From 8415907bf198ab875d60bc90af89d512f48a031c Mon Sep 17 00:00:00 2001 From: natxocc Date: Thu, 7 May 2026 16:50:25 +0200 Subject: [PATCH] Update --- ag-grid/dist/package/main.esm.mjs | 4 +- bun.lock | 11 +- dist/sigpro-grid.esm.js | 77737 ++++++++++++++++++++++++++++ dist/sigpro-grid.esm.min.js | 275 +- dist/sigpro-grid.min.js | 70 - index.js | 53 +- package.json | 19 +- sigpro.js | 433 + 8 files changed, 78292 insertions(+), 310 deletions(-) create mode 100644 dist/sigpro-grid.esm.js delete mode 100644 dist/sigpro-grid.min.js create mode 100644 sigpro.js diff --git a/ag-grid/dist/package/main.esm.mjs b/ag-grid/dist/package/main.esm.mjs index 3e47fd7..1a909f2 100644 --- a/ag-grid/dist/package/main.esm.mjs +++ b/ag-grid/dist/package/main.esm.mjs @@ -509,10 +509,10 @@ var GridLicenseManager = class extends BeanStub { return this.licenseManager.getWatermarkMessage(); } static setLicenseKey(licenseKey) { - LicenseManager.setLicenseKey(licenseKey); + } static setChartsLicenseManager(chartsLicenseManager) { - LicenseManager.setChartsLicenseManager(chartsLicenseManager); + } }; diff --git a/bun.lock b/bun.lock index 039e7c0..dc91670 100644 --- a/bun.lock +++ b/bun.lock @@ -7,12 +7,7 @@ "dependencies": { "ag-grid-community": "^35.2.0", "ag-grid-enterprise": "^35.2.0", - }, - "devDependencies": { - "sigpro-ui": "^1.2.6", - }, - "peerDependencies": { - "sigpro": "^1.2.28", + "sigpro": "git+http://gitea:3000/natxocc/sigpro", }, }, }, @@ -31,8 +26,6 @@ "ag-grid-enterprise": ["ag-grid-enterprise@35.2.1", "", { "dependencies": { "ag-grid-community": "35.2.1" }, "optionalDependencies": { "ag-charts-community": "13.2.1", "ag-charts-enterprise": "13.2.1" } }, "sha512-nLl06cc7/THzf7mGZt7PotdeaBN74X3K9g2looyvJEymrOOJfjrLePrV4aNNhz/WZnATkbyblm5DM/qv3BeHKA=="], - "sigpro": ["sigpro@1.2.28", "", {}, "sha512-4fz70tNpLdgyreLweEuORdlTqvegCrjohgU6wHtil7+ItjSMsu2u0+1ICE06xsybgReCi+YCkGndwukwBLfMHA=="], - - "sigpro-ui": ["sigpro-ui@1.2.6", "", {}, "sha512-I0HP4yGJ5wtVYTDd2Ig6Wqk7iUV8hlaq3DO7KZIG8ZKmZMRMWAaBzz5i4gFelY5hfpcwo0wJk7KVFYVbaXZXsg=="], + "sigpro": ["sigpro@git+http://gitea:3000/natxocc/sigpro#ab0e6e06974308b28cc54229cf0301ab81d7c132", {}, "ab0e6e06974308b28cc54229cf0301ab81d7c132"], } } diff --git a/dist/sigpro-grid.esm.js b/dist/sigpro-grid.esm.js new file mode 100644 index 0000000..366f2ed --- /dev/null +++ b/dist/sigpro-grid.esm.js @@ -0,0 +1,77737 @@ +// index.js +import { h, watch, onUnmount } from "sigpro"; + +// node_modules/ag-grid-community/dist/package/main.esm.mjs +function _last(arr) { + if (!arr?.length) { + return; + } + return arr[arr.length - 1]; +} +function _areEqual(a, b, comparator) { + if (a === b) { + return true; + } + if (!a || !b) { + return a == null && b == null; + } + const len = a.length; + if (len !== b.length) { + return false; + } + for (let i = 0;i < len; i++) { + if (a[i] !== b[i] && !comparator?.(a[i], b[i])) { + return false; + } + } + return true; +} +function _forAll(array, callback) { + if (!array) { + return; + } + for (const value of array) { + if (callback(value)) { + return true; + } + } +} +function _removeFromArray(array, object) { + const index = array.indexOf(object); + if (index >= 0) { + array.splice(index, 1); + } +} +function _removeAllFromArray(array, elementsToRemove) { + let i = 0; + let j = 0; + for (;i < array.length; i++) { + if (!elementsToRemove.includes(array[i])) { + array[j] = array[i]; + j++; + } + } + while (j < array.length) { + array.pop(); + } +} +function _moveInArray(array, objectsToMove, toIndex) { + for (let i = 0;i < objectsToMove.length; i++) { + _removeFromArray(array, objectsToMove[i]); + } + for (let i = objectsToMove.length - 1;i >= 0; i--) { + array.splice(toIndex, 0, objectsToMove[i]); + } +} +var _makeNull = (value) => { + if (value == null || value === "") { + return null; + } + return value; +}; +function _exists(value) { + return value != null && value !== ""; +} +function _missing(value) { + return !_exists(value); +} +var _toStringOrNull = (value) => { + return value != null && typeof value.toString === "function" ? value.toString() : null; +}; +var _jsonEquals = (val1, val2) => { + const val1Json = val1 ? JSON.stringify(val1) : null; + const val2Json = val2 ? JSON.stringify(val2) : null; + return val1Json === val2Json; +}; +var _defaultComparator = (valueA, valueB, accentedCompare = false) => { + if (valueA == null) { + return valueB == null ? 0 : -1; + } + if (valueB == null) { + return 1; + } + if (typeof valueA === "object" && valueA.toNumber) { + valueA = valueA.toNumber(); + } + if (typeof valueB === "object" && valueB.toNumber) { + valueB = valueB.toNumber(); + } + if (!accentedCompare || typeof valueA !== "string") { + if (valueA > valueB) { + return 1; + } + if (valueA < valueB) { + return -1; + } + return 0; + } + return valueA.localeCompare(valueB); +}; +var LocalEventService = class { + constructor() { + this.allSyncListeners = /* @__PURE__ */ new Map; + this.allAsyncListeners = /* @__PURE__ */ new Map; + this.globalSyncListeners = /* @__PURE__ */ new Set; + this.globalAsyncListeners = /* @__PURE__ */ new Set; + this.asyncFunctionsQueue = []; + this.scheduled = false; + this.firedEvents = {}; + } + setFrameworkOverrides(frameworkOverrides) { + this.frameworkOverrides = frameworkOverrides; + } + getListeners(eventType, async, autoCreateListenerCollection) { + const listenerMap = async ? this.allAsyncListeners : this.allSyncListeners; + let listeners = listenerMap.get(eventType); + if (!listeners && autoCreateListenerCollection) { + listeners = /* @__PURE__ */ new Set; + listenerMap.set(eventType, listeners); + } + return listeners; + } + noRegisteredListenersExist() { + return this.allSyncListeners.size === 0 && this.allAsyncListeners.size === 0 && this.globalSyncListeners.size === 0 && this.globalAsyncListeners.size === 0; + } + addEventListener(eventType, listener, async = false) { + this.getListeners(eventType, async, true).add(listener); + } + removeEventListener(eventType, listener, async = false) { + const listeners = this.getListeners(eventType, async, false); + if (!listeners) { + return; + } + listeners.delete(listener); + if (listeners.size === 0) { + (async ? this.allAsyncListeners : this.allSyncListeners).delete(eventType); + } + } + addGlobalListener(listener, async = false) { + this.getGlobalListeners(async).add(listener); + } + removeGlobalListener(listener, async = false) { + this.getGlobalListeners(async).delete(listener); + } + dispatchEvent(event) { + this.dispatchToListeners(event, true); + this.dispatchToListeners(event, false); + this.firedEvents[event.type] = true; + } + dispatchEventOnce(event) { + if (!this.firedEvents[event.type]) { + this.dispatchEvent(event); + } + } + dispatchToListeners(event, async) { + const eventType = event.type; + if (async && "event" in event) { + const browserEvent = event.event; + if (browserEvent instanceof Event) { + event.eventPath = browserEvent.composedPath(); + } + } + const { frameworkOverrides } = this; + const runCallback = (func) => { + const callback = frameworkOverrides ? () => frameworkOverrides.wrapIncoming(func) : func; + if (async) { + this.dispatchAsync(callback); + } else { + callback(); + } + }; + const originalListeners = this.getListeners(eventType, async, false); + if ((originalListeners?.size ?? 0) > 0) { + const listeners = new Set(originalListeners); + for (const listener of listeners) { + if (!originalListeners?.has(listener)) { + continue; + } + runCallback(() => listener(event)); + } + } + const globalListenersSrc = this.getGlobalListeners(async); + if (globalListenersSrc.size > 0) { + const globalListeners = new Set(globalListenersSrc); + for (const listener of globalListeners) { + runCallback(() => listener(eventType, event)); + } + } + } + getGlobalListeners(async) { + return async ? this.globalAsyncListeners : this.globalSyncListeners; + } + dispatchAsync(func) { + this.asyncFunctionsQueue.push(func); + if (!this.scheduled) { + const flush = () => { + window.setTimeout(this.flushAsyncQueue.bind(this), 0); + }; + const frameworkOverrides = this.frameworkOverrides; + if (frameworkOverrides) { + frameworkOverrides.wrapIncoming(flush); + } else { + flush(); + } + this.scheduled = true; + } + } + flushAsyncQueue() { + this.scheduled = false; + const queueCopy = this.asyncFunctionsQueue.slice(); + this.asyncFunctionsQueue = []; + for (const func of queueCopy) { + func(); + } + } +}; +var reUnescapedHtml = /[&<>"']/g; +var HTML_ESCAPES = { + "&": "&", + "<": "<", + ">": ">", + '"': """, + "'": "'" +}; +function _toString(toEscape) { + return toEscape?.toString().toString() ?? null; +} +function _escapeString(toEscape) { + return _toString(toEscape)?.replace(reUnescapedHtml, (chr) => HTML_ESCAPES[chr]) ?? null; +} +function _isExpressionString(value) { + return typeof value === "string" && value.startsWith("=") && value.length > 1; +} +function _camelCaseToHumanText(camelCase) { + if (!camelCase || camelCase == null) { + return null; + } + const rex = /([a-z])([A-Z])/g; + const rexCaps = /([A-Z]+)([A-Z])([a-z])/g; + const words = camelCase.replace(rex, "$1 $2").replace(rexCaps, "$1 $2$3").replace(/\./g, " ").split(" "); + return words.map((word) => word.substring(0, 1).toUpperCase() + (word.length > 1 ? word.substring(1, word.length) : "")).join(" "); +} +function _getRootNode(beans) { + return beans.eRootDiv.getRootNode(); +} +function _getActiveDomElement(beans) { + return _getRootNode(beans).activeElement; +} +function _getDocument(beans) { + const { gos, eRootDiv } = beans; + let result = null; + const optionsGetDocument = gos.get("getDocument"); + if (optionsGetDocument && _exists(optionsGetDocument)) { + result = optionsGetDocument(); + } else if (eRootDiv) { + result = eRootDiv.ownerDocument; + } + if (result && _exists(result)) { + return result; + } + return document; +} +function _isNothingFocused(beans) { + const activeEl = _getActiveDomElement(beans); + return activeEl === null || activeEl === _getDocument(beans).body; +} +function _getWindow(beans) { + const eDocument = _getDocument(beans); + return eDocument.defaultView || window; +} +function _getPageBody(beans) { + let rootNode = null; + let targetEl = null; + try { + rootNode = _getDocument(beans).fullscreenElement; + } catch (e) {} finally { + if (!rootNode) { + rootNode = _getRootNode(beans); + } + const body = rootNode.querySelector("body"); + if (body) { + targetEl = body; + } else if (rootNode instanceof ShadowRoot) { + targetEl = rootNode; + } else if (rootNode instanceof Document) { + targetEl = rootNode?.documentElement; + } else { + targetEl = rootNode; + } + } + return targetEl; +} +function _getBodyWidth(beans) { + const body = _getPageBody(beans); + return body?.clientWidth ?? (window.innerWidth || -1); +} +function _getBodyHeight(beans) { + const body = _getPageBody(beans); + return body?.clientHeight ?? (window.innerHeight || -1); +} +function _toggleAriaAttribute(element, attribute, value) { + if (value == null || typeof value === "string" && value == "") { + _removeAriaAttribute(element, attribute); + } else { + _setAriaAttribute(element, attribute, value); + } +} +function _setAriaAttribute(element, attribute, value) { + element.setAttribute(_ariaAttributeName(attribute), value.toString()); +} +function _removeAriaAttribute(element, attribute) { + element.removeAttribute(_ariaAttributeName(attribute)); +} +function _ariaAttributeName(attribute) { + return `aria-${attribute}`; +} +function _setAriaRole(element, role) { + if (role) { + element.setAttribute("role", role); + } else { + element.removeAttribute("role"); + } +} +function _getAriaSortState(directionOrDef) { + const direction = directionOrDef?.direction; + if (direction === "asc") { + return "ascending"; + } else if (direction === "desc") { + return "descending"; + } else if (direction === "mixed") { + return "other"; + } + return "none"; +} +function _getAriaPosInSet(element) { + return Number.parseInt(element.getAttribute("aria-posinset"), 10); +} +function _getAriaLabel(element) { + return element.getAttribute("aria-label"); +} +function _setAriaLabel(element, label) { + _toggleAriaAttribute(element, "label", label); +} +function _setAriaLabelledBy(element, labelledBy) { + _toggleAriaAttribute(element, "labelledby", labelledBy); +} +function _setAriaDescribedBy(element, describedby) { + _toggleAriaAttribute(element, "describedby", describedby); +} +function _setAriaLive(element, live) { + _toggleAriaAttribute(element, "live", live); +} +function _setAriaAtomic(element, atomic) { + _toggleAriaAttribute(element, "atomic", atomic); +} +function _setAriaRelevant(element, relevant) { + _toggleAriaAttribute(element, "relevant", relevant); +} +function _setAriaInvalid(element, invalid) { + _toggleAriaAttribute(element, "invalid", invalid); +} +function _setAriaLevel(element, level) { + _toggleAriaAttribute(element, "level", level); +} +function _setAriaDisabled(element, disabled) { + _toggleAriaAttribute(element, "disabled", disabled); +} +function _setAriaHidden(element, hidden) { + _toggleAriaAttribute(element, "hidden", hidden); +} +function _setAriaExpanded(element, expanded) { + _setAriaAttribute(element, "expanded", expanded); +} +function _removeAriaExpanded(element) { + _removeAriaAttribute(element, "expanded"); +} +function _setAriaSetSize(element, setsize) { + _setAriaAttribute(element, "setsize", setsize); +} +function _setAriaPosInSet(element, position) { + _setAriaAttribute(element, "posinset", position); +} +function _setAriaMultiSelectable(element, multiSelectable) { + _setAriaAttribute(element, "multiselectable", multiSelectable); +} +function _setAriaRowCount(element, rowCount) { + _setAriaAttribute(element, "rowcount", rowCount); +} +function _setAriaRowIndex(element, rowIndex) { + _setAriaAttribute(element, "rowindex", rowIndex); +} +function _setAriaColCount(element, colCount) { + _setAriaAttribute(element, "colcount", colCount); +} +function _setAriaColIndex(element, colIndex) { + _setAriaAttribute(element, "colindex", colIndex); +} +function _setAriaColSpan(element, colSpan) { + _setAriaAttribute(element, "colspan", colSpan); +} +function _setAriaSort(element, sort) { + _setAriaAttribute(element, "sort", sort); +} +function _removeAriaSort(element) { + _removeAriaAttribute(element, "sort"); +} +function _setAriaSelected(element, selected) { + _toggleAriaAttribute(element, "selected", selected); +} +function _setAriaChecked(element, checked) { + _setAriaAttribute(element, "checked", checked === undefined ? "mixed" : checked); +} +function _setAriaControls(controllerElement, controlledId) { + _toggleAriaAttribute(controllerElement, "controls", controlledId); +} +function _setAriaControlsAndLabel(controllerElement, controlledElement) { + _setAriaControls(controllerElement, controlledElement.id); + _setAriaLabelledBy(controlledElement, controllerElement.id); +} +function _setAriaOwns(ownerElement, ownedId) { + _toggleAriaAttribute(ownerElement, "owns", ownedId); +} +function _setAriaHasPopup(element, hasPopup) { + _toggleAriaAttribute(element, "haspopup", hasPopup === false ? null : hasPopup); +} +function _getAriaCheckboxStateName(translate, state) { + return state === undefined ? translate("ariaIndeterminate", "indeterminate") : state === true ? translate("ariaChecked", "checked") : translate("ariaUnchecked", "unchecked"); +} +function _radioCssClass(element, elementClass, otherElementClass) { + const parent = element.parentElement; + let sibling = parent && parent.firstChild; + while (sibling) { + if (elementClass) { + sibling.classList.toggle(elementClass, sibling === element); + } + if (otherElementClass) { + sibling.classList.toggle(otherElementClass, sibling !== element); + } + sibling = sibling.nextSibling; + } +} +var FOCUSABLE_SELECTOR = "[tabindex], input, select, button, textarea, [href]"; +var FOCUSABLE_EXCLUDE = "[disabled], .ag-disabled:not(.ag-button), .ag-disabled *"; +function _isFocusableFormField(element) { + if (!element) { + return false; + } + const isFocusable = element.matches("input, select, button, textarea"); + if (!isFocusable) { + return false; + } + const isNotFocusable = element.matches(FOCUSABLE_EXCLUDE); + if (!isNotFocusable) { + return false; + } + return _isVisible(element); +} +function _setDisplayed(element, displayed, options = {}) { + const { skipAriaHidden } = options; + element.classList.toggle("ag-hidden", !displayed); + if (!skipAriaHidden) { + _setAriaHidden(element, !displayed); + } +} +function _setVisible(element, visible, options = {}) { + const { skipAriaHidden } = options; + element.classList.toggle("ag-invisible", !visible); + if (!skipAriaHidden) { + _setAriaHidden(element, !visible); + } +} +function _setDisabled(element, disabled) { + const attributeName = "disabled"; + const addOrRemoveDisabledAttribute = disabled ? (e) => e.setAttribute(attributeName, "") : (e) => e.removeAttribute(attributeName); + addOrRemoveDisabledAttribute(element); + const inputs = element.querySelectorAll("input") ?? []; + for (const input of inputs) { + addOrRemoveDisabledAttribute(input); + } +} +function _isElementChildOfClass(element, cls, maxNest) { + let counter = 0; + while (element) { + if (element.classList.contains(cls)) { + return true; + } + element = element.parentElement; + if (typeof maxNest == "number") { + if (++counter > maxNest) { + break; + } + } else if (element === maxNest) { + break; + } + } + return false; +} +function _getElementSize(el) { + const { + height, + width, + borderTopWidth, + borderRightWidth, + borderBottomWidth, + borderLeftWidth, + paddingTop, + paddingRight, + paddingBottom, + paddingLeft, + marginTop, + marginRight, + marginBottom, + marginLeft, + boxSizing + } = window.getComputedStyle(el); + const pf = Number.parseFloat; + return { + height: pf(height || "0"), + width: pf(width || "0"), + borderTopWidth: pf(borderTopWidth || "0"), + borderRightWidth: pf(borderRightWidth || "0"), + borderBottomWidth: pf(borderBottomWidth || "0"), + borderLeftWidth: pf(borderLeftWidth || "0"), + paddingTop: pf(paddingTop || "0"), + paddingRight: pf(paddingRight || "0"), + paddingBottom: pf(paddingBottom || "0"), + paddingLeft: pf(paddingLeft || "0"), + marginTop: pf(marginTop || "0"), + marginRight: pf(marginRight || "0"), + marginBottom: pf(marginBottom || "0"), + marginLeft: pf(marginLeft || "0"), + boxSizing + }; +} +function _getInnerHeight(el) { + const size = _getElementSize(el); + if (size.boxSizing === "border-box") { + return size.height - size.paddingTop - size.paddingBottom - size.borderTopWidth - size.borderBottomWidth; + } + return size.height; +} +function _getInnerWidth(el) { + const size = _getElementSize(el); + if (size.boxSizing === "border-box") { + return size.width - size.paddingLeft - size.paddingRight - size.borderLeftWidth - size.borderRightWidth; + } + return size.width; +} +function _getAbsoluteHeight(el) { + const { height, marginBottom, marginTop } = _getElementSize(el); + return Math.floor(height + marginBottom + marginTop); +} +function _getAbsoluteWidth(el) { + const { width, marginLeft, marginRight } = _getElementSize(el); + return Math.floor(width + marginLeft + marginRight); +} +function _getElementRectWithOffset(el) { + const offsetElementRect = el.getBoundingClientRect(); + const { borderTopWidth, borderLeftWidth, borderRightWidth, borderBottomWidth } = _getElementSize(el); + return { + top: offsetElementRect.top + (borderTopWidth || 0), + left: offsetElementRect.left + (borderLeftWidth || 0), + right: offsetElementRect.right + (borderRightWidth || 0), + bottom: offsetElementRect.bottom + (borderBottomWidth || 0) + }; +} +function _getScrollLeft(element, rtl) { + let scrollLeft = element.scrollLeft; + if (rtl) { + scrollLeft = Math.abs(scrollLeft); + } + return scrollLeft; +} +function _setScrollLeft(element, value, rtl) { + if (rtl) { + value *= -1; + } + element.scrollLeft = value; +} +function _clearElement(el) { + while (el?.firstChild) { + el.firstChild.remove(); + } +} +function _removeFromParent(node) { + if (node?.parentNode) { + node.remove(); + } +} +function _isInDOM(element) { + return !!element.offsetParent; +} +function _isVisible(element) { + if (element.checkVisibility) { + return element.checkVisibility({ checkVisibilityCSS: true }); + } + const isHidden = !_isInDOM(element) || window.getComputedStyle(element).visibility !== "visible"; + return !isHidden; +} +function _loadTemplate(template) { + const tempDiv = document.createElement("div"); + tempDiv.innerHTML = (template || "").trim(); + return tempDiv.firstChild; +} +function _ensureDomOrder(eContainer, eChild, eChildBefore) { + if (eChildBefore && eChildBefore.nextSibling === eChild) { + return; + } + if (!eContainer.firstChild) { + eContainer.appendChild(eChild); + } else if (eChildBefore) { + if (eChildBefore.nextSibling) { + eContainer.insertBefore(eChild, eChildBefore.nextSibling); + } else { + eContainer.appendChild(eChild); + } + } else if (eContainer.firstChild && eContainer.firstChild !== eChild) { + eContainer.prepend(eChild); + } +} +function _setDomChildOrder(eContainer, orderedChildren) { + for (let i = 0;i < orderedChildren.length; i++) { + const correctCellAtIndex = orderedChildren[i]; + const actualCellAtIndex = eContainer.children[i]; + if (actualCellAtIndex !== correctCellAtIndex) { + eContainer.insertBefore(correctCellAtIndex, actualCellAtIndex); + } + } +} +function _camelCaseToHyphenated(camelCase) { + return camelCase.replace(/[A-Z]/g, (s) => `-${s.toLocaleLowerCase()}`); +} +function _addStylesToElement(eElement, styles) { + if (!styles) { + return; + } + for (const key of Object.keys(styles)) { + const value = styles[key]; + if (!key?.length || value == null) { + continue; + } + const parsedKey = _camelCaseToHyphenated(key); + const valueAsString = value.toString(); + const parsedValue = valueAsString.replace(/\s*!important/g, ""); + const priority = parsedValue.length != valueAsString.length ? "important" : undefined; + eElement.style.setProperty(parsedKey, parsedValue, priority); + } +} +function _isElementOverflowingCallback(getElement2) { + return () => { + const element = getElement2(); + if (!element) { + return true; + } + return _isHorizontalScrollShowing(element) || _isVerticalScrollShowing(element); + }; +} +function _isHorizontalScrollShowing(element) { + return element.clientWidth < element.scrollWidth; +} +function _isVerticalScrollShowing(element) { + return element.clientHeight < element.scrollHeight; +} +function _setElementWidth(element, width) { + if (width === "flex") { + element.style.removeProperty("width"); + element.style.removeProperty("minWidth"); + element.style.removeProperty("maxWidth"); + element.style.flex = "1 1 auto"; + } else { + _setFixedWidth(element, width); + } +} +function _setFixedWidth(element, width) { + width = _formatSize(width); + element.style.width = width; + element.style.maxWidth = width; + element.style.minWidth = width; +} +function _setFixedHeight(element, height) { + height = _formatSize(height); + element.style.height = height; + element.style.maxHeight = height; + element.style.minHeight = height; +} +function _formatSize(size) { + return typeof size === "number" ? `${size}px` : size; +} +function _isNodeOrElement(o) { + return o instanceof Node || o instanceof HTMLElement; +} +function _addOrRemoveAttribute(element, name, value) { + if (value == null || value === "") { + element.removeAttribute(name); + } else { + element.setAttribute(name, value.toString()); + } +} +function _placeCaretAtEnd(beans, contentElement) { + if (!contentElement.isContentEditable) { + return; + } + const selection = _getWindow(beans).getSelection(); + if (!selection) { + return; + } + const range = _getDocument(beans).createRange(); + range.selectNodeContents(contentElement); + range.collapse(false); + selection.removeAllRanges(); + selection.addRange(range); +} +function _observeResize(beans, element, callback) { + const win = _getWindow(beans); + const ResizeObserverImpl = win.ResizeObserver; + const resizeObserver = ResizeObserverImpl ? new ResizeObserverImpl(callback) : null; + resizeObserver?.observe(element); + return () => resizeObserver?.disconnect(); +} +function _requestAnimationFrame(beans, callback) { + const win = _getWindow(beans); + if (win.requestAnimationFrame) { + win.requestAnimationFrame(callback); + } else if (win.webkitRequestAnimationFrame) { + win.webkitRequestAnimationFrame(callback); + } else { + win.setTimeout(callback, 0); + } +} +var DataRefAttribute = "data-ref"; +var whitespaceNode; +function getWhitespaceNode() { + whitespaceNode ?? (whitespaceNode = document.createTextNode(" ")); + return whitespaceNode.cloneNode(); +} +function _createAgElement(params) { + const { attrs, children, cls, ref, role, tag } = params; + const element = document.createElement(tag); + if (cls) { + element.className = cls; + } + if (ref) { + element.setAttribute(DataRefAttribute, ref); + } + if (role) { + element.setAttribute("role", role); + } + if (attrs) { + for (const key of Object.keys(attrs)) { + element.setAttribute(key, attrs[key]); + } + } + if (children) { + if (typeof children === "string") { + element.textContent = children; + } else { + let addFirstWhitespace = true; + for (const child of children) { + if (child) { + if (typeof child === "string") { + element.appendChild(document.createTextNode(child)); + addFirstWhitespace = false; + } else if (typeof child === "function") { + element.appendChild(child()); + } else { + if (addFirstWhitespace) { + element.appendChild(getWhitespaceNode()); + addFirstWhitespace = false; + } + element.append(_createAgElement(child)); + element.appendChild(getWhitespaceNode()); + } + } + } + } + } + return element; +} +var PASSIVE_EVENTS = ["touchstart", "touchend", "touchmove", "touchcancel", "scroll"]; +var NON_PASSIVE_EVENTS = ["wheel"]; +var supports = {}; +var _isEventSupported = /* @__PURE__ */ (() => { + const tags = { + select: "input", + change: "input", + submit: "form", + reset: "form", + error: "img", + load: "img", + abort: "img" + }; + const eventChecker = (eventName) => { + if (typeof supports[eventName] === "boolean") { + return supports[eventName]; + } + const el = document.createElement(tags[eventName] || "div"); + eventName = "on" + eventName; + return supports[eventName] = eventName in el; + }; + return eventChecker; +})(); +function _isElementInEventPath(element, event) { + if (!event || !element) { + return false; + } + return _getEventPath(event).indexOf(element) >= 0; +} +function _createEventPath(event) { + const res = []; + let pointer = event.target; + while (pointer) { + res.push(pointer); + pointer = pointer.parentElement; + } + return res; +} +function _getEventPath(event) { + const eventNoType = event; + if (eventNoType.path) { + return eventNoType.path; + } + if (eventNoType.composedPath) { + return eventNoType.composedPath(); + } + return _createEventPath(eventNoType); +} +function _addSafePassiveEventListener(eElement, event, listener) { + const passive = getPassiveStateForEvent(event); + let options; + if (passive != null) { + options = { passive }; + } + eElement.addEventListener(event, listener, options); +} +var getPassiveStateForEvent = (event) => { + const isPassive = PASSIVE_EVENTS.includes(event); + const isNonPassive = NON_PASSIVE_EVENTS.includes(event); + if (isPassive) { + return true; + } + if (isNonPassive) { + return false; + } +}; +function _areEventsNear(e1, e2, pixelCount) { + if (pixelCount === 0) { + return false; + } + const diffX = Math.abs(e1.clientX - e2.clientX); + const diffY = Math.abs(e1.clientY - e2.clientY); + return Math.max(diffX, diffY) <= pixelCount; +} +var _getFirstActiveTouch = (touch, touchList) => { + const identifier = touch.identifier; + for (let i = 0, len = touchList.length;i < len; ++i) { + const item = touchList[i]; + if (item.identifier === identifier) { + return item; + } + } + return null; +}; +function _isEventFromThisInstance(beans, event) { + return beans.gos.isElementInThisInstance(event.target); +} +function _anchorElementToMouseMoveEvent(element, mouseMoveEvent, beans) { + const eRect = element.getBoundingClientRect(); + const height = eRect.height; + const browserWidth = _getBodyWidth(beans) - 2; + const browserHeight = _getBodyHeight(beans) - 2; + const offsetParent = element.offsetParent; + if (!offsetParent) { + return; + } + const offsetParentSize = _getElementRectWithOffset(element.offsetParent); + const { clientY, clientX } = mouseMoveEvent; + let top = clientY - offsetParentSize.top - height / 2; + let left = clientX - offsetParentSize.left - 10; + const eDocument = _getDocument(beans); + const win = eDocument.defaultView || window; + const windowScrollY = win.pageYOffset || eDocument.documentElement.scrollTop; + const windowScrollX = win.pageXOffset || eDocument.documentElement.scrollLeft; + if (browserWidth > 0 && left + element.clientWidth > browserWidth + windowScrollX) { + left = browserWidth + windowScrollX - element.clientWidth; + } + if (left < 0) { + left = 0; + } + if (browserHeight > 0 && top + element.clientHeight > browserHeight + windowScrollY) { + top = browserHeight + windowScrollY - element.clientHeight; + } + if (top < 0) { + top = 0; + } + element.style.left = `${left}px`; + element.style.top = `${top}px`; +} +var addTempEventHandlers = (list, ...handlers) => { + for (const handler of handlers) { + const [target, type, eventListener, options] = handler; + target.addEventListener(type, eventListener, options); + list.push(handler); + } +}; +var clearTempEventHandlers = (list) => { + if (list) { + for (const [target, type, listener, options] of list) { + target.removeEventListener(type, listener, options); + } + list.length = 0; + } +}; +var preventEventDefault = (event) => { + if (event.cancelable) { + event.preventDefault(); + } +}; +function defaultLocaleTextFunc(_key, defaultValue) { + return defaultValue; +} +function _getLocaleTextFunc(localeSvc) { + return localeSvc?.getLocaleTextFunc() ?? defaultLocaleTextFunc; +} +function _translate(bean, localeValues, key, variableValues) { + const defaultValue = localeValues[key]; + return bean.getLocaleTextFunc()(key, typeof defaultValue === "function" ? defaultValue(variableValues) : defaultValue, variableValues); +} +var AgBeanStub = class { + constructor() { + this.destroyFunctions = []; + this.destroyed = false; + this.__v_skip = true; + this.propertyListenerId = 0; + this.lastChangeSetIdLookup = {}; + this.isAlive = () => !this.destroyed; + } + preWireBeans(beans) { + this.beans = beans; + this.stubContext = beans.context; + this.eventSvc = beans.eventSvc; + this.gos = beans.gos; + } + destroy() { + const { destroyFunctions } = this; + for (let i = 0;i < destroyFunctions.length; i++) { + destroyFunctions[i](); + } + destroyFunctions.length = 0; + this.destroyed = true; + this.dispatchLocalEvent({ type: "destroyed" }); + } + addEventListener(eventType, listener, async) { + if (!this.localEventService) { + this.localEventService = new LocalEventService; + } + this.localEventService.addEventListener(eventType, listener, async); + } + removeEventListener(eventType, listener, async) { + this.localEventService?.removeEventListener(eventType, listener, async); + } + dispatchLocalEvent(event) { + this.localEventService?.dispatchEvent(event); + } + addManagedElementListeners(object, handlers) { + return this._setupListeners(object, handlers); + } + addManagedEventListeners(handlers) { + return this._setupListeners(this.eventSvc, handlers); + } + addManagedListeners(object, handlers) { + return this._setupListeners(object, handlers); + } + _setupListeners(object, handlers) { + const destroyFuncs = []; + for (const k of Object.keys(handlers)) { + const handler = handlers[k]; + if (handler) { + destroyFuncs.push(this._setupListener(object, k, handler)); + } + } + return destroyFuncs; + } + _setupListener(object, event, listener) { + if (this.destroyed) { + return () => null; + } + let destroyFunc; + if (isAgEventEmitter(object)) { + object.__addEventListener(event, listener); + destroyFunc = () => { + object.__removeEventListener(event, listener); + return null; + }; + } else { + const objIsEventService = isEventService(object); + if (object instanceof HTMLElement) { + _addSafePassiveEventListener(object, event, listener); + } else if (objIsEventService) { + object.addListener(event, listener); + } else { + object.addEventListener(event, listener); + } + destroyFunc = objIsEventService ? () => { + object.removeListener(event, listener); + return null; + } : () => { + object.removeEventListener(event, listener); + return null; + }; + } + this.destroyFunctions.push(destroyFunc); + return () => { + destroyFunc(); + this.destroyFunctions = this.destroyFunctions.filter((fn) => fn !== destroyFunc); + return null; + }; + } + setupPropertyListener(event, listener) { + const { gos } = this; + gos.addPropertyEventListener(event, listener); + const destroyFunc = () => { + gos.removePropertyEventListener(event, listener); + return null; + }; + this.destroyFunctions.push(destroyFunc); + return () => { + destroyFunc(); + this.destroyFunctions = this.destroyFunctions.filter((fn) => fn !== destroyFunc); + return null; + }; + } + addManagedPropertyListener(event, listener) { + if (this.destroyed) { + return () => null; + } + return this.setupPropertyListener(event, listener); + } + addManagedPropertyListeners(events, listener) { + if (this.destroyed) { + return; + } + const eventsKey = events.join("-") + this.propertyListenerId++; + const wrappedListener = (event) => { + if (event.changeSet) { + if (event.changeSet && event.changeSet.id === this.lastChangeSetIdLookup[eventsKey]) { + return; + } + this.lastChangeSetIdLookup[eventsKey] = event.changeSet.id; + } + const propertiesChangeEvent = { + type: "propertyChanged", + changeSet: event.changeSet, + source: event.source + }; + listener(propertiesChangeEvent); + }; + for (const event of events) { + this.setupPropertyListener(event, wrappedListener); + } + } + getLocaleTextFunc() { + return _getLocaleTextFunc(this.beans.localeSvc); + } + addDestroyFunc(func) { + if (this.isAlive()) { + this.destroyFunctions.push(func); + } else { + func(); + } + } + createOptionalManagedBean(bean, context) { + return bean ? this.createManagedBean(bean, context) : undefined; + } + createManagedBean(bean, context) { + const res = this.createBean(bean, context); + this.addDestroyFunc(this.destroyBean.bind(this, bean, context)); + return res; + } + createBean(bean, context, afterPreCreateCallback) { + return (context || this.stubContext).createBean(bean, afterPreCreateCallback); + } + destroyBean(bean, context) { + return (context || this.stubContext).destroyBean(bean); + } + destroyBeans(beans, context) { + return (context || this.stubContext).destroyBeans(beans); + } +}; +function isAgEventEmitter(object) { + return object.__addEventListener !== undefined; +} +function isEventService(object) { + return object.eventServiceType === "global"; +} +var BeanStub = class extends AgBeanStub { +}; +var doOnceSet = /* @__PURE__ */ new Set; +var _doOnce = (func, key) => { + if (!doOnceSet.has(key)) { + doOnceSet.add(key); + func(); + } +}; +_doOnce._set = doOnceSet; +var batchedCallsSetTimeout = { + pending: false, + funcs: [] +}; +var batchedCallsRaf = { + pending: false, + funcs: [] +}; +function _batchCall(func, mode = "setTimeout", beans) { + const batch = mode === "raf" ? batchedCallsRaf : batchedCallsSetTimeout; + batch.funcs.push(func); + if (batch.pending) { + return; + } + batch.pending = true; + const runBatch = () => { + const funcsCopy = batch.funcs.slice(); + batch.funcs.length = 0; + batch.pending = false; + for (const func2 of funcsCopy) { + func2(); + } + }; + if (mode === "raf") { + _requestAnimationFrame(beans, runBatch); + } else { + window.setTimeout(runBatch, 0); + } +} +function _debounce(bean, func, delay) { + let timeout; + return function(...args) { + const context = this; + window.clearTimeout(timeout); + timeout = window.setTimeout(function() { + if (bean.isAlive()) { + func.apply(context, args); + } + }, delay); + return timeout; + }; +} +function _throttle(func, wait) { + let previousCall = 0; + return function(...args) { + const context = this; + const currentCall = Date.now(); + if (currentCall - previousCall < wait) { + return; + } + previousCall = currentCall; + func.apply(context, args); + }; +} +function _waitUntil(bean, condition, callback, timeout = 100) { + const timeStamp = Date.now(); + let interval = null; + let executed = false; + const clearWait = () => { + if (interval != null) { + window.clearInterval(interval); + interval = null; + } + }; + bean.addDestroyFunc(clearWait); + const internalCallback = () => { + const reachedTimeout = Date.now() - timeStamp > timeout; + if (condition() || reachedTimeout) { + callback(); + executed = true; + clearWait(); + } + }; + internalCallback(); + if (!executed) { + interval = window.setInterval(internalCallback, 10); + } +} +var SKIP_JS_BUILTINS = /* @__PURE__ */ new Set(["__proto__", "constructor", "prototype"]); +function _iterateObject(object, callback) { + if (object == null) { + return; + } + if (Array.isArray(object)) { + for (let i = 0;i < object.length; i++) { + callback(i.toString(), object[i]); + } + return; + } + for (const key of Object.keys(object).filter((key2) => !SKIP_JS_BUILTINS.has(key2))) { + callback(key, object[key]); + } +} +function _mergeDeep(dest, source, copyUndefined = true, makeCopyOfSimpleObjects = false) { + if (!_exists(source)) { + return; + } + _iterateObject(source, (key, sourceValue) => { + let destValue = dest[key]; + if (destValue === sourceValue) { + return; + } + if (makeCopyOfSimpleObjects) { + const objectIsDueToBeCopied = destValue == null && sourceValue != null; + if (objectIsDueToBeCopied) { + const doNotCopyAsSourceIsSimpleObject = typeof sourceValue === "object" && sourceValue.constructor === Object; + if (doNotCopyAsSourceIsSimpleObject) { + destValue = {}; + dest[key] = destValue; + } + } + } + if (_isNonNullObject(sourceValue) && _isNonNullObject(destValue) && !Array.isArray(destValue)) { + _mergeDeep(destValue, sourceValue, copyUndefined, makeCopyOfSimpleObjects); + } else if (copyUndefined || sourceValue !== undefined) { + dest[key] = sourceValue; + } + }); +} +function _isNonNullObject(value) { + return typeof value === "object" && value !== null; +} +var _GlobalGridOptions = class _GlobalGridOptions2 { + static applyGlobalGridOptions(providedOptions) { + if (!_GlobalGridOptions2.gridOptions) { + return { ...providedOptions }; + } + let mergedGridOps = {}; + _mergeDeep(mergedGridOps, _GlobalGridOptions2.gridOptions, true, true); + if (_GlobalGridOptions2.mergeStrategy === "deep") { + _mergeDeep(mergedGridOps, providedOptions, true, true); + } else { + mergedGridOps = { ...mergedGridOps, ...providedOptions }; + } + if (_GlobalGridOptions2.gridOptions.context) { + mergedGridOps.context = _GlobalGridOptions2.gridOptions.context; + } + if (providedOptions.context) { + if (_GlobalGridOptions2.mergeStrategy === "deep" && mergedGridOps.context) { + _mergeDeep(providedOptions.context, mergedGridOps.context, true, true); + } + mergedGridOps.context = providedOptions.context; + } + return mergedGridOps; + } + static applyGlobalGridOption(optionKey, providedValue) { + if (_GlobalGridOptions2.mergeStrategy === "deep") { + const globalValue = _getGlobalGridOption(optionKey); + if (globalValue && typeof globalValue === "object" && typeof providedValue === "object") { + return _GlobalGridOptions2.applyGlobalGridOptions({ [optionKey]: providedValue })[optionKey]; + } + } + return providedValue; + } +}; +_GlobalGridOptions.gridOptions = undefined; +_GlobalGridOptions.mergeStrategy = "shallow"; +var GlobalGridOptions = _GlobalGridOptions; +function _getGlobalGridOption(gridOption) { + return GlobalGridOptions.gridOptions?.[gridOption]; +} +var GRID_OPTION_DEFAULTS = { + suppressContextMenu: false, + preventDefaultOnContextMenu: false, + allowContextMenuWithControlKey: false, + suppressMenuHide: true, + enableBrowserTooltips: false, + tooltipTrigger: "hover", + tooltipShowDelay: 2000, + tooltipSwitchShowDelay: 200, + tooltipHideDelay: 1e4, + tooltipMouseTrack: false, + tooltipShowMode: "standard", + tooltipInteraction: false, + copyHeadersToClipboard: false, + copyGroupHeadersToClipboard: false, + clipboardDelimiter: "\t", + suppressCopyRowsToClipboard: false, + suppressCopySingleCellRanges: false, + suppressLastEmptyLineOnPaste: false, + suppressClipboardPaste: false, + suppressClipboardApi: false, + suppressCutToClipboard: false, + maintainColumnOrder: false, + enableStrictPivotColumnOrder: false, + suppressFieldDotNotation: false, + allowDragFromColumnsToolPanel: false, + suppressMovableColumns: false, + suppressColumnMoveAnimation: false, + suppressMoveWhenColumnDragging: false, + suppressDragLeaveHidesColumns: false, + suppressRowGroupHidesColumns: false, + suppressAutoSize: false, + autoSizePadding: 20, + skipHeaderOnAutoSize: false, + singleClickEdit: false, + suppressClickEdit: false, + readOnlyEdit: false, + stopEditingWhenCellsLoseFocus: false, + enterNavigatesVertically: false, + enterNavigatesVerticallyAfterEdit: false, + enableCellEditingOnBackspace: false, + undoRedoCellEditing: false, + undoRedoCellEditingLimit: 10, + suppressCsvExport: false, + suppressExcelExport: false, + cacheQuickFilter: false, + includeHiddenColumnsInQuickFilter: false, + excludeChildrenWhenTreeDataFiltering: false, + enableAdvancedFilter: false, + includeHiddenColumnsInAdvancedFilter: false, + enableCharts: false, + masterDetail: false, + keepDetailRows: false, + keepDetailRowsCount: 10, + detailRowAutoHeight: false, + tabIndex: 0, + rowBuffer: 10, + valueCache: false, + valueCacheNeverExpires: false, + enableCellExpressions: false, + suppressTouch: false, + suppressFocusAfterRefresh: false, + suppressBrowserResizeObserver: false, + suppressPropertyNamesCheck: false, + suppressChangeDetection: false, + debug: false, + suppressLoadingOverlay: false, + suppressNoRowsOverlay: false, + pagination: false, + paginationPageSize: 100, + paginationPageSizeSelector: true, + paginationAutoPageSize: false, + paginateChildRows: false, + suppressPaginationPanel: false, + pivotMode: false, + pivotPanelShow: "never", + pivotDefaultExpanded: 0, + pivotSuppressAutoColumn: false, + suppressExpandablePivotGroups: false, + functionsReadOnly: false, + suppressAggFuncInHeader: false, + alwaysAggregateAtRootLevel: false, + aggregateOnlyChangedColumns: false, + suppressAggFilteredOnly: false, + removePivotHeaderRowWhenSingleValueColumn: false, + animateRows: true, + cellFlashDuration: 500, + cellFadeDuration: 1000, + allowShowChangeAfterFilter: false, + domLayout: "normal", + ensureDomOrder: false, + enableRtl: false, + suppressColumnVirtualisation: false, + suppressMaxRenderedRowRestriction: false, + suppressRowVirtualisation: false, + rowDragManaged: false, + refreshAfterGroupEdit: false, + rowDragInsertDelay: 500, + suppressRowDrag: false, + suppressMoveWhenRowDragging: false, + rowDragEntireRow: false, + rowDragMultiRow: false, + embedFullWidthRows: false, + groupDisplayType: "singleColumn", + groupDefaultExpanded: 0, + groupMaintainOrder: false, + groupSelectsChildren: false, + groupSuppressBlankHeader: false, + groupSelectsFiltered: false, + showOpenedGroup: false, + groupRemoveSingleChildren: false, + groupRemoveLowestSingleChildren: false, + groupHideOpenParents: false, + groupHideColumnsUntilExpanded: false, + groupAllowUnbalanced: false, + rowGroupPanelShow: "never", + suppressMakeColumnVisibleAfterUnGroup: false, + treeData: false, + rowGroupPanelSuppressSort: false, + suppressGroupRowsSticky: false, + rowModelType: "clientSide", + asyncTransactionWaitMillis: 50, + suppressModelUpdateAfterUpdateTransaction: false, + cacheOverflowSize: 1, + infiniteInitialRowCount: 1, + serverSideInitialRowCount: 1, + cacheBlockSize: 100, + maxBlocksInCache: -1, + maxConcurrentDatasourceRequests: 2, + blockLoadDebounceMillis: 0, + purgeClosedRowNodes: false, + serverSideSortAllLevels: false, + serverSideOnlyRefreshFilteredGroups: false, + serverSidePivotResultFieldSeparator: "_", + viewportRowModelPageSize: 5, + viewportRowModelBufferSize: 5, + alwaysShowHorizontalScroll: false, + alwaysShowVerticalScroll: false, + debounceVerticalScrollbar: false, + suppressHorizontalScroll: false, + suppressScrollOnNewData: false, + suppressScrollWhenPopupsAreOpen: false, + suppressAnimationFrame: false, + suppressMiddleClickScrolls: false, + suppressPreventDefaultOnMouseWheel: false, + rowMultiSelectWithClick: false, + suppressRowDeselection: false, + suppressRowClickSelection: false, + suppressCellFocus: false, + suppressHeaderFocus: false, + suppressMultiRangeSelection: false, + enableCellTextSelection: false, + enableRangeSelection: false, + enableRangeHandle: false, + enableFillHandle: false, + fillHandleDirection: "xy", + suppressClearOnFillReduction: false, + accentedSort: false, + unSortIcon: false, + suppressMultiSort: false, + alwaysMultiSort: false, + suppressMaintainUnsortedOrder: false, + suppressRowHoverHighlight: false, + suppressRowTransform: false, + columnHoverHighlight: false, + deltaSort: false, + enableGroupEdit: false, + groupLockGroupColumns: 0, + serverSideEnableClientSideSort: false, + suppressServerSideFullWidthLoadingRow: false, + pivotMaxGeneratedColumns: -1, + columnMenu: "new", + reactiveCustomComponents: true, + suppressSetFilterByDefault: false, + enableFilterHandlers: false +}; +var BASE_URL = "https://www.ag-grid.com"; +function _logIfDebug(gos, message, ...args) { + if (gos.get("debug")) { + console.log("AG Grid: " + message, ...args); + } +} +function _warnOnce(msg, ...args) { + _doOnce(() => _consoleWarn(msg, ...args), msg + args?.join("")); +} +function _errorOnce(msg, ...args) { + _doOnce(() => _consoleError(msg, ...args), msg + args?.join("")); +} +function _consoleError(msg, ...args) { + console.error("AG Grid: " + msg, ...args); +} +function _consoleWarn(msg, ...args) { + console.warn("AG Grid: " + msg, ...args); +} +var allRegisteredModules = /* @__PURE__ */ new Set; +var globalModulesMap = {}; +var gridModulesMap = {}; +var currentModuleVersion; +var userHasRegistered = false; +var areGridScopedModules = false; +var isUmd = false; +function isValidModuleVersion(module) { + const [moduleMajor, moduleMinor] = module.version.split(".") || []; + const [currentModuleMajor, currentModuleMinor] = currentModuleVersion.split(".") || []; + return moduleMajor === currentModuleMajor && moduleMinor === currentModuleMinor; +} +function runVersionChecks(module) { + if (!currentModuleVersion) { + currentModuleVersion = module.version; + } + const errorMsg = (details) => `You are using incompatible versions of AG Grid modules. Major and minor versions should always match across modules. ${details} Please update all modules to the same version.`; + if (!module.version) { + _errorOnce(errorMsg(`'${module.moduleName}' is incompatible.`)); + } else if (!isValidModuleVersion(module)) { + _errorOnce(errorMsg(`'${module.moduleName}' is version ${module.version} but the other modules are version ${currentModuleVersion}.`)); + } + const result = module.validate?.(); + if (result && !result.isValid) { + _errorOnce(`${result.message}`); + } +} +function _registerModule(module, gridId, isInternalRegistration = false) { + if (!isInternalRegistration) { + userHasRegistered = true; + } + runVersionChecks(module); + const rowModels = module.rowModels ?? ["all"]; + allRegisteredModules.add(module); + let moduleStore; + if (gridId !== undefined) { + areGridScopedModules = true; + if (gridModulesMap[gridId] === undefined) { + gridModulesMap[gridId] = {}; + } + moduleStore = gridModulesMap[gridId]; + } else { + moduleStore = globalModulesMap; + } + for (const rowModel of rowModels) { + if (moduleStore[rowModel] === undefined) { + moduleStore[rowModel] = {}; + } + moduleStore[rowModel][module.moduleName] = module; + } + if (module.dependsOn) { + for (const dependency of module.dependsOn) { + _registerModule(dependency, gridId, isInternalRegistration); + } + } +} +function _unRegisterGridModules(gridId) { + delete gridModulesMap[gridId]; +} +function _isModuleRegistered(moduleName, gridId, rowModel) { + const isRegisteredForRowModel = (model) => !!globalModulesMap[model]?.[moduleName] || !!gridModulesMap[gridId]?.[model]?.[moduleName]; + return isRegisteredForRowModel(rowModel) || isRegisteredForRowModel("all"); +} +function _areModulesGridScoped() { + return areGridScopedModules; +} +function _getRegisteredModules(gridId, rowModel) { + const gridModules = gridModulesMap[gridId] ?? {}; + return [ + ...Object.values(globalModulesMap["all"] ?? {}), + ...Object.values(gridModules["all"] ?? {}), + ...Object.values(globalModulesMap[rowModel] ?? {}), + ...Object.values(gridModules[rowModel] ?? {}) + ]; +} +function _getAllRegisteredModules() { + return new Set(allRegisteredModules); +} +function _getGridRegisteredModules(gridId, rowModel) { + const gridModules = gridModulesMap[gridId] ?? {}; + return [...Object.values(gridModules["all"] ?? {}), ...Object.values(gridModules[rowModel] ?? {})]; +} +function _hasUserRegistered() { + return userHasRegistered; +} +function _isUmd() { + return isUmd; +} +var ModuleRegistry = class { + static register(module) { + _registerModule(module, undefined); + } + static registerModules(modules) { + for (const module of modules) { + _registerModule(module, undefined); + } + } +}; +var VERSION = "35.2.1"; +var MAX_URL_LENGTH = 2000; +var MIN_PARAM_LENGTH = 100; +var VERSION_PARAM_NAME = "_version_"; +var getConsoleMessage = null; +var baseDocLink = `${BASE_URL}/javascript-data-grid`; +function provideValidationServiceLogger(logger) { + getConsoleMessage = logger; +} +function setValidationDocLink(docLink) { + baseDocLink = docLink; +} +function getErrorParts(id, args, defaultMessage) { + return getConsoleMessage?.(id, args) ?? [minifiedLog(id, args, defaultMessage)]; +} +function getMsgOrDefault(logger, id, args, isWarning, defaultMessage) { + logger(`${isWarning ? "warning" : "error"} #${id}`, ...getErrorParts(id, args, defaultMessage)); +} +function stringifyObject(inputObj) { + if (!inputObj) { + return String(inputObj); + } + const object = {}; + for (const prop of Object.keys(inputObj)) { + if (typeof inputObj[prop] !== "object" && typeof inputObj[prop] !== "function") { + object[prop] = inputObj[prop]; + } + } + return JSON.stringify(object); +} +function stringifyValue(value) { + let output = value; + if (value instanceof Error) { + output = value.toString(); + } else if (typeof value === "object") { + output = stringifyObject(value); + } + return output; +} +function toStringWithNullUndefined(str) { + return str === undefined ? "undefined" : str === null ? "null" : str; +} +function getParamsUrl(baseUrl, params) { + return `${baseUrl}?${params.toString()}`; +} +function truncateUrl(baseUrl, params, maxLength) { + const sortedParams = Array.from(params.entries()).sort((a, b) => b[1].length - a[1].length); + let url = getParamsUrl(baseUrl, params); + for (const [key, value] of sortedParams) { + if (key === VERSION_PARAM_NAME) { + continue; + } + const excessLength = url.length - maxLength; + if (excessLength <= 0) { + break; + } + const ellipse = "..."; + const truncateAmount = excessLength + ellipse.length; + const truncatedValue = value.length - truncateAmount > MIN_PARAM_LENGTH ? value.slice(0, value.length - truncateAmount) + ellipse : value.slice(0, MIN_PARAM_LENGTH) + ellipse; + params.set(key, truncatedValue); + url = getParamsUrl(baseUrl, params); + } + return url; +} +function getErrorLink(errorNum, args) { + const params = new URLSearchParams; + params.append(VERSION_PARAM_NAME, VERSION); + if (args) { + for (const key of Object.keys(args)) { + params.append(key, stringifyValue(args[key])); + } + } + const baseUrl = `${baseDocLink}/errors/${errorNum}`; + const url = getParamsUrl(baseUrl, params); + return url.length <= MAX_URL_LENGTH ? url : truncateUrl(baseUrl, params, MAX_URL_LENGTH); +} +var minifiedLog = (errorNum, args, defaultMessage) => { + const errorLink = getErrorLink(errorNum, args); + const prefix = `${defaultMessage ? defaultMessage + ` +` : ""}Visit ${errorLink}`; + if (_isUmd()) { + return prefix; + } + return `${prefix}${defaultMessage ? "" : ` + Alternatively register the ValidationModule to see the full message in the console.`}`; +}; +function _warn(...args) { + getMsgOrDefault(_warnOnce, args[0], args[1], true); +} +function _error(...args) { + getMsgOrDefault(_errorOnce, args[0], args[1], false); +} +function _logPreInitErr(id, args, defaultMessage) { + getMsgOrDefault(_errorOnce, id, args, false, defaultMessage); +} +function _logPreInitWarn(id, args, defaultMessage) { + getMsgOrDefault(_warnOnce, id, args, true, defaultMessage); +} +function getErrMsg(defaultMessage, args) { + const id = args[0]; + return `error #${id} ` + getErrorParts(id, args[1], defaultMessage).join(" "); +} +function _errMsg(...args) { + return getErrMsg(undefined, args); +} +function isRowModelType(gos, rowModelType) { + return gos.get("rowModelType") === rowModelType; +} +function _isClientSideRowModel(gos, rowModel) { + return isRowModelType(gos, "clientSide"); +} +function _isServerSideRowModel(gos, rowModel) { + return isRowModelType(gos, "serverSide"); +} +function _isDomLayout(gos, domLayout) { + return gos.get("domLayout") === domLayout; +} +function _isRowSelection(gos) { + return _getRowSelectionMode(gos) !== undefined; +} +function _isGetRowHeightFunction(gos) { + return typeof gos.get("getRowHeight") === "function"; +} +function _shouldMaintainColumnOrder(gos, isPivotColumns) { + if (isPivotColumns) { + return !gos.get("enableStrictPivotColumnOrder"); + } + return gos.get("maintainColumnOrder"); +} +function _isRowNumbers({ gos, formula }) { + const rowNumbers = gos.get("rowNumbers"); + return rowNumbers || !!formula?.active && rowNumbers !== false; +} +function _getRowHeightForNode(beans, rowNode, allowEstimate = false, defaultRowHeight) { + const { gos, environment } = beans; + if (defaultRowHeight == null) { + defaultRowHeight = environment.getDefaultRowHeight(); + } + if (_isGetRowHeightFunction(gos)) { + if (allowEstimate) { + return { height: defaultRowHeight, estimated: true }; + } + const params = { + node: rowNode, + data: rowNode.data + }; + const height = gos.getCallback("getRowHeight")(params); + if (isNumeric(height)) { + if (height === 0) { + _warn(23); + } + return { height: Math.max(1, height), estimated: false }; + } + } + if (rowNode.detail && gos.get("masterDetail")) { + return getMasterDetailRowHeight(gos); + } + const gridOptionsRowHeight = gos.get("rowHeight"); + const rowHeight = gridOptionsRowHeight && isNumeric(gridOptionsRowHeight) ? gridOptionsRowHeight : defaultRowHeight; + return { height: rowHeight, estimated: false }; +} +function getMasterDetailRowHeight(gos) { + if (gos.get("detailRowAutoHeight")) { + return { height: 1, estimated: false }; + } + const defaultRowHeight = gos.get("detailRowHeight"); + if (isNumeric(defaultRowHeight)) { + return { height: defaultRowHeight, estimated: false }; + } + return { height: 300, estimated: false }; +} +function _getRowHeightAsNumber(beans) { + const { environment, gos } = beans; + const gridOptionsRowHeight = gos.get("rowHeight"); + if (!gridOptionsRowHeight || _missing(gridOptionsRowHeight)) { + return environment.getDefaultRowHeight(); + } + const rowHeight = environment.refreshRowHeightVariable(); + if (rowHeight !== -1) { + return rowHeight; + } + _warn(24); + return environment.getDefaultRowHeight(); +} +function isNumeric(value) { + return !isNaN(value) && typeof value === "number" && isFinite(value); +} +function _getDomData(gos, element, key) { + const domData = element[gos.getDomDataKey()]; + return domData ? domData[key] : undefined; +} +function _setDomData(gos, element, key, value) { + const domDataKey = gos.getDomDataKey(); + let domData = element[domDataKey]; + if (_missing(domData)) { + domData = {}; + element[domDataKey] = domData; + } + domData[key] = value; +} +function _isAnimateRows(gos) { + if (gos.get("ensureDomOrder")) { + return false; + } + return gos.get("animateRows"); +} +function _isGroupRowsSticky(gos) { + return !(gos.get("paginateChildRows") || gos.get("groupHideOpenParents") || _isDomLayout(gos, "print")); +} +function _isColumnsSortingCoupledToGroup(gos) { + const autoGroupColumnDef = gos.get("autoGroupColumnDef"); + return !autoGroupColumnDef?.comparator && !gos.get("treeData"); +} +function _getGroupAggFiltering(gos) { + const userValue = gos.get("groupAggFiltering"); + if (typeof userValue === "function") { + return gos.getCallback("groupAggFiltering"); + } + if (userValue === true) { + return () => true; + } + return; +} +function _getGrandTotalRow(gos) { + return gos.get("grandTotalRow"); +} +function _getGroupTotalRowCallback(gos) { + const userValue = gos.get("groupTotalRow"); + if (typeof userValue === "function") { + return gos.getCallback("groupTotalRow"); + } + return () => userValue ?? undefined; +} +function _isGroupMultiAutoColumn(gos) { + const isHideOpenParents = !!gos.get("groupHideOpenParents"); + if (isHideOpenParents) { + return true; + } + return gos.get("groupDisplayType") === "multipleColumns"; +} +function _isGroupHideColumnsUntilExpanded(gos) { + return _isGroupMultiAutoColumn(gos) && gos.get("groupHideColumnsUntilExpanded") && _isClientSideRowModel(gos); +} +function _isGroupUseEntireRow(gos, pivotMode) { + if (pivotMode) { + return false; + } + return gos.get("groupDisplayType") === "groupRows"; +} +function _isFullWidthGroupRow(gos, node, pivotMode) { + return !!node.group && !node.footer && _isGroupUseEntireRow(gos, pivotMode); +} +function _getRowIdCallback(gos) { + const getRowId = gos.getCallback("getRowId"); + if (getRowId === undefined) { + return getRowId; + } + return (params) => { + let id = getRowId(params); + if (typeof id !== "string") { + _doOnce(() => _warn(25, { id }), "getRowIdString"); + id = String(id); + } + return id; + }; +} +function _canSkipShowingRowGroup(gos, node) { + const isSkippingGroups = gos.get("groupHideParentOfSingleChild"); + if (isSkippingGroups === true) { + return true; + } + if (isSkippingGroups === "leafGroupsOnly" && node.leafGroup) { + return true; + } + if (gos.get("groupRemoveSingleChildren")) { + return true; + } + if (gos.get("groupRemoveLowestSingleChildren") && node.leafGroup) { + return true; + } + return false; +} +function _shouldUpdateColVisibilityAfterGroup(gos, isGrouped) { + const preventVisibilityChanges = gos.get("suppressGroupChangesColumnVisibility"); + if (preventVisibilityChanges === true) { + return false; + } + if (isGrouped && preventVisibilityChanges === "suppressHideOnGroup") { + return false; + } + if (!isGrouped && preventVisibilityChanges === "suppressShowOnUngroup") { + return false; + } + const legacySuppressOnGroup = gos.get("suppressRowGroupHidesColumns"); + if (isGrouped && legacySuppressOnGroup === true) { + return false; + } + const legacySuppressOnUngroup = gos.get("suppressMakeColumnVisibleAfterUnGroup"); + if (!isGrouped && legacySuppressOnUngroup === true) { + return false; + } + return true; +} +function _getCheckboxes(selection) { + return selection?.checkboxes ?? true; +} +function _getHeaderCheckbox(selection) { + return selection?.mode === "multiRow" && (selection.headerCheckbox ?? true); +} +function _getCheckboxLocation(rowSelection) { + if (typeof rowSelection !== "object") { + return; + } + return rowSelection.checkboxLocation ?? "selectionColumn"; +} +function _getHideDisabledCheckboxes(selection) { + return selection?.hideDisabledCheckboxes ?? false; +} +function _isUsingNewRowSelectionAPI(gos) { + const rowSelection = gos.get("rowSelection"); + return typeof rowSelection !== "string"; +} +function _isUsingNewCellSelectionAPI(gos) { + return gos.get("cellSelection") !== undefined; +} +function _getSuppressMultiRanges(gos) { + const selection = gos.get("cellSelection"); + const useNewAPI = selection !== undefined; + if (!useNewAPI) { + return gos.get("suppressMultiRangeSelection"); + } + return typeof selection !== "boolean" ? selection?.suppressMultiRanges ?? false : false; +} +function _isCellSelectionEnabled(gos) { + const selection = gos.get("cellSelection"); + const useNewAPI = selection !== undefined; + return useNewAPI ? !!selection : gos.get("enableRangeSelection"); +} +function _getFillHandle(gos) { + const selection = gos.get("cellSelection"); + const useNewAPI = selection !== undefined; + if (!useNewAPI) { + return { + mode: "fill", + setFillValue: gos.get("fillOperation"), + direction: gos.get("fillHandleDirection"), + suppressClearOnFillReduction: gos.get("suppressClearOnFillReduction") + }; + } + return typeof selection !== "boolean" && selection.handle?.mode === "fill" ? selection.handle : undefined; +} +function _getEnableColumnSelection(gos) { + const cellSelection = gos.get("cellSelection") ?? false; + return (typeof cellSelection === "object" && cellSelection.enableColumnSelection) ?? false; +} +function _getEnableClickSelection(gos) { + const selection = gos.get("rowSelection") ?? "single"; + if (typeof selection === "string") { + const suppressRowClickSelection = gos.get("suppressRowClickSelection"); + const suppressRowDeselection = gos.get("suppressRowDeselection"); + if (suppressRowClickSelection && suppressRowDeselection) { + return false; + } else if (suppressRowClickSelection) { + return "enableDeselection"; + } else if (suppressRowDeselection) { + return "enableSelection"; + } else { + return true; + } + } + return selection.mode === "singleRow" || selection.mode === "multiRow" ? selection.enableClickSelection ?? false : false; +} +function _getEnableSelection(gos) { + const enableClickSelection = _getEnableClickSelection(gos); + return enableClickSelection === true || enableClickSelection === "enableSelection"; +} +function _getEnableDeselection(gos) { + const enableClickSelection = _getEnableClickSelection(gos); + return enableClickSelection === true || enableClickSelection === "enableDeselection"; +} +function _getIsRowSelectable(gos) { + const selection = gos.get("rowSelection"); + if (typeof selection === "string") { + return gos.get("isRowSelectable"); + } + return selection?.isRowSelectable; +} +function _getRowSelectionMode(arg) { + const selection = "beanName" in arg && arg.beanName === "gos" ? arg.get("rowSelection") : arg.rowSelection; + if (typeof selection === "string") { + switch (selection) { + case "multiple": + return "multiRow"; + case "single": + return "singleRow"; + default: + return; + } + } + switch (selection?.mode) { + case "multiRow": + case "singleRow": + return selection.mode; + default: + return; + } +} +function _isMultiRowSelection(arg) { + const mode = _getRowSelectionMode(arg); + return mode === "multiRow"; +} +function _getEnableSelectionWithoutKeys(gos) { + const selection = gos.get("rowSelection"); + if (typeof selection === "string") { + return gos.get("rowMultiSelectWithClick"); + } + return selection?.enableSelectionWithoutKeys ?? false; +} +function _getGroupSelection(gos) { + const selection = gos.get("rowSelection"); + if (typeof selection === "string") { + const groupSelectsChildren = gos.get("groupSelectsChildren"); + const groupSelectsFiltered = gos.get("groupSelectsFiltered"); + if (groupSelectsChildren && groupSelectsFiltered) { + return "filteredDescendants"; + } else if (groupSelectsChildren) { + return "descendants"; + } else { + return "self"; + } + } + return selection?.mode === "multiRow" ? selection.groupSelects : undefined; +} +function _getSelectAll(gos, defaultValue = true) { + const rowSelection = gos.get("rowSelection"); + if (typeof rowSelection !== "object") { + return defaultValue ? "all" : undefined; + } + return rowSelection.mode === "multiRow" ? rowSelection.selectAll : "all"; +} +function _getCtrlASelectsRows(gos) { + const rowSelection = gos.get("rowSelection"); + if (typeof rowSelection === "string") { + return false; + } + return rowSelection?.mode === "multiRow" ? rowSelection.ctrlASelectsRows ?? false : false; +} +function _getGroupSelectsDescendants(gos) { + const groupSelection = _getGroupSelection(gos); + return groupSelection === "descendants" || groupSelection === "filteredDescendants"; +} +function _getMasterSelects(gos) { + const rowSelection = gos.get("rowSelection"); + return typeof rowSelection === "object" && rowSelection.masterSelects || "self"; +} +function _isSetFilterByDefault(gos) { + return gos.isModuleRegistered("SetFilter") && !gos.get("suppressSetFilterByDefault"); +} +function _isLegacyMenuEnabled(gos) { + return gos.get("columnMenu") === "legacy"; +} +function _isColumnMenuAnchoringEnabled(gos) { + return !_isLegacyMenuEnabled(gos); +} +function _getCallbackForEvent(eventName) { + if (!eventName || eventName.length < 2) { + return eventName; + } + return "on" + eventName[0].toUpperCase() + eventName.substring(1); +} +function _addGridCommonParams(gos, params) { + return gos.addCommon(params); +} +function _interpretAsRightClick({ gos }, event) { + return event.button === 2 || event.ctrlKey && gos.get("allowContextMenuWithControlKey"); +} +var COL_DEF_DEFAULTS = { + resizable: true, + sortable: true +}; +var instanceIdSequence = 0; +function getNextColInstanceId() { + return instanceIdSequence++; +} +function isColumn(col) { + return col instanceof AgColumn; +} +var DEFAULT_SORTING_ORDER = ["asc", "desc", null]; +var DEFAULT_ABSOLUTE_SORTING_ORDER = [ + { type: "absolute", direction: "asc" }, + { type: "absolute", direction: "desc" }, + null +]; +var AgColumn = class extends BeanStub { + constructor(colDef, userProvidedColDef, colId, primary) { + super(); + this.colDef = colDef; + this.userProvidedColDef = userProvidedColDef; + this.colId = colId; + this.primary = primary; + this.isColumn = true; + this.instanceId = getNextColInstanceId(); + this.autoHeaderHeight = null; + this.sortDef = _getSortDefFromInput(); + this._wasSortExplicitlyRemoved = false; + this.moving = false; + this.resizing = false; + this.menuVisible = false; + this.formulaRef = null; + this.lastLeftPinned = false; + this.firstRightPinned = false; + this.filterActive = false; + this.colEventSvc = new LocalEventService; + this.tooltipEnabled = false; + this.rowGroupActive = false; + this.pivotActive = false; + this.aggregationActive = false; + this.flex = null; + this.colIdSanitised = _escapeString(colId); + } + destroy() { + super.destroy(); + this.beans.rowSpanSvc?.deregister(this); + } + getInstanceId() { + return this.instanceId; + } + initState() { + const { + colDef, + beans: { sortSvc, pinnedCols, colFlex } + } = this; + sortSvc?.initCol(this); + const hide = colDef.hide; + if (hide !== undefined) { + this.visible = !hide; + } else { + this.visible = !colDef.initialHide; + } + pinnedCols?.initCol(this); + colFlex?.initCol(this); + } + setColDef(colDef, userProvidedColDef, source) { + const colSpanChanged = colDef.spanRows !== this.colDef.spanRows; + this.colDef = colDef; + this.userProvidedColDef = userProvidedColDef; + this.initMinAndMaxWidths(); + this.initDotNotation(); + this.initTooltip(); + if (colSpanChanged) { + this.beans.rowSpanSvc?.deregister(this); + this.initRowSpan(); + } + this.dispatchColEvent("colDefChanged", source); + } + 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() { + const { + gos, + colDef: { field, tooltipField } + } = this; + const suppressDotNotation = gos.get("suppressFieldDotNotation"); + this.fieldContainsDots = _exists(field) && field.includes(".") && !suppressDotNotation; + this.tooltipFieldContainsDots = _exists(tooltipField) && tooltipField.includes(".") && !suppressDotNotation; + } + initMinAndMaxWidths() { + const colDef = this.colDef; + this.minWidth = colDef.minWidth ?? this.beans.environment.getDefaultColumnMinWidth(); + this.maxWidth = colDef.maxWidth ?? Number.MAX_SAFE_INTEGER; + } + initTooltip() { + this.beans.tooltipSvc?.initCol(this); + } + initRowSpan() { + if (this.colDef.spanRows) { + this.beans.rowSpanSvc?.register(this); + } + } + addPivotListener() { + const pivotColDefSvc = this.beans.pivotColDefSvc; + const pivotValueColumn = this.colDef.pivotValueColumn; + if (!pivotColDefSvc || !pivotValueColumn) { + return; + } + this.addManagedListeners(pivotValueColumn, { + colDefChanged: (evt) => { + const colDef = pivotColDefSvc.recreateColDef(this.colDef); + this.setColDef(colDef, colDef, evt.source); + } + }); + } + resetActualWidth(source) { + const initialWidth = this.calculateColInitialWidth(this.colDef); + this.setActualWidth(initialWidth, source, true); + } + calculateColInitialWidth(colDef) { + const width = colDef.width ?? colDef.initialWidth ?? 200; + return Math.max(Math.min(width, this.maxWidth), this.minWidth); + } + isEmptyGroup() { + return false; + } + isRowGroupDisplayed(colId) { + return this.beans.showRowGroupCols?.isRowGroupDisplayed(this, colId) ?? false; + } + isPrimary() { + return this.primary; + } + isFilterAllowed() { + const filterDefined = !!this.colDef.filter; + return filterDefined; + } + isFieldContainsDots() { + return this.fieldContainsDots; + } + isTooltipEnabled() { + return this.tooltipEnabled; + } + isTooltipFieldContainsDots() { + return this.tooltipFieldContainsDots; + } + getHighlighted() { + return this.highlighted; + } + __addEventListener(eventType, listener) { + this.colEventSvc.addEventListener(eventType, listener); + } + __removeEventListener(eventType, listener) { + this.colEventSvc.removeEventListener(eventType, listener); + } + addEventListener(eventType, userListener) { + this.frameworkEventListenerService = this.beans.frameworkOverrides.createLocalEventListenerWrapper?.(this.frameworkEventListenerService, this.colEventSvc); + const listener = this.frameworkEventListenerService?.wrap(eventType, userListener) ?? userListener; + this.colEventSvc.addEventListener(eventType, listener); + } + removeEventListener(eventType, userListener) { + const listener = this.frameworkEventListenerService?.unwrap(eventType, userListener) ?? userListener; + this.colEventSvc.removeEventListener(eventType, listener); + } + createColumnFunctionCallbackParams(rowNode) { + return _addGridCommonParams(this.gos, { + node: rowNode, + data: rowNode.data, + column: this, + colDef: this.colDef + }); + } + isSuppressNavigable(rowNode) { + return this.beans.cellNavigation?.isSuppressNavigable(this, rowNode) ?? false; + } + isCellEditable(rowNode) { + return this.beans.editSvc?.isCellEditable({ rowNode, column: this }) ?? false; + } + isSuppressFillHandle() { + return !!this.colDef.suppressFillHandle; + } + isAutoHeight() { + return !!this.colDef.autoHeight; + } + isAutoHeaderHeight() { + return !!this.colDef.autoHeaderHeight; + } + isRowDrag(rowNode) { + return this.isColumnFunc(rowNode, this.colDef.rowDrag); + } + isDndSource(rowNode) { + return this.isColumnFunc(rowNode, this.colDef.dndSource); + } + isCellCheckboxSelection(rowNode) { + return this.beans.selectionSvc?.isCellCheckboxSelection(this, rowNode) ?? false; + } + isSuppressPaste(rowNode) { + return this.isColumnFunc(rowNode, this.colDef?.suppressPaste ?? null); + } + isResizable() { + return !!this.getColDefValue("resizable"); + } + getColDefValue(key) { + return this.colDef[key] ?? COL_DEF_DEFAULTS[key]; + } + isColumnFunc(rowNode, value) { + if (typeof value === "boolean") { + return value; + } + if (typeof value === "function") { + const params = this.createColumnFunctionCallbackParams(rowNode); + const editableFunc = value; + return editableFunc(params); + } + return false; + } + createColumnEvent(type, source) { + return _addGridCommonParams(this.gos, { + type, + column: this, + columns: [this], + source + }); + } + isMoving() { + return this.moving; + } + getSort() { + return this.sortDef.direction; + } + getSortDef() { + if (!this.sortDef.direction) { + return null; + } + return this.sortDef; + } + getColDefAllowedSortTypes() { + const res = []; + const { sort, initialSort } = this.colDef; + const colDefSortType = sort === null ? sort : _normalizeSortType(sort?.type); + const colDefInitialSortType = initialSort === null ? initialSort : _normalizeSortType(initialSort?.type); + if (colDefSortType) { + res.push(colDefSortType); + } + if (colDefInitialSortType) { + res.push(colDefInitialSortType); + } + return res; + } + getSortingOrder() { + const defaultSortingOrder = this.getColDefAllowedSortTypes().includes("absolute") ? DEFAULT_ABSOLUTE_SORTING_ORDER : DEFAULT_SORTING_ORDER; + return (this.colDef.sortingOrder ?? this.gos.get("sortingOrder") ?? defaultSortingOrder).map((objOrDirection) => _getSortDefFromInput(objOrDirection)); + } + getAvailableSortTypes() { + const explicitSortTypesFromSortingOrder = this.getSortingOrder().reduce((acc, so) => { + if (so.direction) { + acc.push(so.type); + } + return acc; + }, this.getColDefAllowedSortTypes()); + return new Set(explicitSortTypesFromSortingOrder); + } + get wasSortExplicitlyRemoved() { + return this._wasSortExplicitlyRemoved; + } + setSortDef(sortDef, initial = false) { + if (!initial) { + this._wasSortExplicitlyRemoved = !sortDef.direction; + } + this.sortDef = sortDef; + } + isSortable() { + return !!this.getColDefValue("sortable"); + } + isSortAscending() { + return this.getSort() === "asc"; + } + isSortDescending() { + return this.getSort() === "desc"; + } + isSortNone() { + return _missing(this.getSort()); + } + isSorting() { + return _exists(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(left, source) { + this.oldLeft = this.left; + if (this.left !== left) { + this.left = left; + this.dispatchColEvent("leftChanged", source); + } + } + isFilterActive() { + return this.filterActive; + } + isHovered() { + _warn(261); + return !!this.beans.colHover?.isHovered(this); + } + setFirstRightPinned(firstRightPinned, source) { + if (this.firstRightPinned !== firstRightPinned) { + this.firstRightPinned = firstRightPinned; + this.dispatchColEvent("firstRightPinnedChanged", source); + } + } + setLastLeftPinned(lastLeftPinned, source) { + if (this.lastLeftPinned !== lastLeftPinned) { + this.lastLeftPinned = lastLeftPinned; + this.dispatchColEvent("lastLeftPinnedChanged", source); + } + } + 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(visible, source) { + const newValue = visible === true; + if (this.visible !== newValue) { + this.visible = newValue; + this.dispatchColEvent("visibleChanged", source); + } + this.dispatchStateUpdatedEvent("hide"); + } + isVisible() { + return this.visible; + } + isSpanHeaderHeight() { + const colDef = this.getColDef(); + return !colDef.suppressSpanHeaderHeight; + } + getFirstRealParent() { + let parent = this.getOriginalParent(); + while (parent?.isPadding()) { + parent = parent.getOriginalParent(); + } + return parent; + } + getColumnGroupPaddingInfo() { + let parent = this.getParent(); + if (!parent?.isPadding()) { + return { numberOfParents: 0, isSpanningTotal: false }; + } + const numberOfParents = parent.getPaddingLevel() + 1; + let isSpanningTotal = true; + while (parent) { + if (!parent.isPadding()) { + isSpanningTotal = false; + break; + } + parent = parent.getParent(); + } + return { numberOfParents, isSpanningTotal }; + } + 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(height) { + const changed = height !== this.autoHeaderHeight; + this.autoHeaderHeight = height; + return changed; + } + createBaseColDefParams(rowNode) { + const params = _addGridCommonParams(this.gos, { + node: rowNode, + data: rowNode.data, + colDef: this.colDef, + column: this + }); + return params; + } + getColSpan(rowNode) { + if (_missing(this.colDef.colSpan)) { + return 1; + } + const params = this.createBaseColDefParams(rowNode); + const colSpan = this.colDef.colSpan(params); + return Math.max(colSpan, 1); + } + getRowSpan(rowNode) { + if (_missing(this.colDef.rowSpan)) { + return 1; + } + const params = this.createBaseColDefParams(rowNode); + const rowSpan = this.colDef.rowSpan(params); + return Math.max(rowSpan, 1); + } + setActualWidth(actualWidth, source, silent = false) { + actualWidth = Math.max(actualWidth, this.minWidth); + actualWidth = Math.min(actualWidth, this.maxWidth); + if (this.actualWidth !== actualWidth) { + this.actualWidth = actualWidth; + if (this.flex != null && source !== "flex" && source !== "gridInitializing") { + this.flex = null; + } + if (!silent) { + this.fireColumnWidthChangedEvent(source); + } + } + this.dispatchStateUpdatedEvent("width"); + } + fireColumnWidthChangedEvent(source) { + this.dispatchColEvent("widthChanged", source); + } + isGreaterThanMax(width) { + return width > 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 === true; + } + isAllowValue() { + return this.colDef.enableValue === true; + } + isAllowRowGroup() { + return this.colDef.enableRowGroup === true; + } + isAllowFormula() { + return this.colDef.allowFormula === true; + } + dispatchColEvent(type, source, additionalEventAttributes) { + const colEvent = this.createColumnEvent(type, source); + if (additionalEventAttributes) { + _mergeDeep(colEvent, additionalEventAttributes); + } + this.colEventSvc.dispatchEvent(colEvent); + } + dispatchStateUpdatedEvent(key) { + this.colEventSvc.dispatchEvent({ + type: "columnStateUpdated", + key + }); + } +}; +function _getSortDefFromInput(input) { + if (_isSortDefValid(input)) { + return { direction: input.direction, type: input.type }; + } + return { direction: _normalizeSortDirection(input), type: _normalizeSortType(input) }; +} +function _isSortDirectionValid(maybeSortDir) { + return maybeSortDir === "asc" || maybeSortDir === "desc" || maybeSortDir === null; +} +function _isSortTypeValid(maybeSortType) { + return maybeSortType === "default" || maybeSortType === "absolute"; +} +function _isSortDefValid(maybeSortDef) { + if (!maybeSortDef || typeof maybeSortDef !== "object") { + return false; + } + const maybeSortDefT = maybeSortDef; + return _isSortTypeValid(maybeSortDefT.type) && _isSortDirectionValid(maybeSortDefT.direction); +} +function _areSortDefsEqual(sortDef1, sortDef2) { + if (!sortDef1) { + return sortDef2 ? sortDef2.direction === null : true; + } + if (!sortDef2) { + return sortDef1 ? sortDef1.direction === null : true; + } + return sortDef1.type === sortDef2.type && sortDef1.direction === sortDef2.direction; +} +function _normalizeSortDirection(sortDirectionLike) { + return _isSortDirectionValid(sortDirectionLike) ? sortDirectionLike : null; +} +function _normalizeSortType(sortTypeLike) { + return _isSortTypeValid(sortTypeLike) ? sortTypeLike : "default"; +} +function _getDisplaySortForColumn(column, beans, getSortDefOverride) { + const overrideSortDef = getSortDefOverride?.(); + const sortDef = overrideSortDef ?? beans.sortSvc.getDisplaySortForColumn(column); + const type = _normalizeSortType(sortDef?.type); + const direction = _normalizeSortDirection(sortDef?.direction); + const allowedSortTypes = column.getAvailableSortTypes(); + const isDefaultSortAllowed = allowedSortTypes.has("default"); + const isAbsoluteSortAllowed = allowedSortTypes.has("absolute"); + const isAbsoluteSort = type === "absolute"; + const isDefaultSort = type === "default"; + const isAscending = direction === "asc"; + const isDescending = direction === "desc"; + return { + isDefaultSortAllowed, + isAbsoluteSortAllowed, + isAbsoluteSort, + isDefaultSort, + isAscending, + isDescending, + direction + }; +} +function isProvidedColumnGroup(col) { + return col instanceof AgProvidedColumnGroup; +} +var AgProvidedColumnGroup = class extends BeanStub { + constructor(colGroupDef, groupId, padding, level) { + super(); + this.colGroupDef = colGroupDef; + this.groupId = groupId; + this.padding = padding; + this.level = level; + this.isColumn = false; + this.expandable = false; + this.instanceId = getNextColInstanceId(); + this.expandableListenerRemoveCallback = null; + this.expanded = !!colGroupDef?.openByDefault; + } + destroy() { + if (this.expandableListenerRemoveCallback) { + this.reset(null, undefined); + } + super.destroy(); + } + reset(colGroupDef, level) { + this.colGroupDef = colGroupDef; + this.level = level; + this.originalParent = null; + if (this.expandableListenerRemoveCallback) { + this.expandableListenerRemoveCallback(); + } + this.children = undefined; + this.expandable = undefined; + } + getInstanceId() { + return this.instanceId; + } + getOriginalParent() { + return this.originalParent; + } + getLevel() { + return this.level; + } + isVisible() { + if (this.children) { + return this.children.some((child) => child.isVisible()); + } + return false; + } + isPadding() { + return this.padding; + } + setExpanded(expanded) { + this.expanded = expanded === undefined ? false : expanded; + this.dispatchLocalEvent({ type: "expandedChanged" }); + } + isExpandable() { + return this.expandable; + } + isExpanded() { + return this.expanded; + } + getGroupId() { + return this.groupId; + } + getId() { + return this.getGroupId(); + } + setChildren(children) { + this.children = children; + } + getChildren() { + return this.children; + } + getColGroupDef() { + return this.colGroupDef; + } + getLeafColumns() { + const result = []; + this.addLeafColumns(result); + return result; + } + forEachLeafColumn(callback) { + if (!this.children) { + return; + } + for (const child of this.children) { + if (isColumn(child)) { + callback(child); + } else if (isProvidedColumnGroup(child)) { + child.forEachLeafColumn(callback); + } + } + } + addLeafColumns(leafColumns) { + if (!this.children) { + return; + } + for (const child of this.children) { + if (isColumn(child)) { + leafColumns.push(child); + } else if (isProvidedColumnGroup(child)) { + child.addLeafColumns(leafColumns); + } + } + } + getColumnGroupShow() { + const colGroupDef = this.colGroupDef; + if (!colGroupDef) { + return; + } + return colGroupDef.columnGroupShow; + } + setupExpandable() { + this.setExpandable(); + if (this.expandableListenerRemoveCallback) { + this.expandableListenerRemoveCallback(); + } + const listener = this.onColumnVisibilityChanged.bind(this); + for (const col of this.getLeafColumns()) { + col.__addEventListener("visibleChanged", listener); + } + this.expandableListenerRemoveCallback = () => { + for (const col of this.getLeafColumns()) { + col.__removeEventListener("visibleChanged", listener); + } + this.expandableListenerRemoveCallback = null; + }; + } + setExpandable() { + if (this.isPadding()) { + return; + } + let atLeastOneShowingWhenOpen = false; + let atLeastOneShowingWhenClosed = false; + let atLeastOneChangeable = false; + const children = this.findChildrenRemovingPadding(); + for (let i = 0, j = children.length;i < j; i++) { + const abstractColumn = children[i]; + if (!abstractColumn.isVisible()) { + continue; + } + const headerGroupShow = abstractColumn.getColumnGroupShow(); + if (headerGroupShow === "open") { + atLeastOneShowingWhenOpen = true; + atLeastOneChangeable = true; + } else if (headerGroupShow === "closed") { + atLeastOneShowingWhenClosed = true; + atLeastOneChangeable = true; + } else { + atLeastOneShowingWhenOpen = true; + atLeastOneShowingWhenClosed = true; + } + } + const expandable = atLeastOneShowingWhenOpen && atLeastOneShowingWhenClosed && atLeastOneChangeable; + if (this.expandable !== expandable) { + this.expandable = expandable; + this.dispatchLocalEvent({ type: "expandableChanged" }); + } + } + findChildrenRemovingPadding() { + const res = []; + const process = (items) => { + for (const item of items) { + const skipBecausePadding = isProvidedColumnGroup(item) && item.isPadding(); + if (skipBecausePadding) { + process(item.children); + } else { + res.push(item); + } + } + }; + process(this.children); + return res; + } + onColumnVisibilityChanged() { + this.setExpandable(); + } +}; +var DefaultColumnTypes = { + numericColumn: { + headerClass: "ag-right-aligned-header", + cellClass: "ag-right-aligned-cell" + }, + rightAligned: { + headerClass: "ag-right-aligned-header", + cellClass: "ag-right-aligned-cell" + } +}; +function createMergedColGroupDef(beans, colGroupDef, groupId) { + const colGroupDefMerged = {}; + const gos = beans.gos; + Object.assign(colGroupDefMerged, gos.get("defaultColGroupDef")); + Object.assign(colGroupDefMerged, colGroupDef); + gos.validateColDef(colGroupDefMerged, groupId); + return colGroupDefMerged; +} +var ColumnKeyCreator = class { + constructor() { + this.existingKeys = {}; + } + addExistingKeys(keys) { + for (let i = 0;i < keys.length; i++) { + this.existingKeys[keys[i]] = true; + } + } + getUniqueKey(colId, colField) { + colId = _toStringOrNull(colId); + let count = 0; + while (true) { + let idToTry = colId ?? colField; + if (idToTry) { + if (count !== 0) { + idToTry += "_" + count; + } + } else { + idToTry = count; + } + if (!this.existingKeys[idToTry]) { + const usedId = String(idToTry); + if (colId && count > 0) { + _warn(273, { providedId: colId, usedId }); + } + this.existingKeys[usedId] = true; + return usedId; + } + count++; + } + } +}; +var depthFirstCallback = (child, parent) => { + if (isProvidedColumnGroup(child)) { + child.setupExpandable(); + } + child.originalParent = parent; +}; +function _createColumnTreeWithIds(beans, defs = null, primaryColumns, existingTree, source) { + const { existingCols, existingGroups } = extractExistingTreeData(existingTree); + const colIdMap = new Map(existingCols.map((col) => [col.getId(), col])); + const colGroupIdMap = new Map(existingGroups.map((group) => [group.getId(), group])); + let maxDepth = 0; + const recursivelyProcessColDef = (def, level) => { + maxDepth = Math.max(maxDepth, level); + if (isColumnGroupDef(def)) { + if (!beans.colGroupSvc) { + return null; + } + const groupId = def.groupId; + const group = colGroupIdMap.get(groupId); + const colGroupDef = createMergedColGroupDef(beans, def, groupId); + const newGroup = new AgProvidedColumnGroup(colGroupDef, groupId, false, level); + beans.context.createBean(newGroup); + if (group) { + newGroup.setExpanded(group.isExpanded()); + } + newGroup.setChildren(def.children.map((child) => recursivelyProcessColDef(child, level + 1))); + return newGroup; + } + const colId = def.colId; + let column = colIdMap.get(colId); + const colDefMerged = _addColumnDefaultAndTypes(beans, def, column?.getColId() ?? colId); + if (!column) { + column = new AgColumn(colDefMerged, def, colId, primaryColumns); + beans.context.createBean(column); + } else { + column.setColDef(colDefMerged, def, source); + _updateColumnState(beans, column, colDefMerged, source); + } + beans.dataTypeSvc?.addColumnListeners(column); + return column; + }; + const root = defs?.map((def) => recursivelyProcessColDef(def, 0)) ?? []; + let counter = 0; + const keyCreator = { + getUniqueKey: (_colId, _field) => String(++counter) + }; + const columnTree = beans.colGroupSvc ? beans.colGroupSvc.balanceColumnTree(root, 0, maxDepth, keyCreator) : root; + depthFirstOriginalTreeSearch(null, columnTree, depthFirstCallback); + return { + columnTree, + treeDepth: maxDepth + }; +} +function _createColumnTree(beans, defs = null, primaryColumns, existingTree, source) { + const columnKeyCreator = new ColumnKeyCreator; + const { existingCols, existingGroups, existingColKeys } = extractExistingTreeData(existingTree); + columnKeyCreator.addExistingKeys(existingColKeys); + const unbalancedTree = _recursivelyCreateColumns(beans, defs, 0, primaryColumns, existingCols, columnKeyCreator, existingGroups, source); + const { colGroupSvc } = beans; + const treeDepth = colGroupSvc?.findMaxDepth(unbalancedTree, 0) ?? 0; + const columnTree = colGroupSvc ? colGroupSvc.balanceColumnTree(unbalancedTree, 0, treeDepth, columnKeyCreator) : unbalancedTree; + depthFirstOriginalTreeSearch(null, columnTree, depthFirstCallback); + return { + columnTree, + treeDepth + }; +} +function extractExistingTreeData(existingTree) { + const existingCols = []; + const existingGroups = []; + const existingColKeys = []; + if (existingTree) { + depthFirstOriginalTreeSearch(null, existingTree, (item) => { + if (isProvidedColumnGroup(item)) { + const group = item; + existingGroups.push(group); + } else { + const col = item; + existingColKeys.push(col.getId()); + existingCols.push(col); + } + }); + } + return { existingCols, existingGroups, existingColKeys }; +} +function _recursivelyCreateColumns(beans, defs, level, primaryColumns, existingColsCopy, columnKeyCreator, existingGroups, source) { + if (!defs) { + return []; + } + const { colGroupSvc } = beans; + const result = new Array(defs.length); + for (let i = 0;i < result.length; i++) { + const def = defs[i]; + if (colGroupSvc && isColumnGroupDef(def)) { + result[i] = colGroupSvc.createProvidedColumnGroup(primaryColumns, def, level, existingColsCopy, columnKeyCreator, existingGroups, source); + } else { + result[i] = createColumn(beans, primaryColumns, def, existingColsCopy, columnKeyCreator, source); + } + } + return result; +} +function createColumn(beans, primaryColumns, colDef, existingColsCopy, columnKeyCreator, source) { + const existingColAndIndex = findExistingColumn(colDef, existingColsCopy); + if (existingColAndIndex) { + existingColsCopy?.splice(existingColAndIndex.idx, 1); + } + let column = existingColAndIndex?.column; + if (!column) { + const colId = columnKeyCreator.getUniqueKey(colDef.colId, colDef.field); + const colDefMerged = _addColumnDefaultAndTypes(beans, colDef, colId); + column = new AgColumn(colDefMerged, colDef, colId, primaryColumns); + beans.context.createBean(column); + } else { + const colDefMerged = _addColumnDefaultAndTypes(beans, colDef, column.getColId()); + column.setColDef(colDefMerged, colDef, source); + _updateColumnState(beans, column, colDefMerged, source); + } + beans.dataTypeSvc?.addColumnListeners(column); + return column; +} +function updateSomeColumnState(beans, column, hide, sort, sortIndex, pinned, flex, source) { + const { sortSvc, pinnedCols, colFlex } = beans; + if (hide !== undefined) { + column.setVisible(!hide, source); + } + if (sortSvc) { + sortSvc.updateColSort(column, sort, source); + if (sortIndex !== undefined) { + sortSvc.setColSortIndex(column, sortIndex); + } + } + if (pinned !== undefined) { + pinnedCols?.setColPinned(column, pinned); + } + if (flex !== undefined) { + colFlex?.setColFlex(column, flex); + } +} +function _updateColumnState(beans, column, colDef, source) { + updateSomeColumnState(beans, column, colDef.hide, colDef.sort, colDef.sortIndex, colDef.pinned, colDef.flex, source); + const colFlex = column.getFlex(); + if (colFlex != null && colFlex > 0) { + return; + } + if (colDef.width != null) { + column.setActualWidth(colDef.width, source); + } else { + const widthBeforeUpdate = column.getActualWidth(); + column.setActualWidth(widthBeforeUpdate, source); + } +} +function findExistingColumn(newColDef, existingColsCopy) { + if (!existingColsCopy) { + return; + } + for (let i = 0;i < existingColsCopy.length; i++) { + const def = existingColsCopy[i].getUserProvidedColDef(); + if (!def) { + continue; + } + const newHasId = newColDef.colId != null; + if (newHasId) { + if (existingColsCopy[i].getId() === newColDef.colId) { + return { idx: i, column: existingColsCopy[i] }; + } + continue; + } + const newHasField = newColDef.field != null; + if (newHasField) { + if (def.field === newColDef.field) { + return { idx: i, column: existingColsCopy[i] }; + } + continue; + } + if (def === newColDef) { + return { idx: i, column: existingColsCopy[i] }; + } + } + return; +} +function _addColumnDefaultAndTypes(beans, colDef, colId, isAutoCol) { + const { gos, dataTypeSvc } = beans; + const res = {}; + const defaultColDef = gos.get("defaultColDef"); + _mergeDeep(res, defaultColDef, false, true); + const columnType = updateColDefAndGetColumnType(beans, res, colDef, colId); + if (columnType) { + assignColumnTypes(beans, columnType, res); + } + const cellDataType = res.cellDataType; + _mergeDeep(res, colDef, false, true); + if (cellDataType !== undefined) { + res.cellDataType = cellDataType; + } + const autoGroupColDef = gos.get("autoGroupColumnDef"); + const isSortingCoupled = _isColumnsSortingCoupledToGroup(gos); + if (colDef.rowGroup && autoGroupColDef && isSortingCoupled) { + _mergeDeep(res, { + sort: autoGroupColDef.sort, + initialSort: autoGroupColDef.initialSort + }, false, true); + } + dataTypeSvc?.postProcess(res); + dataTypeSvc?.validateColDef(res, colDef, defaultColDef, colId); + gos.validateColDef(res, colId, isAutoCol); + return res; +} +function updateColDefAndGetColumnType(beans, colDef, userColDef, colId) { + const dataTypeDefinitionColumnType = beans.dataTypeSvc?.updateColDefAndGetColumnType(colDef, userColDef, colId); + const columnTypes = userColDef.type ?? dataTypeDefinitionColumnType ?? colDef.type; + colDef.type = columnTypes; + return columnTypes ? convertColumnTypes(columnTypes) : undefined; +} +function assignColumnTypes(beans, typeKeys, colDefMerged) { + if (!typeKeys.length) { + return; + } + const allColumnTypes = Object.assign({}, DefaultColumnTypes); + const userTypes = beans.gos.get("columnTypes") || {}; + for (const key of Object.keys(userTypes)) { + const value = userTypes[key]; + if (key in allColumnTypes) { + _warn(34, { key }); + } else { + const colType = value; + if (colType.type) { + _warn(35); + } + allColumnTypes[key] = value; + } + } + for (const t of typeKeys) { + const typeColDef = allColumnTypes[t.trim()]; + if (typeColDef) { + _mergeDeep(colDefMerged, typeColDef, false, true); + } else { + _warn(36, { t }); + } + } +} +function isColumnGroupDef(abstractColDef) { + return abstractColDef.children !== undefined; +} +function depthFirstOriginalTreeSearch(parent, tree, callback) { + if (!tree) { + return; + } + for (let i = 0;i < tree.length; i++) { + const child = tree[i]; + if (isProvidedColumnGroup(child)) { + depthFirstOriginalTreeSearch(child, child.getChildren(), callback); + } + callback(child, parent); + } +} +var GROUP_AUTO_COLUMN_ID = "ag-Grid-AutoColumn"; +var SELECTION_COLUMN_ID = "ag-Grid-SelectionColumn"; +var ROW_NUMBERS_COLUMN_ID = "ag-Grid-RowNumbersColumn"; +var GROUP_HIERARCHY_COLUMN_ID_PREFIX = "ag-Grid-HierarchyColumn"; +function _getColumnsFromTree(rootColumns) { + const result = []; + const recursiveFindColumns = (childColumns) => { + for (let i = 0;i < childColumns.length; i++) { + const child = childColumns[i]; + if (isColumn(child)) { + result.push(child); + } else if (isProvidedColumnGroup(child)) { + recursiveFindColumns(child.getChildren()); + } + } + }; + recursiveFindColumns(rootColumns); + return result; +} +function getWidthOfColsInList(columnList) { + return columnList.reduce((width, col) => width + col.getActualWidth(), 0); +} +function _destroyColumnTree(beans, oldTree, newTree) { + const oldObjectsById = {}; + if (!oldTree) { + return; + } + depthFirstOriginalTreeSearch(null, oldTree, (child) => { + oldObjectsById[child.getInstanceId()] = child; + }); + if (newTree) { + depthFirstOriginalTreeSearch(null, newTree, (child) => { + oldObjectsById[child.getInstanceId()] = null; + }); + } + const colsToDestroy = Object.values(oldObjectsById).filter((item) => item != null); + beans.context.destroyBeans(colsToDestroy); +} +function isColumnGroupAutoCol(col) { + const colId = col.getId(); + return colId.startsWith(GROUP_AUTO_COLUMN_ID); +} +function isColumnSelectionCol(col) { + const id = typeof col === "string" ? col : ("getColId" in col) ? col.getColId() : col.colId; + return id?.startsWith(SELECTION_COLUMN_ID) ?? false; +} +function isRowNumberCol(col) { + const id = typeof col === "string" ? col : ("getColId" in col) ? col.getColId() : col.colId; + return id?.startsWith(ROW_NUMBERS_COLUMN_ID) ?? false; +} +function isSpecialCol(col) { + return isColumnSelectionCol(col) || isRowNumberCol(col); +} +function convertColumnTypes(type) { + let typeKeys = []; + if (type instanceof Array) { + typeKeys = type; + } else if (typeof type === "string") { + typeKeys = type.split(","); + } + return typeKeys; +} +function _areColIdsEqual(colsA, colsB) { + return _areEqual(colsA, colsB, (a, b) => a.getColId() === b.getColId()); +} +function _updateColsMap(cols) { + cols.map = {}; + for (const col of cols.list) { + cols.map[col.getId()] = col; + } +} +function _convertColumnEventSourceType(source) { + return source === "optionsUpdated" ? "gridOptionsChanged" : source; +} +function _columnsMatch(column, key) { + return column === key || column.colId == key || column.getColDef() === key; +} +var getValueFactory = (stateItem, defaultState) => (key1, key2) => { + const obj = { + value1: undefined, + value2: undefined + }; + let calculated = false; + if (stateItem) { + if (stateItem[key1] !== undefined) { + obj.value1 = stateItem[key1]; + calculated = true; + } + if (_exists(key2) && stateItem[key2] !== undefined) { + obj.value2 = stateItem[key2]; + calculated = true; + } + } + if (!calculated && defaultState) { + if (defaultState[key1] !== undefined) { + obj.value1 = defaultState[key1]; + } + if (_exists(key2) && defaultState[key2] !== undefined) { + obj.value2 = defaultState[key2]; + } + } + return obj; +}; +function _getColumnStateFromColDef(colDef, colId) { + const state = { + ...colDef, + sort: undefined, + colId + }; + const sortDef = _getSortDefFromColDef(colDef); + if (sortDef) { + state.sort = sortDef.direction; + state.sortType = sortDef.type; + } + return state; +} +function _getSortDefFromColDef(colDef) { + const { sort, initialSort } = colDef; + const sortIsValid = _isSortDefValid(sort) || _isSortDirectionValid(sort); + const initialSortIsValid = _isSortDefValid(initialSort) || _isSortDirectionValid(initialSort); + if (sortIsValid) { + return _getSortDefFromInput(sort); + } + if (initialSortIsValid) { + return _getSortDefFromInput(initialSort); + } + return null; +} +function createUniqueColumnGroupId(groupId, instanceId) { + return groupId + "_" + instanceId; +} +function isColumnGroup(col) { + return col instanceof AgColumnGroup; +} +var AgColumnGroup = class extends BeanStub { + constructor(providedColumnGroup, groupId, partId, pinned) { + super(); + this.providedColumnGroup = providedColumnGroup; + this.groupId = groupId; + this.partId = partId; + this.pinned = pinned; + this.isColumn = false; + this.displayedChildren = []; + this.autoHeaderHeight = null; + this.parent = null; + this.colIdSanitised = _escapeString(this.getUniqueId()); + } + reset() { + this.parent = null; + this.children = null; + this.displayedChildren = null; + } + getParent() { + return this.parent; + } + getUniqueId() { + return createUniqueColumnGroupId(this.groupId, this.partId); + } + isEmptyGroup() { + return this.displayedChildren.length === 0; + } + isMoving() { + const allLeafColumns = this.getProvidedColumnGroup().getLeafColumns(); + if (!allLeafColumns || allLeafColumns.length === 0) { + return false; + } + return allLeafColumns.every((col) => col.isMoving()); + } + checkLeft() { + for (const child of this.displayedChildren) { + if (isColumnGroup(child)) { + child.checkLeft(); + } + } + if (this.displayedChildren.length > 0) { + if (this.gos.get("enableRtl")) { + const lastChild = _last(this.displayedChildren); + const lastChildLeft = lastChild.getLeft(); + this.setLeft(lastChildLeft); + } else { + const firstChildLeft = this.displayedChildren[0].getLeft(); + this.setLeft(firstChildLeft); + } + } else { + this.setLeft(null); + } + } + getLeft() { + return this.left; + } + getOldLeft() { + return this.oldLeft; + } + setLeft(left) { + this.oldLeft = this.left; + if (this.left !== left) { + this.left = left; + this.dispatchLocalEvent({ type: "leftChanged" }); + } + } + getPinned() { + return this.pinned; + } + getGroupId() { + return this.groupId; + } + getPartId() { + return this.partId; + } + getActualWidth() { + let groupActualWidth = 0; + for (const child of this.displayedChildren ?? []) { + groupActualWidth += child.getActualWidth(); + } + return groupActualWidth; + } + isResizable() { + if (!this.displayedChildren) { + return false; + } + let result = false; + for (const child of this.displayedChildren) { + if (child.isResizable()) { + result = true; + } + } + return result; + } + getMinWidth() { + let result = 0; + for (const groupChild of this.displayedChildren) { + result += groupChild.getMinWidth(); + } + return result; + } + addChild(child) { + if (!this.children) { + this.children = []; + } + this.children.push(child); + } + getDisplayedChildren() { + return this.displayedChildren; + } + getLeafColumns() { + const result = []; + this.addLeafColumns(result); + return result; + } + getDisplayedLeafColumns() { + const result = []; + this.addDisplayedLeafColumns(result); + return result; + } + 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(expanded) { + this.providedColumnGroup.setExpanded(expanded); + } + isAutoHeaderHeight() { + return !!this.getColGroupDef()?.autoHeaderHeight; + } + getAutoHeaderHeight() { + return this.autoHeaderHeight; + } + setAutoHeaderHeight(height) { + const changed = height !== this.autoHeaderHeight; + this.autoHeaderHeight = height; + return changed; + } + addDisplayedLeafColumns(leafColumns) { + for (const child of this.displayedChildren ?? []) { + if (isColumn(child)) { + leafColumns.push(child); + } else if (isColumnGroup(child)) { + child.addDisplayedLeafColumns(leafColumns); + } + } + } + addLeafColumns(leafColumns) { + for (const child of this.children ?? []) { + if (isColumn(child)) { + leafColumns.push(child); + } else if (isColumnGroup(child)) { + child.addLeafColumns(leafColumns); + } + } + } + getChildren() { + return this.children; + } + getColumnGroupShow() { + return this.providedColumnGroup.getColumnGroupShow(); + } + getProvidedColumnGroup() { + return this.providedColumnGroup; + } + getPaddingLevel() { + const parent = this.getParent(); + if (!this.isPadding() || !parent?.isPadding()) { + return 0; + } + return 1 + parent.getPaddingLevel(); + } + calculateDisplayedColumns() { + this.displayedChildren = []; + let parentWithExpansion = this; + while (parentWithExpansion?.isPadding()) { + parentWithExpansion = parentWithExpansion.getParent(); + } + const isExpandable = parentWithExpansion ? parentWithExpansion.getProvidedColumnGroup().isExpandable() : false; + if (!isExpandable) { + this.displayedChildren = this.children; + this.dispatchLocalEvent({ type: "displayedChildrenChanged" }); + return; + } + for (const child of this.children ?? []) { + const emptyGroup = isColumnGroup(child) && !child.displayedChildren?.length; + if (emptyGroup) { + continue; + } + const headerGroupShow = child.getColumnGroupShow(); + switch (headerGroupShow) { + case "open": + if (parentWithExpansion.getProvidedColumnGroup().isExpanded()) { + this.displayedChildren.push(child); + } + break; + case "closed": + if (!parentWithExpansion.getProvidedColumnGroup().isExpanded()) { + this.displayedChildren.push(child); + } + break; + default: + this.displayedChildren.push(child); + break; + } + } + this.dispatchLocalEvent({ type: "displayedChildrenChanged" }); + } +}; +var KeyCode = { + 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" +}; +var A_KEYCODE = 65; +var C_KEYCODE = 67; +var V_KEYCODE = 86; +var D_KEYCODE = 68; +var Z_KEYCODE = 90; +var Y_KEYCODE = 89; +function _normaliseQwertyAzerty(keyboardEvent) { + const { keyCode } = keyboardEvent; + let code; + switch (keyCode) { + case A_KEYCODE: + code = KeyCode.A; + break; + case C_KEYCODE: + code = KeyCode.C; + break; + case V_KEYCODE: + code = KeyCode.V; + break; + case D_KEYCODE: + code = KeyCode.D; + break; + case Z_KEYCODE: + code = KeyCode.Z; + break; + case Y_KEYCODE: + code = KeyCode.Y; + break; + default: + code = keyboardEvent.code; + } + return code; +} +function _wrapInterval(action, timeout) { + return new AgPromise((resolve) => { + resolve(window.setInterval(action, timeout)); + }); +} +var AgPromise = class _AgPromise { + constructor(callback) { + this.status = 0; + this.resolution = null; + this.waiters = []; + callback((value) => this.onDone(value), (params) => this.onReject(params)); + } + static all(promises) { + return promises.length ? new _AgPromise((resolve) => { + let remainingToResolve = promises.length; + const combinedValues = new Array(remainingToResolve); + promises.forEach((promise, index) => { + promise.then((value) => { + combinedValues[index] = value; + remainingToResolve--; + if (remainingToResolve === 0) { + resolve(combinedValues); + } + }); + }); + }) : _AgPromise.resolve(); + } + static resolve(value = null) { + return new _AgPromise((resolve) => resolve(value)); + } + then(func) { + return new _AgPromise((resolve) => { + if (this.status === 1) { + resolve(func(this.resolution)); + } else { + this.waiters.push((value) => resolve(func(value))); + } + }); + } + onDone(value) { + this.status = 1; + this.resolution = value; + for (const waiter of this.waiters) { + waiter(value); + } + } + onReject(_) {} +}; +var BaseDragAndDropService = class extends AgBeanStub { + 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 = undefined; + this.dragImageLastLabel = undefined; + this.dropTargets = []; + this.externalDropZoneCount = 0; + this.lastDropTarget = null; + } + addDragSource(dragSource, allowTouch = false) { + const entry = { + capturePointer: true, + dragSource, + eElement: dragSource.eElement, + dragStartPixels: dragSource.dragStartPixels, + onDragStart: (mouseEvent) => this.onDragStart(dragSource, mouseEvent), + onDragStop: this.onDragStop.bind(this), + onDragging: this.onDragging.bind(this), + onDragCancel: this.onDragCancel.bind(this), + includeTouch: allowTouch + }; + this.dragSourceAndParamsList.push(entry); + this.beans.dragSvc.addDragSource(entry); + } + setDragImageCompIcon(iconName, shake = false) { + const component = this.dragImageComp; + if (component && (shake || this.dragImageLastIcon !== iconName)) { + this.dragImageLastIcon = iconName; + component.setIcon(iconName, shake); + } + } + removeDragSource(dragSource) { + const { dragSourceAndParamsList, beans } = this; + for (let i = 0, len = dragSourceAndParamsList.length;i < len; i++) { + if (dragSourceAndParamsList[i].dragSource === dragSource) { + const sourceAndParams = dragSourceAndParamsList[i]; + beans.dragSvc?.removeDragSource(sourceAndParams); + dragSourceAndParamsList.splice(i, 1); + break; + } + } + } + destroy() { + const { dragSourceAndParamsList, dropTargets, beans } = this; + const dragSvc = beans.dragSvc; + for (const sourceAndParams of dragSourceAndParamsList) { + dragSvc?.removeDragSource(sourceAndParams); + } + dragSourceAndParamsList.length = 0; + dropTargets.length = 0; + this.externalDropZoneCount = 0; + this.clearDragAndDropProperties(); + super.destroy(); + } + nudge() { + const lastMouseEvent = this.lastMouseEvent; + if (lastMouseEvent) { + this.onDragging(lastMouseEvent, true); + } + } + onDragStart(dragSource, mouseEvent) { + this.lastMouseEvent = mouseEvent; + this.dragSource = dragSource; + this.dragItem = dragSource.getDragItem(); + const rect = dragSource.eElement.getBoundingClientRect(); + this.dragInitialSourcePointerOffsetX = mouseEvent.clientX - rect.left; + this.dragInitialSourcePointerOffsetY = mouseEvent.clientY - rect.top; + dragSource.onDragStarted?.(); + this.createAndUpdateDragImageComp(dragSource); + } + onDragStop(mouseEvent) { + const { dragSource, lastDropTarget } = this; + dragSource?.onDragStopped?.(); + if (lastDropTarget) { + const dragEndEvent = this.dropTargetEvent(lastDropTarget, mouseEvent, false); + lastDropTarget.onDragStop?.(dragEndEvent); + } + this.clearDragAndDropProperties(); + } + onDragCancel() { + const { dragSource, lastDropTarget, lastMouseEvent } = this; + dragSource?.onDragCancelled?.(); + if (lastDropTarget && lastMouseEvent) { + const dragCancelEvent = this.dropTargetEvent(lastDropTarget, lastMouseEvent, false); + lastDropTarget.onDragCancel?.(dragCancelEvent); + } + this.clearDragAndDropProperties(); + } + onDragging(mouseEvent, fromNudge = false) { + this.positionDragImageComp(mouseEvent); + const dropTarget = this.findCurrentDropTarget(mouseEvent); + const { lastDropTarget, dragSource, dragItem } = this; + let needUpdate = false; + if (dropTarget !== lastDropTarget) { + needUpdate = true; + if (lastDropTarget) { + const dragLeaveEvent = this.dropTargetEvent(lastDropTarget, mouseEvent, fromNudge); + lastDropTarget.onDragLeave?.(dragLeaveEvent); + } + if (lastDropTarget !== null && !dropTarget) { + this.handleExit(dragSource, dragItem); + } else if (lastDropTarget === null && dropTarget) { + this.handleEnter(dragSource, dragItem); + } + if (dropTarget) { + const dragEnterEvent = this.dropTargetEvent(dropTarget, mouseEvent, fromNudge); + dropTarget.onDragEnter?.(dragEnterEvent); + } + this.lastDropTarget = dropTarget; + } else if (dropTarget) { + const dragMoveEvent = this.dropTargetEvent(dropTarget, mouseEvent, fromNudge); + dropTarget.onDragging?.(dragMoveEvent); + if (dragMoveEvent?.changed) { + needUpdate = true; + } + } + this.lastMouseEvent = mouseEvent; + if (needUpdate) { + this.updateDragImageComp(); + } + } + clearDragAndDropProperties() { + this.removeDragImageComp(this.dragImageComp); + this.dragImageCompPromise = null; + this.dragImageLastIcon = undefined; + this.dragImageLastLabel = undefined; + this.lastMouseEvent = null; + this.lastDraggingEvent = null; + this.lastDropTarget = null; + this.dragItem = null; + this.dragInitialSourcePointerOffsetX = 0; + this.dragInitialSourcePointerOffsetY = 0; + this.dragSource = null; + } + getAllContainersFromDropTarget(dropTarget) { + const primaryContainer = dropTarget.getContainer(); + const secondaryContainers = dropTarget.getSecondaryContainers?.(); + const secondaryContainersLen = secondaryContainers?.length; + if (!secondaryContainersLen) { + return [[primaryContainer]]; + } + const containers = new Array(secondaryContainersLen + 1); + containers[0] = [primaryContainer]; + for (let i = 0;i < secondaryContainersLen; ++i) { + containers[i + 1] = secondaryContainers[i]; + } + return containers; + } + isMouseOnDropTarget(mouseEvent, dropTarget) { + const allContainersFromDropTarget = this.getAllContainersFromDropTarget(dropTarget); + let mouseOverTarget = false; + const allContainersIntersect = (mouseEvent2, containers) => { + for (const container of containers) { + const { width, height, left, right, top, bottom } = container.getBoundingClientRect(); + if (width === 0 || height === 0) { + return false; + } + const horizontalFit = mouseEvent2.clientX >= left && mouseEvent2.clientX < right; + const verticalFit = mouseEvent2.clientY >= top && mouseEvent2.clientY < bottom; + if (!horizontalFit || !verticalFit) { + return false; + } + } + return true; + }; + for (const currentContainers of allContainersFromDropTarget) { + if (allContainersIntersect(mouseEvent, currentContainers)) { + mouseOverTarget = true; + break; + } + } + const { eElement, type } = this.dragSource; + if (dropTarget.targetContainsSource && !dropTarget.getContainer().contains(eElement)) { + return false; + } + return mouseOverTarget && dropTarget.isInterestedIn(type, eElement); + } + findCurrentDropTarget(mouseEvent) { + const validDropTargets = []; + const dropTargets = this.dropTargets; + for (let i = 0, len2 = dropTargets.length;i < len2; ++i) { + const target = dropTargets[i]; + if (this.isMouseOnDropTarget(mouseEvent, target)) { + validDropTargets.push(target); + } + } + const len = validDropTargets.length; + if (len === 0) { + return null; + } + if (len === 1) { + return validDropTargets[0]; + } + const rootNode = _getRootNode(this.beans); + const elementStack = rootNode.elementsFromPoint(mouseEvent.clientX, mouseEvent.clientY); + for (let i = 0, stackLen = elementStack.length;i < stackLen; ++i) { + const el = elementStack[i]; + for (let targetIndex = 0, targetsLen = validDropTargets.length;targetIndex < targetsLen; targetIndex++) { + const dropTarget = validDropTargets[targetIndex]; + const containerGroups = this.getAllContainersFromDropTarget(dropTarget); + let matched = false; + for (let groupIdx = 0, groupLen = containerGroups.length;groupIdx < groupLen && !matched; groupIdx++) { + const group = containerGroups[groupIdx]; + for (let elIdx = 0, elLen = group.length;elIdx < elLen; elIdx++) { + if (group[elIdx] === el) { + matched = true; + break; + } + } + } + if (matched) { + return dropTarget; + } + } + } + return null; + } + addDropTarget(dropTarget) { + this.dropTargets.push(dropTarget); + if (dropTarget.external) { + this.externalDropZoneCount++; + } + } + removeDropTarget(dropTarget) { + const container = dropTarget.getContainer(); + const dropTargets = this.dropTargets; + let writeIndex = 0; + for (let readIndex = 0, len = dropTargets.length;readIndex < len; ++readIndex) { + const target = dropTargets[readIndex]; + if (target.getContainer() === container) { + if (target.external) { + --this.externalDropZoneCount; + } + continue; + } + if (writeIndex !== readIndex) { + dropTargets[writeIndex] = target; + } + ++writeIndex; + } + dropTargets.length = writeIndex; + } + hasExternalDropZones() { + return this.externalDropZoneCount > 0; + } + findExternalZone(container) { + const dropTargets = this.dropTargets; + for (let i = 0, len = dropTargets.length;i < len; ++i) { + const zone = dropTargets[i]; + if (zone.external && zone.getContainer() === container) { + return zone; + } + } + return null; + } + dropTargetEvent(dropTarget, mouseEvent, fromNudge) { + const { + dragSource, + dragItem, + lastDraggingEvent, + lastMouseEvent, + dragInitialSourcePointerOffsetX, + dragInitialSourcePointerOffsetY + } = this; + const dropZoneTarget = dropTarget.getContainer(); + const rect = dropZoneTarget.getBoundingClientRect(); + const { clientX, clientY } = mouseEvent; + const xDir = clientX - (lastMouseEvent?.clientX || 0); + const yDir = clientY - (lastMouseEvent?.clientY || 0); + const draggingEvent = this.createEvent({ + event: mouseEvent, + x: clientX - rect.left, + y: clientY - rect.top, + vDirection: yDir > 0 ? "down" : yDir < 0 ? "up" : null, + hDirection: xDir < 0 ? "left" : xDir > 0 ? "right" : null, + initialSourcePointerOffsetX: dragInitialSourcePointerOffsetX, + initialSourcePointerOffsetY: dragInitialSourcePointerOffsetY, + dragSource, + fromNudge, + dragItem, + dropZoneTarget, + dropTarget: lastDraggingEvent?.dropTarget ?? null, + changed: !!lastDraggingEvent?.changed + }); + this.lastDraggingEvent = draggingEvent; + return draggingEvent; + } + positionDragImageComp(event) { + const gui = this.dragImageComp?.getGui(); + if (gui) { + _anchorElementToMouseMoveEvent(gui, event, this.beans); + } + } + removeDragImageComp(comp) { + if (this.dragImageComp === comp) { + this.dragImageComp = null; + } + if (comp) { + comp.getGui()?.remove(); + this.destroyBean(comp); + } + } + createAndUpdateDragImageComp(dragSource) { + const promise = this.createDragImageComp(dragSource) ?? null; + this.dragImageCompPromise = promise; + promise?.then((dragImageComp) => { + const lastMouseEvent = this.lastMouseEvent; + if (promise !== this.dragImageCompPromise || !lastMouseEvent || !this.isAlive()) { + this.destroyBean(dragImageComp); + return; + } + this.dragImageCompPromise = null; + this.dragImageLastIcon = undefined; + this.dragImageLastLabel = undefined; + const oldDragImageComp = this.dragImageComp; + if (oldDragImageComp !== dragImageComp) { + this.dragImageComp = dragImageComp; + this.removeDragImageComp(oldDragImageComp); + } + if (dragImageComp) { + this.appendDragImageComp(dragImageComp); + this.updateDragImageComp(); + this.positionDragImageComp(lastMouseEvent); + } + }); + } + appendDragImageComp(component) { + const eGui = component.getGui(); + const style = eGui.style; + style.position = "absolute"; + style.zIndex = "9999"; + if (this.beans.dragSvc?.hasPointerCapture()) { + style.pointerEvents = "none"; + } + this.gos.setInstanceDomData(eGui); + this.beans.environment.applyThemeClasses(eGui); + style.top = "20px"; + style.left = "20px"; + const targetEl = _getPageBody(this.beans); + if (!targetEl) { + this.warnNoBody(); + } else { + targetEl.appendChild(eGui); + } + } + updateDragImageComp() { + const { dragImageComp, dragSource, lastDropTarget, lastDraggingEvent, dragImageLastLabel } = this; + if (!dragImageComp) { + return; + } + this.setDragImageCompIcon(lastDropTarget?.getIconName?.(lastDraggingEvent) ?? null); + let label = dragSource?.dragItemName; + if (typeof label === "function") { + label = label(lastDraggingEvent); + } + label || (label = ""); + if (dragImageLastLabel !== label) { + this.dragImageLastLabel = label; + dragImageComp.setLabel(label); + } + } +}; +function isColumnFilterComp(filter) { + return typeof filter === "object" && !!filter.component; +} +function doesImplementIComponent(candidate) { + if (!candidate) { + return false; + } + return candidate.prototype && "getGui" in candidate.prototype; +} +function _getUserCompKeys(frameworkOverrides, defObject, type, params) { + const { name } = type; + let compName; + let jsComp; + let fwComp; + let paramsFromSelector; + let popupFromSelector; + let popupPositionFromSelector; + if (defObject) { + const defObjectAny = defObject; + const selectorFunc = defObjectAny[name + "Selector"]; + const selectorRes = selectorFunc ? selectorFunc(params) : null; + const assignComp = (providedJsComp) => { + if (typeof providedJsComp === "string") { + compName = providedJsComp; + } else if (providedJsComp != null && providedJsComp !== true) { + const isFwkComp = frameworkOverrides.isFrameworkComponent(providedJsComp); + if (isFwkComp) { + fwComp = providedJsComp; + } else { + jsComp = providedJsComp; + } + } + }; + if (selectorRes) { + assignComp(selectorRes.component); + paramsFromSelector = selectorRes.params; + popupFromSelector = selectorRes.popup; + popupPositionFromSelector = selectorRes.popupPosition; + } else { + assignComp(defObjectAny[name]); + } + } + return { compName, jsComp, fwComp, paramsFromSelector, popupFromSelector, popupPositionFromSelector }; +} +var UserComponentFactory = class extends BeanStub { + constructor() { + super(...arguments); + this.beanName = "userCompFactory"; + } + wireBeans(beans) { + this.agCompUtils = beans.agCompUtils; + this.registry = beans.registry; + this.frameworkCompWrapper = beans.frameworkCompWrapper; + this.gridOptions = beans.gridOptions; + } + getCompDetailsFromGridOptions(type, defaultName, params, mandatory = false) { + return this.getCompDetails(this.gridOptions, type, defaultName, params, mandatory); + } + getCompDetails(defObject, type, defaultName, params, mandatory = false) { + const { name, cellRenderer } = type; + let { compName, jsComp, fwComp, paramsFromSelector, popupFromSelector, popupPositionFromSelector } = _getUserCompKeys(this.beans.frameworkOverrides, defObject, type, params); + let defaultCompParams; + let defaultCompProcessParams; + const lookupFromRegistry = (key) => { + const item = this.registry.getUserComponent(name, key); + if (item) { + jsComp = !item.componentFromFramework ? item.component : undefined; + fwComp = item.componentFromFramework ? item.component : undefined; + defaultCompParams = item.params; + defaultCompProcessParams = item.processParams; + } + }; + if (compName != null) { + lookupFromRegistry(compName); + } + if (jsComp == null && fwComp == null && defaultName != null) { + lookupFromRegistry(defaultName); + } + if (jsComp && cellRenderer && !doesImplementIComponent(jsComp)) { + jsComp = this.agCompUtils?.adaptFunction(type, jsComp); + } + if (!jsComp && !fwComp) { + const { validation } = this.beans; + if (mandatory && (compName !== defaultName || !defaultName)) { + if (compName) { + if (!validation?.isProvidedUserComp(compName)) { + _error(50, { compName }); + } + } else if (defaultName) { + if (!validation) { + _error(260, { + ...this.gos.getModuleErrorParams(), + propName: name, + compName: defaultName + }); + } + } else { + _error(216, { name }); + } + } else if (defaultName && !validation) { + _error(146, { comp: defaultName }); + } + return; + } + const paramsMerged = this.mergeParams(defObject, type, params, paramsFromSelector, defaultCompParams, defaultCompProcessParams); + const componentFromFramework = jsComp == null; + const componentClass = jsComp ?? fwComp; + return { + componentFromFramework, + componentClass, + params: paramsMerged, + type, + popupFromSelector, + popupPositionFromSelector, + newAgStackInstance: () => this.newAgStackInstance(componentClass, componentFromFramework, paramsMerged, type) + }; + } + newAgStackInstance(ComponentClass, componentFromFramework, params, type) { + const jsComponent = !componentFromFramework; + let instance; + if (jsComponent) { + instance = new ComponentClass; + } else { + instance = this.frameworkCompWrapper.wrap(ComponentClass, type.mandatoryMethods, type.optionalMethods, type); + } + this.createBean(instance); + const deferredInit = instance.init?.(params); + if (deferredInit == null) { + return AgPromise.resolve(instance); + } + return deferredInit.then(() => instance); + } + mergeParams(defObject, type, paramsFromGrid, paramsFromSelector = null, defaultCompParams, defaultCompProcessParams) { + const params = { ...paramsFromGrid, ...defaultCompParams }; + const defObjectAny = defObject; + const userParams = defObjectAny?.[type.name + "Params"]; + if (typeof userParams === "function") { + const userParamsFromFunc = userParams(paramsFromGrid); + _mergeDeep(params, userParamsFromFunc); + } else if (typeof userParams === "object") { + _mergeDeep(params, userParams); + } + _mergeDeep(params, paramsFromSelector); + return defaultCompProcessParams ? defaultCompProcessParams(params) : params; + } +}; +var DateComponent = { + name: "dateComponent", + mandatoryMethods: ["getDate", "setDate"], + optionalMethods: ["afterGuiAttached", "setInputPlaceholder", "setInputAriaLabel", "setDisabled", "refresh"] +}; +var DragAndDropImageComponent = { + name: "dragAndDropImageComponent", + mandatoryMethods: ["setIcon", "setLabel"] +}; +var HeaderComponent = { name: "headerComponent", optionalMethods: ["refresh"] }; +var InnerHeaderComponent = { name: "innerHeaderComponent" }; +var InnerHeaderGroupComponent = { name: "innerHeaderGroupComponent" }; +var HeaderGroupComponent = { name: "headerGroupComponent" }; +var InnerCellRendererComponent = { + name: "innerRenderer", + cellRenderer: true, + optionalMethods: ["afterGuiAttached"] +}; +var CellRendererComponent = { + name: "cellRenderer", + optionalMethods: ["refresh", "afterGuiAttached"], + cellRenderer: true +}; +var LoadingCellRendererComponent = { name: "loadingCellRenderer", cellRenderer: true }; +var CellEditorComponent = { + name: "cellEditor", + mandatoryMethods: ["getValue"], + optionalMethods: [ + "isPopup", + "isCancelBeforeStart", + "isCancelAfterEnd", + "getPopupPosition", + "focusIn", + "focusOut", + "afterGuiAttached", + "refresh" + ] +}; +var TooltipComponent = { name: "tooltipComponent" }; +var FilterComponent = { + name: "filter", + mandatoryMethods: ["isFilterActive", "doesFilterPass", "getModel", "setModel"], + optionalMethods: [ + "afterGuiAttached", + "afterGuiDetached", + "onNewRowsLoaded", + "getModelAsString", + "onFloatingFilterChanged", + "onAnyFilterChanged", + "refresh" + ] +}; +var FloatingFilterComponent = { + name: "floatingFilterComponent", + mandatoryMethods: ["onParentModelChanged"], + optionalMethods: ["afterGuiAttached", "refresh"] +}; +var FullWidth = { + name: "fullWidthCellRenderer", + optionalMethods: ["refresh", "afterGuiAttached"], + cellRenderer: true +}; +var FullWidthLoading = { name: "loadingCellRenderer", cellRenderer: true }; +var FullWidthGroup = { + name: "groupRowRenderer", + optionalMethods: ["afterGuiAttached"], + cellRenderer: true +}; +var FullWidthDetail = { name: "detailCellRenderer", optionalMethods: ["refresh"], cellRenderer: true }; +function _getDragAndDropImageCompDetails(userCompFactory, params) { + return userCompFactory.getCompDetailsFromGridOptions(DragAndDropImageComponent, "agDragAndDropImage", params, true); +} +function _getInnerCellRendererDetails(userCompFactory, def, params) { + return userCompFactory.getCompDetails(def, InnerCellRendererComponent, undefined, params); +} +function _getHeaderCompDetails(userCompFactory, colDef, params) { + return userCompFactory.getCompDetails(colDef, HeaderComponent, "agColumnHeader", params); +} +function _getInnerHeaderCompDetails(userCompFactory, headerCompParams, params) { + return userCompFactory.getCompDetails(headerCompParams, InnerHeaderComponent, undefined, params); +} +function _getHeaderGroupCompDetails(userCompFactory, params) { + const colGroupDef = params.columnGroup.getColGroupDef(); + return userCompFactory.getCompDetails(colGroupDef, HeaderGroupComponent, "agColumnGroupHeader", params); +} +function _getInnerHeaderGroupCompDetails(userCompFactory, headerGroupCompParams, params) { + return userCompFactory.getCompDetails(headerGroupCompParams, InnerHeaderGroupComponent, undefined, params); +} +function _getFullWidthCellRendererDetails(userCompFactory, params) { + return userCompFactory.getCompDetailsFromGridOptions(FullWidth, undefined, params, true); +} +function _getFullWidthLoadingCellRendererDetails(userCompFactory, params) { + return userCompFactory.getCompDetailsFromGridOptions(FullWidthLoading, "agLoadingCellRenderer", params, true); +} +function _getFullWidthGroupCellRendererDetails(userCompFactory, params) { + return userCompFactory.getCompDetailsFromGridOptions(FullWidthGroup, "agGroupRowRenderer", params, true); +} +function _getFullWidthDetailCellRendererDetails(userCompFactory, params) { + return userCompFactory.getCompDetailsFromGridOptions(FullWidthDetail, "agDetailCellRenderer", params, true); +} +function _getCellRendererDetails(userCompFactory, def, params) { + return userCompFactory.getCompDetails(def, CellRendererComponent, undefined, params); +} +function _getLoadingCellRendererDetails(userCompFactory, def, params) { + return userCompFactory.getCompDetails(def, LoadingCellRendererComponent, "agSkeletonCellRenderer", params, true); +} +function _getCellEditorDetails(userCompFactory, def, params) { + return userCompFactory.getCompDetails(def, CellEditorComponent, "agCellEditor", params, true); +} +function _getFilterDetails(userCompFactory, def, params, defaultFilter) { + const filter = def.filter; + if (isColumnFilterComp(filter)) { + def = { + filter: filter.component, + filterParams: def.filterParams + }; + } + return userCompFactory.getCompDetails(def, FilterComponent, defaultFilter, params, true); +} +function _getDateCompDetails(userCompFactory, def, params) { + return userCompFactory.getCompDetails(def, DateComponent, "agDateInput", params, true); +} +function _getTooltipCompDetails(userCompFactory, params) { + return userCompFactory.getCompDetails(params.colDef, TooltipComponent, "agTooltipComponent", params, true); +} +function _getFloatingFilterCompDetails(userCompFactory, def, params, defaultFloatingFilter) { + return userCompFactory.getCompDetails(def, FloatingFilterComponent, defaultFloatingFilter, params); +} +function _getFilterCompKeys(frameworkOverrides, def) { + return _getUserCompKeys(frameworkOverrides, def, FilterComponent); +} +function _mergeFilterParamsWithApplicationProvidedParams(userCompFactory, defObject, paramsFromGrid) { + return userCompFactory.mergeParams(defObject, FilterComponent, paramsFromGrid); +} +var DragSourceType = /* @__PURE__ */ ((DragSourceType2) => { + DragSourceType2[DragSourceType2["ToolPanel"] = 0] = "ToolPanel"; + DragSourceType2[DragSourceType2["HeaderCell"] = 1] = "HeaderCell"; + DragSourceType2[DragSourceType2["RowDrag"] = 2] = "RowDrag"; + DragSourceType2[DragSourceType2["ChartPanel"] = 3] = "ChartPanel"; + DragSourceType2[DragSourceType2["AdvancedFilterBuilder"] = 4] = "AdvancedFilterBuilder"; + return DragSourceType2; +})(DragSourceType || {}); +var DragAndDropService = class extends BaseDragAndDropService { + createEvent(event) { + return _addGridCommonParams(this.gos, event); + } + createDragImageComp(dragSource) { + const { gos, beans } = this; + const userCompDetails = _getDragAndDropImageCompDetails(beans.userCompFactory, _addGridCommonParams(gos, { + dragSource + })); + return userCompDetails?.newAgStackInstance(); + } + handleEnter(dragSource, dragItem) { + dragSource?.onGridEnter?.(dragItem); + } + handleExit(dragSource, dragItem) { + dragSource?.onGridExit?.(dragItem); + } + warnNoBody() { + _warn(54); + } + isDropZoneWithinThisGrid(draggingEvent) { + return this.beans.ctrlsSvc.getGridBodyCtrl().eGridBody.contains(draggingEvent.dropZoneTarget); + } + registerGridDropTarget(elementFn, ctrl) { + const dropTarget = { + getContainer: elementFn, + isInterestedIn: (type) => type === 1 || type === 0, + getIconName: () => "notAllowed" + }; + this.addDropTarget(dropTarget); + ctrl.addDestroyFunc(() => this.removeDropTarget(dropTarget)); + } +}; +function isCombinedFilterModel(model) { + return !!model.operator; +} +var RESIZE_CONTAINER_STYLE = "ag-resizer-wrapper"; +var makeDiv = (dataRefPrefix, classSuffix) => ({ + tag: "div", + ref: `${dataRefPrefix}Resizer`, + cls: `ag-resizer ag-resizer-${classSuffix}` +}); +var RESIZE_TEMPLATE = { + tag: "div", + cls: RESIZE_CONTAINER_STYLE, + children: [ + makeDiv("eTopLeft", "topLeft"), + makeDiv("eTop", "top"), + makeDiv("eTopRight", "topRight"), + makeDiv("eRight", "right"), + makeDiv("eBottomRight", "bottomRight"), + makeDiv("eBottom", "bottom"), + makeDiv("eBottomLeft", "bottomLeft"), + makeDiv("eLeft", "left") + ] +}; +var AgPositionableFeature = class extends AgBeanStub { + constructor(element, config) { + super(); + this.element = element; + this.dragStartPosition = { + x: 0, + y: 0 + }; + this.position = { + x: 0, + y: 0 + }; + this.lastSize = { + width: -1, + height: -1 + }; + this.positioned = false; + this.resizersAdded = false; + this.resizeListeners = []; + this.boundaryEl = null; + this.isResizing = false; + this.isMoving = false; + this.resizable = {}; + this.movable = false; + this.currentResizer = null; + this.config = { popup: false, ...config }; + } + wireBeans(beans) { + this.popupSvc = beans.popupSvc; + this.dragSvc = beans.dragSvc; + } + center(postProcessCallback) { + const { clientHeight, clientWidth } = this.offsetParent; + const x = clientWidth / 2 - this.getWidth() / 2; + const y = clientHeight / 2 - this.getHeight() / 2; + this.offsetElement(x, y, postProcessCallback); + } + initialisePosition(postProcessCallback) { + if (this.positioned) { + return; + } + const { centered, forcePopupParentAsOffsetParent, minWidth, width, minHeight, height, x, y } = this.config; + if (!this.offsetParent) { + this.setOffsetParent(); + } + let computedMinHeight = 0; + let computedMinWidth = 0; + const isElementVisible = _isVisible(this.element); + if (isElementVisible) { + const boundaryEl = this.findBoundaryElement(); + const offsetParentComputedStyles = window.getComputedStyle(boundaryEl); + if (offsetParentComputedStyles.minWidth != null) { + const paddingWidth = boundaryEl.offsetWidth - this.element.offsetWidth; + computedMinWidth = Number.parseInt(offsetParentComputedStyles.minWidth, 10) - paddingWidth; + } + if (offsetParentComputedStyles.minHeight != null) { + const paddingHeight = boundaryEl.offsetHeight - this.element.offsetHeight; + computedMinHeight = Number.parseInt(offsetParentComputedStyles.minHeight, 10) - paddingHeight; + } + } + this.minHeight = minHeight || computedMinHeight; + this.minWidth = minWidth || computedMinWidth; + if (width) { + this.setWidth(width); + } + if (height) { + this.setHeight(height); + } + if (!width || !height) { + this.refreshSize(); + } + if (centered) { + this.center(postProcessCallback); + } else if (x || y) { + this.offsetElement(x, y, postProcessCallback); + } else if (isElementVisible && forcePopupParentAsOffsetParent) { + let boundaryEl = this.boundaryEl; + let initialisedDuringPositioning = true; + if (!boundaryEl) { + boundaryEl = this.findBoundaryElement(); + initialisedDuringPositioning = false; + } + if (boundaryEl) { + const top = Number.parseFloat(boundaryEl.style.top); + const left = Number.parseFloat(boundaryEl.style.left); + if (initialisedDuringPositioning) { + this.offsetElement(Number.isNaN(left) ? 0 : left, Number.isNaN(top) ? 0 : top, postProcessCallback); + } else { + this.setPosition(left, top); + } + } + } + this.positioned = !!this.offsetParent; + } + isPositioned() { + return this.positioned; + } + getPosition() { + return this.position; + } + setMovable(movable, moveElement) { + if (!this.config.popup || movable === this.movable) { + return; + } + this.movable = movable; + const params = this.moveElementDragListener || { + eElement: moveElement, + onDragStart: this.onMoveStart.bind(this), + onDragging: this.onMove.bind(this), + onDragStop: this.onMoveEnd.bind(this) + }; + if (movable) { + this.dragSvc?.addDragSource(params); + this.moveElementDragListener = params; + } else { + this.dragSvc?.removeDragSource(params); + this.moveElementDragListener = undefined; + } + } + setResizable(resizable) { + this.clearResizeListeners(); + if (resizable) { + this.addResizers(); + } else { + this.removeResizers(); + } + if (typeof resizable === "boolean") { + if (resizable === false) { + return; + } + resizable = { + topLeft: resizable, + top: resizable, + topRight: resizable, + right: resizable, + bottomRight: resizable, + bottom: resizable, + bottomLeft: resizable, + left: resizable + }; + } + for (const side of Object.keys(resizable)) { + const isSideResizable = !!resizable[side]; + const resizerEl = this.getResizerElement(side); + const params = { + dragStartPixels: 0, + eElement: resizerEl, + onDragStart: (e) => this.onResizeStart(e, side), + onDragging: this.onResize.bind(this), + onDragStop: (e) => this.onResizeEnd(e, side) + }; + if (isSideResizable || !this.isAlive() && !isSideResizable) { + if (isSideResizable) { + this.dragSvc?.addDragSource(params); + this.resizeListeners.push(params); + resizerEl.style.pointerEvents = "all"; + } else { + resizerEl.style.pointerEvents = "none"; + } + this.resizable[side] = isSideResizable; + } + } + } + removeSizeFromEl() { + this.element.style.removeProperty("height"); + this.element.style.removeProperty("width"); + this.element.style.removeProperty("flex"); + } + restoreLastSize() { + this.element.style.flex = "0 0 auto"; + const { height, width } = this.lastSize; + if (width !== -1) { + this.element.style.width = `${width}px`; + } + if (height !== -1) { + this.element.style.height = `${height}px`; + } + } + getHeight() { + return this.element.offsetHeight; + } + setHeight(height) { + const { popup } = this.config; + const eGui = this.element; + let isPercent = false; + if (typeof height === "string" && height.includes("%")) { + _setFixedHeight(eGui, height); + height = _getAbsoluteHeight(eGui); + isPercent = true; + } else { + height = Math.max(this.minHeight, height); + if (this.positioned) { + const availableHeight = this.getAvailableHeight(); + if (availableHeight && height > availableHeight) { + height = availableHeight; + } + } + } + if (this.getHeight() === height) { + return; + } + if (isPercent) { + eGui.style.maxHeight = "unset"; + eGui.style.minHeight = "unset"; + } else if (popup) { + _setFixedHeight(eGui, height); + } else { + eGui.style.height = `${height}px`; + eGui.style.flex = "0 0 auto"; + this.lastSize.height = typeof height === "number" ? height : Number.parseFloat(height); + } + } + getAvailableHeight() { + const { popup, forcePopupParentAsOffsetParent } = this.config; + if (!this.positioned) { + this.initialisePosition(); + } + const { clientHeight } = this.offsetParent; + if (!clientHeight) { + return null; + } + const elRect = this.element.getBoundingClientRect(); + const offsetParentRect = this.offsetParent.getBoundingClientRect(); + const yPosition = popup ? this.position.y : elRect.top; + const parentTop = popup ? 0 : offsetParentRect.top; + let additionalHeight = 0; + if (forcePopupParentAsOffsetParent) { + const parentEl = this.element.parentElement; + if (parentEl) { + const { bottom } = parentEl.getBoundingClientRect(); + additionalHeight = bottom - elRect.bottom; + } + } + const availableHeight = clientHeight + parentTop - yPosition - additionalHeight; + return availableHeight; + } + getWidth() { + return this.element.offsetWidth; + } + setWidth(width) { + const eGui = this.element; + const { popup } = this.config; + let isPercent = false; + if (typeof width === "string" && width.includes("%")) { + _setFixedWidth(eGui, width); + width = _getAbsoluteWidth(eGui); + isPercent = true; + } else if (this.positioned) { + width = Math.max(this.minWidth, width); + const { clientWidth } = this.offsetParent; + const xPosition = popup ? this.position.x : this.element.getBoundingClientRect().left; + if (clientWidth && width + xPosition > clientWidth) { + width = clientWidth - xPosition; + } + } + if (this.getWidth() === width) { + return; + } + if (isPercent) { + eGui.style.maxWidth = "unset"; + eGui.style.minWidth = "unset"; + } else if (this.config.popup) { + _setFixedWidth(eGui, width); + } else { + eGui.style.width = `${width}px`; + eGui.style.flex = " unset"; + this.lastSize.width = typeof width === "number" ? width : Number.parseFloat(width); + } + } + offsetElement(x = 0, y = 0, postProcessCallback) { + const { forcePopupParentAsOffsetParent } = this.config; + const ePopup = forcePopupParentAsOffsetParent ? this.boundaryEl : this.element; + if (!ePopup) { + return; + } + this.popupSvc?.positionPopup({ + ePopup, + keepWithinBounds: true, + skipObserver: this.movable || this.isResizable(), + updatePosition: () => ({ x, y }), + postProcessCallback + }); + this.setPosition(Number.parseFloat(ePopup.style.left), Number.parseFloat(ePopup.style.top)); + } + constrainSizeToAvailableHeight(constrain) { + if (!this.config.forcePopupParentAsOffsetParent) { + return; + } + const applyMaxHeightToElement = () => { + const availableHeight = this.getAvailableHeight(); + this.element.style.setProperty("max-height", `${availableHeight}px`); + }; + if (constrain && this.popupSvc) { + this.resizeObserverSubscriber?.(); + this.resizeObserverSubscriber = _observeResize(this.beans, this.popupSvc?.getPopupParent(), applyMaxHeightToElement); + } else { + this.element.style.removeProperty("max-height"); + if (this.resizeObserverSubscriber) { + this.resizeObserverSubscriber(); + this.resizeObserverSubscriber = undefined; + } + } + } + setPosition(x, y) { + this.position.x = x; + this.position.y = y; + } + updateDragStartPosition(x, y) { + this.dragStartPosition = { x, y }; + } + calculateMouseMovement(params) { + const { e, isLeft, isTop, anywhereWithin, topBuffer } = params; + const xDiff = e.clientX - this.dragStartPosition.x; + const yDiff = e.clientY - this.dragStartPosition.y; + const movementX = this.shouldSkipX(e, !!isLeft, !!anywhereWithin, xDiff) ? 0 : xDiff; + const movementY = this.shouldSkipY(e, !!isTop, topBuffer, yDiff) ? 0 : yDiff; + return { movementX, movementY }; + } + shouldSkipX(e, isLeft, anywhereWithin, diff) { + const elRect = this.element.getBoundingClientRect(); + const parentRect = this.offsetParent.getBoundingClientRect(); + const boundaryElRect = this.boundaryEl.getBoundingClientRect(); + const xPosition = this.config.popup ? this.position.x : elRect.left; + let skipX = xPosition <= 0 && parentRect.left >= e.clientX || parentRect.right <= e.clientX && parentRect.right <= boundaryElRect.right; + if (skipX) { + return true; + } + if (isLeft) { + skipX = diff < 0 && e.clientX > xPosition + parentRect.left || diff > 0 && e.clientX < xPosition + parentRect.left; + } else if (anywhereWithin) { + skipX = diff < 0 && e.clientX > boundaryElRect.right || diff > 0 && e.clientX < xPosition + parentRect.left; + } else { + skipX = diff < 0 && e.clientX > boundaryElRect.right || diff > 0 && e.clientX < boundaryElRect.right; + } + return skipX; + } + shouldSkipY(e, isTop, topBuffer = 0, diff) { + const elRect = this.element.getBoundingClientRect(); + const parentRect = this.offsetParent.getBoundingClientRect(); + const boundaryElRect = this.boundaryEl.getBoundingClientRect(); + const yPosition = this.config.popup ? this.position.y : elRect.top; + let skipY = yPosition <= 0 && parentRect.top >= e.clientY || parentRect.bottom <= e.clientY && parentRect.bottom <= boundaryElRect.bottom; + if (skipY) { + return true; + } + if (isTop) { + skipY = diff < 0 && e.clientY > yPosition + parentRect.top + topBuffer || diff > 0 && e.clientY < yPosition + parentRect.top; + } else { + skipY = diff < 0 && e.clientY > boundaryElRect.bottom || diff > 0 && e.clientY < boundaryElRect.bottom; + } + return skipY; + } + createResizeMap() { + const getElement2 = (ref) => ({ + element: this.element.querySelector(`[data-ref=${ref}Resizer]`) + }); + this.resizerMap = { + topLeft: getElement2("eTopLeft"), + top: getElement2("eTop"), + topRight: getElement2("eTopRight"), + right: getElement2("eRight"), + bottomRight: getElement2("eBottomRight"), + bottom: getElement2("eBottom"), + bottomLeft: getElement2("eBottomLeft"), + left: getElement2("eLeft") + }; + } + addResizers() { + if (this.resizersAdded) { + return; + } + const eGui = this.element; + if (!eGui) { + return; + } + eGui.appendChild(_createAgElement(RESIZE_TEMPLATE)); + this.createResizeMap(); + this.resizersAdded = true; + } + removeResizers() { + this.resizerMap = undefined; + const resizerEl = this.element.querySelector(`.${RESIZE_CONTAINER_STYLE}`); + resizerEl?.remove(); + this.resizersAdded = false; + } + getResizerElement(side) { + return this.resizerMap[side].element; + } + onResizeStart(e, side) { + this.boundaryEl = this.findBoundaryElement(); + if (!this.positioned) { + this.initialisePosition(); + } + this.currentResizer = { + isTop: !!side.match(/top/i), + isRight: !!side.match(/right/i), + isBottom: !!side.match(/bottom/i), + isLeft: !!side.match(/left/i) + }; + this.element.classList.add("ag-resizing"); + this.resizerMap[side].element.classList.add("ag-active"); + const { popup, forcePopupParentAsOffsetParent } = this.config; + if (!popup && !forcePopupParentAsOffsetParent) { + this.applySizeToSiblings(this.currentResizer.isBottom || this.currentResizer.isTop); + } + this.isResizing = true; + this.updateDragStartPosition(e.clientX, e.clientY); + } + getSiblings() { + const element = this.element; + const parent = element.parentElement; + if (!parent) { + return null; + } + return Array.prototype.slice.call(parent.children).filter((el) => !el.classList.contains("ag-hidden")); + } + getMinSizeOfSiblings() { + const siblings = this.getSiblings() || []; + let height = 0; + let width = 0; + for (const currentEl of siblings) { + const isFlex = !!currentEl.style.flex && currentEl.style.flex !== "0 0 auto"; + if (currentEl === this.element) { + continue; + } + let nextHeight = this.minHeight || 0; + let nextWidth = this.minWidth || 0; + if (isFlex) { + const computedStyle = window.getComputedStyle(currentEl); + if (computedStyle.minHeight) { + nextHeight = Number.parseInt(computedStyle.minHeight, 10); + } + if (computedStyle.minWidth) { + nextWidth = Number.parseInt(computedStyle.minWidth, 10); + } + } else { + nextHeight = currentEl.offsetHeight; + nextWidth = currentEl.offsetWidth; + } + height += nextHeight; + width += nextWidth; + } + return { height, width }; + } + applySizeToSiblings(vertical) { + let containerToFlex = null; + const siblings = this.getSiblings(); + if (!siblings) { + return; + } + for (let i = 0;i < siblings.length; i++) { + const el = siblings[i]; + if (el === containerToFlex) { + continue; + } + if (vertical) { + el.style.height = `${el.offsetHeight}px`; + } else { + el.style.width = `${el.offsetWidth}px`; + } + el.style.flex = "0 0 auto"; + if (el === this.element) { + containerToFlex = siblings[i + 1]; + } + } + if (containerToFlex) { + containerToFlex.style.removeProperty("height"); + containerToFlex.style.removeProperty("min-height"); + containerToFlex.style.removeProperty("max-height"); + containerToFlex.style.flex = "1 1 auto"; + } + } + isResizable() { + return Object.values(this.resizable).some((value) => value); + } + onResize(e) { + if (!this.isResizing || !this.currentResizer) { + return; + } + const { popup, forcePopupParentAsOffsetParent } = this.config; + const { isTop, isRight, isBottom, isLeft } = this.currentResizer; + const isHorizontal = isRight || isLeft; + const isVertical = isBottom || isTop; + const { movementX, movementY } = this.calculateMouseMovement({ e, isLeft, isTop }); + const xPosition = this.position.x; + const yPosition = this.position.y; + let offsetLeft = 0; + let offsetTop = 0; + if (isHorizontal && movementX) { + const direction = isLeft ? -1 : 1; + const oldWidth = this.getWidth(); + const newWidth = oldWidth + movementX * direction; + let skipWidth = false; + if (isLeft) { + offsetLeft = oldWidth - newWidth; + if (xPosition + offsetLeft <= 0 || newWidth <= this.minWidth) { + skipWidth = true; + offsetLeft = 0; + } + } + if (!skipWidth) { + this.setWidth(newWidth); + } + } + if (isVertical && movementY) { + const direction = isTop ? -1 : 1; + const oldHeight = this.getHeight(); + const newHeight = oldHeight + movementY * direction; + let skipHeight = false; + if (isTop) { + offsetTop = oldHeight - newHeight; + if (yPosition + offsetTop <= 0 || newHeight <= this.minHeight) { + skipHeight = true; + offsetTop = 0; + } + } else if (!this.config.popup && !this.config.forcePopupParentAsOffsetParent && oldHeight < newHeight && this.getMinSizeOfSiblings().height + newHeight > this.element.parentElement.offsetHeight) { + skipHeight = true; + } + if (!skipHeight) { + this.setHeight(newHeight); + } + } + this.updateDragStartPosition(e.clientX, e.clientY); + if ((popup || forcePopupParentAsOffsetParent) && offsetLeft || offsetTop) { + this.offsetElement(xPosition + offsetLeft, yPosition + offsetTop); + } + } + onResizeEnd(e, side) { + this.isResizing = false; + this.currentResizer = null; + this.boundaryEl = null; + this.element.classList.remove("ag-resizing"); + this.resizerMap[side].element.classList.remove("ag-active"); + this.dispatchLocalEvent({ type: "resize" }); + } + refreshSize() { + const eGui = this.element; + if (this.config.popup) { + if (!this.config.width) { + this.setWidth(eGui.offsetWidth); + } + if (!this.config.height) { + this.setHeight(eGui.offsetHeight); + } + } + } + onMoveStart(e) { + this.boundaryEl = this.findBoundaryElement(); + if (!this.positioned) { + this.initialisePosition(); + } + this.isMoving = true; + this.element.classList.add("ag-moving"); + this.updateDragStartPosition(e.clientX, e.clientY); + } + onMove(e) { + if (!this.isMoving) { + return; + } + const { x, y } = this.position; + let topBuffer; + if (this.config.calculateTopBuffer) { + topBuffer = this.config.calculateTopBuffer(); + } + const { movementX, movementY } = this.calculateMouseMovement({ + e, + isTop: true, + anywhereWithin: true, + topBuffer + }); + this.offsetElement(x + movementX, y + movementY); + this.updateDragStartPosition(e.clientX, e.clientY); + } + onMoveEnd() { + this.isMoving = false; + 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 el = this.element; + while (el) { + if (window.getComputedStyle(el).position !== "static") { + return el; + } + el = el.parentElement; + } + return this.element; + } + clearResizeListeners() { + while (this.resizeListeners.length) { + const params = this.resizeListeners.pop(); + this.dragSvc?.removeDragSource(params); + } + } + destroy() { + super.destroy(); + if (this.moveElementDragListener) { + this.dragSvc?.removeDragSource(this.moveElementDragListener); + } + this.constrainSizeToAvailableHeight(false); + this.clearResizeListeners(); + this.removeResizers(); + } +}; +var PositionableFeature = class extends AgPositionableFeature { +}; +var RefPlaceholder = null; +function _isComponent(item) { + return typeof item?.getGui === "function"; +} +var CssClassManager = class { + constructor(getGui) { + this.cssClassStates = {}; + this.getGui = getGui; + } + toggleCss(className, addOrRemove) { + if (!className) { + return; + } + if (className.includes(" ")) { + const list = (className || "").split(" "); + if (list.length > 1) { + for (const cls of list) { + this.toggleCss(cls, addOrRemove); + } + return; + } + } + const updateNeeded = this.cssClassStates[className] !== addOrRemove; + if (updateNeeded && className.length) { + this.getGui()?.classList.toggle(className, addOrRemove); + this.cssClassStates[className] = addOrRemove; + } + } +}; +var compIdSequence = 0; +var AgComponentStub = class extends AgBeanStub { + constructor(templateOrParams, componentSelectors) { + super(); + this.suppressDataRefValidation = false; + this.displayed = true; + this.visible = true; + this.compId = compIdSequence++; + this.cssManager = new CssClassManager(() => this.eGui); + this.componentSelectors = new Map((componentSelectors ?? []).map((comp) => [comp.selector, comp])); + if (templateOrParams) { + this.setTemplate(templateOrParams); + } + } + preConstruct() { + this.wireTemplate(this.getGui()); + this.addGlobalCss(); + } + wireTemplate(element, paramsMap) { + if (element && this.gos) { + this.applyElementsToComponent(element); + this.createChildComponentsFromTags(element, paramsMap); + } + } + getCompId() { + return this.compId; + } + getDataRefAttribute(element) { + if (element.getAttribute) { + return element.getAttribute(DataRefAttribute); + } + return null; + } + applyElementsToComponent(element, elementRef, paramsMap, newComponent = null) { + if (elementRef === undefined) { + elementRef = this.getDataRefAttribute(element); + } + if (elementRef) { + const current = this[elementRef]; + if (current === RefPlaceholder) { + this[elementRef] = newComponent ?? element; + } else { + const usedAsParamRef = paramsMap?.[elementRef]; + if (!this.suppressDataRefValidation && !usedAsParamRef) { + throw new Error(`data-ref: ${elementRef} on ${this.constructor.name} with ${current}`); + } + } + } + } + createChildComponentsFromTags(parentNode, paramsMap) { + const childNodeList = []; + for (const childNode of parentNode.childNodes ?? []) { + childNodeList.push(childNode); + } + for (const childNode of childNodeList) { + if (!(childNode instanceof HTMLElement)) { + continue; + } + const childComp = this.createComponentFromElement(childNode, (childComp2) => { + const childGui = childComp2.getGui(); + if (childGui) { + for (const attr of childNode.attributes ?? []) { + childGui.setAttribute(attr.name, attr.value); + } + } + }, paramsMap); + if (childComp) { + if (childComp.addItems && childNode.children.length) { + this.createChildComponentsFromTags(childNode, paramsMap); + const items = Array.prototype.slice.call(childNode.children); + childComp.addItems(items); + } + this.swapComponentForNode(childComp, parentNode, childNode); + } else if (childNode.childNodes) { + this.createChildComponentsFromTags(childNode, paramsMap); + } + } + } + createComponentFromElement(element, afterPreCreateCallback, paramsMap) { + const key = element.nodeName; + const elementRef = this.getDataRefAttribute(element); + const isAgGridComponent = key.indexOf("AG-") === 0; + const componentSelector = isAgGridComponent ? this.componentSelectors.get(key) : null; + let newComponent = null; + if (componentSelector) { + const componentParams = paramsMap && elementRef ? paramsMap[elementRef] : undefined; + newComponent = new componentSelector.component(componentParams); + newComponent.setParentComponent(this); + this.createBean(newComponent, null, afterPreCreateCallback); + } else if (isAgGridComponent) { + throw new Error(`selector: ${key}`); + } + this.applyElementsToComponent(element, elementRef, paramsMap, newComponent); + return newComponent; + } + swapComponentForNode(newComponent, parentNode, childNode) { + const eComponent = newComponent.getGui(); + parentNode.replaceChild(eComponent, childNode); + parentNode.insertBefore(document.createComment(childNode.nodeName), eComponent); + this.addDestroyFunc(this.destroyBean.bind(this, newComponent)); + } + activateTabIndex(elements, overrideTabIndex) { + const tabIndex = overrideTabIndex ?? this.gos.get("tabIndex"); + if (!elements) { + elements = []; + } + if (!elements.length) { + elements.push(this.getGui()); + } + for (const el of elements) { + el.setAttribute("tabindex", tabIndex.toString()); + } + } + setTemplate(templateOrParams, componentSelectors, paramsMap) { + let eGui; + if (typeof templateOrParams === "string" || templateOrParams == null) { + eGui = _loadTemplate(templateOrParams); + } else { + eGui = _createAgElement(templateOrParams); + } + this.setTemplateFromElement(eGui, componentSelectors, paramsMap); + } + setTemplateFromElement(element, components, paramsMap, suppressDataRefValidation = false) { + this.eGui = element; + this.suppressDataRefValidation = suppressDataRefValidation; + if (components) { + for (let i = 0;i < components.length; i++) { + const component = components[i]; + this.componentSelectors.set(component.selector, component); + } + } + this.wireTemplate(element, paramsMap); + } + getGui() { + return this.eGui; + } + getFocusableElement() { + return this.eGui; + } + getAriaElement() { + return this.getFocusableElement(); + } + setParentComponent(component) { + this.parentComponent = component; + } + getParentComponent() { + return this.parentComponent; + } + setGui(eGui) { + this.eGui = eGui; + } + queryForHtmlElement(cssSelector) { + return this.eGui.querySelector(cssSelector); + } + getContainerAndElement(newChild, container) { + let parent = container; + if (newChild == null) { + return null; + } + if (!parent) { + parent = this.eGui; + } + if (_isNodeOrElement(newChild)) { + return { + element: newChild, + parent + }; + } + return { + element: newChild.getGui(), + parent + }; + } + prependChild(newChild, container) { + const { element, parent } = this.getContainerAndElement(newChild, container) || {}; + if (!element || !parent) { + return; + } + parent.prepend(element); + } + appendChild(newChild, container) { + const { element, parent } = this.getContainerAndElement(newChild, container) || {}; + if (!element || !parent) { + return; + } + parent.appendChild(element); + } + isDisplayed() { + return this.displayed; + } + setVisible(visible, options = {}) { + if (visible !== this.visible) { + this.visible = visible; + const { skipAriaHidden } = options; + _setVisible(this.eGui, visible, { skipAriaHidden }); + } + } + setDisplayed(displayed, options = {}) { + if (displayed !== this.displayed) { + this.displayed = displayed; + const { skipAriaHidden } = options; + _setDisplayed(this.eGui, displayed, { skipAriaHidden }); + const event = { + type: "displayChanged", + visible: this.displayed + }; + this.dispatchLocalEvent(event); + } + } + destroy() { + if (this.parentComponent) { + this.parentComponent = undefined; + } + super.destroy(); + } + addGuiEventListener(event, listener, options) { + this.eGui.addEventListener(event, listener, options); + this.addDestroyFunc(() => this.eGui.removeEventListener(event, listener)); + } + addCss(className) { + this.cssManager.toggleCss(className, true); + } + removeCss(className) { + this.cssManager.toggleCss(className, false); + } + toggleCss(className, addOrRemove) { + this.cssManager.toggleCss(className, addOrRemove); + } + registerCSS(css) { + if (this.css === globalCssAdded) { + this.css = [css]; + this.addGlobalCss(); + } else { + this.css || (this.css = []); + this.css.push(css); + } + } + addGlobalCss() { + if (Array.isArray(this.css)) { + const debugId = "component-" + Object.getPrototypeOf(this)?.constructor?.name; + for (const css of this.css ?? []) { + this.beans.environment.addGlobalCSS(css, debugId); + } + } + this.css = globalCssAdded; + } +}; +var globalCssAdded = Symbol(); +var Component = class extends AgComponentStub { +}; +var isSafari; +var isFirefox; +var isMacOs; +var isIOS; +var invisibleScrollbar; +var browserScrollbarWidth; +var maxDivHeight; +function _isBrowserSafari() { + if (isSafari === undefined) { + isSafari = /^((?!chrome|android).)*safari/i.test(navigator.userAgent); + } + return isSafari; +} +function _isBrowserFirefox() { + if (isFirefox === undefined) { + isFirefox = /(firefox)/i.test(navigator.userAgent); + } + return isFirefox; +} +function _isMacOsUserAgent() { + if (isMacOs === undefined) { + isMacOs = /(Mac|iPhone|iPod|iPad)/i.test(navigator.platform); + } + return isMacOs; +} +function _isIOSUserAgent() { + if (isIOS === undefined) { + isIOS = /iPad|iPhone|iPod/.test(navigator.platform) || navigator.platform === "MacIntel" && navigator.maxTouchPoints > 1; + } + return isIOS; +} +function _getTabIndex(el) { + if (!el) { + return null; + } + const numberTabIndex = el.tabIndex; + const tabIndex = el.getAttribute("tabIndex"); + if (numberTabIndex === -1 && (tabIndex === null || tabIndex === "" && !_isBrowserFirefox())) { + return null; + } + return numberTabIndex.toString(); +} +function _getMaxDivHeight() { + if (maxDivHeight !== undefined) { + return maxDivHeight; + } + if (!document.body) { + return -1; + } + let res = 1e6; + const testUpTo = _isBrowserFirefox() ? 6000000 : 1e9; + const div = document.createElement("div"); + document.body.appendChild(div); + while (true) { + const test = res * 2; + div.style.height = test + "px"; + if (test > testUpTo || div.clientHeight !== test) { + break; + } else { + res = test; + } + } + div.remove(); + maxDivHeight = res; + return res; +} +function _getScrollbarWidth() { + if (browserScrollbarWidth == null) { + initScrollbarWidthAndVisibility(); + } + return browserScrollbarWidth; +} +function initScrollbarWidthAndVisibility() { + const body = document.body; + const div = document.createElement("div"); + div.style.width = div.style.height = "100px"; + div.style.opacity = "0"; + div.style.overflow = "scroll"; + div.style.msOverflowStyle = "scrollbar"; + div.style.position = "absolute"; + body.appendChild(div); + let width = div.offsetWidth - div.clientWidth; + if (width === 0 && div.clientWidth === 0) { + width = null; + } + if (div.parentNode) { + div.remove(); + } + if (width != null) { + browserScrollbarWidth = width; + invisibleScrollbar = width === 0; + } +} +function _isInvisibleScrollbar() { + if (invisibleScrollbar == null) { + initScrollbarWidthAndVisibility(); + } + return invisibleScrollbar; +} +var keyboardModeActive = false; +var instanceCount = 0; +function addKeyboardModeEvents(doc) { + if (instanceCount > 0) { + return; + } + doc.addEventListener("keydown", toggleKeyboardMode); + doc.addEventListener("mousedown", toggleKeyboardMode); +} +function removeKeyboardModeEvents(doc) { + if (instanceCount > 0) { + return; + } + doc.removeEventListener("keydown", toggleKeyboardMode); + doc.removeEventListener("mousedown", toggleKeyboardMode); +} +function toggleKeyboardMode(event) { + const isKeyboardActive = keyboardModeActive; + const isKeyboardEvent = event.type === "keydown"; + if (isKeyboardEvent) { + if (event.ctrlKey || event.metaKey || event.altKey) { + return; + } + } + if (isKeyboardActive === isKeyboardEvent) { + return; + } + keyboardModeActive = isKeyboardEvent; +} +function _registerKeyboardFocusEvents(beans) { + const eDocument = _getDocument(beans); + addKeyboardModeEvents(eDocument); + instanceCount++; + return () => { + instanceCount--; + removeKeyboardModeEvents(eDocument); + }; +} +function _isKeyboardMode() { + return keyboardModeActive; +} +function _findFocusableElements(rootNode, exclude, onlyUnmanaged = false) { + const focusableString = FOCUSABLE_SELECTOR; + let excludeString = FOCUSABLE_EXCLUDE; + if (exclude) { + excludeString += ", " + exclude; + } + if (onlyUnmanaged) { + excludeString += ', [tabindex="-1"]'; + } + const nodes = Array.prototype.slice.apply(rootNode.querySelectorAll(focusableString)).filter((node) => { + return _isVisible(node); + }); + const excludeNodes = Array.prototype.slice.apply(rootNode.querySelectorAll(excludeString)); + if (!excludeNodes.length) { + return nodes; + } + const diff = (a, b) => a.filter((element) => b.indexOf(element) === -1); + return diff(nodes, excludeNodes); +} +function _focusInto(rootNode, up = false, onlyUnmanaged = false, excludeTabGuards = false) { + const focusableElements = _findFocusableElements(rootNode, excludeTabGuards ? ".ag-tab-guard" : null, onlyUnmanaged); + const toFocus = up ? _last(focusableElements) : focusableElements[0]; + if (toFocus) { + toFocus.focus({ preventScroll: true }); + return true; + } + return false; +} +function _findNextFocusableElement(beans, rootNode, onlyManaged, backwards) { + const focusable = _findFocusableElements(rootNode, onlyManaged ? ':not([tabindex="-1"])' : null); + const activeEl = _getActiveDomElement(beans); + let currentIndex; + if (onlyManaged) { + currentIndex = focusable.findIndex((el) => el.contains(activeEl)); + } else { + currentIndex = focusable.indexOf(activeEl); + } + const nextIndex = currentIndex + (backwards ? -1 : 1); + if (nextIndex < 0 || nextIndex >= focusable.length) { + return null; + } + return focusable[nextIndex]; +} +function _findTabbableParent(node, limit = 5) { + let counter = 0; + while (node && _getTabIndex(node) === null && ++counter <= limit) { + node = node.parentElement; + } + if (_getTabIndex(node) === null) { + return null; + } + return node; +} +var FOCUS_MANAGED_CLASS = "ag-focus-managed"; +var AgManagedFocusFeature = class extends AgBeanStub { + constructor(eFocusable, stopPropagationCallbacks = { + isStopPropagation: () => false, + stopPropagation: () => {} + }, callbacks = {}) { + super(); + this.eFocusable = eFocusable; + this.stopPropagationCallbacks = stopPropagationCallbacks; + this.callbacks = callbacks; + this.callbacks = { + shouldStopEventPropagation: () => false, + onTabKeyDown: (e) => { + if (e.defaultPrevented) { + return; + } + const nextRoot = _findNextFocusableElement(this.beans, this.eFocusable, false, e.shiftKey); + if (!nextRoot) { + return; + } + nextRoot.focus(); + e.preventDefault(); + }, + ...callbacks + }; + } + postConstruct() { + const { + eFocusable, + callbacks: { onFocusIn, onFocusOut } + } = this; + eFocusable.classList.add(FOCUS_MANAGED_CLASS); + this.addKeyDownListeners(eFocusable); + if (onFocusIn) { + this.addManagedElementListeners(eFocusable, { focusin: onFocusIn }); + } + if (onFocusOut) { + this.addManagedElementListeners(eFocusable, { focusout: onFocusOut }); + } + } + addKeyDownListeners(eGui) { + this.addManagedElementListeners(eGui, { + keydown: (e) => { + if (e.defaultPrevented || this.stopPropagationCallbacks.isStopPropagation(e)) { + return; + } + const { callbacks } = this; + if (callbacks.shouldStopEventPropagation(e)) { + this.stopPropagationCallbacks.stopPropagation(e); + return; + } + if (e.key === KeyCode.TAB) { + callbacks.onTabKeyDown(e); + } else if (callbacks.handleKeyDown) { + callbacks.handleKeyDown(e); + } + } + }); + } +}; +var AG_GRID_STOP_PROPAGATION = "__ag_Grid_Stop_Propagation"; +function _stopPropagationForAgGrid(event) { + event[AG_GRID_STOP_PROPAGATION] = true; +} +function _isStopPropagationForAgGrid(event) { + return event[AG_GRID_STOP_PROPAGATION] === true; +} +var STOP_PROPAGATION_CALLBACKS = { + isStopPropagation: _isStopPropagationForAgGrid, + stopPropagation: _stopPropagationForAgGrid +}; +var ManagedFocusFeature = class extends AgManagedFocusFeature { + constructor(eFocusable, callbacks) { + super(eFocusable, STOP_PROPAGATION_CALLBACKS, callbacks); + } +}; +var FILTER_LOCALE_TEXT = { + 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: (variableValues) => `(${variableValues[0]}, ${variableValues[1]})`, + filterSummaryTextQuote: (variableValues) => `"${variableValues[0]}"`, + minDateValidation: (variableValues) => `Date must be after ${variableValues[0]}`, + maxDateValidation: (variableValues) => `Date must be before ${variableValues[0]}`, + strictMinValueValidation: (variableValues) => `Must be greater than ${variableValues[0]}`, + strictMaxValueValidation: (variableValues) => `Must be less than ${variableValues[0]}` +}; +function translateForFilter(bean, key, variableValues) { + return _translate(bean, FILTER_LOCALE_TEXT, key, variableValues); +} +function getDebounceMs(params, debounceDefault) { + const { debounceMs } = params; + if (_isUseApplyButton(params)) { + if (debounceMs != null) { + _warn(71); + } + return 0; + } + return debounceMs ?? debounceDefault; +} +function _isUseApplyButton(params) { + return (params.buttons?.indexOf("apply") ?? -1) >= 0; +} +function getPlaceholderText(bean, filterPlaceholder, defaultPlaceholder, filterOptionKey) { + let placeholder = translateForFilter(bean, defaultPlaceholder); + if (typeof filterPlaceholder === "function") { + const filterOption = translateForFilter(bean, filterOptionKey); + placeholder = filterPlaceholder({ + filterOptionKey, + filterOption, + placeholder + }); + } else if (typeof filterPlaceholder === "string") { + placeholder = filterPlaceholder; + } + return placeholder; +} +var ProvidedFilter = class extends Component { + constructor(filterNameKey, cssIdentifier) { + super(); + this.filterNameKey = filterNameKey; + this.cssIdentifier = cssIdentifier; + this.applyActive = false; + this.debouncePending = false; + this.defaultDebounceMs = 0; + } + postConstruct() { + const element = { + tag: "div", + cls: `ag-filter-body-wrapper ag-${this.cssIdentifier}-body-wrapper`, + children: [this.createBodyTemplate()] + }; + this.setTemplate(element, this.getAgComponents()); + this.createManagedBean(new ManagedFocusFeature(this.getFocusableElement(), { + handleKeyDown: this.handleKeyDown.bind(this) + })); + this.positionableFeature = this.createBean(new PositionableFeature(this.getPositionableElement(), { + forcePopupParentAsOffsetParent: true + })); + } + handleKeyDown(_e) {} + init(legacyParams) { + const params = legacyParams; + this.setParams(params); + this.setModelIntoUi(params.state.model, true).then(() => this.updateUiVisibility()); + } + areStatesEqual(stateA, stateB) { + return stateA === stateB; + } + refresh(legacyNewParams) { + const newParams = legacyNewParams; + const oldParams = this.params; + this.params = newParams; + const { source, state: newState, additionalEventAttributes } = newParams; + if (source === "colDef") { + this.updateParams(newParams, oldParams); + } + const oldState = this.state; + this.state = newState; + const fromAction = additionalEventAttributes?.fromAction; + if (fromAction && fromAction !== "apply" || newState.model !== oldState.model || !this.areStatesEqual(newState.state, oldState.state)) { + this.setModelIntoUi(newState.model); + } + return true; + } + setParams(params) { + this.params = params; + this.state = params.state; + this.commonUpdateParams(params); + } + updateParams(newParams, oldParams) { + this.commonUpdateParams(newParams, oldParams); + } + commonUpdateParams(newParams, _oldParams) { + this.applyActive = _isUseApplyButton(newParams); + this.setupApplyDebounced(); + } + doesFilterPass(params) { + _warn(283); + const { getHandler, model, column } = this.params; + return getHandler().doesFilterPass({ + ...params, + model, + handlerParams: this.beans.colFilter.getHandlerParams(column) + }); + } + getFilterTitle() { + return this.translate(this.filterNameKey); + } + isFilterActive() { + _warn(284); + return this.params.model != null; + } + setupApplyDebounced() { + const debounceMs = getDebounceMs(this.params, this.defaultDebounceMs); + const debounceFunc = _debounce(this, this.checkApplyDebounce.bind(this), debounceMs); + this.applyDebounced = () => { + this.debouncePending = true; + debounceFunc(); + }; + } + checkApplyDebounce() { + if (this.debouncePending) { + this.debouncePending = false; + this.doApplyModel(); + } + } + getModel() { + _warn(285); + return this.params.model; + } + setModel(model) { + _warn(286); + const { beans, params } = this; + return beans.colFilter.setModelForColumnLegacy(params.column, model); + } + applyModel(_source = "api") { + return this.doApplyModel(); + } + canApply(_model) { + return true; + } + doApplyModel(additionalEventAttributes) { + const { + params, + state: { valid = true, model } + } = this; + if (!valid) { + return false; + } + const changed = !this.areModelsEqual(params.model, model); + if (changed) { + params.onAction("apply", additionalEventAttributes); + } + return changed; + } + onNewRowsLoaded() {} + onUiChanged(apply, afterFloatingFilter = false) { + this.updateUiVisibility(); + const model = this.getModelFromUi(); + const state = { + model, + state: this.getState(), + valid: this.canApply(model) + }; + this.state = state; + const { params, gos, eventSvc, applyActive } = this; + params.onStateChange(state); + params.onUiChange(this.getUiChangeEventParams()); + if (!gos.get("enableFilterHandlers")) { + eventSvc.dispatchEvent({ + type: "filterModified", + column: params.column, + filterInstance: this + }); + } + if (!state.valid) { + return; + } + apply ?? (apply = applyActive ? undefined : "debounce"); + if (apply === "immediately") { + this.doApplyModel({ afterFloatingFilter, afterDataChange: false }); + } else if (apply === "debounce") { + this.applyDebounced(); + } + } + getState() { + return; + } + getUiChangeEventParams() { + return; + } + afterGuiAttached(params) { + this.lastContainerType = params?.container; + this.refreshFilterResizer(params?.container); + } + refreshFilterResizer(containerType) { + const { positionableFeature, gos } = this; + if (!positionableFeature) { + return; + } + const isResizable = containerType === "floatingFilter" || containerType === "columnFilter"; + if (isResizable) { + positionableFeature.restoreLastSize(); + positionableFeature.setResizable(gos.get("enableRtl") ? { bottom: true, bottomLeft: true, left: true } : { bottom: true, bottomRight: true, right: true }); + } else { + positionableFeature.removeSizeFromEl(); + positionableFeature.setResizable(false); + } + positionableFeature.constrainSizeToAvailableHeight(isResizable); + } + afterGuiDetached() { + this.checkApplyDebounce(); + this.positionableFeature?.constrainSizeToAvailableHeight(false); + } + destroy() { + this.positionableFeature = this.destroyBean(this.positionableFeature); + super.destroy(); + } + translate(key, variableValues) { + return translateForFilter(this, key, variableValues); + } + getPositionableElement() { + return this.getGui(); + } + areModelsEqual(a, b) { + if (a === b || a == null && b == null) { + return true; + } + if (a == null || b == null) { + return false; + } + return this.areNonNullModelsEqual(a, b); + } +}; +var AgPopupComponent = class extends AgComponentStub { + isPopup() { + return true; + } + setParentComponent(container) { + container.addCss("ag-has-popup"); + super.setParentComponent(container); + } + destroy() { + const parentComp = this.parentComponent; + const hasParent = parentComp?.isAlive(); + if (hasParent) { + parentComp.getGui().classList.remove("ag-has-popup"); + } + super.destroy(); + } +}; +var AgAbstractCellEditor = class extends AgPopupComponent { + constructor() { + super(...arguments); + this.errorMessages = null; + } + init(params) { + this.params = params; + this.initialiseEditor(params); + this.eEditor.onValueChange(() => params.validate()); + } + destroy() { + this.eEditor.destroy(); + this.errorMessages = null; + super.destroy(); + } +}; +function _getClientSideRowModel(beans) { + const rowModel = beans.rowModel; + return rowModel.getType() === "clientSide" ? rowModel : undefined; +} +var ROW_ID_PREFIX_ROW_GROUP = "row-group-"; +var ROW_ID_PREFIX_TOP_PINNED = "t-"; +var ROW_ID_PREFIX_BOTTOM_PINNED = "b-"; +var OBJECT_ID_SEQUENCE = 0; +var RowNode = class { + constructor(beans) { + this.id = undefined; + this.destroyed = false; + this._groupData = undefined; + this.master = false; + this.detail = undefined; + this.rowIndex = null; + this.field = null; + this.rowGroupColumn = null; + this.key = null; + this.sourceRowIndex = -1; + this._leafs = undefined; + 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 = undefined; + this.displayed = false; + this.rowTop = null; + this.oldRowTop = null; + this.selectable = true; + this.__objectId = OBJECT_ID_SEQUENCE++; + this.alreadyRendered = false; + this.formulaRowIndex = null; + this.hovered = false; + this.__selected = false; + this.beans = beans; + } + get groupData() { + const groupData = this._groupData; + if (groupData !== undefined) { + return groupData; + } + if (this.footer) { + return this.sibling?.groupData; + } + return this.beans.groupStage?.loadGroupData(this) ?? null; + } + set groupData(value) { + this._groupData = value; + } + get primaryRow() { + let node = this.footer && this.sibling ? this.sibling : this; + const { pinnedSibling } = node; + if (pinnedSibling && node.rowPinned) { + node = pinnedSibling; + if (node.footer && node.sibling) { + node = node.sibling; + } + } + return node; + } + get allLeafChildren() { + const leafs = this._leafs; + return leafs === undefined ? this.beans.groupStage?.loadLeafs?.(this) ?? null : leafs; + } + set allLeafChildren(value) { + this._leafs = value; + } + get expanded() { + const expansionSvc = this.beans.expansionSvc; + return expansionSvc ? expansionSvc.isExpanded(this) : this.level === -1 ? true : !!this._expanded; + } + set expanded(value) { + this._expanded = value; + } + setData(data) { + this.setDataCommon(data, false); + } + updateData(data) { + this.setDataCommon(data, true); + } + setDataCommon(data, update) { + const { valueCache, eventSvc } = this.beans; + const oldData = this.data; + this.data = data; + valueCache?.onDataChanged(); + this.updateDataOnDetailNode(); + this.resetQuickFilterAggregateText(); + const event = this.createDataChangedEvent(data, oldData, update); + this.__localEventService?.dispatchEvent(event); + if (this.sibling) { + this.sibling.data = data; + const event2 = this.sibling.createDataChangedEvent(data, oldData, update); + this.sibling.__localEventService?.dispatchEvent(event2); + } + eventSvc.dispatchEvent({ type: "rowNodeDataChanged", node: this }); + const pinnedSibling = this.pinnedSibling; + if (pinnedSibling) { + pinnedSibling.data = data; + pinnedSibling.__localEventService?.dispatchEvent(pinnedSibling.createDataChangedEvent(data, oldData, update)); + eventSvc.dispatchEvent({ type: "rowNodeDataChanged", node: pinnedSibling }); + } + } + updateDataOnDetailNode() { + const detailNode = this.detailNode; + if (detailNode) { + detailNode.data = this.data; + } + } + createDataChangedEvent(newData, oldData, update) { + return { + type: "dataChanged", + node: this, + oldData, + newData, + update + }; + } + getRowIndexString() { + if (this.rowIndex == null) { + _error(13); + return null; + } + if (this.rowPinned === "top") { + return ROW_ID_PREFIX_TOP_PINNED + this.rowIndex; + } + if (this.rowPinned === "bottom") { + return ROW_ID_PREFIX_BOTTOM_PINNED + this.rowIndex; + } + return this.rowIndex.toString(); + } + setDataAndId(data, id) { + const { selectionSvc } = this.beans; + const oldNode = selectionSvc?.createDaemonNode?.(this); + const oldData = this.data; + this.data = data; + this.updateDataOnDetailNode(); + this.setId(id); + if (selectionSvc) { + selectionSvc.updateRowSelectable(this); + selectionSvc.syncInRowNode(this, oldNode); + } + const event = this.createDataChangedEvent(data, oldData, false); + this.__localEventService?.dispatchEvent(event); + } + setId(id) { + const getRowIdFunc = _getRowIdCallback(this.beans.gos); + if (getRowIdFunc) { + if (this.data) { + const parentKeys = this.parent?.getRoute() ?? []; + this.id = getRowIdFunc({ + data: this.data, + parentKeys: parentKeys.length > 0 ? parentKeys : undefined, + level: this.level, + rowPinned: this.rowPinned + }); + if (this.id.startsWith(ROW_ID_PREFIX_ROW_GROUP)) { + _error(14, { + groupPrefix: ROW_ID_PREFIX_ROW_GROUP + }); + } + } else { + this.id = undefined; + } + } else { + this.id = id; + } + } + setRowTop(rowTop) { + this.oldRowTop = this.rowTop; + if (this.rowTop === rowTop) { + return; + } + this.rowTop = rowTop; + this.dispatchRowEvent("topChanged"); + const displayed = rowTop !== null; + if (this.displayed !== displayed) { + this.displayed = displayed; + this.dispatchRowEvent("displayedChanged"); + } + } + clearRowTopAndRowIndex() { + this.oldRowTop = null; + this.setRowTop(null); + this.setRowIndex(null); + } + setHovered(hovered) { + this.hovered = hovered; + } + isHovered() { + return this.hovered; + } + setRowHeight(rowHeight, estimated = false) { + this.rowHeight = rowHeight; + this.rowHeightEstimated = estimated; + this.dispatchRowEvent("heightChanged"); + } + setExpanded(expanded, e, forceSync) { + this.beans.expansionSvc?.setExpanded(this, expanded, e, forceSync); + } + setDataValue(colKey, newValue, eventSource) { + const { colModel, valueSvc, gos, editSvc } = this.beans; + if (colKey == null) { + return false; + } + let column = colModel.getCol(colKey) ?? colModel.getColDefCol(colKey); + if (!column) { + return false; + } + if (!this.group) { + const colDef = column.getColDef(); + if (colDef.pivotValueColumn) { + column = colDef.pivotValueColumn; + } + } + const oldValue = valueSvc.getValueForDisplay({ column, node: this, from: "data" }).value; + if (gos.get("readOnlyEdit")) { + const { + beans: { eventSvc }, + data, + rowIndex, + rowPinned + } = this; + eventSvc.dispatchEvent({ + type: "cellEditRequest", + event: null, + rowIndex, + rowPinned, + column, + colDef: column.colDef, + data, + node: this, + oldValue, + newValue, + value: newValue, + source: eventSource + }); + return false; + } + if (eventSource !== "data" && editSvc && !editSvc.committing) { + const result = editSvc.setDataValue({ rowNode: this, column }, newValue, eventSource); + if (result != null) { + return result; + } + } + const valueChanged = valueSvc.setValue(this, column, newValue, eventSource); + this.dispatchCellChangedEvent(column, newValue, oldValue); + if (valueChanged) { + this.pinnedSibling?.dispatchCellChangedEvent(column, newValue, oldValue); + } + return valueChanged; + } + getDataValue(colKey, from = "data") { + const { colModel, valueSvc, formula } = this.beans; + if (colKey == null) { + return; + } + const column = colModel.getCol(colKey) ?? colModel.getColDefCol(colKey); + if (!column) { + return; + } + const dataRaw = from === "data-raw"; + const resolvedFrom = dataRaw || from === "value" ? "data" : from; + let value = valueSvc.getValue(column, this, resolvedFrom, dataRaw); + if (!dataRaw) { + if (formula && column.isAllowFormula() && formula.isFormula(value)) { + value = formula.resolveValue(column, this); + } + if (from !== "data" && column.getAggFunc() && typeof value === "object" && value != null) { + if (typeof value.toNumber === "function") { + return value.toNumber(); + } + if ("value" in value) { + return value.value; + } + } + } + return value; + } + updateHasChildren() { + let newValue = this.group && !this.footer || !!this.childrenAfterGroup?.length; + const { rowChildrenSvc } = this.beans; + if (rowChildrenSvc) { + newValue = rowChildrenSvc.getHasChildrenValue(this); + } + if (newValue !== this.__hasChildren) { + this.__hasChildren = !!newValue; + this.dispatchRowEvent("hasChildrenChanged"); + } + } + hasChildren() { + if (this.__hasChildren == null) { + this.updateHasChildren(); + } + return this.__hasChildren; + } + dispatchCellChangedEvent(column, newValue, oldValue) { + const cellChangedEvent = { + type: "cellChanged", + node: this, + column, + newValue, + oldValue + }; + this.__localEventService?.dispatchEvent(cellChangedEvent); + } + resetQuickFilterAggregateText() { + this.quickFilterAggregateText = null; + } + isExpandable() { + return this.beans.expansionSvc?.isExpandable(this) ?? false; + } + isSelected() { + if (this.footer) { + return this.sibling.isSelected(); + } + const pinnedSibling = this.rowPinned && this.pinnedSibling; + if (pinnedSibling) { + return pinnedSibling.isSelected(); + } + return this.__selected; + } + depthFirstSearch(callback) { + const childrenAfterGroup = this.childrenAfterGroup; + if (childrenAfterGroup) { + for (let i = 0, len = childrenAfterGroup.length;i < len; ++i) { + childrenAfterGroup[i].depthFirstSearch(callback); + } + } + callback(this); + } + getAggregatedChildren(colKey, recursive) { + const beans = this.beans; + return beans.aggChildrenSvc?.getAggregatedChildren(this, beans.colModel.getCol(colKey), recursive) ?? []; + } + dispatchRowEvent(type) { + this.__localEventService?.dispatchEvent({ + type, + node: this + }); + } + setSelected(newValue, clearSelection = false, source = "api") { + this.beans.selectionSvc?.setNodesSelected({ + nodes: [this], + newValue, + clearSelection, + source + }); + } + isRowPinned() { + return !!this.rowPinned; + } + __addEventListener(eventType, listener) { + const localEventService = this.__localEventService ?? (this.__localEventService = new LocalEventService); + localEventService.addEventListener(eventType, listener); + } + __removeEventListener(eventType, listener) { + this.removeLocalListener(eventType, listener); + } + addEventListener(eventType, userListener) { + this.beans.validation?.checkRowEvents(eventType); + const localEventService = this.__localEventService ?? (this.__localEventService = new LocalEventService); + this.frameworkEventListenerService = this.beans.frameworkOverrides.createLocalEventListenerWrapper?.(this.frameworkEventListenerService, localEventService); + const listener = this.frameworkEventListenerService?.wrap(eventType, userListener) ?? userListener; + localEventService.addEventListener(eventType, listener); + } + removeEventListener(eventType, userListener) { + const listener = this.frameworkEventListenerService?.unwrap(eventType, userListener) ?? userListener; + this.removeLocalListener(eventType, listener); + } + removeLocalListener(eventType, listener) { + const localEventService = this.__localEventService; + if (localEventService) { + localEventService.removeEventListener(eventType, listener); + if (localEventService.noRegisteredListenersExist()) { + this.__localEventService = null; + } + } + } + isFullWidthCell() { + _warn(61); + if (this.detail) { + return true; + } + const isFullWidthCellFunc = this.beans.gos.getCallback("isFullWidthRow"); + return isFullWidthCellFunc ? isFullWidthCellFunc({ rowNode: this }) : false; + } + getRoute() { + if (this.level === -1) { + return []; + } + if (this.key == null) { + return; + } + const res = []; + let pointer = this; + while (pointer?.key != null) { + res.push(pointer.key); + pointer = pointer.parent; + } + return res.reverse(); + } + setRowIndex(rowIndex) { + if (this.rowIndex !== rowIndex) { + this.rowIndex = rowIndex; + this.dispatchRowEvent("rowIndexChanged"); + } + } + setAllChildrenCount(allChildrenCount) { + if (this.allChildrenCount !== allChildrenCount) { + this.allChildrenCount = allChildrenCount; + this.dispatchRowEvent("allChildrenCountChanged"); + } + } + setUiLevel(uiLevel) { + if (this.uiLevel !== uiLevel) { + this.uiLevel = uiLevel; + this.dispatchRowEvent("uiLevelChanged"); + } + } + getFirstChild() { + const childStore = this.childStore; + if (childStore) { + return childStore.getFirstNode(); + } + return this.childrenAfterSort?.[0] ?? null; + } + _destroy(fadeOut) { + if (this.destroyed) { + return false; + } + this.destroyed = true; + const pinnedSibling = this.pinnedSibling; + if (pinnedSibling?.rowPinned && !this.rowPinned) { + this.beans.pinnedRowModel?.pinRow(pinnedSibling, null); + } + if (fadeOut) { + this.clearRowTopAndRowIndex(); + } else { + this.setRowTop(null); + this.setRowIndex(null); + } + if (!this.footer) { + const detailNode = this.detailNode; + if (detailNode) { + detailNode._destroy(fadeOut); + } + const sibling = this.sibling; + if (sibling) { + sibling._destroy(fadeOut); + } + } + return true; + } +}; +function _createGlobalRowEvent(rowNode, gos, type) { + return _addGridCommonParams(gos, { + type, + node: rowNode, + data: rowNode.data, + rowIndex: rowNode.rowIndex, + rowPinned: rowNode.rowPinned + }); +} +var IGNORED_SIBLING_PROPERTIES = /* @__PURE__ */ new Set([ + "__autoHeights", + "__checkAutoHeightsDebounced", + "__localEventService", + "__objectId", + "_groupData", + "_leafs", + "childStore", + "groupValue", + "oldRowTop", + "sticky", + "treeNodeFlags", + "treeParent" +]); +var _createRowNodeSibling = (rowNode, beans) => { + const sibling = new RowNode(beans); + for (const key of Object.keys(rowNode)) { + if (IGNORED_SIBLING_PROPERTIES.has(key)) { + continue; + } + sibling[key] = rowNode[key]; + } + sibling.oldRowTop = null; + return sibling; +}; +var _prevOrNextDisplayedRow = (rowModel, direction, initial) => { + if (!initial) { + return; + } + let rowIndex = initial.rowIndex; + if (rowIndex == null) { + return; + } + rowIndex += direction; + const rowCount = rowModel.getRowCount(); + while (rowIndex >= 0 && rowIndex < rowCount) { + const row = rowModel.getRow(rowIndex); + if (!row || !row.footer && !row.detail) { + return row; + } + rowIndex += direction; + } + return; +}; +var DOUBLE_TAP_MILLISECONDS = 500; +var LONG_PRESS_MILLISECONDS = 550; +var handledTouchEvents; +var addHandledTouchEvent = (event) => { + if (!handledTouchEvents) { + handledTouchEvents = /* @__PURE__ */ new WeakSet; + } else if (handledTouchEvents.has(event)) { + return false; + } + handledTouchEvents.add(event); + return true; +}; +var TouchListener = class { + constructor(eElement, preventClick = false) { + this.eElement = eElement; + this.preventClick = preventClick; + this.startListener = null; + this.handlers = []; + this.eventSvc = undefined; + this.touchStart = null; + this.lastTapTime = null; + this.longPressTimer = 0; + this.moved = false; + } + addEventListener(eventType, listener) { + let eventSvc = this.eventSvc; + if (!eventSvc) { + if (eventSvc === null) { + return; + } + this.eventSvc = eventSvc = new LocalEventService; + const startListener = this.onTouchStart.bind(this); + this.startListener = startListener; + this.eElement.addEventListener("touchstart", startListener, { passive: true }); + } + eventSvc.addEventListener(eventType, listener); + } + removeEventListener(eventType, listener) { + this.eventSvc?.removeEventListener(eventType, listener); + } + onTouchStart(touchEvent) { + if (this.touchStart || !addHandledTouchEvent(touchEvent)) { + return; + } + const touchStart = touchEvent.touches[0]; + this.touchStart = touchStart; + const handlers = this.handlers; + if (!handlers.length) { + const eElement = this.eElement; + const doc = eElement.ownerDocument; + const touchMove = this.onTouchMove.bind(this); + const touchEnd = this.onTouchEnd.bind(this); + const touchCancel = this.onTouchCancel.bind(this); + const passiveTrue = { passive: true }; + const passiveFalse = { passive: false }; + addTempEventHandlers(handlers, [eElement, "touchmove", touchMove, passiveTrue], [doc, "touchcancel", touchCancel, passiveTrue], [doc, "touchend", touchEnd, passiveFalse], [doc, "contextmenu", preventEventDefault, passiveFalse]); + } + this.clearLongPress(); + this.longPressTimer = window.setTimeout(() => { + this.longPressTimer = 0; + if (this.touchStart === touchStart && !this.moved) { + this.moved = true; + this.eventSvc?.dispatchEvent({ type: "longTap", touchStart, touchEvent }); + } + }, LONG_PRESS_MILLISECONDS); + } + onTouchMove(touchEvent) { + const { moved, touchStart } = this; + if (!moved && touchStart) { + const touch = _getFirstActiveTouch(touchStart, touchEvent.touches); + const eventIsFarAway = touch && !_areEventsNear(touch, touchStart, 4); + if (eventIsFarAway) { + this.clearLongPress(); + this.moved = true; + } + } + } + onTouchEnd(touchEvent) { + const touchStart = this.touchStart; + if (!touchStart || !_getFirstActiveTouch(touchStart, touchEvent.changedTouches)) { + return; + } + if (!this.moved) { + this.eventSvc?.dispatchEvent({ type: "tap", touchStart }); + this.checkDoubleTap(touchStart); + } + if (this.preventClick) { + preventEventDefault(touchEvent); + } + this.cancel(); + } + onTouchCancel(touchEvent) { + const touchStart = this.touchStart; + if (!touchStart || !_getFirstActiveTouch(touchStart, touchEvent.changedTouches)) { + return; + } + this.lastTapTime = null; + this.cancel(); + } + checkDoubleTap(touchStart) { + let now = Date.now(); + const lastTapTime = this.lastTapTime; + if (lastTapTime) { + const interval = now - lastTapTime; + if (interval > DOUBLE_TAP_MILLISECONDS) { + this.eventSvc?.dispatchEvent({ type: "doubleTap", touchStart }); + now = null; + } + } + this.lastTapTime = now; + } + cancel() { + this.clearLongPress(); + clearTempEventHandlers(this.handlers); + this.touchStart = null; + } + clearLongPress() { + window.clearTimeout(this.longPressTimer); + this.longPressTimer = 0; + this.moved = false; + } + destroy() { + const startListener = this.startListener; + if (startListener) { + this.startListener = null; + this.eElement.removeEventListener("touchstart", startListener); + } + this.cancel(); + this.eElement = null; + this.eventSvc = null; + } +}; +var CellRangeType = /* @__PURE__ */ ((CellRangeType2) => { + CellRangeType2[CellRangeType2["VALUE"] = 0] = "VALUE"; + CellRangeType2[CellRangeType2["DIMENSION"] = 1] = "DIMENSION"; + return CellRangeType2; +})(CellRangeType || {}); +var contextId = 1; +var AgContext = class { + constructor(params) { + this.beans = {}; + this.createdBeans = []; + this.destroyed = false; + this.instanceId = contextId++; + if (!params?.beanClasses) { + return; + } + this.beanDestroyComparator = params.beanDestroyComparator; + this.init(params); + } + init(params) { + this.id = params.id; + this.beans.context = this; + this.destroyCallback = params.destroyCallback; + for (const beanName of Object.keys(params.providedBeanInstances)) { + this.beans[beanName] = params.providedBeanInstances[beanName]; + } + for (const BeanClass of params.beanClasses) { + const instance = new BeanClass; + if (instance.beanName) { + this.beans[instance.beanName] = instance; + } else { + console.error(`Bean ${BeanClass.name} is missing beanName`); + } + this.createdBeans.push(instance); + } + for (const beanFunc of params.derivedBeans ?? []) { + const { beanName, bean } = beanFunc(this); + this.beans[beanName] = bean; + this.createdBeans.push(bean); + } + if (params.beanInitComparator) { + this.createdBeans.sort(params.beanInitComparator); + } + this.initBeans(this.createdBeans); + } + getBeanInstances() { + return Object.values(this.beans); + } + createBean(bean, afterPreCreateCallback) { + this.initBeans([bean], afterPreCreateCallback); + return bean; + } + initBeans(beanInstances, afterPreCreateCallback) { + const beans = this.beans; + for (const instance of beanInstances) { + instance.preWireBeans?.(beans); + instance.wireBeans?.(beans); + } + for (const instance of beanInstances) { + instance.preConstruct?.(); + } + if (afterPreCreateCallback) { + beanInstances.forEach(afterPreCreateCallback); + } + for (const instance of beanInstances) { + instance.postConstruct?.(); + } + } + getBeans() { + return this.beans; + } + getBean(name) { + return this.beans[name]; + } + getId() { + return this.id; + } + destroy() { + if (this.destroyed) { + return; + } + this.destroyed = true; + const beanInstances = this.getBeanInstances(); + if (this.beanDestroyComparator) { + beanInstances.sort(this.beanDestroyComparator); + } + this.destroyBeans(beanInstances); + this.beans = {}; + this.createdBeans = []; + this.destroyCallback?.(); + } + destroyBean(bean) { + bean?.destroy?.(); + } + destroyBeans(beans) { + if (beans) { + for (let i = 0;i < beans.length; i++) { + this.destroyBean(beans[i]); + } + } + return []; + } + isDestroyed() { + return this.destroyed; + } +}; +function createGridApi(context) { + return { + beanName: "gridApi", + bean: context.getBean("apiFunctionSvc").api + }; +} +var orderedCoreBeans = [ + "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" +]; +var beanNamePosition = Object.fromEntries(orderedCoreBeans.map((beanName, index) => [beanName, index])); +function gridBeanInitComparator(bean1, bean2) { + const index1 = (bean1.beanName ? beanNamePosition[bean1.beanName] : undefined) ?? Number.MAX_SAFE_INTEGER; + const index2 = (bean2.beanName ? beanNamePosition[bean2.beanName] : undefined) ?? Number.MAX_SAFE_INTEGER; + return index1 - index2; +} +function gridBeanDestroyComparator(bean1, bean2) { + if (bean1?.beanName === "gridDestroySvc") { + return -1; + } + if (bean2?.beanName === "gridDestroySvc") { + return 1; + } + return 0; +} +function _createCellId(cellPosition) { + const { rowIndex, rowPinned, column } = cellPosition; + return `${rowIndex}.${rowPinned == null ? "null" : rowPinned}.${column.getId()}`; +} +function _areCellsEqual(cellA, cellB) { + const colsMatch = cellA.column === cellB.column; + const floatingMatch = cellA.rowPinned === cellB.rowPinned; + const indexMatch = cellA.rowIndex === cellB.rowIndex; + return colsMatch && floatingMatch && indexMatch; +} +function _isRowBefore(rowA, rowB) { + switch (rowA.rowPinned) { + case "top": + if (rowB.rowPinned !== "top") { + return true; + } + break; + case "bottom": + if (rowB.rowPinned !== "bottom") { + return false; + } + break; + default: + if (_exists(rowB.rowPinned)) { + return rowB.rowPinned !== "top"; + } + break; + } + return rowA.rowIndex < rowB.rowIndex; +} +function _isSameRow(rowA, rowB) { + if (!rowA && !rowB) { + return true; + } + if (!rowA || !rowB) { + return false; + } + return rowA.rowIndex === rowB.rowIndex && rowA.rowPinned == rowB.rowPinned; +} +function _getFirstRow(beans) { + let rowIndex = 0; + let rowPinned; + const { pinnedRowModel, rowModel, pageBounds } = beans; + if (pinnedRowModel?.getPinnedTopRowCount()) { + rowPinned = "top"; + } else if (rowModel.getRowCount()) { + rowPinned = null; + rowIndex = pageBounds.getFirstRow(); + } else if (pinnedRowModel?.getPinnedBottomRowCount()) { + rowPinned = "bottom"; + } + return rowPinned === undefined ? null : { rowIndex, rowPinned }; +} +function _getLastRow(beans) { + let rowIndex; + let rowPinned = null; + const { pinnedRowModel, pageBounds } = beans; + const pinnedBottomCount = pinnedRowModel?.getPinnedBottomRowCount(); + const pinnedTopCount = pinnedRowModel?.getPinnedTopRowCount(); + if (pinnedBottomCount) { + rowPinned = "bottom"; + rowIndex = pinnedBottomCount - 1; + } else if (beans.rowModel.getRowCount()) { + rowIndex = pageBounds.getLastRow(); + } else if (pinnedTopCount) { + rowPinned = "top"; + rowIndex = pinnedTopCount - 1; + } + return rowIndex === undefined ? null : { rowIndex, rowPinned }; +} +function _getRowNode(beans, gridRow) { + switch (gridRow.rowPinned) { + case "top": + return beans.pinnedRowModel?.getPinnedTopRow(gridRow.rowIndex); + case "bottom": + return beans.pinnedRowModel?.getPinnedBottomRow(gridRow.rowIndex); + default: + return beans.rowModel.getRow(gridRow.rowIndex); + } +} +function _getCellByPosition(beans, cellPosition) { + const spannedCellCtrl = beans.spannedRowRenderer?.getCellByPosition(cellPosition); + if (spannedCellCtrl) { + return spannedCellCtrl; + } + const rowCtrl = beans.rowRenderer.getRowByPosition(cellPosition); + if (!rowCtrl) { + return null; + } + return rowCtrl.getCellCtrl(cellPosition.column); +} +function _getRowById(beans, rowId, rowPinned) { + const { rowModel: rm, pinnedRowModel: prm } = beans; + let node; + node ?? (node = rm?.getRowNode(rowId)); + if (rowPinned) { + node ?? (node = prm?.getPinnedRowById(rowId, rowPinned)); + } else { + node ?? (node = prm?.getPinnedRowById(rowId, "top")); + node ?? (node = prm?.getPinnedRowById(rowId, "bottom")); + } + return node; +} +function _getRowAbove(beans, rowPosition, checkSticky = false) { + const { rowIndex: index, rowPinned: pinned } = rowPosition; + const { pageBounds, pinnedRowModel, rowModel } = beans; + if (index === 0) { + if (pinned === "top") { + return null; + } + if (pinned === "bottom" && rowModel.isRowsToRender()) { + return { rowIndex: pageBounds.getLastRow(), rowPinned: null }; + } + return pinnedRowModel?.isRowsToRender("top") ? { rowIndex: pinnedRowModel.getPinnedTopRowCount() - 1, rowPinned: "top" } : null; + } + if (checkSticky) { + const rowNode = pinned ? undefined : rowModel.getRow(index); + return getNextStickyPosition(beans, rowNode, true) ?? { rowIndex: index - 1, rowPinned: pinned }; + } + return { rowIndex: index - 1, rowPinned: pinned }; +} +function _getAbsoluteRowIndex(beans, rowPosition) { + const { pinnedRowModel, rowModel } = beans; + const pinnedTopRowCount = pinnedRowModel?.getPinnedTopRowCount() ?? 0; + const unpinnedRowCount = rowModel.getRowCount(); + const { rowPinned, rowIndex } = rowPosition; + if (rowPinned === "top") { + return rowIndex; + } + if (rowPinned === "bottom") { + return pinnedTopRowCount + unpinnedRowCount + rowIndex; + } + return pinnedTopRowCount + rowIndex; +} +function _getRowBelow(beans, rowPosition, checkSticky = false) { + const { rowIndex: index, rowPinned: pinned } = rowPosition; + const { pageBounds, pinnedRowModel, rowModel } = beans; + if (isLastRowInContainer(beans, rowPosition)) { + if (pinned === "bottom") { + return null; + } + if (pinned === "top" && rowModel.isRowsToRender()) { + return { rowIndex: pageBounds.getFirstRow(), rowPinned: null }; + } + return pinnedRowModel?.isRowsToRender("bottom") ? { rowIndex: 0, rowPinned: "bottom" } : null; + } + if (checkSticky) { + const rowNode = pinned ? undefined : rowModel.getRow(index); + return getNextStickyPosition(beans, rowNode) ?? { rowIndex: index + 1, rowPinned: pinned }; + } + return { rowIndex: index + 1, rowPinned: pinned }; +} +function getNextStickyPosition(beans, rowNode, up = false) { + const { gos, rowRenderer } = beans; + if (!rowNode?.sticky || !_isGroupRowsSticky(gos)) { + return; + } + const stickyTopCtrls = rowRenderer.getStickyTopRowCtrls(); + const stickyBottomCtrls = rowRenderer.getStickyBottomRowCtrls(); + const isStickyTop = !stickyBottomCtrls.some((ctrl) => ctrl.rowNode.rowIndex === rowNode.rowIndex); + const stickyRowCtrls = isStickyTop ? stickyTopCtrls : stickyBottomCtrls; + const increment = (up ? -1 : 1) * (isStickyTop ? -1 : 1); + let nextCtrl; + for (let i = 0;i < stickyRowCtrls.length; i++) { + if (stickyRowCtrls[i].rowNode.rowIndex === rowNode.rowIndex) { + nextCtrl = stickyRowCtrls[i + increment]; + break; + } + } + return nextCtrl ? { rowIndex: nextCtrl.rowNode.rowIndex, rowPinned: null } : undefined; +} +function isLastRowInContainer(beans, rowPosition) { + const { rowPinned, rowIndex } = rowPosition; + const { pinnedRowModel, pageBounds } = beans; + if (rowPinned === "top") { + const lastTopIndex = (pinnedRowModel?.getPinnedTopRowCount() ?? 0) - 1; + return lastTopIndex <= rowIndex; + } + if (rowPinned === "bottom") { + const lastBottomIndex = (pinnedRowModel?.getPinnedBottomRowCount() ?? 0) - 1; + return lastBottomIndex <= rowIndex; + } + const lastBodyIndex = pageBounds.getLastRow(); + return lastBodyIndex <= rowIndex; +} +function _addFocusableContainerListener(beans, comp, eGui) { + comp.addManagedElementListeners(eGui, { + keydown: (e) => { + if (!e.defaultPrevented && !_shouldSkipFocusableContainerListener(e) && e.key === KeyCode.TAB) { + const backwards = e.shiftKey; + if (!_findNextFocusableElement(beans, eGui, false, backwards)) { + if (_focusNextGridCoreContainer(beans, backwards)) { + e.preventDefault(); + } + } + } + } + }); +} +function _isHeaderFocusSuppressed(beans) { + return beans.gos.get("suppressHeaderFocus") || !!beans.overlays?.exclusive; +} +function _isCellFocusSuppressed(beans) { + return beans.gos.get("suppressCellFocus") || !!beans.overlays?.exclusive; +} +function _focusNextGridCoreContainer(beans, backwards, forceOut = false) { + const gridCtrl = beans.ctrlsSvc.get("gridCtrl"); + const focusResult = gridCtrl.focusNextInnerContainer(backwards); + if (focusResult === true) { + return true; + } + if (focusResult === false) { + return focusResult; + } + if (forceOut || !backwards && !gridCtrl.isDetailGrid() && gridCtrl.isFocusInsideGridBody()) { + gridCtrl.forceFocusOutOfContainer(backwards); + } + return false; +} +function _attemptToRestoreCellFocus(beans, focusedCell) { + const focusSvc = beans.focusSvc; + const currentFocusedCell = focusSvc.getFocusedCell(); + if (currentFocusedCell && focusedCell && _areCellsEqual(currentFocusedCell, focusedCell)) { + const { rowIndex, rowPinned, column } = focusedCell; + if (_isNothingFocused(beans)) { + focusSvc.setFocusedCell({ + rowIndex, + column, + rowPinned, + forceBrowserFocus: true, + preventScrollOnBrowserFocus: !_isKeyboardMode() + }); + } + } +} +function _getDefaultTabTargetForContainer(container, getGridBodyTabTarget) { + const containerName = container.getFocusableContainerName(); + if (containerName === "gridBody") { + return getGridBodyTabTarget(); + } + return _runWithContainerFocusAllowed(container, () => _findFocusableElements(container.getGui(), ".ag-tab-guard").length > 0) ? containerName : null; +} +function _runWithContainerFocusAllowed(container, callback) { + container.setAllowFocus?.(true); + try { + return callback(); + } finally { + container.setAllowFocus?.(false); + } +} +var AG_GRID_SKIP_FOCUSABLE_CONTAINER = "__ag_Grid_Skip_Focusable_Container"; +function _skipFocusableContainerListenerForAgGrid(event) { + event[AG_GRID_SKIP_FOCUSABLE_CONTAINER] = true; +} +function _shouldSkipFocusableContainerListener(event) { + return event[AG_GRID_SKIP_FOCUSABLE_CONTAINER] === true; +} +function getHeaderRowCount(colModel) { + if (!colModel.cols) { + return -1; + } + return colModel.cols.treeDepth + 1; +} +function getFocusHeaderRowCount(beans) { + return beans.ctrlsSvc.getHeaderRowContainerCtrl()?.getRowCount() ?? 0; +} +function getGroupRowsHeight(beans) { + const heights = []; + const headerRowContainerCtrls = beans.ctrlsSvc.getHeaderRowContainerCtrls(); + for (const headerRowContainerCtrl of headerRowContainerCtrls) { + if (!headerRowContainerCtrl) { + continue; + } + const groupRowCount = headerRowContainerCtrl.getGroupRowCount() || 0; + for (let i = 0;i < groupRowCount; i++) { + const headerRowCtrl = headerRowContainerCtrl.getGroupRowCtrlAtIndex(i); + const currentHeightAtPos = heights[i]; + if (headerRowCtrl) { + const newHeight = getColumnGroupHeaderRowHeight(beans, headerRowCtrl); + if (currentHeightAtPos == null || newHeight > currentHeightAtPos) { + heights[i] = newHeight; + } + } + } + } + return heights; +} +function getColumnGroupHeaderRowHeight(beans, headerRowCtrl) { + const defaultHeight = beans.colModel.isPivotMode() ? getPivotGroupHeaderHeight(beans) : getGroupHeaderHeight(beans); + let maxDisplayedHeight = defaultHeight; + const headerRowCellCtrls = headerRowCtrl.getHeaderCellCtrls(); + for (const headerCellCtrl of headerRowCellCtrls) { + const { column } = headerCellCtrl; + const height = column.getAutoHeaderHeight(); + if (height != null && height > maxDisplayedHeight && column.isAutoHeaderHeight()) { + maxDisplayedHeight = height; + } + } + return maxDisplayedHeight; +} +function getColumnHeaderRowHeight(beans) { + const defaultHeight = beans.colModel.isPivotMode() ? getPivotHeaderHeight(beans) : getHeaderHeight(beans); + let maxDisplayedHeight = defaultHeight; + beans.colModel.forAllCols((col) => { + const height = col.getAutoHeaderHeight(); + if (height != null && height > maxDisplayedHeight && col.isAutoHeaderHeight()) { + maxDisplayedHeight = height; + } + }); + return maxDisplayedHeight; +} +function getHeaderHeight(beans) { + return beans.gos.get("headerHeight") ?? beans.environment.getDefaultHeaderHeight(); +} +function getFloatingFiltersHeight(beans) { + return beans.gos.get("floatingFiltersHeight") ?? getHeaderHeight(beans); +} +function getGroupHeaderHeight(beans) { + return beans.gos.get("groupHeaderHeight") ?? getHeaderHeight(beans); +} +function getPivotHeaderHeight(beans) { + return beans.gos.get("pivotHeaderHeight") ?? getHeaderHeight(beans); +} +function getPivotGroupHeaderHeight(beans) { + return beans.gos.get("pivotGroupHeaderHeight") ?? getGroupHeaderHeight(beans); +} +function isHeaderPositionEqual(headerPosA, headerPosB) { + return headerPosA.headerRowIndex === headerPosB.headerRowIndex && headerPosA.column === headerPosB.column; +} +function isHeaderPosition(position) { + return position?.headerRowIndex != null; +} +var GridHeaderCtrl = class extends BeanStub { + setComp(comp, eGui, eFocusableElement) { + this.comp = comp; + this.eGui = eGui; + const { beans } = this; + const { headerNavigation, touchSvc, ctrlsSvc } = beans; + if (headerNavigation) { + this.createManagedBean(new ManagedFocusFeature(eFocusableElement, { + onTabKeyDown: this.onTabKeyDown.bind(this), + handleKeyDown: this.handleKeyDown.bind(this), + onFocusOut: this.onFocusOut.bind(this) + })); + } + this.addManagedEventListeners({ + columnPivotModeChanged: this.onPivotModeChanged.bind(this, beans), + displayedColumnsChanged: this.onDisplayedColumnsChanged.bind(this, beans) + }); + this.onPivotModeChanged(beans); + this.setupHeaderHeight(); + const listener = this.onHeaderContextMenu.bind(this); + this.addManagedElementListeners(this.eGui, { contextmenu: listener }); + touchSvc?.mockHeaderContextMenu(this, listener); + ctrlsSvc.register("gridHeaderCtrl", this); + } + setupHeaderHeight() { + const listener = this.setHeaderHeight.bind(this); + listener(); + this.addManagedPropertyListeners([ + "headerHeight", + "pivotHeaderHeight", + "groupHeaderHeight", + "pivotGroupHeaderHeight", + "floatingFiltersHeight" + ], listener); + this.addManagedEventListeners({ + headerRowsChanged: listener, + columnHeaderHeightChanged: listener, + columnGroupHeaderHeightChanged: () => _requestAnimationFrame(this.beans, () => listener()), + stylesChanged: listener, + advancedFilterEnabledChanged: listener + }); + } + setHeaderHeight() { + const { beans } = this; + let totalHeaderHeight = 0; + const groupHeight = getGroupRowsHeight(beans).reduce((prev, curr) => prev + curr, 0); + const headerHeight = getColumnHeaderRowHeight(beans); + if (beans.filterManager?.hasFloatingFilters()) { + totalHeaderHeight += getFloatingFiltersHeight(beans); + } + totalHeaderHeight += groupHeight; + totalHeaderHeight += headerHeight; + const headerBorderWidth = beans.environment.getHeaderRowBorderWidth(); + const totalHeaderHeightWithBorder = totalHeaderHeight + headerBorderWidth; + if (this.headerHeightWithBorder !== totalHeaderHeightWithBorder) { + this.headerHeightWithBorder = totalHeaderHeightWithBorder; + const px = `${totalHeaderHeightWithBorder}px`; + this.comp.setHeightAndMinHeight(px); + } + if (this.headerHeight !== totalHeaderHeight) { + this.headerHeight = totalHeaderHeight; + this.eventSvc.dispatchEvent({ + type: "headerHeightChanged" + }); + } + } + onPivotModeChanged(beans) { + const pivotMode = beans.colModel.isPivotMode(); + this.comp.toggleCss("ag-pivot-on", pivotMode); + this.comp.toggleCss("ag-pivot-off", !pivotMode); + } + onDisplayedColumnsChanged(beans) { + const columns = beans.visibleCols.allCols; + const shouldAllowOverflow = columns.some((col) => col.isSpanHeaderHeight()); + this.comp.toggleCss("ag-header-allow-overflow", shouldAllowOverflow); + } + onTabKeyDown(e) { + const isRtl = this.gos.get("enableRtl"); + const backwards = e.shiftKey; + const direction = backwards !== isRtl ? "LEFT" : "RIGHT"; + const { beans } = this; + const { headerNavigation, focusSvc } = beans; + if (headerNavigation.navigateHorizontally(direction, true, e) || !backwards && focusSvc.focusOverlay(false) || _focusNextGridCoreContainer(beans, backwards, true)) { + e.preventDefault(); + } + } + handleKeyDown(e) { + let direction = null; + const { headerNavigation } = this.beans; + switch (e.key) { + case KeyCode.LEFT: + direction = "LEFT"; + case KeyCode.RIGHT: { + if (!_exists(direction)) { + direction = "RIGHT"; + } + if (headerNavigation.navigateHorizontally(direction, false, e)) { + e.preventDefault(); + } + break; + } + case KeyCode.UP: + direction = "UP"; + case KeyCode.DOWN: { + if (!_exists(direction)) { + direction = "DOWN"; + } + if (headerNavigation.navigateVertically(direction, e)) { + e.preventDefault(); + } + break; + } + default: + return; + } + } + onFocusOut(e) { + const { relatedTarget } = e; + const { eGui, beans } = this; + if (!relatedTarget && eGui.contains(_getActiveDomElement(beans))) { + return; + } + if (!eGui.contains(relatedTarget)) { + beans.focusSvc.focusedHeader = null; + } + } + onHeaderContextMenu(mouseEvent, touch, touchEvent) { + const { menuSvc, ctrlsSvc } = this.beans; + if (!mouseEvent && !touchEvent || !menuSvc?.isHeaderContextMenuEnabled()) { + return; + } + const { target } = mouseEvent ?? touch; + if (target === this.eGui || target === ctrlsSvc.getHeaderRowContainerCtrl()?.eViewport) { + menuSvc.showHeaderContextMenu(undefined, mouseEvent, touchEvent); + } + } +}; +var AbstractHeaderCellComp = class extends Component { + constructor(template, ctrl) { + super(template); + this.ctrl = ctrl; + } + getCtrl() { + return this.ctrl; + } +}; +var HeaderCellElement = { + 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" } + ] +}; +var HeaderCellComp = class extends AbstractHeaderCellComp { + constructor(ctrl) { + super(HeaderCellElement, ctrl); + this.eResize = RefPlaceholder; + this.eHeaderCompWrapper = RefPlaceholder; + this.headerCompVersion = 0; + } + postConstruct() { + const eGui = this.getGui(); + const refreshSelectAllGui = () => { + const selectAllGui = this.ctrl.getSelectAllGui(); + if (selectAllGui) { + this.eResize.insertAdjacentElement("afterend", selectAllGui); + this.addDestroyFunc(() => selectAllGui.remove()); + } + }; + const compProxy = { + setWidth: (width) => eGui.style.width = width, + toggleCss: (cssClassName, on) => this.toggleCss(cssClassName, on), + setUserStyles: (styles) => _addStylesToElement(eGui, styles), + setAriaSort: (sort) => sort ? _setAriaSort(eGui, sort) : _removeAriaSort(eGui), + setUserCompDetails: (compDetails) => this.setUserCompDetails(compDetails), + getUserCompInstance: () => this.headerComp, + refreshSelectAllGui, + removeSelectAllGui: () => this.ctrl.getSelectAllGui()?.remove() + }; + this.ctrl.setComp(compProxy, this.getGui(), this.eResize, this.eHeaderCompWrapper, undefined); + refreshSelectAllGui(); + } + destroy() { + this.destroyHeaderComp(); + super.destroy(); + } + destroyHeaderComp() { + if (this.headerComp) { + this.headerCompGui?.remove(); + this.headerComp = this.destroyBean(this.headerComp); + this.headerCompGui = undefined; + } + } + setUserCompDetails(compDetails) { + this.headerCompVersion++; + const versionCopy = this.headerCompVersion; + compDetails.newAgStackInstance().then((comp) => this.afterCompCreated(versionCopy, comp)); + } + afterCompCreated(version, headerComp) { + if (version != this.headerCompVersion || !this.isAlive()) { + this.destroyBean(headerComp); + return; + } + this.destroyHeaderComp(); + this.headerComp = headerComp; + this.headerCompGui = headerComp.getGui(); + this.eHeaderCompWrapper.appendChild(this.headerCompGui); + this.ctrl.setDragSource(this.getGui()); + } +}; +var HeaderGroupCellCompElement = { + 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" } + ] +}; +var HeaderGroupCellComp = class extends AbstractHeaderCellComp { + constructor(ctrl) { + super(HeaderGroupCellCompElement, ctrl); + this.eResize = RefPlaceholder; + this.eHeaderCompWrapper = RefPlaceholder; + } + postConstruct() { + const eGui = this.getGui(); + const setAttribute = (key, value) => value != null ? eGui.setAttribute(key, value) : eGui.removeAttribute(key); + const compProxy = { + toggleCss: (cssClassName, on) => this.toggleCss(cssClassName, on), + setUserStyles: (styles) => _addStylesToElement(eGui, styles), + setHeaderWrapperHidden: (hidden) => { + if (hidden) { + this.eHeaderCompWrapper.style.setProperty("display", "none"); + } else { + this.eHeaderCompWrapper.style.removeProperty("display"); + } + }, + setHeaderWrapperMaxHeight: (value) => { + if (value != null) { + this.eHeaderCompWrapper.style.setProperty("max-height", `${value}px`); + } else { + this.eHeaderCompWrapper.style.removeProperty("max-height"); + } + this.eHeaderCompWrapper.classList.toggle("ag-header-cell-comp-wrapper-limited-height", value != null); + }, + setResizableDisplayed: (displayed) => _setDisplayed(this.eResize, displayed), + setWidth: (width) => eGui.style.width = width, + setAriaExpanded: (expanded) => setAttribute("aria-expanded", expanded), + setUserCompDetails: (details) => this.setUserCompDetails(details), + getUserCompInstance: () => this.headerGroupComp + }; + this.ctrl.setComp(compProxy, eGui, this.eResize, this.eHeaderCompWrapper, undefined); + } + setUserCompDetails(details) { + details.newAgStackInstance().then((comp) => this.afterHeaderCompCreated(comp)); + } + afterHeaderCompCreated(headerGroupComp) { + const destroyFunc = () => this.destroyBean(headerGroupComp); + if (!this.isAlive()) { + destroyFunc(); + return; + } + const eGui = this.getGui(); + const eHeaderGroupGui = headerGroupComp.getGui(); + this.eHeaderCompWrapper.appendChild(eHeaderGroupGui); + this.addDestroyFunc(destroyFunc); + this.headerGroupComp = headerGroupComp; + this.ctrl.setDragSource(eGui); + } +}; +var HeaderFilterCellCompElement = { + 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" } + } + ] + } + ] +}; +var HeaderFilterCellComp = class extends AbstractHeaderCellComp { + constructor(ctrl) { + super(HeaderFilterCellCompElement, ctrl); + this.eFloatingFilterBody = RefPlaceholder; + this.eButtonWrapper = RefPlaceholder; + this.eButtonShowMainFilter = RefPlaceholder; + } + postConstruct() { + const eGui = this.getGui(); + const compProxy = { + toggleCss: (cssClassName, on) => this.toggleCss(cssClassName, on), + setUserStyles: (styles) => _addStylesToElement(eGui, styles), + addOrRemoveBodyCssClass: (cssClassName, on) => this.eFloatingFilterBody.classList.toggle(cssClassName, on), + setButtonWrapperDisplayed: (displayed) => _setDisplayed(this.eButtonWrapper, displayed), + setCompDetails: (compDetails) => this.setCompDetails(compDetails), + getFloatingFilterComp: () => this.compPromise, + setWidth: (width) => eGui.style.width = width, + setMenuIcon: (eIcon) => this.eButtonShowMainFilter.appendChild(eIcon) + }; + this.ctrl.setComp(compProxy, eGui, this.eButtonShowMainFilter, this.eFloatingFilterBody, undefined); + } + setCompDetails(compDetails) { + if (!compDetails) { + this.destroyFloatingFilterComp(); + this.compPromise = null; + return; + } + this.compPromise = compDetails.newAgStackInstance(); + this.compPromise.then((comp) => this.afterCompCreated(comp)); + } + destroy() { + this.destroyFloatingFilterComp(); + super.destroy(); + } + destroyFloatingFilterComp() { + this.floatingFilterComp?.getGui().remove(); + this.floatingFilterComp = this.destroyBean(this.floatingFilterComp); + } + afterCompCreated(comp) { + if (!comp) { + return; + } + if (!this.isAlive()) { + this.destroyBean(comp); + return; + } + this.destroyFloatingFilterComp(); + this.floatingFilterComp = comp; + this.eFloatingFilterBody.appendChild(comp.getGui()); + comp.afterGuiAttached?.(); + } +}; +var HeaderRowComp = class extends Component { + constructor(ctrl) { + super({ tag: "div", cls: ctrl.headerRowClass, role: "row" }); + this.ctrl = ctrl; + this.headerComps = {}; + } + postConstruct() { + const eGui = this.getGui(); + eGui.setAttribute("tabindex", String(this.gos.get("tabIndex"))); + _setAriaRowIndex(this.getGui(), this.ctrl.getAriaRowIndex()); + const compProxy = { + setHeight: (height) => this.getGui().style.height = height, + setTop: (top) => this.getGui().style.top = top, + setHeaderCtrls: (ctrls, forceOrder) => this.setHeaderCtrls(ctrls, forceOrder), + setWidth: (width) => this.getGui().style.width = width, + setRowIndex: (rowIndex) => _setAriaRowIndex(this.getGui(), rowIndex) + }; + this.ctrl.setComp(compProxy, undefined); + } + destroy() { + this.setHeaderCtrls([], false); + super.destroy(); + } + setHeaderCtrls(ctrls, forceOrder) { + if (!this.isAlive()) { + return; + } + const oldComps = this.headerComps; + this.headerComps = {}; + for (const ctrl of ctrls) { + const id = ctrl.instanceId; + let comp = oldComps[id]; + delete oldComps[id]; + if (comp == null) { + comp = this.createHeaderComp(ctrl); + this.getGui().appendChild(comp.getGui()); + } + this.headerComps[id] = comp; + } + Object.values(oldComps).forEach((comp) => { + comp.getGui().remove(); + this.destroyBean(comp); + }); + if (forceOrder) { + const comps = Object.values(this.headerComps); + comps.sort((a, b) => { + const leftA = a.getCtrl().column.getLeft(); + const leftB = b.getCtrl().column.getLeft(); + return leftA - leftB; + }); + const elementsInOrder = comps.map((c) => c.getGui()); + _setDomChildOrder(this.getGui(), elementsInOrder); + } + } + createHeaderComp(headerCtrl) { + let result; + switch (this.ctrl.type) { + case "group": + result = new HeaderGroupCellComp(headerCtrl); + break; + case "filter": + result = new HeaderFilterCellComp(headerCtrl); + break; + default: + result = new HeaderCellComp(headerCtrl); + break; + } + this.createBean(result); + result.setParentComponent(this); + return result; + } +}; +var CenterWidthFeature = class extends BeanStub { + constructor(callback, addSpacer = false) { + super(); + this.callback = callback; + this.addSpacer = addSpacer; + } + postConstruct() { + const listener = this.setWidth.bind(this); + this.addManagedPropertyListener("domLayout", listener); + this.addManagedEventListeners({ + columnContainerWidthChanged: listener, + displayedColumnsChanged: listener, + leftPinnedWidthChanged: listener + }); + if (this.addSpacer) { + this.addManagedEventListeners({ + rightPinnedWidthChanged: listener, + scrollVisibilityChanged: listener, + scrollbarWidthChanged: listener + }); + } + this.setWidth(); + } + setWidth() { + const printLayout = _isDomLayout(this.gos, "print"); + const { visibleCols, scrollVisibleSvc } = this.beans; + const centerWidth = visibleCols.bodyWidth; + const leftWidth = visibleCols.getColsLeftWidth(); + const rightWidth = visibleCols.getDisplayedColumnsRightWidth(); + let totalWidth; + if (printLayout) { + totalWidth = centerWidth + leftWidth + rightWidth; + } else { + totalWidth = centerWidth; + if (this.addSpacer) { + const relevantWidth = this.gos.get("enableRtl") ? leftWidth : rightWidth; + if (relevantWidth === 0 && scrollVisibleSvc.verticalScrollShowing) { + totalWidth += scrollVisibleSvc.getScrollbarWidth(); + } + } + } + this.callback(totalWidth); + } +}; +function setupCompBean(ctrl, ctx, compBean) { + if (compBean) { + ctrl.addDestroyFunc(() => ctx.destroyBean(compBean)); + } + return compBean ?? ctrl; +} +var SetLeftFeature = class extends BeanStub { + constructor(columnOrGroup, eCell, beans, colsSpanning) { + super(); + this.columnOrGroup = columnOrGroup; + this.eCell = eCell; + this.colsSpanning = colsSpanning; + this.columnOrGroup = columnOrGroup; + this.ariaEl = eCell.querySelector("[role=columnheader]") || eCell; + this.beans = beans; + } + setColsSpanning(colsSpanning) { + this.colsSpanning = colsSpanning; + this.onLeftChanged(); + } + getColumnOrGroup() { + const { beans, colsSpanning } = this; + if (beans.gos.get("enableRtl") && colsSpanning) { + return _last(colsSpanning); + } + return this.columnOrGroup; + } + postConstruct() { + const onLeftChanged = this.onLeftChanged.bind(this); + this.addManagedListeners(this.columnOrGroup, { leftChanged: onLeftChanged }); + this.setLeftFirstTime(); + this.addManagedEventListeners({ displayedColumnsWidthChanged: onLeftChanged }); + this.addManagedPropertyListener("domLayout", onLeftChanged); + } + setLeftFirstTime() { + const { gos, colAnimation } = this.beans; + const suppressMoveAnimation = gos.get("suppressColumnMoveAnimation"); + const oldLeftExists = _exists(this.columnOrGroup.getOldLeft()); + const animateColumnMove = colAnimation?.isActive() && oldLeftExists && !suppressMoveAnimation; + if (animateColumnMove) { + this.animateInLeft(); + } else { + this.onLeftChanged(); + } + } + animateInLeft() { + const colOrGroup = this.getColumnOrGroup(); + const oldActualLeft = this.modifyLeftForPrintLayout(colOrGroup, colOrGroup.getOldLeft()); + const actualLeft = this.modifyLeftForPrintLayout(colOrGroup, colOrGroup.getLeft()); + this.setLeft(oldActualLeft); + this.actualLeft = actualLeft; + this.beans.colAnimation.executeNextVMTurn(() => { + if (this.actualLeft === actualLeft) { + this.setLeft(actualLeft); + } + }); + } + onLeftChanged() { + const colOrGroup = this.getColumnOrGroup(); + const left = colOrGroup.getLeft(); + this.actualLeft = this.modifyLeftForPrintLayout(colOrGroup, left); + this.setLeft(this.actualLeft); + } + modifyLeftForPrintLayout(colOrGroup, leftPosition) { + const { gos, visibleCols } = this.beans; + const printLayout = _isDomLayout(gos, "print"); + if (!printLayout) { + return leftPosition; + } + if (colOrGroup.getPinned() === "left") { + return leftPosition; + } + const leftWidth = visibleCols.getColsLeftWidth(); + if (colOrGroup.getPinned() === "right") { + const bodyWidth = visibleCols.bodyWidth; + return leftWidth + bodyWidth + leftPosition; + } + return leftWidth + leftPosition; + } + setLeft(value) { + if (_exists(value)) { + this.eCell.style.left = `${value}px`; + } + if (isColumnGroup(this.columnOrGroup)) { + const children = this.columnOrGroup.getLeafColumns(); + if (!children.length) { + return; + } + if (children.length > 1) { + _setAriaColSpan(this.ariaEl, children.length); + } + } + } +}; +var CSS_FIRST_COLUMN = "ag-column-first"; +var CSS_LAST_COLUMN = "ag-column-last"; +function _getHeaderClassesFromColDef(abstractColDef, gos, column, columnGroup) { + if (_missing(abstractColDef)) { + return []; + } + return getColumnClassesFromCollDef(abstractColDef.headerClass, abstractColDef, gos, column, columnGroup); +} +function _getToolPanelClassesFromColDef(abstractColDef, gos, column, columnGroup) { + if (_missing(abstractColDef)) { + return []; + } + return getColumnClassesFromCollDef(abstractColDef.toolPanelClass, abstractColDef, gos, column, columnGroup); +} +function refreshFirstAndLastStyles(comp, column, presentedColsService) { + comp.toggleCss(CSS_FIRST_COLUMN, presentedColsService.isColAtEdge(column, "first")); + comp.toggleCss(CSS_LAST_COLUMN, presentedColsService.isColAtEdge(column, "last")); +} +function getClassParams(abstractColDef, gos, column, columnGroup) { + return _addGridCommonParams(gos, { + colDef: abstractColDef, + column, + columnGroup + }); +} +function getColumnClassesFromCollDef(classesOrFunc, abstractColDef, gos, column, columnGroup) { + if (_missing(classesOrFunc)) { + return []; + } + let classToUse; + if (typeof classesOrFunc === "function") { + const params = getClassParams(abstractColDef, gos, column, columnGroup); + classToUse = classesOrFunc(params); + } else { + classToUse = classesOrFunc; + } + if (typeof classToUse === "string") { + return [classToUse]; + } + if (Array.isArray(classToUse)) { + return [...classToUse]; + } + return []; +} +var instanceIdSequence2 = 0; +var DOM_DATA_KEY_HEADER_CTRL = "headerCtrl"; +var AbstractHeaderCellCtrl = class extends BeanStub { + constructor(column, rowCtrl) { + super(); + this.column = column; + this.rowCtrl = rowCtrl; + this.resizeToggleTimeout = 0; + this.resizeMultiplier = 1; + this.resizeFeature = null; + this.lastFocusEvent = null; + this.dragSource = null; + this.reAttemptToFocus = false; + this.instanceId = column.getUniqueId() + "-" + instanceIdSequence2++; + } + postConstruct() { + const refreshTabIndex = this.refreshTabIndex.bind(this); + this.addManagedPropertyListeners(["suppressHeaderFocus"], refreshTabIndex); + this.addManagedEventListeners({ + overlayExclusiveChanged: refreshTabIndex + }); + } + setComp(comp, eGui, eResize, eHeaderCompWrapper, compBean) { + eGui.setAttribute("col-id", this.column.colIdSanitised); + this.wireComp(comp, eGui, eResize, eHeaderCompWrapper, compBean); + if (this.reAttemptToFocus) { + this.reAttemptToFocus = false; + this.focus(this.lastFocusEvent ?? undefined); + } + } + shouldStopEventPropagation(event) { + const { headerRowIndex, column } = this.beans.focusSvc.focusedHeader; + const colDef = column.getDefinition(); + const colDefFunc = colDef?.suppressHeaderKeyboardEvent; + if (!_exists(colDefFunc)) { + return false; + } + const params = _addGridCommonParams(this.gos, { + colDef, + column, + headerRowIndex, + event + }); + return !!colDefFunc(params); + } + getWrapperHasFocus() { + const activeEl = _getActiveDomElement(this.beans); + return activeEl === this.eGui; + } + setGui(eGui, compBean) { + this.eGui = eGui; + this.addDomData(compBean); + compBean.addManagedListeners(this.beans.eventSvc, { + displayedColumnsChanged: this.onDisplayedColumnsChanged.bind(this) + }); + compBean.addManagedElementListeners(this.eGui, { + focus: this.onGuiFocus.bind(this) + }); + this.onDisplayedColumnsChanged(); + this.refreshTabIndex(); + } + refreshHeaderStyles() { + const colDef = this.column.getDefinition(); + if (!colDef) { + return; + } + const { headerStyle } = colDef; + let styles; + if (typeof headerStyle === "function") { + const cellStyleParams = this.getHeaderClassParams(); + styles = headerStyle(cellStyleParams); + } else { + styles = headerStyle; + } + if (styles) { + this.comp.setUserStyles(styles); + } + } + onGuiFocus() { + this.eventSvc.dispatchEvent({ + type: "headerFocused", + column: this.column + }); + } + setupAutoHeight(params) { + const { wrapperElement, checkMeasuringCallback, compBean } = params; + const { beans } = this; + const measureHeight = (timesCalled) => { + if (!this.isAlive() || !compBean.isAlive()) { + return; + } + const { paddingTop, paddingBottom, borderBottomWidth, borderTopWidth } = _getElementSize(this.eGui); + const extraHeight = paddingTop + paddingBottom + borderBottomWidth + borderTopWidth; + const wrapperHeight = wrapperElement.offsetHeight; + const autoHeight = wrapperHeight + extraHeight; + if (timesCalled < 5) { + const doc = _getDocument(beans); + const notYetInDom = !doc?.contains(wrapperElement); + const possiblyNoContentYet = autoHeight == 0; + if (notYetInDom || possiblyNoContentYet) { + _batchCall(() => measureHeight(timesCalled + 1), "raf", beans); + return; + } + } + this.setColHeaderHeight(this.column, autoHeight); + }; + let isMeasuring = false; + let stopResizeObserver; + const checkMeasuring = () => { + const newValue = this.column.isAutoHeaderHeight(); + if (newValue && !isMeasuring) { + startMeasuring(); + } + if (!newValue && isMeasuring) { + stopMeasuring(); + } + }; + const startMeasuring = () => { + isMeasuring = true; + this.comp.toggleCss("ag-header-cell-auto-height", true); + measureHeight(0); + stopResizeObserver = _observeResize(this.beans, wrapperElement, () => measureHeight(0)); + }; + const stopMeasuring = () => { + isMeasuring = false; + if (stopResizeObserver) { + stopResizeObserver(); + } + this.comp.toggleCss("ag-header-cell-auto-height", false); + stopResizeObserver = undefined; + }; + checkMeasuring(); + compBean.addDestroyFunc(() => stopMeasuring()); + compBean.addManagedListeners(this.column, { widthChanged: () => isMeasuring && measureHeight(0) }); + compBean.addManagedEventListeners({ + sortChanged: () => { + if (isMeasuring) { + window.setTimeout(() => measureHeight(0)); + } + } + }); + if (checkMeasuringCallback) { + checkMeasuringCallback(checkMeasuring); + } + } + onDisplayedColumnsChanged() { + const { comp, column, beans, eGui } = this; + if (!comp || !column || !eGui) { + return; + } + refreshFirstAndLastStyles(comp, column, beans.visibleCols); + _setAriaColIndex(eGui, beans.visibleCols.getAriaColIndex(column)); + } + addResizeAndMoveKeyboardListeners(compBean) { + compBean.addManagedListeners(this.eGui, { + keydown: this.onGuiKeyDown.bind(this), + keyup: this.onGuiKeyUp.bind(this) + }); + } + refreshTabIndex() { + const suppressHeaderFocus = _isHeaderFocusSuppressed(this.beans); + if (this.eGui) { + _addOrRemoveAttribute(this.eGui, "tabindex", suppressHeaderFocus ? null : "-1"); + } + } + onGuiKeyDown(e) { + const activeEl = _getActiveDomElement(this.beans); + const isLeftOrRight = e.key === KeyCode.LEFT || e.key === KeyCode.RIGHT; + if (this.isResizing) { + e.preventDefault(); + e.stopImmediatePropagation(); + } + if (activeEl !== this.eGui || !e.shiftKey && !e.altKey && !e.ctrlKey && !e.metaKey) { + return; + } + if (this.isResizing || isLeftOrRight) { + e.preventDefault(); + e.stopImmediatePropagation(); + } + const isCopy = (e.ctrlKey || e.metaKey) && _normaliseQwertyAzerty(e) === KeyCode.C; + if (isCopy) { + return this.beans.clipboardSvc?.copyToClipboard(); + } + if (!isLeftOrRight) { + return; + } + const isLeft = e.key === KeyCode.LEFT !== this.gos.get("enableRtl"); + const direction = isLeft ? "left" : "right"; + if (e.altKey) { + this.isResizing = true; + this.resizeMultiplier += 1; + const diff = this.getViewportAdjustedResizeDiff(e); + this.resizeHeader(diff, e.shiftKey); + this.resizeFeature?.toggleColumnResizing(true); + } else { + this.moveHeader(direction); + } + } + moveHeader(hDirection) { + this.beans.colMoves?.moveHeader(hDirection, this.eGui, this.column, this.rowCtrl.pinned, this); + } + getViewportAdjustedResizeDiff(e) { + const diff = this.getResizeDiff(e); + const { pinnedCols } = this.beans; + return pinnedCols ? pinnedCols.getHeaderResizeDiff(diff, this.column) : diff; + } + getResizeDiff(e) { + const { gos, column } = this; + let isLeft = e.key === KeyCode.LEFT !== gos.get("enableRtl"); + const pinned = column.getPinned(); + const isRtl = gos.get("enableRtl"); + if (pinned) { + if (isRtl !== (pinned === "right")) { + isLeft = !isLeft; + } + } + return (isLeft ? -1 : 1) * this.resizeMultiplier; + } + onGuiKeyUp() { + if (!this.isResizing) { + return; + } + if (this.resizeToggleTimeout) { + window.clearTimeout(this.resizeToggleTimeout); + this.resizeToggleTimeout = 0; + } + this.isResizing = false; + this.resizeMultiplier = 1; + this.resizeToggleTimeout = window.setTimeout(() => { + this.resizeFeature?.toggleColumnResizing(false); + }, 150); + } + handleKeyDown(e) { + const wrapperHasFocus = this.getWrapperHasFocus(); + switch (e.key) { + case KeyCode.PAGE_DOWN: + case KeyCode.PAGE_UP: + case KeyCode.PAGE_HOME: + case KeyCode.PAGE_END: + if (wrapperHasFocus) { + e.preventDefault(); + } + } + } + addDomData(compBean) { + const key = DOM_DATA_KEY_HEADER_CTRL; + const { eGui, gos } = this; + _setDomData(gos, eGui, key, this); + compBean.addDestroyFunc(() => _setDomData(gos, eGui, key, null)); + } + focus(event) { + if (!this.isAlive()) { + return false; + } + const { eGui } = this; + if (!eGui) { + this.reAttemptToFocus = true; + } else { + this.lastFocusEvent = event || null; + eGui.focus(); + } + return true; + } + 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(mouseEvent, touchEvent, column) { + const event = mouseEvent ?? touchEvent; + const { menuSvc, gos } = this.beans; + if (gos.get("preventDefaultOnContextMenu")) { + event.preventDefault(); + } + if (menuSvc?.isHeaderContextMenuEnabled(column)) { + menuSvc.showHeaderContextMenu(column, mouseEvent, touchEvent); + } + this.dispatchColumnMouseEvent("columnHeaderContextMenu", column); + } + dispatchColumnMouseEvent(eventType, column) { + this.eventSvc.dispatchEvent({ + type: eventType, + column + }); + } + setColHeaderHeight(col, height) { + if (!col.setAutoHeaderHeight(height)) { + return; + } + const { eventSvc } = this; + if (col.isColumn) { + eventSvc.dispatchEvent({ + type: "columnHeaderHeightChanged", + column: col, + columns: [col], + source: "autosizeColumnHeaderHeight" + }); + } else { + eventSvc.dispatchEvent({ + type: "columnGroupHeaderHeightChanged", + columnGroup: col, + 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; + } +}; +var HeaderCellCtrl = class extends AbstractHeaderCellCtrl { + constructor() { + super(...arguments); + this.refreshFunctions = {}; + this.userHeaderClasses = /* @__PURE__ */ new Set; + this.ariaDescriptionProperties = /* @__PURE__ */ new Map; + } + wireComp(comp, eGui, eResize, eHeaderCompWrapper, compBeanInput) { + this.comp = comp; + const { rowCtrl, column, beans } = this; + const { colResize, context, colHover, rangeSvc } = beans; + const compBean = setupCompBean(this, context, compBeanInput); + this.setGui(eGui, compBean); + this.updateState(); + this.setupWidth(compBean); + this.setupMovingCss(compBean); + this.setupMenuClass(compBean); + this.setupSortableClass(compBean); + this.setupWrapTextClass(); + this.refreshSpanHeaderHeight(); + this.setupAutoHeight({ + wrapperElement: eHeaderCompWrapper, + checkMeasuringCallback: (checkMeasuring) => this.setRefreshFunction("measuring", checkMeasuring), + compBean + }); + this.addColumnHoverListener(compBean); + this.setupFilterClass(compBean); + this.setupStylesFromColDef(); + this.setupClassesFromColDef(); + this.setupTooltip(); + this.addActiveHeaderMouseListeners(compBean); + this.setupSelectAll(compBean); + this.setupUserComp(); + this.refreshAria(); + if (colResize) { + this.resizeFeature = compBean.createManagedBean(colResize.createResizeFeature(rowCtrl.pinned, column, eResize, comp, this)); + } else { + _setDisplayed(eResize, false); + } + colHover?.createHoverFeature(compBean, [column], eGui); + rangeSvc?.createRangeHighlightFeature(compBean, column, comp); + compBean.createManagedBean(new SetLeftFeature(column, eGui, beans)); + compBean.createManagedBean(new ManagedFocusFeature(eGui, { + shouldStopEventPropagation: (e) => this.shouldStopEventPropagation(e), + onTabKeyDown: () => null, + handleKeyDown: this.handleKeyDown.bind(this), + onFocusIn: this.onFocusIn.bind(this), + onFocusOut: this.onFocusOut.bind(this) + })); + this.addResizeAndMoveKeyboardListeners(compBean); + compBean.addManagedPropertyListeners(["suppressMovableColumns", "suppressMenuHide", "suppressAggFuncInHeader", "enableAdvancedFilter"], () => this.refresh()); + compBean.addManagedListeners(column, { + colDefChanged: () => this.refresh(), + formulaRefChanged: () => this.refresh(), + headerHighlightChanged: this.onHeaderHighlightChanged.bind(this) + }); + const listener = () => this.checkDisplayName(); + compBean.addManagedEventListeners({ + columnValueChanged: listener, + columnRowGroupChanged: listener, + columnPivotChanged: listener, + headerHeightChanged: this.onHeaderHeightChanged.bind(this) + }); + compBean.addDestroyFunc(() => { + this.refreshFunctions = {}; + this.selectAllFeature = null; + this.dragSourceElement = undefined; + this.userCompDetails = null; + this.userHeaderClasses.clear(); + this.ariaDescriptionProperties.clear(); + this.clearComponent(); + }); + } + resizeHeader(delta, shiftKey) { + this.beans.colResize?.resizeHeader(this.column, delta, shiftKey); + } + getHeaderClassParams() { + const { column, beans } = this; + const colDef = column.colDef; + return _addGridCommonParams(beans.gos, { + colDef, + column, + floatingFilter: false + }); + } + setupUserComp() { + const compDetails = this.lookupUserCompDetails(); + if (compDetails) { + this.setCompDetails(compDetails); + } + } + setCompDetails(compDetails) { + this.userCompDetails = compDetails; + this.comp.setUserCompDetails(compDetails); + } + lookupUserCompDetails() { + const params = this.createParams(); + const colDef = this.column.getColDef(); + return _getHeaderCompDetails(this.beans.userCompFactory, colDef, params); + } + createParams() { + const { menuSvc, sortSvc, colFilter, gos } = this.beans; + const params = _addGridCommonParams(gos, { + column: this.column, + displayName: this.displayName, + enableSorting: this.column.isSortable(), + enableMenu: this.menuEnabled, + enableFilterButton: this.openFilterEnabled && !!menuSvc?.isHeaderFilterButtonEnabled(this.column), + enableFilterIcon: !!colFilter && (!this.openFilterEnabled || _isLegacyMenuEnabled(this.gos)), + showColumnMenu: (buttonElement, onClosedCallback) => { + menuSvc?.showColumnMenu({ + column: this.column, + buttonElement, + positionBy: "button", + onClosedCallback + }); + }, + showColumnMenuAfterMouseClick: (mouseEvent, onClosedCallback) => { + menuSvc?.showColumnMenu({ + column: this.column, + mouseEvent, + positionBy: "mouse", + onClosedCallback + }); + }, + showFilter: (buttonElement) => { + menuSvc?.showFilterMenu({ + column: this.column, + buttonElement, + containerType: "columnFilter", + positionBy: "button" + }); + }, + progressSort: (multiSort) => { + sortSvc?.progressSort(this.column, !!multiSort, "uiColumnSorted"); + }, + setSort: (sort, multiSort) => { + sortSvc?.setSortForColumn(this.column, _getSortDefFromInput(sort), !!multiSort, "uiColumnSorted"); + }, + eGridHeader: this.eGui, + setTooltip: (value, shouldDisplayTooltip) => { + gos.assertModuleRegistered("Tooltip", 3); + this.setupTooltip(value, shouldDisplayTooltip); + } + }); + return params; + } + setupSelectAll(compBean) { + const { selectionSvc } = this.beans; + if (!selectionSvc) { + return; + } + this.selectAllFeature = compBean.createOptionalManagedBean(selectionSvc.createSelectAllFeature(this.column)); + this.selectAllFeature?.setComp(this); + compBean.addManagedPropertyListener("rowSelection", () => { + const selectAllFeature = selectionSvc.createSelectAllFeature(this.column); + if (selectAllFeature && !this.selectAllFeature) { + this.selectAllFeature = compBean.createManagedBean(selectAllFeature); + this.selectAllFeature?.setComp(this); + this.comp.refreshSelectAllGui(); + } else if (this.selectAllFeature && !selectAllFeature) { + this.comp.removeSelectAllGui(); + this.selectAllFeature = this.destroyBean(this.selectAllFeature); + } + }); + } + getSelectAllGui() { + return this.selectAllFeature?.getCheckboxGui(); + } + handleKeyDown(e) { + super.handleKeyDown(e); + if (e.key === KeyCode.SPACE) { + this.selectAllFeature?.onSpaceKeyDown(e); + } else if (e.key === KeyCode.ENTER) { + this.onEnterKeyDown(e); + } else if (e.key === KeyCode.DOWN && e.altKey) { + this.showMenuOnKeyPress(e, false); + } + } + onEnterKeyDown(e) { + const { column, gos, sortable, beans } = this; + let actioned = false; + if (e.ctrlKey || e.metaKey) { + actioned = this.showMenuOnKeyPress(e, true); + } + if (!actioned) { + if (!e.altKey && _getEnableColumnSelection(gos)) { + beans.rangeSvc?.handleColumnSelection(column, e); + } else if (sortable) { + beans.sortSvc?.progressSort(column, e.shiftKey, "uiColumnSorted"); + } + } + } + showMenuOnKeyPress(e, isFilterShortcut) { + const headerComp = this.comp.getUserCompInstance(); + if (!isHeaderComp(headerComp)) { + return false; + } + if (headerComp.onMenuKeyboardShortcut(isFilterShortcut)) { + e.preventDefault(); + return true; + } + return false; + } + onFocusIn(e) { + if (!this.eGui.contains(e.relatedTarget)) { + this.focusThis(); + this.announceAriaDescription(); + } + if (_isKeyboardMode()) { + this.setActiveHeader(true); + } + } + onFocusOut(e) { + if (this.eGui.contains(e.relatedTarget)) { + return; + } + this.setActiveHeader(false); + } + setupTooltip(value, shouldDisplayTooltip) { + this.tooltipFeature = this.beans.tooltipSvc?.setupHeaderTooltip(this.tooltipFeature, this, value, shouldDisplayTooltip); + } + setupStylesFromColDef() { + this.setRefreshFunction("headerStyles", this.refreshHeaderStyles.bind(this)); + this.refreshHeaderStyles(); + } + setupClassesFromColDef() { + const refreshHeaderClasses = () => { + const colDef = this.column.getColDef(); + const classes = _getHeaderClassesFromColDef(colDef, this.gos, this.column, null); + const oldClasses = this.userHeaderClasses; + this.userHeaderClasses = new Set(classes); + for (const c of classes) { + if (oldClasses.has(c)) { + oldClasses.delete(c); + } else { + this.comp.toggleCss(c, true); + } + } + for (const c of oldClasses) { + this.comp.toggleCss(c, false); + } + }; + this.setRefreshFunction("headerClasses", refreshHeaderClasses); + refreshHeaderClasses(); + } + setDragSource(eSource) { + this.dragSourceElement = eSource; + this.removeDragSource(); + if (!eSource || !this.draggable) { + return; + } + this.dragSource = this.beans.colMoves?.setDragSourceForHeader(eSource, this.column, this.displayName) ?? null; + } + updateState() { + const { menuSvc } = this.beans; + this.menuEnabled = !!menuSvc?.isColumnMenuInHeaderEnabled(this.column); + this.openFilterEnabled = !!menuSvc?.isFilterMenuInHeaderEnabled(this.column); + this.sortable = this.column.isSortable(); + this.displayName = this.calculateDisplayName(); + this.draggable = this.workOutDraggable(); + } + setRefreshFunction(name, func) { + this.refreshFunctions[name] = func; + } + refresh() { + this.updateState(); + this.refreshHeaderComp(); + this.refreshAria(); + for (const f of Object.values(this.refreshFunctions)) { + f(); + } + } + refreshHeaderComp() { + const newCompDetails = this.lookupUserCompDetails(); + if (!newCompDetails) { + return; + } + const compInstance = this.comp.getUserCompInstance(); + const attemptRefresh = compInstance != null && this.userCompDetails.componentClass == newCompDetails.componentClass; + const headerCompRefreshed = attemptRefresh ? this.attemptHeaderCompRefresh(newCompDetails.params) : false; + if (headerCompRefreshed) { + this.setDragSource(this.dragSourceElement); + } else { + this.setCompDetails(newCompDetails); + } + } + attemptHeaderCompRefresh(params) { + const headerComp = this.comp.getUserCompInstance(); + if (!headerComp) { + return false; + } + if (!headerComp.refresh) { + return false; + } + const res = headerComp.refresh(params); + return res; + } + calculateDisplayName() { + return this.beans.colNames.getDisplayNameForColumn(this.column, "header", true); + } + checkDisplayName() { + if (this.displayName !== this.calculateDisplayName()) { + this.refresh(); + } + } + workOutDraggable() { + const colDef = this.column.getColDef(); + const isSuppressMovableColumns = this.gos.get("suppressMovableColumns"); + const colCanMove = !isSuppressMovableColumns && !colDef.suppressMovable && !colDef.lockPosition; + return !!colCanMove || !!colDef.enableRowGroup || !!colDef.enablePivot; + } + setupWidth(compBean) { + const listener = () => { + const columnWidth = this.column.getActualWidth(); + this.comp.setWidth(`${columnWidth}px`); + }; + compBean.addManagedListeners(this.column, { widthChanged: listener }); + listener(); + } + setupMovingCss(compBean) { + const listener = () => { + this.comp.toggleCss("ag-header-cell-moving", this.column.isMoving()); + }; + compBean.addManagedListeners(this.column, { movingChanged: listener }); + listener(); + } + setupMenuClass(compBean) { + const listener = () => { + this.comp?.toggleCss("ag-column-menu-visible", this.column.isMenuVisible()); + }; + compBean.addManagedListeners(this.column, { menuVisibleChanged: listener }); + listener(); + } + setupSortableClass(compBean) { + const updateSortableCssClass = () => { + this.comp.toggleCss("ag-header-cell-sortable", !!this.sortable); + }; + updateSortableCssClass(); + this.setRefreshFunction("updateSortable", updateSortableCssClass); + compBean.addManagedEventListeners({ sortChanged: this.refreshAriaSort.bind(this) }); + } + setupFilterClass(compBean) { + const listener = () => { + const isFilterActive = this.column.isFilterActive(); + this.comp.toggleCss("ag-header-cell-filtered", isFilterActive); + this.refreshAria(); + }; + compBean.addManagedListeners(this.column, { filterActiveChanged: listener }); + listener(); + } + setupWrapTextClass() { + const listener = () => { + const wrapText = !!this.column.getColDef().wrapHeaderText; + this.comp.toggleCss("ag-header-cell-wrap-text", wrapText); + }; + listener(); + this.setRefreshFunction("wrapText", listener); + } + onHeaderHighlightChanged() { + const highlighted = this.column.getHighlighted(); + const beforeOn = highlighted === 0; + const afterOn = highlighted === 1; + this.comp.toggleCss("ag-header-highlight-before", beforeOn); + this.comp.toggleCss("ag-header-highlight-after", afterOn); + } + onDisplayedColumnsChanged() { + super.onDisplayedColumnsChanged(); + if (!this.isAlive()) { + return; + } + this.onHeaderHeightChanged(); + } + onHeaderHeightChanged() { + this.refreshSpanHeaderHeight(); + } + refreshSpanHeaderHeight() { + const { eGui, column, comp, beans } = this; + const groupHeaderHeight = getGroupRowsHeight(this.beans); + const isZeroGroupHeight = groupHeaderHeight.reduce((total, next) => total + next, 0) === 0; + comp.toggleCss("ag-header-parent-hidden", isZeroGroupHeight); + if (!column.isSpanHeaderHeight()) { + eGui.style.removeProperty("top"); + eGui.style.removeProperty("height"); + comp.toggleCss("ag-header-span-height", false); + comp.toggleCss("ag-header-span-total", false); + return; + } + const { numberOfParents, isSpanningTotal } = this.column.getColumnGroupPaddingInfo(); + comp.toggleCss("ag-header-span-height", numberOfParents > 0); + const headerHeight = getColumnHeaderRowHeight(beans); + if (numberOfParents === 0) { + comp.toggleCss("ag-header-span-total", false); + eGui.style.setProperty("top", `0px`); + eGui.style.setProperty("height", `${headerHeight}px`); + return; + } + comp.toggleCss("ag-header-span-total", isSpanningTotal); + const indexToStartSpanning = (this.column.getFirstRealParent()?.getLevel() ?? -1) + 1; + const rowsToSpan = groupHeaderHeight.length - indexToStartSpanning; + let extraHeight = 0; + for (let i = 0;i < rowsToSpan; i++) { + extraHeight += groupHeaderHeight[groupHeaderHeight.length - 1 - i]; + } + eGui.style.setProperty("top", `${-extraHeight}px`); + eGui.style.setProperty("height", `${headerHeight + extraHeight}px`); + } + refreshAriaSort() { + let description = null; + const { beans, column, comp, sortable } = this; + if (sortable) { + const translate = this.getLocaleTextFunc(); + const sortDef = beans.sortSvc?.getDisplaySortForColumn(column) ?? null; + comp.setAriaSort(_getAriaSortState(sortDef)); + description = translate("ariaSortableColumn", "Press ENTER to sort"); + } else { + comp.setAriaSort(); + } + this.setAriaDescriptionProperty("sort", description); + } + refreshAriaMenu() { + let description = null; + if (this.menuEnabled) { + const translate = this.getLocaleTextFunc(); + description = translate("ariaMenuColumn", "Press ALT DOWN to open column menu"); + } + this.setAriaDescriptionProperty("menu", description); + } + refreshAriaFilterButton() { + let description = null; + const { openFilterEnabled, gos } = this; + if (openFilterEnabled && !_isLegacyMenuEnabled(gos)) { + const translate = this.getLocaleTextFunc(); + description = translate("ariaFilterColumn", "Press CTRL ENTER to open filter"); + } + this.setAriaDescriptionProperty("filterButton", description); + } + refreshAriaFiltered() { + let description = null; + if (this.column.isFilterActive()) { + const translate = this.getLocaleTextFunc(); + description = translate("ariaColumnFiltered", "Column Filtered"); + } + this.setAriaDescriptionProperty("filter", description); + } + refreshAriaCellSelection() { + let description = null; + const { gos, column } = this; + const enableColumnSelection = _getEnableColumnSelection(gos); + if (enableColumnSelection && !isRowNumberCol(column)) { + const translate = this.getLocaleTextFunc(); + description = translate("ariaColumnCellSelection", "Press Enter to toggle selection for all visible cells in this column"); + } + this.setAriaDescriptionProperty("cellSelection", description); + } + setAriaDescriptionProperty(property, value) { + const props = this.ariaDescriptionProperties; + if (value != null) { + props.set(property, value); + } else { + props.delete(property); + } + } + announceAriaDescription() { + const { beans, eGui, ariaDescriptionProperties } = this; + if (!eGui.contains(_getActiveDomElement(beans))) { + return; + } + const ariaDescription = Array.from(ariaDescriptionProperties.keys()).sort((a, b) => a === "filter" ? -1 : b.charCodeAt(0) - a.charCodeAt(0)).map((key) => ariaDescriptionProperties.get(key)).join(". "); + beans.ariaAnnounce?.announceValue(ariaDescription, "columnHeader"); + } + refreshAria() { + this.refreshAriaSort(); + this.refreshAriaMenu(); + this.refreshAriaFilterButton(); + this.refreshAriaFiltered(); + this.refreshAriaCellSelection(); + } + addColumnHoverListener(compBean) { + this.beans.colHover?.addHeaderColumnHoverListener(compBean, this.comp, this.column); + } + addActiveHeaderMouseListeners(compBean) { + const listener = (e) => this.handleMouseOverChange(e.type === "mouseenter"); + const clickListener = () => { + this.setActiveHeader(true); + this.dispatchColumnMouseEvent("columnHeaderClicked", this.column); + }; + const contextMenuListener = (event) => this.handleContextMenuMouseEvent(event, undefined, this.column); + compBean.addManagedListeners(this.eGui, { + mouseenter: listener, + mouseleave: listener, + click: clickListener, + contextmenu: contextMenuListener + }); + } + handleMouseOverChange(isMouseOver) { + this.setActiveHeader(isMouseOver); + this.eventSvc.dispatchEvent({ + type: isMouseOver ? "columnHeaderMouseOver" : "columnHeaderMouseLeave", + column: this.column + }); + } + setActiveHeader(active) { + this.comp.toggleCss("ag-header-active", active); + } + getAnchorElementForMenu(isFilter) { + const headerComp = this.comp.getUserCompInstance(); + if (isHeaderComp(headerComp)) { + return headerComp.getAnchorElementForMenu(isFilter); + } + return this.eGui; + } + destroy() { + this.tooltipFeature = this.destroyBean(this.tooltipFeature); + super.destroy(); + } +}; +function isHeaderComp(headerComp) { + return typeof headerComp?.getAnchorElementForMenu === "function" && typeof headerComp.onMenuKeyboardShortcut === "function"; +} +var instanceIdSequence3 = 0; +var HeaderRowCtrl = class extends BeanStub { + constructor(rowIndex, pinned, type) { + super(); + this.rowIndex = rowIndex; + this.pinned = pinned; + this.type = type; + this.instanceId = instanceIdSequence3++; + this.comp = null; + this.allCtrls = []; + let typeClass = "ag-header-row-column"; + if (type === "group") { + typeClass = "ag-header-row-group"; + } else if (type === "filter") { + typeClass = "ag-header-row-filter"; + } + this.headerRowClass = `ag-header-row ${typeClass}`; + } + setRowIndex(rowIndex) { + this.rowIndex = rowIndex; + this.comp?.setRowIndex(this.getAriaRowIndex()); + this.onRowHeightChanged(); + } + postConstruct() { + this.isPrintLayout = _isDomLayout(this.gos, "print"); + this.isEnsureDomOrder = this.gos.get("ensureDomOrder"); + } + areCellsRendered() { + if (!this.comp) { + return false; + } + return this.allCtrls.every((ctrl) => ctrl.eGui != null); + } + setComp(comp, compBean, initCompState = true) { + this.comp = comp; + compBean = setupCompBean(this, this.beans.context, compBean); + if (initCompState) { + this.setRowIndex(this.rowIndex); + this.onVirtualColumnsChanged(); + } + this.setWidth(); + this.addEventListeners(compBean); + } + getAriaRowIndex() { + return this.rowIndex + 1; + } + addEventListeners(compBean) { + const onHeightChanged = this.onRowHeightChanged.bind(this); + const onDisplayedColumnsChanged = this.onDisplayedColumnsChanged.bind(this); + compBean.addManagedEventListeners({ + columnResized: this.setWidth.bind(this), + displayedColumnsChanged: onDisplayedColumnsChanged, + virtualColumnsChanged: (params) => this.onVirtualColumnsChanged(params.afterScroll), + columnGroupHeaderHeightChanged: onHeightChanged, + columnHeaderHeightChanged: onHeightChanged, + stylesChanged: onHeightChanged, + advancedFilterEnabledChanged: onHeightChanged + }); + compBean.addManagedPropertyListener("domLayout", onDisplayedColumnsChanged); + compBean.addManagedPropertyListener("ensureDomOrder", (e) => this.isEnsureDomOrder = e.currentValue); + compBean.addManagedPropertyListeners([ + "headerHeight", + "pivotHeaderHeight", + "groupHeaderHeight", + "pivotGroupHeaderHeight", + "floatingFiltersHeight" + ], onHeightChanged); + } + onDisplayedColumnsChanged() { + this.isPrintLayout = _isDomLayout(this.gos, "print"); + this.onVirtualColumnsChanged(); + this.setWidth(); + this.onRowHeightChanged(); + } + setWidth() { + if (!this.comp) { + return; + } + const width = this.getWidthForRow(); + this.comp.setWidth(`${width}px`); + } + getWidthForRow() { + const { visibleCols } = this.beans; + if (this.isPrintLayout) { + const pinned = this.pinned != null; + if (pinned) { + return 0; + } + return visibleCols.getContainerWidth("right") + visibleCols.getContainerWidth("left") + visibleCols.getContainerWidth(null); + } + return visibleCols.getContainerWidth(this.pinned); + } + onRowHeightChanged() { + if (!this.comp) { + return; + } + const { topOffset, rowHeight } = this.getTopAndHeight(); + this.comp.setTop(topOffset + "px"); + this.comp.setHeight(rowHeight + "px"); + } + getTopAndHeight() { + let topOffset = 0; + const groupHeadersHeight = getGroupRowsHeight(this.beans); + for (let i = 0;i < groupHeadersHeight.length; i++) { + if (i === this.rowIndex && this.type === "group") { + return { topOffset, rowHeight: groupHeadersHeight[i] }; + } + topOffset += groupHeadersHeight[i]; + } + const headerHeight = getColumnHeaderRowHeight(this.beans); + if (this.type === "column") { + return { topOffset, rowHeight: headerHeight }; + } + topOffset += headerHeight; + const filterHeight = getFloatingFiltersHeight(this.beans); + return { topOffset, rowHeight: filterHeight }; + } + onVirtualColumnsChanged(afterScroll = false) { + if (!this.comp) { + return; + } + const ctrlsToDisplay = this.getUpdatedHeaderCtrls(); + const forceOrder = this.isEnsureDomOrder || this.isPrintLayout; + this.comp.setHeaderCtrls(ctrlsToDisplay, forceOrder, afterScroll); + } + getUpdatedHeaderCtrls() { + const oldCtrls = this.ctrlsById; + this.ctrlsById = /* @__PURE__ */ new Map; + const columns = this.getColumnsInViewport(); + for (const child of columns) { + this.recycleAndCreateHeaderCtrls(child, this.ctrlsById, oldCtrls); + } + const isFocusedAndDisplayed = (ctrl) => { + const { focusSvc, visibleCols } = this.beans; + const isFocused = focusSvc.isHeaderWrapperFocused(ctrl); + if (!isFocused) { + return false; + } + const isDisplayed = visibleCols.isVisible(ctrl.column); + return isDisplayed; + }; + if (oldCtrls) { + for (const [id, oldCtrl] of oldCtrls) { + const keepCtrl = isFocusedAndDisplayed(oldCtrl); + if (keepCtrl) { + this.ctrlsById.set(id, oldCtrl); + } else { + this.destroyBean(oldCtrl); + } + } + } + this.allCtrls = Array.from(this.ctrlsById.values()); + return this.allCtrls; + } + getHeaderCellCtrls() { + return this.allCtrls; + } + recycleAndCreateHeaderCtrls(headerColumn, currCtrls, oldCtrls) { + if (headerColumn.isEmptyGroup()) { + return; + } + const idOfChild = headerColumn.getUniqueId(); + let headerCtrl; + if (oldCtrls) { + headerCtrl = oldCtrls.get(idOfChild); + oldCtrls.delete(idOfChild); + } + const forOldColumn = headerCtrl && headerCtrl.column != headerColumn; + if (forOldColumn) { + this.destroyBean(headerCtrl); + headerCtrl = undefined; + } + if (headerCtrl == null) { + switch (this.type) { + case "filter": { + headerCtrl = this.createBean(this.beans.registry.createDynamicBean("headerFilterCellCtrl", true, headerColumn, this)); + break; + } + case "group": + headerCtrl = this.createBean(this.beans.registry.createDynamicBean("headerGroupCellCtrl", true, headerColumn, this)); + break; + default: + headerCtrl = this.createBean(new HeaderCellCtrl(headerColumn, this)); + break; + } + } + currCtrls.set(idOfChild, headerCtrl); + } + getColumnsInViewport() { + if (!this.isPrintLayout) { + return this.getComponentsToRender(); + } + if (this.pinned) { + return []; + } + const viewportColumns = []; + for (const pinned of ["left", null, "right"]) { + viewportColumns.push(...this.getComponentsToRender(pinned)); + } + return viewportColumns; + } + getComponentsToRender(pinned = this.pinned) { + if (this.type === "group") { + return this.beans.colViewport.getHeadersToRender(pinned, this.rowIndex); + } + return this.beans.colViewport.getColumnHeadersToRender(pinned); + } + focusHeader(column, event) { + const ctrl = this.allCtrls.find((ctrl2) => ctrl2.column == column); + if (!ctrl) { + return false; + } + const focused = ctrl.focus(event); + return focused; + } + destroy() { + this.allCtrls = this.destroyBeans(this.allCtrls); + this.ctrlsById = undefined; + this.comp = null; + super.destroy(); + } +}; +var HeaderRowContainerCtrl = class extends BeanStub { + constructor(pinned) { + super(); + this.pinned = pinned; + this.hidden = false; + this.includeFloatingFilter = false; + this.groupsRowCtrls = []; + } + setComp(comp, eGui) { + this.comp = comp; + this.eViewport = eGui; + const { pinnedCols, ctrlsSvc, colModel, colMoves } = this.beans; + this.setupCenterWidth(); + pinnedCols?.setupHeaderPinnedWidth(this); + this.setupDragAndDrop(colMoves, this.eViewport); + const onDisplayedColsChanged = this.refresh.bind(this, true); + this.addManagedEventListeners({ + displayedColumnsChanged: onDisplayedColsChanged, + advancedFilterEnabledChanged: onDisplayedColsChanged + }); + const headerType = `${typeof this.pinned === "string" ? this.pinned : "center"}Header`; + ctrlsSvc.register(headerType, this); + if (colModel.ready) { + this.refresh(); + } + } + getAllCtrls() { + const res = [...this.groupsRowCtrls]; + if (this.columnsRowCtrl) { + res.push(this.columnsRowCtrl); + } + if (this.filtersRowCtrl) { + res.push(this.filtersRowCtrl); + } + return res; + } + refresh(keepColumns = false) { + const { focusSvc, filterManager, visibleCols } = this.beans; + let sequence = 0; + const focusedHeaderPosition = focusSvc.getFocusHeaderToUseAfterRefresh(); + const refreshColumnGroups = () => { + const groupRowCount = visibleCols.headerGroupRowCount; + sequence = groupRowCount; + if (!keepColumns) { + this.groupsRowCtrls = this.destroyBeans(this.groupsRowCtrls); + } + const currentGroupCount = this.groupsRowCtrls.length; + if (currentGroupCount === groupRowCount) { + return; + } + if (currentGroupCount > groupRowCount) { + for (let i = groupRowCount;i < currentGroupCount; i++) { + this.destroyBean(this.groupsRowCtrls[i]); + } + this.groupsRowCtrls.length = groupRowCount; + return; + } + for (let i = currentGroupCount;i < groupRowCount; i++) { + const ctrl = this.createBean(new HeaderRowCtrl(i, this.pinned, "group")); + this.groupsRowCtrls.push(ctrl); + } + }; + const refreshColumns = () => { + const rowIndex = sequence++; + if (this.hidden) { + this.columnsRowCtrl = this.destroyBean(this.columnsRowCtrl); + return; + } + if (this.columnsRowCtrl == null || !keepColumns) { + this.columnsRowCtrl = this.destroyBean(this.columnsRowCtrl); + this.columnsRowCtrl = this.createBean(new HeaderRowCtrl(rowIndex, this.pinned, "column")); + } else if (this.columnsRowCtrl.rowIndex !== rowIndex) { + this.columnsRowCtrl.setRowIndex(rowIndex); + } + }; + const refreshFilters = () => { + this.includeFloatingFilter = !!filterManager?.hasFloatingFilters() && !this.hidden; + const destroyPreviousComp = () => { + this.filtersRowCtrl = this.destroyBean(this.filtersRowCtrl); + }; + if (!this.includeFloatingFilter) { + destroyPreviousComp(); + return; + } + if (!keepColumns) { + destroyPreviousComp(); + } + const rowIndex = sequence++; + if (this.filtersRowCtrl) { + const rowIndexMismatch = this.filtersRowCtrl.rowIndex !== rowIndex; + if (rowIndexMismatch) { + this.filtersRowCtrl.setRowIndex(rowIndex); + } + } else { + this.filtersRowCtrl = this.createBean(new HeaderRowCtrl(rowIndex, this.pinned, "filter")); + } + }; + const oldCtrls = this.getAllCtrls(); + refreshColumnGroups(); + refreshColumns(); + refreshFilters(); + const allCtrls = this.getAllCtrls(); + this.comp.setCtrls(allCtrls); + this.restoreFocusOnHeader(focusSvc, focusedHeaderPosition); + if (oldCtrls.length !== allCtrls.length) { + this.beans.eventSvc.dispatchEvent({ + type: "headerRowsChanged" + }); + } + } + getHeaderCtrlForColumn(column) { + const findCtrl = (ctrl) => ctrl?.getHeaderCellCtrls().find((ctrl2) => ctrl2.column === column); + if (isColumn(column)) { + return findCtrl(this.columnsRowCtrl); + } + if (this.groupsRowCtrls.length === 0) { + return; + } + for (let i = 0;i < this.groupsRowCtrls.length; i++) { + const ctrl = findCtrl(this.groupsRowCtrls[i]); + if (ctrl) { + return ctrl; + } + } + } + getHtmlElementForColumnHeader(column) { + return this.getHeaderCtrlForColumn(column)?.eGui ?? null; + } + getRowType(rowIndex) { + return this.getAllCtrls()[rowIndex]?.type; + } + focusHeader(rowIndex, column, event) { + const allCtrls = this.getAllCtrls(); + const ctrl = allCtrls[rowIndex]; + if (!ctrl) { + return false; + } + return ctrl.focusHeader(column, event); + } + getGroupRowCount() { + return this.groupsRowCtrls.length; + } + getGroupRowCtrlAtIndex(index) { + return this.groupsRowCtrls[index]; + } + getRowCount() { + return this.groupsRowCtrls.length + (this.columnsRowCtrl ? 1 : 0) + (this.filtersRowCtrl ? 1 : 0); + } + setHorizontalScroll(offset) { + this.comp.setViewportScrollLeft(offset); + } + onScrollCallback(fn) { + this.addManagedElementListeners(this.eViewport, { scroll: fn }); + } + destroy() { + this.filtersRowCtrl = this.destroyBean(this.filtersRowCtrl); + this.columnsRowCtrl = this.destroyBean(this.columnsRowCtrl); + this.groupsRowCtrls = this.destroyBeans(this.groupsRowCtrls); + super.destroy(); + } + setupDragAndDrop(colMoves, dropContainer) { + const bodyDropTarget = colMoves?.createBodyDropTarget(this.pinned, dropContainer); + if (bodyDropTarget) { + this.createManagedBean(bodyDropTarget); + } + } + restoreFocusOnHeader(focusSvc, position) { + if (!position) { + return; + } + const { column } = position; + if (column.getPinned() != this.pinned) { + return; + } + focusSvc.focusHeaderPosition({ headerPosition: position, scroll: false }); + } + setupCenterWidth() { + if (this.pinned != null) { + return; + } + this.createManagedBean(new CenterWidthFeature((width) => this.comp.setCenterWidth(`${width}px`), true)); + } +}; +var PinnedLeftElement = { tag: "div", cls: "ag-pinned-left-header", role: "rowgroup" }; +var PinnedRightElement = { tag: "div", cls: "ag-pinned-right-header", role: "rowgroup" }; +var CenterElement = { + tag: "div", + cls: "ag-header-viewport", + role: "rowgroup", + attrs: { tabindex: "-1" }, + children: [{ tag: "div", ref: "eCenterContainer", cls: "ag-header-container", role: "presentation" }] +}; +var HeaderRowContainerComp = class extends Component { + constructor(pinned) { + super(); + this.eCenterContainer = RefPlaceholder; + this.headerRowComps = {}; + this.rowCompsList = []; + this.pinned = pinned; + } + postConstruct() { + this.selectAndSetTemplate(); + const compProxy = { + setDisplayed: (displayed) => this.setDisplayed(displayed), + setCtrls: (ctrls) => this.setCtrls(ctrls), + setCenterWidth: (width) => this.eCenterContainer.style.width = width, + setViewportScrollLeft: (left) => this.getGui().scrollLeft = left, + setPinnedContainerWidth: (width) => { + const eGui = this.getGui(); + eGui.style.width = width; + eGui.style.maxWidth = width; + eGui.style.minWidth = width; + } + }; + const ctrl = this.createManagedBean(new HeaderRowContainerCtrl(this.pinned)); + ctrl.setComp(compProxy, this.getGui()); + } + selectAndSetTemplate() { + const pinnedLeft = this.pinned == "left"; + const pinnedRight = this.pinned == "right"; + const template = pinnedLeft ? PinnedLeftElement : pinnedRight ? PinnedRightElement : CenterElement; + this.setTemplate(template); + this.eRowContainer = this.eCenterContainer !== RefPlaceholder ? this.eCenterContainer : this.getGui(); + } + destroy() { + this.setCtrls([]); + super.destroy(); + } + destroyRowComp(rowComp) { + this.destroyBean(rowComp); + rowComp.getGui().remove(); + } + setCtrls(ctrls) { + const oldRowComps = this.headerRowComps; + this.headerRowComps = {}; + this.rowCompsList = []; + let prevGui; + const appendEnsuringDomOrder = (rowComp) => { + const eGui = rowComp.getGui(); + const notAlreadyIn = eGui.parentElement != this.eRowContainer; + if (notAlreadyIn) { + this.eRowContainer.appendChild(eGui); + } + if (prevGui) { + _ensureDomOrder(this.eRowContainer, eGui, prevGui); + } + prevGui = eGui; + }; + for (const ctrl of ctrls) { + const ctrlId = ctrl.instanceId; + const existingComp = oldRowComps[ctrlId]; + delete oldRowComps[ctrlId]; + const rowComp = existingComp ? existingComp : this.createBean(new HeaderRowComp(ctrl)); + this.headerRowComps[ctrlId] = rowComp; + this.rowCompsList.push(rowComp); + appendEnsuringDomOrder(rowComp); + } + for (const c of Object.values(oldRowComps)) { + this.destroyRowComp(c); + } + } +}; +var GridHeaderElement = { tag: "div", cls: "ag-header", role: "presentation" }; +var GridHeaderComp = class extends Component { + constructor() { + super(GridHeaderElement); + } + postConstruct() { + const compProxy = { + toggleCss: (cssClassName, on) => this.toggleCss(cssClassName, on), + setHeightAndMinHeight: (height) => { + this.getGui().style.height = height; + this.getGui().style.minHeight = height; + } + }; + const ctrl = this.createManagedBean(new GridHeaderCtrl); + ctrl.setComp(compProxy, this.getGui(), this.getFocusableElement()); + const addContainer = (container) => { + this.createManagedBean(container); + this.appendChild(container); + }; + addContainer(new HeaderRowContainerComp("left")); + addContainer(new HeaderRowContainerComp(null)); + addContainer(new HeaderRowContainerComp("right")); + } +}; +var GridHeaderSelector = { + selector: "AG-HEADER-ROOT", + component: GridHeaderComp +}; +var LayoutCssClasses = { + AUTO_HEIGHT: "ag-layout-auto-height", + NORMAL: "ag-layout-normal", + PRINT: "ag-layout-print" +}; +var LayoutFeature = class extends BeanStub { + constructor(view) { + super(); + this.view = view; + } + postConstruct() { + this.addManagedPropertyListener("domLayout", this.updateLayoutClasses.bind(this)); + this.updateLayoutClasses(); + } + updateLayoutClasses() { + const domLayout = this.gos.get("domLayout"); + const params = { + autoHeight: domLayout === "autoHeight", + normal: domLayout === "normal", + print: domLayout === "print" + }; + const cssClass = params.autoHeight ? LayoutCssClasses.AUTO_HEIGHT : params.print ? LayoutCssClasses.PRINT : LayoutCssClasses.NORMAL; + this.view.updateLayoutClasses(cssClass, params); + } +}; +var AbstractFakeScrollComp = class extends Component { + constructor(template, direction) { + super(); + this.direction = direction; + this.eViewport = RefPlaceholder; + this.eContainer = RefPlaceholder; + this.hideTimeout = 0; + this.setTemplate(template); + } + postConstruct() { + this.addManagedEventListeners({ + scrollVisibilityChanged: this.onScrollVisibilityChanged.bind(this) + }); + this.onScrollVisibilityChanged(); + this.toggleCss("ag-apple-scrollbar", _isMacOsUserAgent() || _isIOSUserAgent()); + } + destroy() { + super.destroy(); + window.clearTimeout(this.hideTimeout); + } + initialiseInvisibleScrollbar() { + if (this.invisibleScrollbar !== undefined) { + return; + } + this.invisibleScrollbar = _isInvisibleScrollbar(); + if (this.invisibleScrollbar) { + this.hideAndShowInvisibleScrollAsNeeded(); + this.addActiveListenerToggles(); + } + } + addActiveListenerToggles() { + const eGui = this.getGui(); + const onActivate = () => this.toggleCss("ag-scrollbar-active", true); + const onDeactivate = () => this.toggleCss("ag-scrollbar-active", false); + this.addManagedListeners(eGui, { + mouseenter: onActivate, + mousedown: onActivate, + touchstart: onActivate, + mouseleave: onDeactivate, + touchend: onDeactivate + }); + } + onScrollVisibilityChanged() { + if (this.invisibleScrollbar === undefined) { + this.initialiseInvisibleScrollbar(); + } + _requestAnimationFrame(this.beans, () => this.setScrollVisible()); + } + hideAndShowInvisibleScrollAsNeeded() { + this.addManagedEventListeners({ + bodyScroll: (params) => { + if (params.direction === this.direction) { + if (this.hideTimeout) { + window.clearTimeout(this.hideTimeout); + this.hideTimeout = 0; + } + this.toggleCss("ag-scrollbar-scrolling", true); + } + }, + bodyScrollEnd: () => { + this.hideTimeout = window.setTimeout(() => { + this.toggleCss("ag-scrollbar-scrolling", false); + this.hideTimeout = 0; + }, 400); + } + }); + } + attemptSettingScrollPosition(value) { + const viewport = this.eViewport; + _waitUntil(this, () => _isVisible(viewport), () => this.setScrollPosition(value), 100); + } + onScrollCallback(fn) { + this.addManagedElementListeners(this.eViewport, { scroll: fn }); + } +}; +var FakeHScrollElement = { + 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" } + ] +}; +var FakeHScrollComp = class extends AbstractFakeScrollComp { + constructor() { + super(FakeHScrollElement, "horizontal"); + this.eLeftSpacer = RefPlaceholder; + this.eRightSpacer = RefPlaceholder; + this.setScrollVisibleDebounce = 0; + } + wireBeans(beans) { + this.visibleCols = beans.visibleCols; + this.scrollVisibleSvc = beans.scrollVisibleSvc; + } + postConstruct() { + super.postConstruct(); + const spacerWidthsListener = this.setFakeHScrollSpacerWidths.bind(this); + this.addManagedEventListeners({ + displayedColumnsChanged: spacerWidthsListener, + displayedColumnsWidthChanged: spacerWidthsListener, + pinnedRowDataChanged: this.refreshCompBottom.bind(this) + }); + this.addManagedPropertyListener("domLayout", spacerWidthsListener); + this.beans.ctrlsSvc.register("fakeHScrollComp", this); + this.createManagedBean(new CenterWidthFeature((width) => this.eContainer.style.width = `${width}px`)); + this.addManagedPropertyListeners(["suppressHorizontalScroll"], this.onScrollVisibilityChanged.bind(this)); + } + destroy() { + window.clearTimeout(this.setScrollVisibleDebounce); + super.destroy(); + } + initialiseInvisibleScrollbar() { + if (this.invisibleScrollbar !== undefined) { + return; + } + this.enableRtl = this.gos.get("enableRtl"); + super.initialiseInvisibleScrollbar(); + if (this.invisibleScrollbar) { + this.refreshCompBottom(); + } + } + refreshCompBottom() { + if (!this.invisibleScrollbar) { + return; + } + const bottomPinnedHeight = this.beans.pinnedRowModel?.getPinnedBottomTotalHeight() ?? 0; + this.getGui().style.bottom = `${bottomPinnedHeight}px`; + } + onScrollVisibilityChanged() { + super.onScrollVisibilityChanged(); + this.setFakeHScrollSpacerWidths(); + } + setFakeHScrollSpacerWidths() { + const vScrollShowing = this.scrollVisibleSvc.verticalScrollShowing; + let rightSpacing = this.visibleCols.getDisplayedColumnsRightWidth(); + const scrollOnRight = !this.enableRtl && vScrollShowing; + const scrollbarWidth = this.scrollVisibleSvc.getScrollbarWidth(); + if (scrollOnRight) { + rightSpacing += scrollbarWidth; + } + _setFixedWidth(this.eRightSpacer, rightSpacing); + this.eRightSpacer.classList.toggle("ag-scroller-corner", rightSpacing <= scrollbarWidth); + let leftSpacing = this.visibleCols.getColsLeftWidth(); + const scrollOnLeft = this.enableRtl && vScrollShowing; + if (scrollOnLeft) { + leftSpacing += scrollbarWidth; + } + _setFixedWidth(this.eLeftSpacer, leftSpacing); + this.eLeftSpacer.classList.toggle("ag-scroller-corner", leftSpacing <= scrollbarWidth); + } + setScrollVisible() { + const hScrollShowing = this.scrollVisibleSvc.horizontalScrollShowing; + const invisibleScrollbar2 = this.invisibleScrollbar; + const isSuppressHorizontalScroll = this.gos.get("suppressHorizontalScroll"); + const scrollbarWidth = hScrollShowing ? this.scrollVisibleSvc.getScrollbarWidth() || 0 : 0; + const adjustedScrollbarWidth = scrollbarWidth === 0 && invisibleScrollbar2 ? 16 : scrollbarWidth; + const scrollContainerSize = !isSuppressHorizontalScroll ? adjustedScrollbarWidth : 0; + const apply = () => { + this.setScrollVisibleDebounce = 0; + this.toggleCss("ag-scrollbar-invisible", invisibleScrollbar2); + _setFixedHeight(this.getGui(), scrollContainerSize); + _setFixedHeight(this.eViewport, scrollContainerSize); + _setFixedHeight(this.eContainer, scrollContainerSize); + if (!scrollContainerSize) { + this.eContainer.style.setProperty("min-height", "1px"); + } + this.setVisible(hScrollShowing, { skipAriaHidden: true }); + }; + window.clearTimeout(this.setScrollVisibleDebounce); + if (!hScrollShowing) { + apply(); + } else { + this.setScrollVisibleDebounce = window.setTimeout(apply, 100); + } + } + getScrollPosition() { + return _getScrollLeft(this.eViewport, this.enableRtl); + } + setScrollPosition(value) { + if (!_isVisible(this.eViewport)) { + this.attemptSettingScrollPosition(value); + } + _setScrollLeft(this.eViewport, value, this.enableRtl); + } +}; +var FakeHScrollSelector = { + selector: "AG-FAKE-HORIZONTAL-SCROLL", + component: FakeHScrollComp +}; +var SetHeightFeature = class extends BeanStub { + constructor(eContainer, eViewport) { + super(); + this.eContainer = eContainer; + this.eViewport = eViewport; + } + postConstruct() { + this.addManagedEventListeners({ + rowContainerHeightChanged: this.onHeightChanged.bind(this, this.beans.rowContainerHeight) + }); + } + onHeightChanged(maxDivHeightScaler) { + const height = maxDivHeightScaler.uiContainerHeight; + const heightString = height != null ? `${height}px` : ``; + this.eContainer.style.height = heightString; + if (this.eViewport) { + this.eViewport.style.height = heightString; + } + } +}; +var FakeVScrollElement = { + 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" }] + } + ] +}; +var FakeVScrollComp = class extends AbstractFakeScrollComp { + constructor() { + super(FakeVScrollElement, "vertical"); + } + postConstruct() { + super.postConstruct(); + this.createManagedBean(new SetHeightFeature(this.eContainer)); + const { ctrlsSvc } = this.beans; + ctrlsSvc.register("fakeVScrollComp", this); + this.addManagedEventListeners({ + rowContainerHeightChanged: this.onRowContainerHeightChanged.bind(this, ctrlsSvc) + }); + } + setScrollVisible() { + const { scrollVisibleSvc } = this.beans; + const vScrollShowing = scrollVisibleSvc.verticalScrollShowing; + const invisibleScrollbar2 = this.invisibleScrollbar; + const scrollbarWidth = vScrollShowing ? scrollVisibleSvc.getScrollbarWidth() || 0 : 0; + const adjustedScrollbarWidth = scrollbarWidth === 0 && invisibleScrollbar2 ? 16 : scrollbarWidth; + this.toggleCss("ag-scrollbar-invisible", invisibleScrollbar2); + _setFixedWidth(this.getGui(), adjustedScrollbarWidth); + _setFixedWidth(this.eViewport, adjustedScrollbarWidth); + _setFixedWidth(this.eContainer, adjustedScrollbarWidth); + this.setDisplayed(vScrollShowing, { skipAriaHidden: true }); + } + onRowContainerHeightChanged(ctrlsSvc) { + const gridBodyCtrl = ctrlsSvc.getGridBodyCtrl(); + const gridBodyViewportEl = gridBodyCtrl.eBodyViewport; + const eViewportScrollTop = this.getScrollPosition(); + const gridBodyViewportScrollTop = gridBodyViewportEl.scrollTop; + if (eViewportScrollTop != gridBodyViewportScrollTop) { + this.setScrollPosition(gridBodyViewportScrollTop, true); + } + } + getScrollPosition() { + return this.eViewport.scrollTop; + } + setScrollPosition(value, force) { + if (!force && !_isVisible(this.eViewport)) { + this.attemptSettingScrollPosition(value); + } + this.eViewport.scrollTop = value; + } +}; +var FakeVScrollSelector = { + selector: "AG-FAKE-VERTICAL-SCROLL", + component: FakeVScrollComp +}; +var VIEWPORT = "Viewport"; +var FAKE_V_SCROLLBAR = "fakeVScrollComp"; +var HORIZONTAL_SOURCES = [ + "fakeHScrollComp", + "centerHeader", + "topCenter", + "bottomCenter", + "stickyTopCenter", + "stickyBottomCenter" +]; +var SCROLL_DEBOUNCE_TIMEOUT = 100; +var SCROLL_END_TIMEOUT = 150; +var GridBodyScrollFeature = class extends BeanStub { + constructor(eBodyViewport) { + super(); + this.clearRetryListenerFncs = []; + this.lastScrollSource = [null, null]; + this.scrollLeft = -1; + this.nextScrollTop = -1; + this.scrollTop = -1; + this.lastOffsetHeight = -1; + this.lastScrollTop = -1; + this.lastIsHorizontalScrollShowing = false; + this.scrollTimer = 0; + this.isScrollActive = false; + this.isVerticalPositionInvalidated = true; + this.isHorizontalPositionInvalidated = true; + this.eBodyViewport = eBodyViewport; + this.resetLastHScrollDebounced = _debounce(this, () => this.lastScrollSource[1] = null, SCROLL_END_TIMEOUT); + this.resetLastVScrollDebounced = _debounce(this, () => this.lastScrollSource[0] = null, SCROLL_END_TIMEOUT); + } + wireBeans(beans) { + this.ctrlsSvc = beans.ctrlsSvc; + this.animationFrameSvc = beans.animationFrameSvc; + this.visibleCols = beans.visibleCols; + } + destroy() { + super.destroy(); + this.clearRetryListenerFncs = []; + window.clearTimeout(this.scrollTimer); + } + postConstruct() { + this.enableRtl = this.gos.get("enableRtl"); + const invalidateVerticalScroll = this.invalidateVerticalScroll.bind(this); + const invalidateHorizontalScroll = this.invalidateHorizontalScroll.bind(this); + this.addManagedEventListeners({ + displayedColumnsWidthChanged: this.onDisplayedColumnsWidthChanged.bind(this), + bodyHeightChanged: invalidateVerticalScroll, + scrollGapChanged: invalidateHorizontalScroll + }); + this.addManagedElementListeners(this.eBodyViewport, { + scroll: invalidateVerticalScroll + }); + this.ctrlsSvc.whenReady(this, (p) => { + this.centerRowsCtrl = p.center; + this.fakeVScrollComp = p.fakeVScrollComp; + this.fakeHScrollComp = p.fakeHScrollComp; + this.onDisplayedColumnsWidthChanged(); + this.addScrollListener(); + }); + } + invalidateHorizontalScroll() { + this.isHorizontalPositionInvalidated = true; + } + invalidateVerticalScroll() { + this.isVerticalPositionInvalidated = true; + } + addScrollListener() { + this.addHorizontalScrollListeners(); + this.addVerticalScrollListeners(); + } + addHorizontalScrollListeners() { + this.addManagedElementListeners(this.centerRowsCtrl.eViewport, { + scroll: this.onHScroll.bind(this, VIEWPORT) + }); + for (const source of HORIZONTAL_SOURCES) { + const scrollPartner = this.ctrlsSvc.get(source); + this.registerScrollPartner(scrollPartner, this.onHScroll.bind(this, source)); + } + } + addVerticalScrollListeners() { + const isDebounce = this.gos.get("debounceVerticalScrollbar"); + const onVScroll = isDebounce ? _debounce(this, this.onVScroll.bind(this, VIEWPORT), SCROLL_DEBOUNCE_TIMEOUT) : this.onVScroll.bind(this, VIEWPORT); + const onFakeVScroll = isDebounce ? _debounce(this, this.onVScroll.bind(this, FAKE_V_SCROLLBAR), SCROLL_DEBOUNCE_TIMEOUT) : this.onVScroll.bind(this, FAKE_V_SCROLLBAR); + this.addManagedElementListeners(this.eBodyViewport, { scroll: onVScroll }); + this.registerScrollPartner(this.fakeVScrollComp, onFakeVScroll); + } + registerScrollPartner(comp, callback) { + comp.onScrollCallback(callback); + } + onDisplayedColumnsWidthChanged() { + if (this.enableRtl) { + this.horizontallyScrollHeaderCenterAndFloatingCenter(); + } + } + horizontallyScrollHeaderCenterAndFloatingCenter(scrollLeft) { + const notYetInitialised = this.centerRowsCtrl == null; + if (notYetInitialised) { + return; + } + if (scrollLeft === undefined) { + scrollLeft = this.centerRowsCtrl.getCenterViewportScrollLeft(); + } + this.setScrollLeftForAllContainersExceptCurrent(Math.abs(scrollLeft)); + } + setScrollLeftForAllContainersExceptCurrent(scrollLeft) { + for (const container of [...HORIZONTAL_SOURCES, VIEWPORT]) { + if (this.lastScrollSource[1] === container) { + continue; + } + const viewport = this.getViewportForSource(container); + _setScrollLeft(viewport, scrollLeft, this.enableRtl); + } + } + getViewportForSource(source) { + if (source === VIEWPORT) { + return this.centerRowsCtrl.eViewport; + } + return this.ctrlsSvc.get(source).eViewport; + } + isControllingScroll(source, direction) { + if (this.lastScrollSource[direction] == null) { + if (direction === 0) { + this.lastScrollSource[0] = source; + } else { + this.lastScrollSource[1] = source; + } + return true; + } + return this.lastScrollSource[direction] === source; + } + onHScroll(source) { + if (!this.isControllingScroll(source, 1)) { + return; + } + const centerContainerViewport = this.centerRowsCtrl.eViewport; + const { scrollLeft } = centerContainerViewport; + if (this.shouldBlockScrollUpdate(1, scrollLeft, true)) { + return; + } + const newScrollLeft = _getScrollLeft(this.getViewportForSource(source), this.enableRtl); + this.doHorizontalScroll(newScrollLeft); + this.resetLastHScrollDebounced(); + } + onVScroll(source) { + if (!this.isControllingScroll(source, 0)) { + return; + } + const requestedScrollTop = source === VIEWPORT ? this.eBodyViewport.scrollTop : this.fakeVScrollComp.getScrollPosition(); + let scrollTop = requestedScrollTop; + if (this.shouldBlockScrollUpdate(0, scrollTop, true)) { + return; + } + if (source === VIEWPORT) { + this.fakeVScrollComp.setScrollPosition(scrollTop); + } else { + this.eBodyViewport.scrollTop = requestedScrollTop; + scrollTop = this.eBodyViewport.scrollTop; + this.invalidateVerticalScroll(); + if (scrollTop !== requestedScrollTop) { + this.fakeVScrollComp.setScrollPosition(scrollTop, true); + } + } + const { animationFrameSvc } = this; + animationFrameSvc?.setScrollTop(scrollTop); + this.nextScrollTop = scrollTop; + if (animationFrameSvc?.active) { + animationFrameSvc.schedule(); + } else { + this.scrollGridIfNeeded(true); + } + this.resetLastVScrollDebounced(); + } + doHorizontalScroll(scrollLeft) { + const fakeScrollLeft = this.fakeHScrollComp.getScrollPosition(); + if (this.scrollLeft === scrollLeft && scrollLeft === fakeScrollLeft) { + return; + } + this.scrollLeft = scrollLeft; + this.fireScrollEvent(1); + this.horizontallyScrollHeaderCenterAndFloatingCenter(scrollLeft); + this.centerRowsCtrl.onHorizontalViewportChanged(true); + } + isScrolling() { + return this.isScrollActive; + } + fireScrollEvent(direction) { + const bodyScrollEvent = { + type: "bodyScroll", + direction: direction === 1 ? "horizontal" : "vertical", + left: this.scrollLeft, + top: this.scrollTop + }; + this.isScrollActive = true; + this.eventSvc.dispatchEvent(bodyScrollEvent); + window.clearTimeout(this.scrollTimer); + this.scrollTimer = window.setTimeout(() => { + this.scrollTimer = 0; + this.isScrollActive = false; + this.eventSvc.dispatchEvent({ + ...bodyScrollEvent, + type: "bodyScrollEnd" + }); + }, SCROLL_END_TIMEOUT); + } + shouldBlockScrollUpdate(direction, scrollTo, touchOnly = false) { + if (touchOnly && !_isIOSUserAgent()) { + return false; + } + if (direction === 0) { + return this.shouldBlockVerticalScroll(scrollTo); + } + return this.shouldBlockHorizontalScroll(scrollTo); + } + shouldBlockVerticalScroll(scrollTo) { + const clientHeight = _getInnerHeight(this.eBodyViewport); + const { scrollHeight } = this.eBodyViewport; + return !!(scrollTo < 0 || scrollTo + clientHeight > scrollHeight); + } + shouldBlockHorizontalScroll(scrollTo) { + const clientWidth = this.centerRowsCtrl.getCenterWidth(); + const { scrollWidth } = this.centerRowsCtrl.eViewport; + if (this.enableRtl) { + if (scrollTo > 0) { + return true; + } + } else if (scrollTo < 0) { + return true; + } + return Math.abs(scrollTo) + clientWidth > scrollWidth; + } + redrawRowsAfterScroll() { + this.fireScrollEvent(0); + } + checkScrollLeft() { + const scrollLeft = this.scrollLeft; + let hasHorizontalScrollersOutOfSync = false; + for (const source of HORIZONTAL_SOURCES) { + const viewport = this.getViewportForSource(source); + if (viewport.scrollLeft !== scrollLeft) { + hasHorizontalScrollersOutOfSync = true; + break; + } + } + if (hasHorizontalScrollersOutOfSync) { + this.onHScroll(VIEWPORT); + } + } + scrollGridIfNeeded(suppressedAnimationFrame = false) { + const frameNeeded = this.scrollTop != this.nextScrollTop; + if (frameNeeded) { + this.scrollTop = this.nextScrollTop; + if (suppressedAnimationFrame) { + this.invalidateVerticalScroll(); + } + this.redrawRowsAfterScroll(); + } + return frameNeeded; + } + setHorizontalScrollPosition(hScrollPosition, fromAlignedGridsService = false) { + const minScrollLeft = 0; + const maxScrollLeft = this.centerRowsCtrl.eViewport.scrollWidth - this.centerRowsCtrl.getCenterWidth(); + if (!fromAlignedGridsService && this.shouldBlockScrollUpdate(1, hScrollPosition)) { + if (this.enableRtl) { + hScrollPosition = hScrollPosition > 0 ? 0 : maxScrollLeft; + } else { + hScrollPosition = Math.min(Math.max(hScrollPosition, minScrollLeft), maxScrollLeft); + } + } + _setScrollLeft(this.centerRowsCtrl.eViewport, Math.abs(hScrollPosition), this.enableRtl); + this.doHorizontalScroll(hScrollPosition); + } + setVerticalScrollPosition(vScrollPosition) { + this.invalidateVerticalScroll(); + this.eBodyViewport.scrollTop = vScrollPosition; + } + getVScrollPosition() { + if (!this.isVerticalPositionInvalidated) { + const { lastOffsetHeight, lastScrollTop } = this; + return { + top: lastScrollTop, + bottom: lastScrollTop + lastOffsetHeight + }; + } + this.isVerticalPositionInvalidated = false; + const { scrollTop, offsetHeight } = this.eBodyViewport; + this.lastScrollTop = scrollTop; + this.lastOffsetHeight = offsetHeight; + return { + top: scrollTop, + bottom: scrollTop + offsetHeight + }; + } + 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 = false; + } + return this.lastIsHorizontalScrollShowing; + } + scrollHorizontally(pixels) { + const oldScrollPosition = this.centerRowsCtrl.eViewport.scrollLeft; + this.setHorizontalScrollPosition(oldScrollPosition + pixels); + return this.centerRowsCtrl.eViewport.scrollLeft - oldScrollPosition; + } + scrollToTop() { + this.setVerticalScrollPosition(0); + } + ensureNodeVisible(comparator, position = null) { + const { rowModel } = this.beans; + const rowCount = rowModel.getRowCount(); + let indexToSelect = -1; + for (let i = 0;i < rowCount; i++) { + const node = rowModel.getRow(i); + if (typeof comparator === "function") { + const predicate = comparator; + if (node && predicate(node)) { + indexToSelect = i; + break; + } + } else if (comparator === node || comparator === node.data) { + indexToSelect = i; + break; + } + } + if (indexToSelect >= 0) { + this.ensureIndexVisible(indexToSelect, position); + } + } + ensureIndexVisible(index, position, retry = 0) { + if (_isDomLayout(this.gos, "print")) { + return; + } + const { rowModel } = this.beans; + const rowCount = rowModel.getRowCount(); + if (typeof index !== "number" || index < 0 || index >= rowCount) { + _warn(88, { index }); + return; + } + this.clearRetryListeners(); + const { frameworkOverrides, pageBounds, rowContainerHeight: heightScaler, rowRenderer } = this.beans; + frameworkOverrides.wrapIncoming(() => { + const gridBodyCtrl = this.ctrlsSvc.getGridBodyCtrl(); + const rowNode = rowModel.getRow(index); + let rowGotShiftedDuringOperation; + let stickyHeightsChanged; + let attempt = 0; + this.invalidateVerticalScroll(); + do { + const { stickyTopHeight, stickyBottomHeight } = gridBodyCtrl; + const startingRowTop = rowNode.rowTop; + const startingRowHeight = rowNode.rowHeight; + const paginationOffset = pageBounds.getPixelOffset(); + const rowTopPixel = rowNode.rowTop - paginationOffset; + const rowBottomPixel = rowTopPixel + rowNode.rowHeight; + const scrollPosition = this.getVScrollPosition(); + const heightOffset = heightScaler.divStretchOffset; + const vScrollTop = scrollPosition.top + heightOffset; + const vScrollBottom = scrollPosition.bottom + heightOffset; + const viewportHeight = vScrollBottom - vScrollTop; + const pxTop = heightScaler.getScrollPositionForPixel(rowTopPixel); + const pxBottom = heightScaler.getScrollPositionForPixel(rowBottomPixel - viewportHeight); + const pxMiddle = Math.min((pxTop + pxBottom) / 2, rowTopPixel); + const rowAboveViewport = vScrollTop + stickyTopHeight > rowTopPixel; + const rowBelowViewport = vScrollBottom - stickyBottomHeight < rowBottomPixel; + let newScrollPosition = null; + if (position === "top") { + newScrollPosition = pxTop - stickyTopHeight; + } else if (position === "bottom") { + newScrollPosition = pxBottom + stickyBottomHeight; + } else if (position === "middle") { + newScrollPosition = pxMiddle; + } else if (rowAboveViewport) { + newScrollPosition = pxTop - stickyTopHeight; + } else if (rowBelowViewport) { + if (pxBottom - pxTop > viewportHeight) { + newScrollPosition = pxTop - stickyTopHeight; + } else { + newScrollPosition = pxBottom + stickyBottomHeight; + } + } + if (newScrollPosition !== null) { + this.setVerticalScrollPosition(newScrollPosition); + rowRenderer.redraw({ afterScroll: true }); + } + rowGotShiftedDuringOperation = startingRowTop !== rowNode.rowTop || startingRowHeight !== rowNode.rowHeight; + stickyHeightsChanged = stickyTopHeight !== gridBodyCtrl.stickyTopHeight || stickyBottomHeight !== gridBodyCtrl.stickyBottomHeight; + attempt++; + } while ((rowGotShiftedDuringOperation || stickyHeightsChanged) && attempt < 10); + this.animationFrameSvc?.flushAllFrames(); + if (retry < 10 && (rowNode?.stub || !this.beans.rowAutoHeight?.areRowsMeasured())) { + const scrollTop = this.getVScrollPosition().top; + this.clearRetryListenerFncs = this.addManagedEventListeners({ + bodyScroll: () => { + const newScrollTop = this.getVScrollPosition().top; + if (scrollTop === newScrollTop) { + return; + } + this.clearRetryListeners(); + }, + modelUpdated: () => { + this.clearRetryListeners(); + if (index >= rowModel.getRowCount()) { + return; + } + this.ensureIndexVisible(index, position, retry + 1); + } + }); + } + }); + } + clearRetryListeners() { + for (const callback of this.clearRetryListenerFncs) { + callback(); + } + this.clearRetryListenerFncs = []; + } + ensureColumnVisible(key, position = "auto") { + const { colModel, frameworkOverrides } = this.beans; + const column = colModel.getCol(key); + if (!column) { + return; + } + if (column.isPinned()) { + return; + } + if (!this.visibleCols.isColDisplayed(column)) { + return; + } + const newHorizontalScroll = this.getPositionedHorizontalScroll(column, position); + frameworkOverrides.wrapIncoming(() => { + if (newHorizontalScroll !== null) { + this.centerRowsCtrl.setCenterViewportScrollLeft(newHorizontalScroll); + } + this.centerRowsCtrl.onHorizontalViewportChanged(); + this.animationFrameSvc?.flushAllFrames(); + }); + } + getPositionedHorizontalScroll(column, position) { + const { columnBeforeStart, columnAfterEnd } = this.isColumnOutsideViewport(column); + const viewportTooSmallForColumn = this.centerRowsCtrl.getCenterWidth() < column.getActualWidth(); + const viewportWidth = this.centerRowsCtrl.getCenterWidth(); + const isRtl = this.enableRtl; + let alignColToStart = (isRtl ? columnBeforeStart : columnAfterEnd) || viewportTooSmallForColumn; + let alignColToEnd = isRtl ? columnAfterEnd : columnBeforeStart; + if (position !== "auto") { + alignColToStart = position === "start"; + alignColToEnd = position === "end"; + } + const isMiddle = position === "middle"; + if (alignColToStart || alignColToEnd || isMiddle) { + const { colLeft, colMiddle, colRight } = this.getColumnBounds(column); + if (isMiddle) { + return colMiddle - viewportWidth / 2; + } + if (alignColToStart) { + return isRtl ? colRight : colLeft; + } + return isRtl ? colLeft - viewportWidth : colRight - viewportWidth; + } + return null; + } + isColumnOutsideViewport(column) { + const { start: viewportStart, end: viewportEnd } = this.getViewportBounds(); + const { colLeft, colRight } = this.getColumnBounds(column); + const isRtl = this.enableRtl; + const columnBeforeStart = isRtl ? viewportStart > colRight : viewportEnd < colRight; + const columnAfterEnd = isRtl ? viewportEnd < colLeft : viewportStart > colLeft; + return { columnBeforeStart, columnAfterEnd }; + } + getColumnBounds(column) { + const isRtl = this.enableRtl; + const bodyWidth = this.visibleCols.bodyWidth; + const colWidth = column.getActualWidth(); + const colLeft = column.getLeft(); + const multiplier = isRtl ? -1 : 1; + const colLeftPixel = isRtl ? bodyWidth - colLeft : colLeft; + const colRightPixel = colLeftPixel + colWidth * multiplier; + const colMidPixel = colLeftPixel + colWidth / 2 * multiplier; + return { colLeft: colLeftPixel, colMiddle: colMidPixel, colRight: colRightPixel }; + } + getViewportBounds() { + const viewportWidth = this.centerRowsCtrl.getCenterWidth(); + const scrollPosition = this.centerRowsCtrl.getCenterViewportScrollLeft(); + const viewportStartPixel = scrollPosition; + const viewportEndPixel = viewportWidth + scrollPosition; + return { start: viewportStartPixel, end: viewportEndPixel, width: viewportWidth }; + } +}; +var AXES = { + horizontal: { + overflow: (el) => el.scrollWidth - el.clientWidth, + scrollSize: (el) => el.scrollWidth, + clientSize: (el) => el.clientWidth, + opposite: "vertical" + }, + vertical: { + overflow: (el) => el.scrollHeight - el.clientHeight, + scrollSize: (el) => el.scrollHeight, + clientSize: (el) => el.clientHeight, + opposite: "horizontal" + } +}; +function _shouldShowHorizontalScroll(horizontalElement, verticalScrollElement, scrollbarWidth = _getScrollbarWidth() || 0, primaryScrollbarElement, oppositeScrollbarElement) { + return shouldShowScroll(horizontalElement, verticalScrollElement, "horizontal", scrollbarWidth, primaryScrollbarElement, oppositeScrollbarElement); +} +function _shouldShowVerticalScroll(verticalElement, horizontalScrollElement, scrollbarWidth = _getScrollbarWidth() || 0, primaryScrollbarElement, oppositeScrollbarElement) { + return shouldShowScroll(verticalElement, horizontalScrollElement, "vertical", scrollbarWidth, primaryScrollbarElement, oppositeScrollbarElement); +} +function shouldShowScroll(primaryElement, oppositeElement, axis, scrollbarWidth, primaryScrollbarElement, oppositeScrollbarElement) { + const primary = AXES[axis]; + const opposite = AXES[primary.opposite]; + const primaryScrollbarShowing = primaryScrollbarElement ? _isVisible(primaryScrollbarElement) : true; + const oppositeScrollbarShowing = oppositeScrollbarElement ? _isVisible(oppositeScrollbarElement) : true; + const primaryOverflow = primary.overflow(primaryElement); + if (primaryOverflow <= 0) { + return false; + } + if (!oppositeElement || scrollbarWidth === 0) { + return true; + } + const oppositeOverflow = opposite.overflow(oppositeElement); + if (oppositeOverflow <= 0) { + return true; + } + if (primaryOverflow <= scrollbarWidth) { + if (primaryScrollbarShowing && oppositeScrollbarShowing && isScrollbarCausedByOppositeAxis({ + candidateOverflow: oppositeOverflow, + candidateScrollSize: opposite.scrollSize(oppositeElement), + candidateClientSize: opposite.clientSize(oppositeElement), + scrollbarWidth + })) { + return false; + } + const sizeWithoutOppositeScrollbar = primary.clientSize(primaryElement) + scrollbarWidth; + return primary.scrollSize(primaryElement) <= sizeWithoutOppositeScrollbar; + } + return true; +} +function isScrollbarCausedByOppositeAxis({ + candidateOverflow, + candidateScrollSize, + candidateClientSize, + scrollbarWidth +}) { + if (candidateOverflow <= 0 || candidateOverflow > scrollbarWidth) { + return false; + } + const sizeWithoutOppositeScrollbar = candidateClientSize + scrollbarWidth; + return candidateScrollSize > candidateClientSize && candidateScrollSize <= sizeWithoutOppositeScrollbar; +} +var ViewportSizeFeature = class extends BeanStub { + constructor(centerContainerCtrl) { + super(); + this.centerContainerCtrl = centerContainerCtrl; + } + wireBeans(beans) { + this.scrollVisibleSvc = beans.scrollVisibleSvc; + } + postConstruct() { + this.beans.ctrlsSvc.whenReady(this, (p) => { + this.gridBodyCtrl = p.gridBodyCtrl; + this.listenForResize(); + }); + this.addManagedEventListeners({ scrollbarWidthChanged: this.onScrollbarWidthChanged.bind(this) }); + this.addManagedPropertyListeners(["alwaysShowHorizontalScroll", "alwaysShowVerticalScroll"], () => { + this.checkViewportAndScrolls(); + }); + } + listenForResize() { + const { beans, centerContainerCtrl, gridBodyCtrl } = this; + const listener = () => { + _requestAnimationFrame(beans, () => { + this.onCenterViewportResized(); + }); + }; + centerContainerCtrl.registerViewportResizeListener(listener); + gridBodyCtrl.registerBodyViewportResizeListener(listener); + } + onScrollbarWidthChanged() { + this.checkViewportAndScrolls(); + } + onCenterViewportResized() { + this.scrollVisibleSvc.updateScrollGap(); + if (this.centerContainerCtrl.isViewportInTheDOMTree()) { + const { pinnedCols, colFlex } = this.beans; + pinnedCols?.keepPinnedColumnsNarrowerThanViewport(); + this.checkViewportAndScrolls(); + const newWidth = this.centerContainerCtrl.getCenterWidth(); + if (newWidth !== this.centerWidth) { + this.centerWidth = newWidth; + colFlex?.refreshFlexedColumns({ + viewportWidth: this.centerWidth, + updateBodyWidths: true, + fireResizedEvent: true + }); + } + } else { + this.bodyHeight = 0; + } + } + checkViewportAndScrolls() { + this.updateScrollVisibleService(); + this.checkBodyHeight(); + this.onHorizontalViewportChanged(); + this.gridBodyCtrl.scrollFeature.checkScrollLeft(); + } + getBodyHeight() { + return this.bodyHeight; + } + checkBodyHeight() { + const eBodyViewport = this.gridBodyCtrl.eBodyViewport; + const bodyHeight = _getInnerHeight(eBodyViewport); + if (this.bodyHeight !== bodyHeight) { + this.bodyHeight = bodyHeight; + this.eventSvc.dispatchEvent({ + type: "bodyHeightChanged" + }); + } + } + updateScrollVisibleService() { + this.updateScrollVisibleServiceImpl(); + setTimeout(this.updateScrollVisibleServiceImpl.bind(this), 500); + } + updateScrollVisibleServiceImpl() { + if (!this.isAlive()) { + return; + } + const params = { + horizontalScrollShowing: this.centerContainerCtrl.isHorizontalScrollShowing(), + verticalScrollShowing: this.gridBodyCtrl.isVerticalScrollShowing() + }; + this.scrollVisibleSvc.setScrollsVisible(params); + } + onHorizontalViewportChanged() { + const { centerContainerCtrl, beans } = this; + const scrollWidth = centerContainerCtrl.getCenterWidth(); + const scrollPosition = centerContainerCtrl.getViewportScrollLeft(); + beans.colViewport.setScrollPosition(scrollWidth, scrollPosition); + } +}; +function _isEventFromPrintableCharacter(event) { + if (event.altKey || event.ctrlKey || event.metaKey) { + return false; + } + const printableCharacter = event.key?.length === 1; + return printableCharacter; +} +function _suppressCellMouseEvent(gos, column, node, event) { + const suppressMouseEventHandling = column.getColDef().cellRendererParams?.suppressMouseEventHandling; + return suppressMouseEvent(gos, column, node, event, suppressMouseEventHandling); +} +function _suppressFullWidthMouseEvent(gos, cellRendererParams, node, event) { + const suppressMouseEventHandling = cellRendererParams?.suppressMouseEventHandling; + return suppressMouseEvent(gos, undefined, node, event, suppressMouseEventHandling); +} +function suppressMouseEvent(gos, column, node, event, suppressMouseEventHandling) { + if (!suppressMouseEventHandling) { + return false; + } + return suppressMouseEventHandling(_addGridCommonParams(gos, { + column, + node, + event + })); +} +function _getCtrlForEventTarget(gos, eventTarget, type) { + let sourceElement = eventTarget; + while (sourceElement) { + const renderedComp = _getDomData(gos, sourceElement, type); + if (renderedComp) { + return renderedComp; + } + sourceElement = sourceElement.parentElement; + } + return null; +} +var DOM_DATA_KEY_CELL_CTRL = "cellCtrl"; +function _getCellCtrlForEventTarget(gos, eventTarget) { + return _getCtrlForEventTarget(gos, eventTarget, DOM_DATA_KEY_CELL_CTRL); +} +var DOM_DATA_KEY_ROW_CTRL = "renderedRow"; +function _getRowCtrlForEventTarget(gos, eventTarget) { + return _getCtrlForEventTarget(gos, eventTarget, DOM_DATA_KEY_ROW_CTRL); +} +function _isUserSuppressingKeyboardEvent(gos, keyboardEvent, rowNode, column, editing) { + const colDefFunc = column ? column.getColDef().suppressKeyboardEvent : undefined; + if (!colDefFunc) { + return false; + } + const params = _addGridCommonParams(gos, { + event: keyboardEvent, + editing, + column, + node: rowNode, + data: rowNode.data, + colDef: column.getColDef() + }); + if (colDefFunc) { + const colDefFuncResult = colDefFunc(params); + if (colDefFuncResult) { + return true; + } + } + return false; +} +function _selectAllCells(beans) { + const { pinnedRowModel, rowModel, rangeSvc, visibleCols } = beans; + if (!rangeSvc || visibleCols.allCols.length === 0) { + return; + } + const isEmptyPinnedTop = pinnedRowModel?.isEmpty("top") ?? true; + const isEmptyPinnedBottom = pinnedRowModel?.isEmpty("bottom") ?? true; + const floatingStart = isEmptyPinnedTop ? null : "top"; + let floatingEnd; + let rowEnd; + if (isEmptyPinnedBottom) { + floatingEnd = null; + rowEnd = rowModel.getRowCount() - 1; + } else { + floatingEnd = "bottom"; + rowEnd = pinnedRowModel?.getPinnedBottomRowCount() ?? 0 - 1; + } + rangeSvc.setCellRange({ + rowStartIndex: 0, + rowStartPinned: floatingStart, + rowEndIndex: rowEnd, + rowEndPinned: floatingEnd + }); +} +var RowContainerEventsFeature = class extends BeanStub { + constructor(element) { + super(); + this.element = element; + } + postConstruct() { + this.addKeyboardListeners(); + this.addMouseListeners(); + this.beans.touchSvc?.mockRowContextMenu(this); + this.editSvc = this.beans.editSvc; + } + addKeyboardListeners() { + const eventName = "keydown"; + const listener = this.processKeyboardEvent.bind(this, eventName); + this.addManagedElementListeners(this.element, { [eventName]: listener }); + } + addMouseListeners() { + let mouseDownEvent = "mousedown"; + if (_isEventSupported("pointerdown")) { + mouseDownEvent = "pointerdown"; + } else if (_isEventSupported("touchstart")) { + mouseDownEvent = "touchstart"; + } + const eventNames = ["dblclick", "contextmenu", "mouseover", "mouseout", "click", mouseDownEvent]; + for (const eventName of eventNames) { + const listener = this.processMouseEvent.bind(this, eventName); + this.addManagedElementListeners(this.element, { [eventName]: listener }); + } + } + processMouseEvent(eventName, mouseEvent) { + if (!_isEventFromThisInstance(this.beans, mouseEvent) || _isStopPropagationForAgGrid(mouseEvent)) { + return; + } + const { cellCtrl, rowCtrl } = this.getControlsForEventTarget(mouseEvent.target); + if (eventName === "contextmenu") { + if (cellCtrl?.column) { + cellCtrl.dispatchCellContextMenuEvent(mouseEvent); + } + this.beans.contextMenuSvc?.handleContextMenuMouseEvent(mouseEvent, undefined, rowCtrl, cellCtrl); + } else { + if (cellCtrl) { + cellCtrl.onMouseEvent(eventName, mouseEvent); + } + if (rowCtrl) { + rowCtrl.onMouseEvent(eventName, mouseEvent); + } + } + } + getControlsForEventTarget(target) { + const { gos } = this; + return { + cellCtrl: _getCellCtrlForEventTarget(gos, target), + rowCtrl: _getRowCtrlForEventTarget(gos, target) + }; + } + processKeyboardEvent(eventName, keyboardEvent) { + const { cellCtrl, rowCtrl } = this.getControlsForEventTarget(keyboardEvent.target); + if (keyboardEvent.defaultPrevented) { + return; + } + if (cellCtrl) { + this.processCellKeyboardEvent(cellCtrl, eventName, keyboardEvent); + } else if (rowCtrl?.isFullWidth()) { + this.processFullWidthRowKeyboardEvent(rowCtrl, eventName, keyboardEvent); + } + } + processCellKeyboardEvent(cellCtrl, eventName, keyboardEvent) { + const editing = this.editSvc?.isEditing(cellCtrl, { withOpenEditor: true }) ?? false; + const gridProcessingAllowed = !_isUserSuppressingKeyboardEvent(this.gos, keyboardEvent, cellCtrl.rowNode, cellCtrl.column, editing); + if (gridProcessingAllowed) { + if (eventName === "keydown") { + const wasScrollKey = !editing && this.beans.navigation?.handlePageScrollingKey(keyboardEvent); + if (!wasScrollKey) { + cellCtrl.onKeyDown(keyboardEvent); + } + this.doGridOperations(keyboardEvent, editing); + if (_isEventFromPrintableCharacter(keyboardEvent)) { + cellCtrl.processCharacter(keyboardEvent); + } + } + } + if (eventName === "keydown") { + this.eventSvc.dispatchEvent(cellCtrl.createEvent(keyboardEvent, "cellKeyDown")); + } + } + processFullWidthRowKeyboardEvent(rowCtrl, eventName, keyboardEvent) { + const { rowNode } = rowCtrl; + const { focusSvc, navigation } = this.beans; + const focusedCell = focusSvc.getFocusedCell(); + const column = focusedCell?.column; + const gridProcessingAllowed = !_isUserSuppressingKeyboardEvent(this.gos, keyboardEvent, rowNode, column, false); + if (gridProcessingAllowed) { + const key = keyboardEvent.key; + if (eventName === "keydown") { + switch (key) { + case KeyCode.PAGE_HOME: + case KeyCode.PAGE_END: + case KeyCode.PAGE_UP: + case KeyCode.PAGE_DOWN: + navigation?.handlePageScrollingKey(keyboardEvent, true); + break; + case KeyCode.LEFT: + case KeyCode.RIGHT: + if (!this.gos.get("embedFullWidthRows")) { + break; + } + case KeyCode.UP: + case KeyCode.DOWN: + rowCtrl.onKeyboardNavigate(keyboardEvent); + break; + case KeyCode.TAB: + rowCtrl.onTabKeyDown(keyboardEvent); + break; + default: + } + } + } + if (eventName === "keydown") { + this.eventSvc.dispatchEvent(rowCtrl.createRowEvent("cellKeyDown", keyboardEvent)); + } + } + doGridOperations(keyboardEvent, editing) { + if (!keyboardEvent.ctrlKey && !keyboardEvent.metaKey) { + return; + } + if (editing) { + return; + } + if (!_isEventFromThisInstance(this.beans, keyboardEvent)) { + return; + } + const keyCode = _normaliseQwertyAzerty(keyboardEvent); + const { clipboardSvc, undoRedo } = this.beans; + if (keyCode === KeyCode.A) { + return this.onCtrlAndA(keyboardEvent); + } + if (keyCode === KeyCode.C) { + return this.onCtrlAndC(clipboardSvc, keyboardEvent); + } + if (keyCode === KeyCode.D) { + return this.onCtrlAndD(clipboardSvc, keyboardEvent); + } + if (keyCode === KeyCode.V) { + return this.onCtrlAndV(clipboardSvc, keyboardEvent); + } + if (keyCode === KeyCode.X) { + return this.onCtrlAndX(clipboardSvc, keyboardEvent); + } + if (keyCode === KeyCode.Y) { + return this.onCtrlAndY(undoRedo); + } + if (keyCode === KeyCode.Z) { + return this.onCtrlAndZ(undoRedo, keyboardEvent); + } + } + onCtrlAndA(event) { + const { + beans: { rowModel, rangeSvc, selectionSvc }, + gos + } = this; + if (rangeSvc && _isCellSelectionEnabled(gos) && !_getCtrlASelectsRows(gos) && rowModel.isRowsToRender()) { + _selectAllCells(this.beans); + } else if (selectionSvc) { + selectionSvc.selectAllRowNodes({ source: "keyboardSelectAll", selectAll: _getSelectAll(gos) }); + } + event.preventDefault(); + } + onCtrlAndC(clipboardSvc, event) { + if (!clipboardSvc || this.gos.get("enableCellTextSelection")) { + return; + } + const { cellCtrl } = this.getControlsForEventTarget(event.target); + if (this.editSvc?.isEditing(cellCtrl, { withOpenEditor: true })) { + return; + } + event.preventDefault(); + clipboardSvc.copyToClipboard(); + } + onCtrlAndX(clipboardSvc, event) { + if (!clipboardSvc || this.gos.get("enableCellTextSelection") || this.gos.get("suppressCutToClipboard")) { + return; + } + const { cellCtrl } = this.getControlsForEventTarget(event.target); + if (this.editSvc?.isEditing(cellCtrl, { withOpenEditor: true })) { + return; + } + event.preventDefault(); + clipboardSvc.cutToClipboard(undefined, "ui"); + } + onCtrlAndV(clipboardSvc, event) { + const { cellCtrl } = this.getControlsForEventTarget(event.target); + if (this.editSvc?.isEditing(cellCtrl, { withOpenEditor: true })) { + return; + } + if (clipboardSvc && !this.gos.get("suppressClipboardPaste")) { + clipboardSvc.pasteFromClipboard(); + } + } + onCtrlAndD(clipboardSvc, event) { + if (clipboardSvc && !this.gos.get("suppressClipboardPaste")) { + clipboardSvc.copyRangeDown(); + } + event.preventDefault(); + } + onCtrlAndZ(undoRedo, event) { + if (!this.gos.get("undoRedoCellEditing") || !undoRedo) { + return; + } + event.preventDefault(); + if (event.shiftKey) { + undoRedo.redo("ui"); + } else { + undoRedo.undo("ui"); + } + } + onCtrlAndY(undoRedo) { + undoRedo?.redo("ui"); + } +}; +var getTopRowCtrls = (r) => r.topRowCtrls; +var getStickyTopRowCtrls = (r) => r.getStickyTopRowCtrls(); +var getStickyBottomRowCtrls = (r) => r.getStickyBottomRowCtrls(); +var getBottomRowCtrls = (r) => r.bottomRowCtrls; +var getCentreRowCtrls = (r) => r.allRowCtrls; +var getSpannedTopRowCtrls = (r) => r.getCtrls("top"); +var getSpannedCenterRowCtrls = (r) => r.getCtrls("center"); +var getSpannedBottomRowCtrls = (r) => r.getCtrls("bottom"); +var ContainerCssClasses = { + center: { + type: "center", + name: "center-cols", + getRowCtrls: getCentreRowCtrls, + getSpannedRowCtrls: getSpannedCenterRowCtrls + }, + left: { + type: "left", + name: "pinned-left-cols", + pinnedType: "left", + getRowCtrls: getCentreRowCtrls, + getSpannedRowCtrls: getSpannedCenterRowCtrls + }, + right: { + type: "right", + name: "pinned-right-cols", + pinnedType: "right", + getRowCtrls: getCentreRowCtrls, + getSpannedRowCtrls: getSpannedCenterRowCtrls + }, + fullWidth: { + type: "fullWidth", + name: "full-width", + fullWidth: true, + getRowCtrls: getCentreRowCtrls + }, + topCenter: { + type: "center", + name: "floating-top", + getRowCtrls: getTopRowCtrls, + getSpannedRowCtrls: getSpannedTopRowCtrls + }, + topLeft: { + type: "left", + name: "pinned-left-floating", + container: "ag-pinned-left-floating-top", + pinnedType: "left", + getRowCtrls: getTopRowCtrls, + getSpannedRowCtrls: getSpannedTopRowCtrls + }, + topRight: { + type: "right", + name: "pinned-right-floating", + container: "ag-pinned-right-floating-top", + pinnedType: "right", + getRowCtrls: getTopRowCtrls, + getSpannedRowCtrls: getSpannedTopRowCtrls + }, + topFullWidth: { + type: "fullWidth", + name: "floating-top-full-width", + fullWidth: true, + getRowCtrls: getTopRowCtrls + }, + stickyTopCenter: { + type: "center", + name: "sticky-top", + getRowCtrls: getStickyTopRowCtrls + }, + stickyTopLeft: { + type: "left", + name: "pinned-left-sticky-top", + container: "ag-pinned-left-sticky-top", + pinnedType: "left", + getRowCtrls: getStickyTopRowCtrls + }, + stickyTopRight: { + type: "right", + name: "pinned-right-sticky-top", + container: "ag-pinned-right-sticky-top", + pinnedType: "right", + getRowCtrls: getStickyTopRowCtrls + }, + stickyTopFullWidth: { + type: "fullWidth", + name: "sticky-top-full-width", + fullWidth: true, + getRowCtrls: getStickyTopRowCtrls + }, + stickyBottomCenter: { + type: "center", + name: "sticky-bottom", + getRowCtrls: getStickyBottomRowCtrls + }, + stickyBottomLeft: { + type: "left", + name: "pinned-left-sticky-bottom", + container: "ag-pinned-left-sticky-bottom", + pinnedType: "left", + getRowCtrls: getStickyBottomRowCtrls + }, + stickyBottomRight: { + type: "right", + name: "pinned-right-sticky-bottom", + container: "ag-pinned-right-sticky-bottom", + pinnedType: "right", + getRowCtrls: getStickyBottomRowCtrls + }, + stickyBottomFullWidth: { + type: "fullWidth", + name: "sticky-bottom-full-width", + fullWidth: true, + getRowCtrls: getStickyBottomRowCtrls + }, + bottomCenter: { + type: "center", + name: "floating-bottom", + getRowCtrls: getBottomRowCtrls, + getSpannedRowCtrls: getSpannedBottomRowCtrls + }, + bottomLeft: { + type: "left", + name: "pinned-left-floating-bottom", + container: "ag-pinned-left-floating-bottom", + pinnedType: "left", + getRowCtrls: getBottomRowCtrls, + getSpannedRowCtrls: getSpannedBottomRowCtrls + }, + bottomRight: { + type: "right", + name: "pinned-right-floating-bottom", + container: "ag-pinned-right-floating-bottom", + pinnedType: "right", + getRowCtrls: getBottomRowCtrls, + getSpannedRowCtrls: getSpannedBottomRowCtrls + }, + bottomFullWidth: { + type: "fullWidth", + name: "floating-bottom-full-width", + fullWidth: true, + getRowCtrls: getBottomRowCtrls + } +}; +function _getRowViewportClass(name) { + const options = _getRowContainerOptions(name); + return `ag-${options.name}-viewport`; +} +function _getRowContainerClass(name) { + const options = _getRowContainerOptions(name); + return options.container ?? `ag-${options.name}-container`; +} +function _getRowSpanContainerClass(name) { + const options = _getRowContainerOptions(name); + return `ag-${options.name}-spanned-cells-container`; +} +function _getRowContainerOptions(name) { + return ContainerCssClasses[name]; +} +var allTopNoFW = ["topCenter", "topLeft", "topRight"]; +var allBottomNoFW = ["bottomCenter", "bottomLeft", "bottomRight"]; +var allMiddleNoFW = ["center", "left", "right"]; +var allMiddle = ["center", "left", "right", "fullWidth"]; +var allCenter = ["stickyTopCenter", "stickyBottomCenter", "center", "topCenter", "bottomCenter"]; +var allLeft = ["left", "bottomLeft", "topLeft", "stickyTopLeft", "stickyBottomLeft"]; +var allRight = ["right", "bottomRight", "topRight", "stickyTopRight", "stickyBottomRight"]; +var allStickyTopNoFW = ["stickyTopCenter", "stickyTopLeft", "stickyTopRight"]; +var allStickyBottomNoFW = ["stickyBottomCenter", "stickyBottomLeft", "stickyBottomRight"]; +var allStickyContainers = [ + ...allStickyTopNoFW, + "stickyTopFullWidth", + ...allStickyBottomNoFW, + "stickyBottomFullWidth" +]; +var allNoFW = [ + ...allTopNoFW, + ...allBottomNoFW, + ...allMiddleNoFW, + ...allStickyTopNoFW, + ...allStickyBottomNoFW +]; +var RowContainerCtrl = class extends BeanStub { + constructor(name) { + super(); + this.name = name; + this.visible = true; + this.EMPTY_CTRLS = []; + this.options = _getRowContainerOptions(name); + } + postConstruct() { + this.enableRtl = this.gos.get("enableRtl"); + this.forContainers(["center"], () => { + this.viewportSizeFeature = this.createManagedBean(new ViewportSizeFeature(this)); + this.addManagedEventListeners({ + stickyTopOffsetChanged: this.onStickyTopOffsetChanged.bind(this) + }); + }); + } + onStickyTopOffsetChanged(event) { + this.comp.setOffsetTop(`${event.offset}px`); + } + registerWithCtrlsService() { + if (this.options.fullWidth) { + return; + } + this.beans.ctrlsSvc.register(this.name, this); + } + forContainers(names, callback) { + if (names.indexOf(this.name) >= 0) { + callback(); + } + } + setComp(view, eContainer, eSpannedContainer, eViewport) { + this.comp = view; + this.eContainer = eContainer; + this.eSpannedContainer = eSpannedContainer; + this.eViewport = eViewport; + this.createManagedBean(new RowContainerEventsFeature(this.eViewport ?? this.eContainer)); + this.addPreventScrollWhileDragging(); + this.listenOnDomOrder(); + const { pinnedCols, rangeSvc } = this.beans; + const pinnedWidthChanged = () => this.onPinnedWidthChanged(); + this.forContainers(allLeft, () => { + this.pinnedWidthFeature = this.createOptionalManagedBean(pinnedCols?.createPinnedWidthFeature(true, this.eContainer, this.eSpannedContainer)); + this.addManagedEventListeners({ leftPinnedWidthChanged: pinnedWidthChanged }); + }); + this.forContainers(allRight, () => { + this.pinnedWidthFeature = this.createOptionalManagedBean(pinnedCols?.createPinnedWidthFeature(false, this.eContainer, this.eSpannedContainer)); + this.addManagedEventListeners({ rightPinnedWidthChanged: pinnedWidthChanged }); + }); + this.forContainers(allMiddle, () => this.createManagedBean(new SetHeightFeature(this.eContainer, this.name === "center" ? eViewport : undefined))); + if (rangeSvc) { + this.forContainers(allNoFW, () => this.createManagedBean(rangeSvc.createDragListenerFeature(this.eContainer))); + } + this.forContainers(allCenter, () => this.createManagedBean(new CenterWidthFeature((width) => this.comp.setContainerWidth(`${width}px`)))); + this.visible = this.isContainerVisible(); + this.addListeners(); + this.registerWithCtrlsService(); + } + onScrollCallback(fn) { + this.addManagedElementListeners(this.eViewport, { scroll: fn }); + } + addListeners() { + const { spannedRowRenderer, gos } = this.beans; + const onDisplayedColumnsChanged = this.onDisplayedColumnsChanged.bind(this); + this.addManagedEventListeners({ + displayedColumnsChanged: onDisplayedColumnsChanged, + displayedColumnsWidthChanged: onDisplayedColumnsChanged, + displayedRowsChanged: (params) => this.onDisplayedRowsChanged(params.afterScroll) + }); + onDisplayedColumnsChanged(); + this.onDisplayedRowsChanged(); + if (spannedRowRenderer && this.options.getSpannedRowCtrls && gos.get("enableCellSpan")) { + this.addManagedListeners(spannedRowRenderer, { + spannedRowsUpdated: () => { + const spannedCtrls = this.options.getSpannedRowCtrls(spannedRowRenderer); + if (!spannedCtrls) { + return; + } + this.comp.setSpannedRowCtrls(spannedCtrls, false); + } + }); + } + } + listenOnDomOrder() { + const isStickContainer = allStickyContainers.indexOf(this.name) >= 0; + if (isStickContainer) { + this.comp.setDomOrder(true); + return; + } + const listener = () => { + const isEnsureDomOrder = this.gos.get("ensureDomOrder"); + const isPrintLayout = _isDomLayout(this.gos, "print"); + this.comp.setDomOrder(isEnsureDomOrder || isPrintLayout); + }; + this.addManagedPropertyListener("domLayout", listener); + listener(); + } + onDisplayedColumnsChanged() { + this.forContainers(["center"], () => this.onHorizontalViewportChanged()); + } + addPreventScrollWhileDragging() { + const { dragSvc } = this.beans; + if (!dragSvc) { + return; + } + const preventScroll = (e) => { + if (dragSvc.dragging) { + if (e.cancelable) { + e.preventDefault(); + } + } + }; + this.eContainer.addEventListener("touchmove", preventScroll, { passive: false }); + this.addDestroyFunc(() => this.eContainer.removeEventListener("touchmove", preventScroll)); + } + onHorizontalViewportChanged(afterScroll = false) { + const scrollWidth = this.getCenterWidth(); + const scrollPosition = this.getCenterViewportScrollLeft(); + this.beans.colViewport.setScrollPosition(scrollWidth, scrollPosition, afterScroll); + } + hasHorizontalScrollGap() { + return this.eContainer.clientWidth - this.eViewport.clientWidth < 0; + } + hasVerticalScrollGap() { + return this.eContainer.clientHeight - this.eViewport.clientHeight < 0; + } + getCenterWidth() { + return _getInnerWidth(this.eViewport); + } + getCenterViewportScrollLeft() { + return _getScrollLeft(this.eViewport, this.enableRtl); + } + registerViewportResizeListener(listener) { + const unsubscribeFromResize = _observeResize(this.beans, this.eViewport, listener); + this.addDestroyFunc(() => unsubscribeFromResize()); + } + isViewportInTheDOMTree() { + return _isInDOM(this.eViewport); + } + getViewportScrollLeft() { + return _getScrollLeft(this.eViewport, this.enableRtl); + } + isHorizontalScrollShowing() { + const { beans, gos, eViewport } = this; + const isAlwaysShowHorizontalScroll = gos.get("alwaysShowHorizontalScroll"); + const { ctrlsSvc } = beans; + const verticalScrollElement = ctrlsSvc.getGridBodyCtrl()?.eBodyViewport; + const hScrollEl = ctrlsSvc.get("fakeHScrollComp")?.getGui(); + const vScrollEl = ctrlsSvc.get("fakeVScrollComp")?.getGui(); + return isAlwaysShowHorizontalScroll || _shouldShowHorizontalScroll(eViewport, verticalScrollElement, undefined, hScrollEl, vScrollEl); + } + setHorizontalScroll(offset) { + this.comp.setHorizontalScroll(offset); + } + getHScrollPosition() { + const res = { + left: this.eViewport.scrollLeft, + right: this.eViewport.scrollLeft + this.eViewport.offsetWidth + }; + return res; + } + setCenterViewportScrollLeft(value) { + _setScrollLeft(this.eViewport, value, this.enableRtl); + } + isContainerVisible() { + const pinned = this.options.pinnedType != null; + return !pinned || !!this.pinnedWidthFeature && this.pinnedWidthFeature.getWidth() > 0; + } + onPinnedWidthChanged() { + const visible = this.isContainerVisible(); + if (this.visible != visible) { + this.visible = visible; + this.onDisplayedRowsChanged(); + } + } + onDisplayedRowsChanged(afterScroll = false) { + const rows = this.options.getRowCtrls(this.beans.rowRenderer); + if (!this.visible || rows.length === 0) { + this.comp.setRowCtrls({ rowCtrls: this.EMPTY_CTRLS }); + return; + } + const printLayout = _isDomLayout(this.gos, "print"); + const embedFullWidthRows = this.gos.get("embedFullWidthRows"); + const embedFW = embedFullWidthRows || printLayout; + const rowsThisContainer = rows.filter((rowCtrl) => { + const fullWidthRow = rowCtrl.isFullWidth(); + const match = this.options.fullWidth ? !embedFW && fullWidthRow : embedFW || !fullWidthRow; + return match; + }); + this.comp.setRowCtrls({ rowCtrls: rowsThisContainer, useFlushSync: afterScroll }); + } +}; +var CSS_CLASS_FORCE_VERTICAL_SCROLL = "ag-force-vertical-scroll"; +var CSS_CLASS_CELL_SELECTABLE = "ag-selectable"; +var CSS_CLASS_COLUMN_MOVING = "ag-column-moving"; +var GridBodyCtrl = class extends BeanStub { + constructor() { + super(...arguments); + this.stickyTopHeight = 0; + this.stickyBottomHeight = 0; + } + wireBeans(beans) { + this.ctrlsSvc = beans.ctrlsSvc; + this.colModel = beans.colModel; + this.scrollVisibleSvc = beans.scrollVisibleSvc; + this.pinnedRowModel = beans.pinnedRowModel; + this.filterManager = beans.filterManager; + this.rowGroupColsSvc = beans.rowGroupColsSvc; + } + setComp(comp, eGridBody, eBodyViewport, eTop, eBottom, eStickyTop, eStickyBottom) { + this.comp = comp; + this.eGridBody = eGridBody; + this.eBodyViewport = eBodyViewport; + this.eTop = eTop; + this.eBottom = eBottom; + this.eStickyTop = eStickyTop; + this.eStickyBottom = eStickyBottom; + this.eCenterColsViewport = eBodyViewport.querySelector(`.${_getRowViewportClass("center")}`); + this.eFullWidthContainer = eBodyViewport.querySelector(`.${_getRowContainerClass("fullWidth")}`); + this.setCellTextSelection(this.gos.get("enableCellTextSelection")); + this.addManagedPropertyListener("enableCellTextSelection", (props) => this.setCellTextSelection(props.currentValue)); + this.createManagedBean(new LayoutFeature(this.comp)); + this.scrollFeature = this.createManagedBean(new GridBodyScrollFeature(eBodyViewport)); + this.beans.rowDragSvc?.setupRowDrag(eBodyViewport, this); + this.setupRowAnimationCssClass(); + this.addEventListeners(); + this.addFocusListeners([eTop, eBodyViewport, eBottom, eStickyTop, eStickyBottom]); + this.setGridRootRole(); + this.onGridColumnsChanged(); + this.addBodyViewportListener(); + this.setFloatingHeights(); + this.disableBrowserDragging(); + this.addStopEditingWhenGridLosesFocus(); + this.updateScrollingClasses(); + this.filterManager?.setupAdvFilterHeaderComp(eTop); + this.ctrlsSvc.register("gridBodyCtrl", this); + } + addEventListeners() { + const setFloatingHeights = this.setFloatingHeights.bind(this); + const setGridRootRole = this.setGridRootRole.bind(this); + const toggleRowResizeStyle = this.toggleRowResizeStyles.bind(this); + this.addManagedEventListeners({ + gridColumnsChanged: this.onGridColumnsChanged.bind(this), + scrollVisibilityChanged: this.onScrollVisibilityChanged.bind(this), + scrollGapChanged: this.updateScrollingClasses.bind(this), + pinnedRowDataChanged: setFloatingHeights, + pinnedHeightChanged: setFloatingHeights, + pinnedRowsChanged: setFloatingHeights, + headerHeightChanged: this.setStickyTopOffsetTop.bind(this), + columnRowGroupChanged: setGridRootRole, + columnPivotChanged: setGridRootRole, + rowResizeStarted: toggleRowResizeStyle, + rowResizeEnded: toggleRowResizeStyle + }); + this.addManagedPropertyListener("treeData", setGridRootRole); + } + toggleRowResizeStyles(params) { + const isResizingRow = params.type === "rowResizeStarted"; + this.eBodyViewport.classList.toggle("ag-prevent-animation", isResizingRow); + } + onGridColumnsChanged() { + const columns = this.beans.colModel.getCols(); + this.comp.setColumnCount(columns.length); + } + onScrollVisibilityChanged() { + const { scrollVisibleSvc } = this; + const visible = scrollVisibleSvc.verticalScrollShowing; + this.setVerticalScrollPaddingVisible(visible); + this.setStickyWidth(visible); + this.setStickyBottomOffsetBottom(); + const scrollbarWidth = visible ? scrollVisibleSvc.getScrollbarWidth() || 0 : 0; + const pad = _isInvisibleScrollbar() ? 16 : 0; + const width = `calc(100% + ${scrollbarWidth + pad}px)`; + _requestAnimationFrame(this.beans, () => this.comp.setBodyViewportWidth(width)); + this.updateScrollingClasses(); + } + setGridRootRole() { + const { rowGroupColsSvc, colModel, gos } = this; + let isTreeGrid = gos.get("treeData"); + if (!isTreeGrid) { + const isPivotActive = colModel.isPivotMode(); + const rowGroupColumnLen = !rowGroupColsSvc ? 0 : rowGroupColsSvc.columns.length; + const columnsNeededForGrouping = isPivotActive ? 2 : 1; + isTreeGrid = rowGroupColumnLen >= columnsNeededForGrouping; + } + this.comp.setGridRootRole(isTreeGrid ? "treegrid" : "grid"); + } + addFocusListeners(elements) { + for (const element of elements) { + this.addManagedElementListeners(element, { + focusin: (e) => { + const { target } = e; + const isFocusedElementNested = _isElementChildOfClass(target, "ag-root", element); + element.classList.toggle("ag-has-focus", !isFocusedElementNested); + }, + focusout: (e) => { + const { target, relatedTarget } = e; + const gridContainRelatedTarget = element.contains(relatedTarget); + const isNestedRelatedTarget = _isElementChildOfClass(relatedTarget, "ag-root", element); + const isNestedTarget = _isElementChildOfClass(target, "ag-root", element); + if (isNestedTarget) { + return; + } + if (!gridContainRelatedTarget || isNestedRelatedTarget) { + element.classList.remove("ag-has-focus"); + } + } + }); + } + } + setColumnMovingCss(moving) { + this.comp.setColumnMovingCss(CSS_CLASS_COLUMN_MOVING, moving); + } + setCellTextSelection(selectable = false) { + this.comp.setCellSelectableCss(CSS_CLASS_CELL_SELECTABLE, selectable); + } + updateScrollingClasses() { + const { + eGridBody: { classList }, + scrollVisibleSvc + } = this; + classList.toggle("ag-body-vertical-content-no-gap", !scrollVisibleSvc.verticalScrollGap); + classList.toggle("ag-body-horizontal-content-no-gap", !scrollVisibleSvc.horizontalScrollGap); + } + disableBrowserDragging() { + this.addManagedElementListeners(this.eGridBody, { + dragstart: (event) => { + if (event.target instanceof HTMLImageElement) { + event.preventDefault(); + return false; + } + } + }); + } + addStopEditingWhenGridLosesFocus() { + this.beans.editSvc?.addStopEditingWhenGridLosesFocus([ + this.eBodyViewport, + this.eBottom, + this.eTop, + this.eStickyTop, + this.eStickyBottom + ]); + } + updateRowCount() { + const headerCount = (this.ctrlsSvc.getHeaderRowContainerCtrl()?.getRowCount() ?? 0) + (this.filterManager?.getHeaderRowCount() ?? 0); + const { rowModel } = this.beans; + const rowCount = rowModel.isLastRowIndexKnown() ? rowModel.getRowCount() : -1; + const total = rowCount === -1 ? -1 : headerCount + rowCount; + this.comp.setRowCount(total); + } + registerBodyViewportResizeListener(listener) { + this.comp.registerBodyViewportResizeListener(listener); + } + setVerticalScrollPaddingVisible(visible) { + const overflowY = visible ? "scroll" : "hidden"; + this.comp.setPinnedTopBottomOverflowY(overflowY); + } + isVerticalScrollShowing() { + const { gos, comp, ctrlsSvc } = this; + const show = gos.get("alwaysShowVerticalScroll"); + const cssClass = show ? CSS_CLASS_FORCE_VERTICAL_SCROLL : null; + const allowVerticalScroll = _isDomLayout(gos, "normal"); + comp.setAlwaysVerticalScrollClass(cssClass, show); + const horizontalScrollElement = ctrlsSvc.get("center")?.eViewport; + const hScrollEl = ctrlsSvc.get("fakeHScrollComp")?.getGui(); + const vScrollEl = ctrlsSvc.get("fakeVScrollComp")?.getGui(); + return show || allowVerticalScroll && _shouldShowVerticalScroll(this.eBodyViewport, horizontalScrollElement, undefined, vScrollEl, hScrollEl); + } + setupRowAnimationCssClass() { + const { rowContainerHeight, environment } = this.beans; + let initialSizeMeasurementComplete = environment.sizesMeasured; + const updateAnimationClass = () => { + const animateRows = initialSizeMeasurementComplete && _isAnimateRows(this.gos) && !rowContainerHeight.stretching; + const animateRowsCssClass = animateRows ? "ag-row-animation" : "ag-row-no-animation"; + this.comp.setRowAnimationCssOnBodyViewport(animateRowsCssClass, animateRows); + }; + updateAnimationClass(); + this.addManagedEventListeners({ heightScaleChanged: updateAnimationClass }); + this.addManagedPropertyListener("animateRows", updateAnimationClass); + this.addManagedEventListeners({ + stylesChanged: () => { + if (!initialSizeMeasurementComplete && environment.sizesMeasured) { + initialSizeMeasurementComplete = true; + updateAnimationClass(); + } + } + }); + } + addBodyViewportListener() { + const { + eBodyViewport, + eStickyTop, + eStickyBottom, + eTop, + eBottom, + beans: { popupSvc, touchSvc } + } = this; + const listener = this.onBodyViewportContextMenu.bind(this); + this.addManagedElementListeners(eBodyViewport, { contextmenu: listener }); + touchSvc?.mockBodyContextMenu(this, listener); + this.addManagedElementListeners(eBodyViewport, { + wheel: this.onBodyViewportWheel.bind(this, popupSvc) + }); + const onStickyWheel = this.onStickyWheel.bind(this); + for (const container of [eStickyTop, eStickyBottom, eTop, eBottom]) { + this.addManagedElementListeners(container, { wheel: onStickyWheel }); + } + const onHorizontalWheel = this.onHorizontalWheel.bind(this); + for (const container of ["left", "right", "topLeft", "topRight", "bottomLeft", "bottomRight"]) { + this.addManagedElementListeners(this.ctrlsSvc.get(container).eContainer, { + wheel: onHorizontalWheel + }); + } + this.addFullWidthContainerWheelListener(); + } + addFullWidthContainerWheelListener() { + this.addManagedElementListeners(this.eFullWidthContainer, { + wheel: (e) => this.onFullWidthContainerWheel(e) + }); + } + onFullWidthContainerWheel(e) { + const { deltaX, deltaY, shiftKey } = e; + const isHorizontalScroll = shiftKey || Math.abs(deltaX) > Math.abs(deltaY); + if (isHorizontalScroll && _isEventFromThisInstance(this.beans, e)) { + this.scrollGridBodyToMatchEvent(e); + } + } + onStickyWheel(e) { + const { deltaY } = e; + const scrolled = this.scrollVertically(deltaY); + if (scrolled > 0) { + e.preventDefault(); + } + } + onHorizontalWheel(e) { + const { deltaX, deltaY, shiftKey } = e; + const isHorizontalScroll = shiftKey || Math.abs(deltaX) > Math.abs(deltaY); + if (!isHorizontalScroll) { + return; + } + this.scrollGridBodyToMatchEvent(e); + } + scrollGridBodyToMatchEvent(e) { + const { deltaX, deltaY } = e; + e.preventDefault(); + this.eCenterColsViewport.scrollBy({ left: deltaX || deltaY }); + } + onBodyViewportContextMenu(mouseEvent, touch, touchEvent) { + if (!mouseEvent && !touchEvent) { + return; + } + if (this.gos.get("preventDefaultOnContextMenu")) { + const event = mouseEvent || touchEvent; + event.preventDefault(); + } + const { target } = mouseEvent || touch; + if (target === this.eBodyViewport || target === this.ctrlsSvc.get("center").eViewport) { + this.beans.contextMenuSvc?.showContextMenu({ + mouseEvent, + touchEvent, + value: null, + anchorToElement: this.eGridBody, + source: "ui" + }); + } + } + onBodyViewportWheel(popupSvc, e) { + if (!this.gos.get("suppressScrollWhenPopupsAreOpen")) { + return; + } + if (popupSvc?.hasAnchoredPopup()) { + e.preventDefault(); + } + } + scrollVertically(pixels) { + const oldScrollPosition = this.eBodyViewport.scrollTop; + this.scrollFeature.setVerticalScrollPosition(oldScrollPosition + pixels); + return this.eBodyViewport.scrollTop - oldScrollPosition; + } + setFloatingHeights() { + const { + pinnedRowModel, + beans: { environment } + } = this; + const floatingTopHeight = pinnedRowModel?.getPinnedTopTotalHeight(); + const floatingBottomHeight = pinnedRowModel?.getPinnedBottomTotalHeight(); + const pinnedBorderWidth = environment.getPinnedRowBorderWidth(); + const rowBorderWidth = environment.getRowBorderWidth(); + const additionalHeight = pinnedBorderWidth - rowBorderWidth; + const normalisedFloatingTopHeight = !floatingTopHeight ? 0 : additionalHeight + floatingTopHeight; + const normalisedFloatingBottomHeight = !floatingBottomHeight ? 0 : additionalHeight + floatingBottomHeight; + this.comp.setTopHeight(normalisedFloatingTopHeight); + this.comp.setBottomHeight(normalisedFloatingBottomHeight); + this.comp.setTopInvisible(normalisedFloatingTopHeight <= 0); + this.comp.setBottomInvisible(normalisedFloatingBottomHeight <= 0); + this.setStickyTopOffsetTop(); + this.setStickyBottomOffsetBottom(); + } + setStickyTopHeight(height = 0) { + this.comp.setStickyTopHeight(`${height}px`); + this.stickyTopHeight = height; + } + setStickyBottomHeight(height = 0) { + this.comp.setStickyBottomHeight(`${height}px`); + this.stickyBottomHeight = height; + } + setStickyWidth(vScrollVisible) { + if (!vScrollVisible) { + this.comp.setStickyTopWidth("100%"); + this.comp.setStickyBottomWidth("100%"); + } else { + const scrollbarWidth = this.scrollVisibleSvc.getScrollbarWidth(); + this.comp.setStickyTopWidth(`calc(100% - ${scrollbarWidth}px)`); + this.comp.setStickyBottomWidth(`calc(100% - ${scrollbarWidth}px)`); + } + } + setStickyTopOffsetTop() { + const headerCtrl = this.ctrlsSvc.get("gridHeaderCtrl"); + const headerHeight = headerCtrl.headerHeight + (this.filterManager?.getHeaderHeight() ?? 0); + const pinnedTopHeight = this.pinnedRowModel?.getPinnedTopTotalHeight() ?? 0; + let height = 0; + if (headerHeight > 0) { + height += headerHeight; + } + if (pinnedTopHeight > 0) { + height += pinnedTopHeight; + } + if (height > 0) { + height += 1; + } + this.comp.setStickyTopTop(`${height}px`); + } + setStickyBottomOffsetBottom() { + const { pinnedRowModel, scrollVisibleSvc, comp } = this; + const pinnedBottomHeight = pinnedRowModel?.getPinnedBottomTotalHeight() ?? 0; + const hScrollShowing = scrollVisibleSvc.horizontalScrollShowing; + const scrollbarWidth = hScrollShowing ? scrollVisibleSvc.getScrollbarWidth() || 0 : 0; + const height = pinnedBottomHeight + scrollbarWidth; + comp.setStickyBottomBottom(`${height}px`); + } +}; +function _createElement(params) { + return _createAgElement(params); +} +var CellComp = class extends Component { + constructor(beans, cellCtrl, printLayout, eRow, editingCell) { + super(); + this.cellCtrl = cellCtrl; + this.rowResizerElement = null; + this.rendererVersion = 0; + this.editorVersion = 0; + this.beans = beans; + this.gos = beans.gos; + this.column = cellCtrl.column; + this.rowNode = cellCtrl.rowNode; + this.eRow = eRow; + const cellDiv = _createElement({ + tag: "div", + role: cellCtrl.getCellAriaRole(), + attrs: { + "comp-id": `${this.getCompId()}`, + "col-id": cellCtrl.column.colIdSanitised + } + }); + this.eCell = cellDiv; + let wrapperDiv; + if (cellCtrl.isCellSpanning()) { + wrapperDiv = _createElement({ + tag: "div", + cls: "ag-spanned-cell-wrapper", + role: "presentation" + }); + wrapperDiv.appendChild(cellDiv); + this.setTemplateFromElement(wrapperDiv); + } else { + this.setTemplateFromElement(cellDiv); + } + this.cellCssManager = new CssClassManager(() => cellDiv); + this.forceWrapper = cellCtrl.isForceWrapper(); + this.refreshWrapper(false); + const compProxy = { + toggleCss: (cssClassName, on) => this.cellCssManager.toggleCss(cssClassName, on), + setUserStyles: (styles) => _addStylesToElement(cellDiv, styles), + getFocusableElement: () => cellDiv, + setIncludeSelection: (include) => this.includeSelection = include, + setIncludeRowDrag: (include) => this.includeRowDrag = include, + setIncludeDndSource: (include) => this.includeDndSource = include, + setRowResizerElement: (element) => this.setRowResizerElement(element), + setRenderDetails: (compDetails, valueToDisplay, force) => this.setRenderDetails(compDetails, valueToDisplay, force), + setEditDetails: (compDetails, popup, position) => this.setEditDetails(compDetails, popup, position), + getCellEditor: () => this.cellEditor || null, + getCellRenderer: () => this.cellRenderer || null, + getParentOfValue: () => this.getParentOfValue(), + refreshEditStyles: (editing, isPopup) => this.refreshEditStyles(editing, isPopup) + }; + cellCtrl.setComp(compProxy, cellDiv, wrapperDiv, this.eCellWrapper, printLayout, editingCell, undefined); + } + getParentOfValue() { + return this.eCellValue ?? this.eCellWrapper ?? this.eCell; + } + setRowResizerElement(element) { + if (this.rowResizerElement) { + _removeFromParent(this.rowResizerElement); + } + this.rowResizerElement = element; + if (element) { + this.eCell.appendChild(element); + } + } + setRenderDetails(compDetails, valueToDisplay, forceNewCellRendererInstance) { + const isInlineEditing = this.cellEditor && !this.cellEditorPopupWrapper; + if (isInlineEditing) { + return; + } + this.firstRender = this.firstRender == null; + const controlWrapperChanged = this.refreshWrapper(false); + this.refreshEditStyles(false); + if (compDetails) { + const neverRefresh = forceNewCellRendererInstance || controlWrapperChanged; + const cellRendererRefreshSuccessful = neverRefresh ? false : this.refreshCellRenderer(compDetails); + if (!cellRendererRefreshSuccessful) { + this.destroyRenderer(); + this.createCellRendererInstance(compDetails); + } + } else { + this.destroyRenderer(); + this.insertValueWithoutCellRenderer(valueToDisplay); + } + this.rowDraggingComp?.refreshVisibility(); + if (this.rowResizerElement && !this.rowResizerElement.parentElement) { + this.eCell.appendChild(this.rowResizerElement); + } + } + setEditDetails(compDetails, popup, position) { + if (compDetails) { + this.createCellEditorInstance(compDetails, popup, position); + } else { + this.destroyEditor(); + } + } + removeControls() { + const context = this.beans.context; + this.checkboxSelectionComp = context.destroyBean(this.checkboxSelectionComp); + this.dndSourceComp = context.destroyBean(this.dndSourceComp); + this.rowDraggingComp = context.destroyBean(this.rowDraggingComp); + } + refreshWrapper(editing) { + const providingControls = this.includeRowDrag || this.includeDndSource || this.includeSelection; + const usingWrapper = providingControls || this.forceWrapper; + const putWrapperIn = usingWrapper && this.eCellWrapper == null; + if (putWrapperIn) { + this.eCellWrapper = _createElement({ tag: "div", cls: "ag-cell-wrapper", role: "presentation" }); + this.eCell.appendChild(this.eCellWrapper); + } + const takeWrapperOut = !usingWrapper && this.eCellWrapper != null; + if (takeWrapperOut) { + _removeFromParent(this.eCellWrapper); + this.eCellWrapper = undefined; + } + this.cellCssManager.toggleCss("ag-cell-value", !usingWrapper); + const usingCellValue = !editing && usingWrapper; + const putCellValueIn = usingCellValue && this.eCellValue == null; + if (putCellValueIn) { + const cls = this.cellCtrl.getCellValueClass(); + this.eCellValue = _createElement({ tag: "span", cls, role: "presentation" }); + this.eCellWrapper.appendChild(this.eCellValue); + } + const takeCellValueOut = !usingCellValue && this.eCellValue != null; + if (takeCellValueOut) { + _removeFromParent(this.eCellValue); + this.eCellValue = undefined; + } + const templateChanged = putWrapperIn || takeWrapperOut || putCellValueIn || takeCellValueOut; + if (templateChanged) { + this.removeControls(); + } + if (!editing && providingControls) { + this.addControls(); + } + return templateChanged; + } + addControls() { + const { cellCtrl, eCellWrapper, eCellValue, includeRowDrag, includeDndSource, includeSelection } = this; + const insertBefore = (comp) => { + if (comp) { + eCellWrapper.insertBefore(comp.getGui(), eCellValue); + } + }; + if (includeRowDrag && this.rowDraggingComp == null) { + this.rowDraggingComp = cellCtrl.createRowDragComp(); + insertBefore(this.rowDraggingComp); + } + if (includeDndSource && this.dndSourceComp == null) { + this.dndSourceComp = cellCtrl.createDndSource(); + insertBefore(this.dndSourceComp); + } + if (includeSelection && this.checkboxSelectionComp == null) { + this.checkboxSelectionComp = cellCtrl.createSelectionCheckbox(); + insertBefore(this.checkboxSelectionComp); + } + } + createCellEditorInstance(compDetails, popup, position) { + const versionCopy = this.editorVersion; + const cellEditorPromise = compDetails.newAgStackInstance(); + const { params } = compDetails; + cellEditorPromise.then((c) => this.afterCellEditorCreated(versionCopy, c, params, popup, position)); + const cellEditorAsync = _missing(this.cellEditor); + if (cellEditorAsync && params.cellStartedEdit) { + this.cellCtrl.focusCell(true); + } + } + insertValueWithoutCellRenderer(valueToDisplay) { + const eParent = this.getParentOfValue(); + _clearElement(eParent); + const escapedValue = _toString(valueToDisplay); + if (escapedValue != null) { + eParent.textContent = escapedValue; + } + } + destroyRenderer() { + const { context } = this.beans; + this.cellRenderer = context.destroyBean(this.cellRenderer); + _removeFromParent(this.cellRendererGui); + this.cellRendererGui = null; + this.rendererVersion++; + } + destroyEditor() { + const { context } = this.beans; + const recoverFocus = this.cellEditorPopupWrapper?.getGui().contains(_getActiveDomElement(this.beans)) || this.cellCtrl.hasBrowserFocus(); + if (recoverFocus) { + this.eCell.focus({ preventScroll: true }); + } + this.hideEditorPopup?.(); + this.hideEditorPopup = undefined; + this.cellEditor = context.destroyBean(this.cellEditor); + this.cellEditorPopupWrapper = context.destroyBean(this.cellEditorPopupWrapper); + _removeFromParent(this.cellEditorGui); + this.cellCtrl.disableEditorTooltipFeature(); + this.cellEditorGui = null; + this.editorVersion++; + } + refreshCellRenderer(compClassAndParams) { + if (this.cellRenderer?.refresh == null) { + return false; + } + if (this.cellRendererClass !== compClassAndParams.componentClass) { + return false; + } + const result = this.cellRenderer.refresh(compClassAndParams.params); + return result === true || result === undefined; + } + createCellRendererInstance(compDetails) { + const displayComponentVersionCopy = this.rendererVersion; + const createCellRendererFunc = (details) => (_) => { + const staleTask = this.rendererVersion !== displayComponentVersionCopy || !this.isAlive(); + if (staleTask) { + return; + } + const componentPromise = details.newAgStackInstance(); + const callback = this.afterCellRendererCreated.bind(this, displayComponentVersionCopy, details.componentClass); + componentPromise?.then(callback); + }; + const { animationFrameSvc } = this.beans; + let createTask; + if (animationFrameSvc?.active && this.firstRender) { + createTask = (details, isDeferred = false) => { + animationFrameSvc.createTask(createCellRendererFunc(details), this.rowNode.rowIndex, "p2", details.componentFromFramework, isDeferred); + }; + } else { + createTask = (details) => createCellRendererFunc(details)(); + } + if (compDetails.params?.deferRender && !this.cellCtrl.rowNode.group) { + const { loadingComp, onReady } = this.cellCtrl.getDeferLoadingCellRenderer(); + if (loadingComp) { + createTask(loadingComp); + onReady.then(() => createTask(compDetails, true)); + } + } else { + createTask(compDetails); + } + } + afterCellRendererCreated(cellRendererVersion, cellRendererClass, cellRenderer) { + const staleTask = !this.isAlive() || cellRendererVersion !== this.rendererVersion; + if (staleTask) { + this.beans.context.destroyBean(cellRenderer); + return; + } + this.cellRenderer = cellRenderer; + this.cellRendererClass = cellRendererClass; + const cellGui = cellRenderer.getGui(); + this.cellRendererGui = cellGui; + if (cellGui != null) { + const eParent = this.getParentOfValue(); + _clearElement(eParent); + eParent.appendChild(cellGui); + } + } + afterCellEditorCreated(requestVersion, cellEditor, params, popup, position) { + const staleComp = requestVersion !== this.editorVersion; + const { context } = this.beans; + if (staleComp) { + context.destroyBean(cellEditor); + return; + } + const editingCancelledByUserComp = cellEditor.isCancelBeforeStart?.(); + if (editingCancelledByUserComp) { + context.destroyBean(cellEditor); + this.cellCtrl.stopEditing(true); + return; + } + if (!cellEditor.getGui) { + _warn(97, { colId: this.column.getId() }); + context.destroyBean(cellEditor); + return; + } + this.cellEditor = cellEditor; + this.cellEditorGui = cellEditor.getGui(); + const cellEditorInPopup = popup || cellEditor.isPopup?.(); + if (cellEditorInPopup) { + this.addPopupCellEditor(params, position); + } else { + this.addInCellEditor(); + } + this.refreshEditStyles(true, cellEditorInPopup); + cellEditor.afterGuiAttached?.(); + this.cellCtrl.enableEditorTooltipFeature(cellEditor); + this.cellCtrl.cellEditorAttached(); + } + refreshEditStyles(editing, isPopup) { + const { cellCssManager } = this; + cellCssManager.toggleCss("ag-cell-inline-editing", editing && !isPopup); + cellCssManager.toggleCss("ag-cell-popup-editing", editing && !!isPopup); + cellCssManager.toggleCss("ag-cell-not-inline-editing", !editing || !!isPopup); + } + addInCellEditor() { + const { eCell } = this; + if (eCell.contains(_getActiveDomElement(this.beans))) { + eCell.focus(); + } + this.destroyRenderer(); + this.refreshWrapper(true); + _clearElement(this.getParentOfValue()); + if (this.cellEditorGui) { + const eParent = this.getParentOfValue(); + eParent.appendChild(this.cellEditorGui); + } + } + addPopupCellEditor(params, position) { + const { gos, context, popupSvc, editSvc } = this.beans; + if (gos.get("editType") === "fullRow") { + _warn(98); + } + const cellEditorPopupWrapper = this.cellEditorPopupWrapper = context.createBean(editSvc.createPopupEditorWrapper(params)); + const { cellEditor, cellEditorGui, eCell, rowNode, column, cellCtrl } = this; + const ePopupGui = cellEditorPopupWrapper.getGui(); + if (cellEditorGui) { + ePopupGui.appendChild(cellEditorGui); + } + const useModelPopup = gos.get("stopEditingWhenCellsLoseFocus"); + const positionToUse = position != null ? position : cellEditor.getPopupPosition?.() ?? "over"; + const isRtl = gos.get("enableRtl"); + const positionParams = { + ePopup: ePopupGui, + additionalParams: { + column, + rowNode + }, + type: "popupCellEditor", + eventSource: eCell, + position: positionToUse, + alignSide: isRtl ? "right" : "left", + keepWithinBounds: true + }; + const positionCallback = popupSvc.positionPopupByComponent.bind(popupSvc, positionParams); + const addPopupRes = popupSvc.addPopup({ + modal: useModelPopup, + eChild: ePopupGui, + closeOnEsc: true, + closedCallback: (e) => { + cellCtrl.onPopupEditorClosed(e); + }, + anchorToElement: eCell, + positionCallback, + ariaOwns: eCell + }); + if (addPopupRes) { + this.hideEditorPopup = addPopupRes.hideFunc; + } + } + detach() { + this.getGui().remove(); + } + destroy() { + this.destroyRenderer(); + this.destroyEditor(); + this.removeControls(); + super.destroy(); + } +}; +var RowComp = class extends Component { + constructor(ctrl, beans, containerType) { + super(); + this.cellComps = /* @__PURE__ */ new Map; + this.beans = beans; + this.rowCtrl = ctrl; + const rowDiv = _createElement({ tag: "div", role: "row", attrs: { "comp-id": `${this.getCompId()}` } }); + this.setInitialStyle(rowDiv, containerType); + this.setTemplateFromElement(rowDiv); + const style = rowDiv.style; + this.domOrder = this.rowCtrl.getDomOrder(); + const compProxy = { + setDomOrder: (domOrder) => this.domOrder = domOrder, + setCellCtrls: (cellCtrls) => this.setCellCtrls(cellCtrls), + showFullWidth: (compDetails) => this.showFullWidth(compDetails), + getFullWidthCellRenderer: () => this.fullWidthCellRenderer, + getFullWidthCellRendererParams: () => this.fullWidthCellRendererParams, + toggleCss: (name, on) => this.toggleCss(name, on), + setUserStyles: (styles) => _addStylesToElement(rowDiv, styles), + setTop: (top) => style.top = top, + setTransform: (transform) => style.transform = transform, + setRowIndex: (rowIndex) => rowDiv.setAttribute("row-index", rowIndex), + setRowId: (rowId) => rowDiv.setAttribute("row-id", rowId), + setRowBusinessKey: (businessKey) => rowDiv.setAttribute("row-business-key", businessKey), + refreshFullWidth: (getUpdatedParams) => { + const params = getUpdatedParams(); + this.fullWidthCellRendererParams = params; + return this.fullWidthCellRenderer?.refresh?.(params) ?? false; + } + }; + ctrl.setComp(compProxy, this.getGui(), containerType, undefined); + this.addDestroyFunc(() => { + ctrl.unsetComp(containerType); + }); + } + setInitialStyle(container, containerType) { + const transform = this.rowCtrl.getInitialTransform(containerType); + if (transform) { + container.style.setProperty("transform", transform); + } else { + const top = this.rowCtrl.getInitialRowTop(containerType); + if (top) { + container.style.setProperty("top", top); + } + } + } + showFullWidth(compDetails) { + const callback = (cellRenderer) => { + if (this.isAlive()) { + const eGui = cellRenderer.getGui(); + this.getGui().appendChild(eGui); + this.rowCtrl.setupDetailRowAutoHeight(eGui); + this.setFullWidthRowComp(cellRenderer, compDetails.params); + } else { + this.beans.context.destroyBean(cellRenderer); + } + }; + const res = compDetails.newAgStackInstance(); + res.then(callback); + } + setCellCtrls(cellCtrls) { + const cellsToRemove = new Map(this.cellComps); + for (const cellCtrl of cellCtrls) { + const key = cellCtrl.instanceId; + if (!this.cellComps.has(key)) { + this.newCellComp(cellCtrl); + } else { + cellsToRemove.delete(key); + } + } + this.destroyCells(cellsToRemove); + this.ensureDomOrder(cellCtrls); + } + ensureDomOrder(cellCtrls) { + if (!this.domOrder) { + return; + } + const elementsInOrder = []; + for (const cellCtrl of cellCtrls) { + const cellComp = this.cellComps.get(cellCtrl.instanceId); + if (cellComp) { + elementsInOrder.push(cellComp.getGui()); + } + } + _setDomChildOrder(this.getGui(), elementsInOrder); + } + newCellComp(cellCtrl) { + const editing = this.beans.editSvc?.isEditing(cellCtrl, { withOpenEditor: true }) ?? false; + const cellComp = new CellComp(this.beans, cellCtrl, this.rowCtrl.printLayout, this.getGui(), editing); + this.cellComps.set(cellCtrl.instanceId, cellComp); + this.getGui().appendChild(cellComp.getGui()); + } + destroy() { + super.destroy(); + this.destroyCells(this.cellComps); + } + setFullWidthRowComp(fullWidthRowComponent, params) { + this.fullWidthCellRenderer = fullWidthRowComponent; + this.fullWidthCellRendererParams = params; + this.addDestroyFunc(() => { + this.fullWidthCellRenderer = this.beans.context.destroyBean(this.fullWidthCellRenderer); + this.fullWidthCellRendererParams = undefined; + }); + } + destroyCells(cellComps) { + for (const cellComp of cellComps.values()) { + if (!cellComp) { + continue; + } + const instanceId = cellComp.cellCtrl.instanceId; + if (this.cellComps.get(instanceId) !== cellComp) { + continue; + } + cellComp.detach(); + cellComp.destroy(); + this.cellComps.delete(instanceId); + } + } +}; +function getElementParams(name, options, beans) { + const isCellSpanning = !!beans.gos.get("enableCellSpan") && !!options.getSpannedRowCtrls; + const eContainerElement = { + tag: "div", + ref: "eContainer", + cls: _getRowContainerClass(name), + role: "rowgroup" + }; + if (options.type === "center" || isCellSpanning) { + const eSpannedContainerElement = { + tag: "div", + ref: "eSpannedContainer", + cls: `ag-spanning-container ${_getRowSpanContainerClass(name)}`, + role: "presentation" + }; + eContainerElement.role = "presentation"; + return { + tag: "div", + ref: "eViewport", + cls: `ag-viewport ${_getRowViewportClass(name)}`, + role: "rowgroup", + children: [eContainerElement, isCellSpanning ? eSpannedContainerElement : null] + }; + } + return eContainerElement; +} +var RowContainerComp = class extends Component { + constructor(params) { + super(); + this.eViewport = RefPlaceholder; + this.eContainer = RefPlaceholder; + this.eSpannedContainer = RefPlaceholder; + this.rowCompsNoSpan = {}; + this.rowCompsWithSpan = {}; + this.name = params?.name; + this.options = _getRowContainerOptions(this.name); + } + postConstruct() { + this.setTemplate(getElementParams(this.name, this.options, this.beans)); + const compProxy = { + setHorizontalScroll: (offset) => this.eViewport.scrollLeft = offset, + setViewportHeight: (height) => this.eViewport.style.height = height, + setRowCtrls: ({ rowCtrls }) => this.setRowCtrls(rowCtrls), + setSpannedRowCtrls: (rowCtrls) => this.setRowCtrls(rowCtrls, true), + setDomOrder: (domOrder) => { + this.domOrder = domOrder; + }, + setContainerWidth: (width) => { + this.eContainer.style.width = width; + if (this.eSpannedContainer) { + this.eSpannedContainer.style.width = width; + } + }, + setOffsetTop: (offset) => { + const top = `translateY(${offset})`; + this.eContainer.style.transform = top; + if (this.eSpannedContainer) { + this.eSpannedContainer.style.transform = top; + } + } + }; + const ctrl = this.createManagedBean(new RowContainerCtrl(this.name)); + ctrl.setComp(compProxy, this.eContainer, this.eSpannedContainer, this.eViewport); + } + destroy() { + this.setRowCtrls([]); + this.setRowCtrls([], true); + super.destroy(); + this.lastPlacedElement = null; + } + setRowCtrls(rowCtrls, spanContainer) { + const { beans, options } = this; + const container = spanContainer ? this.eSpannedContainer : this.eContainer; + const oldRows = spanContainer ? { ...this.rowCompsWithSpan } : { ...this.rowCompsNoSpan }; + const newComps = {}; + if (spanContainer) { + this.rowCompsWithSpan = newComps; + } else { + this.rowCompsNoSpan = newComps; + } + this.lastPlacedElement = null; + const orderedRows = []; + for (const rowCtrl of rowCtrls) { + const instanceId = rowCtrl.instanceId; + const existingRowComp = oldRows[instanceId]; + let rowComp; + if (existingRowComp) { + rowComp = existingRowComp; + delete oldRows[instanceId]; + } else { + if (!rowCtrl.rowNode.displayed) { + continue; + } + rowComp = new RowComp(rowCtrl, beans, options.type); + } + newComps[instanceId] = rowComp; + orderedRows.push([rowComp, !existingRowComp]); + } + this.removeOldRows(Object.values(oldRows)); + this.addRowNodes(orderedRows, container); + } + addRowNodes(rows, container) { + const { domOrder } = this; + for (const [rowComp, isNew] of rows) { + const eGui = rowComp.getGui(); + if (!domOrder) { + if (isNew) { + container.appendChild(eGui); + } + } else { + this.ensureDomOrder(eGui, container); + } + } + } + removeOldRows(rowComps) { + for (const oldRowComp of rowComps) { + oldRowComp.getGui().remove(); + oldRowComp.destroy(); + } + } + ensureDomOrder(eRow, container) { + _ensureDomOrder(container, eRow, this.lastPlacedElement); + this.lastPlacedElement = eRow; + } +}; +var RowContainerSelector = { + selector: "AG-ROW-CONTAINER", + component: RowContainerComp +}; +function makeRowContainers(paramsMap, names) { + return names.map((name) => { + const refName = `e${name[0].toUpperCase() + name.substring(1)}RowContainer`; + paramsMap[refName] = { name }; + return { + tag: "ag-row-container", + ref: refName, + attrs: { name } + }; + }); +} +function getGridBodyTemplate(includeOverlay) { + const paramsMap = {}; + const elementParams = { + 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: makeRowContainers(paramsMap, ["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: makeRowContainers(paramsMap, ["left", "center", "right", "fullWidth"]) + }, + { tag: "ag-fake-vertical-scroll" } + ] + }, + { + tag: "div", + ref: "eStickyTop", + cls: "ag-sticky-top", + role: "presentation", + children: makeRowContainers(paramsMap, [ + "stickyTopLeft", + "stickyTopCenter", + "stickyTopRight", + "stickyTopFullWidth" + ]) + }, + { + tag: "div", + ref: "eStickyBottom", + cls: "ag-sticky-bottom", + role: "presentation", + children: makeRowContainers(paramsMap, [ + "stickyBottomLeft", + "stickyBottomCenter", + "stickyBottomRight", + "stickyBottomFullWidth" + ]) + }, + { + tag: "div", + ref: "eBottom", + cls: "ag-floating-bottom", + role: "presentation", + children: makeRowContainers(paramsMap, [ + "bottomLeft", + "bottomCenter", + "bottomRight", + "bottomFullWidth" + ]) + }, + { tag: "ag-fake-horizontal-scroll" }, + includeOverlay ? { tag: "ag-overlay-wrapper" } : null + ] + }; + return { paramsMap, elementParams }; +} +var GridBodyComp = class extends Component { + constructor() { + super(...arguments); + this.eGridRoot = RefPlaceholder; + this.eBodyViewport = RefPlaceholder; + this.eStickyTop = RefPlaceholder; + this.eStickyBottom = RefPlaceholder; + this.eTop = RefPlaceholder; + this.eBottom = RefPlaceholder; + this.eBody = RefPlaceholder; + } + postConstruct() { + const { overlays, rangeSvc } = this.beans; + const overlaySelector = overlays?.getOverlayWrapperSelector(); + const { paramsMap, elementParams } = getGridBodyTemplate(!!overlaySelector); + this.setTemplate(elementParams, [ + ...overlaySelector ? [overlaySelector] : [], + FakeHScrollSelector, + FakeVScrollSelector, + GridHeaderSelector, + RowContainerSelector + ], paramsMap); + const setHeight = (height, element) => { + const heightString = `${height}px`; + element.style.minHeight = heightString; + element.style.height = heightString; + }; + const compProxy = { + setRowAnimationCssOnBodyViewport: (cssClass, animate) => this.setRowAnimationCssOnBodyViewport(cssClass, animate), + setColumnCount: (count) => _setAriaColCount(this.getGui(), count), + setRowCount: (count) => _setAriaRowCount(this.getGui(), count), + setTopHeight: (height) => setHeight(height, this.eTop), + setBottomHeight: (height) => setHeight(height, this.eBottom), + setTopInvisible: (invisible) => this.eTop.classList.toggle("ag-invisible", invisible), + setBottomInvisible: (invisible) => this.eBottom.classList.toggle("ag-invisible", invisible), + setStickyTopHeight: (height) => this.eStickyTop.style.height = height, + setStickyTopTop: (top) => this.eStickyTop.style.top = top, + setStickyTopWidth: (width) => this.eStickyTop.style.width = width, + setStickyBottomHeight: (height) => { + this.eStickyBottom.style.height = height; + this.eStickyBottom.classList.toggle("ag-invisible", height === "0px"); + }, + setStickyBottomBottom: (bottom) => this.eStickyBottom.style.bottom = bottom, + setStickyBottomWidth: (width) => this.eStickyBottom.style.width = width, + setColumnMovingCss: (cssClass, flag) => this.toggleCss(cssClass, flag), + updateLayoutClasses: (cssClass, params) => { + const classLists = [this.eBodyViewport.classList, this.eBody.classList]; + for (const classList of classLists) { + classList.toggle(LayoutCssClasses.AUTO_HEIGHT, params.autoHeight); + classList.toggle(LayoutCssClasses.NORMAL, params.normal); + classList.toggle(LayoutCssClasses.PRINT, params.print); + } + this.toggleCss(LayoutCssClasses.AUTO_HEIGHT, params.autoHeight); + this.toggleCss(LayoutCssClasses.NORMAL, params.normal); + this.toggleCss(LayoutCssClasses.PRINT, params.print); + }, + setAlwaysVerticalScrollClass: (cssClass, on) => this.eBodyViewport.classList.toggle(CSS_CLASS_FORCE_VERTICAL_SCROLL, on), + registerBodyViewportResizeListener: (listener) => { + const unsubscribeFromResize = _observeResize(this.beans, this.eBodyViewport, listener); + this.addDestroyFunc(() => unsubscribeFromResize()); + }, + setPinnedTopBottomOverflowY: (overflow) => this.eTop.style.overflowY = this.eBottom.style.overflowY = overflow, + setCellSelectableCss: (cssClass, selectable) => { + for (const ct of [this.eTop, this.eBodyViewport, this.eBottom]) { + ct.classList.toggle(cssClass, selectable); + } + }, + setBodyViewportWidth: (width) => this.eBodyViewport.style.width = width, + setGridRootRole: (role) => _setAriaRole(this.eGridRoot, role) + }; + this.ctrl = this.createManagedBean(new GridBodyCtrl); + this.ctrl.setComp(compProxy, this.getGui(), this.eBodyViewport, this.eTop, this.eBottom, this.eStickyTop, this.eStickyBottom); + if (rangeSvc && _isCellSelectionEnabled(this.gos) || _isMultiRowSelection(this.gos)) { + _setAriaMultiSelectable(this.getGui(), true); + } + } + setRowAnimationCssOnBodyViewport(cssClass, animateRows) { + const bodyViewportClassList = this.eBodyViewport.classList; + bodyViewportClassList.toggle("ag-row-animation", animateRows); + bodyViewportClassList.toggle("ag-row-no-animation", !animateRows); + } + getFocusableContainerName() { + return "gridBody"; + } +}; +var GridBodySelector = { + selector: "AG-GRID-BODY", + component: GridBodyComp +}; +var TabGuardClassNames = { + TAB_GUARD: "ag-tab-guard", + TAB_GUARD_TOP: "ag-tab-guard-top", + TAB_GUARD_BOTTOM: "ag-tab-guard-bottom" +}; +var AgTabGuardCtrl = class extends AgBeanStub { + constructor(params, stopPropagationCallbacks) { + super(); + this.stopPropagationCallbacks = stopPropagationCallbacks; + this.skipTabGuardFocus = false; + this.forcingFocusOut = false; + this.allowFocus = false; + const { + comp, + eTopGuard, + eBottomGuard, + focusTrapActive, + forceFocusOutWhenTabGuardsAreEmpty, + isFocusableContainer, + focusInnerElement, + onFocusIn, + onFocusOut, + shouldStopEventPropagation, + onTabKeyDown, + handleKeyDown, + isEmpty, + eFocusableElement + } = params; + this.comp = comp; + this.eTopGuard = eTopGuard; + this.eBottomGuard = eBottomGuard; + this.providedFocusInnerElement = focusInnerElement; + this.eFocusableElement = eFocusableElement; + this.focusTrapActive = !!focusTrapActive; + this.forceFocusOutWhenTabGuardsAreEmpty = !!forceFocusOutWhenTabGuardsAreEmpty; + this.isFocusableContainer = !!isFocusableContainer; + this.providedFocusIn = onFocusIn; + this.providedFocusOut = onFocusOut; + this.providedShouldStopEventPropagation = shouldStopEventPropagation; + this.providedOnTabKeyDown = onTabKeyDown; + this.providedHandleKeyDown = handleKeyDown; + this.providedIsEmpty = isEmpty; + } + postConstruct() { + this.createManagedBean(new AgManagedFocusFeature(this.eFocusableElement, this.stopPropagationCallbacks, { + shouldStopEventPropagation: () => this.shouldStopEventPropagation(), + onTabKeyDown: (e) => this.onTabKeyDown(e), + handleKeyDown: (e) => this.handleKeyDown(e), + onFocusIn: (e) => this.onFocusIn(e), + onFocusOut: (e) => this.onFocusOut(e) + })); + this.activateTabGuards(); + for (const guard of [this.eTopGuard, this.eBottomGuard]) { + this.addManagedElementListeners(guard, { focus: this.onFocus.bind(this) }); + } + } + handleKeyDown(e) { + if (this.providedHandleKeyDown) { + this.providedHandleKeyDown(e); + } + } + tabGuardsAreActive() { + return !!this.eTopGuard && this.eTopGuard.hasAttribute("tabIndex"); + } + shouldStopEventPropagation() { + if (this.providedShouldStopEventPropagation) { + return this.providedShouldStopEventPropagation(); + } + return false; + } + activateTabGuards() { + if (this.forcingFocusOut) { + return; + } + const tabIndex = this.gos.get("tabIndex"); + this.comp.setTabIndex(tabIndex.toString()); + } + deactivateTabGuards() { + this.comp.setTabIndex(); + } + onFocus(e) { + if (this.isFocusableContainer && !this.eFocusableElement.contains(e.relatedTarget)) { + if (!this.allowFocus) { + this.findNextElementOutsideAndFocus(e.target === this.eBottomGuard); + return; + } + } + if (this.skipTabGuardFocus) { + this.skipTabGuardFocus = false; + return; + } + if (this.forceFocusOutWhenTabGuardsAreEmpty) { + const isEmpty = this.providedIsEmpty ? this.providedIsEmpty() : _findFocusableElements(this.eFocusableElement, ".ag-tab-guard").length === 0; + if (isEmpty) { + this.findNextElementOutsideAndFocus(e.target === this.eBottomGuard); + return; + } + } + if (this.isFocusableContainer && this.eFocusableElement.contains(e.relatedTarget)) { + return; + } + const fromBottom = e.target === this.eBottomGuard; + const hasFocusedInnerElement = this.providedFocusInnerElement ? this.providedFocusInnerElement(fromBottom) : this.focusInnerElement(fromBottom); + if (!hasFocusedInnerElement && this.forceFocusOutWhenTabGuardsAreEmpty) { + this.findNextElementOutsideAndFocus(e.target === this.eBottomGuard); + } + } + findNextElementOutsideAndFocus(up) { + const eDocument = _getDocument(this.beans); + const focusableEls = _findFocusableElements(eDocument.body, null, true); + const index = focusableEls.indexOf(up ? this.eTopGuard : this.eBottomGuard); + if (index === -1) { + return; + } + let start; + let end; + if (up) { + start = 0; + end = index; + } else { + start = index + 1; + end = focusableEls.length; + } + const focusableRange = focusableEls.slice(start, end); + const targetTabIndex = this.gos.get("tabIndex"); + focusableRange.sort((a, b) => { + const indexA = Number.parseInt(a.getAttribute("tabindex") || "0"); + const indexB = Number.parseInt(b.getAttribute("tabindex") || "0"); + if (indexB === targetTabIndex) { + return 1; + } + if (indexA === targetTabIndex) { + return -1; + } + if (indexA === 0) { + return 1; + } + if (indexB === 0) { + return -1; + } + return indexA - indexB; + }); + focusableRange[up ? focusableRange.length - 1 : 0]?.focus(); + } + onFocusIn(e) { + if (this.focusTrapActive || this.forcingFocusOut) { + return; + } + if (this.providedFocusIn) { + this.providedFocusIn(e); + } + if (!this.isFocusableContainer) { + this.deactivateTabGuards(); + } + } + onFocusOut(e) { + if (this.focusTrapActive) { + return; + } + if (this.providedFocusOut) { + this.providedFocusOut(e); + } + if (!this.eFocusableElement.contains(e.relatedTarget)) { + this.activateTabGuards(); + } + } + onTabKeyDown(e) { + if (this.providedOnTabKeyDown) { + this.providedOnTabKeyDown(e); + return; + } + if (this.focusTrapActive) { + return; + } + if (e.defaultPrevented) { + return; + } + const tabGuardsAreActive = this.tabGuardsAreActive(); + if (tabGuardsAreActive) { + this.deactivateTabGuards(); + } + const nextRoot = this.getNextFocusableElement(e.shiftKey); + if (tabGuardsAreActive) { + setTimeout(() => this.activateTabGuards(), 0); + } + if (!nextRoot) { + return; + } + nextRoot.focus(); + e.preventDefault(); + } + focusInnerElement(fromBottom = false) { + const focusable = _findFocusableElements(this.eFocusableElement); + if (this.tabGuardsAreActive()) { + focusable.splice(0, 1); + focusable.splice(-1, 1); + } + if (!focusable.length) { + return false; + } + focusable[fromBottom ? focusable.length - 1 : 0].focus({ preventScroll: true }); + return true; + } + getNextFocusableElement(backwards) { + return _findNextFocusableElement(this.beans, this.eFocusableElement, false, backwards); + } + forceFocusOutOfContainer(up = false) { + if (this.forcingFocusOut) { + return; + } + const tabGuardToFocus = up ? this.eTopGuard : this.eBottomGuard; + this.activateTabGuards(); + this.skipTabGuardFocus = true; + this.forcingFocusOut = true; + tabGuardToFocus.focus(); + window.setTimeout(() => { + this.forcingFocusOut = false; + this.activateTabGuards(); + }); + } + isTabGuard(element, bottom) { + return element === this.eTopGuard && !bottom || element === this.eBottomGuard && (bottom ?? true); + } + setAllowFocus(allowFocus) { + this.allowFocus = allowFocus; + } +}; +var AgTabGuardFeature = class extends AgBeanStub { + constructor(comp, stopPropagationCallbacks) { + super(); + this.comp = comp; + this.stopPropagationCallbacks = stopPropagationCallbacks; + } + initialiseTabGuard(params) { + this.eTopGuard = this.createTabGuard("top"); + this.eBottomGuard = this.createTabGuard("bottom"); + this.eFocusableElement = this.comp.getFocusableElement(); + const { eTopGuard, eBottomGuard, eFocusableElement, stopPropagationCallbacks } = this; + const tabGuards = [eTopGuard, eBottomGuard]; + const compProxy = { + setTabIndex: (tabIndex) => { + for (const tabGuard of tabGuards) { + if (tabIndex == null) { + tabGuard.removeAttribute("tabindex"); + } else { + tabGuard.setAttribute("tabindex", tabIndex); + } + } + } + }; + this.addTabGuards(eTopGuard, eBottomGuard); + const { + focusTrapActive = false, + onFocusIn, + onFocusOut, + focusInnerElement, + handleKeyDown, + onTabKeyDown, + shouldStopEventPropagation, + isEmpty, + forceFocusOutWhenTabGuardsAreEmpty, + isFocusableContainer + } = params; + this.tabGuardCtrl = this.createManagedBean(new AgTabGuardCtrl({ + comp: compProxy, + focusTrapActive, + eTopGuard, + eBottomGuard, + eFocusableElement, + onFocusIn, + onFocusOut, + focusInnerElement, + handleKeyDown, + onTabKeyDown, + shouldStopEventPropagation, + isEmpty, + forceFocusOutWhenTabGuardsAreEmpty, + isFocusableContainer + }, stopPropagationCallbacks)); + } + getTabGuardCtrl() { + return this.tabGuardCtrl; + } + createTabGuard(side) { + const tabGuard = _getDocument(this.beans).createElement("div"); + const cls = side === "top" ? TabGuardClassNames.TAB_GUARD_TOP : TabGuardClassNames.TAB_GUARD_BOTTOM; + tabGuard.classList.add(TabGuardClassNames.TAB_GUARD, cls); + _setAriaRole(tabGuard, "presentation"); + return tabGuard; + } + addTabGuards(topTabGuard, bottomTabGuard) { + const eFocusableElement = this.eFocusableElement; + eFocusableElement.prepend(topTabGuard); + eFocusableElement.append(bottomTabGuard); + } + removeAllChildrenExceptTabGuards() { + const tabGuards = [this.eTopGuard, this.eBottomGuard]; + _clearElement(this.comp.getFocusableElement()); + this.addTabGuards(...tabGuards); + } + forceFocusOutOfContainer(up = false) { + this.tabGuardCtrl.forceFocusOutOfContainer(up); + } + appendChild(appendChild, newChild, container) { + if (!_isNodeOrElement(newChild)) { + newChild = newChild.getGui(); + } + const { eBottomGuard: bottomTabGuard } = this; + if (bottomTabGuard) { + bottomTabGuard.before(newChild); + } else { + appendChild(newChild, container); + } + } + destroy() { + const { eTopGuard, eBottomGuard } = this; + _removeFromParent(eTopGuard); + _removeFromParent(eBottomGuard); + super.destroy(); + } +}; +var AgTabGuardComp = class extends AgComponentStub { + initialiseTabGuard(params, stopPropagationCallbacks) { + this.tabGuardFeature = this.createManagedBean(new AgTabGuardFeature(this, stopPropagationCallbacks)); + this.tabGuardFeature.initialiseTabGuard(params); + } + forceFocusOutOfContainer(up = false) { + this.tabGuardFeature.forceFocusOutOfContainer(up); + } + appendChild(newChild, container) { + this.tabGuardFeature.appendChild(super.appendChild.bind(this), newChild, container); + } +}; +var TabGuardComp = class extends AgTabGuardComp { + initialiseTabGuard(params) { + super.initialiseTabGuard(params, STOP_PROPAGATION_CALLBACKS); + } +}; +var focusContainer = (comp, up) => { + return _runWithContainerFocusAllowed(comp, () => _focusInto(comp.getGui(), up, false, true)); +}; +var getGridContainerName = (container) => { + return container?.getFocusableContainerName() ?? "external"; +}; +var getDefaultTabToNextGridContainerTargetName = (target) => { + if (target == null) { + return "external"; + } + return typeof target === "string" ? target : "gridBody"; +}; +var GridCtrl = class extends BeanStub { + constructor() { + super(...arguments); + this.additionalFocusableContainers = /* @__PURE__ */ new Set; + } + setComp(view, eGridDiv, eGui) { + this.view = view; + this.eGridHostDiv = eGridDiv; + this.eGui = eGui; + this.eGui.setAttribute("grid-id", this.beans.context.getId()); + const { dragAndDrop, ctrlsSvc } = this.beans; + dragAndDrop?.registerGridDropTarget(() => this.eGui, this); + this.createManagedBean(new LayoutFeature(this.view)); + this.view.setRtlClass(this.gos.get("enableRtl") ? "ag-rtl" : "ag-ltr"); + const unsubscribeFromResize = _observeResize(this.beans, this.eGridHostDiv, this.onGridSizeChanged.bind(this)); + this.addDestroyFunc(() => unsubscribeFromResize()); + ctrlsSvc.register("gridCtrl", this); + } + isDetailGrid() { + const el = _findTabbableParent(this.getGui()); + return el?.getAttribute("row-id")?.startsWith("detail") || false; + } + getOptionalSelectors() { + const beans = this.beans; + return { + paginationSelector: beans.pagination?.getPaginationSelector(), + gridHeaderDropZonesSelector: beans.registry?.getSelector("AG-GRID-HEADER-DROP-ZONES"), + sideBarSelector: beans.sideBar?.getSelector(), + statusBarSelector: beans.registry?.getSelector("AG-STATUS-BAR"), + watermarkSelector: beans.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(direction) { + const { view } = this; + if (direction === false) { + view.setCursor(null); + } else { + view.setCursor(direction === 1 ? "ew-resize" : "ns-resize"); + } + } + disableUserSelect(on) { + this.view.setUserSelect(on ? "none" : null); + } + focusNextInnerContainer(backwards) { + const focusableContainers = this.getFocusableContainers(); + const { indexWithFocus, nextIndex } = this.getNextFocusableIndex(focusableContainers, backwards); + const resolvedNextIndex = indexWithFocus === -1 ? backwards ? focusableContainers.length - 1 : 0 : nextIndex; + const { + gos, + beans: { focusSvc, navigation } + } = this; + const userCallbackFunction = gos.getCallback("tabToNextGridContainer"); + if (userCallbackFunction) { + const defaultTarget = focusSvc.getDefaultTabToNextGridContainerTarget({ + backwards, + focusableContainers, + nextIndex: resolvedNextIndex + }); + const nextContainerName = getGridContainerName(focusableContainers[resolvedNextIndex]); + const nextContainer = defaultTarget == null && nextContainerName === "gridBody" ? "gridBody" : getDefaultTabToNextGridContainerTargetName(defaultTarget); + const userResult = userCallbackFunction({ + backwards, + previousContainer: getGridContainerName(focusableContainers[indexWithFocus]), + nextContainer, + defaultTarget + }); + if (userResult !== undefined) { + if (typeof userResult === "boolean") { + return userResult; + } + if (typeof userResult === "string") { + if (userResult === "gridBody") { + return this.focusGridBodyDefault(backwards) || undefined; + } + const targetContainer = focusableContainers.find((container) => container.getFocusableContainerName() === userResult); + if (!targetContainer) { + _consoleWarn(`tabToNextGridContainer - ${userResult} container not found`); + return; + } + return focusContainer(targetContainer, backwards) ? true : undefined; + } + if (isHeaderPosition(userResult)) { + return focusSvc.focusHeaderPosition({ headerPosition: userResult }) || undefined; + } + navigation?.ensureCellVisible(userResult); + focusSvc.setFocusedCell({ ...userResult, forceBrowserFocus: true }); + return focusSvc.isCellFocused(userResult) || undefined; + } + } + return this.focusNextInnerContainerDefault({ + backwards, + focusableContainers, + indexWithFocus, + nextIndex: resolvedNextIndex + }) || undefined; + } + focusInnerElement(fromBottom) { + const { + gos, + beans, + beans: { focusSvc, visibleCols } + } = this; + const userCallbackFunction = gos.getCallback("focusGridInnerElement"); + if (userCallbackFunction?.({ fromBottom: !!fromBottom })) { + return true; + } + const focusableContainers = this.getFocusableContainers(); + if (fromBottom) { + if (this.focusNextInnerContainerDefault({ + backwards: true, + focusableContainers, + indexWithFocus: focusableContainers.length, + nextIndex: focusableContainers.length - 1 + })) { + return true; + } + return focusSvc.focusGridView({ column: _last(visibleCols.allCols), backwards: true }); + } + const allColumns = visibleCols.allCols; + if (gos.get("headerHeight") === 0 || _isHeaderFocusSuppressed(beans)) { + if (focusSvc.focusGridView({ column: allColumns[0], backwards: fromBottom })) { + return true; + } + for (let i = 1;i < focusableContainers.length; i++) { + if (_focusInto(focusableContainers[i].getGui(), fromBottom)) { + return true; + } + } + return false; + } + return focusSvc.focusFirstHeader(); + } + forceFocusOutOfContainer(up = false) { + this.view.forceFocusOutOfContainer(up); + } + isFocusInsideGridBody() { + const focusableContainers = this.getFocusableContainers(); + const { indexWithFocus } = this.getNextFocusableIndex(focusableContainers); + return focusableContainers[indexWithFocus]?.getFocusableContainerName() === "gridBody"; + } + addFocusableContainer(container) { + this.additionalFocusableContainers.add(container); + } + removeFocusableContainer(container) { + this.additionalFocusableContainers.delete(container); + } + allowFocusForNextCoreContainer(up) { + const coreContainers = this.view.getFocusableContainers(); + const { indexWithFocus, nextIndex } = this.getNextFocusableIndex(coreContainers, up); + if (!this.focusNextInnerContainerDefault({ + backwards: !!up, + focusableContainers: coreContainers, + indexWithFocus, + nextIndex + })) { + this.forceFocusOutOfContainer(up); + } + } + isFocusable() { + const beans = this.beans; + return !_isCellFocusSuppressed(beans) || !_isHeaderFocusSuppressed(beans) || !!beans.sideBar?.comp?.isDisplayed(); + } + getNextFocusableIndex(focusableContainers, backwards) { + const activeEl = _getActiveDomElement(this.beans); + const indexWithFocus = focusableContainers.findIndex((container) => container.getGui().contains(activeEl)); + return { indexWithFocus, nextIndex: indexWithFocus + (backwards ? -1 : 1) }; + } + focusGridBodyDefault(backwards) { + const { + gos, + beans, + beans: { + focusSvc, + visibleCols: { allCols } + } + } = this; + if (backwards) { + return focusSvc.focusGridView({ column: _last(allCols), backwards: true }); + } + if (gos.get("headerHeight") === 0 || _isHeaderFocusSuppressed(beans)) { + return focusSvc.focusGridView({ column: allCols[0] }); + } + return focusSvc.focusFirstHeader(); + } + focusNextInnerContainerDefault(params) { + const { backwards, focusableContainers, indexWithFocus } = params; + const step = backwards ? -1 : 1; + for (let index = params.nextIndex;index >= 0 && index < focusableContainers.length; index += step) { + const container = focusableContainers[index]; + const containerName = container.getFocusableContainerName(); + if (containerName === "gridBody") { + const enteringGridBody = indexWithFocus === -1 || (backwards ? indexWithFocus > index : indexWithFocus < index); + if (enteringGridBody) { + if (this.focusGridBodyDefault(backwards)) { + return true; + } + continue; + } + } + if (focusContainer(container, backwards)) { + return true; + } + } + return false; + } + getFocusableContainers() { + return [...this.view.getFocusableContainers(), ...this.additionalFocusableContainers]; + } + destroy() { + this.additionalFocusableContainers.clear(); + super.destroy(); + } +}; +var GridComp = class extends TabGuardComp { + constructor(eGridDiv) { + super(); + this.gridBody = RefPlaceholder; + this.gridHeaderDropZones = RefPlaceholder; + this.sideBar = RefPlaceholder; + this.statusBar = RefPlaceholder; + this.pagination = RefPlaceholder; + this.rootWrapperBody = RefPlaceholder; + this.eGridDiv = eGridDiv; + } + postConstruct() { + const compProxy = { + destroyGridUi: () => this.destroyBean(this), + setRtlClass: (cssClass) => this.addCss(cssClass), + forceFocusOutOfContainer: this.forceFocusOutOfContainer.bind(this), + updateLayoutClasses: this.updateLayoutClasses.bind(this), + getFocusableContainers: this.getFocusableContainers.bind(this), + setUserSelect: (value) => { + this.getGui().style.userSelect = value != null ? value : ""; + this.getGui().style.webkitUserSelect = value != null ? value : ""; + }, + setCursor: (value) => { + this.getGui().style.cursor = value != null ? value : ""; + } + }; + const ctrl = this.createManagedBean(new GridCtrl); + const comps = ctrl.getOptionalSelectors(); + const template = this.createTemplate(comps); + const requiredComps = [GridBodySelector, ...Object.values(comps).filter((c) => !!c)]; + this.setTemplate(template, requiredComps); + ctrl.setComp(compProxy, this.eGridDiv, this.getGui()); + this.insertGridIntoDom(); + this.initialiseTabGuard({ + onTabKeyDown: () => { + return; + }, + focusInnerElement: (fromBottom) => ctrl.focusInnerElement(fromBottom), + forceFocusOutWhenTabGuardsAreEmpty: true, + isEmpty: () => !ctrl.isFocusable() + }); + } + insertGridIntoDom() { + const eGui = this.getGui(); + this.eGridDiv.appendChild(eGui); + this.addDestroyFunc(() => { + eGui.remove(); + _logIfDebug(this.gos, "Grid removed from DOM"); + }); + } + updateLayoutClasses(cssClass, params) { + const eRootWrapperBodyClassList = this.rootWrapperBody.classList; + const { AUTO_HEIGHT, NORMAL, PRINT } = LayoutCssClasses; + const { autoHeight, normal, print } = params; + eRootWrapperBodyClassList.toggle(AUTO_HEIGHT, autoHeight); + eRootWrapperBodyClassList.toggle(NORMAL, normal); + eRootWrapperBodyClassList.toggle(PRINT, print); + this.toggleCss(AUTO_HEIGHT, autoHeight); + this.toggleCss(NORMAL, normal); + this.toggleCss(PRINT, print); + } + createTemplate(params) { + const dropZones = params.gridHeaderDropZonesSelector ? { tag: "ag-grid-header-drop-zones", ref: "gridHeaderDropZones" } : null; + const sideBar = params.sideBarSelector ? { + tag: "ag-side-bar", + ref: "sideBar" + } : null; + const statusBar = params.statusBarSelector ? { tag: "ag-status-bar", ref: "statusBar" } : null; + const watermark = params.watermarkSelector ? { tag: "ag-watermark" } : null; + const pagination = params.paginationSelector ? { tag: "ag-pagination", ref: "pagination" } : null; + return { + tag: "div", + cls: "ag-root-wrapper", + role: "presentation", + children: [ + dropZones, + { + tag: "div", + ref: "rootWrapperBody", + cls: "ag-root-wrapper-body", + role: "presentation", + children: [{ tag: "ag-grid-body", ref: "gridBody" }, sideBar] + }, + statusBar, + pagination, + watermark + ] + }; + } + getFocusableElement() { + return this.rootWrapperBody; + } + forceFocusOutOfContainer(up = false) { + if (!up && this.pagination?.isDisplayed()) { + this.pagination.forceFocusOutOfContainer(up); + return; + } + super.forceFocusOutOfContainer(up); + } + getFocusableContainers() { + const focusableContainers = [ + ...this.gridHeaderDropZones?.getFocusableContainers?.() ?? [], + this.gridBody + ]; + for (const comp of [this.sideBar, this.statusBar, this.pagination]) { + if (comp) { + focusableContainers.push(comp); + } + } + return focusableContainers.filter((el) => _isVisible(el.getGui())); + } +}; +var mod = (moduleName, input) => { + for (const key of Object.keys(input)) { + input[key] = moduleName; + } + return input; +}; +var gridApiFunctionsMap = { + dispatchEvent: "CommunityCore", + ...mod("CommunityCore", { + destroy: 0, + getGridId: 0, + getGridOption: 0, + isDestroyed: 0, + setGridOption: 0, + updateGridOptions: 0, + isModuleRegistered: 0 + }), + ...mod("GridState", { + getState: 0, + setState: 0 + }), + ...mod("SharedRowSelection", { + setNodesSelected: 0, + selectAll: 0, + deselectAll: 0, + selectAllFiltered: 0, + deselectAllFiltered: 0, + selectAllOnCurrentPage: 0, + deselectAllOnCurrentPage: 0, + getSelectedNodes: 0, + getSelectedRows: 0 + }), + ...mod("RowApi", { + redrawRows: 0, + setRowNodeExpanded: 0, + getRowNode: 0, + addRenderedRowListener: 0, + getRenderedNodes: 0, + forEachNode: 0, + getFirstDisplayedRowIndex: 0, + getLastDisplayedRowIndex: 0, + getDisplayedRowAtIndex: 0, + getDisplayedRowCount: 0 + }), + ...mod("ScrollApi", { + getVerticalPixelRange: 0, + getHorizontalPixelRange: 0, + ensureColumnVisible: 0, + ensureIndexVisible: 0, + ensureNodeVisible: 0 + }), + ...mod("KeyboardNavigation", { + getFocusedCell: 0, + clearFocusedCell: 0, + setFocusedCell: 0, + tabToNextCell: 0, + tabToPreviousCell: 0, + setFocusedHeader: 0 + }), + ...mod("EventApi", { + addEventListener: 0, + addGlobalListener: 0, + removeEventListener: 0, + removeGlobalListener: 0 + }), + ...mod("ValueCache", { + expireValueCache: 0 + }), + ...mod("CellApi", { + getCellValue: 0 + }), + ...mod("SharedMenu", { + showColumnMenu: 0, + hidePopupMenu: 0 + }), + ...mod("Sort", { + onSortChanged: 0 + }), + ...mod("PinnedRow", { + getPinnedTopRowCount: 0, + getPinnedBottomRowCount: 0, + getPinnedTopRow: 0, + getPinnedBottomRow: 0, + forEachPinnedRow: 0 + }), + ...mod("Overlay", { + showLoadingOverlay: 0, + showNoRowsOverlay: 0, + hideOverlay: 0 + }), + ...mod("RenderApi", { + setGridAriaProperty: 0, + refreshCells: 0, + refreshHeader: 0, + isAnimationFrameQueueEmpty: 0, + flushAllAnimationFrames: 0, + getSizesForCurrentTheme: 0, + getCellRendererInstances: 0 + }), + ...mod("HighlightChanges", { + flashCells: 0 + }), + ...mod("RowDrag", { + addRowDropZone: 0, + removeRowDropZone: 0, + getRowDropZoneParams: 0, + getRowDropPositionIndicator: 0, + setRowDropPositionIndicator: 0 + }), + ...mod("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 + }), + ...mod("ColumnAutoSize", { + sizeColumnsToFit: 0, + autoSizeColumns: 0, + autoSizeAllColumns: 0 + }), + ...mod("ColumnGroup", { + setColumnGroupOpened: 0, + getColumnGroup: 0, + getProvidedColumnGroup: 0, + getDisplayNameForColumnGroup: 0, + getColumnGroupState: 0, + setColumnGroupState: 0, + resetColumnGroupState: 0, + getLeftDisplayedColumnGroups: 0, + getCenterDisplayedColumnGroups: 0, + getRightDisplayedColumnGroups: 0, + getAllDisplayedColumnGroups: 0 + }), + ...mod("ColumnMove", { + moveColumnByIndex: 0, + moveColumns: 0 + }), + ...mod("ColumnResize", { + setColumnWidths: 0 + }), + ...mod("ColumnHover", { + isColumnHovered: 0 + }), + ...mod("EditCore", { + getCellEditorInstances: 0, + getEditingCells: 0, + getEditRowValues: 0, + stopEditing: 0, + startEditingCell: 0, + isEditing: 0, + validateEdit: 0 + }), + ...mod("BatchEdit", { + startBatchEdit: 0, + cancelBatchEdit: 0, + commitBatchEdit: 0, + isBatchEditing: 0 + }), + ...mod("UndoRedoEdit", { + undoCellEditing: 0, + redoCellEditing: 0, + getCurrentUndoSize: 0, + getCurrentRedoSize: 0 + }), + ...mod("FilterCore", { + isAnyFilterPresent: 0, + onFilterChanged: 0 + }), + ...mod("ColumnFilter", { + isColumnFilterPresent: 0, + getColumnFilterInstance: 0, + destroyFilter: 0, + setFilterModel: 0, + getFilterModel: 0, + getColumnFilterModel: 0, + setColumnFilterModel: 0, + showColumnFilter: 0, + hideColumnFilter: 0, + getColumnFilterHandler: 0, + doFilterAction: 0 + }), + ...mod("QuickFilter", { + isQuickFilterPresent: 0, + getQuickFilter: 0, + resetQuickFilter: 0 + }), + ...mod("Find", { + findGetActiveMatch: 0, + findGetTotalMatches: 0, + findGoTo: 0, + findNext: 0, + findPrevious: 0, + findGetNumMatches: 0, + findGetParts: 0, + findClearActive: 0, + findRefresh: 0 + }), + ...mod("Pagination", { + paginationIsLastPageFound: 0, + paginationGetPageSize: 0, + paginationGetCurrentPage: 0, + paginationGetTotalPages: 0, + paginationGetRowCount: 0, + paginationGoToNextPage: 0, + paginationGoToPreviousPage: 0, + paginationGoToFirstPage: 0, + paginationGoToLastPage: 0, + paginationGoToPage: 0 + }), + ...mod("CsrmSsrmSharedApi", { + expandAll: 0, + collapseAll: 0, + resetRowGroupExpansion: 0 + }), + ...mod("SsrmInfiniteSharedApi", { + setRowCount: 0, + getCacheBlockState: 0, + isLastRowIndexKnown: 0 + }), + ...mod("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 + }), + ...mod("CsvExport", { + getDataAsCsv: 0, + exportDataAsCsv: 0 + }), + ...mod("InfiniteRowModel", { + refreshInfiniteCache: 0, + purgeInfiniteCache: 0, + getInfiniteRowCount: 0 + }), + ...mod("AdvancedFilter", { + getAdvancedFilterModel: 0, + setAdvancedFilterModel: 0, + showAdvancedFilterBuilder: 0, + hideAdvancedFilterBuilder: 0 + }), + ...mod("IntegratedCharts", { + getChartModels: 0, + getChartRef: 0, + getChartImageDataURL: 0, + downloadChart: 0, + openChartToolPanel: 0, + closeChartToolPanel: 0, + createRangeChart: 0, + createPivotChart: 0, + createCrossFilterChart: 0, + updateChart: 0, + restoreChart: 0 + }), + ...mod("Clipboard", { + copyToClipboard: 0, + cutToClipboard: 0, + copySelectedRowsToClipboard: 0, + copySelectedRangeToClipboard: 0, + copySelectedRangeDown: 0, + pasteFromClipboard: 0 + }), + ...mod("ExcelExport", { + getDataAsExcel: 0, + exportDataAsExcel: 0, + getSheetDataForExcel: 0, + getMultipleSheetsAsExcel: 0, + exportMultipleSheetsAsExcel: 0 + }), + ...mod("SharedMasterDetail", { + addDetailGridInfo: 0, + removeDetailGridInfo: 0, + getDetailGridInfo: 0, + forEachDetailGridInfo: 0 + }), + ...mod("ContextMenu", { + showContextMenu: 0 + }), + ...mod("ColumnMenu", { + showColumnChooser: 0, + hideColumnChooser: 0 + }), + ...mod("CellSelection", { + getCellRanges: 0, + addCellRange: 0, + clearRangeSelection: 0, + clearCellSelection: 0 + }), + ...mod("SharedRowGrouping", { + setRowGroupColumns: 0, + removeRowGroupColumns: 0, + addRowGroupColumns: 0, + getRowGroupColumns: 0, + moveRowGroupColumn: 0 + }), + ...mod("SharedAggregation", { + addAggFuncs: 0, + clearAggFuncs: 0, + setColumnAggFunc: 0 + }), + ...mod("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 + }), + ...mod("ServerSideRowModelApi", { + getServerSideSelectionState: 0, + setServerSideSelectionState: 0, + applyServerSideTransaction: 0, + applyServerSideTransactionAsync: 0, + applyServerSideRowData: 0, + retryServerSideLoads: 0, + flushServerSideAsyncTransactions: 0, + refreshServerSide: 0, + getServerSideGroupLevelState: 0, + onRowHeightChanged: 0, + resetRowHeights: 0 + }), + ...mod("SideBar", { + isSideBarVisible: 0, + setSideBarVisible: 0, + setSideBarPosition: 0, + openToolPanel: 0, + closeToolPanel: 0, + getOpenedToolPanel: 0, + refreshToolPanel: 0, + isToolPanelShowing: 0, + getToolPanelInstance: 0, + getSideBar: 0 + }), + ...mod("StatusBar", { + getStatusPanel: 0 + }), + ...mod("AiToolkit", { + getStructuredSchema: 0 + }) +}; +var defaultFns = { + isDestroyed: () => true, + destroy() {}, + preConstruct() {}, + postConstruct() {}, + preWireBeans() {}, + wireBeans() {} +}; +var dispatchEvent = (beans, event) => beans.eventSvc.dispatchEvent(event); +var GridApiClass = class { +}; +Reflect.defineProperty(GridApiClass, "name", { value: "GridApi" }); +var ApiFunctionService = class extends BeanStub { + constructor() { + super(); + this.beanName = "apiFunctionSvc"; + this.api = new GridApiClass; + this.fns = { + ...defaultFns, + dispatchEvent + }; + this.preDestroyLink = ""; + const { api } = this; + for (const key of Object.keys(gridApiFunctionsMap)) { + api[key] = this.makeApi(key)[key]; + } + } + postConstruct() { + this.preDestroyLink = this.beans.frameworkOverrides.getDocLink("grid-lifecycle/#grid-pre-destroyed"); + } + addFunction(functionName, func) { + const { fns, beans } = this; + if (fns !== defaultFns) { + fns[functionName] = beans?.validation?.validateApiFunction(functionName, func) ?? func; + } + } + makeApi(apiName) { + return { + [apiName]: (...args) => { + const { + beans, + fns: { [apiName]: fn } + } = this; + return fn ? fn(beans, ...args) : this.apiNotFound(apiName); + } + }; + } + apiNotFound(fnName) { + const { beans, gos, preDestroyLink } = this; + if (!beans) { + _warn(26, { fnName, preDestroyLink }); + } else { + const module = gridApiFunctionsMap[fnName]; + if (gos.assertModuleRegistered(module, `api.${fnName}`)) { + _warn(27, { fnName, module }); + } + } + } + destroy() { + super.destroy(); + this.fns = defaultFns; + this.beans = null; + } +}; +function getGridId(beans) { + return beans.context.getId(); +} +function destroy(beans) { + beans.gridDestroySvc.destroy(); +} +function isDestroyed(beans) { + return beans.gridDestroySvc.destroyCalled; +} +function getGridOption(beans, key) { + return beans.gos.get(key); +} +function setGridOption(beans, key, value) { + updateGridOptions(beans, { [key]: value }); +} +function updateGridOptions(beans, options) { + beans.gos.updateGridOptions({ options }); +} +function isModuleRegistered(beans, moduleName) { + const withoutSuffix = moduleName.replace(/Module$/, ""); + return beans.gos.isModuleRegistered(withoutSuffix); +} +function _createIcon(iconName, beans, column) { + const iconContents = _createIconNoSpan(iconName, beans, column); + if (iconContents) { + const { className } = iconContents; + if (typeof className === "string" && className.includes("ag-icon") || typeof className === "object" && className["ag-icon"]) { + return iconContents; + } + } + const eResult = _createElement({ tag: "span" }); + eResult.appendChild(iconContents); + return eResult; +} +function _createIconNoSpan(iconName, beans, column) { + let userProvidedIcon = null; + if (iconName === "smallDown") { + _warn(262); + } else if (iconName === "smallLeft") { + _warn(263); + } else if (iconName === "smallRight") { + _warn(264); + } + const icons = column?.getColDef().icons; + if (icons) { + userProvidedIcon = icons[iconName]; + } + if (beans.gos && !userProvidedIcon) { + const optionsIcons = beans.gos.get("icons"); + if (optionsIcons) { + userProvidedIcon = optionsIcons[iconName]; + } + } + if (userProvidedIcon) { + let rendererResult; + if (typeof userProvidedIcon === "function") { + rendererResult = userProvidedIcon(); + } else if (typeof userProvidedIcon === "string") { + rendererResult = userProvidedIcon; + } else { + _warn(38, { iconName }); + return; + } + if (typeof rendererResult === "string") { + return _loadTemplate(rendererResult); + } + if (_isNodeOrElement(rendererResult)) { + return rendererResult; + } + _warn(133, { iconName }); + return; + } else { + const iconValue = beans.registry.getIcon(iconName); + if (!iconValue) { + beans.validation?.validateIcon(iconName); + } + return _createElement({ + tag: "span", + cls: `ag-icon ag-icon-${iconValue ?? iconName}`, + role: "presentation", + attrs: { unselectable: "on" } + }); + } +} +var dragAndDropImageComponent_default = ".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)}"; +var DragAndDropElement = { + 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" } + ] + } + ] +}; +var DragAndDropImageComponent2 = class extends Component { + constructor() { + super(); + this.dragSource = null; + this.eIcon = RefPlaceholder; + this.eLabel = RefPlaceholder; + this.eGhost = RefPlaceholder; + this.registerCSS(dragAndDropImageComponent_default); + } + postConstruct() { + const create = (iconName) => _createIcon(iconName, this.beans, null); + this.dropIconMap = { + pinned: create("columnMovePin"), + hide: create("columnMoveHide"), + move: create("columnMoveMove"), + left: create("columnMoveLeft"), + right: create("columnMoveRight"), + group: create("columnMoveGroup"), + aggregate: create("columnMoveValue"), + pivot: create("columnMovePivot"), + notAllowed: create("dropNotAllowed") + }; + } + init(params) { + this.dragSource = params.dragSource; + this.setTemplate(DragAndDropElement); + this.beans.environment.applyThemeClasses(this.eGhost); + } + destroy() { + this.dragSource = null; + super.destroy(); + } + setIcon(iconName, shake) { + const { eGhost, eIcon, dragSource, dropIconMap, gos } = this; + _clearElement(eIcon); + let eIconChild = null; + if (!iconName) { + iconName = dragSource?.getDefaultIconName ? dragSource.getDefaultIconName() : "notAllowed"; + } + eIconChild = dropIconMap[iconName]; + eGhost.classList.toggle("ag-dnd-ghost-not-allowed", iconName === "notAllowed"); + eIcon.classList.toggle("ag-shake-left-to-right", shake); + if (eIconChild === dropIconMap["hide"] && gos.get("suppressDragLeaveHidesColumns")) { + return; + } + if (eIconChild) { + eIcon.appendChild(eIconChild); + } + } + setLabel(label) { + this.eLabel.textContent = label; + } +}; +var tryPointerCapture = (eElement, pointerId) => { + if (pointerId != null && eElement?.setPointerCapture) { + try { + eElement.setPointerCapture(pointerId); + return eElement.hasPointerCapture(pointerId); + } catch {} + } + return false; +}; +var capturePointer = (eElement, mouseEvent) => { + if (typeof PointerEvent === "undefined" || !(mouseEvent instanceof PointerEvent)) { + return null; + } + const pointerId = mouseEvent.pointerId; + if (!tryPointerCapture(eElement, pointerId)) { + return null; + } + const capture = { + eElement, + pointerId, + onLost(pointerEvent) { + pointerLostHandler(capture, pointerEvent); + } + }; + eElement.addEventListener("lostpointercapture", capture.onLost); + return capture; +}; +var releasePointerCapture = (capture) => { + if (!capture) { + return; + } + removeLostHandler(capture); + const { eElement, pointerId } = capture; + if (!eElement) { + return; + } + try { + eElement.releasePointerCapture(pointerId); + } catch {} + capture.eElement = null; +}; +var removeLostHandler = (capture) => { + const { eElement, onLost } = capture; + if (eElement && onLost) { + eElement.removeEventListener("lostpointercapture", onLost); + capture.onLost = null; + } +}; +var pointerLostHandler = (capture, pointerEvent) => { + removeLostHandler(capture); + const { eElement, pointerId } = capture; + if (eElement && pointerEvent.pointerId === pointerId) { + tryPointerCapture(eElement, pointerId); + } +}; +var activePointerDrags; +var handledDragEvents; +var PASSIVE_TRUE = { passive: true }; +var PASSIVE_FALSE = { passive: false }; +var addHandledDragEvent = (event) => { + if (!handledDragEvents) { + handledDragEvents = /* @__PURE__ */ new WeakSet; + } else if (handledDragEvents.has(event)) { + return false; + } + handledDragEvents.add(event); + return true; +}; +var BaseDragService = class extends AgBeanStub { + constructor() { + super(...arguments); + this.beanName = "dragSvc"; + this.dragging = false; + this.drag = null; + this.dragSources = []; + } + get startTarget() { + return this.drag?.start.target ?? null; + } + isPointer() { + return !!activePointerDrags?.has(_getRootNode(this.beans)); + } + hasPointerCapture() { + const capture = this.drag?.pointerCapture; + return !!(capture && this.beans.eRootDiv.hasPointerCapture?.(capture.pointerId)); + } + destroy() { + if (this.drag) { + this.cancelDrag(); + } + const dragSources = this.dragSources; + for (const entry of dragSources) { + destroyDragSourceEntry(entry); + } + dragSources.length = 0; + super.destroy(); + } + removeDragSource(params) { + const dragSources = this.dragSources; + for (let i = 0, len = dragSources.length;i < len; ++i) { + const entry = dragSources[i]; + if (entry.params === params) { + dragSources.splice(i, 1); + destroyDragSourceEntry(entry); + break; + } + } + } + addDragSource(params) { + if (!this.isAlive()) { + return; + } + const { eElement, includeTouch } = params; + const handlers = []; + let oldTouchAction; + if (includeTouch) { + const style = eElement.style; + if (style) { + oldTouchAction = style.touchAction; + style.touchAction = "none"; + } + } + const dragSource = { handlers, params, oldTouchAction }; + this.dragSources.push(dragSource); + const pointerDownListener = (event) => this.onPointerDown(params, event); + const mouseListener = (event) => this.onMouseDown(params, event); + addTempEventHandlers(handlers, [eElement, "pointerdown", pointerDownListener, PASSIVE_FALSE], [eElement, "mousedown", mouseListener]); + const suppressTouch = this.gos.get("suppressTouch"); + if (includeTouch && !suppressTouch) { + const touchListener = (touchEvent) => this.onTouchStart(params, touchEvent); + addTempEventHandlers(handlers, [eElement, "touchstart", touchListener, PASSIVE_FALSE]); + } + } + cancelDrag(eElement) { + const drag = this.drag; + eElement ?? (eElement = drag?.eElement); + if (eElement) { + this.eventSvc.dispatchEvent({ type: "dragCancelled", target: eElement }); + } + drag?.params.onDragCancel?.(); + this.destroyDrag(); + } + shouldPreventMouseEvent(mouseEvent) { + const type = mouseEvent.type; + const isMouseMove = type === "mousemove" || type === "pointermove"; + return isMouseMove && mouseEvent.cancelable && _isEventFromThisInstance(this.beans, mouseEvent) && !_isFocusableFormField(getEventTargetElement(mouseEvent)); + } + initDrag(drag, ...handlers) { + this.drag = drag; + const beans = this.beans; + const onScroll = (event) => this.onScroll(event); + const keydownEvent = (ev) => this.onKeyDown(ev); + const rootEl = _getRootNode(beans); + const eDocument = _getDocument(beans); + addTempEventHandlers(drag.handlers, [rootEl, "contextmenu", preventEventDefault], [rootEl, "keydown", keydownEvent], [eDocument, "scroll", onScroll, { capture: true }], [eDocument.defaultView || window, "scroll", onScroll], ...handlers); + } + destroyDrag() { + this.dragging = false; + const drag = this.drag; + if (drag) { + const rootEl = drag.rootEl; + if (activePointerDrags?.get(rootEl) === drag) { + activePointerDrags.delete(rootEl); + } + this.drag = null; + releasePointerCapture(drag.pointerCapture); + clearTempEventHandlers(drag.handlers); + } + } + onPointerDown(params, pointerEvent) { + if (this.isPointer()) { + return; + } + const beans = this.beans; + if (handledDragEvents?.has(pointerEvent)) { + return; + } + const pointerType = pointerEvent.pointerType; + if (pointerType === "touch") { + if (beans.gos.get("suppressTouch") || !params.includeTouch) { + return; + } + if (params.stopPropagationForTouch) { + pointerEvent.stopPropagation(); + } + if (_isFocusableFormField(getEventTargetElement(pointerEvent))) { + return; + } + } + if (!pointerEvent.isPrimary) { + return; + } + if (pointerType === "mouse" && pointerEvent.button !== 0) { + return; + } + this.destroyDrag(); + const rootEl = _getRootNode(beans); + const eElement = params.eElement; + const pointerId = pointerEvent.pointerId; + const pointerDrag = new Dragging(rootEl, params, pointerEvent, pointerId); + activePointerDrags ?? (activePointerDrags = /* @__PURE__ */ new WeakMap); + activePointerDrags.set(rootEl, pointerDrag); + const onPointerMove = (ev) => { + if (ev.pointerId === pointerId) { + this.onMouseOrPointerMove(ev); + } + }; + const onUp = (ev) => { + if (ev.pointerId === pointerId) { + this.onMouseOrPointerUp(ev); + } + }; + const onCancel = (ev) => { + if (ev.pointerId === pointerId && addHandledDragEvent(ev)) { + this.cancelDrag(); + } + }; + const dragPreventEventDefault = (e) => this.draggingPreventDefault(e); + this.initDrag(pointerDrag, [rootEl, "pointerup", onUp], [rootEl, "pointercancel", onCancel], [rootEl, "pointermove", onPointerMove, PASSIVE_FALSE], [rootEl, "touchmove", dragPreventEventDefault, PASSIVE_FALSE], [eElement, "mousemove", dragPreventEventDefault, PASSIVE_FALSE]); + if (params.dragStartPixels === 0) { + this.onMouseOrPointerMove(pointerEvent); + } else { + addHandledDragEvent(pointerEvent); + } + } + onTouchStart(params, touchEvent) { + const suppressTouch = this.gos.get("suppressTouch"); + if (suppressTouch || !params.includeTouch) { + return; + } + if (!addHandledDragEvent(touchEvent)) { + return; + } + if (_isFocusableFormField(getEventTargetElement(touchEvent))) { + return; + } + if (params.stopPropagationForTouch) { + touchEvent.stopPropagation(); + } + if (this.isPointer()) { + if (this.dragging) { + preventEventDefault(touchEvent); + } + return; + } + this.destroyDrag(); + const beans = this.beans; + const rootEl = _getRootNode(beans); + const touchDrag = new Dragging(rootEl, params, touchEvent.touches[0]); + const touchMoveEvent = (e) => this.onTouchMove(e); + const touchEndEvent = (e) => this.onTouchUp(e); + const touchCancelEvent = (e) => this.onTouchCancel(e); + const dragPreventEventDefault = (e) => this.draggingPreventDefault(e); + const rootNode = _getRootNode(beans); + const target = touchEvent.target ?? params.eElement; + this.initDrag(touchDrag, [target, "touchmove", touchMoveEvent, PASSIVE_TRUE], [target, "touchend", touchEndEvent, PASSIVE_TRUE], [target, "touchcancel", touchCancelEvent, PASSIVE_TRUE], [rootNode, "touchmove", dragPreventEventDefault, PASSIVE_FALSE], [rootNode, "touchend", touchEndEvent, PASSIVE_FALSE], [rootNode, "touchcancel", touchCancelEvent, PASSIVE_FALSE]); + if (params.dragStartPixels === 0) { + this.onMove(touchDrag.start); + } + } + draggingPreventDefault(e) { + if (this.dragging) { + preventEventDefault(e); + } + } + onMouseDown(params, mouseEvent) { + if (mouseEvent.button !== 0) { + return; + } + if (handledDragEvents?.has(mouseEvent)) { + return; + } + if (this.isPointer()) { + return; + } + const beans = this.beans; + this.destroyDrag(); + const mouseDrag = new Dragging(_getRootNode(beans), params, mouseEvent); + const mouseMoveEvent = (event) => this.onMouseOrPointerMove(event); + const mouseUpEvent = (event) => this.onMouseOrPointerUp(event); + const target = _getRootNode(beans); + this.initDrag(mouseDrag, [target, "mousemove", mouseMoveEvent], [target, "mouseup", mouseUpEvent]); + if (params.dragStartPixels === 0) { + this.onMouseOrPointerMove(mouseEvent); + } else { + addHandledDragEvent(mouseEvent); + } + } + onScroll(event) { + if (!addHandledDragEvent(event)) { + return; + } + const drag = this.drag; + const lastDrag = drag?.lastDrag; + if (lastDrag && this.dragging) { + drag.params?.onDragging?.(lastDrag); + } + } + onMouseOrPointerMove(mouseEvent) { + if (!addHandledDragEvent(mouseEvent)) { + return; + } + if (_isBrowserSafari()) { + _getDocument(this.beans).getSelection()?.removeAllRanges(); + } + if (this.shouldPreventMouseEvent(mouseEvent)) { + preventEventDefault(mouseEvent); + } + this.onMove(mouseEvent); + } + onTouchCancel(touchEvent) { + const drag = this.drag; + if (!drag || !addHandledDragEvent(touchEvent)) { + return; + } + if (!_getFirstActiveTouch(drag.start, touchEvent.changedTouches)) { + return; + } + this.cancelDrag(); + } + onTouchMove(touchEvent) { + const drag = this.drag; + if (!drag || !addHandledDragEvent(touchEvent)) { + return; + } + const touch = _getFirstActiveTouch(drag.start, touchEvent.touches); + if (touch) { + this.onMove(touch); + this.draggingPreventDefault(touchEvent); + } + } + onMove(currentEvent) { + const drag = this.drag; + if (!drag) { + return; + } + drag.lastDrag = currentEvent; + const dragSource = drag.params; + if (!this.dragging) { + const start = drag.start; + const dragStartPixels = dragSource.dragStartPixels; + const requiredPixelDiff = dragStartPixels ?? 4; + if (_areEventsNear(currentEvent, start, requiredPixelDiff)) { + return; + } + this.dragging = true; + if (dragSource.capturePointer) { + drag.pointerCapture = capturePointer(this.beans.eRootDiv, currentEvent); + } + this.eventSvc.dispatchEvent({ + type: "dragStarted", + target: dragSource.eElement + }); + dragSource.onDragStart?.(start); + if (this.drag !== drag) { + return; + } + dragSource.onDragging?.(start); + if (this.drag !== drag) { + return; + } + } + dragSource.onDragging?.(currentEvent); + } + onTouchUp(touchEvent) { + const drag = this.drag; + if (drag && addHandledDragEvent(touchEvent)) { + this.onUp(_getFirstActiveTouch(drag.start, touchEvent.changedTouches)); + } + } + onMouseOrPointerUp(mouseEvent) { + if (addHandledDragEvent(mouseEvent)) { + this.onUp(mouseEvent); + } + } + onUp(eventOrTouch) { + const drag = this.drag; + if (!drag) { + return; + } + if (!eventOrTouch) { + eventOrTouch = drag.lastDrag; + } + if (eventOrTouch && this.dragging) { + this.dragging = false; + drag.params.onDragStop?.(eventOrTouch); + this.eventSvc.dispatchEvent({ + type: "dragStopped", + target: drag.params.eElement + }); + } + this.destroyDrag(); + } + onKeyDown(event) { + if (event.key === KeyCode.ESCAPE) { + this.cancelDrag(); + } + } +}; +var destroyDragSourceEntry = (dragSource) => { + clearTempEventHandlers(dragSource.handlers); + const oldTouchAction = dragSource.oldTouchAction; + if (oldTouchAction != null) { + const style = dragSource.params.eElement.style; + if (style) { + style.touchAction = oldTouchAction; + } + } +}; +var Dragging = class { + constructor(rootEl, params, start, pointerId = null) { + this.rootEl = rootEl; + this.params = params; + this.start = start; + this.pointerId = pointerId; + this.handlers = []; + this.lastDrag = null; + this.pointerCapture = null; + this.eElement = params.eElement; + } +}; +var getEventTargetElement = (event) => { + const target = event.target; + return target instanceof Element ? target : null; +}; +var DragService = class extends BaseDragService { + shouldPreventMouseEvent(mouseEvent) { + const isEnableCellTextSelect = this.gos.get("enableCellTextSelection"); + return isEnableCellTextSelect && super.shouldPreventMouseEvent(mouseEvent); + } +}; +var HorizontalResizeService = class extends BeanStub { + constructor() { + super(...arguments); + this.beanName = "horizontalResizeSvc"; + } + addResizeBar(params) { + const dragSource = { + dragStartPixels: params.dragStartPixels || 0, + eElement: params.eResizeBar, + onDragStart: this.onDragStart.bind(this, params), + onDragStop: this.onDragStop.bind(this, params), + onDragging: this.onDragging.bind(this, params), + onDragCancel: this.onDragStop.bind(this, params), + includeTouch: true, + stopPropagationForTouch: true + }; + const { dragSvc } = this.beans; + dragSvc.addDragSource(dragSource); + const finishedWithResizeFunc = () => dragSvc.removeDragSource(dragSource); + return finishedWithResizeFunc; + } + onDragStart(params, mouseEvent) { + this.dragStartX = mouseEvent.clientX; + this.setResizeIcons(); + const shiftKey = mouseEvent instanceof MouseEvent && mouseEvent.shiftKey === true; + params.onResizeStart(shiftKey); + } + setResizeIcons() { + const ctrl = this.beans.ctrlsSvc.get("gridCtrl"); + ctrl.setResizeCursor(1); + ctrl.disableUserSelect(true); + } + onDragStop(params) { + params.onResizeEnd(this.resizeAmount); + this.resetIcons(); + } + resetIcons() { + const ctrl = this.beans.ctrlsSvc.get("gridCtrl"); + ctrl.setResizeCursor(false); + ctrl.disableUserSelect(false); + } + onDragging(params, mouseEvent) { + this.resizeAmount = mouseEvent.clientX - this.dragStartX; + params.onResizing(this.resizeAmount); + } +}; +var AutoScrollService = class { + constructor(params) { + this.tickingInterval = null; + this.onScrollCallback = null; + this.scrollContainer = params.scrollContainer; + this.scrollHorizontally = params.scrollAxis.includes("x"); + this.scrollVertically = params.scrollAxis.includes("y"); + this.scrollByTick = params.scrollByTick ?? 20; + if (params.onScrollCallback) { + this.onScrollCallback = params.onScrollCallback; + } + if (this.scrollVertically) { + this.getVerticalPosition = params.getVerticalPosition; + this.setVerticalPosition = params.setVerticalPosition; + } + if (this.scrollHorizontally) { + this.getHorizontalPosition = params.getHorizontalPosition; + this.setHorizontalPosition = params.setHorizontalPosition; + } + this.shouldSkipVerticalScroll = params.shouldSkipVerticalScroll || (() => false); + this.shouldSkipHorizontalScroll = params.shouldSkipHorizontalScroll || (() => false); + } + get scrolling() { + return this.tickingInterval !== null; + } + check(mouseEvent, forceSkipVerticalScroll = false) { + const skipVerticalScroll = !this.scrollVertically || forceSkipVerticalScroll || this.shouldSkipVerticalScroll(); + const skipHorizontalScroll = !this.scrollHorizontally || this.shouldSkipHorizontalScroll(); + if (skipVerticalScroll && skipHorizontalScroll) { + return; + } + const rect = this.scrollContainer.getBoundingClientRect(); + const scrollTick = this.scrollByTick; + this.tickLeft = !skipHorizontalScroll && mouseEvent.clientX < rect.left + scrollTick; + this.tickRight = !skipHorizontalScroll && mouseEvent.clientX > rect.right - scrollTick; + this.tickUp = !skipVerticalScroll && mouseEvent.clientY < rect.top + scrollTick; + this.tickDown = !skipVerticalScroll && mouseEvent.clientY > rect.bottom - scrollTick; + if (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++; + const tickAmount = this.tickCount > 20 ? 200 : this.tickCount > 10 ? 80 : 40; + if (this.scrollVertically) { + const vScrollPosition = this.getVerticalPosition(); + if (this.tickUp) { + this.setVerticalPosition(vScrollPosition - tickAmount); + } + if (this.tickDown) { + this.setVerticalPosition(vScrollPosition + tickAmount); + } + } + if (this.scrollHorizontally) { + const hScrollPosition = this.getHorizontalPosition(); + if (this.tickLeft) { + this.setHorizontalPosition(hScrollPosition - tickAmount); + } + if (this.tickRight) { + this.setHorizontalPosition(hScrollPosition + tickAmount); + } + } + if (this.onScrollCallback) { + this.onScrollCallback(); + } + } + ensureCleared() { + if (this.tickingInterval) { + window.clearInterval(this.tickingInterval); + this.tickingInterval = null; + } + } +}; +var ChangedRowNodes = class { + constructor() { + this.reordered = false; + this.removals = []; + this.updates = /* @__PURE__ */ new Set; + this.adds = /* @__PURE__ */ new Set; + } +}; +var _csrmFirstLeaf = (node) => { + let childrenAfterGroup = node.childrenAfterGroup; + while (childrenAfterGroup?.length) { + const child = childrenAfterGroup[0]; + if (child.sourceRowIndex >= 0) { + return child; + } + childrenAfterGroup = child.childrenAfterGroup; + } +}; +var _csrmReorderAllLeafs = (allLeafs, leafsToMove, target, above) => { + if (!leafsToMove.size || !allLeafs) { + return false; + } + let orderChanged = false; + const allLeafsLen = allLeafs.length ?? 0; + let targetPositionIdx = -1; + if (target) { + targetPositionIdx = target.sourceRowIndex; + target = targetPositionIdx < 0 ? _csrmFirstLeaf(target) : null; + if (target) { + targetPositionIdx = target.sourceRowIndex; + } + } + if (targetPositionIdx < 0 || targetPositionIdx >= allLeafsLen) { + targetPositionIdx = allLeafsLen; + } else if (!above) { + ++targetPositionIdx; + } + let firstAffectedLeafIdx = targetPositionIdx; + let lastAffectedLeafIndex = Math.min(targetPositionIdx, allLeafsLen - 1); + for (const row of leafsToMove) { + const sourceRowIndex = row.sourceRowIndex; + if (sourceRowIndex < firstAffectedLeafIdx) { + firstAffectedLeafIdx = sourceRowIndex; + } + if (sourceRowIndex > lastAffectedLeafIndex) { + lastAffectedLeafIndex = sourceRowIndex; + } + } + let writeIdxLeft = firstAffectedLeafIdx; + for (let readIdx = firstAffectedLeafIdx;readIdx < targetPositionIdx; ++readIdx) { + const row = allLeafs[readIdx]; + if (leafsToMove.has(row)) { + continue; + } + if (row.sourceRowIndex !== writeIdxLeft) { + row.sourceRowIndex = writeIdxLeft; + allLeafs[writeIdxLeft] = row; + orderChanged = true; + } + ++writeIdxLeft; + } + let writeIdxRight = lastAffectedLeafIndex; + for (let readIdx = lastAffectedLeafIndex;readIdx >= targetPositionIdx; --readIdx) { + const row = allLeafs[readIdx]; + if (leafsToMove.has(row)) { + continue; + } + if (row.sourceRowIndex !== writeIdxRight) { + row.sourceRowIndex = writeIdxRight; + allLeafs[writeIdxRight] = row; + orderChanged = true; + } + --writeIdxRight; + } + for (const row of leafsToMove) { + if (row.sourceRowIndex !== writeIdxLeft) { + row.sourceRowIndex = writeIdxLeft; + allLeafs[writeIdxLeft] = row; + orderChanged = true; + } + ++writeIdxLeft; + } + return orderChanged; +}; +function _getCellPositionForEvent(gos, event) { + return _getCellCtrlForEventTarget(gos, event.target)?.getFocusedCellPosition() ?? null; +} +function _getNormalisedMousePosition(beans, event) { + const gridPanelHasScrolls = _isDomLayout(beans.gos, "normal"); + const e = event; + let x; + let y; + if (e.clientX != null || e.clientY != null) { + x = e.clientX; + y = e.clientY; + } else { + x = e.x; + y = e.y; + } + const { pageFirstPixel } = beans.pageBounds.getCurrentPagePixelRange(); + y += pageFirstPixel; + if (gridPanelHasScrolls) { + const scrollFeature = beans.ctrlsSvc.getScrollFeature(); + const vRange = scrollFeature.getVScrollPosition(); + const hRange = scrollFeature.getHScrollPosition(); + x += hRange.left; + y += vRange.top; + } + return { x, y }; +} +var DragModule = { + moduleName: "Drag", + version: VERSION, + beans: [DragService] +}; +var SharedDragAndDropModule = { + moduleName: "SharedDragAndDrop", + version: VERSION, + beans: [DragAndDropService], + dependsOn: [DragModule], + userComponents: { + agDragAndDropImage: DragAndDropImageComponent2 + }, + icons: { + columnMovePin: "pin", + columnMoveHide: "eye-slash", + columnMoveMove: "arrows", + columnMoveLeft: "left", + columnMoveRight: "right", + columnMoveGroup: "group", + columnMoveValue: "aggregation", + columnMovePivot: "pivot", + dropNotAllowed: "not-allowed", + rowDrag: "grip" + } +}; +var HorizontalResizeModule = { + moduleName: "HorizontalResize", + version: VERSION, + beans: [HorizontalResizeService], + dependsOn: [DragModule] +}; +var column_moving_default = ":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}}"; +var ColumnAnimationService = class extends BeanStub { + constructor() { + super(...arguments); + this.beanName = "colAnimation"; + this.executeNextFuncs = []; + this.executeLaterFuncs = []; + this.active = false; + this.activeNext = false; + this.suppressAnimation = false; + this.animationThreadCount = 0; + } + postConstruct() { + this.beans.ctrlsSvc.whenReady(this, (p) => this.gridBodyCtrl = p.gridBodyCtrl); + } + isActive() { + return this.active && !this.suppressAnimation; + } + setSuppressAnimation(suppress) { + this.suppressAnimation = suppress; + } + start() { + if (this.active) { + return; + } + const { gos } = this; + if (gos.get("suppressColumnMoveAnimation")) { + return; + } + if (gos.get("enableRtl")) { + return; + } + this.ensureAnimationCssClassPresent(); + this.active = true; + this.activeNext = true; + } + finish() { + if (!this.active) { + return; + } + this.flush(() => this.activeNext = false, () => this.active = false); + } + executeNextVMTurn(func) { + if (this.activeNext) { + this.executeNextFuncs.push(func); + } else { + func(); + } + } + executeLaterVMTurn(func) { + if (this.active) { + this.executeLaterFuncs.push(func); + } else { + func(); + } + } + ensureAnimationCssClassPresent() { + this.animationThreadCount++; + const animationThreadCountCopy = this.animationThreadCount; + const { gridBodyCtrl } = this; + gridBodyCtrl.setColumnMovingCss(true); + this.executeLaterFuncs.push(() => { + if (this.animationThreadCount === animationThreadCountCopy) { + gridBodyCtrl.setColumnMovingCss(false); + } + }); + } + flush(callbackNext, callbackLater) { + const { executeNextFuncs, executeLaterFuncs } = this; + if (executeNextFuncs.length === 0 && executeLaterFuncs.length === 0) { + callbackNext(); + callbackLater(); + return; + } + const runFuncs = (queue) => { + while (queue.length) { + const func = queue.pop(); + if (func) { + func(); + } + } + }; + this.beans.frameworkOverrides.wrapIncoming(() => { + window.setTimeout(() => { + callbackNext(); + runFuncs(executeNextFuncs); + }, 0); + window.setTimeout(() => { + callbackLater(); + runFuncs(executeLaterFuncs); + }, 200); + }); + } +}; +function moveColumnByIndex(beans, fromIndex, toIndex) { + beans.colMoves?.moveColumnByIndex(fromIndex, toIndex, "api"); +} +function moveColumns(beans, columnsToMoveKeys, toIndex) { + beans.colMoves?.moveColumns(columnsToMoveKeys, toIndex, "api"); +} +var BodyDropPivotTarget = class extends BeanStub { + constructor(pinned) { + super(); + this.pinned = pinned; + this.columnsToAggregate = []; + this.columnsToGroup = []; + this.columnsToPivot = []; + } + onDragEnter(draggingEvent) { + this.clearColumnsList(); + if (this.gos.get("functionsReadOnly")) { + return; + } + const dragColumns = draggingEvent.dragItem.columns; + if (!dragColumns) { + return; + } + for (const column of dragColumns) { + if (!column.isPrimary()) { + continue; + } + if (column.isAnyFunctionActive()) { + continue; + } + if (column.isAllowValue()) { + this.columnsToAggregate.push(column); + } else if (column.isAllowRowGroup()) { + this.columnsToGroup.push(column); + } else if (column.isAllowPivot()) { + this.columnsToPivot.push(column); + } + } + } + getIconName() { + const totalColumns = this.columnsToAggregate.length + this.columnsToGroup.length + this.columnsToPivot.length; + if (totalColumns > 0) { + return this.pinned ? "pinned" : "move"; + } + return null; + } + onDragLeave(draggingEvent) { + this.clearColumnsList(); + } + clearColumnsList() { + this.columnsToAggregate.length = 0; + this.columnsToGroup.length = 0; + this.columnsToPivot.length = 0; + } + onDragging(draggingEvent) {} + onDragStop(draggingEvent) { + const { valueColsSvc, rowGroupColsSvc, pivotColsSvc } = this.beans; + if (this.columnsToAggregate.length > 0) { + valueColsSvc?.addColumns(this.columnsToAggregate, "toolPanelDragAndDrop"); + } + if (this.columnsToGroup.length > 0) { + rowGroupColsSvc?.addColumns(this.columnsToGroup, "toolPanelDragAndDrop"); + } + if (this.columnsToPivot.length > 0) { + pivotColsSvc?.addColumns(this.columnsToPivot, "toolPanelDragAndDrop"); + } + } + onDragCancel() { + this.clearColumnsList(); + } +}; +function sortColsLikeCols(colsList, cols) { + if (!cols || cols.length <= 1) { + return; + } + const notAllColsPresent = cols.filter((c) => colsList.indexOf(c) < 0).length > 0; + if (notAllColsPresent) { + return; + } + cols.sort((a, b) => { + const indexA = colsList.indexOf(a); + const indexB = colsList.indexOf(b); + return indexA - indexB; + }); +} +function getColsToMove(allMovingColumns) { + const newCols = [...allMovingColumns]; + for (const col of allMovingColumns) { + let movingGroup = null; + let parent = col.getParent(); + while (parent != null && parent.getDisplayedLeafColumns().length === 1) { + movingGroup = parent; + parent = parent.getParent(); + } + if (movingGroup != null) { + const isMarryChildren = !!movingGroup.getColGroupDef()?.marryChildren; + const columnsToMove = isMarryChildren ? movingGroup.getProvidedColumnGroup().getLeafColumns() : movingGroup.getLeafColumns(); + for (const newCol of columnsToMove) { + if (!newCols.includes(newCol)) { + newCols.push(newCol); + } + } + } + } + return newCols; +} +function getLowestFragMove(validMoves, allMovingColumnsOrdered, colMoves, visibleCols) { + const displayedCols = visibleCols.allCols; + let lowestFragMove = null; + let targetOrder = null; + for (let i = 0;i < validMoves.length; i++) { + const move = validMoves[i]; + const order = colMoves.getProposedColumnOrder(allMovingColumnsOrdered, move); + if (!colMoves.doesOrderPassRules(order)) { + continue; + } + const displayedOrder = order.filter((col) => displayedCols.includes(col)); + if (targetOrder === null) { + targetOrder = displayedOrder; + } else if (!_areEqual(displayedOrder, targetOrder)) { + break; + } + const fragCount = groupFragCount(order); + if (lowestFragMove === null || fragCount < lowestFragMove.fragCount) { + lowestFragMove = { move, fragCount }; + } + } + return lowestFragMove; +} +function getBestColumnMoveIndexFromXPosition(params) { + const { isFromHeader, fromLeft, xPosition, fromEnter, fakeEvent, pinned, gos, colModel, colMoves, visibleCols } = params; + let { allMovingColumns } = params; + if (isFromHeader) { + allMovingColumns = getColsToMove(allMovingColumns); + } + const allMovingColumnsOrdered = allMovingColumns.slice(); + sortColsLikeCols(colModel.getCols(), allMovingColumnsOrdered); + const validMoves = calculateValidMoves({ + movingCols: allMovingColumnsOrdered, + draggingRight: fromLeft, + xPosition, + pinned, + gos, + colModel, + visibleCols + }); + const oldIndex = calculateOldIndex(allMovingColumnsOrdered, colModel); + if (validMoves.length === 0) { + return; + } + const firstValidMove = validMoves[0]; + const constrainDirection = oldIndex !== null && (isFromHeader || !fromEnter); + if (constrainDirection && !fakeEvent) { + if (!fromLeft && firstValidMove >= oldIndex) { + return; + } + if (fromLeft && firstValidMove <= oldIndex) { + return; + } + } + const lowestFragMove = getLowestFragMove(validMoves, allMovingColumnsOrdered, colMoves, visibleCols); + if (!lowestFragMove) { + return; + } + const toIndex = lowestFragMove.move; + if (toIndex > colModel.getCols().length - allMovingColumnsOrdered.length) { + return; + } + return { columns: allMovingColumnsOrdered, toIndex }; +} +function attemptMoveColumns(params) { + const { columns, toIndex } = getBestColumnMoveIndexFromXPosition(params) || {}; + const { finished, colMoves } = params; + if (!columns || toIndex == null) { + return null; + } + colMoves.moveColumns(columns, toIndex, "uiColumnMoved", finished); + return finished ? null : { columns, toIndex }; +} +function calculateOldIndex(movingCols, colModel) { + const gridCols = colModel.getCols(); + const indexes = movingCols.map((col) => gridCols.indexOf(col)).sort((a, b) => a - b); + const firstIndex = indexes[0]; + const lastIndex = _last(indexes); + const spread = lastIndex - firstIndex; + const gapsExist = spread !== indexes.length - 1; + return gapsExist ? null : firstIndex; +} +function groupFragCount(columns) { + function parents(col) { + const result = []; + let parent = col.getOriginalParent(); + while (parent != null) { + result.push(parent); + parent = parent.getOriginalParent(); + } + return result; + } + let count = 0; + for (let i = 0;i < columns.length - 1; i++) { + let a = parents(columns[i]); + let b = parents(columns[i + 1]); + [a, b] = a.length > b.length ? [a, b] : [b, a]; + for (const parent of a) { + if (b.indexOf(parent) === -1) { + count++; + } + } + } + return count; +} +function getDisplayedColumns(visibleCols, type) { + switch (type) { + case "left": + return visibleCols.leftCols; + case "right": + return visibleCols.rightCols; + default: + return visibleCols.centerCols; + } +} +function calculateValidMoves(params) { + const { movingCols, draggingRight, xPosition, pinned, gos, colModel, visibleCols } = params; + const isMoveBlocked = gos.get("suppressMovableColumns") || movingCols.some((col) => col.getColDef().suppressMovable); + if (isMoveBlocked) { + return []; + } + const allDisplayedCols = getDisplayedColumns(visibleCols, pinned); + const allGridCols = colModel.getCols(); + const movingDisplayedCols = allDisplayedCols.filter((col) => movingCols.includes(col)); + const otherDisplayedCols = allDisplayedCols.filter((col) => !movingCols.includes(col)); + const otherGridCols = allGridCols.filter((col) => !movingCols.includes(col)); + let displayIndex = 0; + let availableWidth = xPosition; + if (draggingRight) { + let widthOfMovingDisplayedCols = 0; + for (const col of movingDisplayedCols) { + widthOfMovingDisplayedCols += col.getActualWidth(); + } + availableWidth -= widthOfMovingDisplayedCols; + } + if (availableWidth > 0) { + for (let i = 0;i < otherDisplayedCols.length; i++) { + const col = otherDisplayedCols[i]; + availableWidth -= col.getActualWidth(); + if (availableWidth < 0) { + break; + } + displayIndex++; + } + if (draggingRight) { + displayIndex++; + } + } + let firstValidMove; + if (displayIndex > 0) { + const leftColumn = otherDisplayedCols[displayIndex - 1]; + firstValidMove = otherGridCols.indexOf(leftColumn) + 1; + } else { + firstValidMove = otherGridCols.indexOf(otherDisplayedCols[0]); + if (firstValidMove === -1) { + firstValidMove = 0; + } + } + const validMoves = [firstValidMove]; + const numberComparator = (a, b) => a - b; + if (draggingRight) { + let pointer = firstValidMove + 1; + const lastIndex = allGridCols.length - 1; + while (pointer <= lastIndex) { + validMoves.push(pointer); + pointer++; + } + validMoves.sort(numberComparator); + } else { + let pointer = firstValidMove; + const lastIndex = allGridCols.length - 1; + let displacedCol = allGridCols[pointer]; + while (pointer <= lastIndex && allDisplayedCols.indexOf(displacedCol) < 0) { + pointer++; + validMoves.push(pointer); + displacedCol = allGridCols[pointer]; + } + pointer = firstValidMove - 1; + const firstDisplayIndex = 0; + while (pointer >= firstDisplayIndex) { + validMoves.push(pointer); + pointer--; + } + validMoves.sort(numberComparator).reverse(); + } + return validMoves; +} +function normaliseX(params) { + const { pinned, fromKeyboard, gos, ctrlsSvc, useHeaderRow, skipScrollPadding } = params; + let eViewport = ctrlsSvc.getHeaderRowContainerCtrl(pinned)?.eViewport; + let { x } = params; + if (!eViewport) { + return 0; + } + if (fromKeyboard) { + x -= eViewport.getBoundingClientRect().left; + } + if (gos.get("enableRtl")) { + if (useHeaderRow) { + eViewport = eViewport.querySelector(".ag-header-row"); + } + x = eViewport.clientWidth - x; + } + if (pinned == null && !skipScrollPadding) { + x += ctrlsSvc.get("center").getCenterViewportScrollLeft(); + } + return x; +} +function setColumnsMoving(columns, isMoving) { + for (const column of columns) { + column.moving = isMoving; + column.dispatchColEvent("movingChanged", "uiColumnMoved"); + } +} +var MOVE_FAIL_THRESHOLD = 7; +var SCROLL_MOVE_WIDTH = 100; +var SCROLL_GAP_NEEDED_BEFORE_MOVE = SCROLL_MOVE_WIDTH / 2; +var SCROLL_ACCELERATION_RATE = 5; +var SCROLL_TIME_INTERVAL = 100; +var MoveColumnFeature = class extends BeanStub { + constructor(pinned) { + super(); + this.pinned = pinned; + this.needToMoveLeft = false; + this.needToMoveRight = false; + this.lastMovedInfo = null; + this.isCenterContainer = !_exists(pinned); + } + postConstruct() { + this.beans.ctrlsSvc.whenReady(this, (p) => { + this.gridBodyCon = p.gridBodyCtrl; + }); + } + getIconName() { + const { pinned, lastDraggingEvent } = this; + const { dragItem } = lastDraggingEvent || {}; + const columns = dragItem?.columns ?? []; + for (const col of columns) { + const colPinned = col.getPinned(); + if (col.getColDef().lockPinned) { + if (colPinned == pinned) { + return "move"; + } + continue; + } + const initialPinnedState = dragItem?.containerType; + if (initialPinnedState === pinned || !pinned) { + return "move"; + } + if (pinned && (!colPinned || initialPinnedState !== pinned)) { + return "pinned"; + } + } + return "notAllowed"; + } + onDragEnter(draggingEvent) { + const dragItem = draggingEvent.dragItem; + const columns = dragItem.columns; + const dragCameFromToolPanel = draggingEvent.dragSource.type === 0; + if (dragCameFromToolPanel) { + this.setColumnsVisible(columns, true, "uiColumnDragged"); + } else { + const visibleState = dragItem.visibleState; + const visibleColumns = (columns || []).filter((column) => visibleState[column.getId()] && !column.isVisible()); + this.setColumnsVisible(visibleColumns, true, "uiColumnDragged"); + } + if (!this.gos.get("suppressMoveWhenColumnDragging")) { + this.attemptToPinColumns(columns, this.pinned); + } + this.onDragging(draggingEvent, true, true); + } + onDragging(draggingEvent = this.lastDraggingEvent, fromEnter = false, fakeEvent = false, finished = false) { + const { gos, ctrlsSvc } = this.beans; + const isSuppressMoveWhenDragging = gos.get("suppressMoveWhenColumnDragging"); + if (finished && !isSuppressMoveWhenDragging) { + this.finishColumnMoving(); + return; + } + this.lastDraggingEvent = draggingEvent; + if (!draggingEvent || !finished && _missing(draggingEvent.hDirection)) { + return; + } + const mouseX = normaliseX({ + x: draggingEvent.x, + pinned: this.pinned, + gos, + ctrlsSvc + }); + if (!fromEnter) { + this.checkCenterForScrolling(mouseX); + } + if (isSuppressMoveWhenDragging) { + this.handleColumnDragWhileSuppressingMovement(draggingEvent, fromEnter, fakeEvent, mouseX, finished); + } else { + this.handleColumnDragWhileAllowingMovement(draggingEvent, fromEnter, fakeEvent, mouseX, finished); + } + } + onDragLeave() { + this.ensureIntervalCleared(); + this.clearHighlighted(); + this.updateDragItemContainerType(); + this.lastMovedInfo = null; + } + onDragStop() { + this.onDragging(this.lastDraggingEvent, false, true, true); + this.ensureIntervalCleared(); + this.lastMovedInfo = null; + } + onDragCancel() { + this.clearHighlighted(); + this.ensureIntervalCleared(); + this.lastMovedInfo = null; + } + setColumnsVisible(columns, visible, source) { + if (!columns?.length) { + return; + } + const allowedCols = columns.filter((c) => !c.getColDef().lockVisible); + if (!allowedCols.length) { + return; + } + this.beans.colModel.setColsVisible(allowedCols, visible, source); + } + finishColumnMoving() { + this.clearHighlighted(); + const lastMovedInfo = this.lastMovedInfo; + if (!lastMovedInfo) { + return; + } + const { columns, toIndex } = lastMovedInfo; + this.beans.colMoves.moveColumns(columns, toIndex, "uiColumnMoved", true); + } + updateDragItemContainerType() { + const { lastDraggingEvent } = this; + if (this.gos.get("suppressMoveWhenColumnDragging") || !lastDraggingEvent) { + return; + } + const dragItem = lastDraggingEvent.dragItem; + if (!dragItem) { + return; + } + dragItem.containerType = this.pinned; + } + handleColumnDragWhileSuppressingMovement(draggingEvent, fromEnter, fakeEvent, mouseX, finished) { + const allMovingColumns = this.getAllMovingColumns(draggingEvent, true); + if (finished) { + const isAttemptingToPin = this.isAttemptingToPin(allMovingColumns); + if (isAttemptingToPin) { + this.attemptToPinColumns(allMovingColumns, undefined, true); + } + const { fromLeft, xPosition } = this.getNormalisedXPositionInfo(allMovingColumns, isAttemptingToPin) || {}; + if (fromLeft == null || xPosition == null) { + this.finishColumnMoving(); + return; + } + this.moveColumnsAfterHighlight({ + allMovingColumns, + xPosition, + fromEnter, + fakeEvent, + fromLeft + }); + } else { + if (!this.beans.dragAndDrop.isDropZoneWithinThisGrid(draggingEvent)) { + return; + } + this.highlightHoveredColumn(allMovingColumns, mouseX); + } + } + handleColumnDragWhileAllowingMovement(draggingEvent, fromEnter, fakeEvent, mouseX, finished) { + const allMovingColumns = this.getAllMovingColumns(draggingEvent); + const fromLeft = this.normaliseDirection(draggingEvent.hDirection) === "right"; + const isFromHeader = draggingEvent.dragSource.type === 1; + const params = this.getMoveColumnParams({ + allMovingColumns, + isFromHeader, + xPosition: mouseX, + fromLeft, + fromEnter, + fakeEvent + }); + const lastMovedInfo = attemptMoveColumns({ ...params, finished }); + if (lastMovedInfo) { + this.lastMovedInfo = lastMovedInfo; + } + } + getAllMovingColumns(draggingEvent, useSplit = false) { + const dragItem = draggingEvent.dragSource.getDragItem(); + let columns = null; + if (useSplit) { + columns = dragItem.columnsInSplit; + if (!columns) { + columns = dragItem.columns; + } + } else { + columns = dragItem.columns; + } + const conditionCallback = (col) => col.getColDef().lockPinned ? col.getPinned() == this.pinned : true; + if (!columns) { + return []; + } + return columns.filter(conditionCallback); + } + getMoveColumnParams(params) { + const { allMovingColumns, isFromHeader, xPosition, fromLeft, fromEnter, fakeEvent } = params; + const { gos, colModel, colMoves, visibleCols } = this.beans; + return { + allMovingColumns, + isFromHeader, + fromLeft, + xPosition, + pinned: this.pinned, + fromEnter, + fakeEvent, + gos, + colModel, + colMoves, + visibleCols + }; + } + highlightHoveredColumn(movingColumns, mouseX) { + const { gos, colModel } = this.beans; + const isRtl = gos.get("enableRtl"); + const consideredColumns = colModel.getCols().filter((col) => col.isVisible() && col.getPinned() === this.pinned); + let start = null; + let width = null; + let targetColumn = null; + for (const col of consideredColumns) { + width = col.getActualWidth(); + start = this.getNormalisedColumnLeft(col, 0, isRtl); + if (start != null) { + const end = start + width; + if (start <= mouseX && end >= mouseX) { + targetColumn = col; + break; + } + } + start = null; + width = null; + } + if (!targetColumn) { + for (let i = consideredColumns.length - 1;i >= 0; i--) { + const currentColumn = consideredColumns[i]; + const parent = consideredColumns[i].getParent(); + if (!parent) { + targetColumn = currentColumn; + break; + } + const leafDisplayedCols = parent?.getDisplayedLeafColumns(); + if (leafDisplayedCols.length) { + targetColumn = _last(leafDisplayedCols); + break; + } + } + if (!targetColumn) { + return; + } + start = this.getNormalisedColumnLeft(targetColumn, 0, isRtl); + width = targetColumn.getActualWidth(); + } else if (movingColumns.indexOf(targetColumn) !== -1) { + targetColumn = null; + } + if (targetColumn == null || start == null || width == null) { + if (this.lastHighlightedColumn?.column !== targetColumn) { + this.clearHighlighted(); + } + return; + } + let position; + if (mouseX - start < width / 2) { + const targetIndex = consideredColumns.indexOf(targetColumn); + if (targetIndex === 0) { + position = 0; + } else { + position = 1; + targetColumn = consideredColumns[targetIndex - 1]; + } + } else { + position = 1; + } + if (this.lastHighlightedColumn?.column !== targetColumn || this.lastHighlightedColumn?.position !== position) { + this.clearHighlighted(); + } + setColumnHighlighted(targetColumn, position); + this.lastHighlightedColumn = { column: targetColumn, position }; + } + getNormalisedXPositionInfo(allMovingColumns, isAttemptingToPin) { + const { gos, visibleCols } = this.beans; + const isRtl = gos.get("enableRtl"); + const { firstMovingCol, column, position } = this.getColumnMoveAndTargetInfo(allMovingColumns, isAttemptingToPin, isRtl); + if (!firstMovingCol || !column || position == null) { + return; + } + const visibleColumns = visibleCols.allCols; + const movingColIndex = visibleColumns.indexOf(firstMovingCol); + const targetIndex = visibleColumns.indexOf(column); + const isBefore = position === 0; + const fromLeft = movingColIndex < targetIndex || movingColIndex === targetIndex && !isBefore; + let diff = 0; + if (isBefore) { + if (fromLeft) { + diff -= 1; + } + } else if (!fromLeft) { + diff += 1; + } + if (targetIndex + diff === movingColIndex) { + return; + } + const targetColumn = visibleColumns[targetIndex + diff]; + if (!targetColumn) { + return; + } + const xPosition = this.getNormalisedColumnLeft(targetColumn, 20, isRtl); + return { fromLeft, xPosition }; + } + getColumnMoveAndTargetInfo(allMovingColumns, isAttemptingToPin, isRtl) { + const lastHighlightedColumn = this.lastHighlightedColumn || {}; + const { firstMovingCol, lastMovingCol } = findFirstAndLastMovingColumns(allMovingColumns); + if (!firstMovingCol || !lastMovingCol || lastHighlightedColumn.column || !isAttemptingToPin) { + return { + firstMovingCol, + ...lastHighlightedColumn + }; + } + const pinned = this.getPinDirection(); + const isLeft = pinned === "left"; + return { + firstMovingCol, + position: isLeft ? 1 : 0, + column: isLeft !== isRtl ? firstMovingCol : lastMovingCol + }; + } + normaliseDirection(hDirection) { + if (this.gos.get("enableRtl")) { + switch (hDirection) { + case "left": + return "right"; + case "right": + return "left"; + } + } + return hDirection; + } + getNormalisedColumnLeft(col, padding, isRtl) { + const { gos, ctrlsSvc } = this.beans; + const left = col.getLeft(); + if (left == null) { + return null; + } + const width = col.getActualWidth(); + return normaliseX({ + x: isRtl ? left + width - padding : left + padding, + pinned: col.getPinned(), + useHeaderRow: isRtl, + skipScrollPadding: true, + gos, + ctrlsSvc + }); + } + isAttemptingToPin(columns) { + const isMovingHorizontally = this.needToMoveLeft || this.needToMoveRight; + const isFailedMoreThanThreshold = this.failedMoveAttempts > MOVE_FAIL_THRESHOLD; + return isMovingHorizontally && isFailedMoreThanThreshold || columns.some((col) => col.getPinned() !== this.pinned); + } + moveColumnsAfterHighlight(params) { + const { allMovingColumns, xPosition, fromEnter, fakeEvent, fromLeft } = params; + const columnMoveParams = this.getMoveColumnParams({ + allMovingColumns, + isFromHeader: true, + xPosition, + fromLeft, + fromEnter, + fakeEvent + }); + const { columns, toIndex } = getBestColumnMoveIndexFromXPosition(columnMoveParams) || {}; + if (columns && toIndex != null) { + this.lastMovedInfo = { + columns, + toIndex + }; + } + this.finishColumnMoving(); + } + clearHighlighted() { + const { lastHighlightedColumn } = this; + if (!lastHighlightedColumn) { + return; + } + setColumnHighlighted(lastHighlightedColumn.column, null); + this.lastHighlightedColumn = null; + } + checkCenterForScrolling(xAdjustedForScroll) { + if (!this.isCenterContainer) { + return; + } + const centerCtrl = this.beans.ctrlsSvc.get("center"); + const firstVisiblePixel = centerCtrl.getCenterViewportScrollLeft(); + const lastVisiblePixel = firstVisiblePixel + centerCtrl.getCenterWidth(); + let needToMoveRight; + let needToMoveLeft; + if (this.gos.get("enableRtl")) { + needToMoveRight = xAdjustedForScroll < firstVisiblePixel + SCROLL_GAP_NEEDED_BEFORE_MOVE; + needToMoveLeft = xAdjustedForScroll > lastVisiblePixel - SCROLL_GAP_NEEDED_BEFORE_MOVE; + } else { + needToMoveLeft = xAdjustedForScroll < firstVisiblePixel + SCROLL_GAP_NEEDED_BEFORE_MOVE; + needToMoveRight = xAdjustedForScroll > lastVisiblePixel - SCROLL_GAP_NEEDED_BEFORE_MOVE; + } + this.needToMoveRight = needToMoveRight; + this.needToMoveLeft = needToMoveLeft; + if (needToMoveLeft || needToMoveRight) { + this.ensureIntervalStarted(); + } else { + this.ensureIntervalCleared(); + } + } + ensureIntervalStarted() { + if (this.movingIntervalId) { + return; + } + this.intervalCount = 0; + this.failedMoveAttempts = 0; + this.movingIntervalId = window.setInterval(this.moveInterval.bind(this), SCROLL_TIME_INTERVAL); + this.beans.dragAndDrop.setDragImageCompIcon(this.needToMoveLeft ? "left" : "right", true); + } + ensureIntervalCleared() { + if (!this.movingIntervalId) { + return; + } + window.clearInterval(this.movingIntervalId); + this.movingIntervalId = null; + this.failedMoveAttempts = 0; + this.beans.dragAndDrop.setDragImageCompIcon(this.getIconName()); + } + moveInterval() { + let pixelsToMove; + this.intervalCount++; + pixelsToMove = 10 + this.intervalCount * SCROLL_ACCELERATION_RATE; + if (pixelsToMove > SCROLL_MOVE_WIDTH) { + pixelsToMove = SCROLL_MOVE_WIDTH; + } + let pixelsMoved = null; + const scrollFeature = this.gridBodyCon.scrollFeature; + if (this.needToMoveLeft) { + pixelsMoved = scrollFeature.scrollHorizontally(-pixelsToMove); + } else if (this.needToMoveRight) { + pixelsMoved = scrollFeature.scrollHorizontally(pixelsToMove); + } + if (pixelsMoved !== 0) { + this.onDragging(this.lastDraggingEvent); + this.failedMoveAttempts = 0; + } else { + this.failedMoveAttempts++; + const { pinnedCols, dragAndDrop, gos } = this.beans; + if (this.failedMoveAttempts <= MOVE_FAIL_THRESHOLD + 1 || !pinnedCols) { + return; + } + dragAndDrop.setDragImageCompIcon("pinned"); + if (!gos.get("suppressMoveWhenColumnDragging")) { + const columns = this.lastDraggingEvent?.dragItem.columns; + this.attemptToPinColumns(columns, undefined, true); + } + } + } + getPinDirection() { + if (this.needToMoveLeft || this.pinned === "left") { + return "left"; + } + if (this.needToMoveRight || this.pinned === "right") { + return "right"; + } + } + attemptToPinColumns(columns, pinned, fromMoving = false) { + const allowedCols = (columns || []).filter((c) => !c.getColDef().lockPinned); + if (!allowedCols.length) { + return 0; + } + if (fromMoving) { + pinned = this.getPinDirection(); + } + const { pinnedCols, dragAndDrop } = this.beans; + pinnedCols?.setColsPinned(allowedCols, pinned, "uiColumnDragged"); + if (fromMoving) { + dragAndDrop.nudge(); + } + return allowedCols.length; + } + destroy() { + super.destroy(); + this.lastDraggingEvent = null; + this.clearHighlighted(); + this.lastMovedInfo = null; + } +}; +function setColumnHighlighted(column, highlighted) { + if (column.highlighted === highlighted) { + return; + } + column.highlighted = highlighted; + column.dispatchColEvent("headerHighlightChanged", "uiColumnMoved"); +} +function findFirstAndLastMovingColumns(allMovingColumns) { + const moveLen = allMovingColumns.length; + let firstMovingCol; + let lastMovingCol; + for (let i = 0;i < moveLen; i++) { + if (!firstMovingCol) { + const leftCol = allMovingColumns[i]; + if (leftCol.getLeft() != null) { + firstMovingCol = leftCol; + } + } + if (!lastMovingCol) { + const rightCol = allMovingColumns[moveLen - 1 - i]; + if (rightCol.getLeft() != null) { + lastMovingCol = rightCol; + } + } + if (firstMovingCol && lastMovingCol) { + break; + } + } + return { firstMovingCol, lastMovingCol }; +} +var BodyDropTarget = class extends BeanStub { + constructor(pinned, eContainer) { + super(); + this.pinned = pinned; + this.eContainer = eContainer; + } + postConstruct() { + const { ctrlsSvc, dragAndDrop } = this.beans; + const pinned = this.pinned; + ctrlsSvc.whenReady(this, (p) => { + let eSecondaryContainers; + const eBodyViewport = p.gridBodyCtrl.eBodyViewport; + switch (pinned) { + case "left": + eSecondaryContainers = [ + [eBodyViewport, p.left.eContainer], + [p.bottomLeft.eContainer], + [p.topLeft.eContainer] + ]; + break; + case "right": + eSecondaryContainers = [ + [eBodyViewport, p.right.eContainer], + [p.bottomRight.eContainer], + [p.topRight.eContainer] + ]; + break; + default: + eSecondaryContainers = [ + [eBodyViewport, p.center.eViewport], + [p.bottomCenter.eViewport], + [p.topCenter.eViewport] + ]; + break; + } + this.eSecondaryContainers = eSecondaryContainers; + }); + this.moveColumnFeature = this.createManagedBean(new MoveColumnFeature(pinned)); + this.bodyDropPivotTarget = this.createManagedBean(new BodyDropPivotTarget(pinned)); + dragAndDrop.addDropTarget(this); + this.addDestroyFunc(() => dragAndDrop.removeDropTarget(this)); + } + isInterestedIn(type) { + return type === 1 || type === 0 && this.gos.get("allowDragFromColumnsToolPanel"); + } + getSecondaryContainers() { + return this.eSecondaryContainers; + } + getContainer() { + return this.eContainer; + } + getIconName() { + return this.currentDropListener.getIconName(); + } + isDropColumnInPivotMode(draggingEvent) { + return this.beans.colModel.isPivotMode() && draggingEvent.dragSource.type === 0; + } + onDragEnter(draggingEvent) { + this.currentDropListener = this.isDropColumnInPivotMode(draggingEvent) ? this.bodyDropPivotTarget : this.moveColumnFeature; + this.currentDropListener.onDragEnter(draggingEvent); + } + onDragLeave(params) { + this.currentDropListener.onDragLeave(params); + } + onDragging(params) { + this.currentDropListener.onDragging(params); + } + onDragStop(params) { + this.currentDropListener.onDragStop(params); + } + onDragCancel() { + this.currentDropListener.onDragCancel(); + } +}; +function placeLockedColumns(cols, gos) { + const left = []; + const normal = []; + const right = []; + cols.forEach((col) => { + const position = col.getColDef().lockPosition; + if (position === "right") { + right.push(col); + } else if (position === "left" || position === true) { + left.push(col); + } else { + normal.push(col); + } + }); + const isRtl = gos.get("enableRtl"); + if (isRtl) { + return [...right, ...normal, ...left]; + } + return [...left, ...normal, ...right]; +} +function doesMovePassMarryChildren(allColumnsCopy, gridBalancedTree) { + let rulePassed = true; + depthFirstOriginalTreeSearch(null, gridBalancedTree, (child) => { + if (!isProvidedColumnGroup(child)) { + return; + } + const columnGroup = child; + const colGroupDef = columnGroup.getColGroupDef(); + const marryChildren = colGroupDef?.marryChildren; + if (!marryChildren) { + return; + } + const newIndexes = []; + for (const col of columnGroup.getLeafColumns()) { + const newColIndex = allColumnsCopy.indexOf(col); + newIndexes.push(newColIndex); + } + const maxIndex = Math.max.apply(Math, newIndexes); + const minIndex = Math.min.apply(Math, newIndexes); + const spread = maxIndex - minIndex; + const maxSpread = columnGroup.getLeafColumns().length - 1; + if (spread > maxSpread) { + rulePassed = false; + } + }); + return rulePassed; +} +var ColumnMoveService = class extends BeanStub { + constructor() { + super(...arguments); + this.beanName = "colMoves"; + } + moveColumnByIndex(fromIndex, toIndex, source) { + const gridColumns = this.beans.colModel.getCols(); + if (!gridColumns) { + return; + } + const column = gridColumns[fromIndex]; + this.moveColumns([column], toIndex, source); + } + moveColumns(columnsToMoveKeys, toIndex, source, finished = true) { + const { colModel, colAnimation, visibleCols, eventSvc } = this.beans; + const gridColumns = colModel.getCols(); + if (!gridColumns) { + return; + } + if (toIndex > gridColumns.length - columnsToMoveKeys.length) { + _warn(30, { toIndex }); + return; + } + colAnimation?.start(); + const movedColumns = colModel.getColsForKeys(columnsToMoveKeys); + if (this.doesMovePassRules(movedColumns, toIndex)) { + _moveInArray(colModel.getCols(), movedColumns, toIndex); + visibleCols.refresh(source); + eventSvc.dispatchEvent({ + type: "columnMoved", + columns: movedColumns, + column: movedColumns.length === 1 ? movedColumns[0] : null, + toIndex, + finished, + source + }); + } + colAnimation?.finish(); + } + doesMovePassRules(columnsToMove, toIndex) { + const proposedColumnOrder = this.getProposedColumnOrder(columnsToMove, toIndex); + return this.doesOrderPassRules(proposedColumnOrder); + } + doesOrderPassRules(gridOrder) { + const { colModel, gos } = this.beans; + if (!doesMovePassMarryChildren(gridOrder, colModel.getColTree())) { + return false; + } + const doesMovePassLockedPositions = (proposedColumnOrder) => { + const lockPositionToPlacement = (position) => { + if (!position) { + return 0; + } + return position === "left" || position === true ? -1 : 1; + }; + const isRtl = gos.get("enableRtl"); + let lastPlacement = isRtl ? 1 : -1; + let rulePassed = true; + for (const col of proposedColumnOrder) { + const placement = lockPositionToPlacement(col.getColDef().lockPosition); + if (isRtl) { + if (placement > lastPlacement) { + rulePassed = false; + } + } else if (placement < lastPlacement) { + rulePassed = false; + } + lastPlacement = placement; + } + return rulePassed; + }; + if (!doesMovePassLockedPositions(gridOrder)) { + return false; + } + return true; + } + getProposedColumnOrder(columnsToMove, toIndex) { + const gridColumns = this.beans.colModel.getCols(); + const proposedColumnOrder = gridColumns.slice(); + _moveInArray(proposedColumnOrder, columnsToMove, toIndex); + return proposedColumnOrder; + } + createBodyDropTarget(pinned, dropContainer) { + return new BodyDropTarget(pinned, dropContainer); + } + moveHeader(hDirection, eGui, column, pinned, bean) { + const { ctrlsSvc, gos, colModel, visibleCols, focusSvc } = this.beans; + const rect = eGui.getBoundingClientRect(); + const left = rect.left; + const isGroup = isColumnGroup(column); + const width = isGroup ? rect.width : column.getActualWidth(); + const isLeft = hDirection === "left" !== gos.get("enableRtl"); + const xPosition = normaliseX({ + x: isLeft ? left - 20 : left + width + 20, + pinned, + fromKeyboard: true, + gos, + ctrlsSvc + }); + const headerPosition = focusSvc.focusedHeader; + attemptMoveColumns({ + allMovingColumns: isGroup ? column.getLeafColumns() : [column], + isFromHeader: true, + fromLeft: hDirection === "right", + xPosition, + pinned, + fromEnter: false, + fakeEvent: false, + gos, + colModel, + colMoves: this, + visibleCols, + finished: true + }); + let targetColumn; + if (isGroup) { + const displayedLeafColumns = column.getDisplayedLeafColumns(); + targetColumn = isLeft ? displayedLeafColumns[0] : _last(displayedLeafColumns); + } else { + targetColumn = column; + } + ctrlsSvc.getScrollFeature().ensureColumnVisible(targetColumn, "auto"); + if ((!bean.isAlive() || gos.get("ensureDomOrder")) && headerPosition) { + let restoreFocusColumn; + if (isGroup) { + const groupId = column.getGroupId(); + const leafCols = column.getLeafColumns(); + if (!leafCols.length) { + return; + } + const parent = leafCols[0].getParent(); + if (!parent) { + return; + } + restoreFocusColumn = findGroupWidthId(parent, groupId); + } else { + restoreFocusColumn = column; + } + if (restoreFocusColumn) { + focusSvc.focusHeaderPosition({ + headerPosition: { + ...headerPosition, + column: restoreFocusColumn + } + }); + } + } + } + setDragSourceForHeader(eSource, column, displayName) { + const { gos, colModel, dragAndDrop, visibleCols } = this.beans; + let hideColumnOnExit = !gos.get("suppressDragLeaveHidesColumns"); + const isGroup = isColumnGroup(column); + const columns = isGroup ? column.getProvidedColumnGroup().getLeafColumns() : [column]; + const getDragItem = isGroup ? () => createDragItemForGroup(column, visibleCols.allCols) : () => createDragItem(column); + const dragSource = { + type: 1, + eElement: eSource, + getDefaultIconName: () => hideColumnOnExit ? "hide" : "notAllowed", + getDragItem, + dragItemName: displayName, + onDragStarted: () => { + hideColumnOnExit = !gos.get("suppressDragLeaveHidesColumns"); + setColumnsMoving(columns, true); + }, + onDragStopped: () => setColumnsMoving(columns, false), + onDragCancelled: () => setColumnsMoving(columns, false), + onGridEnter: (dragItem) => { + if (hideColumnOnExit) { + const { columns: columns2 = [], visibleState } = dragItem ?? {}; + const hasVisibleState = isGroup ? (col) => !visibleState || visibleState[col.getColId()] : () => true; + const unlockedColumns = columns2.filter((col) => !col.getColDef().lockVisible && hasVisibleState(col)); + colModel.setColsVisible(unlockedColumns, true, "uiColumnMoved"); + } + }, + onGridExit: (dragItem) => { + if (hideColumnOnExit) { + const unlockedColumns = dragItem?.columns?.filter((col) => !col.getColDef().lockVisible) || []; + colModel.setColsVisible(unlockedColumns, false, "uiColumnMoved"); + } + } + }; + dragAndDrop.addDragSource(dragSource, true); + return dragSource; + } +}; +function findGroupWidthId(columnGroup, id) { + while (columnGroup) { + if (columnGroup.getGroupId() === id) { + return columnGroup; + } + columnGroup = columnGroup.getParent(); + } + return; +} +function createDragItem(column) { + const visibleState = {}; + visibleState[column.getId()] = column.isVisible(); + return { + columns: [column], + visibleState, + containerType: column.pinned + }; +} +function createDragItemForGroup(columnGroup, allCols) { + const allColumnsOriginalOrder = columnGroup.getProvidedColumnGroup().getLeafColumns(); + const visibleState = {}; + for (const column of allColumnsOriginalOrder) { + visibleState[column.getId()] = column.isVisible(); + } + const allColumnsCurrentOrder = []; + for (const column of allCols) { + if (allColumnsOriginalOrder.indexOf(column) >= 0) { + allColumnsCurrentOrder.push(column); + _removeFromArray(allColumnsOriginalOrder, column); + } + } + for (const column of allColumnsOriginalOrder) { + allColumnsCurrentOrder.push(column); + } + const columnsInSplit = []; + const columnGroupColumns = columnGroup.getLeafColumns(); + for (const col of allColumnsCurrentOrder) { + if (columnGroupColumns.indexOf(col) !== -1) { + columnsInSplit.push(col); + } + } + return { + columns: allColumnsCurrentOrder, + columnsInSplit, + visibleState, + containerType: columnsInSplit[0]?.pinned + }; +} +var ColumnMoveModule = { + moduleName: "ColumnMove", + version: VERSION, + beans: [ColumnMoveService, ColumnAnimationService], + apiFunctions: { + moveColumnByIndex, + moveColumns + }, + dependsOn: [SharedDragAndDropModule], + css: [column_moving_default] +}; +var AutoWidthCalculator = class extends BeanStub { + constructor() { + super(...arguments); + this.beanName = "autoWidthCalc"; + } + postConstruct() { + this.beans.ctrlsSvc.whenReady(this, (p) => { + this.centerRowContainerCtrl = p.center; + }); + } + getPreferredWidthForColumn(column, skipHeader) { + const eHeaderCell = this.getHeaderCellForColumn(column); + if (!eHeaderCell) { + return -1; + } + const elements = this.beans.rowRenderer.getAllCellsNotSpanningForColumn(column); + if (!skipHeader) { + elements.push(eHeaderCell); + } + return this.getPreferredWidthForElements(elements); + } + getPreferredWidthForColumnGroup(columnGroup) { + const eHeaderCell = this.getHeaderCellForColumn(columnGroup); + if (!eHeaderCell) { + return -1; + } + return this.getPreferredWidthForElements([eHeaderCell]); + } + getPreferredWidthForElements(elements, extraPadding) { + const eDummyContainer = document.createElement("form"); + eDummyContainer.style.position = "fixed"; + const eBodyContainer = this.centerRowContainerCtrl.eContainer; + for (const el of elements) { + this.cloneItemIntoDummy(el, eDummyContainer); + } + eBodyContainer.appendChild(eDummyContainer); + const dummyContainerWidth = Math.ceil(eDummyContainer.getBoundingClientRect().width); + eDummyContainer.remove(); + extraPadding = extraPadding ?? this.gos.get("autoSizePadding"); + return dummyContainerWidth + extraPadding; + } + getHeaderCellForColumn(column) { + let element = null; + for (const container of this.beans.ctrlsSvc.getHeaderRowContainerCtrls()) { + const res = container.getHtmlElementForColumnHeader(column); + if (res != null) { + element = res; + } + } + return element; + } + cloneItemIntoDummy(eCell, eDummyContainer) { + const eCellClone = eCell.cloneNode(true); + eCellClone.style.width = ""; + eCellClone.style.position = "static"; + eCellClone.style.left = ""; + const eCloneParent = document.createElement("div"); + const eCloneParentClassList = eCloneParent.classList; + const isHeader = ["ag-header-cell", "ag-header-group-cell"].some((cls) => eCellClone.classList.contains(cls)); + if (isHeader) { + eCloneParentClassList.add("ag-header", "ag-header-row"); + eCloneParent.style.position = "static"; + } else { + eCloneParentClassList.add("ag-row"); + } + let pointer = eCell.parentElement; + while (pointer) { + const isRow = ["ag-header-row", "ag-row"].some((cls) => pointer.classList.contains(cls)); + if (isRow) { + for (let i = 0;i < pointer.classList.length; i++) { + const item = pointer.classList[i]; + if (item != "ag-row-position-absolute") { + eCloneParentClassList.add(item); + } + } + break; + } + pointer = pointer.parentElement; + } + eCloneParent.appendChild(eCellClone); + eDummyContainer.appendChild(eCloneParent); + } +}; +var AutoWidthModule = { + moduleName: "AutoWidth", + version: VERSION, + beans: [AutoWidthCalculator] +}; +function setColumnWidths(beans, columnWidths, finished = true, source = "api") { + beans.colResize?.setColumnWidths(columnWidths, false, finished, source); +} +function getCommonValue(cols, valueGetter) { + if (!cols || cols.length == 0) { + return; + } + const firstValue = valueGetter(cols[0]); + for (let i = 1;i < cols.length; i++) { + if (firstValue !== valueGetter(cols[i])) { + return; + } + } + return firstValue; +} +function dispatchColumnPinnedEvent(eventSvc, changedColumns, source) { + if (!changedColumns.length) { + return; + } + const column = changedColumns.length === 1 ? changedColumns[0] : null; + const pinned = getCommonValue(changedColumns, (col) => col.getPinned()); + eventSvc.dispatchEvent({ + type: "columnPinned", + pinned: pinned != null ? pinned : null, + columns: changedColumns, + column, + source + }); +} +function dispatchColumnVisibleEvent(eventSvc, changedColumns, source) { + if (!changedColumns.length) { + return; + } + const column = changedColumns.length === 1 ? changedColumns[0] : null; + const visible = getCommonValue(changedColumns, (col) => col.isVisible()); + eventSvc.dispatchEvent({ + type: "columnVisible", + visible, + columns: changedColumns, + column, + source + }); +} +function dispatchColumnChangedEvent(eventSvc, type, columns, source) { + eventSvc.dispatchEvent({ + type, + columns, + column: columns && columns.length == 1 ? columns[0] : null, + source + }); +} +function dispatchColumnResizedEvent(eventSvc, columns, finished, source, flexColumns = null) { + if (columns?.length) { + eventSvc.dispatchEvent({ + type: "columnResized", + columns, + column: columns.length === 1 ? columns[0] : null, + flexColumns, + finished, + source + }); + } +} +var GroupResizeFeature = class extends BeanStub { + constructor(comp, eResize, pinned, columnGroup) { + super(); + this.comp = comp; + this.eResize = eResize; + this.pinned = pinned; + this.columnGroup = columnGroup; + } + postConstruct() { + if (!this.columnGroup.isResizable()) { + this.comp.setResizableDisplayed(false); + return; + } + const { horizontalResizeSvc, gos, colAutosize } = this.beans; + const finishedWithResizeFunc = horizontalResizeSvc.addResizeBar({ + eResizeBar: this.eResize, + onResizeStart: this.onResizeStart.bind(this), + onResizing: this.onResizing.bind(this, false), + onResizeEnd: this.onResizing.bind(this, true) + }); + this.addDestroyFunc(finishedWithResizeFunc); + if (!gos.get("suppressAutoSize") && colAutosize) { + this.addDestroyFunc(colAutosize.addColumnGroupResize(this.eResize, this.columnGroup, () => this.resizeLeafColumnsToFit("uiColumnResized"))); + } + } + onResizeStart(shiftKey) { + const { + columnsToResize, + resizeStartWidth, + resizeRatios, + groupAfterColumns, + groupAfterStartWidth, + groupAfterRatios + } = this.getInitialValues(shiftKey); + this.resizeCols = columnsToResize; + this.resizeStartWidth = resizeStartWidth; + this.resizeRatios = resizeRatios; + this.resizeTakeFromCols = groupAfterColumns; + this.resizeTakeFromStartWidth = groupAfterStartWidth; + this.resizeTakeFromRatios = groupAfterRatios; + this.toggleColumnResizing(true); + } + onResizing(finished, resizeAmount, source = "uiColumnResized") { + const resizeAmountNormalised = this.normaliseDragChange(resizeAmount); + const width = this.resizeStartWidth + resizeAmountNormalised; + this.resizeColumnsFromLocalValues(width, source, finished); + } + getInitialValues(shiftKey) { + const getInitialSizeOfColumns = (columns) => columns.reduce((totalWidth, column) => totalWidth + column.getActualWidth(), 0); + const getSizeRatiosOfColumns = (columns, initialSizeOfColumns) => columns.map((column) => column.getActualWidth() / initialSizeOfColumns); + const columnsToResize = this.getColumnsToResize(); + const resizeStartWidth = getInitialSizeOfColumns(columnsToResize); + const resizeRatios = getSizeRatiosOfColumns(columnsToResize, resizeStartWidth); + const columnSizeAndRatios = { + columnsToResize, + resizeStartWidth, + resizeRatios + }; + let groupAfter = null; + if (shiftKey) { + groupAfter = this.beans.colGroupSvc?.getGroupAtDirection(this.columnGroup, "After") ?? null; + } + if (groupAfter) { + const takeFromLeafCols = groupAfter.getDisplayedLeafColumns(); + const groupAfterColumns = columnSizeAndRatios.groupAfterColumns = takeFromLeafCols.filter((col) => col.isResizable()); + const groupAfterStartWidth = columnSizeAndRatios.groupAfterStartWidth = getInitialSizeOfColumns(groupAfterColumns); + columnSizeAndRatios.groupAfterRatios = getSizeRatiosOfColumns(groupAfterColumns, groupAfterStartWidth); + } else { + columnSizeAndRatios.groupAfterColumns = undefined; + columnSizeAndRatios.groupAfterStartWidth = undefined; + columnSizeAndRatios.groupAfterRatios = undefined; + } + return columnSizeAndRatios; + } + resizeLeafColumnsToFit(source) { + const preferredSize = this.beans.autoWidthCalc.getPreferredWidthForColumnGroup(this.columnGroup); + const initialValues = this.getInitialValues(); + if (preferredSize > initialValues.resizeStartWidth) { + this.resizeColumns(initialValues, preferredSize, source, true); + } + } + resizeColumnsFromLocalValues(totalWidth, source, finished = true) { + if (!this.resizeCols || !this.resizeRatios) { + return; + } + const initialValues = { + columnsToResize: this.resizeCols, + resizeStartWidth: this.resizeStartWidth, + resizeRatios: this.resizeRatios, + groupAfterColumns: this.resizeTakeFromCols, + groupAfterStartWidth: this.resizeTakeFromStartWidth, + groupAfterRatios: this.resizeTakeFromRatios + }; + this.resizeColumns(initialValues, totalWidth, source, finished); + } + resizeColumns(initialValues, totalWidth, source, finished = true) { + const { + columnsToResize, + resizeStartWidth, + resizeRatios, + groupAfterColumns, + groupAfterStartWidth, + groupAfterRatios + } = initialValues; + const resizeSets = []; + resizeSets.push({ + columns: columnsToResize, + ratios: resizeRatios, + width: totalWidth + }); + if (groupAfterColumns) { + const diff = totalWidth - resizeStartWidth; + resizeSets.push({ + columns: groupAfterColumns, + ratios: groupAfterRatios, + width: groupAfterStartWidth - diff + }); + } + this.beans.colResize?.resizeColumnSets({ + resizeSets, + finished, + source + }); + if (finished) { + this.toggleColumnResizing(false); + } + } + toggleColumnResizing(resizing) { + this.comp.toggleCss("ag-column-resizing", resizing); + } + getColumnsToResize() { + const leafCols = this.columnGroup.getDisplayedLeafColumns(); + return leafCols.filter((col) => col.isResizable()); + } + normaliseDragChange(dragChange) { + let result = dragChange; + if (this.gos.get("enableRtl")) { + if (this.pinned !== "left") { + result *= -1; + } + } else if (this.pinned === "right") { + result *= -1; + } + return result; + } + destroy() { + super.destroy(); + this.resizeCols = undefined; + this.resizeRatios = undefined; + this.resizeTakeFromCols = undefined; + this.resizeTakeFromRatios = undefined; + } +}; +var ResizeFeature = class extends BeanStub { + constructor(pinned, column, eResize, comp, ctrl) { + super(); + this.pinned = pinned; + this.column = column; + this.eResize = eResize; + this.comp = comp; + this.ctrl = ctrl; + } + postConstruct() { + const destroyResizeFuncs = []; + let canResize; + let canAutosize; + const addResize = () => { + _setDisplayed(this.eResize, canResize); + if (!canResize) { + return; + } + const { horizontalResizeSvc, colAutosize } = this.beans; + const finishedWithResizeFunc = horizontalResizeSvc.addResizeBar({ + eResizeBar: this.eResize, + onResizeStart: this.onResizeStart.bind(this), + onResizing: this.onResizing.bind(this, false), + onResizeEnd: this.onResizing.bind(this, true) + }); + destroyResizeFuncs.push(finishedWithResizeFunc); + if (canAutosize && colAutosize) { + destroyResizeFuncs.push(colAutosize.addColumnAutosizeListeners(this.eResize, this.column)); + } + }; + const removeResize = () => { + for (const f of destroyResizeFuncs) { + f(); + } + destroyResizeFuncs.length = 0; + }; + const refresh = () => { + const resize = this.column.isResizable(); + const autoSize = !this.gos.get("suppressAutoSize") && !this.column.getColDef().suppressAutoSize; + const propertyChange = resize !== canResize || autoSize !== canAutosize; + if (propertyChange) { + canResize = resize; + canAutosize = autoSize; + removeResize(); + addResize(); + } + }; + refresh(); + this.addDestroyFunc(removeResize); + this.ctrl.setRefreshFunction("resize", refresh); + } + onResizing(finished, resizeAmount) { + const { column: key, lastResizeAmount, resizeStartWidth, beans } = this; + const resizeAmountNormalised = this.normaliseResizeAmount(resizeAmount); + const newWidth = resizeStartWidth + resizeAmountNormalised; + const columnWidths = [{ key, newWidth }]; + const { pinnedCols, ctrlsSvc, colResize } = beans; + if (this.column.getPinned()) { + const leftWidth = pinnedCols?.leftWidth ?? 0; + const rightWidth = pinnedCols?.rightWidth ?? 0; + const bodyWidth = _getInnerWidth(ctrlsSvc.getGridBodyCtrl().eBodyViewport) - 50; + if (leftWidth + rightWidth + (resizeAmountNormalised - lastResizeAmount) > bodyWidth) { + return; + } + } + this.lastResizeAmount = resizeAmountNormalised; + colResize?.setColumnWidths(columnWidths, this.resizeWithShiftKey, finished, "uiColumnResized"); + if (finished) { + this.toggleColumnResizing(false); + } + } + onResizeStart(shiftKey) { + this.resizeStartWidth = this.column.getActualWidth(); + this.lastResizeAmount = 0; + this.resizeWithShiftKey = shiftKey; + this.toggleColumnResizing(true); + } + toggleColumnResizing(resizing) { + this.column.resizing = resizing; + this.comp.toggleCss("ag-column-resizing", resizing); + } + normaliseResizeAmount(dragChange) { + let result = dragChange; + const notPinningLeft = this.pinned !== "left"; + const pinningRight = this.pinned === "right"; + if (this.gos.get("enableRtl")) { + if (notPinningLeft) { + result *= -1; + } + } else if (pinningRight) { + result *= -1; + } + return result; + } +}; +var ColumnResizeService = class extends BeanStub { + constructor() { + super(...arguments); + this.beanName = "colResize"; + } + setColumnWidths(columnWidths, shiftKey, finished, source) { + const sets = []; + const { colModel, gos, visibleCols } = this.beans; + for (const columnWidth of columnWidths) { + const col = colModel.getColDefCol(columnWidth.key) || colModel.getCol(columnWidth.key); + if (!col) { + continue; + } + sets.push({ + width: columnWidth.newWidth, + ratios: [1], + columns: [col] + }); + const defaultIsShift = gos.get("colResizeDefault") === "shift"; + if (defaultIsShift) { + shiftKey = !shiftKey; + } + if (shiftKey) { + const otherCol = visibleCols.getColAfter(col); + if (!otherCol) { + continue; + } + const widthDiff = col.getActualWidth() - columnWidth.newWidth; + const otherColWidth = otherCol.getActualWidth() + widthDiff; + sets.push({ + width: otherColWidth, + ratios: [1], + columns: [otherCol] + }); + } + } + if (sets.length === 0) { + return; + } + this.resizeColumnSets({ + resizeSets: sets, + finished, + source + }); + } + resizeColumnSets(params) { + const { resizeSets, finished, source } = params; + const passMinMaxCheck = !resizeSets || resizeSets.every((columnResizeSet) => checkMinAndMaxWidthsForSet(columnResizeSet)); + if (!passMinMaxCheck) { + if (finished) { + const columns = resizeSets && resizeSets.length > 0 ? resizeSets[0].columns : null; + dispatchColumnResizedEvent(this.eventSvc, columns, finished, source); + } + return; + } + const changedCols = []; + const allResizedCols = []; + for (const set of resizeSets) { + const { width, columns, ratios } = set; + const newWidths = {}; + const finishedCols = {}; + for (const col of columns) { + allResizedCols.push(col); + } + let finishedColsGrew = true; + let loopCount = 0; + while (finishedColsGrew) { + loopCount++; + if (loopCount > 1000) { + _error(31); + break; + } + finishedColsGrew = false; + const subsetCols = []; + let subsetRatioTotal = 0; + let pixelsToDistribute = width; + columns.forEach((col, index) => { + const thisColFinished = finishedCols[col.getId()]; + if (thisColFinished) { + pixelsToDistribute -= newWidths[col.getId()]; + } else { + subsetCols.push(col); + const ratioThisCol = ratios[index]; + subsetRatioTotal += ratioThisCol; + } + }); + const ratioScale = 1 / subsetRatioTotal; + subsetCols.forEach((col, index) => { + const lastCol = index === subsetCols.length - 1; + let colNewWidth; + if (lastCol) { + colNewWidth = pixelsToDistribute; + } else { + colNewWidth = Math.round(ratios[index] * width * ratioScale); + pixelsToDistribute -= colNewWidth; + } + const minWidth = col.getMinWidth(); + const maxWidth = col.getMaxWidth(); + if (colNewWidth < minWidth) { + colNewWidth = minWidth; + finishedCols[col.getId()] = true; + finishedColsGrew = true; + } else if (maxWidth > 0 && colNewWidth > maxWidth) { + colNewWidth = maxWidth; + finishedCols[col.getId()] = true; + finishedColsGrew = true; + } + newWidths[col.getId()] = colNewWidth; + }); + } + for (const col of columns) { + const newWidth = newWidths[col.getId()]; + const actualWidth = col.getActualWidth(); + if (actualWidth !== newWidth) { + col.setActualWidth(newWidth, source); + changedCols.push(col); + } + } + } + const atLeastOneColChanged = changedCols.length > 0; + let flexedCols = []; + if (atLeastOneColChanged) { + const { colFlex, visibleCols, colViewport } = this.beans; + flexedCols = colFlex?.refreshFlexedColumns({ + resizingCols: allResizedCols, + skipSetLeft: true + }) ?? []; + visibleCols.setLeftValues(source); + visibleCols.updateBodyWidths(); + colViewport.checkViewportColumns(); + } + const colsForEvent = allResizedCols.concat(flexedCols); + if (atLeastOneColChanged || finished) { + dispatchColumnResizedEvent(this.eventSvc, colsForEvent, finished, source, flexedCols); + } + } + resizeHeader(column, delta, shiftKey) { + if (!column.isResizable()) { + return; + } + const actualWidth = column.getActualWidth(); + const minWidth = column.getMinWidth(); + const maxWidth = column.getMaxWidth(); + const newWidth = Math.min(Math.max(actualWidth + delta, minWidth), maxWidth); + this.setColumnWidths([{ key: column, newWidth }], shiftKey, true, "uiColumnResized"); + } + createResizeFeature(pinned, column, eResize, comp, ctrl) { + return new ResizeFeature(pinned, column, eResize, comp, ctrl); + } + createGroupResizeFeature(comp, eResize, pinned, columnGroup) { + return new GroupResizeFeature(comp, eResize, pinned, columnGroup); + } +}; +function checkMinAndMaxWidthsForSet(columnResizeSet) { + const { columns, width } = columnResizeSet; + let minWidthAccumulated = 0; + let maxWidthAccumulated = 0; + let maxWidthActive = true; + for (const col of columns) { + const minWidth = col.getMinWidth(); + minWidthAccumulated += minWidth || 0; + const maxWidth = col.getMaxWidth(); + if (maxWidth > 0) { + maxWidthAccumulated += maxWidth; + } else { + maxWidthActive = false; + } + } + const minWidthPasses = width >= minWidthAccumulated; + const maxWidthPasses = !maxWidthActive || width <= maxWidthAccumulated; + return minWidthPasses && maxWidthPasses; +} +var ColumnResizeModule = { + moduleName: "ColumnResize", + version: VERSION, + beans: [ColumnResizeService], + apiFunctions: { + setColumnWidths + }, + dependsOn: [HorizontalResizeModule, AutoWidthModule] +}; +var GroupWidthFeature = class extends BeanStub { + constructor(comp, columnGroup) { + super(); + this.removeChildListenersFuncs = []; + this.columnGroup = columnGroup; + this.comp = comp; + } + postConstruct() { + this.addListenersToChildrenColumns(); + this.addManagedListeners(this.columnGroup, { + displayedChildrenChanged: this.onDisplayedChildrenChanged.bind(this) + }); + this.onWidthChanged(); + this.addDestroyFunc(this.removeListenersOnChildrenColumns.bind(this)); + } + addListenersToChildrenColumns() { + this.removeListenersOnChildrenColumns(); + const widthChangedListener = this.onWidthChanged.bind(this); + for (const column of this.columnGroup.getLeafColumns()) { + column.__addEventListener("widthChanged", widthChangedListener); + column.__addEventListener("visibleChanged", widthChangedListener); + this.removeChildListenersFuncs.push(() => { + column.__removeEventListener("widthChanged", widthChangedListener); + column.__removeEventListener("visibleChanged", widthChangedListener); + }); + } + } + removeListenersOnChildrenColumns() { + for (const func of this.removeChildListenersFuncs) { + func(); + } + this.removeChildListenersFuncs = []; + } + onDisplayedChildrenChanged() { + this.addListenersToChildrenColumns(); + this.onWidthChanged(); + } + onWidthChanged() { + const columnWidth = this.columnGroup.getActualWidth(); + this.comp.setWidth(`${columnWidth}px`); + this.comp.toggleCss("ag-hidden", columnWidth === 0); + } +}; +var HeaderGroupCellCtrl = class extends AbstractHeaderCellCtrl { + constructor() { + super(...arguments); + this.onSuppressColMoveChange = () => { + if (!this.isAlive() || this.isSuppressMoving()) { + this.removeDragSource(); + } else if (!this.dragSource) { + this.setDragSource(this.eGui); + } + }; + } + wireComp(comp, eGui, eResize, eHeaderCompWrapper, compBean) { + const { column, beans } = this; + const { context, colNames, colHover, rangeSvc, colResize } = beans; + this.comp = comp; + compBean = setupCompBean(this, context, compBean); + this.setGui(eGui, compBean); + this.displayName = colNames.getDisplayNameForColumnGroup(column, "header"); + this.refreshHeaderStyles(); + this.addClasses(); + this.setupMovingCss(compBean); + this.setupExpandable(compBean); + this.setupTooltip(); + this.refreshAnnouncement(); + this.setupAutoHeight({ + wrapperElement: eHeaderCompWrapper, + compBean + }); + this.setupUserComp(); + this.addHeaderMouseListeners(compBean, eHeaderCompWrapper); + this.addManagedPropertyListener("groupHeaderHeight", this.refreshMaxHeaderHeight.bind(this)); + this.refreshMaxHeaderHeight(); + const pinned = this.rowCtrl.pinned; + const leafCols = column.getProvidedColumnGroup().getLeafColumns(); + colHover?.createHoverFeature(compBean, leafCols, eGui); + rangeSvc?.createRangeHighlightFeature(compBean, column, comp); + compBean.createManagedBean(new SetLeftFeature(column, eGui, beans)); + compBean.createManagedBean(new GroupWidthFeature(comp, column)); + if (colResize) { + this.resizeFeature = compBean.createManagedBean(colResize.createGroupResizeFeature(comp, eResize, pinned, column)); + } else { + comp.setResizableDisplayed(false); + } + compBean.createManagedBean(new ManagedFocusFeature(eGui, { + shouldStopEventPropagation: this.shouldStopEventPropagation.bind(this), + onTabKeyDown: () => { + return; + }, + handleKeyDown: this.handleKeyDown.bind(this), + onFocusIn: this.onFocusIn.bind(this) + })); + this.addHighlightListeners(compBean, leafCols); + this.addManagedEventListeners({ + cellSelectionChanged: () => this.refreshAnnouncement() + }); + compBean.addManagedPropertyListener("suppressMovableColumns", this.onSuppressColMoveChange); + this.addResizeAndMoveKeyboardListeners(compBean); + compBean.addDestroyFunc(() => this.clearComponent()); + } + getHeaderClassParams() { + const { column, beans } = this; + const colDef = column.getDefinition(); + return _addGridCommonParams(beans.gos, { + colDef, + columnGroup: column, + floatingFilter: false + }); + } + refreshMaxHeaderHeight() { + const { gos, comp } = this; + const groupHeaderHeight = gos.get("groupHeaderHeight"); + if (groupHeaderHeight != null) { + if (groupHeaderHeight === 0) { + comp.setHeaderWrapperHidden(true); + } else { + comp.setHeaderWrapperMaxHeight(groupHeaderHeight); + } + } else { + comp.setHeaderWrapperHidden(false); + comp.setHeaderWrapperMaxHeight(null); + } + } + addHighlightListeners(compBean, columns) { + if (!this.beans.gos.get("suppressMoveWhenColumnDragging")) { + return; + } + for (const column of columns) { + compBean.addManagedListeners(column, { + headerHighlightChanged: this.onLeafColumnHighlightChanged.bind(this, column) + }); + } + } + onLeafColumnHighlightChanged(column) { + const displayedColumns = this.column.getDisplayedLeafColumns(); + const isFirst = displayedColumns[0] === column; + const isLast = _last(displayedColumns) === column; + if (!isFirst && !isLast) { + return; + } + const highlighted = column.getHighlighted(); + const isColumnMoveAtThisLevel = !!this.rowCtrl.getHeaderCellCtrls().find((ctrl) => { + return ctrl.column.isMoving(); + }); + let beforeOn = false; + let afterOn = false; + if (isColumnMoveAtThisLevel) { + const isRtl = this.beans.gos.get("enableRtl"); + const isHighlightAfter = highlighted === 1; + const isHighlightBefore = highlighted === 0; + if (isFirst) { + if (isRtl) { + afterOn = isHighlightAfter; + } else { + beforeOn = isHighlightBefore; + } + } + if (isLast) { + if (isRtl) { + beforeOn = isHighlightBefore; + } else { + afterOn = isHighlightAfter; + } + } + } + this.comp.toggleCss("ag-header-highlight-before", beforeOn); + this.comp.toggleCss("ag-header-highlight-after", afterOn); + } + resizeHeader(delta, shiftKey) { + const { resizeFeature } = this; + if (!resizeFeature) { + return; + } + const initialValues = resizeFeature.getInitialValues(shiftKey); + resizeFeature.resizeColumns(initialValues, initialValues.resizeStartWidth + delta, "uiColumnResized", true); + } + resizeLeafColumnsToFit(source) { + this.resizeFeature?.resizeLeafColumnsToFit(source); + } + setupUserComp() { + const { colGroupSvc, userCompFactory, gos, enterpriseMenuFactory } = this.beans; + const columnGroup = this.column; + const providedColumnGroup = columnGroup.getProvidedColumnGroup(); + const params = _addGridCommonParams(gos, { + displayName: this.displayName, + columnGroup, + setExpanded: (expanded) => { + colGroupSvc.setColumnGroupOpened(providedColumnGroup, expanded, "gridInitializing"); + }, + setTooltip: (value, shouldDisplayTooltip) => { + gos.assertModuleRegistered("Tooltip", 3); + this.setupTooltip(value, shouldDisplayTooltip); + }, + showColumnMenu: (buttonElement, onClosedCallback) => enterpriseMenuFactory?.showMenuAfterButtonClick(providedColumnGroup, buttonElement, "columnMenu", onClosedCallback), + showColumnMenuAfterMouseClick: (mouseEvent, onClosedCallback) => enterpriseMenuFactory?.showMenuAfterMouseEvent(providedColumnGroup, mouseEvent, "columnMenu", onClosedCallback), + eGridHeader: this.eGui + }); + const compDetails = _getHeaderGroupCompDetails(userCompFactory, params); + if (compDetails) { + this.comp.setUserCompDetails(compDetails); + } + } + addHeaderMouseListeners(compBean, eHeaderCompWrapper) { + const { + column, + comp, + beans: { rangeSvc }, + gos + } = this; + const listener = (e) => this.handleMouseOverChange(e.type === "mouseenter"); + const clickListener = () => this.dispatchColumnMouseEvent("columnHeaderClicked", column.getProvidedColumnGroup()); + const contextMenuListener = (event) => this.handleContextMenuMouseEvent(event, undefined, column.getProvidedColumnGroup()); + compBean.addManagedListeners(this.eGui, { + mouseenter: listener, + mouseleave: listener, + click: clickListener, + contextmenu: contextMenuListener + }); + comp.toggleCss("ag-header-group-cell-selectable", _getEnableColumnSelection(gos)); + const mouseListener = rangeSvc?.createHeaderGroupCellMouseListenerFeature(this.column, eHeaderCompWrapper); + if (mouseListener) { + this.createManagedBean(mouseListener); + } + } + handleMouseOverChange(isMouseOver) { + this.eventSvc.dispatchEvent({ + type: isMouseOver ? "columnHeaderMouseOver" : "columnHeaderMouseLeave", + column: this.column.getProvidedColumnGroup() + }); + } + setupTooltip(value, shouldDisplayTooltip) { + this.tooltipFeature = this.beans.tooltipSvc?.setupHeaderGroupTooltip(this.tooltipFeature, this, value, shouldDisplayTooltip); + } + setupExpandable(compBean) { + const providedColGroup = this.column.getProvidedColumnGroup(); + this.refreshExpanded(); + const listener = this.refreshExpanded.bind(this); + compBean.addManagedListeners(providedColGroup, { + expandedChanged: listener, + expandableChanged: listener + }); + } + refreshExpanded() { + const { column } = this; + this.expandable = column.isExpandable(); + const expanded = column.isExpanded(); + if (this.expandable) { + this.comp.setAriaExpanded(expanded ? "true" : "false"); + } else { + this.comp.setAriaExpanded(undefined); + } + this.refreshHeaderStyles(); + } + addClasses() { + const { column } = this; + const colGroupDef = column.getColGroupDef(); + const classes = _getHeaderClassesFromColDef(colGroupDef, this.gos, null, column); + if (column.isPadding()) { + classes.push("ag-header-group-cell-no-group"); + const leafCols = column.getLeafColumns(); + if (leafCols.every((col) => col.isSpanHeaderHeight())) { + classes.push("ag-header-span-height"); + } + } else { + classes.push("ag-header-group-cell-with-group"); + if (colGroupDef?.wrapHeaderText) { + classes.push("ag-header-cell-wrap-text"); + } + } + for (const c of classes) { + this.comp.toggleCss(c, true); + } + } + setupMovingCss(compBean) { + const { column } = this; + const providedColumnGroup = column.getProvidedColumnGroup(); + const leafColumns = providedColumnGroup.getLeafColumns(); + const listener = () => this.comp.toggleCss("ag-header-cell-moving", column.isMoving()); + for (const col of leafColumns) { + compBean.addManagedListeners(col, { movingChanged: listener }); + } + listener(); + } + onFocusIn(e) { + if (!this.eGui.contains(e.relatedTarget)) { + this.focusThis(); + this.announceAriaDescription(); + } + } + handleKeyDown(e) { + super.handleKeyDown(e); + const wrapperHasFocus = this.getWrapperHasFocus(); + if (!wrapperHasFocus) { + return; + } + const { column, expandable, gos, beans } = this; + const enableColumnSelection = _getEnableColumnSelection(gos); + if (e.key != KeyCode.ENTER) { + return; + } + if (enableColumnSelection && !e.altKey) { + beans.rangeSvc?.handleColumnSelection(column, e); + } else if (expandable) { + const newExpandedValue = !column.isExpanded(); + beans.colGroupSvc.setColumnGroupOpened(column.getProvidedColumnGroup(), newExpandedValue, "uiColumnExpanded"); + } + } + refreshAnnouncement() { + let description; + const { gos } = this; + const enableColumnSelection = _getEnableColumnSelection(gos); + if (enableColumnSelection) { + const translate = this.getLocaleTextFunc(); + description = translate("ariaColumnGroupCellSelection", "Press Enter to toggle selection for all visible cells in this column group"); + } + this.ariaAnnouncement = description; + } + announceAriaDescription() { + const { beans, eGui, ariaAnnouncement } = this; + if (!ariaAnnouncement || !eGui.contains(_getActiveDomElement(beans))) { + return; + } + beans.ariaAnnounce?.announceValue(ariaAnnouncement, "columnHeader"); + } + setDragSource(eHeaderGroup) { + if (!this.isAlive() || this.isSuppressMoving()) { + return; + } + this.removeDragSource(); + if (!eHeaderGroup) { + return; + } + this.dragSource = this.beans.colMoves?.setDragSourceForHeader(eHeaderGroup, this.column, this.displayName) ?? null; + } + isSuppressMoving() { + return this.gos.get("suppressMovableColumns") || this.column.getLeafColumns().some((column) => column.getColDef().suppressMovable || column.getColDef().lockPosition); + } + destroy() { + this.tooltipFeature = this.destroyBean(this.tooltipFeature); + super.destroy(); + } +}; +function setColumnGroupOpened(beans, group, newValue) { + beans.colGroupSvc?.setColumnGroupOpened(group, newValue, "api"); +} +function getColumnGroup(beans, name, instanceId) { + return beans.colGroupSvc?.getColumnGroup(name, instanceId) ?? null; +} +function getProvidedColumnGroup(beans, name) { + return beans.colGroupSvc?.getProvidedColGroup(name) ?? null; +} +function getDisplayNameForColumnGroup(beans, columnGroup, location) { + return beans.colNames.getDisplayNameForColumnGroup(columnGroup, location) || ""; +} +function getColumnGroupState(beans) { + return beans.colGroupSvc?.getColumnGroupState() ?? []; +} +function setColumnGroupState(beans, stateItems) { + beans.colGroupSvc?.setColumnGroupState(stateItems, "api"); +} +function resetColumnGroupState(beans) { + beans.colGroupSvc?.resetColumnGroupState("api"); +} +function getLeftDisplayedColumnGroups(beans) { + return beans.visibleCols.treeLeft; +} +function getCenterDisplayedColumnGroups(beans) { + return beans.visibleCols.treeCenter; +} +function getRightDisplayedColumnGroups(beans) { + return beans.visibleCols.treeRight; +} +function getAllDisplayedColumnGroups(beans) { + return beans.visibleCols.getAllTrees(); +} +var GroupInstanceIdCreator = class { + constructor() { + this.existingIds = {}; + } + getInstanceIdForKey(key) { + const lastResult = this.existingIds[key]; + let result; + if (typeof lastResult !== "number") { + result = 0; + } else { + result = lastResult + 1; + } + this.existingIds[key] = result; + return result; + } +}; +function _removeAllFromUnorderedArray(array, toRemove) { + for (let i = 0;i < toRemove.length; i++) { + const index = array.indexOf(toRemove[i]); + if (index >= 0) { + array[index] = array[array.length - 1]; + array.pop(); + } + } +} +var VisibleColsService = class extends BeanStub { + 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 = true; + } + refresh(source, skipTreeBuild = false) { + const { colFlex, colModel, colGroupSvc, colViewport, selectionColSvc } = this.beans; + if (!skipTreeBuild) { + this.buildTrees(colModel, colGroupSvc); + } + colGroupSvc?.updateOpenClosedVisibility(); + this.leftCols = pickDisplayedCols(this.treeLeft); + this.centerCols = pickDisplayedCols(this.treeCenter); + this.rightCols = pickDisplayedCols(this.treeRight); + selectionColSvc?.refreshVisibility(this.leftCols, this.centerCols, this.rightCols); + this.joinColsAriaOrder(colModel); + this.joinCols(); + this.headerGroupRowCount = this.getHeaderRowCount(); + this.setLeftValues(source); + this.autoHeightCols = this.allCols.filter((col) => col.isAutoHeight()); + colFlex?.refreshFlexedColumns(); + this.updateBodyWidths(); + this.setFirstRightAndLastLeftPinned(colModel, this.leftCols, this.rightCols, source); + colViewport.checkViewportColumns(false); + this.eventSvc.dispatchEvent({ + type: "displayedColumnsChanged", + source + }); + } + getHeaderRowCount() { + if (!this.gos.get("hidePaddedHeaderRows")) { + return this.beans.colModel.cols.treeDepth; + } + let headerGroupRowCount = 0; + for (const col of this.allCols) { + let parent = col.getParent(); + while (parent) { + if (!parent.isPadding()) { + const level = parent.getProvidedColumnGroup().getLevel() + 1; + if (level > headerGroupRowCount) { + headerGroupRowCount = level; + } + break; + } + parent = parent.getParent(); + } + } + return headerGroupRowCount; + } + updateBodyWidths() { + const newBodyWidth = getWidthOfColsInList(this.centerCols); + const newLeftWidth = getWidthOfColsInList(this.leftCols); + const newRightWidth = getWidthOfColsInList(this.rightCols); + this.isBodyWidthDirty = this.bodyWidth !== newBodyWidth; + const atLeastOneChanged = this.bodyWidth !== newBodyWidth || this.leftWidth !== newLeftWidth || this.rightWidth !== newRightWidth; + if (atLeastOneChanged) { + this.bodyWidth = newBodyWidth; + this.leftWidth = newLeftWidth; + this.rightWidth = newRightWidth; + this.eventSvc.dispatchEvent({ + type: "columnContainerWidthChanged" + }); + this.eventSvc.dispatchEvent({ + type: "displayedColumnsWidthChanged" + }); + } + } + setLeftValues(source) { + this.setLeftValuesOfCols(source); + this.setLeftValuesOfGroups(); + } + setFirstRightAndLastLeftPinned(colModel, leftCols, rightCols, source) { + let lastLeft; + let firstRight; + if (this.gos.get("enableRtl")) { + lastLeft = leftCols ? leftCols[0] : null; + firstRight = rightCols ? _last(rightCols) : null; + } else { + lastLeft = leftCols ? _last(leftCols) : null; + firstRight = rightCols ? rightCols[0] : null; + } + for (const col of colModel.getCols()) { + col.setLastLeftPinned(col === lastLeft, source); + col.setFirstRightPinned(col === firstRight, source); + } + } + buildTrees(colModel, columnGroupSvc) { + const cols = colModel.getColsToShow(); + const leftCols = cols.filter((col) => col.getPinned() == "left"); + const rightCols = cols.filter((col) => col.getPinned() == "right"); + const centerCols = cols.filter((col) => col.getPinned() != "left" && col.getPinned() != "right"); + const idCreator = new GroupInstanceIdCreator; + const createGroups = (params) => { + return columnGroupSvc ? columnGroupSvc.createColumnGroups(params) : params.columns; + }; + this.treeLeft = createGroups({ + columns: leftCols, + idCreator, + pinned: "left", + oldDisplayedGroups: this.treeLeft + }); + this.treeRight = createGroups({ + columns: rightCols, + idCreator, + pinned: "right", + oldDisplayedGroups: this.treeRight + }); + this.treeCenter = createGroups({ + columns: centerCols, + idCreator, + pinned: null, + oldDisplayedGroups: this.treeCenter + }); + this.updateColsAndGroupsMap(); + } + clear() { + this.leftCols = []; + this.rightCols = []; + this.centerCols = []; + this.allCols = []; + this.ariaOrderColumns = []; + } + joinColsAriaOrder(colModel) { + const allColumns = colModel.getCols(); + const pinnedLeft = []; + const center = []; + const pinnedRight = []; + for (const col of allColumns) { + const pinned = col.getPinned(); + if (!pinned) { + center.push(col); + } else if (pinned === true || pinned === "left") { + pinnedLeft.push(col); + } else { + pinnedRight.push(col); + } + } + this.ariaOrderColumns = pinnedLeft.concat(center).concat(pinnedRight); + } + getAriaColIndex(colOrGroup) { + let col; + if (isColumnGroup(colOrGroup)) { + col = colOrGroup.getLeafColumns()[0]; + } else { + col = colOrGroup; + } + return this.ariaOrderColumns.indexOf(col) + 1; + } + setLeftValuesOfGroups() { + for (const columns of [this.treeLeft, this.treeRight, this.treeCenter]) { + for (const column of columns) { + if (isColumnGroup(column)) { + const columnGroup = column; + columnGroup.checkLeft(); + } + } + } + } + setLeftValuesOfCols(source) { + const { colModel } = this.beans; + const primaryCols = colModel.getColDefCols(); + if (!primaryCols) { + return; + } + const allColumns = colModel.getCols().slice(0); + const doingRtl = this.gos.get("enableRtl"); + for (const columns of [this.leftCols, this.rightCols, this.centerCols]) { + if (doingRtl) { + let left = getWidthOfColsInList(columns); + for (const column of columns) { + left -= column.getActualWidth(); + column.setLeft(left, source); + } + } else { + let left = 0; + for (const column of columns) { + column.setLeft(left, source); + left += column.getActualWidth(); + } + } + _removeAllFromUnorderedArray(allColumns, columns); + } + for (const column of allColumns) { + column.setLeft(null, source); + } + } + 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(column) { + return this.allCols.indexOf(column) >= 0; + } + getLeftColsForRow(rowNode) { + const { + leftCols, + beans: { colModel } + } = this; + const colSpanActive = colModel.colSpanActive; + if (!colSpanActive) { + return leftCols; + } + return this.getColsForRow(rowNode, leftCols); + } + getRightColsForRow(rowNode) { + const { + rightCols, + beans: { colModel } + } = this; + const colSpanActive = colModel.colSpanActive; + if (!colSpanActive) { + return rightCols; + } + return this.getColsForRow(rowNode, rightCols); + } + getColsForRow(rowNode, displayedColumns, filterCallback, emptySpaceBeforeColumn) { + const result = []; + let lastConsideredCol = null; + for (let i = 0;i < displayedColumns.length; i++) { + const col = displayedColumns[i]; + const maxAllowedColSpan = displayedColumns.length - i; + const colSpan = Math.min(col.getColSpan(rowNode), maxAllowedColSpan); + const columnsToCheckFilter = [col]; + if (colSpan > 1) { + const colsToRemove = colSpan - 1; + for (let j = 1;j <= colsToRemove; j++) { + columnsToCheckFilter.push(displayedColumns[i + j]); + } + i += colsToRemove; + } + let filterPasses; + if (filterCallback) { + filterPasses = false; + for (const colForFilter of columnsToCheckFilter) { + if (filterCallback(colForFilter)) { + filterPasses = true; + } + } + } else { + filterPasses = true; + } + if (filterPasses) { + if (result.length === 0 && lastConsideredCol) { + const gapBeforeColumn = emptySpaceBeforeColumn ? emptySpaceBeforeColumn(col) : false; + if (gapBeforeColumn) { + result.push(lastConsideredCol); + } + } + result.push(col); + } + lastConsideredCol = col; + } + return result; + } + getContainerWidth(pinned) { + switch (pinned) { + case "left": + return this.leftWidth; + case "right": + return this.rightWidth; + default: + return this.bodyWidth; + } + } + getColBefore(col) { + const allDisplayedColumns = this.allCols; + const oldIndex = allDisplayedColumns.indexOf(col); + if (oldIndex > 0) { + return allDisplayedColumns[oldIndex - 1]; + } + return null; + } + isPinningLeft() { + return this.leftCols.length > 0; + } + isPinningRight() { + return this.rightCols.length > 0; + } + updateColsAndGroupsMap() { + this.colsAndGroupsMap = {}; + const func = (child) => { + this.colsAndGroupsMap[child.getUniqueId()] = child; + }; + depthFirstAllColumnTreeSearch(this.treeCenter, false, func); + depthFirstAllColumnTreeSearch(this.treeLeft, false, func); + depthFirstAllColumnTreeSearch(this.treeRight, false, func); + } + isVisible(item) { + const fromMap = this.colsAndGroupsMap[item.getUniqueId()]; + return fromMap === item; + } + getFirstColumn() { + const isRtl = this.gos.get("enableRtl"); + const queryOrder = ["leftCols", "centerCols", "rightCols"]; + if (isRtl) { + queryOrder.reverse(); + } + for (let i = 0;i < queryOrder.length; i++) { + const container = this[queryOrder[i]]; + if (container.length) { + return isRtl ? _last(container) : container[0]; + } + } + return null; + } + getColAfter(col) { + const allDisplayedColumns = this.allCols; + const oldIndex = allDisplayedColumns.indexOf(col); + if (oldIndex < allDisplayedColumns.length - 1) { + return allDisplayedColumns[oldIndex + 1]; + } + return null; + } + getColsLeftWidth() { + return getWidthOfColsInList(this.leftCols); + } + getDisplayedColumnsRightWidth() { + return getWidthOfColsInList(this.rightCols); + } + isColAtEdge(col, edge) { + const allColumns = this.allCols; + if (!allColumns.length) { + return false; + } + const isFirst = edge === "first"; + let columnToCompare; + if (isColumnGroup(col)) { + const leafColumns = col.getDisplayedLeafColumns(); + if (!leafColumns.length) { + return false; + } + columnToCompare = isFirst ? leafColumns[0] : _last(leafColumns); + } else { + columnToCompare = col; + } + return (isFirst ? allColumns[0] : _last(allColumns)) === columnToCompare; + } +}; +function depthFirstAllColumnTreeSearch(tree, useDisplayedChildren, callback) { + if (!tree) { + return; + } + for (let i = 0;i < tree.length; i++) { + const child = tree[i]; + if (isColumnGroup(child)) { + const childTree = useDisplayedChildren ? child.getDisplayedChildren() : child.getChildren(); + depthFirstAllColumnTreeSearch(childTree, useDisplayedChildren, callback); + } + callback(child); + } +} +function pickDisplayedCols(tree) { + const res = []; + depthFirstAllColumnTreeSearch(tree, true, (child) => { + if (isColumn(child)) { + res.push(child); + } + }); + return res; +} +var ColumnGroupService = class extends BeanStub { + constructor() { + super(...arguments); + this.beanName = "colGroupSvc"; + } + getColumnGroupState() { + const columnGroupState = []; + const gridBalancedTree = this.beans.colModel.getColTree(); + depthFirstOriginalTreeSearch(null, gridBalancedTree, (node) => { + if (isProvidedColumnGroup(node)) { + columnGroupState.push({ + groupId: node.getGroupId(), + open: node.isExpanded() + }); + } + }); + return columnGroupState; + } + resetColumnGroupState(source) { + const primaryColumnTree = this.beans.colModel.getColDefColTree(); + if (!primaryColumnTree) { + return; + } + const stateItems = []; + depthFirstOriginalTreeSearch(null, primaryColumnTree, (child) => { + if (isProvidedColumnGroup(child)) { + const colGroupDef = child.getColGroupDef(); + const groupState = { + groupId: child.getGroupId(), + open: !colGroupDef ? undefined : colGroupDef.openByDefault + }; + stateItems.push(groupState); + } + }); + this.setColumnGroupState(stateItems, source); + } + setColumnGroupState(stateItems, source) { + const { colModel, colAnimation, visibleCols, eventSvc } = this.beans; + const gridBalancedTree = colModel.getColTree(); + if (!gridBalancedTree.length) { + return; + } + colAnimation?.start(); + const impactedGroups = []; + for (const stateItem of stateItems) { + const groupKey = stateItem.groupId; + const newValue = stateItem.open; + const providedColumnGroup = this.getProvidedColGroup(groupKey); + if (!providedColumnGroup) { + continue; + } + if (providedColumnGroup.isExpanded() === newValue) { + continue; + } + providedColumnGroup.setExpanded(newValue); + impactedGroups.push(providedColumnGroup); + } + visibleCols.refresh(source, true); + if (impactedGroups.length) { + eventSvc.dispatchEvent({ + type: "columnGroupOpened", + columnGroup: impactedGroups.length === 1 ? impactedGroups[0] : undefined, + columnGroups: impactedGroups + }); + } + colAnimation?.finish(); + } + setColumnGroupOpened(key, newValue, source) { + let keyAsString; + if (isProvidedColumnGroup(key)) { + keyAsString = key.getId(); + } else { + keyAsString = key || ""; + } + this.setColumnGroupState([{ groupId: keyAsString, open: newValue }], source); + } + getProvidedColGroup(key) { + let res = null; + depthFirstOriginalTreeSearch(null, this.beans.colModel.getColTree(), (node) => { + if (isProvidedColumnGroup(node)) { + if (node.getId() === key) { + res = node; + } + } + }); + return res; + } + getGroupAtDirection(columnGroup, direction) { + const requiredLevel = columnGroup.getProvidedColumnGroup().getLevel() + columnGroup.getPaddingLevel(); + const colGroupLeafColumns = columnGroup.getDisplayedLeafColumns(); + const col = direction === "After" ? _last(colGroupLeafColumns) : colGroupLeafColumns[0]; + const getDisplayColMethod = `getCol${direction}`; + while (true) { + const column = this.beans.visibleCols[getDisplayColMethod](col); + if (!column) { + return null; + } + const groupPointer = this.getColGroupAtLevel(column, requiredLevel); + if (groupPointer !== columnGroup) { + return groupPointer; + } + } + } + getColGroupAtLevel(column, level) { + let groupPointer = column.getParent(); + let originalGroupLevel; + let groupPointerLevel; + while (true) { + const groupPointerProvidedColumnGroup = groupPointer.getProvidedColumnGroup(); + originalGroupLevel = groupPointerProvidedColumnGroup.getLevel(); + groupPointerLevel = groupPointer.getPaddingLevel(); + if (originalGroupLevel + groupPointerLevel <= level) { + break; + } + groupPointer = groupPointer.getParent(); + } + return groupPointer; + } + updateOpenClosedVisibility() { + const allColumnGroups = this.beans.visibleCols.getAllTrees(); + depthFirstAllColumnTreeSearch(allColumnGroups, false, (child) => { + if (isColumnGroup(child)) { + child.calculateDisplayedColumns(); + } + }); + } + getColumnGroup(colId, partId) { + if (!colId) { + return null; + } + if (isColumnGroup(colId)) { + return colId; + } + const allColumnGroups = this.beans.visibleCols.getAllTrees(); + const checkPartId = typeof partId === "number"; + let result = null; + depthFirstAllColumnTreeSearch(allColumnGroups, false, (child) => { + if (isColumnGroup(child)) { + const columnGroup = child; + let matched; + if (checkPartId) { + matched = colId === columnGroup.getGroupId() && partId === columnGroup.getPartId(); + } else { + matched = colId === columnGroup.getGroupId(); + } + if (matched) { + result = columnGroup; + } + } + }); + return result; + } + createColumnGroups(params) { + const { columns, idCreator, pinned, oldDisplayedGroups, isStandaloneStructure } = params; + const oldColumnsMapped = this.mapOldGroupsById(oldDisplayedGroups); + const topLevelResultCols = []; + let groupsOrColsAtCurrentLevel = columns; + while (groupsOrColsAtCurrentLevel.length) { + const currentlyIterating = groupsOrColsAtCurrentLevel; + groupsOrColsAtCurrentLevel = []; + let lastGroupedColIdx = 0; + const createGroupToIndex = (to) => { + const from = lastGroupedColIdx; + lastGroupedColIdx = to; + const previousNode = currentlyIterating[from]; + const previousNodeProvided = isColumnGroup(previousNode) ? previousNode.getProvidedColumnGroup() : previousNode; + const previousNodeParent = previousNodeProvided.getOriginalParent(); + if (previousNodeParent == null) { + for (let i = from;i < to; i++) { + topLevelResultCols.push(currentlyIterating[i]); + } + return; + } + const newGroup = this.createColumnGroup(previousNodeParent, idCreator, oldColumnsMapped, pinned, isStandaloneStructure); + for (let i = from;i < to; i++) { + newGroup.addChild(currentlyIterating[i]); + } + groupsOrColsAtCurrentLevel.push(newGroup); + }; + for (let i = 1;i < currentlyIterating.length; i++) { + const thisNode = currentlyIterating[i]; + const thisNodeProvided = isColumnGroup(thisNode) ? thisNode.getProvidedColumnGroup() : thisNode; + const thisNodeParent = thisNodeProvided.getOriginalParent(); + const previousNode = currentlyIterating[lastGroupedColIdx]; + const previousNodeProvided = isColumnGroup(previousNode) ? previousNode.getProvidedColumnGroup() : previousNode; + const previousNodeParent = previousNodeProvided.getOriginalParent(); + if (thisNodeParent !== previousNodeParent) { + createGroupToIndex(i); + } + } + if (lastGroupedColIdx < currentlyIterating.length) { + createGroupToIndex(currentlyIterating.length); + } + } + if (!isStandaloneStructure) { + this.setupParentsIntoCols(topLevelResultCols, null); + } + return topLevelResultCols; + } + createProvidedColumnGroup(primaryColumns, colGroupDef, level, existingColumns, columnKeyCreator, existingGroups, source) { + const groupId = columnKeyCreator.getUniqueKey(colGroupDef.groupId || null, null); + const colGroupDefMerged = createMergedColGroupDef(this.beans, colGroupDef, groupId); + const providedGroup = new AgProvidedColumnGroup(colGroupDefMerged, groupId, false, level); + this.createBean(providedGroup); + const existingGroupAndIndex = this.findExistingGroup(colGroupDef, existingGroups); + if (existingGroupAndIndex) { + existingGroups.splice(existingGroupAndIndex.idx, 1); + } + const existingGroup = existingGroupAndIndex?.group; + if (existingGroup) { + providedGroup.setExpanded(existingGroup.isExpanded()); + } + const children = _recursivelyCreateColumns(this.beans, colGroupDefMerged.children, level + 1, primaryColumns, existingColumns, columnKeyCreator, existingGroups, source); + providedGroup.setChildren(children); + return providedGroup; + } + balanceColumnTree(unbalancedTree, currentDepth, columnDepth, columnKeyCreator) { + const result = []; + for (let i = 0;i < unbalancedTree.length; i++) { + const child = unbalancedTree[i]; + if (isProvidedColumnGroup(child)) { + const originalGroup = child; + const newChildren = this.balanceColumnTree(originalGroup.getChildren(), currentDepth + 1, columnDepth, columnKeyCreator); + originalGroup.setChildren(newChildren); + result.push(originalGroup); + } else { + let firstPaddedGroup; + let currentPaddedGroup; + for (let j = currentDepth;j < columnDepth; j++) { + const newColId = columnKeyCreator.getUniqueKey(null, null); + const colGroupDefMerged = createMergedColGroupDef(this.beans, null, newColId); + const paddedGroup = new AgProvidedColumnGroup(colGroupDefMerged, newColId, true, j); + this.createBean(paddedGroup); + if (currentPaddedGroup) { + currentPaddedGroup.setChildren([paddedGroup]); + } + currentPaddedGroup = paddedGroup; + if (!firstPaddedGroup) { + firstPaddedGroup = currentPaddedGroup; + } + } + if (firstPaddedGroup && currentPaddedGroup) { + result.push(firstPaddedGroup); + const hasGroups = unbalancedTree.some((leaf) => isProvidedColumnGroup(leaf)); + if (hasGroups) { + currentPaddedGroup.setChildren([child]); + continue; + } else { + currentPaddedGroup.setChildren(unbalancedTree); + break; + } + } + result.push(child); + } + } + return result; + } + findDepth(balancedColumnTree) { + let depth = 0; + let pointer = balancedColumnTree; + while (pointer?.[0] && isProvidedColumnGroup(pointer[0])) { + depth++; + pointer = pointer[0].getChildren(); + } + return depth; + } + findMaxDepth(treeChildren, depth) { + let maxDepthThisLevel = depth; + for (let i = 0;i < treeChildren.length; i++) { + const abstractColumn = treeChildren[i]; + if (isProvidedColumnGroup(abstractColumn)) { + const originalGroup = abstractColumn; + const newDepth = this.findMaxDepth(originalGroup.getChildren(), depth + 1); + if (maxDepthThisLevel < newDepth) { + maxDepthThisLevel = newDepth; + } + } + } + return maxDepthThisLevel; + } + balanceTreeForAutoCols(autoCols, depth) { + const tree = []; + for (const col of autoCols) { + let nextChild = col; + for (let i = depth - 1;i >= 0; i--) { + const autoGroup = new AgProvidedColumnGroup(null, `FAKE_PATH_${col.getId()}_${i}`, true, i); + this.createBean(autoGroup); + autoGroup.setChildren([nextChild]); + nextChild.originalParent = autoGroup; + nextChild = autoGroup; + } + if (depth === 0) { + col.originalParent = null; + } + tree.push(nextChild); + } + return tree; + } + findExistingGroup(newGroupDef, existingGroups) { + const newHasId = newGroupDef.groupId != null; + if (!newHasId) { + return; + } + for (let i = 0;i < existingGroups.length; i++) { + const existingGroup = existingGroups[i]; + const existingDef = existingGroup.getColGroupDef(); + if (!existingDef) { + continue; + } + if (existingGroup.getId() === newGroupDef.groupId) { + return { idx: i, group: existingGroup }; + } + } + return; + } + createColumnGroup(providedGroup, groupInstanceIdCreator, oldColumnsMapped, pinned, isStandaloneStructure) { + const groupId = providedGroup.getGroupId(); + const instanceId = groupInstanceIdCreator.getInstanceIdForKey(groupId); + const uniqueId = createUniqueColumnGroupId(groupId, instanceId); + let columnGroup = oldColumnsMapped[uniqueId]; + if (columnGroup && columnGroup.getProvidedColumnGroup() !== providedGroup) { + columnGroup = null; + } + if (_exists(columnGroup)) { + columnGroup.reset(); + } else { + columnGroup = new AgColumnGroup(providedGroup, groupId, instanceId, pinned); + if (!isStandaloneStructure) { + this.createBean(columnGroup); + } + } + return columnGroup; + } + mapOldGroupsById(displayedGroups) { + const result = {}; + const recursive = (columnsOrGroups) => { + for (const columnOrGroup of columnsOrGroups) { + if (isColumnGroup(columnOrGroup)) { + const columnGroup = columnOrGroup; + result[columnOrGroup.getUniqueId()] = columnGroup; + recursive(columnGroup.getChildren()); + } + } + }; + if (displayedGroups) { + recursive(displayedGroups); + } + return result; + } + setupParentsIntoCols(columnsOrGroups, parent) { + for (const columnsOrGroup of columnsOrGroups ?? []) { + if (columnsOrGroup.parent !== parent) { + this.beans.colViewport.colsWithinViewportHash = ""; + } + columnsOrGroup.parent = parent; + if (isColumnGroup(columnsOrGroup)) { + const columnGroup = columnsOrGroup; + this.setupParentsIntoCols(columnGroup.getChildren(), columnGroup); + } + } + } +}; +var ColumnGroupModule = { + moduleName: "ColumnGroup", + version: VERSION, + dynamicBeans: { headerGroupCellCtrl: HeaderGroupCellCtrl }, + beans: [ColumnGroupService], + apiFunctions: { + getAllDisplayedColumnGroups, + getCenterDisplayedColumnGroups, + getColumnGroup, + getColumnGroupState, + getDisplayNameForColumnGroup, + getLeftDisplayedColumnGroups, + getProvidedColumnGroup, + getRightDisplayedColumnGroups, + resetColumnGroupState, + setColumnGroupOpened, + setColumnGroupState + } +}; +function _applyColumnState(beans, params, source) { + const { + colModel, + rowGroupColsSvc, + pivotColsSvc, + autoColSvc, + selectionColSvc, + colAnimation, + visibleCols, + pivotResultCols, + environment, + valueColsSvc, + eventSvc, + gos + } = beans; + const providedCols = colModel.getColDefCols() ?? []; + const selectionCols = selectionColSvc?.getColumns(); + if (!providedCols.length && !selectionCols?.length) { + return false; + } + if (params?.state && !params.state.forEach) { + _warn(32); + return false; + } + const syncColumnWithStateItem = (column, stateItem, rowGroupIndexes, pivotIndexes, autoCol) => { + if (!column) { + return; + } + const getValue = getValueFactory(stateItem, params.defaultState); + const flex = getValue("flex").value1; + const maybeSortDirection = getValue("sort").value1; + const maybeSortType = getValue("sortType").value1; + const isSortUpdate = _isSortDirectionValid(maybeSortDirection) || _isSortTypeValid(maybeSortType); + const type = _normalizeSortType(maybeSortType); + const direction = _normalizeSortDirection(maybeSortDirection); + const newSortDef = isSortUpdate ? { type, direction } : undefined; + updateSomeColumnState(beans, column, getValue("hide").value1, newSortDef, getValue("sortIndex").value1, getValue("pinned").value1, flex, source); + if (flex == null) { + const width = getValue("width").value1; + if (width != null) { + const minColWidth = column.getColDef().minWidth ?? environment.getDefaultColumnMinWidth(); + if (minColWidth != null && width >= minColWidth) { + column.setActualWidth(width, source); + } + } + } + if (autoCol || !column.isPrimary()) { + return; + } + valueColsSvc?.syncColumnWithState(column, source, getValue); + rowGroupColsSvc?.syncColumnWithState(column, source, getValue, rowGroupIndexes); + pivotColsSvc?.syncColumnWithState(column, source, getValue, pivotIndexes); + }; + const applyStates = (states, existingColumns, getById2) => { + const dispatchEventsFunc = _compareColumnStatesAndDispatchEvents(beans, source); + const columnsWithNoState = existingColumns.slice(); + const rowGroupIndexes = {}; + const pivotIndexes = {}; + const autoColStates = []; + const selectionColStates = []; + const unmatchedAndAutoStates2 = []; + let unmatchedCount2 = 0; + const previousRowGroupCols = rowGroupColsSvc?.columns.slice() ?? []; + const previousPivotCols = pivotColsSvc?.columns.slice() ?? []; + for (const state of states) { + const colId = state.colId; + const isAutoGroupColumn = colId.startsWith(GROUP_AUTO_COLUMN_ID); + if (isAutoGroupColumn) { + autoColStates.push(state); + unmatchedAndAutoStates2.push(state); + continue; + } + if (isColumnSelectionCol(colId)) { + selectionColStates.push(state); + unmatchedAndAutoStates2.push(state); + continue; + } + const column = getById2(colId); + if (!column) { + unmatchedAndAutoStates2.push(state); + unmatchedCount2 += 1; + } else { + syncColumnWithStateItem(column, state, rowGroupIndexes, pivotIndexes, false); + _removeFromArray(columnsWithNoState, column); + } + } + const applyDefaultsFunc = (col) => syncColumnWithStateItem(col, null, rowGroupIndexes, pivotIndexes, false); + columnsWithNoState.forEach(applyDefaultsFunc); + rowGroupColsSvc?.sortColumns(comparatorByIndex.bind(rowGroupColsSvc, rowGroupIndexes, previousRowGroupCols)); + pivotColsSvc?.sortColumns(comparatorByIndex.bind(pivotColsSvc, pivotIndexes, previousPivotCols)); + colModel.refreshCols(false, source); + const syncColStates = (getCol, colStates, columns = []) => { + for (const stateItem of colStates) { + const col = getCol(stateItem.colId); + _removeFromArray(columns, col); + syncColumnWithStateItem(col, stateItem, null, null, true); + } + columns.forEach(applyDefaultsFunc); + }; + syncColStates((colId) => autoColSvc?.getColumn(colId) ?? null, autoColStates, autoColSvc?.getColumns()?.slice()); + syncColStates((colId) => selectionColSvc?.getColumn(colId) ?? null, selectionColStates, selectionColSvc?.getColumns()?.slice()); + orderLiveColsLikeState(params, colModel, gos); + visibleCols.refresh(source); + eventSvc.dispatchEvent({ + type: "columnEverythingChanged", + source + }); + dispatchEventsFunc(); + return { unmatchedAndAutoStates: unmatchedAndAutoStates2, unmatchedCount: unmatchedCount2 }; + }; + colAnimation?.start(); + let { unmatchedAndAutoStates, unmatchedCount } = applyStates(params.state || [], providedCols, (id) => colModel.getColDefCol(id)); + if (unmatchedAndAutoStates.length > 0 || _exists(params.defaultState)) { + const pivotResultColsList = pivotResultCols?.getPivotResultCols()?.list ?? []; + unmatchedCount = applyStates(unmatchedAndAutoStates, pivotResultColsList, (id) => pivotResultCols?.getPivotResultCol(id) ?? null).unmatchedCount; + } + colAnimation?.finish(); + return unmatchedCount === 0; +} +function _resetColumnState(beans, source) { + const { colModel, autoColSvc, selectionColSvc, eventSvc, gos } = beans; + const primaryCols = colModel.getColDefCols(); + if (!primaryCols?.length) { + return; + } + const primaryColumnTree = colModel.getColDefColTree(); + const primaryColumns = _getColumnsFromTree(primaryColumnTree); + const columnStates = []; + let letRowGroupIndex = 1000; + let letPivotIndex = 1000; + const addColState = (col) => { + const stateItem = getColumnStateFromColDef(col); + if (_missing(stateItem.rowGroupIndex) && stateItem.rowGroup) { + stateItem.rowGroupIndex = letRowGroupIndex++; + } + if (_missing(stateItem.pivotIndex) && stateItem.pivot) { + stateItem.pivotIndex = letPivotIndex++; + } + columnStates.push(stateItem); + }; + autoColSvc?.getColumns()?.forEach(addColState); + selectionColSvc?.getColumns()?.forEach(addColState); + primaryColumns?.forEach(addColState); + _applyColumnState(beans, { state: columnStates }, source); + const autoCols = autoColSvc?.getColumns() ?? []; + const selectionCols = selectionColSvc?.getColumns() ?? []; + const orderedCols = [...selectionCols, ...autoCols, ...primaryCols]; + const orderedColState = orderedCols.map((col) => ({ colId: col.colId })); + _applyColumnState(beans, { state: orderedColState, applyOrder: true }, source); + eventSvc.dispatchEvent(_addGridCommonParams(gos, { type: "columnsReset", source })); +} +function _compareColumnStatesAndDispatchEvents(beans, source) { + const { rowGroupColsSvc, pivotColsSvc, valueColsSvc, colModel, sortSvc, eventSvc } = beans; + const startState = { + rowGroupColumns: rowGroupColsSvc?.columns.slice() ?? [], + pivotColumns: pivotColsSvc?.columns.slice() ?? [], + valueColumns: valueColsSvc?.columns.slice() ?? [] + }; + const columnStateBefore = _getColumnState(beans); + const columnStateBeforeMap = {}; + for (const col of columnStateBefore) { + columnStateBeforeMap[col.colId] = col; + } + return () => { + const dispatchWhenListsDifferent = (eventType, colsBefore, colsAfter, idMapper) => { + const beforeList = colsBefore.map(idMapper); + const afterList = colsAfter.map(idMapper); + const unchanged = _areEqual(beforeList, afterList); + if (unchanged) { + return; + } + const changes = new Set(colsBefore); + for (const id of colsAfter) { + if (!changes.delete(id)) { + changes.add(id); + } + } + const changesArr = [...changes]; + eventSvc.dispatchEvent({ + type: eventType, + columns: changesArr, + column: changesArr.length === 1 ? changesArr[0] : null, + source + }); + }; + const getChangedColumns = (changedPredicate) => { + const changedColumns2 = []; + colModel.forAllCols((column) => { + const colStateBefore = columnStateBeforeMap[column.getColId()]; + if (colStateBefore && changedPredicate(colStateBefore, column)) { + changedColumns2.push(column); + } + }); + return changedColumns2; + }; + const columnIdMapper = (c) => c.getColId(); + dispatchWhenListsDifferent("columnRowGroupChanged", startState.rowGroupColumns, rowGroupColsSvc?.columns ?? [], columnIdMapper); + dispatchWhenListsDifferent("columnPivotChanged", startState.pivotColumns, pivotColsSvc?.columns ?? [], columnIdMapper); + const valueChangePredicate = (cs, c) => { + const oldActive = cs.aggFunc != null; + const activeChanged = oldActive != c.isValueActive(); + const aggFuncChanged = oldActive && cs.aggFunc != c.getAggFunc(); + return activeChanged || aggFuncChanged; + }; + const changedValues = getChangedColumns(valueChangePredicate); + if (changedValues.length > 0) { + dispatchColumnChangedEvent(eventSvc, "columnValueChanged", changedValues, source); + } + const resizeChangePredicate = (cs, c) => cs.width != c.getActualWidth(); + dispatchColumnResizedEvent(eventSvc, getChangedColumns(resizeChangePredicate), true, source); + const pinnedChangePredicate = (cs, c) => cs.pinned != c.getPinned(); + dispatchColumnPinnedEvent(eventSvc, getChangedColumns(pinnedChangePredicate), source); + const visibilityChangePredicate = (cs, c) => cs.hide == c.isVisible(); + dispatchColumnVisibleEvent(eventSvc, getChangedColumns(visibilityChangePredicate), source); + const sortChangePredicate = (cs, c) => !_areSortDefsEqual(c.getSortDef(), { + type: _normalizeSortType(cs.sortType), + direction: _normalizeSortDirection(cs.sort) + }) || cs.sortIndex != c.getSortIndex(); + const changedColumns = getChangedColumns(sortChangePredicate); + if (changedColumns.length > 0) { + sortSvc?.dispatchSortChangedEvents(source, changedColumns); + } + const colStateAfter = _getColumnState(beans); + normaliseColumnMovedEventForColumnState(columnStateBefore, colStateAfter, source, colModel, eventSvc); + }; +} +function _getColumnState(beans) { + const { colModel, rowGroupColsSvc, pivotColsSvc } = beans; + const primaryCols = colModel.getColDefCols(); + if (_missing(primaryCols) || !colModel.isAlive()) { + return []; + } + const rowGroupColumns = rowGroupColsSvc?.columns; + const pivotColumns = pivotColsSvc?.columns; + const res = []; + const createStateItemFromColumn = (column) => { + const rowGroupIndex = column.isRowGroupActive() && rowGroupColumns ? rowGroupColumns.indexOf(column) : null; + const pivotIndex = column.isPivotActive() && pivotColumns ? pivotColumns.indexOf(column) : null; + const aggFunc = column.isValueActive() ? column.getAggFunc() : null; + const sortIndex = column.getSortIndex() != null ? column.getSortIndex() : null; + res.push({ + colId: column.getColId(), + width: column.getActualWidth(), + hide: !column.isVisible(), + pinned: column.getPinned(), + sort: column.getSort(), + sortType: column.getSortDef()?.type, + sortIndex, + aggFunc, + rowGroup: column.isRowGroupActive(), + rowGroupIndex, + pivot: column.isPivotActive(), + pivotIndex, + flex: column.getFlex() ?? null + }); + }; + colModel.forAllCols((col) => createStateItemFromColumn(col)); + const colIdToGridIndexMap = new Map(colModel.getCols().map((col, index) => [col.getColId(), index])); + res.sort((itemA, itemB) => { + const posA = colIdToGridIndexMap.has(itemA.colId) ? colIdToGridIndexMap.get(itemA.colId) : -1; + const posB = colIdToGridIndexMap.has(itemB.colId) ? colIdToGridIndexMap.get(itemB.colId) : -1; + return posA - posB; + }); + return res; +} +function getColumnStateFromColDef(column) { + const getValueOrNull = (a, b) => a != null ? a : b != null ? b : null; + const colDef = column.getColDef(); + const sortDefFromColDef = _getSortDefFromInput(getValueOrNull(colDef.sort, colDef.initialSort)); + const sort = sortDefFromColDef.direction; + const sortType = sortDefFromColDef.type; + const sortIndex = getValueOrNull(colDef.sortIndex, colDef.initialSortIndex); + const hide = getValueOrNull(colDef.hide, colDef.initialHide); + const pinned = getValueOrNull(colDef.pinned, colDef.initialPinned); + const width = getValueOrNull(colDef.width, colDef.initialWidth); + const flex = getValueOrNull(colDef.flex, colDef.initialFlex); + let rowGroupIndex = getValueOrNull(colDef.rowGroupIndex, colDef.initialRowGroupIndex); + let rowGroup = getValueOrNull(colDef.rowGroup, colDef.initialRowGroup); + if (rowGroupIndex == null && !rowGroup) { + rowGroupIndex = null; + rowGroup = null; + } + let pivotIndex = getValueOrNull(colDef.pivotIndex, colDef.initialPivotIndex); + let pivot = getValueOrNull(colDef.pivot, colDef.initialPivot); + if (pivotIndex == null && !pivot) { + pivotIndex = null; + pivot = null; + } + const aggFunc = getValueOrNull(colDef.aggFunc, colDef.initialAggFunc); + return { + colId: column.getColId(), + sort, + sortType, + sortIndex, + hide, + pinned, + width, + flex, + rowGroup, + rowGroupIndex, + pivot, + pivotIndex, + aggFunc + }; +} +function orderLiveColsLikeState(params, colModel, gos) { + if (!params.applyOrder || !params.state) { + return; + } + const colIds = []; + for (const item of params.state) { + if (item.colId != null) { + colIds.push(item.colId); + } + } + sortColsLikeKeys(colModel.cols, colIds, colModel, gos); +} +function sortColsLikeKeys(cols, colIds, colModel, gos) { + if (cols == null) { + return; + } + let newOrder = []; + const processedColIds = {}; + for (const colId of colIds) { + if (processedColIds[colId]) { + continue; + } + const col = cols.map[colId]; + if (col) { + newOrder.push(col); + processedColIds[colId] = true; + } + } + let autoGroupInsertIndex = 0; + for (const col of cols.list) { + const colId = col.getColId(); + const alreadyProcessed = processedColIds[colId] != null; + if (alreadyProcessed) { + continue; + } + const isAutoGroupCol = colId.startsWith(GROUP_AUTO_COLUMN_ID); + if (isAutoGroupCol) { + newOrder.splice(autoGroupInsertIndex++, 0, col); + } else { + newOrder.push(col); + } + } + newOrder = placeLockedColumns(newOrder, gos); + if (!doesMovePassMarryChildren(newOrder, colModel.getColTree())) { + _warn(39); + return; + } + cols.list = newOrder; +} +function normaliseColumnMovedEventForColumnState(colStateBefore, colStateAfter, source, colModel, eventSvc) { + const colStateAfterMapped = {}; + for (const s of colStateAfter) { + colStateAfterMapped[s.colId] = s; + } + const colsIntersectIds = {}; + for (const s of colStateBefore) { + if (colStateAfterMapped[s.colId]) { + colsIntersectIds[s.colId] = true; + } + } + const beforeFiltered = colStateBefore.filter((c) => colsIntersectIds[c.colId]); + const afterFiltered = colStateAfter.filter((c) => colsIntersectIds[c.colId]); + const movedColumns = []; + afterFiltered.forEach((csAfter, index) => { + const csBefore = beforeFiltered?.[index]; + if (csBefore && csBefore.colId !== csAfter.colId) { + const gridCol = colModel.getCol(csBefore.colId); + if (gridCol) { + movedColumns.push(gridCol); + } + } + }); + if (!movedColumns.length) { + return; + } + eventSvc.dispatchEvent({ + type: "columnMoved", + columns: movedColumns, + column: movedColumns.length === 1 ? movedColumns[0] : null, + finished: true, + source + }); +} +var comparatorByIndex = (indexes, oldList, colA, colB) => { + const indexA = indexes[colA.getId()]; + const indexB = indexes[colB.getId()]; + const aHasIndex = indexA != null; + const bHasIndex = indexB != null; + if (aHasIndex && bHasIndex) { + return indexA - indexB; + } + if (aHasIndex) { + return -1; + } + if (bHasIndex) { + return 1; + } + const oldIndexA = oldList.indexOf(colA); + const oldIndexB = oldList.indexOf(colB); + const aHasOldIndex = oldIndexA >= 0; + const bHasOldIndex = oldIndexB >= 0; + if (aHasOldIndex && bHasOldIndex) { + return oldIndexA - oldIndexB; + } + if (aHasOldIndex) { + return -1; + } + return 1; +}; +var ColumnModel = class extends BeanStub { + constructor() { + super(...arguments); + this.beanName = "colModel"; + this.pivotMode = false; + this.ready = false; + this.changeEventsDispatching = false; + } + postConstruct() { + this.pivotMode = this.gos.get("pivotMode"); + this.addManagedPropertyListeners([ + "groupDisplayType", + "treeData", + "treeDataDisplayType", + "groupHideOpenParents", + "groupHideColumnsUntilExpanded", + "rowNumbers", + "hidePaddedHeaderRows" + ], (event) => this.refreshAll(_convertColumnEventSourceType(event.source))); + this.addManagedPropertyListeners(["defaultColDef", "defaultColGroupDef", "columnTypes", "suppressFieldDotNotation"], this.recreateColumnDefs.bind(this)); + this.addManagedPropertyListener("pivotMode", (event) => this.setPivotMode(this.gos.get("pivotMode"), _convertColumnEventSourceType(event.source))); + } + createColsFromColDefs(source) { + const { beans } = this; + const { + valueCache, + colAutosize, + rowGroupColsSvc, + pivotColsSvc, + valueColsSvc, + visibleCols, + eventSvc, + groupHierarchyColSvc + } = beans; + const dispatchEventsFunc = this.colDefs ? _compareColumnStatesAndDispatchEvents(beans, source) : undefined; + valueCache?.expire(); + const oldCols = this.colDefCols?.list; + const oldTree = this.colDefCols?.tree; + const newTree = _createColumnTree(beans, this.colDefs, true, oldTree, source); + _destroyColumnTree(beans, this.colDefCols?.tree, newTree.columnTree); + const tree = newTree.columnTree; + const treeDepth = newTree.treeDepth; + const list = _getColumnsFromTree(tree); + const map = {}; + for (const col of list) { + map[col.getId()] = col; + } + this.colDefCols = { tree, treeDepth, list, map }; + this.createColumnsForService([groupHierarchyColSvc], this.colDefCols, source); + rowGroupColsSvc?.extractCols(source, oldCols); + pivotColsSvc?.extractCols(source, oldCols); + valueColsSvc?.extractCols(source, oldCols); + this.ready = true; + this.changeEventsDispatching = true; + this.refreshCols(true, source); + this.changeEventsDispatching = false; + visibleCols.refresh(source); + eventSvc.dispatchEvent({ + type: "columnEverythingChanged", + source + }); + if (dispatchEventsFunc) { + this.changeEventsDispatching = true; + dispatchEventsFunc(); + this.changeEventsDispatching = false; + } + eventSvc.dispatchEvent({ + type: "newColumnsLoaded", + source + }); + if (source === "gridInitializing") { + colAutosize?.applyAutosizeStrategy(); + } + } + refreshCols(newColDefs, source) { + if (!this.colDefCols) { + return; + } + const prevColTree = this.cols?.tree; + this.saveColOrder(); + const { + autoColSvc, + selectionColSvc, + rowNumbersSvc, + quickFilter, + pivotResultCols, + showRowGroupCols, + rowAutoHeight, + visibleCols, + colViewport, + eventSvc, + formula + } = this.beans; + const cols = this.selectCols(pivotResultCols, this.colDefCols); + formula?.setFormulasActive(cols); + this.createColumnsForService([autoColSvc, selectionColSvc, rowNumbersSvc], cols, source); + const shouldSortNewColDefs = _shouldMaintainColumnOrder(this.gos, this.showingPivotResult); + if (!newColDefs || shouldSortNewColDefs) { + this.restoreColOrder(cols); + } + this.positionLockedCols(cols); + showRowGroupCols?.refresh(); + quickFilter?.refreshCols(); + this.setColSpanActive(); + rowAutoHeight?.setAutoHeightActive(cols); + visibleCols.clear(); + colViewport.clear(); + if (!_areEqual(prevColTree, this.cols.tree)) { + eventSvc.dispatchEvent({ + type: "gridColumnsChanged" + }); + } + } + createColumnsForService(services, cols, source) { + for (const service of services) { + if (!service) { + continue; + } + service.createColumns(cols, (updateOrder) => { + this.lastOrder = updateOrder(this.lastOrder); + this.lastPivotOrder = updateOrder(this.lastPivotOrder); + }, source); + service.addColumns(cols); + } + } + selectCols(pivotResultColsSvc, colDefCols) { + const pivotResultCols = pivotResultColsSvc?.getPivotResultCols() ?? null; + this.showingPivotResult = pivotResultCols != null; + const { map, list, tree, treeDepth } = pivotResultCols ?? colDefCols; + this.cols = { + list: list.slice(), + map: { ...map }, + tree: tree.slice(), + treeDepth + }; + if (pivotResultCols) { + const hasSameColumns = pivotResultCols.list.some((col) => this.cols?.map[col.getColId()] !== undefined); + if (!hasSameColumns) { + this.lastPivotOrder = null; + } + } + return this.cols; + } + getColsToShow() { + if (!this.cols) { + return []; + } + const { beans, showingPivotResult, cols } = this; + const { valueColsSvc, selectionColSvc, gos } = beans; + const showAutoGroupAndValuesOnly = this.isPivotMode() && !showingPivotResult; + const showSelectionColumn = selectionColSvc?.isSelectionColumnEnabled(); + const showRowNumbers = _isRowNumbers(beans); + const valueColumns = valueColsSvc?.columns; + const hideEmptyAutoColGroups = _isGroupHideColumnsUntilExpanded(gos); + const res = cols.list.filter((col) => { + const isAutoGroupCol = isColumnGroupAutoCol(col); + if (showAutoGroupAndValuesOnly) { + const isValueCol = valueColumns?.includes(col); + return isValueCol || isAutoGroupCol && (!hideEmptyAutoColGroups || col.isVisible()) || showSelectionColumn && isColumnSelectionCol(col) || showRowNumbers && isRowNumberCol(col); + } else { + return isAutoGroupCol && !hideEmptyAutoColGroups || col.isVisible(); + } + }); + return res; + } + refreshAll(source) { + if (!this.ready) { + return; + } + this.refreshCols(false, source); + this.beans.visibleCols.refresh(source); + } + setColsVisible(keys, visible = false, source) { + _applyColumnState(this.beans, { + state: keys.map((key) => ({ + colId: typeof key === "string" ? key : key.getColId(), + hide: !visible + })) + }, source); + } + restoreColOrder(cols) { + const lastOrder = this.showingPivotResult ? this.lastPivotOrder : this.lastOrder; + if (!lastOrder) { + return; + } + const preservedOrder = lastOrder.filter((col) => cols.map[col.getId()] != null); + if (preservedOrder.length === 0) { + return; + } + if (preservedOrder.length === cols.list.length) { + cols.list = preservedOrder; + return; + } + const hasSiblings = (col) => { + const ancestor = col.getOriginalParent(); + if (!ancestor) { + return false; + } + const children = ancestor.getChildren(); + if (children.length > 1) { + return true; + } + return hasSiblings(ancestor); + }; + if (!preservedOrder.some((col) => hasSiblings(col))) { + const preservedOrderSet = new Set(preservedOrder); + for (const col of cols.list) { + if (!preservedOrderSet.has(col)) { + preservedOrder.push(col); + } + } + cols.list = preservedOrder; + return; + } + const colPositionMap = /* @__PURE__ */ new Map; + for (let i = 0;i < preservedOrder.length; i++) { + const col = preservedOrder[i]; + colPositionMap.set(col, i); + } + const additionalCols = cols.list.filter((col) => !colPositionMap.has(col)); + if (additionalCols.length === 0) { + cols.list = preservedOrder; + return; + } + const getPreviousSibling = (col, group) => { + const parent = group ? group.getOriginalParent() : col.getOriginalParent(); + if (!parent) { + return null; + } + let highestIdx = null; + let highestSibling = null; + for (const child of parent.getChildren()) { + if (child === group || child === col) { + continue; + } + if (child instanceof AgColumn) { + const colIdx = colPositionMap.get(child); + if (colIdx == null) { + continue; + } + if (highestIdx == null || highestIdx < colIdx) { + highestIdx = colIdx; + highestSibling = child; + } + continue; + } + child.forEachLeafColumn((leafCol) => { + const colIdx = colPositionMap.get(leafCol); + if (colIdx == null) { + return; + } + if (highestIdx == null || highestIdx < colIdx) { + highestIdx = colIdx; + highestSibling = leafCol; + } + }); + } + if (highestSibling == null) { + return getPreviousSibling(col, parent); + } + return highestSibling; + }; + const noSiblingsAvailable = []; + const previousSiblingPosMap = /* @__PURE__ */ new Map; + for (const col of additionalCols) { + const prevSiblingIdx = getPreviousSibling(col, null); + if (prevSiblingIdx == null) { + noSiblingsAvailable.push(col); + continue; + } + const prev = previousSiblingPosMap.get(prevSiblingIdx); + if (prev === undefined) { + previousSiblingPosMap.set(prevSiblingIdx, col); + } else if (Array.isArray(prev)) { + prev.push(col); + } else { + previousSiblingPosMap.set(prevSiblingIdx, [prev, col]); + } + } + const result = new Array(cols.list.length); + let resultPointer = result.length - 1; + for (let i = noSiblingsAvailable.length - 1;i >= 0; i--) { + result[resultPointer--] = noSiblingsAvailable[i]; + } + for (let i = preservedOrder.length - 1;i >= 0; i--) { + const nextCol = preservedOrder[i]; + const extraCols = previousSiblingPosMap.get(nextCol); + if (extraCols) { + if (Array.isArray(extraCols)) { + for (let x = extraCols.length - 1;x >= 0; x--) { + const col = extraCols[x]; + result[resultPointer--] = col; + } + } else { + result[resultPointer--] = extraCols; + } + } + result[resultPointer--] = nextCol; + } + cols.list = result; + } + positionLockedCols(cols) { + cols.list = placeLockedColumns(cols.list, this.gos); + } + saveColOrder() { + if (this.showingPivotResult) { + this.lastPivotOrder = this.cols?.list ?? null; + } else { + this.lastOrder = this.cols?.list ?? null; + } + } + getColumnDefs(sorted) { + return this.colDefCols && this.beans.colDefFactory?.getColumnDefs(this.colDefCols.list, this.showingPivotResult, this.lastOrder, this.cols?.list ?? [], sorted); + } + setColSpanActive() { + this.colSpanActive = !!this.cols?.list.some((col) => col.getColDef().colSpan != null); + } + isPivotMode() { + return this.pivotMode; + } + setPivotMode(pivotMode, source) { + if (pivotMode === this.pivotMode) { + return; + } + this.pivotMode = pivotMode; + if (!this.ready) { + return; + } + this.refreshCols(false, source); + const { visibleCols, eventSvc } = this.beans; + visibleCols.refresh(source); + eventSvc.dispatchEvent({ + type: "columnPivotModeChanged" + }); + } + isPivotActive() { + const pivotColumns = this.beans.pivotColsSvc?.columns; + return this.pivotMode && !!pivotColumns?.length; + } + recreateColumnDefs(e) { + if (!this.cols) { + return; + } + this.beans.autoColSvc?.updateColumns(e); + const source = _convertColumnEventSourceType(e.source); + this.createColsFromColDefs(source); + } + setColumnDefs(columnDefs, source) { + this.colDefs = columnDefs; + this.createColsFromColDefs(source); + } + destroy() { + _destroyColumnTree(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(callback) { + const { pivotResultCols, autoColSvc, selectionColSvc, groupHierarchyColSvc } = this.beans; + if (_forAll(this.colDefCols?.list, callback)) { + return; + } + if (_forAll(autoColSvc?.columns?.list, callback)) { + return; + } + if (_forAll(selectionColSvc?.columns?.list, callback)) { + return; + } + if (_forAll(groupHierarchyColSvc?.columns?.list, callback)) { + return; + } + if (_forAll(pivotResultCols?.getPivotResultCols()?.list, callback)) { + return; + } + } + getColsForKeys(keys) { + if (!keys) { + return []; + } + return keys.map((key) => this.getCol(key)).filter((col) => col != null); + } + getColDefCol(key) { + if (!this.colDefCols?.list) { + return null; + } + return this.getColFromCollection(key, this.colDefCols); + } + getCol(key) { + if (key == null) { + return null; + } + return this.getColFromCollection(key, this.cols); + } + getColById(key) { + return this.cols?.map[key] ?? null; + } + getColFromCollection(key, cols) { + if (cols == null) { + return null; + } + const { map, list } = cols; + if (typeof key == "string" && map[key]) { + return map[key]; + } + for (let i = 0;i < list.length; i++) { + if (_columnsMatch(list[i], key)) { + return list[i]; + } + } + const { autoColSvc, selectionColSvc, groupHierarchyColSvc } = this.beans; + return autoColSvc?.getColumn(key) ?? selectionColSvc?.getColumn(key) ?? groupHierarchyColSvc?.getColumn(key) ?? null; + } +}; +var agAbstractLabel_default = ".ag-label{white-space:nowrap}:where(.ag-ltr) .ag-label{margin-right:var(--ag-spacing)}:where(.ag-rtl) .ag-label{margin-left:var(--ag-spacing)}:where(.ag-label-align-right) .ag-label{order:1}:where(.ag-ltr) :where(.ag-label-align-right) .ag-label{margin-left:var(--ag-spacing)}:where(.ag-rtl) :where(.ag-label-align-right) .ag-label{margin-right:var(--ag-spacing)}:where(.ag-label-align-right){.ag-label,.ag-wrapper{flex:none}}.ag-label-align-top{align-items:flex-start;flex-direction:column}:where(.ag-label-align-top){.ag-label,.ag-wrapper{align-self:stretch}}.ag-label-ellipsis{flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}:where(.ag-label-align-top) .ag-label{margin-bottom:calc(var(--ag-spacing)*.5)}"; +var AgAbstractLabel = class extends AgComponentStub { + constructor(config, template, components) { + super(template, components); + this.labelSeparator = ""; + this.labelAlignment = "left"; + this.disabled = false; + this.label = ""; + this.config = config || {}; + this.registerCSS(agAbstractLabel_default); + } + postConstruct() { + this.addCss("ag-labeled"); + this.eLabel.classList.add("ag-label"); + const { labelSeparator, label, labelWidth, labelAlignment, disabled, labelEllipsis } = this.config; + if (disabled != null) { + this.setDisabled(disabled); + } + if (labelSeparator != null) { + this.setLabelSeparator(labelSeparator); + } + if (label != null) { + this.setLabel(label); + } + if (labelWidth != null) { + this.setLabelWidth(labelWidth); + } + if (labelEllipsis != null) { + this.setLabelEllipsis(labelEllipsis); + } + this.setLabelAlignment(labelAlignment || this.labelAlignment); + this.refreshLabel(); + } + refreshLabel() { + const { label, eLabel } = this; + _clearElement(eLabel); + if (typeof label === "string") { + eLabel.innerText = label + this.labelSeparator; + } else if (label) { + eLabel.appendChild(label); + } + if (label === "") { + _setDisplayed(eLabel, false); + _setAriaRole(eLabel, "presentation"); + } else { + _setDisplayed(eLabel, true); + _setAriaRole(eLabel, null); + } + } + setLabelSeparator(labelSeparator) { + if (this.labelSeparator === labelSeparator) { + return this; + } + this.labelSeparator = labelSeparator; + if (this.label != null) { + this.refreshLabel(); + } + return this; + } + getLabelId() { + const eLabel = this.eLabel; + eLabel.id = eLabel.id || `ag-${this.getCompId()}-label`; + return eLabel.id; + } + getLabel() { + return this.label; + } + setLabel(label) { + if (this.label === label) { + return this; + } + this.label = label; + this.refreshLabel(); + return this; + } + setLabelAlignment(alignment) { + const eGui = this.getGui(); + const eGuiClassList = eGui.classList; + eGuiClassList.toggle("ag-label-align-left", alignment === "left"); + eGuiClassList.toggle("ag-label-align-right", alignment === "right"); + eGuiClassList.toggle("ag-label-align-top", alignment === "top"); + return this; + } + setLabelEllipsis(hasEllipsis) { + this.eLabel.classList.toggle("ag-label-ellipsis", hasEllipsis); + return this; + } + setLabelWidth(width) { + if (this.label == null) { + return this; + } + _setElementWidth(this.eLabel, width); + return this; + } + setDisabled(disabled) { + disabled = !!disabled; + const element = this.getGui(); + _setDisabled(element, disabled); + element.classList.toggle("ag-disabled", disabled); + this.disabled = disabled; + return this; + } + isDisabled() { + return !!this.disabled; + } +}; +var AgAbstractField = class extends AgAbstractLabel { + constructor(config, template, components, className) { + super(config, template, components); + this.className = className; + } + postConstruct() { + super.postConstruct(); + const { width, value, onValueChange, ariaLabel } = this.config; + if (width != null) { + this.setWidth(width); + } + if (value != null) { + this.setValue(value); + } + if (onValueChange != null) { + this.onValueChange(onValueChange); + } + if (ariaLabel != null) { + this.setAriaLabel(ariaLabel); + } + if (this.className) { + this.addCss(this.className); + } + this.refreshAriaLabelledBy(); + } + setLabel(label) { + super.setLabel(label); + this.refreshAriaLabelledBy(); + return this; + } + refreshAriaLabelledBy() { + const ariaEl = this.getAriaElement(); + const labelId = this.getLabelId(); + const label = this.getLabel(); + if (label == null || label == "" || _getAriaLabel(ariaEl) !== null) { + _setAriaLabelledBy(ariaEl, ""); + } else { + _setAriaLabelledBy(ariaEl, labelId ?? ""); + } + } + setAriaLabel(label) { + _setAriaLabel(this.getAriaElement(), label); + this.refreshAriaLabelledBy(); + return this; + } + onValueChange(callbackFn) { + this.addManagedListeners(this, { fieldValueChanged: () => callbackFn(this.getValue()) }); + return this; + } + getWidth() { + return this.getGui().clientWidth; + } + setWidth(width) { + _setFixedWidth(this.getGui(), width); + return this; + } + getPreviousValue() { + return this.previousValue; + } + getValue() { + return this.value; + } + setValue(value, silent) { + if (this.value === value) { + return this; + } + this.previousValue = this.value; + this.value = value; + if (!silent) { + this.dispatchLocalEvent({ type: "fieldValueChanged" }); + } + return this; + } +}; +function buildTemplate(displayFieldTag) { + 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: displayFieldTag, ref: "eInput", cls: "ag-input-field-input" }] + } + ] + }; +} +var AgAbstractInputField = class extends AgAbstractField { + constructor(config, className, inputType = "text", displayFieldTag = "input") { + super(config, config?.template ?? buildTemplate(displayFieldTag), [], className); + this.inputType = inputType; + this.displayFieldTag = displayFieldTag; + this.eLabel = RefPlaceholder; + this.eWrapper = RefPlaceholder; + this.eInput = RefPlaceholder; + } + postConstruct() { + super.postConstruct(); + this.setInputType(this.inputType); + const { eLabel, eWrapper, eInput, className } = this; + eLabel.classList.add(`${className}-label`); + eWrapper.classList.add(`${className}-input-wrapper`); + eInput.classList.add(`${className}-input`); + this.addCss("ag-input-field"); + eInput.id = eInput.id || `ag-${this.getCompId()}-input`; + const { inputName, inputWidth, inputPlaceholder, autoComplete, tabIndex } = this.config; + if (inputName != null) { + this.setInputName(inputName); + } + if (inputWidth != null) { + this.setInputWidth(inputWidth); + } + if (inputPlaceholder != null) { + this.setInputPlaceholder(inputPlaceholder); + } + if (autoComplete != null) { + this.setAutoComplete(autoComplete); + } + this.addInputListeners(); + this.activateTabIndex([eInput], tabIndex); + } + addInputListeners() { + this.addManagedElementListeners(this.eInput, { + input: (e) => this.setValue(e.target.value) + }); + } + setInputType(inputType) { + if (this.displayFieldTag === "input") { + this.inputType = inputType; + _addOrRemoveAttribute(this.eInput, "type", inputType); + } + } + getInputElement() { + return this.eInput; + } + getWrapperElement() { + return this.eWrapper; + } + setInputWidth(width) { + _setElementWidth(this.eWrapper, width); + return this; + } + setInputName(name) { + this.getInputElement().setAttribute("name", name); + return this; + } + getFocusableElement() { + return this.eInput; + } + setMaxLength(length) { + const eInput = this.eInput; + eInput.maxLength = length; + return this; + } + setInputPlaceholder(placeholder) { + _addOrRemoveAttribute(this.eInput, "placeholder", placeholder); + return this; + } + setInputAriaLabel(label) { + _setAriaLabel(this.eInput, label); + this.refreshAriaLabelledBy(); + return this; + } + setDisabled(disabled) { + _setDisabled(this.eInput, disabled); + return super.setDisabled(disabled); + } + setAutoComplete(value) { + if (value === true) { + _addOrRemoveAttribute(this.eInput, "autocomplete", null); + } else { + const autoCompleteValue = typeof value === "string" ? value : "off"; + _addOrRemoveAttribute(this.eInput, "autocomplete", autoCompleteValue); + } + return this; + } +}; +var AgCheckbox = class extends AgAbstractInputField { + constructor(config, className = "ag-checkbox", inputType = "checkbox") { + super(config, className, inputType); + this.labelAlignment = "right"; + this.selected = false; + this.readOnly = false; + this.passive = false; + } + postConstruct() { + super.postConstruct(); + const { readOnly, passive, name } = this.config; + if (typeof readOnly === "boolean") { + this.setReadOnly(readOnly); + } + if (typeof passive === "boolean") { + this.setPassive(passive); + } + if (name != null) { + this.setName(name); + } + } + addInputListeners() { + this.addManagedElementListeners(this.eInput, { click: this.onCheckboxClick.bind(this) }); + this.addManagedElementListeners(this.eLabel, { click: this.toggle.bind(this) }); + } + getNextValue() { + return this.selected === undefined ? true : !this.selected; + } + setPassive(passive) { + this.passive = passive; + } + isReadOnly() { + return this.readOnly; + } + setReadOnly(readOnly) { + this.eWrapper.classList.toggle("ag-disabled", readOnly); + this.eInput.disabled = readOnly; + this.readOnly = readOnly; + } + setDisabled(disabled) { + this.eWrapper.classList.toggle("ag-disabled", disabled); + return super.setDisabled(disabled); + } + toggle() { + if (this.eInput.disabled) { + return; + } + const previousValue = this.isSelected(); + const nextValue = this.getNextValue(); + if (this.passive) { + this.dispatchChange(nextValue, previousValue); + } else { + this.setValue(nextValue); + } + } + getValue() { + return this.isSelected(); + } + setValue(value, silent) { + this.refreshSelectedClass(value); + this.setSelected(value, silent); + return this; + } + setName(name) { + const input = this.getInputElement(); + input.name = name; + return this; + } + isSelected() { + return this.selected; + } + setSelected(selected, silent) { + if (this.isSelected() === selected) { + return; + } + this.previousValue = this.isSelected(); + selected = this.selected = typeof selected === "boolean" ? selected : undefined; + const eInput = this.eInput; + eInput.checked = selected; + eInput.indeterminate = selected === undefined; + if (!silent) { + this.dispatchChange(this.selected, this.previousValue); + } + } + dispatchChange(selected, previousValue, event) { + this.dispatchLocalEvent({ type: "fieldValueChanged", selected, previousValue, event }); + const input = this.getInputElement(); + this.eventSvc.dispatchEvent({ + type: "checkboxChanged", + id: input.id, + name: input.name, + selected, + previousValue + }); + } + onCheckboxClick(e) { + if (this.passive || this.eInput.disabled) { + return; + } + const previousValue = this.isSelected(); + const selected = this.selected = e.target.checked; + this.refreshSelectedClass(selected); + this.dispatchChange(selected, previousValue, e); + } + refreshSelectedClass(value) { + const classList = this.eWrapper.classList; + classList.toggle("ag-checked", value === true); + classList.toggle("ag-indeterminate", value == null); + } +}; +var AgCheckboxSelector = { + selector: "AG-CHECKBOX", + component: AgCheckbox +}; +var checkboxCellRenderer_default = ".ag-checkbox-cell{height:100%}"; +var CheckboxCellRendererElement = { + tag: "div", + cls: "ag-cell-wrapper ag-checkbox-cell", + role: "presentation", + children: [ + { + tag: "ag-checkbox", + ref: "eCheckbox", + role: "presentation" + } + ] +}; +var CheckboxCellRenderer = class extends Component { + constructor() { + super(CheckboxCellRendererElement, [AgCheckboxSelector]); + this.eCheckbox = RefPlaceholder; + this.registerCSS(checkboxCellRenderer_default); + } + init(params) { + this.refresh(params); + const { eCheckbox, beans } = this; + const inputEl = eCheckbox.getInputElement(); + inputEl.setAttribute("tabindex", "-1"); + _setAriaLive(inputEl, "polite"); + this.addManagedListeners(inputEl, { + click: (event) => { + _stopPropagationForAgGrid(event); + if (eCheckbox.isDisabled()) { + return; + } + const isSelected = eCheckbox.getValue(); + this.onCheckboxChanged(isSelected); + }, + dblclick: (event) => { + _stopPropagationForAgGrid(event); + } + }); + this.addManagedElementListeners(params.eGridCell, { + keydown: (event) => { + if (event.key === KeyCode.SPACE && !eCheckbox.isDisabled()) { + if (params.eGridCell === _getActiveDomElement(beans)) { + eCheckbox.toggle(); + } + const isSelected = eCheckbox.getValue(); + this.onCheckboxChanged(isSelected); + event.preventDefault(); + } + } + }); + } + refresh(params) { + this.params = params; + this.updateCheckbox(params); + return true; + } + updateCheckbox(params) { + let isSelected; + let displayed = true; + const { value, column, node } = params; + if (node.group && column) { + if (typeof value === "boolean") { + isSelected = value; + } else { + const colId = column.getColId(); + if (colId.startsWith(GROUP_AUTO_COLUMN_ID)) { + isSelected = value == null || value === "" ? undefined : value === "true"; + } else if (node.aggData && node.aggData[colId] !== undefined) { + isSelected = value ?? undefined; + } else if (node.sourceRowIndex >= 0) { + isSelected = value ?? undefined; + } else { + displayed = false; + } + } + } else { + isSelected = value ?? undefined; + } + const { eCheckbox } = this; + if (!displayed) { + eCheckbox.setDisplayed(false); + return; + } + eCheckbox.setValue(isSelected); + const disabled = params.disabled ?? !column?.isCellEditable(node); + eCheckbox.setDisabled(disabled); + const translate = this.getLocaleTextFunc(); + const stateName = _getAriaCheckboxStateName(translate, isSelected); + const ariaLabel = disabled ? stateName : `${translate("ariaToggleCellValue", "Press SPACE to toggle cell value")} (${stateName})`; + eCheckbox.setInputAriaLabel(ariaLabel); + } + onCheckboxChanged(isSelected) { + const { params } = this; + const { column, node, value: oldValue } = params; + const { editSvc } = this.beans; + if (!column) { + return; + } + const position = { rowNode: node, column }; + editSvc?.dispatchCellEvent(position, null, "cellEditingStarted", { value: oldValue }); + const valueChanged = node.setDataValue(column, isSelected, "ui"); + editSvc?.dispatchCellEvent(position, null, "cellEditingStopped", { + oldValue, + newValue: isSelected, + valueChanged + }); + if (!valueChanged) { + this.updateCheckbox(params); + } + } +}; +var SkeletonCellRendererElement = { tag: "div", cls: "ag-skeleton-container" }; +var SkeletonCellRenderer = class extends Component { + constructor() { + super(SkeletonCellRendererElement); + } + init(params) { + const id = `ag-cell-skeleton-renderer-${this.getCompId()}`; + this.getGui().setAttribute("id", id); + this.addDestroyFunc(() => _setAriaLabelledBy(params.eParentOfValue)); + _setAriaLabelledBy(params.eParentOfValue, id); + if (params.deferRender) { + this.setupLoading(params); + } else if (params.node.failedLoad) { + this.setupFailed(); + } else { + this.setupLoading(params); + } + } + setupFailed() { + const localeTextFunc = this.getLocaleTextFunc(); + this.getGui().textContent = localeTextFunc("loadingError", "ERR"); + const ariaFailed = localeTextFunc("ariaSkeletonCellLoadingFailed", "Row failed to load"); + _setAriaLabel(this.getGui(), ariaFailed); + } + setupLoading(params) { + const skeletonEffect = _createElement({ + tag: "div", + cls: "ag-skeleton-effect" + }); + const rowIndex = params.node.rowIndex; + if (rowIndex != null) { + const width = 75 + 25 * (rowIndex % 2 === 0 ? Math.sin(rowIndex) : Math.cos(rowIndex)); + skeletonEffect.style.width = `${width}%`; + } + this.getGui().appendChild(skeletonEffect); + const localeTextFunc = this.getLocaleTextFunc(); + const ariaLoading = params.deferRender ? localeTextFunc("ariaDeferSkeletonCellLoading", "Cell is loading") : localeTextFunc("ariaSkeletonCellLoading", "Row data is loading"); + _setAriaLabel(this.getGui(), ariaLoading); + } + refresh(_params) { + return false; + } +}; +var CheckboxCellRendererModule = { + moduleName: "CheckboxCellRenderer", + version: VERSION, + userComponents: { + agCheckboxCellRenderer: CheckboxCellRenderer + } +}; +var SkeletonCellRendererModule = { + moduleName: "SkeletonCellRenderer", + version: VERSION, + userComponents: { + agSkeletonCellRenderer: SkeletonCellRenderer + } +}; +var ColumnFlexService = class extends BeanStub { + constructor() { + super(...arguments); + this.beanName = "colFlex"; + this.columnsHidden = false; + } + refreshFlexedColumns(params = {}) { + const source = params.source ?? "flex"; + if (params.viewportWidth != null) { + this.flexViewportWidth = params.viewportWidth; + } + const totalSpace = this.flexViewportWidth; + const { visibleCols, colDelayRenderSvc } = this.beans; + const visibleCenterCols = visibleCols.centerCols; + let flexAfterDisplayIndex = -1; + if (params.resizingCols) { + const allResizingCols = new Set(params.resizingCols); + for (let i = visibleCenterCols.length - 1;i >= 0; i--) { + if (allResizingCols.has(visibleCenterCols[i])) { + flexAfterDisplayIndex = i; + break; + } + } + } + let hasFlexItems = false; + const items = visibleCenterCols.map((col, i) => { + const flex = col.getFlex(); + const isFlex = flex != null && flex > 0 && i > flexAfterDisplayIndex; + hasFlexItems || (hasFlexItems = isFlex); + return { + col, + isFlex, + flex: Math.max(0, flex ?? 0), + initialSize: col.getActualWidth(), + min: col.getMinWidth(), + max: col.getMaxWidth(), + targetSize: 0 + }; + }); + if (hasFlexItems) { + colDelayRenderSvc?.hideColumns("colFlex"); + this.columnsHidden = true; + } else if (this.columnsHidden) { + this.revealColumns(colDelayRenderSvc); + } + if (!totalSpace || !hasFlexItems) { + return []; + } + let unfrozenItemCount = items.length; + let unfrozenFlex = items.reduce((acc, item) => acc + item.flex, 0); + let unfrozenSpace = totalSpace; + const freeze = (item, width) => { + item.frozenSize = width; + item.col.setActualWidth(width, source); + unfrozenSpace -= width; + unfrozenFlex -= item.flex; + unfrozenItemCount -= 1; + }; + const isFrozen = (item) => item.frozenSize != null; + for (const item of items) { + if (!item.isFlex) { + freeze(item, item.initialSize); + } + } + while (unfrozenItemCount > 0) { + const spaceToFill = Math.round(unfrozenFlex < 1 ? unfrozenSpace * unfrozenFlex : unfrozenSpace); + let lastUnfrozenItem; + let actualLeft = 0; + let idealRight = 0; + for (const item of items) { + if (isFrozen(item)) { + continue; + } + lastUnfrozenItem = item; + idealRight += spaceToFill * (item.flex / unfrozenFlex); + const idealSize = idealRight - actualLeft; + const roundedSize = Math.round(idealSize); + item.targetSize = roundedSize; + actualLeft += roundedSize; + } + if (lastUnfrozenItem) { + lastUnfrozenItem.targetSize += spaceToFill - actualLeft; + } + let totalViolation = 0; + for (const item of items) { + if (isFrozen(item)) { + continue; + } + const unclampedSize = item.targetSize; + const clampedSize = Math.min(Math.max(unclampedSize, item.min), item.max); + totalViolation += clampedSize - unclampedSize; + item.violationType = clampedSize === unclampedSize ? undefined : clampedSize < unclampedSize ? "max" : "min"; + item.targetSize = clampedSize; + } + const freezeType = totalViolation === 0 ? "all" : totalViolation > 0 ? "min" : "max"; + for (const item of items) { + if (isFrozen(item)) { + continue; + } + if (freezeType === "all" || item.violationType === freezeType) { + freeze(item, item.targetSize); + } + } + } + if (!params.skipSetLeft) { + visibleCols.setLeftValues(source); + } + if (params.updateBodyWidths) { + visibleCols.updateBodyWidths(); + } + const unconstrainedFlexColumns = items.filter((item) => item.isFlex && !item.violationType).map((item) => item.col); + if (params.fireResizedEvent) { + const changedColumns = items.filter((item) => item.initialSize !== item.frozenSize).map((item) => item.col); + const flexingColumns = items.filter((item) => item.flex).map((item) => item.col); + dispatchColumnResizedEvent(this.eventSvc, changedColumns, true, source, flexingColumns); + } + this.revealColumns(colDelayRenderSvc); + return unconstrainedFlexColumns; + } + revealColumns(colDelayRenderSvc) { + if (this.columnsHidden) { + colDelayRenderSvc?.revealColumns("colFlex"); + this.columnsHidden = false; + } + } + initCol(column) { + const { flex, initialFlex } = column.colDef; + if (flex !== undefined) { + column.flex = flex; + } else if (initialFlex !== undefined) { + column.flex = initialFlex; + } + } + setColFlex(column, flex) { + column.flex = flex ?? null; + column.dispatchStateUpdatedEvent("flex"); + } +}; +var _parseBigIntOrNull = (value) => { + if (typeof value === "bigint") { + return value; + } + let trimmed; + if (typeof value === "number") { + trimmed = value; + } else if (typeof value === "string") { + trimmed = value.trim(); + if (trimmed === "") { + return null; + } + if (trimmed.endsWith("n")) { + trimmed = trimmed.slice(0, -1); + } + if (!/^[+-]?\d+$/.test(trimmed)) { + return null; + } + } + if (trimmed == null) { + return null; + } + try { + return BigInt(trimmed); + } catch { + return null; + } +}; +var DATE_TIME_SEPARATOR = "T"; +var DATE_TIME_SEPARATOR_REGEXP = new RegExp(`[${DATE_TIME_SEPARATOR} ]`); +var DATE_TIME_REGEXP = new RegExp(`^\\d{4}-\\d{2}-\\d{2}(${DATE_TIME_SEPARATOR}\\d{2}:\\d{2}:\\d{2}\\D?)?`); +function _padStartWidthZeros(value, totalStringSize) { + return value.toString().padStart(totalStringSize, "0"); +} +function _serialiseDate(date, includeTime = true, separator = DATE_TIME_SEPARATOR) { + if (!date) { + return null; + } + let serialised = [date.getFullYear(), date.getMonth() + 1, date.getDate()].map((part) => _padStartWidthZeros(part, 2)).join("-"); + if (includeTime) { + serialised += separator + [date.getHours(), date.getMinutes(), date.getSeconds()].map((part) => _padStartWidthZeros(part, 2)).join(":"); + } + return serialised; +} +function _getDateParts(d, includeTime = true) { + if (!d) { + return null; + } + if (includeTime) { + return [ + String(d.getFullYear()), + String(d.getMonth() + 1), + _padStartWidthZeros(d.getDate(), 2), + _padStartWidthZeros(d.getHours(), 2), + `:${_padStartWidthZeros(d.getMinutes(), 2)}`, + `:${_padStartWidthZeros(d.getSeconds(), 2)}` + ]; + } + return [d.getFullYear(), d.getMonth() + 1, _padStartWidthZeros(d.getDate(), 2)].map(String); +} +var calculateOrdinal = (value) => { + if (value > 3 && value < 21) { + return "th"; + } + const remainder = value % 10; + switch (remainder) { + case 1: + return "st"; + case 2: + return "nd"; + case 3: + return "rd"; + } + return "th"; +}; +var MONTHS = [ + "January", + "February", + "March", + "April", + "May", + "June", + "July", + "August", + "September", + "October", + "November", + "December" +]; +var DAYS = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"]; +function _dateToFormattedString(date, format) { + if (format == null) { + return _serialiseDate(date, false); + } + const fullYear = _padStartWidthZeros(date.getFullYear(), 4); + const replace = { + YYYY: () => fullYear.slice(fullYear.length - 4, fullYear.length), + YY: () => fullYear.slice(fullYear.length - 2, fullYear.length), + Y: () => `${date.getFullYear()}`, + MMMM: () => MONTHS[date.getMonth()], + MMM: () => MONTHS[date.getMonth()].slice(0, 3), + MM: () => _padStartWidthZeros(date.getMonth() + 1, 2), + Mo: () => `${date.getMonth() + 1}${calculateOrdinal(date.getMonth() + 1)}`, + M: () => `${date.getMonth() + 1}`, + Do: () => `${date.getDate()}${calculateOrdinal(date.getDate())}`, + DD: () => _padStartWidthZeros(date.getDate(), 2), + D: () => `${date.getDate()}`, + dddd: () => DAYS[date.getDay()], + ddd: () => DAYS[date.getDay()].slice(0, 3), + dd: () => DAYS[date.getDay()].slice(0, 2), + do: () => `${date.getDay()}${calculateOrdinal(date.getDay())}`, + d: () => `${date.getDay()}` + }; + const regexp = new RegExp(Object.keys(replace).join("|"), "g"); + return format.replace(regexp, (match) => { + if (match in replace) { + return replace[match](); + } + return match; + }); +} +function _isValidDate(value, bailIfInvalidTime = false) { + return !!_parseDateTimeFromString(value, bailIfInvalidTime); +} +function _isValidDateTime(value) { + return _isValidDate(value, true); +} +function _parseDateTimeFromString(value, bailIfInvalidTime = false, skipValidation) { + if (!value) { + return null; + } + if (!skipValidation && !DATE_TIME_REGEXP.test(value)) { + return null; + } + const [dateStr, timeStr] = value.split(DATE_TIME_SEPARATOR_REGEXP); + if (!dateStr) { + return null; + } + const fields = dateStr.split("-").map((f) => Number.parseInt(f, 10)); + if (fields.filter((f) => !isNaN(f)).length !== 3) { + return null; + } + const [year, month, day] = fields; + const date = new Date(year, month - 1, day); + if (date.getFullYear() !== year || date.getMonth() !== month - 1 || date.getDate() !== day) { + return null; + } + if (!timeStr && bailIfInvalidTime) { + return null; + } + if (!timeStr || timeStr === "00:00:00") { + return date; + } + const [hours, minutes, seconds] = timeStr.split(":").map((part) => Number.parseInt(part, 10)); + if (hours >= 0 && hours < 24) { + date.setHours(hours); + } else if (bailIfInvalidTime) { + return null; + } + if (minutes >= 0 && minutes < 60) { + date.setMinutes(minutes); + } else if (bailIfInvalidTime) { + return null; + } + if (seconds >= 0 && seconds < 60) { + date.setSeconds(seconds); + } else if (bailIfInvalidTime) { + return null; + } + return date; +} +function _getValueUsingField(data, field, fieldContainsDots) { + if (!field || !data) { + return; + } + if (!fieldContainsDots) { + return data[field]; + } + const fields = field.split("."); + let currentObject = data; + for (let i = 0;i < fields.length; i++) { + if (currentObject == null) { + return; + } + currentObject = currentObject[fields[i]]; + } + return currentObject; +} +var SORTED_CELL_DATA_TYPES_FOR_MATCHING = [ + "dateTimeString", + "dateString", + "text", + "number", + "bigint", + "boolean", + "date" +]; +var DataTypeService = class extends BeanStub { + constructor() { + super(...arguments); + this.beanName = "dataTypeSvc"; + this.dataTypeDefinitions = {}; + this.isPendingInference = false; + this.isColumnTypeOverrideInDataTypeDefinitions = false; + this.columnStateUpdatesPendingInference = {}; + this.columnStateUpdateListenerDestroyFuncs = []; + this.columnDefinitionPropsPerDataType = { + number() { + return { cellEditor: "agNumberCellEditor" }; + }, + bigint({ filterModuleBean }) { + if (filterModuleBean) { + return { + cellEditor: "agTextCellEditor" + }; + } + return { + cellEditor: "agTextCellEditor", + comparator: { + default: bigintComparator, + absolute: bigintAbsoluteComparator + } + }; + }, + boolean() { + return { + cellEditor: "agCheckboxCellEditor", + cellRenderer: "agCheckboxCellRenderer", + getFindText: () => null, + suppressKeyboardEvent: ({ node, event, column }) => event.key === KeyCode.SPACE && column.isCellEditable(node) + }; + }, + date({ formatValue }) { + return { cellEditor: "agDateCellEditor", keyCreator: formatValue }; + }, + dateString({ formatValue }) { + return { cellEditor: "agDateStringCellEditor", keyCreator: formatValue }; + }, + dateTime(args) { + return this.date(args); + }, + dateTimeString(args) { + return this.dateString(args); + }, + object({ formatValue, colModel, colId }) { + return { + cellEditorParams: { + useFormatter: true + }, + comparator: (a, b) => { + const column = colModel.getColDefCol(colId); + const colDef = column?.getColDef(); + if (!column || !colDef) { + return 0; + } + const valA = a == null ? "" : formatValue({ column, node: null, value: a }); + const valB = b == null ? "" : formatValue({ column, node: null, value: b }); + if (valA === valB) { + return 0; + } + return valA > valB ? 1 : -1; + }, + keyCreator: formatValue + }; + }, + text() { + return {}; + } + }; + } + wireBeans(beans) { + this.colModel = beans.colModel; + } + postConstruct() { + this.processDataTypeDefinitions(); + this.addManagedPropertyListener("dataTypeDefinitions", (event) => { + this.processDataTypeDefinitions(); + this.colModel.recreateColumnDefs(event); + }); + } + processDataTypeDefinitions() { + const defaultDataTypes = this.getDefaultDataTypes(); + const newDataTypeDefinitions = {}; + const newFormatValueFuncs = {}; + const generateFormatValueFunc = (dataTypeDefinition) => { + return (params) => { + const { column, node, value } = params; + let valueFormatter = column.getColDef().valueFormatter; + if (valueFormatter === dataTypeDefinition.groupSafeValueFormatter) { + valueFormatter = dataTypeDefinition.valueFormatter; + } + return this.beans.valueSvc.formatValue(column, node, value, valueFormatter); + }; + }; + for (const cellDataType of Object.keys(defaultDataTypes)) { + const defaultDataTypeDef = defaultDataTypes[cellDataType]; + const mergedDataTypeDefinition = { + ...defaultDataTypeDef, + groupSafeValueFormatter: createGroupSafeValueFormatter(defaultDataTypeDef, this.gos) + }; + newDataTypeDefinitions[cellDataType] = mergedDataTypeDefinition; + newFormatValueFuncs[cellDataType] = generateFormatValueFunc(mergedDataTypeDefinition); + } + const userDataTypeDefs = this.gos.get("dataTypeDefinitions") ?? {}; + const newDataTypeMatchers = {}; + for (const cellDataType of Object.keys(userDataTypeDefs)) { + const userDataTypeDef = userDataTypeDefs[cellDataType]; + const mergedDataTypeDefinition = this.processDataTypeDefinition(userDataTypeDef, userDataTypeDefs, [cellDataType], defaultDataTypes); + if (mergedDataTypeDefinition) { + newDataTypeDefinitions[cellDataType] = mergedDataTypeDefinition; + if (userDataTypeDef.dataTypeMatcher) { + newDataTypeMatchers[cellDataType] = userDataTypeDef.dataTypeMatcher; + } + newFormatValueFuncs[cellDataType] = generateFormatValueFunc(mergedDataTypeDefinition); + } + } + const { valueParser: defaultValueParser, valueFormatter: defaultValueFormatter } = defaultDataTypes.object; + const { valueParser: userValueParser, valueFormatter: userValueFormatter } = newDataTypeDefinitions.object; + this.hasObjectValueParser = userValueParser !== defaultValueParser; + this.hasObjectValueFormatter = userValueFormatter !== defaultValueFormatter; + this.formatValueFuncs = newFormatValueFuncs; + this.dataTypeDefinitions = newDataTypeDefinitions; + this.dataTypeMatchers = this.sortKeysInMatchers(newDataTypeMatchers, defaultDataTypes); + } + sortKeysInMatchers(matchers, dataTypes) { + const sortedMatchers = { ...matchers }; + for (const cellDataType of SORTED_CELL_DATA_TYPES_FOR_MATCHING) { + delete sortedMatchers[cellDataType]; + sortedMatchers[cellDataType] = matchers[cellDataType] ?? dataTypes[cellDataType].dataTypeMatcher; + } + return sortedMatchers; + } + processDataTypeDefinition(userDataTypeDef, userDataTypeDefs, alreadyProcessedDataTypes, defaultDataTypes) { + let mergedDataTypeDefinition; + const extendsCellDataType = userDataTypeDef.extendsDataType; + if (userDataTypeDef.columnTypes) { + this.isColumnTypeOverrideInDataTypeDefinitions = true; + } + if (userDataTypeDef.extendsDataType === userDataTypeDef.baseDataType) { + let baseDataTypeDefinition = defaultDataTypes[extendsCellDataType]; + const overriddenBaseDataTypeDefinition = userDataTypeDefs[extendsCellDataType]; + if (baseDataTypeDefinition && overriddenBaseDataTypeDefinition) { + baseDataTypeDefinition = overriddenBaseDataTypeDefinition; + } + if (!validateDataTypeDefinition(userDataTypeDef, baseDataTypeDefinition, extendsCellDataType)) { + return; + } + mergedDataTypeDefinition = mergeDataTypeDefinitions(baseDataTypeDefinition, userDataTypeDef); + } else { + if (alreadyProcessedDataTypes.includes(extendsCellDataType)) { + _warn(44); + return; + } + const extendedDataTypeDefinition = userDataTypeDefs[extendsCellDataType]; + if (!validateDataTypeDefinition(userDataTypeDef, extendedDataTypeDefinition, extendsCellDataType)) { + return; + } + const mergedExtendedDataTypeDefinition = this.processDataTypeDefinition(extendedDataTypeDefinition, userDataTypeDefs, [...alreadyProcessedDataTypes, extendsCellDataType], defaultDataTypes); + if (!mergedExtendedDataTypeDefinition) { + return; + } + mergedDataTypeDefinition = mergeDataTypeDefinitions(mergedExtendedDataTypeDefinition, userDataTypeDef); + } + return { + ...mergedDataTypeDefinition, + groupSafeValueFormatter: createGroupSafeValueFormatter(mergedDataTypeDefinition, this.gos) + }; + } + updateColDefAndGetColumnType(colDef, userColDef, colId) { + let { cellDataType } = userColDef; + if (cellDataType === undefined) { + cellDataType = colDef.cellDataType; + } + const { field } = userColDef; + if (cellDataType == null || cellDataType === true) { + cellDataType = this.canInferCellDataType(colDef, userColDef) ? this.inferCellDataType(field, colId) : false; + } + this.addFormulaCellEditorToColDef(colDef, userColDef); + if (!cellDataType) { + colDef.cellDataType = false; + return; + } + const dataTypeDefinition = this.dataTypeDefinitions[cellDataType]; + if (!dataTypeDefinition) { + _warn(47, { cellDataType }); + return; + } + colDef.cellDataType = cellDataType; + if (dataTypeDefinition.groupSafeValueFormatter) { + colDef.valueFormatter = dataTypeDefinition.groupSafeValueFormatter; + } + if (dataTypeDefinition.valueParser) { + colDef.valueParser = dataTypeDefinition.valueParser; + } + if (!dataTypeDefinition.suppressDefaultProperties) { + this.setColDefPropertiesForBaseDataType(colDef, cellDataType, dataTypeDefinition, colId); + } + return dataTypeDefinition.columnTypes; + } + addFormulaCellEditorToColDef(colDef, userColDef) { + const allowFormula = userColDef.allowFormula ?? colDef.allowFormula; + if (!allowFormula || userColDef.cellEditor) { + return; + } + colDef.cellEditor = "agFormulaCellEditor"; + } + addColumnListeners(column) { + if (!this.isPendingInference) { + return; + } + const columnStateUpdates = this.columnStateUpdatesPendingInference[column.getColId()]; + if (!columnStateUpdates) { + return; + } + const columnListener = (event) => { + columnStateUpdates.add(event.key); + }; + column.__addEventListener("columnStateUpdated", columnListener); + this.columnStateUpdateListenerDestroyFuncs.push(() => column.__removeEventListener("columnStateUpdated", columnListener)); + } + canInferCellDataType(colDef, userColDef) { + const { gos } = this; + if (!_isClientSideRowModel(gos)) { + return false; + } + const propsToCheckForInference = { cellRenderer: true, valueGetter: true, valueParser: true, refData: true }; + if (doColDefPropsPreventInference(userColDef, propsToCheckForInference)) { + return false; + } + const columnTypes = userColDef.type === null ? colDef.type : userColDef.type; + if (columnTypes) { + const columnTypeDefs = gos.get("columnTypes") ?? {}; + const hasPropsPreventingInference = convertColumnTypes(columnTypes).some((columnType) => { + const columnTypeDef = columnTypeDefs[columnType.trim()]; + return columnTypeDef && doColDefPropsPreventInference(columnTypeDef, propsToCheckForInference); + }); + if (hasPropsPreventingInference) { + return false; + } + } + return !doColDefPropsPreventInference(colDef, propsToCheckForInference); + } + inferCellDataType(field, colId) { + if (!field) { + return; + } + let value; + const initialData = this.getInitialData(); + if (initialData) { + const fieldContainsDots = field.includes(".") && !this.gos.get("suppressFieldDotNotation"); + value = _getValueUsingField(initialData, field, fieldContainsDots); + } else { + this.initWaitForRowData(colId); + } + if (value == null) { + return; + } + const matchedType = Object.keys(this.dataTypeMatchers).find((_cellDataType) => this.dataTypeMatchers[_cellDataType](value)); + return matchedType ?? "object"; + } + getInitialData() { + const rowData = this.gos.get("rowData"); + if (rowData?.length) { + return rowData[0]; + } else if (this.initialData) { + return this.initialData; + } else { + const rowNodes = this.beans.rowModel.rootNode?._leafs; + if (rowNodes?.length) { + return rowNodes[0].data; + } + } + return null; + } + initWaitForRowData(colId) { + this.columnStateUpdatesPendingInference[colId] = /* @__PURE__ */ new Set; + if (this.isPendingInference) { + return; + } + this.isPendingInference = true; + const columnTypeOverridesExist = this.isColumnTypeOverrideInDataTypeDefinitions; + const { colAutosize, eventSvc } = this.beans; + if (columnTypeOverridesExist && colAutosize) { + colAutosize.shouldQueueResizeOperations = true; + } + const [destroyFunc] = this.addManagedEventListeners({ + rowDataUpdateStarted: (event) => { + const { firstRowData } = event; + if (!firstRowData) { + return; + } + destroyFunc?.(); + this.isPendingInference = false; + this.processColumnsPendingInference(firstRowData, columnTypeOverridesExist); + this.columnStateUpdatesPendingInference = {}; + if (columnTypeOverridesExist) { + colAutosize?.processResizeOperations(); + } + eventSvc.dispatchEvent({ + type: "dataTypesInferred" + }); + } + }); + } + processColumnsPendingInference(firstRowData, columnTypeOverridesExist) { + this.initialData = firstRowData; + const state = []; + this.destroyColumnStateUpdateListeners(); + const newRowGroupColumnStateWithoutIndex = {}; + const newPivotColumnStateWithoutIndex = {}; + for (const colId of Object.keys(this.columnStateUpdatesPendingInference)) { + const columnStateUpdates = this.columnStateUpdatesPendingInference[colId]; + const column = this.colModel.getCol(colId); + if (!column) { + continue; + } + const oldColDef = column.getColDef(); + if (!this.resetColDefIntoCol(column, "cellDataTypeInferred")) { + continue; + } + const newColDef = column.getColDef(); + if (columnTypeOverridesExist && newColDef.type && newColDef.type !== oldColDef.type) { + const updatedColumnState = getUpdatedColumnState(column, columnStateUpdates); + if (updatedColumnState.rowGroup && updatedColumnState.rowGroupIndex == null) { + newRowGroupColumnStateWithoutIndex[colId] = updatedColumnState; + } + if (updatedColumnState.pivot && updatedColumnState.pivotIndex == null) { + newPivotColumnStateWithoutIndex[colId] = updatedColumnState; + } + state.push(updatedColumnState); + } + } + if (columnTypeOverridesExist) { + state.push(...this.generateColumnStateForRowGroupAndPivotIndexes(newRowGroupColumnStateWithoutIndex, newPivotColumnStateWithoutIndex)); + } + if (state.length) { + _applyColumnState(this.beans, { state }, "cellDataTypeInferred"); + } + this.initialData = null; + } + generateColumnStateForRowGroupAndPivotIndexes(updatedRowGroupColumnState, updatedPivotColumnState) { + const existingColumnStateUpdates = {}; + const { rowGroupColsSvc, pivotColsSvc } = this.beans; + rowGroupColsSvc?.restoreColumnOrder(existingColumnStateUpdates, updatedRowGroupColumnState); + pivotColsSvc?.restoreColumnOrder(existingColumnStateUpdates, updatedPivotColumnState); + return Object.values(existingColumnStateUpdates); + } + resetColDefIntoCol(column, source) { + const userColDef = column.getUserProvidedColDef(); + if (!userColDef) { + return false; + } + const newColDef = _addColumnDefaultAndTypes(this.beans, userColDef, column.getColId()); + column.setColDef(newColDef, userColDef, source); + return true; + } + getDateStringTypeDefinition(column) { + const { dateString } = this.dataTypeDefinitions; + if (!column) { + return dateString; + } + return this.getDataTypeDefinition(column) ?? dateString; + } + getDateParserFunction(column) { + return this.getDateStringTypeDefinition(column).dateParser; + } + getDateFormatterFunction(column) { + return this.getDateStringTypeDefinition(column).dateFormatter; + } + getDateIncludesTimeFlag(cellDataType) { + return cellDataType === "dateTime" || cellDataType === "dateTimeString"; + } + getDataTypeDefinition(column) { + const colDef = column.getColDef(); + if (!colDef.cellDataType) { + return; + } + return this.dataTypeDefinitions[colDef.cellDataType]; + } + getBaseDataType(column) { + return this.getDataTypeDefinition(column)?.baseDataType; + } + checkType(column, value) { + if (value == null) { + return true; + } + const dataTypeMatcher = this.getDataTypeDefinition(column)?.dataTypeMatcher; + if (!dataTypeMatcher) { + return true; + } + if (column.getColDef().allowFormula && this.beans.formula?.isFormula(value)) { + return true; + } + return dataTypeMatcher(value); + } + validateColDef(colDef, userColDef, defaultColDef, colId) { + if (colDef.cellDataType === "object") { + const wasInferred = (colDef2) => { + return colDef2?.cellDataType == null || colDef2?.cellDataType === true; + }; + const inferred = wasInferred(userColDef) && wasInferred(defaultColDef); + const warning = (property) => _warn(48, { property, inferred, colId }); + const { object } = this.dataTypeDefinitions; + if (colDef.valueFormatter === object.groupSafeValueFormatter && !this.hasObjectValueFormatter) { + warning("Formatter"); + } + if (colDef.editable && colDef.valueParser === object.valueParser && !this.hasObjectValueParser) { + warning("Parser"); + } + } + } + postProcess(colDef) { + const cellDataType = colDef.cellDataType; + if (!cellDataType || typeof cellDataType !== "string") { + return; + } + const { dataTypeDefinitions, beans, formatValueFuncs } = this; + const dataTypeDefinition = dataTypeDefinitions[cellDataType]; + if (!dataTypeDefinition) { + return; + } + beans.colFilter?.setColDefPropsForDataType(colDef, dataTypeDefinition, formatValueFuncs[cellDataType]); + } + getFormatValue(cellDataType) { + return this.formatValueFuncs[cellDataType]; + } + isColPendingInference(colId) { + return this.isPendingInference && !!this.columnStateUpdatesPendingInference[colId]; + } + setColDefPropertiesForBaseDataType(colDef, cellDataType, dataTypeDefinition, colId) { + const formatValue = this.formatValueFuncs[cellDataType]; + const partialColDef = this.columnDefinitionPropsPerDataType[dataTypeDefinition.baseDataType]({ + colDef, + cellDataType, + colModel: this.colModel, + dataTypeDefinition, + colId, + formatValue, + filterModuleBean: this.beans.filterManager + }); + if (colDef.cellEditor === "agFormulaCellEditor" && partialColDef.cellEditor !== colDef.cellEditor) { + partialColDef.cellEditor = colDef.cellEditor; + } + Object.assign(colDef, partialColDef); + } + getDateObjectTypeDef(baseDataType) { + const translate = this.getLocaleTextFunc(); + const includeTime = this.getDateIncludesTimeFlag(baseDataType); + return { + baseDataType, + valueParser: (params) => _parseDateTimeFromString(params.newValue && String(params.newValue)), + valueFormatter: (params) => { + if (params.value == null) { + return ""; + } + if (!(params.value instanceof Date) || isNaN(params.value.getTime())) { + return translate("invalidDate", "Invalid Date"); + } + return _serialiseDate(params.value, includeTime) ?? ""; + }, + dataTypeMatcher: (value) => value instanceof Date + }; + } + getDateStringTypeDef(baseDataType) { + const includeTime = this.getDateIncludesTimeFlag(baseDataType); + return { + baseDataType, + dateParser: (value) => _parseDateTimeFromString(value) ?? undefined, + dateFormatter: (value) => _serialiseDate(value ?? null, includeTime) ?? undefined, + valueParser: (params) => _isValidDate(String(params.newValue)) ? params.newValue : null, + valueFormatter: (params) => _isValidDate(String(params.value)) ? String(params.value) : "", + dataTypeMatcher: (value) => typeof value === "string" && _isValidDate(value) + }; + } + getDefaultDataTypes() { + const translate = this.getLocaleTextFunc(); + return { + number: { + baseDataType: "number", + valueParser: (params) => params.newValue?.trim?.() === "" ? null : Number(params.newValue), + valueFormatter: (params) => { + if (params.value == null) { + return ""; + } + if (typeof params.value !== "number" || isNaN(params.value)) { + return translate("invalidNumber", "Invalid Number"); + } + return String(params.value); + }, + dataTypeMatcher: (value) => typeof value === "number" + }, + bigint: { + baseDataType: "bigint", + valueParser: (params) => { + const { newValue } = params; + if (newValue == null) { + return null; + } + if (typeof newValue === "string" && newValue.trim() === "") { + return null; + } + return _parseBigIntOrNull(newValue); + }, + valueFormatter: (params) => { + if (params.value == null) { + return ""; + } + if (typeof params.value !== "bigint") { + return translate("invalidBigInt", "Invalid BigInt"); + } + return String(params.value); + }, + dataTypeMatcher: (value) => typeof value === "bigint" + }, + text: { + baseDataType: "text", + valueParser: (params) => params.newValue === "" ? null : _toStringOrNull(params.newValue), + dataTypeMatcher: (value) => typeof value === "string" + }, + boolean: { + baseDataType: "boolean", + valueParser: (params) => { + if (params.newValue == null) { + return params.newValue; + } + return params.newValue?.trim?.() === "" ? null : String(params.newValue).toLowerCase() === "true"; + }, + valueFormatter: (params) => params.value == null ? "" : String(params.value), + dataTypeMatcher: (value) => typeof value === "boolean" + }, + date: this.getDateObjectTypeDef("date"), + dateString: this.getDateStringTypeDef("dateString"), + dateTime: this.getDateObjectTypeDef("dateTime"), + dateTimeString: { + ...this.getDateStringTypeDef("dateTimeString"), + dataTypeMatcher: (value) => typeof value === "string" && _isValidDateTime(value) + }, + object: { + baseDataType: "object", + valueParser: () => null, + valueFormatter: (params) => _toStringOrNull(params.value) ?? "" + } + }; + } + destroyColumnStateUpdateListeners() { + for (const destroyFunc of this.columnStateUpdateListenerDestroyFuncs) { + destroyFunc(); + } + this.columnStateUpdateListenerDestroyFuncs = []; + } + destroy() { + this.dataTypeDefinitions = {}; + this.dataTypeMatchers = {}; + this.formatValueFuncs = {}; + this.columnStateUpdatesPendingInference = {}; + this.destroyColumnStateUpdateListeners(); + super.destroy(); + } +}; +function mergeDataTypeDefinitions(parentDataTypeDefinition, childDataTypeDefinition) { + const mergedDataTypeDefinition = { + ...parentDataTypeDefinition, + ...childDataTypeDefinition + }; + if (parentDataTypeDefinition.columnTypes && childDataTypeDefinition.columnTypes && childDataTypeDefinition.appendColumnTypes) { + mergedDataTypeDefinition.columnTypes = [ + ...convertColumnTypes(parentDataTypeDefinition.columnTypes), + ...convertColumnTypes(childDataTypeDefinition.columnTypes) + ]; + } + return mergedDataTypeDefinition; +} +function validateDataTypeDefinition(dataTypeDefinition, parentDataTypeDefinition, parentCellDataType) { + if (!parentDataTypeDefinition) { + _warn(45, { parentCellDataType }); + return false; + } + if (parentDataTypeDefinition.baseDataType !== dataTypeDefinition.baseDataType) { + _warn(46); + return false; + } + return true; +} +var isNumberOrBigintType = (v) => typeof v === "bigint" || typeof v === "number"; +var isNumberOrBigintBaseDataType = (v) => v === "number" || v === "bigint"; +function createGroupSafeValueFormatter(dataTypeDefinition, gos) { + if (!dataTypeDefinition.valueFormatter) { + return; + } + return (params) => { + const { node, colDef, column, value } = params; + if (node?.group) { + const aggFunc = (colDef.pivotValueColumn ?? column).getAggFunc(); + if (aggFunc) { + if (aggFunc === "first" || aggFunc === "last") { + return dataTypeDefinition.valueFormatter(params); + } + const { baseDataType } = dataTypeDefinition; + if (isNumberOrBigintBaseDataType(baseDataType) && aggFunc !== "count") { + if (isNumberOrBigintType(value)) { + return dataTypeDefinition.valueFormatter(params); + } + if (value == null) { + return; + } + if (typeof value === "object") { + if (typeof value.toNumber === "function") { + return dataTypeDefinition.valueFormatter({ ...params, value: value.toNumber() }); + } + if ("value" in value) { + return dataTypeDefinition.valueFormatter({ ...params, value: value.value }); + } + } + } + return; + } + } else if (gos.get("groupHideOpenParents") && params.column.isRowGroupActive()) { + if (typeof params.value === "string" && !dataTypeDefinition.dataTypeMatcher?.(params.value)) { + return; + } + } + return dataTypeDefinition.valueFormatter(params); + }; +} +function doesColDefPropPreventInference(colDef, checkProps, prop, comparisonValue) { + if (!checkProps[prop]) { + return false; + } + const value = colDef[prop]; + if (value === null) { + checkProps[prop] = false; + return false; + } else { + return comparisonValue === undefined ? !!value : value === comparisonValue; + } +} +function bigintComparator(valueA, valueB) { + if (valueA == null) { + return valueB == null ? 0 : -1; + } + if (valueB == null) { + return 1; + } + const bigA = _parseBigIntOrNull(valueA); + const bigB = _parseBigIntOrNull(valueB); + if (bigA != null && bigB != null) { + if (bigA === bigB) { + return 0; + } + return bigA > bigB ? 1 : -1; + } + return 0; +} +function bigintAbsoluteComparator(valueA, valueB) { + if (valueA == null) { + return valueB == null ? 0 : -1; + } + if (valueB == null) { + return 1; + } + const bigA = toAbsoluteBigInt(valueA); + const bigB = toAbsoluteBigInt(valueB); + if (bigA != null && bigB != null) { + if (bigA === bigB) { + return 0; + } + return bigA > bigB ? 1 : -1; + } + return 0; +} +function toAbsoluteBigInt(value) { + const bigIntValue = _parseBigIntOrNull(value); + if (bigIntValue == null) { + return null; + } + return bigIntValue < 0n ? -bigIntValue : bigIntValue; +} +function doColDefPropsPreventInference(colDef, propsToCheckForInference) { + return [ + ["cellRenderer", "agSparklineCellRenderer"], + ["valueGetter", undefined], + ["valueParser", undefined], + ["refData", undefined] + ].some(([prop, comparisonValue]) => doesColDefPropPreventInference(colDef, propsToCheckForInference, prop, comparisonValue)); +} +function getUpdatedColumnState(column, columnStateUpdates) { + const columnState = getColumnStateFromColDef(column); + for (const key of columnStateUpdates) { + delete columnState[key]; + if (key === "rowGroup") { + delete columnState.rowGroupIndex; + } else if (key === "pivot") { + delete columnState.pivotIndex; + } + } + return columnState; +} +var DataTypeModule = { + moduleName: "DataType", + version: VERSION, + beans: [DataTypeService], + dependsOn: [CheckboxCellRendererModule] +}; +var ColumnFlexModule = { + moduleName: "ColumnFlex", + version: VERSION, + beans: [ColumnFlexService] +}; +var ColumnNameService = class extends BeanStub { + constructor() { + super(...arguments); + this.beanName = "colNames"; + } + getDisplayNameForColumn(column, location, includeAggFunc = false) { + if (!column) { + return null; + } + const headerName = this.getHeaderName(column.getColDef(), column, null, null, location); + const { aggColNameSvc } = this.beans; + if (includeAggFunc && aggColNameSvc) { + return aggColNameSvc.getHeaderName(column, headerName); + } + return headerName; + } + getDisplayNameForProvidedColumnGroup(columnGroup, providedColumnGroup, location) { + const colGroupDef = providedColumnGroup?.getColGroupDef(); + if (colGroupDef) { + return this.getHeaderName(colGroupDef, null, columnGroup, providedColumnGroup, location); + } + return null; + } + getDisplayNameForColumnGroup(columnGroup, location) { + return this.getDisplayNameForProvidedColumnGroup(columnGroup, columnGroup.getProvidedColumnGroup(), location); + } + getHeaderName(colDef, column, columnGroup, providedColumnGroup, location) { + const headerValueGetter = colDef.headerValueGetter; + if (headerValueGetter) { + const params = _addGridCommonParams(this.gos, { + colDef, + column, + columnGroup, + providedColumnGroup, + location + }); + if (typeof headerValueGetter === "function") { + return headerValueGetter(params); + } else if (typeof headerValueGetter === "string") { + return this.beans.expressionSvc?.evaluate(headerValueGetter, params) ?? null; + } + return ""; + } else if (colDef.headerName != null) { + return colDef.headerName; + } else if (colDef.field) { + return _camelCaseToHumanText(colDef.field); + } + return ""; + } +}; +var ColumnViewportService = class extends BeanStub { + 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(beans) { + this.visibleCols = beans.visibleCols; + this.colModel = beans.colModel; + } + postConstruct() { + this.suppressColumnVirtualisation = this.gos.get("suppressColumnVirtualisation"); + } + getScrollPosition() { + return this.scrollPosition; + } + setScrollPosition(scrollWidth, scrollPosition, afterScroll = false) { + const { visibleCols } = this; + const bodyWidthDirty = visibleCols.isBodyWidthDirty; + const noChange = scrollWidth === this.scrollWidth && scrollPosition === this.scrollPosition && !bodyWidthDirty; + if (noChange) { + return; + } + this.scrollWidth = scrollWidth; + this.scrollPosition = scrollPosition; + visibleCols.isBodyWidthDirty = true; + if (this.gos.get("enableRtl")) { + const bodyWidth = visibleCols.bodyWidth; + this.viewportLeft = bodyWidth - scrollPosition - scrollWidth; + this.viewportRight = bodyWidth - scrollPosition; + } else { + this.viewportLeft = scrollPosition; + this.viewportRight = scrollWidth + scrollPosition; + } + if (this.colModel.ready) { + this.checkViewportColumns(afterScroll); + } + } + getColumnHeadersToRender(type) { + switch (type) { + case "left": + return this.columnsToRenderLeft; + case "right": + return this.columnsToRenderRight; + default: + return this.columnsToRenderCenter; + } + } + getHeadersToRender(type, depth) { + let result; + switch (type) { + case "left": + result = this.rowsOfHeadersToRenderLeft[depth]; + break; + case "right": + result = this.rowsOfHeadersToRenderRight[depth]; + break; + default: + result = this.rowsOfHeadersToRenderCenter[depth]; + break; + } + return result ?? []; + } + extractViewportColumns() { + const displayedColumnsCenter = this.visibleCols.centerCols; + if (this.isColumnVirtualisationSuppressed()) { + this.colsWithinViewport = displayedColumnsCenter; + this.headerColsWithinViewport = displayedColumnsCenter; + } else { + this.colsWithinViewport = displayedColumnsCenter.filter(this.isColumnInRowViewport.bind(this)); + this.headerColsWithinViewport = displayedColumnsCenter.filter(this.isColumnInHeaderViewport.bind(this)); + } + } + isColumnVirtualisationSuppressed() { + return this.suppressColumnVirtualisation || this.viewportRight === 0; + } + clear() { + this.rowsOfHeadersToRenderLeft = {}; + this.rowsOfHeadersToRenderRight = {}; + this.rowsOfHeadersToRenderCenter = {}; + this.colsWithinViewportHash = ""; + } + isColumnInHeaderViewport(col) { + if (col.isAutoHeaderHeight() || isAnyParentAutoHeaderHeight(col)) { + return true; + } + return this.isColumnInRowViewport(col); + } + isColumnInRowViewport(col) { + if (col.isAutoHeight()) { + return true; + } + const columnLeft = col.getLeft() || 0; + const columnRight = columnLeft + col.getActualWidth(); + const leftBounds = this.viewportLeft - 200; + const rightBounds = this.viewportRight + 200; + const columnToMuchLeft = columnLeft < leftBounds && columnRight < leftBounds; + const columnToMuchRight = columnLeft > rightBounds && columnRight > rightBounds; + return !columnToMuchLeft && !columnToMuchRight; + } + getViewportColumns() { + const { leftCols, rightCols } = this.visibleCols; + const res = this.colsWithinViewport.concat(leftCols).concat(rightCols); + return res; + } + getColsWithinViewport(rowNode) { + if (!this.colModel.colSpanActive) { + return this.colsWithinViewport; + } + const emptySpaceBeforeColumn = (col) => { + const left = col.getLeft(); + return _exists(left) && left > this.viewportLeft; + }; + const inViewportCallback = this.isColumnVirtualisationSuppressed() ? undefined : this.isColumnInRowViewport.bind(this); + const { visibleCols } = this; + const displayedColumnsCenter = visibleCols.centerCols; + return visibleCols.getColsForRow(rowNode, displayedColumnsCenter, inViewportCallback, emptySpaceBeforeColumn); + } + checkViewportColumns(afterScroll = false) { + const viewportColumnsChanged = this.extractViewport(); + if (viewportColumnsChanged) { + this.eventSvc.dispatchEvent({ + type: "virtualColumnsChanged", + afterScroll + }); + } + } + calculateHeaderRows() { + const { leftCols, rightCols } = this.visibleCols; + this.columnsToRenderLeft = leftCols; + this.columnsToRenderRight = rightCols; + this.columnsToRenderCenter = this.colsWithinViewport; + const workOutGroupsToRender = (cols) => { + const groupsToRenderSet = /* @__PURE__ */ new Set; + const groupsToRender = {}; + for (const col of cols) { + let group = col.getParent(); + const skipFillers = col.isSpanHeaderHeight(); + while (group) { + if (groupsToRenderSet.has(group)) { + break; + } + const skipFillerGroup = skipFillers && group.isPadding(); + if (skipFillerGroup) { + group = group.getParent(); + continue; + } + const level = group.getProvidedColumnGroup().getLevel(); + groupsToRender[level] ?? (groupsToRender[level] = []); + groupsToRender[level].push(group); + groupsToRenderSet.add(group); + group = group.getParent(); + } + } + return groupsToRender; + }; + this.rowsOfHeadersToRenderLeft = workOutGroupsToRender(leftCols); + this.rowsOfHeadersToRenderRight = workOutGroupsToRender(rightCols); + this.rowsOfHeadersToRenderCenter = workOutGroupsToRender(this.headerColsWithinViewport); + } + extractViewport() { + const hashColumn = (c) => `${c.getId()}-${c.getPinned() || "normal"}`; + this.extractViewportColumns(); + const newHash = this.getViewportColumns().map(hashColumn).join("#"); + const changed = this.colsWithinViewportHash !== newHash; + if (changed) { + this.colsWithinViewportHash = newHash; + this.calculateHeaderRows(); + } + return changed; + } +}; +function isAnyParentAutoHeaderHeight(col) { + while (col) { + if (col.isAutoHeaderHeight()) { + return true; + } + col = col.getParent(); + } + return false; +} +var AgComponentUtils = class extends BeanStub { + constructor() { + super(...arguments); + this.beanName = "agCompUtils"; + } + adaptFunction(type, jsCompFunc) { + if (!type.cellRenderer) { + return null; + } + + class Adapter { + refresh() { + return false; + } + getGui() { + return this.eGui; + } + init(params) { + const callbackResult = jsCompFunc(params); + const type2 = typeof callbackResult; + if (type2 === "string" || type2 === "number" || type2 === "boolean") { + this.eGui = _loadTemplate("" + callbackResult + ""); + return; + } + if (callbackResult == null) { + this.eGui = _createElement({ tag: "span" }); + return; + } + this.eGui = callbackResult; + } + } + return Adapter; + } +}; +var CellRendererFunctionModule = { + moduleName: "CellRendererFunction", + version: VERSION, + beans: [AgComponentUtils] +}; +var BaseRegistry = class extends AgBeanStub { + constructor() { + super(...arguments); + this.beanName = "registry"; + } + registerDynamicBeans(dynamicBeans) { + if (dynamicBeans) { + this.dynamicBeans ?? (this.dynamicBeans = {}); + for (const name of Object.keys(dynamicBeans)) { + this.dynamicBeans[name] = dynamicBeans[name]; + } + } + } + createDynamicBean(name, mandatory, ...args) { + if (!this.dynamicBeans) { + throw new Error(this.getDynamicError(name, true)); + } + const BeanClass = this.dynamicBeans[name]; + if (BeanClass == null) { + if (mandatory) { + throw new Error(this.getDynamicError(name, false)); + } + return; + } + return new BeanClass(...args); + } +}; +function isComponentMetaFunc(componentMeta) { + return typeof componentMeta === "object" && !!componentMeta.getComp; +} +var Registry = class extends BaseRegistry { + constructor() { + super(...arguments); + this.agGridDefaults = {}; + this.agGridDefaultOverrides = {}; + this.jsComps = {}; + this.selectors = {}; + this.icons = {}; + } + postConstruct() { + const comps = this.gos.get("components"); + if (comps != null) { + for (const key of Object.keys(comps)) { + this.jsComps[key] = comps[key]; + } + } + } + registerModule(module) { + const { icons, userComponents, dynamicBeans, selectors } = module; + if (userComponents) { + const registerUserComponent = (name, component, params, processParams) => { + this.agGridDefaults[name] = component; + if (params || processParams) { + this.agGridDefaultOverrides[name] = { params, processParams }; + } + }; + for (const name of Object.keys(userComponents)) { + let comp = userComponents[name]; + if (isComponentMetaFunc(comp)) { + comp = comp.getComp(this.beans); + } + if (typeof comp === "object") { + const { classImp, params, processParams } = comp; + registerUserComponent(name, classImp, params, processParams); + } else { + registerUserComponent(name, comp); + } + } + } + this.registerDynamicBeans(dynamicBeans); + for (const selector of selectors ?? []) { + this.selectors[selector.selector] = selector; + } + if (icons) { + for (const name of Object.keys(icons)) { + this.icons[name] = icons[name]; + } + } + } + getUserComponent(propertyName, name) { + const createResult = (component, componentFromFramework, params, processParams) => ({ + componentFromFramework, + component, + params, + processParams + }); + const { frameworkOverrides } = this.beans; + const registeredViaFrameworkComp = frameworkOverrides.frameworkComponent(name, this.gos.get("components")); + if (registeredViaFrameworkComp != null) { + return createResult(registeredViaFrameworkComp, true); + } + const jsComponent = this.jsComps[name]; + if (jsComponent) { + const isFwkComp = frameworkOverrides.isFrameworkComponent(jsComponent); + return createResult(jsComponent, isFwkComp); + } + const defaultComponent = this.agGridDefaults[name]; + if (defaultComponent) { + const overrides = this.agGridDefaultOverrides[name]; + return createResult(defaultComponent, false, overrides?.params, overrides?.processParams); + } + this.beans.validation?.missingUserComponent(propertyName, name, this.agGridDefaults, this.jsComps); + return null; + } + getSelector(name) { + return this.selectors[name]; + } + getIcon(name) { + return this.icons[name]; + } + getDynamicError(name, init) { + if (init) { + return _errMsg(279, { name }); + } + return this.beans.validation?.missingDynamicBean(name) ?? _errMsg(256); + } +}; +var NUM_CTRLS = 23; +var CtrlsService = class extends BeanStub { + constructor() { + super(...arguments); + this.beanName = "ctrlsSvc"; + this.params = {}; + this.ready = false; + this.readyCallbacks = []; + } + postConstruct() { + this.addEventListener("ready", () => { + this.updateReady(); + if (this.ready) { + for (const callback of this.readyCallbacks) { + callback(this.params); + } + this.readyCallbacks.length = 0; + } + }, this.beans.frameworkOverrides.runWhenReadyAsync?.() ?? false); + } + updateReady() { + const values = Object.values(this.params); + this.ready = values.length === NUM_CTRLS && values.every((ctrl) => { + return ctrl?.isAlive() ?? false; + }); + } + whenReady(caller, callback) { + if (this.ready) { + callback(this.params); + } else { + this.readyCallbacks.push(callback); + } + caller.addDestroyFunc(() => { + const index = this.readyCallbacks.indexOf(callback); + if (index >= 0) { + this.readyCallbacks.splice(index, 1); + } + }); + } + register(ctrlType, ctrl) { + this.params[ctrlType] = ctrl; + this.updateReady(); + if (this.ready) { + this.dispatchLocalEvent({ type: "ready" }); + } + ctrl.addDestroyFunc(() => { + this.updateReady(); + }); + } + get(ctrlType) { + return this.params[ctrlType]; + } + getGridBodyCtrl() { + return this.params.gridBodyCtrl; + } + getHeaderRowContainerCtrls() { + const { leftHeader, centerHeader, rightHeader } = this.params; + return [leftHeader, rightHeader, centerHeader]; + } + getHeaderRowContainerCtrl(pinned) { + const params = this.params; + switch (pinned) { + case "left": + return params.leftHeader; + case "right": + return params.rightHeader; + default: + return params.centerHeader; + } + } + getScrollFeature() { + return this.getGridBodyCtrl().scrollFeature; + } +}; +var shared_default = ':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}'; +var IS_SSR = typeof window !== "object" || !window?.document?.fonts?.forEach; +var FORCE_LEGACY_THEMES = false; +var _injectGlobalCSS = (rawCss, styleContainer, debugId, layer, priority, nonce, isParams = false) => { + if (IS_SSR || FORCE_LEGACY_THEMES) { + return; + } + let injectedCss = rawCss; + if (layer) { + injectedCss = `@layer ${CSS.escape(layer).replaceAll("\\.", ".")} { ${rawCss} }`; + } + let injections = injectionState.map.get(styleContainer); + if (!injections) { + injections = []; + injectionState.map.set(styleContainer, injections); + } + if (injections.some((i) => i.injectedCss === injectedCss)) { + return; + } + const el = document.createElement("style"); + if (nonce) { + el.setAttribute("nonce", nonce); + } + el.dataset.agCss = debugId; + el.dataset.agCssVersion = VERSION; + el.textContent = injectedCss; + const newInjection = { rawCss, injectedCss, el, priority, isParams }; + let insertAfter; + for (const injection of injections) { + if (injection.priority > priority) { + break; + } + insertAfter = injection; + } + if (insertAfter) { + insertAfter.el.after(el); + const index = injections.indexOf(insertAfter); + injections.splice(index + 1, 0, newInjection); + } else { + if (styleContainer.nodeName === "STYLE") { + styleContainer.after(el); + } else { + styleContainer.insertBefore(el, styleContainer.querySelector(":not(title, meta)")); + } + injections.push(newInjection); + } +}; +var _injectCoreAndModuleCSS = (styleContainer, layer, nonce, moduleCss) => { + _injectGlobalCSS(shared_default, styleContainer, "shared", layer, 0, nonce); + moduleCss?.forEach((css, debugId) => css.forEach((singleCss) => _injectGlobalCSS(singleCss, styleContainer, debugId, layer, 0, nonce))); +}; +var _useParamsCss = (environment, paramsCss, paramsDebugId, styleContainer, layer, nonce) => { + if (IS_SSR || FORCE_LEGACY_THEMES) { + return; + } + const gridState = injectionState.grids.get(environment); + if (!gridState) { + injectionState.grids.set(environment, { styleContainer, paramsCss }); + } else { + gridState.paramsCss = paramsCss; + } + removeStaleParamsCss(styleContainer); + if (paramsCss && paramsDebugId) { + _injectGlobalCSS(paramsCss, styleContainer, paramsDebugId, layer, 2, nonce, true); + } +}; +var _unregisterInstanceUsingThemingAPI = (environment) => { + const styleContainer = injectionState.grids.get(environment)?.styleContainer; + if (!styleContainer) { + return; + } + injectionState.grids.delete(environment); + const containerStillInUse = Array.from(injectionState.grids.values()).some((gs) => gs.styleContainer === styleContainer); + if (containerStillInUse) { + removeStaleParamsCss(styleContainer); + } else { + removeStaleParamsCss(styleContainer, true); + injectionState.map.delete(styleContainer); + } +}; +var removeStaleParamsCss = (styleContainer, deleteAll = false) => { + const neededCss = /* @__PURE__ */ new Set; + for (const gs of injectionState.grids.values()) { + if (gs.styleContainer === styleContainer) { + neededCss.add(gs.paramsCss); + } + } + const injections = injectionState.map.get(styleContainer) ?? []; + for (let i = injections.length - 1;i >= 0; i--) { + if (deleteAll || injections[i].isParams && !neededCss.has(injections[i].rawCss)) { + injections[i].el.remove(); + injections.splice(i, 1); + } + } +}; +var getInjectionState = () => { + const versionMap = globalThis.agStyleInjectionVersions ?? (globalThis.agStyleInjectionVersions = /* @__PURE__ */ new Map); + let state = versionMap.get(VERSION); + if (!state) { + state = { + map: /* @__PURE__ */ new WeakMap, + grids: /* @__PURE__ */ new Map, + paramsId: 0 + }; + versionMap.set(VERSION, state); + } + return state; +}; +var injectionState = getInjectionState(); +var createPart = (args) => { + return new PartImpl(args); +}; +var defaultModeName = "$default"; +var partCounter = 0; +var PartImpl = class { + constructor({ feature, params, modeParams = {}, css, cssImports }) { + this.feature = feature; + this.css = css; + this.cssImports = cssImports; + this.modeParams = { + [defaultModeName]: { + ...modeParams[defaultModeName] ?? {}, + ...params ?? {} + }, + ...modeParams + }; + } + use(styleContainer, layer, nonce) { + let inject = this._inject; + if (inject == null) { + let { css } = this; + if (css) { + const className = `ag-theme-${this.feature ?? "part"}-${++partCounter}`; + if (typeof css === "function") { + css = css(); + } + css = `:where(.${className}) { +${css} +} +`; + for (const cssImport of this.cssImports ?? []) { + css = `@import url(${JSON.stringify(cssImport)}); +${css}`; + } + inject = { css, class: className }; + } else { + inject = false; + } + this._inject = inject; + } + if (inject && styleContainer) { + _injectGlobalCSS(inject.css, styleContainer, inject.class, layer, 1, nonce); + } + return inject ? inject.class : false; + } +}; +var kebabCase = (str) => str.replace(/[A-Z]|\d+/g, (m) => `-${m}`).toLowerCase(); +var paramToVariableName = (paramName) => `--ag-${kebabCase(paramName)}`; +var paramToVariableExpression = (paramName) => `var(${paramToVariableName(paramName)})`; +var clamp = (value, min, max) => Math.max(min, Math.min(max, value)); +var memoize = (fn) => { + const values = /* @__PURE__ */ new Map; + return (a) => { + const key = a; + if (!values.has(key)) { + values.set(key, fn(a)); + } + return values.get(key); + }; +}; +var accentMix = (mix) => ({ ref: "accentColor", mix }); +var foregroundMix = (mix) => ({ ref: "foregroundColor", mix }); +var foregroundBackgroundMix = (mix) => ({ + ref: "foregroundColor", + mix, + onto: "backgroundColor" +}); +var foregroundHeaderBackgroundMix = (mix) => ({ + ref: "foregroundColor", + mix, + onto: "headerBackgroundColor" +}); +var backgroundColor = { ref: "backgroundColor" }; +var foregroundColor = { ref: "foregroundColor" }; +var accentColor = { ref: "accentColor" }; +var defaultLightColorSchemeParams = { + backgroundColor: "#fff", + foregroundColor: "#181d1f", + borderColor: foregroundMix(0.15), + chromeBackgroundColor: foregroundBackgroundMix(0.02), + browserColorScheme: "light" +}; +var sharedDefaults = { + ...defaultLightColorSchemeParams, + textColor: foregroundColor, + 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: accentMix(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: backgroundColor, + dragAndDropImageBorder: true, + dragAndDropImageNotAllowedBorder: { + color: { + ref: "invalidColor", + onto: "dragAndDropImageBackgroundColor", + mix: 0.5 + } + }, + dragAndDropImageShadow: { + ref: "popupShadow" + }, + iconSize: 16, + iconColor: "inherit", + toggleButtonWidth: 28, + toggleButtonHeight: 18, + toggleButtonOnBackgroundColor: accentColor, + toggleButtonOffBackgroundColor: foregroundBackgroundMix(0.3), + toggleButtonSwitchBackgroundColor: backgroundColor, + toggleButtonSwitchInset: 2, + tooltipBackgroundColor: { + ref: "chromeBackgroundColor" + }, + tooltipErrorBackgroundColor: { + ref: "invalidColor", + onto: "backgroundColor", + mix: 0.1 + }, + tooltipTextColor: { + ref: "textColor" + }, + tooltipErrorTextColor: { + ref: "invalidColor" + }, + tooltipBorder: true, + tooltipErrorBorder: { + color: { + ref: "invalidColor", + onto: "backgroundColor", + mix: 0.25 + } + }, + panelBackgroundColor: backgroundColor, + panelTitleBarHeight: { ref: "headerHeight" }, + panelTitleBarBackgroundColor: { + ref: "headerBackgroundColor" + }, + panelTitleBarIconColor: { + ref: "headerTextColor" + }, + panelTitleBarTextColor: { + ref: "headerTextColor" + }, + panelTitleBarFontFamily: { + ref: "headerFontFamily" + }, + panelTitleBarFontSize: { + ref: "headerFontSize" + }, + panelTitleBarFontWeight: { + ref: "headerFontWeight" + }, + panelTitleBarBorder: true, + dialogShadow: { + ref: "popupShadow" + }, + dialogBorder: { + color: foregroundMix(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: foregroundMix(0.2) + }, + menuBackgroundColor: foregroundBackgroundMix(0.03), + menuTextColor: foregroundBackgroundMix(0.95), + menuShadow: { + ref: "popupShadow" + }, + menuSeparatorColor: { + ref: "borderColor" + } +}; +var paramTypes = [ + "colorScheme", + "color", + "length", + "scale", + "borderStyle", + "border", + "shadow", + "image", + "fontFamily", + "fontWeight", + "duration" +]; +var getParamType = memoize((param) => { + param = param.toLowerCase(); + return paramTypes.find((type) => param.endsWith(type.toLowerCase())) ?? "length"; +}); +var literalToCSS = (value) => { + if (typeof value === "object" && value?.ref) { + return paramToVariableExpression(value.ref); + } + if (typeof value === "string") { + return value; + } + if (typeof value === "number") { + return String(value); + } + return false; +}; +var colorValueToCss = (value) => { + if (typeof value === "string") { + return value; + } + if (typeof value === "object" && value && "ref" in value) { + const colorExpr = paramToVariableExpression(value.ref); + if (value.mix == null) { + return colorExpr; + } + const backgroundExpr = value.onto ? paramToVariableExpression(value.onto) : "transparent"; + return `color-mix(in srgb, ${backgroundExpr}, ${colorExpr} ${clamp(value.mix * 100, 0, 100)}%)`; + } + return false; +}; +var colorSchemeValueToCss = literalToCSS; +var lengthValueToCss = (value) => { + if (typeof value === "string") { + return value; + } + if (typeof value === "number") { + return `${value}px`; + } + if (typeof value === "object" && value && "calc" in value) { + const valueWithSpaces = value.calc.replace(/ ?[*/+] ?/g, " $& "); + return `calc(${valueWithSpaces.replace(/-?\b[a-z][a-z0-9]*\b(?![-(])/gi, (p) => p[0] === "-" ? p : " " + paramToVariableExpression(p) + " ")})`; + } + if (typeof value === "object" && value && "ref" in value) { + return paramToVariableExpression(value.ref); + } + return false; +}; +var scaleValueToCss = literalToCSS; +var borderValueToCss = (value, param) => { + if (typeof value === "string") { + return value; + } + if (value === true) { + return borderValueToCss({}, param); + } + if (value === false) { + return param === "columnBorder" ? borderValueToCss({ color: "transparent" }, param) : "none"; + } + if (typeof value === "object" && value && "ref" in value) { + return paramToVariableExpression(value.ref); + } + return borderStyleValueToCss(value.style ?? "solid") + " " + lengthValueToCss(value.width ?? { ref: "borderWidth" }) + " " + colorValueToCss(value.color ?? { ref: "borderColor" }); +}; +var shadowValueParamsToCss = (value) => { + return [ + lengthValueToCss(value.offsetX ?? 0), + lengthValueToCss(value.offsetY ?? 0), + lengthValueToCss(value.radius ?? 0), + lengthValueToCss(value.spread ?? 0), + colorValueToCss(value.color ?? { ref: "foregroundColor" }), + ...value.inset ? ["inset"] : [] + ].join(" "); +}; +var shadowValueToCss = (value) => { + if (typeof value === "string") { + return value; + } + if (value === false) { + return "none"; + } + if (typeof value === "object" && value && "ref" in value) { + return paramToVariableExpression(value.ref); + } + if (Array.isArray(value)) { + return value.map(shadowValueParamsToCss).join(", "); + } + return shadowValueParamsToCss(value); +}; +var borderStyleValueToCss = literalToCSS; +var fontFamilyValueToCss = (value) => { + if (typeof value === "string") { + return value.includes(",") ? value : quoteUnsafeChars(value); + } + if (typeof value === "object" && value && "googleFont" in value) { + return fontFamilyValueToCss(value.googleFont); + } + if (typeof value === "object" && value && "ref" in value) { + return paramToVariableExpression(value.ref); + } + if (Array.isArray(value)) { + return value.map((font) => { + if (typeof font === "object" && "googleFont" in font) { + font = font.googleFont; + } + return quoteUnsafeChars(font); + }).join(", "); + } + return false; +}; +var quoteUnsafeChars = (font) => /^[\w-]+$|\w\(/.test(font) ? font : JSON.stringify(font); +var fontWeightValueToCss = literalToCSS; +var imageValueToCss = (value) => { + if (typeof value === "string") { + return value; + } + if (typeof value === "object" && value && "url" in value) { + return `url(${JSON.stringify(value.url)})`; + } + if (typeof value === "object" && value && "svg" in value) { + return imageValueToCss({ url: `data:image/svg+xml,${encodeURIComponent(value.svg)}` }); + } + if (typeof value === "object" && value && "ref" in value) { + return paramToVariableExpression(value.ref); + } + return false; +}; +var durationValueToCss = (value, param, themeLogger) => { + if (typeof value === "string") { + return value; + } + if (typeof value === "number") { + if (value >= 10) { + themeLogger?.warn(104, { value, param }); + } + return `${value}s`; + } + if (typeof value === "object" && value && "ref" in value) { + return paramToVariableExpression(value.ref); + } + return false; +}; +var paramValidators = { + color: colorValueToCss, + colorScheme: colorSchemeValueToCss, + length: lengthValueToCss, + scale: scaleValueToCss, + border: borderValueToCss, + borderStyle: borderStyleValueToCss, + shadow: shadowValueToCss, + image: imageValueToCss, + fontFamily: fontFamilyValueToCss, + fontWeight: fontWeightValueToCss, + duration: durationValueToCss +}; +var paramValueToCss = (param, value, themeLogger) => { + const type = getParamType(param); + return paramValidators[type](value, param, themeLogger); +}; +var createSharedTheme = (themeLogger, overridePrefix) => new ThemeImpl({ themeLogger, overridePrefix }); +var ThemeImpl = class _ThemeImpl { + constructor(params, parts = []) { + this.params = params; + this.parts = parts; + } + withPart(part) { + if (typeof part === "function") { + part = part(); + } + if (!(part instanceof PartImpl)) { + this.params.themeLogger.preInitErr(259, "Invalid part", { part }); + return this; + } + return new _ThemeImpl(this.params, [...this.parts, part]); + } + withoutPart(feature) { + return this.withPart(createPart({ feature })); + } + withParams(params, mode = defaultModeName) { + return this.withPart(createPart({ + modeParams: { [mode]: params } + })); + } + _startUse({ styleContainer, cssLayer, nonce, loadThemeGoogleFonts, moduleCss }) { + if (IS_SSR) { + return; + } + if (FORCE_LEGACY_THEMES) { + return; + } + uninstallLegacyCSS(); + _injectCoreAndModuleCSS(styleContainer, cssLayer, nonce, moduleCss); + const googleFontsUsed = getGoogleFontsUsed(this); + if (googleFontsUsed.length > 0) { + for (const googleFont of googleFontsUsed) { + if (loadThemeGoogleFonts) { + loadGoogleFont(googleFont, nonce); + } + } + } + for (const part of this.parts) { + part.use(styleContainer, cssLayer, nonce); + } + } + _getCssClass() { + if (FORCE_LEGACY_THEMES) { + return "ag-theme-quartz"; + } + return this._cssClassCache ?? (this._cssClassCache = deduplicatePartsByFeature(this.parts).map((part) => part.use(undefined, undefined, undefined)).filter(Boolean).concat(this._getParamsClassName()).join(" ")); + } + _getParamsClassName() { + return this._paramsClassName ?? (this._paramsClassName = `ag-theme-params-${++getInjectionState().paramsId}`); + } + _getModeParams() { + let paramsCache = this._paramsCache; + if (!paramsCache) { + const mergedModeParams = { + [defaultModeName]: { ...sharedDefaults } + }; + for (const part of deduplicatePartsByFeature(this.parts)) { + for (const partMode of Object.keys(part.modeParams)) { + const partParams = part.modeParams[partMode]; + if (partParams) { + const mergedParams = mergedModeParams[partMode] ?? (mergedModeParams[partMode] = {}); + const partParamNames = /* @__PURE__ */ new Set; + for (const partParamName of Object.keys(partParams)) { + const partParamValue = partParams[partParamName]; + if (partParamValue !== undefined) { + mergedParams[partParamName] = partParamValue; + partParamNames.add(partParamName); + } + } + if (partMode === defaultModeName) { + for (const mergedMode of Object.keys(mergedModeParams)) { + const mergedParams2 = mergedModeParams[mergedMode]; + if (mergedMode !== defaultModeName) { + for (const partParamName of partParamNames) { + delete mergedParams2[partParamName]; + } + } + } + } + } + } + } + this._paramsCache = paramsCache = mergedModeParams; + } + return paramsCache; + } + _getParamsCss() { + if (!this._paramsCssCache) { + let variablesCss = ""; + let inheritanceCss = ""; + const modeParams = this._getModeParams(); + const { overridePrefix, themeLogger } = this.params; + const cssOverridePrefix = overridePrefix ? `--ag-${overridePrefix}-` : undefined; + for (const mode of Object.keys(modeParams)) { + const params = modeParams[mode]; + if (mode !== defaultModeName) { + const escapedMode = typeof CSS === "object" ? CSS.escape(mode) : mode; + const wrapPrefix = `:where([data-ag-theme-mode="${escapedMode}"]) & { +`; + variablesCss += wrapPrefix; + inheritanceCss += wrapPrefix; + } + for (const key of Object.keys(params).sort()) { + const value = params[key]; + const cssValue = paramValueToCss(key, value, themeLogger); + if (cssValue === false) { + themeLogger.error(107, { key, value }); + } else { + const cssName = paramToVariableName(key); + const overrideName = cssOverridePrefix ? cssName.replace("--ag-", cssOverridePrefix) : cssName; + const inheritedName = cssName.replace("--ag-", "--ag-inherited-"); + variablesCss += ` ${cssName}: var(${inheritedName}, ${cssValue}); +`; + inheritanceCss += ` ${inheritedName}: var(${overrideName}); +`; + } + } + if (mode !== defaultModeName) { + variablesCss += `} +`; + inheritanceCss += `} +`; + } + } + const selectorPlaceholder = `:where(.${this._getParamsClassName()})`; + let css = `${selectorPlaceholder} { +${variablesCss}} +`; + css += `:has(> ${selectorPlaceholder}):not(${selectorPlaceholder}) { +${inheritanceCss}} +`; + this._paramsCssCache = css; + } + return this._paramsCssCache; + } +}; +var deduplicatePartsByFeature = (parts) => { + const lastPartByFeature = /* @__PURE__ */ new Map; + for (const part of parts) { + lastPartByFeature.set(part.feature, part); + } + const result = []; + for (const part of parts) { + if (!part.feature || lastPartByFeature.get(part.feature) === part) { + result.push(part); + } + } + return result; +}; +var getGoogleFontsUsed = (theme) => { + const googleFontsUsed = /* @__PURE__ */ new Set; + const visitParamValue = (paramValue) => { + if (Array.isArray(paramValue)) { + paramValue.forEach(visitParamValue); + } else { + const googleFont = paramValue?.googleFont; + if (typeof googleFont === "string") { + googleFontsUsed.add(googleFont); + } + } + }; + const allModeValues = Object.values(theme._getModeParams()); + const allValues = allModeValues.flatMap((mv) => Object.values(mv)); + allValues.forEach(visitParamValue); + return Array.from(googleFontsUsed).sort(); +}; +var uninstalledLegacyCSS = false; +var uninstallLegacyCSS = () => { + if (uninstalledLegacyCSS) { + return; + } + uninstalledLegacyCSS = true; + for (const style of Array.from(document.head.querySelectorAll('style[data-ag-scope="legacy"]'))) { + style.remove(); + } +}; +var loadGoogleFont = async (font, nonce) => { + const css = `@import url('https://${googleFontsDomain}/css2?family=${encodeURIComponent(font)}:wght@100;200;300;400;500;600;700;800;900&display=swap'); +`; + _injectGlobalCSS(css, document.head, `googleFont:${font}`, undefined, 0, nonce); +}; +var googleFontsDomain = "fonts.googleapis.com"; +var LIST_ITEM_HEIGHT = { + changeKey: "listItemHeight", + type: "length", + defaultValue: 24 +}; +var BaseEnvironment = class extends AgBeanStub { + constructor() { + super(...arguments); + this.beanName = "environment"; + this.sizeEls = /* @__PURE__ */ new Map; + this.lastKnownValues = /* @__PURE__ */ new Map; + this.sizesMeasured = false; + this.globalCSS = []; + } + wireBeans(beans) { + this.eRootDiv = beans.eRootDiv; + } + postConstruct() { + const { gos, eRootDiv } = this; + gos.setInstanceDomData(eRootDiv); + const themeStyleContainer = gos.get("themeStyleContainer"); + const hasShadowRootGlobal = typeof ShadowRoot !== "undefined"; + const isShadowRoot = hasShadowRootGlobal && eRootDiv.getRootNode() instanceof ShadowRoot; + this.eStyleContainer = (typeof themeStyleContainer === "function" ? themeStyleContainer() : themeStyleContainer) ?? (isShadowRoot ? eRootDiv : document.head); + if (!themeStyleContainer && !isShadowRoot && hasShadowRootGlobal) { + warnOnAttachToShadowRoot(eRootDiv, this.shadowRootError.bind(this), this.addDestroyFunc.bind(this)); + } + this.cssLayer = gos.get("themeCssLayer"); + this.styleNonce = gos.get("styleNonce"); + this.addManagedPropertyListener("theme", () => this.handleThemeChange()); + this.handleThemeChange(); + this.getSizeEl(LIST_ITEM_HEIGHT); + this.initVariables(); + this.addDestroyFunc(() => _unregisterInstanceUsingThemingAPI(this)); + this.mutationObserver = new MutationObserver(() => { + this.fireStylesChangedEvent("theme"); + }); + this.addDestroyFunc(() => this.mutationObserver.disconnect()); + } + applyThemeClasses(el, extraClasses = []) { + const { theme } = this; + const themeClass = theme ? theme._getCssClass() : this.applyLegacyThemeClasses(); + for (const className of Array.from(el.classList)) { + if (className.startsWith("ag-theme-")) { + el.classList.remove(className); + } + } + if (themeClass) { + const oldClass = el.className; + el.className = `${oldClass}${oldClass ? " " : ""}${themeClass}${extraClasses?.length ? " " + extraClasses.join(" ") : ""}`; + } + } + applyLegacyThemeClasses() { + let themeClass = ""; + this.mutationObserver.disconnect(); + let node = this.eRootDiv; + while (node) { + let isThemeEl = false; + for (const className of Array.from(node.classList)) { + if (className.startsWith("ag-theme-")) { + isThemeEl = true; + themeClass = themeClass ? `${themeClass} ${className}` : className; + } + } + if (isThemeEl) { + this.mutationObserver.observe(node, { + attributes: true, + attributeFilter: ["class"] + }); + } + node = node.parentElement; + } + return themeClass; + } + addGlobalCSS(css, debugId) { + if (this.theme) { + _injectGlobalCSS(css, this.eStyleContainer, debugId, this.cssLayer, 0, this.styleNonce); + } else { + this.globalCSS.push([css, debugId]); + } + } + getDefaultListItemHeight() { + return this.getCSSVariablePixelValue(LIST_ITEM_HEIGHT); + } + getCSSVariablePixelValue(variable) { + const cached = this.lastKnownValues.get(variable); + if (cached != null) { + return cached; + } + const measurement = this.measureSizeEl(variable); + if (measurement === "detached" || measurement === "no-styles") { + if (variable.cacheDefault) { + this.lastKnownValues.set(variable, variable.defaultValue); + } + return variable.defaultValue; + } + this.lastKnownValues.set(variable, measurement); + return measurement; + } + measureSizeEl(variable) { + const sizeEl = this.getSizeEl(variable); + if (sizeEl.offsetParent == null) { + return "detached"; + } + const newSize = sizeEl.offsetWidth; + if (newSize === NO_VALUE_SENTINEL) { + return "no-styles"; + } + this.sizesMeasured = true; + return newSize; + } + getMeasurementContainer() { + let container = this.eMeasurementContainer; + if (!container) { + container = this.eMeasurementContainer = _createAgElement({ tag: "div", cls: "ag-measurement-container" }); + this.eRootDiv.appendChild(container); + } + return container; + } + getSizeEl(variable) { + let sizeEl = this.sizeEls.get(variable); + if (sizeEl) { + return sizeEl; + } + const container = this.getMeasurementContainer(); + sizeEl = _createAgElement({ tag: "div" }); + const cssName = this.setSizeElStyles(sizeEl, variable); + container.appendChild(sizeEl); + this.sizeEls.set(variable, sizeEl); + const { type, noWarn } = variable; + if (type !== "length" && type !== "border") { + return sizeEl; + } + let lastMeasurement = this.measureSizeEl(variable); + if (lastMeasurement === "no-styles" && !noWarn) { + this.varError(cssName, variable.defaultValue); + } + const unsubscribe = _observeResize(this.beans, sizeEl, () => { + const newMeasurement = this.measureSizeEl(variable); + if (newMeasurement === "detached" || newMeasurement === "no-styles") { + return; + } + this.lastKnownValues.set(variable, newMeasurement); + if (newMeasurement !== lastMeasurement) { + lastMeasurement = newMeasurement; + this.fireStylesChangedEvent(variable.changeKey); + } + }); + this.addDestroyFunc(() => unsubscribe()); + return sizeEl; + } + setSizeElStyles(sizeEl, variable) { + const { changeKey, type } = variable; + let cssName = paramToVariableName(changeKey); + if (type === "border") { + if (cssName.endsWith("-width")) { + cssName = cssName.slice(0, -6); + } + sizeEl.className = "ag-measurement-element-border"; + sizeEl.style.setProperty("--ag-internal-measurement-border", `var(${cssName}, solid ${NO_VALUE_SENTINEL}px)`); + } else { + sizeEl.style.width = `var(${cssName}, ${NO_VALUE_SENTINEL}px)`; + } + return cssName; + } + handleThemeChange() { + const { gos, theme: oldTheme } = this; + const themeProperty = gos.get("theme"); + let newTheme; + if (themeProperty === "legacy") { + newTheme = undefined; + } else { + const themeOrDefault = themeProperty ?? this.getDefaultTheme(); + if (themeOrDefault instanceof ThemeImpl) { + newTheme = themeOrDefault; + } else { + this.themeError(themeOrDefault); + } + } + if (newTheme !== oldTheme) { + this.handleNewTheme(newTheme); + } + this.postProcessThemeChange(newTheme, themeProperty); + } + handleNewTheme(newTheme) { + const { gos, eRootDiv, globalCSS } = this; + const additionalCss = this.getAdditionalCss(); + if (newTheme) { + _injectCoreAndModuleCSS(this.eStyleContainer, this.cssLayer, this.styleNonce, additionalCss); + for (const [css, debugId] of globalCSS) { + _injectGlobalCSS(css, this.eStyleContainer, debugId, this.cssLayer, 0, this.styleNonce); + } + globalCSS.length = 0; + } + this.theme = newTheme; + newTheme?._startUse({ + loadThemeGoogleFonts: gos.get("loadThemeGoogleFonts"), + styleContainer: this.eStyleContainer, + cssLayer: this.cssLayer, + nonce: this.styleNonce, + moduleCss: additionalCss + }); + _useParamsCss(this, newTheme?._getParamsCss() ?? null, newTheme?._getParamsClassName() ?? null, this.eStyleContainer, this.cssLayer, this.styleNonce); + this.applyThemeClasses(eRootDiv); + this.fireStylesChangedEvent("theme"); + } + fireStylesChangedEvent(change) { + this.eventSvc.dispatchEvent({ + type: "stylesChanged", + [`${change}Changed`]: true + }); + } +}; +var NO_VALUE_SENTINEL = 15538; +var warnOnAttachToShadowRoot = (el, errorCallback, onDestroy) => { + let retries = 60; + const interval = setInterval(() => { + if (typeof ShadowRoot !== "undefined" && el.getRootNode() instanceof ShadowRoot) { + errorCallback(); + clearInterval(interval); + } + if (el.isConnected || --retries < 0) { + clearInterval(interval); + } + }, 1000); + onDestroy(() => clearInterval(interval)); +}; +var core_default = ".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)}}"; +var coreDefaults = { + wrapperBorder: true, + rowBorder: true, + headerRowBorder: true, + footerRowBorder: { + ref: "rowBorder" + }, + columnBorder: { + style: "solid", + width: 1, + color: "transparent" + }, + headerColumnBorder: false, + headerColumnBorderHeight: "100%", + pinnedColumnBorder: true, + pinnedRowBorder: true, + sidePanelBorder: true, + 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: backgroundColor, + sideButtonSelectedTextColor: { ref: "sideButtonTextColor" }, + sideButtonBorder: "solid 1px transparent", + sideButtonSelectedBorder: true, + 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: accentColor, + rangeSelectionBackgroundColor: accentMix(0.2), + rangeSelectionChartBackgroundColor: "#0058FF1A", + rangeSelectionChartCategoryBackgroundColor: "#00FF841A", + rangeSelectionHighlightColor: accentMix(0.5), + rangeHeaderHighlightColor: foregroundHeaderBackgroundMix(0.08), + rowNumbersSelectedColor: accentMix(0.5), + rowHoverColor: accentMix(0.08), + columnHoverColor: accentMix(0.05), + selectedRowBackgroundColor: accentMix(0.12), + modalOverlayBackgroundColor: { + ref: "backgroundColor", + mix: 0.66 + }, + dataBackgroundColor: backgroundColor, + 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: foregroundMix(0.7), + headerColumnResizeHandleHeight: "30%", + headerColumnResizeHandleWidth: 2, + headerColumnResizeHandleColor: { + ref: "borderColor" + }, + iconButtonColor: { ref: "iconColor" }, + iconButtonBackgroundColor: "transparent", + iconButtonBackgroundSpread: 4, + iconButtonBorderRadius: 1, + iconButtonHoverColor: { ref: "iconButtonColor" }, + iconButtonHoverBackgroundColor: foregroundMix(0.1), + iconButtonActiveColor: accentColor, + iconButtonActiveBackgroundColor: accentMix(0.28), + iconButtonActiveIndicatorColor: accentColor, + setFilterIndentSize: { + ref: "iconSize" + }, + chartMenuPanelWidth: 260, + chartMenuLabelColor: foregroundMix(0.8), + cellEditingBorder: { + color: accentColor + }, + cellEditingShadow: { ref: "cardShadow" }, + fullRowEditInvalidBackgroundColor: { + ref: "invalidColor", + onto: "backgroundColor", + mix: 0.25 + }, + columnSelectIndentSize: { + ref: "iconSize" + }, + toolPanelSeparatorBorder: true, + columnDropCellBackgroundColor: foregroundMix(0.07), + columnDropCellTextColor: { + ref: "textColor" + }, + columnDropCellDragHandleColor: { + ref: "textColor" + }, + columnDropCellBorder: { + color: foregroundMix(0.13) + }, + selectCellBackgroundColor: foregroundMix(0.07), + selectCellBorder: { + color: foregroundMix(0.13) + }, + advancedFilterBuilderButtonBarBorder: true, + advancedFilterBuilderIndentSize: { + calc: "spacing * 2 + iconSize" + }, + advancedFilterBuilderJoinPillColor: "#f08e8d", + advancedFilterBuilderColumnPillColor: "#a6e194", + advancedFilterBuilderOptionPillColor: "#f3c08b", + advancedFilterBuilderValuePillColor: "#85c0e4", + filterPanelApplyButtonColor: backgroundColor, + filterPanelApplyButtonBackgroundColor: accentColor, + columnPanelApplyButtonColor: backgroundColor, + columnPanelApplyButtonBackgroundColor: accentColor, + filterPanelCardSubtleColor: { + ref: "textColor", + mix: 0.7 + }, + filterPanelCardSubtleHoverColor: { ref: "textColor" }, + findMatchColor: foregroundColor, + findMatchBackgroundColor: "#ffff00", + findActiveMatchColor: foregroundColor, + findActiveMatchBackgroundColor: "#ffa500", + filterToolPanelGroupIndent: { + ref: "spacing" + }, + rowLoadingSkeletonEffectColor: foregroundMix(0.15), + statusBarLabelColor: foregroundColor, + statusBarLabelFontWeight: 500, + statusBarValueColor: foregroundColor, + 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 +}; +var batch_edit_style_default_default = ".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)}"; +var baseParams = { + cellBatchEditBackgroundColor: "rgba(220 181 139 / 16%)", + cellBatchEditTextColor: "#422f00", + rowBatchEditBackgroundColor: { + ref: "cellBatchEditBackgroundColor" + }, + rowBatchEditTextColor: { + ref: "cellBatchEditTextColor" + } +}; +var baseDarkBatchEditParams = { + ...baseParams, + cellBatchEditTextColor: "#f3d0b3" +}; +var makeBatchEditStyleBaseTreeShakeable = () => createPart({ + feature: "batchEditStyle", + params: baseParams, + css: batch_edit_style_default_default +}); +var batchEditStyleBase = /* @__PURE__ */ makeBatchEditStyleBaseTreeShakeable(); +var button_style_base_default = ":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)}"; +var baseParams2 = { + buttonTextColor: "inherit", + buttonFontWeight: "normal", + buttonBackgroundColor: "transparent", + buttonBorder: false, + 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 makeButtonStyleQuartzTreeShakeable = () => createPart({ + feature: "buttonStyle", + params: { + ...baseParams2, + buttonBackgroundColor: backgroundColor, + buttonBorder: true, + buttonHoverBackgroundColor: { ref: "rowHoverColor" }, + buttonActiveBorder: { color: accentColor } + }, + css: button_style_base_default +}); +var buttonStyleQuartz = /* @__PURE__ */ makeButtonStyleQuartzTreeShakeable(); +var column_drop_style_bordered_default = ".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 makeColumnDropStyleBorderedTreeShakeable = () => { + return createPart({ + feature: "columnDropStyle", + css: column_drop_style_bordered_default + }); +}; +var columnDropStyleBordered = /* @__PURE__ */ makeColumnDropStyleBorderedTreeShakeable(); +var baseParams3 = { + 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" + } + } +}; +var makeBatchEditStyleBaseTreeShakeable2 = () => createPart({ + feature: "formulaStyle", + params: baseParams3 +}); +var formulaStyleBase = /* @__PURE__ */ makeBatchEditStyleBaseTreeShakeable2(); +var gridThemeLogger = { + warn: (...args) => { + _warn(args[0], args[1]); + }, + error: (...args) => { + _error(args[0], args[1]); + }, + preInitErr: (...args) => { + _logPreInitErr(args[0], args[2], args[1]); + } +}; +var createTheme = () => createSharedTheme(gridThemeLogger).withParams(coreDefaults).withPart(buttonStyleQuartz).withPart(columnDropStyleBordered).withPart(batchEditStyleBase).withPart(formulaStyleBase); +var checkbox_style_default_default = '.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)}}'; +var makeCheckboxStyleDefaultTreeShakeable = () => createPart({ + feature: "checkboxStyle", + params: { + checkboxBorderWidth: 1, + checkboxBorderRadius: { + ref: "borderRadius" + }, + checkboxUncheckedBackgroundColor: backgroundColor, + checkboxUncheckedBorderColor: foregroundBackgroundMix(0.3), + checkboxCheckedBackgroundColor: accentColor, + checkboxCheckedBorderColor: { ref: "checkboxCheckedBackgroundColor" }, + checkboxCheckedShapeImage: { + svg: '' + }, + checkboxCheckedShapeColor: backgroundColor, + checkboxIndeterminateBackgroundColor: foregroundBackgroundMix(0.3), + checkboxIndeterminateBorderColor: { ref: "checkboxIndeterminateBackgroundColor" }, + checkboxIndeterminateShapeImage: { + svg: '' + }, + checkboxIndeterminateShapeColor: backgroundColor, + radioCheckedShapeImage: { + svg: '' + } + }, + css: checkbox_style_default_default +}); +var checkboxStyleDefault = /* @__PURE__ */ makeCheckboxStyleDefaultTreeShakeable(); +var darkParams = () => ({ + ...defaultLightColorSchemeParams, + ...baseDarkBatchEditParams, + backgroundColor: "hsl(217, 0%, 17%)", + foregroundColor: "#FFF", + chromeBackgroundColor: foregroundBackgroundMix(0.05), + rowHoverColor: accentMix(0.15), + selectedRowBackgroundColor: accentMix(0.2), + menuBackgroundColor: foregroundBackgroundMix(0.1), + browserColorScheme: "dark", + popupShadow: "0 0px 20px #000A", + cardShadow: "0 1px 4px 1px #000A", + advancedFilterBuilderJoinPillColor: "#7a3a37", + advancedFilterBuilderColumnPillColor: "#355f2d", + advancedFilterBuilderOptionPillColor: "#5a3168", + advancedFilterBuilderValuePillColor: "#374c86", + filterPanelApplyButtonColor: foregroundColor, + columnPanelApplyButtonColor: foregroundColor, + findMatchColor: backgroundColor, + findActiveMatchColor: backgroundColor, + checkboxUncheckedBorderColor: foregroundBackgroundMix(0.4), + toggleButtonOffBackgroundColor: foregroundBackgroundMix(0.4), + rowBatchEditBackgroundColor: foregroundBackgroundMix(0.1), + formulaToken1Color: "#4da3e5", + formulaToken2Color: "#f55864", + formulaToken3Color: "#b688f2", + formulaToken4Color: "#24bb4a", + formulaToken5Color: "#e772ba", + formulaToken6Color: "#f69b5f", + formulaToken7Color: "#a3e6ff" +}); +var darkBlueParams = () => ({ + ...darkParams(), + backgroundColor: "#1f2836" +}); +var makeColorSchemeVariableTreeShakeable = () => createPart({ + feature: "colorScheme", + params: defaultLightColorSchemeParams, + modeParams: { + light: defaultLightColorSchemeParams, + dark: darkParams(), + "dark-blue": darkBlueParams() + } +}); +var colorSchemeVariable = /* @__PURE__ */ makeColorSchemeVariableTreeShakeable(); +var iconNameToSvgFragment = { + 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: '' +}; +var iconNameToFullSvg = { + 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": '' +}; +var getQuartzIconsCss = (args = {}) => { + let result = ""; + for (const iconName of [...Object.keys(iconNameToSvgFragment), ...Object.keys(iconNameToFullSvg)]) { + const iconSvg = quartzIconSvg(iconName, args.strokeWidth); + result += `.ag-icon-${iconName}::before { mask-image: url('data:image/svg+xml,${encodeURIComponent(iconSvg)}'); } +`; + } + return result; +}; +var quartzIconSvg = (name, strokeWidth = 1.5) => { + const fullSVG = iconNameToFullSvg[name]; + if (fullSVG) { + return fullSVG; + } + const svgFragment = iconNameToSvgFragment[name]; + if (!svgFragment) { + throw new Error(`Missing icon data for ${name}`); + } + return `` + svgFragment + ""; +}; +var iconSetQuartz = (args = {}) => { + return createPart({ + feature: "iconSet", + css: () => getQuartzIconsCss(args) + }); +}; +var iconSetQuartzRegular = /* @__PURE__ */ iconSetQuartz(); +var input_style_base_default = ":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)}}"; +var input_style_bordered_default = ".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 baseParams4 = { + inputBackgroundColor: "transparent", + inputBorder: false, + 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: false, + pickerButtonFocusBorder: { ref: "inputFocusBorder" }, + pickerButtonBackgroundColor: { ref: "backgroundColor" }, + pickerButtonFocusBackgroundColor: { ref: "backgroundColor" }, + pickerListBorder: false, + pickerListBackgroundColor: { ref: "backgroundColor" }, + colorPickerThumbSize: 18, + colorPickerTrackSize: 12, + colorPickerThumbBorderWidth: 3, + colorPickerTrackBorderRadius: 12, + colorPickerColorBorderRadius: 4 +}; +var makeInputStyleBorderedTreeShakeable = () => createPart({ + feature: "inputStyle", + params: { + ...baseParams4, + inputBackgroundColor: backgroundColor, + inputBorder: true, + inputBorderRadius: { + ref: "borderRadius" + }, + inputPaddingStart: { + ref: "spacing" + }, + inputFocusBorder: { + color: accentColor + }, + inputFocusShadow: { + ref: "focusShadow" + }, + inputDisabledBackgroundColor: foregroundBackgroundMix(0.06), + inputDisabledTextColor: { + ref: "textColor", + mix: 0.5 + }, + inputInvalidBorder: { + color: { ref: "invalidColor" } + }, + pickerButtonBorder: true, + pickerListBorder: true + }, + css: () => input_style_base_default + input_style_bordered_default +}); +var inputStyleBordered = /* @__PURE__ */ makeInputStyleBorderedTreeShakeable(); +var tab_style_base_default = ".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 baseParams5 = { + 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: false +}; +var makeTabStyleQuartzTreeShakeable = () => createPart({ + feature: "tabStyle", + params: { + ...baseParams5, + tabBarBorder: true, + tabBarBackgroundColor: foregroundMix(0.05), + tabTextColor: { + ref: "textColor", + mix: 0.7 + }, + tabSelectedTextColor: { + ref: "textColor" + }, + tabHoverTextColor: { + ref: "textColor" + }, + tabSelectedBorderColor: { + ref: "borderColor" + }, + tabSelectedBackgroundColor: backgroundColor + }, + css: tab_style_base_default +}); +var tabStyleQuartz = /* @__PURE__ */ makeTabStyleQuartzTreeShakeable(); +var themeQuartzParams = () => ({ + fontFamily: [ + { googleFont: "IBM Plex Sans" }, + "-apple-system", + "BlinkMacSystemFont", + "Segoe UI", + "Roboto", + "Oxygen-Sans", + "Ubuntu" + ] +}); +var makeThemeQuartzTreeShakeable = () => createTheme().withPart(checkboxStyleDefault).withPart(colorSchemeVariable).withPart(iconSetQuartzRegular).withPart(tabStyleQuartz).withPart(inputStyleBordered).withPart(columnDropStyleBordered).withParams(themeQuartzParams()); +var themeQuartz = /* @__PURE__ */ makeThemeQuartzTreeShakeable(); +var cssVariable = (changeKey, type, defaultValue, noWarn, cacheDefault) => ({ changeKey, type, defaultValue, noWarn, cacheDefault }); +var CELL_HORIZONTAL_PADDING = cssVariable("cellHorizontalPadding", "length", 16); +var INDENTATION_LEVEL = cssVariable("indentationLevel", "length", 0, true, true); +var ROW_GROUP_INDENT_SIZE = cssVariable("rowGroupIndentSize", "length", 0); +var ROW_HEIGHT = cssVariable("rowHeight", "length", 42); +var HEADER_HEIGHT = cssVariable("headerHeight", "length", 48); +var ROW_BORDER_WIDTH = cssVariable("rowBorderWidth", "border", 1); +var PINNED_BORDER_WIDTH = cssVariable("pinnedRowBorderWidth", "border", 1); +var HEADER_ROW_BORDER_WIDTH = cssVariable("headerRowBorderWidth", "border", 1); +function _addAdditionalCss(cssMap, modules) { + for (const module of modules.sort((a, b) => a.moduleName.localeCompare(b.moduleName))) { + const moduleCss = module.css; + if (moduleCss) { + cssMap.set(`module-${module.moduleName}`, moduleCss); + } + } +} +var Environment = class extends BaseEnvironment { + initVariables() { + this.addManagedPropertyListener("rowHeight", () => this.refreshRowHeightVariable()); + this.getSizeEl(ROW_HEIGHT); + this.getSizeEl(HEADER_HEIGHT); + this.getSizeEl(ROW_BORDER_WIDTH); + this.getSizeEl(PINNED_BORDER_WIDTH); + this.refreshRowBorderWidthVariable(); + } + getPinnedRowBorderWidth() { + return this.getCSSVariablePixelValue(PINNED_BORDER_WIDTH); + } + getRowBorderWidth() { + return this.getCSSVariablePixelValue(ROW_BORDER_WIDTH); + } + getHeaderRowBorderWidth() { + return this.getCSSVariablePixelValue(HEADER_ROW_BORDER_WIDTH); + } + getDefaultRowHeight() { + return this.getCSSVariablePixelValue(ROW_HEIGHT); + } + getDefaultHeaderHeight() { + return this.getCSSVariablePixelValue(HEADER_HEIGHT); + } + getDefaultCellHorizontalPadding() { + return this.getCSSVariablePixelValue(CELL_HORIZONTAL_PADDING); + } + getCellPaddingLeft() { + const cellHorizontalPadding = this.getDefaultCellHorizontalPadding(); + const indentationLevel = this.getCSSVariablePixelValue(INDENTATION_LEVEL); + const rowGroupIndentSize = this.getCSSVariablePixelValue(ROW_GROUP_INDENT_SIZE); + return cellHorizontalPadding - 1 + rowGroupIndentSize * indentationLevel; + } + getCellPadding() { + const cellPaddingRight = this.getDefaultCellHorizontalPadding() - 1; + return this.getCellPaddingLeft() + cellPaddingRight; + } + getDefaultColumnMinWidth() { + return Math.min(36, this.getDefaultRowHeight()); + } + refreshRowHeightVariable() { + const { eRootDiv } = this; + const oldRowHeight = eRootDiv.style.getPropertyValue("--ag-line-height").trim(); + const height = this.gos.get("rowHeight"); + if (height == null || isNaN(height) || !isFinite(height)) { + if (oldRowHeight !== null) { + eRootDiv.style.setProperty("--ag-line-height", null); + } + return -1; + } + const newRowHeight = `${height}px`; + if (oldRowHeight != newRowHeight) { + eRootDiv.style.setProperty("--ag-line-height", newRowHeight); + return height; + } + return oldRowHeight != "" ? Number.parseFloat(oldRowHeight) : -1; + } + fireStylesChangedEvent(change) { + if (change === "rowBorderWidth") { + this.refreshRowBorderWidthVariable(); + } + super.fireStylesChangedEvent(change); + } + refreshRowBorderWidthVariable() { + const width = this.getCSSVariablePixelValue(ROW_BORDER_WIDTH); + this.eRootDiv.style.setProperty("--ag-internal-row-border-width", `${width}px`); + } + postProcessThemeChange(newGridTheme, themeGridOption) { + if (newGridTheme && getComputedStyle(this.getMeasurementContainer()).getPropertyValue("--ag-legacy-styles-loaded")) { + if (themeGridOption) { + _error(106); + } else { + _error(239); + } + } + } + getAdditionalCss() { + const additionalCss = /* @__PURE__ */ new Map; + additionalCss.set("core", [core_default]); + _addAdditionalCss(additionalCss, Array.from(_getAllRegisteredModules())); + return additionalCss; + } + getDefaultTheme() { + return themeQuartz; + } + varError(cssName, defaultValue) { + _warn(9, { variable: { cssName, defaultValue } }); + } + themeError(theme) { + _error(240, { theme }); + } + shadowRootError() { + _error(293); + } +}; +var BaseEventService = class extends AgBeanStub { + constructor() { + super(...arguments); + this.beanName = "eventSvc"; + this.eventServiceType = "global"; + this.globalSvc = new LocalEventService; + } + addListener(eventType, listener, async) { + this.globalSvc.addEventListener(eventType, listener, async); + } + removeListener(eventType, listener, async) { + this.globalSvc.removeEventListener(eventType, listener, async); + } + addGlobalListener(listener, async = false) { + this.globalSvc.addGlobalListener(listener, async); + } + removeGlobalListener(listener, async = false) { + this.globalSvc.removeGlobalListener(listener, async); + } + dispatchEvent(event) { + this.globalSvc.dispatchEvent(this.gos.addCommon(event)); + } + dispatchEventOnce(event) { + this.globalSvc.dispatchEventOnce(this.gos.addCommon(event)); + } +}; +var EventService = class extends BaseEventService { + postConstruct() { + const { globalListener, globalSyncListener } = this.beans; + if (globalListener) { + this.addGlobalListener(globalListener, true); + } + if (globalSyncListener) { + this.addGlobalListener(globalSyncListener, false); + } + } +}; +function getHeaderIndexToFocus(beans, column, level) { + const columnRowIndex = beans.visibleCols.headerGroupRowCount; + if (level >= columnRowIndex) { + return { + column, + headerRowIndex: level + }; + } + let parent = column.getParent(); + while (parent && parent.getProvidedColumnGroup().getLevel() > level) { + parent = parent.getParent(); + } + const isColSpanning = column.isSpanHeaderHeight(); + if (!parent || isColSpanning && parent.isPadding()) { + return { + column, + headerRowIndex: columnRowIndex + }; + } + return { + column: parent, + headerRowIndex: parent.getProvidedColumnGroup().getLevel() + }; +} +var HeaderNavigationService = class extends BeanStub { + constructor() { + super(...arguments); + this.beanName = "headerNavigation"; + this.currentHeaderRowWithoutSpan = -1; + } + postConstruct() { + const beans = this.beans; + beans.ctrlsSvc.whenReady(this, (p) => { + this.gridBodyCon = p.gridBodyCtrl; + }); + const eDocument = _getDocument(beans); + this.addManagedElementListeners(eDocument, { + mousedown: () => { + this.currentHeaderRowWithoutSpan = -1; + } + }); + } + getHeaderPositionForColumn(colKey, floatingFilter) { + let column; + const { colModel, colGroupSvc, ctrlsSvc } = this.beans; + if (typeof colKey === "string") { + column = colModel.getCol(colKey); + if (!column) { + column = colGroupSvc?.getColumnGroup(colKey) ?? null; + } + } else { + column = colKey; + } + if (!column) { + return null; + } + const centerHeaderContainer = ctrlsSvc.getHeaderRowContainerCtrl(); + const allCtrls = centerHeaderContainer?.getAllCtrls(); + const isFloatingFilterVisible = _last(allCtrls || []).type === "filter"; + const headerRowCount = getFocusHeaderRowCount(this.beans) - 1; + let row = -1; + let col = column; + while (col) { + row++; + col = col.getParent(); + } + let headerRowIndex = row; + if (floatingFilter && isFloatingFilterVisible && headerRowIndex === headerRowCount - 1) { + headerRowIndex++; + } + return headerRowIndex === -1 ? null : { + headerRowIndex, + column + }; + } + navigateVertically(direction, event) { + const { focusSvc, visibleCols } = this.beans; + const { focusedHeader } = focusSvc; + if (!focusedHeader) { + return false; + } + const { headerRowIndex } = focusedHeader; + const column = focusedHeader.column; + const rowLen = getFocusHeaderRowCount(this.beans); + const currentRowType = this.getHeaderRowType(headerRowIndex); + const columnHeaderRowIndex = visibleCols.headerGroupRowCount; + let { + headerRowIndex: nextRow, + column: nextFocusColumn, + headerRowIndexWithoutSpan + } = direction === "UP" ? getColumnVisibleParent(currentRowType, column, headerRowIndex) : getColumnVisibleChild(column, headerRowIndex, columnHeaderRowIndex); + let skipColumn = false; + if (nextRow < 0) { + nextRow = 0; + nextFocusColumn = column; + skipColumn = true; + } + if (nextRow >= rowLen) { + nextRow = -1; + this.currentHeaderRowWithoutSpan = -1; + } else if (headerRowIndexWithoutSpan !== undefined) { + this.currentHeaderRowWithoutSpan = headerRowIndexWithoutSpan; + } + if (!skipColumn && !nextFocusColumn) { + return false; + } + return focusSvc.focusHeaderPosition({ + headerPosition: { headerRowIndex: nextRow, column: nextFocusColumn }, + allowUserOverride: true, + event + }); + } + navigateHorizontally(direction, fromTab = false, event) { + const { focusSvc, gos } = this.beans; + const focusedHeader = { ...focusSvc.focusedHeader }; + let nextHeader; + let normalisedDirection; + if (this.currentHeaderRowWithoutSpan !== -1) { + focusedHeader.headerRowIndex = this.currentHeaderRowWithoutSpan; + } else { + this.currentHeaderRowWithoutSpan = focusedHeader.headerRowIndex; + } + if (direction === "LEFT" !== gos.get("enableRtl")) { + normalisedDirection = "Before"; + nextHeader = this.findHeader(focusedHeader, normalisedDirection); + } else { + normalisedDirection = "After"; + nextHeader = this.findHeader(focusedHeader, normalisedDirection); + } + const userFunc = gos.getCallback("tabToNextHeader"); + if (fromTab && userFunc) { + const wasFocusedFromUserFunc = focusSvc.focusHeaderPositionFromUserFunc({ + userFunc, + headerPosition: nextHeader, + direction: normalisedDirection + }); + if (wasFocusedFromUserFunc) { + const { headerRowIndex } = focusSvc.focusedHeader || {}; + if (headerRowIndex != null && headerRowIndex != focusedHeader.headerRowIndex) { + this.currentHeaderRowWithoutSpan = headerRowIndex; + } + } + return wasFocusedFromUserFunc; + } + if (nextHeader || !fromTab) { + return focusSvc.focusHeaderPosition({ + headerPosition: nextHeader, + direction: normalisedDirection, + fromTab, + allowUserOverride: true, + event + }); + } + return this.focusNextHeaderRow(focusedHeader, normalisedDirection, event); + } + focusNextHeaderRow(focusedHeader, direction, event) { + const beans = this.beans; + const currentIndex = focusedHeader.headerRowIndex; + let nextFocusedCol = null; + let nextRowIndex; + const headerRowCount = getFocusHeaderRowCount(beans); + const allVisibleCols = this.beans.visibleCols.allCols; + if (direction === "Before") { + if (currentIndex <= 0) { + return false; + } + nextFocusedCol = _last(allVisibleCols); + nextRowIndex = currentIndex - 1; + this.currentHeaderRowWithoutSpan -= 1; + } else { + nextFocusedCol = allVisibleCols[0]; + nextRowIndex = currentIndex + 1; + if (this.currentHeaderRowWithoutSpan < headerRowCount) { + this.currentHeaderRowWithoutSpan += 1; + } else { + this.currentHeaderRowWithoutSpan = -1; + } + } + let { column, headerRowIndex } = getHeaderIndexToFocus(this.beans, nextFocusedCol, nextRowIndex); + if (headerRowIndex >= headerRowCount) { + headerRowIndex = -1; + } + return beans.focusSvc.focusHeaderPosition({ + headerPosition: { column, headerRowIndex }, + direction, + fromTab: true, + allowUserOverride: true, + event + }); + } + scrollToColumn(column, direction = "After") { + if (column.getPinned()) { + return; + } + let columnToScrollTo; + if (isColumnGroup(column)) { + const columns = column.getDisplayedLeafColumns(); + columnToScrollTo = direction === "Before" ? _last(columns) : columns[0]; + } else { + columnToScrollTo = column; + } + this.gridBodyCon.scrollFeature.ensureColumnVisible(columnToScrollTo); + } + findHeader(focusedHeader, direction) { + const { colGroupSvc, visibleCols } = this.beans; + let currentFocusedColumn = focusedHeader.column; + if (currentFocusedColumn instanceof AgColumnGroup) { + const leafChildren = currentFocusedColumn.getDisplayedLeafColumns(); + currentFocusedColumn = direction === "Before" ? leafChildren[0] : leafChildren[leafChildren.length - 1]; + } + const nextFocusedCol = direction === "Before" ? visibleCols.getColBefore(currentFocusedColumn) : visibleCols.getColAfter(currentFocusedColumn); + if (!nextFocusedCol) { + return; + } + const headerGroupRowIndex = visibleCols.headerGroupRowCount; + if (focusedHeader.headerRowIndex >= headerGroupRowIndex) { + return { + headerRowIndex: focusedHeader.headerRowIndex, + column: nextFocusedCol + }; + } + const groupAtLevel = colGroupSvc?.getColGroupAtLevel(nextFocusedCol, focusedHeader.headerRowIndex); + if (!groupAtLevel) { + const isSpanningCol = nextFocusedCol instanceof AgColumn && nextFocusedCol.isSpanHeaderHeight(); + return { + headerRowIndex: isSpanningCol ? visibleCols.headerGroupRowCount : focusedHeader.headerRowIndex, + column: nextFocusedCol + }; + } + if (groupAtLevel.isPadding() && nextFocusedCol.isSpanHeaderHeight()) { + return { + headerRowIndex: visibleCols.headerGroupRowCount, + column: nextFocusedCol + }; + } + return { + headerRowIndex: focusedHeader.headerRowIndex, + column: groupAtLevel ?? nextFocusedCol + }; + } + getHeaderRowType(rowIndex) { + const centerHeaderContainer = this.beans.ctrlsSvc.getHeaderRowContainerCtrl(); + if (centerHeaderContainer) { + return centerHeaderContainer.getRowType(rowIndex); + } + } +}; +function getColumnVisibleParent(currentRowType, currentColumn, currentIndex) { + const optimisticNextIndex = currentIndex - 1; + if (currentRowType !== "filter") { + const isSpanningCol = currentColumn instanceof AgColumn && currentColumn.isSpanHeaderHeight(); + let nextVisibleParent = currentColumn.getParent(); + while (nextVisibleParent && (nextVisibleParent.getProvidedColumnGroup().getLevel() > optimisticNextIndex || isSpanningCol && nextVisibleParent.isPadding())) { + nextVisibleParent = nextVisibleParent.getParent(); + } + if (nextVisibleParent) { + if (isSpanningCol) { + return { + column: nextVisibleParent, + headerRowIndex: nextVisibleParent.getProvidedColumnGroup().getLevel(), + headerRowIndexWithoutSpan: optimisticNextIndex + }; + } else { + return { + column: nextVisibleParent, + headerRowIndex: optimisticNextIndex, + headerRowIndexWithoutSpan: optimisticNextIndex + }; + } + } + } + return { + column: currentColumn, + headerRowIndex: optimisticNextIndex, + headerRowIndexWithoutSpan: optimisticNextIndex + }; +} +function getColumnVisibleChild(column, currentIndex, columnHeaderRowIndex) { + const optimisticNextIndex = currentIndex + 1; + const result = { + column, + headerRowIndex: optimisticNextIndex, + headerRowIndexWithoutSpan: optimisticNextIndex + }; + if (column instanceof AgColumnGroup) { + if (optimisticNextIndex >= columnHeaderRowIndex) { + return { + column: column.getDisplayedLeafColumns()[0], + headerRowIndex: columnHeaderRowIndex, + headerRowIndexWithoutSpan: optimisticNextIndex + }; + } + const children = column.getDisplayedChildren(); + let firstChild = children[0]; + if (firstChild instanceof AgColumnGroup && firstChild.isPadding()) { + const firstCol = firstChild.getDisplayedLeafColumns()[0]; + if (firstCol.isSpanHeaderHeight()) { + firstChild = firstCol; + } + } + result.column = firstChild; + const isSpanningCol = firstChild instanceof AgColumn && firstChild.isSpanHeaderHeight(); + if (isSpanningCol) { + result.headerRowIndex = columnHeaderRowIndex; + result.headerRowIndexWithoutSpan = optimisticNextIndex; + } + } + return result; +} +var FocusService = class extends BeanStub { + constructor() { + super(...arguments); + this.beanName = "focusSvc"; + this.focusFallbackTimeout = null; + this.needsFocusRestored = false; + } + wireBeans(beans) { + this.colModel = beans.colModel; + this.visibleCols = beans.visibleCols; + this.rowRenderer = beans.rowRenderer; + this.navigation = beans.navigation; + this.filterManager = beans.filterManager; + this.overlays = beans.overlays; + } + postConstruct() { + const clearFocusedCellListener = this.clearFocusedCell.bind(this); + this.addManagedEventListeners({ + columnPivotModeChanged: clearFocusedCellListener, + newColumnsLoaded: this.onColumnEverythingChanged.bind(this), + columnGroupOpened: clearFocusedCellListener, + columnRowGroupChanged: clearFocusedCellListener + }); + this.addDestroyFunc(_registerKeyboardFocusEvents(this.beans)); + } + attemptToRecoverFocus() { + this.needsFocusRestored = true; + if (this.focusFallbackTimeout != null) { + clearTimeout(this.focusFallbackTimeout); + } + this.focusFallbackTimeout = window.setTimeout(this.setFocusRecovered.bind(this), 100); + } + setFocusRecovered() { + this.needsFocusRestored = false; + if (this.focusFallbackTimeout != null) { + clearTimeout(this.focusFallbackTimeout); + this.focusFallbackTimeout = null; + } + } + shouldTakeFocus() { + if (this.gos.get("suppressFocusAfterRefresh")) { + this.setFocusRecovered(); + return false; + } + if (this.needsFocusRestored) { + this.setFocusRecovered(); + return true; + } + return this.doesRowOrCellHaveBrowserFocus(); + } + onColumnEverythingChanged() { + if (!this.focusedCell) { + return; + } + const col = this.focusedCell.column; + const colFromColumnModel = this.colModel.getCol(col.getId()); + if (col !== colFromColumnModel) { + this.clearFocusedCell(); + } + } + getFocusCellToUseAfterRefresh() { + const { gos, focusedCell } = this; + if (gos.get("suppressFocusAfterRefresh") || gos.get("suppressCellFocus") || !focusedCell) { + return null; + } + if (!this.doesRowOrCellHaveBrowserFocus()) { + return null; + } + return focusedCell; + } + getFocusHeaderToUseAfterRefresh() { + if (this.gos.get("suppressFocusAfterRefresh") || !this.focusedHeader) { + return null; + } + if (!this.isDomDataPresentInHierarchy(_getActiveDomElement(this.beans), DOM_DATA_KEY_HEADER_CTRL)) { + return null; + } + return this.focusedHeader; + } + doesRowOrCellHaveBrowserFocus() { + const activeElement = _getActiveDomElement(this.beans); + if (this.isDomDataPresentInHierarchy(activeElement, DOM_DATA_KEY_CELL_CTRL, true)) { + return true; + } + return this.isDomDataPresentInHierarchy(activeElement, DOM_DATA_KEY_ROW_CTRL, true); + } + isDomDataPresentInHierarchy(eBrowserCell, key, attemptToRefocusIfDestroyed) { + let ePointer = eBrowserCell; + while (ePointer) { + const data = _getDomData(this.gos, ePointer, key); + if (data) { + if (data.destroyed && attemptToRefocusIfDestroyed) { + this.attemptToRecoverFocus(); + return false; + } + return true; + } + ePointer = ePointer.parentNode; + } + return false; + } + getFocusedCell() { + return this.focusedCell; + } + getFocusEventParams(focusedCellPosition) { + const { rowIndex, rowPinned, column } = focusedCellPosition; + const params = { + rowIndex, + rowPinned, + column, + isFullWidthCell: false + }; + const rowCtrl = this.rowRenderer.getRowByPosition({ rowIndex, rowPinned }); + if (rowCtrl) { + params.isFullWidthCell = rowCtrl.isFullWidth(); + } + return params; + } + clearFocusedCell() { + if (this.focusedCell == null) { + return; + } + const focusEventParams = this.getFocusEventParams(this.focusedCell); + this.focusedCell = null; + this.eventSvc.dispatchEvent({ + type: "cellFocusCleared", + ...focusEventParams + }); + } + setFocusedCell(params) { + this.setFocusRecovered(); + const { + column, + rowIndex, + rowPinned, + forceBrowserFocus = false, + preventScrollOnBrowserFocus = false, + sourceEvent + } = params; + const gridColumn = this.colModel.getCol(column); + if (!gridColumn) { + this.focusedCell = null; + return; + } + this.focusedCell = { + rowIndex, + rowPinned: _makeNull(rowPinned), + column: gridColumn + }; + const focusEventParams = this.getFocusEventParams(this.focusedCell); + this.eventSvc.dispatchEvent({ + type: "cellFocused", + ...focusEventParams, + ...this.previousCellFocusParams && { previousParams: this.previousCellFocusParams }, + forceBrowserFocus, + preventScrollOnBrowserFocus, + sourceEvent + }); + this.previousCellFocusParams = focusEventParams; + } + isCellFocused(cellPosition) { + if (this.focusedCell == null) { + return false; + } + return _areCellsEqual(cellPosition, this.focusedCell); + } + isHeaderWrapperFocused(headerCtrl) { + if (this.focusedHeader == null) { + return false; + } + const { + column, + rowCtrl: { rowIndex: headerRowIndex, pinned } + } = headerCtrl; + const { column: focusedColumn, headerRowIndex: focusedHeaderRowIndex } = this.focusedHeader; + return column === focusedColumn && headerRowIndex === focusedHeaderRowIndex && pinned == focusedColumn.getPinned(); + } + focusHeaderPosition(params) { + this.setFocusRecovered(); + if (_isHeaderFocusSuppressed(this.beans)) { + return false; + } + const { direction, fromTab, allowUserOverride, event, fromCell, rowWithoutSpanValue, scroll = true } = params; + let { headerPosition } = params; + if (fromCell && this.filterManager?.isAdvFilterHeaderActive()) { + return this.focusAdvancedFilter(headerPosition); + } + if (allowUserOverride) { + const currentPosition = this.focusedHeader; + const headerRowCount = getFocusHeaderRowCount(this.beans); + if (fromTab) { + const userFunc = this.gos.getCallback("tabToNextHeader"); + if (userFunc) { + headerPosition = this.getHeaderPositionFromUserFunc({ + userFunc, + direction, + currentPosition, + headerPosition, + headerRowCount + }); + } + } else { + const userFunc = this.gos.getCallback("navigateToNextHeader"); + if (userFunc && event) { + const params2 = { + key: event.key, + previousHeaderPosition: currentPosition, + nextHeaderPosition: headerPosition, + headerRowCount, + event + }; + const userResult = userFunc(params2); + headerPosition = userResult === null ? currentPosition : userResult; + } + } + } + if (!headerPosition) { + return false; + } + return this.focusProvidedHeaderPosition({ + headerPosition, + direction, + event, + fromCell, + rowWithoutSpanValue, + scroll + }); + } + focusHeaderPositionFromUserFunc(params) { + if (_isHeaderFocusSuppressed(this.beans)) { + return false; + } + const { userFunc, headerPosition, direction, event } = params; + const currentPosition = this.focusedHeader; + const headerRowCount = getFocusHeaderRowCount(this.beans); + const newHeaderPosition = this.getHeaderPositionFromUserFunc({ + userFunc, + direction, + currentPosition, + headerPosition, + headerRowCount + }); + return !!newHeaderPosition && this.focusProvidedHeaderPosition({ + headerPosition: newHeaderPosition, + direction, + event + }); + } + getHeaderPositionFromUserFunc(params) { + const { userFunc, direction, currentPosition, headerPosition, headerRowCount } = params; + const userFuncParams = { + backwards: direction === "Before", + previousHeaderPosition: currentPosition, + nextHeaderPosition: headerPosition, + headerRowCount + }; + const userResult = userFunc(userFuncParams); + if (userResult === true) { + return currentPosition; + } + if (userResult === false) { + return null; + } + return userResult; + } + focusProvidedHeaderPosition(params) { + const { headerPosition, direction, fromCell, rowWithoutSpanValue, event, scroll = true } = params; + const { column, headerRowIndex } = headerPosition; + const { filterManager, ctrlsSvc, headerNavigation } = this.beans; + if (this.focusedHeader && isHeaderPositionEqual(params.headerPosition, this.focusedHeader)) { + return false; + } + if (headerRowIndex === -1) { + if (filterManager?.isAdvFilterHeaderActive()) { + return this.focusAdvancedFilter(headerPosition); + } + return this.focusGridView({ column, event }); + } + if (scroll) { + headerNavigation?.scrollToColumn(column, direction); + } + const headerRowContainerCtrl = ctrlsSvc.getHeaderRowContainerCtrl(column.getPinned()); + const focusSuccess = headerRowContainerCtrl?.focusHeader(headerPosition.headerRowIndex, column, event) || false; + if (headerNavigation && focusSuccess && (rowWithoutSpanValue != null || fromCell)) { + headerNavigation.currentHeaderRowWithoutSpan = rowWithoutSpanValue ?? -1; + } + return focusSuccess; + } + focusFirstHeader() { + if (this.overlays?.exclusive && this.focusOverlay()) { + return true; + } + const firstColumn = this.visibleCols.allCols[0]; + if (!firstColumn) { + return false; + } + const headerPosition = getHeaderIndexToFocus(this.beans, firstColumn, 0); + return this.focusHeaderPosition({ + headerPosition, + rowWithoutSpanValue: 0 + }); + } + focusLastHeader(event) { + if (this.overlays?.exclusive && this.focusOverlay(true)) { + return true; + } + const headerRowIndex = getFocusHeaderRowCount(this.beans) - 1; + const column = _last(this.visibleCols.allCols); + return this.focusHeaderPosition({ + headerPosition: { headerRowIndex, column }, + rowWithoutSpanValue: -1, + event + }); + } + focusPreviousFromFirstCell(event) { + if (this.filterManager?.isAdvFilterHeaderActive()) { + return this.focusAdvancedFilter(null); + } + return this.focusLastHeader(event); + } + isAnyCellFocused() { + return !!this.focusedCell; + } + isRowFocused(rowIndex, rowPinnedType) { + if (this.focusedCell == null) { + return false; + } + return this.focusedCell.rowIndex === rowIndex && this.focusedCell.rowPinned === _makeNull(rowPinnedType); + } + focusOverlay(backwards) { + const overlayGui = this.overlays?.isVisible() && this.overlays.eWrapper?.getGui(); + return !!overlayGui && _focusInto(overlayGui, backwards); + } + getDefaultTabToNextGridContainerTarget(params) { + const { backwards, focusableContainers } = params; + const step = backwards ? -1 : 1; + let gridBodyTarget; + const getGridBodyTabTarget = () => { + if (gridBodyTarget === undefined) { + gridBodyTarget = this.getGridBodyTabTarget(backwards); + } + return gridBodyTarget; + }; + for (let index = params.nextIndex;index >= 0 && index < focusableContainers.length; index += step) { + const target = _getDefaultTabTargetForContainer(focusableContainers[index], getGridBodyTabTarget); + if (target) { + return target; + } + } + return null; + } + getGridBodyTabTarget(backwards) { + if (backwards) { + return this.getGridViewTabTarget({ column: _last(this.visibleCols.allCols), backwards: true }); + } + const firstColumn = this.visibleCols.allCols[0]; + if (this.gos.get("headerHeight") === 0 || _isHeaderFocusSuppressed(this.beans)) { + return this.getGridViewTabTarget({ column: firstColumn }); + } + if (!firstColumn) { + return null; + } + return getHeaderIndexToFocus(this.beans, firstColumn, 0); + } + getGridViewTabTarget(params) { + const { backwards = false } = params; + const column = params.column ?? this.focusedHeader?.column; + if (!column) { + return null; + } + if (this.overlays?.exclusive) { + return null; + } + if (_isCellFocusSuppressed(this.beans)) { + return backwards && !_isHeaderFocusSuppressed(this.beans) ? { + headerRowIndex: getFocusHeaderRowCount(this.beans) - 1, + column + } : null; + } + const nextRow = backwards ? _getLastRow(this.beans) : _getFirstRow(this.beans); + if (nextRow?.rowIndex == null) { + if (this.overlays?.isVisible()) { + return null; + } + if (backwards && !_isHeaderFocusSuppressed(this.beans)) { + const lastColumn = _last(this.visibleCols.allCols); + if (lastColumn) { + return { + headerRowIndex: getFocusHeaderRowCount(this.beans) - 1, + column: lastColumn + }; + } + } + return null; + } + const rowNode = _getRowNode(this.beans, nextRow); + if (!rowNode || column.isSuppressNavigable(rowNode)) { + return null; + } + if (backwards) { + const rowCtrl = this.rowRenderer.getRowByPosition(nextRow); + if (rowCtrl?.isFullWidth()) { + return null; + } + } + return { + rowIndex: nextRow.rowIndex, + rowPinned: nextRow.rowPinned, + column + }; + } + focusGridView(params) { + const { backwards = false, canFocusOverlay = true, event } = params; + if (this.overlays?.exclusive) { + return canFocusOverlay && this.focusOverlay(backwards); + } + if (_isCellFocusSuppressed(this.beans)) { + if (backwards) { + if (!_isHeaderFocusSuppressed(this.beans)) { + return this.focusLastHeader(); + } + } + if (canFocusOverlay && this.focusOverlay(backwards)) { + return true; + } + if (backwards) { + return false; + } + return _focusNextGridCoreContainer(this.beans, backwards); + } + const nextRow = backwards ? _getLastRow(this.beans) : _getFirstRow(this.beans); + if (nextRow) { + const column = params.column ?? this.focusedHeader?.column; + const { rowIndex, rowPinned } = nextRow; + const rowNode = _getRowNode(this.beans, nextRow); + if (!column || !rowNode || rowIndex == null) { + return false; + } + if (column.isSuppressNavigable(rowNode)) { + const isRtl = this.gos.get("enableRtl"); + let key; + if (!event || event.key === KeyCode.TAB) { + key = isRtl ? KeyCode.LEFT : KeyCode.RIGHT; + } else { + key = event.key; + } + this.beans.navigation?.navigateToNextCell(null, key, { rowIndex, column, rowPinned: rowPinned || null }, true); + return true; + } + this.navigation?.ensureCellVisible({ rowIndex, column, rowPinned }); + if (backwards) { + const rowCtrl = this.rowRenderer.getRowByPosition(nextRow); + if (rowCtrl?.isFullWidth() && this.navigation?.tryToFocusFullWidthRow(nextRow, backwards)) { + return true; + } + } + this.setFocusedCell({ + rowIndex, + column, + rowPinned: _makeNull(rowPinned), + forceBrowserFocus: true + }); + if (!isRowNumberCol(column)) { + this.beans.rangeSvc?.setRangeToCell({ rowIndex, rowPinned, column }); + } + return true; + } + if (canFocusOverlay && this.focusOverlay(backwards)) { + return true; + } + if (backwards && this.focusLastHeader()) { + return true; + } + return false; + } + focusAdvancedFilter(position) { + this.advFilterFocusColumn = position?.column; + return this.beans.advancedFilter?.getCtrl().focusHeaderComp() ?? false; + } + focusNextFromAdvancedFilter(backwards, forceFirstColumn) { + const column = (forceFirstColumn ? undefined : this.advFilterFocusColumn) ?? this.visibleCols.allCols?.[0]; + if (backwards) { + return this.focusHeaderPosition({ + headerPosition: { + column, + headerRowIndex: getFocusHeaderRowCount(this.beans) - 1 + } + }); + } + return this.focusGridView({ column }); + } + clearAdvancedFilterColumn() { + this.advFilterFocusColumn = undefined; + } +}; +var ScrollVisibleService = class extends BeanStub { + constructor() { + super(...arguments); + this.beanName = "scrollVisibleSvc"; + } + wireBeans(beans) { + this.ctrlsSvc = beans.ctrlsSvc; + this.colAnimation = beans.colAnimation; + } + postConstruct() { + const { gos } = this; + this.horizontalScrollShowing = gos.get("alwaysShowHorizontalScroll") === true; + this.verticalScrollShowing = gos.get("alwaysShowVerticalScroll") === true; + this.getScrollbarWidth(); + const updateScrollVisible = this.updateScrollVisible.bind(this); + this.addManagedEventListeners({ + displayedColumnsChanged: updateScrollVisible, + displayedColumnsWidthChanged: updateScrollVisible, + newColumnsLoaded: updateScrollVisible + }); + } + updateScrollVisible() { + const { colAnimation } = this; + if (colAnimation?.isActive()) { + colAnimation.executeLaterVMTurn(() => { + colAnimation.executeLaterVMTurn(() => this.updateScrollVisibleImpl()); + }); + } else { + this.updateScrollVisibleImpl(); + } + } + updateScrollVisibleImpl() { + const centerRowCtrl = this.ctrlsSvc.get("center"); + if (!centerRowCtrl || this.colAnimation?.isActive()) { + return; + } + const params = { + horizontalScrollShowing: centerRowCtrl.isHorizontalScrollShowing(), + verticalScrollShowing: this.verticalScrollShowing + }; + this.setScrollsVisible(params); + this.updateScrollGap(); + } + updateScrollGap() { + const centerRowCtrl = this.ctrlsSvc.get("center"); + const horizontalGap = centerRowCtrl.hasHorizontalScrollGap(); + const verticalGap = centerRowCtrl.hasVerticalScrollGap(); + const atLeastOneDifferent = this.horizontalScrollGap !== horizontalGap || this.verticalScrollGap !== verticalGap; + if (atLeastOneDifferent) { + this.horizontalScrollGap = horizontalGap; + this.verticalScrollGap = verticalGap; + this.eventSvc.dispatchEvent({ + type: "scrollGapChanged" + }); + } + } + setScrollsVisible(params) { + const atLeastOneDifferent = this.horizontalScrollShowing !== params.horizontalScrollShowing || this.verticalScrollShowing !== params.verticalScrollShowing; + if (atLeastOneDifferent) { + this.horizontalScrollShowing = params.horizontalScrollShowing; + this.verticalScrollShowing = params.verticalScrollShowing; + this.eventSvc.dispatchEvent({ + type: "scrollVisibilityChanged" + }); + } + } + getScrollbarWidth() { + if (this.scrollbarWidth == null) { + const gridOptionsScrollbarWidth = this.gos.get("scrollbarWidth"); + const useGridOptions = typeof gridOptionsScrollbarWidth === "number" && gridOptionsScrollbarWidth >= 0; + const scrollbarWidth = useGridOptions ? gridOptionsScrollbarWidth : _getScrollbarWidth(); + if (scrollbarWidth != null) { + this.scrollbarWidth = scrollbarWidth; + this.eventSvc.dispatchEvent({ + type: "scrollbarWidthChanged" + }); + } + } + return this.scrollbarWidth; + } +}; +var GridDestroyService = class extends BeanStub { + constructor() { + super(...arguments); + this.beanName = "gridDestroySvc"; + this.destroyCalled = false; + } + destroy() { + if (this.destroyCalled) { + return; + } + const { stateSvc, ctrlsSvc, context } = this.beans; + this.eventSvc.dispatchEvent({ + type: "gridPreDestroyed", + state: stateSvc?.getState() ?? {} + }); + this.destroyCalled = true; + ctrlsSvc.get("gridCtrl")?.destroyGridUi(); + context.destroy(); + super.destroy(); + } +}; +var _PUBLIC_EVENTS = [ + "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 ALWAYS_SYNC_GLOBAL_EVENTS = /* @__PURE__ */ new Set(["gridPreDestroyed", "fillStart", "pasteStart"]); +var _PUBLIC_EVENT_HANDLERS_MAP = _PUBLIC_EVENTS.reduce((mem, ev) => { + mem[ev] = _getCallbackForEvent(ev); + return mem; +}, {}); +var USER_COMP_MODULES = { + 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 quote(s) { + return `"${s}"`; +} +var COLUMN_DEFINITION_DEPRECATIONS = () => ({ + 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." + } +}); +var COLUMN_DEFINITION_MOD_VALIDATIONS = { + allowFormula: "Formula", + aggFunc: "SharedAggregation", + autoHeight: "RowAutoHeight", + cellClass: "CellStyle", + cellClassRules: "CellStyle", + cellEditor: ({ cellEditor, editable, groupRowEditable }) => { + const editingEnabled = !!editable || !!groupRowEditable; + if (!editingEnabled) { + return null; + } + if (typeof cellEditor === "string") { + return USER_COMP_MODULES[cellEditor] ?? "CustomEditor"; + } + return "CustomEditor"; + }, + cellRenderer: ({ cellRenderer }) => { + if (typeof cellRenderer !== "string") { + return null; + } + return USER_COMP_MODULES[cellRenderer]; + }, + cellStyle: "CellStyle", + columnChooserParams: "ColumnMenu", + contextMenuItems: "ContextMenu", + dndSource: "DragAndDrop", + dndSourceOnRowDrag: "DragAndDrop", + editable: ({ editable, cellEditor }) => { + if (editable && !cellEditor) { + return "TextEditor"; + } + return null; + }, + groupRowEditable: ({ groupRowEditable, cellEditor }) => { + if (!groupRowEditable) { + return null; + } + return cellEditor ? "RowGroupingEdit" : ["RowGroupingEdit", "TextEditor"]; + }, + groupRowValueSetter: ({ groupRowValueSetter }) => groupRowValueSetter ? "RowGroupingEdit" : null, + enableCellChangeFlash: "HighlightChanges", + enablePivot: "SharedPivot", + enableRowGroup: "SharedRowGrouping", + enableValue: "SharedAggregation", + filter: ({ filter }) => { + if (filter && typeof filter !== "string" && typeof filter !== "boolean") { + return "CustomFilter"; + } + if (typeof filter === "string") { + return USER_COMP_MODULES[filter] ?? "ColumnFilter"; + } + return "ColumnFilter"; + }, + floatingFilter: "ColumnFilter", + getQuickFilterText: "QuickFilter", + headerTooltip: "Tooltip", + headerTooltipValueGetter: "Tooltip", + mainMenuItems: "ColumnMenu", + menuTabs: (options) => { + const enterpriseMenuTabs = ["columnsMenuTab", "generalMenuTab"]; + if (options.menuTabs?.some((tab) => enterpriseMenuTabs.includes(tab))) { + return "ColumnMenu"; + } + return null; + }, + pivot: "SharedPivot", + pivotIndex: "SharedPivot", + rowDrag: "RowDrag", + rowGroup: "SharedRowGrouping", + rowGroupIndex: "SharedRowGrouping", + tooltipField: "Tooltip", + tooltipValueGetter: "Tooltip", + tooltipComponentSelector: "Tooltip", + spanRows: "CellSpan", + groupHierarchy: "SharedRowGrouping" +}; +var COLUMN_DEFINITION_VALIDATIONS = () => { + const validations = { + autoHeight: { + supportedRowModels: ["clientSide", "serverSide"], + validate: (_colDef, { paginationAutoPageSize }) => { + if (paginationAutoPageSize) { + return "colDef.autoHeight is not supported with paginationAutoPageSize."; + } + return null; + } + }, + allowFormula: { + supportedRowModels: ["clientSide"] + }, + cellRendererParams: { + validate: (colDef) => { + const groupColumn = colDef.rowGroup != null || colDef.rowGroupIndex != null || colDef.cellRenderer === "agGroupCellRenderer"; + if (groupColumn && "checkbox" in colDef.cellRendererParams) { + return 'Since v33.0, `cellRendererParams.checkbox` has been deprecated. Use `rowSelection.checkboxLocation = "autoGroupColumn"` instead.'; + } + return null; + } + }, + flex: { + validate: (_options, gridOptions) => { + if (gridOptions.autoSizeStrategy) { + return "colDef.flex is not supported with gridOptions.autoSizeStrategy"; + } + return null; + } + }, + headerCheckboxSelection: { + supportedRowModels: ["clientSide", "serverSide"], + validate: (_options, { rowSelection }) => rowSelection === "multiple" ? null : "headerCheckboxSelection is only supported with rowSelection=multiple" + }, + headerCheckboxSelectionCurrentPageOnly: { + supportedRowModels: ["clientSide"], + validate: (_options, { rowSelection }) => rowSelection === "multiple" ? null : "headerCheckboxSelectionCurrentPageOnly is only supported with rowSelection=multiple" + }, + headerCheckboxSelectionFilteredOnly: { + supportedRowModels: ["clientSide"], + validate: (_options, { rowSelection }) => rowSelection === "multiple" ? null : "headerCheckboxSelectionFilteredOnly is only supported with rowSelection=multiple" + }, + headerValueGetter: { + validate: (_options) => { + const headerValueGetter = _options.headerValueGetter; + if (typeof headerValueGetter === "function" || typeof headerValueGetter === "string") { + return null; + } + return "headerValueGetter must be a function or a valid string expression"; + } + }, + icons: { + validate: ({ icons }) => { + if (icons) { + if (icons["smallDown"]) { + return _errMsg(262); + } + if (icons["smallLeft"]) { + return _errMsg(263); + } + if (icons["smallRight"]) { + return _errMsg(264); + } + } + return null; + } + }, + sort: { + validate: (_options) => { + if (_isSortDefValid(_options.sort) || _isSortDirectionValid(_options.sort)) { + return null; + } + return `sort must be of type (SortDirection | SortDef), currently it is ${typeof _options.sort === "object" ? JSON.stringify(_options.sort) : toStringWithNullUndefined(_options.sort)}`; + } + }, + initialSort: { + validate: (_options) => { + if (_isSortDefValid(_options.initialSort) || _isSortDirectionValid(_options.initialSort)) { + return null; + } + return `initialSort must be of non-null type (SortDirection | SortDef), currently it is ${typeof _options.initialSort === "object" ? JSON.stringify(_options.initialSort) : toStringWithNullUndefined(_options.initialSort)}`; + } + }, + sortingOrder: { + validate: (_options) => { + const sortingOrder = _options.sortingOrder; + if (Array.isArray(sortingOrder) && sortingOrder.length > 0) { + const invalidItems = sortingOrder.filter((a) => { + return !(_isSortDefValid(a) || _isSortDirectionValid(a)); + }); + if (invalidItems.length > 0) { + return `sortingOrder must be an array of type non-null (SortDirection | SortDef)[], incorrect items are: [${invalidItems.map((item) => typeof item === "string" || item == null ? toStringWithNullUndefined(item) : JSON.stringify(item)).join(", ")}]`; + } + } else if (!Array.isArray(sortingOrder) || !sortingOrder.length) { + return `sortingOrder must be an array with at least one element, currently it is [${sortingOrder}]`; + } + return null; + } + }, + type: { + validate: (_options) => { + const type = _options.type; + if (type instanceof Array) { + const invalidArray = type.some((a) => typeof a !== "string"); + if (invalidArray) { + return "if colDef.type is supplied an array it should be of type 'string[]'"; + } + return null; + } + if (typeof type === "string") { + return null; + } + return "colDef.type should be of type 'string' | 'string[]'"; + } + }, + rowSpan: { + validate: (_options, { suppressRowTransform }) => { + if (!suppressRowTransform) { + return "colDef.rowSpan requires suppressRowTransform to be enabled."; + } + return null; + } + }, + spanRows: { + dependencies: { + editable: { required: [false, undefined] }, + groupRowEditable: { required: [false, undefined] }, + rowDrag: { required: [false, undefined] }, + colSpan: { required: [undefined] }, + rowSpan: { required: [undefined] } + }, + validate: (_options, { + rowSelection, + cellSelection, + suppressRowTransform, + enableCellSpan, + rowDragEntireRow, + enableCellTextSelection + }) => { + if (typeof rowSelection === "object") { + if (rowSelection?.mode === "singleRow" && rowSelection?.enableClickSelection) { + return "colDef.spanRows is not supported with rowSelection.clickSelection"; + } + } + if (cellSelection) { + return "colDef.spanRows is not supported with cellSelection."; + } + if (suppressRowTransform) { + return "colDef.spanRows is not supported with suppressRowTransform."; + } + if (!enableCellSpan) { + return "colDef.spanRows requires enableCellSpan to be enabled."; + } + if (rowDragEntireRow) { + return "colDef.spanRows is not supported with rowDragEntireRow."; + } + if (enableCellTextSelection) { + return "colDef.spanRows is not supported with enableCellTextSelection."; + } + return null; + } + }, + groupHierarchy: { + validate(options, { groupHierarchyConfig = {} }, beans) { + const GROUP_HIERARCHY_PARTS = /* @__PURE__ */ new Set([ + "year", + "quarter", + "month", + "formattedMonth", + "day", + "hour", + "minute", + "second" + ]); + const unrecognisedParts = []; + for (const part of options.groupHierarchy ?? []) { + if (typeof part === "object") { + beans.validation?.validateColDef(part); + continue; + } + if (!GROUP_HIERARCHY_PARTS.has(part) && !(part in groupHierarchyConfig)) { + unrecognisedParts.push(quote(part)); + } + } + if (unrecognisedParts.length > 0) { + const warning = `The following parts of colDef.groupHierarchy are not recognised: ${unrecognisedParts.join(", ")}.`; + const suggestions = `Choose one of ${[...GROUP_HIERARCHY_PARTS].map(quote).join(", ")}, or define your own parts in gridOptions.groupHierarchyConfig.`; + return `${warning} +${suggestions}`; + } + return null; + } + } + }; + return validations; +}; +var colDefPropertyMap = { + headerName: undefined, + columnGroupShow: undefined, + headerStyle: undefined, + headerClass: undefined, + toolPanelClass: undefined, + headerValueGetter: undefined, + pivotKeys: undefined, + groupId: undefined, + colId: undefined, + sort: undefined, + initialSort: undefined, + field: undefined, + type: undefined, + cellDataType: undefined, + tooltipComponent: undefined, + tooltipField: undefined, + headerTooltip: undefined, + headerTooltipValueGetter: undefined, + cellClass: undefined, + showRowGroup: undefined, + filter: undefined, + initialAggFunc: undefined, + defaultAggFunc: undefined, + aggFunc: undefined, + groupRowEditable: undefined, + groupRowValueSetter: undefined, + pinned: undefined, + initialPinned: undefined, + chartDataType: undefined, + cellAriaRole: undefined, + cellEditorPopupPosition: undefined, + headerGroupComponent: undefined, + headerGroupComponentParams: undefined, + cellStyle: undefined, + cellRenderer: undefined, + cellRendererParams: undefined, + cellEditor: undefined, + cellEditorParams: undefined, + filterParams: undefined, + pivotValueColumn: undefined, + headerComponent: undefined, + headerComponentParams: undefined, + floatingFilterComponent: undefined, + floatingFilterComponentParams: undefined, + tooltipComponentParams: undefined, + refData: undefined, + columnChooserParams: undefined, + children: undefined, + sortingOrder: undefined, + allowedAggFuncs: undefined, + menuTabs: undefined, + pivotTotalColumnIds: undefined, + cellClassRules: undefined, + icons: undefined, + sortIndex: undefined, + initialSortIndex: undefined, + flex: undefined, + initialFlex: undefined, + width: undefined, + initialWidth: undefined, + minWidth: undefined, + maxWidth: undefined, + rowGroupIndex: undefined, + initialRowGroupIndex: undefined, + pivotIndex: undefined, + initialPivotIndex: undefined, + suppressColumnsToolPanel: undefined, + suppressFiltersToolPanel: undefined, + openByDefault: undefined, + marryChildren: undefined, + suppressStickyLabel: undefined, + hide: undefined, + initialHide: undefined, + rowGroup: undefined, + initialRowGroup: undefined, + pivot: undefined, + initialPivot: undefined, + checkboxSelection: undefined, + showDisabledCheckboxes: undefined, + headerCheckboxSelection: undefined, + headerCheckboxSelectionFilteredOnly: undefined, + headerCheckboxSelectionCurrentPageOnly: undefined, + suppressHeaderMenuButton: undefined, + suppressMovable: undefined, + lockPosition: undefined, + lockVisible: undefined, + lockPinned: undefined, + unSortIcon: undefined, + suppressSizeToFit: undefined, + suppressAutoSize: undefined, + enableRowGroup: undefined, + enablePivot: undefined, + enableValue: undefined, + editable: undefined, + suppressPaste: undefined, + suppressNavigable: undefined, + enableCellChangeFlash: undefined, + rowDrag: undefined, + dndSource: undefined, + autoHeight: undefined, + wrapText: undefined, + sortable: undefined, + resizable: undefined, + singleClickEdit: undefined, + floatingFilter: undefined, + cellEditorPopup: undefined, + suppressFillHandle: undefined, + wrapHeaderText: undefined, + autoHeaderHeight: undefined, + dndSourceOnRowDrag: undefined, + valueGetter: undefined, + valueSetter: undefined, + filterValueGetter: undefined, + keyCreator: undefined, + valueFormatter: undefined, + valueParser: undefined, + comparator: undefined, + equals: undefined, + pivotComparator: undefined, + suppressKeyboardEvent: undefined, + suppressHeaderKeyboardEvent: undefined, + colSpan: undefined, + rowSpan: undefined, + spanRows: undefined, + getQuickFilterText: undefined, + onCellValueChanged: undefined, + onCellClicked: undefined, + onCellDoubleClicked: undefined, + onCellContextMenu: undefined, + rowDragText: undefined, + tooltipValueGetter: undefined, + tooltipComponentSelector: undefined, + cellRendererSelector: undefined, + cellEditorSelector: undefined, + suppressSpanHeaderHeight: undefined, + useValueFormatterForExport: undefined, + useValueParserForImport: undefined, + mainMenuItems: undefined, + contextMenuItems: undefined, + suppressFloatingFilterButton: undefined, + suppressHeaderFilterButton: undefined, + suppressHeaderContextMenu: undefined, + loadingCellRenderer: undefined, + loadingCellRendererParams: undefined, + loadingCellRendererSelector: undefined, + context: undefined, + dateComponent: undefined, + dateComponentParams: undefined, + getFindText: undefined, + rowGroupingHierarchy: undefined, + groupHierarchy: undefined, + allowFormula: undefined +}; +var ALL_PROPERTIES = () => Object.keys(colDefPropertyMap); +var COL_DEF_VALIDATORS = () => ({ + objectName: "colDef", + allProperties: ALL_PROPERTIES(), + docsUrl: "column-properties/", + deprecations: COLUMN_DEFINITION_DEPRECATIONS(), + validations: COLUMN_DEFINITION_VALIDATIONS() +}); +var STRING_GRID_OPTIONS = [ + "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" +]; +var OBJECT_GRID_OPTIONS = [ + "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" +]; +var ARRAY_GRID_OPTIONS = [ + "sortingOrder", + "alignedGrids", + "rowData", + "columnDefs", + "excelStyles", + "pinnedTopRowData", + "pinnedBottomRowData", + "chartThemes", + "rowClass", + "paginationPageSizeSelector", + "suppressOverlays" +]; +var _NUMBER_GRID_OPTIONS = [ + "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" +]; +var OTHER_GRID_OPTIONS = ["theme", "rowSelection"]; +var _BOOLEAN_MIXED_GRID_OPTIONS = [ + "cellSelection", + "sideBar", + "rowNumbers", + "suppressGroupChangesColumnVisibility", + "groupAggFiltering", + "suppressStickyTotalRow", + "groupHideParentOfSingleChild", + "enableRowPinning" +]; +var _BOOLEAN_GRID_OPTIONS = [ + "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" +]; +var _FUNCTION_GRID_OPTIONS = [ + "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" +]; +var _GET_ALL_GRID_OPTIONS = () => [ + ...ARRAY_GRID_OPTIONS, + ...OBJECT_GRID_OPTIONS, + ...STRING_GRID_OPTIONS, + ..._NUMBER_GRID_OPTIONS, + ..._FUNCTION_GRID_OPTIONS, + ..._BOOLEAN_GRID_OPTIONS, + ..._BOOLEAN_MIXED_GRID_OPTIONS, + ...OTHER_GRID_OPTIONS +]; +var GRID_OPTION_DEPRECATIONS = () => ({ + 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 toConstrainedNum(key, value, min) { + if (typeof value === "number" || value == null) { + if (value == null) { + return null; + } + return value >= min ? null : `${key}: value should be greater than or equal to ${min}`; + } + return `${key}: value should be a number`; +} +var GRID_OPTIONS_MODULES = { + 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" +}; +var GRID_OPTION_VALIDATIONS = () => { + const definedValidations = { + autoSizePadding: { + validate({ autoSizePadding }) { + return toConstrainedNum("autoSizePadding", autoSizePadding, 0); + } + }, + cacheBlockSize: { + supportedRowModels: ["serverSide", "infinite"], + validate({ cacheBlockSize }) { + return toConstrainedNum("cacheBlockSize", cacheBlockSize, 1); + } + }, + cacheOverflowSize: { + validate({ cacheOverflowSize }) { + return toConstrainedNum("cacheOverflowSize", cacheOverflowSize, 1); + } + }, + datasource: { + supportedRowModels: ["infinite"] + }, + domLayout: { + validate: (options) => { + const domLayout = options.domLayout; + const validLayouts = ["autoHeight", "normal", "print"]; + if (domLayout && !validLayouts.includes(domLayout)) { + return `domLayout must be one of [${validLayouts.join()}], currently it's ${domLayout}`; + } + return null; + } + }, + enableFillHandle: { + dependencies: { + enableRangeSelection: { required: [true] } + } + }, + enableRangeHandle: { + dependencies: { + enableRangeSelection: { required: [true] } + } + }, + enableCellSpan: { + supportedRowModels: ["clientSide", "serverSide"] + }, + enableRangeSelection: { + dependencies: { + rowDragEntireRow: { required: [false, undefined] } + } + }, + enableRowPinning: { + supportedRowModels: ["clientSide"], + validate({ enableRowPinning, pinnedTopRowData, pinnedBottomRowData }) { + if (enableRowPinning && (pinnedTopRowData || pinnedBottomRowData)) { + 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, isRowPinnable, pinnedTopRowData, pinnedBottomRowData }) { + if (isRowPinnable && (pinnedTopRowData || pinnedBottomRowData)) { + return "Manual row pinning cannot be used together with pinned row data. Either remove `isRowPinnable`, or remove `pinnedTopRowData` and `pinnedBottomRowData`."; + } + if (!enableRowPinning && isRowPinnable) { + return "`isRowPinnable` requires `enableRowPinning` to be set."; + } + return null; + } + }, + isRowPinned: { + supportedRowModels: ["clientSide"], + validate({ enableRowPinning, isRowPinned, pinnedTopRowData, pinnedBottomRowData }) { + if (isRowPinned && (pinnedTopRowData || pinnedBottomRowData)) { + return "Manual row pinning cannot be used together with pinned row data. Either remove `isRowPinned`, or remove `pinnedTopRowData` and `pinnedBottomRowData`."; + } + if (!enableRowPinning && isRowPinned) { + return "`isRowPinned` requires `enableRowPinning` to be set."; + } + return null; + } + }, + groupDefaultExpanded: { + supportedRowModels: ["clientSide"] + }, + groupHideColumnsUntilExpanded: { + supportedRowModels: ["clientSide"], + validate({ groupHideColumnsUntilExpanded, groupHideOpenParents, groupDisplayType }) { + if (groupHideColumnsUntilExpanded && !groupHideOpenParents && groupDisplayType !== "multipleColumns") { + return "`groupHideColumnsUntilExpanded = true` requires either `groupDisplayType = 'multipleColumns'` or `groupHideOpenParents = true`"; + } + return null; + } + }, + groupHideOpenParents: { + supportedRowModels: ["clientSide", "serverSide"], + dependencies: { + groupTotalRow: { required: [undefined, "bottom"] }, + treeData: { + required: [undefined, false], + reason: "Tree Data has values at the group level so it doesn't make sense to hide them." + } + } + }, + groupHideParentOfSingleChild: { + dependencies: { + groupHideOpenParents: { required: [undefined, false] } + } + }, + groupRemoveLowestSingleChildren: { + dependencies: { + groupHideOpenParents: { required: [undefined, false] }, + groupRemoveSingleChildren: { required: [undefined, false] } + } + }, + groupRemoveSingleChildren: { + dependencies: { + groupHideOpenParents: { required: [undefined, false] }, + groupRemoveLowestSingleChildren: { required: [undefined, false] } + } + }, + groupSelectsChildren: { + dependencies: { + rowSelection: { required: ["multiple"] } + } + }, + groupHierarchyConfig: { + validate({ groupHierarchyConfig = {} }, gridOptions, beans) { + for (const k of Object.keys(groupHierarchyConfig)) { + beans.validation?.validateColDef(groupHierarchyConfig[k]); + } + return null; + } + }, + icons: { + validate: ({ icons }) => { + if (icons) { + if (icons["smallDown"]) { + return _errMsg(262); + } + if (icons["smallLeft"]) { + return _errMsg(263); + } + if (icons["smallRight"]) { + return _errMsg(264); + } + } + return null; + } + }, + infiniteInitialRowCount: { + validate({ infiniteInitialRowCount }) { + return toConstrainedNum("infiniteInitialRowCount", infiniteInitialRowCount, 1); + } + }, + initialGroupOrderComparator: { + supportedRowModels: ["clientSide"] + }, + ssrmExpandAllAffectsAllRows: { + validate: (options) => { + if (typeof options.ssrmExpandAllAffectsAllRows === "boolean") { + if (options.rowModelType !== "serverSide") { + return "'ssrmExpandAllAffectsAllRows' is only supported with the Server Side Row Model."; + } + if (options.ssrmExpandAllAffectsAllRows && typeof options.getRowId !== "function") { + return `'getRowId' callback must be provided for Server Side Row Model grouping to work correctly.`; + } + } + return null; + } + }, + keepDetailRowsCount: { + validate({ keepDetailRowsCount }) { + return toConstrainedNum("keepDetailRowsCount", keepDetailRowsCount, 1); + } + }, + paginationPageSize: { + validate({ paginationPageSize }) { + return toConstrainedNum("paginationPageSize", paginationPageSize, 1); + } + }, + paginationPageSizeSelector: { + validate: (options) => { + const values = options.paginationPageSizeSelector; + if (typeof values === "boolean" || values == null) { + return null; + } + if (!values.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: [false, undefined], + reason: "Pivot Mode is not supported with Tree Data." + } + } + }, + quickFilterText: { + supportedRowModels: ["clientSide"] + }, + rowBuffer: { + validate({ rowBuffer }) { + return toConstrainedNum("rowBuffer", rowBuffer, 0); + } + }, + rowClass: { + validate: (options) => { + const rowClass = options.rowClass; + if (typeof rowClass === "function") { + return "rowClass should not be a function, please use getRowClass instead"; + } + return null; + } + }, + rowData: { + supportedRowModels: ["clientSide"] + }, + rowDragManaged: { + supportedRowModels: ["clientSide"], + dependencies: { + pagination: { + required: [false, undefined] + } + } + }, + rowSelection: { + validate({ rowSelection }) { + if (rowSelection && typeof rowSelection === "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 (rowSelection && typeof rowSelection !== "object") { + return "Expected `RowSelectionOptions` object for the `rowSelection` property."; + } + if (rowSelection && rowSelection.mode !== "multiRow" && rowSelection.mode !== "singleRow") { + return `Selection mode "${rowSelection.mode}" is invalid. Use one of 'singleRow' or 'multiRow'.`; + } + return null; + } + }, + rowStyle: { + validate: (options) => { + const rowStyle = options.rowStyle; + if (rowStyle && typeof rowStyle === "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 }) { + return toConstrainedNum("serverSideInitialRowCount", serverSideInitialRowCount, 1); + } + }, + serverSideOnlyRefreshFilteredGroups: { + supportedRowModels: ["serverSide"] + }, + serverSideSortAllLevels: { + supportedRowModels: ["serverSide"] + }, + sortingOrder: { + validate: (_options) => { + const sortingOrder = _options.sortingOrder; + if (Array.isArray(sortingOrder) && sortingOrder.length > 0) { + const invalidItems = sortingOrder.filter((a) => !_getSortDefFromInput(a)); + if (invalidItems.length > 0) { + return `sortingOrder must be an array of type (SortDirection | SortDef)[], incorrect items are: ${invalidItems.map((item) => typeof item === "string" || item == null ? toStringWithNullUndefined(item) : JSON.stringify(item))}]`; + } + } else if (!Array.isArray(sortingOrder) || !sortingOrder.length) { + return `sortingOrder must be an array with at least one element, currently it's ${sortingOrder}`; + } + return null; + } + }, + tooltipHideDelay: { + validate: (options) => { + if (options.tooltipHideDelay && options.tooltipHideDelay < 0) { + return "tooltipHideDelay should not be lower than 0"; + } + return null; + } + }, + tooltipShowDelay: { + validate: (options) => { + if (options.tooltipShowDelay && options.tooltipShowDelay < 0) { + return "tooltipShowDelay should not be lower than 0"; + } + return null; + } + }, + tooltipSwitchShowDelay: { + validate: (options) => { + if (options.tooltipSwitchShowDelay && options.tooltipSwitchShowDelay < 0) { + return "tooltipSwitchShowDelay should not be lower than 0"; + } + return null; + } + }, + treeData: { + supportedRowModels: ["clientSide", "serverSide"], + validate: (options) => { + const rowModel = options.rowModelType ?? "clientSide"; + switch (rowModel) { + case "clientSide": { + const { treeDataChildrenField, treeDataParentIdField, getDataPath, getRowId } = options; + if (!treeDataChildrenField && !treeDataParentIdField && !getDataPath) { + return "treeData requires either 'treeDataChildrenField' or 'treeDataParentIdField' or 'getDataPath' in the clientSide row model."; + } + if (treeDataChildrenField) { + if (getDataPath) { + return "Cannot use both 'treeDataChildrenField' and 'getDataPath' at the same time."; + } + if (treeDataParentIdField) { + return "Cannot use both 'treeDataChildrenField' and 'treeDataParentIdField' at the same time."; + } + } + if (treeDataParentIdField) { + if (!getRowId) { + return "getRowId callback not provided, tree data with parent id cannot be built."; + } + if (getDataPath) { + return "Cannot use both 'treeDataParentIdField' and 'getDataPath' at the same time."; + } + } + return null; + } + case "serverSide": { + const ssrmWarning = `treeData requires 'isServerSideGroup' and 'getServerSideGroupKey' in the ${rowModel} row model.`; + return options.isServerSideGroup && options.getServerSideGroupKey ? null : ssrmWarning; + } + } + return null; + } + }, + viewportDatasource: { + supportedRowModels: ["viewport"] + }, + viewportRowModelBufferSize: { + validate({ viewportRowModelBufferSize }) { + return toConstrainedNum("viewportRowModelBufferSize", viewportRowModelBufferSize, 0); + } + }, + viewportRowModelPageSize: { + validate({ viewportRowModelPageSize }) { + return toConstrainedNum("viewportRowModelPageSize", viewportRowModelPageSize, 1); + } + }, + rowDragEntireRow: { + dependencies: { + cellSelection: { required: [undefined] } + } + }, + autoGroupColumnDef: { + validate({ autoGroupColumnDef, showOpenedGroup }) { + if (autoGroupColumnDef?.field && showOpenedGroup) { + return "autoGroupColumnDef.field and showOpenedGroup are not supported when used together."; + } + if (autoGroupColumnDef?.valueGetter && showOpenedGroup) { + return "autoGroupColumnDef.valueGetter and showOpenedGroup are not supported when used together."; + } + return null; + } + }, + renderingMode: { + validate: (options) => { + const renderingMode = options.renderingMode; + const validModes = ["default", "legacy"]; + if (renderingMode && !validModes.includes(renderingMode)) { + return `renderingMode must be one of [${validModes.join()}], currently it's ${renderingMode}`; + } + return null; + } + }, + autoSizeStrategy: { + validate: ({ autoSizeStrategy }) => { + if (!autoSizeStrategy) { + return null; + } + const validModes = [ + "fitCellContents", + "fitGridWidth", + "fitProvidedWidth" + ]; + const type = autoSizeStrategy.type; + if (type !== "fitCellContents" && type !== "fitGridWidth" && type !== "fitProvidedWidth") { + return `Invalid Auto-size strategy. \`autoSizeStrategy\` must be one of ${validModes.map((m) => '"' + m + '"').join(", ")}, currently it's ${type}`; + } + if (type === "fitProvidedWidth" && typeof autoSizeStrategy.width != "number") { + return `When using the 'fitProvidedWidth' auto-size strategy, must provide a numeric \`width\`. You provided ${autoSizeStrategy.width}`; + } + return null; + } + } + }; + const validations = {}; + for (const key of _BOOLEAN_GRID_OPTIONS) { + validations[key] = { expectedType: "boolean" }; + } + for (const key of _NUMBER_GRID_OPTIONS) { + validations[key] = { expectedType: "number" }; + } + _mergeDeep(validations, definedValidations); + return validations; +}; +var GRID_OPTIONS_VALIDATORS = () => ({ + objectName: "gridOptions", + allProperties: [..._GET_ALL_GRID_OPTIONS(), ...Object.values(_PUBLIC_EVENT_HANDLERS_MAP)], + propertyExceptions: ["api"], + docsUrl: "grid-options/", + deprecations: GRID_OPTION_DEPRECATIONS(), + validations: GRID_OPTION_VALIDATIONS() +}); +var changeSetId = 0; +var gridInstanceSequence = 0; +var GRID_DOM_KEY = "__ag_grid_instance"; +var GridOptionsService = class extends BeanStub { + constructor() { + super(...arguments); + this.beanName = "gos"; + this.domDataKey = "__AG_" + Math.random().toString(); + this.instanceId = gridInstanceSequence++; + this.gridReadyFired = false; + this.queueEvents = []; + this.propEventSvc = new LocalEventService; + this.globalEventHandlerFactory = (restrictToSyncOnly) => { + return (eventName, event) => { + if (!this.isAlive()) { + return; + } + const alwaysSync = ALWAYS_SYNC_GLOBAL_EVENTS.has(eventName); + if (alwaysSync && !restrictToSyncOnly || !alwaysSync && restrictToSyncOnly) { + return; + } + if (!isPublicEventHandler(eventName)) { + return; + } + const fireEvent = (name, e) => { + const eventHandlerName = _PUBLIC_EVENT_HANDLERS_MAP[name]; + const eventHandler = this.gridOptions[eventHandlerName]; + if (typeof eventHandler === "function") { + this.beans.frameworkOverrides.wrapOutgoing(() => eventHandler(e)); + } + }; + if (this.gridReadyFired) { + fireEvent(eventName, event); + } else if (eventName === "gridReady") { + fireEvent(eventName, event); + this.gridReadyFired = true; + for (const q of this.queueEvents) { + fireEvent(q.eventName, q.event); + } + this.queueEvents = []; + } else { + this.queueEvents.push({ eventName, event }); + } + }; + }; + } + wireBeans(beans) { + this.gridOptions = beans.gridOptions; + this.validation = beans.validation; + this.api = beans.gridApi; + this.gridId = beans.context.getId(); + } + get gridOptionsContext() { + return this.gridOptions["context"]; + } + postConstruct() { + this.validateGridOptions(this.gridOptions); + this.eventSvc.addGlobalListener(this.globalEventHandlerFactory().bind(this), true); + this.eventSvc.addGlobalListener(this.globalEventHandlerFactory(true).bind(this), false); + this.propEventSvc.setFrameworkOverrides(this.beans.frameworkOverrides); + this.addManagedEventListeners({ + gridOptionsChanged: ({ options }) => { + this.updateGridOptions({ options, force: true, source: "optionsUpdated" }); + } + }); + } + destroy() { + super.destroy(); + this.queueEvents = []; + } + get(property) { + return this.gridOptions[property] ?? GRID_OPTION_DEFAULTS[property]; + } + getCallback(property) { + return this.mergeGridCommonParams(this.gridOptions[property]); + } + exists(property) { + return _exists(this.gridOptions[property]); + } + mergeGridCommonParams(callback) { + if (callback) { + const wrapped = (callbackParams) => { + return callback(this.addCommon(callbackParams)); + }; + return wrapped; + } + return callback; + } + updateGridOptions({ + options, + force, + source = "api" + }) { + const changeSet = { id: changeSetId++, properties: [] }; + const events = []; + const { gridOptions, validation } = this; + for (const key of Object.keys(options)) { + const value = GlobalGridOptions.applyGlobalGridOption(key, options[key]); + validation?.warnOnInitialPropertyUpdate(source, key); + const shouldForce = force || typeof value === "object" && source === "api"; + const previousValue = gridOptions[key]; + if (shouldForce || previousValue !== value) { + gridOptions[key] = value; + const event = { + type: key, + currentValue: value, + previousValue, + changeSet, + source + }; + events.push(event); + } + } + this.validateGridOptions(this.gridOptions); + changeSet.properties = events.map((event) => event.type); + for (const event of events) { + _logIfDebug(this, `Updated property ${event.type} from`, event.previousValue, ` to `, event.currentValue); + this.propEventSvc.dispatchEvent(event); + } + } + addPropertyEventListener(key, listener) { + this.propEventSvc.addEventListener(key, listener); + } + removePropertyEventListener(key, listener) { + this.propEventSvc.removeEventListener(key, listener); + } + getDomDataKey() { + return this.domDataKey; + } + addCommon(params) { + params.api = this.api; + params.context = this.gridOptionsContext; + return params; + } + validateOptions(options, modValidations) { + for (const key of Object.keys(options)) { + const value = options[key]; + if (value == null || value === false) { + continue; + } + let moduleToCheck = modValidations[key]; + if (typeof moduleToCheck === "function") { + moduleToCheck = moduleToCheck(options, this.gridOptions, this.beans); + } + if (moduleToCheck) { + this.assertModuleRegistered(moduleToCheck, key); + } + } + } + validateGridOptions(gridOptions) { + this.validateOptions(gridOptions, GRID_OPTIONS_MODULES); + this.validation?.processGridOptions(gridOptions); + } + validateColDef(colDef, colId, skipInferenceCheck) { + if (skipInferenceCheck || !this.beans.dataTypeSvc?.isColPendingInference(colId)) { + this.validateOptions(colDef, COLUMN_DEFINITION_MOD_VALIDATIONS); + this.validation?.validateColDef(colDef); + } + } + assertModuleRegistered(moduleName, reasonOrId) { + const registered = Array.isArray(moduleName) ? moduleName.some((modName) => this.isModuleRegistered(modName)) : this.isModuleRegistered(moduleName); + if (!registered) { + _error(200, { + ...this.getModuleErrorParams(), + moduleName, + reasonOrId + }); + } + return registered; + } + getModuleErrorParams() { + return { + gridId: this.gridId, + gridScoped: _areModulesGridScoped(), + rowModelType: this.get("rowModelType"), + isUmd: _isUmd() + }; + } + isModuleRegistered(moduleName) { + return _isModuleRegistered(moduleName, this.gridId, this.get("rowModelType")); + } + setInstanceDomData(element) { + element[GRID_DOM_KEY] = this.instanceId; + } + isElementInThisInstance(element) { + let pointer = element; + while (pointer) { + const instanceId = pointer[GRID_DOM_KEY]; + if (_exists(instanceId)) { + const eventFromThisGrid = instanceId === this.instanceId; + return eventFromThisGrid; + } + pointer = pointer.parentElement; + } + return false; + } +}; +function isPublicEventHandler(eventName) { + return !!_PUBLIC_EVENT_HANDLERS_MAP[eventName]; +} +var HeaderCellMouseListenerFeature = class extends BeanStub { + constructor(column, eGui) { + super(); + this.column = column; + this.eGui = eGui; + this.lastMovingChanged = 0; + } + postConstruct() { + this.addManagedElementListeners(this.eGui, { + click: (e) => e && this.onClick(e) + }); + this.addManagedListeners(this.column, { + movingChanged: () => { + this.lastMovingChanged = Date.now(); + } + }); + } + onClick(event) { + const { sortSvc, rangeSvc, gos } = this.beans; + const sortFromClick = _getEnableColumnSelection(gos) ? event.altKey : true; + if (!sortFromClick) { + rangeSvc?.handleColumnSelection(this.column, event); + } else if (this.column.isSortable()) { + const moving = this.column.isMoving(); + const nowTime = Date.now(); + const movedRecently = nowTime - this.lastMovingChanged < 50; + const columnMoving = moving || movedRecently; + if (!columnMoving) { + sortSvc?.progressSortFromEvent(this.column, event); + } + } + } +}; +function getHeaderCompElementParams(includeColumnRefIndicator, includeSortIndicator) { + const hiddenAttrs = { "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: hiddenAttrs + }, + { + tag: "span", + ref: "eFilterButton", + cls: "ag-header-icon ag-header-cell-filter-button", + attrs: hiddenAttrs + }, + { + tag: "div", + ref: "eLabel", + cls: "ag-header-cell-label", + role: "presentation", + children: [ + includeColumnRefIndicator ? { 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: hiddenAttrs + }, + includeSortIndicator ? { tag: "ag-sort-indicator", ref: "eSortIndicator" } : null + ] + } + ] + }; +} +var HeaderComp = class extends Component { + constructor() { + super(...arguments); + this.eFilter = RefPlaceholder; + this.eFilterButton = RefPlaceholder; + this.eSortIndicator = RefPlaceholder; + this.eMenu = RefPlaceholder; + this.eLabel = RefPlaceholder; + this.eText = RefPlaceholder; + this.eColRef = RefPlaceholder; + this.eSortOrder = RefPlaceholder; + this.eSortAsc = RefPlaceholder; + this.eSortDesc = RefPlaceholder; + this.eSortMixed = RefPlaceholder; + this.eSortNone = RefPlaceholder; + this.eSortAbsoluteAsc = RefPlaceholder; + this.eSortAbsoluteDesc = RefPlaceholder; + this.isLoadingInnerComponent = false; + } + refresh(params) { + const oldParams = this.params; + this.params = params; + if (this.workOutTemplate(params, !!this.beans?.sortSvc) != this.currentTemplate || this.workOutShowMenu() != this.currentShowMenu || params.enableSorting != this.currentSort || params.column.formulaRef != this.currentRef || this.currentSuppressMenuHide != null && this.shouldSuppressMenuHide() != this.currentSuppressMenuHide || oldParams.enableFilterButton != params.enableFilterButton || oldParams.enableFilterIcon != params.enableFilterIcon) { + return false; + } + if (this.innerHeaderComponent) { + const mergedParams = { ...params }; + _mergeDeep(mergedParams, params.innerHeaderComponentParams); + this.innerHeaderComponent.refresh?.(mergedParams); + } else { + this.setDisplayName(params); + } + return true; + } + workOutTemplate(params, isSorting) { + const { formula } = this.beans; + const paramsTemplate = params.template; + if (paramsTemplate) { + return paramsTemplate?.trim ? paramsTemplate.trim() : paramsTemplate; + } + return getHeaderCompElementParams(!!formula?.active, isSorting); + } + init(params) { + this.params = params; + const { sortSvc, touchSvc, rowNumbersSvc, userCompFactory } = this.beans; + const sortComp = sortSvc?.getSortIndicatorSelector(); + this.currentTemplate = this.workOutTemplate(params, !!sortComp); + this.setTemplate(this.currentTemplate, sortComp ? [sortComp] : undefined); + if (this.eLabel) { + this.mouseListener ?? (this.mouseListener = this.createManagedBean(new HeaderCellMouseListenerFeature(params.column, this.eLabel))); + } + touchSvc?.setupForHeader(this); + this.setMenu(); + this.setupSort(); + this.setupColumnRefIndicator(); + rowNumbersSvc?.setupForHeader(this); + this.setupFilterIcon(); + this.setupFilterButton(); + this.workOutInnerHeaderComponent(userCompFactory, params); + this.setDisplayName(params); + } + workOutInnerHeaderComponent(userCompFactory, params) { + const userCompDetails = _getInnerHeaderCompDetails(userCompFactory, params, params); + if (!userCompDetails) { + return; + } + this.isLoadingInnerComponent = true; + userCompDetails.newAgStackInstance().then((comp) => { + this.isLoadingInnerComponent = false; + if (!comp) { + return; + } + if (this.isAlive()) { + this.innerHeaderComponent = comp; + if (this.eText) { + this.eText.appendChild(comp.getGui()); + } + } else { + this.destroyBean(comp); + } + }); + } + setDisplayName(params) { + const { displayName } = params; + const oldDisplayName = this.currentDisplayName; + this.currentDisplayName = displayName; + if (!this.eText || oldDisplayName === displayName || this.innerHeaderComponent || this.isLoadingInnerComponent) { + return; + } + this.eText.textContent = _toString(displayName); + } + addInIcon(iconName, eParent, column) { + const eIcon = _createIconNoSpan(iconName, this.beans, column); + if (eIcon) { + eParent.appendChild(eIcon); + } + } + workOutShowMenu() { + return this.params.enableMenu && !!this.beans.menuSvc?.isHeaderMenuButtonEnabled(); + } + shouldSuppressMenuHide() { + return !!this.beans.menuSvc?.isHeaderMenuButtonAlwaysShowEnabled(); + } + setMenu() { + if (!this.eMenu) { + return; + } + this.currentShowMenu = this.workOutShowMenu(); + if (!this.currentShowMenu) { + _removeFromParent(this.eMenu); + this.eMenu = undefined; + return; + } + const { gos, eMenu, params } = this; + const isLegacyMenu = _isLegacyMenuEnabled(gos); + this.addInIcon(isLegacyMenu ? "menu" : "menuAlt", eMenu, params.column); + eMenu.classList.toggle("ag-header-menu-icon", !isLegacyMenu); + const currentSuppressMenuHide = this.shouldSuppressMenuHide(); + this.currentSuppressMenuHide = currentSuppressMenuHide; + this.addManagedElementListeners(eMenu, { click: () => this.showColumnMenu(this.eMenu) }); + this.toggleMenuAlwaysShow(currentSuppressMenuHide); + } + toggleMenuAlwaysShow(alwaysShow) { + this.eMenu?.classList.toggle("ag-header-menu-always-show", alwaysShow); + } + showColumnMenu(element) { + const { currentSuppressMenuHide, params } = this; + if (!currentSuppressMenuHide) { + this.toggleMenuAlwaysShow(true); + } + params.showColumnMenu(element, () => { + if (!currentSuppressMenuHide) { + this.toggleMenuAlwaysShow(false); + } + }); + } + onMenuKeyboardShortcut(isFilterShortcut) { + const { params, gos, beans, eMenu, eFilterButton } = this; + const column = params.column; + const isLegacyMenuEnabled = _isLegacyMenuEnabled(gos); + if (isFilterShortcut && !isLegacyMenuEnabled) { + if (beans.menuSvc?.isFilterMenuInHeaderEnabled(column)) { + params.showFilter(eFilterButton ?? eMenu ?? this.getGui()); + return true; + } + } else if (params.enableMenu) { + this.showColumnMenu(eMenu ?? eFilterButton ?? this.getGui()); + return true; + } + return false; + } + setupSort() { + const { sortSvc } = this.beans; + if (!sortSvc) { + return; + } + const { enableSorting, column } = this.params; + this.currentSort = enableSorting; + if (!this.eSortIndicator) { + this.eSortIndicator = this.createBean(sortSvc.createSortIndicator(true)); + const { + eSortIndicator, + eSortOrder, + eSortAsc, + eSortDesc, + eSortMixed, + eSortNone, + eSortAbsoluteAsc, + eSortAbsoluteDesc + } = this; + eSortIndicator.attachCustomElements(eSortOrder, eSortAsc, eSortDesc, eSortMixed, eSortNone, eSortAbsoluteAsc, eSortAbsoluteDesc); + } + this.eSortIndicator.setupSort(column); + if (!this.currentSort) { + return; + } + sortSvc.setupHeader(this, column); + } + setupColumnRefIndicator() { + const { + eColRef, + beans: { editModelSvc }, + params + } = this; + if (!eColRef) { + return; + } + this.currentRef = params.column.formulaRef; + eColRef.textContent = this.currentRef; + _setDisplayed(eColRef, false); + this.addManagedEventListeners({ + cellEditingStarted: () => { + const editPositions = editModelSvc?.getEditPositions(); + const shouldDisplay = !!this.currentRef && !!editPositions?.some((position) => position.column.isAllowFormula()); + _setDisplayed(eColRef, shouldDisplay); + }, + cellEditingStopped: () => { + _setDisplayed(eColRef, false); + } + }); + } + setupFilterIcon() { + const { eFilter, params } = this; + if (!eFilter) { + return; + } + const onFilterChangedIcon = () => { + const filterPresent = params.column.isFilterActive(); + _setDisplayed(eFilter, filterPresent, { skipAriaHidden: true }); + }; + this.configureFilter(params.enableFilterIcon, eFilter, onFilterChangedIcon, "filterActive"); + } + setupFilterButton() { + const { eFilterButton, params } = this; + if (!eFilterButton) { + return; + } + const configured = this.configureFilter(params.enableFilterButton, eFilterButton, this.onFilterChangedButton.bind(this), "filter"); + if (configured) { + this.addManagedElementListeners(eFilterButton, { + click: () => params.showFilter(eFilterButton) + }); + } else { + this.eFilterButton = undefined; + } + } + configureFilter(enabled, element, filterChangedCallback, icon) { + if (!enabled) { + _removeFromParent(element); + return false; + } + const column = this.params.column; + this.addInIcon(icon, element, column); + this.addManagedListeners(column, { filterChanged: filterChangedCallback }); + filterChangedCallback(); + return true; + } + onFilterChangedButton() { + const filterPresent = this.params.column.isFilterActive(); + this.eFilterButton.classList.toggle("ag-filter-active", filterPresent); + } + getAnchorElementForMenu(isFilter) { + const { eFilterButton, eMenu } = this; + if (isFilter) { + return eFilterButton ?? eMenu ?? this.getGui(); + } + return eMenu ?? eFilterButton ?? this.getGui(); + } + destroy() { + super.destroy(); + this.innerHeaderComponent = this.destroyBean(this.innerHeaderComponent); + this.mouseListener = this.destroyBean(this.mouseListener); + } +}; +var GroupStickyLabelFeature = class extends BeanStub { + constructor(eLabel, columnGroup) { + super(); + this.eLabel = eLabel; + this.columnGroup = columnGroup; + this.isSticky = false; + this.left = null; + this.right = null; + } + postConstruct() { + const { columnGroup, beans } = this; + const { ctrlsSvc } = beans; + ctrlsSvc.whenReady(this, () => { + const refreshPosition = this.refreshPosition.bind(this); + if (columnGroup.getPinned() == null) { + this.addManagedEventListeners({ + bodyScroll: (event) => { + if (event.direction === "horizontal") { + this.updateSticky(event.left); + } + } + }); + } + this.addManagedListeners(columnGroup, { + leftChanged: refreshPosition, + displayedChildrenChanged: refreshPosition + }); + this.addManagedEventListeners({ + columnResized: refreshPosition + }); + this.refreshPosition(); + }); + } + refreshPosition() { + const { columnGroup, beans } = this; + const left = columnGroup.getLeft(); + const width = columnGroup.getActualWidth(); + if (left == null || width === 0) { + this.left = null; + this.right = null; + this.setSticky(false); + return; + } + this.left = left; + this.right = left + width; + const scrollPosition = beans.colViewport.getScrollPosition(); + if (scrollPosition != null) { + this.updateSticky(scrollPosition); + } + } + updateSticky(scrollLeft) { + const { beans, left, right } = this; + if (left == null || right == null) { + this.setSticky(false); + return; + } + const { gos, visibleCols } = beans; + const isRtl = gos.get("enableRtl"); + const viewportEdge = isRtl ? visibleCols.bodyWidth - scrollLeft : scrollLeft; + this.setSticky(left < viewportEdge && right > viewportEdge); + } + setSticky(value) { + const { isSticky, eLabel } = this; + if (isSticky === value) { + return; + } + this.isSticky = value; + eLabel.classList.toggle("ag-sticky-label", value); + } +}; +var HeaderGroupCompElement = { + 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` } + ] +}; +var HeaderGroupComp = class extends Component { + constructor() { + super(HeaderGroupCompElement); + this.agOpened = RefPlaceholder; + this.agClosed = RefPlaceholder; + this.agLabel = RefPlaceholder; + this.isLoadingInnerComponent = false; + } + init(params) { + const { userCompFactory, touchSvc } = this.beans; + this.params = params; + this.checkWarnings(); + this.workOutInnerHeaderGroupComponent(userCompFactory, params); + this.setupLabel(params); + this.addGroupExpandIcon(params); + this.setupExpandIcons(); + touchSvc?.setupForHeaderGroup(this); + } + checkWarnings() { + const paramsAny = this.params; + if (paramsAny.template) { + _warn(89); + } + } + workOutInnerHeaderGroupComponent(userCompFactory, params) { + const userCompDetails = _getInnerHeaderGroupCompDetails(userCompFactory, params, params); + if (!userCompDetails) { + return; + } + this.isLoadingInnerComponent = true; + userCompDetails.newAgStackInstance().then((comp) => { + this.isLoadingInnerComponent = false; + if (!comp) { + return; + } + if (this.isAlive()) { + this.innerHeaderGroupComponent = comp; + this.agLabel.appendChild(comp.getGui()); + } else { + this.destroyBean(comp); + } + }); + } + setupExpandIcons() { + const { + agOpened, + agClosed, + params: { columnGroup }, + beans: { colGroupSvc } + } = this; + this.addInIcon("columnGroupOpened", agOpened); + this.addInIcon("columnGroupClosed", agClosed); + const expandAction = (event) => { + if (_isStopPropagationForAgGrid(event)) { + return; + } + const newExpandedValue = !columnGroup.isExpanded(); + colGroupSvc.setColumnGroupOpened(columnGroup.getProvidedColumnGroup(), newExpandedValue, "uiColumnExpanded"); + }; + this.addTouchAndClickListeners(agClosed, expandAction); + this.addTouchAndClickListeners(agOpened, expandAction); + const stopPropagationAction = (event) => { + _stopPropagationForAgGrid(event); + }; + this.addManagedElementListeners(agClosed, { dblclick: stopPropagationAction }); + this.addManagedElementListeners(agOpened, { dblclick: stopPropagationAction }); + this.addManagedElementListeners(this.getGui(), { dblclick: expandAction }); + this.updateIconVisibility(); + const providedColumnGroup = columnGroup.getProvidedColumnGroup(); + const updateIcon = this.updateIconVisibility.bind(this); + this.addManagedListeners(providedColumnGroup, { + expandedChanged: updateIcon, + expandableChanged: updateIcon + }); + } + addTouchAndClickListeners(eElement, action) { + this.beans.touchSvc?.setupForHeaderGroupElement(this, eElement, action); + this.addManagedElementListeners(eElement, { click: action }); + } + updateIconVisibility() { + const { + agOpened, + agClosed, + params: { columnGroup } + } = this; + if (columnGroup.isExpandable()) { + const expanded = columnGroup.isExpanded(); + _setDisplayed(agOpened, expanded); + _setDisplayed(agClosed, !expanded); + } else { + _setDisplayed(agOpened, false); + _setDisplayed(agClosed, false); + } + } + addInIcon(iconName, element) { + const eIcon = _createIconNoSpan(iconName, this.beans, null); + if (eIcon) { + element.appendChild(eIcon); + } + } + addGroupExpandIcon(params) { + if (!params.columnGroup.isExpandable()) { + const { agOpened, agClosed } = this; + _setDisplayed(agOpened, false); + _setDisplayed(agClosed, false); + } + } + setupLabel(params) { + const { displayName, columnGroup } = params; + const { innerHeaderGroupComponent, isLoadingInnerComponent } = this; + const hasInnerComponent = innerHeaderGroupComponent || isLoadingInnerComponent; + if (_exists(displayName) && !hasInnerComponent) { + this.agLabel.textContent = _toString(displayName); + } + if (!columnGroup.getColGroupDef()?.suppressStickyLabel) { + this.createManagedBean(new GroupStickyLabelFeature(this.getGui(), columnGroup)); + } + } + destroy() { + super.destroy(); + if (this.innerHeaderGroupComponent) { + this.destroyBean(this.innerHeaderGroupComponent); + this.innerHeaderGroupComponent = undefined; + } + } +}; +var ColumnHeaderCompModule = { + moduleName: "ColumnHeaderComp", + version: VERSION, + userComponents: { + agColumnHeader: HeaderComp + }, + icons: { + menu: "menu", + menuAlt: "menu-alt" + } +}; +var ColumnGroupHeaderCompModule = { + moduleName: "ColumnGroupHeaderComp", + version: VERSION, + userComponents: { + agColumnGroupHeader: HeaderGroupComp + }, + icons: { + columnGroupOpened: "expanded", + columnGroupClosed: "contracted" + } +}; +var AnimationFrameService = class extends BeanStub { + constructor() { + super(...arguments); + this.beanName = "animationFrameSvc"; + this.p1 = { list: [], sorted: false }; + this.p2 = { list: [], sorted: false }; + this.f1 = { list: [], sorted: false }; + this.destroyTasks = []; + this.ticking = false; + this.scrollGoingDown = true; + this.lastScrollTop = 0; + this.taskCount = 0; + } + setScrollTop(scrollTop) { + this.scrollGoingDown = scrollTop >= this.lastScrollTop; + if (scrollTop === 0) { + this.scrollGoingDown = true; + } + this.lastScrollTop = scrollTop; + } + postConstruct() { + this.active = !this.gos.get("suppressAnimationFrame"); + this.batchFrameworkComps = this.beans.frameworkOverrides.batchFrameworkComps; + } + verify() { + if (this.active === false) { + _warn(92); + } + } + createTask(task, index, list, isFramework, isDeferred = false) { + this.verify(); + let taskList = list; + if (isFramework && this.batchFrameworkComps) { + taskList = "f1"; + } + const taskItem = { task, index, createOrder: ++this.taskCount, deferred: isDeferred }; + this.addTaskToList(this[taskList], taskItem); + this.schedule(); + } + addTaskToList(taskList, task) { + taskList.list.push(task); + taskList.sorted = false; + } + sortTaskList(taskList) { + if (taskList.sorted) { + return; + } + const sortDirection = this.scrollGoingDown ? 1 : -1; + taskList.list.sort((a, b) => { + if (a.deferred !== b.deferred) { + return a.deferred ? -1 : 1; + } + if (a.index !== b.index) { + return sortDirection * (b.index - a.index); + } + return b.createOrder - a.createOrder; + }); + taskList.sorted = true; + } + addDestroyTask(task) { + this.verify(); + this.destroyTasks.push(task); + this.schedule(); + } + executeFrame(millis) { + const { p1, p2, f1, destroyTasks, beans } = this; + const { ctrlsSvc, frameworkOverrides } = beans; + const p1Tasks = p1.list; + const p2Tasks = p2.list; + const f1Tasks = f1.list; + const frameStart = Date.now(); + let duration = 0; + const noMaxMillis = millis <= 0; + const scrollFeature = ctrlsSvc.getScrollFeature(); + while (noMaxMillis || duration < millis) { + const gridBodyDidSomething = scrollFeature.scrollGridIfNeeded(); + if (!gridBodyDidSomething) { + let task; + if (p1Tasks.length) { + this.sortTaskList(p1); + task = p1Tasks.pop().task; + } else if (p2Tasks.length) { + this.sortTaskList(p2); + task = p2Tasks.pop().task; + } else if (f1Tasks.length) { + frameworkOverrides.wrapOutgoing(() => { + while (noMaxMillis || duration < millis) { + const gridBodyDidSomething2 = scrollFeature.scrollGridIfNeeded(); + if (!gridBodyDidSomething2) { + if (f1Tasks.length) { + this.sortTaskList(f1); + task = f1Tasks.pop().task; + task(); + } else { + break; + } + } else { + break; + } + duration = Date.now() - frameStart; + } + }); + task = () => {}; + } else if (destroyTasks.length) { + task = destroyTasks.pop(); + } else { + break; + } + task(); + } + duration = Date.now() - frameStart; + } + if (p1Tasks.length || p2Tasks.length || f1Tasks.length || destroyTasks.length) { + this.requestFrame(); + } else { + this.ticking = false; + } + } + flushAllFrames() { + if (!this.active) { + return; + } + this.executeFrame(-1); + } + schedule() { + if (!this.active) { + return; + } + if (!this.ticking) { + this.ticking = true; + this.requestFrame(); + } + } + requestFrame() { + const callback = this.executeFrame.bind(this, 60); + _requestAnimationFrame(this.beans, callback); + } + isQueueEmpty() { + return !this.ticking; + } +}; +var AnimationFrameModule = { + moduleName: "AnimationFrame", + version: VERSION, + beans: [AnimationFrameService] +}; +var IconService = class extends BeanStub { + constructor() { + super(...arguments); + this.beanName = "iconSvc"; + } + createIconNoSpan(iconName, params) { + return _createIconNoSpan(iconName, this.beans, params?.column); + } +}; +var _shouldOpenHeaderMenuOnLongTap = (enableMenu, isHeaderContextMenuEnabled, isLegacyMenuEnabled) => isHeaderContextMenuEnabled || enableMenu && isLegacyMenuEnabled; +var TouchService = class extends BeanStub { + constructor() { + super(...arguments); + this.beanName = "touchSvc"; + } + mockBodyContextMenu(ctrl, listener) { + this.mockContextMenu(ctrl, ctrl.eBodyViewport, listener); + } + mockHeaderContextMenu(ctrl, listener) { + this.mockContextMenu(ctrl, ctrl.eGui, listener); + } + mockRowContextMenu(ctrl) { + if (!_isIOSUserAgent()) { + return; + } + const listener = (mouseListener, touch, touchEvent) => { + const { rowCtrl, cellCtrl } = ctrl.getControlsForEventTarget(touchEvent?.target ?? null); + if (cellCtrl?.column) { + cellCtrl.dispatchCellContextMenuEvent(touchEvent ?? null); + } + this.beans.contextMenuSvc?.handleContextMenuMouseEvent(undefined, touchEvent, rowCtrl, cellCtrl); + }; + this.mockContextMenu(ctrl, ctrl.element, listener); + } + handleCellDoubleClick(ctrl, mouseEvent) { + const isDoubleClickOnIPad = () => { + if (!_isIOSUserAgent() || _isEventSupported("dblclick")) { + return false; + } + const nowMillis = Date.now(); + const res = nowMillis - ctrl.lastIPadMouseClickEvent < 200; + ctrl.lastIPadMouseClickEvent = nowMillis; + return res; + }; + if (isDoubleClickOnIPad()) { + ctrl.onCellDoubleClicked(mouseEvent); + mouseEvent.preventDefault(); + return true; + } + return false; + } + setupForHeader(comp) { + const { gos, sortSvc, menuSvc } = this.beans; + if (gos.get("suppressTouch")) { + return; + } + const { params, eMenu, eFilterButton } = comp; + const touchListener = new TouchListener(comp.getGui(), true); + comp.addDestroyFunc(() => touchListener.destroy()); + const suppressMenuHide = comp.shouldSuppressMenuHide(); + const tapMenuButton = suppressMenuHide && _exists(eMenu) && params.enableMenu; + const isHeaderContextMenuEnabled = !!menuSvc?.isHeaderContextMenuEnabled(params.column); + const shouldOpenMenuOnLongTap = _shouldOpenHeaderMenuOnLongTap(params.enableMenu, isHeaderContextMenuEnabled, _isLegacyMenuEnabled(gos)); + let menuTouchListener = touchListener; + if (tapMenuButton) { + menuTouchListener = new TouchListener(eMenu, true); + comp.addDestroyFunc(() => menuTouchListener.destroy()); + } + const showMenuFn = (event) => params.showColumnMenuAfterMouseClick(event.touchStart); + if (tapMenuButton && params.enableMenu) { + comp.addManagedListeners(menuTouchListener, { tap: showMenuFn }); + } + if (shouldOpenMenuOnLongTap) { + comp.addManagedListeners(touchListener, { longTap: showMenuFn }); + } + if (params.enableSorting) { + const tapListener = (event) => { + const target = event.touchStart.target; + if (suppressMenuHide && (eMenu?.contains(target) || eFilterButton?.contains(target))) { + return; + } + sortSvc?.progressSort(params.column, false, "uiColumnSorted"); + }; + comp.addManagedListeners(touchListener, { tap: tapListener }); + } + if (params.enableFilterButton && eFilterButton) { + const filterButtonTouchListener = new TouchListener(eFilterButton, true); + comp.addManagedListeners(filterButtonTouchListener, { + tap: () => params.showFilter(eFilterButton) + }); + comp.addDestroyFunc(() => filterButtonTouchListener.destroy()); + } + } + setupForHeaderGroup(comp) { + const params = comp.params; + if (this.beans.menuSvc?.isHeaderContextMenuEnabled(params.columnGroup.getProvidedColumnGroup())) { + const touchListener = new TouchListener(params.eGridHeader, true); + const showMenuFn = (event) => params.showColumnMenuAfterMouseClick(event.touchStart); + comp.addManagedListeners(touchListener, { longTap: showMenuFn }); + comp.addDestroyFunc(() => touchListener.destroy()); + } + } + setupForHeaderGroupElement(comp, eElement, action) { + const touchListener = new TouchListener(eElement, true); + comp.addManagedListeners(touchListener, { tap: action }); + comp.addDestroyFunc(() => touchListener.destroy()); + } + mockContextMenu(ctrl, element, listener) { + if (!_isIOSUserAgent()) { + return; + } + const touchListener = new TouchListener(element); + const longTapListener = (event) => { + if (!_isEventFromThisInstance(this.beans, event.touchEvent)) { + return; + } + listener(undefined, event.touchStart, event.touchEvent); + }; + ctrl.addManagedListeners(touchListener, { longTap: longTapListener }); + ctrl.addDestroyFunc(() => touchListener.destroy()); + } +}; +var TouchModule = { + moduleName: "Touch", + version: VERSION, + beans: [TouchService] +}; +var CellNavigationService = class extends BeanStub { + constructor() { + super(...arguments); + this.beanName = "cellNavigation"; + } + wireBeans(beans) { + this.rowSpanSvc = beans.rowSpanSvc; + } + getNextCellToFocus(key, focusedCell, ctrlPressed = false) { + if (ctrlPressed) { + return this.getNextCellToFocusWithCtrlPressed(key, focusedCell); + } + return this.getNextCellToFocusWithoutCtrlPressed(key, focusedCell); + } + getNextCellToFocusWithCtrlPressed(key, focusedCell) { + const upKey = key === KeyCode.UP; + const downKey = key === KeyCode.DOWN; + const leftKey = key === KeyCode.LEFT; + let column; + let rowIndex; + const { pageBounds, gos, visibleCols, pinnedRowModel } = this.beans; + const { rowPinned } = focusedCell; + if (upKey || downKey) { + if (rowPinned && pinnedRowModel) { + if (upKey) { + rowIndex = 0; + } else { + rowIndex = rowPinned === "top" ? pinnedRowModel.getPinnedTopRowCount() - 1 : pinnedRowModel.getPinnedBottomRowCount() - 1; + } + } else { + rowIndex = upKey ? pageBounds.getFirstRow() : pageBounds.getLastRow(); + } + column = focusedCell.column; + } else { + const isRtl = gos.get("enableRtl"); + rowIndex = focusedCell.rowIndex; + const allColumns = leftKey !== isRtl ? visibleCols.allCols : [...visibleCols.allCols].reverse(); + column = allColumns.find((col) => !isRowNumberCol(col) && this.isCellGoodToFocusOn({ + rowIndex, + rowPinned: null, + column: col + })); + } + return column ? { + rowIndex, + rowPinned, + column + } : null; + } + getNextCellToFocusWithoutCtrlPressed(key, focusedCell) { + let pointer = focusedCell; + let finished = false; + while (!finished) { + switch (key) { + case KeyCode.UP: + pointer = this.getCellAbove(pointer); + break; + case KeyCode.DOWN: + pointer = this.getCellBelow(pointer); + break; + case KeyCode.RIGHT: + pointer = this.gos.get("enableRtl") ? this.getCellToLeft(pointer) : this.getCellToRight(pointer); + break; + case KeyCode.LEFT: + pointer = this.gos.get("enableRtl") ? this.getCellToRight(pointer) : this.getCellToLeft(pointer); + break; + default: + pointer = null; + _warn(8, { key }); + break; + } + if (pointer) { + finished = this.isCellGoodToFocusOn(pointer); + } else { + finished = true; + } + } + return pointer; + } + isCellGoodToFocusOn(gridCell) { + const column = gridCell.column; + let rowNode; + const { pinnedRowModel, rowModel } = this.beans; + switch (gridCell.rowPinned) { + case "top": + rowNode = pinnedRowModel?.getPinnedTopRow(gridCell.rowIndex); + break; + case "bottom": + rowNode = pinnedRowModel?.getPinnedBottomRow(gridCell.rowIndex); + break; + default: + rowNode = rowModel.getRow(gridCell.rowIndex); + break; + } + if (!rowNode) { + return false; + } + const suppressNavigable = this.isSuppressNavigable(column, rowNode); + return !suppressNavigable; + } + getCellToLeft(lastCell) { + if (!lastCell) { + return null; + } + const colToLeft = this.beans.visibleCols.getColBefore(lastCell.column); + if (!colToLeft) { + return null; + } + return { + rowIndex: lastCell.rowIndex, + column: colToLeft, + rowPinned: lastCell.rowPinned + }; + } + getCellToRight(lastCell) { + if (!lastCell) { + return null; + } + const colToRight = this.beans.visibleCols.getColAfter(lastCell.column); + if (!colToRight) { + return null; + } + return { + rowIndex: lastCell.rowIndex, + column: colToRight, + rowPinned: lastCell.rowPinned + }; + } + getCellBelow(lastCell) { + if (!lastCell) { + return null; + } + const adjustedLastCell = this.rowSpanSvc?.getCellEnd(lastCell) ?? lastCell; + const rowBelow = _getRowBelow(this.beans, adjustedLastCell, true); + if (rowBelow) { + return { + rowIndex: rowBelow.rowIndex, + column: lastCell.column, + rowPinned: rowBelow.rowPinned + }; + } + return null; + } + getCellAbove(lastCell) { + if (!lastCell) { + return null; + } + const adjustedLastCell = this.rowSpanSvc?.getCellStart(lastCell) ?? lastCell; + const rowAbove = _getRowAbove(this.beans, { + rowIndex: adjustedLastCell.rowIndex, + rowPinned: adjustedLastCell.rowPinned + }, true); + if (rowAbove) { + return { + rowIndex: rowAbove.rowIndex, + column: lastCell.column, + rowPinned: rowAbove.rowPinned + }; + } + return null; + } + getNextTabbedCell(gridCell, backwards) { + if (backwards) { + return this.getNextTabbedCellBackwards(gridCell); + } + return this.getNextTabbedCellForwards(gridCell); + } + getNextTabbedCellForwards(gridCell) { + const { visibleCols, pagination } = this.beans; + const displayedColumns = visibleCols.allCols; + let newRowIndex = gridCell.rowIndex; + let newFloating = gridCell.rowPinned; + let newColumn = visibleCols.getColAfter(gridCell.column); + if (!newColumn) { + newColumn = displayedColumns[0]; + const rowBelow = _getRowBelow(this.beans, gridCell, true); + if (_missing(rowBelow)) { + return null; + } + if (!rowBelow.rowPinned && !(pagination?.isRowInPage(rowBelow.rowIndex) ?? true)) { + return null; + } + newRowIndex = rowBelow ? rowBelow.rowIndex : null; + newFloating = rowBelow ? rowBelow.rowPinned : null; + } + return { rowIndex: newRowIndex, column: newColumn, rowPinned: newFloating }; + } + getNextTabbedCellBackwards(gridCell) { + const { beans } = this; + const { visibleCols, pagination } = beans; + const displayedColumns = visibleCols.allCols; + let newRowIndex = gridCell.rowIndex; + let newFloating = gridCell.rowPinned; + let newColumn = visibleCols.getColBefore(gridCell.column); + if (!newColumn) { + newColumn = _last(displayedColumns); + const rowAbove = _getRowAbove(beans, { rowIndex: gridCell.rowIndex, rowPinned: gridCell.rowPinned }, true); + if (_missing(rowAbove)) { + return null; + } + if (!rowAbove.rowPinned && !(pagination?.isRowInPage(rowAbove.rowIndex) ?? true)) { + return null; + } + newRowIndex = rowAbove ? rowAbove.rowIndex : null; + newFloating = rowAbove ? rowAbove.rowPinned : null; + } + return { rowIndex: newRowIndex, column: newColumn, rowPinned: newFloating }; + } + isSuppressNavigable(column, rowNode) { + const { suppressNavigable } = column.colDef; + if (typeof suppressNavigable === "boolean") { + return suppressNavigable; + } + if (typeof suppressNavigable === "function") { + const params = column.createColumnFunctionCallbackParams(rowNode); + const userFunc = suppressNavigable; + return userFunc(params); + } + return false; + } +}; +function getFocusedCell(beans) { + return beans.focusSvc.getFocusedCell(); +} +function clearFocusedCell(beans) { + return beans.focusSvc.clearFocusedCell(); +} +function setFocusedCell(beans, rowIndex, colKey, rowPinned) { + beans.focusSvc.setFocusedCell({ rowIndex, column: colKey, rowPinned, forceBrowserFocus: true }); +} +function tabToNextCell(beans, event) { + return beans.navigation?.tabToNextCell(false, event) ?? false; +} +function tabToPreviousCell(beans, event) { + return beans.navigation?.tabToNextCell(true, event) ?? false; +} +function setFocusedHeader(beans, colKey, floatingFilter = false) { + const headerPosition = beans.headerNavigation?.getHeaderPositionForColumn(colKey, floatingFilter); + if (!headerPosition) { + return; + } + beans.focusSvc.focusHeaderPosition({ headerPosition }); +} +function _unwrapUserComp(comp) { + const compAsAny = comp; + const isProxy = compAsAny?.getFrameworkComponentInstance != null; + return isProxy ? compAsAny.getFrameworkComponentInstance() : comp; +} +var EditModelService = class extends BeanStub { + constructor() { + super(...arguments); + this.beanName = "editModelSvc"; + this.edits = /* @__PURE__ */ new Map; + this.cellValidations = new EditCellValidationModel; + this.rowValidations = new EditRowValidationModel; + this.suspendEdits = false; + } + suspend(suspend) { + this.suspendEdits = suspend; + } + removeEdits({ rowNode, column }) { + if (!this.hasEdits({ rowNode }) || !rowNode) { + return; + } + const editRow = this.getEditRow(rowNode); + if (column) { + editRow.delete(column); + } else { + editRow.clear(); + } + if (editRow.size === 0) { + this.edits.delete(rowNode); + } + } + getEditRow(rowNode, params = {}) { + if (this.suspendEdits) { + return; + } + if (this.edits.size === 0) { + return; + } + const edits = rowNode && this.edits.get(rowNode); + if (edits) { + return edits; + } + if (params.checkSiblings) { + const pinnedSibling = rowNode.pinnedSibling; + if (pinnedSibling) { + return this.getEditRow(pinnedSibling); + } + } + return; + } + getEditRowDataValue(rowNode, { checkSiblings } = {}) { + if (!rowNode || this.edits.size === 0) { + return; + } + const editRow = this.getEditRow(rowNode); + const pinnedSibling = rowNode.pinnedSibling; + const siblingRow = checkSiblings && pinnedSibling && this.getEditRow(pinnedSibling); + if (!editRow && !siblingRow) { + return; + } + const data = { ...rowNode.data }; + const applyEdits = (edits, data2) => edits.forEach(({ editorValue, pendingValue }, column) => { + const value = editorValue === undefined ? pendingValue : editorValue; + if (value !== UNEDITED) { + data2[column.getColId()] = value; + } + }); + if (editRow) { + applyEdits(editRow, data); + } + if (siblingRow) { + applyEdits(siblingRow, data); + } + return data; + } + getEdit(position = {}, params) { + const { rowNode, column } = position; + const edits = this.edits; + if (this.suspendEdits || edits.size === 0 || !rowNode || !column) { + return; + } + const edit = edits.get(rowNode)?.get(column); + if (edit) { + return edit; + } + if (params?.checkSiblings) { + const pinnedSibling = rowNode.pinnedSibling; + if (pinnedSibling) { + return edits.get(pinnedSibling)?.get(column); + } + } + return; + } + getEditMap(copy = true) { + if (this.suspendEdits || this.edits.size === 0) { + return /* @__PURE__ */ new Map; + } + if (!copy) { + return this.edits; + } + const map = /* @__PURE__ */ new Map; + this.edits.forEach((editRow, rowNode) => { + const newEditRow = /* @__PURE__ */ new Map; + editRow.forEach(({ editorState: _, ...cellData }, column) => newEditRow.set(column, { ...cellData })); + map.set(rowNode, newEditRow); + }); + return map; + } + setEditMap(newEdits) { + this.edits.clear(); + newEdits.forEach((editRow, rowNode) => { + const newRow = /* @__PURE__ */ new Map; + editRow.forEach((cellData, column) => newRow.set(column, { ...cellData })); + this.edits.set(rowNode, newRow); + }); + } + setEdit(position, edit) { + const edits = this.edits; + if (edits.size === 0 || !edits.has(position.rowNode)) { + edits.set(position.rowNode, /* @__PURE__ */ new Map); + } + const currentEdit = this.getEdit(position); + const updatedEdit = { + editorState: { + isCancelAfterEnd: undefined, + isCancelBeforeStart: undefined + }, + ...currentEdit, + ...edit + }; + this.getEditRow(position.rowNode).set(position.column, updatedEdit); + return updatedEdit; + } + clearEditValue(position) { + const { rowNode, column } = position; + if (!rowNode) { + return; + } + const update = (edit2) => { + edit2.editorValue = undefined; + edit2.pendingValue = edit2.sourceValue; + edit2.state = "changed"; + }; + if (!column) { + this.getEditRow(rowNode)?.forEach(update); + return; + } + const edit = this.getEdit(position); + if (edit) { + update(edit); + } + } + getState(position) { + if (this.suspendEdits) { + return; + } + return this.getEdit(position)?.state; + } + getEditPositions(editMap) { + if (this.suspendEdits || (editMap ?? this.edits).size === 0) { + return []; + } + const positions = []; + (editMap ?? this.edits).forEach((editRow, rowNode) => { + for (const column of editRow.keys()) { + const { editorState: _, ...rest } = editRow.get(column); + positions.push({ + rowNode, + column, + ...rest + }); + } + }); + return positions; + } + hasRowEdits(rowNode, params) { + if (this.suspendEdits) { + return false; + } + if (this.edits.size === 0) { + return false; + } + const rowEdits = this.getEditRow(rowNode, params); + return !!rowEdits; + } + hasEdits(position = {}, params = {}) { + if (this.suspendEdits) { + return false; + } + if (this.edits.size === 0) { + return false; + } + const { rowNode, column } = position; + const { withOpenEditor } = params; + if (rowNode) { + const rowEdits = this.getEditRow(rowNode, params); + if (!rowEdits) { + return false; + } + if (column) { + if (withOpenEditor) { + return this.getEdit(position)?.state === "editing"; + } + return rowEdits.has(column); + } + if (rowEdits.size !== 0) { + if (withOpenEditor) { + return Array.from(rowEdits.values()).some(({ state }) => state === "editing"); + } + return true; + } + return false; + } + if (withOpenEditor) { + return this.getEditPositions().some(({ state }) => state === "editing"); + } + return this.edits.size > 0; + } + start(position) { + const map = this.getEditRow(position.rowNode) ?? /* @__PURE__ */ new Map; + const { rowNode, column } = position; + if (column && !map.has(column)) { + map.set(column, { + editorValue: undefined, + pendingValue: UNEDITED, + sourceValue: this.beans.valueSvc.getValue(column, rowNode, "data"), + state: "editing", + editorState: { + isCancelAfterEnd: undefined, + isCancelBeforeStart: undefined + } + }); + } + this.edits.set(rowNode, map); + } + stop(position, preserveBatch, cancel) { + if (!this.hasEdits(position)) { + return; + } + if (preserveBatch) { + const edit = this.getEditRow(position.rowNode)?.get(position.column); + if (edit && (edit.pendingValue === UNEDITED || edit.pendingValue === edit.sourceValue)) { + this.removeEdits(position); + } else if (edit && cancel) { + edit.editorValue = undefined; + } + } else { + this.removeEdits(position); + } + } + clear() { + for (const pendingRowEdits of this.edits.values()) { + pendingRowEdits.clear(); + } + this.edits.clear(); + } + getCellValidationModel() { + return this.cellValidations; + } + getRowValidationModel() { + return this.rowValidations; + } + setCellValidationModel(model) { + this.cellValidations = model; + } + setRowValidationModel(model) { + this.rowValidations = model; + } + destroy() { + super.destroy(); + this.clear(); + } +}; +var EditCellValidationModel = class { + constructor() { + this.cellValidations = /* @__PURE__ */ new Map; + } + getCellValidation(position) { + const { rowNode, column } = position || {}; + return this.cellValidations?.get(rowNode)?.get(column); + } + hasCellValidation(position) { + if (!position?.rowNode || !position.column) { + return this.cellValidations.size > 0; + } + return !!this.getCellValidation(position); + } + setCellValidation(position, validation) { + const { rowNode, column } = position; + if (!this.cellValidations.has(rowNode)) { + this.cellValidations.set(rowNode, /* @__PURE__ */ new Map); + } + this.cellValidations.get(rowNode).set(column, validation); + } + clearCellValidation(position) { + const { rowNode, column } = position; + this.cellValidations.get(rowNode)?.delete(column); + } + setCellValidationMap(validationMap) { + this.cellValidations = validationMap; + } + getCellValidationMap() { + return this.cellValidations; + } + clearCellValidationMap() { + this.cellValidations.clear(); + } +}; +var EditRowValidationModel = class { + constructor() { + this.rowValidations = /* @__PURE__ */ new Map; + } + getRowValidation(position) { + const { rowNode } = position || {}; + return this.rowValidations.get(rowNode); + } + hasRowValidation(position) { + if (!position?.rowNode) { + return this.rowValidations.size > 0; + } + return !!this.getRowValidation(position); + } + setRowValidation({ rowNode }, rowValidation) { + this.rowValidations.set(rowNode, rowValidation); + } + clearRowValidation({ rowNode }) { + this.rowValidations.delete(rowNode); + } + setRowValidationMap(validationMap) { + this.rowValidations = validationMap; + } + getRowValidationMap() { + return this.rowValidations; + } + clearRowValidationMap() { + this.rowValidations.clear(); + } +}; +function _getRowCtrl(beans, inputs = {}) { + const { rowIndex, rowId, rowCtrl, rowPinned } = inputs; + if (rowCtrl) { + return rowCtrl; + } + const { rowModel, rowRenderer } = beans; + let { rowNode } = inputs; + if (!rowNode) { + if (rowId) { + rowNode = _getRowById(beans, rowId, rowPinned); + } else if (rowIndex != null) { + rowNode = rowModel.getRow(rowIndex); + } + } + return rowNode ? rowRenderer.getRowCtrlByNode(rowNode) : undefined; +} +function _getCellCtrl(beans, inputs = {}) { + const { cellCtrl, colId, columnId, column } = inputs; + if (cellCtrl) { + return cellCtrl; + } + const actualColumn = beans.colModel.getCol(colId ?? columnId ?? _getColId(column)); + const rowCtrl = inputs.rowCtrl ?? _getRowCtrl(beans, inputs); + const result = rowCtrl?.getCellCtrl(actualColumn) ?? undefined; + if (result) { + return result; + } + const rowNode = inputs.rowNode ?? rowCtrl?.rowNode; + if (rowNode) { + return beans.rowRenderer.getCellCtrls([rowNode], [actualColumn])?.[0]; + } + return; +} +function _stopEditing(beans) { + const { editSvc } = beans; + if (editSvc?.isBatchEditing()) { + _syncFromEditors(beans, { persist: true }); + _destroyEditors(beans); + } else { + editSvc?.stopEditing(undefined, { source: "api" }); + } +} +function _addStopEditingWhenGridLosesFocus(bean, beans, viewports) { + const { gos, popupSvc } = beans; + if (!gos.get("stopEditingWhenCellsLoseFocus")) { + return; + } + const focusOutListener = (event) => { + const elementWithFocus = event.relatedTarget; + if (_getTabIndex(elementWithFocus) === null) { + _stopEditing(beans); + return; + } + let clickInsideGrid = viewports.some((viewport) => viewport.contains(elementWithFocus)) && gos.isElementInThisInstance(elementWithFocus); + if (!clickInsideGrid) { + clickInsideGrid = !!popupSvc && (popupSvc.getActivePopups().some((popup) => popup.contains(elementWithFocus)) || popupSvc.isElementWithinCustomPopup(elementWithFocus)); + } + if (!clickInsideGrid) { + _stopEditing(beans); + } + }; + for (const viewport of viewports) { + bean.addManagedElementListeners(viewport, { focusout: focusOutListener }); + } +} +function _getColId(column) { + if (!column) { + return; + } + if (typeof column === "string") { + return column; + } + return column.getColId(); +} +var UNEDITED = Symbol("unedited"); +var getCellEditorInstances = (beans, params = {}) => { + const ctrls = beans.rowRenderer.getCellCtrls(params.rowNodes, params.columns); + const editors = new Array(ctrls.length); + let count = 0; + for (let i = 0, len = ctrls.length;i < len; ++i) { + const ctrl = ctrls[i]; + const cellEditor = ctrl.comp?.getCellEditor(); + if (cellEditor) { + editors[count++] = _unwrapUserComp(cellEditor); + } + } + editors.length = count; + return editors; +}; +function _setupEditors(beans, editingCells, position, key, event, cellStartedEdit) { + if (editingCells.length === 0 && position?.rowNode && position?.column) { + _setupEditor(beans, position, { key, event, cellStartedEdit }); + } + const { valueSvc, editSvc, editModelSvc } = beans; + const { rowNode, column } = position ?? {}; + for (const cellPosition of editingCells) { + const { rowNode: cellRowNode, column: cellColumn } = cellPosition; + const curCellCtrl = _getCellCtrl(beans, cellPosition); + if (!curCellCtrl) { + if (cellRowNode && cellColumn) { + const oldValue = valueSvc.getValue(cellColumn, cellRowNode, "data"); + const isNewValueCell = position?.rowNode === cellRowNode && position?.column === cellColumn; + const cellStartValue = isNewValueCell && key || undefined; + const newValue = cellStartValue ?? editSvc?.getCellDataValue(cellPosition) ?? valueSvc.getValueForDisplay({ + column: cellColumn, + node: cellRowNode, + from: "edit" + })?.value ?? oldValue ?? UNEDITED; + editModelSvc?.setEdit(cellPosition, { + pendingValue: getNormalisedFormula(beans, newValue, false, cellColumn), + sourceValue: oldValue, + state: "editing" + }); + } + continue; + } + const shouldStartEditing2 = cellStartedEdit && rowNode === curCellCtrl.rowNode && curCellCtrl.column === column; + _setupEditor(beans, { rowNode, column: curCellCtrl.column }, { + key: shouldStartEditing2 ? key : null, + event: shouldStartEditing2 ? event : null, + cellStartedEdit: shouldStartEditing2 && cellStartedEdit + }); + } +} +function _sourceAndPendingDiffer({ + pendingValue, + sourceValue +}) { + if (pendingValue === UNEDITED) { + pendingValue = sourceValue; + } + return pendingValue !== sourceValue; +} +function _filterChangedEdits(edits) { + const result = /* @__PURE__ */ new Map; + for (const [rowNode, editRow] of edits) { + const filtered = /* @__PURE__ */ new Map; + for (const [column, editValue] of editRow) { + if (_sourceAndPendingDiffer(editValue)) { + filtered.set(column, editValue); + } + } + if (filtered.size > 0) { + result.set(rowNode, filtered); + } + } + return result; +} +function _setupEditor(beans, position, params) { + const { key, event, cellStartedEdit, silent } = params ?? {}; + const { editModelSvc, gos, userCompFactory } = beans; + const cellCtrl = _getCellCtrl(beans, position); + const editorComp = cellCtrl?.comp?.getCellEditor(); + const editorParams = _createEditorParams(beans, position, key, cellStartedEdit && !silent); + const previousEdit = editModelSvc?.getEdit(position); + const newValue = editorParams.value ?? previousEdit?.sourceValue; + if (editorComp) { + editModelSvc?.setEdit(position, { + editorValue: getNormalisedFormula(beans, newValue, true, position.column), + state: "editing" + }); + editorComp.refresh?.(editorParams); + return; + } + const colDef = position.column.getColDef(); + const compDetails = _getCellEditorDetails(userCompFactory, colDef, editorParams); + if (!compDetails) { + return; + } + const { popupFromSelector, popupPositionFromSelector } = compDetails; + const popup = popupFromSelector ?? !!colDef.cellEditorPopup; + const popupLocation = popupPositionFromSelector ?? colDef.cellEditorPopupPosition; + checkAndPreventDefault(compDetails.params, event); + if (!cellCtrl) { + return; + } + const { rangeFeature, rowCtrl, comp, onEditorAttachedFuncs } = cellCtrl; + editModelSvc?.setEdit(position, { + editorValue: getNormalisedFormula(beans, newValue, true, position.column), + state: "editing", + editorState: { cellStartedEditing: undefined, cellStoppedEditing: undefined } + }); + cellCtrl.editCompDetails = compDetails; + onEditorAttachedFuncs.push(() => rangeFeature?.unsetComp()); + comp?.setEditDetails(compDetails, popup, popupLocation, gos.get("reactiveCustomComponents")); + rowCtrl?.refreshRow({ suppressFlash: true }); + dispatchEditingStarted(beans, position, event, newValue, silent); +} +function dispatchEditingStarted(beans, position, event, value, silent) { + const { editSvc, editModelSvc } = beans; + const edit = editModelSvc?.getEdit(position); + if (!silent && edit?.state === "editing" && !edit?.editorState?.cellStartedEditing) { + editSvc?.dispatchCellEvent(position, event, "cellEditingStarted", { value }); + editModelSvc?.setEdit(position, { editorState: { cellStartedEditing: true } }); + } +} +function _valueFromEditor(beans, cellEditor, params) { + const noValueResult = { editorValueExists: false }; + if (_hasValidationRules(beans)) { + const validationErrors = cellEditor.getValidationErrors?.(); + if ((validationErrors?.length ?? 0) > 0) { + return noValueResult; + } + } + if (params?.isCancelling) { + return noValueResult; + } + if (params?.isStopping) { + const isCancelAfterEnd = cellEditor?.isCancelAfterEnd?.(); + if (isCancelAfterEnd) { + return { ...noValueResult, isCancelAfterEnd }; + } + } + const editorValue = cellEditor.getValue(); + return { + editorValue, + editorValueExists: true + }; +} +function _createEditorParams(beans, position, key, cellStartedEdit) { + const { valueSvc, gos, editSvc } = beans; + const enableGroupEditing = beans.gos.get("enableGroupEdit"); + const cellCtrl = _getCellCtrl(beans, position); + const rowIndex = position.rowNode?.rowIndex ?? undefined; + const batchEdit = editSvc?.isBatchEditing(); + const agColumn = beans.colModel.getCol(position.column.getId()); + const { rowNode, column } = position; + const editor = cellCtrl.comp?.getCellEditor(); + const cellDataValue = editSvc?.getCellDataValue(position); + const initialNewValue = cellDataValue === undefined ? editor ? _valueFromEditor(beans, editor)?.editorValue : undefined : cellDataValue; + const value = initialNewValue === UNEDITED ? valueSvc.getValueForDisplay({ column: agColumn, node: rowNode, from: "edit" })?.value : initialNewValue; + let paramsValue = enableGroupEditing ? initialNewValue : value; + if (column.isAllowFormula() && beans.formula?.isFormula(paramsValue)) { + paramsValue = beans.formula?.normaliseFormula(paramsValue, true) ?? paramsValue; + } + return _addGridCommonParams(gos, { + value: paramsValue, + eventKey: key ?? null, + column, + colDef: column.getColDef(), + rowIndex, + node: rowNode, + data: rowNode.data, + cellStartedEdit: !!cellStartedEdit, + onKeyDown: cellCtrl?.onKeyDown.bind(cellCtrl), + stopEditing: (suppressNavigateAfterEdit) => { + editSvc.stopEditing(position, { source: batchEdit ? "ui" : "api", suppressNavigateAfterEdit }); + _destroyEditor(beans, position, {}); + }, + eGridCell: cellCtrl?.eGui, + parseValue: (newValue) => valueSvc.parseValue(agColumn, rowNode, newValue, cellCtrl?.value), + formatValue: cellCtrl?.formatValue.bind(cellCtrl), + validate: () => { + editSvc?.validateEdit(); + } + }); +} +function _purgeUnchangedEdits(beans, includeEditing) { + const { editModelSvc } = beans; + editModelSvc?.getEditMap().forEach((editRow, rowNode) => { + editRow.forEach((edit, column) => { + if (!includeEditing && (edit.state === "editing" || edit.pendingValue === UNEDITED)) { + return; + } + if (!_sourceAndPendingDiffer(edit) && (edit.state !== "editing" || includeEditing)) { + editModelSvc?.removeEdits({ rowNode, column }); + } + }); + }); +} +function _refreshEditorOnColDefChanged(beans, cellCtrl) { + const editor = cellCtrl.comp?.getCellEditor(); + if (!editor?.refresh) { + return; + } + const { eventKey, cellStartedEdit } = cellCtrl.editCompDetails.params; + const { column } = cellCtrl; + const editorParams = _createEditorParams(beans, cellCtrl, eventKey, cellStartedEdit); + const colDef = column.getColDef(); + const compDetails = _getCellEditorDetails(beans.userCompFactory, colDef, editorParams); + editor.refresh(checkAndPreventDefault(compDetails.params, eventKey)); +} +function checkAndPreventDefault(params, event) { + if (event instanceof KeyboardEvent && params.column.getColDef().cellEditor === "agNumberCellEditor") { + params.suppressPreventDefault = ["-", "+", ".", "e"].includes(event?.key ?? "") || params.suppressPreventDefault; + } else { + event?.preventDefault?.(); + } + return params; +} +function _syncFromEditors(beans, params) { + for (const cellId of beans.editModelSvc?.getEditPositions() ?? []) { + const cellCtrl = _getCellCtrl(beans, cellId); + if (!cellCtrl) { + continue; + } + const editor = cellCtrl.comp?.getCellEditor(); + if (!editor) { + continue; + } + const { editorValue, editorValueExists, isCancelAfterEnd } = _valueFromEditor(beans, editor, params); + if (isCancelAfterEnd) { + const { cellStartedEditing, cellStoppedEditing } = beans.editModelSvc?.getEdit(cellId)?.editorState || {}; + beans.editModelSvc?.setEdit(cellId, { + editorState: { isCancelAfterEnd, cellStartedEditing, cellStoppedEditing } + }); + } + _syncFromEditor(beans, cellId, editorValue, undefined, !editorValueExists, params); + } +} +function _syncFromEditor(beans, position, editorValue, _source, valueSameAsSource, params) { + const { editModelSvc, valueSvc } = beans; + if (!editModelSvc) { + return; + } + const { rowNode, column } = position; + if (!(rowNode && column)) { + return; + } + let edit = editModelSvc.getEdit(position); + if (edit?.sourceValue === undefined) { + const pendingValue = edit ? getNormalisedFormula(beans, edit.editorValue, false, column) : UNEDITED; + const editValue = { + sourceValue: valueSvc.getValue(column, rowNode, "data"), + pendingValue + }; + if (params?.persist) { + editValue.state = "changed"; + } + edit = editModelSvc.setEdit(position, editValue); + } + editModelSvc.setEdit(position, { + editorValue: valueSameAsSource ? getNormalisedFormula(beans, edit.sourceValue, true, column) : editorValue + }); + if (params?.persist) { + _persistEditorValue(beans, position); + } +} +function getNormalisedFormula(beans, value, forEditing, column) { + const { formula } = beans; + if (column.isAllowFormula() && formula?.isFormula(value)) { + return formula?.normaliseFormula(value, forEditing) ?? value; + } + return value; +} +function _persistEditorValue(beans, position) { + const { editModelSvc } = beans; + const edit = editModelSvc?.getEdit(position); + const pendingValue = getNormalisedFormula(beans, edit?.editorValue, false, position.column); + const editValue = { pendingValue }; + if (!edit?.editorState?.cellStoppedEditing && edit?.state !== "editing") { + editValue.state = "changed"; + } + editModelSvc?.setEdit(position, editValue); +} +function _destroyEditors(beans, edits, params = {}) { + if (!edits) { + edits = beans.editModelSvc?.getEditPositions(); + } + if (edits) { + for (const cellPosition of edits) { + _destroyEditor(beans, cellPosition, params); + } + } +} +function _destroyEditor(beans, position, params, cellCtrl = _getCellCtrl(beans, position)) { + const editModelSvc = beans.editModelSvc; + const edit = editModelSvc?.getEdit(position); + let state; + if (edit && edit.state !== "editing" && edit.editorState?.cellStoppedEditing) { + state = edit.state; + } else { + state = "changed"; + } + if (!cellCtrl) { + if (edit) { + editModelSvc?.setEdit(position, { state }); + } + return; + } + const comp = cellCtrl.comp; + const cellEditor = comp?.getCellEditor(); + if (comp && !cellEditor) { + cellCtrl?.refreshCell(); + if (edit) { + editModelSvc?.setEdit(position, { state }); + const args = beans.gos.get("enableGroupEdit") ? _enabledGroupEditStoppedArgs(edit, params?.cancel) : { + valueChanged: false, + newValue: undefined, + oldValue: edit.sourceValue + }; + dispatchEditingStopped(beans, position, args, params); + } + return; + } + if (_hasValidationRules(beans)) { + const errorMessages = edit && cellEditor?.getValidationErrors?.(); + const cellValidationModel = editModelSvc?.getCellValidationModel(); + if (errorMessages?.length) { + cellValidationModel?.setCellValidation(position, { errorMessages }); + } else { + cellValidationModel?.clearCellValidation(position); + } + } + if (edit) { + editModelSvc?.setEdit(position, { state }); + } + comp?.setEditDetails(); + comp?.refreshEditStyles(false, false); + cellCtrl?.refreshCell({ force: true, suppressFlash: true }); + const latest = editModelSvc?.getEdit(position); + if (latest && latest.state !== "editing") { + const cancel = params?.cancel; + const args = beans.gos.get("enableGroupEdit") ? _enabledGroupEditStoppedArgs(latest, cancel) : _cellEditStoppedArgs(latest, edit, cancel); + dispatchEditingStopped(beans, position, args, params); + } +} +function _enabledGroupEditStoppedArgs(latest, cancel) { + const { sourceValue, pendingValue } = latest; + let newValue; + if (!cancel && pendingValue !== UNEDITED) { + newValue = pendingValue; + } + return { + valueChanged: !cancel && _sourceAndPendingDiffer(latest), + newValue, + oldValue: sourceValue, + value: sourceValue + }; +} +function _cellEditStoppedArgs(latest, edit, cancel) { + if (cancel || latest.editorState.isCancelAfterEnd) { + return { + valueChanged: false, + newValue: undefined, + oldValue: latest.sourceValue + }; + } + let newValue = latest.editorValue; + if (newValue == null || newValue === UNEDITED) { + newValue = edit?.pendingValue; + } + if (newValue === UNEDITED) { + newValue = undefined; + } + return { + valueChanged: _sourceAndPendingDiffer(latest), + newValue, + oldValue: latest.sourceValue + }; +} +function dispatchEditingStopped(beans, position, args, { silent, event } = {}) { + const { editSvc, editModelSvc } = beans; + const latest = editModelSvc?.getEdit(position); + const { editorState } = latest || {}; + const { isCancelBeforeStart, cellStartedEditing, cellStoppedEditing } = editorState || {}; + if (!silent && !isCancelBeforeStart && cellStartedEditing && !cellStoppedEditing) { + editSvc?.dispatchCellEvent(position, event, "cellEditingStopped", args); + editModelSvc?.setEdit(position, { editorState: { cellStoppedEditing: true } }); + } +} +function _columnDefsRequireValidation(columnDefs) { + if (!columnDefs) { + return false; + } + for (let i = 0, len = columnDefs.length;i < len; ++i) { + const colDef = columnDefs[i]; + const params = colDef.cellEditorParams; + if (!params || !colDef.editable && !colDef.groupRowEditable) { + continue; + } + if (params.minLength !== undefined || params.maxLength !== undefined || params.getValidationErrors !== undefined || params.min !== undefined || params.max !== undefined) { + return true; + } + } + return false; +} +function _editorsRequireValidation(beans) { + const ctrls = beans.rowRenderer.getCellCtrls(); + for (let i = 0, len = ctrls.length;i < len; ++i) { + const ctrl = ctrls[i]; + const cellEditor = ctrl.comp?.getCellEditor(); + if (cellEditor) { + const editor = _unwrapUserComp(cellEditor); + if (editor.getValidationElement || editor.getValidationErrors) { + return true; + } + } + } + return false; +} +function _hasValidationRules(beans) { + return !!beans.gos.get("getFullRowEditValidationErrors") || _columnDefsRequireValidation(beans.colModel.getColumnDefs()) || _editorsRequireValidation(beans); +} +function _populateModelValidationErrors(beans, force) { + if (!(force || _hasValidationRules(beans))) { + return; + } + const cellValidationModel = new EditCellValidationModel; + const { ariaAnnounce, localeSvc, editModelSvc, gos } = beans; + const includeRows = gos.get("editType") === "fullRow"; + const translate = _getLocaleTextFunc(localeSvc); + const ariaValidationErrorPrefix = translate("ariaValidationErrorPrefix", "Cell Editor Validation"); + const rowCtrlSet = /* @__PURE__ */ new Set; + for (const ctrl of beans.rowRenderer.getCellCtrls()) { + const cellEditorComp = ctrl.comp?.getCellEditor(); + if (!cellEditorComp) { + continue; + } + const editor = _unwrapUserComp(cellEditorComp); + const { rowNode, column } = ctrl; + const errorMessages = editor.getValidationErrors?.() ?? []; + const el = editor.getValidationElement?.(false) || !editor.isPopup?.() && ctrl.eGui; + if (el) { + const isInvalid = errorMessages != null && errorMessages.length > 0; + const invalidMessage = isInvalid ? errorMessages.join(". ") : ""; + _setAriaInvalid(el, isInvalid); + if (isInvalid) { + ariaAnnounce.announceValue(`${ariaValidationErrorPrefix} ${errorMessages}`, "editorValidation"); + } + if (el instanceof HTMLInputElement) { + el.setCustomValidity(invalidMessage); + } else { + el.classList.toggle("invalid", isInvalid); + } + } + if (errorMessages?.length > 0) { + cellValidationModel.setCellValidation({ + rowNode, + column + }, { + errorMessages + }); + } + rowCtrlSet.add(ctrl.rowCtrl); + } + _syncFromEditors(beans, { persist: false }); + editModelSvc?.setCellValidationModel(cellValidationModel); + if (includeRows) { + const rowValidations = _generateRowValidationErrors(beans); + editModelSvc?.setRowValidationModel(rowValidations); + } + for (const rowCtrl of rowCtrlSet.values()) { + rowCtrl.rowEditStyleFeature?.applyRowStyles(); + for (const cellCtrl of rowCtrl.getAllCellCtrls()) { + cellCtrl.tooltipFeature?.refreshTooltip(true); + cellCtrl.editorTooltipFeature?.refreshTooltip(true); + cellCtrl.editStyleFeature?.applyCellStyles?.(); + } + } +} +var _generateRowValidationErrors = (beans) => { + const rowValidationModel = new EditRowValidationModel; + const getFullRowEditValidationErrors = beans.gos.get("getFullRowEditValidationErrors"); + const editMap = beans.editModelSvc?.getEditMap(); + if (!editMap) { + return rowValidationModel; + } + for (const rowNode of editMap.keys()) { + const rowEditMap = editMap.get(rowNode); + if (!rowEditMap) { + continue; + } + const editorsState = []; + const { rowIndex, rowPinned } = rowNode; + for (const column of rowEditMap.keys()) { + const editValue = rowEditMap.get(column); + if (!editValue) { + continue; + } + const { editorValue, pendingValue, sourceValue } = editValue; + const newValue = editorValue ?? (pendingValue === UNEDITED ? undefined : pendingValue) ?? sourceValue; + editorsState.push({ + column, + colId: column.getColId(), + rowIndex, + rowPinned, + oldValue: sourceValue, + newValue + }); + } + const errorMessages = getFullRowEditValidationErrors?.({ editorsState }) ?? []; + if (errorMessages.length > 0) { + rowValidationModel.setRowValidation({ + rowNode + }, { errorMessages }); + } + } + return rowValidationModel; +}; +function _validateEdit(beans) { + _populateModelValidationErrors(beans, true); + const map = beans.editModelSvc?.getCellValidationModel().getCellValidationMap(); + if (!map) { + return null; + } + const validations = []; + map.forEach((rowValidations, rowNode) => { + rowValidations.forEach(({ errorMessages }, column) => { + validations.push({ + column, + rowIndex: rowNode.rowIndex, + rowPinned: rowNode.rowPinned, + messages: errorMessages ?? null + }); + }); + }); + return validations; +} +function _isManualPinnedRow(rowNode) { + return !!(rowNode.rowPinned && rowNode.pinnedSibling); +} +function _getNodesInRangeForSelection(rowModel, float, start, end) { + const isTop = float === "top"; + if (!start) { + return _getNodesInRangeForSelection(rowModel, float, isTop ? rowModel.getPinnedTopRow(0) : rowModel.getPinnedBottomRow(0), end); + } + if (!end) { + const count = isTop ? rowModel.getPinnedTopRowCount() : rowModel.getPinnedBottomRowCount(); + return _getNodesInRangeForSelection(rowModel, float, start, isTop ? rowModel.getPinnedTopRow(count - 1) : rowModel.getPinnedBottomRow(count - 1)); + } + let started = false; + let finished = false; + const range = []; + rowModel.forEachPinnedRow(float, (node) => { + if (node === start && !started) { + started = true; + range.push(node); + return; + } + if (started && node === end) { + finished = true; + range.push(node); + return; + } + if (started && !finished) { + range.push(node); + } + }); + return range; +} +function _createCellEvent(beans, domEvent, eventType, { rowNode, column }, value) { + const event = _addGridCommonParams(beans.gos, { + type: eventType, + node: rowNode, + data: rowNode.data, + value, + column, + colDef: column.getColDef(), + rowPinned: rowNode.rowPinned, + event: domEvent, + rowIndex: rowNode.rowIndex + }); + return event; +} +function _isDeleteKey(key, alwaysReturnFalseOnBackspace = false) { + if (key === KeyCode.DELETE) { + return true; + } + if (!alwaysReturnFalseOnBackspace && key === KeyCode.BACKSPACE) { + return _isMacOsUserAgent(); + } + return false; +} +var CellKeyboardListenerFeature = class extends BeanStub { + constructor(cellCtrl, beans, rowNode, rowCtrl) { + super(); + this.cellCtrl = cellCtrl; + this.rowNode = rowNode; + this.rowCtrl = rowCtrl; + this.beans = beans; + } + init() { + this.eGui = this.cellCtrl.eGui; + } + onKeyDown(event) { + const key = event.key; + if (key === KeyCode.ENTER && isRowNumberCol(this.cellCtrl.column) && this.beans.rowNumbersSvc?.handleKeyDownOnCell(this.cellCtrl.cellPosition, event)) { + return; + } + switch (key) { + case KeyCode.ENTER: + this.onEnterKeyDown(event); + break; + case KeyCode.F2: + this.onF2KeyDown(event); + break; + case KeyCode.ESCAPE: + this.onEscapeKeyDown(event); + break; + case KeyCode.TAB: + this.onTabKeyDown(event); + break; + case KeyCode.BACKSPACE: + case KeyCode.DELETE: + this.onBackspaceOrDeleteKeyDown(key, event); + break; + case KeyCode.DOWN: + case KeyCode.UP: + case KeyCode.RIGHT: + case KeyCode.LEFT: + this.onNavigationKeyDown(event, key); + break; + } + } + onNavigationKeyDown(event, key) { + const { cellCtrl, beans } = this; + if (beans.editSvc?.isEditing(cellCtrl, { withOpenEditor: true })) { + return; + } + if (event.shiftKey && cellCtrl.isRangeSelectionEnabled()) { + this.onShiftRangeSelect(event); + } else { + const currentCellPosition = cellCtrl.getFocusedCellPosition(); + beans.navigation?.navigateToNextCell(event, key, currentCellPosition, true); + } + event.preventDefault(); + } + onShiftRangeSelect(event) { + const { rangeSvc, navigation } = this.beans; + if (!rangeSvc) { + return; + } + const endCell = rangeSvc.extendLatestRangeInDirection(event); + if (!endCell) { + return; + } + if (event.key === KeyCode.LEFT || event.key === KeyCode.RIGHT) { + navigation?.ensureColumnVisible(endCell.column); + } else { + navigation?.ensureRowVisible(endCell.rowIndex); + } + } + onTabKeyDown(event) { + this.beans.navigation?.onTabKeyDown(this.cellCtrl, event); + } + onBackspaceOrDeleteKeyDown(key, event) { + const { cellCtrl, beans, rowNode } = this; + const { gos, rangeSvc, eventSvc, editSvc } = beans; + eventSvc.dispatchEvent({ type: "keyShortcutChangedCellStart" }); + if (_isDeleteKey(key, gos.get("enableCellEditingOnBackspace")) && !editSvc?.isEditing(cellCtrl, { withOpenEditor: true })) { + if (rangeSvc && _isCellSelectionEnabled(gos)) { + rangeSvc.clearCellRangeCellValues({ + dispatchWrapperEvents: true, + wrapperEventSource: "deleteKey" + }); + } else if (cellCtrl.isCellEditable()) { + const deleteValue = beans.valueSvc.getDeleteValue(cellCtrl.column, rowNode); + rowNode.setDataValue(cellCtrl.column, deleteValue, "cellClear"); + } + } else if (!editSvc?.isEditing(cellCtrl, { withOpenEditor: true })) { + beans.editSvc?.startEditing(cellCtrl, { startedEdit: true, event }); + } + eventSvc.dispatchEvent({ type: "keyShortcutChangedCellEnd" }); + } + onEnterKeyDown(event) { + const { cellCtrl, beans } = this; + const { editSvc, navigation } = beans; + const cellEditing = editSvc?.isEditing(cellCtrl, { withOpenEditor: true }); + const rowNode = cellCtrl.rowNode; + const rowEditing = editSvc?.isRowEditing(rowNode, { withOpenEditor: true }); + const startEditingAction = (cellCtrl2) => { + const started = editSvc?.startEditing(cellCtrl2, { + startedEdit: true, + event, + source: "edit" + }); + if (started) { + event.preventDefault(); + } + }; + if (cellEditing || rowEditing) { + if (this.isCtrlEnter(event)) { + editSvc?.applyBulkEdit(cellCtrl, beans?.rangeSvc?.getCellRanges() || []); + return; + } + _populateModelValidationErrors(beans); + if (editSvc?.checkNavWithValidation(undefined, event) === "block-stop") { + return; + } + if (editSvc?.isEditing(cellCtrl, { withOpenEditor: true })) { + editSvc?.stopEditing(cellCtrl, { + event, + source: "edit" + }); + } else if (rowEditing && !cellCtrl.isCellEditable()) { + editSvc?.stopEditing({ rowNode }, { event, source: "edit" }); + } else { + startEditingAction(cellCtrl); + } + } else if (beans.gos.get("enterNavigatesVertically")) { + const key = event.shiftKey ? KeyCode.UP : KeyCode.DOWN; + navigation?.navigateToNextCell(null, key, cellCtrl.cellPosition, false); + } else { + if (editSvc?.hasValidationErrors()) { + return; + } + if (editSvc?.hasValidationErrors(cellCtrl)) { + editSvc.revertSingleCellEdit(cellCtrl, true); + } + startEditingAction(cellCtrl); + } + } + isCtrlEnter(e) { + return (e.ctrlKey || e.metaKey) && e.key === KeyCode.ENTER; + } + onF2KeyDown(event) { + const { + cellCtrl, + beans: { editSvc } + } = this; + const editing = editSvc?.isEditing(); + if (editing) { + _populateModelValidationErrors(this.beans); + if (editSvc?.checkNavWithValidation(undefined, event) === "block-stop") { + return; + } + } + editSvc?.startEditing(cellCtrl, { startedEdit: true, event }); + } + onEscapeKeyDown(event) { + const { + cellCtrl, + beans: { editSvc } + } = this; + if (editSvc?.checkNavWithValidation(cellCtrl, event) === "block-stop") { + editSvc.revertSingleCellEdit(cellCtrl); + } + setTimeout(() => { + editSvc?.stopEditing(cellCtrl, { + event, + cancel: true + }); + }); + } + processCharacter(event) { + const eventTarget = event.target; + const eventOnChildComponent = eventTarget !== this.eGui; + const { + beans: { editSvc }, + cellCtrl + } = this; + if (eventOnChildComponent) { + return; + } + if (editSvc?.isEditing(cellCtrl, { withOpenEditor: true })) { + return; + } + const key = event.key; + if (key === KeyCode.SPACE) { + this.onSpaceKeyDown(event); + } else if (editSvc?.isCellEditable(cellCtrl, "ui")) { + if (editSvc?.hasValidationErrors() && !editSvc?.hasValidationErrors(cellCtrl)) { + return; + } + editSvc?.startEditing(cellCtrl, { startedEdit: true, event, source: "api", editable: true }); + const compDetails = cellCtrl.editCompDetails; + const shouldPreventDefault = !compDetails?.params?.suppressPreventDefault; + if (shouldPreventDefault) { + event.preventDefault(); + } + } + } + onSpaceKeyDown(event) { + const { gos, editSvc } = this.beans; + const { rowNode } = this.cellCtrl; + if (!editSvc?.isEditing(this.cellCtrl, { withOpenEditor: true }) && _isRowSelection(gos)) { + this.beans.selectionSvc?.handleSelectionEvent(event, rowNode, "spaceKey"); + } + event.preventDefault(); + } +}; +var CellMouseListenerFeature = class extends BeanStub { + constructor(cellCtrl, beans, column) { + super(); + this.cellCtrl = cellCtrl; + this.column = column; + this.beans = beans; + } + onMouseEvent(eventName, mouseEvent) { + if (_isStopPropagationForAgGrid(mouseEvent)) { + return; + } + switch (eventName) { + case "click": + this.onCellClicked(mouseEvent); + break; + case "pointerdown": + case "mousedown": + case "touchstart": + this.onMouseDown(mouseEvent); + break; + case "dblclick": + this.onCellDoubleClicked(mouseEvent); + break; + case "mouseout": + this.onMouseOut(mouseEvent); + break; + case "mouseover": + this.onMouseOver(mouseEvent); + break; + } + } + onCellClicked(event) { + if (this.beans.touchSvc?.handleCellDoubleClick(this, event)) { + return; + } + const { eventSvc, rangeSvc, editSvc, editModelSvc, frameworkOverrides, gos } = this.beans; + const isMultiKey = event.ctrlKey || event.metaKey; + const { cellCtrl } = this; + const { column, cellPosition, rowNode } = cellCtrl; + const suppressMouseEvent2 = _suppressCellMouseEvent(gos, column, rowNode, event); + if (rangeSvc && isMultiKey && !suppressMouseEvent2) { + if (rangeSvc.getCellRangeCount(cellPosition) > 1) { + rangeSvc.intersectLastRange(true); + } + } + const cellClickedEvent = cellCtrl.createEvent(event, "cellClicked"); + cellClickedEvent.isEventHandlingSuppressed = suppressMouseEvent2; + eventSvc.dispatchEvent(cellClickedEvent); + const colDef = column.getColDef(); + if (colDef.onCellClicked) { + window.setTimeout(() => { + frameworkOverrides.wrapOutgoing(() => { + colDef.onCellClicked(cellClickedEvent); + }); + }, 0); + } + if (suppressMouseEvent2) { + return; + } + if (editModelSvc?.getState(cellCtrl) !== "editing") { + const editing = editSvc?.isEditing(); + const isRangeSelectionEnabledWhileEditing = editSvc?.isRangeSelectionEnabledWhileEditing(); + const cellValidations = editModelSvc?.getCellValidationModel().getCellValidationMap().size ?? 0; + const rowValidations = editModelSvc?.getRowValidationModel().getRowValidationMap().size ?? 0; + if (editing && (isRangeSelectionEnabledWhileEditing || cellValidations > 0 || rowValidations > 0)) { + return; + } + if (editSvc?.shouldStartEditing(cellCtrl, event)) { + editSvc?.startEditing(cellCtrl, { event }); + } else if (editSvc?.shouldStopEditing(cellCtrl, event)) { + if (this.beans.gos.get("editType") === "fullRow") { + editSvc?.stopEditing(cellCtrl, { + event, + source: "edit" + }); + } else { + editSvc?.stopEditing(undefined, { + event, + source: "edit" + }); + } + } + } + } + onCellDoubleClicked(event) { + const { column, beans, cellCtrl } = this; + const { eventSvc, frameworkOverrides, editSvc, editModelSvc, gos } = beans; + const suppressMouseEvent2 = _suppressCellMouseEvent(gos, cellCtrl.column, cellCtrl.rowNode, event); + const colDef = column.getColDef(); + const cellDoubleClickedEvent = cellCtrl.createEvent(event, "cellDoubleClicked"); + cellDoubleClickedEvent.isEventHandlingSuppressed = suppressMouseEvent2; + eventSvc.dispatchEvent(cellDoubleClickedEvent); + if (typeof colDef.onCellDoubleClicked === "function") { + window.setTimeout(() => { + frameworkOverrides.wrapOutgoing(() => { + colDef.onCellDoubleClicked(cellDoubleClickedEvent); + }); + }, 0); + } + if (suppressMouseEvent2) { + return; + } + if (editSvc?.shouldStartEditing(cellCtrl, event) && editModelSvc?.getState(cellCtrl) !== "editing") { + const editing = editSvc?.isEditing(); + const isRangeSelectionEnabledWhileEditing = editSvc?.isRangeSelectionEnabledWhileEditing(); + const cellValidations = editModelSvc?.getCellValidationModel().getCellValidationMap().size ?? 0; + const rowValidations = editModelSvc?.getRowValidationModel().getRowValidationMap().size ?? 0; + if (editing && (isRangeSelectionEnabledWhileEditing || cellValidations > 0 || rowValidations > 0)) { + return; + } + editSvc?.startEditing(cellCtrl, { event }); + } + } + onMouseDown(mouseEvent) { + const { shiftKey } = mouseEvent; + const target = mouseEvent.target; + const { cellCtrl, beans } = this; + const { eventSvc, rangeSvc, rowNumbersSvc, focusSvc, gos, editSvc } = beans; + const { column, rowNode, cellPosition } = cellCtrl; + const suppressMouseEvent2 = _suppressCellMouseEvent(gos, column, rowNode, mouseEvent); + const fireMouseDownEvent = () => { + const cellMouseDownEvent = cellCtrl.createEvent(mouseEvent, "cellMouseDown"); + cellMouseDownEvent.isEventHandlingSuppressed = suppressMouseEvent2; + eventSvc.dispatchEvent(cellMouseDownEvent); + }; + if (suppressMouseEvent2) { + fireMouseDownEvent(); + return; + } + if (this.isRightClickInExistingRange(mouseEvent)) { + return; + } + const hasRanges = rangeSvc && !rangeSvc.isEmpty(); + const containsWidget = this.containsWidget(target); + const isRowNumberColumn = isRowNumberCol(column); + if (rowNumbersSvc && isRowNumberColumn && !rowNumbersSvc.handleMouseDownOnCell(cellPosition, mouseEvent)) { + return; + } + if (!shiftKey || !hasRanges) { + const editing = editSvc?.isEditing(cellCtrl); + const isEnableCellTextSelection = gos.get("enableCellTextSelection"); + const shouldFocus = isEnableCellTextSelection && mouseEvent.defaultPrevented; + const forceBrowserFocus = (_isBrowserSafari() || shouldFocus) && !editing && !_isFocusableFormField(target) && !containsWidget; + cellCtrl.focusCell(forceBrowserFocus, mouseEvent); + } + if (shiftKey && hasRanges && !focusSvc.isCellFocused(cellPosition)) { + mouseEvent.preventDefault(); + const focusedCell = focusSvc.getFocusedCell(); + if (focusedCell) { + const { column: column2, rowIndex, rowPinned } = focusedCell; + const allowRangesWhileEditing = !!editSvc?.isRangeSelectionEnabledWhileEditing?.(); + if (editSvc?.isEditing(focusedCell) && !allowRangesWhileEditing) { + editSvc?.stopEditing(focusedCell); + } + if (!allowRangesWhileEditing) { + focusSvc.setFocusedCell({ + column: column2, + rowIndex, + rowPinned, + forceBrowserFocus: true, + preventScrollOnBrowserFocus: true, + sourceEvent: mouseEvent + }); + } + } + } + if (containsWidget) { + return; + } + rangeSvc?.handleCellMouseDown(mouseEvent, cellPosition); + fireMouseDownEvent(); + } + isRightClickInExistingRange(mouseEvent) { + const { rangeSvc } = this.beans; + if (rangeSvc) { + const cellInRange = rangeSvc.isCellInAnyRange(this.cellCtrl.cellPosition); + const isRightClick = _interpretAsRightClick(this.beans, mouseEvent); + if (cellInRange && isRightClick) { + return true; + } + } + return false; + } + containsWidget(target) { + return _isElementChildOfClass(target, "ag-selection-checkbox", 3) || _isElementChildOfClass(target, "ag-drag-handle", 3); + } + onMouseOut(mouseEvent) { + if (this.mouseStayingInsideCell(mouseEvent)) { + return; + } + const { eventSvc, colHover } = this.beans; + eventSvc.dispatchEvent(this.cellCtrl.createEvent(mouseEvent, "cellMouseOut")); + colHover?.clearMouseOver(); + } + onMouseOver(mouseEvent) { + if (this.mouseStayingInsideCell(mouseEvent)) { + return; + } + const { eventSvc, colHover } = this.beans; + eventSvc.dispatchEvent(this.cellCtrl.createEvent(mouseEvent, "cellMouseOver")); + colHover?.setMouseOver([this.column]); + } + mouseStayingInsideCell(e) { + if (!e.target || !e.relatedTarget) { + return false; + } + const eCell = this.cellCtrl.eGui; + const cellContainsTarget = eCell.contains(e.target); + const cellContainsRelatedTarget = eCell.contains(e.relatedTarget); + return cellContainsTarget && cellContainsRelatedTarget; + } +}; +var CellPositionFeature = class extends BeanStub { + constructor(cellCtrl, beans) { + super(); + this.cellCtrl = cellCtrl; + this.beans = beans; + this.column = cellCtrl.column; + this.rowNode = cellCtrl.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; + const cellSpan = this.cellCtrl.getCellSpan(); + if (!cellSpan) { + this.setupColSpan(); + this.setupRowSpan(); + } + this.onLeftChanged(); + this.onWidthChanged(); + if (!cellSpan) { + this._legacyApplyRowSpan(); + } + if (cellSpan) { + const refreshSpanHeight = this.refreshSpanHeight.bind(this, cellSpan); + refreshSpanHeight(); + this.addManagedListeners(this.beans.eventSvc, { + paginationChanged: refreshSpanHeight, + recalculateRowBounds: refreshSpanHeight, + pinnedHeightChanged: refreshSpanHeight + }); + } + } + refreshSpanHeight(cellSpan) { + const spanHeight = cellSpan.getCellHeight(); + if (spanHeight != null) { + this.eContent.style.height = `${spanHeight}px`; + } + } + onNewColumnsLoaded() { + const rowSpan = this.column.getRowSpan(this.rowNode); + if (this.rowSpan === rowSpan) { + return; + } + this.rowSpan = rowSpan; + this._legacyApplyRowSpan(true); + } + onDisplayColumnsChanged() { + const colsSpanning = this.getColSpanningList(); + if (!_areEqual(this.colsSpanning, colsSpanning)) { + this.colsSpanning = 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; + } + const width = this.getCellWidth(); + this.eContent.style.width = `${width}px`; + } + getCellWidth() { + if (!this.colsSpanning) { + return this.column.getActualWidth(); + } + return this.colsSpanning.reduce((width, col) => width + col.getActualWidth(), 0); + } + getColSpanningList() { + const { column, rowNode } = this; + const colSpan = column.getColSpan(rowNode); + const colsSpanning = []; + if (colSpan === 1) { + colsSpanning.push(column); + } else { + let pointer = column; + const pinned = column.getPinned(); + for (let i = 0;pointer && i < colSpan; i++) { + colsSpanning.push(pointer); + pointer = this.beans.visibleCols.getColAfter(pointer); + if (!pointer || _missing(pointer)) { + break; + } + if (pinned !== pointer.getPinned()) { + break; + } + } + } + return colsSpanning; + } + onLeftChanged() { + if (!this.eSetLeft) { + return; + } + const left = this.modifyLeftForPrintLayout(this.getCellLeft()); + this.eSetLeft.style.left = left + "px"; + } + getCellLeft() { + let mostLeftCol; + if (this.beans.gos.get("enableRtl") && this.colsSpanning) { + mostLeftCol = _last(this.colsSpanning); + } else { + mostLeftCol = this.column; + } + return mostLeftCol.getLeft(); + } + modifyLeftForPrintLayout(leftPosition) { + if (!this.cellCtrl.printLayout || this.column.getPinned() === "left") { + return leftPosition; + } + const { visibleCols } = this.beans; + const leftWidth = visibleCols.getColsLeftWidth(); + if (this.column.getPinned() === "right") { + const bodyWidth = visibleCols.bodyWidth; + return leftWidth + bodyWidth + (leftPosition || 0); + } + return leftWidth + (leftPosition || 0); + } + _legacyApplyRowSpan(force) { + if (this.rowSpan === 1 && !force) { + return; + } + const singleRowHeight = _getRowHeightAsNumber(this.beans); + const totalRowHeight = singleRowHeight * this.rowSpan; + this.eContent.style.height = `${totalRowHeight}px`; + this.eContent.style.zIndex = "1"; + } + destroy() { + super.destroy(); + } +}; +var CSS_CELL = "ag-cell"; +var CSS_AUTO_HEIGHT = "ag-cell-auto-height"; +var CSS_NORMAL_HEIGHT = "ag-cell-normal-height"; +var CSS_CELL_FOCUS = "ag-cell-focus"; +var CSS_CELL_FIRST_RIGHT_PINNED = "ag-cell-first-right-pinned"; +var CSS_CELL_LAST_LEFT_PINNED = "ag-cell-last-left-pinned"; +var CSS_CELL_NOT_INLINE_EDITING = "ag-cell-not-inline-editing"; +var CSS_CELL_WRAP_TEXT = "ag-cell-wrap-text"; +var instanceIdSequence4 = 0; +var CellCtrl = class extends BeanStub { + constructor(column, rowNode, beans, rowCtrl) { + super(); + this.column = column; + this.rowNode = rowNode; + this.rowCtrl = rowCtrl; + this.rangeFeature = undefined; + this.rowResizeFeature = undefined; + this.positionFeature = undefined; + this.customStyleFeature = undefined; + this.editStyleFeature = undefined; + this.mouseListener = undefined; + this.keyboardListener = undefined; + this.suppressRefreshCell = false; + this.onCompAttachedFuncs = []; + this.onEditorAttachedFuncs = []; + this.focusEventWhileNotReady = null; + this.hasBeenFocused = false; + this.hasEdit = false; + this.tooltipFeature = undefined; + this.editorTooltipFeature = undefined; + this.beans = beans; + this.gos = beans.gos; + this.editSvc = beans.editSvc; + this.hasEdit = !!beans.editSvc; + const { colId } = column; + this.instanceId = colId + "-" + instanceIdSequence4++; + this.createCellPosition(); + this.updateAndFormatValue(false); + } + addFeatures() { + const { beans } = this; + this.positionFeature = new CellPositionFeature(this, beans); + this.customStyleFeature = beans.cellStyles?.createCellCustomStyleFeature(this); + this.editStyleFeature = beans.editSvc?.createCellStyleFeature(this); + this.mouseListener = new CellMouseListenerFeature(this, beans, this.column); + this.keyboardListener = new CellKeyboardListenerFeature(this, beans, this.rowNode, this.rowCtrl); + this.enableTooltipFeature(); + const { rangeSvc } = beans; + const cellSelectionEnabled = rangeSvc && _isCellSelectionEnabled(beans.gos); + if (cellSelectionEnabled) { + this.rangeFeature = rangeSvc.createCellRangeFeature(this); + } + if (isRowNumberCol(this.column)) { + this.rowResizeFeature = this.beans.rowNumbersSvc.createRowNumbersRowResizerFeature(this); + } + } + isCellSpanning() { + return false; + } + getCellSpan() { + return; + } + removeFeatures() { + const context = this.beans.context; + this.positionFeature = context.destroyBean(this.positionFeature); + this.editorTooltipFeature = context.destroyBean(this.editorTooltipFeature); + this.customStyleFeature = context.destroyBean(this.customStyleFeature); + this.editStyleFeature = context.destroyBean(this.editStyleFeature); + this.mouseListener = context.destroyBean(this.mouseListener); + this.keyboardListener = context.destroyBean(this.keyboardListener); + this.rangeFeature = context.destroyBean(this.rangeFeature); + this.rowResizeFeature = context.destroyBean(this.rowResizeFeature); + this.disableTooltipFeature(); + } + enableTooltipFeature(value, shouldDisplayTooltip) { + this.tooltipFeature = this.beans.tooltipSvc?.enableCellTooltipFeature(this, value, shouldDisplayTooltip); + } + disableTooltipFeature() { + this.tooltipFeature = this.beans.context.destroyBean(this.tooltipFeature); + } + enableEditorTooltipFeature(editor) { + if (this.editorTooltipFeature) { + this.disableEditorTooltipFeature(); + } + this.editorTooltipFeature = this.beans.tooltipSvc?.setupCellEditorTooltip(this, editor); + _populateModelValidationErrors(this.beans); + } + disableEditorTooltipFeature() { + this.editorTooltipFeature = this.beans.context.destroyBean(this.editorTooltipFeature); + } + setComp(comp, eCell, _eWrapper, eCellWrapper, printLayout, startEditing, compBean) { + this.comp = comp; + this.eGui = eCell; + this.printLayout = printLayout; + compBean ?? (compBean = this); + this.addDomData(compBean); + this.addFeatures(); + compBean.addDestroyFunc(() => this.removeFeatures()); + this.onSuppressCellFocusChanged(this.beans.gos.get("suppressCellFocus")); + this.setupFocus(); + this.applyStaticCssClasses(); + this.setWrapText(); + this.onFirstRightPinnedChanged(); + this.onLastLeftPinnedChanged(); + this.onColumnHover(); + this.setupControlComps(); + this.setupAutoHeight(eCellWrapper, compBean); + this.refreshFirstAndLastStyles(); + this.checkFormulaError(); + this.refreshAriaRowIndex(); + this.refreshAriaColIndex(); + this.positionFeature?.init(); + this.customStyleFeature?.setComp(comp); + this.editStyleFeature?.setComp(comp); + this.tooltipFeature?.refreshTooltip(); + this.keyboardListener?.init(); + this.rangeFeature?.setComp(comp); + this.rowResizeFeature?.refreshRowResizer(); + const editable = startEditing ? this.isCellEditable() : undefined; + const continuingEdit = !editable && this.hasEdit && this.editSvc?.isEditing(this, { withOpenEditor: true }); + if (editable || continuingEdit) { + this.editSvc?.startEditing(this, { + startedEdit: false, + source: "api", + silent: true, + continueEditing: true, + editable + }); + } else { + this.showValue(false, true); + } + if (this.onCompAttachedFuncs.length) { + for (const func of this.onCompAttachedFuncs) { + func(); + } + this.onCompAttachedFuncs = []; + } + } + checkFormulaError() { + const isFormulaError = !!this.beans.formula?.getFormulaError(this.column, this.rowNode); + this.eGui.classList.toggle("formula-error", isFormulaError); + } + setupAutoHeight(eCellWrapper, compBean) { + this.isAutoHeight = this.beans.rowAutoHeight?.setupCellAutoHeight(this, eCellWrapper, compBean) ?? false; + } + getCellAriaRole() { + return this.column.getColDef().cellAriaRole ?? "gridcell"; + } + isCellRenderer() { + const colDef = this.column.getColDef(); + return colDef.cellRenderer != null || colDef.cellRendererSelector != null; + } + getValueToDisplay() { + return this.valueFormatted ?? this.value; + } + getDeferLoadingCellRenderer() { + const { beans, column } = this; + const { userCompFactory, ctrlsSvc, eventSvc } = beans; + const colDef = column.getColDef(); + const params = this.createCellRendererParams(); + params.deferRender = true; + const loadingDetails = _getLoadingCellRendererDetails(userCompFactory, colDef, params); + if (ctrlsSvc.getGridBodyCtrl()?.scrollFeature?.isScrolling()) { + let resolver; + const onReady = new AgPromise((resolve) => { + resolver = resolve; + }); + const [removeBodyScrollEnd] = this.addManagedListeners(eventSvc, { + bodyScrollEnd: () => { + resolver(); + removeBodyScrollEnd(); + } + }); + return { loadingComp: loadingDetails, onReady }; + } + return { loadingComp: loadingDetails, onReady: AgPromise.resolve() }; + } + showValue(forceNewCellRendererInstance, skipRangeHandleRefresh) { + const { beans, column, rowNode, rangeFeature } = this; + const { userCompFactory } = beans; + let valueToDisplay = this.getValueToDisplay(); + let compDetails; + const isSsrmLoading = rowNode.stub && rowNode.groupData?.[column.getId()] == null; + const colDef = column.getColDef(); + if (isSsrmLoading || this.isCellRenderer()) { + const params = this.createCellRendererParams(); + if (!isSsrmLoading || isRowNumberCol(column)) { + compDetails = _getCellRendererDetails(userCompFactory, colDef, params); + } else { + compDetails = _getLoadingCellRendererDetails(userCompFactory, colDef, params); + } + } + if (!compDetails && !isSsrmLoading && beans.findSvc?.isMatch(rowNode, column)) { + const params = this.createCellRendererParams(); + compDetails = _getCellRendererDetails(userCompFactory, { ...column.getColDef(), cellRenderer: "agFindCellRenderer" }, params); + } + if (this.hasEdit && this.editSvc.isBatchEditing() && this.editSvc.isRowEditing(rowNode, { checkSiblings: true })) { + const result = this.editSvc.prepDetailsDuringBatch(this, { compDetails, valueToDisplay }); + if (result) { + if (result.compDetails) { + compDetails = result.compDetails; + } else if (result.valueToDisplay) { + valueToDisplay = result.valueToDisplay; + } + } + } + this.comp.setRenderDetails(compDetails, valueToDisplay, forceNewCellRendererInstance); + this.customRowDragComp?.refreshVisibility(); + if (!skipRangeHandleRefresh && rangeFeature) { + _requestAnimationFrame(beans, () => rangeFeature?.refreshRangeStyleAndHandle()); + } + this.rowResizeFeature?.refreshRowResizer(); + } + setupControlComps() { + const colDef = this.column.getColDef(); + this.includeSelection = this.isIncludeControl(this.isCheckboxSelection(colDef), true); + this.includeRowDrag = this.isIncludeControl(colDef.rowDrag); + this.includeDndSource = this.isIncludeControl(colDef.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() { + const prefix = "ag-cell-value"; + const isCheckboxRenderer = this.column.getColDef().cellRenderer === "agCheckboxCellRenderer"; + let suffix = ""; + if (isCheckboxRenderer) { + suffix = " ag-allow-overflow"; + } + return `${prefix}${suffix}`; + } + isIncludeControl(value, allowManuallyPinned = false) { + const rowUnpinned = this.rowNode.rowPinned == null; + return (rowUnpinned || allowManuallyPinned && _isManualPinnedRow(this.rowNode)) && !!value; + } + isCheckboxSelection(colDef) { + const { rowSelection, groupDisplayType } = this.beans.gridOptions; + const checkboxLocation = _getCheckboxLocation(rowSelection); + const isSelectionColumn = isColumnSelectionCol(this.column); + if (groupDisplayType === "custom" && checkboxLocation !== "selectionColumn" && isSelectionColumn) { + return false; + } + return colDef.checkboxSelection || isSelectionColumn && typeof rowSelection === "object" && _getCheckboxes(rowSelection); + } + refreshShouldDestroy() { + const colDef = this.column.getColDef(); + const selectionChanged = this.includeSelection != this.isIncludeControl(this.isCheckboxSelection(colDef), true); + const rowDragChanged = this.includeRowDrag != this.isIncludeControl(colDef.rowDrag); + const dndSourceChanged = this.includeDndSource != this.isIncludeControl(colDef.dndSource); + const autoHeightChanged = this.isAutoHeight != this.column.isAutoHeight(); + return selectionChanged || rowDragChanged || dndSourceChanged || autoHeightChanged; + } + onPopupEditorClosed(e) { + const { editSvc } = this.beans; + if (!editSvc?.isEditing(this, { withOpenEditor: true })) { + return; + } + const isKeyboardEvent = e instanceof KeyboardEvent; + const isMouseEvent = e instanceof MouseEvent; + const isEscape = isKeyboardEvent && e.key === KeyCode.ESCAPE; + editSvc.stopEditing(this, { + source: editSvc.isBatchEditing() ? "ui" : "api", + cancel: isEscape, + event: isKeyboardEvent || isMouseEvent ? e : undefined + }); + if (isEscape) { + this.focusCell(true, e); + } + } + stopEditing(cancel = false) { + const { editSvc } = this.beans; + return editSvc?.stopEditing(this, { cancel, source: editSvc?.isBatchEditing() ? "ui" : "api" }) ?? false; + } + createCellRendererParams() { + const { + value, + valueFormatted, + column, + rowNode, + comp, + eGui, + beans: { valueSvc, gos, editSvc } + } = this; + const res = _addGridCommonParams(gos, { + value, + valueFormatted, + getValue: () => valueSvc.getValueForDisplay({ column, node: rowNode, from: "edit" }).value, + setValue: (value2) => editSvc?.setDataValue({ rowNode, column }, value2) || rowNode.setDataValue(column, value2), + formatValue: this.formatValue.bind(this), + data: rowNode.data, + node: rowNode, + pinned: column.getPinned(), + colDef: column.getColDef(), + column, + refreshCell: this.refreshCell.bind(this), + eGridCell: eGui, + eParentOfValue: comp.getParentOfValue(), + registerRowDragger: (rowDraggerElement, dragStartPixels, value2, suppressVisibilityChange) => this.registerRowDragger(rowDraggerElement, dragStartPixels, suppressVisibilityChange), + setTooltip: (value2, shouldDisplayTooltip) => { + gos.assertModuleRegistered("Tooltip", 3); + if (this.tooltipFeature) { + this.disableTooltipFeature(); + } + this.enableTooltipFeature(value2, shouldDisplayTooltip); + this.tooltipFeature?.refreshTooltip(); + } + }); + return res; + } + onCellChanged(event) { + const eventImpactsThisCell = event.column === this.column; + if (eventImpactsThisCell) { + this.refreshCell(); + } + } + refreshOrDestroyCell(params) { + if (this.refreshShouldDestroy()) { + this.rowCtrl?.recreateCell(this); + } else { + this.refreshCell(params); + } + if (this.hasEdit && this.editCompDetails) { + const { editSvc, comp } = this; + if (!comp?.getCellEditor() && editSvc.isEditing(this, { withOpenEditor: true })) { + editSvc.startEditing(this, { startedEdit: false, source: "api", silent: true }); + } + } + } + refreshCell(params) { + const { + editStyleFeature, + customStyleFeature, + rowCtrl: { rowEditStyleFeature }, + beans: { cellFlashSvc, filterManager }, + column, + comp, + suppressRefreshCell, + tooltipFeature + } = this; + if (suppressRefreshCell) { + return; + } + const { field, valueGetter, showRowGroup, enableCellChangeFlash } = column.getColDef(); + const noValueProvided = field == null && valueGetter == null && showRowGroup == null; + const newData = params?.newData ?? false; + const forceRefresh = noValueProvided || params && (params.force || newData); + const isCellCompReady = !!comp; + const valuesDifferent = this.updateAndFormatValue(isCellCompReady); + const dataNeedsUpdating = forceRefresh || valuesDifferent; + if (!isCellCompReady) { + return; + } + if (dataNeedsUpdating) { + this.showValue(!!newData, false); + const processingFilterChange = filterManager?.isSuppressFlashingCellsBecauseFiltering(); + const flashCell = !params?.suppressFlash && !processingFilterChange && enableCellChangeFlash; + if (flashCell) { + cellFlashSvc?.flashCell(this); + } + editStyleFeature?.applyCellStyles?.(); + customStyleFeature?.applyUserStyles(); + customStyleFeature?.applyClassesFromColDef(); + rowEditStyleFeature?.applyRowStyles(); + this.checkFormulaError(); + } + tooltipFeature?.refreshTooltip(); + customStyleFeature?.applyCellClassRules(); + } + isCellEditable() { + return this.column.isCellEditable(this.rowNode); + } + formatValue(value) { + return this.callValueFormatter(value) ?? value; + } + callValueFormatter(value) { + return this.beans.valueSvc.formatValue(this.column, this.rowNode, value); + } + updateAndFormatValue(compareValues) { + const oldValue = this.value; + const oldValueFormatted = this.valueFormatted; + const { value, valueFormatted } = this.beans.valueSvc.getValueForDisplay({ + column: this.column, + node: this.rowNode, + includeValueFormatted: true, + from: "edit" + }); + this.value = value; + this.valueFormatted = valueFormatted; + if (compareValues) { + return !this.valuesAreEqual(oldValue, this.value) || this.valueFormatted != oldValueFormatted; + } + return true; + } + valuesAreEqual(val1, val2) { + const colDef = this.column.getColDef(); + return colDef.equals ? colDef.equals(val1, val2) : val1 === val2; + } + addDomData(compBean) { + const element = this.eGui; + _setDomData(this.beans.gos, element, DOM_DATA_KEY_CELL_CTRL, this); + compBean.addDestroyFunc(() => _setDomData(this.beans.gos, element, DOM_DATA_KEY_CELL_CTRL, null)); + } + createEvent(domEvent, eventType) { + const { rowNode, column, value, beans } = this; + return _createCellEvent(beans, domEvent, eventType, { rowNode, column }, value); + } + processCharacter(event) { + this.keyboardListener?.processCharacter(event); + } + onKeyDown(event) { + this.keyboardListener?.onKeyDown(event); + } + onMouseEvent(eventName, mouseEvent) { + this.mouseListener?.onMouseEvent(eventName, mouseEvent); + } + getColSpanningList() { + return this.positionFeature?.getColSpanningList() ?? []; + } + onLeftChanged() { + if (!this.comp) { + return; + } + this.positionFeature?.onLeftChanged(); + } + onDisplayedColumnsChanged() { + if (!this.eGui) { + return; + } + this.refreshAriaColIndex(); + this.refreshFirstAndLastStyles(); + } + refreshFirstAndLastStyles() { + const { comp, column, beans } = this; + refreshFirstAndLastStyles(comp, column, beans.visibleCols); + } + refreshAriaColIndex() { + const colIdx = this.beans.visibleCols.getAriaColIndex(this.column); + _setAriaColIndex(this.eGui, colIdx); + } + onWidthChanged() { + return this.positionFeature?.onWidthChanged(); + } + getRowPosition() { + const { rowIndex, rowPinned } = this.cellPosition; + return { + rowIndex, + rowPinned + }; + } + updateRangeBordersIfRangeCount() { + if (!this.comp) { + return; + } + this.rangeFeature?.updateRangeBordersIfRangeCount(); + } + onCellSelectionChanged() { + if (!this.comp) { + return; + } + this.rangeFeature?.onCellSelectionChanged(); + } + isRangeSelectionEnabled() { + return this.rangeFeature != null; + } + focusCell(forceBrowserFocus = false, sourceEvent) { + const allowedTarget = this.editSvc?.allowedFocusTargetOnValidation(this); + if (allowedTarget && allowedTarget !== this) { + return; + } + this.beans.focusSvc.setFocusedCell({ + ...this.getFocusedCellPosition(), + forceBrowserFocus, + sourceEvent + }); + } + restoreFocus(waitForRender = false) { + const { + beans: { editSvc, focusSvc }, + comp + } = this; + if (!comp || editSvc?.isEditing(this) || !this.isCellFocused() || !focusSvc.shouldTakeFocus()) { + return; + } + const focus = () => { + if (!this.isAlive()) { + return; + } + const focusableElement = comp.getFocusableElement(); + if (this.isCellFocused()) { + focusableElement.focus({ preventScroll: true }); + } + }; + if (waitForRender) { + setTimeout(focus, 0); + return; + } + focus(); + } + onRowIndexChanged() { + this.createCellPosition(); + this.refreshAriaRowIndex(); + this.onCellFocused(); + this.restoreFocus(); + this.rangeFeature?.onCellSelectionChanged(); + this.rowResizeFeature?.refreshRowResizer(); + } + onSuppressCellFocusChanged(suppressCellFocus) { + const element = this.eGui; + if (!element) { + return; + } + _addOrRemoveAttribute(element, "tabindex", suppressCellFocus ? undefined : -1); + } + onFirstRightPinnedChanged() { + if (!this.comp) { + return; + } + const firstRightPinned = this.column.isFirstRightPinned(); + this.comp.toggleCss(CSS_CELL_FIRST_RIGHT_PINNED, firstRightPinned); + } + onLastLeftPinnedChanged() { + if (!this.comp) { + return; + } + const lastLeftPinned = this.column.isLastLeftPinned(); + this.comp.toggleCss(CSS_CELL_LAST_LEFT_PINNED, lastLeftPinned); + } + checkCellFocused() { + return this.beans.focusSvc.isCellFocused(this.cellPosition); + } + isCellFocused() { + const isFocused = this.checkCellFocused(); + this.hasBeenFocused || (this.hasBeenFocused = isFocused); + return isFocused; + } + setupFocus() { + this.restoreFocus(true); + this.onCellFocused(this.focusEventWhileNotReady ?? undefined); + } + onCellFocused(event) { + const { beans } = this; + if (_isCellFocusSuppressed(beans)) { + return; + } + if (!this.comp) { + if (event) { + this.focusEventWhileNotReady = event; + } + return; + } + const cellFocused = this.isCellFocused(); + const editing = beans.editSvc?.isEditing(this) ?? false; + this.comp.toggleCss(CSS_CELL_FOCUS, cellFocused); + if (cellFocused && (event?.forceBrowserFocus || !this.hasBrowserFocus() && this.beans.focusSvc.shouldTakeFocus())) { + let focusEl = this.comp.getFocusableElement(); + if (editing) { + const focusableEls = _findFocusableElements(focusEl, null, true); + if (focusableEls.length) { + focusEl = focusableEls[0]; + } + } + const preventScroll = event ? event.preventScrollOnBrowserFocus : true; + focusEl.focus({ preventScroll }); + _placeCaretAtEnd(beans, focusEl); + } + if (cellFocused && this.focusEventWhileNotReady) { + this.focusEventWhileNotReady = null; + } + if (cellFocused && event) { + this.rowCtrl.announceDescription(); + } + } + createCellPosition() { + const { rowIndex, rowPinned } = this.rowNode; + this.cellPosition = { + rowIndex, + rowPinned: _makeNull(rowPinned), + column: this.column + }; + } + applyStaticCssClasses() { + const { comp } = this; + comp.toggleCss(CSS_CELL, true); + comp.toggleCss(CSS_CELL_NOT_INLINE_EDITING, true); + const autoHeight = this.column.isAutoHeight() == true; + comp.toggleCss(CSS_AUTO_HEIGHT, autoHeight); + comp.toggleCss(CSS_NORMAL_HEIGHT, !autoHeight); + } + 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(); + } + this.setWrapText(); + if (this.editSvc?.isEditing(this)) { + this.editSvc?.handleColDefChanged(this); + } else { + this.refreshOrDestroyCell({ force: true, suppressFlash: true }); + } + } + setWrapText() { + const value = this.column.getColDef().wrapText == true; + this.comp.toggleCss(CSS_CELL_WRAP_TEXT, value); + } + dispatchCellContextMenuEvent(event) { + const colDef = this.column.getColDef(); + const cellContextMenuEvent = this.createEvent(event, "cellContextMenu"); + const { beans } = this; + beans.eventSvc.dispatchEvent(cellContextMenuEvent); + if (colDef.onCellContextMenu) { + window.setTimeout(() => { + beans.frameworkOverrides.wrapOutgoing(() => { + colDef.onCellContextMenu(cellContextMenuEvent); + }); + }, 0); + } + } + getCellRenderer() { + return this.comp?.getCellRenderer() ?? null; + } + destroy() { + this.onCompAttachedFuncs = []; + this.onEditorAttachedFuncs = []; + if (this.isCellFocused() && this.hasBrowserFocus()) { + this.beans.focusSvc.attemptToRecoverFocus(); + } + super.destroy(); + } + hasBrowserFocus() { + return this.eGui?.contains(_getActiveDomElement(this.beans)) ?? false; + } + createSelectionCheckbox() { + const cbSelectionComponent = this.beans.selectionSvc?.createCheckboxSelectionComponent(); + if (!cbSelectionComponent) { + return; + } + this.beans.context.createBean(cbSelectionComponent); + cbSelectionComponent.init({ rowNode: this.rowNode, column: this.column }); + return cbSelectionComponent; + } + createDndSource() { + const dndSourceComp = this.beans.registry.createDynamicBean("dndSourceComp", false, this.rowNode, this.column, this.eGui); + if (dndSourceComp) { + this.beans.context.createBean(dndSourceComp); + } + return dndSourceComp; + } + registerRowDragger(customElement, dragStartPixels, alwaysVisible) { + if (this.customRowDragComp) { + this.customRowDragComp.setDragElement(customElement, dragStartPixels); + return; + } + const newComp = this.createRowDragComp(customElement, dragStartPixels, alwaysVisible); + if (newComp) { + this.customRowDragComp = newComp; + this.addDestroyFunc(() => { + this.beans.context.destroyBean(newComp); + this.customRowDragComp = null; + }); + newComp.refreshVisibility(); + } + } + createRowDragComp(customElement, dragStartPixels, alwaysVisible) { + const rowDragComp = this.beans.rowDragSvc?.createRowDragCompForCell(this.rowNode, this.column, () => this.value, customElement, dragStartPixels, alwaysVisible); + if (!rowDragComp) { + return; + } + this.beans.context.createBean(rowDragComp); + return rowDragComp; + } + cellEditorAttached() { + for (const func of this.onEditorAttachedFuncs) { + func(); + } + this.onEditorAttachedFuncs = []; + } + setFocusedCellPosition(_cellPosition) {} + getFocusedCellPosition() { + return this.cellPosition; + } + refreshAriaRowIndex() { + if (!isRowNumberCol(this.column) || !this.eGui) { + return; + } + const { ariaRowIndex } = this.rowCtrl; + if (ariaRowIndex != null) { + _setAriaRowIndex(this.eGui, ariaRowIndex); + } + } + getRootElement() { + return this.eGui; + } +}; +function processClassRules(expressionSvc, previousClassRules, classRules, params, onApplicableClass, onNotApplicableClass) { + if (classRules == null && previousClassRules == null) { + return; + } + const classesToApply = {}; + const classesToRemove = {}; + const forEachSingleClass = (className, callback) => { + for (const singleClass of className.split(" ")) { + if (singleClass.trim() == "") { + continue; + } + callback(singleClass); + } + }; + if (classRules) { + const classNames = Object.keys(classRules); + for (let i = 0;i < classNames.length; i++) { + const className = classNames[i]; + const rule = classRules[className]; + let resultOfRule; + if (typeof rule === "string") { + resultOfRule = expressionSvc ? expressionSvc.evaluate(rule, params) : true; + } else if (typeof rule === "function") { + resultOfRule = rule(params); + } + forEachSingleClass(className, (singleClass) => { + if (resultOfRule) { + classesToApply[singleClass] = true; + } else { + classesToRemove[singleClass] = true; + } + }); + } + } + if (previousClassRules && onNotApplicableClass) { + for (const className of Object.keys(previousClassRules)) { + forEachSingleClass(className, (singleClass) => { + if (!classesToApply[singleClass]) { + classesToRemove[singleClass] = true; + } + }); + } + } + if (onNotApplicableClass) { + Object.keys(classesToRemove).forEach(onNotApplicableClass); + } + Object.keys(classesToApply).forEach(onApplicableClass); +} +function calculateRowLevel(rowNode) { + if (rowNode.group) { + return rowNode.level; + } + const parent = rowNode.parent; + return parent ? parent.level + 1 : 0; +} +var instanceIdSequence5 = 0; +var RowCtrl = class extends BeanStub { + constructor(rowNode, beans, animateIn, useAnimationFrameForCreate, printLayout) { + super(); + this.rowNode = rowNode; + this.useAnimationFrameForCreate = useAnimationFrameForCreate; + this.printLayout = printLayout; + this.focusEventWhileNotReady = null; + this.allRowGuis = []; + this.active = true; + this.centerCellCtrls = { list: [], map: {} }; + this.leftCellCtrls = { list: [], map: {} }; + this.rightCellCtrls = { list: [], map: {} }; + this.slideInAnimation = { + left: false, + center: false, + right: false, + fullWidth: false + }; + this.fadeInAnimation = { + left: false, + center: false, + right: false, + fullWidth: false + }; + this.rowDragComps = []; + this.lastMouseDownOnDragger = false; + this.emptyStyle = {}; + this.updateColumnListsPending = false; + this.rowId = null; + this.ariaRowIndex = null; + this.businessKey = null; + this.beans = beans; + this.gos = beans.gos; + this.paginationPage = beans.pagination?.getCurrentPage() ?? 0; + this.suppressRowTransform = this.gos.get("suppressRowTransform"); + this.instanceId = rowNode.id + "-" + instanceIdSequence5++; + this.rowId = _escapeString(rowNode.id); + this.initRowBusinessKey(); + this.rowFocused = beans.focusSvc.isRowFocused(this.rowNode.rowIndex, this.rowNode.rowPinned); + this.rowLevel = calculateRowLevel(this.rowNode); + this.setRowType(); + this.setAnimateFlags(animateIn); + this.rowStyles = this.processStylesFromGridOptions(); + this.rowEditStyleFeature = beans.editSvc?.createRowStyleFeature(this); + this.addListeners(); + } + initRowBusinessKey() { + this.businessKeyForNodeFunc = this.gos.get("getBusinessKeyForNode"); + this.updateRowBusinessKey(); + } + updateRowBusinessKey() { + if (typeof this.businessKeyForNodeFunc !== "function") { + return; + } + const businessKey = this.businessKeyForNodeFunc(this.rowNode); + this.businessKey = _escapeString(businessKey); + } + updateGui(containerType, gui) { + if (containerType === "left") { + this.leftGui = gui; + } else if (containerType === "right") { + this.rightGui = gui; + } else if (containerType === "fullWidth") { + this.fullWidthGui = gui; + } else { + this.centerGui = gui; + } + } + setComp(rowComp, element, containerType, compBean) { + const { context, rowRenderer } = this.beans; + compBean = setupCompBean(this, context, compBean); + const gui = { rowComp, element, containerType, compBean }; + this.allRowGuis.push(gui); + this.updateGui(containerType, gui); + this.initialiseRowComp(gui); + const rowNode = this.rowNode; + const isSsrmLoadingRow = this.rowType === "FullWidthLoading" || rowNode.stub; + const isIrmLoadingRow = !rowNode.data && this.beans.rowModel.getType() === "infinite"; + if (!isSsrmLoadingRow && !isIrmLoadingRow && !rowNode.rowPinned) { + rowRenderer.dispatchFirstDataRenderedEvent(); + } + this.setupFocus(); + } + unsetComp(containerType) { + this.allRowGuis = this.allRowGuis.filter((rowGui) => rowGui.containerType !== containerType); + this.updateGui(containerType, undefined); + } + isCacheable() { + return this.rowType === "FullWidthDetail" && this.gos.get("keepDetailRows"); + } + setCached(cached) { + const displayValue = cached ? "none" : ""; + for (const rg of this.allRowGuis) { + rg.element.style.display = displayValue; + } + } + initialiseRowComp(gui) { + const gos = this.gos; + this.onSuppressCellFocusChanged(this.beans.gos.get("suppressCellFocus")); + this.listenOnDomOrder(gui); + this.onRowHeightChanged(gui); + this.updateRowIndexes(gui); + this.setFocusedClasses(gui); + this.setStylesFromGridOptions(false, gui); + if (_isRowSelection(gos) && this.rowNode.selectable) { + this.onRowSelected(gui); + } + this.updateColumnLists(!this.useAnimationFrameForCreate); + const comp = gui.rowComp; + const initialRowClasses = this.getInitialRowClasses(gui.containerType); + for (const name of initialRowClasses) { + comp.toggleCss(name, true); + } + this.executeSlideAndFadeAnimations(gui); + if (this.rowNode.group) { + _setAriaExpanded(gui.element, !!this.rowNode.expanded); + } + this.setRowCompRowId(comp); + this.setRowCompRowBusinessKey(comp); + _setDomData(gos, gui.element, DOM_DATA_KEY_ROW_CTRL, this); + gui.compBean.addDestroyFunc(() => _setDomData(gos, gui.element, DOM_DATA_KEY_ROW_CTRL, null)); + if (this.useAnimationFrameForCreate) { + this.beans.animationFrameSvc.createTask(this.addHoverFunctionality.bind(this, gui), this.rowNode.rowIndex, "p2", false); + } else { + this.addHoverFunctionality(gui); + } + if (this.isFullWidth()) { + this.setupFullWidth(gui); + } + if (gos.get("rowDragEntireRow")) { + this.addRowDraggerToRow(gui); + } + if (this.useAnimationFrameForCreate) { + this.beans.animationFrameSvc.addDestroyTask(() => { + if (!this.isAlive()) { + return; + } + gui.rowComp.toggleCss("ag-after-created", true); + }); + } + this.executeProcessRowPostCreateFunc(); + } + setRowCompRowBusinessKey(comp) { + if (this.businessKey == null) { + return; + } + comp.setRowBusinessKey(this.businessKey); + } + setRowCompRowId(comp) { + const rowId = _escapeString(this.rowNode.id); + this.rowId = rowId; + if (rowId == null) { + return; + } + comp.setRowId(rowId); + } + executeSlideAndFadeAnimations(gui) { + const { containerType } = gui; + const shouldSlide = this.slideInAnimation[containerType]; + if (shouldSlide) { + _batchCall(() => { + this.onTopChanged(); + }); + this.slideInAnimation[containerType] = false; + } + const shouldFade = this.fadeInAnimation[containerType]; + if (shouldFade) { + _batchCall(() => { + gui.rowComp.toggleCss("ag-opacity-zero", false); + }); + this.fadeInAnimation[containerType] = false; + } + } + addRowDraggerToRow(gui) { + const rowDragComp = this.beans.rowDragSvc?.createRowDragCompForRow(this.rowNode, gui.element); + if (!rowDragComp) { + return; + } + const rowDragBean = this.createBean(rowDragComp, this.beans.context); + this.rowDragComps.push(rowDragBean); + gui.compBean.addDestroyFunc(() => { + this.rowDragComps = this.rowDragComps.filter((r) => r !== rowDragBean); + this.rowEditStyleFeature = this.destroyBean(this.rowEditStyleFeature, this.beans.context); + this.destroyBean(rowDragBean, this.beans.context); + }); + } + setupFullWidth(gui) { + const pinned = this.getPinnedForContainer(gui.containerType); + const compDetails = this.createFullWidthCompDetails(gui.element, pinned); + gui.rowComp.showFullWidth(compDetails); + } + getFullWidthCellRenderers() { + if (this.gos.get("embedFullWidthRows")) { + return this.allRowGuis.map((gui) => gui?.rowComp?.getFullWidthCellRenderer()); + } + return [this.fullWidthGui?.rowComp?.getFullWidthCellRenderer()]; + } + executeProcessRowPostCreateFunc() { + const func = this.gos.getCallback("processRowPostCreate"); + if (!func || !this.areAllContainersReady()) { + return; + } + const params = { + eRow: this.centerGui.element, + ePinnedLeftRow: this.leftGui ? this.leftGui.element : undefined, + ePinnedRightRow: this.rightGui ? this.rightGui.element : undefined, + node: this.rowNode, + rowIndex: this.rowNode.rowIndex, + addRenderedRowListener: this.addEventListener.bind(this) + }; + func(params); + } + areAllContainersReady() { + const { + leftGui, + centerGui, + rightGui, + beans: { visibleCols } + } = this; + const isLeftReady = !!leftGui || !visibleCols.isPinningLeft(); + const isCenterReady = !!centerGui; + const isRightReady = !!rightGui || !visibleCols.isPinningRight(); + return isLeftReady && isCenterReady && isRightReady; + } + isNodeFullWidthCell() { + if (this.rowNode.detail) { + return true; + } + const isFullWidthCellFunc = this.beans.gos.getCallback("isFullWidthRow"); + return isFullWidthCellFunc ? isFullWidthCellFunc({ rowNode: this.rowNode }) : false; + } + setRowType() { + const { + rowNode, + gos, + beans: { colModel } + } = this; + const isStub = rowNode.stub && !gos.get("suppressServerSideFullWidthLoadingRow") && !gos.get("groupHideOpenParents"); + const isFullWidthCell = this.isNodeFullWidthCell(); + const isDetailCell = gos.get("masterDetail") && rowNode.detail; + const pivotMode = colModel.isPivotMode(); + const isFullWidthGroup = _isFullWidthGroupRow(gos, rowNode, pivotMode); + if (isStub) { + this.rowType = "FullWidthLoading"; + } else if (isDetailCell) { + this.rowType = "FullWidthDetail"; + } else if (isFullWidthCell) { + this.rowType = "FullWidth"; + } else if (isFullWidthGroup) { + this.rowType = "FullWidthGroup"; + } else { + this.rowType = "Normal"; + } + } + updateColumnLists(suppressAnimationFrame = false, useFlushSync = false) { + if (this.isFullWidth()) { + return; + } + const { animationFrameSvc } = this.beans; + const noAnimation = !animationFrameSvc?.active || suppressAnimationFrame || this.printLayout; + if (noAnimation) { + this.updateColumnListsImpl(useFlushSync); + return; + } + if (this.updateColumnListsPending) { + return; + } + animationFrameSvc.createTask(() => { + if (!this.active) { + return; + } + this.updateColumnListsImpl(true); + }, this.rowNode.rowIndex, "p1", false); + this.updateColumnListsPending = true; + } + getNewCellCtrl(col) { + const isCellSpan = this.beans.rowSpanSvc?.isCellSpanning(col, this.rowNode); + if (isCellSpan) { + return; + } + return new CellCtrl(col, this.rowNode, this.beans, this); + } + isCorrectCtrlForSpan(cell) { + return !this.beans.rowSpanSvc?.isCellSpanning(cell.column, this.rowNode); + } + createCellCtrls(prev, cols, pinned = null) { + const res = { + list: [], + map: {} + }; + const addCell = (colInstanceId, cellCtrl, index) => { + if (index != null) { + res.list.splice(index, 0, cellCtrl); + } else { + res.list.push(cellCtrl); + } + res.map[colInstanceId] = cellCtrl; + }; + const colsFromPrev = []; + for (const col of cols) { + const colInstanceId = col.getInstanceId(); + let cellCtrl = prev.map[colInstanceId]; + if (cellCtrl && !this.isCorrectCtrlForSpan(cellCtrl)) { + cellCtrl.destroy(); + cellCtrl = undefined; + } + if (!cellCtrl) { + cellCtrl = this.getNewCellCtrl(col); + } + if (!cellCtrl) { + continue; + } + addCell(colInstanceId, cellCtrl); + } + for (const prevCellCtrl of prev.list) { + const colInstanceId = prevCellCtrl.column.getInstanceId(); + const cellInResult = res.map[colInstanceId] != null; + if (cellInResult) { + continue; + } + const keepCell = !this.isCellEligibleToBeRemoved(prevCellCtrl, pinned); + if (keepCell) { + colsFromPrev.push([colInstanceId, prevCellCtrl]); + } else { + prevCellCtrl.destroy(); + } + } + if (colsFromPrev.length) { + for (const [colInstanceId, cellCtrl] of colsFromPrev) { + const index = res.list.findIndex((ctrl) => ctrl.column.getLeft() > cellCtrl.column.getLeft()); + const normalisedIndex = index === -1 ? undefined : Math.max(index - 1, 0); + addCell(colInstanceId, cellCtrl, normalisedIndex); + } + } + const { focusSvc, visibleCols } = this.beans; + const focusedCell = focusSvc.getFocusedCell(); + if (focusedCell && focusedCell.column.getPinned() == pinned) { + const focusedColInstanceId = focusedCell.column.getInstanceId(); + const focusedCellCtrl = res.map[focusedColInstanceId]; + if (!focusedCellCtrl && visibleCols.allCols.includes(focusedCell.column)) { + const cellCtrl = this.createFocusedCellCtrl(); + if (cellCtrl) { + const index = res.list.findIndex((ctrl) => ctrl.column.getLeft() > cellCtrl.column.getLeft()); + const normalisedIndex = index === -1 ? undefined : Math.max(index - 1, 0); + addCell(focusedColInstanceId, cellCtrl, normalisedIndex); + } + } + } + return res; + } + createFocusedCellCtrl() { + const { focusSvc, rowSpanSvc } = this.beans; + const focusedCell = focusSvc.getFocusedCell(); + if (!focusedCell) { + return; + } + const focusedSpan = rowSpanSvc?.getCellSpan(focusedCell.column, this.rowNode); + if (focusedSpan) { + if (focusedSpan.firstNode !== this.rowNode || !focusedSpan.doesSpanContain(focusedCell)) { + return; + } + } else if (!focusSvc.isRowFocused(this.rowNode.rowIndex, this.rowNode.rowPinned)) { + return; + } + return this.getNewCellCtrl(focusedCell.column); + } + updateColumnListsImpl(useFlushSync) { + this.updateColumnListsPending = false; + this.createAllCellCtrls(); + this.setCellCtrls(useFlushSync); + } + setCellCtrls(useFlushSync) { + for (const item of this.allRowGuis) { + const cellControls = this.getCellCtrlsForContainer(item.containerType); + item.rowComp.setCellCtrls(cellControls, useFlushSync); + } + } + getCellCtrlsForContainer(containerType) { + switch (containerType) { + case "left": + return this.leftCellCtrls.list; + case "right": + return this.rightCellCtrls.list; + case "fullWidth": + return []; + case "center": + return this.centerCellCtrls.list; + } + } + createAllCellCtrls() { + const colViewport = this.beans.colViewport; + const presentedColsService = this.beans.visibleCols; + if (this.printLayout) { + this.centerCellCtrls = this.createCellCtrls(this.centerCellCtrls, presentedColsService.allCols); + this.leftCellCtrls = { list: [], map: {} }; + this.rightCellCtrls = { list: [], map: {} }; + } else { + const centerCols = colViewport.getColsWithinViewport(this.rowNode); + this.centerCellCtrls = this.createCellCtrls(this.centerCellCtrls, centerCols); + const leftCols = presentedColsService.getLeftColsForRow(this.rowNode); + this.leftCellCtrls = this.createCellCtrls(this.leftCellCtrls, leftCols, "left"); + const rightCols = presentedColsService.getRightColsForRow(this.rowNode); + this.rightCellCtrls = this.createCellCtrls(this.rightCellCtrls, rightCols, "right"); + } + } + isCellEligibleToBeRemoved(cellCtrl, nextContainerPinned) { + const REMOVE_CELL = true; + const KEEP_CELL = false; + const { column } = cellCtrl; + if (column.getPinned() != nextContainerPinned) { + return REMOVE_CELL; + } + if (!this.isCorrectCtrlForSpan(cellCtrl)) { + return REMOVE_CELL; + } + const { visibleCols, editSvc } = this.beans; + const editing = editSvc?.isEditing(cellCtrl); + const focused = cellCtrl.isCellFocused(); + const mightWantToKeepCell = editing || focused; + if (mightWantToKeepCell) { + const displayedColumns = visibleCols.allCols; + const cellStillDisplayed = displayedColumns.indexOf(column) >= 0; + return cellStillDisplayed ? KEEP_CELL : REMOVE_CELL; + } + return REMOVE_CELL; + } + getDomOrder() { + const isEnsureDomOrder = this.gos.get("ensureDomOrder"); + return isEnsureDomOrder || _isDomLayout(this.gos, "print"); + } + listenOnDomOrder(gui) { + const listener = () => { + gui.rowComp.setDomOrder(this.getDomOrder()); + }; + gui.compBean.addManagedPropertyListeners(["domLayout", "ensureDomOrder"], listener); + } + setAnimateFlags(animateIn) { + if (this.rowNode.sticky || !animateIn) { + return; + } + const oldRowTopExists = _exists(this.rowNode.oldRowTop); + const { visibleCols } = this.beans; + const pinningLeft = visibleCols.isPinningLeft(); + const pinningRight = visibleCols.isPinningRight(); + if (oldRowTopExists) { + const { slideInAnimation } = this; + if (this.isFullWidth() && !this.gos.get("embedFullWidthRows")) { + slideInAnimation.fullWidth = true; + return; + } + slideInAnimation.center = true; + slideInAnimation.left = pinningLeft; + slideInAnimation.right = pinningRight; + } else { + const { fadeInAnimation } = this; + if (this.isFullWidth() && !this.gos.get("embedFullWidthRows")) { + fadeInAnimation.fullWidth = true; + return; + } + fadeInAnimation.center = true; + fadeInAnimation.left = pinningLeft; + fadeInAnimation.right = pinningRight; + } + } + isFullWidth() { + return this.rowType !== "Normal"; + } + refreshFullWidth() { + const tryRefresh = (gui, pinned) => { + if (!gui) { + return true; + } + return gui.rowComp.refreshFullWidth(() => { + const compDetails = this.createFullWidthCompDetails(gui.element, pinned); + return compDetails.params; + }); + }; + const fullWidthSuccess = tryRefresh(this.fullWidthGui, null); + const centerSuccess = tryRefresh(this.centerGui, null); + const leftSuccess = tryRefresh(this.leftGui, "left"); + const rightSuccess = tryRefresh(this.rightGui, "right"); + const allFullWidthRowsRefreshed = fullWidthSuccess && centerSuccess && leftSuccess && rightSuccess; + return allFullWidthRowsRefreshed; + } + addListeners() { + const { beans, gos, rowNode } = this; + const { expansionSvc, eventSvc, context, rowSpanSvc } = beans; + this.addManagedListeners(this.rowNode, { + heightChanged: () => this.onRowHeightChanged(), + rowSelected: () => this.onRowSelected(), + rowIndexChanged: this.onRowIndexChanged.bind(this), + topChanged: this.onTopChanged.bind(this), + ...expansionSvc?.getRowExpandedListeners(this) ?? {} + }); + if (rowNode.detail) { + this.addManagedListeners(rowNode.parent, { dataChanged: this.onRowNodeDataChanged.bind(this) }); + } + this.addManagedListeners(rowNode, { + 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(eventSvc, { + 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() + }); + if (rowSpanSvc) { + this.addManagedListeners(rowSpanSvc, { + spannedCellsUpdated: ({ pinned }) => { + if (pinned && !rowNode.rowPinned) { + return; + } + this.updateColumnLists(); + } + }); + } + this.addDestroyFunc(() => { + this.rowDragComps = this.destroyBeans(this.rowDragComps, context); + this.tooltipFeature = this.destroyBean(this.tooltipFeature, context); + this.rowEditStyleFeature = this.destroyBean(this.rowEditStyleFeature, context); + }); + this.addManagedPropertyListeners(["rowStyle", "getRowStyle", "rowClass", "getRowClass", "rowClassRules"], this.postProcessCss.bind(this)); + this.addManagedPropertyListener("rowDragEntireRow", () => { + const useRowDragEntireRow = gos.get("rowDragEntireRow"); + if (useRowDragEntireRow) { + for (const gui of this.allRowGuis) { + this.addRowDraggerToRow(gui); + } + return; + } + this.rowDragComps = this.destroyBeans(this.rowDragComps, context); + }); + this.addListenersForCellComps(); + } + addListenersForCellComps() { + this.addManagedListeners(this.rowNode, { + rowIndexChanged: () => { + for (const cellCtrl of this.getAllCellCtrls()) { + cellCtrl.onRowIndexChanged(); + } + }, + cellChanged: (event) => { + for (const cellCtrl of this.getAllCellCtrls()) { + cellCtrl.onCellChanged(event); + } + } + }); + } + onRowPinned() { + for (const gui of this.allRowGuis) { + gui.rowComp.toggleCss("ag-row-pinned-source", !!this.rowNode.pinnedSibling); + } + } + onRowNodeDataChanged(event) { + this.refreshRow({ + suppressFlash: !event.update, + newData: !event.update + }); + } + refreshRow(params) { + const fullWidthChanged = this.isFullWidth() !== !!this.isNodeFullWidthCell(); + if (fullWidthChanged) { + this.beans.rowRenderer.redrawRow(this.rowNode); + return; + } + if (this.isFullWidth()) { + const refresh = this.refreshFullWidth(); + if (!refresh) { + this.beans.rowRenderer.redrawRow(this.rowNode); + } + return; + } + for (const cellCtrl of this.getAllCellCtrls()) { + cellCtrl.refreshCell(params); + } + for (const gui of this.allRowGuis) { + this.setRowCompRowId(gui.rowComp); + this.updateRowBusinessKey(); + this.setRowCompRowBusinessKey(gui.rowComp); + } + this.onRowSelected(); + this.postProcessCss(); + } + postProcessCss() { + this.setStylesFromGridOptions(true); + this.postProcessClassesFromGridOptions(); + this.postProcessRowClassRules(); + this.rowEditStyleFeature?.applyRowStyles(); + this.postProcessRowDragging(); + } + onRowNodeHighlightChanged() { + const rowDropHighlightSvc = this.beans.rowDropHighlightSvc; + const highlighted = rowDropHighlightSvc?.row === this.rowNode ? rowDropHighlightSvc.position : "none"; + const aboveOn = highlighted === "above"; + const insideOn = highlighted === "inside"; + const belowOn = highlighted === "below"; + const highlightActive = highlighted !== "none"; + const dropEdge = aboveOn || belowOn; + const uiLevel = this.rowNode.uiLevel; + const shouldIndent = dropEdge && uiLevel > 0; + const highlightLevel = shouldIndent ? uiLevel.toString() : "0"; + for (const gui of this.allRowGuis) { + const rowComp = gui.rowComp; + rowComp.toggleCss("ag-row-highlight-above", aboveOn); + rowComp.toggleCss("ag-row-highlight-inside", insideOn); + rowComp.toggleCss("ag-row-highlight-below", belowOn); + rowComp.toggleCss("ag-row-highlight-indent", shouldIndent); + if (highlightActive) { + gui.element.style.setProperty("--ag-row-highlight-level", highlightLevel); + } else { + gui.element.style.removeProperty("--ag-row-highlight-level"); + } + } + } + postProcessRowDragging() { + const dragging = this.rowNode.dragging; + for (const gui of this.allRowGuis) { + gui.rowComp.toggleCss("ag-row-dragging", dragging); + } + } + onDisplayedColumnsChanged() { + this.updateColumnLists(true); + this.beans.rowAutoHeight?.requestCheckAutoHeight(); + } + onVirtualColumnsChanged() { + this.updateColumnLists(false, true); + } + getRowPosition() { + return { + rowPinned: _makeNull(this.rowNode.rowPinned), + rowIndex: this.rowNode.rowIndex + }; + } + onKeyboardNavigate(keyboardEvent) { + const groupInfo = this.findFullWidthInfoForEvent(keyboardEvent); + if (!groupInfo) { + return; + } + const { rowGui, column } = groupInfo; + const currentFullWidthContainer = rowGui.element; + const isFullWidthContainerFocused = currentFullWidthContainer === keyboardEvent.target; + if (!isFullWidthContainerFocused) { + return; + } + const node = this.rowNode; + const { focusSvc, navigation } = this.beans; + const lastFocusedCell = focusSvc.getFocusedCell(); + const cellPosition = { + rowIndex: node.rowIndex, + rowPinned: node.rowPinned, + column: lastFocusedCell?.column ?? column + }; + navigation?.navigateToNextCell(keyboardEvent, keyboardEvent.key, cellPosition, true); + keyboardEvent.preventDefault(); + } + onTabKeyDown(keyboardEvent) { + if (keyboardEvent.defaultPrevented || _isStopPropagationForAgGrid(keyboardEvent)) { + return; + } + const currentFullWidthComp = this.allRowGuis.find((c) => c.element.contains(keyboardEvent.target)); + const currentFullWidthContainer = currentFullWidthComp ? currentFullWidthComp.element : null; + const isFullWidthContainerFocused = currentFullWidthContainer === keyboardEvent.target; + const activeEl = _getActiveDomElement(this.beans); + let isDetailGridCellFocused = false; + if (currentFullWidthContainer && activeEl) { + isDetailGridCellFocused = currentFullWidthContainer.contains(activeEl) && activeEl.classList.contains("ag-cell"); + } + let nextEl = null; + if (!isFullWidthContainerFocused && !isDetailGridCellFocused) { + nextEl = _findNextFocusableElement(this.beans, currentFullWidthContainer, false, keyboardEvent.shiftKey); + } + if (this.isFullWidth() && isFullWidthContainerFocused || !nextEl) { + this.beans.navigation?.onTabKeyDown(this, keyboardEvent); + } + } + getFullWidthElement() { + if (this.fullWidthGui) { + return this.fullWidthGui.element; + } + return null; + } + getRowYPosition() { + const displayedEl = this.allRowGuis.find((el) => _isVisible(el.element))?.element; + if (displayedEl) { + return displayedEl.getBoundingClientRect().top; + } + return 0; + } + onSuppressCellFocusChanged(suppressCellFocus) { + const tabIndex = this.isFullWidth() && suppressCellFocus ? undefined : this.gos.get("tabIndex"); + for (const gui of this.allRowGuis) { + _addOrRemoveAttribute(gui.element, "tabindex", tabIndex); + } + } + setupFocus() { + if (!this.isFullWidth()) { + return; + } + this.restoreFullWidthFocus(true); + this.onFullWidthRowFocused(this.focusEventWhileNotReady ?? undefined); + } + restoreFullWidthFocus(waitForRender = false) { + const { focusSvc, editSvc } = this.beans; + if (editSvc?.isEditing(this)) { + return; + } + if (!focusSvc.isRowFocused(this.rowNode.rowIndex, this.rowNode.rowPinned) || !focusSvc.shouldTakeFocus()) { + return; + } + const targetGui = this.getFullWidthRowGuiForFocus(); + if (!targetGui) { + return; + } + const focus = () => { + if (!this.isAlive()) { + return; + } + if (focusSvc.isRowFocused(this.rowNode.rowIndex, this.rowNode.rowPinned)) { + targetGui.element.focus({ preventScroll: true }); + } + }; + if (waitForRender) { + setTimeout(focus, 0); + return; + } + focus(); + } + getFullWidthRowGuiForFocus(event) { + if (this.fullWidthGui) { + return this.fullWidthGui; + } + const focusedCell = this.beans.focusSvc.getFocusedCell(); + const column = this.beans.colModel.getCol(event?.column ?? focusedCell?.column); + if (!column) { + return; + } + const pinned = column?.pinned; + if (pinned === "right") { + return this.rightGui; + } + if (pinned === "left") { + return this.leftGui; + } + return this.centerGui; + } + setFullWidthRowFocusedClass(targetGui, isFocused) { + this.forEachGui(undefined, (gui) => { + gui.element.classList.toggle("ag-full-width-focus", isFocused && gui === targetGui); + }); + } + onFullWidthRowFocused(event) { + const { focusSvc } = this.beans; + const isFocused = this.isFullWidth() && focusSvc.isRowFocused(this.rowNode.rowIndex, this.rowNode.rowPinned); + if (!isFocused) { + this.setFullWidthRowFocusedClass(undefined, false); + return; + } + const targetGui = this.getFullWidthRowGuiForFocus(event); + if (!targetGui) { + if (event) { + this.focusEventWhileNotReady = event; + } + this.setFullWidthRowFocusedClass(undefined, false); + return; + } + this.setFullWidthRowFocusedClass(targetGui, true); + this.focusEventWhileNotReady = null; + if (event?.forceBrowserFocus) { + targetGui.element.focus({ preventScroll: true }); + } + } + recreateCell(cellCtrl) { + this.centerCellCtrls = this.removeCellCtrl(this.centerCellCtrls, cellCtrl); + this.leftCellCtrls = this.removeCellCtrl(this.leftCellCtrls, cellCtrl); + this.rightCellCtrls = this.removeCellCtrl(this.rightCellCtrls, cellCtrl); + cellCtrl.destroy(); + this.updateColumnLists(); + } + removeCellCtrl(prev, cellCtrlToRemove) { + const res = { + list: [], + map: {} + }; + for (const cellCtrl of prev.list) { + if (cellCtrl === cellCtrlToRemove) { + continue; + } + res.list.push(cellCtrl); + res.map[cellCtrl.column.getInstanceId()] = cellCtrl; + } + return res; + } + onMouseEvent(eventName, mouseEvent) { + switch (eventName) { + case "dblclick": + this.onRowDblClick(mouseEvent); + break; + case "click": + this.onRowClick(mouseEvent); + break; + case "pointerdown": + case "touchstart": + case "mousedown": + this.onRowMouseDown(mouseEvent); + break; + } + } + createRowEvent(type, domEvent) { + const { rowNode } = this; + return _addGridCommonParams(this.gos, { + type, + node: rowNode, + data: rowNode.data, + rowIndex: rowNode.rowIndex, + rowPinned: rowNode.rowPinned, + event: domEvent + }); + } + createRowEventWithSource(type, domEvent) { + const event = this.createRowEvent(type, domEvent); + event.source = this; + return event; + } + onRowDblClick(mouseEvent) { + if (_isStopPropagationForAgGrid(mouseEvent)) { + return; + } + const rowEvent = this.createRowEventWithSource("rowDoubleClicked", mouseEvent); + rowEvent.isEventHandlingSuppressed = this.isSuppressMouseEvent(mouseEvent); + this.beans.eventSvc.dispatchEvent(rowEvent); + } + findFullWidthInfoForEvent(event) { + if (!event) { + return; + } + const rowGui = this.findFullWidthRowGui(event.target); + const column = this.getColumnForFullWidth(rowGui); + if (!rowGui || !column) { + return; + } + return { rowGui, column }; + } + findFullWidthRowGui(target) { + return this.allRowGuis.find((c) => c.element.contains(target)); + } + getColumnForFullWidth(fullWidthRowGui) { + const { visibleCols } = this.beans; + switch (fullWidthRowGui?.containerType) { + case "center": + return visibleCols.centerCols[0]; + case "left": + return visibleCols.leftCols[0]; + case "right": + return visibleCols.rightCols[0]; + default: + return visibleCols.allCols[0]; + } + } + onRowMouseDown(mouseEvent) { + this.lastMouseDownOnDragger = _isElementChildOfClass(mouseEvent.target, "ag-row-drag", 3); + if (!this.isFullWidth() || this.isSuppressMouseEvent(mouseEvent)) { + return; + } + const { rangeSvc, focusSvc } = this.beans; + rangeSvc?.removeAllCellRanges(); + const groupInfo = this.findFullWidthInfoForEvent(mouseEvent); + if (!groupInfo) { + return; + } + const { rowGui, column } = groupInfo; + const element = rowGui.element; + const target = mouseEvent.target; + const node = this.rowNode; + let forceBrowserFocus = mouseEvent.defaultPrevented || _isBrowserSafari(); + if (element && element.contains(target) && _isFocusableFormField(target)) { + forceBrowserFocus = false; + } + focusSvc.setFocusedCell({ + rowIndex: node.rowIndex, + column, + rowPinned: node.rowPinned, + forceBrowserFocus + }); + } + isSuppressMouseEvent(mouseEvent) { + const { gos, rowNode } = this; + if (this.isFullWidth()) { + const fullWidthRowGui = this.findFullWidthRowGui(mouseEvent.target); + return _suppressFullWidthMouseEvent(gos, fullWidthRowGui?.rowComp.getFullWidthCellRendererParams(), rowNode, mouseEvent); + } + const cellCtrl = _getCellCtrlForEventTarget(gos, mouseEvent.target); + return cellCtrl != null && _suppressCellMouseEvent(gos, cellCtrl.column, rowNode, mouseEvent); + } + onRowClick(mouseEvent) { + const stop = _isStopPropagationForAgGrid(mouseEvent) || this.lastMouseDownOnDragger; + if (stop) { + return; + } + const isSuppressMouseEvent = this.isSuppressMouseEvent(mouseEvent); + const { eventSvc, selectionSvc } = this.beans; + const rowEvent = this.createRowEventWithSource("rowClicked", mouseEvent); + rowEvent.isEventHandlingSuppressed = isSuppressMouseEvent; + eventSvc.dispatchEvent(rowEvent); + if (isSuppressMouseEvent) { + return; + } + selectionSvc?.handleSelectionEvent(mouseEvent, this.rowNode, "rowClicked"); + } + setupDetailRowAutoHeight(eDetailGui) { + if (this.rowType !== "FullWidthDetail") { + return; + } + this.beans.masterDetailSvc?.setupDetailRowAutoHeight(this, eDetailGui); + } + createFullWidthCompDetails(eRow, pinned) { + const { gos, rowNode } = this; + const params = _addGridCommonParams(gos, { + fullWidth: true, + data: rowNode.data, + node: rowNode, + value: rowNode.key, + valueFormatted: rowNode.key, + eGridCell: eRow, + eParentOfValue: eRow, + pinned, + addRenderedRowListener: this.addEventListener.bind(this), + registerRowDragger: (rowDraggerElement, dragStartPixels, value, rowDragEntireRow) => this.addFullWidthRowDragging(rowDraggerElement, dragStartPixels, value, rowDragEntireRow), + setTooltip: (value, shouldDisplayTooltip) => { + gos.assertModuleRegistered("Tooltip", 3); + this.setupFullWidthRowTooltip(value, shouldDisplayTooltip); + } + }); + const compFactory = this.beans.userCompFactory; + switch (this.rowType) { + case "FullWidthDetail": + return _getFullWidthDetailCellRendererDetails(compFactory, params); + case "FullWidthGroup": { + const { value, valueFormatted } = this.beans.valueSvc.getValueForDisplay({ + node: this.rowNode, + includeValueFormatted: true, + from: "edit" + }); + params.value = value; + params.valueFormatted = valueFormatted; + return _getFullWidthGroupCellRendererDetails(compFactory, params); + } + case "FullWidthLoading": + return _getFullWidthLoadingCellRendererDetails(compFactory, params); + default: + return _getFullWidthCellRendererDetails(compFactory, params); + } + } + setupFullWidthRowTooltip(value, shouldDisplayTooltip) { + if (!this.fullWidthGui) { + return; + } + this.tooltipFeature = this.beans.tooltipSvc?.setupFullWidthRowTooltip(this.tooltipFeature, this, value, shouldDisplayTooltip); + } + addFullWidthRowDragging(rowDraggerElement, dragStartPixels, value = "", alwaysVisible) { + const { rowDragSvc, context } = this.beans; + if (!rowDragSvc || !this.isFullWidth()) { + return; + } + const rowDragComp = rowDragSvc.createRowDragComp(() => value, this.rowNode, undefined, rowDraggerElement, dragStartPixels, alwaysVisible); + this.createBean(rowDragComp, context); + this.addDestroyFunc(() => { + this.destroyBean(rowDragComp, context); + }); + } + onUiLevelChanged() { + const newLevel = calculateRowLevel(this.rowNode); + if (this.rowLevel != newLevel) { + const classToAdd = "ag-row-level-" + newLevel; + const classToRemove = "ag-row-level-" + this.rowLevel; + for (const gui of this.allRowGuis) { + gui.rowComp.toggleCss(classToAdd, true); + gui.rowComp.toggleCss(classToRemove, false); + } + } + this.rowLevel = newLevel; + } + isFirstRowOnPage() { + return this.rowNode.rowIndex === this.beans.pageBounds.getFirstRow(); + } + isLastRowOnPage() { + return this.rowNode.rowIndex === this.beans.pageBounds.getLastRow(); + } + refreshFirstAndLastRowStyles() { + const newFirst = this.isFirstRowOnPage(); + const newLast = this.isLastRowOnPage(); + if (this.firstRowOnPage !== newFirst) { + this.firstRowOnPage = newFirst; + for (const gui of this.allRowGuis) { + gui.rowComp.toggleCss("ag-row-first", newFirst); + } + } + if (this.lastRowOnPage !== newLast) { + this.lastRowOnPage = newLast; + for (const gui of this.allRowGuis) { + gui.rowComp.toggleCss("ag-row-last", newLast); + } + } + } + getAllCellCtrls() { + if (this.leftCellCtrls.list.length === 0 && this.rightCellCtrls.list.length === 0) { + return this.centerCellCtrls.list; + } + const res = [...this.centerCellCtrls.list, ...this.leftCellCtrls.list, ...this.rightCellCtrls.list]; + return res; + } + postProcessClassesFromGridOptions() { + const cssClasses = []; + this.beans.rowStyleSvc?.processClassesFromGridOptions(cssClasses, this.rowNode); + if (!cssClasses.length) { + return; + } + for (const classStr of cssClasses) { + for (const c of this.allRowGuis) { + c.rowComp.toggleCss(classStr, true); + } + } + } + postProcessRowClassRules() { + this.beans.rowStyleSvc?.processRowClassRules(this.rowNode, (className) => { + for (const gui of this.allRowGuis) { + gui.rowComp.toggleCss(className, true); + } + }, (className) => { + for (const gui of this.allRowGuis) { + gui.rowComp.toggleCss(className, false); + } + }); + } + setStylesFromGridOptions(updateStyles, gui) { + if (updateStyles) { + this.rowStyles = this.processStylesFromGridOptions(); + } + this.forEachGui(gui, (gui2) => gui2.rowComp.setUserStyles(this.rowStyles)); + } + getPinnedForContainer(rowContainerType) { + if (rowContainerType === "left" || rowContainerType === "right") { + return rowContainerType; + } + return null; + } + getInitialRowClasses(rowContainerType) { + const pinned = this.getPinnedForContainer(rowContainerType); + const fullWidthRow = this.isFullWidth(); + const { rowNode, beans } = this; + const classes = []; + classes.push("ag-row"); + classes.push(this.rowFocused ? "ag-row-focus" : "ag-row-no-focus"); + if (this.fadeInAnimation[rowContainerType]) { + classes.push("ag-opacity-zero"); + } + classes.push(rowNode.rowIndex % 2 === 0 ? "ag-row-even" : "ag-row-odd"); + if (rowNode.isRowPinned()) { + classes.push("ag-row-pinned"); + if (beans.pinnedRowModel?.isManual()) { + classes.push("ag-row-pinned-manual"); + } + } + if (!rowNode.isRowPinned() && rowNode.pinnedSibling) { + classes.push("ag-row-pinned-source"); + } + if (rowNode.isSelected()) { + classes.push("ag-row-selected"); + } + if (rowNode.footer) { + classes.push("ag-row-footer"); + } + classes.push("ag-row-level-" + this.rowLevel); + if (rowNode.stub) { + classes.push("ag-row-loading"); + } + if (fullWidthRow) { + classes.push("ag-full-width-row"); + } + beans.expansionSvc?.addExpandedCss(classes, rowNode); + if (rowNode.dragging) { + classes.push("ag-row-dragging"); + } + const { rowStyleSvc } = beans; + if (rowStyleSvc) { + rowStyleSvc.processClassesFromGridOptions(classes, rowNode); + rowStyleSvc.preProcessRowClassRules(classes, rowNode); + } + classes.push(this.printLayout ? "ag-row-position-relative" : "ag-row-position-absolute"); + if (this.isFirstRowOnPage()) { + classes.push("ag-row-first"); + } + if (this.isLastRowOnPage()) { + classes.push("ag-row-last"); + } + if (fullWidthRow) { + if (pinned === "left") { + classes.push("ag-cell-last-left-pinned"); + } + if (pinned === "right") { + classes.push("ag-cell-first-right-pinned"); + } + } + return classes; + } + processStylesFromGridOptions() { + return this.beans.rowStyleSvc?.processStylesFromGridOptions(this.rowNode) ?? this.emptyStyle; + } + onRowSelected(gui) { + this.beans.selectionSvc?.onRowCtrlSelected(this, (gui2) => { + if (gui2 === this.centerGui || gui2 === this.fullWidthGui) { + this.announceDescription(); + } + }, gui); + } + announceDescription() { + this.beans.selectionSvc?.announceAriaRowSelection(this.rowNode); + } + addHoverFunctionality(eGui) { + if (!this.active) { + return; + } + const { element, compBean } = eGui; + const { rowNode, beans, gos } = this; + compBean.addManagedListeners(element, { + pointerenter: (e) => { + if (e.pointerType === "mouse") { + rowNode.dispatchRowEvent("mouseEnter"); + } + }, + pointerleave: (e) => { + if (e.pointerType === "mouse") { + rowNode.dispatchRowEvent("mouseLeave"); + } + } + }); + compBean.addManagedListeners(rowNode, { + mouseEnter: () => { + if (!beans.dragSvc?.dragging && !gos.get("suppressRowHoverHighlight")) { + element.classList.add("ag-row-hover"); + rowNode.setHovered(true); + } + }, + mouseLeave: () => { + this.resetHoveredStatus(element); + } + }); + } + resetHoveredStatus(el) { + const elements = el ? [el] : this.allRowGuis.map((gui) => gui.element); + for (const element of elements) { + element.classList.remove("ag-row-hover"); + } + this.rowNode.setHovered(false); + } + roundRowTopToBounds(rowTop) { + const range = this.beans.ctrlsSvc.getScrollFeature().getApproximateVScollPosition(); + const minPixel = this.applyPaginationOffset(range.top, true) - 100; + const maxPixel = this.applyPaginationOffset(range.bottom, true) + 100; + return Math.min(Math.max(minPixel, rowTop), maxPixel); + } + forEachGui(gui, callback) { + if (gui) { + callback(gui); + } else { + for (const gui2 of this.allRowGuis) { + callback(gui2); + } + } + } + isRowRendered() { + return this.allRowGuis.length > 0; + } + onRowHeightChanged(gui) { + if (this.rowNode.rowHeight == null) { + return; + } + const rowHeight = this.rowNode.rowHeight; + const defaultRowHeight = this.beans.environment.getDefaultRowHeight(); + const isHeightFromFunc = _isGetRowHeightFunction(this.gos); + const heightFromFunc = isHeightFromFunc ? _getRowHeightForNode(this.beans, this.rowNode).height : undefined; + const lineHeight = heightFromFunc ? `${Math.min(defaultRowHeight, heightFromFunc) - 2}px` : undefined; + this.forEachGui(gui, (gui2) => { + gui2.element.style.height = `${rowHeight}px`; + if (lineHeight) { + gui2.element.style.setProperty("--ag-line-height", lineHeight); + } + }); + } + destroyFirstPass(suppressAnimation = false) { + this.active = false; + const { rowNode } = this; + if (!suppressAnimation && _isAnimateRows(this.gos) && !rowNode.sticky) { + const rowStillVisibleJustNotInViewport = rowNode.rowTop != null; + if (rowStillVisibleJustNotInViewport) { + const rowTop = this.roundRowTopToBounds(rowNode.rowTop); + this.setRowTop(rowTop); + } else { + for (const gui of this.allRowGuis) { + gui.rowComp.toggleCss("ag-opacity-zero", true); + } + } + } + if (this.fullWidthGui?.element.contains(_getActiveDomElement(this.beans))) { + this.beans.focusSvc.attemptToRecoverFocus(); + } + rowNode.setHovered(false); + const event = this.createRowEvent("virtualRowRemoved"); + this.dispatchLocalEvent(event); + this.beans.eventSvc.dispatchEvent(event); + super.destroy(); + } + destroySecondPass() { + this.allRowGuis.length = 0; + const destroyCellCtrls = (ctrls) => { + for (const c of ctrls.list) { + c.destroy(); + } + return { list: [], map: {} }; + }; + this.centerCellCtrls = destroyCellCtrls(this.centerCellCtrls); + this.leftCellCtrls = destroyCellCtrls(this.leftCellCtrls); + this.rightCellCtrls = destroyCellCtrls(this.rightCellCtrls); + } + setFocusedClasses(gui) { + this.forEachGui(gui, (gui2) => { + gui2.rowComp.toggleCss("ag-row-focus", this.rowFocused); + gui2.rowComp.toggleCss("ag-row-no-focus", !this.rowFocused); + }); + } + onCellFocusChanged() { + const { focusSvc } = this.beans; + const rowFocused = focusSvc.isRowFocused(this.rowNode.rowIndex, this.rowNode.rowPinned); + if (rowFocused !== this.rowFocused) { + this.rowFocused = rowFocused; + this.setFocusedClasses(); + } + } + onPaginationChanged() { + const currentPage = this.beans.pagination?.getCurrentPage() ?? 0; + if (this.paginationPage !== currentPage) { + this.paginationPage = currentPage; + this.onTopChanged(); + } + this.refreshFirstAndLastRowStyles(); + } + onTopChanged() { + this.setRowTop(this.rowNode.rowTop); + } + onPaginationPixelOffsetChanged() { + this.onTopChanged(); + } + applyPaginationOffset(topPx, reverse = false) { + if (this.rowNode.isRowPinned() || this.rowNode.sticky) { + return topPx; + } + const pixelOffset = this.beans.pageBounds.getPixelOffset(); + const multiplier = reverse ? 1 : -1; + return topPx + pixelOffset * multiplier; + } + setRowTop(pixels) { + if (this.printLayout) { + return; + } + if (_exists(pixels)) { + const afterPaginationPixels = this.applyPaginationOffset(pixels); + const skipScaling = this.rowNode.isRowPinned() || this.rowNode.sticky; + const afterScalingPixels = skipScaling ? afterPaginationPixels : this.beans.rowContainerHeight.getRealPixelPosition(afterPaginationPixels); + const topPx = `${afterScalingPixels}px`; + this.setRowTopStyle(topPx); + } + } + getInitialRowTop(rowContainerType) { + return this.suppressRowTransform ? this.getInitialRowTopShared(rowContainerType) : undefined; + } + getInitialTransform(rowContainerType) { + return this.suppressRowTransform ? undefined : `translateY(${this.getInitialRowTopShared(rowContainerType)})`; + } + getInitialRowTopShared(rowContainerType) { + if (this.printLayout) { + return ""; + } + const rowNode = this.rowNode; + let rowTop; + if (rowNode.sticky) { + rowTop = rowNode.stickyRowTop; + } else { + const pixels = this.slideInAnimation[rowContainerType] ? this.roundRowTopToBounds(rowNode.oldRowTop) : rowNode.rowTop; + const afterPaginationPixels = this.applyPaginationOffset(pixels); + rowTop = rowNode.isRowPinned() ? afterPaginationPixels : this.beans.rowContainerHeight.getRealPixelPosition(afterPaginationPixels); + } + return rowTop + "px"; + } + setRowTopStyle(topPx) { + for (const gui of this.allRowGuis) { + if (this.suppressRowTransform) { + gui.rowComp.setTop(topPx); + } else { + gui.rowComp.setTransform(`translateY(${topPx})`); + } + } + } + getCellCtrl(column, skipColSpanSearch = false) { + let res = null; + for (const cellCtrl of this.getAllCellCtrls()) { + if (cellCtrl.column == column) { + res = cellCtrl; + } + } + if (res != null || skipColSpanSearch) { + return res; + } + for (const cellCtrl of this.getAllCellCtrls()) { + if (cellCtrl?.getColSpanningList().indexOf(column) >= 0) { + res = cellCtrl; + } + } + return res; + } + onRowIndexChanged() { + if (this.rowNode.rowIndex != null) { + this.onCellFocusChanged(); + this.updateRowIndexes(); + this.postProcessCss(); + } + } + updateRowIndexes(gui) { + const rowIndexStr = this.rowNode.getRowIndexString(); + if (rowIndexStr === null) { + return; + } + const headerRowCount = (this.beans.ctrlsSvc.getHeaderRowContainerCtrl()?.getRowCount() ?? 0) + (this.beans.filterManager?.getHeaderRowCount() ?? 0); + const rowIsEven = this.rowNode.rowIndex % 2 === 0; + const ariaRowIndex = this.ariaRowIndex = headerRowCount + this.rowNode.rowIndex + 1; + this.forEachGui(gui, (c) => { + c.rowComp.setRowIndex(rowIndexStr); + c.rowComp.toggleCss("ag-row-even", rowIsEven); + c.rowComp.toggleCss("ag-row-odd", !rowIsEven); + _setAriaRowIndex(c.element, ariaRowIndex); + }); + } +}; +var NavigationService = class extends BeanStub { + constructor() { + super(); + this.beanName = "navigation"; + this.onPageDown = _throttle(this.onPageDown, 100); + this.onPageUp = _throttle(this.onPageUp, 100); + } + postConstruct() { + this.beans.ctrlsSvc.whenReady(this, (p) => { + this.gridBodyCon = p.gridBodyCtrl; + }); + } + handlePageScrollingKey(event, fromFullWidth = false) { + const key = event.key; + const alt = event.altKey; + const ctrl = event.ctrlKey || event.metaKey; + const rangeServiceShouldHandleShift = !!this.beans.rangeSvc && event.shiftKey; + const currentCell = _getCellPositionForEvent(this.gos, event); + let processed = false; + switch (key) { + case KeyCode.PAGE_HOME: + case KeyCode.PAGE_END: + if (!ctrl && !alt) { + this.onHomeOrEndKey(key); + processed = true; + } + break; + case KeyCode.LEFT: + case KeyCode.RIGHT: + case KeyCode.UP: + case KeyCode.DOWN: + if (!currentCell) { + return false; + } + if (ctrl && !alt && !rangeServiceShouldHandleShift) { + this.onCtrlUpDownLeftRight(key, currentCell); + processed = true; + } + break; + case KeyCode.PAGE_DOWN: + case KeyCode.PAGE_UP: + if (!ctrl && !alt) { + processed = this.handlePageUpDown(key, currentCell, fromFullWidth); + } + break; + } + if (processed) { + event.preventDefault(); + } + return processed; + } + handlePageUpDown(key, currentCell, fromFullWidth) { + if (fromFullWidth) { + currentCell = this.beans.focusSvc.getFocusedCell(); + } + if (!currentCell) { + return false; + } + if (key === KeyCode.PAGE_UP) { + this.onPageUp(currentCell); + } else { + this.onPageDown(currentCell); + } + return true; + } + navigateTo({ + scrollIndex, + scrollType, + scrollColumn, + focusIndex, + focusColumn, + isAsync, + rowPinned + }) { + const { scrollFeature } = this.gridBodyCon; + if (_exists(scrollColumn) && !scrollColumn.isPinned()) { + scrollFeature.ensureColumnVisible(scrollColumn); + } + if (_exists(scrollIndex)) { + scrollFeature.ensureIndexVisible(scrollIndex, scrollType); + } + if (!isAsync) { + scrollFeature.ensureIndexVisible(focusIndex); + } + const { focusSvc } = this.beans; + focusSvc.setFocusedCell({ + rowIndex: focusIndex, + column: focusColumn, + rowPinned, + forceBrowserFocus: true + }); + this.setRangeToCellIfSupported({ rowIndex: focusIndex, rowPinned, column: focusColumn }); + } + onPageDown(gridCell) { + const beans = this.beans; + const scrollPosition = getVScroll(beans); + const pixelsInOnePage = this.getViewportHeight(); + const { pageBounds, rowModel, rowAutoHeight } = beans; + const pagingPixelOffset = pageBounds.getPixelOffset(); + const currentPageBottomPixel = scrollPosition.top + pixelsInOnePage; + const currentPageBottomRow = rowModel.getRowIndexAtPixel(currentPageBottomPixel + pagingPixelOffset); + if (rowAutoHeight?.active) { + this.navigateToNextPageWithAutoHeight(gridCell, currentPageBottomRow); + } else { + this.navigateToNextPage(gridCell, currentPageBottomRow); + } + } + onPageUp(gridCell) { + const beans = this.beans; + const scrollPosition = getVScroll(beans); + const { pageBounds, rowModel, rowAutoHeight } = beans; + const pagingPixelOffset = pageBounds.getPixelOffset(); + const currentPageTopPixel = scrollPosition.top; + const currentPageTopRow = rowModel.getRowIndexAtPixel(currentPageTopPixel + pagingPixelOffset); + if (rowAutoHeight?.active) { + this.navigateToNextPageWithAutoHeight(gridCell, currentPageTopRow, true); + } else { + this.navigateToNextPage(gridCell, currentPageTopRow, true); + } + } + navigateToNextPage(gridCell, scrollIndex, up = false) { + const { pageBounds, rowModel } = this.beans; + const pixelsInOnePage = this.getViewportHeight(); + const firstRow = pageBounds.getFirstRow(); + const lastRow = pageBounds.getLastRow(); + const pagingPixelOffset = pageBounds.getPixelOffset(); + const currentRowNode = rowModel.getRow(gridCell.rowIndex); + const rowPixelDiff = up ? currentRowNode?.rowHeight - pixelsInOnePage - pagingPixelOffset : pixelsInOnePage - pagingPixelOffset; + const nextCellPixel = currentRowNode?.rowTop + rowPixelDiff; + let focusIndex = rowModel.getRowIndexAtPixel(nextCellPixel + pagingPixelOffset); + if (focusIndex === gridCell.rowIndex) { + const diff = up ? -1 : 1; + scrollIndex = focusIndex = gridCell.rowIndex + diff; + } + let scrollType; + if (up) { + scrollType = "bottom"; + if (focusIndex < firstRow) { + focusIndex = firstRow; + } + if (scrollIndex < firstRow) { + scrollIndex = firstRow; + } + } else { + scrollType = "top"; + if (focusIndex > lastRow) { + focusIndex = lastRow; + } + if (scrollIndex > lastRow) { + scrollIndex = lastRow; + } + } + if (this.isRowTallerThanView(rowModel.getRow(focusIndex))) { + scrollIndex = focusIndex; + scrollType = "top"; + } + this.navigateTo({ + scrollIndex, + scrollType, + scrollColumn: null, + focusIndex, + focusColumn: gridCell.column + }); + } + navigateToNextPageWithAutoHeight(gridCell, scrollIndex, up = false) { + this.navigateTo({ + scrollIndex, + scrollType: up ? "bottom" : "top", + scrollColumn: null, + focusIndex: scrollIndex, + focusColumn: gridCell.column + }); + setTimeout(() => { + const focusIndex = this.getNextFocusIndexForAutoHeight(gridCell, up); + this.navigateTo({ + scrollIndex, + scrollType: up ? "bottom" : "top", + scrollColumn: null, + focusIndex, + focusColumn: gridCell.column, + isAsync: true + }); + }, 50); + } + getNextFocusIndexForAutoHeight(gridCell, up = false) { + const step = up ? -1 : 1; + const pixelsInOnePage = this.getViewportHeight(); + const { pageBounds, rowModel } = this.beans; + const lastRowIndex = pageBounds.getLastRow(); + let pixelSum = 0; + let currentIndex = gridCell.rowIndex; + while (currentIndex >= 0 && currentIndex <= lastRowIndex) { + const currentCell = rowModel.getRow(currentIndex); + if (currentCell) { + const currentCellHeight = currentCell.rowHeight ?? 0; + if (pixelSum + currentCellHeight > pixelsInOnePage) { + break; + } + pixelSum += currentCellHeight; + } + currentIndex += step; + } + return Math.max(0, Math.min(currentIndex, lastRowIndex)); + } + getViewportHeight() { + const beans = this.beans; + const scrollPosition = getVScroll(beans); + const scrollbarWidth = this.beans.scrollVisibleSvc.getScrollbarWidth(); + let pixelsInOnePage = scrollPosition.bottom - scrollPosition.top; + if (beans.ctrlsSvc.get("center").isHorizontalScrollShowing()) { + pixelsInOnePage -= scrollbarWidth; + } + return pixelsInOnePage; + } + isRowTallerThanView(rowNode) { + if (!rowNode) { + return false; + } + const rowHeight = rowNode.rowHeight; + if (typeof rowHeight !== "number") { + return false; + } + return rowHeight > this.getViewportHeight(); + } + onCtrlUpDownLeftRight(key, gridCell) { + const cellToFocus = this.beans.cellNavigation.getNextCellToFocus(key, gridCell, true); + if (!cellToFocus) { + return; + } + const normalisedPosition = this.getNormalisedPosition(cellToFocus); + const { rowIndex, rowPinned, column } = normalisedPosition ?? cellToFocus; + const col = column; + this.navigateTo({ + scrollIndex: rowIndex, + scrollType: null, + scrollColumn: col, + focusIndex: rowIndex, + focusColumn: col, + rowPinned + }); + } + onHomeOrEndKey(key) { + const homeKey = key === KeyCode.PAGE_HOME; + const { visibleCols, pageBounds, rowModel } = this.beans; + const allColumns = visibleCols.allCols; + const scrollIndex = homeKey ? pageBounds.getFirstRow() : pageBounds.getLastRow(); + const rowNode = rowModel.getRow(scrollIndex); + if (!rowNode) { + return; + } + const columnToSelect = (homeKey ? allColumns : [...allColumns].reverse()).find((col) => !col.isSuppressNavigable(rowNode) && !isRowNumberCol(col)); + if (!columnToSelect) { + return; + } + this.navigateTo({ + scrollIndex, + scrollType: null, + scrollColumn: columnToSelect, + focusIndex: scrollIndex, + focusColumn: columnToSelect + }); + } + onTabKeyDown(previous, keyboardEvent) { + const backwards = keyboardEvent.shiftKey; + const movedToNextCell = this.tabToNextCellCommon(previous, backwards, keyboardEvent); + const beans = this.beans; + const { ctrlsSvc, pageBounds, focusSvc, gos } = beans; + if (movedToNextCell !== false) { + if (movedToNextCell) { + keyboardEvent.preventDefault(); + } else if (movedToNextCell === null) { + ctrlsSvc.get("gridCtrl").allowFocusForNextCoreContainer(backwards); + } + return; + } + if (backwards) { + const { rowIndex, rowPinned } = previous.getRowPosition(); + const firstRow = rowPinned ? rowIndex === 0 : rowIndex === pageBounds.getFirstRow(); + if (firstRow) { + if (gos.get("headerHeight") === 0 || _isHeaderFocusSuppressed(beans)) { + _focusNextGridCoreContainer(beans, true, true); + } else { + keyboardEvent.preventDefault(); + focusSvc.focusPreviousFromFirstCell(keyboardEvent); + } + } + } else { + if (previous instanceof CellCtrl) { + previous.focusCell(true); + } + if (focusSvc.focusOverlay(false) || _focusNextGridCoreContainer(beans, backwards)) { + keyboardEvent.preventDefault(); + } + } + } + tabToNextCell(backwards, event) { + const beans = this.beans; + const { focusSvc, rowRenderer } = beans; + const focusedCell = focusSvc.getFocusedCell(); + if (!focusedCell) { + return false; + } + let cellOrRow = _getCellByPosition(beans, focusedCell); + if (!cellOrRow) { + cellOrRow = rowRenderer.getRowByPosition(focusedCell); + if (!cellOrRow?.isFullWidth()) { + return false; + } + } + return !!this.tabToNextCellCommon(cellOrRow, backwards, event, "api"); + } + tabToNextCellCommon(previous, backwards, event, source = "ui") { + const { editSvc, focusSvc } = this.beans; + let res = undefined; + const cellCtrl = previous instanceof CellCtrl ? previous : previous.getAllCellCtrls()?.[0]; + if (editSvc?.isEditing()) { + res = editSvc?.moveToNextCell(cellCtrl, backwards, event, source); + } else { + res = this.moveToNextCellNotEditing(previous, backwards, event); + } + if (res === null) { + return res; + } + return res || !!focusSvc.focusedHeader; + } + moveToNextCellNotEditing(previousCell, backwards, event) { + const displayedColumns = this.beans.visibleCols.allCols; + let cellPos; + if (previousCell instanceof RowCtrl) { + cellPos = { + ...previousCell.getRowPosition(), + column: backwards ? displayedColumns[0] : _last(displayedColumns) + }; + if (this.gos.get("embedFullWidthRows") && event) { + const focusedContainer = previousCell.findFullWidthInfoForEvent(event); + if (focusedContainer) { + cellPos.column = focusedContainer.column; + } + } + } else { + cellPos = previousCell.getFocusedCellPosition(); + } + const nextCell = this.findNextCellToFocusOn(cellPos, { backwards, startEditing: false }); + if (nextCell === false) { + return null; + } + if (nextCell instanceof CellCtrl) { + nextCell.focusCell(true); + } else if (nextCell) { + return this.tryToFocusFullWidthRow(nextCell, backwards); + } + return _exists(nextCell); + } + findNextCellToFocusOn(previousPosition, { backwards, startEditing, skipToNextEditableCell }) { + let nextPosition = previousPosition; + const beans = this.beans; + const { cellNavigation, gos, focusSvc, rowRenderer } = beans; + while (true) { + if (previousPosition !== nextPosition) { + previousPosition = nextPosition; + } + if (!backwards) { + nextPosition = this.getLastCellOfColSpan(nextPosition); + } + nextPosition = cellNavigation.getNextTabbedCell(nextPosition, backwards); + const userFunc = gos.getCallback("tabToNextCell"); + if (_exists(userFunc)) { + const params = { + backwards, + editing: startEditing, + previousCellPosition: previousPosition, + nextCellPosition: nextPosition ? nextPosition : null + }; + const userResult = userFunc(params); + if (userResult === true) { + nextPosition = previousPosition; + } else if (userResult === false) { + return false; + } else { + nextPosition = { + rowIndex: userResult.rowIndex, + column: userResult.column, + rowPinned: userResult.rowPinned + }; + } + } + if (!nextPosition) { + return null; + } + if (nextPosition.rowIndex < 0) { + const headerLen = getFocusHeaderRowCount(beans); + focusSvc.focusHeaderPosition({ + headerPosition: { + headerRowIndex: headerLen + nextPosition.rowIndex, + column: nextPosition.column + }, + fromCell: true + }); + return null; + } + const fullRowEdit = gos.get("editType") === "fullRow"; + if (startEditing && (!fullRowEdit || skipToNextEditableCell)) { + const cellIsEditable = this.isCellEditable(nextPosition); + if (!cellIsEditable) { + continue; + } + } + this.ensureCellVisible(nextPosition); + const nextCell = _getCellByPosition(beans, nextPosition); + if (!nextCell) { + const row = rowRenderer.getRowByPosition(nextPosition); + if (!row || !row.isFullWidth() || startEditing) { + continue; + } + return { ...row.getRowPosition(), column: nextPosition?.column }; + } + if (cellNavigation.isSuppressNavigable(nextCell.column, nextCell.rowNode)) { + continue; + } + nextCell.setFocusedCellPosition(nextPosition); + this.setRangeToCellIfSupported(nextPosition); + return nextCell; + } + } + isCellEditable(cell) { + const rowNode = this.lookupRowNodeForCell(cell); + if (rowNode) { + return cell.column.isCellEditable(rowNode); + } + return false; + } + lookupRowNodeForCell({ rowIndex, rowPinned }) { + const { pinnedRowModel, rowModel } = this.beans; + if (rowPinned === "top") { + return pinnedRowModel?.getPinnedTopRow(rowIndex); + } + if (rowPinned === "bottom") { + return pinnedRowModel?.getPinnedBottomRow(rowIndex); + } + return rowModel.getRow(rowIndex); + } + navigateToNextCell(event, key, currentCell, allowUserOverride) { + let nextCell = currentCell; + let hitEdgeOfGrid = false; + const beans = this.beans; + const { cellNavigation, focusSvc, gos } = beans; + while (nextCell && (nextCell === currentCell || !this.isValidNavigateCell(nextCell))) { + if (gos.get("enableRtl")) { + if (key === KeyCode.LEFT) { + nextCell = this.getLastCellOfColSpan(nextCell); + } + } else if (key === KeyCode.RIGHT) { + nextCell = this.getLastCellOfColSpan(nextCell); + } + nextCell = cellNavigation.getNextCellToFocus(key, nextCell); + hitEdgeOfGrid = _missing(nextCell); + } + if (hitEdgeOfGrid && event && event.key === KeyCode.UP) { + nextCell = { + rowIndex: -1, + rowPinned: null, + column: currentCell.column + }; + } + if (allowUserOverride) { + const userFunc = gos.getCallback("navigateToNextCell"); + if (_exists(userFunc)) { + const params = { + key, + previousCellPosition: currentCell, + nextCellPosition: nextCell ? nextCell : null, + event + }; + const userCell = userFunc(params); + if (_exists(userCell)) { + nextCell = { + rowPinned: userCell.rowPinned, + rowIndex: userCell.rowIndex, + column: userCell.column + }; + } else { + nextCell = null; + } + } + } + if (!nextCell) { + return; + } + if (nextCell.rowIndex < 0) { + const headerLen = getFocusHeaderRowCount(beans); + focusSvc.focusHeaderPosition({ + headerPosition: { + headerRowIndex: headerLen + nextCell.rowIndex, + column: nextCell.column ?? currentCell.column + }, + event: event || undefined, + fromCell: true + }); + return; + } + const normalisedPosition = this.getNormalisedPosition(nextCell); + if (normalisedPosition) { + this.focusPosition(normalisedPosition); + } else { + this.tryToFocusFullWidthRow(nextCell); + } + } + getNormalisedPosition(cellPosition) { + const isSpannedCell = !!this.beans.spannedRowRenderer?.getCellByPosition(cellPosition); + if (isSpannedCell) { + return cellPosition; + } + this.ensureCellVisible(cellPosition); + const cellCtrl = _getCellByPosition(this.beans, cellPosition); + if (!cellCtrl) { + return null; + } + cellPosition = cellCtrl.getFocusedCellPosition(); + this.ensureCellVisible(cellPosition); + return cellPosition; + } + tryToFocusFullWidthRow(position, backwards) { + const { visibleCols, rowRenderer, focusSvc, eventSvc } = this.beans; + const displayedColumns = visibleCols.allCols; + const rowComp = rowRenderer.getRowByPosition(position); + if (!rowComp?.isFullWidth()) { + return false; + } + const currentCellFocused = focusSvc.getFocusedCell(); + const cellPosition = { + rowIndex: position.rowIndex, + rowPinned: position.rowPinned, + column: position.column || (backwards ? _last(displayedColumns) : displayedColumns[0]) + }; + this.focusPosition(cellPosition); + const fromBelow = backwards == null ? currentCellFocused != null && _isRowBefore(cellPosition, currentCellFocused) : backwards; + eventSvc.dispatchEvent({ + type: "fullWidthRowFocused", + rowIndex: cellPosition.rowIndex, + rowPinned: cellPosition.rowPinned, + column: cellPosition.column, + isFullWidthCell: true, + fromBelow + }); + return true; + } + focusPosition(cellPosition) { + const { focusSvc } = this.beans; + focusSvc.setFocusedCell({ + rowIndex: cellPosition.rowIndex, + column: cellPosition.column, + rowPinned: cellPosition.rowPinned, + forceBrowserFocus: true + }); + this.setRangeToCellIfSupported(cellPosition); + } + setRangeToCellIfSupported(cellPosition) { + if (isRowNumberCol(cellPosition.column)) { + return; + } + this.beans.rangeSvc?.setRangeToCell(cellPosition); + } + isValidNavigateCell(cell) { + const rowNode = _getRowNode(this.beans, cell); + return !!rowNode; + } + getLastCellOfColSpan(cell) { + const cellCtrl = _getCellByPosition(this.beans, cell); + if (!cellCtrl) { + return cell; + } + const colSpanningList = cellCtrl.getColSpanningList(); + if (colSpanningList.length === 1) { + return cell; + } + return { + rowIndex: cell.rowIndex, + column: _last(colSpanningList), + rowPinned: cell.rowPinned + }; + } + ensureCellVisible(gridCell) { + const isGroupStickyEnabled = _isGroupRowsSticky(this.gos); + const rowNode = this.beans.rowModel.getRow(gridCell.rowIndex); + const skipScrollToRow = isGroupStickyEnabled && rowNode?.sticky; + const { scrollFeature } = this.gridBodyCon; + if (!skipScrollToRow && _missing(gridCell.rowPinned)) { + scrollFeature.ensureIndexVisible(gridCell.rowIndex); + } + if (!gridCell.column.isPinned()) { + scrollFeature.ensureColumnVisible(gridCell.column); + } + } + ensureColumnVisible(column) { + const scrollFeature = this.gridBodyCon.scrollFeature; + if (!column.isPinned()) { + scrollFeature.ensureColumnVisible(column); + } + } + ensureRowVisible(rowIndex) { + const scrollFeature = this.gridBodyCon.scrollFeature; + scrollFeature.ensureIndexVisible(rowIndex); + } +}; +function getVScroll(beans) { + return beans.ctrlsSvc.getScrollFeature().getVScrollPosition(); +} +var KeyboardNavigationModule = { + moduleName: "KeyboardNavigation", + version: VERSION, + beans: [NavigationService, CellNavigationService, HeaderNavigationService], + apiFunctions: { + getFocusedCell, + clearFocusedCell, + setFocusedCell, + setFocusedHeader, + tabToNextCell, + tabToPreviousCell + } +}; +var PageBoundsListener = class extends BeanStub { + constructor() { + super(...arguments); + this.beanName = "pageBoundsListener"; + } + postConstruct() { + this.addManagedEventListeners({ + modelUpdated: this.onModelUpdated.bind(this), + recalculateRowBounds: this.calculatePages.bind(this) + }); + this.onModelUpdated(); + } + onModelUpdated(modelUpdatedEvent) { + this.calculatePages(); + this.eventSvc.dispatchEvent({ + type: "paginationChanged", + animate: modelUpdatedEvent?.animate ?? false, + newData: modelUpdatedEvent?.newData ?? false, + newPage: modelUpdatedEvent?.newPage ?? false, + newPageSize: modelUpdatedEvent?.newPageSize ?? false, + keepRenderedRows: modelUpdatedEvent?.keepRenderedRows ?? false + }); + } + calculatePages() { + const { pageBounds, pagination, rowModel } = this.beans; + if (pagination) { + pagination.calculatePages(); + } else { + pageBounds.calculateBounds(0, rowModel.getRowCount() - 1); + } + } +}; +var PageBoundsService = class extends BeanStub { + constructor() { + super(...arguments); + this.beanName = "pageBounds"; + this.pixelOffset = 0; + } + getFirstRow() { + return this.topRowBounds?.rowIndex ?? -1; + } + getLastRow() { + return this.bottomRowBounds?.rowIndex ?? -1; + } + getCurrentPageHeight() { + const { topRowBounds, bottomRowBounds } = this; + if (!topRowBounds || !bottomRowBounds) { + return 0; + } + return Math.max(bottomRowBounds.rowTop + bottomRowBounds.rowHeight - topRowBounds.rowTop, 0); + } + getCurrentPagePixelRange() { + const { topRowBounds, bottomRowBounds } = this; + const pageFirstPixel = topRowBounds?.rowTop ?? 0; + const pageLastPixel = bottomRowBounds ? bottomRowBounds.rowTop + bottomRowBounds.rowHeight : 0; + return { pageFirstPixel, pageLastPixel }; + } + calculateBounds(topDisplayedRowIndex, bottomDisplayedRowIndex) { + const { rowModel } = this.beans; + const topRowBounds = rowModel.getRowBounds(topDisplayedRowIndex); + if (topRowBounds) { + topRowBounds.rowIndex = topDisplayedRowIndex; + } + this.topRowBounds = topRowBounds; + const bottomRowBounds = rowModel.getRowBounds(bottomDisplayedRowIndex); + if (bottomRowBounds) { + bottomRowBounds.rowIndex = bottomDisplayedRowIndex; + } + this.bottomRowBounds = bottomRowBounds; + this.calculatePixelOffset(); + } + getPixelOffset() { + return this.pixelOffset; + } + calculatePixelOffset() { + const value = this.topRowBounds?.rowTop ?? 0; + if (this.pixelOffset === value) { + return; + } + this.pixelOffset = value; + this.eventSvc.dispatchEvent({ type: "paginationPixelOffsetChanged" }); + } +}; +var pinnedColumnModule_default = ".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}"; +var SetPinnedWidthFeature = class extends BeanStub { + constructor(isLeft, elements) { + super(); + this.isLeft = isLeft; + this.elements = elements; + this.getWidth = isLeft ? () => this.beans.pinnedCols.leftWidth : () => this.beans.pinnedCols.rightWidth; + } + postConstruct() { + this.addManagedEventListeners({ + [`${this.isLeft ? "left" : "right"}PinnedWidthChanged`]: this.onPinnedWidthChanged.bind(this) + }); + } + onPinnedWidthChanged() { + const width = this.getWidth(); + const displayed = width > 0; + for (const element of this.elements) { + if (element) { + _setDisplayed(element, displayed); + _setFixedWidth(element, width); + } + } + } +}; +var PinnedColumnService = class extends BeanStub { + constructor() { + super(...arguments); + this.beanName = "pinnedCols"; + } + postConstruct() { + this.beans.ctrlsSvc.whenReady(this, (p) => { + this.gridBodyCtrl = p.gridBodyCtrl; + }); + const listener = this.checkContainerWidths.bind(this); + this.addManagedEventListeners({ + displayedColumnsChanged: listener, + displayedColumnsWidthChanged: listener + }); + this.addManagedPropertyListener("domLayout", listener); + } + checkContainerWidths() { + const { gos, visibleCols, eventSvc } = this.beans; + const printLayout = _isDomLayout(gos, "print"); + const newLeftWidth = printLayout ? 0 : visibleCols.getColsLeftWidth(); + const newRightWidth = printLayout ? 0 : visibleCols.getDisplayedColumnsRightWidth(); + if (newLeftWidth != this.leftWidth) { + this.leftWidth = newLeftWidth; + eventSvc.dispatchEvent({ type: "leftPinnedWidthChanged" }); + } + if (newRightWidth != this.rightWidth) { + this.rightWidth = newRightWidth; + eventSvc.dispatchEvent({ type: "rightPinnedWidthChanged" }); + } + } + keepPinnedColumnsNarrowerThanViewport() { + const eBodyViewport = this.gridBodyCtrl.eBodyViewport; + const bodyWidth = _getInnerWidth(eBodyViewport); + if (bodyWidth <= 50) { + return; + } + const processedColumnsToRemove = this.getPinnedColumnsOverflowingViewport(bodyWidth - 50); + const processUnpinnedColumns = this.gos.getCallback("processUnpinnedColumns"); + const { columns, hasLockedPinned } = processedColumnsToRemove; + let columnsToRemove = columns; + if (!columnsToRemove.length && !hasLockedPinned) { + return; + } + if (processUnpinnedColumns) { + const params = { + columns: columnsToRemove, + viewportWidth: bodyWidth + }; + columnsToRemove = processUnpinnedColumns(params); + } + if (!columnsToRemove?.length) { + return; + } + columnsToRemove = columnsToRemove.filter((col) => !isRowNumberCol(col)); + this.setColsPinned(columnsToRemove, null, "viewportSizeFeature"); + } + createPinnedWidthFeature(isLeft, ...elements) { + return new SetPinnedWidthFeature(isLeft, elements); + } + setColsPinned(keys, pinned, source) { + const { colModel, colAnimation, visibleCols, gos } = this.beans; + if (!colModel.cols) { + return; + } + if (!keys?.length) { + return; + } + if (_isDomLayout(gos, "print")) { + _warn(37); + return; + } + colAnimation?.start(); + let actualPinned; + if (pinned === true || pinned === "left") { + actualPinned = "left"; + } else if (pinned === "right") { + actualPinned = "right"; + } else { + actualPinned = null; + } + const updatedCols = []; + for (const key of keys) { + if (!key) { + continue; + } + const column = colModel.getCol(key); + if (!column) { + continue; + } + if (column.getPinned() !== actualPinned) { + this.setColPinned(column, actualPinned); + updatedCols.push(column); + } + } + if (updatedCols.length) { + visibleCols.refresh(source); + dispatchColumnPinnedEvent(this.eventSvc, updatedCols, source); + } + colAnimation?.finish(); + } + initCol(column) { + const { pinned, initialPinned } = column.colDef; + if (pinned !== undefined) { + this.setColPinned(column, pinned); + } else { + this.setColPinned(column, initialPinned); + } + } + setColPinned(column, pinned) { + if (pinned === true || pinned === "left") { + column.pinned = "left"; + } else if (pinned === "right") { + column.pinned = "right"; + } else { + column.pinned = null; + } + column.dispatchStateUpdatedEvent("pinned"); + } + setupHeaderPinnedWidth(ctrl) { + const { scrollVisibleSvc } = this.beans; + if (ctrl.pinned == null) { + return; + } + const pinningLeft = ctrl.pinned === "left"; + const pinningRight = ctrl.pinned === "right"; + ctrl.hidden = true; + const listener = () => { + const width = pinningLeft ? this.leftWidth : this.rightWidth; + if (width == null) { + return; + } + const hidden = width == 0; + const hiddenChanged = ctrl.hidden !== hidden; + const isRtl = this.gos.get("enableRtl"); + const scrollbarWidth = scrollVisibleSvc.getScrollbarWidth(); + const addPaddingForScrollbar = scrollVisibleSvc.verticalScrollShowing && (isRtl && pinningLeft || !isRtl && pinningRight); + const widthWithPadding = addPaddingForScrollbar ? width + scrollbarWidth : width; + ctrl.comp.setPinnedContainerWidth(`${widthWithPadding}px`); + ctrl.comp.setDisplayed(!hidden); + if (hiddenChanged) { + ctrl.hidden = hidden; + ctrl.refresh(); + } + }; + ctrl.addManagedEventListeners({ + leftPinnedWidthChanged: listener, + rightPinnedWidthChanged: listener, + scrollVisibilityChanged: listener, + scrollbarWidthChanged: listener + }); + } + getHeaderResizeDiff(diff, column) { + const pinned = column.getPinned(); + if (pinned) { + const { leftWidth, rightWidth } = this; + const bodyWidth = _getInnerWidth(this.beans.ctrlsSvc.getGridBodyCtrl().eBodyViewport) - 50; + if (leftWidth + rightWidth + diff > bodyWidth) { + if (bodyWidth > leftWidth + rightWidth) { + diff = bodyWidth - leftWidth - rightWidth; + } else { + return 0; + } + } + } + return diff; + } + getPinnedColumnsOverflowingViewport(viewportWidth) { + const pinnedRightWidth = this.rightWidth ?? 0; + const pinnedLeftWidth = this.leftWidth ?? 0; + const totalPinnedWidth = pinnedRightWidth + pinnedLeftWidth; + let hasLockedPinned = false; + if (totalPinnedWidth < viewportWidth) { + return { columns: [], hasLockedPinned }; + } + const { visibleCols } = this.beans; + const pinnedLeftColumns = [...visibleCols.leftCols]; + const pinnedRightColumns = [...visibleCols.rightCols]; + let indexRight = 0; + let indexLeft = 0; + const totalWidthRemoved = 0; + const columnsToRemove = []; + let spaceNecessary = totalPinnedWidth - totalWidthRemoved - viewportWidth; + while ((indexLeft < pinnedLeftColumns.length || indexRight < pinnedRightColumns.length) && spaceNecessary > 0) { + if (indexRight < pinnedRightColumns.length) { + const currentColumn = pinnedRightColumns[indexRight++]; + if (currentColumn.colDef.lockPinned) { + hasLockedPinned = true; + continue; + } + spaceNecessary -= currentColumn.getActualWidth(); + columnsToRemove.push(currentColumn); + } + if (indexLeft < pinnedLeftColumns.length && spaceNecessary > 0) { + const currentColumn = pinnedLeftColumns[indexLeft++]; + if (currentColumn.colDef.lockPinned) { + hasLockedPinned = true; + continue; + } + spaceNecessary -= currentColumn.getActualWidth(); + columnsToRemove.push(currentColumn); + } + } + return { columns: columnsToRemove, hasLockedPinned }; + } +}; +var PinnedColumnModule = { + moduleName: "PinnedColumn", + version: VERSION, + beans: [PinnedColumnService], + css: [pinnedColumnModule_default] +}; +var BaseAriaAnnouncementService = class extends AgBeanStub { + constructor() { + super(); + this.beanName = "ariaAnnounce"; + this.descriptionContainer = null; + this.pendingAnnouncements = /* @__PURE__ */ new Map; + this.lastAnnouncement = ""; + this.updateAnnouncement = _debounce(this, this.updateAnnouncement.bind(this), 200); + } + postConstruct() { + const beans = this.beans; + const eDocument = _getDocument(beans); + const div = this.descriptionContainer = eDocument.createElement("div"); + div.classList.add("ag-aria-description-container"); + _setAriaLive(div, "polite"); + _setAriaRelevant(div, "additions text"); + _setAriaAtomic(div, true); + beans.eRootDiv.appendChild(div); + } + announceValue(value, key) { + this.pendingAnnouncements.set(key, value); + this.updateAnnouncement(); + } + updateAnnouncement() { + if (!this.descriptionContainer) { + return; + } + const value = Array.from(this.pendingAnnouncements.values()).join(". "); + this.pendingAnnouncements.clear(); + this.descriptionContainer.textContent = ""; + setTimeout(() => { + this.handleAnnouncementUpdate(value); + }, 50); + } + handleAnnouncementUpdate(value) { + if (!this.isAlive() || !this.descriptionContainer) { + return; + } + let valueToAnnounce = value; + if (valueToAnnounce == null || valueToAnnounce.replace(/[ .]/g, "") == "") { + this.lastAnnouncement = ""; + return; + } + if (this.lastAnnouncement === valueToAnnounce) { + valueToAnnounce = `${valueToAnnounce}​`; + } + this.lastAnnouncement = valueToAnnounce; + this.descriptionContainer.textContent = valueToAnnounce; + } + destroy() { + super.destroy(); + const { descriptionContainer } = this; + if (descriptionContainer) { + _clearElement(descriptionContainer); + descriptionContainer.remove(); + } + this.descriptionContainer = null; + this.pendingAnnouncements.clear(); + } +}; +var AriaAnnouncementService = class extends BaseAriaAnnouncementService { +}; +var AriaModule = { + moduleName: "Aria", + version: VERSION, + beans: [AriaAnnouncementService] +}; +var column_delay_render_default = ":where(.ag-delay-render){.ag-cell,.ag-header-cell,.ag-header-group-cell,.ag-row,.ag-spanned-cell-wrapper{visibility:hidden}}"; +var HideClass = "ag-delay-render"; +var ColumnDelayRenderService = class extends BeanStub { + constructor() { + super(...arguments); + this.beanName = "colDelayRenderSvc"; + this.hideRequested = false; + this.alreadyRevealed = false; + this.timesRetried = 0; + this.requesters = /* @__PURE__ */ new Set; + } + hideColumns(key) { + if (this.alreadyRevealed || this.requesters.has(key)) { + return; + } + this.requesters.add(key); + if (!this.hideRequested) { + this.beans.ctrlsSvc.whenReady(this, (p) => { + p.gridBodyCtrl.eGridBody.classList.add(HideClass); + }); + this.hideRequested = true; + } + } + revealColumns(key) { + if (this.alreadyRevealed || !this.isAlive()) { + return; + } + this.requesters.delete(key); + if (this.requesters.size > 0) { + return; + } + const { renderStatus, ctrlsSvc } = this.beans; + if (renderStatus) { + if (!renderStatus.areHeaderCellsRendered() && this.timesRetried < 5) { + this.timesRetried++; + setTimeout(() => this.revealColumns(key)); + return; + } + this.timesRetried = 0; + } + ctrlsSvc.getGridBodyCtrl().eGridBody.classList.remove(HideClass); + this.alreadyRevealed = true; + } +}; +var ColumnDelayRenderModule = { + moduleName: "ColumnDelayRender", + version: VERSION, + beans: [ColumnDelayRenderService], + css: [column_delay_render_default] +}; +var OverlayComponent = class extends Component { + constructor() { + super(); + } +}; +var ExportingOverlayElement = { + tag: "div", + cls: "ag-overlay-exporting-center", + children: [ + { tag: "span", ref: "eExportingIcon", cls: "ag-loading-icon" }, + { tag: "span", ref: "eExportingText", cls: "ag-exporting-text" } + ] +}; +var ExportingOverlayComponent = class extends OverlayComponent { + constructor() { + super(...arguments); + this.eExportingIcon = RefPlaceholder; + this.eExportingText = RefPlaceholder; + } + init(params) { + const { beans } = this; + this.setTemplate(ExportingOverlayElement); + const eExportingIcon = _createIconNoSpan("overlayExporting", beans, null); + if (eExportingIcon) { + this.eExportingIcon.appendChild(eExportingIcon); + } + const exportingText = params.exporting?.overlayText ?? this.getLocaleTextFunc()("exportingOoo", "Exporting..."); + this.eExportingText.textContent = exportingText; + beans.ariaAnnounce.announceValue(exportingText, "overlay"); + } +}; +var LoadingOverlayElement = { + tag: "div", + cls: "ag-overlay-loading-center", + children: [ + { tag: "span", ref: "eLoadingIcon", cls: "ag-loading-icon" }, + { tag: "span", ref: "eLoadingText", cls: "ag-loading-text" } + ] +}; +var LoadingOverlayComponent = class extends OverlayComponent { + constructor() { + super(...arguments); + this.eLoadingIcon = RefPlaceholder; + this.eLoadingText = RefPlaceholder; + } + init(params) { + const { beans, gos } = this; + const customTemplate = _makeNull(gos.get("overlayLoadingTemplate")?.trim()); + this.setTemplate(customTemplate ?? LoadingOverlayElement); + if (!customTemplate) { + const eLoadingIcon = _createIconNoSpan("overlayLoading", beans, null); + if (eLoadingIcon) { + this.eLoadingIcon.appendChild(eLoadingIcon); + } + const loadingText = params.loading?.overlayText ?? this.getLocaleTextFunc()("loadingOoo", "Loading..."); + this.eLoadingText.textContent = loadingText; + beans.ariaAnnounce.announceValue(loadingText, "overlay"); + } + } +}; +var NoMatchingRowsOverlayElement = { tag: "span", cls: "ag-overlay-no-matching-rows-center" }; +var NoMatchingRowsOverlayComponent = class extends OverlayComponent { + init(params) { + const { beans } = this; + this.setTemplate(NoMatchingRowsOverlayElement); + const noRowsText = params.noMatchingRows?.overlayText ?? this.getLocaleTextFunc()("noMatchingRows", "No Matching Rows"); + this.getGui().textContent = noRowsText; + beans.ariaAnnounce.announceValue(noRowsText, "overlay"); + } +}; +var NoRowsOverlayElement = { tag: "span", cls: "ag-overlay-no-rows-center" }; +var NoRowsOverlayComponent = class extends OverlayComponent { + init(params) { + const { beans, gos } = this; + const customTemplate = _makeNull(gos.get("overlayNoRowsTemplate")?.trim()); + this.setTemplate(customTemplate ?? NoRowsOverlayElement); + if (!customTemplate) { + const noRowsText = params.noRows?.overlayText ?? this.getLocaleTextFunc()("noRowsToShow", "No Rows To Show"); + this.getGui().textContent = noRowsText; + beans.ariaAnnounce.announceValue(noRowsText, "overlay"); + } + } +}; +function showLoadingOverlay(beans) { + beans.overlays?.showLoadingOverlay(); +} +function showNoRowsOverlay(beans) { + beans.overlays?.showNoRowsOverlay(); +} +function hideOverlay(beans) { + beans.overlays?.hideOverlay(); +} +var overlayWrapperComponent_default = ".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)}"; +var OverlayWrapperElement = { + 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" }] + } + ] +}; +var OverlayWrapperComponent = class extends Component { + constructor() { + super(OverlayWrapperElement); + this.eOverlayWrapper = RefPlaceholder; + this.activeOverlay = null; + this.activePromise = null; + this.activeCssClass = null; + this.elToFocusAfter = null; + this.overlayExclusive = false; + this.oldWrapperPadding = null; + this.registerCSS(overlayWrapperComponent_default); + } + handleKeyDown(e) { + if (e.key !== KeyCode.TAB || e.defaultPrevented || _isStopPropagationForAgGrid(e)) { + return; + } + const { beans, eOverlayWrapper } = this; + const nextEl = eOverlayWrapper && _findNextFocusableElement(beans, eOverlayWrapper, false, e.shiftKey); + if (nextEl) { + return; + } + let isFocused = false; + if (e.shiftKey) { + isFocused = beans.focusSvc.focusGridView({ + column: _last(beans.visibleCols.allCols), + backwards: true, + canFocusOverlay: false + }); + } else { + isFocused = _focusNextGridCoreContainer(beans, false); + } + if (isFocused) { + e.preventDefault(); + } + } + updateLayoutClasses(cssClass, params) { + const eOverlayWrapper = this.eOverlayWrapper; + if (!eOverlayWrapper) { + return; + } + const overlayWrapperClassList = eOverlayWrapper.classList; + const { AUTO_HEIGHT, NORMAL, PRINT } = LayoutCssClasses; + overlayWrapperClassList.toggle(AUTO_HEIGHT, params.autoHeight); + overlayWrapperClassList.toggle(NORMAL, params.normal); + overlayWrapperClassList.toggle(PRINT, params.print); + } + postConstruct() { + this.createManagedBean(new LayoutFeature(this)); + this.setDisplayed(false, { skipAriaHidden: true }); + this.beans.overlays.setWrapperComp(this, false); + this.addManagedElementListeners(this.getFocusableElement(), { keydown: this.handleKeyDown.bind(this) }); + this.addManagedEventListeners({ gridSizeChanged: this.refreshWrapperPadding.bind(this) }); + } + setWrapperTypeClass(overlayWrapperCssClass) { + const overlayWrapperClassList = this.eOverlayWrapper?.classList; + if (!overlayWrapperClassList) { + this.activeCssClass = null; + return; + } + if (this.activeCssClass) { + overlayWrapperClassList.toggle(this.activeCssClass, false); + } + this.activeCssClass = overlayWrapperCssClass; + overlayWrapperClassList.toggle(overlayWrapperCssClass, true); + } + showOverlay(overlayComponentPromise, overlayWrapperCssClass, exclusive) { + this.destroyActiveOverlay(); + this.elToFocusAfter = null; + this.activePromise = overlayComponentPromise; + this.overlayExclusive = exclusive; + if (!overlayComponentPromise) { + this.refreshWrapperPadding(); + return AgPromise.resolve(); + } + this.setWrapperTypeClass(overlayWrapperCssClass); + this.setDisplayed(true, { skipAriaHidden: true }); + this.refreshWrapperPadding(); + if (exclusive && this.isGridFocused()) { + const activeElement = _getActiveDomElement(this.beans); + if (activeElement && !_isNothingFocused(this.beans)) { + this.elToFocusAfter = activeElement; + } + } + overlayComponentPromise.then((comp) => { + const eOverlayWrapper = this.eOverlayWrapper; + if (!eOverlayWrapper) { + this.destroyBean(comp); + return; + } + if (this.activePromise !== overlayComponentPromise) { + if (this.activeOverlay !== comp) { + this.destroyBean(comp); + comp = null; + } + return; + } + this.activePromise = null; + if (!comp) { + return; + } + if (this.activeOverlay !== comp) { + eOverlayWrapper.appendChild(comp.getGui()); + this.activeOverlay = comp; + } + if (exclusive && this.isGridFocused()) { + _focusInto(eOverlayWrapper); + } + }); + return overlayComponentPromise; + } + refreshWrapperPadding() { + if (!this.eOverlayWrapper) { + this.oldWrapperPadding = null; + return; + } + const overlayActive = !!this.activeOverlay || !!this.activePromise; + let padding = 0; + if (overlayActive && !this.overlayExclusive) { + padding = this.beans.ctrlsSvc.get("gridHeaderCtrl")?.headerHeight || 0; + } + if (padding !== this.oldWrapperPadding) { + this.oldWrapperPadding = padding; + this.eOverlayWrapper.style.setProperty("padding-top", `${padding}px`); + } + } + destroyActiveOverlay() { + this.activePromise = null; + const activeOverlay = this.activeOverlay; + if (!activeOverlay) { + this.overlayExclusive = false; + this.elToFocusAfter = null; + this.refreshWrapperPadding(); + return; + } + let elementToFocus = this.elToFocusAfter; + this.elToFocusAfter = null; + this.activeOverlay = null; + this.overlayExclusive = false; + if (elementToFocus && !this.isGridFocused()) { + elementToFocus = null; + } + this.destroyBean(activeOverlay); + const eOverlayWrapper = this.eOverlayWrapper; + if (eOverlayWrapper) { + _clearElement(eOverlayWrapper); + } + elementToFocus?.focus?.({ preventScroll: true }); + this.refreshWrapperPadding(); + } + hideOverlay() { + this.destroyActiveOverlay(); + this.setDisplayed(false, { skipAriaHidden: true }); + } + isGridFocused() { + const activeEl = _getActiveDomElement(this.beans); + return !!activeEl && this.beans.eGridDiv.contains(activeEl); + } + destroy() { + this.elToFocusAfter = null; + this.destroyActiveOverlay(); + this.beans.overlays.setWrapperComp(this, true); + super.destroy(); + this.eOverlayWrapper = null; + } +}; +var OverlayWrapperSelector = { + selector: "AG-OVERLAY-WRAPPER", + component: OverlayWrapperComponent +}; +var overlayCompTypeOptionalMethods = ["refresh"]; +var overlayCompType = (name) => ({ name, optionalMethods: overlayCompTypeOptionalMethods }); +var LoadingOverlayDef = { + id: "agLoadingOverlay", + overlayType: "loading", + comp: overlayCompType("loadingOverlayComponent"), + wrapperCls: "ag-overlay-loading-wrapper", + exclusive: true, + compKey: "loadingOverlayComponent", + paramsKey: "loadingOverlayComponentParams", + isSuppressed: (gos) => { + const isLoading = gos.get("loading"); + return isLoading === false || gos.get("suppressLoadingOverlay") === true && isLoading !== true; + } +}; +var NoRowsOverlayDef = { + id: "agNoRowsOverlay", + overlayType: "noRows", + comp: overlayCompType("noRowsOverlayComponent"), + wrapperCls: "ag-overlay-no-rows-wrapper", + compKey: "noRowsOverlayComponent", + paramsKey: "noRowsOverlayComponentParams", + isSuppressed: (gos) => gos.get("suppressNoRowsOverlay") +}; +var NoMatchingRowsOverlayDef = { + id: "agNoMatchingRowsOverlay", + overlayType: "noMatchingRows", + comp: overlayCompType("noMatchingRowsOverlayComponent"), + wrapperCls: "ag-overlay-no-matching-rows-wrapper" +}; +var ExportingOverlayDef = { + id: "agExportingOverlay", + overlayType: "exporting", + comp: overlayCompType("exportingOverlayComponent"), + wrapperCls: "ag-overlay-exporting-wrapper", + exclusive: true +}; +var CustomOverlayDef = { + id: "activeOverlay", + comp: overlayCompType("activeOverlay"), + wrapperCls: "ag-overlay-modal-wrapper", + exclusive: true +}; +var getActiveOverlayDef = (activeOverlay) => { + if (!activeOverlay) { + return null; + } + return { + agLoadingOverlay: LoadingOverlayDef, + agNoRowsOverlay: NoRowsOverlayDef, + agNoMatchingRowsOverlay: NoMatchingRowsOverlayDef, + agExportingOverlay: ExportingOverlayDef + }[activeOverlay] ?? CustomOverlayDef; +}; +var getOverlayDefForType = (overlayType) => { + if (!overlayType) { + return null; + } + return { + loading: LoadingOverlayDef, + noRows: NoRowsOverlayDef, + noMatchingRows: NoMatchingRowsOverlayDef, + exporting: ExportingOverlayDef + }[overlayType]; +}; +var OverlayService = class extends BeanStub { + constructor() { + super(...arguments); + this.beanName = "overlays"; + this.eWrapper = undefined; + this.exclusive = false; + this.oldExclusive = false; + this.currentDef = null; + this.showInitialOverlay = true; + this.userForcedNoRows = false; + this.exportsInProgress = 0; + this.newColumnsLoadedCleanup = null; + } + postConstruct() { + const gos = this.gos; + this.showInitialOverlay = _isClientSideRowModel(gos); + const updateOverlayVisibility = () => { + if (this.userForcedNoRows) { + return; + } + this.updateOverlay(false); + }; + const [newColumnsLoadedCleanup, rowCountReadyCleanup, _, __] = this.addManagedEventListeners({ + newColumnsLoaded: updateOverlayVisibility, + rowCountReady: () => { + this.disableInitialOverlay(); + updateOverlayVisibility(); + rowCountReadyCleanup(); + }, + rowDataUpdated: updateOverlayVisibility, + modelUpdated: updateOverlayVisibility + }); + this.newColumnsLoadedCleanup = newColumnsLoadedCleanup; + this.addManagedPropertyListeners([ + "loading", + "activeOverlay", + "activeOverlayParams", + "overlayComponentParams", + "loadingOverlayComponentParams", + "noRowsOverlayComponentParams" + ], (params) => this.onPropChange(new Set(params.changeSet?.properties))); + } + destroy() { + this.doHideOverlay(); + super.destroy(); + this.eWrapper = undefined; + } + setWrapperComp(overlayWrapperComp, destroyed) { + if (!this.isAlive()) { + return; + } + if (!destroyed) { + this.eWrapper = overlayWrapperComp; + } else if (this.eWrapper === overlayWrapperComp) { + this.eWrapper = undefined; + } + this.updateOverlay(false); + } + isVisible() { + return !!this.currentDef; + } + showLoadingOverlay() { + this.showInitialOverlay = false; + const gos = this.gos; + if (!this.eWrapper || gos.get("activeOverlay")) { + return; + } + if (this.isDisabled(LoadingOverlayDef)) { + return; + } + const loading = gos.get("loading"); + if (!loading && loading !== undefined) { + return; + } + this.doShowOverlay(LoadingOverlayDef); + } + showNoRowsOverlay() { + this.showInitialOverlay = false; + const gos = this.gos; + if (!this.eWrapper || gos.get("activeOverlay") || gos.get("loading") || this.isDisabled(NoRowsOverlayDef)) { + return; + } + this.userForcedNoRows = true; + this.doShowOverlay(NoRowsOverlayDef); + } + async showExportOverlay(heavyOperation) { + const { gos, beans } = this; + if (!this.eWrapper || gos.get("activeOverlay") || gos.get("loading") || this.isDisabled(ExportingOverlayDef) || this.userForcedNoRows && this.currentDef === NoRowsOverlayDef) { + heavyOperation(); + return; + } + const desiredDef = this.getDesiredDefWithOverride(ExportingOverlayDef); + if (!desiredDef) { + heavyOperation(); + return; + } + this.exportsInProgress++; + this.focusedCell = beans.focusSvc.getFocusedCell(); + await this.doShowOverlay(desiredDef); + await new Promise((resolve) => setTimeout(() => resolve())); + const shownAt = Date.now(); + try { + heavyOperation(); + } finally { + const elapsed = Date.now() - shownAt; + const remaining = Math.max(0, 300 - elapsed); + const clearExportOverlay = () => { + this.exportsInProgress--; + if (this.exportsInProgress === 0) { + this.updateOverlay(false); + _attemptToRestoreCellFocus(beans, this.focusedCell); + this.focusedCell = null; + } + }; + if (remaining > 0) { + setTimeout(() => clearExportOverlay(), remaining); + } else { + clearExportOverlay(); + } + } + } + hideOverlay() { + const gos = this.gos; + this.showInitialOverlay = false; + const userHadForced = this.userForcedNoRows; + this.userForcedNoRows = false; + if (gos.get("loading")) { + _warn(99); + return; + } + if (gos.get("activeOverlay")) { + _warn(296); + return; + } + if (this.currentDef === NoMatchingRowsOverlayDef) { + _warn(297); + return; + } + this.doHideOverlay(); + if (userHadForced) { + if (this.getOverlayDef() !== NoRowsOverlayDef) { + this.updateOverlay(false); + } + } + } + getOverlayWrapperSelector() { + return OverlayWrapperSelector; + } + getOverlayWrapperCompClass() { + return OverlayWrapperComponent; + } + onPropChange(changedProps) { + const activeOverlayChanged = changedProps.has("activeOverlay"); + if (activeOverlayChanged || changedProps.has("loading")) { + if (this.updateOverlay(activeOverlayChanged)) { + return; + } + } + const currentDef = this.currentDef; + const currOverlayComp = this.eWrapper?.activeOverlay; + if (currOverlayComp && currentDef) { + const activeOverlayParamsChanged = changedProps.has("activeOverlayParams"); + if (currentDef === CustomOverlayDef) { + if (activeOverlayParamsChanged) { + currOverlayComp.refresh?.(this.makeCompParams(true)); + } + } else { + const paramsKey = currentDef.paramsKey; + if (changedProps.has("overlayComponentParams") || paramsKey && changedProps.has(paramsKey)) { + currOverlayComp.refresh?.(this.makeCompParams(false, paramsKey, currentDef.overlayType)); + } + } + } + } + updateOverlay(activeOverlayChanged) { + const eWrapper = this.eWrapper; + if (!eWrapper) { + this.currentDef = null; + return false; + } + const desiredDef = this.getDesiredDefWithOverride(); + const currentDef = this.currentDef; + const shouldReload = desiredDef === CustomOverlayDef && activeOverlayChanged; + if (desiredDef !== currentDef) { + if (!desiredDef) { + this.disableInitialOverlay(); + return this.doHideOverlay(); + } + this.doShowOverlay(desiredDef); + return true; + } + if (shouldReload && desiredDef) { + eWrapper.hideOverlay(); + this.doShowOverlay(desiredDef); + return true; + } + if (!desiredDef) { + this.disableInitialOverlay(); + } + return false; + } + getDesiredDefWithOverride(defaultDef) { + const { gos } = this; + let desiredDef = getActiveOverlayDef(gos.get("activeOverlay")); + if (!desiredDef) { + desiredDef = defaultDef ?? this.getOverlayDef(); + if (desiredDef && this.isDisabled(desiredDef)) { + desiredDef = null; + } + } + return desiredDef; + } + getOverlayDef() { + const { gos, beans } = this; + const { rowModel } = beans; + const loading = gos.get("loading"); + const loadingDefined = loading !== undefined; + if (loadingDefined) { + this.disableInitialOverlay(); + if (loading) { + return LoadingOverlayDef; + } + } else if (this.showInitialOverlay) { + if (!this.isDisabled(LoadingOverlayDef) && (!gos.get("columnDefs") || !gos.get("rowData"))) { + return LoadingOverlayDef; + } + this.disableInitialOverlay(); + } else { + this.disableInitialOverlay(); + } + const overlayType = rowModel.getOverlayType(); + return getOverlayDefForType(overlayType); + } + disableInitialOverlay() { + this.showInitialOverlay = false; + this.newColumnsLoadedCleanup?.(); + this.newColumnsLoadedCleanup = null; + } + doShowOverlay(componentDef) { + const { gos, beans } = this; + const { userCompFactory } = beans; + this.currentDef = componentDef; + const isProvidedOverlay = componentDef !== CustomOverlayDef; + const exclusive = !!componentDef.exclusive; + this.exclusive = exclusive; + let legacyParamsKey; + if (componentDef.paramsKey && gos.get(componentDef.paramsKey) || componentDef.compKey && gos.get(componentDef.compKey)) { + legacyParamsKey = componentDef.paramsKey; + } + let compDetails = undefined; + if (isProvidedOverlay) { + if (gos.get("overlayComponent") || gos.get("overlayComponentSelector")) { + compDetails = userCompFactory.getCompDetailsFromGridOptions({ name: "overlayComponent", optionalMethods: ["refresh"] }, undefined, this.makeCompParams(false, componentDef.paramsKey, componentDef.overlayType)); + } + } + compDetails ?? (compDetails = userCompFactory.getCompDetailsFromGridOptions(componentDef.comp, isProvidedOverlay ? componentDef.id : undefined, this.makeCompParams(!isProvidedOverlay, legacyParamsKey, componentDef.overlayType), false)); + const promise = compDetails?.newAgStackInstance() ?? null; + const mountedPromise = this.eWrapper ? this.eWrapper.showOverlay(promise, componentDef.wrapperCls, exclusive) : AgPromise.resolve(); + this.eWrapper?.refreshWrapperPadding(); + this.setExclusive(exclusive); + return mountedPromise; + } + makeCompParams(includeActiveOverlayParams, legacyParamsKey, overlayType) { + const { gos } = this; + const params = includeActiveOverlayParams ? gos.get("activeOverlayParams") : { + ...gos.get("overlayComponentParams"), + ...legacyParamsKey && gos.get(legacyParamsKey) || null, + overlayType + }; + return _addGridCommonParams(gos, params ?? {}); + } + doHideOverlay() { + let changed = false; + if (this.currentDef) { + this.currentDef = null; + changed = true; + } + this.exclusive = false; + const eWrapper = this.eWrapper; + if (eWrapper) { + eWrapper.hideOverlay(); + eWrapper.refreshWrapperPadding(); + this.setExclusive(false); + } + return changed; + } + setExclusive(exclusive) { + if (this.oldExclusive !== exclusive) { + this.oldExclusive = exclusive; + this.eventSvc.dispatchEvent({ type: "overlayExclusiveChanged" }); + } + } + isDisabled(def) { + const { gos } = this; + return def.overlayType && gos.get("suppressOverlays")?.includes(def.overlayType) || def.isSuppressed?.(gos) === true; + } +}; +var OverlayModule = { + moduleName: "Overlay", + version: VERSION, + userComponents: { + agLoadingOverlay: LoadingOverlayComponent, + agNoRowsOverlay: NoRowsOverlayComponent, + agNoMatchingRowsOverlay: NoMatchingRowsOverlayComponent, + agExportingOverlay: ExportingOverlayComponent + }, + apiFunctions: { + showLoadingOverlay, + showNoRowsOverlay, + hideOverlay + }, + icons: { + overlayLoading: "loading", + overlayExporting: "loading" + }, + beans: [OverlayService] +}; +var RowContainerHeightService = class extends BeanStub { + constructor() { + super(...arguments); + this.beanName = "rowContainerHeight"; + this.scrollY = 0; + this.uiBodyHeight = 0; + } + postConstruct() { + this.addManagedEventListeners({ bodyHeightChanged: this.updateOffset.bind(this) }); + this.maxDivHeight = _getMaxDivHeight(); + _logIfDebug(this.gos, "RowContainerHeightService - maxDivHeight = " + this.maxDivHeight); + } + updateOffset() { + if (!this.stretching) { + return; + } + const newScrollY = this.beans.ctrlsSvc.getScrollFeature().getVScrollPosition().top; + const newBodyHeight = this.getUiBodyHeight(); + const atLeastOneChanged = newScrollY !== this.scrollY || newBodyHeight !== this.uiBodyHeight; + if (atLeastOneChanged) { + this.scrollY = newScrollY; + this.uiBodyHeight = newBodyHeight; + this.calculateOffset(); + } + } + calculateOffset() { + this.setUiContainerHeight(this.maxDivHeight); + this.pixelsToShave = this.modelHeight - this.uiContainerHeight; + this.maxScrollY = this.uiContainerHeight - this.uiBodyHeight; + const scrollPercent = this.scrollY / this.maxScrollY; + const divStretchOffset = scrollPercent * this.pixelsToShave; + _logIfDebug(this.gos, `RowContainerHeightService - Div Stretch Offset = ${divStretchOffset} (${this.pixelsToShave} * ${scrollPercent})`); + this.setDivStretchOffset(divStretchOffset); + } + setUiContainerHeight(height) { + if (height !== this.uiContainerHeight) { + this.uiContainerHeight = height; + this.eventSvc.dispatchEvent({ type: "rowContainerHeightChanged" }); + } + } + clearOffset() { + this.setUiContainerHeight(this.modelHeight); + this.pixelsToShave = 0; + this.setDivStretchOffset(0); + } + setDivStretchOffset(newOffset) { + const newOffsetFloor = typeof newOffset === "number" ? Math.floor(newOffset) : null; + if (this.divStretchOffset === newOffsetFloor) { + return; + } + this.divStretchOffset = newOffsetFloor; + this.eventSvc.dispatchEvent({ type: "heightScaleChanged" }); + } + setModelHeight(modelHeight) { + this.modelHeight = modelHeight; + this.stretching = modelHeight != null && this.maxDivHeight > 0 && modelHeight > this.maxDivHeight; + if (this.stretching) { + this.calculateOffset(); + } else { + this.clearOffset(); + } + } + getRealPixelPosition(modelPixel) { + return modelPixel - this.divStretchOffset; + } + getUiBodyHeight() { + const pos = this.beans.ctrlsSvc.getScrollFeature().getVScrollPosition(); + return pos.bottom - pos.top; + } + getScrollPositionForPixel(rowTop) { + if (this.pixelsToShave <= 0) { + return rowTop; + } + const modelMaxScroll = this.modelHeight - this.getUiBodyHeight(); + const scrollPercent = rowTop / modelMaxScroll; + const scrollPixel = this.maxScrollY * scrollPercent; + return scrollPixel; + } +}; +var ROW_ANIMATION_TIMEOUT = 400; +var RowRenderer = class extends BeanStub { + constructor() { + super(...arguments); + this.beanName = "rowRenderer"; + this.destroyFuncsForColumnListeners = []; + this.rowCtrlsByRowIndex = {}; + this.zombieRowCtrls = {}; + this.allRowCtrls = []; + this.topRowCtrls = []; + this.bottomRowCtrls = []; + this.refreshInProgress = false; + this.dataFirstRenderedFired = false; + this.setupRangeSelectionListeners = () => { + const onCellSelectionChanged = () => { + for (const cellCtrl of this.getAllCellCtrls()) { + cellCtrl.onCellSelectionChanged(); + } + }; + const onColumnMovedPinnedVisible = () => { + for (const cellCtrl of this.getAllCellCtrls()) { + cellCtrl.updateRangeBordersIfRangeCount(); + } + }; + const addCellSelectionListeners = () => { + this.eventSvc.addListener("cellSelectionChanged", onCellSelectionChanged); + this.eventSvc.addListener("columnMoved", onColumnMovedPinnedVisible); + this.eventSvc.addListener("columnPinned", onColumnMovedPinnedVisible); + this.eventSvc.addListener("columnVisible", onColumnMovedPinnedVisible); + }; + const removeCellSelectionListeners = () => { + this.eventSvc.removeListener("cellSelectionChanged", onCellSelectionChanged); + this.eventSvc.removeListener("columnMoved", onColumnMovedPinnedVisible); + this.eventSvc.removeListener("columnPinned", onColumnMovedPinnedVisible); + this.eventSvc.removeListener("columnVisible", onColumnMovedPinnedVisible); + }; + this.addDestroyFunc(() => removeCellSelectionListeners()); + this.addManagedPropertyListeners(["enableRangeSelection", "cellSelection"], () => { + const isEnabled = _isCellSelectionEnabled(this.gos); + if (isEnabled) { + addCellSelectionListeners(); + } else { + removeCellSelectionListeners(); + } + }); + const cellSelectionEnabled = _isCellSelectionEnabled(this.gos); + if (cellSelectionEnabled) { + addCellSelectionListeners(); + } + }; + } + wireBeans(beans) { + this.pageBounds = beans.pageBounds; + this.colModel = beans.colModel; + this.pinnedRowModel = beans.pinnedRowModel; + this.rowModel = beans.rowModel; + this.focusSvc = beans.focusSvc; + this.rowContainerHeight = beans.rowContainerHeight; + this.ctrlsSvc = beans.ctrlsSvc; + this.editSvc = beans.editSvc; + } + postConstruct() { + this.ctrlsSvc.whenReady(this, (p) => { + this.gridBodyCtrl = p.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", (e) => this.onSuppressCellFocusChanged(e.currentValue)); + this.addManagedPropertyListeners([ + "groupSuppressBlankHeader", + "getBusinessKeyForNode", + "fullWidthCellRenderer", + "fullWidthCellRendererParams", + "suppressStickyTotalRow", + "groupRowRenderer", + "groupRowRendererParams", + "loadingCellRenderer", + "loadingCellRendererParams", + "detailCellRenderer", + "detailCellRendererParams", + "enableRangeSelection", + "enableCellTextSelection" + ], () => this.redrawRows()); + this.addManagedPropertyListener("cellSelection", ({ currentValue, previousValue }) => { + if (!previousValue && currentValue || previousValue && !currentValue) { + this.redrawRows(); + } + }); + const { stickyRowSvc, gos, showRowGroupCols } = this.beans; + if (showRowGroupCols) { + this.addManagedPropertyListener("showOpenedGroup", () => { + const columns = showRowGroupCols.columns; + if (columns.length) { + this.refreshCells({ columns, force: true }); + } + }); + } + if (stickyRowSvc) { + this.stickyRowFeature = stickyRowSvc.createStickyRowFeature(this, this.createRowCon.bind(this), this.destroyRowCtrls.bind(this)); + } else { + const gridBodyCtrl = this.gridBodyCtrl; + gridBodyCtrl.setStickyTopHeight(0); + gridBodyCtrl.setStickyBottomHeight(0); + } + this.registerCellEventListeners(); + this.initialiseCache(); + this.printLayout = _isDomLayout(gos, "print"); + this.embedFullWidthRows = this.printLayout || gos.get("embedFullWidthRows"); + this.redrawAfterModelUpdate(); + } + initialiseCache() { + if (this.gos.get("keepDetailRows")) { + const countProp = this.getKeepDetailRowsCount(); + const count = countProp != null ? countProp : 3; + this.cachedRowCtrls = new RowCtrlCache(count); + } + } + getKeepDetailRowsCount() { + return this.gos.get("keepDetailRowsCount"); + } + getStickyTopRowCtrls() { + return this.stickyRowFeature?.stickyTopRowCtrls ?? []; + } + getStickyBottomRowCtrls() { + return this.stickyRowFeature?.stickyBottomRowCtrls ?? []; + } + updateAllRowCtrls() { + const liveList = Object.values(this.rowCtrlsByRowIndex); + const zombieList = Object.values(this.zombieRowCtrls); + const cachedList = this.cachedRowCtrls?.getEntries() ?? []; + if (zombieList.length > 0 || cachedList.length > 0) { + this.allRowCtrls = [...liveList, ...zombieList, ...cachedList]; + } else { + this.allRowCtrls = liveList; + } + } + isCellBeingRendered(rowIndex, column) { + const rowCtrl = this.rowCtrlsByRowIndex[rowIndex]; + if (!column || !rowCtrl) { + return !!rowCtrl; + } + if (rowCtrl.isFullWidth()) { + return true; + } + const spannedCell = this.beans.spannedRowRenderer?.getCellByPosition({ rowIndex, column, rowPinned: null }); + return !!spannedCell || !!rowCtrl.getCellCtrl(column) || !rowCtrl.isRowRendered(); + } + updateCellFocus(event) { + for (const cellCtrl of this.getAllCellCtrls()) { + cellCtrl.onCellFocused(event); + } + for (const rowCtrl of this.getFullWidthRowCtrls()) { + rowCtrl.onFullWidthRowFocused(event); + } + } + onCellFocusChanged(event) { + if (event?.rowIndex != null && !event.rowPinned) { + const col = this.beans.colModel.getCol(event.column) ?? undefined; + if (!this.isCellBeingRendered(event.rowIndex, col)) { + this.redraw(); + } + } + this.updateCellFocus(event); + } + onSuppressCellFocusChanged(suppressCellFocus) { + for (const cellCtrl of this.getAllCellCtrls()) { + cellCtrl.onSuppressCellFocusChanged(suppressCellFocus); + } + for (const rowCtrl of this.getFullWidthRowCtrls()) { + rowCtrl.onSuppressCellFocusChanged(suppressCellFocus); + } + } + registerCellEventListeners() { + this.addManagedEventListeners({ + cellFocused: (event) => this.onCellFocusChanged(event), + cellFocusCleared: () => this.updateCellFocus(), + flashCells: (event) => { + const { cellFlashSvc } = this.beans; + if (cellFlashSvc) { + for (const cellCtrl of this.getAllCellCtrls()) { + cellFlashSvc.onFlashCells(cellCtrl, event); + } + } + }, + columnHoverChanged: () => { + for (const cellCtrl of this.getAllCellCtrls()) { + cellCtrl.onColumnHover(); + } + }, + displayedColumnsChanged: () => { + for (const cellCtrl of this.getAllCellCtrls()) { + cellCtrl.onDisplayedColumnsChanged(); + } + }, + displayedColumnsWidthChanged: () => { + if (this.printLayout) { + for (const cellCtrl of this.getAllCellCtrls()) { + cellCtrl.onLeftChanged(); + } + } + } + }); + this.setupRangeSelectionListeners(); + this.refreshListenersToColumnsForCellComps(); + this.addManagedEventListeners({ + gridColumnsChanged: this.refreshListenersToColumnsForCellComps.bind(this) + }); + this.addDestroyFunc(this.removeGridColumnListeners.bind(this)); + } + removeGridColumnListeners() { + for (const func of this.destroyFuncsForColumnListeners) { + func(); + } + this.destroyFuncsForColumnListeners.length = 0; + } + refreshListenersToColumnsForCellComps() { + this.removeGridColumnListeners(); + const cols = this.colModel.getCols(); + for (const col of cols) { + const forEachCellWithThisCol = (callback) => { + for (const cellCtrl of this.getAllCellCtrls()) { + if (cellCtrl.column === col) { + callback(cellCtrl); + } + } + }; + const leftChangedListener = () => { + forEachCellWithThisCol((cellCtrl) => cellCtrl.onLeftChanged()); + }; + const widthChangedListener = () => { + forEachCellWithThisCol((cellCtrl) => cellCtrl.onWidthChanged()); + }; + const firstRightPinnedChangedListener = () => { + forEachCellWithThisCol((cellCtrl) => cellCtrl.onFirstRightPinnedChanged()); + }; + const lastLeftPinnedChangedListener = () => { + forEachCellWithThisCol((cellCtrl) => cellCtrl.onLastLeftPinnedChanged()); + }; + const colDefChangedListener = () => { + forEachCellWithThisCol((cellCtrl) => cellCtrl.onColDefChanged()); + }; + col.__addEventListener("leftChanged", leftChangedListener); + col.__addEventListener("widthChanged", widthChangedListener); + col.__addEventListener("firstRightPinnedChanged", firstRightPinnedChangedListener); + col.__addEventListener("lastLeftPinnedChanged", lastLeftPinnedChangedListener); + col.__addEventListener("colDefChanged", colDefChangedListener); + this.destroyFuncsForColumnListeners.push(() => { + col.__removeEventListener("leftChanged", leftChangedListener); + col.__removeEventListener("widthChanged", widthChangedListener); + col.__removeEventListener("firstRightPinnedChanged", firstRightPinnedChangedListener); + col.__removeEventListener("lastLeftPinnedChanged", lastLeftPinnedChangedListener); + col.__removeEventListener("colDefChanged", colDefChangedListener); + }); + } + } + onDomLayoutChanged() { + const printLayout = _isDomLayout(this.gos, "print"); + const embedFullWidthRows = printLayout || this.gos.get("embedFullWidthRows"); + const destroyRows = embedFullWidthRows !== this.embedFullWidthRows || this.printLayout !== printLayout; + this.printLayout = printLayout; + this.embedFullWidthRows = embedFullWidthRows; + if (destroyRows) { + this.redrawAfterModelUpdate({ domLayoutChanged: true }); + } + } + datasourceChanged() { + this.firstRenderedRow = 0; + this.lastRenderedRow = -1; + const rowIndexesToRemove = Object.keys(this.rowCtrlsByRowIndex); + this.removeRowCtrls(rowIndexesToRemove); + } + onPageLoaded(event) { + const params = { + recycleRows: event.keepRenderedRows, + animate: event.animate, + newData: event.newData, + newPage: event.newPage, + onlyBody: true + }; + this.redrawAfterModelUpdate(params); + } + getAllCellsNotSpanningForColumn(column) { + const res = []; + for (const rowCtrl of this.getAllRowCtrls()) { + const eCell = rowCtrl.getCellCtrl(column, true)?.eGui; + if (eCell) { + res.push(eCell); + } + } + return res; + } + refreshFloatingRowComps(recycleRows = true) { + this.refreshFloatingRows(this.topRowCtrls, "top", recycleRows); + this.refreshFloatingRows(this.bottomRowCtrls, "bottom", recycleRows); + } + refreshFloatingRows(rowCtrls, floating, recycleRows) { + const { pinnedRowModel, beans, printLayout } = this; + const rowCtrlMap = Object.fromEntries(rowCtrls.map((ctrl) => [ctrl.rowNode.id, ctrl])); + pinnedRowModel?.forEachPinnedRow(floating, (node, i) => { + const rowCtrl = rowCtrls[i]; + const rowCtrlDoesNotExist = rowCtrl && pinnedRowModel.getPinnedRowById(rowCtrl.rowNode.id, floating) === undefined; + if (rowCtrlDoesNotExist) { + rowCtrl.destroyFirstPass(); + rowCtrl.destroySecondPass(); + } + if (node.id in rowCtrlMap && recycleRows) { + rowCtrls[i] = rowCtrlMap[node.id]; + delete rowCtrlMap[node.id]; + } else { + rowCtrls[i] = new RowCtrl(node, beans, false, false, printLayout); + } + }); + const rowNodeCount = (floating === "top" ? pinnedRowModel?.getPinnedTopRowCount() : pinnedRowModel?.getPinnedBottomRowCount()) ?? 0; + rowCtrls.length = rowNodeCount; + } + onPinnedRowDataChanged() { + const params = { + recycleRows: true + }; + this.redrawAfterModelUpdate(params); + } + onPinnedRowsChanged() { + this.redrawAfterModelUpdate({ recycleRows: true }); + } + redrawRow(rowNode, suppressEvent = false) { + if (rowNode.sticky) { + this.stickyRowFeature?.refreshStickyNode(rowNode); + } else if (this.cachedRowCtrls?.has(rowNode)) { + this.cachedRowCtrls.removeRow(rowNode); + return; + } else { + const destroyAndRecreateCtrl = (dataStruct) => { + const ctrl = dataStruct[rowNode.rowIndex]; + if (!ctrl) { + return; + } + if (ctrl.rowNode !== rowNode) { + return; + } + ctrl.destroyFirstPass(); + ctrl.destroySecondPass(); + dataStruct[rowNode.rowIndex] = this.createRowCon(rowNode, false, false); + }; + switch (rowNode.rowPinned) { + case "top": + destroyAndRecreateCtrl(this.topRowCtrls); + break; + case "bottom": + destroyAndRecreateCtrl(this.bottomRowCtrls); + break; + default: + destroyAndRecreateCtrl(this.rowCtrlsByRowIndex); + this.updateAllRowCtrls(); + } + } + if (!suppressEvent) { + this.dispatchDisplayedRowsChanged(false); + } + } + redrawRows(rowNodes) { + const { editSvc } = this.beans; + if (editSvc?.isEditing()) { + if (editSvc.isBatchEditing()) { + editSvc.cleanupEditors(); + } else { + editSvc.stopEditing(undefined, { source: "api" }); + } + } + const partialRefresh = rowNodes != null; + if (partialRefresh) { + for (const node of rowNodes ?? []) { + this.redrawRow(node, true); + } + this.dispatchDisplayedRowsChanged(false); + return; + } + this.redrawAfterModelUpdate(); + } + redrawAfterModelUpdate(params = {}) { + this.getLockOnRefresh(); + const focusedCell = this.beans.focusSvc?.getFocusCellToUseAfterRefresh(); + this.updateContainerHeights(); + this.scrollToTopIfNewData(params); + const recycleRows = !params.domLayoutChanged && !!params.recycleRows; + const animate = params.animate && _isAnimateRows(this.gos); + const rowsToRecycle = recycleRows ? this.getRowsToRecycle() : null; + if (!recycleRows) { + this.removeAllRowComps(); + } + this.workOutFirstAndLastRowsToRender(); + const { stickyRowFeature, gos } = this; + if (stickyRowFeature) { + stickyRowFeature.checkStickyRows(); + const extraHeight = stickyRowFeature.extraTopHeight + stickyRowFeature.extraBottomHeight; + if (extraHeight) { + this.updateContainerHeights(extraHeight); + } + } + this.recycleRows(rowsToRecycle, animate); + this.gridBodyCtrl.updateRowCount(); + if (!params.onlyBody) { + this.refreshFloatingRowComps(gos.get("enableRowPinning") ? recycleRows : undefined); + } + this.dispatchDisplayedRowsChanged(); + if (focusedCell != null) { + this.restoreFocusedCell(focusedCell); + } + this.releaseLockOnRefresh(); + } + scrollToTopIfNewData(params) { + const scrollToTop = params.newData || params.newPage; + const suppressScrollToTop = this.gos.get("suppressScrollOnNewData"); + if (scrollToTop && !suppressScrollToTop) { + this.gridBodyCtrl.scrollFeature.scrollToTop(); + this.stickyRowFeature?.resetOffsets(); + } + } + updateContainerHeights(additionalHeight = 0) { + const { rowContainerHeight } = this; + if (this.printLayout) { + rowContainerHeight.setModelHeight(null); + return; + } + let containerHeight = this.pageBounds.getCurrentPageHeight(); + if (containerHeight === 0) { + containerHeight = 1; + } + rowContainerHeight.setModelHeight(containerHeight + additionalHeight); + } + getLockOnRefresh() { + if (this.refreshInProgress) { + throw new Error(_errMsg(252)); + } + this.refreshInProgress = true; + this.beans.frameworkOverrides.getLockOnRefresh?.(); + } + releaseLockOnRefresh() { + this.refreshInProgress = false; + this.beans.frameworkOverrides.releaseLockOnRefresh?.(); + } + isRefreshInProgress() { + return this.refreshInProgress; + } + restoreFocusedCell(cellPosition) { + if (!cellPosition) { + return; + } + const focusSvc = this.beans.focusSvc; + const cellToFocus = this.findPositionToFocus(cellPosition); + if (!cellToFocus) { + focusSvc.focusHeaderPosition({ + headerPosition: { + headerRowIndex: getFocusHeaderRowCount(this.beans) - 1, + column: cellPosition.column + } + }); + return; + } + if (cellPosition.rowIndex !== cellToFocus.rowIndex || cellPosition.rowPinned != cellToFocus.rowPinned) { + focusSvc.setFocusedCell({ + ...cellToFocus, + preventScrollOnBrowserFocus: true, + forceBrowserFocus: true + }); + return; + } + if (!focusSvc.doesRowOrCellHaveBrowserFocus()) { + this.updateCellFocus(_addGridCommonParams(this.gos, { + ...cellToFocus, + forceBrowserFocus: true, + preventScrollOnBrowserFocus: true, + type: "cellFocused" + })); + } + } + findPositionToFocus(cellPosition) { + const { pagination, pageBounds } = this.beans; + let rowPosition = cellPosition; + if (rowPosition.rowPinned == null && pagination && pageBounds && !pagination.isRowInPage(rowPosition.rowIndex)) { + rowPosition = { rowPinned: null, rowIndex: pageBounds.getFirstRow() }; + } + while (rowPosition) { + if (rowPosition.rowPinned == null && pageBounds) { + if (rowPosition.rowIndex < pageBounds.getFirstRow()) { + rowPosition = _getRowAbove(this.beans, { rowPinned: null, rowIndex: 0 }); + if (!rowPosition) { + return null; + } + } else if (rowPosition.rowIndex > pageBounds.getLastRow()) { + rowPosition = { rowPinned: null, rowIndex: pageBounds.getLastRow() }; + } + } + const row = this.getRowByPosition(rowPosition); + if (row?.isAlive()) { + return { ...row.getRowPosition(), column: cellPosition.column }; + } + rowPosition = _getRowAbove(this.beans, rowPosition); + } + return null; + } + getAllCellCtrls() { + const res = []; + const rowCtrls = this.getAllRowCtrls(); + const rowCtrlsLength = rowCtrls.length; + for (let i = 0;i < rowCtrlsLength; i++) { + const cellCtrls = rowCtrls[i].getAllCellCtrls(); + const cellCtrlsLength = cellCtrls.length; + for (let j = 0;j < cellCtrlsLength; j++) { + res.push(cellCtrls[j]); + } + } + return res; + } + getAllRowCtrls() { + const { spannedRowRenderer } = this.beans; + const stickyTopRowCtrls = this.getStickyTopRowCtrls(); + const stickyBottomRowCtrls = this.getStickyBottomRowCtrls(); + const res = [ + ...this.topRowCtrls, + ...this.bottomRowCtrls, + ...stickyTopRowCtrls, + ...stickyBottomRowCtrls, + ...spannedRowRenderer?.getCtrls("top") ?? [], + ...spannedRowRenderer?.getCtrls("bottom") ?? [], + ...spannedRowRenderer?.getCtrls("center") ?? [], + ...Object.values(this.rowCtrlsByRowIndex) + ]; + return res; + } + addRenderedRowListener(eventName, rowIndex, callback) { + const rowComp = this.rowCtrlsByRowIndex[rowIndex]; + if (rowComp) { + rowComp.addEventListener(eventName, callback); + } + } + refreshCells({ rowNodes, columns, force, suppressFlash } = {}) { + const refreshCellParams = { + force, + newData: false, + suppressFlash + }; + for (const cellCtrl of this.getCellCtrls(rowNodes, columns)) { + cellCtrl.refreshOrDestroyCell(refreshCellParams); + } + this.refreshFullWidth(rowNodes); + } + refreshRows(params = {}) { + for (const rowCtrl of this.getRowCtrls(params.rowNodes)) { + rowCtrl.refreshRow(params); + } + this.refreshFullWidth(params.rowNodes); + } + getRowCtrlByNode(node) { + const rowIndex = node.rowIndex; + if (rowIndex == null) { + return; + } + const rowPinned = node.rowPinned; + if (rowPinned === "top") { + const ctrl2 = this.topRowCtrls[rowIndex]; + return ctrl2?.rowNode === node ? ctrl2 : undefined; + } + if (rowPinned === "bottom") { + const ctrl2 = this.bottomRowCtrls[rowIndex]; + return ctrl2?.rowNode === node ? ctrl2 : undefined; + } + const ctrl = this.rowCtrlsByRowIndex[rowIndex]; + if (ctrl?.rowNode === node) { + return ctrl; + } + return this.getStickyRowCtrlByNode(node); + } + getStickyRowCtrlByNode(node) { + const stickyRowFeature = this.stickyRowFeature; + if (!stickyRowFeature) { + return; + } + for (const c of stickyRowFeature.stickyTopRowCtrls) { + if (c.rowNode === node) { + return c; + } + } + for (const c of stickyRowFeature.stickyBottomRowCtrls) { + if (c.rowNode === node) { + return c; + } + } + return; + } + refreshRowByNode(node) { + if (node) { + this.getRowCtrlByNode(node)?.refreshRow(); + } + } + refreshFullWidth(rowNodes) { + if (!rowNodes) { + return; + } + let rowRedrawn = false; + for (const rowCtrl of this.getRowCtrls(rowNodes)) { + if (!rowCtrl.isFullWidth()) { + continue; + } + const refreshed = rowCtrl.refreshFullWidth(); + if (!refreshed) { + rowRedrawn = true; + this.redrawRow(rowCtrl.rowNode, true); + } + } + if (rowRedrawn) { + this.dispatchDisplayedRowsChanged(false); + } + } + getRowCtrls(rowNodes) { + const rowIdsMap = mapRowNodes(rowNodes); + const allRowCtrls = this.getAllRowCtrls(); + if (!rowNodes || !rowIdsMap) { + return allRowCtrls; + } + return allRowCtrls.filter((rowCtrl) => { + const rowNode = rowCtrl.rowNode; + return isRowInMap(rowNode, rowIdsMap); + }); + } + getCellCtrls(rowNodes, columns) { + let colIdsMap; + if (_exists(columns)) { + colIdsMap = {}; + columns.forEach((colKey) => { + const column = this.colModel.getCol(colKey); + if (_exists(column)) { + colIdsMap[column.getId()] = true; + } + }); + } + const res = []; + for (const rowCtrl of this.getRowCtrls(rowNodes)) { + for (const cellCtrl of rowCtrl.getAllCellCtrls()) { + const colId = cellCtrl.column.getId(); + const excludeColFromRefresh = colIdsMap && !colIdsMap[colId]; + if (excludeColFromRefresh) { + continue; + } + res.push(cellCtrl); + } + } + return res; + } + destroy() { + this.removeAllRowComps(true); + super.destroy(); + } + removeAllRowComps(suppressAnimation = false) { + const rowIndexesToRemove = Object.keys(this.rowCtrlsByRowIndex); + this.removeRowCtrls(rowIndexesToRemove, suppressAnimation); + this.stickyRowFeature?.destroyStickyCtrls(); + } + getRowsToRecycle() { + const stubNodeIndexes = []; + for (const index of Object.keys(this.rowCtrlsByRowIndex)) { + const rowCtrl = this.rowCtrlsByRowIndex[index]; + const stubNode = rowCtrl.rowNode.id == null; + if (stubNode) { + stubNodeIndexes.push(index); + } + } + this.removeRowCtrls(stubNodeIndexes); + const ctrlsByIdMap = {}; + for (const rowCtrl of Object.values(this.rowCtrlsByRowIndex)) { + const rowNode = rowCtrl.rowNode; + ctrlsByIdMap[rowNode.id] = rowCtrl; + } + this.rowCtrlsByRowIndex = {}; + return ctrlsByIdMap; + } + removeRowCtrls(rowsToRemove, suppressAnimation = false) { + for (const indexToRemove of rowsToRemove) { + const rowCtrl = this.rowCtrlsByRowIndex[indexToRemove]; + if (rowCtrl) { + rowCtrl.destroyFirstPass(suppressAnimation); + rowCtrl.destroySecondPass(); + } + delete this.rowCtrlsByRowIndex[indexToRemove]; + } + } + onBodyScroll(e) { + if (e.direction !== "vertical") { + return; + } + this.redraw({ afterScroll: true }); + } + redraw(params = {}) { + const { focusSvc, animationFrameSvc } = this.beans; + const { afterScroll } = params; + let cellFocused; + const stickyRowFeature = this.stickyRowFeature; + if (stickyRowFeature) { + cellFocused = focusSvc?.getFocusCellToUseAfterRefresh() || undefined; + } + const oldFirstRow = this.firstRenderedRow; + const oldLastRow = this.lastRenderedRow; + this.workOutFirstAndLastRowsToRender(); + let hasStickyRowChanges = false; + if (stickyRowFeature) { + hasStickyRowChanges = stickyRowFeature.checkStickyRows(); + const extraHeight = stickyRowFeature.extraTopHeight + stickyRowFeature.extraBottomHeight; + if (extraHeight) { + this.updateContainerHeights(extraHeight); + } + } + const rangeChanged = this.firstRenderedRow !== oldFirstRow || this.lastRenderedRow !== oldLastRow; + if (afterScroll && !hasStickyRowChanges && !rangeChanged) { + return; + } + this.getLockOnRefresh(); + this.recycleRows(null, false, afterScroll); + this.releaseLockOnRefresh(); + this.dispatchDisplayedRowsChanged(afterScroll && !hasStickyRowChanges); + if (cellFocused != null) { + const newFocusedCell = focusSvc?.getFocusCellToUseAfterRefresh(); + if (cellFocused != null && newFocusedCell == null) { + animationFrameSvc?.flushAllFrames(); + this.restoreFocusedCell(cellFocused); + } + } + } + removeRowCompsNotToDraw(indexesToDraw, suppressAnimation) { + const indexesToDrawMap = {}; + for (const index of indexesToDraw) { + indexesToDrawMap[index] = true; + } + const existingIndexes = Object.keys(this.rowCtrlsByRowIndex); + const indexesNotToDraw = existingIndexes.filter((index) => !indexesToDrawMap[index]); + this.removeRowCtrls(indexesNotToDraw, suppressAnimation); + } + calculateIndexesToDraw(rowsToRecycle) { + const indexesToDraw = []; + for (let i = this.firstRenderedRow;i <= this.lastRenderedRow; i++) { + indexesToDraw.push(i); + } + const pagination = this.beans.pagination; + const focusedRowIndex = this.beans.focusSvc?.getFocusedCell()?.rowIndex; + if (focusedRowIndex != null && (focusedRowIndex < this.firstRenderedRow || focusedRowIndex > this.lastRenderedRow) && (!pagination || pagination.isRowInPage(focusedRowIndex)) && focusedRowIndex < this.rowModel.getRowCount()) { + indexesToDraw.push(focusedRowIndex); + } + const checkRowToDraw = (rowComp) => { + const index = rowComp.rowNode.rowIndex; + if (index == null || index === focusedRowIndex) { + return; + } + if (index < this.firstRenderedRow || index > this.lastRenderedRow) { + if (this.doNotUnVirtualiseRow(rowComp)) { + indexesToDraw.push(index); + } + } + }; + for (const rowCtrl of Object.values(this.rowCtrlsByRowIndex)) { + checkRowToDraw(rowCtrl); + } + if (rowsToRecycle) { + for (const rowCtrl of Object.values(rowsToRecycle)) { + checkRowToDraw(rowCtrl); + } + } + indexesToDraw.sort((a, b) => a - b); + const ret = []; + for (let i = 0;i < indexesToDraw.length; i++) { + const currRow = indexesToDraw[i]; + const rowNode = this.rowModel.getRow(currRow); + if (rowNode && !rowNode.sticky) { + ret.push(currRow); + } + } + return ret; + } + recycleRows(rowsToRecycle, animate = false, afterScroll = false) { + const indexesToDraw = this.calculateIndexesToDraw(rowsToRecycle); + if (this.printLayout || afterScroll) { + animate = false; + } + this.removeRowCompsNotToDraw(indexesToDraw, !animate); + for (const rowIndex of indexesToDraw) { + this.createOrUpdateRowCtrl(rowIndex, rowsToRecycle, animate, afterScroll); + } + if (rowsToRecycle) { + const { animationFrameSvc } = this.beans; + const useAnimationFrame = animationFrameSvc?.active && afterScroll && !this.printLayout; + if (useAnimationFrame) { + animationFrameSvc.addDestroyTask(() => { + this.destroyRowCtrls(rowsToRecycle, animate); + this.updateAllRowCtrls(); + this.dispatchDisplayedRowsChanged(); + }); + } else { + this.destroyRowCtrls(rowsToRecycle, animate); + } + } + this.updateAllRowCtrls(); + } + dispatchDisplayedRowsChanged(afterScroll = false) { + this.eventSvc.dispatchEvent({ + type: "displayedRowsChanged", + afterScroll + }); + } + onDisplayedColumnsChanged() { + const { visibleCols } = this.beans; + const pinningLeft = visibleCols.isPinningLeft(); + const pinningRight = visibleCols.isPinningRight(); + const atLeastOneChanged = this.pinningLeft !== pinningLeft || pinningRight !== this.pinningRight; + if (atLeastOneChanged) { + this.pinningLeft = pinningLeft; + this.pinningRight = pinningRight; + if (this.embedFullWidthRows) { + this.redrawFullWidthEmbeddedRows(); + } + } + } + redrawFullWidthEmbeddedRows() { + const rowsToRemove = []; + for (const fullWidthCtrl of this.getFullWidthRowCtrls()) { + const rowIndex = fullWidthCtrl.rowNode.rowIndex; + rowsToRemove.push(rowIndex.toString()); + } + this.refreshFloatingRowComps(); + this.removeRowCtrls(rowsToRemove); + this.redraw({ afterScroll: true }); + } + getFullWidthRowCtrls(rowNodes) { + const rowNodesMap = mapRowNodes(rowNodes); + return this.getAllRowCtrls().filter((rowCtrl) => { + if (!rowCtrl.isFullWidth()) { + return false; + } + const rowNode = rowCtrl.rowNode; + if (rowNodesMap != null && !isRowInMap(rowNode, rowNodesMap)) { + return false; + } + return true; + }); + } + createOrUpdateRowCtrl(rowIndex, rowsToRecycle, animate, afterScroll) { + let rowNode; + let rowCtrl = this.rowCtrlsByRowIndex[rowIndex]; + if (!rowCtrl) { + rowNode = this.rowModel.getRow(rowIndex); + if (_exists(rowNode) && _exists(rowsToRecycle) && rowsToRecycle[rowNode.id] && rowNode.alreadyRendered) { + rowCtrl = rowsToRecycle[rowNode.id]; + rowsToRecycle[rowNode.id] = null; + } + } + const creatingNewRowCtrl = !rowCtrl; + if (creatingNewRowCtrl) { + if (!rowNode) { + rowNode = this.rowModel.getRow(rowIndex); + } + if (_exists(rowNode)) { + rowCtrl = this.createRowCon(rowNode, animate, afterScroll); + } else { + return; + } + } + if (rowNode) { + rowNode.alreadyRendered = true; + } + this.rowCtrlsByRowIndex[rowIndex] = rowCtrl; + } + destroyRowCtrls(rowCtrlsMap, animate) { + const executeInAWhileFuncs = []; + if (rowCtrlsMap) { + for (const rowCtrl of Object.values(rowCtrlsMap)) { + if (!rowCtrl) { + continue; + } + if (this.cachedRowCtrls && rowCtrl.isCacheable()) { + this.cachedRowCtrls.addRow(rowCtrl); + continue; + } + rowCtrl.destroyFirstPass(!animate); + if (animate) { + const instanceId = rowCtrl.instanceId; + this.zombieRowCtrls[instanceId] = rowCtrl; + executeInAWhileFuncs.push(() => { + rowCtrl.destroySecondPass(); + delete this.zombieRowCtrls[instanceId]; + }); + } else { + rowCtrl.destroySecondPass(); + } + } + } + if (animate) { + executeInAWhileFuncs.push(() => { + if (this.isAlive()) { + this.updateAllRowCtrls(); + this.dispatchDisplayedRowsChanged(); + } + }); + window.setTimeout(() => { + for (const func of executeInAWhileFuncs) { + func(); + } + }, ROW_ANIMATION_TIMEOUT); + } + } + getRowBuffer() { + return this.gos.get("rowBuffer"); + } + getRowBufferInPixels() { + const rowsToBuffer = this.getRowBuffer(); + const defaultRowHeight = _getRowHeightAsNumber(this.beans); + return rowsToBuffer * defaultRowHeight; + } + workOutFirstAndLastRowsToRender() { + const { rowContainerHeight, pageBounds, rowModel } = this; + rowContainerHeight.updateOffset(); + let newFirst; + let newLast; + if (!rowModel.isRowsToRender()) { + newFirst = 0; + newLast = -1; + } else if (this.printLayout) { + this.beans.environment.refreshRowHeightVariable(); + newFirst = pageBounds.getFirstRow(); + newLast = pageBounds.getLastRow(); + } else { + const bufferPixels = this.getRowBufferInPixels(); + const scrollFeature = this.ctrlsSvc.getScrollFeature(); + const suppressRowVirtualisation = this.gos.get("suppressRowVirtualisation"); + let rowHeightsChanged = false; + let firstPixel; + let lastPixel; + do { + const paginationOffset = pageBounds.getPixelOffset(); + const { pageFirstPixel, pageLastPixel } = pageBounds.getCurrentPagePixelRange(); + const divStretchOffset = rowContainerHeight.divStretchOffset; + const bodyVRange = scrollFeature.getVScrollPosition(); + const bodyTopPixel = bodyVRange.top; + const bodyBottomPixel = bodyVRange.bottom; + if (suppressRowVirtualisation) { + firstPixel = pageFirstPixel + divStretchOffset; + lastPixel = pageLastPixel + divStretchOffset; + } else { + firstPixel = Math.max(bodyTopPixel + paginationOffset - bufferPixels, pageFirstPixel) + divStretchOffset; + lastPixel = Math.min(bodyBottomPixel + paginationOffset + bufferPixels, pageLastPixel) + divStretchOffset; + } + this.firstVisibleVPixel = Math.max(bodyTopPixel + paginationOffset, pageFirstPixel) + divStretchOffset; + this.lastVisibleVPixel = Math.min(bodyBottomPixel + paginationOffset, pageLastPixel) + divStretchOffset; + rowHeightsChanged = this.ensureAllRowsInRangeHaveHeightsCalculated(firstPixel, lastPixel); + } while (rowHeightsChanged); + let firstRowIndex = rowModel.getRowIndexAtPixel(firstPixel); + let lastRowIndex = rowModel.getRowIndexAtPixel(lastPixel); + const pageFirstRow = pageBounds.getFirstRow(); + const pageLastRow = pageBounds.getLastRow(); + if (firstRowIndex < pageFirstRow) { + firstRowIndex = pageFirstRow; + } + if (lastRowIndex > pageLastRow) { + lastRowIndex = pageLastRow; + } + newFirst = firstRowIndex; + newLast = lastRowIndex; + } + const rowLayoutNormal = _isDomLayout(this.gos, "normal"); + const suppressRowCountRestriction = this.gos.get("suppressMaxRenderedRowRestriction"); + const rowBufferMaxSize = Math.max(this.getRowBuffer(), 500); + if (rowLayoutNormal && !suppressRowCountRestriction) { + if (newLast - newFirst > rowBufferMaxSize) { + newLast = newFirst + rowBufferMaxSize; + } + } + const firstDiffers = newFirst !== this.firstRenderedRow; + const lastDiffers = newLast !== this.lastRenderedRow; + if (firstDiffers || lastDiffers) { + this.firstRenderedRow = newFirst; + this.lastRenderedRow = newLast; + this.eventSvc.dispatchEvent({ + type: "viewportChanged", + firstRow: newFirst, + lastRow: newLast + }); + } + } + dispatchFirstDataRenderedEvent() { + if (this.dataFirstRenderedFired) { + return; + } + this.dataFirstRenderedFired = true; + _requestAnimationFrame(this.beans, () => { + this.beans.eventSvc.dispatchEvent({ + type: "firstDataRendered", + firstRow: this.firstRenderedRow, + lastRow: this.lastRenderedRow + }); + }); + } + ensureAllRowsInRangeHaveHeightsCalculated(topPixel, bottomPixel) { + const pinnedRowHeightsChanged = this.pinnedRowModel?.ensureRowHeightsValid(); + const stickyHeightsChanged = this.stickyRowFeature?.ensureRowHeightsValid(); + const { pageBounds, rowModel } = this; + const rowModelHeightsChanged = rowModel.ensureRowHeightsValid(topPixel, bottomPixel, pageBounds.getFirstRow(), pageBounds.getLastRow()); + if (rowModelHeightsChanged || stickyHeightsChanged) { + this.eventSvc.dispatchEvent({ + type: "recalculateRowBounds" + }); + } + if (stickyHeightsChanged || rowModelHeightsChanged || pinnedRowHeightsChanged) { + this.updateContainerHeights(); + return true; + } + return false; + } + doNotUnVirtualiseRow(rowCtrl) { + const REMOVE_ROW = false; + const KEEP_ROW = true; + const rowNode = rowCtrl.rowNode; + const rowHasFocus = this.focusSvc.isRowFocused(rowNode.rowIndex, rowNode.rowPinned); + const rowIsEditing = this.editSvc?.isEditing(rowCtrl); + const rowIsDetail = rowNode.detail; + const mightWantToKeepRow = rowHasFocus || rowIsEditing || rowIsDetail; + if (!mightWantToKeepRow) { + return REMOVE_ROW; + } + const rowNodePresent = this.isRowPresent(rowNode); + return rowNodePresent ? KEEP_ROW : REMOVE_ROW; + } + isRowPresent(rowNode) { + if (!this.rowModel.isRowPresent(rowNode)) { + return false; + } + return this.beans.pagination?.isRowInPage(rowNode.rowIndex) ?? true; + } + createRowCon(rowNode, animate, afterScroll) { + const rowCtrlFromCache = this.cachedRowCtrls?.getRow(rowNode) ?? null; + if (rowCtrlFromCache) { + return rowCtrlFromCache; + } + const useAnimationFrameForCreate = afterScroll && !this.printLayout && !!this.beans.animationFrameSvc?.active; + const res = new RowCtrl(rowNode, this.beans, animate, useAnimationFrameForCreate, this.printLayout); + return res; + } + getRenderedNodes() { + const viewportRows = Object.values(this.rowCtrlsByRowIndex).map((rowCtrl) => rowCtrl.rowNode); + const stickyTopRows = this.getStickyTopRowCtrls().map((rowCtrl) => rowCtrl.rowNode); + const stickyBottomRows = this.getStickyBottomRowCtrls().map((rowCtrl) => rowCtrl.rowNode); + return [...stickyTopRows, ...viewportRows, ...stickyBottomRows]; + } + getRowByPosition(rowPosition) { + let rowCtrl; + const { rowIndex } = rowPosition; + switch (rowPosition.rowPinned) { + case "top": + rowCtrl = this.topRowCtrls[rowIndex]; + break; + case "bottom": + rowCtrl = this.bottomRowCtrls[rowIndex]; + break; + default: + rowCtrl = this.rowCtrlsByRowIndex[rowIndex]; + if (!rowCtrl) { + rowCtrl = this.getStickyTopRowCtrls().find((ctrl) => ctrl.rowNode.rowIndex === rowIndex) || null; + if (!rowCtrl) { + rowCtrl = this.getStickyBottomRowCtrls().find((ctrl) => ctrl.rowNode.rowIndex === rowIndex) || null; + } + } + break; + } + return rowCtrl; + } + isRangeInRenderedViewport(startIndex, endIndex) { + const parentClosed = startIndex == null || endIndex == null; + if (parentClosed) { + return false; + } + const blockAfterViewport = startIndex > this.lastRenderedRow; + const blockBeforeViewport = endIndex < this.firstRenderedRow; + const blockInsideViewport = !blockBeforeViewport && !blockAfterViewport; + return blockInsideViewport; + } +}; +var RowCtrlCache = class { + constructor(maxCount) { + this.entriesMap = {}; + this.entriesList = []; + this.maxCount = maxCount; + } + addRow(rowCtrl) { + this.entriesMap[rowCtrl.rowNode.id] = rowCtrl; + this.entriesList.push(rowCtrl); + rowCtrl.setCached(true); + if (this.entriesList.length > this.maxCount) { + const rowCtrlToDestroy = this.entriesList[0]; + rowCtrlToDestroy.destroyFirstPass(); + rowCtrlToDestroy.destroySecondPass(); + this.removeFromCache(rowCtrlToDestroy); + } + } + getRow(rowNode) { + if (rowNode?.id == null) { + return null; + } + const res = this.entriesMap[rowNode.id]; + if (!res) { + return null; + } + this.removeFromCache(res); + res.setCached(false); + const rowNodeMismatch = res.rowNode != rowNode; + return rowNodeMismatch ? null : res; + } + has(rowNode) { + return this.entriesMap[rowNode.id] != null; + } + removeRow(rowNode) { + const rowNodeId = rowNode.id; + const ctrl = this.entriesMap[rowNodeId]; + delete this.entriesMap[rowNodeId]; + _removeFromArray(this.entriesList, ctrl); + } + removeFromCache(rowCtrl) { + const rowNodeId = rowCtrl.rowNode.id; + delete this.entriesMap[rowNodeId]; + _removeFromArray(this.entriesList, rowCtrl); + } + getEntries() { + return this.entriesList; + } +}; +function mapRowNodes(rowNodes) { + if (!rowNodes) { + return; + } + const res = { + top: {}, + bottom: {}, + normal: {} + }; + for (const rowNode of rowNodes) { + const id = rowNode.id; + switch (rowNode.rowPinned) { + case "top": + res.top[id] = rowNode; + break; + case "bottom": + res.bottom[id] = rowNode; + break; + default: + res.normal[id] = rowNode; + break; + } + } + return res; +} +function isRowInMap(rowNode, rowIdsMap) { + const id = rowNode.id; + const floating = rowNode.rowPinned; + switch (floating) { + case "top": + return rowIdsMap.top[id] != null; + case "bottom": + return rowIdsMap.bottom[id] != null; + default: + return rowIdsMap.normal[id] != null; + } +} +var RowNodeSorter = class extends BeanStub { + constructor() { + super(...arguments); + this.beanName = "rowNodeSorter"; + this.accentedSort = false; + this.primaryColumnsSortGroups = false; + this.pivotActive = false; + } + postConstruct() { + this.firstLeaf = _isClientSideRowModel(this.gos) ? _csrmFirstLeaf : defaultGetLeaf; + this.addManagedPropertyListeners(["accentedSort", "autoGroupColumnDef", "treeData"], this.updateOptions.bind(this)); + const updatePivotModeState = this.updatePivotModeState.bind(this); + this.addManagedEventListeners({ + columnPivotModeChanged: updatePivotModeState, + columnPivotChanged: updatePivotModeState + }); + this.updateOptions(); + updatePivotModeState(); + } + updateOptions() { + this.accentedSort = !!this.gos.get("accentedSort"); + this.primaryColumnsSortGroups = _isColumnsSortingCoupledToGroup(this.gos); + } + updatePivotModeState() { + this.pivotActive = this.beans.colModel.isPivotActive(); + } + doFullSortInPlace(rowNodes, sortOptions) { + return rowNodes.sort((a, b) => this.compareRowNodes(sortOptions, a, b)); + } + compareRowNodes(sortOptions, nodeA, nodeB) { + if (nodeA === nodeB) { + return 0; + } + const accentedCompare = this.accentedSort; + for (let i = 0, len = sortOptions.length;i < len; ++i) { + const sortOption = sortOptions[i]; + const isDescending = sortOption.sort === "desc"; + let valueA = this.getValue(nodeA, sortOption.column); + let valueB = this.getValue(nodeB, sortOption.column); + let comparatorResult; + const providedComparator = this.getComparator(sortOption, nodeA); + if (providedComparator) { + comparatorResult = providedComparator(valueA, valueB, nodeA, nodeB, isDescending); + } else { + if (sortOption.type === "absolute") { + valueA = absoluteValueTransformer(valueA); + valueB = absoluteValueTransformer(valueB); + } + comparatorResult = _defaultComparator(valueA, valueB, accentedCompare); + } + if (comparatorResult) { + return sortOption.sort === "asc" ? comparatorResult : -comparatorResult; + } + } + return 0; + } + getComparator(sortOption, rowNode) { + const colDef = sortOption.column.getColDef(); + const comparatorOnCol = this.getComparatorFromColDef(colDef, sortOption); + if (comparatorOnCol) { + return comparatorOnCol; + } + if (!colDef.showRowGroup) { + return; + } + const groupLeafField = !rowNode.group && colDef.field; + if (!groupLeafField) { + return; + } + const primaryColumn = this.beans.colModel.getColDefCol(groupLeafField); + if (!primaryColumn) { + return; + } + return this.getComparatorFromColDef(primaryColumn.getColDef(), sortOption); + } + getComparatorFromColDef(colDef, sortOption) { + const comparator = colDef.comparator; + if (comparator == null) { + return; + } + if (typeof comparator === "object") { + return comparator[_normalizeSortType(sortOption.type)]; + } + return comparator; + } + getValue(node, column) { + const beans = this.beans; + if (this.primaryColumnsSortGroups) { + if (node.rowGroupColumn === column) { + return this.getGroupDataValue(node, column); + } + if (node.group && column.getColDef().showRowGroup) { + return; + } + } + const value = beans.valueSvc.getValue(column, node, "data"); + if (column.isAllowFormula()) { + const formula = beans.formula; + if (formula?.isFormula(value)) { + return formula.resolveValue(column, node); + } + } + return value; + } + getGroupDataValue(node, column) { + if (_isGroupUseEntireRow(this.gos, this.pivotActive)) { + const leafChild = this.firstLeaf(node); + return leafChild && this.beans.valueSvc.getValue(column, leafChild, "data"); + } + const displayCol = this.beans.showRowGroupCols?.getShowRowGroupCol(column.getId()); + return displayCol ? node.groupData?.[displayCol.getId()] : undefined; + } +}; +var defaultGetLeaf = (row) => { + if (row.data) { + return row; + } + let childrenAfterGroup = row.childrenAfterGroup; + while (childrenAfterGroup?.length) { + const node = childrenAfterGroup[0]; + if (node.data) { + return node; + } + childrenAfterGroup = node.childrenAfterGroup; + } +}; +var absoluteValueTransformer = (value) => { + if (!value) { + return value; + } + if (typeof value === "bigint") { + return value < 0n ? -value : value; + } + const numberValue = Number(value); + return isNaN(numberValue) ? value : Math.abs(numberValue); +}; +function onSortChanged(beans) { + beans.sortSvc?.onSortChanged("api"); +} +var makeIconParams = (dataRefSuffix, classSuffix) => ({ + tag: "span", + ref: `eSort${dataRefSuffix}`, + cls: `ag-sort-indicator-icon ag-sort-${classSuffix} ag-hidden`, + attrs: { "aria-hidden": "true" } +}); +var SortIndicatorElement = { + tag: "span", + cls: "ag-sort-indicator-container", + children: [ + makeIconParams("Order", "order"), + makeIconParams("Asc", "ascending-icon"), + makeIconParams("Desc", "descending-icon"), + makeIconParams("Mixed", "mixed-icon"), + makeIconParams("AbsoluteAsc", "absolute-ascending-icon"), + makeIconParams("AbsoluteDesc", "absolute-descending-icon"), + makeIconParams("None", "none-icon") + ] +}; +var SortIndicatorComp = class extends Component { + constructor(skipTemplate) { + super(); + this.eSortOrder = RefPlaceholder; + this.eSortAsc = RefPlaceholder; + this.eSortDesc = RefPlaceholder; + this.eSortMixed = RefPlaceholder; + this.eSortNone = RefPlaceholder; + this.eSortAbsoluteAsc = RefPlaceholder; + this.eSortAbsoluteDesc = RefPlaceholder; + if (!skipTemplate) { + this.setTemplate(SortIndicatorElement); + } + } + attachCustomElements(eSortOrder, eSortAsc, eSortDesc, eSortMixed, eSortNone, eSortAbsoluteAsc, eSortAbsoluteDesc) { + this.eSortOrder = eSortOrder; + this.eSortAsc = eSortAsc; + this.eSortDesc = eSortDesc; + this.eSortMixed = eSortMixed; + this.eSortNone = eSortNone; + this.eSortAbsoluteAsc = eSortAbsoluteAsc; + this.eSortAbsoluteDesc = eSortAbsoluteDesc; + } + setupSort(column, suppressOrder = false, getSortDefOverride) { + this.column = column; + this.suppressOrder = suppressOrder; + this.getSortDefOverride = getSortDefOverride; + this.setupMultiSortIndicator(); + if (!column.isSortable() && !column.getColDef().showRowGroup) { + return; + } + this.addInIcon("sortAscending", this.eSortAsc, column); + this.addInIcon("sortDescending", this.eSortDesc, column); + this.addInIcon("sortUnSort", this.eSortNone, column); + this.addInIcon("sortAbsoluteAscending", this.eSortAbsoluteAsc, column); + this.addInIcon("sortAbsoluteDescending", this.eSortAbsoluteDesc, column); + const updateIcons = this.updateIcons.bind(this); + const sortUpdated = this.onSortChanged.bind(this); + this.addManagedPropertyListener("unSortIcon", updateIcons); + this.addManagedEventListeners({ + newColumnsLoaded: updateIcons, + sortChanged: sortUpdated, + columnRowGroupChanged: sortUpdated + }); + this.onSortChanged(); + } + addInIcon(iconName, eParent, column) { + if (eParent == null) { + return; + } + const eIcon = _createIconNoSpan(iconName, this.beans, column); + if (eIcon) { + eParent.appendChild(eIcon); + } + } + onSortChanged() { + this.updateIcons(); + if (!this.suppressOrder) { + this.updateSortOrder(); + } + } + updateIcons() { + const { eSortAsc, eSortDesc, eSortAbsoluteAsc, eSortAbsoluteDesc, eSortNone, column, gos, beans } = this; + const displaySort = _getDisplaySortForColumn(column, beans, this.getSortDefOverride); + const isDefaultSortAllowed = displaySort.isDefaultSortAllowed; + const isAbsoluteSortAllowed = displaySort.isAbsoluteSortAllowed; + const { isAbsoluteSort, isDefaultSort, isAscending, isDescending, direction } = displaySort; + if (eSortAsc) { + _setDisplayed(eSortAsc, isAscending && isDefaultSort && isDefaultSortAllowed, { skipAriaHidden: true }); + } + if (eSortDesc) { + _setDisplayed(eSortDesc, isDescending && isDefaultSort && isDefaultSortAllowed, { skipAriaHidden: true }); + } + if (eSortNone) { + const alwaysHideNoSort = !column.getColDef().unSortIcon && !gos.get("unSortIcon"); + _setDisplayed(eSortNone, !alwaysHideNoSort && !direction, { skipAriaHidden: true }); + } + if (eSortAbsoluteAsc) { + _setDisplayed(eSortAbsoluteAsc, isAscending && isAbsoluteSort && isAbsoluteSortAllowed, { + skipAriaHidden: true + }); + } + if (eSortAbsoluteDesc) { + _setDisplayed(eSortAbsoluteDesc, isDescending && isAbsoluteSort && isAbsoluteSortAllowed, { + skipAriaHidden: true + }); + } + } + setupMultiSortIndicator() { + const { eSortMixed, column, gos } = this; + this.addInIcon("sortUnSort", eSortMixed, column); + const isColumnShowingRowGroup = column.getColDef().showRowGroup; + const areGroupsCoupled = _isColumnsSortingCoupledToGroup(gos); + if (areGroupsCoupled && isColumnShowingRowGroup) { + this.addManagedEventListeners({ + sortChanged: this.updateMultiSortIndicator.bind(this), + columnRowGroupChanged: this.updateMultiSortIndicator.bind(this) + }); + this.updateMultiSortIndicator(); + } + } + updateMultiSortIndicator() { + const { eSortMixed, beans, column } = this; + if (eSortMixed) { + const isMixedSort = beans.sortSvc.getDisplaySortForColumn(column)?.direction === "mixed"; + _setDisplayed(eSortMixed, isMixedSort, { skipAriaHidden: true }); + } + } + updateSortOrder() { + const { + eSortOrder, + column, + beans: { sortSvc } + } = this; + if (!eSortOrder) { + return; + } + const allColumnsWithSorting = sortSvc.getColumnsWithSortingOrdered(); + const indexThisCol = sortSvc.getDisplaySortIndexForColumn(column) ?? -1; + const moreThanOneColSorting = allColumnsWithSorting.some((col) => sortSvc.getDisplaySortIndexForColumn(col) ?? -1 >= 1); + const showIndex = indexThisCol >= 0 && moreThanOneColSorting; + _setDisplayed(eSortOrder, showIndex, { skipAriaHidden: true }); + if (indexThisCol >= 0) { + eSortOrder.textContent = (indexThisCol + 1).toString(); + } else { + _clearElement(eSortOrder); + } + } + refresh() { + this.onSortChanged(); + } +}; +var SortIndicatorSelector = { + selector: "AG-SORT-INDICATOR", + component: SortIndicatorComp +}; +var SortService = class extends BeanStub { + constructor() { + super(...arguments); + this.beanName = "sortSvc"; + } + progressSort(column, multiSort, source) { + const nextDirection = this.getNextSortDirection(column); + this.setSortForColumn(column, nextDirection, multiSort, source); + } + progressSortFromEvent(column, event) { + const sortUsingCtrl = this.gos.get("multiSortKey") === "ctrl"; + const multiSort = sortUsingCtrl ? event.ctrlKey || event.metaKey : event.shiftKey; + this.progressSort(column, multiSort, "uiColumnSorted"); + } + setSortForColumn(column, sortDef, multiSort, source) { + const { gos, showRowGroupCols } = this.beans; + const isColumnsSortingCoupledToGroup = _isColumnsSortingCoupledToGroup(gos); + let columnsToUpdate = [column]; + if (isColumnsSortingCoupledToGroup) { + if (column.getColDef().showRowGroup) { + const rowGroupColumns = showRowGroupCols?.getSourceColumnsForGroupColumn?.(column); + const sortableRowGroupColumns = rowGroupColumns?.filter((col) => col.isSortable()); + if (sortableRowGroupColumns) { + columnsToUpdate = [column, ...sortableRowGroupColumns]; + } + } + } + for (const col of columnsToUpdate) { + this.setColSort(col, sortDef, source); + } + const doingMultiSort = (multiSort || gos.get("alwaysMultiSort")) && !gos.get("suppressMultiSort"); + const updatedColumns = []; + if (!doingMultiSort) { + const clearedColumns = this.clearSortBarTheseColumns(columnsToUpdate, source); + updatedColumns.push(...clearedColumns); + } + this.updateSortIndex(column); + updatedColumns.push(...columnsToUpdate); + this.dispatchSortChangedEvents(source, updatedColumns); + } + updateSortIndex(lastColToChange) { + const { gos, colModel, showRowGroupCols } = this.beans; + const isCoupled = _isColumnsSortingCoupledToGroup(gos); + const groupParent = showRowGroupCols?.getShowRowGroupCol(lastColToChange.getId()); + const lastSortIndexCol = isCoupled ? groupParent || lastColToChange : lastColToChange; + const allSortedCols = this.getColumnsWithSortingOrdered(); + colModel.forAllCols((col) => this.setColSortIndex(col, null)); + const allSortedColsWithoutChangesOrGroups = allSortedCols.filter((col) => { + if (isCoupled && col.getColDef().showRowGroup) { + return false; + } + return col !== lastSortIndexCol; + }); + const sortedColsWithIndices = lastSortIndexCol.getSortDef() ? [...allSortedColsWithoutChangesOrGroups, lastSortIndexCol] : allSortedColsWithoutChangesOrGroups; + sortedColsWithIndices.forEach((col, idx) => this.setColSortIndex(col, idx)); + } + onSortChanged(source, columns) { + this.dispatchSortChangedEvents(source, columns); + } + isSortActive() { + let isSorting = false; + this.beans.colModel.forAllCols((col) => { + if (col.getSortDef()) { + isSorting = true; + return true; + } + }); + return isSorting; + } + dispatchSortChangedEvents(source, columns) { + const event = { + type: "sortChanged", + source + }; + if (columns) { + event.columns = columns; + } + this.eventSvc.dispatchEvent(event); + } + clearSortBarTheseColumns(columnsToSkip, source) { + const clearedColumns = []; + this.beans.colModel.forAllCols((columnToClear) => { + if (!columnsToSkip.includes(columnToClear)) { + if (columnToClear.getSortDef()) { + clearedColumns.push(columnToClear); + } + this.setColSort(columnToClear, undefined, source); + } + }); + return clearedColumns; + } + getNextSortDirection(column, currentSort) { + const sortingOrder = column.getSortingOrder(); + const currentSortDef = currentSort === undefined ? column.getSortDef() : _getSortDefFromInput(currentSort); + const currentIndex = sortingOrder.findIndex((e) => _areSortDefsEqual(e, currentSortDef)); + let nextIndex = currentIndex + 1; + if (nextIndex >= sortingOrder.length) { + nextIndex = 0; + } + return _getSortDefFromInput(sortingOrder[nextIndex]); + } + getIndexedSortMap() { + const { gos, colModel, showRowGroupCols, rowGroupColsSvc } = this.beans; + let allSortedCols = []; + colModel.forAllCols((col) => { + if (col.getSortDef()) { + allSortedCols.push(col); + } + }); + if (colModel.isPivotMode()) { + const isSortingLinked = _isColumnsSortingCoupledToGroup(gos); + allSortedCols = allSortedCols.filter((col) => { + const isAggregated = !!col.getAggFunc(); + const isSecondary = !col.isPrimary(); + const isGroup = isSortingLinked ? showRowGroupCols?.getShowRowGroupCol(col.getId()) : col.getColDef().showRowGroup; + return isAggregated || isSecondary || isGroup; + }); + } + const sortedRowGroupCols = rowGroupColsSvc?.columns.filter((col) => !!col.getSortDef()) ?? []; + const allColsIndexes = {}; + allSortedCols.forEach((col, index) => allColsIndexes[col.getId()] = index); + allSortedCols.sort((a, b) => { + const iA = a.getSortIndex(); + const iB = b.getSortIndex(); + if (iA != null && iB != null) { + return iA - iB; + } else if (iA == null && iB == null) { + const posA = allColsIndexes[a.getId()]; + const posB = allColsIndexes[b.getId()]; + return posA > posB ? 1 : -1; + } else if (iB == null) { + return -1; + } else { + return 1; + } + }); + const isSortLinked = _isColumnsSortingCoupledToGroup(gos) && !!sortedRowGroupCols.length; + if (isSortLinked) { + allSortedCols = [ + ...new Set(allSortedCols.map((col) => showRowGroupCols?.getShowRowGroupCol(col.getId()) ?? col)) + ]; + } + const indexMap = /* @__PURE__ */ new Map; + allSortedCols.forEach((col, idx) => indexMap.set(col, idx)); + if (isSortLinked) { + for (const col of sortedRowGroupCols) { + const groupDisplayCol = showRowGroupCols.getShowRowGroupCol(col.getId()); + indexMap.set(col, indexMap.get(groupDisplayCol)); + } + } + return indexMap; + } + getColumnsWithSortingOrdered() { + return [...this.getIndexedSortMap().entries()].sort(([, idx1], [, idx2]) => idx1 - idx2).map(([col]) => col); + } + collectSortItems(asSortModel = false) { + const sortItems = []; + const columnsWithSortingOrdered = this.getColumnsWithSortingOrdered(); + for (const column of columnsWithSortingOrdered) { + const sort = column.getSortDef()?.direction; + if (!sort) { + continue; + } + const type = _normalizeSortType(column.getSortDef()?.type); + const sortItem = { sort, type }; + if (asSortModel) { + sortItem.colId = column.getId(); + } else { + sortItem.column = column; + } + sortItems.push(sortItem); + } + return sortItems; + } + getSortModel() { + return this.collectSortItems(true); + } + getSortOptions() { + return this.collectSortItems(); + } + canColumnDisplayMixedSort(column) { + const isColumnSortCouplingActive = _isColumnsSortingCoupledToGroup(this.gos); + const isGroupDisplayColumn = !!column.getColDef().showRowGroup; + return isColumnSortCouplingActive && isGroupDisplayColumn; + } + getDisplaySortForColumn(column) { + const linkedColumns = this.beans.showRowGroupCols?.getSourceColumnsForGroupColumn(column); + if (!this.canColumnDisplayMixedSort(column) || !linkedColumns?.length) { + return column.getSortDef(); + } + const columnHasUniqueData = column.getColDef().field != null || !!column.getColDef().valueGetter; + const sortableColumns = columnHasUniqueData ? [column, ...linkedColumns] : linkedColumns; + const firstSort = sortableColumns[0].getSortDef(); + const allMatch = sortableColumns.every((col) => _areSortDefsEqual(col.getSortDef(), firstSort)); + if (!allMatch) { + return { type: _normalizeSortType(column.getSortDef()?.type), direction: "mixed" }; + } + return firstSort; + } + getDisplaySortIndexForColumn(column) { + return this.getIndexedSortMap().get(column); + } + setupHeader(comp, column) { + const refreshStyles = () => { + const { type, direction } = _getSortDefFromInput(column.getSortDef()); + comp.toggleCss("ag-header-cell-sorted-asc", direction === "asc"); + comp.toggleCss("ag-header-cell-sorted-desc", direction === "desc"); + comp.toggleCss("ag-header-cell-sorted-abs-asc", type === "absolute" && direction === "asc"); + comp.toggleCss("ag-header-cell-sorted-abs-desc", type === "absolute" && direction === "desc"); + comp.toggleCss("ag-header-cell-sorted-none", !direction); + if (column.getColDef().showRowGroup) { + const sourceColumns = this.beans.showRowGroupCols?.getSourceColumnsForGroupColumn(column); + const sortDirectionsMatch = sourceColumns?.every((sourceCol) => direction == sourceCol.getSortDef()?.direction); + const isMultiSorting = !sortDirectionsMatch; + comp.toggleCss("ag-header-cell-sorted-mixed", isMultiSorting); + } + }; + comp.addManagedEventListeners({ + sortChanged: refreshStyles, + columnPinned: refreshStyles, + columnRowGroupChanged: refreshStyles, + displayedColumnsChanged: refreshStyles + }); + } + initCol(column) { + const { sortIndex, initialSortIndex } = column.colDef; + const sortDef = _getSortDefFromColDef(column.colDef); + if (sortDef) { + column.setSortDef(sortDef, true); + } + if (sortIndex !== undefined) { + if (sortIndex !== null) { + column.sortIndex = sortIndex; + } + } else if (initialSortIndex !== null) { + column.sortIndex = initialSortIndex; + } + } + updateColSort(column, sortDefOrDirection, source) { + if (sortDefOrDirection === undefined) { + return; + } + this.setColSort(column, _getSortDefFromInput(sortDefOrDirection), source); + } + setColSort(column, sort, source) { + if (!_areSortDefsEqual(column.getSortDef(), sort)) { + column.setSortDef(_getSortDefFromInput(sort), sort === undefined); + column.dispatchColEvent("sortChanged", source); + } + column.dispatchStateUpdatedEvent("sort"); + } + setColSortIndex(column, sortOrder) { + column.sortIndex = sortOrder; + column.dispatchStateUpdatedEvent("sortIndex"); + } + createSortIndicator(skipTemplate) { + return new SortIndicatorComp(skipTemplate); + } + getSortIndicatorSelector() { + return SortIndicatorSelector; + } +}; +var SortModule = { + moduleName: "Sort", + version: VERSION, + beans: [SortService, RowNodeSorter], + apiFunctions: { + onSortChanged + }, + userComponents: { + agSortIndicator: SortIndicatorComp + }, + icons: { + sortAscending: "asc", + sortDescending: "desc", + sortUnSort: "none", + sortAbsoluteAscending: "aasc", + sortAbsoluteDescending: "adesc" + } +}; +var SyncService = class extends BeanStub { + constructor() { + super(...arguments); + this.beanName = "syncSvc"; + this.waitingForColumns = false; + } + postConstruct() { + this.addManagedPropertyListener("columnDefs", (event) => this.setColumnDefs(event)); + } + start() { + this.beans.ctrlsSvc.whenReady(this, () => { + const columnDefs = this.gos.get("columnDefs"); + if (columnDefs) { + this.setColumnsAndData(columnDefs); + } else { + this.waitingForColumns = true; + } + this.gridReady(); + }); + } + setColumnsAndData(columnDefs) { + const { colModel, rowModel } = this.beans; + colModel.setColumnDefs(columnDefs ?? [], "gridInitializing"); + rowModel.start(); + } + gridReady() { + const { eventSvc, gos } = this; + eventSvc.dispatchEvent({ + type: "gridReady" + }); + _logIfDebug(gos, `initialised successfully, enterprise = ${gos.isModuleRegistered("EnterpriseCore")}`); + } + setColumnDefs(event) { + const columnDefs = this.gos.get("columnDefs"); + if (!columnDefs) { + return; + } + if (this.waitingForColumns) { + this.waitingForColumns = false; + this.setColumnsAndData(columnDefs); + return; + } + this.beans.colModel.setColumnDefs(columnDefs, _convertColumnEventSourceType(event.source)); + } +}; +var SOURCE_PASTE = "paste"; +var ChangeDetectionService = class extends BeanStub { + 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 = _getClientSideRowModel(this.beans); + this.addManagedEventListeners({ cellValueChanged: this.onCellValueChanged.bind(this) }); + } + beginDeferred() { + this.deferredDepth++; + } + endDeferred() { + if (this.deferredDepth === 0) { + return; + } + if (--this.deferredDepth > 0) { + return; + } + const path = this.batchedPath; + const nodes = this.batchedNodes; + this.batchedPath = null; + this.batchedNodes = null; + if (path) { + this.csrm?.doAggregate(path); + } + const { rowRenderer } = this.beans; + if (nodes) { + for (const node of nodes) { + refreshRowAndSiblings(rowRenderer, node); + } + } + if (path) { + const rows = path.getSortedRows(); + for (let i = 0, len = rows.length;i < len; ++i) { + refreshRowAndSiblings(rowRenderer, rows[i]); + } + } + if (this.batchedPath || this.batchedNodes) { + this.deferredDepth = 1; + this.endDeferred(); + } + } + onCellValueChanged(event) { + const { gos, rowModel, changedPathFactory } = this.beans; + if (event.source === SOURCE_PASTE || gos.get("suppressChangeDetection")) { + return; + } + if (!rowModel.rootNode) { + return; + } + const node = event.node.primaryRow; + if (this.csrm) { + let batchedPath = this.batchedPath; + if (!batchedPath) { + batchedPath = changedPathFactory?.newPath(gos.get("aggregateOnlyChangedColumns")) ?? null; + this.batchedPath = batchedPath; + } + let pathNode = node; + if (!node.group) { + const nodes = this.batchedNodes ?? (this.batchedNodes = /* @__PURE__ */ new Set); + nodes.add(node); + pathNode = node.parent; + } + batchedPath?.addCell(pathNode, event.column.getColId()); + } else { + const nodes = this.batchedNodes ?? (this.batchedNodes = /* @__PURE__ */ new Set); + nodes.add(node); + } + if (this.deferredDepth === 0) { + this.deferredDepth = 1; + this.endDeferred(); + } + } +}; +var refreshRowAndSiblings = (rowRenderer, node) => { + const { sibling, pinnedSibling } = node; + rowRenderer.refreshRowByNode(node); + rowRenderer.refreshRowByNode(sibling); + rowRenderer.refreshRowByNode(pinnedSibling); + rowRenderer.refreshRowByNode(sibling?.pinnedSibling); + rowRenderer.refreshRowByNode(pinnedSibling?.sibling); +}; +var ExpressionService = class extends BeanStub { + constructor() { + super(...arguments); + this.beanName = "expressionSvc"; + this.cache = {}; + } + evaluate(expression, params) { + if (typeof expression === "string") { + return this.evaluateExpression(expression, params); + } else { + _error(15, { expression }); + } + } + evaluateExpression(expression, params) { + try { + const javaScriptFunction = this.createExpressionFunction(expression); + const result = javaScriptFunction(params.value, params.context, params.oldValue, params.newValue, params.value, params.node, params.data, params.colDef, params.rowIndex, params.api, params.getValue, params.column, params.columnGroup); + return result; + } catch (e) { + _error(16, { expression, params, e }); + return null; + } + } + createExpressionFunction(expression) { + const expressionToFunctionCache = this.cache; + if (expressionToFunctionCache[expression]) { + return expressionToFunctionCache[expression]; + } + const functionBody = this.createFunctionBody(expression); + const theFunction = new Function("x, ctx, oldValue, newValue, value, node, data, colDef, rowIndex, api, getValue, column, columnGroup", functionBody); + expressionToFunctionCache[expression] = theFunction; + return theFunction; + } + createFunctionBody(expression) { + if (expression.includes("return")) { + return expression; + } else { + return "return " + expression + ";"; + } + } +}; +var ExpressionModule = { + moduleName: "Expression", + version: VERSION, + beans: [ExpressionService] +}; +var ChangeDetectionModule = { + moduleName: "ChangeDetection", + version: VERSION, + beans: [ChangeDetectionService] +}; +var ValueService = class extends BeanStub { + constructor() { + super(...arguments); + this.beanName = "valueSvc"; + this.initialised = false; + this.isSsrm = false; + } + wireBeans(beans) { + this.expressionSvc = beans.expressionSvc; + this.colModel = beans.colModel; + this.valueCache = beans.valueCache; + this.dataTypeSvc = beans.dataTypeSvc; + this.editSvc = beans.editSvc; + this.formulaDataSvc = beans.formulaDataSvc; + this.rowGroupColsSvc = beans.rowGroupColsSvc; + } + postConstruct() { + if (!this.initialised) { + this.init(); + } + } + init() { + const { gos, valueCache } = this; + this.executeValueGetter = valueCache ? this.executeValueGetterWithValueCache.bind(this) : this.executeValueGetterWithoutValueCache.bind(this); + this.isSsrm = _isServerSideRowModel(gos); + this.cellExpressions = gos.get("enableCellExpressions"); + this.isTreeData = gos.get("treeData"); + this.initialised = true; + const listener = (event) => this.callColumnCellValueChangedHandler(event); + this.eventSvc.addListener("cellValueChanged", listener, true); + this.addDestroyFunc(() => this.eventSvc.removeListener("cellValueChanged", listener, true)); + this.addManagedPropertyListener("treeData", (propChange) => this.isTreeData = propChange.currentValue); + } + getValueForDisplay(params) { + const beans = this.beans; + const column = params.column; + const node = params.node; + const showRowGroupColValueSvc = beans.showRowGroupColValueSvc; + const isFullWidthGroup = !column && node.group; + const isGroupCol = column?.colDef.showRowGroup; + const processTreeDataAsGroup = !this.isTreeData || node.footer; + if (showRowGroupColValueSvc && processTreeDataAsGroup && (isFullWidthGroup || isGroupCol)) { + const groupValue = showRowGroupColValueSvc.getGroupValue(node, column, this.displayIgnoresAggData(node)); + if (groupValue == null) { + return { + value: null, + valueFormatted: null + }; + } + return { + value: groupValue.value, + valueFormatted: params.includeValueFormatted ? showRowGroupColValueSvc.formatAndPrefixGroupColValue(groupValue, column, params.exporting) : null + }; + } + if (!column) { + return { + value: node.key, + valueFormatted: null + }; + } + let value = this.getValue(column, node, params.from, this.displayIgnoresAggData(node)); + let valueToFormat = value; + const formula = beans.formula; + if (column.isAllowFormula() && formula?.isFormula(value)) { + if (params.useRawFormula) { + value = formula.normaliseFormula(value, true); + valueToFormat = formula.resolveValue(column, node); + } else { + value = formula.resolveValue(column, node); + valueToFormat = value; + } + } + const format = params.includeValueFormatted && !(params.exporting && column.colDef.useValueFormatterForExport === false); + return { + value, + valueFormatted: format ? this.formatValue(column, node, valueToFormat) : null + }; + } + getValue(column, rowNode, from, ignoreAggData = false) { + if (!this.initialised) { + this.init(); + } + if (!rowNode) { + return; + } + const colDef = column.colDef; + const isGroup = rowNode.group; + if (!isGroup) { + const pivotValueColumn = colDef.pivotValueColumn; + if (pivotValueColumn) { + column = pivotValueColumn; + } + } + const pending = this.editSvc?.getPendingEditValue(rowNode, column, from); + if (pending !== undefined) { + return pending; + } + let result = this.resolveValue(column, rowNode, ignoreAggData, isGroup); + if (result === undefined) { + if (isGroup) { + const rowGroupColId = colDef.showRowGroup; + if (typeof rowGroupColId === "string") { + const colRowGroupIndex = this.rowGroupColsSvc?.getColumnIndex(rowGroupColId); + if (colRowGroupIndex != null && colRowGroupIndex > rowNode.level) { + return null; + } + } + } + return; + } + if (this.cellExpressions && _isExpressionString(result)) { + const cellValueGetter = result.substring(1); + result = this.executeValueGetter(cellValueGetter, rowNode.data, column, rowNode); + } + return result; + } + displayIgnoresAggData(node) { + if (!node.group || node.footer || node.level === -1) { + return false; + } + if (!node.sibling || this.gos.get("groupSuppressBlankHeader")) { + return false; + } + if (node.leafGroup && this.colModel.isPivotMode()) { + return false; + } + return !!node.expanded; + } + resolveValue(column, rowNode, ignoreAggData, isGroup) { + const colDef = column.colDef; + const colId = column.colId; + const formulaDataSvc = !isGroup && this.formulaDataSvc; + if (formulaDataSvc && formulaDataSvc.hasDataSource() && colDef.allowFormula === true) { + const formula = formulaDataSvc.getFormula({ column, rowNode }); + if (_isExpressionString(formula)) { + return formula; + } + } + const aggData = isGroup && !ignoreAggData ? rowNode.aggData : undefined; + const isTreeData = this.isTreeData; + if (isTreeData && aggData?.[colId] !== undefined) { + return aggData[colId]; + } + const data = rowNode.data; + const field = colDef.field; + const valueGetter = colDef.valueGetter; + if (isTreeData) { + if (valueGetter) { + return this.executeValueGetter(valueGetter, data, column, rowNode); + } + if (field && data) { + return _getValueUsingField(data, field, column.isFieldContainsDots()); + } + } + const groupData = rowNode.groupData; + if (groupData && colId in groupData) { + return groupData[colId]; + } + if (aggData?.[colId] !== undefined) { + return aggData[colId]; + } + const rowGroupColId = colDef.showRowGroup; + const allowUserValuesForCell = typeof rowGroupColId !== "string" || !isGroup; + const isSsrm = this.isSsrm; + const ignoreSsrmAggData = isSsrm && ignoreAggData && !!colDef.aggFunc; + if (valueGetter && !ignoreSsrmAggData) { + return allowUserValuesForCell ? this.executeValueGetter(valueGetter, data, column, rowNode) : undefined; + } + const ssrmFooterGroupCol = isSsrm && rowNode.footer && rowNode.field && (rowGroupColId === true || rowGroupColId === rowNode.field); + if (ssrmFooterGroupCol) { + return _getValueUsingField(data, rowNode.field, column.isFieldContainsDots()); + } + if (field && data && !ignoreSsrmAggData) { + return allowUserValuesForCell ? _getValueUsingField(data, field, column.isFieldContainsDots()) : undefined; + } + return; + } + parseValue(column, rowNode, newValue, oldValue) { + const colDef = column.getColDef(); + if (colDef.allowFormula && this.beans.formula?.isFormula(newValue)) { + return newValue; + } + const valueParser = colDef.valueParser; + if (_exists(valueParser)) { + const params = _addGridCommonParams(this.gos, { + node: rowNode, + data: rowNode?.data, + oldValue, + newValue, + colDef, + column + }); + if (typeof valueParser === "function") { + return valueParser(params); + } + return this.expressionSvc?.evaluate(valueParser, params); + } + return newValue; + } + getDeleteValue(column, rowNode) { + if (_exists(column.getColDef().valueParser)) { + return this.parseValue(column, rowNode, "", this.getValueForDisplay({ column, node: rowNode, from: "edit" }).value) ?? null; + } + return null; + } + formatValue(column, node, value, suppliedFormatter, useFormatterFromColumn = true) { + const { expressionSvc } = this.beans; + let result = null; + let formatter; + const colDef = column.getColDef(); + if (suppliedFormatter) { + formatter = suppliedFormatter; + } else if (useFormatterFromColumn) { + formatter = colDef.valueFormatter; + } + if (formatter) { + const data = node ? node.data : null; + const params = _addGridCommonParams(this.gos, { + value, + node, + data, + colDef, + column + }); + if (typeof formatter === "function") { + result = formatter(params); + } else { + result = expressionSvc ? expressionSvc.evaluate(formatter, params) : null; + } + } else if (colDef.refData) { + return colDef.refData[value] || ""; + } + if (result == null && Array.isArray(value)) { + result = value.join(", "); + } + return result; + } + setValue(rowNode, column, newValue, eventSource) { + const colDef = column.getColDef(); + if (!rowNode.data && this.canCreateRowNodeData(rowNode, colDef)) { + rowNode.data = {}; + } + if (!this.isSetValueSupported(column, rowNode, newValue, colDef)) { + return false; + } + const oldValue = this.getValue(column, rowNode, "data"); + const params = _addGridCommonParams(this.gos, { + node: rowNode, + data: rowNode.data, + oldValue, + newValue, + colDef, + column + }); + let valueSetterChanged = false; + if (rowNode.data) { + const externalFormulaResult = this.handleExternalFormulaChange({ + column, + eventSource, + newValue, + setterParams: params, + rowNode + }); + if (externalFormulaResult !== null) { + return externalFormulaResult; + } + const result = this.computeValueChange({ + column, + rowNode, + newValue, + params, + rowData: rowNode.data, + valueSetter: colDef.valueSetter, + field: colDef.field + }); + valueSetterChanged = result ?? true; + } + const changeDetectionSvc = this.beans.changeDetectionSvc; + changeDetectionSvc?.beginDeferred(); + try { + if (rowNode.group) { + const groupResult = this.beans.rowGroupingEditValueSvc?.setGroupDataValue(rowNode, column, newValue, oldValue, eventSource, valueSetterChanged || newValue !== oldValue); + if (groupResult !== undefined) { + if (!valueSetterChanged && !groupResult) { + return false; + } + return this.finishValueChange(rowNode, column, params, eventSource, newValue); + } + } + if (!valueSetterChanged) { + return false; + } + return this.finishValueChange(rowNode, column, params, eventSource); + } finally { + changeDetectionSvc?.endDeferred(); + } + } + canCreateRowNodeData(rowNode, colDef) { + if (!rowNode.group) { + return true; + } + if (colDef.groupRowValueSetter != null || colDef.groupRowEditable != null) { + return false; + } + if (colDef.pivotValueColumn) { + return false; + } + return true; + } + finishValueChange(rowNode, column, params, eventSource, savedValueOverride) { + rowNode.resetQuickFilterAggregateText(); + this.valueCache?.onDataChanged(); + const savedValue = savedValueOverride === undefined ? this.getValue(column, rowNode, "data") : savedValueOverride; + this.dispatchCellValueChangedEvent(rowNode, params, savedValue, eventSource); + if (rowNode.pinnedSibling) { + this.dispatchCellValueChangedEvent(rowNode.pinnedSibling, params, savedValue, eventSource); + } + return true; + } + isSetValueSupported(column, rowNode, newValue, colDef) { + const { field, valueSetter } = colDef; + const formulaSvc = this.beans.formula; + const isFormulaValue = column.isAllowFormula() && formulaSvc?.isFormula(newValue); + const hasExternalFormulaData = !!this.formulaDataSvc?.hasDataSource(); + if (_missing(field) && _missing(valueSetter) && !(hasExternalFormulaData && isFormulaValue)) { + if (rowNode.group && (colDef.groupRowValueSetter || colDef.groupRowEditable)) { + return true; + } + _warn(17); + return false; + } + if (this.dataTypeSvc && !this.dataTypeSvc.checkType(column, newValue)) { + _warn(135); + return false; + } + return true; + } + handleExternalFormulaChange(args) { + const { column, rowNode, newValue, eventSource, setterParams } = args; + const formulaSvc = this.beans.formula; + const formulaDataSvc = this.formulaDataSvc; + if (!formulaDataSvc?.hasDataSource() || !column.isAllowFormula()) { + return null; + } + const isFormulaValue = formulaSvc?.isFormula(newValue); + const existingFormula = formulaDataSvc.getFormula({ column, rowNode }); + if (isFormulaValue) { + const valueWasDifferent = existingFormula !== newValue; + if (!valueWasDifferent) { + return false; + } + formulaDataSvc.setFormula({ column, rowNode, formula: newValue }); + const computedValue = formulaSvc?.resolveValue(column, rowNode); + const colDef = column.getColDef(); + if (_exists(colDef.valueSetter) || !_missing(colDef.field)) { + const computedParams = { ...setterParams, newValue: computedValue }; + this.computeValueChange({ + column, + rowNode, + newValue: computedValue, + params: computedParams, + rowData: rowNode.data, + valueSetter: colDef.valueSetter, + field: colDef.field + }); + } + return this.finishValueChange(rowNode, column, setterParams, eventSource); + } + if (existingFormula !== undefined) { + formulaDataSvc.setFormula({ column, rowNode, formula: undefined }); + } + return null; + } + computeValueChange(params) { + const { valueSetter, params: setterParams, rowData, field, column, newValue } = params; + if (_exists(valueSetter)) { + if (typeof valueSetter === "function") { + return valueSetter(setterParams); + } + return this.expressionSvc?.evaluate(valueSetter, setterParams); + } + return !!rowData && this.setValueUsingField(rowData, field, newValue, column.isFieldContainsDots()); + } + dispatchCellValueChangedEvent(rowNode, params, value, source) { + this.eventSvc.dispatchEvent({ + type: "cellValueChanged", + event: null, + rowIndex: rowNode.rowIndex, + rowPinned: rowNode.rowPinned, + column: params.column, + colDef: params.colDef, + data: rowNode.data, + node: rowNode, + oldValue: params.oldValue, + newValue: value, + newRawValue: params.newValue, + value, + source + }); + } + callColumnCellValueChangedHandler(event) { + const onCellValueChanged = event.colDef.onCellValueChanged; + if (typeof onCellValueChanged === "function") { + this.beans.frameworkOverrides.wrapOutgoing(() => { + onCellValueChanged(event); + }); + } + } + setValueUsingField(data, field, newValue, isFieldContainsDots) { + if (!field) { + return false; + } + let valuesAreSame = false; + if (!isFieldContainsDots) { + valuesAreSame = data[field] === newValue; + if (!valuesAreSame) { + data[field] = newValue; + } + } else { + const fieldPieces = field.split("."); + let currentObject = data; + while (fieldPieces.length > 0 && currentObject) { + const fieldPiece = fieldPieces.shift(); + if (fieldPieces.length === 0) { + valuesAreSame = currentObject[fieldPiece] === newValue; + if (!valuesAreSame) { + currentObject[fieldPiece] = newValue; + } + } else { + currentObject = currentObject[fieldPiece]; + } + } + } + return !valuesAreSame; + } + executeValueGetterWithValueCache(valueGetter, data, column, rowNode) { + const colId = column.getColId(); + const valueFromCache = this.valueCache.getValue(rowNode, colId); + if (valueFromCache !== undefined) { + return valueFromCache; + } + const result = this.executeValueGetterWithoutValueCache(valueGetter, data, column, rowNode); + this.valueCache.setValue(rowNode, colId, result); + return result; + } + executeValueGetterWithoutValueCache(valueGetter, data, column, rowNode) { + const params = _addGridCommonParams(this.gos, { + data, + node: rowNode, + column, + colDef: column.getColDef(), + getValue: (field) => this.getValueCallback(rowNode, field) + }); + let result; + if (typeof valueGetter === "function") { + result = valueGetter(params); + } else { + result = this.expressionSvc?.evaluate(valueGetter, params); + } + return result; + } + getValueCallback(node, field) { + const otherColumn = this.colModel.getColDefCol(field); + if (otherColumn) { + return this.getValue(otherColumn, node, "data"); + } + return null; + } + getKeyForNode(col, rowNode) { + const value = this.getValue(col, rowNode, "data"); + const keyCreator = col.getColDef().keyCreator; + let result = value; + if (keyCreator) { + const keyParams = _addGridCommonParams(this.gos, { + value, + colDef: col.getColDef(), + column: col, + node: rowNode, + data: rowNode.data + }); + result = keyCreator(keyParams); + } + if (typeof result === "string" || result == null) { + return result; + } + result = String(result); + if (result === "[object Object]") { + _warn(121); + } + return result; + } +}; +var CommunityCoreModule = { + moduleName: "CommunityCore", + version: VERSION, + beans: [ + GridDestroyService, + ApiFunctionService, + Registry, + UserComponentFactory, + RowContainerHeightService, + VisibleColsService, + EventService, + GridOptionsService, + ColumnModel, + PageBoundsService, + PageBoundsListener, + RowRenderer, + ValueService, + FocusService, + Environment, + ScrollVisibleService, + CtrlsService, + SyncService, + ColumnNameService, + ColumnViewportService, + IconService + ], + 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, + destroy, + isDestroyed, + getGridOption, + setGridOption, + updateGridOptions, + isModuleRegistered + }, + dependsOn: [ + DataTypeModule, + ColumnMoveModule, + ColumnResizeModule, + SortModule, + ColumnHeaderCompModule, + ColumnGroupModule, + ColumnGroupHeaderCompModule, + OverlayModule, + ChangeDetectionModule, + AnimationFrameModule, + KeyboardNavigationModule, + PinnedColumnModule, + AriaModule, + TouchModule, + CellRendererFunctionModule, + ColumnFlexModule, + ExpressionModule, + SkeletonCellRendererModule, + ColumnDelayRenderModule + ] +}; +function _fuzzySuggestions(params) { + const { inputValue, allSuggestions, hideIrrelevant, filterByPercentageOfBestMatch } = params; + let thisSuggestions = (allSuggestions ?? []).map((text, idx) => ({ + value: text, + relevance: _getLevenshteinSimilarityDistance(inputValue, text), + idx + })); + thisSuggestions.sort((a, b) => a.relevance - b.relevance); + if (hideIrrelevant) { + thisSuggestions = thisSuggestions.filter((suggestion) => suggestion.relevance < Math.max(suggestion.value.length, inputValue.length)); + } + if (thisSuggestions.length > 0 && filterByPercentageOfBestMatch && filterByPercentageOfBestMatch > 0) { + const bestMatch = thisSuggestions[0].relevance; + const limit = bestMatch * filterByPercentageOfBestMatch; + thisSuggestions = thisSuggestions.filter((suggestion) => limit - suggestion.relevance < 0); + } + const values = []; + const indices = []; + for (const suggestion of thisSuggestions) { + values.push(suggestion.value); + indices.push(suggestion.idx); + } + return { values, indices }; +} +function _getLevenshteinSimilarityDistance(source, target) { + const sourceLength = source.length; + const targetLength = target.length; + if (targetLength === 0) { + return sourceLength ? sourceLength : 0; + } + let inputLower = source.toLocaleLowerCase(); + let targetLower = target.toLocaleLowerCase(); + let swapTmp; + if (source.length < target.length) { + swapTmp = targetLower; + targetLower = inputLower; + inputLower = swapTmp; + swapTmp = target; + target = source; + source = swapTmp; + } + let previousRow = new Uint16Array(targetLength + 1); + let currentRow = new Uint16Array(targetLength + 1); + for (let j = 0;j <= targetLength; j++) { + previousRow[j] = j; + } + let secondaryScore = 0; + const earlyMatchLimit = sourceLength / 2 - 10; + for (let i = 1;i <= sourceLength; i++) { + const inputChar = source[i - 1]; + const inputCharLower = inputLower[i - 1]; + currentRow[0] = i; + for (let j = 1;j <= targetLength; j++) { + const targetChar = target[j - 1]; + const targetCharLower = targetLower[j - 1]; + if (inputCharLower !== targetCharLower) { + const insertCost = currentRow[j - 1]; + const deleteCost = previousRow[j]; + const replaceCost = previousRow[j - 1]; + let cost = insertCost < deleteCost ? insertCost : deleteCost; + if (replaceCost < cost) { + cost = replaceCost; + } + currentRow[j] = cost + 1 | 0; + continue; + } + secondaryScore++; + if (inputChar === targetChar) { + secondaryScore++; + } + if (i > 1 && j > 1) { + const prevSourceChar = source[i - 2]; + const prevSourceCharLower = inputLower[i - 2]; + const prevTargetChar = target[j - 2]; + const prevTargetCharLower = targetLower[j - 2]; + if (prevSourceCharLower === prevTargetCharLower) { + secondaryScore++; + if (prevSourceChar === prevTargetChar) { + secondaryScore++; + } + } + } + if (i < earlyMatchLimit) { + secondaryScore++; + } + currentRow[j] = previousRow[j - 1]; + } + swapTmp = previousRow; + previousRow = currentRow; + currentRow = swapTmp; + } + return previousRow[targetLength] / (secondaryScore + 1); +} +var ENTERPRISE_MODULE_NAMES = { + AdvancedFilter: 1, + AiToolkit: 1, + AllEnterprise: 1, + BatchEdit: 1, + CellSelection: 1, + Clipboard: 1, + ColumnMenu: 1, + ColumnsToolPanel: 1, + ContextMenu: 1, + ExcelExport: 1, + FiltersToolPanel: 1, + Find: 1, + GridCharts: 1, + IntegratedCharts: 1, + GroupFilter: 1, + MasterDetail: 1, + Menu: 1, + MultiFilter: 1, + NewFiltersToolPanel: 1, + Pivot: 1, + RangeSelection: 1, + RichSelect: 1, + RowNumbers: 1, + RowGrouping: 1, + RowGroupingEdit: 1, + RowGroupingPanel: 1, + ServerSideRowModelApi: 1, + ServerSideRowModel: 1, + SetFilter: 1, + SideBar: 1, + Sparklines: 1, + StatusBar: 1, + TreeData: 1, + ViewportRowModel: 1, + Formula: 1 +}; +var ALL_COLUMN_FILTERS = [ + "TextFilter", + "NumberFilter", + "BigIntFilter", + "DateFilter", + "SetFilter", + "MultiFilter", + "GroupFilter", + "CustomFilter" +]; +var RESOLVABLE_MODULE_NAMES = { + EditCore: [ + "TextEditor", + "NumberEditor", + "DateEditor", + "CheckboxEditor", + "LargeTextEditor", + "SelectEditor", + "RichSelect", + "CustomEditor" + ], + CheckboxCellRenderer: ["AllCommunity"], + ClientSideRowModelHierarchy: ["RowGrouping", "Pivot", "TreeData"], + ColumnFilter: ALL_COLUMN_FILTERS, + ColumnGroupHeaderComp: ["AllCommunity"], + ColumnGroup: ["AllCommunity"], + ColumnHeaderComp: ["AllCommunity"], + ColumnMove: ["AllCommunity"], + ColumnResize: ["AllCommunity"], + CommunityCore: ["AllCommunity"], + CsrmSsrmSharedApi: ["ClientSideRowModelApi", "ServerSideRowModelApi"], + RowModelSharedApi: ["ClientSideRowModelApi", "ServerSideRowModelApi"], + EnterpriseCore: ["AllEnterprise"], + FilterCore: [...ALL_COLUMN_FILTERS, "QuickFilter", "ExternalFilter", "AdvancedFilter"], + GroupCellRenderer: ["RowGrouping", "Pivot", "TreeData", "MasterDetail", "ServerSideRowModel"], + KeyboardNavigation: ["AllCommunity"], + LoadingCellRenderer: ["ServerSideRowModel"], + MenuCore: ["ColumnMenu", "ContextMenu"], + MenuItem: ["ColumnMenu", "ContextMenu", "MultiFilter", "IntegratedCharts", "ColumnsToolPanel"], + Overlay: ["AllCommunity"], + PinnedColumn: ["AllCommunity"], + SharedAggregation: ["RowGrouping", "Pivot", "TreeData", "ServerSideRowModel"], + SharedDragAndDrop: ["AllCommunity"], + SharedMasterDetail: ["MasterDetail", "ServerSideRowModel"], + SharedMenu: [...ALL_COLUMN_FILTERS, "ColumnMenu", "ContextMenu"], + SharedPivot: ["Pivot", "ServerSideRowModel"], + SharedRowGrouping: ["RowGrouping", "ServerSideRowModel"], + SharedRowSelection: ["RowSelection", "ServerSideRowModel"], + SkeletonCellRenderer: ["ServerSideRowModel"], + Sort: ["AllCommunity"], + SsrmInfiniteSharedApi: ["InfiniteRowModel", "ServerSideRowModelApi"], + SharedTreeData: ["TreeData", "ServerSideRowModel"] +}; +var MODULES_FOR_ROW_MODELS = { + InfiniteRowModel: "infinite", + ClientSideRowModelApi: "clientSide", + ClientSideRowModel: "clientSide", + ServerSideRowModelApi: "serverSide", + ServerSideRowModel: "serverSide", + ViewportRowModel: "viewport" +}; +function resolveModuleNames(moduleName, rowModelType) { + const resolvedModuleNames = []; + for (const modName of Array.isArray(moduleName) ? moduleName : [moduleName]) { + const resolved = RESOLVABLE_MODULE_NAMES[modName]; + if (resolved) { + for (const resolvedModName of resolved) { + const rowModelForModule = MODULES_FOR_ROW_MODELS[resolvedModName]; + if (!rowModelForModule || rowModelForModule === rowModelType) { + resolvedModuleNames.push(resolvedModName); + } + } + } else { + resolvedModuleNames.push(modName); + } + } + return resolvedModuleNames; +} +var NoModulesRegisteredError = () => `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 ]); + `; +var moduleImportMsg = (moduleNames) => { + const imports = moduleNames.map((moduleName) => `import { ${convertToUserModuleName(moduleName)} } from '${ENTERPRISE_MODULE_NAMES[moduleName] ? "ag-grid-enterprise" : "ag-grid-community"}';`); + const includeCharts = moduleNames.some((m) => m === "IntegratedCharts" || m === "Sparklines"); + if (includeCharts) { + const chartImport = `import { AgChartsEnterpriseModule } from 'ag-charts-enterprise';`; + imports.push(chartImport); + } + return `import { ModuleRegistry } from 'ag-grid-community'; +${imports.join(` +`)} + +ModuleRegistry.registerModules([ ${moduleNames.map((m) => convertToUserModuleName(m, true)).join(", ")} ]); + +For more info see: ${baseDocLink}/modules/`; +}; +function convertToUserModuleName(moduleName, inModuleRegistration = false) { + if (inModuleRegistration && (moduleName === "IntegratedCharts" || moduleName === "Sparklines")) { + return `${moduleName}Module.with(AgChartsEnterpriseModule)`; + } + return `${moduleName}Module`; +} +function umdMissingModule(reasonOrId, moduleNames) { + const chartModules = moduleNames.filter((m) => m === "IntegratedCharts" || m === "Sparklines"); + let message = ""; + const agChartsDynamic = globalThis?.agCharts; + if (!agChartsDynamic && chartModules.length > 0) { + message = `Unable to use ${reasonOrId} as either the ag-charts-community or ag-charts-enterprise script needs to be included alongside ag-grid-enterprise. +`; + } else if (moduleNames.some((m) => ENTERPRISE_MODULE_NAMES[m])) { + message = message + `Unable to use ${reasonOrId} as that requires the ag-grid-enterprise script to be included. +`; + } + return message; +} +function missingRowModelTypeError({ + moduleName, + rowModelType +}) { + return `To use the ${moduleName}Module you must set the gridOption "rowModelType='${rowModelType}'"`; +} +var missingModule = ({ + reasonOrId, + moduleName, + gridScoped, + gridId, + rowModelType, + additionalText, + isUmd: isUmd2 +}) => { + const resolvedModuleNames = resolveModuleNames(moduleName, rowModelType); + const reason = typeof reasonOrId === "string" ? reasonOrId : MISSING_MODULE_REASONS[reasonOrId]; + if (isUmd2) { + return umdMissingModule(reason, resolvedModuleNames); + } + const chartModules = resolvedModuleNames.filter((m) => m === "IntegratedCharts" || m === "Sparklines"); + const chartImportRequired = chartModules.length > 0 ? `${chartModules.map((m) => convertToUserModuleName(m)).join()} must be initialised with an AG Charts module. One of 'AgChartsCommunityModule' / 'AgChartsEnterpriseModule'.` : ""; + const explanation = `Unable to use ${reason} as ${resolvedModuleNames.length > 1 ? "one of " + resolvedModuleNames.map((m) => convertToUserModuleName(m)).join(", ") : convertToUserModuleName(resolvedModuleNames[0])} is not registered${gridScoped ? " for gridId: " + gridId : ""}. ${chartImportRequired} Check if you have registered the module: +`; + return `${explanation} +${moduleImportMsg(resolvedModuleNames)}` + (additionalText ? ` + +${additionalText}` : ""); +}; +var missingChartsWithModule = (gridModule) => { + return `${gridModule} 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 { ${gridModule} } from 'ag-grid-enterprise'; + +ModuleRegistry.registerModules([${gridModule}.with(AgChartsEnterpriseModule)]); + `; +}; +var clipboardApiError = (method) => `AG Grid: Unable to use the Clipboard API (navigator.clipboard.${method}()). 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.`; +var AG_GRID_ERRORS = { + 1: () => "`rowData` must be an array", + 2: ({ nodeId }) => `Duplicate node id '${nodeId}' 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=${id}, data item was not found for this id`, + 5: ({ data }) => [ + `Could not find data item as object was not found.`, + data, + " 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 ${key}`, + 9: ({ variable }) => `No value for ${variable?.cssName}. This usually means that the grid has been initialised before styles have been loaded. The default value of ${variable?.defaultValue} will be used and updated when styles load.`, + 10: ({ eventType }) => `As of v33, the '${eventType}' event is deprecated. Use the global 'modelUpdated' event to determine when row children have changed.`, + 11: () => "No gridOptions provided to createGrid", + 12: ({ colKey }) => ["column ", colKey, " 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 ${groupPrefix}, this is a reserved prefix for AG Grid's row grouping feature.`, + 15: ({ expression }) => ["value should be either a string or a function", expression], + 16: ({ expression, params, e }) => [ + "Processing of the expression failed", + "Expression = ", + expression, + "Params = ", + params, + "Exception = ", + e + ], + 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 }) => `${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 `, id, ` is being cast to a string.`], + 26: ({ fnName, preDestroyLink }) => { + return `Grid API function ${fnName}() 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: ${preDestroyLink}`; + }, + 27: ({ fnName, module }) => `API function '${fnName}' not registered to module '${module}'`, + 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 = ", + 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 '${key}' 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 '" + t + "' does not correspond to defined gridOptions.columnTypes", + 37: () => `Changing the column pinning status is not allowed with domLayout='print'`, + 38: ({ iconName }) => `provided icon '${iconName}' 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 }) => `${e} +${clipboardApiError(method)}`, + 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 '${iconName}' 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 ${parentCellDataType} does not exist.`, + 46: () => 'The "baseDataType" property of a data type definition must match that of its parent.', + 47: ({ cellDataType }) => `Missing data type definition - "${cellDataType}"`, + 48: ({ property, inferred, colId }) => { + const inferredStr = inferred ? " (inferred)" : ""; + const colIdStr = colId ? ` for column "${colId}"` : ""; + const parserHint = inferred && property === "Parser" ? ` + - "colDef.cellDataType = 'object'"` : ""; + return `Cell data type is "object"${inferredStr} but no Value ${property} has been provided${colIdStr}. Please either provide an object data type definition with a Value ${property}, or set: + - "colDef.value${property}"${parserHint}`; + }, + 49: ({ methodName }) => `Framework component is missing the method ${methodName}()`, + 50: ({ compName }) => `Could not find component ${compName}, 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: ${colId}`, + 63: ({ colId }) => `setFilterModel() - unable to fully apply model, filtering disabled for colId: ${colId}`, + 64: ({ colId }) => `setFilterModel() - unable to fully apply model, unable to create filter for colId: ${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 ${guiFromFilter}; it should be a DOM element.`, + 70: ({ newFilter }) => `Grid option quickFilterText only supports string inputs, received: ${typeof newFilter}`, + 71: () => "debounceMs is ignored when apply button is present", + 72: ({ keys }) => [`ignoring FilterOptionDef as it doesn't contain one of `, keys], + 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 "', + filterModelType, + '", 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 ${param} 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: ${index}`, + 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, + pageSizesSet, + pageSizeOptions + }) => `'paginationPageSize=${paginationPageSizeOption}'${pageSizeSet ? "" : " (default value)"}, but ${paginationPageSizeOption} is not included in${pageSizesSet ? "" : " the default"} paginationPageSizeSelector=[${pageSizeOptions?.join(", ")}].`, + 95: ({ + paginationPageSizeOption, + paginationPageSizeSelector: paginationPageSizeSelector2 + }) => `Either set '${paginationPageSizeSelector2}' to an array that includes ${paginationPageSizeOption} or to 'false' to disable the page size selector.`, + 96: ({ id, data }) => [ + "Duplicate ID", + id, + "found for pinned row with data", + data, + "When `getRowId` is defined, it must return unique IDs for all pinned rows. Use the `rowPinned` parameter." + ], + 97: ({ colId }) => `cellEditor for column ${colId} 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, + agGridDefaults, + jsComps + }) => { + const textOutput = []; + const validComponents = [ + ...Object.keys(agGridDefaults ?? []).filter((k) => !["agCellEditor", "agGroupRowRenderer", "agSortIndicator"].includes(k)), + ...Object.keys(jsComps ?? []).filter((k) => !!jsComps[k]) + ]; + const suggestions = _fuzzySuggestions({ + inputValue: componentName, + allSuggestions: validComponents, + hideIrrelevant: true, + filterByPercentageOfBestMatch: 0.8 + }).values; + textOutput.push(`Could not find '${componentName}' component. It was configured as "${propertyName}: '${componentName}'" but it wasn't found in the list of registered components. +`); + if (suggestions.length > 0) { + textOutput.push(` Did you mean: [${suggestions.slice(0, 3)}]? +`); + } + textOutput.push(`If using a custom component check it has been registered correctly.`); + return textOutput; + }, + 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 }) => `Numeric value ${value} passed to ${param} param will be interpreted as ${value} seconds. If this is intentional use "${value}s" to silence this warning.`, + 105: ({ e }) => [`chart rendering failed`, e], + 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: ${baseDocLink}/theming-migration/`, + 107: ({ key, value }) => `Invalid value for theme param ${key} - ${value}`, + 108: ({ e }) => ["chart update failed", e], + 109: ({ inputValue, allSuggestions }) => { + const suggestions = _fuzzySuggestions({ + inputValue, + allSuggestions, + hideIrrelevant: true, + filterByPercentageOfBestMatch: 0.8 + }).values; + return [ + `Could not find '${inputValue}' aggregate function. It was configured as "aggFunc: '${inputValue}'" but it wasn't found in the list of registered aggregations.`, + suggestions.length > 0 ? ` Did you mean: [${suggestions.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 ${component}. 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: ${chartId}.`, + 126: () => "unable to restore chart as no chart model is provided", + 127: ({ allRange }) => `unable to create chart as ${allRange ? "there are no columns in the grid" : "no range is selected"}.`, + 128: ({ feature }) => `${feature} is only available if using 'multiRow' selection mode.`, + 129: ({ feature, rowModel }) => `${feature} is only available if using 'clientSide' or 'serverSide' rowModelType, you are using ${rowModel}.`, + 130: () => 'cannot multi select unless selection mode is "multiRow"', + 132: () => "Row selection features are not available unless `rowSelection` is enabled.", + 133: ({ iconName }) => `icon '${iconName}' function should return back a string or a dom object`, + 134: ({ iconName }) => `Did not find icon '${iconName}'`, + 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 }) => `Unable to update chart as a '${type}' update type is not permitted on a ${currentChartType}.`, + 138: ({ chartType }) => `invalid chart type supplied: ${chartType}`, + 139: ({ customThemeName }) => `a custom chart theme with the name ${customThemeName} has been supplied but not added to the 'chartThemes' list`, + 140: ({ name }) => `no stock theme exists with the name '${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 }) => `'${panel}' is not a valid Chart Tool Panel name`, + 144: ({ type }) => `Invalid charts data panel group name supplied: '${type}'`, + 145: ({ group }) => `As of v32, only one charts customize panel group can be expanded at a time. '${group}' will not be expanded.`, + 146: ({ comp }) => `Unable to instantiate component '${comp}' as its module hasn't been loaded. Add 'ValidationModule' to see which module is required.`, + 147: ({ group }) => `Invalid charts customize panel group name supplied: '${group}'`, + 148: ({ group }) => `invalid chartGroupsDef config '${group}'`, + 149: ({ group, chartType }) => `invalid chartGroupsDef config '${group}.${chartType}'`, + 150: () => `'seriesChartTypes' are required when the 'customCombo' chart type is specified.`, + 151: ({ chartType }) => `invalid chartType '${chartType}' supplied in 'seriesChartTypes', converting to 'line' instead.`, + 152: ({ colId }) => `no 'seriesChartType' found for colId = '${colId}', defaulting to 'line'.`, + 153: ({ chartDataType }) => `unexpected chartDataType value '${chartDataType}' supplied, instead use 'category', 'series' or 'excluded'`, + 154: ({ colId }) => `cross filtering requires a 'agSetColumnFilter' or 'agMultiColumnFilter' to be defined on the column with id: ${colId}`, + 155: ({ option }) => `'${option}' is not a valid Chart Toolbar Option`, + 156: ({ panel }) => `Invalid panel in chartToolPanelsDef.panels: '${panel}'`, + 157: ({ unrecognisedGroupIds }) => ["unable to find group(s) for supplied groupIds:", unrecognisedGroupIds], + 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 }) => `Unrecognized data type for excel export [${id}.dataType=${dataType}]`, + 163: ({ featureName }) => `Excel table export does not work with ${featureName}. The exported Excel file will not contain any Excel tables. + Please turn off ${featureName} 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:", unrecognisedGroupIds], + 167: ({ unrecognisedColIds }) => ["unable to find columns for these supplied colIds:", unrecognisedColIds], + 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 = ${providedStrategy} 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 '${group}'`, + 174: ({ group, chartType }) => `invalid chartGroupsDef config '${group}.${chartType}'`, + 175: ({ menuTabName, itemsToConsider }) => [ + `Trying to render an invalid menu item '${menuTabName}'. Check that your 'menuTabs' contains one of `, + itemsToConsider + ], + 176: ({ key }) => `unknown menu item type ${key}`, + 177: () => `valid values for cellSelection.handle.direction are 'x', 'y' and 'xy'. Default to 'xy'.`, + 178: ({ colId }) => `column ${colId} 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 }) => [`duplicate group keys for row data, keys should be unique`, [parentGroupData, childNodeData]], + 185: ({ data }) => [`getDataPath() should not return an empty path`, [data]], + 186: ({ + rowId, + rowData, + duplicateRowsData + }) => [ + `duplicate group keys for row data, keys should be unique`, + rowId, + rowData, + ...duplicateRowsData ?? [] + ], + 187: ({ rowId, firstData, secondData }) => [ + `Duplicate node id ${rowId}. Row IDs are provided via the getRowId() callback. Please modify the getRowId() callback code to provide unique row id values.`, + "first instance", + firstData, + "second instance", + secondData + ], + 188: (props) => `getRowId callback must be provided for Server Side Row Model ${props?.feature || "selection"} to work correctly.`, + 189: ({ startRow }) => `invalid value ${startRow} for startRow, the value should be >= 0`, + 190: ({ rowGroupId, data }) => [ + `null and undefined values are not allowed for server side row model keys`, + rowGroupId ? `column = ${rowGroupId}` : ``, + `data is `, + data + ], + 194: ({ method }) => `calling gridApi.${method}() is only possible when using rowModelType=\`clientSide\`.`, + 195: ({ justCurrentPage }) => `selecting just ${justCurrentPage ? "current page" : "filtered"} only works when gridOptions.rowModelType='clientSide'`, + 196: ({ key }) => `Provided ids must be of string type. Invalid id provided: ${key}`, + 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: missingModule, + 201: ({ rowModelType }) => `Could not find row model for rowModelType = ${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 (${duplicateIdText}) 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 ${baseDocLink}/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: ${key}`, + 215: ({ key, defaultByKey }) => `the key ${key} is not a valid key for specifying a tool panel, valid keys are: ${Object.keys(defaultByKey ?? {}).join(",")}`, + 216: ({ name }) => `Missing component for '${name}'`, + 217: ({ invalidColIds }) => ["unable to find grid columns for the supplied colDef(s):", invalidColIds], + 218: ({ property, defaultOffset }) => `${property} must be a number, the value you provided is not a valid number. Using the default of ${defaultOffset}px.`, + 219: ({ property }) => `Property ${property} does not exist on the target object.`, + 220: ({ lineDash }) => `'${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 ${menuItemOrString}`, + 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 ${methodName}()`, + 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: ${theme}`, + 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 = '${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: ", version], + 254: () => "Cannot create chart: no chart themes available.", + 255: ({ point }) => `Lone surrogate U+${point?.toString(16).toUpperCase()} is not a scalar value`, + 256: () => "Unable to initialise. See validation error, or load ValidationModule if missing.", + 257: () => missingChartsWithModule("IntegratedChartsModule"), + 258: () => missingChartsWithModule("SparklinesModule"), + 259: ({ part }) => `the argument to theme.withPart must be a Theming API part object, received: ${part}`, + 260: ({ + propName, + compName, + gridScoped, + gridId, + rowModelType + }) => missingModule({ + reasonOrId: `AG Grid '${propName}' component: ${compName}`, + moduleName: USER_COMP_MODULES[compName], + gridId, + gridScoped, + rowModelType + }), + 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 '${colId}' if first data entry is null. Please specify "chartDataType", or a "cellDataType" in the column definition. For more information, see ${baseDocLink}/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 }) => `Cycle detected for row with id='${id}' and parent id='${parentId}'. Resetting the parent for row with id='${id}' and showing it as a root-level node.`, + 271: ({ id, parentId }) => `Parent row not found for row with id='${id}' and parent id='${parentId}'. Showing row with id='${id}' as a root-level node.`, + 272: () => NoModulesRegisteredError(), + 273: ({ providedId, usedId }) => `Provided column id '${providedId}' was already in use, ensure all column and group ids are unique. Using '${usedId}' instead.`, + 274: ({ prop }) => { + let msg = `Since v33, ${prop} has been deprecated.`; + switch (prop) { + case "maxComponentCreationTimeMs": + msg += " This property is no longer required and so will be removed in a future version."; + break; + case "setGridApi": + msg += ` 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": + msg += ` For multiple versions AgGridReact does not support children.`; + break; + } + return msg; + }, + 275: missingRowModelTypeError, + 276: () => "Row Numbers Row Resizer cannot be used when Grid Columns have `autoHeight` enabled.", + 277: ({ colId }) => `'enableFilterHandlers' is set to true, but column '${colId}' does not have 'filter.doesFilterPass' or 'filter.handler' set.`, + 278: ({ colId }) => `Unable to create filter handler for column '${colId}'`, + 279: (_) => {}, + 280: ({ colId }) => `'name' must be provided for custom filter components for column '${colId}`, + 281: ({ colId }) => `Filter for column '${colId}' 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 '${rowModelType}' is not supported with Batch Editing`, + 290: ({ rowIndex, rowPinned }) => `Row with index '${rowIndex}' and pinned state '${rowPinned}' 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 '${colId}' 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 ${blockedService}. 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 getError(errorId, args) { + const msgOrFunc = AG_GRID_ERRORS[errorId]; + if (!msgOrFunc) { + return [`Missing error text for error id ${errorId}!`]; + } + const errorBody = msgOrFunc(args); + const errorLink = getErrorLink(errorId, args); + const errorSuffix = ` +See ${errorLink}`; + return Array.isArray(errorBody) ? errorBody.concat(errorSuffix) : [errorBody, errorSuffix]; +} +var MISSING_MODULE_REASONS = { + 1: "Charting Aggregation", + 2: "pivotResultFields", + 3: "setTooltip" +}; +var VanillaFrameworkOverrides = class { + constructor(frameworkName = "javascript") { + this.frameworkName = frameworkName; + this.renderingEngine = "vanilla"; + this.batchFrameworkComps = false; + this.wrapIncoming = (callback) => callback(); + this.wrapOutgoing = (callback) => callback(); + this.baseDocLink = `${BASE_URL}/${this.frameworkName}-data-grid`; + setValidationDocLink(this.baseDocLink); + } + frameworkComponent(_) { + return null; + } + isFrameworkComponent(_) { + return false; + } + getDocLink(path) { + return this.baseDocLink + (path ? "/" + path : ""); + } +}; +var _gridApiCache = /* @__PURE__ */ new WeakMap; +var _gridElementCache = /* @__PURE__ */ new WeakMap; +function createGrid(eGridDiv, gridOptions, params) { + if (!gridOptions) { + _error(11); + return {}; + } + const gridParams = params; + let destroyCallback; + if (!gridParams?.setThemeOnGridDiv) { + const newGridDiv = _createElement({ tag: "div" }); + newGridDiv.style.height = "100%"; + eGridDiv.appendChild(newGridDiv); + eGridDiv = newGridDiv; + destroyCallback = () => eGridDiv.remove(); + } + const api = new GridCoreCreator().create(eGridDiv, gridOptions, (context) => { + const gridComp = new GridComp(eGridDiv); + context.createBean(gridComp); + }, undefined, params, destroyCallback); + return api; +} +var nextGridId = 1; +var GridCoreCreator = class { + create(eGridDiv, providedOptions, createUi, acceptChanges, params, _destroyCallback) { + const gridOptions = GlobalGridOptions.applyGlobalGridOptions(providedOptions); + const gridId = gridOptions.gridId ?? String(nextGridId++); + const registeredModules = this.getRegisteredModules(params, gridId, gridOptions.rowModelType); + const beanClasses = this.createBeansList(gridOptions.rowModelType, registeredModules, gridId); + const providedBeanInstances = this.createProvidedBeans(eGridDiv, gridOptions, params); + if (!beanClasses) { + return; + } + const destroyCallback = () => { + _gridElementCache.delete(api); + _gridApiCache.delete(eGridDiv); + _unRegisterGridModules(gridId); + _destroyCallback?.(); + }; + const contextParams = { + providedBeanInstances, + beanClasses, + id: gridId, + beanInitComparator: gridBeanInitComparator, + beanDestroyComparator: gridBeanDestroyComparator, + derivedBeans: [createGridApi], + destroyCallback + }; + const context = new AgContext(contextParams); + this.registerModuleFeatures(context, registeredModules); + createUi(context); + context.getBean("syncSvc").start(); + acceptChanges?.(context); + const api = context.getBean("gridApi"); + _gridApiCache.set(eGridDiv, api); + _gridElementCache.set(api, eGridDiv); + return api; + } + getRegisteredModules(params, gridId, rowModelType) { + _registerModule(CommunityCoreModule, undefined, true); + params?.modules?.forEach((m) => _registerModule(m, gridId)); + return _getRegisteredModules(gridId, getDefaultRowModelType(rowModelType)); + } + registerModuleFeatures(context, registeredModules) { + const registry = context.getBean("registry"); + const apiFunctionSvc = context.getBean("apiFunctionSvc"); + for (const module of registeredModules) { + registry.registerModule(module); + const apiFunctions = module.apiFunctions; + if (apiFunctions) { + const names = Object.keys(apiFunctions); + for (const name of names) { + apiFunctionSvc?.addFunction(name, apiFunctions[name]); + } + } + } + } + createProvidedBeans(eGridDiv, gridOptions, params) { + let frameworkOverrides = params ? params.frameworkOverrides : null; + if (_missing(frameworkOverrides)) { + frameworkOverrides = new VanillaFrameworkOverrides; + } + const seed = { + gridOptions, + eGridDiv, + eRootDiv: eGridDiv, + globalListener: params ? params.globalListener : null, + globalSyncListener: params ? params.globalSyncListener : null, + frameworkOverrides, + withinStudio: params?.withinStudio + }; + if (params?.providedBeanInstances) { + Object.assign(seed, params.providedBeanInstances); + } + return seed; + } + createBeansList(userProvidedRowModelType, registeredModules, gridId) { + const rowModelModuleNames = { + clientSide: "ClientSideRowModel", + infinite: "InfiniteRowModel", + serverSide: "ServerSideRowModel", + viewport: "ViewportRowModel" + }; + const rowModelType = getDefaultRowModelType(userProvidedRowModelType); + const rowModuleModelName = rowModelModuleNames[rowModelType]; + if (!rowModuleModelName) { + _logPreInitErr(201, { rowModelType }, `Unknown rowModelType ${rowModelType}.`); + return; + } + if (!_hasUserRegistered()) { + _logPreInitErr(272, undefined, NoModulesRegisteredError()); + return; + } + if (!userProvidedRowModelType) { + const registeredRowModelModules = Object.entries(rowModelModuleNames).filter(([rowModelType2, module]) => _isModuleRegistered(module, gridId, rowModelType2)); + if (registeredRowModelModules.length == 1) { + const [userRowModelType, moduleName] = registeredRowModelModules[0]; + if (userRowModelType !== rowModelType) { + const params = { + moduleName, + rowModelType: userRowModelType + }; + _logPreInitErr(275, params, missingRowModelTypeError(params)); + return; + } + } + } + if (!_isModuleRegistered(rowModuleModelName, gridId, rowModelType)) { + const isUmd2 = _isUmd(); + const reasonOrId = `rowModelType = '${rowModelType}'`; + const message = isUmd2 ? `Unable to use ${reasonOrId} as that requires the ag-grid-enterprise script to be included. +` : `Missing module ${rowModuleModelName}Module for rowModelType ${rowModelType}.`; + _logPreInitErr(200, { + reasonOrId, + moduleName: rowModuleModelName, + gridScoped: _areModulesGridScoped(), + gridId, + rowModelType, + isUmd: isUmd2 + }, message); + return; + } + const beans = /* @__PURE__ */ new Set; + for (const module of registeredModules) { + for (const bean of module.beans ?? []) { + beans.add(bean); + } + } + return Array.from(beans); + } +}; +function getDefaultRowModelType(passedRowModelType) { + return passedRowModelType ?? "clientSide"; +} +function ensureColumnVisible(beans, key, position = "auto") { + beans.frameworkOverrides.wrapIncoming(() => beans.ctrlsSvc.getScrollFeature().ensureColumnVisible(key, position), "ensureVisible"); +} +function ensureIndexVisible(beans, index, position) { + beans.frameworkOverrides.wrapIncoming(() => beans.ctrlsSvc.getScrollFeature().ensureIndexVisible(index, position), "ensureVisible"); +} +var forEachGroupDepthFirst = (children, callback) => { + for (let i = 0, len = children.length;i < len; ++i) { + const child = children[i]; + const grandChildren = child.childrenAfterGroup; + if (grandChildren !== null) { + forEachGroupDepthFirst(grandChildren, callback); + callback(child); + } + } +}; +var _forEachChangedGroupDepthFirst = (rootNode, hierarchical, changedPath, callback) => { + if (changedPath != null) { + const rows = changedPath.getSortedRows(); + for (let i = 0, len = rows.length;i < len; ++i) { + const row = rows[i]; + if (row.childrenAfterGroup !== null && !row.destroyed) { + callback(row); + } + } + return; + } + if (rootNode == null) { + return; + } + const children = rootNode.childrenAfterGroup; + if (children === null) { + return; + } + if (hierarchical) { + forEachGroupDepthFirst(children, callback); + } + callback(rootNode); +}; +var ClientSideNodeManager = class extends BeanStub { + constructor(rootNode) { + super(); + this.rootNode = rootNode; + this.nextId = 0; + this.allNodesMap = {}; + initRootNode(rootNode); + } + getRowNode(id) { + return this.allNodesMap[id]; + } + setNewRowData(rowData) { + this.dispatchRowDataUpdateStarted(rowData); + this.destroyAllNodes(); + const rootNode = initRootNode(this.rootNode); + const allLeafs = new Array(rowData.length); + rootNode._leafs = allLeafs; + let writeIdx = 0; + const nestedDataGetter = this.beans.groupStage?.getNestedDataGetter(); + const processedNested = nestedDataGetter ? /* @__PURE__ */ new Set : null; + const processChildren = (parent, childrenData) => { + const level = parent.level + 1; + for (let i = 0, len = childrenData.length;i < len; ++i) { + const data = childrenData[i]; + if (!data) { + continue; + } + const node = this.createRowNode(data, level, writeIdx); + allLeafs[writeIdx++] = node; + if (processedNested && !processedNested.has(data)) { + processedNested.add(data); + node.treeParent = parent; + const children = nestedDataGetter(data); + if (children) { + processChildren(node, children); + } + } + } + }; + processChildren(rootNode, rowData); + allLeafs.length = writeIdx; + } + destroyAllNodes() { + const { selectionSvc, pinnedRowModel, groupStage } = this.beans; + selectionSvc?.reset("rowDataChanged"); + if (pinnedRowModel?.isManual()) { + pinnedRowModel.reset(); + } + groupStage?.clearNonLeafs(); + const existingLeafs = this.rootNode._leafs; + if (existingLeafs) { + for (let i = 0, len = existingLeafs.length;i < len; ++i) { + existingLeafs[i]._destroy(false); + } + } + this.allNodesMap = /* @__PURE__ */ Object.create(null); + this.nextId = 0; + } + setImmutableRowData(params, rowData) { + const { rootNode, gos } = this; + this.dispatchRowDataUpdateStarted(rowData); + const getRowIdFunc = _getRowIdCallback(gos); + const changedRowNodes = params.changedRowNodes; + const { adds, updates } = changedRowNodes; + const processedNodes = /* @__PURE__ */ new Set; + const nodesToUnselect = []; + const nestedDataGetter = this.beans.groupStage?.getNestedDataGetter(); + let reorder = gos.get("suppressMaintainUnsortedOrder") ? undefined : false; + let prevIndex = -1; + let treeUpdated = false; + const updateNode = (node, data) => { + if (!reorder && reorder !== undefined) { + const oldIndex = node.sourceRowIndex; + reorder = oldIndex <= prevIndex; + prevIndex = oldIndex; + } + if (node.data !== data) { + node.updateData(data); + if (!adds.has(node)) { + updates.add(node); + } + if (!node.selectable && node.isSelected()) { + nodesToUnselect.push(node); + } + } + }; + const processChildren = (parent, childrenData, level) => { + for (let i = 0, len = childrenData.length;i < len; ++i) { + const data = childrenData[i]; + if (!data) { + continue; + } + let node = this.getRowNode(getRowIdFunc({ data, level })); + if (node) { + updateNode(node, data); + treeUpdated || (treeUpdated = !!nestedDataGetter && node.treeParent !== parent); + } else { + node = this.createRowNode(data, level); + adds.add(node); + } + if (!nestedDataGetter || processedNodes.has(node)) { + processedNodes.add(node); + continue; + } + processedNodes.add(node); + node.treeParent = parent; + const children = nestedDataGetter(data); + if (children) { + processChildren(node, children, level + 1); + } + } + }; + processChildren(rootNode, rowData, 0); + const changed = this.deleteUnusedNodes(processedNodes, changedRowNodes, nodesToUnselect, !!params.animate) || reorder || adds.size > 0; + if (changed) { + const allLeafs = rootNode._leafs ?? (rootNode._leafs = []); + if (reorder === undefined) { + updateRootLeafsKeepOrder(allLeafs, processedNodes, changedRowNodes); + } else if (updateRootLeafsOrdered(allLeafs, processedNodes)) { + changedRowNodes.reordered = true; + } + } + if (changed || treeUpdated || updates.size) { + params.rowDataUpdated = true; + this.deselect(nodesToUnselect); + } + } + deleteUnusedNodes(processedNodes, { removals }, nodesToUnselect, animate) { + const allLeafs = this.rootNode._leafs; + for (let i = 0, len = allLeafs.length;i < len; i++) { + const node = allLeafs[i]; + if (!processedNodes.has(node)) { + if (this.destroyNode(node, animate)) { + removals.push(node); + if (node.isSelected()) { + nodesToUnselect.push(node); + } + } + } + } + return removals.length > 0; + } + updateRowData(rowDataTran, changedRowNodes, animate) { + this.dispatchRowDataUpdateStarted(rowDataTran.add); + if (this.beans.groupStage?.getNestedDataGetter()) { + _warn(268); + return { remove: [], update: [], add: [] }; + } + const nodesToUnselect = []; + const getRowIdFunc = _getRowIdCallback(this.gos); + const remove = this.executeRemove(getRowIdFunc, rowDataTran, changedRowNodes, nodesToUnselect, animate); + const update = this.executeUpdate(getRowIdFunc, rowDataTran, changedRowNodes, nodesToUnselect); + const add = this.executeAdd(rowDataTran, changedRowNodes); + this.deselect(nodesToUnselect); + return { remove, update, add }; + } + executeRemove(getRowIdFunc, { remove }, { adds, updates, removals }, nodesToUnselect, animate) { + const allLeafs = this.rootNode._leafs; + const allLeafsLen = allLeafs?.length; + const removeLen = remove?.length; + if (!removeLen || !allLeafsLen) { + return []; + } + let removeCount = 0; + let filterIdx = allLeafsLen; + let filterEndIdx = 0; + const removedResult = new Array(removeLen); + for (let i = 0;i < removeLen; ++i) { + const rowNode = this.lookupNode(getRowIdFunc, remove[i]); + if (!rowNode) { + continue; + } + const sourceRowIndex = rowNode.sourceRowIndex; + if (sourceRowIndex < filterIdx) { + filterIdx = sourceRowIndex; + } + if (sourceRowIndex > filterEndIdx) { + filterEndIdx = sourceRowIndex; + } + removedResult[removeCount++] = rowNode; + if (!this.destroyNode(rowNode, animate)) { + continue; + } + if (rowNode.isSelected()) { + nodesToUnselect.push(rowNode); + } + if (!adds.delete(rowNode)) { + updates.delete(rowNode); + removals.push(rowNode); + } + } + removedResult.length = removeCount; + if (removeCount) { + filterRemovedRowNodes(allLeafs, filterIdx, filterEndIdx); + } + return removedResult; + } + executeUpdate(getRowIdFunc, { update }, { adds, updates }, nodesToUnselect) { + const updateLen = update?.length; + if (!updateLen) { + return []; + } + const updateResult = new Array(updateLen); + let writeIdx = 0; + for (let i = 0;i < updateLen; i++) { + const item = update[i]; + const rowNode = this.lookupNode(getRowIdFunc, item); + if (rowNode) { + rowNode.updateData(item); + if (!rowNode.selectable && rowNode.isSelected()) { + nodesToUnselect.push(rowNode); + } + updateResult[writeIdx++] = rowNode; + if (!adds.has(rowNode)) { + updates.add(rowNode); + } + } + } + updateResult.length = writeIdx; + return updateResult; + } + executeAdd(rowDataTran, changedRowNodes) { + var _a; + const allLeafs = (_a = this.rootNode)._leafs ?? (_a._leafs = []); + const allLeafsLen = allLeafs.length; + const add = rowDataTran.add; + const addLength = add?.length; + if (!addLength) { + return []; + } + const newLen = allLeafsLen + addLength; + let addIndex = this.sanitizeAddIndex(allLeafs, rowDataTran.addIndex); + if (addIndex < allLeafsLen) { + for (let readIdx = allLeafsLen - 1, writeIdx = newLen - 1;readIdx >= addIndex; --readIdx) { + const node = allLeafs[readIdx]; + node.sourceRowIndex = writeIdx; + allLeafs[writeIdx--] = node; + } + changedRowNodes.reordered = true; + } + allLeafs.length = newLen; + const addedNodes = new Array(addLength); + const adds = changedRowNodes.adds; + for (let i = 0;i < addLength; i++) { + const node = this.createRowNode(add[i], 0, addIndex); + adds.add(node); + allLeafs[addIndex] = node; + addedNodes[i] = node; + addIndex++; + } + return addedNodes; + } + dispatchRowDataUpdateStarted(data) { + this.eventSvc.dispatchEvent({ type: "rowDataUpdateStarted", firstRowData: data?.length ? data[0] : null }); + } + deselect(nodes) { + const source = "rowDataChanged"; + const selectionSvc = this.beans.selectionSvc; + if (nodes.length) { + selectionSvc?.setNodesSelected({ newValue: false, nodes, suppressFinishActions: true, source }); + } + selectionSvc?.updateGroupsFromChildrenSelections?.(source); + if (nodes.length) { + this.eventSvc.dispatchEvent({ + type: "selectionChanged", + source, + selectedNodes: selectionSvc?.getSelectedNodes() ?? null, + serverSideState: null + }); + } + } + createRowNode(data, level, sourceRowIndex) { + const node = new RowNode(this.beans); + node.parent = this.rootNode; + node.level = level; + node.group = false; + if (sourceRowIndex != null) { + node.sourceRowIndex = sourceRowIndex; + } + node.setDataAndId(data, String(this.nextId++)); + const id = node.id; + const allNodesMap = this.allNodesMap; + if (allNodesMap[id]) { + _warn(2, { nodeId: id }); + } + allNodesMap[id] = node; + return node; + } + destroyNode(node, animate) { + if (!node._destroy(animate)) { + return false; + } + const id = node.id; + const allNodesMap = this.allNodesMap; + if (allNodesMap[id] === node) { + delete allNodesMap[id]; + } + return true; + } + lookupNode(getRowIdFunc, data) { + if (!getRowIdFunc) { + return lookupNodeByData(this.rootNode._leafs, data); + } + const id = getRowIdFunc({ data, level: 0 }); + const rowNode = this.allNodesMap[id]; + if (!rowNode) { + _error(4, { id }); + return null; + } + return rowNode; + } + sanitizeAddIndex(allLeafs, addIndex) { + const allLeafsLen = allLeafs.length; + if (typeof addIndex !== "number") { + return allLeafsLen; + } + if (addIndex < 0 || addIndex >= allLeafsLen || Number.isNaN(addIndex)) { + return allLeafsLen; + } + addIndex = Math.ceil(addIndex); + const gos = this.gos; + if (addIndex > 0 && gos.get("treeData") && gos.get("getDataPath")) { + addIndex = adjustAddIndexForDataPath(allLeafs, addIndex); + } + return addIndex; + } +}; +var adjustAddIndexForDataPath = (allLeafs, addIndex) => { + for (let i = 0, len = allLeafs.length;i < len; i++) { + const node = allLeafs[i]; + if (node?.rowIndex == addIndex - 1) { + return i + 1; + } + } + return addIndex; +}; +var initRootNode = (rootNode) => { + rootNode.group = true; + rootNode.level = -1; + rootNode._expanded = true; + rootNode.id = "ROOT_NODE_ID"; + if (rootNode._leafs?.length !== 0) { + rootNode._leafs = []; + } + const childrenAfterGroup = []; + const childrenAfterSort = []; + const childrenAfterAggFilter = []; + const childrenAfterFilter = []; + rootNode.childrenAfterGroup = childrenAfterGroup; + rootNode.childrenAfterSort = childrenAfterSort; + rootNode.childrenAfterAggFilter = childrenAfterAggFilter; + rootNode.childrenAfterFilter = childrenAfterFilter; + const sibling = rootNode.sibling; + if (sibling) { + sibling.childrenAfterGroup = childrenAfterGroup; + sibling.childrenAfterSort = childrenAfterSort; + sibling.childrenAfterAggFilter = childrenAfterAggFilter; + sibling.childrenAfterFilter = childrenAfterFilter; + sibling.childrenMapped = rootNode.childrenMapped; + } + rootNode.updateHasChildren(); + return rootNode; +}; +var lookupNodeByData = (nodes, data) => { + if (nodes) { + for (let i = 0, len = nodes.length;i < len; i++) { + const node = nodes[i]; + if (node.data === data) { + return node; + } + } + } + _error(5, { data }); + return null; +}; +var filterRemovedRowNodes = (allLeafs, filterIdx, filterEndIdx) => { + filterIdx = Math.max(0, filterIdx); + for (let readIdx = filterIdx, len = allLeafs.length;readIdx < len; ++readIdx) { + const node = allLeafs[readIdx]; + if (readIdx <= filterEndIdx && node.destroyed) { + continue; + } + node.sourceRowIndex = filterIdx; + allLeafs[filterIdx++] = node; + } + allLeafs.length = filterIdx; +}; +var updateRootLeafsOrdered = (allLeafs, processedNodes) => { + const newSize = processedNodes.size; + allLeafs.length = newSize; + let writeIdx = 0; + let added = false; + let reordered = false; + for (const node of processedNodes) { + const sourceRowIndex = node.sourceRowIndex; + if (sourceRowIndex === writeIdx) { + reordered || (reordered = added); + } else { + if (sourceRowIndex >= 0) { + reordered = true; + } else { + added = true; + } + node.sourceRowIndex = writeIdx; + allLeafs[writeIdx] = node; + } + ++writeIdx; + } + return reordered; +}; +var updateRootLeafsKeepOrder = (allLeafs, processedNodes, { adds }) => { + const allLeafsLen = allLeafs.length; + const newAllLeafsLen = processedNodes.size; + if (newAllLeafsLen > allLeafsLen) { + allLeafs.length = newAllLeafsLen; + } + let writeIdx = 0; + for (let readIdx = 0;readIdx < allLeafsLen; ++readIdx) { + const node = allLeafs[readIdx]; + if (!node.destroyed) { + if (writeIdx !== readIdx) { + node.sourceRowIndex = writeIdx; + allLeafs[writeIdx] = node; + } + ++writeIdx; + } + } + for (const node of adds) { + if (node.sourceRowIndex < 0) { + node.sourceRowIndex = writeIdx; + allLeafs[writeIdx++] = node; + } + } + allLeafs.length = writeIdx; +}; +function updateRowNodeAfterFilter(rowNode) { + const sibling = rowNode.sibling; + if (sibling) { + sibling.childrenAfterFilter = rowNode.childrenAfterFilter; + } +} +var FilterStage = class extends BeanStub { + constructor() { + super(...arguments); + this.beanName = "filterStage"; + this.step = "filter"; + this.refreshProps = ["excludeChildrenWhenTreeDataFiltering"]; + } + wireBeans(beans) { + this.filterManager = beans.filterManager; + } + execute(changedPath) { + const filterActive = !!this.filterManager?.isChildFilterPresent(); + if (this.beans.formula?.active) { + this.softFilter(filterActive, changedPath); + } else { + this.filterNodes(filterActive, changedPath); + } + } + filterNodes(filterActive, changedPath) { + const filterCallback = (rowNode, includeChildNodes) => { + if (rowNode.hasChildren()) { + if (filterActive && !includeChildNodes) { + rowNode.childrenAfterFilter = rowNode.childrenAfterGroup.filter((childNode) => { + const passBecauseChildren = childNode.childrenAfterFilter && childNode.childrenAfterFilter.length > 0; + const passBecauseDataPasses = childNode.data && this.filterManager.doesRowPassFilter({ rowNode: childNode }); + return passBecauseChildren || passBecauseDataPasses; + }); + } else { + rowNode.childrenAfterFilter = rowNode.childrenAfterGroup; + } + } else { + rowNode.childrenAfterFilter = rowNode.childrenAfterGroup; + } + updateRowNodeAfterFilter(rowNode); + }; + if (this.doingTreeDataFiltering()) { + const treeDataDepthFirstFilter = (rowNode, alreadyFoundInParent) => { + if (rowNode.childrenAfterGroup) { + for (let i = 0;i < rowNode.childrenAfterGroup.length; i++) { + const childNode = rowNode.childrenAfterGroup[i]; + const foundInParent = alreadyFoundInParent || this.filterManager.doesRowPassFilter({ rowNode: childNode }); + if (childNode.childrenAfterGroup) { + treeDataDepthFirstFilter(rowNode.childrenAfterGroup[i], foundInParent); + } else { + filterCallback(childNode, foundInParent); + } + } + } + filterCallback(rowNode, alreadyFoundInParent); + }; + treeDataDepthFirstFilter(this.beans.rowModel.rootNode, false); + } else { + const defaultFilterCallback = (rowNode) => filterCallback(rowNode, false); + _forEachChangedGroupDepthFirst(this.beans.rowModel.rootNode, this.beans.rowModel.hierarchical, changedPath, defaultFilterCallback); + } + } + softFilter(filterActive, changedPath) { + const filterCallback = (rowNode) => { + rowNode.childrenAfterFilter = rowNode.childrenAfterGroup; + if (rowNode.hasChildren()) { + for (const childNode of rowNode.childrenAfterGroup) { + childNode.softFiltered = filterActive && !(childNode.data && this.filterManager.doesRowPassFilter({ rowNode: childNode })); + } + } + updateRowNodeAfterFilter(rowNode); + }; + const rowModel = this.beans.rowModel; + _forEachChangedGroupDepthFirst(rowModel.rootNode, rowModel.hierarchical, changedPath, filterCallback); + } + doingTreeDataFiltering() { + const { gos } = this; + return !!this.beans.groupStage?.treeData && !gos.get("excludeChildrenWhenTreeDataFiltering"); + } +}; +var MIN_DELTA_SORT_ROWS = 4; +var doDeltaSort = (rowNodeSorter, rowNode, changedRowNodes, changedPath, sortOptions) => { + const oldSortedRows = rowNode.childrenAfterSort; + const unsortedRows = rowNode.childrenAfterAggFilter; + if (!unsortedRows) { + return oldSortedRows && oldSortedRows.length > 0 ? oldSortedRows : []; + } + const unsortedRowsLen = unsortedRows.length; + if (unsortedRowsLen <= 1) { + if (oldSortedRows?.length === unsortedRowsLen && (unsortedRowsLen === 0 || oldSortedRows[0] === unsortedRows[0])) { + return oldSortedRows; + } + return unsortedRows.slice(); + } + if (!oldSortedRows || unsortedRowsLen <= MIN_DELTA_SORT_ROWS) { + return rowNodeSorter.doFullSortInPlace(unsortedRows.slice(), sortOptions); + } + const indexByNode = /* @__PURE__ */ new Map; + const { updates, adds } = changedRowNodes; + const touchedRows = []; + for (let i = 0;i < unsortedRowsLen; ++i) { + const node = unsortedRows[i]; + if (updates.has(node) || adds.has(node) || changedPath?.hasRow(node)) { + indexByNode.set(node, ~i); + touchedRows.push(node); + } else { + indexByNode.set(node, i); + } + } + const touchedRowsLen = touchedRows.length; + if (touchedRowsLen === 0) { + return unsortedRowsLen === oldSortedRows.length ? oldSortedRows : filterRemovedNodes(oldSortedRows, indexByNode, touchedRows); + } + touchedRows.sort((a, b) => rowNodeSorter.compareRowNodes(sortOptions, a, b) || ~indexByNode.get(a) - ~indexByNode.get(b)); + if (touchedRowsLen === unsortedRowsLen) { + return touchedRows; + } + return mergeDeltaSortedArrays(rowNodeSorter, sortOptions, touchedRows, oldSortedRows, indexByNode, unsortedRowsLen); +}; +var mergeDeltaSortedArrays = (rowNodeSorter, sortOptions, touchedRows, oldSortedRows, indexByNode, resultSize) => { + const result = new Array(resultSize); + let touchedIdx = 0; + let touchedNode = touchedRows[touchedIdx]; + let untouchedNode; + let untouchedIdx = -1; + let oldIdx = 0; + let resultIdx = 0; + const touchedLength = touchedRows.length; + const oldSortedLength = oldSortedRows.length; + while (true) { + if (untouchedIdx < 0) { + if (oldIdx >= oldSortedLength) { + break; + } + untouchedNode = oldSortedRows[oldIdx++]; + untouchedIdx = indexByNode.get(untouchedNode) ?? -1; + if (untouchedIdx < 0) { + continue; + } + } + const orderDelta = rowNodeSorter.compareRowNodes(sortOptions, touchedNode, untouchedNode) || ~indexByNode.get(touchedNode) - untouchedIdx; + if (orderDelta < 0) { + result[resultIdx++] = touchedNode; + if (++touchedIdx >= touchedLength) { + break; + } + touchedNode = touchedRows[touchedIdx]; + } else { + result[resultIdx++] = untouchedNode; + untouchedIdx = -1; + } + } + while (touchedIdx < touchedLength) { + result[resultIdx++] = touchedRows[touchedIdx++]; + } + if (untouchedIdx < 0) { + return result; + } + result[resultIdx++] = untouchedNode; + while (oldIdx < oldSortedLength) { + const node = oldSortedRows[oldIdx++]; + if (indexByNode.get(node) >= 0) { + result[resultIdx++] = node; + } + } + return result; +}; +var filterRemovedNodes = (rows, map, result) => { + let count = 0; + result.length = map.size; + for (let i = 0, len = rows.length;i < len; ++i) { + const node = rows[i]; + if (map.has(node)) { + result[count++] = node; + } + } + result.length = count; + return result; +}; +var updateRowNodeAfterSort = (rowNode) => { + const childrenAfterSort = rowNode.childrenAfterSort; + const sibling = rowNode.sibling; + if (sibling) { + sibling.childrenAfterSort = childrenAfterSort; + } + if (!childrenAfterSort) { + return; + } + for (let i = 0, lastIdx = childrenAfterSort.length - 1;i <= lastIdx; i++) { + const child = childrenAfterSort[i]; + const first = i === 0; + const last = i === lastIdx; + if (child.firstChild !== first) { + child.firstChild = first; + child.dispatchRowEvent("firstChildChanged"); + } + if (child.lastChild !== last) { + child.lastChild = last; + child.dispatchRowEvent("lastChildChanged"); + } + if (child.childIndex !== i) { + child.childIndex = i; + child.dispatchRowEvent("childIndexChanged"); + } + } +}; +var SortStage = class extends BeanStub { + constructor() { + super(...arguments); + this.beanName = "sortStage"; + this.step = "sort"; + this.refreshProps = ["postSortRows", "groupDisplayType", "accentedSort"]; + } + execute(changedPath, changedRowNodes) { + const sortOptions = this.beans.sortSvc.getSortOptions(); + const useDeltaSort = sortOptions.length > 0 && !!changedRowNodes && this.gos.get("deltaSort"); + const { gos, colModel, rowGroupColsSvc, rowNodeSorter, rowRenderer, showRowGroupCols } = this.beans; + const groupMaintainOrder = gos.get("groupMaintainOrder"); + const groupColumnsPresent = colModel.getCols().some((c) => c.isRowGroupActive()); + const groupCols = rowGroupColsSvc?.columns; + const isPivotMode = colModel.isPivotMode(); + const postSortFunc = gos.getCallback("postSortRows"); + let hasAnyFirstChildChanged = false; + let sortContainsGroupColumns; + const callback = (rowNode) => { + const skipSortingPivotLeafs = isPivotMode && rowNode.leafGroup; + let skipSortingGroups = groupMaintainOrder && groupColumnsPresent && !rowNode.leafGroup; + if (skipSortingGroups) { + sortContainsGroupColumns ?? (sortContainsGroupColumns = this.shouldSortContainsGroupCols(sortOptions)); + skipSortingGroups && (skipSortingGroups = !sortContainsGroupColumns); + } + let newChildrenAfterSort = null; + if (skipSortingGroups) { + let wasSortExplicitlyRemoved = false; + if (groupCols) { + const nextGroupIndex = rowNode.level + 1; + if (nextGroupIndex < groupCols.length) { + wasSortExplicitlyRemoved = groupCols[nextGroupIndex].wasSortExplicitlyRemoved; + } + } + if (!wasSortExplicitlyRemoved) { + newChildrenAfterSort = preserveGroupOrder(rowNode); + } + } else if (!sortOptions.length || skipSortingPivotLeafs) {} else if (useDeltaSort && changedRowNodes) { + newChildrenAfterSort = doDeltaSort(rowNodeSorter, rowNode, changedRowNodes, changedPath, sortOptions); + } else { + newChildrenAfterSort = rowNodeSorter.doFullSortInPlace(rowNode.childrenAfterAggFilter.slice(), sortOptions); + } + newChildrenAfterSort || (newChildrenAfterSort = rowNode.childrenAfterAggFilter?.slice() ?? []); + hasAnyFirstChildChanged || (hasAnyFirstChildChanged = rowNode.childrenAfterSort?.[0] !== newChildrenAfterSort[0]); + rowNode.childrenAfterSort = newChildrenAfterSort; + updateRowNodeAfterSort(rowNode); + if (postSortFunc) { + const params = { nodes: rowNode.childrenAfterSort }; + postSortFunc(params); + } + }; + _forEachChangedGroupDepthFirst(this.beans.rowModel.rootNode, this.beans.rowModel.hierarchical, changedPath, callback); + if (hasAnyFirstChildChanged && gos.get("groupHideOpenParents")) { + const columns = showRowGroupCols?.columns; + if (columns?.length) { + rowRenderer.refreshCells({ columns, force: true }); + } + } + } + shouldSortContainsGroupCols(sortOptions) { + const sortOptionsLen = sortOptions.length; + if (!sortOptionsLen) { + return false; + } + if (_isColumnsSortingCoupledToGroup(this.gos)) { + for (let i = 0;i < sortOptionsLen; ++i) { + const column = sortOptions[i].column; + if (column.isPrimary() && column.isRowGroupActive()) { + return true; + } + } + return false; + } + for (let i = 0;i < sortOptionsLen; ++i) { + if (sortOptions[i].column.getColDef().showRowGroup) { + return true; + } + } + return false; + } +}; +var preserveGroupOrder = (node) => { + const childrenAfterSort = node.childrenAfterSort; + const childrenAfterAggFilter = node.childrenAfterAggFilter; + const childrenAfterSortLen = childrenAfterSort?.length; + const childrenAfterAggFilterLen = childrenAfterAggFilter?.length; + if (!childrenAfterSortLen || !childrenAfterAggFilterLen) { + return null; + } + const result = new Array(childrenAfterAggFilterLen); + const processed = /* @__PURE__ */ new Set; + for (let i = 0;i < childrenAfterAggFilterLen; ++i) { + processed.add(childrenAfterAggFilter[i]); + } + let writeIdx = 0; + for (let i = 0;i < childrenAfterSortLen; ++i) { + const node2 = childrenAfterSort[i]; + if (processed.delete(node2)) { + result[writeIdx++] = node2; + } + } + if (processed.size === 0 && writeIdx === childrenAfterSortLen) { + return childrenAfterSort; + } + for (const newNode of processed) { + result[writeIdx++] = newNode; + } + result.length = writeIdx; + return result; +}; +var ClientSideRowModel = class extends BeanStub { + constructor() { + super(...arguments); + this.beanName = "rowModel"; + this.rootNode = null; + this.rowCountReady = false; + this.hierarchical = false; + this.nodeManager = undefined; + this.rowsToDisplay = []; + this.formulaRows = []; + this.stages = null; + this.asyncTransactions = null; + this.asyncTransactionsTimer = 0; + this.started = false; + this.refreshingData = false; + this.rowDataUpdatedPending = false; + this.refreshingModel = false; + this.pendingNewData = false; + this.noKeepRenderedRows = false; + this.noKeepUndoRedoStack = false; + this.noAnimate = false; + this.rowNodesCountReady = false; + this.stagesRefreshProps = /* @__PURE__ */ new Map; + this.onRowHeightChanged_debounced = _debounce(this, this.onRowHeightChanged.bind(this), 100); + } + postConstruct() { + const beans = this.beans; + const rootNode = new RowNode(beans); + this.rootNode = rootNode; + this.nodeManager = this.createBean(new ClientSideNodeManager(rootNode)); + const onColumnsChanged = () => { + this.beans.groupStage?.invalidateGroupCols(); + this.refreshModel({ + step: "group", + afterColumnsChanged: true, + keepRenderedRows: true, + animate: !this.gos.get("suppressAnimationFrame") + }); + }; + this.addManagedEventListeners({ + newColumnsLoaded: onColumnsChanged, + columnRowGroupChanged: onColumnsChanged, + 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() { + const { beans, stagesRefreshProps } = this; + const orderedStages = [ + beans.groupStage, + beans.filterStage, + beans.pivotStage, + beans.aggStage, + beans.sortStage, + beans.filterAggStage, + beans.flattenStage + ].filter((stage) => !!stage); + this.stages = orderedStages; + for (let i = orderedStages.length - 1;i >= 0; --i) { + const stage = orderedStages[i]; + for (const prop of stage.refreshProps) { + stagesRefreshProps.set(prop, i); + } + } + this.addManagedPropertyListeners([...stagesRefreshProps.keys(), "rowData"], (params) => { + const properties = params.changeSet?.properties; + if (properties) { + this.onPropChange(properties); + } + }); + this.addManagedPropertyListener("rowHeight", () => this.resetRowHeights()); + } + start() { + this.started = true; + if (this.rowNodesCountReady) { + this.refreshModel({ step: "group", rowDataUpdated: true, newData: true }); + } else { + this.setInitialData(); + } + } + setInitialData() { + const rowData = this.gos.get("rowData"); + if (rowData) { + this.onPropChange(["rowData"]); + } + } + ensureRowHeightsValid(startPixel, endPixel, startLimitIndex, endLimitIndex) { + let atLeastOneChange; + let res = false; + do { + atLeastOneChange = false; + const rowAtStartPixel = this.getRowIndexAtPixel(startPixel); + const rowAtEndPixel = this.getRowIndexAtPixel(endPixel); + const firstRow = Math.max(rowAtStartPixel, startLimitIndex); + const lastRow = Math.min(rowAtEndPixel, endLimitIndex); + for (let rowIndex = firstRow;rowIndex <= lastRow; rowIndex++) { + const rowNode = this.getRow(rowIndex); + if (rowNode.rowHeightEstimated) { + const rowHeight = _getRowHeightForNode(this.beans, rowNode); + rowNode.setRowHeight(rowHeight.height); + atLeastOneChange = true; + res = true; + } + } + if (atLeastOneChange) { + this.setRowTopAndRowIndex(); + } + } while (atLeastOneChange); + return res; + } + onPropChange(properties) { + const { nodeManager, gos, beans } = this; + const groupStage = beans.groupStage; + if (!nodeManager) { + return; + } + const changedProps = new Set(properties); + const extractData = groupStage?.onPropChange(changedProps); + let newRowData; + if (changedProps.has("rowData")) { + newRowData = gos.get("rowData"); + } else if (extractData) { + newRowData = groupStage?.extractData(); + } + if (newRowData && !Array.isArray(newRowData)) { + newRowData = null; + _warn(1); + } + const params = { step: "nothing", changedProps }; + if (newRowData) { + const immutable = !extractData && !this.isEmpty() && newRowData.length > 0 && gos.exists("getRowId") && !gos.get("resetRowDataOnUpdate"); + this.refreshingData = true; + if (immutable) { + params.keepRenderedRows = true; + params.animate = !gos.get("suppressAnimationFrame"); + params.changedRowNodes = new ChangedRowNodes; + nodeManager.setImmutableRowData(params, newRowData); + } else { + params.rowDataUpdated = true; + params.newData = true; + nodeManager.setNewRowData(newRowData); + this.rowNodesCountReady = true; + } + } + const step = params.rowDataUpdated ? "group" : this.getRefreshedStage(properties); + if (step) { + params.step = step; + this.refreshModel(params); + } + } + getRefreshedStage(properties) { + const { stages, stagesRefreshProps } = this; + if (!stages) { + return null; + } + const stagesLen = stages.length; + let minIndex = stagesLen; + for (let i = 0, len = properties.length;i < len && minIndex; ++i) { + minIndex = Math.min(minIndex, stagesRefreshProps.get(properties[i]) ?? minIndex); + } + return minIndex < stagesLen ? stages[minIndex].step : null; + } + setRowTopAndRowIndex(outputDisplayedRowsMapped) { + const { beans, rowsToDisplay } = this; + const defaultRowHeight = beans.environment.getDefaultRowHeight(); + let nextRowTop = 0; + const allowEstimate = _isDomLayout(this.gos, "normal"); + for (let i = 0, len = rowsToDisplay.length;i < len; ++i) { + const rowNode = rowsToDisplay[i]; + const id = rowNode.id; + if (id != null) { + outputDisplayedRowsMapped?.add(id); + } + if (rowNode.rowHeight == null) { + const rowHeight = _getRowHeightForNode(beans, rowNode, allowEstimate, defaultRowHeight); + rowNode.setRowHeight(rowHeight.height, rowHeight.estimated); + } + rowNode.setRowTop(nextRowTop); + rowNode.setRowIndex(i); + nextRowTop += rowNode.rowHeight; + } + if (this.beans.formula?.active) { + const formulaRows = this.formulaRows; + for (let i = 0, len = formulaRows.length;i < len; ++i) { + const rowNode = formulaRows[i]; + rowNode.formulaRowIndex = i; + } + } + } + clearRowTopAndRowIndex(changedPath, displayedRowsMapped) { + const clearIfNotDisplayed = (rowNode) => { + if (rowNode?.id != null && !displayedRowsMapped.has(rowNode.id)) { + rowNode.clearRowTopAndRowIndex(); + } + }; + const recurse = (rowNode) => { + clearIfNotDisplayed(rowNode); + clearIfNotDisplayed(rowNode.detailNode); + clearIfNotDisplayed(rowNode.sibling); + const childrenAfterGroup = rowNode.childrenAfterGroup; + if (!rowNode.hasChildren() || !childrenAfterGroup) { + return; + } + if (changedPath && rowNode.level !== -1 && !rowNode.expanded) { + return; + } + for (let i = 0, len = childrenAfterGroup.length;i < len; ++i) { + recurse(childrenAfterGroup[i]); + } + }; + const rootNode = this.rootNode; + if (rootNode) { + recurse(rootNode); + } + } + isLastRowIndexKnown() { + return true; + } + getRowCount() { + return this.rowsToDisplay.length; + } + getTopLevelRowCount() { + const { rootNode, rowsToDisplay } = this; + if (!rootNode || !rowsToDisplay.length) { + return 0; + } + const showingRootNode = rowsToDisplay[0] === rootNode; + if (showingRootNode) { + return 1; + } + const totalFooterInc = rootNode.sibling?.displayed ? 1 : 0; + return (rootNode.childrenAfterSort?.length ?? 0) + totalFooterInc; + } + getTopLevelRowDisplayedIndex(topLevelIndex) { + const { beans, rootNode, rowsToDisplay } = this; + const showingRootNode = !rootNode || !rowsToDisplay.length || rowsToDisplay[0] === rootNode; + if (showingRootNode) { + return topLevelIndex; + } + const childrenAfterSort = rootNode.childrenAfterSort; + const getDefaultIndex = (adjustedIndex) => { + let rowNode = childrenAfterSort[adjustedIndex]; + if (this.gos.get("groupHideOpenParents")) { + while (rowNode.expanded && rowNode.childrenAfterSort && rowNode.childrenAfterSort.length > 0) { + rowNode = rowNode.childrenAfterSort[0]; + } + } + return rowNode.rowIndex; + }; + const footerSvc = beans.footerSvc; + if (footerSvc) { + return footerSvc?.getTopDisplayIndex(rowsToDisplay, topLevelIndex, childrenAfterSort, getDefaultIndex); + } + return getDefaultIndex(topLevelIndex); + } + getTopLevelIndexFromDisplayedIndex(displayedIndex) { + const { rootNode, rowsToDisplay } = this; + const showingRootNode = !rootNode || !rowsToDisplay.length || rowsToDisplay[0] === rootNode; + if (showingRootNode) { + return displayedIndex; + } + let node = this.getRow(displayedIndex); + if (node.footer) { + node = node.sibling; + } + let parent = node.parent; + while (parent && parent !== rootNode) { + node = parent; + parent = node.parent; + } + const topLevelIndex = rootNode.childrenAfterSort?.indexOf(node) ?? -1; + return topLevelIndex >= 0 ? topLevelIndex : displayedIndex; + } + getRowBounds(index) { + const rowNode = this.rowsToDisplay[index]; + return rowNode ? { rowTop: rowNode.rowTop, rowHeight: rowNode.rowHeight } : null; + } + onRowGroupOpened() { + this.refreshModel({ step: "map", keepRenderedRows: true, animate: _isAnimateRows(this.gos) }); + } + onFilterChanged({ afterDataChange, columns }) { + if (!afterDataChange) { + const primaryOrQuickFilterChanged = columns.length === 0 || columns.some((col) => col.isPrimary()); + const step = primaryOrQuickFilterChanged ? "filter" : "filter_aggregates"; + this.refreshModel({ step, keepRenderedRows: true, animate: _isAnimateRows(this.gos) }); + } + } + onSortChanged() { + this.refreshModel({ + step: "sort", + keepRenderedRows: true, + animate: _isAnimateRows(this.gos) + }); + } + getType() { + return "clientSide"; + } + onValueChanged() { + this.refreshModel({ step: this.beans.colModel.isPivotActive() ? "pivot" : "aggregate" }); + } + isSuppressModelUpdateAfterUpdateTransaction(params) { + if (!this.gos.get("suppressModelUpdateAfterUpdateTransaction")) { + return false; + } + const { changedRowNodes, newData, rowDataUpdated } = params; + if (!changedRowNodes || newData || !rowDataUpdated) { + return false; + } + if (changedRowNodes.removals.length || changedRowNodes.adds.size) { + return false; + } + return true; + } + reMapRows() { + if (this.refreshingModel || this.refreshingData) { + this.noKeepRenderedRows = true; + this.noKeepUndoRedoStack = true; + this.noAnimate = true; + return; + } + this.refreshModel({ step: "map", keepRenderedRows: false, keepUndoRedoStack: false, animate: false }); + } + refreshModel(params) { + const { nodeManager, eventSvc, started } = this; + if (!nodeManager) { + return; + } + const rowDataUpdated = !!params.rowDataUpdated; + if (started && rowDataUpdated) { + eventSvc.dispatchEvent({ type: "rowDataUpdated" }); + } + if (this.deferRefresh(params)) { + this.setPendingRefreshFlags(params); + this.rowDataUpdatedPending || (this.rowDataUpdatedPending = rowDataUpdated); + return; + } + if (this.rowDataUpdatedPending) { + this.rowDataUpdatedPending = false; + params.step = "group"; + } + this.updateRefreshParams(params); + let succeeded = false; + this.refreshingModel = true; + try { + this.executeRefresh(params, rowDataUpdated); + succeeded = true; + } finally { + this.refreshingData = false; + this.refreshingModel = false; + if (!succeeded) { + this.setPendingRefreshFlags(params); + } + } + this.clearPendingRefreshFlags(); + eventSvc.dispatchEvent({ + type: "modelUpdated", + animate: params.animate, + keepRenderedRows: params.keepRenderedRows, + newData: params.newData, + newPage: false, + keepUndoRedoStack: params.keepUndoRedoStack + }); + } + executeRefresh(params, rowDataUpdated) { + const { beans, rootNode } = this; + beans.masterDetailSvc?.refreshModel(params); + if (rowDataUpdated && params.step !== "group") { + beans.colFilter?.refreshModel(); + } + let changedPath = params.changedPath; + changedPath?.addRow(rootNode); + if (params.step === "group") { + this.doGrouping(rootNode, params); + changedPath ?? (changedPath = params.changedPath); + } + changedPath ?? (changedPath = beans.changedPathFactory?.ensureRowsPath(params, rootNode)); + switch (params.step) { + case "group": + case "filter": + this.doFilter(changedPath); + case "pivot": + if (this.doPivot(changedPath)) { + changedPath = undefined; + params.changedPath = undefined; + } + case "aggregate": + this.doAggregate(changedPath); + case "filter_aggregates": + this.doFilterAggregates(changedPath); + case "sort": + this.doSort(changedPath, params.changedRowNodes); + case "map": + this.doRowsToDisplay(); + } + const displayedNodesMapped = /* @__PURE__ */ new Set; + this.setRowTopAndRowIndex(displayedNodesMapped); + this.clearRowTopAndRowIndex(changedPath, displayedNodesMapped); + this.updateRefreshParams(params); + } + deferRefresh(params) { + if (this.refreshingModel) { + return true; + } + if (this.beans.colModel.changeEventsDispatching) { + return true; + } + if (this.isSuppressModelUpdateAfterUpdateTransaction(params)) { + if (this.started) { + this.refreshingData = false; + } + return true; + } + if (!this.started) { + return true; + } + return false; + } + setPendingRefreshFlags(params) { + this.pendingNewData || (this.pendingNewData = !!params.newData); + this.noKeepRenderedRows || (this.noKeepRenderedRows = !params.keepRenderedRows); + this.noKeepUndoRedoStack || (this.noKeepUndoRedoStack = !params.keepUndoRedoStack); + this.noAnimate || (this.noAnimate = !params.animate); + } + clearPendingRefreshFlags() { + this.pendingNewData = false; + this.noKeepRenderedRows = false; + this.noKeepUndoRedoStack = false; + this.noAnimate = false; + } + updateRefreshParams(params) { + params.newData = this.pendingNewData || !!params.newData; + params.keepRenderedRows = !this.noKeepRenderedRows && !!params.keepRenderedRows; + params.keepUndoRedoStack = !this.noKeepUndoRedoStack && !!params.keepUndoRedoStack; + params.animate = !this.noAnimate && !!params.animate; + } + isEmpty() { + return !this.rootNode?._leafs?.length || !this.beans.colModel?.ready; + } + isRowsToRender() { + return this.rowsToDisplay.length > 0; + } + getOverlayType() { + const { beans, gos } = this; + if (this.rootNode?._leafs?.length) { + if (beans.filterManager?.isAnyFilterPresent() && this.getRowCount() === 0) { + return "noMatchingRows"; + } + } else if (this.rowCountReady || (gos.get("rowData")?.length ?? 0) == 0) { + return "noRows"; + } + return null; + } + getNodesInRangeForSelection(firstInRange, lastInRange) { + let started = false; + let finished = false; + const result = []; + const groupsSelectChildren = _getGroupSelectsDescendants(this.gos); + this.forEachNodeAfterFilterAndSort((rowNode) => { + if (finished) { + return; + } + if (started) { + if (rowNode === lastInRange || rowNode === firstInRange) { + finished = true; + if (groupsSelectChildren && rowNode.group) { + addAllLeafs(result, rowNode); + return; + } + } + } + if (!started) { + if (rowNode !== lastInRange && rowNode !== firstInRange) { + return; + } + started = true; + if (lastInRange === firstInRange) { + finished = true; + } + } + const includeThisNode = !rowNode.group || !groupsSelectChildren; + if (includeThisNode) { + result.push(rowNode); + } + }); + return result; + } + getTopLevelNodes() { + return this.rootNode?.childrenAfterGroup ?? null; + } + getRow(index) { + return this.rowsToDisplay[index]; + } + getFormulaRow(index) { + return this.formulaRows[index]; + } + isRowPresent(rowNode) { + return this.rowsToDisplay.indexOf(rowNode) >= 0; + } + getRowIndexAtPixel(pixelToMatch) { + const rowsToDisplay = this.rowsToDisplay; + const rowsToDisplayLen = rowsToDisplay.length; + if (this.isEmpty() || rowsToDisplayLen === 0) { + return -1; + } + let bottomPointer = 0; + let topPointer = rowsToDisplayLen - 1; + if (pixelToMatch <= 0) { + return 0; + } + const lastNode = rowsToDisplay[topPointer]; + if (lastNode.rowTop <= pixelToMatch) { + return topPointer; + } + let oldBottomPointer = -1; + let oldTopPointer = -1; + while (true) { + const midPointer = Math.floor((bottomPointer + topPointer) / 2); + const currentRowNode = rowsToDisplay[midPointer]; + if (this.isRowInPixel(currentRowNode, pixelToMatch)) { + return midPointer; + } + if (currentRowNode.rowTop < pixelToMatch) { + bottomPointer = midPointer + 1; + } else if (currentRowNode.rowTop > pixelToMatch) { + topPointer = midPointer - 1; + } + const caughtInInfiniteLoop = oldBottomPointer === bottomPointer && oldTopPointer === topPointer; + if (caughtInInfiniteLoop) { + return midPointer; + } + oldBottomPointer = bottomPointer; + oldTopPointer = topPointer; + } + } + isRowInPixel(rowNode, pixelToMatch) { + const topPixel = rowNode.rowTop; + const bottomPixel = topPixel + rowNode.rowHeight; + return topPixel <= pixelToMatch && bottomPixel > pixelToMatch; + } + forEachLeafNode(callback) { + const allLeafs = this.rootNode?._leafs; + if (allLeafs) { + for (let i = 0, len = allLeafs.length;i < len; ++i) { + callback(allLeafs[i], i); + } + } + } + forEachNode(callback, includeFooterNodes = false) { + this.depthFirstSearchRowNodes(callback, includeFooterNodes); + } + forEachDisplayedNode(callback) { + const rowsToDisplay = this.rowsToDisplay; + for (let i = 0, len = rowsToDisplay.length;i < len; ++i) { + callback(rowsToDisplay[i], i); + } + } + forEachNodeAfterFilter(callback, includeFooterNodes = false) { + this.depthFirstSearchRowNodes(callback, includeFooterNodes, (node) => node.childrenAfterAggFilter); + } + forEachNodeAfterFilterAndSort(callback, includeFooterNodes = false) { + this.depthFirstSearchRowNodes(callback, includeFooterNodes, (node) => node.childrenAfterSort); + } + forEachPivotNode(callback, includeFooterNodes, afterSort) { + const { colModel, rowGroupColsSvc } = this.beans; + if (!colModel.isPivotMode()) { + return; + } + if (!rowGroupColsSvc?.columns.length) { + callback(this.rootNode, 0); + return; + } + const childrenField = afterSort ? "childrenAfterSort" : "childrenAfterGroup"; + this.depthFirstSearchRowNodes(callback, includeFooterNodes, (node) => !node.leafGroup ? node[childrenField] : null); + } + depthFirstSearchRowNodes(callback, includeFooterNodes = false, getChildren = (node2) => node2.childrenAfterGroup, node = this.rootNode, startIndex = 0) { + let index = startIndex; + if (!node) { + return index; + } + const isRootNode = node === this.rootNode; + if (!isRootNode) { + callback(node, index++); + } + if (node.hasChildren() && !node.footer) { + const children = isRootNode || this.hierarchical ? getChildren(node) : null; + if (children) { + const footerSvc = this.beans.footerSvc; + index = footerSvc?.addTotalRows(index, node, callback, includeFooterNodes, isRootNode, "top") ?? index; + for (const node2 of children) { + index = this.depthFirstSearchRowNodes(callback, includeFooterNodes, getChildren, node2, index); + } + return footerSvc?.addTotalRows(index, node, callback, includeFooterNodes, isRootNode, "bottom") ?? index; + } + } + return index; + } + doAggregate(changedPath) { + const rootNode = this.rootNode; + if (rootNode) { + this.beans.aggStage?.execute(changedPath); + } + } + doFilterAggregates(changedPath) { + const rootNode = this.rootNode; + const filterAggStage = this.beans.filterAggStage; + if (filterAggStage && this.hierarchical) { + filterAggStage.execute(changedPath); + return; + } + rootNode.childrenAfterAggFilter = rootNode.childrenAfterFilter; + const sibling = rootNode.sibling; + if (sibling) { + sibling.childrenAfterAggFilter = rootNode.childrenAfterFilter; + } + } + doSort(changedPath, changedRowNodes) { + const sortStage = this.beans.sortStage; + if (sortStage) { + sortStage.execute(changedPath, changedRowNodes); + return; + } + _forEachChangedGroupDepthFirst(this.rootNode, this.hierarchical, changedPath, (rowNode) => { + rowNode.childrenAfterSort = rowNode.childrenAfterAggFilter.slice(0); + updateRowNodeAfterSort(rowNode); + }); + } + doGrouping(rootNode, params) { + const groupStage = this.beans.groupStage; + const groupingChanged = groupStage?.execute(params); + if (groupingChanged === undefined) { + const allLeafs = rootNode._leafs; + rootNode.childrenAfterGroup = allLeafs; + rootNode.updateHasChildren(); + const sibling = rootNode.sibling; + if (sibling) { + sibling.childrenAfterGroup = allLeafs; + } + } + if (groupingChanged || params.rowDataUpdated) { + this.beans.colFilter?.refreshModel(); + } + if (!this.rowCountReady && this.rowNodesCountReady) { + this.rowCountReady = true; + this.eventSvc.dispatchEventOnce({ type: "rowCountReady" }); + } + } + doFilter(changedPath) { + const filterStage = this.beans.filterStage; + if (filterStage) { + filterStage.execute(changedPath); + return; + } + _forEachChangedGroupDepthFirst(this.rootNode, this.hierarchical, changedPath, (rowNode) => { + rowNode.childrenAfterFilter = rowNode.childrenAfterGroup; + updateRowNodeAfterFilter(rowNode); + }); + } + doPivot(changedPath) { + return this.beans.pivotStage?.execute(changedPath) ?? false; + } + getRowNode(id) { + const found = this.nodeManager?.getRowNode(id); + if (typeof found === "object") { + return found; + } + return this.beans.groupStage?.getNonLeaf(id); + } + batchUpdateRowData(rowDataTransaction, callback) { + if (!this.asyncTransactionsTimer) { + this.asyncTransactions = []; + const waitMilliseconds = this.gos.get("asyncTransactionWaitMillis"); + this.asyncTransactionsTimer = setTimeout(() => this.executeBatchUpdateRowData(), waitMilliseconds); + } + this.asyncTransactions.push({ rowDataTransaction, callback }); + } + flushAsyncTransactions() { + const asyncTransactionsTimer = this.asyncTransactionsTimer; + if (asyncTransactionsTimer) { + clearTimeout(asyncTransactionsTimer); + this.executeBatchUpdateRowData(); + } + } + executeBatchUpdateRowData() { + const { nodeManager, beans, eventSvc, asyncTransactions } = this; + if (!nodeManager) { + return; + } + beans.valueCache?.onDataChanged(); + const rowNodeTrans = []; + const callbackFuncsBound = []; + const changedRowNodes = new ChangedRowNodes; + const animate = !this.gos.get("suppressAnimationFrame"); + for (const { rowDataTransaction, callback } of asyncTransactions ?? []) { + this.rowNodesCountReady = true; + this.refreshingData = true; + const rowNodeTransaction = nodeManager.updateRowData(rowDataTransaction, changedRowNodes, animate); + rowNodeTrans.push(rowNodeTransaction); + if (callback) { + callbackFuncsBound.push(callback.bind(null, rowNodeTransaction)); + } + } + this.commitTransactions(changedRowNodes, animate); + if (callbackFuncsBound.length > 0) { + setTimeout(() => { + for (let i = 0, len = callbackFuncsBound.length;i < len; i++) { + callbackFuncsBound[i](); + } + }, 0); + } + if (rowNodeTrans.length > 0) { + eventSvc.dispatchEvent({ type: "asyncTransactionsFlushed", results: rowNodeTrans }); + } + this.asyncTransactionsTimer = 0; + this.asyncTransactions = null; + } + updateRowData(rowDataTran) { + const nodeManager = this.nodeManager; + if (!nodeManager) { + return null; + } + this.beans.valueCache?.onDataChanged(); + this.rowNodesCountReady = true; + const changedRowNodes = new ChangedRowNodes; + const animate = !this.gos.get("suppressAnimationFrame"); + this.refreshingData = true; + const rowNodeTransaction = nodeManager.updateRowData(rowDataTran, changedRowNodes, animate); + this.commitTransactions(changedRowNodes, animate); + return rowNodeTransaction; + } + commitTransactions(changedRowNodes, animate) { + this.refreshModel({ + step: "group", + rowDataUpdated: true, + keepRenderedRows: true, + animate, + changedRowNodes + }); + } + doRowsToDisplay() { + const { rootNode, beans } = this; + if (beans.formula?.active) { + const unfilteredRows = rootNode?.childrenAfterSort ?? []; + this.formulaRows = unfilteredRows; + this.rowsToDisplay = unfilteredRows.filter((row) => !row.softFiltered); + for (const row of this.rowsToDisplay) { + row.setUiLevel(0); + } + return; + } + const flattenStage = beans.flattenStage; + if (flattenStage) { + this.rowsToDisplay = flattenStage.execute(); + return; + } + const rowsToDisplay = this.rootNode.childrenAfterSort ?? []; + for (const row of rowsToDisplay) { + row.setUiLevel(0); + } + this.rowsToDisplay = rowsToDisplay; + } + onRowHeightChanged() { + this.refreshModel({ step: "map", keepRenderedRows: true, keepUndoRedoStack: true }); + } + resetRowHeights() { + const rootNode = this.rootNode; + if (!rootNode) { + return; + } + const atLeastOne = this.resetRowHeightsForAllRowNodes(); + rootNode.setRowHeight(rootNode.rowHeight, true); + const sibling = rootNode.sibling; + sibling?.setRowHeight(sibling.rowHeight, true); + if (atLeastOne) { + this.onRowHeightChanged(); + } + } + resetRowHeightsForAllRowNodes() { + let atLeastOne = false; + this.forEachNode((rowNode) => { + rowNode.setRowHeight(rowNode.rowHeight, true); + const detailNode = rowNode.detailNode; + detailNode?.setRowHeight(detailNode.rowHeight, true); + const sibling = rowNode.sibling; + sibling?.setRowHeight(sibling.rowHeight, true); + atLeastOne = true; + }); + return atLeastOne; + } + onGridStylesChanges(e) { + if (e.rowHeightChanged && !this.beans.rowAutoHeight?.active) { + this.resetRowHeights(); + } + } + onGridReady() { + if (!this.started) { + this.setInitialData(); + } + } + destroy() { + super.destroy(); + this.nodeManager = this.destroyBean(this.nodeManager); + this.started = false; + this.rootNode = null; + this.rowsToDisplay = []; + this.asyncTransactions = null; + this.stages = null; + this.stagesRefreshProps.clear(); + clearTimeout(this.asyncTransactionsTimer); + } + onRowHeightChangedDebounced() { + this.onRowHeightChanged_debounced(); + } +}; +var addAllLeafs = (result, node) => { + const childrenAfterGroup = node.childrenAfterGroup; + if (childrenAfterGroup) { + for (let i = 0, len = childrenAfterGroup.length;i < len; ++i) { + const child = childrenAfterGroup[i]; + if (child.data) { + result.push(child); + } + if (child.group) { + addAllLeafs(result, child); + } + } + } +}; +var ClientSideRowModelModule = { + moduleName: "ClientSideRowModel", + version: VERSION, + rowModels: ["clientSide"], + beans: [ClientSideRowModel, SortStage], + dependsOn: [SortModule] +}; +var columnAutoSize_default = ":where(.ag-ltr) :where(.ag-animate-autosize){.ag-cell,.ag-header-cell,.ag-header-group-cell{transition:width .2s ease-in-out,left .2s ease-in-out}}:where(.ag-rtl) :where(.ag-animate-autosize){.ag-cell,.ag-header-cell,.ag-header-group-cell{transition:width .2s ease-in-out,right .2s ease-in-out}}"; +function sizeColumnsToFit(beans, paramsOrGridWidth) { + if (typeof paramsOrGridWidth === "number") { + beans.colAutosize?.sizeColumnsToFit(paramsOrGridWidth, "api"); + } else { + beans.colAutosize?.sizeColumnsToFitGridBody(paramsOrGridWidth); + } +} +function autoSizeColumns({ colAutosize, visibleCols }, keysOrParams, skipHeader) { + if (Array.isArray(keysOrParams)) { + colAutosize?.autoSizeCols({ colKeys: keysOrParams, skipHeader, source: "api" }); + } else { + colAutosize?.autoSizeCols({ + ...keysOrParams, + colKeys: keysOrParams.colIds ?? visibleCols.allCols, + source: "api" + }); + } +} +function autoSizeAllColumns(beans, paramsOrSkipHeader) { + if (paramsOrSkipHeader && typeof paramsOrSkipHeader === "object") { + autoSizeColumns(beans, paramsOrSkipHeader); + } else { + beans.colAutosize?.autoSizeAllColumns({ source: "api", skipHeader: paramsOrSkipHeader }); + } +} +var ColumnAutosizeService = class extends BeanStub { + constructor() { + super(...arguments); + this.beanName = "colAutosize"; + this.timesDelayed = 0; + this.shouldQueueResizeOperations = false; + this.resizeOperationQueue = []; + } + postConstruct() { + const { gos } = this; + const autoSizeStrategy = gos.get("autoSizeStrategy"); + if (autoSizeStrategy) { + let shouldHideColumns = false; + const type = autoSizeStrategy.type; + if (type === "fitGridWidth" || type === "fitProvidedWidth") { + shouldHideColumns = true; + } else if (type === "fitCellContents") { + this.addManagedEventListeners({ firstDataRendered: () => this.onFirstDataRendered(autoSizeStrategy) }); + const rowData = gos.get("rowData"); + shouldHideColumns = rowData != null && rowData.length > 0 && _isClientSideRowModel(gos); + } + if (shouldHideColumns) { + this.beans.colDelayRenderSvc?.hideColumns(type); + } + } + } + autoSizeCols(params) { + const { eventSvc, visibleCols, colModel } = this.beans; + setWidthAnimation(this.beans, true); + this.innerAutoSizeCols(params).then((columnsAutoSized) => { + const dispatch = (cols) => dispatchColumnResizedEvent(eventSvc, Array.from(cols), true, "autosizeColumns"); + if (!params.scaleUpToFitGridWidth) { + setWidthAnimation(this.beans, false); + return dispatch(columnsAutoSized); + } + const availableGridWidth = getAvailableWidth(this.beans); + const isLeftCol = (col) => visibleCols.leftCols.some((leftCol) => _columnsMatch(leftCol, col)); + const isRightCol = (col) => visibleCols.rightCols.some((rightCol) => _columnsMatch(rightCol, col)); + const colKeys = params.colKeys.filter((col) => { + const allowAutoSize = !colModel.getCol(col)?.getColDef().suppressAutoSize; + return allowAutoSize && !isRowNumberCol(col) && !isLeftCol(col) && !isRightCol(col); + }); + this.sizeColumnsToFit(availableGridWidth, params.source, true, { + defaultMaxWidth: params.defaultMaxWidth, + defaultMinWidth: params.defaultMinWidth, + columnLimits: params.columnLimits?.map((limit) => ({ ...limit, key: limit.colId })), + colKeys, + onlyScaleUp: true, + animate: false + }); + setWidthAnimation(this.beans, false); + dispatch(columnsAutoSized); + }); + } + innerAutoSizeCols(params) { + return new Promise((resolve, reject) => { + if (this.shouldQueueResizeOperations) { + return this.pushResizeOperation(() => this.innerAutoSizeCols(params).then(resolve, reject)); + } + const { + colKeys, + skipHeader, + skipHeaderGroups, + stopAtGroup, + defaultMaxWidth, + defaultMinWidth, + columnLimits = [], + source = "api" + } = params; + const { animationFrameSvc, renderStatus, colModel, autoWidthCalc, visibleCols } = this.beans; + animationFrameSvc?.flushAllFrames(); + if (this.timesDelayed < 5 && renderStatus && (!renderStatus.areHeaderCellsRendered() || !renderStatus.areCellsRendered())) { + this.timesDelayed++; + setTimeout(() => { + if (this.isAlive()) { + this.innerAutoSizeCols(params).then(resolve, reject); + } + }); + return; + } + this.timesDelayed = 0; + const columnsAutoSized = /* @__PURE__ */ new Set; + let changesThisTimeAround = -1; + const columnLimitsIndex = Object.fromEntries(columnLimits.map(({ colId, ...dimensions }) => [colId, dimensions])); + const shouldSkipHeader = skipHeader ?? this.gos.get("skipHeaderOnAutoSize"); + const shouldSkipHeaderGroups = skipHeaderGroups ?? shouldSkipHeader; + while (changesThisTimeAround !== 0) { + changesThisTimeAround = 0; + const updatedColumns = []; + for (const key of colKeys) { + if (!key || isSpecialCol(key)) { + continue; + } + const column = colModel.getCol(key); + if (!column || columnsAutoSized.has(column) || column.getColDef().suppressAutoSize) { + continue; + } + const preferredWidth = autoWidthCalc.getPreferredWidthForColumn(column, shouldSkipHeader); + if (preferredWidth > 0) { + const columnLimit = columnLimitsIndex[column.colId] ?? {}; + columnLimit.minWidth ?? (columnLimit.minWidth = defaultMinWidth); + columnLimit.maxWidth ?? (columnLimit.maxWidth = defaultMaxWidth); + const newWidth = normaliseColumnWidth(column, preferredWidth, columnLimit); + column.setActualWidth(newWidth, source); + columnsAutoSized.add(column); + changesThisTimeAround++; + } + updatedColumns.push(column); + } + if (updatedColumns.length) { + visibleCols.refresh(source); + } + } + if (!shouldSkipHeaderGroups) { + this.autoSizeColumnGroupsByColumns(colKeys, source, stopAtGroup); + } + resolve(columnsAutoSized); + }); + } + autoSizeColumn(key, source, skipHeader) { + this.autoSizeCols({ colKeys: [key], skipHeader, skipHeaderGroups: true, source }); + } + autoSizeColumnGroupsByColumns(keys, source, stopAtGroup) { + const { colModel, ctrlsSvc } = this.beans; + const columnGroups = /* @__PURE__ */ new Set; + const columns = colModel.getColsForKeys(keys); + for (const col of columns) { + let parent = col.getParent(); + while (parent && parent != stopAtGroup) { + if (!parent.isPadding()) { + columnGroups.add(parent); + } + parent = parent.getParent(); + } + } + let headerGroupCtrl; + for (const columnGroup of columnGroups) { + for (const headerContainerCtrl of ctrlsSvc.getHeaderRowContainerCtrls()) { + headerGroupCtrl = headerContainerCtrl.getHeaderCtrlForColumn(columnGroup); + if (headerGroupCtrl) { + break; + } + } + headerGroupCtrl?.resizeLeafColumnsToFit(source); + } + } + autoSizeAllColumns(params) { + if (this.shouldQueueResizeOperations) { + this.pushResizeOperation(() => this.autoSizeAllColumns(params)); + return; + } + this.autoSizeCols({ colKeys: this.beans.visibleCols.allCols, ...params }); + } + addColumnAutosizeListeners(element, column) { + const skipHeaderOnAutoSize = this.gos.get("skipHeaderOnAutoSize"); + const autoSizeColListener = () => { + this.autoSizeColumn(column, "uiColumnResized", skipHeaderOnAutoSize); + }; + element.addEventListener("dblclick", autoSizeColListener); + const touchListener = new TouchListener(element); + touchListener.addEventListener("doubleTap", autoSizeColListener); + return () => { + element.removeEventListener("dblclick", autoSizeColListener); + touchListener.destroy(); + }; + } + addColumnGroupResize(element, columnGroup, callback) { + const skipHeaderOnAutoSize = this.gos.get("skipHeaderOnAutoSize"); + const listener = () => { + const keys = []; + const leafCols = columnGroup.getDisplayedLeafColumns(); + for (const column of leafCols) { + if (!column.getColDef().suppressAutoSize) { + keys.push(column.getColId()); + } + } + if (keys.length > 0) { + this.autoSizeCols({ + colKeys: keys, + skipHeader: skipHeaderOnAutoSize, + stopAtGroup: columnGroup, + source: "uiColumnResized" + }); + } + callback(); + }; + element.addEventListener("dblclick", listener); + return () => element.removeEventListener("dblclick", listener); + } + sizeColumnsToFitGridBody(params, nextTimeout) { + if (!this.isAlive()) { + return; + } + const availableWidth = getAvailableWidth(this.beans); + if (availableWidth > 0) { + this.sizeColumnsToFit(availableWidth, "sizeColumnsToFit", false, params); + return; + } + if (nextTimeout === undefined) { + window.setTimeout(() => { + this.sizeColumnsToFitGridBody(params, 100); + }, 0); + } else if (nextTimeout === 100) { + window.setTimeout(() => { + this.sizeColumnsToFitGridBody(params, 500); + }, 100); + } else if (nextTimeout === 500) { + window.setTimeout(() => { + this.sizeColumnsToFitGridBody(params, -1); + }, 500); + } else { + _warn(29); + } + } + sizeColumnsToFit(gridWidth, source = "sizeColumnsToFit", silent, params) { + if (this.shouldQueueResizeOperations) { + this.pushResizeOperation(() => this.sizeColumnsToFit(gridWidth, source, silent, params)); + return; + } + const { beans } = this; + const animate = params?.animate ?? true; + if (animate) { + setWidthAnimation(beans, true); + } + const limitsMap = {}; + for (const { key, ...dimensions } of params?.columnLimits ?? []) { + limitsMap[typeof key === "string" ? key : key.getColId()] = dimensions; + } + const allDisplayedColumns = beans.visibleCols.allCols; + if (gridWidth <= 0 || !allDisplayedColumns.length) { + return; + } + const currentTotalColumnWidth = getWidthOfColsInList(allDisplayedColumns); + if (params?.onlyScaleUp && currentTotalColumnWidth > gridWidth) { + return; + } + const doColumnsAlreadyFit = gridWidth === currentTotalColumnWidth; + if (doColumnsAlreadyFit) { + const doAllColumnsSatisfyConstraints = allDisplayedColumns.every((column) => { + if (column.colDef.suppressSizeToFit) { + return true; + } + const widthOverride = limitsMap?.[column.getId()]; + const minWidth = widthOverride?.minWidth ?? params?.defaultMinWidth; + const maxWidth = widthOverride?.maxWidth ?? params?.defaultMaxWidth; + const colWidth = column.getActualWidth(); + return (minWidth == null || colWidth >= minWidth) && (maxWidth == null || colWidth <= maxWidth); + }); + if (doAllColumnsSatisfyConstraints) { + return; + } + } + const colsToSpread = []; + const colsToNotSpread = []; + for (const column of allDisplayedColumns) { + const isIncluded = params?.colKeys?.some((key) => _columnsMatch(column, key)) ?? true; + if (column.getColDef().suppressSizeToFit || !isIncluded) { + colsToNotSpread.push(column); + } else { + colsToSpread.push(column); + } + } + const colsToDispatchEventFor = colsToSpread.slice(0); + let finishedResizing = false; + const moveToNotSpread = (column) => { + _removeFromArray(colsToSpread, column); + colsToNotSpread.push(column); + }; + const currentWidths = {}; + for (const column of colsToSpread) { + if (params?.onlyScaleUp) { + currentWidths[column.getColId()] = column.getActualWidth(); + } + column.resetActualWidth(source); + const widthOverride = limitsMap?.[column.getId()]; + const minOverride = widthOverride?.minWidth ?? params?.defaultMinWidth ?? -Infinity; + const maxOverride = widthOverride?.maxWidth ?? params?.defaultMaxWidth ?? Infinity; + const colWidth = column.getActualWidth(); + const targetWidth = Math.max(Math.min(colWidth, maxOverride), minOverride); + if (targetWidth != colWidth) { + column.setActualWidth(targetWidth, source, true); + } + } + while (!finishedResizing) { + finishedResizing = true; + const availablePixels = gridWidth - getWidthOfColsInList(colsToNotSpread); + if (availablePixels <= 0) { + for (const column of colsToSpread) { + const newWidth = limitsMap?.[column.getId()]?.minWidth ?? params?.defaultMinWidth ?? column.minWidth; + column.setActualWidth(newWidth, source, true); + } + } else { + const scale = availablePixels / getWidthOfColsInList(colsToSpread); + let pixelsForLastCol = availablePixels; + for (let i = colsToSpread.length - 1;i >= 0; i--) { + const column = colsToSpread[i]; + const id = column.getColId(); + const prevWidth = currentWidths[id]; + const widthOverride = limitsMap?.[id]; + const minOverride = widthOverride?.minWidth ?? params?.defaultMinWidth ?? prevWidth; + const maxOverride = widthOverride?.maxWidth ?? params?.defaultMaxWidth; + const minWidth = Math.max(minOverride ?? -Infinity, column.getMinWidth()); + const maxWidth = Math.min(maxOverride ?? Infinity, column.getMaxWidth()); + let newWidth = Math.round(column.getActualWidth() * scale); + if (newWidth < minWidth) { + newWidth = minWidth; + moveToNotSpread(column); + finishedResizing = false; + } else if (newWidth > maxWidth) { + newWidth = maxWidth; + moveToNotSpread(column); + finishedResizing = false; + } else if (i === 0) { + newWidth = pixelsForLastCol; + } + column.setActualWidth(newWidth, source, true); + pixelsForLastCol -= newWidth; + } + } + } + for (const col of colsToDispatchEventFor) { + col.fireColumnWidthChangedEvent(source); + } + const visibleCols = beans.visibleCols; + visibleCols.setLeftValues(source); + visibleCols.updateBodyWidths(); + if (silent) { + return; + } + dispatchColumnResizedEvent(this.eventSvc, colsToDispatchEventFor, true, source); + if (animate) { + setWidthAnimation(beans, false); + } + } + applyAutosizeStrategy() { + const { gos, colDelayRenderSvc } = this.beans; + const autoSizeStrategy = gos.get("autoSizeStrategy"); + if (autoSizeStrategy?.type !== "fitGridWidth" && autoSizeStrategy?.type !== "fitProvidedWidth") { + return; + } + setTimeout(() => { + if (!this.isAlive()) { + return; + } + const type = autoSizeStrategy.type; + if (type === "fitGridWidth") { + const { columnLimits: propColumnLimits, defaultMinWidth, defaultMaxWidth } = autoSizeStrategy; + const columnLimits = propColumnLimits?.map(({ colId: key, minWidth, maxWidth }) => ({ + key, + minWidth, + maxWidth + })); + this.sizeColumnsToFitGridBody({ + defaultMinWidth, + defaultMaxWidth, + columnLimits + }); + } else if (type === "fitProvidedWidth") { + this.sizeColumnsToFit(autoSizeStrategy.width, "sizeColumnsToFit"); + } + colDelayRenderSvc?.revealColumns(type); + }); + } + onFirstDataRendered({ colIds: colKeys, ...params }) { + setTimeout(() => { + if (!this.isAlive()) { + return; + } + const source = "autosizeColumns"; + if (colKeys) { + this.autoSizeCols({ ...params, source, colKeys }); + } else { + this.autoSizeAllColumns({ ...params, source }); + } + this.beans.colDelayRenderSvc?.revealColumns(params.type); + }); + } + processResizeOperations() { + this.shouldQueueResizeOperations = false; + for (const resizeOperation of this.resizeOperationQueue) { + resizeOperation(); + } + this.resizeOperationQueue = []; + } + pushResizeOperation(func) { + this.resizeOperationQueue.push(func); + } + destroy() { + this.resizeOperationQueue.length = 0; + super.destroy(); + } +}; +function normaliseColumnWidth(column, newWidth, limits = {}) { + const minWidth = limits.minWidth ?? column.getMinWidth(); + if (newWidth < minWidth) { + newWidth = minWidth; + } + const maxWidth = limits.maxWidth ?? column.getMaxWidth(); + if (newWidth > maxWidth) { + newWidth = maxWidth; + } + return newWidth; +} +function getAvailableWidth({ ctrlsSvc, scrollVisibleSvc }) { + const gridBodyCtrl = ctrlsSvc.getGridBodyCtrl(); + const removeScrollWidth = gridBodyCtrl.isVerticalScrollShowing(); + const scrollWidthToRemove = removeScrollWidth ? scrollVisibleSvc.getScrollbarWidth() : 0; + const bodyViewportWidth = _getInnerWidth(gridBodyCtrl.eGridBody); + return bodyViewportWidth - scrollWidthToRemove; +} +var WIDTH_ANIMATION_CLASS = "ag-animate-autosize"; +function setWidthAnimation({ ctrlsSvc, gos }, enable) { + if (!gos.get("animateColumnResizing") || gos.get("enableRtl") || !ctrlsSvc.isAlive()) { + return; + } + const classList = ctrlsSvc.getGridBodyCtrl().eGridBody.classList; + if (enable) { + classList.add(WIDTH_ANIMATION_CLASS); + } else { + classList.remove(WIDTH_ANIMATION_CLASS); + } +} +var ColumnAutoSizeModule = { + moduleName: "ColumnAutoSize", + version: VERSION, + beans: [ColumnAutosizeService], + apiFunctions: { + sizeColumnsToFit, + autoSizeColumns, + autoSizeAllColumns + }, + dependsOn: [AutoWidthModule], + css: [columnAutoSize_default] +}; +var GridSerializer = class extends BeanStub { + constructor() { + super(...arguments); + this.beanName = "gridSerializer"; + } + wireBeans(beans) { + this.visibleCols = beans.visibleCols; + this.colModel = beans.colModel; + this.rowModel = beans.rowModel; + this.pinnedRowModel = beans.pinnedRowModel; + } + serialize(gridSerializingSession, params = {}) { + const { allColumns, columnKeys, skipRowGroups, exportRowNumbers } = params; + const columnsToExport = this.getColumnsToExport({ + allColumns, + skipRowGroups, + columnKeys, + exportRowNumbers + }); + return [ + this.prepareSession(columnsToExport), + this.prependContent(params), + this.exportColumnGroups(params, columnsToExport), + this.exportHeaders(params, columnsToExport), + this.processPinnedTopRows(params, columnsToExport), + this.processRows(params, columnsToExport), + this.processPinnedBottomRows(params, columnsToExport), + this.appendContent(params) + ].reduce((composed, f) => f(composed), gridSerializingSession).parse(); + } + processRow(gridSerializingSession, params, columnsToExport, node) { + const rowSkipper = params.shouldRowBeSkipped || (() => false); + const isClipboardExport = params.rowPositions != null; + const isExplicitExportSelection = isClipboardExport || !!params.onlySelected; + const hideOpenParents = this.gos.get("groupHideOpenParents") && !isExplicitExportSelection; + const isLeafNode = this.colModel.isPivotMode() ? node.leafGroup : !node.group; + const isFooter = !!node.footer; + const shouldSkipCurrentGroup = node.allChildrenCount === 1 && node.childrenAfterGroup?.length === 1 && _canSkipShowingRowGroup(this.gos, node); + if (!isLeafNode && !isFooter && (params.skipRowGroups || shouldSkipCurrentGroup || hideOpenParents) || params.onlySelected && !node.isSelected() || params.skipPinnedTop && node.rowPinned === "top" || params.skipPinnedBottom && node.rowPinned === "bottom" || node.stub) { + return; + } + const nodeIsRootNode = node.level === -1; + if (nodeIsRootNode && !isLeafNode && !isFooter) { + return; + } + const shouldRowBeSkipped = rowSkipper(_addGridCommonParams(this.gos, { node })); + if (shouldRowBeSkipped) { + return; + } + const rowAccumulator = gridSerializingSession.onNewBodyRow(node); + columnsToExport.forEach((column, index) => { + rowAccumulator.onColumn(column, index, node); + }); + if (params.getCustomContentBelowRow) { + const content = params.getCustomContentBelowRow(_addGridCommonParams(this.gos, { node })); + if (content) { + gridSerializingSession.addCustomContent(content); + } + } + } + appendContent(params) { + return (gridSerializingSession) => { + const appendContent = params.appendContent; + if (appendContent) { + gridSerializingSession.addCustomContent(appendContent); + } + return gridSerializingSession; + }; + } + prependContent(params) { + return (gridSerializingSession) => { + const prependContent = params.prependContent; + if (prependContent) { + gridSerializingSession.addCustomContent(prependContent); + } + return gridSerializingSession; + }; + } + prepareSession(columnsToExport) { + return (gridSerializingSession) => { + gridSerializingSession.prepare(columnsToExport); + return gridSerializingSession; + }; + } + exportColumnGroups(params, columnsToExport) { + return (gridSerializingSession) => { + if (!params.skipColumnGroupHeaders) { + const idCreator = new GroupInstanceIdCreator; + const { colGroupSvc } = this.beans; + const displayedGroups = colGroupSvc ? colGroupSvc.createColumnGroups({ + columns: columnsToExport, + idCreator, + pinned: null, + isStandaloneStructure: true + }) : columnsToExport; + this.recursivelyAddHeaderGroups(displayedGroups, gridSerializingSession, params.processGroupHeaderCallback); + } + return gridSerializingSession; + }; + } + exportHeaders(params, columnsToExport) { + return (gridSerializingSession) => { + if (!params.skipColumnHeaders) { + const gridRowIterator = gridSerializingSession.onNewHeaderRow(); + columnsToExport.forEach((column, index) => { + gridRowIterator.onColumn(column, index, undefined); + }); + } + return gridSerializingSession; + }; + } + processPinnedTopRows(params, columnsToExport) { + return (gridSerializingSession) => { + const processRow = this.processRow.bind(this, gridSerializingSession, params, columnsToExport); + if (params.rowPositions) { + params.rowPositions.filter((position) => position.rowPinned === "top").sort((a, b) => a.rowIndex - b.rowIndex).map((position) => this.pinnedRowModel?.getPinnedTopRow(position.rowIndex)).forEach(processRow); + } else if (!this.pinnedRowModel?.isManual()) { + this.pinnedRowModel?.forEachPinnedRow("top", processRow); + } + return gridSerializingSession; + }; + } + processRows(params, columnsToExport) { + return (gridSerializingSession) => { + const rowModel = this.rowModel; + const usingCsrm = _isClientSideRowModel(this.gos, rowModel); + const usingSsrm = _isServerSideRowModel(this.gos, rowModel); + const onlySelectedNonStandardModel = !usingCsrm && params.onlySelected; + const processRow = this.processRow.bind(this, gridSerializingSession, params, columnsToExport); + const { exportedRows = "filteredAndSorted" } = params; + if (params.rowPositions) { + params.rowPositions.filter((position) => position.rowPinned == null).sort((a, b) => a.rowIndex - b.rowIndex).map((position) => rowModel.getRow(position.rowIndex)).forEach(processRow); + } else if (this.colModel.isPivotMode()) { + if (usingCsrm) { + rowModel.forEachPivotNode(processRow, true, exportedRows === "filteredAndSorted"); + } else if (usingSsrm) { + rowModel.forEachNodeAfterFilterAndSort(processRow, true); + } else { + rowModel.forEachNode(processRow); + } + } else if (params.onlySelectedAllPages || onlySelectedNonStandardModel) { + const selectedNodes = this.beans.selectionSvc?.getSelectedNodes() ?? []; + this.replicateSortedOrder(selectedNodes); + selectedNodes.forEach(processRow); + } else if (exportedRows === "all") { + rowModel.forEachNode(processRow); + } else if (usingCsrm || usingSsrm) { + rowModel.forEachNodeAfterFilterAndSort(processRow, true); + } else { + rowModel.forEachNode(processRow); + } + return gridSerializingSession; + }; + } + replicateSortedOrder(rows) { + const { sortSvc, rowNodeSorter } = this.beans; + if (!sortSvc || !rowNodeSorter) { + return; + } + const sortOptions = sortSvc.getSortOptions(); + const compareNodes = (rowA, rowB) => { + if (rowA.rowIndex != null && rowB.rowIndex != null) { + return rowA.rowIndex - rowB.rowIndex; + } + if (rowA.level === rowB.level) { + if (rowA.parent?.id === rowB.parent?.id) { + return rowNodeSorter.compareRowNodes(sortOptions, rowA, rowB) || (rowA.rowIndex ?? -1) - (rowB.rowIndex ?? -1); + } + return compareNodes(rowA.parent, rowB.parent); + } + if (rowA.level > rowB.level) { + return compareNodes(rowA.parent, rowB); + } + return compareNodes(rowA, rowB.parent); + }; + rows.sort(compareNodes); + } + processPinnedBottomRows(params, columnsToExport) { + return (gridSerializingSession) => { + const processRow = this.processRow.bind(this, gridSerializingSession, params, columnsToExport); + if (params.rowPositions) { + params.rowPositions.filter((position) => position.rowPinned === "bottom").sort((a, b) => a.rowIndex - b.rowIndex).map((position) => this.pinnedRowModel?.getPinnedBottomRow(position.rowIndex)).forEach(processRow); + } else if (!this.pinnedRowModel?.isManual()) { + this.pinnedRowModel?.forEachPinnedRow("bottom", processRow); + } + return gridSerializingSession; + }; + } + getColumnsToExport(params) { + const { allColumns = false, skipRowGroups = false, exportRowNumbers = false, columnKeys } = params; + const { colModel, gos, visibleCols } = this; + const isPivotMode = colModel.isPivotMode(); + const filterSpecialColumns = (col) => { + if (isColumnSelectionCol(col)) { + return false; + } + return !isRowNumberCol(col) || exportRowNumbers; + }; + if (columnKeys?.length) { + return colModel.getColsForKeys(columnKeys).filter(filterSpecialColumns); + } + const isTreeData = gos.get("treeData"); + let columnsToExport = []; + if (allColumns && !isPivotMode) { + columnsToExport = colModel.getCols(); + } else { + columnsToExport = visibleCols.allCols; + } + columnsToExport = columnsToExport.filter((column) => filterSpecialColumns(column) && (skipRowGroups && !isTreeData ? !isColumnGroupAutoCol(column) : true)); + return columnsToExport; + } + recursivelyAddHeaderGroups(displayedGroups, gridSerializingSession, processGroupHeaderCallback) { + const directChildrenHeaderGroups = []; + for (const columnGroupChild of displayedGroups) { + const columnGroup = columnGroupChild; + if (!columnGroup.getChildren) { + continue; + } + for (const it of columnGroup.getChildren() ?? []) { + directChildrenHeaderGroups.push(it); + } + } + if (displayedGroups.length > 0 && isColumnGroup(displayedGroups[0])) { + this.doAddHeaderHeader(gridSerializingSession, displayedGroups, processGroupHeaderCallback); + } + if (directChildrenHeaderGroups && directChildrenHeaderGroups.length > 0) { + this.recursivelyAddHeaderGroups(directChildrenHeaderGroups, gridSerializingSession, processGroupHeaderCallback); + } + } + doAddHeaderHeader(gridSerializingSession, displayedGroups, processGroupHeaderCallback) { + const gridRowIterator = gridSerializingSession.onNewHeaderGroupingRow(); + let columnIndex = 0; + for (const columnGroupChild of displayedGroups) { + const columnGroup = columnGroupChild; + let name; + if (processGroupHeaderCallback) { + name = processGroupHeaderCallback(_addGridCommonParams(this.gos, { + columnGroup + })); + } else { + name = this.beans.colNames.getDisplayNameForColumnGroup(columnGroup, "header"); + } + const columnsToCalculateRange = columnGroup.isExpandable() ? columnGroup.getLeafColumns() : []; + const collapsibleGroupRanges = columnsToCalculateRange.reduce((collapsibleGroups, currentColumn, currentIdx, arr) => { + let lastGroup = _last(collapsibleGroups); + const groupShow = currentColumn.getColumnGroupShow() === "open"; + if (!groupShow) { + if (lastGroup && lastGroup[1] == null) { + lastGroup[1] = currentIdx - 1; + } + } else if (!lastGroup || lastGroup[1] != null) { + lastGroup = [currentIdx]; + collapsibleGroups.push(lastGroup); + } + if (currentIdx === arr.length - 1 && lastGroup && lastGroup[1] == null) { + lastGroup[1] = currentIdx; + } + return collapsibleGroups; + }, []); + gridRowIterator.onColumn(columnGroup, name || "", columnIndex++, columnGroup.getLeafColumns().length - 1, collapsibleGroupRanges); + } + } +}; +var SharedExportModule = { + moduleName: "SharedExport", + version: VERSION, + beans: [GridSerializer] +}; +var BaseCreator = class extends BeanStub { + getFileName(fileName) { + const extension = this.getDefaultFileExtension(); + if (!fileName?.length) { + fileName = this.getDefaultFileName(); + } + return fileName.includes(".") ? fileName : `${fileName}.${extension}`; + } + getData(params) { + return this.beans.gridSerializer.serialize(this.createSerializingSession(params), params); + } + getDefaultFileName() { + return `export.${this.getDefaultFileExtension()}`; + } +}; +function _downloadFile(fileName, content) { + const win = document.defaultView || window; + if (!win) { + _warn(52); + return; + } + const element = document.createElement("a"); + const url = win.URL.createObjectURL(content); + element.setAttribute("href", url); + element.setAttribute("download", fileName); + element.style.display = "none"; + document.body.appendChild(element); + element.dispatchEvent(new MouseEvent("click", { + bubbles: false, + cancelable: true, + view: win + })); + element.remove(); + win.setTimeout(() => { + win.URL.revokeObjectURL(url); + }, 0); +} +var BaseGridSerializingSession = class { + constructor(config) { + this.valueFrom = "data"; + const { + colModel, + rowGroupColsSvc, + colNames, + valueSvc, + gos, + processCellCallback, + processHeaderCallback, + processGroupHeaderCallback, + processRowGroupCallback, + valueFrom + } = config; + this.colModel = colModel; + this.rowGroupColsSvc = rowGroupColsSvc; + this.colNames = colNames; + this.valueSvc = valueSvc; + this.gos = gos; + this.processCellCallback = processCellCallback; + this.processHeaderCallback = processHeaderCallback; + this.processGroupHeaderCallback = processGroupHeaderCallback; + this.processRowGroupCallback = processRowGroupCallback; + if (valueFrom) { + this.valueFrom = valueFrom; + } + } + prepare(_columnsToExport) {} + extractHeaderValue(column) { + const value = this.getHeaderName(this.processHeaderCallback, column); + return value ?? ""; + } + extractRowCellValue(params) { + const { column, node, currentColumnIndex, accumulatedRowIndex, type, useRawFormula } = params; + const isFullWidthGroup = currentColumnIndex === 0 && _isFullWidthGroupRow(this.gos, node, this.colModel.isPivotMode()); + if (this.processRowGroupCallback && (this.gos.get("treeData") || node.group) && (column.isRowGroupDisplayed(node.rowGroupColumn?.getColId() ?? "") || isFullWidthGroup)) { + return { value: this.processRowGroupCallback(_addGridCommonParams(this.gos, { column, node })) ?? "" }; + } + if (this.processCellCallback) { + return { + value: this.processCellCallback(_addGridCommonParams(this.gos, { + accumulatedRowIndex, + column, + node, + value: this.valueSvc.getValueForDisplay({ column, node, from: this.valueFrom }).value, + type, + parseValue: (valueToParse) => this.valueSvc.parseValue(column, node, valueToParse, this.valueSvc.getValue(column, node, this.valueFrom)), + formatValue: (valueToFormat) => this.valueSvc.formatValue(column, node, valueToFormat) ?? valueToFormat + })) ?? "" + }; + } + const isTreeData = this.gos.get("treeData"); + const valueService = this.valueSvc; + const isGrandTotalRow = node.level === -1 && node.footer; + const isMultiAutoCol = column.colDef.showRowGroup === true && (node.group || isTreeData); + if (!isGrandTotalRow && (isFullWidthGroup || isMultiAutoCol)) { + let concatenatedGroupValue = ""; + let pointer = node; + while (pointer && pointer.level !== -1) { + const { value: value2, valueFormatted: valueFormatted2 } = valueService.getValueForDisplay({ + column: isFullWidthGroup ? undefined : column, + node: pointer, + includeValueFormatted: true, + exporting: true, + from: this.valueFrom + }); + concatenatedGroupValue = ` -> ${valueFormatted2 ?? value2 ?? ""}${concatenatedGroupValue}`; + pointer = pointer.parent; + } + return { + value: concatenatedGroupValue, + valueFormatted: concatenatedGroupValue + }; + } + const { value, valueFormatted } = valueService.getValueForDisplay({ + column, + node, + includeValueFormatted: true, + exporting: true, + useRawFormula, + from: this.valueFrom + }); + return { + value: value ?? "", + valueFormatted + }; + } + getHeaderName(callback, column) { + if (callback) { + return callback(_addGridCommonParams(this.gos, { column })); + } + return this.colNames.getDisplayNameForColumn(column, "csv", true); + } +}; +var LINE_SEPARATOR = `\r +`; +var CsvSerializingSession = class extends BaseGridSerializingSession { + constructor(config) { + super(config); + this.config = config; + this.isFirstLine = true; + this.result = ""; + const { suppressQuotes, columnSeparator } = config; + this.suppressQuotes = suppressQuotes; + this.columnSeparator = columnSeparator; + } + addCustomContent(content) { + if (!content) { + return; + } + if (typeof content === "string") { + if (!/^\s*\n/.test(content)) { + this.beginNewLine(); + } + content = content.replace(/\r?\n/g, LINE_SEPARATOR); + this.result += content; + } else { + content.forEach((row) => { + this.beginNewLine(); + row.forEach((cell, index) => { + if (index !== 0) { + this.result += this.columnSeparator; + } + this.result += this.putInQuotes(cell.data.value || ""); + if (cell.mergeAcross) { + this.appendEmptyCells(cell.mergeAcross); + } + }); + }); + } + } + onNewHeaderGroupingRow() { + this.beginNewLine(); + return { + onColumn: this.onNewHeaderGroupingRowColumn.bind(this) + }; + } + onNewHeaderGroupingRowColumn(columnGroup, header, index, span) { + if (index != 0) { + this.result += this.columnSeparator; + } + this.result += this.putInQuotes(header); + this.appendEmptyCells(span); + } + appendEmptyCells(count) { + for (let i = 1;i <= count; i++) { + this.result += this.columnSeparator + this.putInQuotes(""); + } + } + onNewHeaderRow() { + this.beginNewLine(); + return { + onColumn: this.onNewHeaderRowColumn.bind(this) + }; + } + onNewHeaderRowColumn(column, index) { + if (index != 0) { + this.result += this.columnSeparator; + } + this.result += this.putInQuotes(this.extractHeaderValue(column)); + } + onNewBodyRow() { + this.beginNewLine(); + return { + onColumn: this.onNewBodyRowColumn.bind(this) + }; + } + onNewBodyRowColumn(column, index, node) { + if (index != 0) { + this.result += this.columnSeparator; + } + const rowCellValue = this.extractRowCellValue({ + column, + node, + currentColumnIndex: index, + accumulatedRowIndex: index, + type: "csv", + useRawFormula: false + }); + this.result += this.putInQuotes(rowCellValue.valueFormatted ?? rowCellValue.value); + } + putInQuotes(value) { + if (this.suppressQuotes) { + return value; + } + if (value === null || value === undefined) { + return '""'; + } + let stringValue; + if (typeof value === "string") { + stringValue = value; + } else if (typeof value.toString === "function") { + stringValue = value.toString(); + } else { + _warn(53); + stringValue = ""; + } + const valueEscaped = stringValue.replace(/"/g, '""'); + return '"' + valueEscaped + '"'; + } + parse() { + return this.result; + } + beginNewLine() { + if (!this.isFirstLine) { + this.result += LINE_SEPARATOR; + } + this.isFirstLine = false; + } +}; +var CsvCreator = class extends BaseCreator { + constructor() { + super(...arguments); + this.beanName = "csvCreator"; + } + getMergedParams(params) { + const baseParams6 = this.gos.get("defaultCsvExportParams"); + return Object.assign({}, baseParams6, params); + } + export(userParams) { + if (this.isExportSuppressed()) { + _warn(51); + return; + } + const exportFunc = () => { + const mergedParams = this.getMergedParams(userParams); + const data = this.getData(mergedParams); + const packagedFile = new Blob(["\uFEFF", data], { type: "text/plain" }); + const fileNameParams = mergedParams.fileName; + const fileName = typeof fileNameParams === "function" ? fileNameParams(_addGridCommonParams(this.gos, {})) : fileNameParams; + _downloadFile(this.getFileName(fileName), packagedFile); + }; + const { overlays } = this.beans; + if (overlays) { + overlays.showExportOverlay(exportFunc); + } else { + exportFunc(); + } + } + exportDataAsCsv(params) { + this.export(params); + } + getDataAsCsv(params, skipDefaultParams = false) { + const mergedParams = skipDefaultParams ? Object.assign({}, params) : this.getMergedParams(params); + return this.getData(mergedParams); + } + getDefaultFileExtension() { + return "csv"; + } + createSerializingSession(params) { + const { colModel, colNames, rowGroupColsSvc, valueSvc, gos } = this.beans; + const { + processCellCallback, + processHeaderCallback, + processGroupHeaderCallback, + processRowGroupCallback, + suppressQuotes, + columnSeparator, + valueFrom + } = params; + return new CsvSerializingSession({ + colModel, + colNames, + valueSvc, + gos, + processCellCallback: processCellCallback || undefined, + processHeaderCallback: processHeaderCallback || undefined, + processGroupHeaderCallback: processGroupHeaderCallback || undefined, + processRowGroupCallback: processRowGroupCallback || undefined, + suppressQuotes: suppressQuotes || false, + columnSeparator: columnSeparator || ",", + rowGroupColsSvc, + valueFrom + }); + } + isExportSuppressed() { + return this.gos.get("suppressCsvExport"); + } +}; +function getDataAsCsv(beans, params) { + return beans.csvCreator?.getDataAsCsv(params); +} +function exportDataAsCsv(beans, params) { + beans.csvCreator?.exportDataAsCsv(params); +} +var CsvExportModule = { + moduleName: "CsvExport", + version: VERSION, + beans: [CsvCreator], + apiFunctions: { + getDataAsCsv, + exportDataAsCsv + }, + dependsOn: [SharedExportModule] +}; +var AgTooltipFeature = class extends AgBeanStub { + constructor(ctrl, beans) { + super(); + this.ctrl = ctrl; + if (beans) { + this.beans = beans; + } + } + postConstruct() { + this.refreshTooltip(); + } + setBrowserTooltip(tooltip, allowEmptyString) { + const name = "title"; + const eGui = this.ctrl.getGui(); + if (!eGui) { + return; + } + if (tooltip != null && (tooltip != "" || allowEmptyString)) { + eGui.setAttribute(name, tooltip); + } else { + eGui.removeAttribute(name); + } + } + updateTooltipText() { + const { getTooltipValue } = this.ctrl; + if (getTooltipValue) { + this.tooltip = getTooltipValue(); + } + } + createTooltipFeatureIfNeeded() { + if (this.tooltipManager == null) { + const tooltipManager = this.beans.registry.createDynamicBean("tooltipStateManager", true, this.ctrl, () => this.tooltip); + if (tooltipManager) { + this.tooltipManager = this.createBean(tooltipManager, this.beans.context); + } + } + } + attemptToShowTooltip() { + this.tooltipManager?.prepareToShowTooltip(); + } + attemptToHideTooltip() { + this.tooltipManager?.hideTooltip(); + } + setTooltipAndRefresh(tooltip) { + this.tooltip = tooltip; + this.refreshTooltip(); + } + refreshTooltip(clearWithEmptyString) { + this.browserTooltips = this.beans.gos.get("enableBrowserTooltips"); + this.updateTooltipText(); + if (this.browserTooltips) { + this.setBrowserTooltip(this.tooltip); + this.tooltipManager = this.destroyBean(this.tooltipManager, this.beans.context); + } else { + this.setBrowserTooltip(clearWithEmptyString ? "" : null, clearWithEmptyString); + this.createTooltipFeatureIfNeeded(); + } + } + destroy() { + this.tooltipManager = this.destroyBean(this.tooltipManager, this.beans.context); + super.destroy(); + } +}; +var SHOW_SWITCH_TOOLTIP_DIFF = 1000; +var FADE_OUT_TOOLTIP_TIMEOUT = 1000; +var INTERACTIVE_HIDE_DELAY = 100; +var lastTooltipHideTime; +var isLocked = false; +var BaseTooltipStateManager = class extends AgBeanStub { + constructor(tooltipCtrl, getTooltipValue) { + super(); + this.tooltipCtrl = tooltipCtrl; + this.getTooltipValue = getTooltipValue; + this.interactionEnabled = false; + this.isInteractingWithTooltip = false; + this.state = 0; + this.tooltipInstanceCount = 0; + this.tooltipMouseTrack = false; + } + wireBeans(beans) { + this.popupSvc = beans.popupSvc; + } + postConstruct() { + if (this.gos.get("tooltipInteraction")) { + this.interactionEnabled = true; + } + this.tooltipTrigger = this.getTooltipTrigger(); + this.tooltipMouseTrack = this.gos.get("tooltipMouseTrack"); + const el = this.tooltipCtrl.getGui(); + if (this.tooltipTrigger === 0) { + this.addManagedListeners(el, { + mouseenter: this.onMouseEnter.bind(this), + mouseleave: this.onMouseLeave.bind(this) + }); + } + if (this.tooltipTrigger === 1) { + this.addManagedListeners(el, { + focusin: this.onFocusIn.bind(this), + focusout: this.onFocusOut.bind(this) + }); + } + this.addManagedListeners(el, { mousemove: this.onMouseMove.bind(this) }); + if (!this.interactionEnabled) { + this.addManagedListeners(el, { + mousedown: this.onMouseDown.bind(this), + keydown: this.onKeyDown.bind(this) + }); + } + } + getGridOptionsTooltipDelay(delayOption) { + const delay = this.gos.get(delayOption); + return Math.max(200, delay); + } + getTooltipDelay(type) { + return this.tooltipCtrl[`getTooltip${type}DelayOverride`]?.() ?? this.getGridOptionsTooltipDelay(`tooltip${type}Delay`); + } + destroy() { + this.setToDoNothing(); + super.destroy(); + } + getTooltipTrigger() { + const trigger = this.gos.get("tooltipTrigger"); + if (!trigger || trigger === "hover") { + return 0; + } + return 1; + } + onMouseEnter(e) { + if (this.interactionEnabled && this.interactiveTooltipTimeoutId) { + this.unlockService(); + this.startHideTimeout(); + } + if (_isIOSUserAgent()) { + return; + } + if (isLocked) { + this.showTooltipTimeoutId = window.setTimeout(() => { + this.prepareToShowTooltip(e); + }, INTERACTIVE_HIDE_DELAY); + } else { + this.prepareToShowTooltip(e); + } + } + onMouseMove(e) { + if (this.lastMouseEvent) { + this.lastMouseEvent = e; + } + 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(e) { + const relatedTarget = e.relatedTarget; + const parentCompGui = this.tooltipCtrl.getGui(); + const tooltipGui = this.tooltipComp?.getGui(); + if (this.isInteractingWithTooltip || parentCompGui.contains(relatedTarget) || this.interactionEnabled && tooltipGui?.contains(relatedTarget)) { + return; + } + this.setToDoNothing(); + } + onKeyDown() { + if (this.isInteractingWithTooltip) { + this.isInteractingWithTooltip = false; + } + this.setToDoNothing(); + } + prepareToShowTooltip(mouseEvent) { + if (this.state != 0 || isLocked) { + return; + } + let delay = 0; + if (mouseEvent) { + delay = this.isLastTooltipHiddenRecently() ? this.getTooltipDelay("SwitchShow") : this.getTooltipDelay("Show"); + } + this.lastMouseEvent = mouseEvent || null; + this.showTooltipTimeoutId = window.setTimeout(this.showTooltip.bind(this), delay); + this.state = 1; + } + isLastTooltipHiddenRecently() { + const now = Date.now(); + const then = lastTooltipHideTime; + return now - then < SHOW_SWITCH_TOOLTIP_DIFF; + } + setToDoNothing(fromHideTooltip) { + if (!fromHideTooltip && this.state === 2) { + this.hideTooltip(); + } + if (this.onBodyScrollEventCallback) { + this.onBodyScrollEventCallback(); + this.onBodyScrollEventCallback = undefined; + } + this.clearEventHandlers(); + if (this.onDocumentKeyDownCallback) { + this.onDocumentKeyDownCallback(); + this.onDocumentKeyDownCallback = undefined; + } + this.clearTimeouts(); + this.state = 0; + this.lastMouseEvent = null; + } + showTooltip() { + const value = this.getTooltipValue(); + const ctrl = this.tooltipCtrl; + if (!_exists(value) || ctrl.shouldDisplayTooltip && !ctrl.shouldDisplayTooltip()) { + this.setToDoNothing(); + return; + } + const params = this.gos.addCommon({ + location: ctrl.getLocation?.() ?? "UNKNOWN", + value, + hideTooltipCallback: () => this.hideTooltip(true), + ...ctrl.getAdditionalParams?.() + }); + this.state = 2; + this.tooltipInstanceCount++; + const callback = this.newTooltipComponentCallback.bind(this, this.tooltipInstanceCount); + this.createTooltipComp(params, callback); + } + hideTooltip(forceHide) { + if (!forceHide && this.isInteractingWithTooltip) { + return; + } + if (this.tooltipComp) { + this.destroyTooltipComp(); + lastTooltipHideTime = Date.now(); + } + this.eventSvc.dispatchEvent({ + type: "tooltipHide", + parentGui: this.tooltipCtrl.getGui() + }); + if (forceHide) { + this.isInteractingWithTooltip = false; + } + this.setToDoNothing(true); + } + newTooltipComponentCallback(tooltipInstanceCopy, tooltipComp) { + const compNoLongerNeeded = this.state !== 2 || this.tooltipInstanceCount !== tooltipInstanceCopy; + if (compNoLongerNeeded) { + this.destroyBean(tooltipComp); + return; + } + const eGui = tooltipComp.getGui(); + this.tooltipComp = tooltipComp; + if (!eGui.classList.contains("ag-tooltip")) { + eGui.classList.add("ag-tooltip-custom"); + } + if (this.tooltipTrigger === 0) { + eGui.classList.add("ag-tooltip-animate"); + } + if (this.interactionEnabled) { + eGui.classList.add("ag-tooltip-interactive"); + } + const translate = this.getLocaleTextFunc(); + const addPopupRes = this.popupSvc?.addPopup({ + eChild: eGui, + ariaLabel: translate("ariaLabelTooltip", "Tooltip") + }); + if (addPopupRes) { + this.tooltipPopupDestroyFunc = addPopupRes.hideFunc; + } + this.positionTooltip(); + if (this.tooltipTrigger === 1) { + const listener = () => this.setToDoNothing(); + [this.onBodyScrollEventCallback] = this.addManagedEventListeners({ + bodyScroll: listener + }); + this.setEventHandlers(listener); + } + if (this.interactionEnabled) { + [this.tooltipMouseEnterListener, this.tooltipMouseLeaveListener] = this.addManagedElementListeners(eGui, { + mouseenter: this.onTooltipMouseEnter.bind(this), + mouseleave: this.onTooltipMouseLeave.bind(this) + }); + [this.onDocumentKeyDownCallback] = this.addManagedElementListeners(_getDocument(this.beans), { + keydown: (e) => { + if (!eGui.contains(e?.target)) { + this.onKeyDown(); + } + } + }); + if (this.tooltipTrigger === 1) { + [this.tooltipFocusInListener, this.tooltipFocusOutListener] = this.addManagedElementListeners(eGui, { + focusin: this.onTooltipFocusIn.bind(this), + focusout: this.onTooltipFocusOut.bind(this) + }); + } + } + this.eventSvc.dispatchEvent({ + type: "tooltipShow", + tooltipGui: eGui, + parentGui: this.tooltipCtrl.getGui() + }); + this.startHideTimeout(); + } + onTooltipMouseEnter() { + this.isInteractingWithTooltip = true; + this.unlockService(); + } + onTooltipMouseLeave() { + if (this.isTooltipFocused()) { + return; + } + this.isInteractingWithTooltip = false; + this.lockService(); + } + onTooltipFocusIn() { + this.isInteractingWithTooltip = true; + } + isTooltipFocused() { + const tooltipGui = this.tooltipComp?.getGui(); + const activeEl = _getActiveDomElement(this.beans); + return !!tooltipGui && tooltipGui.contains(activeEl); + } + onTooltipFocusOut(e) { + const parentGui = this.tooltipCtrl.getGui(); + if (this.isTooltipFocused()) { + return; + } + this.isInteractingWithTooltip = false; + if (parentGui.contains(e.relatedTarget)) { + this.startHideTimeout(); + } else { + this.hideTooltip(); + } + } + positionTooltip() { + const params = { + type: "tooltip", + ePopup: this.tooltipComp.getGui(), + nudgeY: 18, + skipObserver: this.tooltipMouseTrack + }; + if (this.lastMouseEvent) { + this.popupSvc?.positionPopupUnderMouseEvent({ + ...params, + mouseEvent: this.lastMouseEvent + }); + } else { + this.popupSvc?.positionPopupByComponent({ + ...params, + eventSource: this.tooltipCtrl.getGui(), + position: "under", + keepWithinBounds: true, + nudgeY: 5 + }); + } + } + destroyTooltipComp() { + this.tooltipComp.getGui().classList.add("ag-tooltip-hiding"); + const tooltipPopupDestroyFunc = this.tooltipPopupDestroyFunc; + const tooltipComp = this.tooltipComp; + const delay = this.tooltipTrigger === 0 ? FADE_OUT_TOOLTIP_TIMEOUT : 0; + window.setTimeout(() => { + tooltipPopupDestroyFunc(); + this.destroyBean(tooltipComp); + }, delay); + this.clearTooltipListeners(); + this.tooltipPopupDestroyFunc = undefined; + this.tooltipComp = undefined; + } + clearTooltipListeners() { + for (const listener of [ + this.tooltipMouseEnterListener, + this.tooltipMouseLeaveListener, + this.tooltipFocusInListener, + this.tooltipFocusOutListener + ]) { + if (listener) { + listener(); + } + } + this.tooltipMouseEnterListener = this.tooltipMouseLeaveListener = this.tooltipFocusInListener = this.tooltipFocusOutListener = null; + } + lockService() { + isLocked = true; + this.interactiveTooltipTimeoutId = window.setTimeout(() => { + this.unlockService(); + this.setToDoNothing(); + }, INTERACTIVE_HIDE_DELAY); + } + unlockService() { + isLocked = false; + 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 = undefined; + } + clearHideTimeout() { + if (!this.hideTooltipTimeoutId) { + return; + } + window.clearTimeout(this.hideTooltipTimeoutId); + this.hideTooltipTimeoutId = undefined; + } + clearInteractiveTimeout() { + if (!this.interactiveTooltipTimeoutId) { + return; + } + window.clearTimeout(this.interactiveTooltipTimeoutId); + this.interactiveTooltipTimeoutId = undefined; + } + clearTimeouts() { + this.clearShowTimeout(); + this.clearHideTimeout(); + this.clearInteractiveTimeout(); + } +}; +var AgHighlightTooltipFeature = class extends AgTooltipFeature { + constructor(ctrl, highlightTracker, beans) { + super(ctrl, beans); + this.highlightTracker = highlightTracker; + this.onHighlight = this.onHighlight.bind(this); + } + postConstruct() { + super.postConstruct(); + this.wireHighlightListeners(); + } + wireHighlightListeners() { + this.addManagedPropertyListener("tooltipTrigger", ({ currentValue }) => { + this.setTooltipMode(currentValue); + }); + this.setTooltipMode(this.gos.get("tooltipTrigger")); + this.highlightTracker.addEventListener("itemHighlighted", this.onHighlight); + } + onHighlight(event) { + if (this.tooltipMode !== 1) { + return; + } + if (event.highlighted) { + this.attemptToShowTooltip(); + } else { + this.attemptToHideTooltip(); + } + } + setTooltipMode(tooltipTriggerMode = "focus") { + this.tooltipMode = tooltipTriggerMode === "focus" ? 1 : 0; + } + destroy() { + this.highlightTracker.removeEventListener("itemHighlighted", this.onHighlight); + super.destroy(); + } +}; +var AgTooltipComponent = class extends AgPopupComponent { + constructor() { + super({ tag: "div", cls: "ag-tooltip" }); + } + init(params) { + const { value } = params; + const eGui = this.getGui(); + eGui.textContent = _toString(value); + const locationKebabCase = params.location.replace(/([a-z])([A-Z0-9])/g, "$1-$2").toLowerCase(); + eGui.classList.add(`ag-${locationKebabCase}-tooltip`); + } +}; +var tooltip_default = ".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}}"; +var instanceIdSeq = 0; +var WAIT_FOR_POPUP_CONTENT_RESIZE = 200; +var BasePopupService = class extends AgBeanStub { + constructor() { + super(...arguments); + this.beanName = "popupSvc"; + this.popupList = []; + } + postConstruct() { + this.addManagedEventListeners({ stylesChanged: this.handleThemeChange.bind(this) }); + } + getPopupParent() { + const ePopupParent = this.gos.get("popupParent"); + if (ePopupParent) { + return ePopupParent; + } + return this.getDefaultPopupParent(); + } + positionPopupUnderMouseEvent(params) { + const { ePopup, nudgeX, nudgeY, skipObserver } = params; + this.positionPopup({ + ePopup, + nudgeX, + nudgeY, + keepWithinBounds: true, + skipObserver, + updatePosition: () => this.calculatePointerAlign(params.mouseEvent), + postProcessCallback: () => this.callPostProcessPopup(params.additionalParams, params.type, params.ePopup, null, params.mouseEvent) + }); + } + calculatePointerAlign(e) { + const parentRect = this.getParentRect(); + return { + x: e.clientX - parentRect.left, + y: e.clientY - parentRect.top + }; + } + positionPopupByComponent(params) { + const { + ePopup, + nudgeX, + nudgeY, + keepWithinBounds, + eventSource, + alignSide = "left", + position = "over", + type + } = params; + const sourceRect = eventSource.getBoundingClientRect(); + const parentRect = this.getParentRect(); + this.setAlignedTo(eventSource, ePopup); + const updatePosition = () => { + let x = sourceRect.left - parentRect.left; + if (alignSide === "right") { + x -= ePopup.offsetWidth - sourceRect.width; + } + let y; + if (position === "over") { + y = sourceRect.top - parentRect.top; + this.setAlignedStyles(ePopup, "over"); + } else { + this.setAlignedStyles(ePopup, "under"); + const alignSide2 = this.shouldRenderUnderOrAbove(ePopup, sourceRect, parentRect, params.nudgeY || 0); + if (alignSide2 === "under") { + y = sourceRect.top - parentRect.top + sourceRect.height; + } else { + y = sourceRect.top - ePopup.offsetHeight - (nudgeY || 0) * 2 - parentRect.top; + } + } + return { x, y }; + }; + this.positionPopup({ + ePopup, + nudgeX, + nudgeY, + keepWithinBounds, + updatePosition, + postProcessCallback: () => this.callPostProcessPopup(params.additionalParams, type, ePopup, eventSource, null) + }); + } + positionPopupForMenu(params) { + const { eventSource, ePopup, event } = params; + const sourceRect = eventSource.getBoundingClientRect(); + const parentRect = this.getParentRect(); + this.setAlignedTo(eventSource, ePopup); + let minWidthSet = false; + const updatePosition = () => { + const y = this.keepXYWithinBounds(ePopup, sourceRect.top - parentRect.top, 0); + const minWidth = ePopup.clientWidth > 0 ? ePopup.clientWidth : 200; + if (!minWidthSet) { + ePopup.style.minWidth = `${minWidth}px`; + minWidthSet = true; + } + const widthOfParent = parentRect.right - parentRect.left; + const maxX = widthOfParent - minWidth; + let x; + if (this.gos.get("enableRtl")) { + x = xLeftPosition(); + if (x < 0) { + x = xRightPosition(); + this.setAlignedStyles(ePopup, "left"); + } + if (x > maxX) { + x = 0; + this.setAlignedStyles(ePopup, "right"); + } + } else { + x = xRightPosition(); + if (x > maxX) { + x = xLeftPosition(); + this.setAlignedStyles(ePopup, "right"); + } + if (x < 0) { + x = 0; + this.setAlignedStyles(ePopup, "left"); + } + } + return { x, y }; + function xRightPosition() { + return sourceRect.right - parentRect.left - 2; + } + function xLeftPosition() { + return sourceRect.left - parentRect.left - minWidth; + } + }; + this.positionPopup({ + ePopup, + keepWithinBounds: true, + updatePosition, + postProcessCallback: () => this.callPostProcessPopup(params.additionalParams, "subMenu", ePopup, eventSource, event instanceof MouseEvent ? event : undefined) + }); + } + shouldRenderUnderOrAbove(ePopup, targetCompRect, parentRect, nudgeY) { + const spaceAvailableUnder = parentRect.bottom - targetCompRect.bottom; + const spaceAvailableAbove = targetCompRect.top - parentRect.top; + const spaceRequired = ePopup.offsetHeight + nudgeY; + if (spaceAvailableUnder > spaceRequired) { + return "under"; + } + if (spaceAvailableAbove > spaceRequired || spaceAvailableAbove > spaceAvailableUnder) { + return "above"; + } + return "under"; + } + setAlignedStyles(ePopup, positioned) { + const popupIdx = this.getPopupIndex(ePopup); + if (popupIdx === -1) { + return; + } + const popup = this.popupList[popupIdx]; + const { alignedToElement } = popup; + if (!alignedToElement) { + return; + } + const positions = ["right", "left", "over", "above", "under"]; + for (const position of positions) { + alignedToElement.classList.remove(`ag-has-popup-positioned-${position}`); + ePopup.classList.remove(`ag-popup-positioned-${position}`); + } + if (!positioned) { + return; + } + alignedToElement.classList.add(`ag-has-popup-positioned-${positioned}`); + ePopup.classList.add(`ag-popup-positioned-${positioned}`); + } + setAlignedTo(eventSource, ePopup) { + const popupIdx = this.getPopupIndex(ePopup); + if (popupIdx !== -1) { + const popup = this.popupList[popupIdx]; + popup.alignedToElement = eventSource; + } + } + positionPopup(params) { + const { ePopup, keepWithinBounds, nudgeX, nudgeY, skipObserver, updatePosition } = params; + const lastSize = { width: 0, height: 0 }; + const updatePopupPosition = (fromResizeObserver = false) => { + let { x, y } = updatePosition(); + if (fromResizeObserver && ePopup.clientWidth === lastSize.width && ePopup.clientHeight === lastSize.height) { + return; + } + lastSize.width = ePopup.clientWidth; + lastSize.height = ePopup.clientHeight; + if (nudgeX) { + x += nudgeX; + } + if (nudgeY) { + y += nudgeY; + } + if (keepWithinBounds) { + x = this.keepXYWithinBounds(ePopup, x, 1); + y = this.keepXYWithinBounds(ePopup, y, 0); + } + ePopup.style.left = `${x}px`; + ePopup.style.top = `${y}px`; + if (params.postProcessCallback) { + params.postProcessCallback(); + } + }; + updatePopupPosition(); + if (!skipObserver) { + const resizeObserverDestroyFunc = _observeResize(this.beans, ePopup, () => updatePopupPosition(true)); + setTimeout(() => resizeObserverDestroyFunc(), WAIT_FOR_POPUP_CONTENT_RESIZE); + } + } + getParentRect() { + const eDocument = _getDocument(this.beans); + let popupParent = this.getPopupParent(); + if (popupParent === eDocument.body) { + popupParent = eDocument.documentElement; + } else if (getComputedStyle(popupParent).position === "static") { + popupParent = popupParent.offsetParent; + } + return _getElementRectWithOffset(popupParent); + } + keepXYWithinBounds(ePopup, position, direction) { + const isVertical = direction === 0; + const sizeProperty = isVertical ? "clientHeight" : "clientWidth"; + const anchorProperty = isVertical ? "top" : "left"; + const offsetProperty = isVertical ? "height" : "width"; + const scrollPositionProperty = isVertical ? "scrollTop" : "scrollLeft"; + const eDocument = _getDocument(this.beans); + const docElement = eDocument.documentElement; + const popupParent = this.getPopupParent(); + const popupRect = ePopup.getBoundingClientRect(); + const parentRect = popupParent.getBoundingClientRect(); + const documentRect = eDocument.documentElement.getBoundingClientRect(); + const isBody = popupParent === eDocument.body; + const offsetSize = Math.ceil(popupRect[offsetProperty]); + const getSize2 = isVertical ? _getAbsoluteHeight : _getAbsoluteWidth; + let sizeOfParent = isBody ? getSize2(docElement) + docElement[scrollPositionProperty] : popupParent[sizeProperty]; + if (isBody) { + sizeOfParent -= Math.abs(documentRect[anchorProperty] - parentRect[anchorProperty]); + } + const max = sizeOfParent - offsetSize; + return Math.min(Math.max(position, 0), Math.max(max, 0)); + } + addPopup(params) { + const { eChild, ariaLabel, ariaOwns, alwaysOnTop, positionCallback, anchorToElement } = params; + const pos = this.getPopupIndex(eChild); + if (pos !== -1) { + const popup = this.popupList[pos]; + return { hideFunc: popup.hideFunc }; + } + this.initialisePopupPosition(eChild); + const wrapperEl = this.createPopupWrapper(eChild, !!alwaysOnTop, ariaLabel, ariaOwns); + const removeListeners = this.addEventListenersToPopup({ ...params, wrapperEl }); + if (positionCallback) { + positionCallback(); + } + this.addPopupToPopupList(eChild, wrapperEl, removeListeners, anchorToElement); + return { + hideFunc: removeListeners + }; + } + initialisePopupPosition(element) { + const ePopupParent = this.getPopupParent(); + const ePopupParentRect = ePopupParent.getBoundingClientRect(); + if (!_exists(element.style.top)) { + element.style.top = `${ePopupParentRect.top * -1}px`; + } + if (!_exists(element.style.left)) { + element.style.left = `${ePopupParentRect.left * -1}px`; + } + } + createPopupWrapper(element, alwaysOnTop, ariaLabel, ariaOwns) { + const ePopupParent = this.getPopupParent(); + const { environment, gos } = this.beans; + const eWrapper = _createAgElement({ tag: "div" }); + environment.applyThemeClasses(eWrapper); + eWrapper.classList.add("ag-popup"); + element.classList.add(gos.get("enableRtl") ? "ag-rtl" : "ag-ltr", "ag-popup-child"); + if (!element.hasAttribute("role")) { + _setAriaRole(element, "dialog"); + } + if (ariaLabel) { + _setAriaLabel(element, ariaLabel); + } else if (ariaOwns) { + element.id || (element.id = `popup-component-${instanceIdSeq}`); + _setAriaOwns(ariaOwns, element.id); + } + eWrapper.appendChild(element); + ePopupParent.appendChild(eWrapper); + if (alwaysOnTop) { + this.setAlwaysOnTop(element, true); + } else { + this.bringPopupToFront(element); + } + return eWrapper; + } + addEventListenersToPopup(params) { + const beans = this.beans; + const eDocument = _getDocument(beans); + const { wrapperEl, eChild: popupEl, closedCallback, afterGuiAttached, closeOnEsc, modal, ariaOwns } = params; + let popupHidden = false; + const hidePopupOnKeyboardEvent = (event) => { + if (!wrapperEl.contains(_getActiveDomElement(beans))) { + return; + } + const key = event.key; + if (key === KeyCode.ESCAPE && !this.isStopPropagation(event)) { + removeListeners({ keyboardEvent: event }); + } + }; + const hidePopupOnMouseEvent = (event) => removeListeners({ mouseEvent: event }); + const hidePopupOnTouchEvent = (event) => removeListeners({ touchEvent: event }); + const removeListeners = (popupParams = {}) => { + const { mouseEvent, touchEvent, keyboardEvent, forceHide } = popupParams; + if (!forceHide && (this.isEventFromCurrentPopup({ mouseEvent, touchEvent }, popupEl) || popupHidden)) { + return; + } + popupHidden = true; + wrapperEl.remove(); + eDocument.removeEventListener("keydown", hidePopupOnKeyboardEvent); + eDocument.removeEventListener("mousedown", hidePopupOnMouseEvent); + eDocument.removeEventListener("touchstart", hidePopupOnTouchEvent); + eDocument.removeEventListener("contextmenu", hidePopupOnMouseEvent); + this.eventSvc.removeListener("dragStarted", hidePopupOnMouseEvent); + if (closedCallback) { + closedCallback(mouseEvent || touchEvent || keyboardEvent); + } + this.removePopupFromPopupList(popupEl, ariaOwns); + }; + if (afterGuiAttached) { + afterGuiAttached({ hidePopup: removeListeners }); + } + window.setTimeout(() => { + if (closeOnEsc) { + eDocument.addEventListener("keydown", hidePopupOnKeyboardEvent); + } + if (modal) { + eDocument.addEventListener("mousedown", hidePopupOnMouseEvent); + this.eventSvc.addListener("dragStarted", hidePopupOnMouseEvent); + eDocument.addEventListener("touchstart", hidePopupOnTouchEvent); + eDocument.addEventListener("contextmenu", hidePopupOnMouseEvent); + } + }, 0); + return removeListeners; + } + addPopupToPopupList(element, wrapperEl, removeListeners, anchorToElement) { + this.popupList.push({ + element, + wrapper: wrapperEl, + hideFunc: removeListeners, + instanceId: instanceIdSeq, + isAnchored: !!anchorToElement + }); + if (anchorToElement) { + this.setPopupPositionRelatedToElement(element, anchorToElement); + } + instanceIdSeq = instanceIdSeq + 1; + } + getPopupIndex(el) { + return this.popupList.findIndex((p) => p.element === el); + } + setPopupPositionRelatedToElement(popupEl, relativeElement) { + const popupIndex = this.getPopupIndex(popupEl); + if (popupIndex === -1) { + return; + } + const popup = this.popupList[popupIndex]; + if (popup.stopAnchoringPromise) { + popup.stopAnchoringPromise.then((destroyFunc) => destroyFunc && destroyFunc()); + } + popup.stopAnchoringPromise = undefined; + popup.isAnchored = false; + if (!relativeElement) { + return; + } + const destroyPositionTracker = this.keepPopupPositionedRelativeTo({ + element: relativeElement, + ePopup: popupEl, + hidePopup: popup.hideFunc + }); + popup.stopAnchoringPromise = destroyPositionTracker; + popup.isAnchored = true; + return destroyPositionTracker; + } + removePopupFromPopupList(element, ariaOwns) { + this.setAlignedStyles(element, null); + this.setPopupPositionRelatedToElement(element, null); + if (ariaOwns) { + _setAriaOwns(ariaOwns, null); + } + this.popupList = this.popupList.filter((p) => p.element !== element); + } + keepPopupPositionedRelativeTo(params) { + const eParent = this.getPopupParent(); + const parentRect = eParent.getBoundingClientRect(); + const { element, ePopup } = params; + const sourceRect = element.getBoundingClientRect(); + const extractFromPixelValue = (pxSize) => Number.parseInt(pxSize.substring(0, pxSize.length - 1), 10); + const createPosition = (prop, direction) => { + const initialDiff = parentRect[prop] - sourceRect[prop]; + const initial = extractFromPixelValue(ePopup.style[prop]); + return { + initialDiff, + lastDiff: initialDiff, + initial, + last: initial, + direction + }; + }; + const topPosition = createPosition("top", 0); + const leftPosition = createPosition("left", 1); + const fwOverrides = this.beans.frameworkOverrides; + return new AgPromise((resolve) => { + fwOverrides.wrapIncoming(() => { + _wrapInterval(() => { + const pRect = eParent.getBoundingClientRect(); + const sRect = element.getBoundingClientRect(); + const elementNotInDom = sRect.top == 0 && sRect.left == 0 && sRect.height == 0 && sRect.width == 0; + if (elementNotInDom) { + params.hidePopup(); + return; + } + const calculateNewPosition = (position, prop) => { + const current = extractFromPixelValue(ePopup.style[prop]); + if (position.last !== current) { + position.initial = current; + position.last = current; + } + const currentDiff = pRect[prop] - sRect[prop]; + if (currentDiff != position.lastDiff) { + const newValue = this.keepXYWithinBounds(ePopup, position.initial + position.initialDiff - currentDiff, position.direction); + ePopup.style[prop] = `${newValue}px`; + position.last = newValue; + } + position.lastDiff = currentDiff; + }; + calculateNewPosition(topPosition, "top"); + calculateNewPosition(leftPosition, "left"); + }, 200).then((intervalId) => { + const result = () => { + if (intervalId != null) { + window.clearInterval(intervalId); + } + }; + resolve(result); + }); + }, "popupPositioning"); + }); + } + isEventFromCurrentPopup(params, target) { + const { mouseEvent, touchEvent } = params; + const event = mouseEvent ? mouseEvent : touchEvent; + if (!event) { + return false; + } + const indexOfThisChild = this.getPopupIndex(target); + if (indexOfThisChild === -1) { + return false; + } + for (let i = indexOfThisChild;i < this.popupList.length; i++) { + const popup = this.popupList[i]; + if (_isElementInEventPath(popup.element, event)) { + return true; + } + } + return this.isElementWithinCustomPopup(event.target); + } + isElementWithinCustomPopup(el) { + const eDocument = _getDocument(this.beans); + while (el && el !== eDocument.body) { + if (el.classList.contains("ag-custom-component-popup") || el.parentElement === null) { + return true; + } + el = el.parentElement; + } + return false; + } + getWrapper(ePopup) { + while (!ePopup.classList.contains("ag-popup") && ePopup.parentElement) { + ePopup = ePopup.parentElement; + } + return ePopup.classList.contains("ag-popup") ? ePopup : null; + } + setAlwaysOnTop(ePopup, alwaysOnTop) { + const eWrapper = this.getWrapper(ePopup); + if (!eWrapper) { + return; + } + eWrapper.classList.toggle("ag-always-on-top", !!alwaysOnTop); + if (alwaysOnTop) { + this.bringPopupToFront(eWrapper); + } + } + bringPopupToFront(ePopup) { + const parent = this.getPopupParent(); + const popupList = Array.prototype.slice.call(parent.querySelectorAll(".ag-popup")); + const popupLen = popupList.length; + const eWrapper = this.getWrapper(ePopup); + if (!eWrapper || popupLen <= 1 || !parent.contains(ePopup)) { + return; + } + const standardPopupList = []; + const alwaysOnTopList = []; + for (const popup of popupList) { + if (popup === eWrapper) { + continue; + } + if (popup.classList.contains("ag-always-on-top")) { + alwaysOnTopList.push(popup); + } else { + standardPopupList.push(popup); + } + } + const innerElsScrollMap = []; + const onTopLength = alwaysOnTopList.length; + const isPopupAlwaysOnTop = eWrapper.classList.contains("ag-always-on-top"); + const shouldBeLast = isPopupAlwaysOnTop || !onTopLength; + const targetList = shouldBeLast ? [...standardPopupList, ...alwaysOnTopList, eWrapper] : [...standardPopupList, eWrapper, ...alwaysOnTopList]; + for (let i = 0;i <= popupLen; i++) { + const currentPopup = targetList[i]; + if (popupList[i] === targetList[i] || currentPopup === eWrapper) { + continue; + } + const innerEls = currentPopup.querySelectorAll("div"); + for (const el of innerEls) { + if (el.scrollTop !== 0) { + innerElsScrollMap.push([el, el.scrollTop]); + } + } + if (i === 0) { + parent.prepend(currentPopup); + } else { + targetList[i - 1].after(currentPopup); + } + } + while (innerElsScrollMap.length) { + const currentEl = innerElsScrollMap.pop(); + currentEl[0].scrollTop = currentEl[1]; + } + } + handleThemeChange(e) { + if (e.themeChanged) { + const environment = this.beans.environment; + for (const popup of this.popupList) { + environment.applyThemeClasses(popup.wrapper); + } + } + } +}; +var PopupService = class extends BasePopupService { + getDefaultPopupParent() { + return this.beans.ctrlsSvc.get("gridCtrl").getGui(); + } + callPostProcessPopup(params, type, ePopup, eventSource, mouseEvent) { + const callback = this.gos.getCallback("postProcessPopup"); + if (callback) { + const { column, rowNode } = params ?? {}; + const postProcessParams = { + column, + rowNode, + ePopup, + type, + eventSource, + mouseEvent + }; + callback(postProcessParams); + } + } + getActivePopups() { + return this.popupList.map((popup) => popup.element); + } + hasAnchoredPopup() { + return this.popupList.some((popup) => popup.isAnchored); + } + isStopPropagation(event) { + return _isStopPropagationForAgGrid(event); + } +}; +var PopupModule = { + moduleName: "Popup", + version: VERSION, + beans: [PopupService] +}; +function _isShowTooltipWhenTruncated(gos) { + return gos.get("tooltipShowMode") === "whenTruncated"; +} +function _getShouldDisplayTooltip(gos, getElement2) { + return _isShowTooltipWhenTruncated(gos) ? _isElementOverflowingCallback(getElement2) : undefined; +} +var getErrorTooltipMessage = (error, translate) => { + const localisable = error; + if (typeof localisable.getTranslatedMessage === "function") { + return localisable.getTranslatedMessage(translate); + } + return error.message; +}; +var getEditErrorsForPosition = (beans, cellCtrl, translate) => { + const { editModelSvc } = beans; + const cellValidationErrors = editModelSvc?.getCellValidationModel()?.getCellValidation(cellCtrl)?.errorMessages; + const rowValidationErrors = editModelSvc?.getRowValidationModel().getRowValidation(cellCtrl)?.errorMessages; + const errors = cellValidationErrors || rowValidationErrors; + return errors?.length ? errors.join(translate("tooltipValidationErrorSeparator", ". ")) : undefined; +}; +var getCellTruncationCheck = (beans, ctrl) => { + const isTooltipWhenTruncated = _isShowTooltipWhenTruncated(beans.gos); + if (!isTooltipWhenTruncated) { + return; + } + if (ctrl.isCellRenderer()) { + const colDef = ctrl.column.getColDef(); + const isGroupCellRenderer = !!colDef.showRowGroup || colDef.cellRenderer === "agGroupCellRenderer"; + if (!isGroupCellRenderer) { + return; + } + return _isElementOverflowingCallback(() => { + const eCell = ctrl.eGui; + return eCell.querySelector(".ag-group-value") || eCell.querySelector(".ag-cell-value") || eCell; + }); + } + return _isElementOverflowingCallback(() => { + const eCell = ctrl.eGui; + return eCell.children.length === 0 ? eCell : eCell.querySelector(".ag-cell-value"); + }); +}; +var buildCellTooltipDisplayFunctions = (beans, ctrl, shouldDisplayTooltip) => { + const { editSvc } = beans; + const { column } = ctrl; + const isCellTruncated = getCellTruncationCheck(beans, ctrl); + const shouldDisplayCellTooltip = () => { + if (editSvc?.isEditing(ctrl)) { + return false; + } + if (!isCellTruncated) { + return true; + } + if (!column.isTooltipEnabled()) { + return false; + } + return isCellTruncated(); + }; + return { + shouldDisplayDefault: shouldDisplayCellTooltip, + shouldDisplayColumnTooltip: shouldDisplayCellTooltip, + shouldDisplayCustomTooltip: shouldDisplayTooltip ?? shouldDisplayCellTooltip + }; +}; +var resolveCellTooltip = ({ + beans, + ctrl, + value, + displayFunctions, + translate +}) => { + const { editSvc, formula, gos } = beans; + const { column, rowNode } = ctrl; + if (formula?.active && column.isAllowFormula()) { + const error = formula.getFormulaError(column, rowNode); + if (error) { + return { + value: getErrorTooltipMessage(error, translate), + location: "cellFormula", + shouldDisplay: () => !!formula?.getFormulaError(column, rowNode) + }; + } + } + const isEditing2 = !!editSvc?.isEditing(ctrl); + if (!isEditing2) { + const errorMessages = getEditErrorsForPosition(beans, ctrl, translate); + if (errorMessages) { + return { + value: errorMessages, + location: "cellEditor", + shouldDisplay: () => !editSvc?.isEditing(ctrl) && !!getEditErrorsForPosition(beans, ctrl, translate) + }; + } + } + const { shouldDisplayCustomTooltip, shouldDisplayColumnTooltip } = displayFunctions; + if (value != null) { + return { value, location: "cell", shouldDisplay: shouldDisplayCustomTooltip }; + } + const colDef = column.getColDef(); + const data = rowNode.data; + if (colDef.tooltipField && _exists(data)) { + return { + value: _getValueUsingField(data, colDef.tooltipField, column.isTooltipFieldContainsDots()), + location: "cell", + shouldDisplay: shouldDisplayColumnTooltip + }; + } + const valueGetter = colDef.tooltipValueGetter; + if (valueGetter) { + return { + value: valueGetter(_addGridCommonParams(gos, { + location: "cell", + colDef: column.getColDef(), + column, + rowIndex: ctrl.cellPosition.rowIndex, + node: rowNode, + data: rowNode.data, + value: ctrl.value, + valueFormatted: ctrl.valueFormatted + })), + location: "cell", + shouldDisplay: shouldDisplayColumnTooltip + }; + } + return null; +}; +var TooltipService = class extends BeanStub { + constructor() { + super(...arguments); + this.beanName = "tooltipSvc"; + } + setupHeaderTooltip(existingTooltipFeature, ctrl, passedValue, shouldDisplayTooltip) { + if (existingTooltipFeature) { + ctrl.destroyBean(existingTooltipFeature); + } + const gos = this.gos; + const isTooltipWhenTruncated = _isShowTooltipWhenTruncated(gos); + const { column, eGui } = ctrl; + const colDef = column.getColDef(); + if (!shouldDisplayTooltip && isTooltipWhenTruncated && !colDef.headerComponent) { + shouldDisplayTooltip = _isElementOverflowingCallback(() => eGui.querySelector(".ag-header-cell-text")); + } + const location = "header"; + const headerLocation = "header"; + const valueFormatted = this.beans.colNames.getDisplayNameForColumn(column, headerLocation, true); + const value = passedValue ?? valueFormatted; + const tooltipCtrl = { + getGui: () => eGui, + getLocation: () => location, + getTooltipValue: () => passedValue ?? colDef?.headerTooltipValueGetter?.(_addGridCommonParams(gos, { location, colDef, column, value, valueFormatted })) ?? colDef?.headerTooltip, + shouldDisplayTooltip, + getAdditionalParams: () => ({ + column, + colDef: column.getColDef() + }) + }; + let tooltipFeature = this.createTooltipFeature(tooltipCtrl); + if (tooltipFeature) { + tooltipFeature = ctrl.createBean(tooltipFeature); + ctrl.setRefreshFunction("tooltip", () => tooltipFeature.refreshTooltip()); + } + return tooltipFeature; + } + setupHeaderGroupTooltip(existingTooltipFeature, ctrl, passedValue, shouldDisplayTooltip) { + if (existingTooltipFeature) { + ctrl.destroyBean(existingTooltipFeature); + } + const gos = this.gos; + const isTooltipWhenTruncated = _isShowTooltipWhenTruncated(gos); + const { column, eGui } = ctrl; + const colDef = column.getColGroupDef(); + if (!shouldDisplayTooltip && isTooltipWhenTruncated && !colDef?.headerGroupComponent) { + shouldDisplayTooltip = _isElementOverflowingCallback(() => eGui.querySelector(".ag-header-group-text")); + } + const location = "headerGroup"; + const headerLocation = "header"; + const valueFormatted = this.beans.colNames.getDisplayNameForColumnGroup(column, headerLocation); + const value = passedValue ?? valueFormatted; + const tooltipCtrl = { + getGui: () => eGui, + getLocation: () => location, + getTooltipValue: () => passedValue ?? colDef?.headerTooltipValueGetter?.(_addGridCommonParams(gos, { location, colDef, column, value, valueFormatted })) ?? colDef?.headerTooltip, + shouldDisplayTooltip, + getAdditionalParams: () => { + const additionalParams = { + column + }; + if (colDef) { + additionalParams.colDef = colDef; + } + return additionalParams; + } + }; + const tooltipFeature = this.createTooltipFeature(tooltipCtrl); + return tooltipFeature ? ctrl.createBean(tooltipFeature) : tooltipFeature; + } + enableCellTooltipFeature(ctrl, value, shouldDisplayTooltip) { + const { beans } = this; + const { column, rowNode } = ctrl; + const displayFunctions = buildCellTooltipDisplayFunctions(beans, ctrl, shouldDisplayTooltip); + const translate = this.getLocaleTextFunc(); + let resolvedTooltip = null; + const resolveAndStore = () => { + resolvedTooltip = resolveCellTooltip({ + beans, + ctrl, + value, + displayFunctions, + translate + }); + return resolvedTooltip; + }; + const getTooltipValue = () => resolveAndStore()?.value; + const tooltipCtrl = { + getGui: () => ctrl.eGui, + getLocation: () => resolvedTooltip?.location ?? "cell", + getTooltipValue, + shouldDisplayTooltip: () => { + const tooltip = resolvedTooltip ?? resolveAndStore(); + if (!tooltip) { + return false; + } + return tooltip.shouldDisplay ? tooltip.shouldDisplay() : true; + }, + getAdditionalParams: () => ({ + column, + colDef: column.getColDef(), + rowIndex: ctrl.cellPosition.rowIndex, + node: rowNode, + data: rowNode.data, + valueFormatted: ctrl.valueFormatted + }) + }; + return this.createTooltipFeature(tooltipCtrl, beans); + } + setupFullWidthRowTooltip(existingTooltipFeature, ctrl, value, shouldDisplayTooltip) { + const tooltipParams = { + getGui: () => ctrl.getFullWidthElement(), + getTooltipValue: () => value, + getLocation: () => "fullWidthRow", + shouldDisplayTooltip + }; + const beans = this.beans; + const context = beans.context; + if (existingTooltipFeature) { + ctrl.destroyBean(existingTooltipFeature, context); + } + const tooltipFeature = this.createTooltipFeature(tooltipParams, beans); + if (!tooltipFeature) { + return; + } + return ctrl.createBean(tooltipFeature, context); + } + setupCellEditorTooltip(cellCtrl, editor) { + const { beans } = this; + const { context } = beans; + const el = editor.getValidationElement?.(true) || !editor.isPopup?.() && cellCtrl.eGui; + if (!el) { + return; + } + const tooltipParams = { + getGui: () => el, + getTooltipValue: () => getEditErrorsForPosition(beans, cellCtrl, this.getLocaleTextFunc()), + getLocation: () => "cellEditor", + shouldDisplayTooltip: () => { + const { editModelSvc } = beans; + const rowValidationMap = editModelSvc?.getRowValidationModel()?.getRowValidationMap(); + const cellValidationMap = editModelSvc?.getCellValidationModel()?.getCellValidationMap(); + const hasRowValidationErrors = !!rowValidationMap && rowValidationMap.size > 0; + const hasCellValidationErrors = !!cellValidationMap && cellValidationMap.size > 0; + return hasRowValidationErrors || hasCellValidationErrors; + } + }; + const tooltipFeature = this.createTooltipFeature(tooltipParams, beans); + if (!tooltipFeature) { + return; + } + return cellCtrl.createBean(tooltipFeature, context); + } + initCol(column) { + const { colDef } = column; + column.tooltipEnabled = _exists(colDef.tooltipField) || _exists(colDef.tooltipValueGetter) || _exists(colDef.tooltipComponent); + } + createTooltipFeature(tooltipCtrl, beans) { + return this.beans.registry.createDynamicBean("tooltipFeature", false, tooltipCtrl, beans); + } +}; +var TooltipStateManager = class extends BaseTooltipStateManager { + createTooltipComp(params, callback) { + const userDetails = _getTooltipCompDetails(this.beans.userCompFactory, params); + userDetails?.newAgStackInstance().then(callback); + } + setEventHandlers(listener) { + [this.onColumnMovedEventCallback] = this.addManagedEventListeners({ + columnMoved: listener + }); + } + clearEventHandlers() { + this.onColumnMovedEventCallback?.(); + this.onColumnMovedEventCallback = undefined; + } +}; +var TooltipModule = { + moduleName: "Tooltip", + version: VERSION, + beans: [TooltipService], + dynamicBeans: { + tooltipFeature: AgTooltipFeature, + highlightTooltipFeature: AgHighlightTooltipFeature, + tooltipStateManager: TooltipStateManager + }, + userComponents: { + agTooltipComponent: AgTooltipComponent + }, + dependsOn: [PopupModule], + css: [tooltip_default] +}; +var cell_editing_default = ".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 AgInputTextField = class extends AgAbstractInputField { + constructor(config, className = "ag-text-field", inputType = "text") { + super(config, className, inputType); + } + postConstruct() { + super.postConstruct(); + if (this.config.allowedCharPattern) { + this.preventDisallowedCharacters(); + } + } + setValue(value, silent) { + const eInput = this.eInput; + if (eInput.value !== value) { + eInput.value = _exists(value) ? value : ""; + } + return super.setValue(value, silent); + } + setStartValue(value) { + this.setValue(value, true); + } + setCustomValidity(message) { + const eInput = this.eInput; + const isInvalid = message.length > 0; + eInput.setCustomValidity(message); + if (isInvalid) { + eInput.reportValidity(); + } + _setAriaInvalid(eInput, isInvalid); + } + preventDisallowedCharacters() { + const pattern = new RegExp(`[${this.config.allowedCharPattern}]`); + const preventCharacters = (event) => { + if (!_isEventFromPrintableCharacter(event)) { + return; + } + if (event.key && !pattern.test(event.key)) { + event.preventDefault(); + } + }; + this.addManagedListeners(this.eInput, { + keydown: preventCharacters, + paste: (e) => { + const text = e.clipboardData?.getData("text"); + if (text?.split("").some((c) => !pattern.test(c))) { + e.preventDefault(); + } + } + }); + } +}; +var AgInputTextFieldSelector = { + selector: "AG-INPUT-TEXT-FIELD", + component: AgInputTextField +}; +var SimpleCellEditor = class extends AgAbstractCellEditor { + constructor(cellEditorInput) { + super(); + this.cellEditorInput = cellEditorInput; + this.eEditor = RefPlaceholder; + } + initialiseEditor(params) { + const { cellEditorInput } = this; + this.setTemplate({ tag: "div", cls: "ag-cell-edit-wrapper", children: [cellEditorInput.getTemplate()] }, cellEditorInput.getAgComponents()); + const { eEditor } = this; + const { cellStartedEdit, eventKey, suppressPreventDefault } = params; + eEditor.getInputElement().setAttribute("title", ""); + cellEditorInput.init(eEditor, params); + let startValue; + let shouldSetStartValue = true; + if (cellStartedEdit) { + this.focusAfterAttached = true; + if (eventKey === KeyCode.BACKSPACE || eventKey === KeyCode.DELETE) { + startValue = ""; + } else if (eventKey && eventKey.length === 1) { + if (suppressPreventDefault) { + shouldSetStartValue = false; + } else { + startValue = eventKey; + } + } else { + startValue = cellEditorInput.getStartValue(); + if (eventKey !== KeyCode.F2) { + this.highlightAllOnFocus = true; + } + } + } else { + this.focusAfterAttached = false; + startValue = cellEditorInput.getStartValue(); + } + if (shouldSetStartValue && startValue != null) { + eEditor.setStartValue(startValue); + } + this.addGuiEventListener("keydown", (event) => { + const { key } = event; + if (key === KeyCode.PAGE_UP || key === KeyCode.PAGE_DOWN) { + event.preventDefault(); + } + }); + } + afterGuiAttached() { + const translate = this.getLocaleTextFunc(); + const eInput = this.eEditor; + eInput.setInputAriaLabel(translate("ariaInputEditor", "Input Editor")); + if (!this.focusAfterAttached) { + return; + } + if (!_isBrowserSafari()) { + eInput.getFocusableElement().focus(); + } + const inputEl = eInput.getInputElement(); + if (this.highlightAllOnFocus) { + inputEl.select(); + } else { + this.cellEditorInput.setCaret?.(); + } + } + focusIn() { + const { eEditor } = this; + const focusEl = eEditor.getFocusableElement(); + const inputEl = eEditor.getInputElement(); + focusEl.focus(); + inputEl.select(); + } + getValue() { + return this.cellEditorInput.getValue(); + } + agSetEditValue(value) { + this.params.value = value; + const startValue = this.cellEditorInput.getStartValue(); + this.eEditor.setStartValue(startValue ?? null); + } + isPopup() { + return false; + } + getValidationElement() { + return this.eEditor.getInputElement(); + } + getValidationErrors() { + return this.cellEditorInput.getValidationErrors(); + } +}; +var AgInputNumberField = class extends AgInputTextField { + constructor(config) { + super(config, "ag-number-field", "number"); + } + postConstruct() { + super.postConstruct(); + const eInput = this.eInput; + this.addManagedListeners(eInput, { + blur: () => { + const floatedValue = Number.parseFloat(eInput.value); + const value = isNaN(floatedValue) ? "" : this.normalizeValue(floatedValue.toString()); + if (this.value !== value) { + this.setValue(value); + } + }, + wheel: this.onWheel.bind(this) + }); + eInput.step = "any"; + const { precision, min, max, step } = this.config; + if (typeof precision === "number") { + this.setPrecision(precision); + } + if (typeof min === "number") { + this.setMin(min); + } + if (typeof max === "number") { + this.setMax(max); + } + if (typeof step === "number") { + this.setStep(step); + } + } + onWheel(e) { + if (_getActiveDomElement(this.beans) === this.eInput) { + e.preventDefault(); + } + } + normalizeValue(value) { + if (value === "") { + return ""; + } + if (this.precision != null) { + value = this.adjustPrecision(value); + } + return value; + } + adjustPrecision(value, isScientificNotation) { + const precision = this.precision; + if (precision == null) { + return value; + } + if (isScientificNotation) { + const floatString = Number.parseFloat(value).toFixed(precision); + return Number.parseFloat(floatString).toString(); + } + const parts = String(value).split("."); + if (parts.length > 1) { + if (parts[1].length <= precision) { + return value; + } else if (precision > 0) { + return `${parts[0]}.${parts[1].slice(0, precision)}`; + } + } + return parts[0]; + } + setMin(min) { + if (this.min === min) { + return this; + } + this.min = min; + _addOrRemoveAttribute(this.eInput, "min", min); + return this; + } + setMax(max) { + if (this.max === max) { + return this; + } + this.max = max; + _addOrRemoveAttribute(this.eInput, "max", max); + return this; + } + setPrecision(precision) { + this.precision = precision; + return this; + } + setStep(step) { + if (this.step === step) { + return this; + } + this.step = step; + _addOrRemoveAttribute(this.eInput, "step", step); + return this; + } + setValue(value, silent) { + return this.setValueOrInputValue((v) => super.setValue(v, silent), () => this, value); + } + setStartValue(value) { + return this.setValueOrInputValue((v) => super.setValue(v, true), (v) => { + this.eInput.value = v; + }, value); + } + setValueOrInputValue(setValueFunc, setInputValueOnlyFunc, value) { + if (_exists(value)) { + let setInputValueOnly = this.isScientificNotation(value); + if (setInputValueOnly && this.eInput.validity.valid) { + return setValueFunc(value); + } + if (!setInputValueOnly) { + value = this.adjustPrecision(value); + const normalizedValue = this.normalizeValue(value); + setInputValueOnly = value != normalizedValue; + } + if (setInputValueOnly) { + return setInputValueOnlyFunc(value); + } + } + return setValueFunc(value); + } + getValue(ignoreValidity = false) { + const eInput = this.eInput; + if (!eInput.validity.valid && !ignoreValidity) { + return; + } + const inputValue = eInput.value; + if (this.isScientificNotation(inputValue)) { + return this.adjustPrecision(inputValue, true); + } + return super.getValue(); + } + isScientificNotation(value) { + return typeof value === "string" && value.includes("e"); + } +}; +var agList_default = ".ag-list-item{align-items:center;display:flex;height:var(--ag-list-item-height);overflow:hidden;text-overflow:ellipsis;white-space:nowrap;&.ag-active-item{background-color:var(--ag-row-hover-color)}}"; +var ACTIVE_CLASS = "ag-active-item"; +var getAgListElement = (cssIdentifier, label) => ({ + tag: "div", + cls: `ag-list-item ag-${cssIdentifier}-list-item`, + attrs: { role: "option" }, + children: [ + { + tag: "span", + cls: `ag-list-item-text ag-${cssIdentifier}-list-item-text`, + ref: "eText", + children: label + } + ] +}); +var AgListItem = class extends AgComponentStub { + constructor(cssIdentifier, label, value) { + super(getAgListElement(cssIdentifier, label)); + this.label = label; + this.value = value; + this.eText = RefPlaceholder; + } + postConstruct() { + this.createTooltip(); + this.addEventListeners(); + } + setHighlighted(highlighted) { + const eGui = this.getGui(); + eGui.classList.toggle(ACTIVE_CLASS, highlighted); + _setAriaSelected(eGui, highlighted); + this.dispatchLocalEvent({ + type: "itemHighlighted", + highlighted + }); + } + getHeight() { + return this.getGui().clientHeight; + } + setIndex(idx, setSize) { + const eGui = this.getGui(); + _setAriaPosInSet(eGui, idx); + _setAriaSetSize(eGui, setSize); + } + createTooltip() { + const tooltipCtrl = { + getTooltipValue: () => this.label, + getGui: () => this.getGui(), + getLocation: () => "UNKNOWN", + shouldDisplayTooltip: () => _isHorizontalScrollShowing(this.eText) + }; + const tooltipFeature = this.createOptionalManagedBean(this.beans.registry.createDynamicBean("highlightTooltipFeature", false, tooltipCtrl, this)); + if (tooltipFeature) { + this.tooltipFeature = tooltipFeature; + } + } + addEventListeners() { + const parentComponent = this.getParentComponent(); + if (!parentComponent) { + return; + } + this.addGuiEventListener("mouseover", () => { + parentComponent.highlightItem(this); + }); + this.addGuiEventListener("mousedown", (e) => { + e.preventDefault(); + e.stopPropagation(); + parentComponent.setValue(this.value); + }); + } +}; +var AgList = class extends AgComponentStub { + constructor(cssIdentifier = "default") { + super({ tag: "div", cls: `ag-list ag-${cssIdentifier}-list` }); + this.cssIdentifier = cssIdentifier; + this.options = []; + this.listItems = []; + this.highlightedItem = null; + this.registerCSS(agList_default); + } + postConstruct() { + const eGui = this.getGui(); + this.addManagedElementListeners(eGui, { mouseleave: () => this.clearHighlighted() }); + } + handleKeyDown(e) { + const key = e.key; + switch (key) { + case KeyCode.ENTER: + if (!this.highlightedItem) { + this.setValue(this.getValue()); + } else { + const pos = this.listItems.indexOf(this.highlightedItem); + this.setValueByIndex(pos); + } + break; + case KeyCode.DOWN: + case KeyCode.UP: + e.preventDefault(); + this.navigate(key); + break; + case KeyCode.PAGE_DOWN: + case KeyCode.PAGE_UP: + case KeyCode.PAGE_HOME: + case KeyCode.PAGE_END: + e.preventDefault(); + this.navigateToPage(key); + break; + } + } + addOptions(listOptions) { + for (const listOption of listOptions) { + this.addOption(listOption); + } + return this; + } + addOption(listOption) { + const { value, text } = listOption; + const valueToRender = text ?? value; + this.options.push({ value, text: valueToRender }); + this.renderOption(value, valueToRender); + this.updateIndices(); + return this; + } + clearOptions() { + this.options = []; + this.reset(true); + for (const item of this.listItems) { + item.destroy(); + } + _clearElement(this.getGui()); + this.listItems = []; + this.refreshAriaRole(); + } + updateOptions(listOptions) { + const needsUpdate = this.options !== listOptions; + if (needsUpdate) { + this.clearOptions(); + this.addOptions(listOptions); + } + return needsUpdate; + } + setValue(value, silent) { + if (this.value === value) { + this.fireItemSelected(); + return this; + } + if (value == null) { + this.reset(silent); + return this; + } + const idx = this.options.findIndex((option) => option.value === value); + if (idx !== -1) { + const option = this.options[idx]; + this.value = option.value; + this.displayValue = option.text; + this.highlightItem(this.listItems[idx]); + if (!silent) { + this.fireChangeEvent(); + } + } + return this; + } + setValueByIndex(idx) { + return this.setValue(this.options[idx].value); + } + getValue() { + return this.value; + } + getDisplayValue() { + return this.displayValue; + } + refreshHighlighted() { + this.clearHighlighted(); + const idx = this.options.findIndex((option) => option.value === this.value); + if (idx !== -1) { + this.highlightItem(this.listItems[idx]); + } + } + highlightItem(item) { + const itemEl = item.getGui(); + if (!_isVisible(itemEl)) { + return; + } + this.clearHighlighted(); + item.setHighlighted(true); + this.highlightedItem = item; + const eGui = this.getGui(); + const { scrollTop, clientHeight } = eGui; + const { offsetTop, offsetHeight } = itemEl; + if (offsetTop + offsetHeight > scrollTop + clientHeight || offsetTop < scrollTop) { + itemEl.scrollIntoView({ block: "nearest" }); + } + } + hideItemTooltip() { + this.highlightedItem?.tooltipFeature?.attemptToHideTooltip(); + } + destroy() { + this.hideItemTooltip(); + super.destroy(); + } + reset(silent) { + this.value = null; + this.displayValue = null; + this.clearHighlighted(); + if (!silent) { + this.fireChangeEvent(); + } + } + clearHighlighted() { + this.highlightedItem?.setHighlighted(false); + this.highlightedItem = null; + } + renderOption(value, text) { + const item = new AgListItem(this.cssIdentifier, text, value); + item.setParentComponent(this); + const listItem = this.createManagedBean(item); + this.listItems.push(listItem); + this.getGui().appendChild(listItem.getGui()); + } + navigate(key) { + const isDown = key === KeyCode.DOWN; + let itemToHighlight; + const { listItems, highlightedItem } = this; + if (!highlightedItem) { + itemToHighlight = isDown ? listItems[0] : _last(listItems); + } else { + const currentIdx = listItems.indexOf(highlightedItem); + let nextPos = currentIdx + (isDown ? 1 : -1); + nextPos = Math.min(Math.max(nextPos, 0), listItems.length - 1); + itemToHighlight = listItems[nextPos]; + } + this.highlightItem(itemToHighlight); + } + navigateToPage(key) { + const { listItems, highlightedItem } = this; + if (!highlightedItem || listItems.length === 0) { + return; + } + const currentIdx = listItems.indexOf(highlightedItem); + const rowCount = this.options.length - 1; + const itemHeight = listItems[0].getHeight(); + const pageSize = Math.floor(this.getGui().clientHeight / itemHeight); + 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(currentIdx + pageSize, rowCount); + } else if (key === KeyCode.PAGE_UP) { + newIndex = Math.max(currentIdx - pageSize, 0); + } + if (newIndex === -1) { + return; + } + this.highlightItem(listItems[newIndex]); + } + refreshAriaRole() { + _setAriaRole(this.getGui(), this.options.length === 0 ? "presentation" : "listbox"); + } + updateIndices() { + this.refreshAriaRole(); + const listItems = this.listItems; + const len = listItems.length; + listItems.forEach((item, idx) => { + item.setIndex(idx + 1, len); + }); + } + fireChangeEvent() { + this.dispatchLocalEvent({ type: "fieldValueChanged" }); + this.fireItemSelected(); + } + fireItemSelected() { + this.dispatchLocalEvent({ type: "selectedItem" }); + } +}; +var agPickerField_default = ".ag-picker-field-display{flex:1 1 auto}.ag-picker-field{align-items:center;display:flex}.ag-picker-field-icon{border:0;cursor:pointer;display:flex;margin:0;padding:0}.ag-picker-field-wrapper{background-color:var(--ag-picker-button-background-color);border:var(--ag-picker-button-border);border-radius:5px;min-height:max(var(--ag-list-item-height),calc(var(--ag-spacing)*4));overflow:hidden;&:where(.invalid){background-color:var(--ag-input-invalid-background-color);border:var(--ag-input-invalid-border);color:var(--ag-input-invalid-text-color)}}.ag-picker-field-wrapper:where(.ag-picker-has-focus),.ag-picker-field-wrapper:where(:focus-within){background-color:var(--ag-picker-button-focus-background-color);border:var(--ag-picker-button-focus-border);box-shadow:var(--ag-focus-shadow);&:where(.invalid){box-shadow:var(--ag-focus-error-shadow)}}.ag-picker-field-wrapper:disabled{opacity:.5}"; +var AgPickerFieldElement = { + 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-picker-collapsed", + children: [ + { tag: "div", ref: "eDisplayField", cls: "ag-picker-field-display" }, + { tag: "div", ref: "eIcon", cls: "ag-picker-field-icon", attrs: { "aria-hidden": "true" } } + ] + } + ] +}; +var AgPickerField = class extends AgAbstractField { + constructor(config) { + super(config, config?.template || AgPickerFieldElement, config?.agComponents || [], config?.className); + this.isPickerDisplayed = false; + this.skipClick = false; + this.pickerGap = 4; + this.hideCurrentPicker = null; + this.eLabel = RefPlaceholder; + this.eWrapper = RefPlaceholder; + this.eDisplayField = RefPlaceholder; + this.eIcon = RefPlaceholder; + this.registerCSS(agPickerField_default); + this.ariaRole = config?.ariaRole; + this.onPickerFocusIn = this.onPickerFocusIn.bind(this); + this.onPickerFocusOut = this.onPickerFocusOut.bind(this); + if (!config) { + return; + } + const { pickerGap, maxPickerHeight, variableWidth, minPickerWidth, maxPickerWidth } = config; + if (pickerGap != null) { + this.pickerGap = pickerGap; + } + this.variableWidth = !!variableWidth; + if (maxPickerHeight != null) { + this.setPickerMaxHeight(maxPickerHeight); + } + if (minPickerWidth != null) { + this.setPickerMinWidth(minPickerWidth); + } + if (maxPickerWidth != null) { + this.setPickerMaxWidth(maxPickerWidth); + } + } + postConstruct() { + super.postConstruct(); + this.setupAria(); + const displayId = `ag-${this.getCompId()}-display`; + this.eDisplayField.setAttribute("id", displayId); + const ariaEl = this.getAriaElement(); + this.addManagedElementListeners(ariaEl, { keydown: this.onKeyDown.bind(this) }); + this.addManagedElementListeners(this.eLabel, { mousedown: this.onLabelOrWrapperMouseDown.bind(this) }); + this.addManagedElementListeners(this.eWrapper, { mousedown: this.onLabelOrWrapperMouseDown.bind(this) }); + const { pickerIcon, inputWidth } = this.config; + if (pickerIcon) { + const icon = this.beans.iconSvc.createIconNoSpan(pickerIcon); + if (icon) { + this.eIcon.appendChild(icon); + } + } + if (inputWidth != null) { + this.setInputWidth(inputWidth); + } + } + setupAria() { + const ariaEl = this.getAriaElement(); + ariaEl.setAttribute("tabindex", this.gos.get("tabIndex").toString()); + _setAriaExpanded(ariaEl, false); + if (this.ariaRole) { + _setAriaRole(ariaEl, this.ariaRole); + } + } + onLabelOrWrapperMouseDown(e) { + if (e) { + const focusableEl = this.getFocusableElement(); + if (focusableEl !== this.eWrapper && e?.target === focusableEl) { + return; + } + e.preventDefault(); + this.getFocusableElement().focus(); + } + if (this.skipClick) { + this.skipClick = false; + return; + } + if (this.isDisabled()) { + return; + } + if (this.isPickerDisplayed) { + this.hidePicker(); + } else { + this.showPicker(); + } + } + onKeyDown(e) { + switch (e.key) { + case KeyCode.UP: + case KeyCode.DOWN: + case KeyCode.ENTER: + case KeyCode.SPACE: + e.preventDefault(); + this.onLabelOrWrapperMouseDown(); + break; + case KeyCode.ESCAPE: + if (this.isPickerDisplayed) { + e.preventDefault(); + e.stopPropagation(); + if (this.hideCurrentPicker) { + this.hideCurrentPicker(); + } + } + break; + } + } + showPicker() { + this.isPickerDisplayed = true; + if (!this.pickerComponent) { + this.pickerComponent = this.createPickerComponent(); + } + const pickerGui = this.pickerComponent.getGui(); + pickerGui.addEventListener("focusin", this.onPickerFocusIn); + pickerGui.addEventListener("focusout", this.onPickerFocusOut); + this.hideCurrentPicker = this.renderAndPositionPicker(); + this.toggleExpandedStyles(true); + } + renderAndPositionPicker() { + const ePicker = this.pickerComponent.getGui(); + if (!this.gos.get("suppressScrollWhenPopupsAreOpen")) { + [this.destroyMouseWheelFunc] = this.addManagedEventListeners({ + bodyScroll: () => { + this.hidePicker(); + } + }); + } + const translate = this.getLocaleTextFunc(); + const { + config: { pickerAriaLabelKey, pickerAriaLabelValue, modalPicker = true }, + maxPickerHeight, + minPickerWidth, + maxPickerWidth, + variableWidth, + beans, + eWrapper + } = this; + const popupParams = { + modal: modalPicker, + eChild: ePicker, + closeOnEsc: true, + closedCallback: () => { + const shouldRestoreFocus = _isNothingFocused(beans); + this.beforeHidePicker(); + if (shouldRestoreFocus && this.isAlive()) { + this.getFocusableElement().focus(); + } + }, + ariaLabel: translate(pickerAriaLabelKey, pickerAriaLabelValue), + anchorToElement: eWrapper + }; + ePicker.style.position = "absolute"; + const popupSvc = beans.popupSvc; + const addPopupRes = popupSvc.addPopup(popupParams); + if (variableWidth) { + if (minPickerWidth) { + ePicker.style.minWidth = minPickerWidth; + } + ePicker.style.width = _formatSize(_getAbsoluteWidth(eWrapper)); + if (maxPickerWidth) { + ePicker.style.maxWidth = maxPickerWidth; + } + } else { + _setElementWidth(ePicker, maxPickerWidth ?? _getAbsoluteWidth(eWrapper)); + } + const maxHeight = maxPickerHeight ?? `${_getInnerHeight(popupSvc.getPopupParent())}px`; + ePicker.style.setProperty("max-height", maxHeight); + this.alignPickerToComponent(); + return addPopupRes.hideFunc; + } + alignPickerToComponent() { + if (!this.pickerComponent) { + return; + } + const { + pickerGap, + config: { pickerType }, + beans: { popupSvc, gos }, + eWrapper, + pickerComponent + } = this; + const alignSide = gos.get("enableRtl") ? "right" : "left"; + popupSvc.positionPopupByComponent({ + type: pickerType, + eventSource: eWrapper, + ePopup: pickerComponent.getGui(), + position: "under", + alignSide, + keepWithinBounds: true, + nudgeY: pickerGap + }); + } + beforeHidePicker() { + if (this.destroyMouseWheelFunc) { + this.destroyMouseWheelFunc(); + this.destroyMouseWheelFunc = undefined; + } + this.toggleExpandedStyles(false); + const pickerGui = this.pickerComponent.getGui(); + pickerGui.removeEventListener("focusin", this.onPickerFocusIn); + pickerGui.removeEventListener("focusout", this.onPickerFocusOut); + this.isPickerDisplayed = false; + this.pickerComponent = undefined; + this.hideCurrentPicker = null; + } + toggleExpandedStyles(expanded) { + if (!this.isAlive()) { + return; + } + const ariaEl = this.getAriaElement(); + _setAriaExpanded(ariaEl, expanded); + const classList = this.eWrapper.classList; + classList.toggle("ag-picker-expanded", expanded); + classList.toggle("ag-picker-collapsed", !expanded); + } + onPickerFocusIn() { + this.togglePickerHasFocus(true); + } + onPickerFocusOut(e) { + if (!this.pickerComponent?.getGui().contains(e.relatedTarget)) { + this.togglePickerHasFocus(false); + } + } + togglePickerHasFocus(focused) { + if (!this.pickerComponent) { + return; + } + this.eWrapper.classList.toggle("ag-picker-has-focus", focused); + } + hidePicker() { + if (this.hideCurrentPicker) { + this.hideCurrentPicker(); + this.dispatchLocalEvent({ + type: "pickerHidden" + }); + } + } + setInputWidth(width) { + _setElementWidth(this.eWrapper, width); + return this; + } + getFocusableElement() { + return this.eWrapper; + } + setPickerGap(gap) { + this.pickerGap = gap; + return this; + } + setPickerMinWidth(width) { + if (typeof width === "number") { + width = `${width}px`; + } + this.minPickerWidth = width == null ? undefined : width; + return this; + } + setPickerMaxWidth(width) { + if (typeof width === "number") { + width = `${width}px`; + } + this.maxPickerWidth = width == null ? undefined : width; + return this; + } + setPickerMaxHeight(height) { + if (typeof height === "number") { + height = `${height}px`; + } + this.maxPickerHeight = height == null ? undefined : height; + return this; + } + destroy() { + this.hidePicker(); + super.destroy(); + } +}; +var agSelect_default = ".ag-select{align-items:center;display:flex;&.ag-disabled{opacity:.5}}.ag-select:where(:not(.ag-cell-editor,.ag-label-align-top)){min-height:var(--ag-list-item-height)}:where(.ag-select){.ag-picker-field-wrapper{cursor:default;padding-left:var(--ag-spacing);padding-right:var(--ag-spacing)}&.ag-disabled .ag-picker-field-wrapper:focus{box-shadow:none}.ag-picker-field-display{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.ag-picker-field-icon{align-items:center;display:flex}}.ag-select-list{background-color:var(--ag-picker-list-background-color);border:var(--ag-picker-list-border);border-radius:var(--ag-border-radius);box-shadow:var(--ag-dropdown-shadow);overflow:hidden auto}.ag-select-list-item{cursor:default;-webkit-user-select:none;-moz-user-select:none;user-select:none}:where(.ag-ltr) .ag-select-list-item{padding-left:var(--ag-spacing)}:where(.ag-rtl) .ag-select-list-item{padding-right:var(--ag-spacing)}.ag-select-list-item-text{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}"; +var AgSelect = class extends AgPickerField { + constructor(config) { + super({ + pickerAriaLabelKey: "ariaLabelSelectField", + pickerAriaLabelValue: "Select Field", + pickerType: "ag-list", + className: "ag-select", + pickerIcon: "selectOpen", + ariaRole: "combobox", + ...config + }); + this.registerCSS(agSelect_default); + } + postConstruct() { + this.tooltipFeature = this.createOptionalManagedBean(this.beans.registry.createDynamicBean("tooltipFeature", false, { + shouldDisplayTooltip: _isElementOverflowingCallback(() => this.eDisplayField), + getGui: () => this.getGui() + })); + super.postConstruct(); + this.createListComponent(); + this.eWrapper.tabIndex = this.gos.get("tabIndex"); + const { options, value, placeholder } = this.config; + if (options != null) { + this.addOptions(options); + } + if (value != null) { + this.setValue(value, true); + } + if (placeholder && value == null) { + this.eDisplayField.textContent = placeholder; + } + this.addManagedElementListeners(this.eWrapper, { focusout: this.onWrapperFocusOut.bind(this) }); + } + onWrapperFocusOut(e) { + if (!this.eWrapper.contains(e.relatedTarget)) { + this.hidePicker(); + } + } + createListComponent() { + const listComponent = this.createBean(new AgList("select")); + this.listComponent = listComponent; + listComponent.setParentComponent(this); + const eListAriaEl = listComponent.getAriaElement(); + const listId = `ag-select-list-${listComponent.getCompId()}`; + eListAriaEl.setAttribute("id", listId); + _setAriaControlsAndLabel(this.getAriaElement(), eListAriaEl); + listComponent.addManagedElementListeners(listComponent.getGui(), { + mousedown: (e) => { + e?.preventDefault(); + } + }); + listComponent.addManagedListeners(listComponent, { + selectedItem: () => { + this.hidePicker(); + this.dispatchLocalEvent({ type: "selectedItem" }); + }, + fieldValueChanged: () => { + if (!this.listComponent) { + return; + } + this.setValue(this.listComponent.getValue(), false, true); + this.hidePicker(); + } + }); + } + createPickerComponent() { + return this.listComponent; + } + beforeHidePicker() { + this.listComponent?.hideItemTooltip(); + super.beforeHidePicker(); + } + onKeyDown(e) { + const { key } = e; + if (key === KeyCode.TAB) { + this.hidePicker(); + } + switch (key) { + case KeyCode.ENTER: + case KeyCode.UP: + case KeyCode.DOWN: + case KeyCode.PAGE_UP: + case KeyCode.PAGE_DOWN: + case KeyCode.PAGE_HOME: + case KeyCode.PAGE_END: + e.preventDefault(); + if (this.isPickerDisplayed) { + this.listComponent?.handleKeyDown(e); + } else { + super.onKeyDown(e); + } + break; + case KeyCode.ESCAPE: + super.onKeyDown(e); + break; + case KeyCode.SPACE: + if (this.isPickerDisplayed) { + e.preventDefault(); + } else { + super.onKeyDown(e); + } + break; + } + } + showPicker() { + const listComponent = this.listComponent; + if (!listComponent) { + return; + } + super.showPicker(); + listComponent.refreshHighlighted(); + } + addOptions(options) { + for (const option of options) { + this.addOption(option); + } + return this; + } + addOption(option) { + this.listComponent.addOption(option); + return this; + } + clearOptions() { + this.listComponent?.clearOptions(); + this.setValue(undefined, true); + return this; + } + updateOptions(options) { + if (this.listComponent?.updateOptions(options)) { + this.setValue(undefined, true); + } + return this; + } + setValue(value, silent, fromPicker) { + const { + listComponent, + config: { placeholder }, + eDisplayField, + tooltipFeature + } = this; + if (this.value === value || !listComponent) { + return this; + } + if (!fromPicker) { + listComponent.setValue(value, true); + } + const newValue = listComponent.getValue(); + if (newValue === this.getValue()) { + return this; + } + let displayValue = listComponent.getDisplayValue(); + if (displayValue == null && placeholder) { + displayValue = placeholder; + } + eDisplayField.textContent = displayValue; + tooltipFeature?.setTooltipAndRefresh(displayValue ?? null); + return super.setValue(value, silent); + } + destroy() { + this.listComponent = this.destroyBean(this.listComponent); + super.destroy(); + } +}; +var TextCellEditorElement = { + tag: "ag-input-text-field", + ref: "eEditor", + cls: "ag-cell-editor" +}; +var TextCellEditorInput = class { + constructor(getLocaleTextFunc) { + this.getLocaleTextFunc = getLocaleTextFunc; + } + getTemplate() { + return TextCellEditorElement; + } + getAgComponents() { + return [AgInputTextFieldSelector]; + } + init(eEditor, params) { + this.eEditor = eEditor; + this.params = params; + const maxLength = params.maxLength; + if (maxLength != null) { + eEditor.setMaxLength(maxLength); + } + } + getValidationErrors() { + const { params } = this; + const { maxLength, getValidationErrors } = params; + const value = this.getValue(); + const translate = this.getLocaleTextFunc(); + let internalErrors = []; + if (maxLength != null && typeof value === "string" && value.length > maxLength) { + internalErrors.push(translate("maxLengthValidation", `Must be ${maxLength} characters or fewer.`, [String(maxLength)])); + } + if (!internalErrors.length) { + internalErrors = null; + } + if (getValidationErrors) { + return getValidationErrors({ value, cellEditorParams: params, internalErrors }); + } + return internalErrors; + } + getValue() { + const { eEditor, params } = this; + const value = eEditor.getValue(); + if (!_exists(value) && !_exists(params.value)) { + return params.value; + } + return params.parseValue(value); + } + getStartValue() { + const params = this.params; + const formatValue = params.useFormatter || params.column.getColDef().refData; + return formatValue ? params.formatValue(params.value) : params.value; + } + setCaret() { + if (_isBrowserSafari()) { + this.eEditor.getInputElement().focus({ preventScroll: true }); + } + const eInput = this.eEditor; + const value = eInput.getValue(); + const len = _exists(value) && value.length || 0; + if (len) { + eInput.getInputElement().setSelectionRange(len, len); + } + } +}; +var TextCellEditor = class extends SimpleCellEditor { + constructor() { + super(new TextCellEditorInput(() => this.getLocaleTextFunc())); + } +}; +function getEditRowValues(beans, rowNode) { + return beans.editModelSvc?.getEditRowDataValue(rowNode, { checkSiblings: true }); +} +function getEditingCells(beans) { + const edits = beans.editModelSvc?.getEditMap(); + const positions = []; + edits?.forEach((editRow, rowNode) => { + const { rowIndex, rowPinned } = rowNode; + editRow.forEach((editValue, column) => { + const { editorValue, pendingValue, sourceValue: oldValue, state } = editValue; + const diff = _sourceAndPendingDiffer(editValue); + let newValue = editorValue ?? pendingValue; + if (newValue === UNEDITED) { + newValue = undefined; + } + const edit = { + newValue, + oldValue, + state, + column, + colId: column.getColId(), + colKey: column.getColId(), + rowIndex, + rowPinned + }; + const editing = state === "editing"; + const changed = !editing && diff; + if (editing || changed) { + positions.push(edit); + } + }); + }); + return positions; +} +function stopEditing(beans, cancel = false) { + const { editSvc } = beans; + if (editSvc?.isBatchEditing()) { + if (cancel) { + for (const cellPosition of beans.editModelSvc?.getEditPositions() ?? []) { + if (cellPosition.state === "editing") { + editSvc.revertSingleCellEdit(cellPosition); + } + } + } else { + _syncFromEditors(beans, { persist: true }); + } + _destroyEditors(beans, undefined, { cancel }); + } else { + editSvc?.stopEditing(undefined, { cancel, source: "edit", forceStop: !cancel, forceCancel: cancel }); + } +} +function isEditing(beans, cellPosition) { + const cellCtrl = _getCellCtrl(beans, cellPosition); + return !!beans.editSvc?.isEditing(cellCtrl); +} +function startEditingCell(beans, params) { + const { key, colKey, rowIndex, rowPinned } = params; + const { editSvc, colModel } = beans; + const column = colModel.getCol(colKey); + if (!column) { + _warn(12, { colKey }); + return; + } + const cellPosition = { + rowIndex, + rowPinned: rowPinned || null, + column + }; + const rowNode = _getRowNode(beans, cellPosition); + if (!rowNode) { + _warn(290, { rowIndex, rowPinned }); + return; + } + if (!editSvc?.isCellEditable({ rowNode, column }, "api")) { + return; + } + const notPinned = rowPinned == null; + if (notPinned) { + ensureIndexVisible(beans, rowIndex); + } + ensureColumnVisible(beans, colKey); + editSvc?.startEditing({ + rowNode, + column + }, { + event: key ? new KeyboardEvent("keydown", { key }) : undefined, + source: "api", + editable: true + }); +} +function validateEdit(beans) { + return beans.editSvc?.validateEdit() || null; +} +var PopupEditorElement = { tag: "div", cls: "ag-popup-editor", attrs: { tabindex: "-1" } }; +var PopupEditorWrapper = class extends AgPopupComponent { + constructor(params) { + super(PopupEditorElement); + this.params = params; + } + postConstruct() { + _setDomData(this.gos, this.getGui(), "popupEditorWrapper", true); + this.addKeyDownListener(); + } + addKeyDownListener() { + const eGui = this.getGui(); + const params = this.params; + const listener = (event) => { + if (!_isUserSuppressingKeyboardEvent(this.gos, event, params.node, params.column, true)) { + params.onKeyDown(event); + } + }; + this.addManagedElementListeners(eGui, { keydown: listener }); + } +}; +function shouldStartEditing(beans, { column }, event, cellStartedEdit, source = "ui") { + if (event instanceof KeyboardEvent && (event.key === KeyCode.TAB || event.key === KeyCode.ENTER || event.key === KeyCode.F2 || event.key === KeyCode.BACKSPACE && cellStartedEdit)) { + return true; + } + const extendingRange = event?.shiftKey && beans.rangeSvc?.getCellRanges().length != 0; + if (extendingRange) { + return false; + } + const colDef = column?.getColDef(); + const clickCount = deriveClickCount(beans.gos, colDef); + const type = event?.type; + if (type === "click" && event?.detail === 1 && clickCount === 1) { + return true; + } + if (type === "dblclick" && event?.detail === 2 && clickCount === 2) { + return true; + } + if (source === "api") { + return !!cellStartedEdit; + } + return false; +} +function deriveClickCount(gos, colDef) { + if (gos.get("suppressClickEdit") === true) { + return 0; + } + if (gos.get("singleClickEdit") === true) { + return 1; + } + if (colDef?.singleClickEdit) { + return 1; + } + return 2; +} +function existingEditing(beans, editPosition) { + return beans.editModelSvc?.hasEdits(editPosition, { withOpenEditor: true }) ?? false; +} +function isCellEditable(beans, editPosition) { + const column = editPosition.column; + const rowNode = editPosition.rowNode; + const colDef = column.getColDef(); + if (!rowNode) { + return existingEditing(beans, editPosition); + } + const editable = colDef.editable; + if (rowNode.group && colDef.groupRowEditable != null) { + if (beans.rowGroupingEditValueSvc?.isGroupCellEditable(rowNode, column)) { + return true; + } + return existingEditing(beans, editPosition); + } + if (column.isColumnFunc(rowNode, editable)) { + return true; + } + return existingEditing(beans, editPosition); +} +function isFullRowCellEditable(beans, position, source = "ui") { + const editable = isCellEditable(beans, position); + if (editable || source === "ui") { + return editable; + } + const { rowNode, column } = position; + for (const col of beans.colModel.getCols()) { + if (col !== column && isCellEditable(beans, { rowNode, column: col })) { + return true; + } + } + return false; +} +var editHighlightFn = (edit, includeEditing = false) => { + if (edit !== undefined) { + return _sourceAndPendingDiffer(edit) || includeEditing && edit.state === "editing"; + } +}; +function _hasEdits(beans, position, includeEditing = false) { + return editHighlightFn(beans.editModelSvc?.getEdit(position), includeEditing); +} +var nodeHasLeafEdit = (children, editModelSvc, column) => { + if (!children) { + return; + } + for (let i = 0, len = children.length;i < len; ++i) { + const child = children[i]; + if (child.data) { + const highlight = editHighlightFn(editModelSvc?.getEdit({ rowNode: child, column })) || editHighlightFn(editModelSvc?.getEdit({ rowNode: child.pinnedSibling, column })); + if (highlight) { + return true; + } + } + if (nodeHasLeafEdit(child.childrenAfterGroup, editModelSvc, column)) { + return true; + } + } +}; +function _hasLeafEdits(beans, position) { + const { column, rowNode } = position; + if (beans.gos.get("groupTotalRow") && !rowNode?.footer) { + return false; + } + return nodeHasLeafEdit(rowNode?.childrenAfterGroup, beans.editModelSvc, column); +} +function _hasPinnedEdits(beans, { rowNode, column }) { + rowNode = rowNode.pinnedSibling; + if (!rowNode) { + return; + } + return editHighlightFn(beans.editModelSvc?.getEdit({ + rowNode, + column + })); +} +var CellEditStyleFeature = class extends BeanStub { + constructor(cellCtrl, beans) { + super(); + this.cellCtrl = cellCtrl; + this.beans = beans; + this.editSvc = beans.editSvc; + this.editModelSvc = beans.editModelSvc; + } + setComp(comp) { + this.cellComp = comp; + this.applyCellStyles(); + } + applyCellStyles() { + const { cellCtrl, editSvc, beans } = this; + if (editSvc?.isBatchEditing() && editSvc.isEditing()) { + const state = _hasEdits(beans, cellCtrl) || _hasLeafEdits(beans, cellCtrl) || _hasPinnedEdits(beans, cellCtrl); + this.applyBatchingStyle(state); + } else { + this.applyBatchingStyle(false); + } + const hasErrors = !!this.editModelSvc?.getCellValidationModel().hasCellValidation(this.cellCtrl); + this.cellComp.toggleCss("ag-cell-editing-error", hasErrors); + } + applyBatchingStyle(newState) { + this.cellComp.toggleCss("ag-cell-editing", newState ?? false); + this.cellComp.toggleCss("ag-cell-batch-edit", (newState && this.editSvc?.isBatchEditing()) ?? false); + } +}; +var RowEditStyleFeature = class extends BeanStub { + constructor(rowCtrl, beans) { + super(); + this.rowCtrl = rowCtrl; + this.beans = beans; + this.gos = beans.gos; + this.editSvc = beans.editSvc; + this.editModelSvc = beans.editModelSvc; + } + applyRowStyles() { + const { rowCtrl, editModelSvc, beans } = this; + let rowNode = rowCtrl.rowNode; + let edits = editModelSvc?.getEditRow(rowNode); + const hasErrors = this.editModelSvc?.getRowValidationModel().hasRowValidation({ rowNode }); + if (!edits && rowNode.pinnedSibling) { + rowNode = rowNode.pinnedSibling; + edits = editModelSvc?.getEditRow(rowNode); + } + if (edits) { + const editing = Array.from(edits.keys()).some((column) => { + const position = { rowNode, column }; + return _hasEdits(beans, position, true) || _hasLeafEdits(beans, position) || _hasPinnedEdits(beans, position); + }); + this.applyStyle(hasErrors, editing); + return; + } + this.applyStyle(hasErrors); + } + applyStyle(hasErrors = false, editing = false) { + const batchEdit = !!this.editSvc?.isBatchEditing(); + const fullRow = this.gos.get("editType") === "fullRow"; + this.rowCtrl?.forEachGui(undefined, ({ rowComp }) => { + rowComp.toggleCss("ag-row-editing", fullRow && editing); + rowComp.toggleCss("ag-row-batch-edit", fullRow && editing && batchEdit); + rowComp.toggleCss("ag-row-inline-editing", editing); + rowComp.toggleCss("ag-row-not-inline-editing", !editing); + rowComp.toggleCss("ag-row-editing-invalid", fullRow && editing && hasErrors); + }); + } +}; +var purgeRows = ({ rowModel, pinnedRowModel, editModelSvc }, rowNodes) => { + const found = /* @__PURE__ */ new Set; + rowModel.forEachNode((node) => rowNodes.has(node) && found.add(node)); + pinnedRowModel?.forEachPinnedRow("top", (node) => rowNodes.has(node) && found.add(node)); + pinnedRowModel?.forEachPinnedRow("bottom", (node) => rowNodes.has(node) && found.add(node)); + for (const rowNode of rowNodes) { + if (!found.has(rowNode)) { + editModelSvc.removeEdits({ rowNode }); + } + } + return found; +}; +var purgeCells = ({ editModelSvc }, rowNodes, columns) => { + for (const rowNode of rowNodes) { + editModelSvc?.getEditRow(rowNode)?.forEach((_, column) => !columns.has(column) && editModelSvc.removeEdits({ rowNode, column })); + } +}; +var _refreshEditCells = (beans) => () => { + const columns = new Set(beans.colModel.getCols()); + const updates = beans.editModelSvc.getEditMap(true); + const rowNodes = new Set(updates.keys()); + purgeCells(beans, purgeRows(beans, rowNodes), columns); +}; +var KEEP_EDITOR_SOURCES = /* @__PURE__ */ new Set(["undo", "redo", "paste", "bulk", "rangeSvc"]); +var INTERNAL_EDITOR_SOURCES = /* @__PURE__ */ new Set(["ui", "api"]); +var STOP_EDIT_SOURCE_TRANSFORM = { + paste: "api", + rangeSvc: "api", + fillHandle: "api", + cellClear: "api", + bulk: "api" +}; +var STOP_EDIT_SOURCE_TRANSFORM_KEYS = new Set(Object.keys(STOP_EDIT_SOURCE_TRANSFORM)); +var SET_DATA_SOURCE_AS_API = /* @__PURE__ */ new Set(["paste", "rangeSvc", "cellClear", "redo", "undo"]); +var CANCEL_PARAMS = { cancel: true, source: "api" }; +var COMMIT_PARAMS = { cancel: false, source: "api" }; +var CHECK_SIBLING = { checkSiblings: true }; +var FORCE_REFRESH = { force: true, suppressFlash: true }; +var FORCE_REFRESH_FLASH = { force: true }; +var EditService = class extends BeanStub { + constructor() { + super(...arguments); + this.beanName = "editSvc"; + this.committing = false; + this.batch = false; + this.batchStartDispatched = false; + this.stopping = false; + this.rangeSelectionWhileEditing = 0; + } + postConstruct() { + const { beans } = this; + this.model = beans.editModelSvc; + this.valueSvc = beans.valueSvc; + this.rangeSvc = beans.rangeSvc; + this.addManagedPropertyListener("editType", ({ currentValue }) => { + this.stopEditing(undefined, CANCEL_PARAMS); + this.createStrategy(currentValue); + }); + const handler = _refreshEditCells(beans); + const stopInvalidEdits = () => { + const hasCellValidation = this.model.getCellValidationModel().getCellValidationMap().size > 0; + const hasRowValidation = this.model.getRowValidationModel().getRowValidationMap().size > 0; + if (hasCellValidation || hasRowValidation) { + this.stopEditing(undefined, CANCEL_PARAMS); + } else if (this.isEditing()) { + if (this.batch) { + _destroyEditors(beans, this.model.getEditPositions()); + } else { + this.stopEditing(undefined, COMMIT_PARAMS); + } + } + return false; + }; + this.addManagedEventListeners({ + columnPinned: handler, + columnVisible: handler, + columnRowGroupChanged: handler, + rowExpansionStateChanged: handler, + pinnedRowsChanged: handler, + displayedRowsChanged: handler, + sortChanged: stopInvalidEdits, + filterChanged: stopInvalidEdits, + cellFocused: this.onCellFocused.bind(this) + }); + } + isBatchEditing() { + return this.batch; + } + startBatchEditing() { + if (this.batch) { + return; + } + this.batch = true; + this.batchStartDispatched = false; + this.stopEditing(undefined, CANCEL_PARAMS); + } + stopBatchEditing(params) { + if (!this.batch) { + return; + } + if (params) { + this.stopEditing(undefined, params); + } + if (this.batchStartDispatched) { + this.dispatchBatchStopped(/* @__PURE__ */ new Map, false); + } + this.batch = false; + this.batchStartDispatched = false; + } + ensureBatchStarted() { + if (!this.batch || this.batchStartDispatched) { + return; + } + this.batchStartDispatched = true; + this.dispatchBatchEvent("batchEditingStarted", /* @__PURE__ */ new Map); + } + createStrategy(editType) { + const { beans, gos, strategy } = this; + const name = getEditType(gos, editType); + if (strategy) { + if (strategy.beanName === name) { + return strategy; + } + this.destroyStrategy(); + } + return this.strategy = this.createOptionalManagedBean(beans.registry.createDynamicBean(name, true)); + } + destroyStrategy() { + if (!this.strategy) { + return; + } + this.strategy.destroy(); + this.strategy = this.destroyBean(this.strategy); + } + shouldStartEditing(position, event, cellStartedEdit, source = "ui") { + const shouldStart = shouldStartEditing(this.beans, position, event, cellStartedEdit, source); + if (shouldStart) { + this.strategy ?? (this.strategy = this.createStrategy()); + } + return shouldStart; + } + shouldStopEditing(position, event, source = "ui") { + return this.strategy?.shouldStop(position, event, source) ?? null; + } + shouldCancelEditing(position, event, source = "ui") { + return this.strategy?.shouldCancel(position, event, source) ?? null; + } + validateEdit() { + return _validateEdit(this.beans); + } + isEditing(position, params) { + return this.model.hasEdits(position ?? undefined, params ?? CHECK_SIBLING); + } + isRowEditing(rowNode, params) { + return !!rowNode && this.model.hasRowEdits(rowNode, params); + } + 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(position, params) { + const { startedEdit = true, event = null, source = "ui", ignoreEventKey = false, silent } = params; + this.strategy ?? (this.strategy = this.createStrategy()); + const editable = params.editable ?? this.isCellEditable(position, "api"); + if (!editable) { + return; + } + const cellCtrl = _getCellCtrl(this.beans, position); + if (cellCtrl && !cellCtrl.comp) { + params.editable = undefined; + cellCtrl.onCompAttachedFuncs.push(() => this.startEditing(position, params)); + return; + } + const res = this.shouldStartEditing(position, event, startedEdit, source); + if (res === false && source !== "api") { + if (this.isEditing(position)) { + this.stopEditing(); + } + return; + } + if (!this.batch && this.shouldStopEditing(position, undefined, source) && !params.continueEditing) { + this.stopEditing(undefined, { source }); + } + if (res) { + this.ensureBatchStarted(); + } + this.strategy.start({ + position, + event, + source, + ignoreEventKey, + startedEdit, + silent + }); + } + stopEditing(position, params) { + const context = this.prepareStopContext(position, params); + if (!context) { + return false; + } + this.stopping = true; + let res = false; + let { edits } = context; + try { + const outcome = this.processStopRequest(context); + res || (res = outcome.res); + edits = outcome.edits; + this.finishStopEditing({ + ...context, + edits, + params, + position, + res + }); + return res; + } finally { + this.rangeSelectionWhileEditing = 0; + this.stopping = false; + } + } + prepareStopContext(position, params) { + const { + event = null, + cancel = false, + source = "ui", + forceCancel = false, + forceStop = false, + commit = false + } = params || {}; + if (STOP_EDIT_SOURCE_TRANSFORM_KEYS.has(source) && this.batch) { + if (position?.rowNode && position?.column) { + this.bulkRefreshCell(position); + } + return null; + } + const treatAsSource = this.committing ? STOP_EDIT_SOURCE_TRANSFORM[source] : source; + const isEditingOrBatchWithEdits = this.committing || this.isEditing(position) || this.batch && this.model.hasEdits(position, CHECK_SIBLING); + if (!isEditingOrBatchWithEdits || !this.strategy || this.stopping) { + return null; + } + const cellCtrl = _getCellCtrl(this.beans, position); + if (cellCtrl) { + cellCtrl.onEditorAttachedFuncs = []; + } + const willStop = !cancel && (!!this.shouldStopEditing(position, event, treatAsSource) || (this.committing || source === "paste") && !this.batch) || forceStop; + const willCancel = cancel && !!this.shouldCancelEditing(position, event, treatAsSource) || forceCancel; + return { + cancel, + cellCtrl, + edits: this.model.getEditMap(true), + event: event ?? null, + forceCancel, + forceStop, + commit, + position, + source, + treatAsSource, + willCancel, + willStop + }; + } + processStopRequest(context) { + const { event, position, willCancel, willStop } = context; + if (willStop || willCancel) { + return this.handleStopOrCancel(context); + } + if (this.shouldHandleMidBatchKey(event, position)) { + return { + res: false, + edits: this.handleMidBatchKey(event, position, context) + }; + } + _syncFromEditors(this.beans, { persist: true }); + if (this.batch) { + this.strategy?.cleanupEditors(position); + } + return { res: false, edits: this.model.getEditMap() }; + } + handleStopOrCancel(context) { + const { beans, model } = this; + const { cancel, commit, edits, event, source, willCancel, willStop } = context; + const persist = !this.batch || !willCancel; + _syncFromEditors(beans, { persist, isCancelling: willCancel || cancel, isStopping: willStop }); + const freshEdits = model.getEditMap(); + const shouldCommit = !willCancel && (!this.batch || commit); + const editsToDelete = shouldCommit ? this.processEdits(freshEdits, source) : []; + if (cancel) { + this.strategy?.stopCancelled(context.forceCancel); + } else { + this.strategy?.stopCommitted(event, commit); + } + this.clearValidationIfNoOpenEditors(); + for (const position of editsToDelete) { + model.clearEditValue(position); + } + this.bulkRefreshMap(edits); + for (const pos of model.getEditPositions(freshEdits)) { + const cellCtrl = _getCellCtrl(beans, pos); + const valueChanged = _sourceAndPendingDiffer(pos); + cellCtrl?.refreshCell({ force: true, suppressFlash: !valueChanged }); + } + return { res: willStop, edits: freshEdits }; + } + shouldHandleMidBatchKey(event, position) { + return event instanceof KeyboardEvent && this.batch && !!this.strategy?.midBatchInputsAllowed(position) && this.isEditing(position, { withOpenEditor: true }); + } + handleMidBatchKey(event, position, context) { + const { beans, model } = this; + const { cellCtrl, edits } = context; + const { key } = event; + const isEnter = key === KeyCode.ENTER; + const isEscape = key === KeyCode.ESCAPE; + const isTab = key === KeyCode.TAB; + if (isEnter || isTab || isEscape) { + if (isEnter || isTab) { + _syncFromEditors(beans, { persist: true }); + } else if (isEscape && cellCtrl) { + const { rowNode, column } = cellCtrl; + if (this.batch && rowNode && column) { + const pos = { rowNode, column }; + _destroyEditors(beans, [pos], { silent: true }); + this.model.stop(pos, true, true); + _getCellCtrl(beans, pos)?.refreshCell(FORCE_REFRESH); + } else { + this.revertSingleCellEdit(cellCtrl); + } + } + if (this.batch) { + this.strategy?.cleanupEditors(); + } else { + _destroyEditors(beans, model.getEditPositions(), { event, cancel: isEscape }); + } + event.preventDefault(); + this.bulkRefreshMap(edits, { suppressFlash: true }); + return model.getEditMap(); + } + return edits; + } + finishStopEditing({ + cellCtrl, + edits, + params, + position, + res, + commit, + forceCancel, + willCancel, + willStop + }) { + const beans = this.beans; + if (res && position) { + if (!this.batch || commit) { + this.model.removeEdits(position); + } + } + this.navigateAfterEdit(params, cellCtrl?.cellPosition); + _purgeUnchangedEdits(beans); + this.clearValidationIfNoOpenEditors(); + const { rowRenderer, formula } = beans; + if (willCancel) { + rowRenderer.refreshRows({ rowNodes: Array.from(edits.keys()) }); + } + if (this.batch) { + if (formula) { + formula.refreshFormulas(true); + } else { + rowRenderer.refreshRows({ suppressFlash: true, force: true }); + } + const batchCommit = willStop && commit; + const batchCancel = willCancel && forceCancel; + if (batchCommit || batchCancel) { + this.dispatchBatchStopped(edits, batchCommit); + } + } + } + dispatchBatchStopped(edits, commit) { + let eventEdits; + if (commit) { + eventEdits = _filterChangedEdits(edits); + if (eventEdits.size > 0) { + this.ensureBatchStarted(); + } + } + if (this.batchStartDispatched) { + this.batchStartDispatched = false; + this.dispatchBatchEvent("batchEditingStopped", eventEdits ?? /* @__PURE__ */ new Map); + } + } + clearValidationIfNoOpenEditors() { + const hasOpenEditors = this.model.hasEdits(undefined, { withOpenEditor: true }); + if (!hasOpenEditors) { + this.model.getCellValidationModel().clearCellValidationMap(); + this.model.getRowValidationModel().clearRowValidationMap(); + } + } + navigateAfterEdit(params, cellPosition) { + if (!params || !cellPosition) { + return; + } + const { event, suppressNavigateAfterEdit } = params; + const isKeyBoardEvent = event instanceof KeyboardEvent; + if (!isKeyBoardEvent || suppressNavigateAfterEdit) { + return; + } + const { key, shiftKey } = event; + const navAfterEdit = this.gos.get("enterNavigatesVerticallyAfterEdit"); + if (key !== KeyCode.ENTER || !navAfterEdit) { + return; + } + const direction = shiftKey ? KeyCode.UP : KeyCode.DOWN; + this.beans.navigation?.navigateToNextCell(null, direction, cellPosition, false); + } + processEdits(edits, source) { + const rowNodes = Array.from(edits.keys()); + const hasValidationErrors = this.model.getCellValidationModel().getCellValidationMap().size > 0 || this.model.getRowValidationModel().getRowValidationMap().size > 0; + const editsToDelete = []; + const { changeDetectionSvc } = this.beans; + changeDetectionSvc?.beginDeferred(); + try { + for (const rowNode of rowNodes) { + const editRow = edits.get(rowNode); + for (const column of editRow.keys()) { + const editValue = editRow.get(column); + const position = { rowNode, column }; + if (_sourceAndPendingDiffer(editValue) && !hasValidationErrors) { + const cellCtrl = _getCellCtrl(this.beans, position); + const success = this.setNodeDataValue(rowNode, column, editValue.pendingValue, cellCtrl, source); + if (!success) { + editsToDelete.push(position); + } + } + } + } + } finally { + changeDetectionSvc?.endDeferred(); + } + return editsToDelete; + } + setNodeDataValue(rowNode, column, newValue, cellCtrl, originalSource = "edit") { + const translatedSource = INTERNAL_EDITOR_SOURCES.has(originalSource) ? "edit" : originalSource; + if (cellCtrl) { + cellCtrl.suppressRefreshCell = true; + } + this.committing = true; + try { + return rowNode.setDataValue(column, newValue, translatedSource); + } finally { + this.committing = false; + if (cellCtrl) { + cellCtrl.suppressRefreshCell = false; + } + } + } + syncEditAfterCommit(position, success) { + const edit = this.model.getEdit(position); + if (edit && edit.state !== "editing") { + if (success) { + this.beans.editModelSvc?.setEdit(position, { sourceValue: edit.pendingValue }); + } else { + this.model.clearEditValue(position); + } + } + } + setEditMap(edits, params) { + this.strategy ?? (this.strategy = this.createStrategy()); + this.strategy?.setEditMap(edits, params); + this.bulkRefreshMap(edits); + let refreshParams = FORCE_REFRESH; + if (params?.forceRefreshOfEditCellsOnly) { + refreshParams = { + ...getRowColumnsFromMap(edits), + ...FORCE_REFRESH + }; + } + this.beans.rowRenderer.refreshCells(refreshParams); + } + dispatchEditValuesChanged({ rowNode, column }, edit = {}) { + if (!rowNode || !column || !edit) { + return; + } + const { pendingValue, sourceValue } = edit; + const { rowIndex, rowPinned, data } = rowNode; + this.beans.eventSvc.dispatchEvent({ + type: "cellEditValuesChanged", + node: rowNode, + rowIndex, + rowPinned, + column, + source: "api", + data, + newValue: pendingValue, + oldValue: sourceValue, + value: pendingValue, + colDef: column.getColDef() + }); + } + bulkRefreshCell(position, params) { + if (_isClientSideRowModel(this.gos, this.beans.rowModel)) { + this.refCell(position, this.model.getEdit(position), params); + } + } + bulkRefreshMap(editMap, params) { + if (_isClientSideRowModel(this.gos, this.beans.rowModel)) { + editMap.forEach((editRow, rowNode) => { + for (const column of editRow.keys()) { + this.refCell({ rowNode, column }, editRow.get(column), params); + } + }); + } + } + refCell({ rowNode, column }, edit, params = {}) { + const { beans, gos } = this; + const updatedNodes = /* @__PURE__ */ new Set([rowNode]); + const refreshNodes = /* @__PURE__ */ new Set; + const pinnedSibling = rowNode.pinnedSibling; + if (pinnedSibling) { + updatedNodes.add(pinnedSibling); + } + const sibling = rowNode.sibling; + if (sibling) { + refreshNodes.add(sibling); + } + let parent = rowNode.parent; + while (parent) { + if (parent.sibling?.footer && gos.get("groupTotalRow")) { + refreshNodes.add(parent.sibling); + } else if (!parent.parent && parent.sibling && gos.get("grandTotalRow")) { + refreshNodes.add(parent.sibling); + } else { + refreshNodes.add(parent); + } + parent = parent.parent; + } + for (const node of updatedNodes) { + this.dispatchEditValuesChanged({ rowNode: node, column }, edit); + } + for (const node of updatedNodes) { + _getCellCtrl(beans, { rowNode: node, column })?.refreshCell(params); + } + for (const node of refreshNodes) { + const cellCtrl = _getCellCtrl(beans, { rowNode: node, column }); + if (cellCtrl) { + cellCtrl.refreshCell(params); + if (!params.force && this.batch) { + cellCtrl.editStyleFeature?.applyCellStyles?.(); + } + } + } + } + stopAllEditing(cancel = false, source = "ui") { + if (this.isEditing()) { + this.stopEditing(undefined, { cancel, source }); + } + } + isCellEditable(position, source = "ui") { + const { gos, beans } = this; + const rowNode = position.rowNode; + if (rowNode.group && position.column.getColDef().groupRowEditable == null) { + if (gos.get("treeData")) { + if (!rowNode.data && !gos.get("enableGroupEdit")) { + return false; + } + } else if (!gos.get("enableGroupEdit")) { + return false; + } + } + const isEditable = getEditType(gos) === "fullRow" ? isFullRowCellEditable(beans, position, source) : isCellEditable(beans, position); + if (isEditable) { + this.strategy ?? (this.strategy = this.createStrategy()); + } + return isEditable; + } + cellEditingInvalidCommitBlocks() { + return this.gos.get("invalidEditValueMode") === "block"; + } + checkNavWithValidation(position, event, focus = true) { + if (this.hasValidationErrors(position)) { + const cellCtrl = _getCellCtrl(this.beans, position); + if (this.cellEditingInvalidCommitBlocks()) { + event?.preventDefault?.(); + if (focus) { + if (cellCtrl && !cellCtrl.hasBrowserFocus()) { + cellCtrl.focusCell(); + } + cellCtrl?.comp?.getCellEditor()?.focusIn?.(); + } + return "block-stop"; + } + if (cellCtrl) { + this.revertSingleCellEdit(cellCtrl); + } + return "revert-continue"; + } + return "continue"; + } + revertSingleCellEdit(cellPosition, focus = false) { + const cellCtrl = _getCellCtrl(this.beans, cellPosition); + if (!cellCtrl?.comp?.getCellEditor()) { + return; + } + _destroyEditors(this.beans, [cellPosition], { silent: true }); + this.model.clearEditValue(cellPosition); + _setupEditor(this.beans, cellPosition, { silent: true }); + _populateModelValidationErrors(this.beans); + cellCtrl?.refreshCell(FORCE_REFRESH); + if (!focus) { + return; + } + cellCtrl?.focusCell(); + cellCtrl?.comp?.getCellEditor()?.focusIn?.(); + } + hasValidationErrors(position) { + _populateModelValidationErrors(this.beans); + const cellCtrl = _getCellCtrl(this.beans, position); + if (cellCtrl) { + cellCtrl.refreshCell(FORCE_REFRESH); + cellCtrl.rowCtrl.rowEditStyleFeature?.applyRowStyles(); + } + let invalid = false; + if (position?.rowNode) { + invalid || (invalid = this.model.getRowValidationModel().hasRowValidation({ rowNode: position.rowNode })); + if (position.column) { + invalid || (invalid = this.model.getCellValidationModel().hasCellValidation({ rowNode: position.rowNode, column: position.column })); + } + } else { + invalid || (invalid = this.model.getCellValidationModel().getCellValidationMap().size > 0); + invalid || (invalid = this.model.getRowValidationModel().getRowValidationMap().size > 0); + } + return invalid; + } + moveToNextCell(prev, backwards, event, source = "ui") { + let res; + const editing = this.isEditing(); + const preventNavigation = editing && this.checkNavWithValidation(undefined, event) === "block-stop"; + if (prev instanceof CellCtrl && editing) { + res = this.strategy?.moveToNextEditingCell(prev, backwards, event, source, preventNavigation); + } + if (res === null) { + return res; + } + res = res || !!this.beans.focusSvc.focusedHeader; + if (res === false && !preventNavigation) { + this.stopEditing(); + } + return res; + } + getPendingEditValue(rowNode, column, from) { + if (from === "data") { + return; + } + if (from === "batch" && !this.batch) { + return; + } + const edit = this.model.getEdit({ rowNode, column }, CHECK_SIBLING); + if (!edit) { + return; + } + if (this.stopping && !this.batch && !edit.editorState?.cellStartedEditing) { + return; + } + if (from === "edit") { + const editorValue = edit.editorValue; + if (editorValue != null && editorValue !== UNEDITED) { + return editorValue; + } + } + const pendingValue = edit.pendingValue; + if (pendingValue !== UNEDITED) { + return pendingValue; + } + return; + } + getCellDataValue(position) { + const edit = this.model.getEdit(position, CHECK_SIBLING); + if (edit) { + const newValue = edit.pendingValue; + if (newValue !== UNEDITED) { + return newValue; + } + const sourceValue = edit.sourceValue; + if (sourceValue != null) { + return sourceValue; + } + } + return this.valueSvc.getValue(position.column, position.rowNode, "data"); + } + addStopEditingWhenGridLosesFocus(viewports) { + _addStopEditingWhenGridLosesFocus(this, this.beans, viewports); + } + createPopupEditorWrapper(params) { + return new PopupEditorWrapper(params); + } + batchResetToSourceValue(position) { + if (!this.batch) { + return false; + } + const existing = this.model.getEdit(position); + if (!existing) { + return false; + } + const { pendingValue, sourceValue, state } = existing; + if (pendingValue === sourceValue) { + return false; + } + if (state === "editing") { + return false; + } + this.dispatchEditValuesChanged(position, { ...existing, pendingValue: sourceValue }); + this.beans.editModelSvc?.removeEdits(position); + _getCellCtrl(this.beans, position)?.refreshCell(FORCE_REFRESH); + return true; + } + setDataValue(position, newValue, eventSource) { + try { + const batch = this.batch; + const editing = this.isEditing(batch ? undefined : position); + if ((!editing || this.committing) && !batch && !SET_DATA_SOURCE_AS_API.has(eventSource)) { + return; + } + if (!editing && !batch && eventSource === "paste") { + return; + } + if (eventSource === "batch" && !batch) { + return; + } + if (eventSource === "edit") { + if (editing && this.applyEditorValue(position, newValue)) { + return true; + } + if (!batch) { + return; + } + } + this.strategy ?? (this.strategy = this.createStrategy()); + if (eventSource === "batch" || eventSource === "edit") { + return this.applyDirectValue(position, newValue, eventSource); + } + const beans = this.beans; + let source; + if (batch) { + source = "ui"; + } else if (this.committing) { + source = eventSource ?? "api"; + } else { + source = "api"; + } + if (!eventSource || KEEP_EDITOR_SOURCES.has(eventSource)) { + return this.applyDirectValue(position, newValue, eventSource); + } + const result = this.applyExistingEdit(position, newValue, eventSource, source); + if (result !== undefined) { + return result; + } + _syncFromEditor(beans, position, newValue, eventSource, undefined, { persist: true }); + this.ensureBatchStarted(); + this.stopEditing(position, { + source, + suppressNavigateAfterEdit: true + }); + return true; + } finally { + this.committing = false; + } + } + applyExistingEdit(position, newValue, eventSource, source) { + const existing = this.model.getEdit(position); + if (!existing) { + return; + } + if (existing.pendingValue === newValue) { + return false; + } + if (existing.sourceValue !== newValue) { + _syncFromEditor(this.beans, position, newValue, eventSource, undefined, { persist: true }); + this.ensureBatchStarted(); + this.stopEditing(position, { + source, + suppressNavigateAfterEdit: true + }); + return true; + } + this.beans.editModelSvc?.removeEdits(position); + this.ensureBatchStarted(); + this.dispatchEditValuesChanged(position, { + ...existing, + pendingValue: newValue + }); + return true; + } + applyEditorValue(position, newValue) { + const beans = this.beans; + const cellCtrl = _getCellCtrl(beans, position); + const editor = cellCtrl?.comp?.getCellEditor(); + if (!cellCtrl || !editor) { + return false; + } + _syncFromEditor(beans, position, newValue, "edit", undefined, { persist: true }); + cellCtrl.editStyleFeature?.applyCellStyles?.(); + if ("agSetEditValue" in editor) { + editor.agSetEditValue(newValue); + return true; + } + if (editor.refresh && cellCtrl.editCompDetails) { + editor.refresh({ ...cellCtrl.editCompDetails.params, value: newValue }); + return true; + } + const restoreFocus = cellCtrl.hasBrowserFocus(); + if (restoreFocus) { + cellCtrl.onEditorAttachedFuncs.push(() => { + const latestCellCtrl = _getCellCtrl(this.beans, position); + latestCellCtrl?.focusCell(true); + latestCellCtrl?.comp?.getCellEditor()?.focusIn?.(); + }); + } + _destroyEditors(beans, [position], { silent: true, cancel: true }); + _setupEditor(beans, position, { silent: true }); + _populateModelValidationErrors(beans); + _getCellCtrl(beans, position)?.refreshCell(FORCE_REFRESH); + return true; + } + applyDirectValue(position, newValue, eventSource) { + const beans = this.beans; + if (this.batch) { + if (eventSource === "batch" && _getCellCtrl(beans, position)?.comp?.getCellEditor()) { + const { editModelSvc, valueSvc } = beans; + const { rowNode, column } = position; + const existingEdit = editModelSvc?.getEdit(position); + if (existingEdit?.sourceValue === undefined) { + editModelSvc?.setEdit(position, { + sourceValue: valueSvc.getValue(column, rowNode, "data") + }); + } + editModelSvc?.setEdit(position, { pendingValue: newValue }); + } else { + _syncFromEditor(beans, position, newValue, eventSource, undefined, { persist: true }); + if (eventSource !== "batch") { + this.cleanupEditors(); + } + } + _purgeUnchangedEdits(beans); + this.ensureBatchStarted(); + this.bulkRefreshCell(position); + return true; + } + _syncFromEditor(beans, position, newValue, eventSource, undefined, { persist: true }); + const cellCtrl = _getCellCtrl(beans, position); + const success = this.setNodeDataValue(position.rowNode, position.column, newValue, cellCtrl, eventSource); + this.syncEditAfterCommit(position, success); + _purgeUnchangedEdits(beans); + _getCellCtrl(beans, position)?.refreshCell(success ? FORCE_REFRESH_FLASH : FORCE_REFRESH); + return success; + } + handleColDefChanged(cellCtrl) { + _refreshEditorOnColDefChanged(this.beans, cellCtrl); + } + destroy() { + this.model.clear(); + this.destroyStrategy(); + super.destroy(); + } + prepDetailsDuringBatch(position, params) { + const { model } = this; + if (!this.batch) { + return; + } + const hasEdits = model.hasRowEdits(position.rowNode, CHECK_SIBLING); + if (!hasEdits) { + return; + } + const { rowNode } = position; + const { compDetails, valueToDisplay } = params; + if (compDetails) { + const { params: params2 } = compDetails; + params2.data = model.getEditRowDataValue(rowNode, CHECK_SIBLING); + return { compDetails }; + } + return { valueToDisplay }; + } + cleanupEditors() { + this.strategy?.cleanupEditors(); + } + dispatchCellEvent(position, event, type, payload) { + this.strategy?.dispatchCellEvent(position, event, type, payload); + } + dispatchBatchEvent(type, edits) { + this.eventSvc.dispatchEvent(this.createBatchEditEvent(type, edits)); + } + createBatchEditEvent(type, edits) { + return _addGridCommonParams(this.gos, { + type, + ...type === "batchEditingStopped" ? { + changes: this.toEventChangeList(edits) + } : {} + }); + } + toEventChangeList(edits) { + return this.model.getEditPositions(edits).map((edit) => ({ + rowIndex: edit.rowNode.rowIndex, + rowPinned: edit.rowNode.rowPinned, + columnId: edit.column.getColId(), + newValue: edit.pendingValue, + oldValue: edit.sourceValue + })); + } + applyBulkEdit({ rowNode, column }, ranges) { + if (!ranges || ranges.length === 0) { + return; + } + const { beans, rangeSvc, valueSvc } = this; + const { formula } = beans; + _syncFromEditors(beans, { persist: true }); + const edits = this.model.getEditMap(true); + let editValue = edits.get(rowNode)?.get(column)?.pendingValue; + let bulkStartDispatched = false; + if (!this.batch) { + this.eventSvc.dispatchEvent({ type: "bulkEditingStarted" }); + bulkStartDispatched = true; + } + const isFormula = formula?.isFormula(editValue) ?? false; + ranges.forEach((range) => { + const hasFormulaColumnsInRange = range.columns.some((col) => col?.isAllowFormula()); + rangeSvc?.forEachRowInRange(range, (position) => { + const rowNode2 = _getRowNode(beans, position); + if (rowNode2 === undefined) { + return; + } + const editRow = edits.get(rowNode2) ?? /* @__PURE__ */ new Map; + let valueForColumn = editValue; + for (const column2 of range.columns) { + if (!column2) { + continue; + } + const isFormulaForColumn = !!isFormula && column2.isAllowFormula(); + if (this.isCellEditable({ rowNode: rowNode2, column: column2 }, "api")) { + const sourceValue = valueSvc.getValue(column2, rowNode2, "data", true); + let pendingValue = valueSvc.parseValue(column2, rowNode2 ?? null, valueForColumn, sourceValue); + if (Number.isNaN(pendingValue)) { + pendingValue = null; + } + editRow.set(column2, { + editorValue: undefined, + pendingValue, + sourceValue, + state: "changed", + editorState: { + isCancelAfterEnd: undefined, + isCancelBeforeStart: undefined + } + }); + } + if (isFormulaForColumn) { + valueForColumn = formula?.updateFormulaByOffset({ value: valueForColumn, columnDelta: 1 }); + } + } + if (editRow.size > 0) { + edits.set(rowNode2, editRow); + } + if (isFormula && hasFormulaColumnsInRange) { + editValue = formula?.updateFormulaByOffset({ value: editValue, rowDelta: 1 }); + } + }); + this.setEditMap(edits); + if (this.batch) { + this.cleanupEditors(); + _purgeUnchangedEdits(beans); + this.ensureBatchStarted(); + return; + } + this.committing = true; + try { + this.stopEditing(undefined, { source: "bulk" }); + } finally { + this.committing = false; + if (bulkStartDispatched) { + this.eventSvc.dispatchEvent({ type: "bulkEditingStopped", changes: this.toEventChangeList(edits) }); + } + } + }); + const cellCtrl = _getCellCtrl(beans, { rowNode, column }); + if (cellCtrl) { + cellCtrl.focusCell(true); + } + } + createCellStyleFeature(cellCtrl) { + return new CellEditStyleFeature(cellCtrl, this.beans); + } + createRowStyleFeature(rowCtrl) { + return new RowEditStyleFeature(rowCtrl, this.beans); + } + setEditingCells(cells, params) { + const { beans } = this; + const { colModel, valueSvc } = beans; + const edits = /* @__PURE__ */ new Map; + for (let { colId, column, colKey, rowIndex, rowPinned, newValue: pendingValue, state } of cells) { + const col = colId ? colModel.getCol(colId) : colKey ? colModel.getCol(colKey) : column; + if (!col) { + continue; + } + const rowNode = _getRowNode(beans, { rowIndex, rowPinned }); + if (!rowNode) { + continue; + } + const sourceValue = valueSvc.getValue(col, rowNode, "data", true); + if (!params?.forceRefreshOfEditCellsOnly && !_sourceAndPendingDiffer({ pendingValue, sourceValue }) && state !== "editing") { + continue; + } + let editRow = edits.get(rowNode); + if (!editRow) { + editRow = /* @__PURE__ */ new Map; + edits.set(rowNode, editRow); + } + if (pendingValue === undefined) { + pendingValue = UNEDITED; + } + editRow.set(col, { + editorValue: undefined, + pendingValue, + sourceValue, + state: state ?? "changed", + editorState: { + isCancelAfterEnd: undefined, + isCancelBeforeStart: undefined + } + }); + } + this.setEditMap(edits, params); + } + onCellFocused(event) { + const cellCtrl = _getCellCtrl(this.beans, event); + if (!cellCtrl || !this.isEditing(cellCtrl, CHECK_SIBLING)) { + return; + } + const edit = this.model.getEdit(cellCtrl); + if (!edit || !_sourceAndPendingDiffer(edit)) { + return; + } + const translate = this.getLocaleTextFunc(); + const label = translate("ariaPendingChange", "Pending Change"); + this.beans.ariaAnnounce?.announceValue(label, "pendingChange"); + } + allowedFocusTargetOnValidation(cellPosition) { + return _getCellCtrl(this.beans, cellPosition); + } +}; +function getRowColumnsFromMap(edits) { + return { + rowNodes: edits ? Array.from(edits.keys()) : undefined, + columns: edits ? [...new Set(Array.from(edits.values()).flatMap((er) => Array.from(er.keys())))] : undefined + }; +} +function getEditType(gos, editType) { + return editType ?? gos.get("editType") ?? "singleCell"; +} +var BaseEditStrategy = class extends BeanStub { + postConstruct() { + this.model = this.beans.editModelSvc; + this.editSvc = this.beans.editSvc; + this.addManagedEventListeners({ + cellFocused: this.onCellFocusChanged?.bind(this), + cellFocusCleared: this.onCellFocusChanged?.bind(this) + }); + } + clearEdits(position) { + this.model.clearEditValue(position); + } + onCellFocusChanged(event) { + let cellCtrl; + const previous = event["previousParams"]; + const { editSvc, beans } = this; + const sourceEvent = event.type === "cellFocused" ? event.sourceEvent : null; + if (previous) { + cellCtrl = _getCellCtrl(beans, previous); + } + const { gos, editModelSvc } = beans; + const isFocusCleared = event.type === "cellFocusCleared"; + if (editSvc.isEditing(undefined, { withOpenEditor: true })) { + const { column, rowIndex, rowPinned } = event; + const cellPositionFromEvent = { + column, + rowNode: _getRowNode(beans, { rowIndex, rowPinned }) + }; + const isBlock = gos.get("invalidEditValueMode") === "block"; + if (isBlock) { + return; + } + const shouldRevert = !isBlock; + const hasError = !!editModelSvc?.getCellValidationModel().hasCellValidation(cellPositionFromEvent); + const shouldCancel = shouldRevert && hasError; + const result = previous || isFocusCleared ? editSvc.stopEditing(undefined, { + cancel: shouldCancel, + source: isFocusCleared && shouldRevert ? "api" : undefined, + event: sourceEvent + }) : true; + if (!result) { + if (editSvc.isBatchEditing()) { + editSvc.cleanupEditors(); + } else { + editSvc.stopEditing(undefined, { source: "api" }); + } + } + } + cellCtrl?.refreshCell({ suppressFlash: true, force: true }); + } + stopCancelled(forceCancel) { + const preserveBatch = this.editSvc.isBatchEditing() && !forceCancel; + for (const cell of this.model.getEditPositions()) { + _destroyEditor(this.beans, cell, { cancel: true }, _getCellCtrl(this.beans, cell)); + this.model.stop(cell, preserveBatch, true); + } + return true; + } + stopCommitted(event, commit) { + const editingCells = this.model.getEditPositions(); + const results = { all: [], pass: [], fail: [] }; + for (const cell of editingCells) { + results.all.push(cell); + if ((this.model.getCellValidationModel().getCellValidation(cell)?.errorMessages?.length ?? 0) > 0) { + results.fail.push(cell); + } else { + results.pass.push(cell); + } + } + const actions = this.processValidationResults(results); + const preserveBatch = this.editSvc.isBatchEditing() && !commit; + for (const cell of actions.destroy) { + _destroyEditor(this.beans, cell, { event }, _getCellCtrl(this.beans, cell)); + this.model.stop(cell, preserveBatch, false); + } + for (const cell of actions.keep) { + const cellCtrl = _getCellCtrl(this.beans, cell); + if (!this.editSvc.cellEditingInvalidCommitBlocks() && cellCtrl) { + this.editSvc.revertSingleCellEdit(cellCtrl); + } + } + return true; + } + cleanupEditors({ rowNode } = {}, includeEditing) { + _syncFromEditors(this.beans, { persist: false }); + const positions = this.model.getEditPositions(); + const discard = []; + if (rowNode) { + for (const pos of positions) { + if (pos.rowNode !== rowNode) { + discard.push(pos); + } + } + } else { + for (const pos of positions) { + discard.push(pos); + } + } + _destroyEditors(this.beans, discard); + _purgeUnchangedEdits(this.beans, includeEditing); + } + setFocusOutOnEditor(cellCtrl) { + cellCtrl.comp?.getCellEditor()?.focusOut?.(); + } + setFocusInOnEditor(cellCtrl) { + const comp = cellCtrl.comp; + const editor = comp?.getCellEditor(); + if (editor?.focusIn) { + editor.focusIn(); + } else { + const isFullRow = this.beans.gos.get("editType") === "fullRow"; + cellCtrl.focusCell(isFullRow); + cellCtrl.onEditorAttachedFuncs.push(() => comp?.getCellEditor()?.focusIn?.()); + } + } + setupEditors(params) { + const { event, ignoreEventKey = false, startedEdit, position, cells = this.model.getEditPositions() } = params; + const key = event instanceof KeyboardEvent && !ignoreEventKey && event.key || undefined; + _setupEditors(this.beans, cells, position, key, event, startedEdit); + } + dispatchCellEvent(position, event, type, payload) { + const cellCtrl = _getCellCtrl(this.beans, position); + if (cellCtrl) { + this.eventSvc.dispatchEvent({ ...cellCtrl.createEvent(event ?? null, type), ...payload }); + } + } + dispatchRowEvent(position, type, silent) { + if (silent) { + return; + } + const rowCtrl = _getRowCtrl(this.beans, position); + if (rowCtrl) { + this.eventSvc.dispatchEvent(rowCtrl.createRowEvent(type)); + } + } + shouldStop(_position, event, source = "ui") { + const batch = this.editSvc.isBatchEditing(); + if (batch && source === "api") { + return true; + } + if (batch && (source === "ui" || source === "edit")) { + return false; + } + if (source === "api") { + return true; + } + if (event instanceof KeyboardEvent && !batch) { + return event.key === KeyCode.ENTER; + } + return null; + } + shouldCancel(_position, event, source = "ui") { + const batch = this.editSvc.isBatchEditing(); + if (event instanceof KeyboardEvent && !batch) { + const result = event.key === KeyCode.ESCAPE; + if (result) { + return true; + } + } + if (batch && source === "api") { + return true; + } + if (source === "api") { + return true; + } + return false; + } + setEditMap(edits, params) { + if (!params?.update) { + this.editSvc.stopEditing(undefined, { cancel: true, source: "api" }); + } + const cells = []; + edits.forEach((editRow, rowNode) => { + editRow.forEach((cellData, column) => { + if (cellData.state === "editing") { + cells.push({ ...cellData, rowNode, column }); + } + }); + }); + if (params?.update) { + edits = new Map([...this.model.getEditMap(), ...edits]); + } + this.model?.setEditMap(edits); + if (cells.length > 0) { + const position = cells.at(-1); + const key = position.pendingValue === UNEDITED ? undefined : position.pendingValue; + this.start({ position, event: new KeyboardEvent("keydown", { key }), source: "api" }); + const cellCtrl = _getCellCtrl(this.beans, position); + if (cellCtrl) { + this.setFocusInOnEditor(cellCtrl); + } + } + } + destroy() { + this.cleanupEditors(); + super.destroy(); + } +}; +var FullRowEditStrategy = class extends BaseEditStrategy { + constructor() { + super(...arguments); + this.beanName = "fullRow"; + this.startedRows = /* @__PURE__ */ new Set; + } + shouldStop(position, event, _source = "ui") { + const { rowNode: currentRowNode, beans } = this; + const { rowNode } = position || {}; + const oldRowCtrl = _getRowCtrl(beans, { rowNode: currentRowNode }); + if (!oldRowCtrl) { + return true; + } + const res = super.shouldStop({ rowNode: currentRowNode }, event, _source); + if (res !== null) { + return res; + } + if (!currentRowNode) { + return false; + } + return rowNode !== currentRowNode; + } + midBatchInputsAllowed({ rowNode }) { + if (!rowNode) { + return false; + } + return this.model.hasEdits({ rowNode }); + } + clearEdits(position) { + this.model.clearEditValue(position); + } + start(params) { + const { position, silent, startedEdit, event, ignoreEventKey } = params; + const { rowNode } = position; + const { beans, model, startedRows } = this; + if (this.rowNode !== rowNode) { + super.cleanupEditors(position); + } + const columns = beans.visibleCols.allCols; + const cells = []; + const editableColumns = []; + for (const column of columns) { + if (column.isCellEditable(rowNode)) { + editableColumns.push(column); + } + } + if (editableColumns.length == 0) { + return; + } + if (!startedRows.has(rowNode)) { + this.dispatchRowEvent({ rowNode }, "rowEditingStarted", silent); + startedRows.add(rowNode); + } + for (const column of editableColumns) { + const position2 = { + rowNode, + column + }; + cells.push(position2); + model.start(position2); + } + this.rowNode = rowNode; + this.setupEditors({ cells, position, startedEdit, event, ignoreEventKey }); + } + processValidationResults(results) { + const anyFailed = results.fail.length > 0; + if (anyFailed && this.editSvc.cellEditingInvalidCommitBlocks()) { + return { + destroy: [], + keep: results.all + }; + } + return { + destroy: results.all, + keep: [] + }; + } + stopCancelled(forceCancel) { + const { rowNode, model } = this; + if (rowNode && !model.hasRowEdits(rowNode)) { + return false; + } + super.stopCancelled(forceCancel); + this.cleanupEditors({ rowNode }, true); + this.rowNode = undefined; + return true; + } + stopCommitted(event, commit) { + const { rowNode, beans, model, editSvc } = this; + if (rowNode && !model.hasRowEdits(rowNode)) { + return false; + } + const changedRows = []; + model.getEditMap().forEach((rowEdits, rowNode2) => { + if (!rowEdits || rowEdits.size === 0) { + return; + } + for (const edit of rowEdits.values()) { + if (_sourceAndPendingDiffer(edit)) { + changedRows.push(rowNode2); + break; + } + } + }); + _populateModelValidationErrors(beans); + if (editSvc.checkNavWithValidation({ rowNode }) === "block-stop") { + return false; + } + super.stopCommitted(event, commit); + if (commit || !editSvc.isBatchEditing()) { + for (const rowNode2 of changedRows) { + this.dispatchRowEvent({ rowNode: rowNode2 }, "rowValueChanged"); + } + } + this.cleanupEditors({ rowNode }, true); + this.rowNode = undefined; + return true; + } + onCellFocusChanged(event) { + const { rowIndex } = event; + const prev = event["previousParams"]; + if (prev?.rowIndex === rowIndex || event.sourceEvent instanceof KeyboardEvent) { + return; + } + const { beans, gos, model } = this; + if (beans.editSvc?.isRangeSelectionEnabledWhileEditing()) { + return; + } + const prevCell = _getCellCtrl(beans, prev); + const isBlock = gos.get("invalidEditValueMode") === "block"; + if (isBlock && prevCell && (model.getCellValidationModel().getCellValidation(prevCell) || model.getRowValidationModel().getRowValidation(prevCell))) { + return; + } + super.onCellFocusChanged(event); + } + cleanupEditors(position = {}, includeEditing) { + super.cleanupEditors(position, includeEditing); + const { startedRows } = this; + for (const rowNode of startedRows) { + this.dispatchRowEvent({ rowNode }, "rowEditingStopped"); + this.destroyEditorsForRow(rowNode); + } + startedRows.clear(); + } + destroyEditorsForRow(rowNode) { + const rowCtrl = _getRowCtrl(this.beans, { rowNode }); + if (!rowCtrl) { + return; + } + const destroyParams = {}; + for (const cellCtrl of rowCtrl.getAllCellCtrls()) { + if (cellCtrl.comp?.getCellEditor()) { + _destroyEditor(this.beans, cellCtrl, destroyParams, cellCtrl); + } + } + } + moveToNextEditingCell(prevCell, backwards, event, source = "ui", preventNavigation = false) { + const { beans, model, gos, editSvc } = this; + const prevPos = prevCell.cellPosition; + let nextCell; + model.suspend(true); + try { + nextCell = beans.navigation?.findNextCellToFocusOn(prevPos, { + backwards, + startEditing: true, + skipToNextEditableCell: false + }); + } finally { + model.suspend(false); + } + if (nextCell === false) { + return null; + } + if (nextCell == null) { + return false; + } + const nextPos = nextCell.cellPosition; + const prevEditable = prevCell.isCellEditable(); + const nextEditable = nextCell.isCellEditable(); + const rowsMatch = nextPos && prevPos.rowIndex === nextPos.rowIndex && prevPos.rowPinned === nextPos.rowPinned; + if (prevEditable) { + this.setFocusOutOnEditor(prevCell); + } + this.restoreEditors(); + const suppressStartEditOnTab = gos.get("suppressStartEditOnTab"); + if (nextEditable && !preventNavigation) { + if (suppressStartEditOnTab) { + nextCell.focusCell(true, event); + } else { + if (!nextCell.comp?.getCellEditor()) { + _setupEditor(beans, nextCell, { event, cellStartedEdit: true }); + } + this.setFocusInOnEditor(nextCell); + nextCell.focusCell(false, event); + } + } else { + if (nextEditable && preventNavigation) { + this.setFocusInOnEditor(nextCell); + } + nextCell.focusCell(true, event); + } + if (!rowsMatch && !preventNavigation) { + editSvc?.stopEditing({ rowNode: prevCell.rowNode }, { event, forceStop: true }); + if (editSvc?.isRowEditing(prevCell.rowNode, { withOpenEditor: true })) { + this.cleanupEditors(nextCell, true); + } + if (suppressStartEditOnTab) { + nextCell.focusCell(true, event); + } else { + editSvc.startEditing(nextCell, { + startedEdit: true, + event, + source, + ignoreEventKey: true, + editable: nextEditable || undefined + }); + } + } + prevCell.rowCtrl?.refreshRow({ suppressFlash: true, force: true }); + return true; + } + restoreEditors() { + const { beans, model } = this; + model.getEditMap().forEach((rowEdits, rowNode) => rowEdits.forEach(({ state }, column) => { + if (state !== "editing") { + return; + } + const cellCtrl = _getCellCtrl(beans, { + rowNode, + column + }); + if (cellCtrl && !cellCtrl.comp?.getCellEditor()) { + _setupEditor(beans, cellCtrl, { silent: true }); + } + })); + } + destroy() { + super.destroy(); + this.rowNode = undefined; + this.startedRows.clear(); + } +}; +var SingleCellEditStrategy = class extends BaseEditStrategy { + constructor() { + super(...arguments); + this.beanName = "singleCell"; + } + shouldStop(position, event, source = "ui") { + const res = super.shouldStop(position, event, source); + if (res !== null) { + return res; + } + const rowNode = position?.rowNode; + const column = position?.column; + const trackedRowNode = this.rowNode; + const trackedColumn = this.column; + if ((!trackedRowNode || !trackedColumn) && rowNode && column) { + return null; + } + if (trackedRowNode !== rowNode || trackedColumn !== column) { + return true; + } + if (!trackedRowNode && !trackedColumn) { + return this.model.hasEdits(undefined, { withOpenEditor: true }); + } + return false; + } + midBatchInputsAllowed(position) { + return this.model.hasEdits(position); + } + start(params) { + const { position, startedEdit, event, ignoreEventKey } = params; + if (this.rowNode !== position.rowNode || this.column !== position.column) { + super.cleanupEditors(); + } + this.rowNode = position.rowNode; + this.column = position.column; + this.model.start(position); + this.setupEditors({ cells: [position], position, startedEdit, event, ignoreEventKey }); + } + dispatchRowEvent(_position, _type, _silent) {} + processValidationResults(results) { + const anyFailed = results.fail.length > 0; + if (anyFailed && this.editSvc.cellEditingInvalidCommitBlocks()) { + return { + destroy: [], + keep: results.all + }; + } + return { + destroy: results.all, + keep: [] + }; + } + stopCancelled(forceCancel) { + super.stopCancelled(forceCancel); + return this.clearPosition(); + } + stopCommitted(event, commit) { + super.stopCommitted(event, commit); + return this.clearPosition(); + } + clearPosition() { + this.rowNode = undefined; + this.column = undefined; + return true; + } + onCellFocusChanged(event) { + const { colModel, editSvc } = this.beans; + const { rowIndex, column, rowPinned } = event; + const rowNode = _getRowNode(this.beans, { rowIndex, rowPinned }); + const curColId = _getColId(column); + const curCol = colModel.getCol(curColId); + const previous = event["previousParams"]; + if (previous) { + const prevColId = _getColId(previous.column); + if (previous?.rowIndex === rowIndex && prevColId === curColId && previous?.rowPinned === rowPinned) { + return; + } + } + if (event.type == "cellFocused" && (editSvc?.isRangeSelectionEnabledWhileEditing() || editSvc?.isEditing({ rowNode, column: curCol }, { withOpenEditor: true }))) { + return; + } + super.onCellFocusChanged(event); + } + moveToNextEditingCell(prevCell, backwards, event, source = "ui", preventNavigation = false) { + const focusedCell = this.beans.focusSvc.getFocusedCell(); + if (focusedCell) { + prevCell = _getCellByPosition(this.beans, focusedCell) ?? prevCell; + } + const prevPos = prevCell.cellPosition; + let nextCell; + const shouldSuspend = this.beans.gos.get("editType") === "fullRow"; + if (shouldSuspend) { + this.model.suspend(true); + } + if (!preventNavigation) { + prevCell.eGui.focus(); + this.editSvc?.stopEditing(prevCell, { source: this.editSvc?.isBatchEditing() ? "ui" : "api", event }); + } + try { + nextCell = this.beans.navigation?.findNextCellToFocusOn(prevPos, { + backwards, + startEditing: true + }); + } finally { + if (shouldSuspend) { + this.model.suspend(false); + } + } + if (nextCell === false) { + return null; + } + if (nextCell == null) { + return false; + } + const nextPos = nextCell.cellPosition; + const prevEditable = prevCell.isCellEditable(); + const nextEditable = nextCell.isCellEditable(); + const rowsMatch = nextPos && prevPos.rowIndex === nextPos.rowIndex && prevPos.rowPinned === nextPos.rowPinned; + if (prevEditable && !preventNavigation) { + this.setFocusOutOnEditor(prevCell); + } + const suppressStartEditOnTab = this.gos.get("suppressStartEditOnTab"); + let startEditingCalled = false; + if (!rowsMatch && !preventNavigation) { + super.cleanupEditors(nextCell, true); + if (suppressStartEditOnTab) { + nextCell.focusCell(true, event); + } else { + startEditingCalled = true; + this.editSvc.startEditing(nextCell, { + startedEdit: true, + event, + source, + ignoreEventKey: true, + editable: nextEditable + }); + } + } + if (nextEditable && !preventNavigation) { + nextCell.focusCell(false, event); + if (suppressStartEditOnTab) { + nextCell.focusCell(true, event); + } else if (!nextCell.comp?.getCellEditor()) { + if (!startEditingCalled) { + const alreadyEditing = this.editSvc?.isEditing(nextCell, { withOpenEditor: true }); + _setupEditor(this.beans, nextCell, { event, cellStartedEdit: true, silent: alreadyEditing }); + } + this.setFocusInOnEditor(nextCell); + this.cleanupEditors(nextCell); + } + } else { + if (nextEditable && preventNavigation) { + this.setFocusInOnEditor(nextCell); + } + nextCell.focusCell(true, event); + } + prevCell.rowCtrl?.refreshRow({ suppressFlash: true, force: true }); + return true; + } + destroy() { + super.destroy(); + this.rowNode = undefined; + this.column = undefined; + } +}; +var EditCoreModule = { + moduleName: "EditCore", + version: VERSION, + beans: [EditModelService, EditService], + apiFunctions: { + getEditingCells, + getEditRowValues, + getCellEditorInstances, + startEditingCell, + stopEditing, + isEditing, + validateEdit + }, + dynamicBeans: { + singleCell: SingleCellEditStrategy, + fullRow: FullRowEditStrategy + }, + dependsOn: [PopupModule, TooltipModule], + css: [cell_editing_default] +}; +var TextEditorModule = { + moduleName: "TextEditor", + version: VERSION, + userComponents: { agCellEditor: TextCellEditor, agTextCellEditor: TextCellEditor }, + dependsOn: [EditCoreModule] +}; +var FILTER_HANDLER_MAP = { + agSetColumnFilter: "agSetColumnFilterHandler", + agMultiColumnFilter: "agMultiColumnFilterHandler", + agGroupColumnFilter: "agGroupColumnFilterHandler", + agNumberColumnFilter: "agNumberColumnFilterHandler", + agBigIntColumnFilter: "agBigIntColumnFilterHandler", + agDateColumnFilter: "agDateColumnFilterHandler", + agTextColumnFilter: "agTextColumnFilterHandler" +}; +var FILTER_HANDLERS = new Set(Object.values(FILTER_HANDLER_MAP)); +function getFilterUiFromWrapper(filterWrapper, skipCreate) { + const filterUi = filterWrapper.filterUi; + if (!filterUi) { + return null; + } + if (filterUi.created) { + return filterUi.promise; + } + if (skipCreate) { + return null; + } + const promise = filterUi.create(filterUi.refreshed); + const createdFilterUi = filterUi; + createdFilterUi.created = true; + createdFilterUi.promise = promise; + return promise; +} +function _refreshHandlerAndUi(getFilterUi, handler, handlerParams, model, state, source, additionalEventAttributes) { + handler.refresh?.({ ...handlerParams, model, source, additionalEventAttributes }); + return getFilterUi().then((filterUi) => { + if (filterUi) { + const { filter, filterParams } = filterUi; + _refreshFilterUi(filter, filterParams, model, state, source, additionalEventAttributes); + } + }); +} +function _refreshFilterUi(filter, filterParams, model, state, source, additionalEventAttributes) { + filter?.refresh?.({ + ...filterParams, + model, + state, + source, + additionalEventAttributes + }); +} +function getAndRefreshFilterUi(getFilterUi, getModel, getState2, additionalEventAttributes) { + const filterUi = getFilterUi(); + if (filterUi?.created) { + filterUi.promise.then((filter) => { + const model = getModel(); + _refreshFilterUi(filter, filterUi.filterParams, model, getState2() ?? { model }, "ui", additionalEventAttributes); + }); + } +} +function _updateFilterModel(params) { + let state; + let shouldUpdateModel = false; + let model; + const { action, filterParams, getFilterUi, getModel, getState: getState2, updateState, updateModel, processModelToApply } = params; + switch (action) { + case "apply": { + const oldState = getState2(); + model = oldState?.model ?? null; + if (processModelToApply) { + model = processModelToApply(model); + } + state = { + state: oldState?.state, + model + }; + shouldUpdateModel = true; + break; + } + case "clear": { + state = { + model: null + }; + if (!filterParams?.buttons?.includes("apply")) { + shouldUpdateModel = true; + model = null; + } + break; + } + case "reset": { + state = { + model: null + }; + shouldUpdateModel = true; + model = null; + break; + } + case "cancel": { + state = { + model: getModel() + }; + break; + } + } + updateState(state); + if (shouldUpdateModel) { + updateModel(model); + } else { + getAndRefreshFilterUi(getFilterUi, getModel, getState2, { fromAction: action }); + } +} +function _getFilterModel(model, colId) { + return model[colId] ?? null; +} +var HeaderFilterCellCtrl = class extends AbstractHeaderCellCtrl { + constructor() { + super(...arguments); + this.iconCreated = false; + } + wireComp(comp, eGui, eButtonShowMainFilter, eFloatingFilterBody, compBeanInput) { + this.comp = comp; + const compBean = setupCompBean(this, this.beans.context, compBeanInput); + this.eButtonShowMainFilter = eButtonShowMainFilter; + this.eFloatingFilterBody = eFloatingFilterBody; + this.setGui(eGui, compBean); + this.setupActive(); + this.refreshHeaderStyles(); + this.setupWidth(compBean); + this.setupLeft(compBean); + this.setupHover(compBean); + this.setupFocus(compBean); + this.setupAria(); + this.setupFilterButton(); + this.setupUserComp(); + this.setupSyncWithFilter(compBean); + this.setupUi(); + compBean.addManagedElementListeners(this.eButtonShowMainFilter, { click: this.showParentFilter.bind(this) }); + this.setupFilterChangedListener(compBean); + const colDefChanged = () => this.onColDefChanged(compBean); + compBean.addManagedListeners(this.column, { colDefChanged }); + compBean.addManagedEventListeners({ + filterSwitched: ({ column }) => { + if (column === this.column) { + colDefChanged(); + } + } + }); + compBean.addDestroyFunc(() => { + this.eButtonShowMainFilter = null; + this.eFloatingFilterBody = null; + this.userCompDetails = null; + this.clearComponent(); + }); + } + resizeHeader() {} + moveHeader() {} + getHeaderClassParams() { + const { column, beans } = this; + const colDef = column.colDef; + return _addGridCommonParams(beans.gos, { + colDef, + column, + floatingFilter: true + }); + } + setupActive() { + const colDef = this.column.getColDef(); + const filterExists = !!colDef.filter; + const floatingFilterExists = !!colDef.floatingFilter; + this.active = filterExists && floatingFilterExists; + } + setupUi() { + 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); + if (!this.active || this.iconCreated) { + return; + } + const eMenuIcon = _createIconNoSpan("filter", this.beans, this.column); + if (eMenuIcon) { + this.iconCreated = true; + this.eButtonShowMainFilter.appendChild(eMenuIcon); + } + } + setupFocus(compBean) { + compBean.createManagedBean(new ManagedFocusFeature(this.eGui, { + shouldStopEventPropagation: this.shouldStopEventPropagation.bind(this), + onTabKeyDown: this.onTabKeyDown.bind(this), + handleKeyDown: this.handleKeyDown.bind(this), + onFocusIn: this.onFocusIn.bind(this) + })); + } + setupAria() { + const localeTextFunc = this.getLocaleTextFunc(); + _setAriaLabel(this.eButtonShowMainFilter, localeTextFunc("ariaFilterMenuOpen", "Open Filter Menu")); + } + onTabKeyDown(e) { + const { beans } = this; + const activeEl = _getActiveDomElement(beans); + const wrapperHasFocus = activeEl === this.eGui; + if (wrapperHasFocus) { + return; + } + const nextFocusableEl = _findNextFocusableElement(beans, this.eGui, null, e.shiftKey); + if (nextFocusableEl) { + beans.headerNavigation?.scrollToColumn(this.column); + e.preventDefault(); + nextFocusableEl.focus(); + return; + } + const nextFocusableColumn = this.findNextColumnWithFloatingFilter(e.shiftKey); + if (!nextFocusableColumn) { + return; + } + if (beans.focusSvc.focusHeaderPosition({ + headerPosition: { + headerRowIndex: this.rowCtrl.rowIndex, + column: nextFocusableColumn + }, + event: e + })) { + e.preventDefault(); + } + } + findNextColumnWithFloatingFilter(backwards) { + const presentedColsService = this.beans.visibleCols; + let nextCol = this.column; + do { + nextCol = backwards ? presentedColsService.getColBefore(nextCol) : presentedColsService.getColAfter(nextCol); + if (!nextCol) { + break; + } + } while (!nextCol.getColDef().filter || !nextCol.getColDef().floatingFilter); + return nextCol; + } + handleKeyDown(e) { + super.handleKeyDown(e); + const wrapperHasFocus = this.getWrapperHasFocus(); + switch (e.key) { + case KeyCode.UP: + case KeyCode.DOWN: + case KeyCode.LEFT: + case KeyCode.RIGHT: + if (wrapperHasFocus) { + return; + } + _stopPropagationForAgGrid(e); + case KeyCode.ENTER: + if (wrapperHasFocus) { + if (_focusInto(this.eGui)) { + e.preventDefault(); + } + } + break; + case KeyCode.ESCAPE: + if (!wrapperHasFocus) { + this.eGui.focus(); + } + } + } + onFocusIn(e) { + const isRelatedWithin = this.eGui.contains(e.relatedTarget); + if (isRelatedWithin) { + return; + } + const notFromHeaderWrapper = !!e.relatedTarget && !e.relatedTarget.classList.contains("ag-floating-filter"); + const fromWithinHeader = !!e.relatedTarget && _isElementChildOfClass(e.relatedTarget, "ag-floating-filter"); + if (notFromHeaderWrapper && fromWithinHeader && e.target === this.eGui) { + const lastFocusEvent = this.lastFocusEvent; + const fromTab = !!(lastFocusEvent && lastFocusEvent.key === KeyCode.TAB); + if (lastFocusEvent && fromTab) { + const shouldFocusLast = lastFocusEvent.shiftKey; + _focusInto(this.eGui, shouldFocusLast); + } + } + this.focusThis(); + } + setupHover(compBean) { + this.beans.colHover?.addHeaderFilterColumnHoverListener(compBean, this.comp, this.column, this.eGui); + } + setupLeft(compBean) { + const setLeftFeature = new SetLeftFeature(this.column, this.eGui, this.beans); + compBean.createManagedBean(setLeftFeature); + } + setupFilterButton() { + this.suppressFilterButton = !this.beans.menuSvc?.isFloatingFilterButtonEnabled(this.column); + this.highlightFilterButtonWhenActive = !_isLegacyMenuEnabled(this.gos); + } + setupUserComp() { + if (!this.active) { + return; + } + const compDetails = this.beans.colFilter?.getFloatingFilterCompDetails(this.column, () => this.showParentFilter()); + if (compDetails) { + this.setCompDetails(compDetails); + } + } + setCompDetails(compDetails) { + this.userCompDetails = compDetails; + this.comp.setCompDetails(compDetails); + } + showParentFilter() { + const eventSource = this.suppressFilterButton ? this.eFloatingFilterBody : this.eButtonShowMainFilter; + this.beans.menuSvc?.showFilterMenu({ + column: this.column, + buttonElement: eventSource, + containerType: "floatingFilter", + positionBy: "button" + }); + } + setupSyncWithFilter(compBean) { + if (!this.active) { + return; + } + const { + beans: { colFilter }, + column, + gos + } = this; + const syncWithFilter = (event) => { + if (event?.source === "filterDestroyed" && (!this.isAlive() || !colFilter?.isAlive())) { + return; + } + const compPromise = this.comp.getFloatingFilterComp(); + if (!compPromise) { + return; + } + compPromise.then((comp) => { + if (comp) { + if (gos.get("enableFilterHandlers")) { + const eventWithParams = event; + let source = "filter"; + if (eventWithParams?.afterFloatingFilter) { + source = "ui"; + } else if (eventWithParams?.afterDataChange) { + source = "dataChanged"; + } else if (event?.source === "api") { + source = "api"; + } + this.updateFloatingFilterParams(this.userCompDetails, source); + return; + } + const parentModel = colFilter?.getCurrentFloatingFilterParentModel(column); + const filterChangedEvent = event ? { + ...event, + columns: event.columns ?? [], + source: event.source === "api" ? "api" : "columnFilter" + } : null; + comp.onParentModelChanged(parentModel, filterChangedEvent); + } + }); + }; + [this.destroySyncListener] = compBean.addManagedListeners(column, { filterChanged: syncWithFilter }); + if (colFilter?.isFilterActive(column)) { + syncWithFilter(null); + } + } + setupWidth(compBean) { + const listener = () => { + const width = `${this.column.getActualWidth()}px`; + this.comp.setWidth(width); + }; + compBean.addManagedListeners(this.column, { widthChanged: listener }); + listener(); + } + setupFilterChangedListener(compBean) { + if (this.active) { + [this.destroyFilterChangedListener] = compBean.addManagedListeners(this.column, { + filterChanged: this.updateFilterButton.bind(this) + }); + this.updateFilterButton(); + } + } + updateFilterButton() { + if (!this.suppressFilterButton && this.comp) { + const isFilterAllowed = !!this.beans.filterManager?.isFilterAllowed(this.column); + this.comp.setButtonWrapperDisplayed(isFilterAllowed); + if (this.highlightFilterButtonWhenActive && isFilterAllowed) { + this.eButtonShowMainFilter.classList.toggle("ag-filter-active", this.column.isFilterActive()); + } + } + } + onColDefChanged(compBean) { + const wasActive = this.active; + this.setupActive(); + const becomeActive = !wasActive && this.active; + if (wasActive && !this.active) { + this.destroySyncListener(); + this.destroyFilterChangedListener(); + } + const colFilter = this.beans.colFilter; + const newCompDetails = this.active ? colFilter?.getFloatingFilterCompDetails(this.column, () => this.showParentFilter()) : null; + const compPromise = this.comp.getFloatingFilterComp(); + if (!compPromise || !newCompDetails) { + this.updateCompDetails(compBean, newCompDetails, becomeActive); + } else { + compPromise.then((compInstance) => { + if (!compInstance || colFilter?.areFilterCompsDifferent(this.userCompDetails ?? null, newCompDetails)) { + this.updateCompDetails(compBean, newCompDetails, becomeActive); + } else { + this.updateFloatingFilterParams(newCompDetails, "colDef"); + } + }); + } + } + updateCompDetails(compBean, compDetails, becomeActive) { + if (!this.isAlive()) { + return; + } + this.setCompDetails(compDetails); + this.setupFilterButton(); + this.setupUi(); + if (becomeActive) { + this.setupSyncWithFilter(compBean); + this.setupFilterChangedListener(compBean); + } + } + updateFloatingFilterParams(userCompDetails, source) { + if (!userCompDetails) { + return; + } + let params = userCompDetails.params; + this.comp.getFloatingFilterComp()?.then((floatingFilter) => { + if (typeof floatingFilter?.refresh === "function") { + if (this.gos.get("enableFilterHandlers")) { + params = { + ...params, + model: _getFilterModel(this.beans.colFilter?.model ?? {}, this.column.getColId()), + source + }; + } + floatingFilter.refresh(params); + } + }); + } + addResizeAndMoveKeyboardListeners() {} + destroy() { + super.destroy(); + this.destroySyncListener = null; + this.destroyFilterChangedListener = null; + } +}; +function showColumnMenu(beans, colKey) { + const column = beans.colModel.getCol(colKey); + if (!column) { + _error(12, { colKey }); + return; + } + beans.menuSvc?.showColumnMenu({ + column, + positionBy: "auto" + }); +} +function hidePopupMenu(beans) { + beans.menuSvc?.hidePopupMenu(); +} +var MenuService = class extends BeanStub { + constructor() { + super(...arguments); + this.beanName = "menuSvc"; + } + postConstruct() { + const { enterpriseMenuFactory, filterMenuFactory } = this.beans; + this.activeMenuFactory = enterpriseMenuFactory ?? filterMenuFactory; + } + showColumnMenu(params) { + this.showColumnMenuCommon(this.activeMenuFactory, params, "columnMenu"); + } + showFilterMenu(params) { + this.showColumnMenuCommon(getFilterMenuFactory(this.beans), params, params.containerType, true); + } + showHeaderContextMenu(column, mouseEvent, touchEvent) { + this.activeMenuFactory?.showMenuAfterContextMenuEvent(column, mouseEvent, touchEvent); + } + hidePopupMenu() { + this.beans.contextMenuSvc?.hideActiveMenu(); + this.activeMenuFactory?.hideActiveMenu(); + } + hideFilterMenu() { + getFilterMenuFactory(this.beans)?.hideActiveMenu(); + } + isColumnMenuInHeaderEnabled(column) { + const { suppressHeaderMenuButton } = column.getColDef(); + return !suppressHeaderMenuButton && !!this.activeMenuFactory?.isMenuEnabled(column) && (_isLegacyMenuEnabled(this.gos) || !!this.beans.enterpriseMenuFactory); + } + isFilterMenuInHeaderEnabled(column) { + return !column.getColDef().suppressHeaderFilterButton && !!this.beans.filterManager?.isFilterAllowed(column); + } + isHeaderContextMenuEnabled(column) { + const colDef = column && isColumn(column) ? column.getColDef() : column?.getColGroupDef(); + return !colDef?.suppressHeaderContextMenu && this.gos.get("columnMenu") === "new"; + } + isHeaderMenuButtonAlwaysShowEnabled() { + return this.isSuppressMenuHide(); + } + isHeaderMenuButtonEnabled() { + const menuHides = !this.isSuppressMenuHide(); + const onIpadAndMenuHides = _isIOSUserAgent() && menuHides; + return !onIpadAndMenuHides; + } + isHeaderFilterButtonEnabled(column) { + return this.isFilterMenuInHeaderEnabled(column) && !_isLegacyMenuEnabled(this.gos) && !this.isFloatingFilterButtonDisplayed(column); + } + isFilterMenuItemEnabled(column) { + return !!this.beans.filterManager?.isFilterAllowed(column) && !_isLegacyMenuEnabled(this.gos) && !this.isFilterMenuInHeaderEnabled(column) && !this.isFloatingFilterButtonDisplayed(column); + } + isFloatingFilterButtonEnabled(column) { + return !column.getColDef().suppressFloatingFilterButton; + } + isFloatingFilterButtonDisplayed(column) { + return !!column.getColDef().floatingFilter && this.isFloatingFilterButtonEnabled(column); + } + isSuppressMenuHide() { + const gos = this.gos; + const suppressMenuHide = gos.get("suppressMenuHide"); + if (_isLegacyMenuEnabled(gos)) { + return gos.exists("suppressMenuHide") ? suppressMenuHide : false; + } + return suppressMenuHide; + } + showColumnMenuCommon(menuFactory, params, containerType, filtersOnly) { + const { positionBy, onClosedCallback } = params; + const column = params.column; + if (positionBy === "button") { + const { buttonElement } = params; + menuFactory?.showMenuAfterButtonClick(column, buttonElement, containerType, onClosedCallback, filtersOnly); + } else if (positionBy === "mouse") { + const { mouseEvent } = params; + menuFactory?.showMenuAfterMouseEvent(column, mouseEvent, containerType, onClosedCallback, filtersOnly); + } else if (column) { + const beans = this.beans; + const ctrlsSvc = beans.ctrlsSvc; + ctrlsSvc.getScrollFeature().ensureColumnVisible(column, "auto"); + _requestAnimationFrame(beans, () => { + const headerCellCtrl = ctrlsSvc.getHeaderRowContainerCtrl(column.getPinned())?.getHeaderCtrlForColumn(column); + if (headerCellCtrl) { + menuFactory?.showMenuAfterButtonClick(column, headerCellCtrl.getAnchorElementForMenu(filtersOnly), containerType, onClosedCallback, filtersOnly); + } + }); + } + } +}; +function _setColMenuVisible(column, visible, source) { + if (column.menuVisible !== visible) { + column.menuVisible = visible; + column.dispatchColEvent("menuVisibleChanged", source); + } +} +function getFilterMenuFactory(beans) { + const { enterpriseMenuFactory, filterMenuFactory, gos } = beans; + return enterpriseMenuFactory && _isLegacyMenuEnabled(gos) ? enterpriseMenuFactory : filterMenuFactory; +} +var SharedMenuModule = { + moduleName: "SharedMenu", + version: VERSION, + beans: [MenuService], + apiFunctions: { + showColumnMenu, + hidePopupMenu + } +}; +var column_filters_default = ".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 isColumnFilterPresent(beans) { + const filterManager = beans.filterManager; + return !!filterManager?.isColumnFilterPresent() || !!filterManager?.isAggregateFilterPresent(); +} +function getColumnFilterInstance(beans, key) { + return beans.filterManager?.getColumnFilterInstance(key) ?? Promise.resolve(undefined); +} +function destroyFilter(beans, key) { + const column = beans.colModel.getColDefCol(key); + if (column) { + return beans.colFilter?.destroyFilter(column, "api"); + } +} +function setFilterModel(beans, model) { + beans.frameworkOverrides.wrapIncoming(() => beans.filterManager?.setFilterModel(model)); +} +function getFilterModel(beans) { + return beans.filterManager?.getFilterModel() ?? {}; +} +function getColumnFilterModel(beans, key, useUnapplied) { + const { gos, colModel, colFilter } = beans; + if (useUnapplied && !gos.get("enableFilterHandlers")) { + _warn(288); + useUnapplied = false; + } + const column = colModel.getColDefCol(key); + return column ? colFilter?.getModelForColumn(column, useUnapplied) ?? null : null; +} +function setColumnFilterModel(beans, column, model) { + return beans.filterManager?.setColumnFilterModel(column, model) ?? Promise.resolve(); +} +function showColumnFilter(beans, colKey) { + const column = beans.colModel.getCol(colKey); + if (!column) { + _error(12, { colKey }); + return; + } + beans.menuSvc?.showFilterMenu({ + column, + containerType: "columnFilter", + positionBy: "auto" + }); +} +function hideColumnFilter(beans) { + beans.menuSvc?.hideFilterMenu(); +} +function getColumnFilterHandler(beans, colKey) { + const column = beans.colModel.getCol(colKey); + if (!column) { + _error(12, { colKey }); + return; + } + return beans.colFilter?.getHandler(column, true); +} +function doFilterAction(beans, params) { + const { colModel, colFilter, gos } = beans; + if (!gos.get("enableFilterHandlers")) { + _warn(287); + return; + } + const { colId, action } = params; + if (colId) { + const column = colModel.getColById(colId); + if (column) { + colFilter?.updateModel(column, action); + } + } else { + colFilter?.updateAllModels(action); + } +} +var MONTH_LOCALE_TEXT = { + january: "January", + february: "February", + march: "March", + april: "April", + may: "May", + june: "June", + july: "July", + august: "August", + september: "September", + october: "October", + november: "November", + december: "December" +}; +var MONTH_KEYS = [ + "january", + "february", + "march", + "april", + "may", + "june", + "july", + "august", + "september", + "october", + "november", + "december" +]; +function setFilterNumberComparator(a, b) { + if (a == null) { + return -1; + } + if (b == null) { + return 1; + } + return Number.parseFloat(a) - Number.parseFloat(b); +} +function setFilterBigIntComparator(a, b) { + if (a == null) { + return -1; + } + if (b == null) { + return 1; + } + const valueA = _parseBigIntOrNull(a); + const valueB = _parseBigIntOrNull(b); + if (valueA != null && valueB != null) { + if (valueA === valueB) { + return 0; + } + return valueA > valueB ? 1 : -1; + } + return String(a).localeCompare(String(b)); +} +function isValidDate(value) { + return value instanceof Date && !isNaN(value.getTime()); +} +var filterParamsForEachDataType = { + number: () => { + return; + }, + bigint: () => { + return; + }, + boolean: () => ({ + maxNumConditions: 1, + debounceMs: 0, + filterOptions: [ + "empty", + { + displayKey: "true", + displayName: "True", + predicate: (_filterValues, cellValue) => cellValue, + numberOfInputs: 0 + }, + { + displayKey: "false", + displayName: "False", + predicate: (_filterValues, cellValue) => cellValue === false, + numberOfInputs: 0 + } + ] + }), + date: () => ({ isValidDate }), + dateString: ({ dataTypeDefinition }) => ({ + comparator: (filterDate, cellValue) => { + const cellAsDate = dataTypeDefinition.dateParser(cellValue); + if (cellValue == null || cellAsDate < filterDate) { + return -1; + } + if (cellAsDate > filterDate) { + return 1; + } + return 0; + }, + isValidDate: (value) => typeof value === "string" && isValidDate(dataTypeDefinition.dateParser(value)) + }), + dateTime: (args) => filterParamsForEachDataType.date(args), + dateTimeString: (args) => filterParamsForEachDataType.dateString(args), + object: () => { + return; + }, + text: () => { + return; + } +}; +var setFilterParamsForEachDataType = { + number: () => ({ comparator: setFilterNumberComparator }), + bigint: () => ({ comparator: setFilterBigIntComparator }), + boolean: ({ t }) => ({ + valueFormatter: (params) => _exists(params.value) ? t(String(params.value), params.value ? "True" : "False") : t("blanks", "(Blanks)") + }), + date: ({ formatValue, t }) => ({ + valueFormatter: (params) => { + const valueFormatted = formatValue(params); + return _exists(valueFormatted) ? valueFormatted : t("blanks", "(Blanks)"); + }, + treeList: true, + treeListFormatter: (pathKey, level) => { + if (pathKey === "NaN") { + return t("invalidDate", "Invalid Date"); + } + if (level === 1 && pathKey != null) { + const monthKey = MONTH_KEYS[Number(pathKey) - 1]; + return t(monthKey, MONTH_LOCALE_TEXT[monthKey]); + } + return pathKey ?? t("blanks", "(Blanks)"); + }, + treeListPathGetter: (date) => _getDateParts(date, false) + }), + dateString: ({ formatValue, dataTypeDefinition, t }) => ({ + valueFormatter: (params) => { + const valueFormatted = formatValue(params); + return _exists(valueFormatted) ? valueFormatted : t("blanks", "(Blanks)"); + }, + treeList: true, + treeListPathGetter: (value) => _getDateParts(dataTypeDefinition.dateParser(value ?? undefined), false), + treeListFormatter: (pathKey, level) => { + if (level === 1 && pathKey != null) { + const monthKey = MONTH_KEYS[Number(pathKey) - 1]; + return t(monthKey, MONTH_LOCALE_TEXT[monthKey]); + } + return pathKey ?? t("blanks", "(Blanks)"); + } + }), + dateTime: (args) => { + const params = setFilterParamsForEachDataType.date(args); + params.treeListPathGetter = _getDateParts; + return params; + }, + dateTimeString(args) { + const convertToDate = args.dataTypeDefinition.dateParser; + const params = setFilterParamsForEachDataType.dateString(args); + params.treeListPathGetter = (value) => _getDateParts(convertToDate(value ?? undefined)); + return params; + }, + object: ({ formatValue, t }) => ({ + valueFormatter: (params) => { + const valueFormatted = formatValue(params); + return _exists(valueFormatted) ? valueFormatted : t("blanks", "(Blanks)"); + } + }), + text: () => { + return; + } +}; +function _getFilterParamsForDataType(filter, existingFilterParams, existingFilterValueGetter, dataTypeDefinition, formatValue, beans, translate) { + let filterParams = existingFilterParams; + let filterValueGetter = existingFilterValueGetter; + const usingSetFilter = filter === "agSetColumnFilter"; + if (!filterValueGetter && dataTypeDefinition.baseDataType === "object" && !usingSetFilter) { + filterValueGetter = ({ column, node }) => formatValue({ column, node, value: beans.valueSvc.getValue(column, node, "data") }); + } + const filterParamsMap = usingSetFilter ? setFilterParamsForEachDataType : filterParamsForEachDataType; + const filterParamsGetter = filterParamsMap[dataTypeDefinition.baseDataType]; + const newFilterParams = filterParamsGetter({ dataTypeDefinition, formatValue, t: translate }); + filterParams = typeof existingFilterParams === "object" ? { + ...newFilterParams, + ...existingFilterParams + } : newFilterParams; + return { filterParams, filterValueGetter }; +} +var defaultFilters = { + boolean: "agTextColumnFilter", + date: "agDateColumnFilter", + dateString: "agDateColumnFilter", + dateTime: "agDateColumnFilter", + dateTimeString: "agDateColumnFilter", + bigint: "agBigIntColumnFilter", + number: "agNumberColumnFilter", + object: "agTextColumnFilter", + text: "agTextColumnFilter" +}; +var defaultFloatingFilters = { + boolean: "agTextColumnFloatingFilter", + date: "agDateColumnFloatingFilter", + dateString: "agDateColumnFloatingFilter", + dateTime: "agDateColumnFloatingFilter", + dateTimeString: "agDateColumnFloatingFilter", + bigint: "agBigIntColumnFloatingFilter", + number: "agNumberColumnFloatingFilter", + object: "agTextColumnFloatingFilter", + text: "agTextColumnFloatingFilter" +}; +function _getDefaultSimpleFilter(cellDataType, isFloating = false) { + const filterSet = isFloating ? defaultFloatingFilters : defaultFilters; + return filterSet[cellDataType ?? "text"]; +} +function _getDefaultFloatingFilterType(frameworkOverrides, def, getFromDefault) { + if (def == null) { + return null; + } + let defaultFloatingFilterType = null; + const { compName, jsComp, fwComp } = _getFilterCompKeys(frameworkOverrides, def); + if (compName) { + const floatingFilterTypeMap = { + agSetColumnFilter: "agSetColumnFloatingFilter", + agMultiColumnFilter: "agMultiColumnFloatingFilter", + agGroupColumnFilter: "agGroupColumnFloatingFilter", + agNumberColumnFilter: "agNumberColumnFloatingFilter", + agBigIntColumnFilter: "agBigIntColumnFloatingFilter", + agDateColumnFilter: "agDateColumnFloatingFilter", + agTextColumnFilter: "agTextColumnFloatingFilter" + }; + defaultFloatingFilterType = floatingFilterTypeMap[compName]; + } else { + const usingDefaultFilter = jsComp == null && fwComp == null && def.filter === true; + if (usingDefaultFilter) { + defaultFloatingFilterType = getFromDefault(); + } + } + return defaultFloatingFilterType; +} +var DUMMY_HANDLER = { + filterHandler: () => ({ + doesFilterPass: () => true + }) +}; +function isAggFilter(column, isPivotMode, isPivotActive, groupFilterEnabled) { + const isSecondary = !column.isPrimary(); + if (isSecondary) { + return true; + } + const isShowingPrimaryColumns = !isPivotActive; + const isValueActive = column.isValueActive(); + if (!isValueActive || !isShowingPrimaryColumns) { + return false; + } + if (isPivotMode) { + return true; + } + return groupFilterEnabled; +} +var ColumnFilterService = class extends BeanStub { + constructor() { + super(...arguments); + this.beanName = "colFilter"; + this.allColumnFilters = /* @__PURE__ */ new Map; + this.allColumnListeners = /* @__PURE__ */ new Map; + this.activeAggregateFilters = []; + this.activeColumnFilters = []; + this.processingFilterChange = false; + this.modelUpdates = []; + this.columnModelUpdates = []; + this.state = /* @__PURE__ */ new Map; + this.handlerMap = { + ...FILTER_HANDLER_MAP + }; + this.isGlobalButtons = false; + this.activeFilterComps = /* @__PURE__ */ new Set; + } + postConstruct() { + this.addManagedEventListeners({ + gridColumnsChanged: this.onColumnsChanged.bind(this), + dataTypesInferred: this.processFilterModelUpdateQueue.bind(this) + }); + this.addManagedPropertyListener("pivotMode", this.onPivotModeChanged.bind(this)); + const gos = this.gos; + const initialFilterModel = { + ...gos.get("initialState")?.filter?.filterModel ?? {} + }; + this.initialModel = initialFilterModel; + this.model = { + ...initialFilterModel + }; + if (!gos.get("enableFilterHandlers")) { + delete this.handlerMap["agMultiColumnFilter"]; + } + } + refreshModel() { + this.onNewRowsLoaded("rowDataUpdated"); + } + setModel(model, source = "api", forceUpdateActive) { + const { colModel, dataTypeSvc, filterManager } = this.beans; + if (dataTypeSvc?.isPendingInference) { + this.modelUpdates.push({ model, source }); + return; + } + const allPromises = []; + const previousModel = this.getModel(true); + if (model) { + const modelKeys = new Set(Object.keys(model)); + this.allColumnFilters.forEach((filterWrapper, colId) => { + const newModel = model[colId]; + allPromises.push(this.setModelOnFilterWrapper(filterWrapper, newModel)); + modelKeys.delete(colId); + }); + modelKeys.forEach((colId) => { + const column = colModel.getColDefCol(colId) || colModel.getCol(colId); + if (!column) { + _warn(62, { colId }); + return; + } + if (!column.isFilterAllowed()) { + _warn(63, { colId }); + return; + } + const filterWrapper = this.getOrCreateFilterWrapper(column, true); + if (!filterWrapper) { + _warn(64, { colId }); + return; + } + allPromises.push(this.setModelOnFilterWrapper(filterWrapper, model[colId], true)); + }); + } else { + this.model = {}; + this.allColumnFilters.forEach((filterWrapper) => { + allPromises.push(this.setModelOnFilterWrapper(filterWrapper, null)); + }); + } + AgPromise.all(allPromises).then(() => { + const currentModel = this.getModel(true); + const columns = []; + this.allColumnFilters.forEach((filterWrapper, colId) => { + const before = previousModel ? previousModel[colId] : null; + const after = currentModel ? currentModel[colId] : null; + if (!_jsonEquals(before, after)) { + columns.push(filterWrapper.column); + } + }); + if (columns.length > 0) { + filterManager?.onFilterChanged({ columns, source }); + } else if (forceUpdateActive) { + this.updateActive("filterChanged"); + } + }); + } + getModel(excludeInitialState) { + const result = {}; + const { + allColumnFilters, + initialModel, + beans: { colModel } + } = this; + allColumnFilters.forEach((filterWrapper, key) => { + const model = this.getModelFromFilterWrapper(filterWrapper); + if (_exists(model)) { + result[key] = model; + } + }); + if (!excludeInitialState) { + for (const colId of Object.keys(initialModel)) { + const model = initialModel[colId]; + if (_exists(model) && !allColumnFilters.has(colId) && colModel.getCol(colId)?.isFilterAllowed()) { + result[colId] = model; + } + } + } + return result; + } + setState(model, state, source = "api") { + this.state.clear(); + if (state) { + for (const colId of Object.keys(state)) { + const newState = state[colId]; + this.state.set(colId, { + model: _getFilterModel(this.model, colId), + state: newState + }); + } + } + this.setModel(model, source, true); + } + getState() { + const state = this.state; + if (!state.size) { + return; + } + const newState = {}; + let hasNewState = false; + state.forEach((colState, colId) => { + const actualState = colState.state; + if (actualState != null) { + hasNewState = true; + newState[colId] = actualState; + } + }); + return hasNewState ? newState : undefined; + } + getModelFromFilterWrapper(filterWrapper) { + const column = filterWrapper.column; + const colId = column.getColId(); + if (filterWrapper.isHandler) { + return _getFilterModel(this.model, colId); + } + const filter = filterWrapper.filter; + if (filter) { + if (typeof filter.getModel !== "function") { + _warn(66); + return null; + } + return filter.getModel(); + } + return _getFilterModel(this.initialModel, colId); + } + isFilterPresent() { + return this.activeColumnFilters.length > 0; + } + isAggFilterPresent() { + return !!this.activeAggregateFilters.length; + } + disableFilters() { + this.initialModel = {}; + const { allColumnFilters } = this; + if (allColumnFilters.size) { + allColumnFilters.forEach((filterWrapper) => this.disposeFilterWrapper(filterWrapper, "advancedFilterEnabled")); + return true; + } + return false; + } + updateActiveFilters() { + const isFilterActive = (filter) => { + if (!filter) { + return false; + } + if (!filter.isFilterActive) { + _warn(67); + return false; + } + return filter.isFilterActive(); + }; + const { colModel, gos } = this.beans; + const groupFilterEnabled = !!_getGroupAggFiltering(gos); + const activeAggregateFilters = []; + const activeColumnFilters = []; + const addFilter = (column, filterActive, doesFilterPassWrapper) => { + if (filterActive) { + if (isAggFilter(column, colModel.isPivotMode(), colModel.isPivotActive(), groupFilterEnabled)) { + activeAggregateFilters.push(doesFilterPassWrapper); + } else { + activeColumnFilters.push(doesFilterPassWrapper); + } + } + }; + const promises = []; + this.allColumnFilters.forEach((filterWrapper) => { + const column = filterWrapper.column; + const colId = column.getColId(); + if (filterWrapper.isHandler) { + promises.push(AgPromise.resolve().then(() => { + addFilter(column, this.isHandlerActive(column), { + colId, + isHandler: true, + handler: filterWrapper.handler, + handlerParams: filterWrapper.handlerParams + }); + })); + } else { + const promise = getFilterUiFromWrapper(filterWrapper); + if (promise) { + promises.push(promise.then((filter) => { + addFilter(column, isFilterActive(filter), { + colId, + isHandler: false, + comp: filter + }); + })); + } + } + }); + return AgPromise.all(promises).then(() => { + this.activeAggregateFilters = activeAggregateFilters; + this.activeColumnFilters = activeColumnFilters; + }); + } + updateFilterFlagInColumns(source, additionalEventAttributes) { + const promises = []; + this.allColumnFilters.forEach((filterWrapper) => { + const column = filterWrapper.column; + if (filterWrapper.isHandler) { + promises.push(AgPromise.resolve().then(() => { + this.setColFilterActive(column, this.isHandlerActive(column), source, additionalEventAttributes); + })); + } else { + const promise = getFilterUiFromWrapper(filterWrapper); + if (promise) { + promises.push(promise.then((filter) => { + this.setColFilterActive(column, filter.isFilterActive(), source, additionalEventAttributes); + })); + } + } + }); + this.beans.groupFilter?.updateFilterFlags(source, additionalEventAttributes); + return AgPromise.all(promises); + } + doFiltersPass(node, colIdToSkip, targetAggregates) { + const { data, aggData } = node; + const targetedFilters = targetAggregates ? this.activeAggregateFilters : this.activeColumnFilters; + const targetedData = targetAggregates ? aggData : data; + const model = this.model; + for (let i = 0;i < targetedFilters.length; i++) { + const filter = targetedFilters[i]; + const { colId, isHandler } = filter; + if (colId === colIdToSkip) { + continue; + } + if (isHandler) { + const { handler, handlerParams } = filter; + if (!handler.doesFilterPass({ + node, + data: targetedData, + model: _getFilterModel(model, colId), + handlerParams + })) { + return false; + } + } else { + const comp = filter.comp; + if (typeof comp.doesFilterPass !== "function") { + _error(91); + continue; + } + if (!comp.doesFilterPass({ node, data: targetedData })) { + return false; + } + } + } + return true; + } + getHandlerParams(column) { + const wrapper = this.allColumnFilters.get(column.getColId()); + return wrapper?.isHandler ? wrapper.handlerParams : undefined; + } + callOnFilterChangedOutsideRenderCycle(params) { + const { rowRenderer, filterManager } = this.beans; + const action = () => { + if (this.isAlive()) { + filterManager?.onFilterChanged(params); + } + }; + if (rowRenderer.isRefreshInProgress()) { + setTimeout(action, 0); + } else { + action(); + } + } + updateBeforeFilterChanged(params = {}) { + const { column, additionalEventAttributes } = params; + const colId = column?.getColId(); + return this.updateActiveFilters().then(() => this.updateFilterFlagInColumns("filterChanged", additionalEventAttributes).then(() => { + this.allColumnFilters.forEach((filterWrapper) => { + const { column: filterColumn, isHandler } = filterWrapper; + if (colId === filterColumn.getColId()) { + return; + } + if (isHandler) { + filterWrapper.handler.onAnyFilterChanged?.(); + } + getFilterUiFromWrapper(filterWrapper, isHandler)?.then((filter) => { + if (typeof filter?.onAnyFilterChanged === "function") { + filter.onAnyFilterChanged(); + } + }); + }); + this.processingFilterChange = true; + })); + } + updateAfterFilterChanged() { + this.processingFilterChange = false; + } + isSuppressFlashingCellsBecauseFiltering() { + const allowShowChangeAfterFilter = this.gos.get("allowShowChangeAfterFilter") ?? false; + return !allowShowChangeAfterFilter && this.processingFilterChange; + } + onNewRowsLoaded(source) { + const promises = []; + this.allColumnFilters.forEach((filterWrapper) => { + const isHandler = filterWrapper.isHandler; + if (isHandler) { + filterWrapper.handler.onNewRowsLoaded?.(); + } + const promise = getFilterUiFromWrapper(filterWrapper, isHandler); + if (promise) { + promises.push(promise.then((filter) => { + filter.onNewRowsLoaded?.(); + })); + } + }); + AgPromise.all(promises).then(() => this.updateActive(source, { afterDataChange: true })); + } + updateActive(source, additionalEventAttributes) { + this.updateFilterFlagInColumns(source, additionalEventAttributes).then(() => this.updateActiveFilters()); + } + createGetValue(filterColumn, filterValueGetterOverride) { + const { filterValueSvc, colModel } = this.beans; + return (rowNode, column) => { + const columnToUse = column ? colModel.getCol(column) : filterColumn; + return columnToUse ? filterValueSvc.getValue(columnToUse, rowNode, filterValueGetterOverride) : undefined; + }; + } + isFilterActive(column) { + const filterWrapper = this.cachedFilter(column); + if (filterWrapper?.isHandler) { + return this.isHandlerActive(column); + } + const filter = filterWrapper?.filter; + if (filter) { + return filter.isFilterActive(); + } + return _getFilterModel(this.initialModel, column.getColId()) != null; + } + isHandlerActive(column) { + const active = _exists(_getFilterModel(this.model, column.getColId())); + if (active) { + return active; + } + const groupFilter = this.beans.groupFilter; + return groupFilter?.isGroupFilter(column) ? groupFilter.isFilterActive(column) : false; + } + getOrCreateFilterUi(column) { + const filterWrapper = this.getOrCreateFilterWrapper(column, true); + return filterWrapper ? getFilterUiFromWrapper(filterWrapper) : null; + } + getFilterUiForDisplay(column) { + const filterWrapper = this.getOrCreateFilterWrapper(column, true); + if (!filterWrapper) { + return null; + } + const compPromise = getFilterUiFromWrapper(filterWrapper); + if (!compPromise) { + return null; + } + return compPromise.then((comp) => ({ + comp, + params: filterWrapper.filterUi.filterParams, + isHandler: filterWrapper.isHandler + })); + } + getHandler(column, createIfMissing) { + const filterWrapper = this.getOrCreateFilterWrapper(column, createIfMissing); + return filterWrapper?.isHandler ? filterWrapper.handler : undefined; + } + getOrCreateFilterWrapper(column, createIfMissing) { + if (!column.isFilterAllowed()) { + return; + } + let filterWrapper = this.cachedFilter(column); + if (!filterWrapper && createIfMissing) { + filterWrapper = this.createFilterWrapper(column); + this.setColumnFilterWrapper(column, filterWrapper); + } + return filterWrapper; + } + cachedFilter(column) { + return this.allColumnFilters.get(column.getColId()); + } + getDefaultFilter(column, isFloating = false) { + return this.getDefaultFilterFromDataType(() => this.beans.dataTypeSvc?.getBaseDataType(column), isFloating); + } + getDefaultFilterFromDataType(getCellDataType, isFloating = false) { + if (_isSetFilterByDefault(this.gos)) { + return isFloating ? "agSetColumnFloatingFilter" : "agSetColumnFilter"; + } + return _getDefaultSimpleFilter(getCellDataType(), isFloating); + } + getDefaultFloatingFilter(column) { + return this.getDefaultFilter(column, true); + } + createFilterComp(column, filterDef, defaultFilter, getFilterParams, isHandler, source) { + const createFilterCompDetails = () => { + const params = this.createFilterCompParams(column, isHandler, source); + const updatedParams = getFilterParams(params, isHandler); + return _getFilterDetails(this.beans.userCompFactory, filterDef, updatedParams, defaultFilter); + }; + const compDetails = createFilterCompDetails(); + if (!compDetails) { + return null; + } + const createFilterUi = (update) => { + return (update ? createFilterCompDetails() : compDetails).newAgStackInstance(); + }; + return { + compDetails, + createFilterUi + }; + } + createFilterInstance(column, filterDef, defaultFilter, getFilterParams) { + const selectableFilter = this.beans.selectableFilter; + if (selectableFilter?.isSelectable(filterDef)) { + filterDef = selectableFilter.getFilterDef(column, filterDef); + } + const { handler, handlerParams, handlerGenerator } = this.createHandler(column, filterDef, defaultFilter) ?? {}; + const filterCompDetails = this.createFilterComp(column, filterDef, defaultFilter, getFilterParams, !!handler, "init"); + if (!filterCompDetails) { + return { + compDetails: null, + createFilterUi: null, + handler, + handlerGenerator, + handlerParams + }; + } + const { compDetails, createFilterUi } = filterCompDetails; + if (this.isGlobalButtons) { + const hasLocalButtons = !!compDetails.params?.buttons?.length; + if (!hasLocalButtons) { + _warn(281, { colId: column.getColId() }); + } + } + return { + compDetails, + handler, + handlerGenerator, + handlerParams, + createFilterUi + }; + } + createBaseFilterParams(column, forFloatingFilter) { + const { filterManager, rowModel } = this.beans; + return _addGridCommonParams(this.gos, { + column, + colDef: column.getColDef(), + getValue: this.createGetValue(column), + doesRowPassOtherFilter: forFloatingFilter ? () => true : (node) => filterManager?.doesRowPassOtherFilters(column.getColId(), node) ?? true, + rowModel + }); + } + createFilterCompParams(column, useHandler, source, forFloatingFilter) { + const filterChangedCallback = this.filterChangedCallbackFactory(column); + const params = this.createBaseFilterParams(column, forFloatingFilter); + params.filterChangedCallback = filterChangedCallback; + params.filterModifiedCallback = forFloatingFilter ? () => {} : (additionalEventAttributes) => this.filterModified(column, additionalEventAttributes); + if (useHandler) { + const displayParams = params; + const colId = column.getColId(); + const model = _getFilterModel(this.model, colId); + displayParams.model = model; + displayParams.state = this.state.get(colId) ?? { + model + }; + displayParams.onModelChange = (model2, additionalEventAttributes) => { + this.updateStoredModel(colId, model2); + this.refreshHandlerAndUi(column, model2, "ui", false, additionalEventAttributes).then(() => { + filterChangedCallback({ ...additionalEventAttributes, source: "columnFilter" }); + }); + }; + displayParams.onStateChange = (state) => { + this.updateState(column, state); + this.updateOrRefreshFilterUi(column); + }; + displayParams.onAction = (action, additionalEventAttributes, event) => { + this.updateModel(column, action, additionalEventAttributes); + this.dispatchLocalEvent({ + type: "filterAction", + column, + action, + event + }); + }; + displayParams.getHandler = () => this.getHandler(column, true); + displayParams.onUiChange = (additionalEventAttributes) => this.filterUiChanged(column, additionalEventAttributes); + displayParams.source = source; + } + return params; + } + createFilterUiForHandler(compDetails, createFilterUi) { + return createFilterUi ? { + created: false, + create: createFilterUi, + filterParams: compDetails.params, + compDetails + } : null; + } + createFilterUiLegacy(compDetails, createFilterUi, updateInstanceCallback) { + const promise = createFilterUi(); + const filterUi = { + created: true, + create: createFilterUi, + filterParams: compDetails.params, + compDetails, + promise + }; + promise.then(updateInstanceCallback); + return filterUi; + } + createFilterWrapper(column) { + const { compDetails, handler, handlerGenerator, handlerParams, createFilterUi } = this.createFilterInstance(column, column.getColDef(), this.getDefaultFilter(column), (params) => params); + const colId = column.getColId(); + if (handler) { + delete this.initialModel[colId]; + handler.init?.({ + ...handlerParams, + source: "init", + model: _getFilterModel(this.model, colId) + }); + return { + column, + isHandler: true, + handler, + handlerGenerator, + handlerParams, + filterUi: this.createFilterUiForHandler(compDetails, createFilterUi) + }; + } + if (createFilterUi) { + const filterWrapper = { + column, + filterUi: null, + isHandler: false + }; + filterWrapper.filterUi = this.createFilterUiLegacy(compDetails, createFilterUi, (filterComp) => { + filterWrapper.filter = filterComp ?? undefined; + }); + return filterWrapper; + } + return { + column, + filterUi: null, + isHandler: false + }; + } + createHandlerFunc(column, filterDef, defaultFilter) { + const { gos, frameworkOverrides, registry } = this.beans; + let doesFilterPass; + const getFilterHandlerFromDef = (filterDef2) => { + const filter = filterDef2.filter; + if (isColumnFilterComp(filter)) { + const handler = filter.handler; + if (handler) { + return handler; + } + doesFilterPass = filter.doesFilterPass; + if (doesFilterPass) { + return () => ({ + doesFilterPass + }); + } + return; + } + return typeof filter === "string" ? filter : undefined; + }; + const enableFilterHandlers = gos.get("enableFilterHandlers"); + const providedFilterHandler = enableFilterHandlers ? getFilterHandlerFromDef(filterDef) : undefined; + const resolveProvidedFilterHandler = (handlerName2) => () => this.createBean(registry.createDynamicBean(handlerName2, true)); + let filterHandler; + let handlerName; + if (typeof providedFilterHandler === "string") { + const userFilterHandler = gos.get("filterHandlers")?.[providedFilterHandler]; + if (userFilterHandler != null) { + filterHandler = userFilterHandler; + } else if (FILTER_HANDLERS.has(providedFilterHandler)) { + filterHandler = resolveProvidedFilterHandler(providedFilterHandler); + handlerName = providedFilterHandler; + } + } else { + filterHandler = providedFilterHandler; + } + if (!filterHandler) { + let filterName; + const { compName, jsComp, fwComp } = _getFilterCompKeys(frameworkOverrides, filterDef); + if (compName) { + filterName = compName; + } else { + const usingDefaultFilter = jsComp == null && fwComp == null && filterDef.filter === true; + if (usingDefaultFilter) { + filterName = defaultFilter; + } + } + handlerName = this.handlerMap[filterName]; + if (handlerName) { + filterHandler = resolveProvidedFilterHandler(handlerName); + } + } + if (!filterHandler) { + if (!enableFilterHandlers) { + return; + } + if (_isClientSideRowModel(gos)) { + _warn(277, { colId: column.getColId() }); + } + return DUMMY_HANDLER; + } + return { filterHandler, handlerNameOrCallback: doesFilterPass ?? handlerName }; + } + createHandler(column, filterDef, defaultFilter) { + const handlerFunc = this.createHandlerFunc(column, filterDef, defaultFilter); + if (!handlerFunc) { + return; + } + const filterParams = _mergeFilterParamsWithApplicationProvidedParams(this.beans.userCompFactory, filterDef, this.createFilterCompParams(column, true, "init")); + const { handlerNameOrCallback, filterHandler } = handlerFunc; + const { handler, handlerParams } = this.createHandlerFromFunc(column, filterHandler, filterParams); + return { + handler, + handlerParams, + handlerGenerator: handlerNameOrCallback ?? filterHandler + }; + } + createHandlerFromFunc(column, filterHandler, filterParams) { + const colDef = column.getColDef(); + const handler = filterHandler(_addGridCommonParams(this.gos, { column, colDef })); + const handlerParams = this.createHandlerParams(column, filterParams); + return { handler, handlerParams }; + } + createHandlerParams(column, filterParams) { + const colDef = column.getColDef(); + const colId = column.getColId(); + const filterChangedCallback = this.filterChangedCallbackFactory(column); + return _addGridCommonParams(this.gos, { + colDef, + column, + getValue: this.createGetValue(column), + doesRowPassOtherFilter: (node) => this.beans.filterManager?.doesRowPassOtherFilters(colId, node) ?? true, + onModelChange: (newModel, additionalEventAttributes) => { + this.updateStoredModel(colId, newModel); + this.refreshHandlerAndUi(column, newModel, "handler", false, additionalEventAttributes).then(() => { + filterChangedCallback({ ...additionalEventAttributes, source: "columnFilter" }); + }); + }, + onModelAsStringChange: () => { + column.dispatchColEvent("filterChanged", "filterChanged"); + this.dispatchLocalEvent({ + type: "filterModelAsStringChanged", + column + }); + }, + filterParams + }); + } + onColumnsChanged() { + const columns = []; + const { colModel, filterManager, groupFilter } = this.beans; + this.allColumnFilters.forEach((wrapper, colId) => { + let currentColumn; + if (wrapper.column.isPrimary()) { + currentColumn = colModel.getColDefCol(colId); + } else { + currentColumn = colModel.getCol(colId); + } + if (currentColumn && currentColumn === wrapper.column) { + return; + } + columns.push(wrapper.column); + this.disposeFilterWrapper(wrapper, "columnChanged"); + this.disposeColumnListener(colId); + }); + const allFiltersAreGroupFilters = groupFilter && columns.every((col) => groupFilter.isGroupFilter(col)); + if (columns.length > 0 && !allFiltersAreGroupFilters) { + filterManager?.onFilterChanged({ columns, source: "api" }); + } + } + isFilterAllowed(column) { + const isFilterAllowed = column.isFilterAllowed(); + if (!isFilterAllowed) { + return false; + } + const groupFilter = this.beans.groupFilter; + if (groupFilter?.isGroupFilter(column)) { + return groupFilter.isFilterAllowed(column); + } + return true; + } + getFloatingFilterCompDetails(column, showParentFilter) { + const { userCompFactory, frameworkOverrides, selectableFilter, gos } = this.beans; + const parentFilterInstance = (callback) => { + const filterComponent = this.getOrCreateFilterUi(column); + filterComponent?.then((instance) => { + callback(_unwrapUserComp(instance)); + }); + }; + const colDef = column.getColDef(); + const filterDef = selectableFilter?.isSelectable(colDef) ? selectableFilter.getFilterDef(column, colDef) : colDef; + const defaultFloatingFilterType = _getDefaultFloatingFilterType(frameworkOverrides, filterDef, () => this.getDefaultFloatingFilter(column)) ?? "agReadOnlyFloatingFilter"; + const isReactive = gos.get("enableFilterHandlers"); + const filterParams = _mergeFilterParamsWithApplicationProvidedParams(userCompFactory, filterDef, this.createFilterCompParams(column, isReactive, "init", true)); + const params = _addGridCommonParams(gos, { + column, + filterParams, + currentParentModel: () => this.getCurrentFloatingFilterParentModel(column), + parentFilterInstance, + showParentFilter + }); + if (isReactive) { + const displayParams = params; + const colId = column.getColId(); + const filterChangedCallback = this.filterChangedCallbackFactory(column); + displayParams.onUiChange = (additionalEventAttributes) => this.floatingFilterUiChanged(column, additionalEventAttributes); + displayParams.model = _getFilterModel(this.model, colId); + displayParams.onModelChange = (model, additionalEventAttributes) => { + this.updateStoredModel(colId, model); + this.refreshHandlerAndUi(column, model, "floating", true, additionalEventAttributes).then(() => { + filterChangedCallback({ ...additionalEventAttributes, source: "columnFilter" }); + }); + }; + displayParams.getHandler = () => this.getHandler(column, true); + displayParams.source = "init"; + } + return _getFloatingFilterCompDetails(userCompFactory, colDef, params, defaultFloatingFilterType); + } + getCurrentFloatingFilterParentModel(column) { + return this.getModelFromFilterWrapper(this.cachedFilter(column) ?? { column }); + } + destroyFilterUi(filterWrapper, column, compDetails, createFilterUi) { + const source = "paramsUpdated"; + if (filterWrapper.isHandler) { + const colId = column.getColId(); + delete this.initialModel[colId]; + this.state.delete(colId); + const filterUi = filterWrapper.filterUi; + const newFilterUi = this.createFilterUiForHandler(compDetails, createFilterUi); + filterWrapper.filterUi = newFilterUi; + const eventSvc = this.eventSvc; + if (filterUi?.created) { + filterUi.promise.then((filter) => { + this.destroyBean(filter); + eventSvc.dispatchEvent({ + type: "filterDestroyed", + source, + column + }); + }); + } else { + eventSvc.dispatchEvent({ + type: "filterHandlerDestroyed", + source, + column + }); + } + } else { + this.destroyFilter(column, source); + } + } + destroyFilter(column, source = "api") { + const colId = column.getColId(); + const filterWrapper = this.allColumnFilters.get(colId); + this.disposeColumnListener(colId); + delete this.initialModel[colId]; + if (filterWrapper) { + this.disposeFilterWrapper(filterWrapper, source).then((wasActive) => { + if (wasActive && this.isAlive()) { + this.beans.filterManager?.onFilterChanged({ + columns: [column], + source: "api" + }); + } + }); + } + } + disposeColumnListener(colId) { + const columnListener = this.allColumnListeners.get(colId); + if (columnListener) { + this.allColumnListeners.delete(colId); + columnListener(); + } + } + disposeFilterWrapper(filterWrapper, source) { + let isActive = false; + const { column, isHandler, filterUi } = filterWrapper; + const colId = column.getColId(); + if (isHandler) { + isActive = this.isHandlerActive(column); + this.destroyBean(filterWrapper.handler); + delete this.model[colId]; + this.state.delete(colId); + } + const removeFilter = () => { + this.setColFilterActive(column, false, "filterDestroyed"); + this.allColumnFilters.delete(colId); + this.eventSvc.dispatchEvent({ + type: "filterDestroyed", + source, + column + }); + }; + if (filterUi) { + if (filterUi.created) { + return filterUi.promise.then((filter) => { + isActive = isHandler ? isActive : !!filter?.isFilterActive(); + this.destroyBean(filter); + removeFilter(); + return isActive; + }); + } else { + removeFilter(); + } + } + return AgPromise.resolve(isActive); + } + filterChangedCallbackFactory(column) { + return (additionalEventAttributes) => { + this.callOnFilterChangedOutsideRenderCycle({ + additionalEventAttributes, + columns: [column], + column, + source: additionalEventAttributes?.source ?? "columnFilter" + }); + }; + } + filterParamsChanged(colId, source = "api") { + const filterWrapper = this.allColumnFilters.get(colId); + if (!filterWrapper) { + return; + } + const beans = this.beans; + const column = filterWrapper.column; + const colDef = column.getColDef(); + const isFilterAllowed = column.isFilterAllowed(); + const defaultFilter = this.getDefaultFilter(column); + const selectableFilter = beans.selectableFilter; + const filterDef = selectableFilter?.isSelectable(colDef) ? selectableFilter.getFilterDef(column, colDef) : colDef; + const handlerFunc = isFilterAllowed ? this.createHandlerFunc(column, filterDef, this.getDefaultFilter(column)) : undefined; + const isHandler = !!handlerFunc; + const wasHandler = filterWrapper.isHandler; + if (wasHandler != isHandler) { + this.destroyFilter(column, "paramsUpdated"); + return; + } + const { compDetails, createFilterUi } = (isFilterAllowed ? this.createFilterComp(column, filterDef, defaultFilter, (params) => params, isHandler, "colDef") : null) ?? { compDetails: null, createFilterUi: null }; + const newFilterParams = compDetails?.params ?? _mergeFilterParamsWithApplicationProvidedParams(beans.userCompFactory, filterDef, this.createFilterCompParams(column, isHandler, "colDef")); + if (wasHandler) { + const handlerGenerator = handlerFunc?.handlerNameOrCallback ?? handlerFunc?.filterHandler; + const existingModel = _getFilterModel(this.model, colId); + if (filterWrapper.handlerGenerator != handlerGenerator) { + const oldHandler = filterWrapper.handler; + const { handler, handlerParams } = this.createHandlerFromFunc(column, handlerFunc.filterHandler, newFilterParams); + filterWrapper.handler = handler; + filterWrapper.handlerParams = handlerParams; + filterWrapper.handlerGenerator = handlerGenerator; + delete this.model[colId]; + handler.init?.({ ...handlerParams, source: "init", model: null }); + this.destroyBean(oldHandler); + if (existingModel != null) { + this.beans.filterManager?.onFilterChanged({ + columns: [column], + source + }); + } + } else { + const handlerParams = this.createHandlerParams(column, compDetails?.params); + filterWrapper.handlerParams = handlerParams; + filterWrapper.handler.refresh?.({ + ...handlerParams, + source: "colDef", + model: existingModel + }); + } + } + if (this.areFilterCompsDifferent(filterWrapper.filterUi?.compDetails ?? null, compDetails) || !filterWrapper.filterUi || !compDetails) { + this.destroyFilterUi(filterWrapper, column, compDetails, createFilterUi); + return; + } + filterWrapper.filterUi.filterParams = newFilterParams; + getFilterUiFromWrapper(filterWrapper, wasHandler)?.then((filter) => { + const shouldRefreshFilter = filter?.refresh ? filter.refresh(newFilterParams) : true; + if (shouldRefreshFilter === false) { + this.destroyFilterUi(filterWrapper, column, compDetails, createFilterUi); + } else { + this.dispatchLocalEvent({ + type: "filterParamsChanged", + column, + params: newFilterParams + }); + } + }); + } + refreshHandlerAndUi(column, model, source, createIfMissing, additionalEventAttributes) { + const filterWrapper = this.cachedFilter(column); + if (!filterWrapper) { + if (createIfMissing) { + this.getOrCreateFilterWrapper(column, true); + } + return AgPromise.resolve(); + } + if (!filterWrapper.isHandler) { + return AgPromise.resolve(); + } + const { filterUi, handler, handlerParams } = filterWrapper; + return _refreshHandlerAndUi(() => { + if (filterUi) { + const { created, filterParams } = filterUi; + if (created) { + return filterUi.promise.then((filter) => { + return filter ? { filter, filterParams } : undefined; + }); + } else { + filterUi.refreshed = true; + } + } + return AgPromise.resolve(undefined); + }, handler, handlerParams, model, this.state.get(column.getColId()) ?? { model }, source, additionalEventAttributes); + } + setColumnFilterWrapper(column, filterWrapper) { + const colId = column.getColId(); + this.allColumnFilters.set(colId, filterWrapper); + this.allColumnListeners.set(colId, this.addManagedListeners(column, { colDefChanged: () => this.filterParamsChanged(colId) })[0]); + } + areFilterCompsDifferent(oldCompDetails, newCompDetails) { + if (!newCompDetails || !oldCompDetails) { + return true; + } + const { componentClass: oldComponentClass } = oldCompDetails; + const { componentClass: newComponentClass } = newCompDetails; + const isSameComponentClass = oldComponentClass === newComponentClass || oldComponentClass?.render && newComponentClass?.render && oldComponentClass.render === newComponentClass.render; + return !isSameComponentClass; + } + hasFloatingFilters() { + const gridColumns = this.beans.colModel.getCols(); + return gridColumns.some((col) => col.getColDef().floatingFilter); + } + getFilterInstance(key) { + const column = this.beans.colModel.getColDefCol(key); + if (!column) { + return Promise.resolve(undefined); + } + const filterPromise = this.getOrCreateFilterUi(column); + if (!filterPromise) { + return Promise.resolve(null); + } + return new Promise((resolve) => { + filterPromise.then((filter) => { + resolve(_unwrapUserComp(filter)); + }); + }); + } + processFilterModelUpdateQueue() { + this.modelUpdates.forEach(({ model, source }) => this.setModel(model, source)); + this.modelUpdates = []; + this.columnModelUpdates.forEach(({ key, model, resolve }) => { + this.setModelForColumn(key, model).then(() => resolve()); + }); + this.columnModelUpdates = []; + } + getModelForColumn(column, useUnapplied) { + if (useUnapplied) { + const { state, model } = this; + const colId = column.getColId(); + const colState = state.get(colId); + if (colState) { + return colState.model ?? null; + } + return _getFilterModel(model, colId); + } + const filterWrapper = this.cachedFilter(column); + return filterWrapper ? this.getModelFromFilterWrapper(filterWrapper) : null; + } + setModelForColumn(key, model) { + if (this.beans.dataTypeSvc?.isPendingInference) { + let resolve = () => {}; + const promise = new Promise((res) => { + resolve = res; + }); + this.columnModelUpdates.push({ key, model, resolve }); + return promise; + } + return new Promise((resolve) => { + this.setModelForColumnLegacy(key, model).then((result) => resolve(result)); + }); + } + getStateForColumn(colId) { + return this.state.get(colId) ?? { + model: _getFilterModel(this.model, colId) + }; + } + setModelForColumnLegacy(key, model) { + const column = this.beans.colModel.getColDefCol(key); + const filterWrapper = column ? this.getOrCreateFilterWrapper(column, true) : null; + return filterWrapper ? this.setModelOnFilterWrapper(filterWrapper, model) : AgPromise.resolve(); + } + setColDefPropsForDataType(colDef, dataTypeDefinition, formatValue) { + const providedFilter = colDef.filter; + const filter = providedFilter === true ? this.getDefaultFilterFromDataType(() => dataTypeDefinition.baseDataType) : providedFilter; + if (typeof filter !== "string") { + return; + } + let filterParams; + let filterValueGetter; + const beans = this.beans; + const { filterParams: colDefFilterParams, filterValueGetter: colDefFilterValueGetter } = colDef; + if (filter === "agMultiColumnFilter") { + ({ filterParams, filterValueGetter } = beans.multiFilter?.getParamsForDataType(colDefFilterParams, colDefFilterValueGetter, dataTypeDefinition, formatValue) ?? {}); + } else { + ({ filterParams, filterValueGetter } = _getFilterParamsForDataType(filter, colDefFilterParams, colDefFilterValueGetter, dataTypeDefinition, formatValue, beans, this.getLocaleTextFunc())); + } + colDef.filterParams = filterParams; + if (filterValueGetter) { + colDef.filterValueGetter = filterValueGetter; + } + } + setColFilterActive(column, active, source, additionalEventAttributes) { + if (column.filterActive !== active) { + column.filterActive = active; + column.dispatchColEvent("filterActiveChanged", source); + } + column.dispatchColEvent("filterChanged", source, additionalEventAttributes); + } + setModelOnFilterWrapper(filterWrapper, newModel, justCreated) { + return new AgPromise((resolve) => { + if (filterWrapper.isHandler) { + const column = filterWrapper.column; + const colId = column.getColId(); + const existingModel = this.model[colId]; + this.updateStoredModel(colId, newModel); + if (justCreated && newModel === existingModel) { + resolve(); + return; + } + this.refreshHandlerAndUi(column, newModel, "api").then(() => resolve()); + return; + } + const uiPromise = getFilterUiFromWrapper(filterWrapper); + if (uiPromise) { + uiPromise.then((filter) => { + if (typeof filter?.setModel !== "function") { + _warn(65); + resolve(); + return; + } + (filter.setModel(newModel) || AgPromise.resolve()).then(() => resolve()); + }); + return; + } + resolve(); + }); + } + updateStoredModel(colId, model) { + if (_exists(model)) { + this.model[colId] = model; + } else { + delete this.model[colId]; + } + const oldState = this.state.get(colId); + const newState = { + model, + state: oldState?.state + }; + this.state.set(colId, newState); + } + filterModified(column, additionalEventAttributes) { + this.getOrCreateFilterUi(column)?.then((filterInstance) => { + this.eventSvc.dispatchEvent({ + type: "filterModified", + column, + filterInstance, + ...additionalEventAttributes + }); + }); + } + filterUiChanged(column, additionalEventAttributes) { + if (this.gos.get("enableFilterHandlers")) { + this.eventSvc.dispatchEvent({ + type: "filterUiChanged", + column, + ...additionalEventAttributes + }); + } + } + floatingFilterUiChanged(column, additionalEventAttributes) { + if (this.gos.get("enableFilterHandlers")) { + this.eventSvc.dispatchEvent({ + type: "floatingFilterUiChanged", + column, + ...additionalEventAttributes + }); + } + } + updateModel(column, action, additionalEventAttributes) { + const colId = column.getColId(); + const filterWrapper = this.cachedFilter(column); + const getFilterUi = () => filterWrapper?.filterUi; + _updateFilterModel({ + action, + filterParams: filterWrapper?.filterUi?.filterParams, + getFilterUi, + getModel: () => _getFilterModel(this.model, colId), + getState: () => this.state.get(colId), + updateState: (state) => this.updateState(column, state), + updateModel: (model) => getFilterUi()?.filterParams?.onModelChange(model, { ...additionalEventAttributes, fromAction: action }), + processModelToApply: filterWrapper?.isHandler ? filterWrapper.handler.processModelToApply?.bind(filterWrapper.handler) : undefined + }); + } + updateAllModels(action, additionalEventAttributes) { + const promises = []; + this.allColumnFilters.forEach((filter, colId) => { + const column = this.beans.colModel.getColDefCol(colId); + if (column) { + _updateFilterModel({ + action, + filterParams: filter.filterUi?.filterParams, + getFilterUi: () => filter.filterUi, + getModel: () => _getFilterModel(this.model, colId), + getState: () => this.state.get(colId), + updateState: (state) => this.updateState(column, state), + updateModel: (model) => { + this.updateStoredModel(colId, model); + this.dispatchLocalEvent({ + type: "filterAction", + column, + action + }); + promises.push(this.refreshHandlerAndUi(column, model, "ui")); + }, + processModelToApply: filter?.isHandler ? filter.handler.processModelToApply?.bind(filter.handler) : undefined + }); + } + }); + if (promises.length) { + AgPromise.all(promises).then(() => { + this.callOnFilterChangedOutsideRenderCycle({ + source: "columnFilter", + additionalEventAttributes, + columns: [] + }); + }); + } + } + updateOrRefreshFilterUi(column) { + const colId = column.getColId(); + getAndRefreshFilterUi(() => this.cachedFilter(column)?.filterUi, () => _getFilterModel(this.model, colId), () => this.state.get(colId)); + } + updateState(column, state) { + this.state.set(column.getColId(), state); + this.dispatchLocalEvent({ + type: "filterStateChanged", + column, + state + }); + } + canApplyAll() { + const { state, model, activeFilterComps } = this; + for (const comp of activeFilterComps) { + if (comp.source === "COLUMN_MENU") { + return false; + } + } + let hasChanges = false; + for (const colId of state.keys()) { + const colState = state.get(colId); + if (colState.valid === false) { + return false; + } + if ((colState.model ?? null) !== _getFilterModel(model, colId)) { + hasChanges = true; + } + } + return hasChanges; + } + hasUnappliedModel(colId) { + const { model, state } = this; + return (state.get(colId)?.model ?? null) !== _getFilterModel(model, colId); + } + setGlobalButtons(isGlobal) { + this.isGlobalButtons = isGlobal; + this.dispatchLocalEvent({ + type: "filterGlobalButtons", + isGlobal + }); + } + shouldKeepStateOnDetach(column, lastContainerType) { + if (lastContainerType === "newFiltersToolPanel") { + return true; + } + const filterPanelSvc = this.beans.filterPanelSvc; + if (filterPanelSvc?.isActive) { + return !!filterPanelSvc.getState(column.getColId()); + } + return false; + } + onPivotModeChanged(event) { + const { colModel, pivotColsSvc } = this.beans; + const groupFilterEnabled = !!_getGroupAggFiltering(this.gos); + const isPivotMode = event.currentValue; + const from = isPivotMode ? this.activeColumnFilters : this.activeAggregateFilters; + const to = isPivotMode ? this.activeAggregateFilters : this.activeColumnFilters; + const moved = []; + for (const filter of from) { + const column = colModel.getColById(filter.colId); + const isPivotActive = isPivotMode && !!pivotColsSvc?.columns.length; + if (column && isPivotMode === isAggFilter(column, isPivotMode, isPivotActive, groupFilterEnabled)) { + to.push(filter); + moved.push(filter); + } + } + _removeAllFromArray(from, moved); + } + destroy() { + super.destroy(); + this.allColumnFilters.forEach((filterWrapper) => this.disposeFilterWrapper(filterWrapper, "gridDestroyed")); + this.allColumnListeners.clear(); + this.state.clear(); + this.activeFilterComps.clear(); + } +}; +function isAnyFilterPresent(beans) { + return !!beans.filterManager?.isAnyFilterPresent(); +} +function onFilterChanged(beans, source = "api") { + beans.filterManager?.onFilterChanged({ source }); +} +var FilterManager = class extends BeanStub { + constructor() { + super(...arguments); + this.beanName = "filterManager"; + this.advFilterModelUpdateQueue = []; + } + wireBeans(beans) { + this.quickFilter = beans.quickFilter; + this.advancedFilter = beans.advancedFilter; + this.colFilter = beans.colFilter; + } + postConstruct() { + const refreshFiltersForAggregations = this.refreshFiltersForAggregations.bind(this); + const updateAdvFilterColumns = this.updateAdvFilterColumns.bind(this); + this.addManagedEventListeners({ + columnValueChanged: refreshFiltersForAggregations, + columnPivotChanged: refreshFiltersForAggregations, + columnPivotModeChanged: refreshFiltersForAggregations, + newColumnsLoaded: updateAdvFilterColumns, + columnVisible: updateAdvFilterColumns, + advancedFilterEnabledChanged: ({ enabled }) => this.onAdvFilterEnabledChanged(enabled), + 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(); + }); + if (this.quickFilter) { + this.addManagedListeners(this.quickFilter, { + quickFilterChanged: () => this.onFilterChanged({ source: "quickFilter" }) + }); + } + const { gos } = this; + this.alwaysPassFilter = gos.get("alwaysPassFilter"); + this.addManagedPropertyListener("alwaysPassFilter", () => { + this.alwaysPassFilter = gos.get("alwaysPassFilter"); + this.onFilterChanged({ source: "api" }); + }); + } + isExternalFilterPresentCallback() { + const isFilterPresent = this.gos.getCallback("isExternalFilterPresent"); + return typeof isFilterPresent === "function" && isFilterPresent({}); + } + doesExternalFilterPass(node) { + const doesFilterPass = this.gos.get("doesExternalFilterPass"); + return typeof doesFilterPass === "function" && doesFilterPass(node); + } + setFilterState(model, state, source = "api") { + if (this.isAdvFilterEnabled()) { + return; + } + this.colFilter?.setState(model, state, source); + } + setFilterModel(model, source = "api", skipWarning) { + if (this.isAdvFilterEnabled()) { + if (!skipWarning) { + this.warnAdvFilters(); + } + return; + } + this.colFilter?.setModel(model, source); + } + 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(enabled) { + if (enabled) { + 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 (_getGroupAggFiltering(this.gos) && this.isAnyFilterPresent()) { + this.onFilterChanged(); + } + } + onFilterChanged(params = {}) { + const { source, additionalEventAttributes, columns = [] } = params; + this.externalFilterPresent = this.isExternalFilterPresentCallback(); + (this.colFilter ? this.colFilter.updateBeforeFilterChanged(params) : AgPromise.resolve()).then(() => { + const filterChangedEvent = { + source, + type: "filterChanged", + columns + }; + if (additionalEventAttributes) { + _mergeDeep(filterChangedEvent, additionalEventAttributes); + } + this.eventSvc.dispatchEvent(filterChangedEvent); + this.colFilter?.updateAfterFilterChanged(); + }); + } + isSuppressFlashingCellsBecauseFiltering() { + return !!this.colFilter?.isSuppressFlashingCellsBecauseFiltering(); + } + isQuickFilterPresent() { + return !!this.quickFilter?.isFilterPresent(); + } + updateAggFiltering() { + this.aggFiltering = !!_getGroupAggFiltering(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(colIdToSkip, rowNode) { + return this.doesRowPassFilter({ rowNode, colIdToSkip }); + } + doesRowPassAggregateFilters(params) { + const { rowNode } = params; + if (this.alwaysPassFilter?.(rowNode)) { + return true; + } + if (this.isAggregateQuickFilterPresent() && !this.quickFilter.doesRowPass(rowNode)) { + return false; + } + if (this.isAggregateFilterPresent() && !this.colFilter.doFiltersPass(rowNode, params.colIdToSkip, true)) { + return false; + } + return true; + } + doesRowPassFilter(params) { + const { rowNode } = params; + if (this.alwaysPassFilter?.(rowNode)) { + return true; + } + if (this.isNonAggregateQuickFilterPresent() && !this.quickFilter.doesRowPass(rowNode)) { + return false; + } + if (this.externalFilterPresent && !this.doesExternalFilterPass(rowNode)) { + return false; + } + if (this.isColumnFilterPresent() && !this.colFilter.doFiltersPass(rowNode, params.colIdToSkip)) { + return false; + } + if (this.isAdvFilterPresent() && !this.advancedFilter.doesFilterPass(rowNode)) { + return false; + } + return true; + } + isFilterAllowed(column) { + if (this.isAdvFilterEnabled()) { + return false; + } + return !!this.colFilter?.isFilterAllowed(column); + } + getAdvFilterModel() { + return this.isAdvFilterEnabled() ? this.advancedFilter.getModel() : null; + } + setAdvFilterModel(expression, source = "api") { + if (!this.isAdvFilterEnabled()) { + return; + } + if (this.beans.dataTypeSvc?.isPendingInference) { + this.advFilterModelUpdateQueue.push(expression); + return; + } + this.advancedFilter.setModel(expression ?? null); + this.onFilterChanged({ source }); + } + toggleAdvFilterBuilder(show, source) { + if (!this.isAdvFilterEnabled()) { + return; + } + this.advancedFilter.getCtrl().toggleFilterBuilder({ source, force: show }); + } + updateAdvFilterColumns() { + if (!this.isAdvFilterEnabled()) { + return; + } + if (this.advancedFilter.updateValidity()) { + this.onFilterChanged({ source: "advancedFilter" }); + } + } + hasFloatingFilters() { + if (this.isAdvFilterEnabled()) { + return false; + } + return !!this.colFilter?.hasFloatingFilters(); + } + getColumnFilterInstance(key) { + if (this.isAdvFilterEnabled()) { + this.warnAdvFilters(); + return Promise.resolve(undefined); + } + return this.colFilter?.getFilterInstance(key) ?? Promise.resolve(undefined); + } + warnAdvFilters() { + _warn(68); + } + setupAdvFilterHeaderComp(eCompToInsertBefore) { + this.advancedFilter?.getCtrl().setupHeaderComp(eCompToInsertBefore); + } + getHeaderRowCount() { + return this.isAdvFilterHeaderActive() ? 1 : 0; + } + getHeaderHeight() { + return this.isAdvFilterHeaderActive() ? this.advancedFilter.getCtrl().getHeaderHeight() : 0; + } + processFilterModelUpdateQueue() { + for (const model of this.advFilterModelUpdateQueue) { + this.setAdvFilterModel(model); + } + this.advFilterModelUpdateQueue = []; + } + setColumnFilterModel(key, model) { + if (this.isAdvFilterEnabled()) { + this.warnAdvFilters(); + return Promise.resolve(); + } + return this.colFilter?.setModelForColumn(key, model) ?? Promise.resolve(); + } +}; +function getElement(className) { + return { + tag: "div", + cls: className + }; +} +var FilterButtonComp = class extends Component { + constructor(config) { + const { className = "ag-filter-apply-panel" } = config ?? {}; + super(getElement(className)); + this.listeners = []; + this.validationMessage = null; + this.className = className; + } + updateButtons(buttons, useForm) { + const oldButtons = this.buttons; + this.buttons = buttons; + if (oldButtons === buttons) { + return; + } + const eGui = this.getGui(); + _clearElement(eGui); + let eApplyButton; + this.destroyListeners(); + const fragment = document.createDocumentFragment(); + const className = this.className; + const addButton = ({ type, label }) => { + const clickListener = (event) => { + this.dispatchLocalEvent({ + type, + event + }); + }; + if (!["apply", "clear", "reset", "cancel"].includes(type)) { + _warn(75); + } + const isApply = type === "apply"; + const buttonType = isApply && useForm ? "submit" : "button"; + const button = _createElement({ + tag: "button", + attrs: { type: buttonType }, + ref: `${type}FilterButton`, + cls: `ag-button ag-standard-button ${className}-button${isApply ? " " + className + "-apply-button" : ""}`, + children: label + }); + this.activateTabIndex([button]); + if (isApply) { + eApplyButton = button; + } + const keydownListener = (event) => { + if (event.key === KeyCode.ENTER) { + event.preventDefault(); + clickListener(event); + } + }; + const listeners = this.listeners; + button.addEventListener("click", clickListener); + listeners.push(() => button.removeEventListener("click", clickListener)); + button.addEventListener("keydown", keydownListener); + listeners.push(() => button.removeEventListener("keydown", keydownListener)); + fragment.append(button); + }; + for (const button of buttons) { + addButton(button); + } + this.eApply = eApplyButton; + const tooltip = this.validationTooltipFeature; + if (eApplyButton && !tooltip) { + this.validationTooltipFeature = this.createOptionalManagedBean(this.beans.registry.createDynamicBean("tooltipFeature", false, { + getGui: () => this.eApply, + getLocation: () => "advancedFilter", + getTooltipShowDelayOverride: () => 1000 + })); + } else if (!eApplyButton && tooltip) { + this.validationTooltipFeature = this.destroyBean(tooltip); + } + eGui.append(fragment); + } + getApplyButton() { + return this.eApply; + } + updateValidity(valid, message = null) { + const eApplyButton = this.eApply; + if (!eApplyButton) { + return; + } + _setDisabled(eApplyButton, !valid); + this.validationMessage = message; + this.validationTooltipFeature?.setTooltipAndRefresh(this.validationMessage); + } + destroyListeners() { + for (const destroyFunc of this.listeners) { + destroyFunc(); + } + this.listeners = []; + } + destroy() { + this.destroyListeners(); + super.destroy(); + } +}; +var FilterWrapperComp = class extends Component { + constructor(column, wrapper, eventParent, updateModel, isGlobalButtons, enableGlobalButtonCheck) { + super(); + this.column = column; + this.wrapper = wrapper; + this.eventParent = eventParent; + this.updateModel = updateModel; + this.isGlobalButtons = isGlobalButtons; + this.enableGlobalButtonCheck = enableGlobalButtonCheck; + this.hidePopup = null; + this.applyActive = false; + } + postConstruct() { + const { comp, params: originalParams } = this.wrapper; + const params = originalParams; + const useForm = params.useForm; + const tag = useForm ? "form" : "div"; + this.setTemplate({ + tag, + cls: "ag-filter-wrapper" + }); + if (useForm) { + this.addManagedElementListeners(this.getGui(), { + submit: (e) => { + e?.preventDefault(); + }, + keydown: this.handleKeyDown.bind(this) + }); + } + this.appendChild(comp.getGui()); + this.params = params; + this.resetButtonsPanel(params); + this.addManagedListeners(this.eventParent, { + filterParamsChanged: ({ column, params: eventParams }) => { + if (column === this.column) { + this.resetButtonsPanel(eventParams, this.params); + } + }, + filterStateChanged: ({ column, state }) => { + if (column === this.column) { + this.eButtons?.updateValidity(state.valid !== false); + } + }, + filterAction: ({ column, action, event: keyboardEvent }) => { + if (column === this.column) { + this.afterAction(action, keyboardEvent); + } + }, + ...this.enableGlobalButtonCheck ? { + filterGlobalButtons: ({ isGlobal }) => { + if (isGlobal !== this.isGlobalButtons) { + this.isGlobalButtons = isGlobal; + const currentParams = this.params; + this.resetButtonsPanel(currentParams, currentParams, true); + } + } + } : undefined + }); + } + afterGuiAttached(params) { + if (params) { + this.hidePopup = params.hidePopup; + } + } + resetButtonsPanel(newParams, oldParams, forceUpdate) { + const { buttons: oldButtons, readOnly: oldReadOnly } = oldParams ?? {}; + const { buttons: newButtons, readOnly, useForm } = newParams; + if (!forceUpdate && oldReadOnly === readOnly && _jsonEquals(oldButtons, newButtons)) { + return; + } + const hasButtons = newButtons && newButtons.length > 0 && !newParams.readOnly && !this.isGlobalButtons; + let eButtonsPanel = this.eButtons; + if (hasButtons) { + const buttons = newButtons.map((type) => { + const localeKey = `${type}Filter`; + return { type, label: translateForFilter(this, localeKey) }; + }); + this.applyActive = _isUseApplyButton(this.params); + if (!eButtonsPanel) { + eButtonsPanel = this.createBean(new FilterButtonComp); + this.appendChild(eButtonsPanel.getGui()); + const column = this.column; + const getListener = (action) => ({ event }) => { + this.updateModel(column, action, { fromButtons: true }); + 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, useForm); + } else { + this.applyActive = false; + if (eButtonsPanel) { + _removeFromParent(eButtonsPanel.getGui()); + this.eButtons = this.destroyBean(eButtonsPanel); + } + } + } + close(e) { + const hidePopup = this.hidePopup; + if (!hidePopup) { + return; + } + const keyboardEvent = e; + const key = keyboardEvent?.key; + let params; + if (key === KeyCode.ENTER || key === KeyCode.SPACE) { + params = { keyboardEvent }; + } + hidePopup(params); + this.hidePopup = null; + } + afterAction(action, event) { + const { params, applyActive } = this; + const closeOnApply = params?.closeOnApply; + switch (action) { + case "apply": { + event?.preventDefault(); + if (closeOnApply && applyActive) { + this.close(event); + } + break; + } + case "reset": { + if (closeOnApply && applyActive) { + this.close(); + } + break; + } + case "cancel": { + if (closeOnApply) { + this.close(event); + } + break; + } + } + } + handleKeyDown(event) { + if (!event.defaultPrevented && event.key === KeyCode.ENTER && this.applyActive) { + this.updateModel(this.column, "apply", { fromButtons: true }); + this.afterAction("apply", event); + } + } + destroy() { + this.hidePopup = null; + this.eButtons = this.destroyBean(this.eButtons); + } +}; +var legacyFilter_default = ":where(.ag-menu:not(.ag-tabs) .ag-filter)>:not(.ag-filter-wrapper){min-width:180px}"; +var FilterElement = { tag: "div", cls: "ag-filter" }; +var FilterComp = class extends Component { + constructor(column, source, enableGlobalButtonCheck) { + super(FilterElement); + this.column = column; + this.source = source; + this.enableGlobalButtonCheck = enableGlobalButtonCheck; + this.wrapper = null; + } + postConstruct() { + this.beans.colFilter?.activeFilterComps.add(this); + this.createFilter(true); + this.addManagedEventListeners({ filterDestroyed: this.onFilterDestroyed.bind(this) }); + } + hasFilter() { + return this.wrapper != null; + } + getFilter() { + return this.wrapper?.then((wrapper) => wrapper.comp) ?? null; + } + afterInit() { + return this.wrapper?.then(() => {}) ?? AgPromise.resolve(); + } + afterGuiAttached(params) { + this.afterGuiAttachedParams = params; + this.wrapper?.then((wrapper) => { + this.comp?.afterGuiAttached(params); + wrapper?.comp?.afterGuiAttached?.(params); + }); + } + afterGuiDetached() { + this.wrapper?.then((wrapper) => { + wrapper?.comp?.afterGuiDetached?.(); + }); + } + createFilter(init) { + const { + column, + source, + beans: { colFilter } + } = this; + const filterPromise = colFilter.getFilterUiForDisplay(column) ?? null; + this.wrapper = filterPromise; + filterPromise?.then((wrapper) => { + if (!wrapper) { + return; + } + const { isHandler, comp } = wrapper; + let filterGui; + if (isHandler) { + const enableGlobalButtonCheck = !!this.enableGlobalButtonCheck; + const displayComp = this.createBean(new FilterWrapperComp(column, wrapper, colFilter, colFilter.updateModel.bind(colFilter), enableGlobalButtonCheck && colFilter.isGlobalButtons, enableGlobalButtonCheck)); + this.comp = displayComp; + filterGui = displayComp.getGui(); + } else { + this.registerCSS(legacyFilter_default); + filterGui = comp.getGui(); + if (!_exists(filterGui)) { + _warn(69, { guiFromFilter: filterGui }); + } + } + this.appendChild(filterGui); + if (init) { + this.eventSvc.dispatchEvent({ + type: "filterOpened", + column, + source, + eGui: this.getGui() + }); + } else { + comp.afterGuiAttached?.(this.afterGuiAttachedParams); + } + }); + } + onFilterDestroyed(event) { + const { source, column } = event; + if ((source === "api" || source === "paramsUpdated") && column.getId() === this.column.getId() && this.beans.colModel.getColDefCol(this.column)) { + _clearElement(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 = undefined; + super.destroy(); + } +}; +var FilterMenuFactory = class extends BeanStub { + constructor() { + super(...arguments); + this.beanName = "filterMenuFactory"; + } + wireBeans(beans) { + this.popupSvc = beans.popupSvc; + } + hideActiveMenu() { + this.hidePopup?.(); + } + showMenuAfterMouseEvent(column, mouseEvent, containerType, onClosedCallback) { + if (column && !column.isColumn) { + return; + } + this.showPopup(column, (eMenu) => { + this.popupSvc?.positionPopupUnderMouseEvent({ + additionalParams: { column }, + type: containerType, + mouseEvent, + ePopup: eMenu + }); + }, containerType, mouseEvent.target, _isLegacyMenuEnabled(this.gos), onClosedCallback); + } + showMenuAfterButtonClick(column, eventSource, containerType, onClosedCallback) { + if (column && !column.isColumn) { + return; + } + let multiplier = -1; + let alignSide = "left"; + const isLegacyMenuEnabled = _isLegacyMenuEnabled(this.gos); + if (!isLegacyMenuEnabled && this.gos.get("enableRtl")) { + multiplier = 1; + alignSide = "right"; + } + const nudgeX = isLegacyMenuEnabled ? undefined : 4 * multiplier; + const nudgeY = isLegacyMenuEnabled ? undefined : 4; + this.showPopup(column, (eMenu) => { + this.popupSvc?.positionPopupByComponent({ + type: containerType, + eventSource, + ePopup: eMenu, + nudgeX, + nudgeY, + alignSide, + keepWithinBounds: true, + position: "under", + additionalParams: { column } + }); + }, containerType, eventSource, isLegacyMenuEnabled, onClosedCallback); + } + showPopup(column, positionCallback, containerType, eventSource, isLegacyMenuEnabled, onClosedCallback) { + const comp = column ? this.createBean(new FilterComp(column, "COLUMN_MENU")) : undefined; + this.activeMenu = comp; + if (!comp?.hasFilter() || !column) { + _error(57); + return; + } + const eMenu = _createElement({ + tag: "div", + cls: `ag-menu${!isLegacyMenuEnabled ? " ag-filter-menu" : ""}`, + role: "presentation" + }); + [this.tabListener] = this.addManagedElementListeners(eMenu, { + keydown: (e) => this.trapFocusWithin(e, eMenu) + }); + eMenu.appendChild(comp?.getGui()); + let hidePopup; + const afterGuiDetached = () => comp?.afterGuiDetached(); + const anchorToElement = _isColumnMenuAnchoringEnabled(this.gos) ? eventSource ?? this.beans.ctrlsSvc.getGridBodyCtrl().eGridBody : undefined; + const closedCallback = (e) => { + _setColMenuVisible(column, false, "contextMenu"); + const isKeyboardEvent = e instanceof KeyboardEvent; + if (this.tabListener) { + this.tabListener = this.tabListener(); + } + if (isKeyboardEvent && eventSource && _isVisible(eventSource)) { + const focusableEl = _findTabbableParent(eventSource); + focusableEl?.focus({ preventScroll: true }); + } + afterGuiDetached(); + this.destroyBean(this.activeMenu); + this.dispatchVisibleChangedEvent(false, containerType, column); + onClosedCallback?.(); + }; + const translate = this.getLocaleTextFunc(); + const ariaLabel = isLegacyMenuEnabled && containerType !== "columnFilter" ? translate("ariaLabelColumnMenu", "Column Menu") : translate("ariaLabelColumnFilter", "Column Filter"); + const addPopupRes = this.popupSvc?.addPopup({ + modal: true, + eChild: eMenu, + closeOnEsc: true, + closedCallback, + positionCallback: () => positionCallback(eMenu), + anchorToElement, + ariaLabel + }); + if (addPopupRes) { + this.hidePopup = hidePopup = addPopupRes.hideFunc; + } + comp.afterInit().then(() => { + positionCallback(eMenu); + comp.afterGuiAttached({ container: containerType, hidePopup }); + }); + _setColMenuVisible(column, true, "contextMenu"); + this.dispatchVisibleChangedEvent(true, containerType, column); + } + trapFocusWithin(e, menu) { + if (e.key !== KeyCode.TAB || e.defaultPrevented || _findNextFocusableElement(this.beans, menu, false, e.shiftKey)) { + return; + } + e.preventDefault(); + _focusInto(menu, e.shiftKey); + } + dispatchVisibleChangedEvent(visible, containerType, column) { + this.eventSvc.dispatchEvent({ + type: "columnMenuVisibleChanged", + visible, + switchingTab: false, + key: containerType, + column: column ?? null, + columnGroup: null + }); + } + isMenuEnabled(column) { + return column.isFilterAllowed() && (column.getColDef().menuTabs ?? ["filterMenuTab"]).includes("filterMenuTab"); + } + showMenuAfterContextMenuEvent() {} + destroy() { + this.destroyBean(this.activeMenu); + super.destroy(); + } +}; +var FilterValueService = class extends BeanStub { + constructor() { + super(...arguments); + this.beanName = "filterValueSvc"; + } + getValue(column, rowNode, filterValueGetterOverride) { + if (!rowNode) { + return; + } + const colDef = column.getColDef(); + const { selectableFilter, valueSvc, formula } = this.beans; + const filterValueGetter = filterValueGetterOverride ?? selectableFilter?.getFilterValueGetter(column.getColId()) ?? colDef.filterValueGetter; + if (filterValueGetter) { + return this.executeFilterValueGetter(filterValueGetter, rowNode.data, column, rowNode, colDef); + } + const value = valueSvc.getValue(column, rowNode, "data"); + if (column.isAllowFormula() && formula?.isFormula(value)) { + return formula.resolveValue(column, rowNode); + } + return value; + } + executeFilterValueGetter(valueGetter, data, column, node, colDef) { + const { expressionSvc, valueSvc } = this.beans; + const params = _addGridCommonParams(this.gos, { + data, + node, + column, + colDef, + getValue: valueSvc.getValueCallback.bind(valueSvc, node) + }); + if (typeof valueGetter === "function") { + return valueGetter(params); + } + return expressionSvc?.evaluate(valueGetter, params); + } +}; +var AgRadioButton = class extends AgCheckbox { + constructor(config) { + super(config, "ag-radio-button", "radio"); + } + isSelected() { + return this.eInput.checked; + } + toggle() { + if (this.eInput.disabled) { + return; + } + if (!this.isSelected()) { + this.setValue(true); + } + } + addInputListeners() { + super.addInputListeners(); + this.addManagedEventListeners({ checkboxChanged: this.onChange.bind(this) }); + } + onChange(event) { + const eInput = this.eInput; + if (event.selected && event.name && eInput.name && eInput.name === event.name && event.id && eInput.id !== event.id) { + this.setValue(false, true); + } + } +}; +var OptionsFactory = class { + constructor() { + this.customFilterOptions = {}; + } + init(params, defaultOptions) { + this.filterOptions = params.filterOptions ?? defaultOptions; + this.mapCustomOptions(); + this.defaultOption = this.getDefaultItem(params.defaultOption); + } + refresh(params, defaultOptions) { + const filterOptions = params.filterOptions ?? defaultOptions; + if (this.filterOptions !== filterOptions) { + this.filterOptions = filterOptions; + this.customFilterOptions = {}; + this.mapCustomOptions(); + } + this.defaultOption = this.getDefaultItem(params.defaultOption); + } + mapCustomOptions() { + const { filterOptions } = this; + if (!filterOptions) { + return; + } + for (const filterOption of filterOptions) { + if (typeof filterOption === "string") { + continue; + } + const requiredProperties = [["displayKey"], ["displayName"], ["predicate", "test"]]; + const propertyCheck = (keys) => { + if (!keys.some((key) => filterOption[key] != null)) { + _warn(72, { keys }); + return false; + } + return true; + }; + if (!requiredProperties.every(propertyCheck)) { + this.filterOptions = filterOptions.filter((v) => v === filterOption) || []; + continue; + } + this.customFilterOptions[filterOption.displayKey] = filterOption; + } + } + getDefaultItem(defaultOption) { + const { filterOptions } = this; + if (defaultOption) { + return defaultOption; + } else if (filterOptions.length >= 1) { + const firstFilterOption = filterOptions[0]; + if (typeof firstFilterOption === "string") { + return firstFilterOption; + } else if (firstFilterOption.displayKey) { + return firstFilterOption.displayKey; + } else { + _warn(73); + } + } else { + _warn(74); + } + return; + } + getCustomOption(name) { + return this.customFilterOptions[name]; + } +}; +function removeItems(items, startPosition, deleteCount) { + return deleteCount == null ? items.splice(startPosition) : items.splice(startPosition, deleteCount); +} +function isBlank(cellValue) { + return cellValue == null || typeof cellValue === "string" && cellValue.trim().length === 0; +} +function getDefaultJoinOperator(defaultJoinOperator) { + return defaultJoinOperator === "AND" || defaultJoinOperator === "OR" ? defaultJoinOperator : "AND"; +} +function evaluateCustomFilter(customFilterOption, values, cellValue) { + if (customFilterOption == null) { + return; + } + const { predicate } = customFilterOption; + if (predicate != null && !values.some((v) => v == null)) { + return predicate(values, cellValue); + } +} +function validateAndUpdateConditions(conditions, maxNumConditions) { + let numConditions = conditions.length; + if (numConditions > maxNumConditions) { + conditions.splice(maxNumConditions); + _warn(78); + numConditions = maxNumConditions; + } + return numConditions; +} +var zeroInputTypes = /* @__PURE__ */ new Set([ + "empty", + "notBlank", + "blank", + "today", + "yesterday", + "tomorrow", + "thisWeek", + "lastWeek", + "nextWeek", + "thisMonth", + "lastMonth", + "nextMonth", + "thisQuarter", + "lastQuarter", + "nextQuarter", + "thisYear", + "lastYear", + "nextYear", + "yearToDate", + "last7Days", + "last30Days", + "last90Days", + "last6Months", + "last12Months", + "last24Months" +]); +function getNumberOfInputs(type, optionsFactory) { + const customOpts = optionsFactory.getCustomOption(type); + if (customOpts) { + const { numberOfInputs } = customOpts; + return numberOfInputs != null ? numberOfInputs : 1; + } + if (type && zeroInputTypes.has(type)) { + return 0; + } else if (type === "inRange") { + return 2; + } + return 1; +} +var SimpleFilter = class extends ProvidedFilter { + constructor(filterNameKey, mapValuesFromModel, defaultOptions) { + super(filterNameKey, "simple-filter"); + this.mapValuesFromModel = mapValuesFromModel; + this.defaultOptions = defaultOptions; + this.eTypes = []; + this.eJoinPanels = []; + this.eJoinAnds = []; + this.eJoinOrs = []; + this.eConditionBodies = []; + this.listener = () => this.onUiChanged(); + this.lastUiCompletePosition = null; + this.joinOperatorId = 0; + } + setParams(params) { + super.setParams(params); + const optionsFactory = new OptionsFactory; + this.optionsFactory = optionsFactory; + optionsFactory.init(params, this.defaultOptions); + this.commonUpdateSimpleParams(params); + this.createOption(); + this.createMissingConditionsAndOperators(); + } + updateParams(newParams, oldParams) { + this.optionsFactory.refresh(newParams, this.defaultOptions); + super.updateParams(newParams, oldParams); + this.commonUpdateSimpleParams(newParams); + } + commonUpdateSimpleParams(params) { + this.setNumConditions(params); + this.defaultJoinOperator = getDefaultJoinOperator(params.defaultJoinOperator); + this.filterPlaceholder = params.filterPlaceholder; + this.createFilterListOptions(); + _addOrRemoveAttribute(this.getGui(), "tabindex", this.isReadOnly() ? "-1" : null); + } + onFloatingFilterChanged(type, value) { + this.setTypeFromFloatingFilter(type); + this.setValueFromFloatingFilter(value); + this.onUiChanged("immediately", true); + } + setTypeFromFloatingFilter(type) { + this.eTypes.forEach((eType, position) => { + const value = position === 0 ? type : this.optionsFactory.defaultOption; + eType.setValue(value, true); + }); + } + getModelFromUi() { + const conditions = this.getUiCompleteConditions(); + if (conditions.length === 0) { + return null; + } + if (this.maxNumConditions > 1 && conditions.length > 1) { + return { + filterType: this.filterType, + operator: this.getJoinOperator(), + conditions + }; + } + return conditions[0]; + } + getConditionTypes() { + return this.eTypes.map((eType) => eType.getValue()); + } + getConditionType(position) { + return this.eTypes[position].getValue(); + } + getJoinOperator() { + const { eJoinOrs: eJoinOperatorsOr, defaultJoinOperator } = this; + return eJoinOperatorsOr.length === 0 ? defaultJoinOperator : eJoinOperatorsOr[0].getValue() === true ? "OR" : "AND"; + } + areNonNullModelsEqual(a, b) { + const aIsSimple = !a.operator; + const bIsSimple = !b.operator; + const oneSimpleOneCombined = !aIsSimple && bIsSimple || aIsSimple && !bIsSimple; + if (oneSimpleOneCombined) { + return false; + } + let res; + if (aIsSimple) { + const aSimple = a; + const bSimple = b; + res = this.areSimpleModelsEqual(aSimple, bSimple); + } else { + const aCombined = a; + const bCombined = b; + res = aCombined.operator === bCombined.operator && _areEqual(aCombined.conditions, bCombined.conditions, (aModel, bModel) => this.areSimpleModelsEqual(aModel, bModel)); + } + return res; + } + setModelIntoUi(model, isInitialLoad) { + if (model == null) { + this.resetUiToDefaults(isInitialLoad); + return AgPromise.resolve(); + } + const isCombined = model.operator; + if (isCombined) { + const combinedModel = model; + let conditions = combinedModel.conditions; + if (conditions == null) { + conditions = []; + _warn(77); + } + const numConditions = validateAndUpdateConditions(conditions, this.maxNumConditions); + const numPrevConditions = this.getNumConditions(); + if (numConditions < numPrevConditions) { + this.removeConditionsAndOperators(numConditions); + } else if (numConditions > numPrevConditions) { + for (let i = numPrevConditions;i < numConditions; i++) { + this.createJoinOperatorPanel(); + this.createOption(); + } + } + const orChecked = combinedModel.operator === "OR"; + this.eJoinAnds.forEach((eJoinOperatorAnd) => eJoinOperatorAnd.setValue(!orChecked, true)); + this.eJoinOrs.forEach((eJoinOperatorOr) => eJoinOperatorOr.setValue(orChecked, true)); + conditions.forEach((condition, position) => { + this.eTypes[position].setValue(condition.type, true); + this.setConditionIntoUi(condition, position); + }); + } else { + const simpleModel = model; + if (this.getNumConditions() > 1) { + this.removeConditionsAndOperators(1); + } + this.eTypes[0].setValue(simpleModel.type, true); + this.setConditionIntoUi(simpleModel, 0); + } + this.lastUiCompletePosition = this.getNumConditions() - 1; + this.createMissingConditionsAndOperators(); + this.updateUiVisibility(); + if (!isInitialLoad) { + this.params.onUiChange(this.getUiChangeEventParams()); + } + return AgPromise.resolve(); + } + setNumConditions(params) { + let maxNumConditions = params.maxNumConditions ?? 2; + if (maxNumConditions < 1) { + _warn(79); + maxNumConditions = 1; + } + this.maxNumConditions = maxNumConditions; + let numAlwaysVisibleConditions = params.numAlwaysVisibleConditions ?? 1; + if (numAlwaysVisibleConditions < 1) { + _warn(80); + numAlwaysVisibleConditions = 1; + } + if (numAlwaysVisibleConditions > maxNumConditions) { + _warn(81); + numAlwaysVisibleConditions = maxNumConditions; + } + this.numAlwaysVisibleConditions = numAlwaysVisibleConditions; + } + createOption() { + const eGui = this.getGui(); + const eType = this.createManagedBean(new AgSelect); + this.eTypes.push(eType); + eType.addCss("ag-filter-select"); + eGui.appendChild(eType.getGui()); + const eConditionBody = this.createEValue(); + this.eConditionBodies.push(eConditionBody); + eGui.appendChild(eConditionBody); + this.putOptionsIntoDropdown(eType); + this.resetType(eType); + const position = this.getNumConditions() - 1; + this.forEachPositionInput(position, (element) => this.resetInput(element)); + this.addChangedListeners(eType, position); + } + createJoinOperatorPanel() { + const eJoinOperatorPanel = _createElement({ tag: "div", cls: "ag-filter-condition" }); + this.eJoinPanels.push(eJoinOperatorPanel); + const eJoinOperatorAnd = this.createJoinOperator(this.eJoinAnds, eJoinOperatorPanel, "and"); + const eJoinOperatorOr = this.createJoinOperator(this.eJoinOrs, eJoinOperatorPanel, "or"); + this.getGui().appendChild(eJoinOperatorPanel); + const index = this.eJoinPanels.length - 1; + const uniqueGroupId = this.joinOperatorId++; + this.resetJoinOperatorAnd(eJoinOperatorAnd, index, uniqueGroupId); + this.resetJoinOperatorOr(eJoinOperatorOr, index, uniqueGroupId); + if (!this.isReadOnly()) { + eJoinOperatorAnd.onValueChange(this.listener); + eJoinOperatorOr.onValueChange(this.listener); + } + } + createJoinOperator(eJoinOperators, eJoinOperatorPanel, andOr) { + const eJoinOperator = this.createManagedBean(new AgRadioButton); + eJoinOperators.push(eJoinOperator); + const baseClass = "ag-filter-condition-operator"; + eJoinOperator.addCss(baseClass); + eJoinOperator.addCss(`${baseClass}-${andOr}`); + eJoinOperatorPanel.appendChild(eJoinOperator.getGui()); + return eJoinOperator; + } + createFilterListOptions() { + this.filterListOptions = this.optionsFactory.filterOptions.map((option) => typeof option === "string" ? this.createBoilerplateListOption(option) : this.createCustomListOption(option)); + } + putOptionsIntoDropdown(eType) { + const { filterListOptions } = this; + for (const listOption of filterListOptions) { + eType.addOption(listOption); + } + eType.setDisabled(filterListOptions.length <= 1); + } + createBoilerplateListOption(option) { + return { value: option, text: this.translate(option) }; + } + createCustomListOption(option) { + const { displayKey } = option; + const customOption = this.optionsFactory.getCustomOption(option.displayKey); + return { + value: displayKey, + text: customOption ? this.getLocaleTextFunc()(customOption.displayKey, customOption.displayName) : this.translate(displayKey) + }; + } + createBodyTemplate() { + return null; + } + getAgComponents() { + return []; + } + updateUiVisibility() { + const joinOperator = this.getJoinOperator(); + this.updateNumConditions(); + this.updateConditionStatusesAndValues(this.lastUiCompletePosition, joinOperator); + } + updateNumConditions() { + let lastUiCompletePosition = -1; + let areAllConditionsUiComplete = true; + for (let position = 0;position < this.getNumConditions(); position++) { + if (this.isConditionUiComplete(position)) { + lastUiCompletePosition = position; + } else { + areAllConditionsUiComplete = false; + } + } + if (this.shouldAddNewConditionAtEnd(areAllConditionsUiComplete)) { + this.createJoinOperatorPanel(); + this.createOption(); + } else { + const activePosition = this.lastUiCompletePosition ?? this.getNumConditions() - 2; + if (lastUiCompletePosition < activePosition) { + this.removeConditionsAndOperators(activePosition + 1); + const removeStartPosition = lastUiCompletePosition + 1; + const numConditionsToRemove = activePosition - removeStartPosition; + if (numConditionsToRemove > 0) { + this.removeConditionsAndOperators(removeStartPosition, numConditionsToRemove); + } + this.createMissingConditionsAndOperators(); + } + } + this.lastUiCompletePosition = lastUiCompletePosition; + } + updateConditionStatusesAndValues(lastUiCompletePosition, joinOperator) { + this.eTypes.forEach((eType, position) => { + const disabled = this.isConditionDisabled(position, lastUiCompletePosition); + eType.setDisabled(disabled || this.filterListOptions.length <= 1); + if (position === 1) { + _setDisabled(this.eJoinPanels[0], disabled); + this.eJoinAnds[0].setDisabled(disabled); + this.eJoinOrs[0].setDisabled(disabled); + } + }); + this.eConditionBodies.forEach((element, index) => { + _setDisplayed(element, this.isConditionBodyVisible(index)); + }); + const orChecked = (joinOperator ?? this.getJoinOperator()) === "OR"; + for (const eJoinOperatorAnd of this.eJoinAnds) { + eJoinOperatorAnd.setValue(!orChecked, true); + } + for (const eJoinOperatorOr of this.eJoinOrs) { + eJoinOperatorOr.setValue(orChecked, true); + } + this.forEachInput((element, index, position, numberOfInputs) => { + this.setElementDisplayed(element, index < numberOfInputs); + this.setElementDisabled(element, this.isConditionDisabled(position, lastUiCompletePosition)); + }); + this.resetPlaceholder(); + } + shouldAddNewConditionAtEnd(areAllConditionsUiComplete) { + return areAllConditionsUiComplete && this.getNumConditions() < this.maxNumConditions && !this.isReadOnly(); + } + removeConditionsAndOperators(startPosition, deleteCount) { + if (startPosition >= this.getNumConditions()) { + return; + } + const { + eTypes, + eConditionBodies, + eJoinPanels: eJoinOperatorPanels, + eJoinAnds: eJoinOperatorsAnd, + eJoinOrs: eJoinOperatorsOr + } = this; + this.removeComponents(eTypes, startPosition, deleteCount); + this.removeElements(eConditionBodies, startPosition, deleteCount); + this.removeEValues(startPosition, deleteCount); + const joinOperatorIndex = Math.max(startPosition - 1, 0); + this.removeElements(eJoinOperatorPanels, joinOperatorIndex, deleteCount); + this.removeComponents(eJoinOperatorsAnd, joinOperatorIndex, deleteCount); + this.removeComponents(eJoinOperatorsOr, joinOperatorIndex, deleteCount); + } + removeElements(elements, startPosition, deleteCount) { + const removedElements = removeItems(elements, startPosition, deleteCount); + for (const element of removedElements) { + _removeFromParent(element); + } + } + removeComponents(components, startPosition, deleteCount) { + const removedComponents = removeItems(components, startPosition, deleteCount); + for (const comp of removedComponents) { + _removeFromParent(comp.getGui()); + this.destroyBean(comp); + } + } + afterGuiAttached(params) { + super.afterGuiAttached(params); + this.resetPlaceholder(); + if (!params?.suppressFocus) { + let elementToFocus; + if (!this.isReadOnly()) { + const firstInput = this.getInputs(0)[0]; + if (firstInput instanceof AgAbstractInputField && this.isConditionBodyVisible(0)) { + elementToFocus = firstInput.getInputElement(); + } else { + elementToFocus = this.eTypes[0]?.getFocusableElement(); + } + } + (elementToFocus ?? this.getGui()).focus({ preventScroll: true }); + } + } + shouldKeepInvalidInputState() { + return false; + } + afterGuiDetached() { + super.afterGuiDetached(); + const params = this.params; + if (this.beans.colFilter?.shouldKeepStateOnDetach(params.column) || this.shouldKeepInvalidInputState()) { + return; + } + params.onStateChange({ + model: params.model + }); + let lastUiCompletePosition = -1; + let updatedLastUiCompletePosition = -1; + let conditionsRemoved = false; + const joinOperator = this.getJoinOperator(); + for (let position = this.getNumConditions() - 1;position >= 0; position--) { + if (this.isConditionUiComplete(position)) { + if (lastUiCompletePosition === -1) { + lastUiCompletePosition = position; + updatedLastUiCompletePosition = position; + } + } else { + const shouldRemovePositionAtEnd = position >= this.numAlwaysVisibleConditions && !this.isConditionUiComplete(position - 1); + const positionBeforeLastUiCompletePosition = position < lastUiCompletePosition; + if (shouldRemovePositionAtEnd || positionBeforeLastUiCompletePosition) { + this.removeConditionsAndOperators(position, 1); + conditionsRemoved = true; + if (positionBeforeLastUiCompletePosition) { + updatedLastUiCompletePosition--; + } + } + } + } + let shouldUpdateConditionStatusesAndValues = false; + if (this.getNumConditions() < this.numAlwaysVisibleConditions) { + this.createMissingConditionsAndOperators(); + shouldUpdateConditionStatusesAndValues = true; + } + if (this.shouldAddNewConditionAtEnd(updatedLastUiCompletePosition === this.getNumConditions() - 1)) { + this.createJoinOperatorPanel(); + this.createOption(); + shouldUpdateConditionStatusesAndValues = true; + } + if (shouldUpdateConditionStatusesAndValues) { + this.updateConditionStatusesAndValues(updatedLastUiCompletePosition, joinOperator); + } + if (conditionsRemoved) { + this.updateJoinOperatorsDisabled(); + } + this.lastUiCompletePosition = updatedLastUiCompletePosition; + } + getModelAsString(model) { + return this.params.getHandler()?.getModelAsString?.(model) ?? ""; + } + resetPlaceholder() { + const globalTranslate = this.getLocaleTextFunc(); + const { filterPlaceholder, eTypes } = this; + this.forEachInput((element, index, position, numberOfInputs) => { + if (!(element instanceof AgAbstractInputField)) { + return; + } + const placeholderKey = index === 0 && numberOfInputs > 1 ? "inRangeStart" : index === 0 ? "filterOoo" : "inRangeEnd"; + const ariaLabel = index === 0 && numberOfInputs > 1 ? globalTranslate("ariaFilterFromValue", "Filter from value") : index === 0 ? globalTranslate("ariaFilterValue", "Filter Value") : globalTranslate("ariaFilterToValue", "Filter to Value"); + const filterOptionKey = eTypes[position].getValue(); + const placeholderText = getPlaceholderText(this, filterPlaceholder, placeholderKey, filterOptionKey); + element.setInputPlaceholder(placeholderText); + element.setInputAriaLabel(ariaLabel); + }); + } + setElementValue(element, value, fromFloatingFilter) { + if (element instanceof AgAbstractInputField) { + element.setValue(value != null ? String(value) : null, true); + } + } + setElementDisplayed(element, displayed) { + if (_isComponent(element)) { + _setDisplayed(element.getGui(), displayed); + } + } + setElementDisabled(element, disabled) { + if (_isComponent(element)) { + _setDisabled(element.getGui(), disabled); + } + } + attachElementOnChange(element, listener) { + if (element instanceof AgAbstractInputField) { + element.onValueChange(listener); + } + } + forEachInput(cb) { + this.getConditionTypes().forEach((type, position) => { + this.forEachPositionTypeInput(position, type, cb); + }); + } + forEachPositionInput(position, cb) { + const type = this.getConditionType(position); + this.forEachPositionTypeInput(position, type, cb); + } + forEachPositionTypeInput(position, type, cb) { + const numberOfInputs = getNumberOfInputs(type, this.optionsFactory); + const inputs = this.getInputs(position); + for (let index = 0;index < inputs.length; index++) { + const input = inputs[index]; + if (input != null) { + cb(input, index, position, numberOfInputs); + } + } + } + isConditionDisabled(position, lastUiCompletePosition) { + if (this.isReadOnly()) { + return true; + } + if (position === 0) { + return false; + } + return position > lastUiCompletePosition + 1; + } + isConditionBodyVisible(position) { + const type = this.getConditionType(position); + const numberOfInputs = getNumberOfInputs(type, this.optionsFactory); + return numberOfInputs > 0; + } + isConditionUiComplete(position) { + if (position >= this.getNumConditions()) { + return false; + } + const type = this.getConditionType(position); + if (type === "empty") { + return false; + } + if (this.getValues(position).some((v) => v == null)) { + return false; + } + if (this.positionHasInvalidInputs(position)) { + return false; + } + return true; + } + getNumConditions() { + return this.eTypes.length; + } + getUiCompleteConditions() { + const conditions = []; + for (let position = 0;position < this.getNumConditions(); position++) { + if (this.isConditionUiComplete(position)) { + conditions.push(this.createCondition(position)); + } + } + return conditions; + } + createMissingConditionsAndOperators() { + if (this.isReadOnly()) { + return; + } + for (let i = this.getNumConditions();i < this.numAlwaysVisibleConditions; i++) { + this.createJoinOperatorPanel(); + this.createOption(); + } + } + resetUiToDefaults(silent) { + this.removeConditionsAndOperators(this.isReadOnly() ? 1 : this.numAlwaysVisibleConditions); + this.eTypes.forEach((eType) => this.resetType(eType)); + this.eJoinAnds.forEach((eJoinOperatorAnd, index) => this.resetJoinOperatorAnd(eJoinOperatorAnd, index, this.joinOperatorId + index)); + this.eJoinOrs.forEach((eJoinOperatorOr, index) => this.resetJoinOperatorOr(eJoinOperatorOr, index, this.joinOperatorId + index)); + this.joinOperatorId++; + this.forEachInput((element) => this.resetInput(element)); + this.resetPlaceholder(); + this.createMissingConditionsAndOperators(); + this.lastUiCompletePosition = null; + this.updateUiVisibility(); + if (!silent) { + this.params.onUiChange(this.getUiChangeEventParams()); + } + } + resetType(eType) { + const translate = this.getLocaleTextFunc(); + const filteringLabel = translate("ariaFilteringOperator", "Filtering operator"); + eType.setValue(this.optionsFactory.defaultOption, true).setAriaLabel(filteringLabel).setDisabled(this.isReadOnly() || this.filterListOptions.length <= 1); + } + resetJoinOperatorAnd(eJoinOperatorAnd, index, uniqueGroupId) { + this.resetJoinOperator(eJoinOperatorAnd, index, this.defaultJoinOperator === "AND", this.translate("andCondition"), uniqueGroupId); + } + resetJoinOperatorOr(eJoinOperatorOr, index, uniqueGroupId) { + this.resetJoinOperator(eJoinOperatorOr, index, this.defaultJoinOperator === "OR", this.translate("orCondition"), uniqueGroupId); + } + resetJoinOperator(eJoinOperator, index, value, label, uniqueGroupId) { + this.updateJoinOperatorDisabled(eJoinOperator.setValue(value, true).setName(`ag-simple-filter-and-or-${this.getCompId()}-${uniqueGroupId}`).setLabel(label), index); + } + updateJoinOperatorsDisabled() { + const updater = (eJoinOperator, index) => this.updateJoinOperatorDisabled(eJoinOperator, index); + this.eJoinAnds.forEach(updater); + this.eJoinOrs.forEach(updater); + } + updateJoinOperatorDisabled(eJoinOperator, index) { + eJoinOperator.setDisabled(this.isReadOnly() || index > 0); + } + resetInput(element) { + this.setElementValue(element, null); + this.setElementDisabled(element, this.isReadOnly()); + } + setConditionIntoUi(model, position) { + const values = this.mapValuesFromModel(model, this.optionsFactory); + this.forEachInput((element, index, elPosition) => { + if (elPosition !== position) { + return; + } + this.setElementValue(element, values[index] != null ? values[index] : null); + }); + } + setValueFromFloatingFilter(value) { + this.forEachInput((element, index, position) => { + this.setElementValue(element, index === 0 && position === 0 ? value : null, true); + }); + } + addChangedListeners(eType, position) { + if (this.isReadOnly()) { + return; + } + eType.onValueChange(this.listener); + this.forEachPositionInput(position, (element) => { + this.attachElementOnChange(element, this.listener); + }); + } + hasInvalidInputs() { + return false; + } + positionHasInvalidInputs(_position) { + return false; + } + isReadOnly() { + return !!this.params.readOnly; + } +}; +var SimpleFilterHandler = class extends BeanStub { + constructor(mapValuesFromModel, defaultOptions) { + super(); + this.mapValuesFromModel = mapValuesFromModel; + this.defaultOptions = defaultOptions; + } + init(params) { + const filterParams = params.filterParams; + const optionsFactory = new OptionsFactory; + this.optionsFactory = optionsFactory; + optionsFactory.init(filterParams, this.defaultOptions); + this.filterModelFormatter = this.createManagedBean(new this.FilterModelFormatterClass(optionsFactory, filterParams)); + this.updateParams(params); + this.validateModel(params); + } + refresh(params) { + if (params.source === "colDef") { + const filterParams = params.filterParams; + const optionsFactory = this.optionsFactory; + optionsFactory.refresh(filterParams, this.defaultOptions); + this.filterModelFormatter.updateParams({ optionsFactory, filterParams }); + this.updateParams(params); + } + this.validateModel(params); + } + updateParams(params) { + this.params = params; + } + doesFilterPass(params) { + const model = params.model; + if (model == null) { + return true; + } + const { operator } = model; + const models = []; + if (operator) { + const combinedModel = model; + models.push(...combinedModel.conditions ?? []); + } else { + models.push(model); + } + const combineFunction = operator && operator === "OR" ? "some" : "every"; + const cellValue = this.params.getValue(params.node); + return models[combineFunction]((m) => this.individualConditionPasses(params, m, cellValue)); + } + getModelAsString(model, source) { + return this.filterModelFormatter.getModelAsString(model, source) ?? ""; + } + validateModel(params) { + const { + model, + filterParams: { filterOptions, maxNumConditions } + } = params; + if (model == null) { + return; + } + const isCombined = isCombinedFilterModel(model); + let conditions = isCombined ? model.conditions : [model]; + const newOptionsList = filterOptions?.map((option) => typeof option === "string" ? option : option.displayKey) ?? this.defaultOptions; + const allConditionsExistInNewOptionsList = !conditions || conditions.every((condition) => newOptionsList.find((option) => option === condition.type) !== undefined); + if (!allConditionsExistInNewOptionsList) { + this.params = { + ...params, + model: null + }; + params.onModelChange(null); + return; + } + let needsUpdate = false; + const filterType = this.filterType; + if (conditions && !conditions.every((condition) => condition.filterType === filterType) || model.filterType !== filterType) { + conditions = conditions.map((condition) => ({ ...condition, filterType })); + needsUpdate = true; + } + if (typeof maxNumConditions === "number" && conditions && conditions.length > maxNumConditions) { + conditions = conditions.slice(0, maxNumConditions); + needsUpdate = true; + } + if (needsUpdate) { + const updatedModel = conditions.length > 1 ? { + ...model, + filterType, + conditions + } : { + ...conditions[0], + filterType + }; + this.params = { + ...params, + model: updatedModel + }; + params.onModelChange(updatedModel); + } + } + individualConditionPasses(params, filterModel, cellValue) { + const optionsFactory = this.optionsFactory; + const values = this.mapValuesFromModel(filterModel, optionsFactory); + const customFilterOption = optionsFactory.getCustomOption(filterModel.type); + const customFilterResult = evaluateCustomFilter(customFilterOption, values, cellValue); + if (customFilterResult != null) { + return customFilterResult; + } + if (cellValue == null) { + return this.evaluateNullValue(filterModel.type); + } + return this.evaluateNonNullValue(values, cellValue, filterModel, params); + } +}; +var ScalarFilterHandler = class extends SimpleFilterHandler { + evaluateNullValue(filterType) { + const { + includeBlanksInEquals, + includeBlanksInNotEqual, + includeBlanksInGreaterThan, + includeBlanksInLessThan, + includeBlanksInRange + } = this.params.filterParams; + switch (filterType) { + case "equals": + if (includeBlanksInEquals) { + return true; + } + break; + case "notEqual": + if (includeBlanksInNotEqual) { + return true; + } + break; + case "greaterThan": + case "greaterThanOrEqual": + if (includeBlanksInGreaterThan) { + return true; + } + break; + case "lessThan": + case "lessThanOrEqual": + if (includeBlanksInLessThan) { + return true; + } + break; + case "inRange": + if (includeBlanksInRange) { + return true; + } + break; + case "blank": + return true; + case "notBlank": + return false; + } + return false; + } + evaluateNonNullValue(values, cellValue, filterModel) { + const type = filterModel.type; + if (!this.isValid(cellValue)) { + return type === "notEqual" || type === "notBlank"; + } + const comparator = this.comparator(); + const compareResult = values[0] != null ? comparator(values[0], cellValue) : 0; + switch (type) { + case "equals": + return compareResult === 0; + case "notEqual": + return compareResult !== 0; + case "greaterThan": + return compareResult > 0; + case "greaterThanOrEqual": + return compareResult >= 0; + case "lessThan": + return compareResult < 0; + case "lessThanOrEqual": + return compareResult <= 0; + case "inRange": { + const compareToResult = comparator(values[1], cellValue); + return this.params.filterParams.inRangeInclusive ? compareResult >= 0 && compareToResult <= 0 : compareResult > 0 && compareToResult < 0; + } + case "blank": + return isBlank(cellValue); + case "notBlank": + return !isBlank(cellValue); + default: + _warn(76, { filterModelType: type }); + return true; + } + } +}; +var SCALAR_FILTER_TYPE_KEYS = { + equals: "Equals", + notEqual: "NotEqual", + greaterThan: "GreaterThan", + greaterThanOrEqual: "GreaterThanOrEqual", + lessThan: "LessThan", + lessThanOrEqual: "LessThanOrEqual", + inRange: "InRange" +}; +var TEXT_FILTER_TYPE_KEYS = { + contains: "Contains", + notContains: "NotContains", + equals: "TextEquals", + notEqual: "TextNotEqual", + startsWith: "StartsWith", + endsWith: "EndsWith", + inRange: "InRange" +}; +var SimpleFilterModelFormatter = class extends BeanStub { + constructor(optionsFactory, filterParams, valueFormatter) { + super(); + this.optionsFactory = optionsFactory; + this.filterParams = filterParams; + this.valueFormatter = valueFormatter; + } + getModelAsString(model, source) { + const translate = this.getLocaleTextFunc(); + const forToolPanel = source === "filterToolPanel"; + if (!model) { + return forToolPanel ? translateForFilter(this, "filterSummaryInactive") : null; + } + const isCombined = model.operator != null; + if (isCombined) { + const combinedModel = model; + const conditions = combinedModel.conditions ?? []; + const customOptions = conditions.map((condition) => this.getModelAsString(condition, source)); + const joinOperatorTranslateKey = combinedModel.operator === "AND" ? "andCondition" : "orCondition"; + return customOptions.join(` ${translateForFilter(this, joinOperatorTranslateKey)} `); + } else if (model.type === "blank" || model.type === "notBlank") { + return forToolPanel ? translateForFilter(this, model.type === "blank" ? "filterSummaryBlank" : "filterSummaryNotBlank") : translate(model.type, model.type); + } else { + const condition = model; + const customOption = this.optionsFactory.getCustomOption(condition.type); + const { displayKey, displayName, numberOfInputs } = customOption || {}; + if (displayKey && displayName && numberOfInputs === 0) { + return translate(displayKey, displayName); + } + return this.conditionToString(condition, forToolPanel, condition.type === "inRange" || numberOfInputs === 2, displayKey, displayName); + } + } + updateParams(params) { + const { optionsFactory, filterParams } = params; + this.optionsFactory = optionsFactory; + this.filterParams = filterParams; + } + conditionForToolPanel(type, isRange, getFilter, getFilterTo, customDisplayKey, customDisplayName) { + let typeValue; + const typeKey = this.getTypeKey(type); + if (typeKey) { + typeValue = translateForFilter(this, typeKey); + } + if (customDisplayKey && customDisplayName) { + typeValue = this.getLocaleTextFunc()(customDisplayKey, customDisplayName); + } + if (typeValue != null) { + if (isRange) { + return `${typeValue} ${translateForFilter(this, "filterSummaryInRangeValues", [getFilter(), getFilterTo()])}`; + } else { + return `${typeValue} ${getFilter()}`; + } + } + return null; + } + getTypeKey(type) { + const suffix = this.filterTypeKeys[type]; + return suffix ? `filterSummary${suffix}` : null; + } + formatValue(value) { + const valueFormatter = this.valueFormatter; + return valueFormatter ? valueFormatter(value ?? null) ?? "" : String(value); + } +}; +var FloatingFilterTextInputService = class extends BeanStub { + constructor(params) { + super(); + this.params = params; + this.eInput = RefPlaceholder; + this.onValueChanged = () => {}; + } + setupGui(parentElement) { + this.eInput = this.createManagedBean(new AgInputTextField(this.params?.config)); + const eInput = this.eInput.getGui(); + parentElement.appendChild(eInput); + const listener = (e) => this.onValueChanged(e); + this.addManagedListeners(eInput, { + input: listener, + keydown: listener + }); + } + setEditable(editable) { + this.eInput.setDisabled(!editable); + } + getValue() { + return this.eInput.getValue(); + } + setValue(value, silent) { + this.eInput.setValue(value, silent); + } + setValueChangedListener(listener) { + this.onValueChanged = listener; + } + setParams({ + ariaLabel, + autoComplete, + placeholder + }) { + const { eInput } = this; + eInput.setInputAriaLabel(ariaLabel); + if (autoComplete !== undefined) { + eInput.setAutoComplete(autoComplete); + } + eInput.toggleCss("ag-floating-filter-search-icon", !!placeholder); + eInput.setInputPlaceholder(placeholder); + } +}; +function trimInputForFilter(value) { + const trimmedInput = value?.trim(); + return trimmedInput === "" ? value : trimmedInput; +} +function mapValuesFromTextFilterModel(filterModel, optionsFactory) { + const { filter, filterTo, type } = filterModel || {}; + return [filter || null, filterTo || null].slice(0, getNumberOfInputs(type, optionsFactory)); +} +var SimpleFloatingFilter = class extends Component { + constructor() { + super(...arguments); + this.defaultDebounceMs = 0; + } + setLastTypeFromModel(model) { + if (!model) { + this.lastType = this.optionsFactory.defaultOption; + return; + } + const isCombined = model.operator; + let condition; + if (isCombined) { + const combinedModel = model; + condition = combinedModel.conditions[0]; + } else { + condition = model; + } + this.lastType = condition.type; + } + canWeEditAfterModelFromParentFilter(model) { + if (!model) { + return this.isTypeEditable(this.lastType); + } + const isCombined = model.operator; + if (isCombined) { + return false; + } + const simpleModel = model; + return this.isTypeEditable(simpleModel.type); + } + init(params) { + this.params = params; + const reactive = this.gos.get("enableFilterHandlers"); + this.reactive = reactive; + this.setParams(params); + if (reactive) { + const reactiveParams = params; + this.onModelUpdated(reactiveParams.model); + } + } + setParams(params) { + const optionsFactory = new OptionsFactory; + this.optionsFactory = optionsFactory; + optionsFactory.init(params.filterParams, this.defaultOptions); + this.filterModelFormatter = this.createManagedBean(new this.FilterModelFormatterClass(optionsFactory, params.filterParams)); + this.setSimpleParams(params, false); + } + setSimpleParams(params, update = true) { + const defaultOption = this.optionsFactory.defaultOption; + if (!update) { + this.lastType = defaultOption; + } + this.readOnly = !!params.filterParams.readOnly; + const editable = this.isTypeEditable(defaultOption); + this.setEditable(editable); + } + refresh(params) { + this.params = params; + const reactiveParams = params; + const reactive = this.reactive; + if (!reactive || reactiveParams.source === "colDef") { + this.updateParams(params); + } + if (reactive) { + const { source, model } = reactiveParams; + if (source === "dataChanged" || source === "ui") { + return; + } + this.onModelUpdated(model); + } + } + updateParams(params) { + const optionsFactory = this.optionsFactory; + optionsFactory.refresh(params.filterParams, this.defaultOptions); + this.setSimpleParams(params); + this.filterModelFormatter.updateParams({ + optionsFactory, + filterParams: params.filterParams + }); + } + onParentModelChanged(model, event) { + if (event?.afterFloatingFilter || event?.afterDataChange) { + return; + } + this.onModelUpdated(model); + } + isTypeEditable(type) { + return !!type && !this.readOnly && getNumberOfInputs(type, this.optionsFactory) === 1; + } + getAriaLabel(column) { + const displayName = this.beans.colNames.getDisplayNameForColumn(column, "header", true); + return `${displayName} ${this.getLocaleTextFunc()("ariaFilterInput", "Filter Input")}`; + } +}; +var TextInputFloatingFilterElement = { + tag: "div", + ref: "eFloatingFilterInputContainer", + cls: "ag-floating-filter-input", + role: "presentation" +}; +var TextInputFloatingFilter = class extends SimpleFloatingFilter { + constructor() { + super(...arguments); + this.eFloatingFilterInputContainer = RefPlaceholder; + this.defaultDebounceMs = 500; + } + postConstruct() { + this.setTemplate(TextInputFloatingFilterElement); + } + onModelUpdated(model) { + this.setLastTypeFromModel(model); + this.setEditable(this.canWeEditAfterModelFromParentFilter(model)); + this.inputSvc.setValue(this.filterModelFormatter.getModelAsString(model)); + } + setParams(params) { + this.setupFloatingFilterInputService(params); + super.setParams(params); + this.setTextInputParams(params); + } + setupFloatingFilterInputService(params) { + this.inputSvc = this.createFloatingFilterInputService(params); + this.inputSvc.setupGui(this.eFloatingFilterInputContainer); + } + setTextInputParams(params) { + const { inputSvc, defaultDebounceMs, readOnly } = this; + const { filterPlaceholder, column, browserAutoComplete, filterParams } = params; + const filterOptionKey = this.lastType ?? this.optionsFactory.defaultOption; + const parentFilterPlaceholder = params.filterParams.filterPlaceholder; + const placeholder = filterPlaceholder === true ? getPlaceholderText(this, parentFilterPlaceholder, "filterOoo", filterOptionKey) : filterPlaceholder || undefined; + inputSvc.setParams({ + ariaLabel: this.getAriaLabel(column), + autoComplete: browserAutoComplete ?? false, + placeholder + }); + this.applyActive = _isUseApplyButton(filterParams); + if (!readOnly) { + const debounceMs = getDebounceMs(filterParams, defaultDebounceMs); + inputSvc.setValueChangedListener(_debounce(this, this.syncUpWithParentFilter.bind(this), debounceMs)); + } + } + updateParams(params) { + super.updateParams(params); + this.setTextInputParams(params); + } + recreateFloatingFilterInputService(params) { + const { inputSvc } = this; + const value = inputSvc.getValue(); + _clearElement(this.eFloatingFilterInputContainer); + this.destroyBean(inputSvc); + this.setupFloatingFilterInputService(params); + inputSvc.setValue(value, true); + } + syncUpWithParentFilter(e) { + const isEnterKey = e.key === KeyCode.ENTER; + const reactive = this.reactive; + if (reactive) { + const reactiveParams = this.params; + reactiveParams.onUiChange(); + } + if (this.applyActive && !isEnterKey) { + return; + } + const { inputSvc, params, lastType } = this; + let value = inputSvc.getValue(); + if (params.filterParams.trimInput) { + value = trimInputForFilter(value); + inputSvc.setValue(value, true); + } + if (reactive) { + const reactiveParams = params; + const model = reactiveParams.model; + const parsedValue = this.convertValue(value); + const newModel = parsedValue == null ? null : { + ...model ?? { + filterType: this.filterType, + type: lastType ?? this.optionsFactory.defaultOption + }, + filter: parsedValue + }; + reactiveParams.onModelChange(newModel, { afterFloatingFilter: true }); + } else { + params.parentFilterInstance((filterInstance) => { + filterInstance?.onFloatingFilterChanged(lastType || null, value || null); + }); + } + } + convertValue(value) { + return value || null; + } + setEditable(editable) { + this.inputSvc.setEditable(editable); + } +}; +var CLASS_INPUT_FIELD = ".ag-input-field-input"; +var DateCompWrapper = class { + constructor(context, userCompFactory, colDef, dateComponentParams, eParent, onReady) { + this.context = context; + this.eParent = eParent; + this.alive = true; + this.debouncedReport = _debounce({ isAlive: () => this.alive }, reportValidity, 500); + this.timeoutHandle = null; + const compDetails = _getDateCompDetails(userCompFactory, colDef, dateComponentParams); + compDetails?.newAgStackInstance().then((dateComp) => { + if (!this.alive) { + context.destroyBean(dateComp); + return; + } + this.dateComp = dateComp; + if (!dateComp) { + return; + } + eParent.appendChild(dateComp.getGui()); + dateComp?.afterGuiAttached?.(); + const { tempValue, disabled } = this; + if (tempValue) { + dateComp.setDate(tempValue); + } + if (disabled != null) { + dateComp.setDisabled?.(disabled); + } + onReady?.(this); + }); + } + destroy() { + this.alive = false; + this.dateComp = this.context.destroyBean(this.dateComp); + } + getDate() { + return this.dateComp ? this.dateComp.getDate() : this.tempValue; + } + setDate(value) { + const dateComp = this.dateComp; + if (dateComp) { + dateComp.setDate(value); + } else { + this.tempValue = value; + } + } + setDisabled(disabled) { + const dateComp = this.dateComp; + if (dateComp) { + dateComp.setDisabled?.(disabled); + } else { + this.disabled = disabled; + } + } + setDisplayed(displayed) { + _setDisplayed(this.eParent, displayed); + } + setInputPlaceholder(placeholder) { + this.dateComp?.setInputPlaceholder?.(placeholder); + } + setInputAriaLabel(label) { + this.dateComp?.setInputAriaLabel?.(label); + } + afterGuiAttached(params) { + this.dateComp?.afterGuiAttached?.(params); + } + updateParams(params) { + this.dateComp?.refresh?.(params); + } + setCustomValidity(message, defer = false) { + const eInput = this.dateComp?.getGui().querySelector(CLASS_INPUT_FIELD); + if (eInput && "setCustomValidity" in eInput) { + const isInvalid = message.length > 0; + eInput.setCustomValidity(message); + if (isInvalid) { + if (defer) { + this.timeoutHandle = this.debouncedReport(eInput); + } else { + reportValidity(eInput); + } + } else if (this.timeoutHandle) { + window.clearTimeout(this.timeoutHandle); + } + _setAriaInvalid(eInput, isInvalid); + } + } + getValidity() { + return this.dateComp?.getGui().querySelector(CLASS_INPUT_FIELD)?.validity; + } +}; +function reportValidity(eInput) { + eInput.reportValidity(); +} +var DEFAULT_DATE_FILTER_OPTIONS = [ + "equals", + "notEqual", + "lessThan", + "greaterThan", + "inRange", + "blank", + "notBlank" +]; +function mapValuesFromDateFilterModel(filterModel, optionsFactory) { + const { dateFrom, dateTo, type } = filterModel || {}; + return [ + dateFrom && _parseDateTimeFromString(dateFrom, undefined, true) || null, + dateTo && _parseDateTimeFromString(dateTo, undefined, true) || null + ].slice(0, getNumberOfInputs(type, optionsFactory)); +} +var DEFAULT_MIN_YEAR = 1000; +var DEFAULT_MAX_YEAR = Infinity; +var DateFilter = class extends SimpleFilter { + constructor() { + super("dateFilter", mapValuesFromDateFilterModel, DEFAULT_DATE_FILTER_OPTIONS); + this.eConditionPanelsFrom = []; + this.eConditionPanelsTo = []; + this.dateConditionFromComps = []; + this.dateConditionToComps = []; + this.minValidYear = DEFAULT_MIN_YEAR; + this.maxValidYear = DEFAULT_MAX_YEAR; + this.minValidDate = null; + this.maxValidDate = null; + this.filterType = "date"; + } + afterGuiAttached(params) { + super.afterGuiAttached(params); + this.dateConditionFromComps[0].afterGuiAttached(params); + this.refreshInputValidation(); + } + shouldKeepInvalidInputState() { + return !_isBrowserFirefox() && this.hasInvalidInputs() && this.getConditionTypes().includes("inRange"); + } + commonUpdateSimpleParams(params) { + super.commonUpdateSimpleParams(params); + const yearParser = (param, fallback) => { + const value = params[param]; + if (value != null) { + if (!isNaN(value)) { + return value == null ? fallback : Number(value); + } else { + _warn(82, { param }); + } + } + return fallback; + }; + const minValidYear = yearParser("minValidYear", DEFAULT_MIN_YEAR); + const maxValidYear = yearParser("maxValidYear", DEFAULT_MAX_YEAR); + this.minValidYear = minValidYear; + this.maxValidYear = maxValidYear; + if (minValidYear > maxValidYear) { + _warn(83); + } + const { minValidDate, maxValidDate } = params; + const parsedMinValidDate = minValidDate instanceof Date ? minValidDate : _parseDateTimeFromString(minValidDate); + this.minValidDate = parsedMinValidDate; + const parsedMaxValidDate = maxValidDate instanceof Date ? maxValidDate : _parseDateTimeFromString(maxValidDate); + this.maxValidDate = parsedMaxValidDate; + if (parsedMinValidDate && parsedMaxValidDate && parsedMinValidDate > parsedMaxValidDate) { + _warn(84); + } + } + refreshInputValidation() { + for (let i = 0;i < this.dateConditionFromComps.length; i++) { + this.refreshInputPairValidation(i, false, true); + } + } + refreshInputPairValidation(position, isFrom = false, forceImmediate = false) { + const { dateConditionFromComps, dateConditionToComps, beans } = this; + const from = dateConditionFromComps[position]; + const to = dateConditionToComps[position]; + const numberOfInputs = getNumberOfInputs(this.getConditionType(position), this.optionsFactory); + const fromDate = from.getDate(); + const toDate = to.getDate(); + const localeKey = numberOfInputs >= 2 ? getRangeValidityMessageKey(fromDate, toDate, isFrom) : null; + const message = localeKey ? this.translate(localeKey, [String(isFrom ? toDate : fromDate)]) : ""; + const shouldDebounceReport = !_isBrowserFirefox() && !forceImmediate; + (isFrom ? from : to).setCustomValidity(message, shouldDebounceReport); + (isFrom ? to : from).setCustomValidity("", shouldDebounceReport); + if (message.length > 0) { + beans.ariaAnnounce.announceValue(message, "dateFilter"); + } + } + createDateCompWrapper(element, position, fromTo) { + const { + beans: { userCompFactory, context, gos }, + params + } = this; + const isFrom = fromTo === "from"; + const dateCompWrapper = new DateCompWrapper(context, userCompFactory, params.colDef, _addGridCommonParams(gos, { + onDateChanged: () => { + this.refreshInputPairValidation(position, isFrom); + this.onUiChanged(); + }, + onFocusIn: () => this.refreshInputPairValidation(position, isFrom), + filterParams: params, + location: "filter" + }), element); + this.addDestroyFunc(() => dateCompWrapper.destroy()); + return dateCompWrapper; + } + getState() { + return { isInvalid: this.hasInvalidInputs() }; + } + areStatesEqual(stateA, stateB) { + return (stateA?.isInvalid ?? false) === (stateB?.isInvalid ?? false); + } + setElementValue(element, value) { + element.setDate(value); + if (!value) { + element.setCustomValidity(""); + } + } + setElementDisplayed(element, displayed) { + element.setDisplayed(displayed); + } + setElementDisabled(element, disabled) { + element.setDisabled(disabled); + } + createEValue() { + const eCondition = _createElement({ tag: "div", cls: "ag-filter-body" }); + this.createFromToElement(eCondition, this.eConditionPanelsFrom, this.dateConditionFromComps, "from"); + this.createFromToElement(eCondition, this.eConditionPanelsTo, this.dateConditionToComps, "to"); + return eCondition; + } + createFromToElement(eCondition, eConditionPanels, dateConditionComps, fromTo) { + const eConditionPanel = _createElement({ tag: "div", cls: `ag-filter-${fromTo} ag-filter-date-${fromTo}` }); + eConditionPanels.push(eConditionPanel); + eCondition.appendChild(eConditionPanel); + dateConditionComps.push(this.createDateCompWrapper(eConditionPanel, eConditionPanels.length - 1, fromTo)); + } + removeEValues(startPosition, deleteCount) { + this.removeDateComps(this.dateConditionFromComps, startPosition, deleteCount); + this.removeDateComps(this.dateConditionToComps, startPosition, deleteCount); + removeItems(this.eConditionPanelsFrom, startPosition, deleteCount); + removeItems(this.eConditionPanelsTo, startPosition, deleteCount); + } + removeDateComps(components, startPosition, deleteCount) { + const removedComponents = removeItems(components, startPosition, deleteCount); + for (const comp of removedComponents) { + comp.destroy(); + } + } + isValidDateValue(value) { + if (value === null) { + return false; + } + const { minValidDate, maxValidDate, minValidYear, maxValidYear } = this; + if (minValidDate) { + if (value < minValidDate) { + return false; + } + } else if (value.getUTCFullYear() < minValidYear) { + return false; + } + if (maxValidDate) { + if (value > maxValidDate) { + return false; + } + } else if (value.getUTCFullYear() > maxValidYear) { + return false; + } + return true; + } + hasInvalidInputs() { + let invalidInputs = false; + this.forEachInput((element) => invalidInputs || (invalidInputs = element.getDate() != null && !(element.getValidity()?.valid ?? true))); + return invalidInputs; + } + positionHasInvalidInputs(position) { + let invalidInputs = false; + this.forEachPositionInput(position, (element) => invalidInputs || (invalidInputs = !(element.getValidity()?.valid ?? true))); + return invalidInputs; + } + canApply(_model) { + return !this.hasInvalidInputs(); + } + isConditionUiComplete(position) { + if (!super.isConditionUiComplete(position)) { + return false; + } + let valid = true; + this.forEachPositionInput(position, (element, index, _pos, numberOfInputs) => { + if (!valid || index >= numberOfInputs) { + return; + } + valid && (valid = this.isValidDateValue(element.getDate())); + }); + return valid; + } + areSimpleModelsEqual(aSimple, bSimple) { + return aSimple.dateFrom === bSimple.dateFrom && aSimple.dateTo === bSimple.dateTo && aSimple.type === bSimple.type; + } + createCondition(position) { + const type = this.getConditionType(position); + const model = {}; + const { params, filterType } = this; + const values = this.getValues(position); + const separator = params.useIsoSeparator ? "T" : " "; + if (values.length > 0) { + model.dateFrom = _serialiseDate(values[0], true, separator); + } + if (values.length > 1) { + model.dateTo = _serialiseDate(values[1], true, separator); + } + return { + dateFrom: null, + dateTo: null, + filterType, + type, + ...model + }; + } + removeConditionsAndOperators(startPosition, deleteCount) { + if (this.hasInvalidInputs()) { + return; + } + return super.removeConditionsAndOperators(startPosition, deleteCount); + } + resetPlaceholder() { + const globalTranslate = this.getLocaleTextFunc(); + const placeholder = this.translate("dateFormatOoo"); + const ariaLabel = globalTranslate("ariaFilterValue", "Filter Value"); + this.forEachInput((element) => { + element.setInputPlaceholder(placeholder); + element.setInputAriaLabel(ariaLabel); + }); + } + getInputs(position) { + const { dateConditionFromComps, dateConditionToComps } = this; + if (position >= dateConditionFromComps.length) { + return [null, null]; + } + return [dateConditionFromComps[position], dateConditionToComps[position]]; + } + getValues(position) { + const result = []; + this.forEachPositionInput(position, (element, index, _elPosition, numberOfInputs) => { + if (index < numberOfInputs) { + result.push(element.getDate()); + } + }); + return result; + } + translate(key, variableValues) { + let normalisedKey = key; + if (key === "lessThan") { + normalisedKey = "before"; + } else if (key === "greaterThan") { + normalisedKey = "after"; + } + return super.translate(normalisedKey, variableValues); + } +}; +function getRangeValidityMessageKey(fromDate, toDate, isFrom) { + const isInvalid = fromDate != null && toDate != null && fromDate >= toDate; + if (!isInvalid) { + return null; + } + return `${isFrom ? "max" : "min"}DateValidation`; +} +var DateFilterModelFormatter = class extends SimpleFilterModelFormatter { + constructor(optionsFactory, filterParams) { + super(optionsFactory, filterParams, (value) => { + const { dataTypeSvc, valueSvc } = this.beans; + const column = filterParams.column; + const dateFormatFn = dataTypeSvc?.getDateFormatterFunction(column); + const valueToFormat = dateFormatFn ? dateFormatFn(value ?? undefined) : value; + return valueSvc.formatValue(column, null, valueToFormat); + }); + this.filterTypeKeys = SCALAR_FILTER_TYPE_KEYS; + } + conditionToString(condition, forToolPanel, isRange, customDisplayKey, customDisplayName) { + const { type } = condition; + const dateFrom = _parseDateTimeFromString(condition.dateFrom); + const dateTo = _parseDateTimeFromString(condition.dateTo); + const format = this.filterParams.inRangeFloatingFilterDateFormat; + const formatDate = forToolPanel ? this.formatValue.bind(this) : (value) => _dateToFormattedString(value, format); + const formattedFrom = () => dateFrom !== null ? formatDate(dateFrom) : "null"; + const formattedTo = () => dateTo !== null ? formatDate(dateTo) : "null"; + if (dateFrom == null && dateTo == null) { + return translateForFilter(this, type); + } + if (forToolPanel) { + const valueForToolPanel = this.conditionForToolPanel(type, isRange, formattedFrom, formattedTo, customDisplayKey, customDisplayName); + if (valueForToolPanel != null) { + return valueForToolPanel; + } + } + if (isRange) { + return `${formattedFrom()}-${formattedTo()}`; + } + if (dateFrom != null) { + return formatDate(dateFrom); + } + return `${type}`; + } +}; +function defaultDateComparator(filterDate, cellValue) { + const cellAsDate = cellValue; + if (cellAsDate < filterDate) { + return -1; + } + if (cellAsDate > filterDate) { + return 1; + } + return 0; +} +var DateFilterHandler = class extends ScalarFilterHandler { + constructor() { + super(mapValuesFromDateFilterModel, DEFAULT_DATE_FILTER_OPTIONS); + this.filterType = "date"; + this.FilterModelFormatterClass = DateFilterModelFormatter; + this.filterTypeToRangeCache = /* @__PURE__ */ new Map; + } + getOrRefreshRangeCacheItem(key, rangeFn) { + const { filterTypeToRangeCache } = this; + const now = Date.now(); + let cache = filterTypeToRangeCache.get(key); + if (cache && cache.expires < now) { + cache = undefined; + } + if (!cache) { + const [from, to] = rangeFn(new Date(now), new Date(now)); + cache = { from, to, expires: setStartOfNextDay(new Date(now)).getTime() - now }; + filterTypeToRangeCache.set(key, cache); + } + return cache; + } + comparator() { + return this.params.filterParams.comparator ?? defaultDateComparator; + } + isValid(value) { + const isValidDate2 = this.params.filterParams.isValidDate; + return !isValidDate2 || isValidDate2(value); + } + evaluateNonNullValue(values, cellValue, filterModel) { + const type = filterModel.type; + const comparator = this.comparator(); + if (!this.isValid(cellValue)) { + return type === "notEqual" || type === "notBlank"; + } + const maybeTypeAsPreset = type; + const presetDateRangeFn = presetDateFilterTypeRelativeFromToMap[maybeTypeAsPreset]; + if (presetDateRangeFn) { + const { from, to } = this.getOrRefreshRangeCacheItem(maybeTypeAsPreset, presetDateRangeFn); + return comparator(from, cellValue) >= 0 && comparator(to, cellValue) < 0; + } + return super.evaluateNonNullValue(values, cellValue, filterModel); + } +}; +var DEFAULT_FIRST_DAY_OF_WEEK = 1; +var cachedFirstDayOfWeek = null; +var getFirstDayOfWeek = () => { + if (cachedFirstDayOfWeek != null) { + return cachedFirstDayOfWeek; + } + let firstDay; + const locale = typeof navigator === "undefined" ? undefined : navigator.languages?.[0] ?? navigator.language; + if (locale && typeof Intl !== "undefined" && typeof Intl.Locale === "function") { + try { + const weekInfo = new Intl.Locale(locale).getWeekInfo?.(); + firstDay = weekInfo?.firstDay; + } catch { + firstDay = undefined; + } + } + cachedFirstDayOfWeek = firstDay == null ? DEFAULT_FIRST_DAY_OF_WEEK : firstDay % 7; + return cachedFirstDayOfWeek; +}; +var setStartOfDay = (date) => { + date.setHours(0, 0, 0, 0); + return date; +}; +var setStartOfWeek = (date) => { + const day = date.getDay(); + const weekStart = getFirstDayOfWeek(); + const diff = (day - weekStart + 7) % 7; + date.setDate(date.getDate() - diff); + return setStartOfDay(date); +}; +var setPreviousNDay = (date, n = 1) => { + date.setDate(date.getDate() - n); + return date; +}; +var setStartOfNextDay = (date) => { + date.setDate(date.getDate() + 1); + return setStartOfDay(date); +}; +var setStartOfNextWeek = (date) => { + setStartOfWeek(date); + date.setDate(date.getDate() + 6); + return setStartOfNextDay(date); +}; +var setStartOfMonth = (date) => { + date.setDate(1); + return setStartOfDay(date); +}; +var setStartOfNextMonth = (date) => { + date.setDate(1); + date.setMonth(date.getMonth() + 1); + return setStartOfDay(date); +}; +var setStartOfQuarter = (date) => { + const quarter = Math.floor(date.getMonth() / 3); + date.setMonth(quarter * 3); + return setStartOfMonth(date); +}; +var setStartOfNextQuarter = (date) => { + const quarter = Math.floor(date.getMonth() / 3); + date.setMonth(quarter * 3 + 2); + return setStartOfNextMonth(date); +}; +var setStartOfYear = (date) => { + date.setMonth(0, 1); + return setStartOfDay(date); +}; +var setStartOfNextYear = (date) => { + date.setMonth(12, 0); + return setStartOfNextDay(date); +}; +var setPreviousDay = (date) => setPreviousNDay(date); +var setPreviousWeek = (date) => setPreviousDay(setStartOfWeek(date)); +var setPreviousMonth = (date) => setPreviousDay(setStartOfMonth(date)); +var setPreviousQuarter = (date) => setPreviousDay(setStartOfQuarter(date)); +var today = (from, to) => [setStartOfDay(from), setStartOfNextDay(to)]; +var yesterday = (from, to) => today(setPreviousDay(from), setPreviousDay(to)); +var thisWeek = (from, to) => [setStartOfWeek(from), setStartOfNextWeek(to)]; +var lastWeek = (from, to) => thisWeek(setPreviousWeek(from), setPreviousWeek(to)); +var thisMonth = (from, to) => [setStartOfMonth(from), setStartOfNextMonth(to)]; +var lastMonth = (from, to) => thisMonth(setPreviousMonth(from), setPreviousMonth(to)); +var thisQuarter = (from, to) => [setStartOfQuarter(from), setStartOfNextQuarter(to)]; +var lastQuarter = (from, to) => thisQuarter(setPreviousQuarter(from), setPreviousQuarter(to)); +var thisYear = (from, to) => [setStartOfYear(from), setStartOfNextYear(to)]; +var yearToDate = (from, to) => [setStartOfYear(from), setStartOfNextDay(to)]; +var last7Days = (from, to) => [ + setStartOfDay(setPreviousNDay(from, 7)), + setStartOfNextDay(to) +]; +var last30Days = (from, to) => [ + setStartOfDay(setPreviousNDay(from, 30)), + setStartOfNextDay(to) +]; +var last90Days = (from, to) => [ + setStartOfDay(setPreviousNDay(from, 90)), + setStartOfNextDay(to) +]; +var last6Months = (from, to) => { + from.setFullYear(from.getFullYear() - 1); + from.setMonth(from.getMonth() + 6); + return [setStartOfDay(from), setStartOfNextDay(to)]; +}; +var last12Months = (from, to) => { + from.setFullYear(from.getFullYear() - 1); + return [setStartOfDay(from), setStartOfNextDay(to)]; +}; +var last24Months = (from, to) => { + from.setFullYear(from.getFullYear() - 2); + return [setStartOfDay(from), setStartOfNextDay(to)]; +}; +var lastYear = (from, to) => { + from.setFullYear(from.getFullYear() - 1); + to.setFullYear(to.getFullYear() - 1); + return thisYear(from, to); +}; +var nextYear = (from, to) => { + from.setFullYear(from.getFullYear() + 1); + to.setFullYear(to.getFullYear() + 1); + return thisYear(from, to); +}; +var nextQuarter = (from, to) => { + from.setMonth(from.getMonth() + 3); + to.setMonth(to.getMonth() + 3); + return thisQuarter(from, to); +}; +var nextMonth = (from, to) => { + from.setMonth(from.getMonth() + 1); + to.setMonth(to.getMonth() + 1); + return thisMonth(from, to); +}; +var nextWeek = (from, to) => { + from.setDate(from.getDate() + 7); + to.setDate(to.getDate() + 7); + return thisWeek(from, to); +}; +var tomorrow = (from, to) => { + from.setDate(from.getDate() + 1); + to.setDate(to.getDate() + 1); + return today(from, to); +}; +var presetDateFilterTypeRelativeFromToMap = { + today, + yesterday, + tomorrow, + thisWeek, + lastWeek, + nextWeek, + thisMonth, + lastMonth, + nextMonth, + thisQuarter, + lastQuarter, + nextQuarter, + thisYear, + lastYear, + nextYear, + yearToDate, + last7Days, + last30Days, + last90Days, + last6Months, + last12Months, + last24Months, + setStartOfDay, + setStartOfWeek, + setStartOfNextDay, + setStartOfNextWeek, + setStartOfMonth, + setStartOfNextMonth, + setStartOfQuarter, + setStartOfNextQuarter, + setStartOfYear, + setStartOfNextYear, + setPreviousDay, + setPreviousWeek, + setPreviousMonth, + setPreviousQuarter +}; +var DateFloatingFilterElement = { + tag: "div", + cls: "ag-floating-filter-input", + role: "presentation", + children: [ + { + tag: "ag-input-text-field", + ref: "eReadOnlyText" + }, + { tag: "div", ref: "eDateWrapper", cls: "ag-date-floating-filter-wrapper" } + ] +}; +var DateFloatingFilter = class extends SimpleFloatingFilter { + constructor() { + super(DateFloatingFilterElement, [AgInputTextFieldSelector]); + this.eReadOnlyText = RefPlaceholder; + this.eDateWrapper = RefPlaceholder; + this.FilterModelFormatterClass = DateFilterModelFormatter; + this.filterType = "date"; + this.defaultOptions = DEFAULT_DATE_FILTER_OPTIONS; + } + setParams(params) { + super.setParams(params); + this.createDateComponent(); + const translate = this.getLocaleTextFunc(); + this.eReadOnlyText.setDisabled(true).setInputAriaLabel(translate("ariaDateFilterInput", "Date Filter Input")); + } + updateParams(params) { + super.updateParams(params); + this.dateComp.updateParams(this.getDateComponentParams()); + this.updateCompOnModelChange(params.currentParentModel()); + } + updateCompOnModelChange(model) { + const allowEditing = !this.readOnly && this.canWeEditAfterModelFromParentFilter(model); + this.setEditable(allowEditing); + if (allowEditing) { + const dateModel = model ? _parseDateTimeFromString(model.dateFrom) : null; + this.dateComp.setDate(dateModel); + this.eReadOnlyText.setValue(""); + } else { + this.eReadOnlyText.setValue(this.filterModelFormatter.getModelAsString(model)); + this.dateComp.setDate(null); + } + } + setEditable(editable) { + _setDisplayed(this.eDateWrapper, editable); + _setDisplayed(this.eReadOnlyText.getGui(), !editable); + } + onModelUpdated(model) { + super.setLastTypeFromModel(model); + this.updateCompOnModelChange(model); + } + onDateChanged() { + const filterValueDate = this.dateComp.getDate(); + if (this.reactive) { + const reactiveParams = this.params; + reactiveParams.onUiChange(); + const model = reactiveParams.model; + const filterValueText = _serialiseDate(filterValueDate); + const newModel = filterValueText == null ? null : { + ...model ?? { + filterType: this.filterType, + type: this.lastType ?? this.optionsFactory.defaultOption + }, + dateFrom: filterValueText + }; + reactiveParams.onModelChange(newModel, { afterFloatingFilter: true }); + } else { + this.params.parentFilterInstance((filterInstance) => { + filterInstance?.onFloatingFilterChanged(this.lastType || null, filterValueDate); + }); + } + } + getDateComponentParams() { + const { filterParams } = this.params; + const debounceMs = getDebounceMs(filterParams, this.defaultDebounceMs); + return _addGridCommonParams(this.gos, { + onDateChanged: _debounce(this, this.onDateChanged.bind(this), debounceMs), + filterParams, + location: "floatingFilter" + }); + } + createDateComponent() { + const { + beans: { context, userCompFactory }, + eDateWrapper, + params: { column } + } = this; + this.dateComp = new DateCompWrapper(context, userCompFactory, column.getColDef(), this.getDateComponentParams(), eDateWrapper, (dateComp) => { + dateComp.setInputAriaLabel(this.getAriaLabel(column)); + }); + this.addDestroyFunc(() => this.dateComp.destroy()); + } +}; +var DefaultDateElement = { + tag: "div", + cls: "ag-filter-filter", + children: [ + { + tag: "ag-input-text-field", + ref: "eDateInput", + cls: "ag-date-filter" + } + ] +}; +var DefaultDateComponent = class extends Component { + constructor() { + super(DefaultDateElement, [AgInputTextFieldSelector]); + this.eDateInput = RefPlaceholder; + this.isApply = false; + this.applyOnFocusOut = false; + } + init(params) { + this.params = params; + this.setParams(params); + const inputElement = this.eDateInput.getInputElement(); + this.addManagedListeners(inputElement, { + mouseDown: () => { + if (this.eDateInput.isDisabled() || this.usingSafariDatePicker) { + return; + } + inputElement.focus({ preventScroll: true }); + }, + input: this.handleInput.bind(this, false), + change: this.handleInput.bind(this, true), + focusout: this.handleFocusOut.bind(this), + focusin: this.handleFocusIn.bind(this) + }); + } + handleInput(isChange) { + if (this.eDateInput.isDisabled()) { + return; + } + if (this.isApply) { + this.applyOnFocusOut = !isChange; + if (isChange) { + this.params.onDateChanged(); + } + return; + } + if (!isChange) { + this.params.onDateChanged(); + } + } + handleFocusOut() { + if (this.applyOnFocusOut) { + this.applyOnFocusOut = false; + this.params.onDateChanged(); + } + } + handleFocusIn() { + this.params.onFocusIn?.(); + } + setParams(params) { + const inputElement = this.eDateInput.getInputElement(); + const shouldUseBrowserDatePicker = this.shouldUseBrowserDatePicker(params); + this.usingSafariDatePicker = shouldUseBrowserDatePicker && _isBrowserSafari(); + const { minValidYear, maxValidYear, minValidDate, maxValidDate, buttons, includeTime, colDef } = params.filterParams || {}; + const dataTypeSvc = this.beans.dataTypeSvc; + const shouldUseDateTimeLocal = includeTime ?? dataTypeSvc?.getDateIncludesTimeFlag?.(colDef.cellDataType) ?? false; + if (shouldUseBrowserDatePicker) { + if (shouldUseDateTimeLocal) { + inputElement.type = "datetime-local"; + inputElement.step = "1"; + } else { + inputElement.type = "date"; + } + } else { + inputElement.type = "text"; + } + const parsedMinValidDate = parseOrConstructDate(minValidDate, minValidYear, true); + const parsedMaxValidDate = parseOrConstructDate(maxValidDate, maxValidYear, false); + if (parsedMinValidDate && parsedMaxValidDate && parsedMinValidDate.getTime() > parsedMaxValidDate.getTime()) { + _warn(87); + } + if (parsedMinValidDate) { + inputElement.min = _serialiseDate(parsedMinValidDate, shouldUseDateTimeLocal); + } + if (parsedMaxValidDate) { + inputElement.max = _serialiseDate(parsedMaxValidDate, shouldUseDateTimeLocal); + } + this.isApply = params.location === "floatingFilter" && !!buttons?.includes("apply"); + } + refresh(params) { + this.params = params; + this.setParams(params); + } + getDate() { + return _parseDateTimeFromString(this.eDateInput.getValue()); + } + setDate(date) { + const colType = this.params.filterParams.colDef.cellDataType; + const includeTime = this.beans.dataTypeSvc?.getDateIncludesTimeFlag(colType) ?? false; + this.eDateInput.setValue(_serialiseDate(date, includeTime)); + } + setInputPlaceholder(placeholder) { + this.eDateInput.setInputPlaceholder(placeholder); + } + setInputAriaLabel(ariaLabel) { + this.eDateInput.setAriaLabel(ariaLabel); + } + setDisabled(disabled) { + this.eDateInput.setDisabled(disabled); + } + afterGuiAttached(params) { + if (!params?.suppressFocus) { + this.eDateInput.getInputElement().focus({ preventScroll: true }); + } + } + shouldUseBrowserDatePicker(params) { + return params?.filterParams?.browserDatePicker ?? true; + } +}; +function parseOrConstructDate(date, year, isMin) { + if (date && year) { + _warn(isMin ? 85 : 86); + } + if (date instanceof Date) { + return date; + } + if (date) { + return _parseDateTimeFromString(date); + } else if (year) { + return _parseDateTimeFromString(`${year}-${isMin ? "01-01" : "12-31"}`); + } + return null; +} +var DEFAULT_NUMBER_FILTER_OPTIONS = [ + "equals", + "notEqual", + "greaterThan", + "greaterThanOrEqual", + "lessThan", + "lessThanOrEqual", + "inRange", + "blank", + "notBlank" +]; +function getAllowedCharPattern2(filterParams) { + return filterParams?.allowedCharPattern ?? null; +} +function processNumberFilterValue(value) { + if (value == null) { + return null; + } + return isNaN(value) ? null : value; +} +function mapValuesFromNumberFilterModel(filterModel, optionsFactory) { + const { filter, filterTo, type } = filterModel || {}; + return [processNumberFilterValue(filter), processNumberFilterValue(filterTo)].slice(0, getNumberOfInputs(type, optionsFactory)); +} +var NumberFilter = class extends SimpleFilter { + constructor() { + super("numberFilter", mapValuesFromNumberFilterModel, DEFAULT_NUMBER_FILTER_OPTIONS); + this.eValuesFrom = []; + this.eValuesTo = []; + this.filterType = "number"; + this.defaultDebounceMs = 500; + } + afterGuiAttached(params) { + super.afterGuiAttached(params); + this.refreshInputValidation(); + } + shouldKeepInvalidInputState() { + return !_isBrowserFirefox() && this.hasInvalidInputs() && this.getConditionTypes().includes("inRange"); + } + refreshInputValidation() { + for (let i = 0;i < this.eValuesFrom.length; i++) { + const from = this.eValuesFrom[i]; + const to = this.eValuesTo[i]; + this.refreshInputPairValidation(from, to); + } + } + refreshInputPairValidation(from, to, isFrom = false) { + const parser = this.params.numberParser; + const fromValue = getNormalisedValue(parser, from); + const toValue = getNormalisedValue(parser, to); + const localeKey = getValidityMessageKey2(fromValue, toValue, isFrom); + const validityMessage = localeKey ? this.translate(localeKey, [String(isFrom ? toValue : fromValue)]) : ""; + (isFrom ? from : to).setCustomValidity(validityMessage); + (isFrom ? to : from).setCustomValidity(""); + if (validityMessage.length > 0) { + this.beans.ariaAnnounce.announceValue(validityMessage, "dateFilter"); + } + } + getState() { + return { isInvalid: this.hasInvalidInputs() }; + } + areStatesEqual(stateA, stateB) { + return (stateA?.isInvalid ?? false) === (stateB?.isInvalid ?? false); + } + refresh(legacyNewParams) { + const result = super.refresh(legacyNewParams); + const { state: newState, additionalEventAttributes } = legacyNewParams; + const oldState = this.state; + const fromAction = additionalEventAttributes?.fromAction; + const forceRefreshValidation = fromAction && fromAction != "apply"; + if (forceRefreshValidation || newState.model !== oldState.model || !this.areStatesEqual(newState.state, oldState.state)) { + this.refreshInputValidation(); + } + return result; + } + setElementValue(element, value, fromFloatingFilter) { + const { numberFormatter } = this.params; + const valueToSet = !fromFloatingFilter && numberFormatter ? numberFormatter(value ?? null) : value; + super.setElementValue(element, valueToSet); + if (valueToSet === null) { + element.setCustomValidity(""); + } + } + createEValue() { + const { params, eValuesFrom, eValuesTo } = this; + const allowedCharPattern = getAllowedCharPattern2(params); + const eCondition = _createElement({ tag: "div", cls: "ag-filter-body", role: "presentation" }); + const from = this.createFromToElement(eCondition, eValuesFrom, "from", allowedCharPattern); + const to = this.createFromToElement(eCondition, eValuesTo, "to", allowedCharPattern); + const getFieldChangedListener = (from2, to2, isFrom) => () => this.refreshInputPairValidation(from2, to2, isFrom); + const fromListener = getFieldChangedListener(from, to, true); + from.onValueChange(fromListener); + from.addGuiEventListener("focusin", fromListener); + const toListener = getFieldChangedListener(from, to, false); + to.onValueChange(toListener); + to.addGuiEventListener("focusin", toListener); + return eCondition; + } + createFromToElement(eCondition, eValues, fromTo, allowedCharPattern) { + const eValue = this.createManagedBean(allowedCharPattern ? new AgInputTextField({ allowedCharPattern }) : new AgInputNumberField); + eValue.addCss(`ag-filter-${fromTo}`); + eValue.addCss("ag-filter-filter"); + eValues.push(eValue); + eCondition.appendChild(eValue.getGui()); + return eValue; + } + removeEValues(startPosition, deleteCount) { + const removeComps = (eGui) => this.removeComponents(eGui, startPosition, deleteCount); + removeComps(this.eValuesFrom); + removeComps(this.eValuesTo); + } + getValues(position) { + const result = []; + this.forEachPositionInput(position, (element, index, _elPosition, numberOfInputs) => { + if (index < numberOfInputs) { + result.push(processNumberFilterValue(stringToFloat(this.params.numberParser, element.getValue()))); + } + }); + return result; + } + areSimpleModelsEqual(aSimple, bSimple) { + return aSimple.filter === bSimple.filter && aSimple.filterTo === bSimple.filterTo && aSimple.type === bSimple.type; + } + createCondition(position) { + const type = this.getConditionType(position); + const model = { + filterType: this.filterType, + type + }; + const values = this.getValues(position); + if (values.length > 0) { + model.filter = values[0]; + } + if (values.length > 1) { + model.filterTo = values[1]; + } + return model; + } + removeConditionsAndOperators(startPosition, deleteCount) { + if (this.hasInvalidInputs()) { + return; + } + return super.removeConditionsAndOperators(startPosition, deleteCount); + } + getInputs(position) { + const { eValuesFrom, eValuesTo } = this; + if (position >= eValuesFrom.length) { + return [null, null]; + } + return [eValuesFrom[position], eValuesTo[position]]; + } + hasInvalidInputs() { + let invalidInputs = false; + this.forEachInput((element) => invalidInputs || (invalidInputs = !element.getInputElement().validity.valid)); + return invalidInputs; + } + positionHasInvalidInputs(position) { + let invalidInputs = false; + this.forEachPositionInput(position, (element) => invalidInputs || (invalidInputs = !element.getInputElement().validity.valid)); + return invalidInputs; + } + canApply(_model) { + return !this.hasInvalidInputs(); + } +}; +function stringToFloat(numberParser, value) { + if (typeof value === "number") { + return value; + } + let filterText = _makeNull(value); + if (filterText != null && filterText.trim() === "") { + filterText = null; + } + if (numberParser) { + return numberParser(filterText); + } + return filterText == null || filterText.trim() === "-" ? null : Number.parseFloat(filterText); +} +function getNormalisedValue(numberParser, input) { + return processNumberFilterValue(stringToFloat(numberParser, input.getValue(true))); +} +function getValidityMessageKey2(fromValue, toValue, isFrom) { + const isInvalid = fromValue != null && toValue != null && fromValue >= toValue; + if (!isInvalid) { + return null; + } + return `strict${isFrom ? "Max" : "Min"}ValueValidation`; +} +var NumberFilterModelFormatter = class extends SimpleFilterModelFormatter { + constructor(optionsFactory, filterParams) { + super(optionsFactory, filterParams, filterParams.numberFormatter); + this.filterTypeKeys = SCALAR_FILTER_TYPE_KEYS; + } + conditionToString(condition, forToolPanel, isRange, customDisplayKey, customDisplayName) { + const { filter, filterTo, type } = condition; + const formatValue = this.formatValue.bind(this); + if (forToolPanel) { + const valueForToolPanel = this.conditionForToolPanel(type, isRange, () => formatValue(filter), () => formatValue(filterTo), customDisplayKey, customDisplayName); + if (valueForToolPanel != null) { + return valueForToolPanel; + } + } + if (isRange) { + return `${formatValue(filter)}-${formatValue(filterTo)}`; + } + if (filter != null) { + return formatValue(filter); + } + return `${type}`; + } +}; +var NumberFilterHandler = class extends ScalarFilterHandler { + constructor() { + super(mapValuesFromNumberFilterModel, DEFAULT_NUMBER_FILTER_OPTIONS); + this.filterType = "number"; + this.FilterModelFormatterClass = NumberFilterModelFormatter; + } + comparator() { + return (left, right) => { + if (left === right) { + return 0; + } + return left < right ? 1 : -1; + }; + } + isValid(value) { + return !isNaN(value); + } +}; +var FloatingFilterNumberInputService = class extends BeanStub { + constructor() { + super(...arguments); + this.onValueChanged = () => {}; + this.numberInputActive = true; + } + setupGui(parentElement) { + this.eNumberInput = this.createManagedBean(new AgInputNumberField); + this.eTextInput = this.createManagedBean(new AgInputTextField); + this.eTextInput.setDisabled(true); + const eNumberInput = this.eNumberInput.getGui(); + const eTextInput = this.eTextInput.getGui(); + parentElement.appendChild(eNumberInput); + parentElement.appendChild(eTextInput); + this.setupListeners(eNumberInput, (e) => this.onValueChanged(e)); + this.setupListeners(eTextInput, (e) => this.onValueChanged(e)); + } + setEditable(editable) { + this.numberInputActive = editable; + this.eNumberInput.setDisplayed(this.numberInputActive); + this.eTextInput.setDisplayed(!this.numberInputActive); + } + setAutoComplete(autoComplete) { + this.eNumberInput.setAutoComplete(autoComplete); + this.eTextInput.setAutoComplete(autoComplete); + } + getValue() { + return this.getActiveInputElement().getValue(); + } + setValue(value, silent) { + this.getActiveInputElement().setValue(value, silent); + } + getActiveInputElement() { + return this.numberInputActive ? this.eNumberInput : this.eTextInput; + } + setValueChangedListener(listener) { + this.onValueChanged = listener; + } + setupListeners(element, listener) { + this.addManagedListeners(element, { + input: listener, + keydown: listener + }); + } + setParams({ + ariaLabel, + autoComplete, + placeholder + }) { + this.setAriaLabel(ariaLabel); + if (autoComplete !== undefined) { + this.setAutoComplete(autoComplete); + } + this.setPlaceholder(this.eNumberInput, placeholder); + this.setPlaceholder(this.eTextInput, placeholder); + } + setPlaceholder(input, placeholder) { + input.toggleCss("ag-floating-filter-search-icon", !!placeholder); + input.setInputPlaceholder(placeholder); + } + setAriaLabel(ariaLabel) { + this.eNumberInput.setInputAriaLabel(ariaLabel); + this.eTextInput.setInputAriaLabel(ariaLabel); + } +}; +var NumberFloatingFilter = class extends TextInputFloatingFilter { + constructor() { + super(...arguments); + this.FilterModelFormatterClass = NumberFilterModelFormatter; + this.filterType = "number"; + this.defaultOptions = DEFAULT_NUMBER_FILTER_OPTIONS; + } + updateParams(params) { + const allowedCharPattern = getAllowedCharPattern2(params.filterParams); + if (allowedCharPattern !== this.allowedCharPattern) { + this.recreateFloatingFilterInputService(params); + } + super.updateParams(params); + } + createFloatingFilterInputService(params) { + this.allowedCharPattern = getAllowedCharPattern2(params.filterParams); + if (this.allowedCharPattern) { + return this.createManagedBean(new FloatingFilterTextInputService({ + config: { allowedCharPattern: this.allowedCharPattern } + })); + } + return this.createManagedBean(new FloatingFilterNumberInputService); + } + convertValue(value) { + return value ? Number(value) : null; + } +}; +var DEFAULT_TEXT_FILTER_OPTIONS = [ + "contains", + "notContains", + "equals", + "notEqual", + "startsWith", + "endsWith", + "blank", + "notBlank" +]; +var TextFilter = class extends SimpleFilter { + constructor() { + super("textFilter", mapValuesFromTextFilterModel, DEFAULT_TEXT_FILTER_OPTIONS); + this.filterType = "text"; + this.eValuesFrom = []; + this.eValuesTo = []; + this.defaultDebounceMs = 500; + } + createCondition(position) { + const type = this.getConditionType(position); + const model = { + filterType: this.filterType, + type + }; + const values = this.getValues(position); + if (values.length > 0) { + model.filter = values[0]; + } + if (values.length > 1) { + model.filterTo = values[1]; + } + return model; + } + areSimpleModelsEqual(aSimple, bSimple) { + return aSimple.filter === bSimple.filter && aSimple.filterTo === bSimple.filterTo && aSimple.type === bSimple.type; + } + getInputs(position) { + const { eValuesFrom, eValuesTo } = this; + if (position >= eValuesFrom.length) { + return [null, null]; + } + return [eValuesFrom[position], eValuesTo[position]]; + } + getValues(position) { + const result = []; + this.forEachPositionInput(position, (element, index, _elPosition, numberOfInputs) => { + if (index < numberOfInputs) { + result.push(_makeNull(element.getValue())); + } + }); + return result; + } + createEValue() { + const eCondition = _createElement({ tag: "div", cls: "ag-filter-body", role: "presentation" }); + const { eValuesFrom, eValuesTo } = this; + this.createFromToElement(eCondition, eValuesFrom, "from"); + this.createFromToElement(eCondition, eValuesTo, "to"); + return eCondition; + } + createFromToElement(eCondition, eValues, fromTo) { + const eValue = this.createManagedBean(new AgInputTextField); + eValue.addCss(`ag-filter-${fromTo}`); + eValue.addCss("ag-filter-filter"); + eValues.push(eValue); + eCondition.appendChild(eValue.getGui()); + } + removeEValues(startPosition, deleteCount) { + const removeComps = (eGui) => this.removeComponents(eGui, startPosition, deleteCount); + const { eValuesFrom, eValuesTo } = this; + removeComps(eValuesFrom); + removeComps(eValuesTo); + } +}; +var TextFilterModelFormatter = class extends SimpleFilterModelFormatter { + constructor() { + super(...arguments); + this.filterTypeKeys = TEXT_FILTER_TYPE_KEYS; + } + conditionToString(condition, forToolPanel, isRange, customDisplayKey, customDisplayName) { + const { filter, filterTo, type } = condition; + if (forToolPanel) { + const getValueFunc = (value) => () => translateForFilter(this, "filterSummaryTextQuote", [value]); + const valueForToolPanel = this.conditionForToolPanel(type, isRange, getValueFunc(filter), getValueFunc(filterTo), customDisplayKey, customDisplayName); + if (valueForToolPanel != null) { + return valueForToolPanel; + } + } + if (isRange) { + return `${filter}-${filterTo}`; + } + if (filter != null) { + return `${filter}`; + } + return `${type}`; + } +}; +var defaultMatcher = ({ filterOption, value, filterText }) => { + if (filterText == null) { + return false; + } + switch (filterOption) { + case "contains": + return value.includes(filterText); + case "notContains": + return !value.includes(filterText); + case "equals": + return value === filterText; + case "notEqual": + return value != filterText; + case "startsWith": + return value.indexOf(filterText) === 0; + case "endsWith": { + const index = value.lastIndexOf(filterText); + return index >= 0 && index === value.length - filterText.length; + } + default: + return false; + } +}; +var defaultFormatter = (from) => from; +var defaultLowercaseFormatter = (from) => from == null ? null : from.toString().toLowerCase(); +var TextFilterHandler = class extends SimpleFilterHandler { + constructor() { + super(mapValuesFromTextFilterModel, DEFAULT_TEXT_FILTER_OPTIONS); + this.filterType = "text"; + this.FilterModelFormatterClass = TextFilterModelFormatter; + } + updateParams(params) { + super.updateParams(params); + const filterParams = params.filterParams; + this.matcher = filterParams.textMatcher ?? defaultMatcher; + this.formatter = filterParams.textFormatter ?? (filterParams.caseSensitive ? defaultFormatter : defaultLowercaseFormatter); + } + evaluateNullValue(filterType) { + const filterTypesAllowNulls = ["notEqual", "notContains", "blank"]; + return filterType ? filterTypesAllowNulls.indexOf(filterType) >= 0 : false; + } + evaluateNonNullValue(values, cellValue, filterModel, params) { + const formattedValues = values.map((v) => this.formatter(v)) || []; + const cellValueFormatted = this.formatter(cellValue); + const { + api, + colDef, + column, + context, + filterParams: { textFormatter } + } = this.params; + if (filterModel.type === "blank") { + return isBlank(cellValue); + } else if (filterModel.type === "notBlank") { + return !isBlank(cellValue); + } + const matcherParams = { + api, + colDef, + column, + context, + node: params.node, + data: params.data, + filterOption: filterModel.type, + value: cellValueFormatted, + textFormatter + }; + return formattedValues.some((v) => this.matcher({ ...matcherParams, filterText: v })); + } + processModelToApply(model) { + if (model && this.params.filterParams.trimInput) { + const processCondition = (condition) => { + const newCondition = { + ...condition + }; + const { filter, filterTo } = condition; + if (filter) { + newCondition.filter = trimInputForFilter(filter) ?? null; + } + if (filterTo) { + newCondition.filterTo = trimInputForFilter(filterTo) ?? null; + } + return newCondition; + }; + if (isCombinedFilterModel(model)) { + return { + ...model, + conditions: model.conditions.map(processCondition) + }; + } + return processCondition(model); + } + return model; + } +}; +var TextFloatingFilter = class extends TextInputFloatingFilter { + constructor() { + super(...arguments); + this.FilterModelFormatterClass = TextFilterModelFormatter; + this.filterType = "text"; + this.defaultOptions = DEFAULT_TEXT_FILTER_OPTIONS; + } + createFloatingFilterInputService() { + return this.createManagedBean(new FloatingFilterTextInputService); + } +}; +function isQuickFilterPresent(beans) { + return !!beans.quickFilter?.isFilterPresent(); +} +function getQuickFilter(beans) { + return beans.quickFilter?.getText(); +} +function resetQuickFilter(beans) { + beans.quickFilter?.resetCache(); +} +var QuickFilterService = class extends BeanStub { + constructor() { + super(...arguments); + this.beanName = "quickFilter"; + this.quickFilter = null; + this.quickFilterParts = null; + } + postConstruct() { + const resetListener = this.resetCache.bind(this); + const gos = this.gos; + this.addManagedEventListeners({ + columnPivotModeChanged: resetListener, + newColumnsLoaded: resetListener, + columnRowGroupChanged: resetListener, + columnVisible: () => { + if (!gos.get("includeHiddenColumnsInQuickFilter")) { + this.resetCache(); + } + } + }); + this.addManagedPropertyListener("quickFilterText", (e) => this.setFilter(e.currentValue)); + this.addManagedPropertyListeners(["includeHiddenColumnsInQuickFilter", "applyQuickFilterBeforePivotOrAgg"], () => this.onColumnConfigChanged()); + this.quickFilter = this.parseFilter(gos.get("quickFilterText")); + this.parser = gos.get("quickFilterParser"); + this.matcher = gos.get("quickFilterMatcher"); + this.setFilterParts(); + this.addManagedPropertyListeners(["quickFilterMatcher", "quickFilterParser"], () => this.setParserAndMatcher()); + } + refreshCols() { + const { autoColSvc, colModel, gos, pivotResultCols } = this.beans; + const pivotMode = colModel.isPivotMode(); + const groupAutoCols = autoColSvc?.getColumns(); + const providedCols = colModel.getColDefCols(); + let columnsForQuickFilter = (pivotMode && !gos.get("applyQuickFilterBeforePivotOrAgg") ? pivotResultCols?.getPivotResultCols()?.list : providedCols) ?? []; + if (groupAutoCols) { + columnsForQuickFilter = columnsForQuickFilter.concat(groupAutoCols); + } + this.colsToUse = gos.get("includeHiddenColumnsInQuickFilter") ? columnsForQuickFilter : columnsForQuickFilter.filter((col) => col.isVisible() || col.isRowGroupActive()); + } + isFilterPresent() { + return this.quickFilter !== null; + } + doesRowPass(node) { + const usingCache = this.gos.get("cacheQuickFilter"); + if (this.matcher) { + return this.doesRowPassMatcher(usingCache, node); + } + return this.quickFilterParts.every((part) => usingCache ? this.doesRowPassCache(node, part) : this.doesRowPassNoCache(node, part)); + } + resetCache() { + this.beans.rowModel.forEachNode((node) => node.quickFilterAggregateText = null); + } + getText() { + return this.gos.get("quickFilterText"); + } + setFilterParts() { + const { quickFilter, parser } = this; + if (quickFilter) { + this.quickFilterParts = parser ? parser(quickFilter) : quickFilter.split(" "); + } else { + this.quickFilterParts = null; + } + } + parseFilter(newFilter) { + if (!_exists(newFilter)) { + return null; + } + return newFilter.toUpperCase(); + } + setFilter(newFilter) { + if (newFilter != null && typeof newFilter !== "string") { + _warn(70, { newFilter }); + return; + } + const parsedFilter = this.parseFilter(newFilter); + if (this.quickFilter !== parsedFilter) { + this.quickFilter = parsedFilter; + this.setFilterParts(); + this.dispatchLocalEvent({ type: "quickFilterChanged" }); + } + } + setParserAndMatcher() { + const parser = this.gos.get("quickFilterParser"); + const matcher = this.gos.get("quickFilterMatcher"); + const hasChanged = parser !== this.parser || matcher !== this.matcher; + this.parser = parser; + this.matcher = matcher; + if (hasChanged) { + this.setFilterParts(); + this.dispatchLocalEvent({ type: "quickFilterChanged" }); + } + } + onColumnConfigChanged() { + this.refreshCols(); + this.resetCache(); + if (this.isFilterPresent()) { + this.dispatchLocalEvent({ type: "quickFilterChanged" }); + } + } + doesRowPassNoCache(node, filterPart) { + return this.colsToUse.some((column) => { + const part = this.getTextForColumn(column, node); + return _exists(part) && part.includes(filterPart); + }); + } + doesRowPassCache(node, filterPart) { + this.checkGenerateAggText(node); + return node.quickFilterAggregateText.includes(filterPart); + } + doesRowPassMatcher(usingCache, node) { + let quickFilterAggregateText; + if (usingCache) { + this.checkGenerateAggText(node); + quickFilterAggregateText = node.quickFilterAggregateText; + } else { + quickFilterAggregateText = this.getAggText(node); + } + const { quickFilterParts, matcher } = this; + return matcher(quickFilterParts, quickFilterAggregateText); + } + checkGenerateAggText(node) { + if (!node.quickFilterAggregateText) { + node.quickFilterAggregateText = this.getAggText(node); + } + } + getTextForColumn(column, node) { + let value = this.beans.filterValueSvc.getValue(column, node); + const colDef = column.getColDef(); + if (colDef.getQuickFilterText) { + const params = _addGridCommonParams(this.gos, { + value, + node, + data: node.data, + column, + colDef + }); + value = colDef.getQuickFilterText(params); + } + return _exists(value) ? value.toString().toUpperCase() : null; + } + getAggText(node) { + const stringParts = []; + for (const column of this.colsToUse) { + const part = this.getTextForColumn(column, node); + if (_exists(part)) { + stringParts.push(part); + } + } + return stringParts.join(` +`); + } +}; +var ClientSideRowModelFilterModule = { + moduleName: "ClientSideRowModelFilter", + version: VERSION, + rowModels: ["clientSide"], + beans: [FilterStage] +}; +var FilterCoreModule = { + moduleName: "FilterCore", + version: VERSION, + beans: [FilterManager], + apiFunctions: { + isAnyFilterPresent, + onFilterChanged + }, + css: [column_filters_default], + dependsOn: [ClientSideRowModelFilterModule] +}; +var FilterValueModule = { + moduleName: "FilterValue", + version: VERSION, + beans: [FilterValueService] +}; +var ColumnFilterModule = { + moduleName: "ColumnFilter", + version: VERSION, + beans: [ColumnFilterService, FilterMenuFactory], + dynamicBeans: { headerFilterCellCtrl: HeaderFilterCellCtrl }, + icons: { + filter: "filter", + filterActive: "filter" + }, + apiFunctions: { + isColumnFilterPresent, + getColumnFilterInstance, + destroyFilter, + setFilterModel, + getFilterModel, + getColumnFilterModel, + setColumnFilterModel, + showColumnFilter, + hideColumnFilter, + getColumnFilterHandler, + doFilterAction + }, + dependsOn: [FilterCoreModule, PopupModule, FilterValueModule, SharedMenuModule] +}; +var TextFilterModule = { + moduleName: "TextFilter", + version: VERSION, + dependsOn: [ColumnFilterModule], + userComponents: { + agTextColumnFilter: { + classImp: TextFilter, + params: { + useForm: true + } + }, + agTextColumnFloatingFilter: TextFloatingFilter + }, + dynamicBeans: { + agTextColumnFilterHandler: TextFilterHandler + } +}; +var NumberFilterModule = { + moduleName: "NumberFilter", + version: VERSION, + dependsOn: [ColumnFilterModule], + userComponents: { + agNumberColumnFilter: { + classImp: NumberFilter, + params: { + useForm: true + } + }, + agNumberColumnFloatingFilter: NumberFloatingFilter + }, + dynamicBeans: { + agNumberColumnFilterHandler: NumberFilterHandler + } +}; +var DateFilterModule = { + moduleName: "DateFilter", + version: VERSION, + dependsOn: [ColumnFilterModule], + userComponents: { + agDateColumnFilter: { + classImp: DateFilter, + params: { + useForm: true + } + }, + agDateInput: DefaultDateComponent, + agDateColumnFloatingFilter: DateFloatingFilter + }, + dynamicBeans: { + agDateColumnFilterHandler: DateFilterHandler + } +}; +var QuickFilterCoreModule = { + moduleName: "QuickFilterCore", + version: VERSION, + rowModels: ["clientSide"], + beans: [QuickFilterService], + dependsOn: [FilterCoreModule, FilterValueModule] +}; +var QuickFilterModule = { + moduleName: "QuickFilter", + version: VERSION, + apiFunctions: { + isQuickFilterPresent, + getQuickFilter, + resetQuickFilter + }, + dependsOn: [QuickFilterCoreModule] +}; +var ApiEventService = class extends BeanStub { + constructor() { + super(...arguments); + this.beanName = "apiEventSvc"; + this.syncListeners = /* @__PURE__ */ new Map; + this.asyncListeners = /* @__PURE__ */ new Map; + this.syncGlobalListeners = /* @__PURE__ */ new Set; + this.globalListenerPairs = /* @__PURE__ */ new Map; + } + postConstruct() { + this.wrapSvc = this.beans.frameworkOverrides.createGlobalEventListenerWrapper?.(); + } + addListener(eventType, userListener) { + const listener = this.wrapSvc?.wrap(eventType, userListener) ?? userListener; + const async = !ALWAYS_SYNC_GLOBAL_EVENTS.has(eventType); + const listeners = async ? this.asyncListeners : this.syncListeners; + if (!listeners.has(eventType)) { + listeners.set(eventType, /* @__PURE__ */ new Set); + } + listeners.get(eventType).add(listener); + this.eventSvc.addListener(eventType, listener, async); + } + removeListener(eventType, userListener) { + const listener = this.wrapSvc?.unwrap(eventType, userListener) ?? userListener; + const asyncListeners = this.asyncListeners.get(eventType); + const hasAsync = !!asyncListeners?.delete(listener); + if (!hasAsync) { + this.syncListeners.get(eventType)?.delete(listener); + } + this.eventSvc.removeListener(eventType, listener, hasAsync); + } + addGlobalListener(userListener) { + const listener = this.wrapSvc?.wrapGlobal(userListener) ?? userListener; + const syncListener = (eventType, event) => { + if (ALWAYS_SYNC_GLOBAL_EVENTS.has(eventType)) { + listener(eventType, event); + } + }; + const asyncListener = (eventType, event) => { + if (!ALWAYS_SYNC_GLOBAL_EVENTS.has(eventType)) { + listener(eventType, event); + } + }; + this.globalListenerPairs.set(userListener, { syncListener, asyncListener }); + const eventSvc = this.eventSvc; + eventSvc.addGlobalListener(syncListener, false); + eventSvc.addGlobalListener(asyncListener, true); + } + removeGlobalListener(userListener) { + const { eventSvc, wrapSvc, globalListenerPairs } = this; + const listener = wrapSvc?.unwrapGlobal(userListener) ?? userListener; + const hasAsync = globalListenerPairs.has(listener); + if (hasAsync) { + const { syncListener, asyncListener } = globalListenerPairs.get(listener); + eventSvc.removeGlobalListener(syncListener, false); + eventSvc.removeGlobalListener(asyncListener, true); + globalListenerPairs.delete(userListener); + } else { + this.syncGlobalListeners.delete(listener); + eventSvc.removeGlobalListener(listener, false); + } + } + destroyEventListeners(map, async) { + map.forEach((listeners, eventType) => { + listeners.forEach((listener) => this.eventSvc.removeListener(eventType, listener, async)); + listeners.clear(); + }); + map.clear(); + } + destroyGlobalListeners(set, async) { + for (const listener of set) { + this.eventSvc.removeGlobalListener(listener, async); + } + set.clear(); + } + destroy() { + super.destroy(); + this.destroyEventListeners(this.syncListeners, false); + this.destroyEventListeners(this.asyncListeners, true); + this.destroyGlobalListeners(this.syncGlobalListeners, false); + const { globalListenerPairs, eventSvc } = this; + globalListenerPairs.forEach(({ syncListener, asyncListener }) => { + eventSvc.removeGlobalListener(syncListener, false); + eventSvc.removeGlobalListener(asyncListener, true); + }); + globalListenerPairs.clear(); + } +}; +function addEventListener(beans, eventType, listener) { + beans.apiEventSvc?.addListener(eventType, listener); +} +function removeEventListener(beans, eventType, listener) { + beans.apiEventSvc?.removeListener(eventType, listener); +} +function addGlobalListener(beans, listener) { + beans.apiEventSvc?.addGlobalListener(listener); +} +function removeGlobalListener(beans, listener) { + beans.apiEventSvc?.removeGlobalListener(listener); +} +var EventApiModule = { + moduleName: "EventApi", + version: VERSION, + apiFunctions: { + addEventListener, + addGlobalListener, + removeEventListener, + removeGlobalListener + }, + beans: [ApiEventService] +}; +function _formatNumberCommas(value, getLocaleTextFunc) { + if (typeof value !== "number") { + return ""; + } + const localeTextFunc = getLocaleTextFunc(); + const thousandSeparator = localeTextFunc("thousandSeparator", ","); + const decimalSeparator = localeTextFunc("decimalSeparator", "."); + return value.toString().replace(".", decimalSeparator).replace(/(\d)(?=(\d{3})+(?!\d))/g, `$1${thousandSeparator}`); +} +var ARROW_UP = "↑"; +var ARROW_DOWN = "↓"; +var AnimateShowChangeCellRendererElement = { + tag: "span", + children: [ + { tag: "span", ref: "eDelta", cls: "ag-value-change-delta" }, + { tag: "span", ref: "eValue", cls: "ag-value-change-value" } + ] +}; +var AnimateShowChangeCellRenderer = class extends Component { + constructor() { + super(AnimateShowChangeCellRendererElement); + this.eValue = RefPlaceholder; + this.eDelta = RefPlaceholder; + this.refreshCount = 0; + } + init(params) { + this.refresh(params, true); + } + showDelta(params, delta) { + const absDelta = Math.abs(delta); + const valueFormatted = params.formatValue(absDelta); + const valueToUse = _exists(valueFormatted) ? valueFormatted : absDelta; + const deltaUp = delta >= 0; + const eDelta = this.eDelta; + if (deltaUp) { + eDelta.textContent = ARROW_UP + valueToUse; + } else { + eDelta.textContent = ARROW_DOWN + valueToUse; + } + eDelta.classList.toggle("ag-value-change-delta-up", deltaUp); + eDelta.classList.toggle("ag-value-change-delta-down", !deltaUp); + } + setTimerToRemoveDelta() { + this.refreshCount++; + const refreshCountCopy = this.refreshCount; + this.beans.frameworkOverrides.wrapIncoming(() => { + window.setTimeout(() => { + if (refreshCountCopy === this.refreshCount) { + this.hideDeltaValue(); + } + }, 2000); + }); + } + hideDeltaValue() { + this.eValue.classList.remove("ag-value-change-value-highlight"); + _clearElement(this.eDelta); + } + refresh(params, isInitialRender = false) { + const { value, valueFormatted } = params; + const { eValue, lastValue, beans } = this; + if (value === lastValue) { + return false; + } + if (_exists(valueFormatted)) { + eValue.textContent = valueFormatted; + } else if (_exists(value)) { + eValue.textContent = value; + } else { + _clearElement(eValue); + } + if (beans.filterManager?.isSuppressFlashingCellsBecauseFiltering()) { + return false; + } + const numericValue = value && typeof value === "object" && "toNumber" in value ? value.toNumber() : value; + const numericLastValue = lastValue && typeof lastValue === "object" && "toNumber" in lastValue ? lastValue.toNumber() : lastValue; + if (numericValue === numericLastValue) { + return false; + } + if (typeof numericValue === "number" && typeof numericLastValue === "number") { + const delta = numericValue - numericLastValue; + this.showDelta(params, delta); + } + if (lastValue) { + eValue.classList.add("ag-value-change-value-highlight"); + } + if (!isInitialRender) { + this.setTimerToRemoveDelta(); + } + this.lastValue = value; + return true; + } +}; +var animateSlideCellRenderer_default = ".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}"; +var AnimateSlideCellRendererElement = { + tag: "span", + children: [{ tag: "span", ref: "eCurrent", cls: "ag-value-slide-current" }] +}; +var AnimateSlideCellRenderer = class extends Component { + constructor() { + super(AnimateSlideCellRendererElement); + this.eCurrent = RefPlaceholder; + this.refreshCount = 0; + this.registerCSS(animateSlideCellRenderer_default); + } + init(params) { + this.refresh(params, true); + } + addSlideAnimation() { + this.refreshCount++; + const refreshCountCopy = this.refreshCount; + this.ePrevious?.remove(); + const { beans, eCurrent } = this; + const prevElement = _createElement({ tag: "span", cls: "ag-value-slide-previous ag-value-slide-out" }); + this.ePrevious = prevElement; + prevElement.textContent = eCurrent.textContent; + this.getGui().insertBefore(prevElement, eCurrent); + beans.frameworkOverrides.wrapIncoming(() => { + window.setTimeout(() => { + if (refreshCountCopy !== this.refreshCount) { + return; + } + this.ePrevious.classList.add("ag-value-slide-out-end"); + }, 50); + window.setTimeout(() => { + if (refreshCountCopy !== this.refreshCount) { + return; + } + this.ePrevious?.remove(); + this.ePrevious = null; + }, 3000); + }); + } + refresh(params, isInitialRender = false) { + let value = params.value; + if (_missing(value)) { + value = ""; + } + if (value === this.lastValue) { + return false; + } + if (this.beans.filterManager?.isSuppressFlashingCellsBecauseFiltering()) { + return false; + } + if (!isInitialRender) { + this.addSlideAnimation(); + } + this.lastValue = value; + const eCurrent = this.eCurrent; + if (_exists(params.valueFormatted)) { + eCurrent.textContent = params.valueFormatted; + } else if (_exists(params.value)) { + eCurrent.textContent = value; + } else { + _clearElement(eCurrent); + } + return true; + } +}; +var CellFlashService = class extends BeanStub { + constructor() { + super(...arguments); + this.beanName = "cellFlashSvc"; + this.nextAnimationTime = null; + this.nextAnimationCycle = null; + this.animations = { + highlight: /* @__PURE__ */ new Map, + "data-changed": /* @__PURE__ */ new Map + }; + } + animateCell(cellCtrl, cssName, flashDuration = this.beans.gos.get("cellFlashDuration"), fadeDuration = this.beans.gos.get("cellFadeDuration")) { + const animations = this.animations[cssName]; + animations.delete(cellCtrl); + const time = Date.now(); + const flashEndTime = time + flashDuration; + const fadeEndTime = time + flashDuration + fadeDuration; + const animState = { + phase: "flash", + flashEndTime, + fadeEndTime + }; + animations.set(cellCtrl, animState); + const cssBase = `ag-cell-${cssName}`; + const cssAnimation = `${cssBase}-animation`; + const { + comp, + eGui: { style } + } = cellCtrl; + comp.toggleCss(cssBase, true); + comp.toggleCss(cssAnimation, false); + style.removeProperty("transition"); + style.removeProperty("transition-delay"); + if (this.nextAnimationTime && flashEndTime + 15 < this.nextAnimationTime) { + clearTimeout(this.nextAnimationCycle); + this.nextAnimationCycle = null; + this.nextAnimationTime = null; + } + if (!this.nextAnimationCycle) { + this.beans.frameworkOverrides.wrapIncoming(() => { + this.nextAnimationCycle = setTimeout(this.advanceAnimations.bind(this), flashDuration); + }); + this.nextAnimationTime = flashEndTime; + } + } + advanceAnimations() { + const time = Date.now(); + let nextAnimationTime = null; + for (const cssName of Object.keys(this.animations)) { + const animations = this.animations[cssName]; + const cssBase = `ag-cell-${cssName}`; + const cssAnimation = `${cssBase}-animation`; + for (const [cell, animState] of animations) { + if (!cell.isAlive() || !cell.comp) { + animations.delete(cell); + continue; + } + const { phase, flashEndTime, fadeEndTime } = animState; + const nextActionableTime = phase === "flash" ? flashEndTime : fadeEndTime; + const requiresAction = time + 15 >= nextActionableTime; + if (!requiresAction) { + nextAnimationTime = Math.min(nextActionableTime, nextAnimationTime ?? Infinity); + continue; + } + const { + comp, + eGui: { style } + } = cell; + switch (phase) { + case "flash": + comp.toggleCss(cssBase, false); + comp.toggleCss(cssAnimation, true); + style.transition = `background-color ${fadeEndTime - flashEndTime}ms`; + style.transitionDelay = `${flashEndTime - time}ms`; + nextAnimationTime = Math.min(fadeEndTime, nextAnimationTime ?? Infinity); + animState.phase = "fade"; + break; + case "fade": + comp.toggleCss(cssBase, false); + comp.toggleCss(cssAnimation, false); + style.removeProperty("transition"); + style.removeProperty("transition-delay"); + animations.delete(cell); + break; + } + } + } + if (nextAnimationTime == null) { + this.nextAnimationTime = null; + this.nextAnimationCycle = null; + } else if (nextAnimationTime) { + this.nextAnimationCycle = setTimeout(this.advanceAnimations.bind(this), nextAnimationTime - time); + this.nextAnimationTime = nextAnimationTime; + } + } + onFlashCells(cellCtrl, event) { + if (!cellCtrl.comp) { + return; + } + const cellId = _createCellId(cellCtrl.cellPosition); + const shouldFlash = event.cells[cellId]; + if (shouldFlash) { + this.animateCell(cellCtrl, "highlight"); + } + } + flashCell(cellCtrl, delays) { + this.animateCell(cellCtrl, "data-changed", delays?.flashDuration, delays?.fadeDuration); + } + destroy() { + for (const cssName of Object.keys(this.animations)) { + const animations = this.animations[cssName]; + animations.clear(); + } + } +}; +function flashCells(beans, params = {}) { + const { cellFlashSvc } = beans; + if (!cellFlashSvc) { + return; + } + beans.frameworkOverrides.wrapIncoming(() => { + for (const cellCtrl of beans.rowRenderer.getCellCtrls(params.rowNodes, params.columns)) { + cellFlashSvc.flashCell(cellCtrl, params); + } + }); +} +var HighlightChangesModule = { + moduleName: "HighlightChanges", + version: VERSION, + beans: [CellFlashService], + userComponents: { + agAnimateShowChangeCellRenderer: AnimateShowChangeCellRenderer, + agAnimateSlideCellRenderer: AnimateSlideCellRenderer + }, + apiFunctions: { + flashCells + } +}; +var SelectionColService = class extends BeanStub { + constructor() { + super(...arguments); + this.beanName = "selectionColSvc"; + } + postConstruct() { + this.addManagedPropertyListener("rowSelection", (event) => { + this.onSelectionOptionsChanged(event.currentValue, event.previousValue, _convertColumnEventSourceType(event.source)); + }); + this.addManagedPropertyListener("selectionColumnDef", this.updateColumns.bind(this)); + } + addColumns(cols) { + const selectionCols = this.columns; + if (selectionCols == null) { + return; + } + cols.list = selectionCols.list.concat(cols.list); + cols.tree = selectionCols.tree.concat(cols.tree); + _updateColsMap(cols); + } + createColumns(cols, updateOrders) { + const destroyCollection = () => { + _destroyColumnTree(this.beans, this.columns?.tree); + this.columns = null; + }; + const newTreeDepth = cols.treeDepth; + const oldTreeDepth = this.columns?.treeDepth ?? -1; + const treeDepthSame = oldTreeDepth == newTreeDepth; + const list = this.generateSelectionCols(); + const areSame = _areColIdsEqual(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 putSelectionColsFirstInList = (cols2) => { + if (!cols2) { + return null; + } + const colsFiltered = cols2.filter((col) => !isColumnSelectionCol(col)); + return [...list, ...colsFiltered]; + }; + updateOrders(putSelectionColsFirstInList); + } + updateColumns(event) { + const source = _convertColumnEventSourceType(event.source); + const { beans } = this; + for (const col of this.columns?.list ?? []) { + const colDef = this.createSelectionColDef(event.currentValue); + col.setColDef(colDef, null, source); + _applyColumnState(beans, { state: [_getColumnStateFromColDef(colDef, col.colId)] }, source); + } + } + getColumn(key) { + return this.columns?.list.find((col) => _columnsMatch(col, key)) ?? null; + } + getColumns() { + return this.columns?.list ?? null; + } + isSelectionColumnEnabled() { + const { gos, beans } = this; + const rowSelection = gos.get("rowSelection"); + if (typeof rowSelection !== "object" || !_isRowSelection(gos)) { + return false; + } + const hasAutoCols = (beans.autoColSvc?.getColumns()?.length ?? 0) > 0; + if (rowSelection.checkboxLocation === "autoGroupColumn" && hasAutoCols) { + return false; + } + const checkboxes = !!_getCheckboxes(rowSelection); + const headerCheckbox = _getHeaderCheckbox(rowSelection); + return checkboxes || headerCheckbox; + } + createSelectionColDef(def) { + const { gos } = this; + const selectionColumnDef = def ?? gos.get("selectionColumnDef"); + const enableRTL = gos.get("enableRtl"); + const { rowSpan: _, spanRows: __, ...filteredSelColDef } = selectionColumnDef ?? {}; + return { + width: 50, + resizable: false, + suppressHeaderMenuButton: true, + sortable: false, + suppressMovable: true, + lockPosition: enableRTL ? "right" : "left", + comparator(valueA, valueB, nodeA, nodeB) { + const aSelected = nodeA.isSelected(); + const bSelected = nodeB.isSelected(); + return aSelected === bSelected ? 0 : aSelected ? 1 : -1; + }, + editable: false, + suppressFillHandle: true, + suppressAutoSize: true, + pinned: null, + ...filteredSelColDef, + colId: SELECTION_COLUMN_ID, + chartDataType: "excluded" + }; + } + generateSelectionCols() { + if (!this.isSelectionColumnEnabled()) { + return []; + } + const colDef = this.createSelectionColDef(); + const colId = colDef.colId; + this.gos.validateColDef(colDef, colId, true); + const col = new AgColumn(colDef, null, colId, false); + this.createBean(col); + return [col]; + } + onSelectionOptionsChanged(current, prev, source) { + const prevCheckbox = prev && typeof prev !== "string" ? _getCheckboxes(prev) : undefined; + const currCheckbox = current && typeof current !== "string" ? _getCheckboxes(current) : undefined; + const checkboxHasChanged = prevCheckbox !== currCheckbox; + const prevHeaderCheckbox = prev && typeof prev !== "string" ? _getHeaderCheckbox(prev) : undefined; + const currHeaderCheckbox = current && typeof current !== "string" ? _getHeaderCheckbox(current) : undefined; + const headerCheckboxHasChanged = prevHeaderCheckbox !== currHeaderCheckbox; + const currLocation = _getCheckboxLocation(current); + const prevLocation = _getCheckboxLocation(prev); + const locationChanged = currLocation !== prevLocation; + if (checkboxHasChanged || headerCheckboxHasChanged || locationChanged) { + this.beans.colModel.refreshAll(source); + } + } + destroy() { + _destroyColumnTree(this.beans, this.columns?.tree); + super.destroy(); + } + refreshVisibility(leftCols, centerCols, rightCols) { + if (!this.columns?.list.length) { + return; + } + const numVisibleCols = leftCols.length + centerCols.length + rightCols.length; + if (numVisibleCols === 0) { + return; + } + const column = this.columns.list[0]; + if (!column.isVisible()) { + return; + } + const hideSelectionCol = () => { + let cols; + switch (column.pinned) { + case "left": + case true: + cols = leftCols; + break; + case "right": + cols = rightCols; + break; + default: + cols = centerCols; + } + if (cols) { + _removeFromArray(cols, column); + } + }; + const rowNumbersCol = this.beans.rowNumbersSvc?.getColumn(ROW_NUMBERS_COLUMN_ID); + const expectedNumCols = rowNumbersCol ? 2 : 1; + if (expectedNumCols === numVisibleCols) { + hideSelectionCol(); + } + } +}; +var rowSelection_default = ':where(.ag-selection-checkbox) .ag-checkbox-input-wrapper:before{content:"";cursor:pointer;inset:-8px;position:absolute}'; +function setNodesSelected(beans, params) { + const allNodesValid = params.nodes.every((node) => { + if (node.rowPinned && !_isManualPinnedRow(node)) { + _warn(59); + return false; + } + if (node.id === undefined) { + _warn(60); + return false; + } + return true; + }); + if (!allNodesValid) { + return; + } + const { nodes, source, newValue } = params; + beans.selectionSvc?.setNodesSelected({ nodes, source: source ?? "api", newValue }); +} +function selectAll(beans, selectAll2, source = "apiSelectAll") { + beans.selectionSvc?.selectAllRowNodes({ source, selectAll: selectAll2 }); +} +function deselectAll(beans, selectAll2, source = "apiSelectAll") { + beans.selectionSvc?.deselectAllRowNodes({ source, selectAll: selectAll2 }); +} +function selectAllFiltered(beans, source = "apiSelectAllFiltered") { + beans.selectionSvc?.selectAllRowNodes({ source, selectAll: "filtered" }); +} +function deselectAllFiltered(beans, source = "apiSelectAllFiltered") { + beans.selectionSvc?.deselectAllRowNodes({ source, selectAll: "filtered" }); +} +function selectAllOnCurrentPage(beans, source = "apiSelectAllCurrentPage") { + beans.selectionSvc?.selectAllRowNodes({ source, selectAll: "currentPage" }); +} +function deselectAllOnCurrentPage(beans, source = "apiSelectAllCurrentPage") { + beans.selectionSvc?.deselectAllRowNodes({ source, selectAll: "currentPage" }); +} +function getSelectedNodes(beans) { + return beans.selectionSvc?.getSelectedNodes() ?? []; +} +function getSelectedRows(beans) { + return beans.selectionSvc?.getSelectedRows() ?? []; +} +var CheckboxSelectionComponentElement = { + tag: "div", + cls: "ag-selection-checkbox", + role: "presentation", + children: [ + { + tag: "ag-checkbox", + ref: "eCheckbox", + role: "presentation" + } + ] +}; +var CheckboxSelectionComponent = class extends Component { + constructor() { + super(CheckboxSelectionComponentElement, [AgCheckboxSelector]); + this.eCheckbox = RefPlaceholder; + } + postConstruct() { + this.eCheckbox.setPassive(true); + } + onDataChanged() { + this.onSelectionChanged(); + } + onSelectableChanged() { + this.showOrHideSelect(); + } + onSelectionChanged() { + const translate = this.getLocaleTextFunc(); + const { rowNode, eCheckbox } = this; + const state = rowNode.isSelected(); + const stateName = _getAriaCheckboxStateName(translate, state); + const [ariaKey, ariaLabel] = rowNode.selectable ? ["ariaRowToggleSelection", "Press Space to toggle row selection"] : ["ariaRowSelectionDisabled", "Row Selection is disabled for this row"]; + const translatedLabel = translate(ariaKey, ariaLabel); + eCheckbox.setValue(state, true); + eCheckbox.setInputAriaLabel(`${translatedLabel} (${stateName})`); + } + init(params) { + this.rowNode = params.rowNode; + this.column = params.column; + this.overrides = params.overrides; + this.onSelectionChanged(); + this.addManagedListeners(this.eCheckbox.getWrapperElement(), { + dblclick: _stopPropagationForAgGrid, + click: (event) => { + _stopPropagationForAgGrid(event); + if (this.eCheckbox.isDisabled()) { + return; + } + this.beans.selectionSvc?.handleSelectionEvent(event, 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, previousValue }) => { + const curr = typeof currentValue === "object" ? _getHideDisabledCheckboxes(currentValue) : undefined; + const prev = typeof previousValue === "object" ? _getHideDisabledCheckboxes(previousValue) : undefined; + if (curr !== prev) { + this.onSelectableChanged(); + } + }); + const isRowSelectableFunc = _getIsRowSelectable(this.gos); + const checkboxVisibleIsDynamic = isRowSelectableFunc || typeof this.getIsVisible() === "function"; + if (checkboxVisibleIsDynamic) { + const showOrHideSelectListener = this.showOrHideSelect.bind(this); + this.addManagedEventListeners({ displayedColumnsChanged: showOrHideSelectListener }); + this.addManagedListeners(this.rowNode, { + dataChanged: showOrHideSelectListener, + cellChanged: showOrHideSelectListener + }); + this.showOrHideSelect(); + } + this.eCheckbox.getInputElement().setAttribute("tabindex", "-1"); + } + showOrHideSelect() { + const { column, rowNode, overrides, gos } = this; + const selectable = rowNode.selectable; + const isVisible = this.getIsVisible(); + let checkboxes = undefined; + if (typeof isVisible === "function") { + const extraParams = overrides?.callbackParams; + if (!column) { + checkboxes = isVisible({ ...extraParams, node: rowNode, data: rowNode.data }); + } else { + const params = column.createColumnFunctionCallbackParams(rowNode); + checkboxes = isVisible({ ...extraParams, ...params }); + } + } else { + checkboxes = isVisible ?? false; + } + const disabled = selectable && !checkboxes || !selectable && checkboxes; + const visible = selectable || checkboxes; + const so = gos.get("rowSelection"); + const showDisabledCheckboxes = so && typeof so !== "string" ? !_getHideDisabledCheckboxes(so) : !!column?.getColDef().showDisabledCheckboxes; + this.setVisible(visible && (disabled ? showDisabledCheckboxes : true)); + this.setDisplayed(visible && (disabled ? showDisabledCheckboxes : true)); + if (visible) { + this.eCheckbox.setDisabled(disabled); + } + if (overrides?.removeHidden) { + this.setDisplayed(visible); + } + } + getIsVisible() { + const overrides = this.overrides; + if (overrides) { + return overrides.isVisible; + } + const so = this.gos.get("rowSelection"); + if (so && typeof so !== "string") { + return _getCheckboxes(so); + } + return this.column?.getColDef()?.checkboxSelection; + } +}; +var RowRangeSelectionContext = class { + constructor(rowModel, pinnedRowModel) { + this.rowModel = rowModel; + this.pinnedRowModel = pinnedRowModel; + this.selectAll = false; + this.rootId = null; + this.endId = null; + this.cachedRange = []; + } + reset() { + this.rootId = null; + this.endId = null; + this.cachedRange.length = 0; + } + setRoot(node) { + this.rootId = node.id; + this.endId = null; + this.cachedRange.length = 0; + } + setEndRange(end) { + this.endId = end.id; + this.cachedRange.length = 0; + } + getRange() { + if (this.cachedRange.length === 0) { + const root = this.getRoot(); + const end = this.getEnd(); + if (root == null || end == null) { + return this.cachedRange; + } + this.cachedRange = this.getNodesInRange(root, end) ?? []; + } + return this.cachedRange; + } + isInRange(node) { + if (this.rootId === null) { + return false; + } + return this.getRange().some((nodeInRange) => nodeInRange.id === node.id); + } + getRoot(fallback) { + if (this.rootId) { + return this.getRowNode(this.rootId); + } + if (fallback) { + this.setRoot(fallback); + return fallback; + } + } + getEnd() { + if (this.endId) { + return this.getRowNode(this.endId); + } + } + getRowNode(id) { + let node; + const { rowModel, pinnedRowModel } = this; + node ?? (node = rowModel.getRowNode(id)); + if (pinnedRowModel?.isManual()) { + node ?? (node = pinnedRowModel.getPinnedRowById(id, "top")); + node ?? (node = pinnedRowModel.getPinnedRowById(id, "bottom")); + } + return node; + } + truncate(node) { + const range = this.getRange(); + if (range.length === 0) { + return { keep: [], discard: [] }; + } + const discardAfter = range[0].id === this.rootId; + const idx = range.findIndex((rowNode) => rowNode.id === node.id); + if (idx > -1) { + const above = range.slice(0, idx); + const below = range.slice(idx + 1); + this.setEndRange(node); + return discardAfter ? { keep: above, discard: below } : { keep: below, discard: above }; + } else { + return { keep: range, discard: [] }; + } + } + extend(node, groupSelectsChildren = false) { + const root = this.getRoot(); + if (root == null) { + const keep = this.getRange().slice(); + if (groupSelectsChildren) { + node.depthFirstSearch((node2) => !node2.group && keep.push(node2)); + } + keep.push(node); + this.setRoot(node); + return { keep, discard: [] }; + } + const newRange = this.getNodesInRange(root, node); + if (!newRange) { + this.setRoot(node); + return { keep: [node], discard: [] }; + } + if (newRange.find((newRangeNode) => newRangeNode.id === this.endId)) { + this.setEndRange(node); + return { keep: this.getRange(), discard: [] }; + } else { + const discard = this.getRange().slice(); + this.setEndRange(node); + return { keep: this.getRange(), discard }; + } + } + getNodesInRange(start, end) { + const { pinnedRowModel, rowModel } = this; + if (!pinnedRowModel?.isManual()) { + return rowModel.getNodesInRangeForSelection(start, end); + } + if (start.rowPinned === "top" && !end.rowPinned) { + const pinnedRange = _getNodesInRangeForSelection(pinnedRowModel, "top", start, undefined); + return pinnedRange.concat(rowModel.getNodesInRangeForSelection(rowModel.getRow(0), end) ?? []); + } + if (start.rowPinned === "bottom" && !end.rowPinned) { + const pinnedRange = _getNodesInRangeForSelection(pinnedRowModel, "bottom", undefined, start); + const count = rowModel.getRowCount(); + const lastMain = rowModel.getRow(count - 1); + return (rowModel.getNodesInRangeForSelection(end, lastMain) ?? []).concat(pinnedRange); + } + if (!start.rowPinned && !end.rowPinned) { + return rowModel.getNodesInRangeForSelection(start, end); + } + if (start.rowPinned === "top" && end.rowPinned === "top") { + return _getNodesInRangeForSelection(pinnedRowModel, "top", start, end); + } + if (start.rowPinned === "bottom" && end.rowPinned === "top") { + const top = _getNodesInRangeForSelection(pinnedRowModel, "top", end, undefined); + const bottom = _getNodesInRangeForSelection(pinnedRowModel, "bottom", undefined, start); + const first = rowModel.getRow(0); + const last = rowModel.getRow(rowModel.getRowCount() - 1); + return top.concat(rowModel.getNodesInRangeForSelection(first, last) ?? []).concat(bottom); + } + if (!start.rowPinned && end.rowPinned === "top") { + const pinned = _getNodesInRangeForSelection(pinnedRowModel, "top", end, undefined); + return pinned.concat(rowModel.getNodesInRangeForSelection(rowModel.getRow(0), start) ?? []); + } + if (start.rowPinned === "top" && end.rowPinned === "bottom") { + const top = _getNodesInRangeForSelection(pinnedRowModel, "top", start, undefined); + const bottom = _getNodesInRangeForSelection(pinnedRowModel, "bottom", undefined, end); + const first = rowModel.getRow(0); + const last = rowModel.getRow(rowModel.getRowCount() - 1); + return top.concat(rowModel.getNodesInRangeForSelection(first, last) ?? []).concat(bottom); + } + if (start.rowPinned === "bottom" && end.rowPinned === "bottom") { + return _getNodesInRangeForSelection(pinnedRowModel, "bottom", start, end); + } + if (!start.rowPinned && end.rowPinned === "bottom") { + const pinned = _getNodesInRangeForSelection(pinnedRowModel, "bottom", undefined, end); + const last = rowModel.getRow(rowModel.getRowCount()); + return (rowModel.getNodesInRangeForSelection(start, last) ?? []).concat(pinned); + } + return null; + } +}; +var SelectAllFeature = class extends BeanStub { + constructor(column) { + super(); + this.column = column; + this.cbSelectAllVisible = false; + this.processingEventFromCheckbox = false; + } + onSpaceKeyDown(e) { + const checkbox = this.cbSelectAll; + if (checkbox.isDisplayed() && !checkbox.getGui().contains(_getActiveDomElement(this.beans))) { + e.preventDefault(); + checkbox.setValue(!checkbox.getValue()); + } + } + getCheckboxGui() { + return this.cbSelectAll.getGui(); + } + setComp(ctrl) { + this.headerCellCtrl = ctrl; + const cbSelectAll = this.createManagedBean(new AgCheckbox); + this.cbSelectAll = cbSelectAll; + cbSelectAll.addCss("ag-header-select-all"); + _setAriaRole(cbSelectAll.getGui(), "presentation"); + this.showOrHideSelectAll(); + const updateStateOfCheckbox = this.updateStateOfCheckbox.bind(this); + this.addManagedEventListeners({ + newColumnsLoaded: () => this.showOrHideSelectAll(), + displayedColumnsChanged: this.onDisplayedColumnsChanged.bind(this), + selectionChanged: updateStateOfCheckbox, + paginationChanged: updateStateOfCheckbox, + modelUpdated: updateStateOfCheckbox + }); + this.addManagedPropertyListener("rowSelection", ({ currentValue, previousValue }) => { + const getSelectAll = (rowSelection) => typeof rowSelection === "string" || !rowSelection || rowSelection.mode === "singleRow" ? undefined : rowSelection.selectAll; + if (getSelectAll(currentValue) !== getSelectAll(previousValue)) { + this.showOrHideSelectAll(); + } + this.updateStateOfCheckbox(); + }); + this.addManagedListeners(cbSelectAll, { fieldValueChanged: this.onCbSelectAll.bind(this) }); + cbSelectAll.getInputElement().setAttribute("tabindex", "-1"); + this.refreshSelectAllLabel(); + } + onDisplayedColumnsChanged(e) { + if (!this.isAlive()) { + return; + } + this.showOrHideSelectAll(e.source === "uiColumnMoved"); + } + showOrHideSelectAll(fromColumnMoved = false) { + const cbSelectAllVisible = this.isCheckboxSelection(); + this.cbSelectAllVisible = cbSelectAllVisible; + this.cbSelectAll.setDisplayed(cbSelectAllVisible); + if (cbSelectAllVisible) { + this.checkRightRowModelType("selectAllCheckbox"); + this.checkSelectionType("selectAllCheckbox"); + this.updateStateOfCheckbox(); + } + this.refreshSelectAllLabel(fromColumnMoved); + } + updateStateOfCheckbox() { + if (!this.cbSelectAllVisible || this.processingEventFromCheckbox) { + return; + } + this.processingEventFromCheckbox = true; + const selectAllMode = this.getSelectAllMode(); + const selectionSvc = this.beans.selectionSvc; + const cbSelectAll = this.cbSelectAll; + const allSelected = selectionSvc.getSelectAllState(selectAllMode); + cbSelectAll.setValue(allSelected); + const hasNodesToSelect = selectionSvc.hasNodesToSelect(selectAllMode); + cbSelectAll.setDisabled(!hasNodesToSelect); + this.refreshSelectAllLabel(); + this.processingEventFromCheckbox = false; + } + refreshSelectAllLabel(fromColumnMoved = false) { + const translate = this.getLocaleTextFunc(); + const { headerCellCtrl, cbSelectAll, cbSelectAllVisible } = this; + const checked = cbSelectAll.getValue(); + const ariaStatus = _getAriaCheckboxStateName(translate, checked); + const ariaLabel = translate("ariaRowSelectAll", "Press Space to toggle all rows selection"); + headerCellCtrl.setAriaDescriptionProperty("selectAll", cbSelectAllVisible ? `${ariaLabel} (${ariaStatus})` : null); + cbSelectAll.setInputAriaLabel(translate("ariaHeaderSelection", "Column with Header Selection")); + if (!fromColumnMoved) { + headerCellCtrl.announceAriaDescription(); + } + } + checkSelectionType(feature) { + const isMultiSelect = _isMultiRowSelection(this.gos); + if (!isMultiSelect) { + _warn(128, { feature }); + return false; + } + return true; + } + checkRightRowModelType(feature) { + const { gos, rowModel } = this.beans; + const rowModelMatches = _isClientSideRowModel(gos) || _isServerSideRowModel(gos); + if (!rowModelMatches) { + _warn(129, { feature, rowModel: rowModel.getType() }); + return false; + } + return true; + } + onCbSelectAll() { + if (this.processingEventFromCheckbox) { + return; + } + if (!this.cbSelectAllVisible) { + return; + } + const value = this.cbSelectAll.getValue(); + const selectAll2 = this.getSelectAllMode(); + let source = "uiSelectAll"; + if (selectAll2 === "currentPage") { + source = "uiSelectAllCurrentPage"; + } else if (selectAll2 === "filtered") { + source = "uiSelectAllFiltered"; + } + const params = { source, selectAll: selectAll2 }; + const selectionSvc = this.beans.selectionSvc; + if (value) { + selectionSvc.selectAllRowNodes(params); + } else { + selectionSvc.deselectAllRowNodes(params); + } + } + isCheckboxSelection() { + const { column, gos, beans } = this; + const rowSelection = gos.get("rowSelection"); + const newHeaderCheckbox = typeof rowSelection === "object"; + const featureName = newHeaderCheckbox ? "headerCheckbox" : "headerCheckboxSelection"; + return isCheckboxSelection(beans, column) && this.checkRightRowModelType(featureName) && this.checkSelectionType(featureName); + } + getSelectAllMode() { + const selectAll2 = _getSelectAll(this.gos, false); + if (selectAll2) { + return selectAll2; + } + const { headerCheckboxSelectionCurrentPageOnly, headerCheckboxSelectionFilteredOnly } = this.column.getColDef(); + if (headerCheckboxSelectionCurrentPageOnly) { + return "currentPage"; + } + if (headerCheckboxSelectionFilteredOnly) { + return "filtered"; + } + return "all"; + } + destroy() { + super.destroy(); + this.cbSelectAll = undefined; + this.headerCellCtrl = undefined; + } +}; +function isCheckboxSelection({ gos, selectionColSvc }, column) { + const rowSelection = gos.get("rowSelection"); + const colDef = column.getColDef(); + const { headerCheckboxSelection } = colDef; + let result = false; + const newHeaderCheckbox = typeof rowSelection === "object"; + if (newHeaderCheckbox) { + const isSelectionCol = isColumnSelectionCol(column); + const isAutoCol = isColumnGroupAutoCol(column); + const location = _getCheckboxLocation(rowSelection); + if (location === "autoGroupColumn" && isAutoCol || isSelectionCol && selectionColSvc?.isSelectionColumnEnabled()) { + result = _getHeaderCheckbox(rowSelection); + } + } else if (typeof headerCheckboxSelection === "function") { + result = headerCheckboxSelection(_addGridCommonParams(gos, { column, colDef })); + } else { + result = !!headerCheckboxSelection; + } + return result; +} +var BaseSelectionService = class extends BeanStub { + postConstruct() { + const { gos, beans } = this; + this.selectionCtx = new RowRangeSelectionContext(beans.rowModel, beans.pinnedRowModel); + this.addManagedPropertyListeners(["isRowSelectable", "rowSelection"], () => { + const callback = _getIsRowSelectable(gos); + if (callback !== this.isRowSelectable) { + this.isRowSelectable = callback; + this.updateSelectable(); + } + }); + this.isRowSelectable = _getIsRowSelectable(gos); + this.addManagedEventListeners({ + cellValueChanged: (e) => this.updateRowSelectable(e.node), + rowNodeDataChanged: (e) => this.updateRowSelectable(e.node) + }); + } + destroy() { + super.destroy(); + this.selectionCtx.reset(); + } + createCheckboxSelectionComponent() { + return new CheckboxSelectionComponent; + } + createSelectAllFeature(column) { + if (isCheckboxSelection(this.beans, column)) { + return new SelectAllFeature(column); + } + } + isMultiSelect() { + return _isMultiRowSelection(this.gos); + } + onRowCtrlSelected(rowCtrl, hasFocusFunc, gui) { + const selected = !!rowCtrl.rowNode.isSelected(); + rowCtrl.forEachGui(gui, (gui2) => { + gui2.rowComp.toggleCss("ag-row-selected", selected); + const element = gui2.element; + _setAriaSelected(element, selected); + const hasFocus = element.contains(_getActiveDomElement(this.beans)); + if (hasFocus) { + hasFocusFunc(gui2); + } + }); + } + announceAriaRowSelection(rowNode) { + if (this.isRowSelectionBlocked(rowNode)) { + return; + } + const selected = rowNode.isSelected(); + const isEditing2 = this.beans.editSvc?.isEditing({ rowNode }); + if (!rowNode.selectable || isEditing2) { + return; + } + const translate = this.getLocaleTextFunc(); + const label = translate(selected ? "ariaRowDeselect" : "ariaRowSelect", `Press SPACE to ${selected ? "deselect" : "select"} this row`); + this.beans.ariaAnnounce?.announceValue(label, "rowSelection"); + } + isRowSelectionBlocked(rowNode) { + return !rowNode.selectable || rowNode.rowPinned && !_isManualPinnedRow(rowNode) || !_isRowSelection(this.gos); + } + updateRowSelectable(rowNode, suppressSelectionUpdate) { + const selectable = rowNode.rowPinned && rowNode.pinnedSibling ? rowNode.pinnedSibling.selectable : this.isRowSelectable?.(rowNode) ?? true; + this.setRowSelectable(rowNode, selectable, suppressSelectionUpdate); + return selectable; + } + setRowSelectable(rowNode, newVal, suppressSelectionUpdate) { + if (rowNode.selectable !== newVal) { + rowNode.selectable = newVal; + rowNode.dispatchRowEvent("selectableChanged"); + if (suppressSelectionUpdate) { + return; + } + const isGroupSelectsChildren = _getGroupSelectsDescendants(this.gos); + if (isGroupSelectsChildren) { + const selected = this.calculateSelectedFromChildren(rowNode); + this.setNodesSelected({ nodes: [rowNode], newValue: selected ?? false, source: "selectableChanged" }); + return; + } + if (rowNode.isSelected() && !rowNode.selectable) { + this.setNodesSelected({ nodes: [rowNode], newValue: false, source: "selectableChanged" }); + } + } + } + calculateSelectedFromChildren(rowNode) { + let atLeastOneSelected = false; + let atLeastOneDeSelected = false; + if (!rowNode.childrenAfterGroup?.length) { + return rowNode.selectable ? rowNode.__selected : null; + } + for (let i = 0;i < rowNode.childrenAfterGroup.length; i++) { + const child = rowNode.childrenAfterGroup[i]; + let childState = child.isSelected(); + if (!child.selectable) { + const selectable = this.calculateSelectedFromChildren(child); + if (selectable === null) { + continue; + } + childState = selectable; + } + switch (childState) { + case true: + atLeastOneSelected = true; + break; + case false: + atLeastOneDeSelected = true; + break; + default: + return; + } + } + if (atLeastOneSelected && atLeastOneDeSelected) { + return; + } + if (atLeastOneSelected) { + return true; + } + if (atLeastOneDeSelected) { + return false; + } + if (!rowNode.selectable) { + return null; + } + return rowNode.__selected; + } + selectRowNode(rowNode, newValue, e, source = "api") { + if (newValue && rowNode.destroyed) { + return false; + } + const selectionNotAllowed = !rowNode.selectable && newValue; + const selectionNotChanged = rowNode.__selected === newValue; + if (selectionNotAllowed || selectionNotChanged) { + return false; + } + rowNode.__selected = newValue; + rowNode.dispatchRowEvent("rowSelected"); + const sibling = rowNode.sibling; + if (sibling && sibling.footer && sibling.__localEventService) { + sibling.dispatchRowEvent("rowSelected"); + } + const pinnedSibling = rowNode.pinnedSibling; + if (pinnedSibling?.rowPinned && pinnedSibling.__localEventService) { + pinnedSibling.dispatchRowEvent("rowSelected"); + } + this.eventSvc.dispatchEvent({ + ..._createGlobalRowEvent(rowNode, this.gos, "rowSelected"), + event: e || null, + source + }); + return true; + } + isCellCheckboxSelection(column, rowNode) { + const so = this.gos.get("rowSelection"); + if (so && typeof so !== "string") { + const checkbox = isColumnSelectionCol(column) && _getCheckboxes(so); + return column.isColumnFunc(rowNode, checkbox); + } else { + return column.isColumnFunc(rowNode, column.colDef.checkboxSelection); + } + } + inferNodeSelections(node, shiftKey, metaKey, source) { + const { gos, selectionCtx } = this; + const currentSelection = node.isSelected(); + const groupSelectsDescendants = _getGroupSelectsDescendants(gos); + const enableClickSelection = _getEnableSelection(gos); + const enableDeselection = _getEnableDeselection(gos); + const isMultiSelect = this.isMultiSelect(); + const isRowClicked = source === "rowClicked"; + if (isRowClicked && !(enableClickSelection || enableDeselection)) { + return null; + } + if (shiftKey && metaKey && isMultiSelect) { + const root = selectionCtx.getRoot(); + if (!root) { + return null; + } else if (!root.isSelected()) { + const partition = selectionCtx.extend(node, groupSelectsDescendants); + return { + select: [], + deselect: partition.keep, + reset: false + }; + } else { + const partition = selectionCtx.isInRange(node) ? selectionCtx.truncate(node) : selectionCtx.extend(node, groupSelectsDescendants); + return { + deselect: partition.discard, + select: partition.keep, + reset: false + }; + } + } else if (shiftKey && isMultiSelect) { + const fallback = selectionCtx.selectAll ? this.beans.rowModel.getRow(0) : undefined; + const root = selectionCtx.getRoot(fallback); + const partition = selectionCtx.isInRange(node) ? selectionCtx.truncate(node) : selectionCtx.extend(node, groupSelectsDescendants); + return { + select: partition.keep, + deselect: partition.discard, + reset: selectionCtx.selectAll || !!(root && !root.isSelected()) + }; + } else if (metaKey) { + if (isRowClicked) { + const newValue = !currentSelection; + const selectingWhenDisabled = newValue && !enableClickSelection; + const deselectingWhenDisabled = !newValue && !enableDeselection; + if (selectingWhenDisabled || deselectingWhenDisabled) { + return null; + } + selectionCtx.setRoot(node); + return { + node, + newValue, + clearSelection: false + }; + } + selectionCtx.setRoot(node); + return { + node, + newValue: !currentSelection, + clearSelection: !isMultiSelect + }; + } else { + selectionCtx.setRoot(node); + const enableSelectionWithoutKeys = _getEnableSelectionWithoutKeys(gos); + const groupSelectsFiltered = _getGroupSelection(gos) === "filteredDescendants"; + const shouldClear = isRowClicked && (!enableSelectionWithoutKeys || !enableClickSelection); + if (groupSelectsFiltered && currentSelection === undefined && _isClientSideRowModel(gos)) { + return { + node, + newValue: false, + checkFilteredNodes: true, + clearSelection: !isMultiSelect || shouldClear + }; + } + if (isRowClicked) { + const newValue = currentSelection ? !enableSelectionWithoutKeys : enableClickSelection; + const selectingWhenDisabled = newValue && !enableClickSelection; + const deselectingWhenDisabled = !newValue && !enableDeselection; + const wouldStateBeUnchanged = newValue === currentSelection && !shouldClear; + if (wouldStateBeUnchanged || selectingWhenDisabled || deselectingWhenDisabled) { + return null; + } + return { + node, + newValue, + clearSelection: !isMultiSelect || shouldClear, + keepDescendants: node.group && groupSelectsDescendants + }; + } + return { + node, + newValue: !currentSelection, + clearSelection: !isMultiSelect || shouldClear + }; + } + } +}; +var SelectionService = class extends BaseSelectionService { + constructor() { + super(...arguments); + this.beanName = "selectionSvc"; + this.selectedNodes = /* @__PURE__ */ new Map; + this.detailSelection = /* @__PURE__ */ new Map; + this.masterSelectsDetail = false; + } + postConstruct() { + super.postConstruct(); + const { gos } = this; + this.mode = _getRowSelectionMode(gos); + this.groupSelectsDescendants = _getGroupSelectsDescendants(gos); + this.groupSelectsFiltered = _getGroupSelection(gos) === "filteredDescendants"; + this.masterSelectsDetail = _getMasterSelects(gos) === "detail"; + this.addManagedPropertyListeners(["groupSelectsChildren", "groupSelectsFiltered", "rowSelection"], () => { + const groupSelectsDescendants = _getGroupSelectsDescendants(gos); + const selectionMode = _getRowSelectionMode(gos); + const groupSelectsFiltered = _getGroupSelection(gos) === "filteredDescendants"; + this.masterSelectsDetail = _getMasterSelects(gos) === "detail"; + if (groupSelectsDescendants !== this.groupSelectsDescendants || groupSelectsFiltered !== this.groupSelectsFiltered || selectionMode !== this.mode) { + this.deselectAllRowNodes({ source: "api" }); + this.groupSelectsDescendants = groupSelectsDescendants; + this.groupSelectsFiltered = groupSelectsFiltered; + this.mode = selectionMode; + } + }); + this.addManagedEventListeners({ rowSelected: this.onRowSelected.bind(this) }); + } + destroy() { + super.destroy(); + this.resetNodes(); + } + handleSelectionEvent(event, rowNode, source) { + if (this.isRowSelectionBlocked(rowNode)) { + return 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.resetNodes(); + } else { + this.selectRange(selection.deselect, false, source); + } + return this.selectRange(selection.select, true, source); + } else { + const newValue = selection.checkFilteredNodes ? recursiveCanNodesBeSelected(selection.node) : selection.newValue; + return this.setNodesSelected({ + nodes: [selection.node], + newValue, + clearSelection: selection.clearSelection, + keepDescendants: selection.keepDescendants, + event, + source + }); + } + } + setNodesSelected({ + newValue, + clearSelection, + suppressFinishActions, + nodes, + event, + source, + keepDescendants = false + }) { + if (nodes.length === 0) { + return 0; + } + const { gos } = this; + if (!_isRowSelection(gos) && newValue) { + _warn(132); + return 0; + } + if (nodes.length > 1 && !this.isMultiSelect()) { + _warn(130); + return 0; + } + let updatedCount = 0; + for (let i = 0;i < nodes.length; i++) { + const rowNode = nodes[i]; + const node = rowNode.primaryRow; + if (node.rowPinned && !_isManualPinnedRow(node)) { + _warn(59); + continue; + } + if (node.id === undefined) { + _warn(60); + continue; + } + if (newValue && rowNode.destroyed) { + continue; + } + const skipThisNode = this.groupSelectsFiltered && node.group && !gos.get("treeData"); + if (!skipThisNode) { + const thisNodeWasSelected = this.selectRowNode(node, newValue, event, source); + if (thisNodeWasSelected) { + this.detailSelection.delete(node.id); + updatedCount++; + } + } + if (this.groupSelectsDescendants && node.childrenAfterGroup?.length) { + updatedCount += this.selectChildren(node, newValue, source); + } + } + if (!suppressFinishActions) { + if (nodes.length === 1 && source === "api") { + this.selectionCtx.setRoot(nodes[0].primaryRow); + } + const clearOtherNodes = newValue && (clearSelection || !this.isMultiSelect()); + if (clearOtherNodes) { + updatedCount += this.clearOtherNodes(nodes[0].primaryRow, keepDescendants, source); + } + if (updatedCount > 0) { + this.updateGroupsFromChildrenSelections(source); + this.dispatchSelectionChanged(source); + } + } + return updatedCount; + } + selectRange(nodesToSelect, value, source) { + let updatedCount = 0; + nodesToSelect.forEach((node) => { + const rowNode = node.primaryRow; + if (rowNode.group && this.groupSelectsDescendants) { + return; + } + const nodeWasSelected = this.selectRowNode(rowNode, value, undefined, source); + if (nodeWasSelected) { + updatedCount++; + } + }); + if (updatedCount > 0) { + this.updateGroupsFromChildrenSelections(source); + this.dispatchSelectionChanged(source); + } + return updatedCount; + } + selectChildren(node, newValue, source) { + const children = this.groupSelectsFiltered ? node.childrenAfterAggFilter : node.childrenAfterGroup; + if (!children) { + return 0; + } + return this.setNodesSelected({ + newValue, + clearSelection: false, + suppressFinishActions: true, + source, + nodes: children + }); + } + getSelectedNodes() { + return Array.from(this.selectedNodes.values()); + } + getSelectedRows() { + const selectedRows = []; + this.selectedNodes.forEach((rowNode) => rowNode.data && selectedRows.push(rowNode.data)); + return selectedRows; + } + getSelectionCount() { + return this.selectedNodes.size; + } + filterFromSelection(predicate) { + const newSelectedNodes = /* @__PURE__ */ new Map; + this.selectedNodes.forEach((rowNode, key) => { + if (predicate(rowNode)) { + newSelectedNodes.set(key, rowNode); + } + }); + this.selectedNodes = newSelectedNodes; + } + updateGroupsFromChildrenSelections(source, changedPath) { + if (!this.groupSelectsDescendants) { + return false; + } + const { gos, rowModel } = this.beans; + if (!_isClientSideRowModel(gos, rowModel)) { + return false; + } + const rootNode = rowModel.rootNode; + if (!rootNode) { + return false; + } + let selectionChanged = false; + const nodeCallback = (rowNode) => { + if (rowNode !== rootNode) { + const selected = this.calculateSelectedFromChildren(rowNode); + selectionChanged = this.selectRowNode(rowNode, selected === null ? false : selected, undefined, source) || selectionChanged; + } + }; + _forEachChangedGroupDepthFirst(rootNode, this.beans.rowModel.hierarchical, changedPath, nodeCallback); + return selectionChanged; + } + clearOtherNodes(rowNodeToKeepSelected, keepDescendants, source) { + const groupsToRefresh = /* @__PURE__ */ new Map; + let updatedCount = 0; + this.selectedNodes.forEach((otherRowNode) => { + const isNodeToKeep = otherRowNode.id == rowNodeToKeepSelected.id; + const shouldClearDescendant = keepDescendants ? !isDescendantOf(rowNodeToKeepSelected, otherRowNode) : true; + if (shouldClearDescendant && !isNodeToKeep) { + const rowNode = this.selectedNodes.get(otherRowNode.id); + updatedCount += this.setNodesSelected({ + nodes: [rowNode], + newValue: false, + clearSelection: false, + suppressFinishActions: true, + source + }); + if (this.groupSelectsDescendants && otherRowNode.parent) { + groupsToRefresh.set(otherRowNode.parent.id, otherRowNode.parent); + } + } + }); + groupsToRefresh.forEach((group) => { + const selected = this.calculateSelectedFromChildren(group); + this.selectRowNode(group, selected === null ? false : selected, undefined, source); + }); + return updatedCount; + } + onRowSelected(event) { + const rowNode = event.node; + if (this.groupSelectsDescendants && rowNode.group) { + return; + } + if (rowNode.isSelected()) { + this.selectedNodes.set(rowNode.id, rowNode); + } else { + this.selectedNodes.delete(rowNode.id); + } + } + syncInRowNode(rowNode, oldNode) { + this.syncInOldRowNode(rowNode, oldNode); + this.syncInNewRowNode(rowNode); + } + createDaemonNode(rowNode) { + if (!rowNode.id) { + return; + } + const oldNode = new RowNode(this.beans); + oldNode.id = rowNode.id; + oldNode.data = rowNode.data; + oldNode.__selected = rowNode.__selected; + oldNode.level = rowNode.level; + return oldNode; + } + syncInOldRowNode(rowNode, oldNode) { + if (oldNode && rowNode.id !== oldNode.id) { + const oldNodeSelected = this.selectedNodes.get(oldNode.id) == rowNode; + if (oldNodeSelected) { + this.selectedNodes.set(oldNode.id, oldNode); + } + } + } + syncInNewRowNode(rowNode) { + if (this.selectedNodes.has(rowNode.id)) { + rowNode.__selected = true; + this.selectedNodes.set(rowNode.id, rowNode); + } else { + rowNode.__selected = false; + } + } + reset(source) { + const selectionCount = this.getSelectionCount(); + this.resetNodes(); + if (selectionCount) { + this.dispatchSelectionChanged(source); + } + } + resetNodes() { + this.selectedNodes.forEach((node) => { + this.selectRowNode(node, false); + }); + this.selectedNodes.clear(); + } + getBestCostNodeSelection() { + const { gos, rowModel } = this.beans; + if (!_isClientSideRowModel(gos, rowModel)) { + return; + } + const topLevelNodes = rowModel.getTopLevelNodes(); + if (topLevelNodes === null) { + return; + } + const result = []; + function traverse(nodes) { + for (let i = 0, l = nodes.length;i < l; i++) { + const node = nodes[i]; + if (node.isSelected()) { + result.push(node); + } else if (node.group && node.childrenAfterGroup) { + traverse(node.childrenAfterGroup); + } + } + } + traverse(topLevelNodes); + return result; + } + isEmpty() { + return this.getSelectionCount() === 0; + } + deselectAllRowNodes({ source, selectAll: selectAll2 }) { + const rowModelClientSide = _isClientSideRowModel(this.gos); + let updatedNodes = false; + const callback = (rowNode) => { + const updated = this.selectRowNode(rowNode.primaryRow, false, undefined, source); + updatedNodes || (updatedNodes = updated); + }; + if (selectAll2 === "currentPage" || selectAll2 === "filtered") { + if (!rowModelClientSide) { + _error(102); + return; + } + this.getNodesToSelect(selectAll2).forEach(callback); + } else { + this.selectedNodes.forEach(callback); + this.reset(source); + } + this.selectionCtx.selectAll = false; + if (rowModelClientSide && this.groupSelectsDescendants) { + const updated = this.updateGroupsFromChildrenSelections(source); + updatedNodes || (updatedNodes = updated); + } + if (updatedNodes) { + this.dispatchSelectionChanged(source); + } + } + getSelectedCounts(selectAll2) { + let selectedCount = 0; + let notSelectedCount = 0; + this.getNodesToSelect(selectAll2).forEach((node) => { + if (this.groupSelectsDescendants && node.group) { + return; + } + if (node.isSelected()) { + selectedCount++; + } else if (node.selectable) { + notSelectedCount++; + } + }); + return { selectedCount, notSelectedCount }; + } + getSelectAllState(selectAll2) { + const { selectedCount, notSelectedCount } = this.getSelectedCounts(selectAll2); + return _calculateSelectAllState(selectedCount, notSelectedCount) ?? null; + } + hasNodesToSelect(selectAll2) { + return this.getNodesToSelect(selectAll2).filter((node) => node.selectable).length > 0; + } + getNodesToSelect(selectAll2) { + if (!this.canSelectAll()) { + return []; + } + const nodes = []; + const addToResult = (node) => nodes.push(node); + if (selectAll2 === "currentPage") { + this.forEachNodeOnPage((node) => { + if (!node.group) { + addToResult(node); + return; + } + if (!node.footer && !node.expanded) { + const recursivelyAddChildren = (child) => { + addToResult(child); + const children = child.childrenAfterFilter; + if (children) { + for (let i = 0, len = children.length;i < len; ++i) { + recursivelyAddChildren(children[i]); + } + } + }; + recursivelyAddChildren(node); + return; + } + if (!this.groupSelectsDescendants) { + addToResult(node); + } + }); + return nodes; + } + const clientSideRowModel = this.beans.rowModel; + if (selectAll2 === "filtered") { + clientSideRowModel.forEachNodeAfterFilter(addToResult); + return nodes; + } + clientSideRowModel.forEachNode(addToResult); + return nodes; + } + forEachNodeOnPage(callback) { + const { pageBounds, rowModel } = this.beans; + const firstRow = pageBounds.getFirstRow(); + const lastRow = pageBounds.getLastRow(); + for (let i = firstRow;i <= lastRow; i++) { + const node = rowModel.getRow(i); + if (node) { + callback(node); + } + } + } + selectAllRowNodes(params) { + const { gos, selectionCtx } = this; + if (!_isRowSelection(gos)) { + _warn(132); + return; + } + if (_isUsingNewRowSelectionAPI(gos) && !_isMultiRowSelection(gos)) { + _warn(130); + return; + } + if (!this.canSelectAll()) { + return; + } + const { source, selectAll: selectAll2 } = params; + let updatedNodes = false; + this.getNodesToSelect(selectAll2).forEach((rowNode) => { + const updated = this.selectRowNode(rowNode.primaryRow, true, undefined, source); + updatedNodes || (updatedNodes = updated); + }); + selectionCtx.selectAll = true; + if (_isClientSideRowModel(gos) && this.groupSelectsDescendants) { + const updated = this.updateGroupsFromChildrenSelections(source); + updatedNodes || (updatedNodes = updated); + } + if (updatedNodes) { + this.dispatchSelectionChanged(source); + } + } + getSelectionState() { + return this.isEmpty() ? null : Array.from(this.selectedNodes.keys()); + } + setSelectionState(state, source, clearSelection) { + if (!state) { + state = []; + } + if (!Array.isArray(state)) { + _error(103); + return; + } + const rowIds = new Set(state); + const nodes = []; + this.beans.rowModel.forEachNode((node) => { + if (rowIds.has(node.id)) { + nodes.push(node); + } + }); + if (clearSelection) { + this.resetNodes(); + } + this.setNodesSelected({ + newValue: true, + nodes, + source + }); + } + canSelectAll() { + return _isClientSideRowModel(this.beans.gos); + } + updateSelectable(changedPath) { + const { gos, rowModel } = this.beans; + if (!_isRowSelection(gos)) { + return; + } + const source = "selectableChanged"; + const isCSRMGroupSelectsDescendants = _isClientSideRowModel(gos) && this.groupSelectsDescendants; + const nodesToDeselect = []; + if (isCSRMGroupSelectsDescendants) { + const rootNode = rowModel.rootNode; + if (rootNode) { + _forEachChangedGroupDepthFirst(rootNode, rowModel.hierarchical, changedPath, (node) => { + let childSelectable = false; + for (const child of node.childrenAfterGroup) { + childSelectable || (childSelectable = child.selectable); + if (!child.group && !this.updateRowSelectable(child, true) && child.isSelected()) { + nodesToDeselect.push(child); + } + } + this.setRowSelectable(node, childSelectable, true); + }); + } + } else { + rowModel.forEachNode((node) => { + if (!this.updateRowSelectable(node, true) && node.isSelected()) { + nodesToDeselect.push(node); + } + }); + } + if (nodesToDeselect.length) { + this.setNodesSelected({ + nodes: nodesToDeselect, + newValue: false, + source + }); + } + if (!changedPath && isCSRMGroupSelectsDescendants) { + this.updateGroupsFromChildrenSelections?.(source); + } + } + updateSelectableAfterGrouping(changedPath) { + this.updateSelectable(changedPath); + if (this.groupSelectsDescendants) { + const selectionChanged = this.updateGroupsFromChildrenSelections?.("rowGroupChanged", changedPath); + if (selectionChanged) { + this.dispatchSelectionChanged("rowGroupChanged"); + } + } + } + refreshMasterNodeState(node, e) { + if (!this.masterSelectsDetail) { + return; + } + const detailApi = node.detailNode?.detailGridInfo?.api; + if (!detailApi) { + return; + } + const isSelectAll = _isAllSelected(detailApi); + const current = node.isSelected(); + if (current !== isSelectAll) { + const selectionChanged = this.selectRowNode(node, isSelectAll, e, "masterDetail"); + if (selectionChanged) { + this.dispatchSelectionChanged("masterDetail"); + } + } + if (!isSelectAll) { + this.detailSelection.set(node.id, new Set(detailApi.getSelectedNodes().map((n) => n.id))); + } + } + setDetailSelectionState(masterNode, detailGridOptions, detailApi) { + if (!this.masterSelectsDetail) { + return; + } + if (!_isMultiRowSelection(detailGridOptions)) { + _warn(269); + return; + } + switch (masterNode.isSelected()) { + case true: { + detailApi.selectAll(); + break; + } + case false: { + detailApi.deselectAll(); + break; + } + case undefined: { + const selectedIds = this.detailSelection.get(masterNode.id); + if (selectedIds) { + const nodes = []; + for (const id of selectedIds) { + const n = detailApi.getRowNode(id); + if (n) { + nodes.push(n); + } + } + detailApi.setNodesSelected({ nodes, newValue: true, source: "masterDetail" }); + } + break; + } + default: + break; + } + } + dispatchSelectionChanged(source) { + this.eventSvc.dispatchEvent({ + type: "selectionChanged", + source, + selectedNodes: this.getSelectedNodes(), + serverSideState: null + }); + } +}; +function _isAllSelected(api) { + let selectedCount = 0; + let notSelectedCount = 0; + api.forEachNode((node) => { + if (node.isSelected()) { + selectedCount++; + } else if (node.selectable) { + notSelectedCount++; + } + }); + return _calculateSelectAllState(selectedCount, notSelectedCount); +} +function _calculateSelectAllState(selected, notSelected) { + if (selected === 0 && notSelected === 0) { + return false; + } + if (selected > 0 && notSelected > 0) { + return; + } + return selected > 0; +} +function isDescendantOf(root, child) { + let parent = child.parent; + while (parent) { + if (parent === root) { + return true; + } + parent = parent.parent; + } + return false; +} +function recursiveCanNodesBeSelected(root) { + const rootCanBeSelected = root.isSelected() === false; + const childrenCanBeSelected = root.childrenAfterFilter?.some(recursiveCanNodesBeSelected) ?? false; + return rootCanBeSelected || childrenCanBeSelected; +} +var SharedRowSelectionModule = { + moduleName: "SharedRowSelection", + version: VERSION, + beans: [SelectionColService], + css: [rowSelection_default], + apiFunctions: { + setNodesSelected, + selectAll, + deselectAll, + selectAllFiltered, + deselectAllFiltered, + selectAllOnCurrentPage, + deselectAllOnCurrentPage, + getSelectedNodes, + getSelectedRows + } +}; +var RowSelectionModule = { + moduleName: "RowSelection", + version: VERSION, + rowModels: ["clientSide", "infinite", "viewport"], + beans: [SelectionService], + dependsOn: [SharedRowSelectionModule] +}; +var CellCustomStyleFeature = class extends BeanStub { + constructor(cellCtrl, beans) { + super(); + this.cellCtrl = cellCtrl; + this.staticClasses = []; + this.beans = beans; + this.column = cellCtrl.column; + } + setComp(comp) { + this.cellComp = comp; + this.applyUserStyles(); + this.applyCellClassRules(); + this.applyClassesFromColDef(); + } + applyCellClassRules() { + const { column, cellComp } = this; + const colDef = column.colDef; + const cellClassRules = colDef.cellClassRules; + const cellClassParams = this.getCellClassParams(column, colDef); + processClassRules(this.beans.expressionSvc, cellClassRules === this.cellClassRules ? undefined : this.cellClassRules, cellClassRules, cellClassParams, (className) => cellComp.toggleCss(className, true), (className) => cellComp.toggleCss(className, false)); + this.cellClassRules = cellClassRules; + } + applyUserStyles() { + const column = this.column; + const colDef = column.colDef; + const cellStyle = colDef.cellStyle; + if (!cellStyle) { + return; + } + let styles; + if (typeof cellStyle === "function") { + const cellStyleParams = this.getCellClassParams(column, colDef); + styles = cellStyle(cellStyleParams); + } else { + styles = cellStyle; + } + if (styles) { + this.cellComp.setUserStyles(styles); + } + } + applyClassesFromColDef() { + const { column, cellComp } = this; + const colDef = column.colDef; + const cellClassParams = this.getCellClassParams(column, colDef); + for (const className of this.staticClasses) { + cellComp.toggleCss(className, false); + } + const newStaticClasses = this.beans.cellStyles.getStaticCellClasses(colDef, cellClassParams); + this.staticClasses = newStaticClasses; + for (const className of newStaticClasses) { + cellComp.toggleCss(className, true); + } + } + getCellClassParams(column, colDef) { + const { value, rowNode } = this.cellCtrl; + return _addGridCommonParams(this.beans.gos, { + value, + data: rowNode.data, + node: rowNode, + colDef, + column, + rowIndex: rowNode.rowIndex + }); + } +}; +var CellStyleService = class extends BeanStub { + constructor() { + super(...arguments); + this.beanName = "cellStyles"; + } + processAllCellClasses(colDef, params, onApplicableClass, onNotApplicableClass) { + processClassRules(this.beans.expressionSvc, undefined, colDef.cellClassRules, params, onApplicableClass, onNotApplicableClass); + this.processStaticCellClasses(colDef, params, onApplicableClass); + } + getStaticCellClasses(colDef, params) { + const { cellClass } = colDef; + if (!cellClass) { + return []; + } + let classOrClasses; + if (typeof cellClass === "function") { + const cellClassFunc = cellClass; + classOrClasses = cellClassFunc(params); + } else { + classOrClasses = cellClass; + } + if (typeof classOrClasses === "string") { + classOrClasses = [classOrClasses]; + } + return classOrClasses || []; + } + createCellCustomStyleFeature(ctrl) { + return new CellCustomStyleFeature(ctrl, this.beans); + } + processStaticCellClasses(colDef, params, onApplicableClass) { + const classOrClasses = this.getStaticCellClasses(colDef, params); + classOrClasses.forEach((cssClassItem) => { + onApplicableClass(cssClassItem); + }); + } +}; +var CellStyleModule = { + moduleName: "CellStyle", + version: VERSION, + beans: [CellStyleService] +}; +var INITIAL_GRID_OPTION_KEYS = { + enableBrowserTooltips: true, + tooltipTrigger: true, + tooltipMouseTrack: true, + tooltipShowMode: true, + tooltipInteraction: true, + defaultColGroupDef: true, + suppressAutoSize: true, + skipHeaderOnAutoSize: true, + autoSizeStrategy: true, + components: true, + stopEditingWhenCellsLoseFocus: true, + undoRedoCellEditing: true, + undoRedoCellEditingLimit: true, + excelStyles: true, + cacheQuickFilter: true, + customChartThemes: true, + chartThemeOverrides: true, + chartToolPanelsDef: true, + loadingCellRendererSelector: true, + localeText: true, + keepDetailRows: true, + keepDetailRowsCount: true, + detailRowHeight: true, + detailRowAutoHeight: true, + tabIndex: true, + valueCache: true, + valueCacheNeverExpires: true, + enableCellExpressions: true, + suppressTouch: true, + suppressBrowserResizeObserver: true, + suppressPropertyNamesCheck: true, + debug: true, + dragAndDropImageComponent: true, + overlayComponent: true, + suppressOverlays: true, + loadingOverlayComponent: true, + suppressLoadingOverlay: true, + noRowsOverlayComponent: true, + paginationPageSizeSelector: true, + paginateChildRows: true, + pivotPanelShow: true, + pivotSuppressAutoColumn: true, + suppressExpandablePivotGroups: true, + aggFuncs: true, + allowShowChangeAfterFilter: true, + ensureDomOrder: true, + enableRtl: true, + suppressColumnVirtualisation: true, + suppressMaxRenderedRowRestriction: true, + suppressRowVirtualisation: true, + rowDragText: true, + groupLockGroupColumns: true, + suppressGroupRowsSticky: true, + rowModelType: true, + cacheOverflowSize: true, + infiniteInitialRowCount: true, + serverSideInitialRowCount: true, + maxBlocksInCache: true, + maxConcurrentDatasourceRequests: true, + blockLoadDebounceMillis: true, + serverSideOnlyRefreshFilteredGroups: true, + serverSidePivotResultFieldSeparator: true, + viewportRowModelPageSize: true, + viewportRowModelBufferSize: true, + debounceVerticalScrollbar: true, + suppressAnimationFrame: true, + suppressPreventDefaultOnMouseWheel: true, + scrollbarWidth: true, + icons: true, + suppressRowTransform: true, + gridId: true, + enableGroupEdit: true, + initialState: true, + processUnpinnedColumns: true, + createChartContainer: true, + getLocaleText: true, + getRowId: true, + reactiveCustomComponents: true, + renderingMode: true, + columnMenu: true, + suppressSetFilterByDefault: true, + getDataPath: true, + enableCellSpan: true, + enableFilterHandlers: true, + filterHandlers: true +}; +var clientSide = "clientSide"; +var serverSide = "serverSide"; +var infinite = "infinite"; +var functionRowModels = { + onGroupExpandedOrCollapsed: [clientSide], + refreshClientSideRowModel: [clientSide], + isRowDataEmpty: [clientSide], + forEachLeafNode: [clientSide], + forEachNodeAfterFilter: [clientSide], + forEachNodeAfterFilterAndSort: [clientSide], + resetRowHeights: [clientSide, serverSide], + applyTransaction: [clientSide], + applyTransactionAsync: [clientSide], + flushAsyncTransactions: [clientSide], + getBestCostNodeSelection: [clientSide], + getServerSideSelectionState: [serverSide], + setServerSideSelectionState: [serverSide], + applyServerSideTransaction: [serverSide], + applyServerSideTransactionAsync: [serverSide], + applyServerSideRowData: [serverSide], + retryServerSideLoads: [serverSide], + flushServerSideAsyncTransactions: [serverSide], + refreshServerSide: [serverSide], + getServerSideGroupLevelState: [serverSide], + refreshInfiniteCache: [infinite], + purgeInfiniteCache: [infinite], + getInfiniteRowCount: [infinite], + isLastRowIndexKnown: [infinite, serverSide], + expandAll: [clientSide, serverSide], + collapseAll: [clientSide, serverSide], + onRowHeightChanged: [clientSide, serverSide], + setRowCount: [infinite, serverSide], + getCacheBlockState: [infinite, serverSide] +}; +var deprecatedFunctions = { + 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 validateApiFunction(functionName, apiFunction, beans) { + const deprecation = deprecatedFunctions[functionName]; + if (deprecation) { + const { version, new: replacement, old, message } = deprecation; + const apiMethod = old ?? functionName; + return (...args) => { + const replacementMessage = replacement ? `Please use ${replacement} instead. ` : ""; + _warnOnce(`Since ${version} api.${apiMethod} is deprecated. ${replacementMessage}${message ?? ""}`); + return apiFunction.apply(apiFunction, args); + }; + } + const rowModels = functionRowModels[functionName]; + if (rowModels) { + return (...args) => { + const rowModel = beans.rowModel.getType(); + if (!rowModels.includes(rowModel)) { + _errorOnce(`api.${functionName} can only be called when gridOptions.rowModelType is ${rowModels.join(" or ")}`); + return; + } + return apiFunction.apply(apiFunction, args); + }; + } + return apiFunction; +} +var DYNAMIC_BEAN_MODULES = { + 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" +}; +var ICON_VALUES = { + 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 +}; +var ICON_MODULES = { + 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" +}; +var DEPRECATED_ICONS_V33 = /* @__PURE__ */ new Set([ + "colorPicker", + "smallUp", + "checkboxChecked", + "checkboxIndeterminate", + "checkboxUnchecked", + "radioButtonOn", + "radioButtonOff", + "smallDown", + "smallLeft", + "smallRight" +]); +var ValidationService = class extends BeanStub { + constructor() { + super(...arguments); + this.beanName = "validation"; + } + wireBeans(beans) { + this.gridOptions = beans.gridOptions; + provideValidationServiceLogger(getError); + } + warnOnInitialPropertyUpdate(source, key) { + if (source === "api" && INITIAL_GRID_OPTION_KEYS[key]) { + _warn(22, { key }); + } + } + processGridOptions(options) { + this.processOptions(options, GRID_OPTIONS_VALIDATORS()); + } + validateApiFunction(functionName, apiFunction) { + return validateApiFunction(functionName, apiFunction, this.beans); + } + missingUserComponent(propertyName, componentName, agGridDefaults, jsComps) { + const moduleForComponent = USER_COMP_MODULES[componentName]; + if (moduleForComponent) { + this.gos.assertModuleRegistered(moduleForComponent, `AG Grid '${propertyName}' component: ${componentName}`); + } else { + _warn(101, { + propertyName, + componentName, + agGridDefaults, + jsComps + }); + } + } + missingDynamicBean(beanName) { + const moduleName = DYNAMIC_BEAN_MODULES[beanName]; + return moduleName ? _errMsg(200, { + ...this.gos.getModuleErrorParams(), + moduleName, + reasonOrId: beanName + }) : undefined; + } + checkRowEvents(eventType) { + if (DEPRECATED_ROW_NODE_EVENTS.has(eventType)) { + _warn(10, { eventType }); + } + } + validateIcon(iconName) { + if (DEPRECATED_ICONS_V33.has(iconName)) { + _warn(43, { iconName }); + } + if (ICON_VALUES[iconName]) { + return; + } + const moduleName = ICON_MODULES[iconName]; + if (moduleName) { + _error(200, { + reasonOrId: `icon '${iconName}'`, + moduleName, + gridScoped: _areModulesGridScoped(), + gridId: this.beans.context.getId(), + rowModelType: this.gos.get("rowModelType"), + additionalText: "Alternatively, use the CSS icon name directly." + }); + return; + } + _warn(134, { iconName }); + } + isProvidedUserComp(compName) { + return !!USER_COMP_MODULES[compName]; + } + validateColDef(colDef) { + this.processOptions(colDef, COL_DEF_VALIDATORS()); + } + processOptions(options, validator) { + const { validations, deprecations, allProperties, propertyExceptions, objectName, docsUrl } = validator; + if (allProperties && this.gridOptions.suppressPropertyNamesCheck !== true) { + this.checkProperties(options, [...propertyExceptions ?? [], ...Object.keys(deprecations)], allProperties, objectName, docsUrl); + } + const warnings = /* @__PURE__ */ new Set; + const optionKeys = Object.keys(options); + optionKeys.forEach((key) => { + const deprecation = deprecations[key]; + if (deprecation) { + const { message, version } = deprecation; + warnings.add(`As of v${version}, ${String(key)} is deprecated. ${message ?? ""}`); + } + const value = options[key]; + if (value == null || value === false) { + return; + } + const rules = validations[key]; + if (!rules) { + return; + } + const { dependencies, validate, supportedRowModels, expectedType } = rules; + if (expectedType) { + const actualType = typeof value; + if (actualType !== expectedType) { + warnings.add(`${String(key)} should be of type '${expectedType}' but received '${actualType}' (${value}).`); + return; + } + } + if (supportedRowModels) { + const rowModel = this.gridOptions.rowModelType ?? "clientSide"; + if (!supportedRowModels.includes(rowModel)) { + warnings.add(`${String(key)} is not supported with the '${rowModel}' row model. It is only valid with: ${supportedRowModels.join(", ")}.`); + return; + } + } + if (dependencies) { + const warning = this.checkForRequiredDependencies(key, dependencies, options); + if (warning) { + warnings.add(warning); + return; + } + } + if (validate) { + const warning = validate(options, this.gridOptions, this.beans); + if (warning) { + warnings.add(warning); + return; + } + } + }); + if (warnings.size > 0) { + for (const warning of warnings) { + _warnOnce(warning); + } + } + } + checkForRequiredDependencies(key, validator, options) { + const optionEntries = Object.entries(validator); + const failedOptions = optionEntries.filter(([key2, value]) => { + const gridOptionValue = options[key2]; + return !value.required.includes(gridOptionValue); + }); + if (failedOptions.length === 0) { + return null; + } + return failedOptions.map(([failedKey, possibleOptions]) => `'${String(key)}' requires '${failedKey}' to be one of [${possibleOptions.required.map((o) => { + if (o === null) { + return "null"; + } else if (o === undefined) { + return "undefined"; + } + return o; + }).join(", ")}]. ${possibleOptions.reason ?? ""}`).join(` + `); + } + checkProperties(object, exceptions, validProperties, containerName, docsUrl) { + const VUE_FRAMEWORK_PROPS = ["__ob__", "__v_skip", "__metadata__"]; + const invalidProperties = _fuzzyCheckStrings(Object.getOwnPropertyNames(object), [...VUE_FRAMEWORK_PROPS, ...exceptions, ...validProperties], validProperties); + const invalidPropertiesKeys = Object.keys(invalidProperties); + for (const key of invalidPropertiesKeys) { + const value = invalidProperties[key]; + let message = `invalid ${containerName} property '${key}' did you mean any of these: ${value.slice(0, 8).join(", ")}.`; + if (validProperties.includes("context")) { + message += ` +If you are trying to annotate ${containerName} with application data, use the '${containerName}.context' property instead.`; + } + _warnOnce(message); + } + if (invalidPropertiesKeys.length > 0 && docsUrl) { + const url = this.beans.frameworkOverrides.getDocLink(docsUrl); + _warnOnce(`to see all the valid ${containerName} properties please check: ${url}`); + } + } +}; +function _fuzzyCheckStrings(inputValues, validValues, allSuggestions) { + const fuzzyMatches = {}; + const invalidInputs = inputValues.filter((inputValue) => !validValues.some((validValue) => validValue === inputValue)); + if (invalidInputs.length > 0) { + for (const invalidInput of invalidInputs) { + fuzzyMatches[invalidInput] = _fuzzySuggestions({ inputValue: invalidInput, allSuggestions }).values; + } + } + return fuzzyMatches; +} +var DEPRECATED_ROW_NODE_EVENTS = /* @__PURE__ */ new Set([ + "firstChildChanged", + "lastChildChanged", + "childIndexChanged" +]); +var ValidationModule = { + moduleName: "Validation", + version: VERSION, + beans: [ValidationService] +}; +var BaseColsService = class extends BeanStub { + constructor() { + super(...arguments); + this.dispatchColumnChangedEvent = dispatchColumnChangedEvent; + this.columns = []; + this.columnIndexMap = {}; + this.updateIndexMap = () => { + this.columnIndexMap = {}; + this.columns.forEach((col, index) => this.columnIndexMap[col.getId()] = index); + }; + } + wireBeans(beans) { + this.colModel = beans.colModel; + this.aggFuncSvc = beans.aggFuncSvc; + this.visibleCols = beans.visibleCols; + this.groupHierarchCols = beans.groupHierarchyColSvc; + } + sortColumns(compareFn) { + const { groupHierarchCols } = this; + this.columns.sort((a, b) => groupHierarchCols?.compareVirtualColumns(a, b) ?? compareFn(a, b)); + this.updateIndexMap(); + } + setColumns(colKeys, source) { + this.setColList(colKeys, this.columns, this.eventName, true, true, this.columnProcessors.set, source); + } + addColumns(colKeys, source) { + this.updateColList(colKeys, this.columns, true, true, this.columnProcessors.add, this.eventName, source); + } + removeColumns(colKeys, source) { + this.updateColList(colKeys, this.columns, false, true, this.columnProcessors.remove, this.eventName, source); + } + getColumnIndex(colId) { + return this.columnIndexMap[colId]; + } + setColList(colKeys = [], masterList, eventName, detectOrderChange, autoGroupsNeedBuilding, columnCallback, source) { + const gridColumns = this.colModel.getCols(); + if (!gridColumns || gridColumns.length === 0) { + return; + } + const changes = /* @__PURE__ */ new Map; + masterList.forEach((col, idx) => changes.set(col, idx)); + masterList.length = 0; + for (const key of colKeys) { + const column = this.colModel.getColDefCol(key); + if (column) { + masterList.push(column); + } + } + masterList.forEach((col, idx) => { + const oldIndex = changes.get(col); + if (oldIndex === undefined) { + changes.set(col, 0); + return; + } + if (detectOrderChange && oldIndex !== idx) { + return; + } + changes.delete(col); + }); + this.updateIndexMap(); + const primaryCols = this.colModel.getColDefCols(); + for (const column of primaryCols ?? []) { + const added = masterList.indexOf(column) >= 0; + columnCallback(column, added, source); + } + if (autoGroupsNeedBuilding) { + this.colModel.refreshCols(false, source); + } + this.visibleCols.refresh(source); + this.dispatchColumnChangedEvent(this.eventSvc, eventName, [...changes.keys()], source); + } + updateColList(keys = [], masterList, actionIsAdd, autoGroupsNeedBuilding, columnCallback, eventType, source) { + if (!keys || keys.length === 0) { + return; + } + let atLeastOne = false; + const updatedCols = /* @__PURE__ */ new Set; + for (const key of keys) { + if (!key) { + continue; + } + const columnToAdd = this.colModel.getColDefCol(key); + if (!columnToAdd) { + continue; + } + updatedCols.add(columnToAdd); + if (actionIsAdd) { + if (masterList.indexOf(columnToAdd) >= 0) { + continue; + } + masterList.push(columnToAdd); + } else { + const currentIndex = masterList.indexOf(columnToAdd); + if (currentIndex < 0) { + continue; + } + for (let i = currentIndex + 1;i < masterList.length; i++) { + updatedCols.add(masterList[i]); + } + _removeFromArray(masterList, columnToAdd); + } + columnCallback(columnToAdd, actionIsAdd, source); + atLeastOne = true; + } + if (!atLeastOne) { + return; + } + this.updateIndexMap(); + if (autoGroupsNeedBuilding) { + this.colModel.refreshCols(false, source); + } + this.visibleCols.refresh(source); + const eventColumns = Array.from(updatedCols); + this.eventSvc.dispatchEvent({ + type: eventType, + columns: eventColumns, + column: eventColumns.length === 1 ? eventColumns[0] : null, + source + }); + } + extractCols(source, oldProvidedCols = []) { + const previousCols = this.columns; + const colsWithIndex = []; + const colsWithValue = []; + const { setFlagFunc, getIndexFunc, getInitialIndexFunc, getValueFunc, getInitialValueFunc } = this.columnExtractors; + const primaryCols = this.colModel.getColDefCols(); + for (const col of primaryCols ?? []) { + const colIsNew = !oldProvidedCols.includes(col); + const colDef = col.getColDef(); + const value = getValueFunc(colDef); + const initialValue = getInitialValueFunc(colDef); + const index = getIndexFunc(colDef); + const initialIndex = getInitialIndexFunc(colDef); + let include; + const valuePresent = value !== undefined; + const indexPresent = index !== undefined; + const initialValuePresent = initialValue !== undefined; + const initialIndexPresent = initialIndex !== undefined; + if (valuePresent) { + include = value; + } else if (indexPresent) { + if (index === null) { + include = false; + } else { + include = index >= 0; + } + } else if (colIsNew) { + if (initialValuePresent) { + include = initialValue; + } else if (initialIndexPresent) { + include = initialIndex != null && initialIndex >= 0; + } else { + include = false; + } + } else { + include = previousCols.indexOf(col) >= 0; + } + if (include) { + const useIndex = colIsNew ? index != null || initialIndex != null : index != null; + if (useIndex) { + colsWithIndex.push(col); + } else { + colsWithValue.push(col); + } + } + } + const getIndexForCol = (col) => { + const colDef = col.getColDef(); + return getIndexFunc(colDef) ?? getInitialIndexFunc(colDef); + }; + colsWithIndex.sort((colA, colB) => getIndexForCol(colA) - getIndexForCol(colB)); + const res = []; + const groupHierarchCols = this.groupHierarchCols; + const addCol = (col) => { + if (groupHierarchCols) { + groupHierarchCols.expandColumnInto(res, col); + } else { + res.push(col); + } + }; + colsWithIndex.forEach(addCol); + for (const col of previousCols) { + if (colsWithValue.indexOf(col) >= 0) { + addCol(col); + } + } + for (const col of colsWithValue) { + if (res.indexOf(col) < 0) { + addCol(col); + } + } + for (const col of previousCols) { + if (res.indexOf(col) < 0) { + setFlagFunc(col, false, source); + } + } + for (const col of res) { + if (previousCols.indexOf(col) < 0) { + setFlagFunc(col, true, source); + } + } + this.columns = res; + this.updateIndexMap(); + return this.columns; + } + restoreColumnOrder(columnStateAccumulator, incomingColumnState) { + const colList = this.columns; + const primaryCols = this.colModel.getColDefCols(); + if (!colList.length || !primaryCols) { + return columnStateAccumulator; + } + const updatedColIdArray = Object.keys(incomingColumnState); + const updatedColIds = new Set(updatedColIdArray); + const newColIds = new Set(updatedColIdArray); + const allColIds = new Set(colList.map((column) => { + const colId = column.getColId(); + newColIds.delete(colId); + return colId; + }).concat(updatedColIdArray)); + const colIdsInOriginalOrder = []; + const originalOrderMap = {}; + let orderIndex = 0; + for (let i = 0;i < primaryCols.length; i++) { + const colId = primaryCols[i].getColId(); + if (allColIds.has(colId)) { + colIdsInOriginalOrder.push(colId); + originalOrderMap[colId] = orderIndex++; + } + } + let index = 1000; + let hasAddedNewCols = false; + let lastIndex = 0; + const enableProp = this.columnOrdering.enableProp; + const initialEnableProp = this.columnOrdering.initialEnableProp; + const indexProp = this.columnOrdering.indexProp; + const initialIndexProp = this.columnOrdering.initialIndexProp; + const processPrecedingNewCols = (colId) => { + const originalOrderIndex = originalOrderMap[colId]; + for (let i = lastIndex;i < originalOrderIndex; i++) { + const newColId = colIdsInOriginalOrder[i]; + if (newColIds.has(newColId)) { + incomingColumnState[newColId][indexProp] = index++; + newColIds.delete(newColId); + } + } + lastIndex = originalOrderIndex; + }; + for (const column of colList) { + const colId = column.getColId(); + if (updatedColIds.has(colId)) { + processPrecedingNewCols(colId); + incomingColumnState[colId][indexProp] = index++; + } else { + const colDef = column.getColDef(); + const missingIndex = colDef[indexProp] === null || colDef[indexProp] === undefined && colDef[initialIndexProp] == null; + if (missingIndex) { + if (!hasAddedNewCols) { + const propEnabled = colDef[enableProp] || colDef[enableProp] === undefined && colDef[initialEnableProp]; + if (propEnabled) { + processPrecedingNewCols(colId); + } else { + for (const newColId of newColIds) { + incomingColumnState[newColId][indexProp] = index + originalOrderMap[newColId]; + } + index += colIdsInOriginalOrder.length; + hasAddedNewCols = true; + } + } + if (!columnStateAccumulator[colId]) { + columnStateAccumulator[colId] = { colId }; + } + columnStateAccumulator[colId][indexProp] = index++; + } + } + } + return columnStateAccumulator; + } +}; +var agToggleButton_default = '.ag-toggle-button{flex:none;min-width:unset;width:unset}.ag-toggle-button-input-wrapper{background-color:var(--ag-toggle-button-off-background-color);border-radius:calc(var(--ag-toggle-button-height)*.5);flex:none;height:var(--ag-toggle-button-height);max-width:var(--ag-toggle-button-width);min-width:var(--ag-toggle-button-width);position:relative;transition:background-color .1s;:where(.ag-toggle-button-input){-webkit-appearance:none;-moz-appearance:none;appearance:none;cursor:pointer;display:block;height:var(--ag-toggle-button-height);margin:0;max-width:var(--ag-toggle-button-width);min-width:var(--ag-toggle-button-width);opacity:0}&.ag-checked{background-color:var(--ag-toggle-button-on-background-color)}&.ag-disabled{opacity:.5}}.ag-toggle-button-input-wrapper:before{background-color:var(--ag-toggle-button-switch-background-color);border-radius:100%;content:"";display:block;height:calc(var(--ag-toggle-button-height) - var(--ag-toggle-button-switch-inset)*2);left:var(--ag-toggle-button-switch-inset);pointer-events:none;position:absolute;top:var(--ag-toggle-button-switch-inset);transition:left .1s;width:calc(var(--ag-toggle-button-height) - var(--ag-toggle-button-switch-inset)*2)}.ag-toggle-button-input-wrapper.ag-checked:before{left:calc(100% - var(--ag-toggle-button-height) + var(--ag-toggle-button-switch-inset))}.ag-toggle-button-input-wrapper:focus-within{box-shadow:var(--ag-focus-shadow)}'; +var AgToggleButton = class extends AgCheckbox { + constructor(config) { + super(config, "ag-toggle-button"); + this.registerCSS(agToggleButton_default); + } + setValue(value, silent) { + super.setValue(value, silent); + this.toggleCss("ag-selected", this.getValue()); + return this; + } +}; +var AgToggleButtonSelector = { + selector: "AG-TOGGLE-BUTTON", + component: AgToggleButton +}; + +// ag-grid/dist/package/main.esm.mjs +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; + } + 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); + } + 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; + } +}; +var LICENSE_TYPES = { + "01": "GRID", + "02": "CHARTS", + "0102": "BOTH" +}; +var _LicenseManager = class _LicenseManager2 { + constructor(document2) { + this.watermarkMessage = undefined; + this.totalMessageLength = 124; + this.document = document2; + this.md5 = new MD5; + this.md5.init(); + } + validateLicense() { + const licenseDetails = this.getLicenseDetails(_LicenseManager2.licenseKey); + const currentLicenseName = `AG Grid ${licenseDetails.currentLicenseType === "BOTH" ? "and AG Charts " : ""}Enterprise`; + const suppliedLicenseName = licenseDetails.suppliedLicenseType === undefined ? "" : `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 = _LicenseManager2.getGridReleaseDate(); + const formattedReleaseDate = _LicenseManager2.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(_LicenseManager2.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] = _LicenseManager2.extractBracketedInformation(cleanedLicenseKey); + return { md5, license, version, isTrial, type }; + } + getLicenseDetails(licenseKey) { + const currentLicenseType = _LicenseManager2.chartsLicenseManager ? "BOTH" : "GRID"; + if (!licenseKey?.length) { + return { + licenseKey, + valid: false, + missing: true, + currentLicenseType + }; + } + const gridReleaseDate = _LicenseManager2.getGridReleaseDate(); + const { md5, license, version, isTrial, type } = _LicenseManager2.extractLicenseComponents(licenseKey); + let valid = md5 === this.md5.md5(license) && !licenseKey.includes("For_Trialing_ag-Grid_Only"); + let trialExpired = undefined; + let expired = undefined; + let expiry = null; + let incorrectLicenseType = false; + let suppliedLicenseType = undefined; + function handleTrial() { + const now = /* @__PURE__ */ new Date; + trialExpired = expiry < now; + expired = undefined; + } + if (valid) { + expiry = _LicenseManager2.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: _LicenseManager2.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(_LicenseManager2.decode(_LicenseManager2.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 = _LicenseManager2.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, undefined, "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, undefined]; + } + const matches = licenseKey.match(/\[(.*?)\]/g).map((match) => match.replace("[", "").replace("]", "")); + if (!matches || matches.length === 0) { + return ["legacy", false, undefined]; + } + 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) {} +}; +_LicenseManager.RELEASE_INFORMATION = "MTc3NDQyNTc0Nzc3NQ=="; +var LicenseManager = _LicenseManager; +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}'; +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), 5000); + } + } + shouldDisplayWatermark() { + return this.licenseManager.isDisplayWatermark(); + } +}; +var AgWatermarkSelector = { + selector: "AG-WATERMARK", + component: AgWatermark +}; +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) {} + static setChartsLicenseManager(chartsLicenseManager) {} +}; +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 +}; +var LINE_SEPARATOR2 = `\r +`; +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_SEPARATOR2; + } + if (xmlElement.textNode != null) { + return result + ">" + xmlElement.textNode + "" + LINE_SEPARATOR2; + } + result += ">" + LINE_SEPARATOR2; + if (xmlElement.children) { + for (const it of xmlElement.children) { + result += createXml(it, booleanTransformer); + } + } + return result + "" + LINE_SEPARATOR2; +} +var pointsToPixel = (points) => { + return Math.round(points * 96 / 72); +}; +var pixelsToEMU = (value) => { + return Math.ceil(value * INCH_TO_EMU); +}; +var getFontFamilyId = (name) => { + if (name === undefined) { + 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(` +`, "_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; +}; +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 = !!node.parent && 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) : undefined; + 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 === undefined) { + 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) || undefined; + return { + styleId, + data: { + type: processedType, + value: processedValue + } + }; + } + createMergedCell(styleId, type, value, numOfCells) { + const valueToUse = value == null ? "" : value; + return { + styleId: this.getStyleById(styleId) ? styleId : undefined, + 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; + } +}; +var contentTypeFactory = { + getTemplate(config) { + const { name, ContentType, Extension, PartName } = config; + return { + name, + properties: { + rawMap: { + Extension, + PartName, + ContentType + } + } + }; + } +}; +var contentType_default = contentTypeFactory; +var _normaliseImageExtension = (ext) => ext === "jpg" ? "jpeg" : ext; +var contentTypesFactory = { + getTemplate({ sheetLen, hasCustomProperties }) { + const worksheets = new Array(sheetLen).fill(undefined).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(undefined).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; +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_default2 = coreFactory; +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: _escapeString(name) ?? "" + } + }, + children: [ + { + name: "vt:lpwstr", + textNode: _escapeString(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; +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 : undefined + } + }, + 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 * 1000 + } + } + }); + } + if (color.tint) { + ret.push({ + name: "a:tint", + properties: { + rawMap: { + val: color.tint * 1000 + } + } + }); + } + 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 * 1000) + } + } + } + ]; + } + 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) * 60000 + } + }; + } + 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; +var relationshipFactory = { + getTemplate(config) { + const { Id, Type, Target } = config; + return { + name: "Relationship", + properties: { + rawMap: { + Id, + Type, + Target + } + } + }; + } +}; +var relationship_default = relationshipFactory; +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; +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; +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: undefined, + 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 == undefined) { + 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] || undefined; +}; +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)] : undefined; + const rightChildren = right ? [getBorderColor(right.color)] : undefined; + const topChildren = top ? [getBorderColor(top.color)] : undefined; + const bottomChildren = bottom ? [getBorderColor(bottom.color)] : undefined; + const diagonalChildren = diagonal ? [getBorderColor(diagonal.color)] : undefined; + 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; +var bordersFactory = { + getTemplate(borders) { + return { + name: "borders", + properties: { + rawMap: { + count: borders.length + } + }, + children: borders.map((border) => border_default.getTemplate(border)) + }; + } +}; +var borders_default = bordersFactory; +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; +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; +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 : undefined, + applyProtection: protection ? 1 : undefined, + applyBorder: borderId ? 1 : undefined, + applyFill: fillId ? 1 : undefined, + borderId, + fillId, + applyFont: fontId ? 1 : undefined, + fontId, + applyNumberFormat: numFmtId ? 1 : undefined, + numFmtId, + quotePrefix: quotePrefix ? 1 : undefined, + xfId + } + }, + children: children.length ? children : undefined + }; + } +}; +var xf_default = xfFactory; +var cellStylesXfsFactory = { + getTemplate(xfs) { + return { + name: "cellStyleXfs", + properties: { + rawMap: { + count: xfs.length + } + }, + children: xfs.map((xf) => xf_default.getTemplate(xf)) + }; + } +}; +var cellStyleXfs_default = cellStylesXfsFactory; +var borderFactory2 = { + getTemplate(cellStyle) { + const { builtinId, name, xfId } = cellStyle; + return { + name: "cellStyle", + properties: { + rawMap: { + builtinId, + name, + xfId + } + } + }; + } +}; +var cellStyle_default = borderFactory2; +var cellStylesFactory = { + getTemplate(cellStyles) { + return { + name: "cellStyles", + properties: { + rawMap: { + count: cellStyles.length + } + }, + children: cellStyles.map((cellStyle) => cellStyle_default.getTemplate(cellStyle)) + }; + } +}; +var cellStyles_default = cellStylesFactory; +var cellXfsFactory = { + getTemplate(xfs) { + return { + name: "cellXfs", + properties: { + rawMap: { + count: xfs.length + } + }, + children: xfs.map((xf) => xf_default.getTemplate(xf)) + }; + } +}; +var cellXfs_default = cellXfsFactory; +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; +var fillsFactory = { + getTemplate(fills) { + return { + name: "fills", + properties: { + rawMap: { + count: fills.length + } + }, + children: fills.map((fill) => fill_default.getTemplate(fill)) + }; + } +}; +var fills_default = fillsFactory; +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; +var fontsFactory = { + getTemplate(fonts) { + return { + name: "fonts", + properties: { + rawMap: { + count: fonts.length + } + }, + children: fonts.map((font) => font_default.getTemplate(font)) + }; + } +}; +var fonts_default = fontsFactory; +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] = _escapeString(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; +var numberFormatsFactory = { + getTemplate(numberFormats) { + return { + name: "numFmts", + properties: { + rawMap: { + count: numberFormats.length + } + }, + children: numberFormats.map((numberFormat) => numberFormat_default.getTemplate(numberFormat)) + }; + } +}; +var numberFormats_default = numberFormatsFactory; +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: undefined, right: undefined, top: undefined, bottom: undefined, diagonal: undefined }]; + 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: undefined, + color: undefined + } + }); + } + 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() : undefined; + const convertedVerticalAlign = verticalAlign ? verticalAlign.toLocaleLowerCase() : undefined; + 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() : undefined + }); + } + 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] != null) { + 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; +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(), + 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: _escapeString(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; +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; +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", undefined, "020F0302020204030204"]), + getFont(["ea", ""]), + getFont(["cs", ""]), + getFont(["font", "游ゴシック Light", "Jpan"]), + getFont(["font", "맑은 고딕", "Hang"]), + getFont(["font", "等线 Light", "Hans"]), + getFont(["font", "新細明體", "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", undefined, "020F0502020204030204"]), + getFont(["ea", ""]), + getFont(["cs", ""]), + getFont(["font", "游ゴシック", "Jpan"]), + getFont(["font", "맑은 고딕", "Hang"]), + getFont(["font", "等线", "Hans"]), + getFont(["font", "新細明體", "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; +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", undefined, "100000"], + ["100000", "phClr", "120000", "99000", undefined, "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", undefined, undefined, "63000"], + ["5400000", "0"] + ]) + ] +}); +var formatScheme = { + getTemplate() { + return { + name: "a:fmtScheme", + properties: { + rawMap: { + name: "Office" + } + }, + children: [getFillStyleList(), getLineStyleList(), getEffectStyleList(), getBgFillStyleList()] + }; + } +}; +var formatScheme_default = formatScheme; +var themeElements = { + getTemplate() { + return { + name: "a:themeElements", + children: [colorScheme_default.getTemplate(), fontScheme_default.getTemplate(), formatScheme_default.getTemplate()] + }; + } +}; +var themeElements_default = themeElements; +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; +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; +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; +var sheetsFactory = { + getTemplate(names) { + return { + name: "sheets", + children: names.map((sheet, idx) => sheet_default.getTemplate(sheet, idx)) + }; + } +}; +var sheets_default = sheetsFactory; +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; +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 : undefined, + width: excelWidth, + style: s2, + hidden: hidden ? "1" : "0", + bestFit: bestFit ? "1" : "0", + customWidth + } + } + }; + } +}; +var column_default = colFactory; +var mergeCellFactory = { + getTemplate(ref) { + return { + name: "mergeCell", + properties: { + rawMap: { + ref + } + } + }; + } +}; +var mergeCell_default = mergeCellFactory; +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" ? undefined : convertedType, + s: styleId ? getStyleId(styleId, currentSheet2) : undefined + } + } + }; + if (convertedType === "empty") { + return obj; + } + let children; + if (convertedType === "str" && type === "f") { + children = [ + { + name: "f", + textNode: _escapeString(replaceInvisibleCharacters(value)) + } + ]; + } else if (convertedType === "inlineStr") { + children = [ + { + name: "is", + children: [ + { + name: "t", + textNode: _escapeString(replaceInvisibleCharacters(value)) + } + ] + } + ]; + } else { + children = [ + { + name: "v", + textNode: value + } + ]; + } + return Object.assign({}, obj, { children }); + } +}; +var cell_default = cellFactory; +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 !== undefined; +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 || undefined + } + }, + children + }; + } +}; +var row_default = rowFactory; +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 ? undefined : 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}${_escapeString(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" : undefined, + topLeftCell: shouldSplit ? `${getExcelColumnName(xSplit + 1)}${ySplit + 1}` : undefined, + xSplit: xSplit === 0 ? undefined : xSplit, + ySplit: ySplit === 0 ? undefined : ySplit + } + } + } + ] : undefined; +}; +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 : undefined + } + } + }); + 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; +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) { + _warn(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)) { + _warn(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 === undefined ? col.filterAllowed ?? false : showFilterButton); + } + if (!tableColumns?.length || !tableRowCount || !tableName) { + _warn(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 = _escapeString(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_default2.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(undefined).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 === undefined && vmlDrawingIndex === undefined && tableName === undefined) { + 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]; + } +}; +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 + }; +}; +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; +} +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, + 936918000, + 2847714899, + 3736837829, + 1202900863, + 817233897, + 3183342108, + 3401237130, + 1404277552, + 615818150, + 3134207493, + 3453421203, + 1423857449, + 601450431, + 3009837614, + 3294710456, + 1567103746, + 711928724, + 3020668471, + 3272380065, + 1510334235, + 755167117 +]); +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 !== undefined ? 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 = "\x14\x00" + (isUTF8 ? "\x00\b" : "\x00\x00") + convertDecToHex(isCompressed ? 8 : 0, 2) + convertDecToHex(time, 2) + convertDecToHex(dt, 2) + convertDecToHex(zipSize ? crcFlag : 0, 4) + convertDecToHex(deflatedSize ?? rawSize, 4) + convertDecToHex(rawSize, 4) + convertDecToHex(utfPath.length, 2) + convertDecToHex(extraFields.length, 2); + const localFileHeader = "PK\x03\x04" + commonHeader + utfPath + extraFields; + const centralDirectoryHeader = "PK\x01\x02\x14\x00" + commonHeader + "\x00\x00\x00\x00\x00\x00" + (content ? "\x00\x00\x00\x00" : "\x10\x00\x00\x00") + convertDecToHex(offset, 4) + utfPath + 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, undefined); + return { + ...headers, + content: rawContent, + isCompressed: false + }; +}; +var buildCentralDirectoryEnd = (tLen, cLen, lLen) => { + const str = "PK\x05\x06\x00\x00\x00\x00" + convertDecToHex(tLen, 2) + convertDecToHex(tLen, 2) + convertDecToHex(cLen, 4) + convertDecToHex(lLen, 4) + "\x00\x00"; + return Uint8Array.from(str, (c) => c.charCodeAt(0)); +}; +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); + } +}; +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) { + _warn(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(undefined); + } + 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 ExcelCreator = class extends BaseCreator { + constructor() { + super(...arguments); + this.beanName = "excelCreator"; + this.workbook = new Workbook; + } + getMergedParams(params) { + const baseParams6 = this.gos.get("defaultExcelExportParams"); + return Object.assign({}, baseParams6, params); + } + export(userParams) { + if (this.isExportSuppressed()) { + _warn(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(_addGridCommonParams(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, _addGridCommonParams(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); + } +}; +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%}"; +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 = RefPlaceholder; + 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; + } + const nextRow = this.lastFocusedRowIndex + (up ? -1 : 1); + if (nextRow < 0 || nextRow >= this.model.getRowCount()) { + return; + } + 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 === undefined) { + 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(); + } + 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(); + } +}; +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}'; +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; + } +}; +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}"; +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 AgComponentStub { + constructor(config) { + super(getTemplate(config.cssIdentifier)); + this.config = config; + this.closable = true; + this.eContentWrapper = RefPlaceholder; + this.eTitleBar = RefPlaceholder; + this.eTitleBarButtons = RefPlaceholder; + this.eTitle = RefPlaceholder; + 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 { + _setDisplayed(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 AgComponentStub({ 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; + } + 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(); + } +}; +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() { + _setDisplayed(this.maximizeIcon, !this.isMaximized); + _setDisplayed(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 = undefined; + } + 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 AgComponentStub({ 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; + } +}; +var AgMenuPanel = class extends AgTabGuardComp { + constructor(wrappedComponent) { + super(); + this.setTemplateFromElement(wrappedComponent.getGui(), undefined, undefined, true); + } + postConstruct() { + this.initialiseTabGuard({ + onTabKeyDown: (e) => this.onTabKeyDown(e), + handleKeyDown: (e) => this.handleKeyDown(e) + }); + } + handleKeyDown(e) { + if (e.key === KeyCode.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); + } +}; +var AgMenuItemComponent = class extends AgBeanStub { + 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 ? undefined : 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 === KeyCode.ENTER || e.key === KeyCode.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 = _createElement({ 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 : undefined, + 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 = undefined; + }; + 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; + _setAriaRole(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(); + } +}; +var AgMenuList = class extends AgTabGuardComp { + 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 KeyCode.UP: + case KeyCode.RIGHT: + case KeyCode.DOWN: + case KeyCode.LEFT: + e.preventDefault(); + this.handleNavKey(e.key); + break; + case KeyCode.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 _createAgElement({ + tag: "div", + cls: "ag-menu-separator", + attrs: { + "aria-hidden": "true" + }, + children: [part, part, part, part] + }); + } + handleNavKey(key) { + switch (key) { + case KeyCode.UP: + case KeyCode.DOWN: { + const nextItem = this.findNextItem(key === KeyCode.UP); + if (nextItem && nextItem !== this.activeMenuItem) { + nextItem.activate(false, true); + } + return; + } + } + const left = this.gos.get("enableRtl") ? KeyCode.RIGHT : KeyCode.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 ? _last(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(); + } +}; +var AgMenuItemRenderer = class extends AgComponentStub { + 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) { + _setAriaExpanded(eGui, false); + } + } + addIcon() { + if (this.params.isCompact) { + return; + } + const iconWrapper = _createAgElement({ + 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 = _createAgElement({ + 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 = _createAgElement({ + tag: "span", + ref: "eShortcut", + cls: `${this.getClassName("part")} ${this.getClassName("shortcut")}`, + children: this.params.shortcut || "" + }); + this.getGui().appendChild(shortcut); + } + addSubMenu() { + const pointer = _createAgElement({ + 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}`; + } +}; +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; +} +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 AgTabGuardComp { + constructor(params) { + super(getTabbedLayoutTemplate(params.cssClass)); + this.eHeader = RefPlaceholder; + this.eBody = RefPlaceholder; + 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 = _createAgElement({ tag: "div", role: "presentation" }); + addCssClasses(this.eHeader, "header-wrapper"); + this.eHeader.appendChild(this.eTabHeader); + } else { + this.eTabHeader = this.eHeader; + } + _setAriaRole(this.eTabHeader, "tablist"); + addCssClasses(this.eTabHeader, "header"); + } + setupCloseButton(addCssClasses) { + const eCloseButton = _createAgElement({ tag: "button" }); + addCssClasses(eCloseButton, "close-button"); + const eIcon = this.beans.iconSvc.createIconNoSpan("close"); + _setAriaLabel(eCloseButton, this.params.closeButtonAriaLabel); + eCloseButton.appendChild(eIcon); + this.addManagedElementListeners(eCloseButton, { click: () => this.params.onCloseClicked?.() }); + const eCloseButtonWrapper = _createAgElement({ 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 KeyCode.RIGHT: + case KeyCode.LEFT: { + if (!this.eTabHeader.contains(_getActiveDomElement(this.beans))) { + return; + } + const isRightKey = e.key === KeyCode.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 KeyCode.UP: + case KeyCode.DOWN: + e.stopPropagation(); + break; + } + } + onTabKeyDown(e) { + if (e.defaultPrevented) { + return; + } + const { beans, eHeader, eBody, activeItem, params } = this; + const { suppressTrapFocus, enableCloseButton } = params; + const activeElement = _getActiveDomElement(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(_getDocument(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 = _findNextFocusableElement(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 _focusInto(this.eBody, fromBottom); + } + setAfterAttachedParams(params) { + this.afterAttachedParams = params; + } + showFirstItem() { + if (this.items.length > 0) { + this.showItemWrapper(this.items[0]); + } + } + addItem(item) { + const eHeaderButton = _createAgElement({ + tag: "span", + cls: "ag-tab", + role: "tab", + attrs: { tabindex: "-1" } + }); + eHeaderButton.appendChild(item.title); + this.eTabHeader.appendChild(eHeaderButton); + _setAriaLabel(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) { + _focusInto(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 !== undefined) { + 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; + } +}; +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}"; +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 AgComponentStub { + constructor(params = {}) { + super(getAgGroupComponentTemplate(params), [AgCheckboxSelector]); + this.params = params; + this.suppressEnabledCheckbox = true; + this.suppressToggleExpandOnEnableChange = false; + this.eToolbar = RefPlaceholder; + this.cbGroupEnabled = RefPlaceholder; + this.eContainer = RefPlaceholder; + 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, undefined, true); + } + this.setAlignItems(this.alignItems); + const { onEnableChange, onExpandedChange, suppressOpenCloseIcons } = this.params; + this.hideEnabledCheckbox(this.suppressEnabledCheckbox); + this.hideOpenCloseIcons(suppressOpenCloseIcons ?? false); + this.refreshChildDisplay(); + _setDisplayed(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() { + _setDisplayed(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(); + _setDisplayed(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]; + _setDisplayed(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 AgComponentStub { + constructor(params = {}) { + super(getDefaultTitleBarTemplate(params)); + this.suppressOpenCloseIcons = false; + this.suppressKeyboardNavigation = false; + this.eGroupOpenedIcon = RefPlaceholder; + this.eGroupClosedIcon = RefPlaceholder; + this.eTitle = RefPlaceholder; + 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 KeyCode.ENTER: + case KeyCode.SPACE: + e.preventDefault(); + this.dispatchExpandChanged(); + break; + case KeyCode.RIGHT: + case KeyCode.LEFT: + e.preventDefault(); + this.dispatchExpandChanged(e.key === KeyCode.RIGHT); + break; + } + } + }); + } + refreshOnExpand(expanded) { + this.refreshAriaStatus(expanded); + this.refreshOpenCloseIcons(expanded); + } + refreshAriaStatus(expanded) { + if (!this.suppressOpenCloseIcons) { + _setAriaExpanded(this.getGui(), expanded); + } + } + refreshOpenCloseIcons(expanded) { + const showIcon = !this.suppressOpenCloseIcons; + _setDisplayed(this.eGroupOpenedIcon, showIcon && expanded); + _setDisplayed(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 : undefined; + this.eTitle.textContent = title ?? ""; + _setDisplayed(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"); + _setAriaRole(eGui, "presentation"); + } else { + eGui.classList.remove(TITLE_BAR_DISABLED_CLASS); + if (typeof this.title === "string" && !this.suppressKeyboardNavigation) { + this.activateTabIndex([eGui]); + _setAriaRole(eGui, "group"); + } else { + eGui.removeAttribute("tabindex"); + _setAriaRole(eGui, "presentation"); + } + } + } +}; +var VERSION2 = "35.2.0"; +var EnterpriseCoreModule = { + moduleName: "EnterpriseCore", + version: VERSION2, + beans: [GridLicenseManager], + icons: { + accordionOpen: "tree-open", + accordionClosed: "tree-closed", + accordionIndeterminate: "tree-indeterminate", + close: "cross", + cancel: "cancel", + maximize: "maximize", + minimize: "minimize", + columnDrag: "grip" + }, + dependsOn: [], + setLicenseKey: GridLicenseManager.setLicenseKey +}; +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"; + } +}; +var VirtualList = class extends AgVirtualList { + constructor(params) { + super(STOP_PROPAGATION_CALLBACKS, params); + } +}; +var VirtualListDragFeature = class extends AgVirtualListDragFeature { +}; +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(); +} +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{ + /* !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)}}`; +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 Component { + constructor(toolPanelDef) { + super(); + this.toolPanelDef = toolPanelDef; + this.eToggleButton = RefPlaceholder; + this.eIconWrapper = RefPlaceholder; + this.eLabel = RefPlaceholder; + } + 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", _createIconNoSpan(this.toolPanelDef.iconKey, this.beans)); + } + onButtonPressed() { + this.dispatchLocalEvent({ type: "toggleButtonClicked" }); + } + setSelected(selected) { + this.toggleCss("ag-selected", selected); + _setAriaExpanded(this.eToggleButton, selected); + } +}; +var SideBarElement = { tag: "div", cls: "ag-side-buttons", role: "tablist" }; +var AgSideBarButtons = class extends Component { + constructor() { + super(SideBarElement); + this.buttonComps = []; + } + postConstruct() { + this.addManagedElementListeners(this.getFocusableElement(), { keydown: this.handleKeyDown.bind(this) }); + } + handleKeyDown(e) { + if (e.key !== KeyCode.TAB || !e.shiftKey) { + return; + } + if (_focusNextGridCoreContainer(this.beans, true)) { + e.preventDefault(); + return; + } + _stopPropagationForAgGrid(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); + _clearElement(this.getGui()); + } + destroy() { + this.clearButtons(); + super.destroy(); + } +}; +var AgSideBarButtonsSelector = { + selector: "AG-SIDE-BAR-BUTTONS", + component: AgSideBarButtons +}; +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; + } + 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) { + _warn(215, { key, defaultByKey: DEFAULT_BY_KEY }); + continue; + } + comps.push(lookupResult); + } + if (comps.length === 0) { + return; + } + 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]; + } + _warn(215, { key: it, defaultByKey: DEFAULT_BY_KEY }); + return null; +} +var AgHorizontalResize = class extends Component { + 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); + } +}; +function getToolPanelCompDetails(userCompFactory, toolPanelDef, params) { + return userCompFactory.getCompDetails(toolPanelDef, ToolPanelComponent, undefined, 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 Component { + constructor() { + super(ToolPanelElement); + this.eContent = RefPlaceholder; + 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 }); + } +}; +var AgSideBarElement = { + tag: "div", + cls: "ag-side-bar ag-unselectable", + children: [ + { + tag: "ag-side-bar-buttons", + ref: "sideBarButtons" + } + ] +}; +var AgSideBar = class extends Component { + constructor() { + super(AgSideBarElement, [AgSideBarButtonsSelector]); + this.sideBarButtons = RefPlaceholder; + 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 = _getActiveDomElement(beans); + const openPanel = eGui.querySelector(".ag-tool-panel-wrapper:not(.ag-hidden)"); + const target = e.target; + const backwards = e.shiftKey; + if (!openPanel) { + if (_focusNextGridCoreContainer(beans, backwards, true)) { + e.preventDefault(); + return true; + } + _skipFocusableContainerListenerForAgGrid(e); + return false; + } + if (sideBarGui.contains(activeElement)) { + if (_focusInto(openPanel, backwards)) { + e.preventDefault(); + } + return; + } + if (!backwards) { + return; + } + let nextEl = null; + if (openPanel.contains(activeElement)) { + nextEl = _findNextFocusableElement(beans, openPanel, undefined, true); + } else if (isTargetUnderManagedComponent(openPanel, target)) { + nextEl = findFocusableElementBeforeTabGuard(openPanel, target); + } + if (!nextEl) { + nextEl = sideBarGui.querySelector(".ag-selected button"); + nextEl = _isVisible(nextEl) ? nextEl : null; + } + if (nextEl && nextEl !== e.target) { + e.preventDefault(); + nextEl.focus(); + } + } + handleKeyDown(e) { + const currentButton = _getActiveDomElement(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 KeyCode.LEFT: + case KeyCode.UP: + nextPos = Math.max(0, currentPos - 1); + break; + case KeyCode.RIGHT: + case KeyCode.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(undefined, "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) { + _warn(212); + return false; + } + if (isFilterPanel(toolPanel)) { + if (this.beans.filterManager?.isAdvFilterEnabled()) { + _warn(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, _addGridCommonParams(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); + _setAriaControlsAndLabel(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 ?? undefined, source); + } + } + getToolPanelInstance(key) { + const toolPanelWrapper = this.getWrapper(key); + if (!toolPanelWrapper) { + _warn(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(undefined, 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 = _addGridCommonParams(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); + _removeFromParent(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) { + _removeFromParent(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 +}; +var SideBarService = class extends BeanStub { + constructor() { + super(...arguments); + this.beanName = "sideBar"; + } + getSelector() { + return AgSideBarSelector; + } +}; +var SideBarModule = { + moduleName: "SideBar", + version: VERSION2, + beans: [SideBarService], + apiFunctions: { + isSideBarVisible, + setSideBarVisible, + setSideBarPosition, + openToolPanel, + closeToolPanel, + getOpenedToolPanel, + refreshToolPanel, + isToolPanelShowing, + getToolPanelInstance, + getSideBar + }, + dependsOn: [EnterpriseCoreModule, HorizontalResizeModule] +}; +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}'; +var MenuItemRenderer = class extends AgMenuItemRenderer { + constructor() { + super({ warnNoIcon: () => _warn(227) }); + } +}; +var MenuItemModule = { + moduleName: "MenuItem", + version: VERSION2, + userComponents: { + agMenuItem: MenuItemRenderer + }, + icons: { + check: "tick", + subMenuOpen: "small-right", + subMenuOpenRtl: "small-left" + }, + css: [menu_default] +}; +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}"; +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 Component { + constructor() { + super(AgPrimaryColsHeaderElement, [AgCheckboxSelector, AgInputTextFieldSelector]); + this.eExpand = RefPlaceholder; + this.eSelect = RefPlaceholder; + this.eFilterTextField = RefPlaceholder; + } + postConstruct() { + this.createExpandIcons(); + this.addManagedListeners(this.eExpand, { + click: this.onExpandClicked.bind(this), + keydown: (e) => { + if (e.key === KeyCode.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 = _createIconNoSpan("columnSelectOpen", beans)); + this.eExpand.appendChild(this.eExpandUnchecked = _createIconNoSpan("columnSelectClosed", beans)); + this.eExpand.appendChild(this.eExpandIndeterminate = _createIconNoSpan("columnSelectIndeterminate", beans)); + this.setExpandState(0); + } + 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...")); + _setDisplayed(this.eFilterTextField.getGui(), showFilter); + _setDisplayed(this.eSelect.getGui(), showSelect); + _setDisplayed(this.eExpand, showExpand && groupsPresent); + } + onFilterTextChanged() { + if (!this.onFilterTextChangedDebounced) { + this.onFilterTextChangedDebounced = _debounce(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 ? "collapseAll" : "expandAll" }); + } + setExpandState(state) { + this.expandState = state; + _setDisplayed(this.eExpandChecked, state === 0); + _setDisplayed(this.eExpandUnchecked, state === 1); + _setDisplayed(this.eExpandIndeterminate, state === 2); + } + setSelectionState(state) { + this.selectState = state; + this.eSelect.setValue(this.selectState); + } +}; +var AgPrimaryColsHeaderSelector = { + selector: "AG-PRIMARY-COLS-HEADER", + component: AgPrimaryColsHeader +}; +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 = _last(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; +} +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) { + _warn(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; + }); +} +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); + } +}; +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(); +} +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() : undefined + }; +} +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) : undefined + }; +} +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, undefined, 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] : undefined; + 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, undefined, oldAggData[colId]); + } + } +}; +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}`; + } +}; +function _getTextSelectionRanges(beans) { + const rootNode = _getRootNode(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); + } +} +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", _addGridCommonParams(beans.gos, params), true); + return compDetails?.newAgStackInstance() ?? AgPromise.resolve(); + }, + getPostProcessPopupParams: ({ column, node }) => ({ + column, + rowNode: node + }), + preserveRangesWhile: _preserveRangesWhile, + stopPropagationCallbacks: STOP_PROPAGATION_CALLBACKS, + warnNoItem: (menuItemOrString) => { + _warn(228, { menuItemOrString }); + } +}; +var MenuItemComponent = class extends AgMenuItemComponent { + constructor() { + super(MENU_ITEM_CALLBACKS); + } +}; +var MenuList = class extends AgMenuList { + constructor(level, menuActionParams = { + column: null, + node: null, + value: null + }) { + super(level, menuActionParams, MENU_ITEM_CALLBACKS); + } +}; +var ToolPanelContextMenu = class extends Component { + 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 (isProvidedColumnGroup(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: () => _focusInto(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: _createIconNoSpan(val.addIcon, beans, null), + action: () => val.activateFunction() + }); + } + if (isActive && val.removeIcon && val.deactivateLabel) { + ret.push({ + name: val.deactivateLabel(displayName), + icon: _createIconNoSpan(val.removeIcon, beans, null), + action: () => val.deActivateFunction?.() + }); + } + } + return ret; + } +}; +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 Component { + constructor(modelItem, allowDragging, eventType, focusWrapper, params) { + super(); + this.modelItem = modelItem; + this.allowDragging = allowDragging; + this.eventType = eventType; + this.focusWrapper = focusWrapper; + this.params = params; + this.cbSelect = RefPlaceholder; + this.eLabel = RefPlaceholder; + this.eGroupOpenedIcon = RefPlaceholder; + this.eGroupClosedIcon = RefPlaceholder; + this.eColumnGroupIcons = RefPlaceholder; + this.processingColumnStateChange = false; + const { columnGroup, depth, displayName } = modelItem; + this.columnGroup = columnGroup; + this.columnDepth = depth; + this.displayName = displayName; + } + postConstruct() { + this.setTemplate(ToolPanelColumnGroupElement, [AgCheckboxSelector]); + const { beans, cbSelect, eLabel, displayName, columnDepth, modelItem, focusWrapper, columnGroup } = this; + const { registry, gos } = beans; + const eDragHandle = _createIconNoSpan("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 KeyCode.LEFT: + e.preventDefault(); + this.modelItem.expanded = false; + break; + case KeyCode.RIGHT: + e.preventDefault(); + this.modelItem.expanded = true; + break; + case KeyCode.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) { + _setDisplayed(this.eDragHandle, false); + return; + } + const beans = this.beans; + const { gos, eventSvc, dragAndDrop } = beans; + let hideColumnOnExit = !gos.get("suppressDragLeaveHidesColumns"); + const dragSource = { + type: DragSourceType.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 === undefined ? translate("ariaIndeterminate", "indeterminate") : checkboxValue ? translate("ariaVisible", "visible") : translate("ariaHidden", "hidden"); + const visibilityLabel = translate("ariaToggleVisibility", "Press SPACE to toggle visibility"); + _setAriaLabel(focusWrapper, `${displayName} ${columnLabel}`); + cbSelect.setInputAriaLabel(`${visibilityLabel} (${state})`); + _setAriaDescribedBy(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; + } + 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; + _setDisplayed(this.eGroupClosedIcon, !folderOpen); + _setDisplayed(this.eGroupOpenedIcon, folderOpen); + } + refreshAriaExpanded() { + _setAriaExpanded(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); + } +}; +var getCurrentColumnsBeingMoved = (column) => { + if (isProvidedColumnGroup(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; +}; +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 Component { + constructor(modelItem, allowDragging, groupsExist, focusWrapper, params) { + super(); + this.modelItem = modelItem; + this.allowDragging = allowDragging; + this.groupsExist = groupsExist; + this.focusWrapper = focusWrapper; + this.params = params; + this.eLabel = RefPlaceholder; + this.cbSelect = RefPlaceholder; + this.processingColumnStateChange = false; + const { column, depth, displayName } = modelItem; + this.column = column; + this.columnDepth = depth; + this.displayName = displayName; + } + postConstruct() { + this.setTemplate(ToolPanelColumnElement, [AgCheckboxSelector]); + const { + beans, + cbSelect, + displayName, + eLabel, + columnDepth: indent, + groupsExist, + column, + gos, + focusWrapper + } = this; + const eDragHandle = _createIconNoSpan("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: _getShouldDisplayTooltip(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 TouchListener(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 = _getToolPanelClassesFromColDef(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 === KeyCode.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"); + _setAriaLabel(focusWrapper, `${displayName} ${columnLabel}`); + this.cbSelect.setInputAriaLabel(`${visibilityLabel} (${state})`); + _setAriaDescribedBy(focusWrapper, cbSelect.getInputElement().id); + } + setupDragging() { + const eDragHandle = this.eDragHandle; + if (!this.allowDragging) { + _setDisplayed(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: DragSourceType.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) { + _warn(158); + } +}; +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 Component { + 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) => { + _setAriaLevel(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: DragSourceType.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 (isProvidedColumnGroup(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; + _setAriaLabel(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) { + _warn(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; + } + if (notExpandedCount > 0) { + return 1; + } + return 0; + } + 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; + } + return !(checkedCount === 0 || uncheckedCount > 0); + } + setFilterText(filterText) { + this.filterText = _exists(filterText) ? filterText.toLowerCase() : null; + this.markFilteredColumns(); + this.flattenAndFilterModel(); + } + markFilteredColumns() { + const passesFilter = (item) => { + if (!_exists(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 +}; +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 Component { + constructor() { + super(AgPrimaryColsElement, [AgPrimaryColsHeaderSelector, AgPrimaryColsListSelector]); + this.primaryColsHeaderPanel = RefPlaceholder; + this.primaryColsListPanel = RefPlaceholder; + this.registerCSS(agPrimaryCols_default); + } + 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(); + } +}; +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)}"; +var DEFERRED_TOOL_PANEL_CLASS = "ag-column-panel-deferred"; +var ColumnToolPanel = class extends Component { + 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)); + }; + 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; + } + setVisible(visible) { + super.setDisplayed(visible); + if (visible && !this.initialised) { + this.init(this.params); + } + } + init(params) { + const defaultParams = _addGridCommonParams(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")) { + _warn(298); + } + if (mergedParams.buttons.length) { + this.initDeferredButtons(mergedParams.buttons); + } + } + this.initialised = true; + } + initDeferredButtons(buttons) { + const buttonComp = this.createBean(new FilterButtonComp({ 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 = _last(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; + _clearElement(this.getGui()); + } + refresh(params) { + this.destroyChildren(); + this.init(params); + return true; + } + getState() { + return { + expandedGroupIds: this.primaryColsPanel.getExpandedGroups() + }; + } + destroy() { + this.destroyChildren(); + super.destroy(); + } +}; +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)}"; +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 Component { + constructor(horizontal) { + super(PillDropZonePanelElement); + this.horizontal = horizontal; + this.state = "notDragging"; + this.guiDestroyFunctions = []; + this.childPillComponents = []; + this.resizeEnabled = false; + this.addElementClasses(this.getGui()); + this.ePillDropList = _createElement({ 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; + _clearElement(this.getGui()); + _clearElement(this.ePillDropList); + } + init(params) { + this.params = params ?? {}; + this.createManagedBean(new ManagedFocusFeature(this.getFocusableElement(), { + onTabKeyDown: this.onTabKeyDown.bind(this), + handleKeyDown: this.onKeyDown.bind(this) + })); + this.setupDropTarget(); + this.positionableFeature = new PositionableFeature(this.getGui()); + this.createManagedBean(this.positionableFeature); + this.refreshGui(); + _setAriaLabel(this.ePillDropList, this.getAriaLabel()); + } + onTabKeyDown(e) { + const focusableElements = _findFocusableElements(this.getFocusableElement(), null, true); + const len = focusableElements.length; + if (len === 0) { + return; + } + const { shiftKey } = e; + const activeEl = _getActiveDomElement(this.beans); + const isFirstFocused = activeEl === focusableElements[0]; + const isLastFocused = activeEl === _last(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 === KeyCode.DOWN; + let isPrevious = key === KeyCode.UP; + if (!isVertical) { + const isRtl = this.gos.get("enableRtl"); + isNext = !isRtl && key === KeyCode.RIGHT || isRtl && key === KeyCode.LEFT; + isPrevious = !isRtl && key === KeyCode.LEFT || isRtl && key === KeyCode.RIGHT; + } + if (!isNext && !isPrevious) { + return; + } + e.preventDefault(); + if (e.shiftKey) { + this.moveFocusedItem(isPrevious); + } else { + const el = _findNextFocusableElement(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 (_areEqual(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 = _isKeyboardMode(); + let alternateElement = null; + if (isKeyboardMode) { + alternateElement = _findNextFocusableElement(this.beans, eGridDiv) ?? _findNextFocusableElement(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 = _getActiveDomElement(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; + _setAriaRole(ePillDropList, len === 0 ? "presentation" : "listbox"); + for (let i = 0;i < len; i++) { + const comp = childPillComponents[i]; + const eGui = comp.getGui(); + _setAriaPosInSet(eGui, i + 1); + _setAriaSetSize(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 = _createElement({ 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 = _createElement({ 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 = _createElement({ 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 = _createIconNoSpan(enableRtl ? "panelDelimiterRtl" : "panelDelimiter", this.beans); + this.addElementClasses(icon, "cell-separator"); + eParent.appendChild(icon); + } + } +}; +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 Component { + constructor(dragSourceDropTarget, ghost, horizontal, template, agComponents) { + super(); + this.dragSourceDropTarget = dragSourceDropTarget; + this.ghost = ghost; + this.horizontal = horizontal; + this.template = template; + this.agComponents = agComponents; + this.eText = RefPlaceholder; + this.eDragHandle = RefPlaceholder; + this.eButton = RefPlaceholder; + } + 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(_createIconNoSpan("columnDrag", beans)); + eButton.appendChild(_createIconNoSpan("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); + _setAriaLabel(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; + } + 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() { + _setDisplayed(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 TouchListener(this.eButton); + this.addManagedListeners(touchListener, { + tap: () => this.dispatchLocalEvent(agEvent) + }); + this.addDestroyFunc(touchListener.destroy.bind(touchListener)); + } + onKeyDown(e) { + const isDelete = e.key === KeyCode.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; + } +}; +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 = RefPlaceholder; + 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" } : undefined, + { 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 === KeyCode.ENTER; + if (isEnter && this.isGroupingZone()) { + performSort(e); + } + }); + } + } + getCurrentSortDirection(column) { + return this.beans.columnStateUpdateStrategy.getSortDef(this.deferApply, column)?.direction ?? null; + } + getSortDefOverride() { + if (!this.deferApply) { + return; + } + 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 === KeyCode.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 = _createElement({ 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 === KeyCode.ENTER || e.key === KeyCode.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 DragSourceType.ToolPanel; + } + destroy() { + super.destroy(); + this.column = null; + } +}; +var AggItemComp = class extends Component { + constructor(itemSelected, value) { + super({ tag: "div", cls: "ag-select-agg-func-item", children: value }); + this.selectItem = itemSelected; + this.addGuiEventListener("click", this.selectItem); + } +}; +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 === DragSourceType.HeaderCell) { + return true; + } + if (type !== DragSourceType.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); + } +}; +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: _createIconNoSpan("pivotPanel", this.beans, null), + emptyMessage, + title + }); + if (this.horizontal) { + _addFocusableContainerListener(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"; + } +}; +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: _createIconNoSpan("rowGroupPanel", this.beans, null), + emptyMessage, + title + }); + if (this.horizontal) { + _addFocusableContainerListener(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"; + } +}; +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: _createIconNoSpan("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)); + } +}; +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 Component { + constructor(params, onPivotModeValueChanged) { + super(); + this.params = params; + this.onPivotModeValueChanged = onPivotModeValueChanged; + this.cbPivotMode = RefPlaceholder; + } + 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 + }); + } +}; +var ColumnToolPanelFactory = class extends BeanStub { + 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; + } +}; +var noop = () => {}; +var ColumnStateUpdateExecutionStrategy = class extends BeanStub { + 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 !== undefined && patch.hide !== !column.isVisible() || patch.rowGroup !== undefined && !!patch.rowGroup !== column.isRowGroupActive() || patch.pivot !== undefined && !!patch.pivot !== column.isPivotActive() || patch.aggFunc !== undefined && (patch.aggFunc ?? null) !== (column.getAggFunc() ?? null)) { + return true; + } + } + } + if (columnOrder && !_areEqual(columnOrder.colIds, getPrimaryColumnIds(beans))) { + return true; + } + if (rowGroup && !_areEqual(rowGroup.colIds, getColIds(beans.rowGroupColsSvc?.columns))) { + return true; + } + if (aggregation && !_areEqual(aggregation.colIds, getColIds(beans.valueColsSvc?.columns))) { + return true; + } + if (pivot && !_areEqual(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 ?? undefined + }); + } + _applyColumnState(beans, { + state: sortState, + defaultState: operation.baselineCleared ? { sort: null, sortIndex: null, sortType: undefined } : undefined + }, 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 !== undefined) { + 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 !== undefined) { + rowGroupActive = !!columnState.rowGroup; + } else if (this.state.rowGroup) { + rowGroupActive = this.state.rowGroup.colIds.includes(colId); + } else { + rowGroupActive = column.isRowGroupActive(); + } + let pivotActive; + if (columnState?.pivot !== undefined) { + pivotActive = !!columnState.pivot; + } else if (this.state.pivot) { + pivotActive = this.state.pivot.colIds.includes(colId); + } else { + pivotActive = column.isPivotActive(); + } + let valueActive; + if (columnState?.aggFunc !== undefined) { + 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 ? undefined : !!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 === undefined ? undefined : 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 ? undefined : !!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 === undefined) { + 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; + } + 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; +} +var ColumnStateUpdateStrategy = class extends BeanStub { + 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); + } +}; +var SharedColumnStateUpdateStrategyModule = { + moduleName: "SharedColumnStateUpdateStrategy", + version: VERSION2, + beans: [ColumnStateUpdateStrategy], + dependsOn: [EnterpriseCoreModule] +}; +var ColumnsToolPanelModule = { + moduleName: "ColumnsToolPanel", + version: VERSION2, + beans: [ColumnToolPanelFactory], + userComponents: { agColumnsToolPanel: ColumnToolPanel }, + 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: [ + EnterpriseCoreModule, + SharedColumnStateUpdateStrategyModule, + SideBarModule, + ColumnMoveModule, + SharedDragAndDropModule, + PopupModule, + MenuItemModule + ] +}; +var ChartMenuItemMapper = class extends BeanStub { + 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); + } + 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; + } + 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 == undefined) { + _warn(173, { group }); + continue; + } + const menuItem = menuItemLookup[chartConfigGroup._key]; + if (menuItem) { + if (menuItem.subMenu) { + const subMenus = chartTypes.map((chartType) => { + const itemKey = chartConfigGroup[chartType]; + if (itemKey == undefined) { + _warn(174, { group, chartType }); + return; + } + return menuItemLookup[itemKey]; + }).filter((s2) => s2 !== undefined); + 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 { + name: localeTextFunc(localeKey, defaultText + "‎"), + 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, + 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: _createIconNoSpan("chart", this.beans, undefined) + }; + } + 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 + }; + } +}; +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 + }, + { + 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: _createIconNoSpan("chart", this.beans, undefined) + }; + } + 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 + } + }; + } +}; +var ColumnChooserFactory = class extends BeanStub { + 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, _addGridCommonParams(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: () => { + _findNextFocusableElement(beans, columnSelectPanel.getGui())?.focus({ + preventScroll: true + }); + this.dispatchVisibleChangedEvent(true, column); + }, + closedCallback: (event) => { + const eComp = this.activeColumnChooser.getGui(); + this.destroyBean(this.activeColumnChooser); + this.activeColumnChooser = undefined; + this.activeColumnChooserDialog = undefined; + 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 + }); + } +}; +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}'`); + } +} +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 BeanStub { + 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: _createIconNoSpan("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: _createIconNoSpan("rowPin", beans, column2), + subMenu + } : null; + } + case "pinTop": + return pinnedRowModel?.isManual() ? { + name: localeTextFunc("pinTop", "Pin to Top"), + icon: _createIconNoSpan("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: _createIconNoSpan("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: _createIconNoSpan("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: _createIconNoSpan("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: _createIconNoSpan("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: _createIconNoSpan("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: _createIconNoSpan("clipboardCopy", beans, null), + action: () => clipboardSvc.copyToClipboard() + } : null; + case "copyWithHeaders": + return clipboardSvc ? { + name: localeTextFunc("copyWithHeaders", "Copy with Headers"), + icon: _createIconNoSpan("clipboardCopy", beans, null), + action: () => clipboardSvc.copyToClipboard({ includeHeaders: true }) + } : null; + case "copyWithGroupHeaders": + return clipboardSvc ? { + name: localeTextFunc("copyWithGroupHeaders", "Copy with Group Headers"), + icon: _createIconNoSpan("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: _createIconNoSpan("clipboardCut", beans, null), + disabled: !isEditable || gos.get("suppressCutToClipboard"), + action: () => clipboardSvc.cutToClipboard(undefined, "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: _createIconNoSpan("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: _createIconNoSpan("save", beans, null) + } : null; + } + case "csvExport": + return csvCreator ? { + name: localeTextFunc("csvExport", "CSV Export"), + icon: _createIconNoSpan("csvExport", beans, null), + action: () => csvCreator.exportDataAsCsv() + } : null; + case "excelExport": + return excelCreator ? { + name: localeTextFunc("excelExport", "Excel Export"), + icon: _createIconNoSpan("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: _createIconNoSpan("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: _createIconNoSpan("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: _createIconNoSpan(key, beans, null), + action: () => sortSvc.setSortForColumn(column2, getSortDef(column2), false, source2) + }; + } + default: { + _warn(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 = _exists(pivotValueColumn) ? pivotValueColumn : undefined; + } + 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, undefined, "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; +} +var ColumnMenuFactory = class extends BeanStub { + 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(_addGridCommonParams(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 && (_isClientSideRowModel(gos) || gos.get("ssrmExpandAllAffectsAllRows")) && (treeData || rowGroupCount > (colModel.isPivotMode() ? 1 : 0))) { + result.push("expandAll"); + result.push("contractAll"); + } + return result; + } +}; +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 BeanStub { + 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" : undefined; + 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, undefined, mouseEvent.target, onClosedCallback); + } + splitColumnOrGroup(columnOrGroup) { + const colIsColumn = columnOrGroup && isColumn(columnOrGroup); + const column = colIsColumn ? columnOrGroup : undefined; + const columnGroup = colIsColumn ? undefined : 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" : undefined; + const restrictToTabs = defaultTab ? [defaultTab] : undefined; + const isLegacyMenuEnabled = _isLegacyMenuEnabled(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)), + positionCallback: defaultTab ? () => positionCallback(menu) : undefined, + 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 + } : undefined; + } + createMenu(column, columnGroup, restoreFocusParams, restrictToTabs, eventSource) { + if (_isLegacyMenuEnabled(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)) : undefined; + } + } + dispatchVisibleChangedEvent(visible, switchingTab, column, columnGroup, defaultTab) { + this.eventSvc.dispatchEvent({ + type: "columnMenuVisibleChanged", + visible, + switchingTab, + key: this.lastSelectedTab ?? defaultTab ?? (_isLegacyMenuEnabled(this.gos) ? TAB_GENERAL : "columnMenu"), + column: column ?? null, + columnGroup: columnGroup ?? null + }); + } + isMenuEnabled(column) { + if (!_isLegacyMenuEnabled(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 BeanStub { + 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) { + _warn(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: _createIconNoSpan("legacyMenu", beans, column), + titleLabel: TAB_GENERAL.replace("MenuTab", ""), + bodyPromise: AgPromise.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: _createIconNoSpan("filterTab", this.beans, this.column), + titleLabel: TAB_FILTER.replace("MenuTab", ""), + bodyPromise: AgPromise.resolve(comp?.getGui()), + afterAttachedCallback, + afterDetachedCallback, + name: TAB_FILTER + }; + return this.tabItemFilter; + } + createColumnsPanel() { + const eWrapperDiv = _createElement({ 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: _createIconNoSpan("columns", beans, column), + titleLabel: TAB_COLUMNS.replace("MenuTab", ""), + bodyPromise: AgPromise.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 Component { + 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 = RefPlaceholder; + } + 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()); + } + onHidePopup(event) { + this.beans.menuUtils.closePopupAndRestoreFocusOnSelect(this.hidePopupFunc, this.restoreFocusParams, event); + } + afterGuiAttached({ hidePopup }) { + if (hidePopup) { + this.hidePopupFunc = hidePopup; + this.addDestroyFunc(hidePopup); + } + _focusInto(this.mainMenuList.getGui()); + } +}; +function showColumnChooser(beans, params) { + beans.colChooserFactory?.showColumnChooser({ chooserParams: params }); +} +function hideColumnChooser(beans) { + beans.colChooserFactory?.hideActiveColumnChooser(); +} +var MenuUtils = class extends BeanStub { + 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 = _getActiveDomElement(this.beans); + if (!eComp.contains(activeEl) && !_isNothingFocused(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 (_isNothingFocused(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(); + } + } + } + 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 && _isVisible(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] || _last(allColumns); + if (columnToFocus) { + focusSvc.focusHeaderPosition({ + headerPosition: { + headerRowIndex: headerPosition.headerRowIndex, + column: columnToFocus + } + }); + } + } + } + blockMiddleClickScrollsIfNeeded(mouseEvent) { + if (this.gos.get("suppressMiddleClickScrolls") && mouseEvent.which === 2) { + mouseEvent.preventDefault(); + } + } +}; +var MenuCoreModule = { + moduleName: "MenuCore", + version: VERSION2, + beans: [MenuItemMapper, ChartMenuItemMapper, MenuUtils], + 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: [EnterpriseCoreModule, PopupModule, SharedMenuModule, MenuItemModule] +}; +var ColumnMenuModule = { + moduleName: "ColumnMenu", + version: VERSION2, + beans: [EnterpriseMenuFactory, ColumnMenuFactory, ColumnChooserFactory], + icons: { + ensureColumnVisible: "column-arrow", + legacyMenu: "menu", + filterTab: "filter", + columnSelectClosed: "tree-closed", + columnSelectOpen: "tree-open", + columnSelectIndeterminate: "tree-indeterminate" + }, + apiFunctions: { + showColumnChooser, + hideColumnChooser + }, + dependsOn: [MenuCoreModule, SharedDragAndDropModule, ColumnMoveModule] +}; +var SET_FILTER_SELECT_ALL = "__AG_SELECT_ALL__"; +var SET_FILTER_ADD_SELECTION_TO_FILTER = "__AG_ADD_SELECTION_TO_FILTER__"; +var FlatSetDisplayValueModel = class { + constructor(valueSvc, getValueFormatter, formatter, column) { + this.valueSvc = valueSvc; + this.getValueFormatter = getValueFormatter; + this.formatter = formatter; + this.column = column; + 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() {} +}; +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 Component { + constructor(params) { + super(params.isGroup ? SetFilterGroupElement : SetFilterElement, [AgCheckboxSelector]); + this.eCheckbox = RefPlaceholder; + this.eGroupOpenedIcon = RefPlaceholder; + this.eGroupClosedIcon = RefPlaceholder; + this.eGroupIndeterminateIcon = RefPlaceholder; + 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 ?? undefined + }; + 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"); + } + _setAriaLevel(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(_createIcon("setFilterGroupClosed", beans, null)); + eGroupOpenedIcon.appendChild(_createIcon("setFilterGroupOpen", beans, null)); + const listener = this.onExpandOrContractClicked.bind(this); + this.addManagedElementListeners(eGroupClosedIcon, { click: listener }); + this.addManagedElementListeners(eGroupOpenedIcon, { click: listener }); + if (hasIndeterminateExpandState) { + eGroupIndeterminateIcon.appendChild(_createIcon("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; + _setDisplayed(eGroupClosedIcon, hasIndeterminateExpandState ? isExpanded === false : !isExpanded); + _setDisplayed(eGroupOpenedIcon, isExpanded === true); + if (hasIndeterminateExpandState) { + _setDisplayed(eGroupIndeterminateIcon, isExpanded === undefined); + } + } + 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 === undefined ? translate("ariaIndeterminate", "indeterminate") : checkboxValue ? translate("ariaVisible", "visible") : translate("ariaHidden", "hidden"); + const visibilityLabel = translate("ariaToggleVisibility", "Press SPACE to toggle visibility"); + _setAriaLabelledBy(this.eCheckbox.getInputElement(), undefined); + 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(); + _setAriaLabel(ariaEl, `${value} ${itemLabel}`); + _setAriaDescribedBy(ariaEl, this.eCheckbox.getInputElement().id); + } + refreshAriaChecked() { + const ariaEl = this.getAriaElement(); + _setAriaChecked(ariaEl, this.eCheckbox.getValue()); + } + refreshAriaExpanded() { + _setAriaExpanded(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 = _toStringOrNull(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 : _toStringOrNull(value); + this.shouldDisplayTooltip = _getShouldDisplayTooltip(gos, () => this.eCheckbox.getGui().querySelector(".ag-label")); + this.tooltipFeature?.setTooltipAndRefresh(newTooltipText); + } + this.cellRendererParams = _addGridCommonParams(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") { + _warn(208); + valueToRender = ""; + } + this.eCheckbox.setLabel(valueToRender); + this.setupFixedAriaLabels(valueToRender); + } + getComponentHolder() { + return this.params.column.getColDef(); + } +}; +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` +}; +function processDataPath(dataPath, treeData, groupAllowUnbalanced) { + let processedDataPath = dataPath; + if (!processedDataPath) { + return null; + } + processedDataPath = processedDataPath.map((treeKey) => _toStringOrNull(_makeNull(treeKey))); + if (!treeData && groupAllowUnbalanced && processedDataPath.some((treeKey) => treeKey == null)) { + if (_last(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; + _warn(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; + }; +} +var TreeSetDisplayValueModel = class { + constructor(formatter, treeListPathGetter, treeListFormatter, treeDataOrGrouping) { + this.formatter = formatter; + this.treeListPathGetter = treeListPathGetter; + this.treeListFormatter = treeListFormatter; + this.treeDataOrGrouping = treeDataOrGrouping; + this.allDisplayedItemsTree = /* @__PURE__ */ new Map; + 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); + } + _warn(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; + } + const childExpanded = recursiveExpansionCheck(item2.children, someTrue, someFalse); + if (childExpanded === undefined) { + return; + } else if (childExpanded) { + someTrue = true; + } else { + someFalse = true; + } + } + return someTrue && someFalse ? undefined : 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"); + } + } +}; +var SetFilter = class extends ProvidedFilter { + constructor() { + super("setFilter", "set-filter"); + this.filterType = "set"; + this.eMiniFilter = RefPlaceholder; + this.eFilterLoading = RefPlaceholder; + this.eFilterLoadingIcon = RefPlaceholder; + this.eSetFilterList = RefPlaceholder; + this.eFilterNoMatches = RefPlaceholder; + this.hardRefreshVirtualList = false; + this.miniFilterText = null; + this.addCurrentSelectionToFilter = false; + 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 [AgInputTextFieldSelector]; + } + handleKeyDown(e) { + super.handleKeyDown(e); + if (e.defaultPrevented) { + return; + } + const getComponentForKeyEvent = () => { + if (!this.eSetFilterList.contains(_getActiveDomElement(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 KeyCode.SPACE: + getComponentForKeyEvent()?.toggleSelected(); + break; + case KeyCode.ENTER: + this.handleKeyEnter(e); + break; + case KeyCode.LEFT: + getComponentForKeyEvent()?.setExpanded(false); + break; + case KeyCode.RIGHT: + getComponentForKeyEvent()?.setExpanded(true); + break; + } + } + handleKeyEnter(e) { + e.preventDefault(); + const { excelMode, readOnly } = this.params; + if (!excelMode || !!readOnly) { + return; + } + this.params.onAction("apply", undefined, 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 _areEqual(a.values, b.values); + } + setIsLoading(isLoading) { + _setDisplayed(this.eFilterLoading, isLoading); + if (!isLoading) { + this.hardRefreshVirtualList = true; + } + } + initialiseFilterBodyUi() { + this.initVirtualList(); + this.initMiniFilter(); + this.initLoading(); + } + initLoading() { + const loadingIcon = _createIconNoSpan("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 !== undefined; + } + 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); + } + 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; + } + onNewRowsLoaded() {} + setFilterValues(values) { + _warn(283); + this.handler.setFilterValues(values); + } + resetFilterValues() { + _warn(283); + this.handler.resetFilterValues(); + } + refreshFilterValues() { + _warn(283); + this.doRefreshFilterValues(); + } + doRefreshFilterValues() { + this.handler.refreshFilterValues(); + } + 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" : undefined; + 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; + _setDisplayed(this.eFilterNoMatches, hideResults); + _setDisplayed(this.eSetFilterList, !hideResults); + } + resetMiniFilter() { + this.eMiniFilter.setValue(null, true); + this.doSetMiniFilter(null); + } + onMiniFilterKeyDown(e) { + const { excelMode, readOnly } = this.params; + if (e.key === KeyCode.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); + } + doSetMiniFilter(value) { + value = _makeNull(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 } : undefined; + } + checkAndRefreshVirtualList() { + this.virtualList.refresh(!this.hardRefreshVirtualList); + if (this.hardRefreshVirtualList) { + this.hardRefreshVirtualList = false; + } + } + getFilterKeys() { + _warn(283); + return this.handler.getFilterKeys(); + } + getFilterValues() { + _warn(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; + } + 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 === undefined) { + return; + } + if (childSelected) { + someTrue = true; + } else { + someFalse = true; + } + if (someTrue && someFalse) { + return; + } + } + 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() && _exists(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 : undefined; + 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(_makeNull(unformattedKey)); + const existingUnformattedKey = existingFormattedKeys.get(formattedKey); + if (existingUnformattedKey !== undefined) { + 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 = undefined; + this.displayValueModel = undefined; + 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; + } +}; +var ClientSideValuesExtractor = class extends BeanStub { + 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 AgPromise((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 = _makeNull(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; + } +}; +var SetFilterAppliedModel = class { + constructor(caseFormat) { + this.caseFormat = caseFormat; + this.keys = null; + } + isNull() { + return this.keys == null; + } + 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; + } +}; +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 BeanStub { + constructor(clientSideValuesExtractor, caseFormat, createKey, isTreeDataOrGrouping, params) { + super(); + this.clientSideValuesExtractor = clientSideValuesExtractor; + this.caseFormat = caseFormat; + this.createKey = createKey; + this.isTreeDataOrGrouping = isTreeDataOrGrouping; + this.params = params; + this.allValues = /* @__PURE__ */ new Map; + 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; + } else { + this.valuesType = Array.isArray(values) ? 0 : 1; + 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; + this.providedValues = null; + } else { + this.valuesType = Array.isArray(values) ? 0 : 1; + } + 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]) => _defaultComparator(aValue, bValue); + } else { + entryComparator = ([_aKey, aValue], [_bKey, bValue]) => keyComparator(aValue, bValue); + } + this.entryComparator = entryComparator; + this.keyComparator = keyComparator ?? _defaultComparator; + this.compareByValue = !!(usingComplexObjects && keyComparator || treeDataOrGrouping || treeList && !treeListPathGetter); + } + updateAllValues() { + this.allKeys = new AgPromise((resolve) => { + switch (this.valuesType) { + case 2: + this.getValuesFromRowsAsync().then((values) => resolve(this.processAllValues(values))); + break; + case 0: { + resolve(this.processAllValues(this.uniqueValues(this.validateProvidedValues(this.providedValues)))); + break; + } + case 1: { + this.dispatchLocalEvent({ type: "loadingStart" }); + const callback = this.providedValues; + const { column, colDef } = this.params.handlerParams; + const params = _addGridCommonParams(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; + this.providedValues = valuesToUse; + }); + } + refreshAvailable() { + return new AgPromise((resolve) => { + if (this.showAvailableOnly()) { + this.allKeys.then((keys) => { + const updatedKeys = keys ?? []; + this.updateAvailableKeys(updatedKeys); + resolve(true); + }); + return; + } + resolve(false); + }); + } + refreshAll() { + return new AgPromise((resolve) => { + this.allKeys.then(() => { + this.updateAllValues().then(() => { + resolve(); + }); + }); + }); + } + isLoading() { + return !this.initialised && this.valuesType === 1; + } + 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) { + _error(113); + return; + } + const existingValues = removeUnavailableValues && !this.params.handlerParams.filterParams.caseSensitive ? this.allValues : undefined; + 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) ?? AgPromise.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 = _makeNull(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) { + _warn(209); + } else { + _warn(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; + } + 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" }); + } + }); + } +}; +var SetFilterHandler = class extends BeanStub { + constructor() { + super(...arguments); + 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 = _isClientSideRowModel(gos, beans.rowModel) ? this.createManagedBean(new ClientSideValuesExtractor(createKey, caseFormat, params.getValue, isTreeDataOrGrouping, isTreeData)) : undefined; + 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 = _last(value); + } + const formattedValue = this.beans.valueSvc.formatValue(this.params.column, null, value, this.valueFormatter, false); + return (formattedValue == null ? _toStringOrNull(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(); + } + refreshFilterValues(suppressAvailableValuesCheck) { + if (!this.valueModel.isInitialised()) { + return; + } + this.valueModel.refreshAll().then(() => { + this.dispatchLocalEvent({ type: "dataChanged", hardRefresh: true }); + this.validateModel(this.params, undefined, !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 = _debounce(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(_makeNull(unformattedKey)); + const existingUnformattedKey = existingFormattedKeys.get(formattedKey); + if (existingUnformattedKey !== undefined) { + 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) { + _error(250); + return () => null; + } + if (keyCreator) { + return (value, node = null) => { + const params = this.getKeyCreatorParams(value, node); + return _makeNull(keyCreator(params)); + }; + } + return (value) => _makeNull(_toStringOrNull(value)); + } + getKeyCreatorParams(value, node = null) { + const { colDef, column } = this.params; + return _addGridCommonParams(this.gos, { + value, + colDef, + column, + node, + data: node?.data + }); + } + setValueFormatter(providedValueFormatter, keyCreator, treeList, isRefData) { + let valueFormatter = providedValueFormatter; + if (!valueFormatter) { + if (keyCreator && !treeList) { + _error(249); + return; + } + this.noValueFormatterSupplied = true; + if (!isRefData) { + valueFormatter = (params) => _toStringOrNull(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 = undefined; + } +}; +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 Component { + constructor() { + super(SetFloatingFilterElement, [AgInputTextFieldSelector]); + this.eFloatingFilterText = RefPlaceholder; + } + 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)) { + _error(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)); + }); + } + } +}; +var SetFilterModule = { + moduleName: "SetFilter", + version: VERSION2, + userComponents: { + agSetColumnFilter: { + classImp: SetFilter, + params: { + useForm: true + }, + processParams: (params) => { + applyExcelModeOptions(params); + return params; + } + }, + agSetColumnFloatingFilter: SetFloatingFilterComp + }, + dynamicBeans: { + agSetColumnFilterHandler: SetFilterHandler + }, + icons: { + setFilterGroupClosed: "tree-closed", + setFilterGroupOpen: "tree-open", + setFilterGroupIndeterminate: "tree-indeterminate", + setFilterLoading: "loading" + }, + dependsOn: [EnterpriseCoreModule, ColumnFilterModule] +}; +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}"; +function getStatusPanelCompDetails(userCompFactory, def, params) { + return userCompFactory.getCompDetails(def, StatusPanelComponent, undefined, 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 Component { + constructor() { + super(AgStatusBarElement); + this.updateQueued = false; + this.panelsPromise = AgPromise.resolve(); + this.eStatusBarLeft = RefPlaceholder; + this.eStatusBarCenter = RefPlaceholder; + this.eStatusBarRight = RefPlaceholder; + 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)); + _addFocusableContainerListener(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; + } + _warn(...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 = AgPromise.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 = _addGridCommonParams(this.gos, { + ...statusPanelConfig.statusPanelParams ?? {}, + key + }); + const hasRefreshed = existingStatusPanel.refresh(newParams); + if (hasRefreshed) { + existingStatusPanelsToReuse.set(key, existingStatusPanel); + delete this.compDestroyFunctions[key]; + _removeFromParent(existingStatusPanel.getGui()); + } + } + } + } + this.resetStatusBar(); + if (validStatusBarPanelsProvided) { + this.processStatusPanels(existingStatusPanelsToReuse); + } + } + resetStatusBar() { + _clearElement(this.eStatusBarLeft); + _clearElement(this.eStatusBarCenter); + _clearElement(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 = AgPromise.resolve(existingStatusPanel); + } else { + const compDetails = getStatusPanelCompDetails(this.userCompFactory, componentConfig, _addGridCommonParams(this.gos, { key })); + if (compDetails == null) { + continue; + } + promise = compDetails.newAgStackInstance(); + } + componentDetails.push({ + key, + promise + }); + } + return AgPromise.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 +}; +var AgNameValueElement = { + tag: "div", + cls: "ag-status-name-value", + children: [ + { tag: "span", ref: "eLabel" }, + ": ", + { 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 Component { + constructor() { + super(AgNameValueElement); + this.eLabel = RefPlaceholder; + this.eValue = RefPlaceholder; + } + 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(_addGridCommonParams(this.gos, { + value: numericValue, + bigintValue, + totalRows, + key: this.key + })); + } +}; +var AgNameValueSelector = { + selector: "AG-NAME-VALUE", + component: AgNameValue +}; +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; +}; +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 Component { + constructor() { + super(AggregationCompElement, [AgNameValueSelector]); + this.sumAggregationComp = RefPlaceholder; + this.countAggregationComp = RefPlaceholder; + this.minAggregationComp = RefPlaceholder; + this.maxAggregationComp = RefPlaceholder; + this.avgAggregationComp = RefPlaceholder; + } + 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 (_exists(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]; + } + 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 = _missing(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 = _getRowNode(beans, currentRow); + if (_missing(rowNode)) { + return; + } + let value = valueSvc.getValue(col, rowNode, "data"); + if (_missing(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 = _parseBigIntOrNull(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); + } +}; +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 }) => _formatNumberCommas(value, this.getLocaleTextFunc.bind(this))); + } + refresh(params) { + const { key, valueFormatter } = params; + this.key = key; + this.updateValueFormatter(valueFormatter); + return true; + } +}; +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 _formatNumberCommas(value, this.getLocaleTextFunc.bind(this)); + } + return this.getLocaleTextFunc()("statusBarLastRowUnknown", "?"); + }); + } + refresh(params) { + const { key, valueFormatter } = params; + this.key = key; + this.updateValueFormatter(valueFormatter); + return true; + } +}; +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 = _formatNumberCommas(value, getLocaleTextFunc); + const totalRowCount = _formatNumberCommas(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; + } +}; +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 }) => _formatNumberCommas(value, this.getLocaleTextFunc.bind(this))); + } + refresh(params) { + const { key, valueFormatter } = params; + this.key = key; + this.updateValueFormatter(valueFormatter); + return true; + } +}; +function getStatusPanel(beans, key) { + const comp = beans.statusBarSvc?.getStatusPanel(key); + return _unwrapUserComp(comp); +} +var StatusBarService = class extends BeanStub { + 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(); + } +}; +var StatusBarModule = { + moduleName: "StatusBar", + version: VERSION2, + beans: [StatusBarService], + userComponents: { + agAggregationComponent: AggregationComp, + agTotalRowCountComponent: TotalRowsComp, + agFilteredRowCountComponent: FilteredRowsComp, + agTotalAndFilteredRowCountComponent: TotalAndFilteredRowsComp, + agSelectedRowCountComponent: SelectedRowsComp + }, + selectors: [AgStatusBarSelector], + apiFunctions: { + getStatusPanel + }, + dependsOn: [EnterpriseCoreModule, KeyboardNavigationModule] +}; +function assertNotExcelMultiSheet(beans) { + if (beans.excelCreator?.getFactoryMode() === "MULTI_SHEET") { + _warn(161); + return false; + } + return true; +} +function getDataAsExcel(beans, params) { + if (assertNotExcelMultiSheet(beans)) { + return beans.excelCreator?.getDataAsExcel(params); + } + return; +} +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); +} +var ExcelExportModule = { + moduleName: "ExcelExport", + version: VERSION2, + beans: [ExcelCreator], + apiFunctions: { + getDataAsExcel, + exportDataAsExcel, + getSheetDataForExcel, + getMultipleSheetsAsExcel: getMultipleSheetsAsExcel2, + exportMultipleSheetsAsExcel: exportMultipleSheetsAsExcel2 + }, + dependsOn: [SharedExportModule, EnterpriseCoreModule] +}; +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 ProvidedFilter ? 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; +} +var BaseMultiFilter = class extends TabGuardComp { + constructor() { + super({ tag: "div", cls: "ag-multi-filter ag-menu-list-compact" }); + this.filterDefs = []; + this.guiDestroyFuncs = []; + this.filterGuis = []; + this.lastActivatedMenuItem = null; + } + postConstruct() { + this.initialiseTabGuard({ + onFocusIn: (e) => this.onFocusIn(e) + }); + } + refreshGui(container) { + if (container === this.lastOpenedInContainer) { + return AgPromise.resolve(); + } + this.tabGuardFeature.removeAllChildrenExceptTabGuards(); + this.destroyChildren(); + return AgPromise.all(this.getFilterWrappers().map((wrapper, index) => { + if (!wrapper) { + return AgPromise.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 = AgPromise.resolve(group.getGui()); + } else { + filterGuiPromise = AgPromise.resolve(comp.getGui()); + } + return filterGuiPromise; + })).then((filterGuis) => { + filterGuis.forEach((filterGui, index) => { + if (!filterGui) { + return; + } + if (index > 0) { + this.appendChild(_createElement({ 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(); + _setAriaRole(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, { + keydown: (e) => { + const { key } = e; + switch (key) { + case KeyCode.UP: + case KeyCode.RIGHT: + case KeyCode.DOWN: + case KeyCode.LEFT: + e.preventDefault(); + if (key === KeyCode.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 = undefined; + refreshPromise = AgPromise.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) : undefined; + 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 (!_focusInto(filterGui)) { + filterGui.focus({ preventScroll: true }); + } + hasFocused = true; + } + } + }); + } + const activeEl = _getActiveDomElement(beans); + if (!hasFocused && (_isNothingFocused(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 = undefined; + 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; + } + } +}; +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 AgPromise((resolve) => { + AgPromise.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 setFilterModel2 = (filter, filterModel) => { + return new AgPromise((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(() => AgPromise.resolve({ filter, filterParams }), handler, handlerParams, modelForFilter, newState, "api").then(() => { + this.updateActiveListForHandler(index, wrapper.model); + })); + } else { + promises.push(setFilterModel2(filter, modelForFilter).then(() => { + this.updateActiveListForFilter(index, filter); + })); + } + }); + return AgPromise.all(promises).then(() => {}); + } + applyModel(source = "api") { + let result = false; + for (const wrapper of this.wrappers) { + if (wrapper) { + const filter = wrapper.filter; + if (filter instanceof ProvidedFilter) { + 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(() => AgPromise.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 AgPromise.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 LocalEventService; + 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 = AgPromise.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); + } + } + 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]) ?? ""; + } +}; +var MultiFilterHandler = class extends BeanStub { + constructor() { + super(...arguments); + this.filterType = "multi"; + this.handlerWrappers = []; + 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) { + _warn(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) { + _warn(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; + _removeFromArray(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(); + } +}; +var MultiFilterService = class extends BeanStub { + 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 + } + }; + } +}; +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) { + _warn(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 AgPromise((resolve) => { + AgPromise.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) + }; + _refreshFilterUi(filter, filterParams[index], modelForFilter, stateForFilter, source); + }); + return true; + } + getLastActiveFilterIndex() { + return this.getHandler().getLastActiveFilterIndex?.() ?? null; + } + getChildFilterInstance(index) { + return this.filters[index] ?? undefined; + } + 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 AgPromise.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) ?? ""; + } +}; +var MultiFloatingFilterElement = { + tag: "div", + cls: "ag-multi-floating-filter ag-floating-filter-input" +}; +var MultiFloatingFilterComp = class extends Component { + 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 AgPromise.all(floatingFilterPromises).then((floatingFilters) => { + floatingFilters.forEach((floatingFilter, index) => { + this.floatingFilters.push(floatingFilter); + const gui = floatingFilter.getGui(); + this.appendChild(gui); + if (index > 0) { + _setDisplayed(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) => { + _setDisplayed(filter.getGui(), i === 0); + }); + } else { + const lastActiveFloatingFilterIndex = reactiveParams.getHandler()?.getLastActiveFilterIndex?.(); + this.floatingFilters.forEach((filter, i) => { + const shouldShow = lastActiveFloatingFilterIndex == null ? i === 0 : i === lastActiveFloatingFilterIndex; + _setDisplayed(filter.getGui(), shouldShow); + }); + } + } + } else { + _clearElement(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, + parentFilterInstance: (callback) => { + this.parentMultiFilterInstance((parent) => { + const child = parent.getChildFilterInstance(index); + if (child == null) { + return; + } + callback(child); + }); + }, + 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); + }; + } + _mergeDeep(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); + _setDisplayed(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; + _setDisplayed(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)) { + _error(120); + } + cb(parent); + }); + } +}; +var MultiFilterModule = { + moduleName: "MultiFilter", + version: VERSION2, + userComponents: { + agMultiColumnFilter: { + getComp: (beans) => beans.gos.get("enableFilterHandlers") ? { + classImp: MultiFilterUi, + params: { + useForm: true + } + } : MultiFilter + }, + agMultiColumnFloatingFilter: MultiFloatingFilterComp + }, + beans: [MultiFilterService], + dynamicBeans: { + agMultiColumnFilterHandler: MultiFilterHandler + }, + dependsOn: [EnterpriseCoreModule, ColumnFilterModule, MenuItemModule] +}; +var AggColumnNameService = class extends BeanStub { + 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 = _exists(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 !== undefined; + 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; + } +}; +var defaultAggFuncNames = { + sum: "Sum", + first: "First", + last: "Last", + min: "Min", + max: "Max", + count: "Count", + avg: "Average" +}; +var AggFuncService = class extends BeanStub { + 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 = _exists(this.aggFuncsMap[func]); + return allowed && funcExists; + } + getDefaultFuncLabel(fctName) { + return defaultAggFuncNames[fctName] ?? fctName; + } + getDefaultAggFunc(column) { + const defaultAgg = column.getColDef().defaultAggFunc; + if (_exists(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 ? _last(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({ + toString: function() { + return this.value.toString(); + }, + 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({ + toString: function() { + return typeof this.value === "number" || typeof this.value === "bigint" ? this.value.toString() : ""; + }, + 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; +} +var AggregatedChildrenSvc = class extends BeanStub { + 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); + } + } +}; +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"); +} +var AggregationStage = class extends BeanStub { + constructor() { + super(...arguments); + this.beanName = "aggStage"; + this.step = "aggregate"; + this.refreshProps = [ + "getGroupRowAgg", + "alwaysAggregateAtRootLevel", + "suppressAggFilteredOnly", + "grandTotalRow" + ]; + this.hadAgg = false; + } + 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, undefined, (rowNode) => { + setAggDataWithSiblings(rowNode, null, colModel2); + }); + } + return; + } + this.hadAgg = true; + const colModel = beans.colModel; + const aggFuncSvc = beans.aggFuncSvc; + const aggregateRoot = gos.get("alwaysAggregateAtRootLevel") || !!_getGrandTotalRow(gos) || colModel.isPivotMode(); + const filteredOnly = !_getGroupAggFiltering(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 : undefined; + 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 : undefined; + 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 !== undefined ? 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] : undefined; + values[n] = v !== undefined ? 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") { + _warn(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; +}; +var FilterAggregatesStage = class extends BeanStub { + constructor() { + super(...arguments); + this.beanName = "filterAggStage"; + this.step = "filter_aggregates"; + this.refreshProps = []; + 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 = allChildrenCount === 0 && rowNode.level >= 0 ? null : allChildrenCount; + rowNode.setAllChildrenCount(count); + rowNode.pinnedSibling?.setAllChildrenCount(count); + }; + 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 = _getGroupAggFiltering(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; + } + }; + _forEachChangedGroupDepthFirst(rowModel.rootNode, rowModel.hierarchical, changedPath, isAggFilterActive ? filterChildren : preserveChildren); + } +}; +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 = undefined; + sibling.sibling = undefined; +} +var FooterService = class extends BeanStub { + constructor() { + super(...arguments); + this.beanName = "footerSvc"; + } + addTotalRows(startIndex, node, callback, includeFooterNodes, isRootNode, position) { + let index = startIndex; + if (isRootNode) { + const grandTotal = includeFooterNodes && _getGrandTotalRow(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 = _addGridCommonParams(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); + } + _warn(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; + } +} +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: () => { + return; + }, + getInitialIndexFunc: () => { + return; + }, + getValueFunc: (colDef) => { + const aggFunc = colDef.aggFunc; + if (aggFunc === null || aggFunc === "") { + return null; + } + if (aggFunc === undefined) { + return; + } + return !!aggFunc; + }, + getInitialValueFunc: (colDef) => { + return colDef.initialAggFunc != null && colDef.initialAggFunc != ""; + } + }; + this.modifyColumnsNoEventsCallbacks = { + addCol: (column) => this.columns.push(column), + removeCol: (column) => _removeFromArray(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 !== undefined) { + if (typeof aggFunc === "string") { + this.setColAggFunc(column, aggFunc); + if (!column.isValueActive()) { + this.setColValueActive(column, true, source); + this.modifyColumnsNoEventsCallbacks.addCol(column); + } + } else { + if (_exists(aggFunc)) { + _warn(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); + } + } +}; +var SharedAggregationModule = { + moduleName: "SharedAggregation", + version: VERSION2, + beans: [AggFuncService, AggColumnNameService, FooterService, ValueColsSvc], + apiFunctions: { + addAggFuncs, + clearAggFuncs, + setColumnAggFunc + }, + dependsOn: [EnterpriseCoreModule] +}; +var AggregationModule = { + moduleName: "Aggregation", + version: VERSION2, + beans: [AggregationStage, FilterAggregatesStage, AggregatedChildrenSvc], + rowModels: ["clientSide"], + dependsOn: [SharedAggregationModule] +}; +var PivotColsSvc = class extends BaseColsService { + 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) => _removeFromArray(this.columns, column) + }; + } + syncColumnWithState(column, source, getValue, rowIndex) { + const { value1: pivot, value2: pivotIndex } = getValue("pivot", "pivotIndex"); + if (pivot !== undefined || pivotIndex !== undefined) { + 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"); + } +}; +var RowGroupColsSvc = class extends BaseColsService { + 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) => _removeFromArray(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 !== undefined || rowGroupIndex !== undefined) { + 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 (_shouldUpdateColVisibilityAfterGroup(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"); + } +}; +var AutoColService = class extends BeanStub { + constructor() { + super(...arguments); + this.beanName = "autoColSvc"; + } + postConstruct() { + this.addManagedPropertyListener("autoGroupColumnDef", this.updateColumns.bind(this)); + this.setupGroupHideColumnsUntilExpanded(); + } + setupGroupHideColumnsUntilExpanded() { + const updateGroupColumnVisibility = () => this.updateGroupColumnVisibility(); + this.addManagedEventListeners({ + 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) => !isColumnGroupAutoCol(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) { + _warn(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"; + } + 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; + } + updateOneAutoCol(colToUpdate, index, source) { + const oldColDef = colToUpdate.getColDef(); + const underlyingColId = typeof oldColDef.showRowGroup == "string" ? oldColDef.showRowGroup : undefined; + const beans = this.beans; + const underlyingColumn = underlyingColId != null ? beans.colModel.getColDefCol(underlyingColId) : undefined; + const colId = colToUpdate.getId(); + const colDef = this.createAutoColDef(colId, underlyingColumn ?? undefined, index); + colToUpdate.setColDef(colDef, null, source); + _applyColumnState(beans, { state: [_getColumnStateFromColDef(colDef, colId)] }, source); + } + createAutoColDef(colId, underlyingColumn, index) { + let res = this.createBaseColDef(underlyingColumn); + const autoGroupColumnDef = this.gos.get("autoGroupColumnDef"); + _mergeDeep(res, autoGroupColumnDef); + res = _addColumnDefaultAndTypes(this.beans, res, colId, true); + if (autoGroupColumnDef?.groupRowEditable == null) { + res.groupRowEditable = undefined; + } + if (autoGroupColumnDef?.groupRowValueSetter == null) { + res.groupRowValueSetter = undefined; + } + if (!this.gos.get("treeData")) { + const noFieldOrValueGetter = _missing(res.field) && _missing(res.valueGetter) && _missing(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 = undefined; + res.initialSort = undefined; + } + 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") ?? undefined; + 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(); + } +}; +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; +}; +var ChangedCellsPathImpl = class { + constructor() { + this.kind = "cells"; + this.rows = []; + this.unsorted = false; + this.slots = /* @__PURE__ */ new Map; + this.bits = []; + this.extraBits = null; + this.colCount = 0; + } + addRow(rowNode) { + let node = rowNode; + if (node == null) { + return; + } + const slots = this.slots; + if (slots.get(node) !== undefined) { + 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; + } + 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 === undefined) { + 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; + } + } + hasRow(rowNode) { + return this.slots.has(rowNode); + } + getSortedRows() { + if (!this.unsorted) { + return this.rows; + } + this.unsorted = false; + const rows = _sortNodesByDepthFirst(this.rows); + this.rows = rows; + return rows; + } + getSlot(key) { + return this.slots.get(key) ?? -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; + } + 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; + } + 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; + } +}; +var ChangedRowsPathImpl = class { + constructor() { + this.kind = "rows"; + this.rows = []; + this.unsorted = false; + this.rowSet = /* @__PURE__ */ new Set; + } + 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; + } + addCell(rowNode, _colId) { + this.addRow(rowNode); + } + hasRow(rowNode) { + return this.rowSet.has(rowNode); + } + getSortedRows() { + if (!this.unsorted) { + return this.rows; + } + this.unsorted = false; + const rows = _sortNodesByDepthFirst(this.rows); + this.rows = rows; + return rows; + } +}; +var ChangedPathFactory = class extends BeanStub { + constructor() { + super(...arguments); + this.beanName = "changedPathFactory"; + } + newPath(trackCells) { + return trackCells ? new ChangedCellsPathImpl : new ChangedRowsPathImpl; + } + 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; + } +}; +var BaseExpansionService = class extends BeanStub { + 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 = _addGridCommonParams(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(undefined, (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); + _setAriaExpanded(gui.element, expandable && expanded); + }); + } + dispatchStateUpdatedEvent() { + this.eventSvc.dispatchEvent({ type: "rowExpansionStateChanged" }); + } +}; +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 = _exists(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(); + } + 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 }); + } + 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(); + }); + }; + } +}; +function _getFlattenDetails(gos) { + let groupHideParentOfSingleChild = gos.get("groupHideParentOfSingleChild"); + if (!groupHideParentOfSingleChild) { + groupHideParentOfSingleChild = gos.get("groupRemoveSingleChildren"); + if (!groupHideParentOfSingleChild && gos.get("groupRemoveLowestSingleChildren")) { + groupHideParentOfSingleChild = "leafGroupsOnly"; + } + } + return { + groupHideParentOfSingleChild, + isGroupMultiAutoColumn: _isGroupMultiAutoColumn(gos), + hideOpenParents: gos.get("groupHideOpenParents"), + grandTotalRow: _getGrandTotalRow(gos), + groupTotalRow: _getGroupTotalRowCallback(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; +} +var FlattenStage = class extends BeanStub { + 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 && 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); + } + } + } + } + addRowNodeToRowsToDisplay(details, rowNode, result, uiLevel, addToTop) { + if (addToTop) { + result.unshift(rowNode); + } else { + result.push(rowNode); + } + rowNode.setUiLevel(details.isGroupMultiAutoColumn ? 0 : uiLevel); + } +}; +var GroupEditService = class extends BeanStub { + constructor() { + super(...arguments); + this.beanName = "groupEditSvc"; + this.pendingEditRefresh = null; + this.dropGroupTarget = null; + this.dropGroupTimer = null; + this.dropGroupThrottled = false; + this.draggingGroups = null; + } + postConstruct() { + if (_isClientSideRowModel(this.gos)) { + this.addManagedListeners(this.eventSvc, { + cellValueChanged: (event) => this.onCsrmCellChange(event), + batchEditingStopped: () => this.flushGroupEdits() + }); + } + } + destroy() { + this.stopDragging(true); + super.destroy(); + } + 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; + } + 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, undefined, 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; + } + 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; + } + flushGroupEdits() { + const pending = this.pendingEditRefresh; + if (pending) { + this.pendingEditRefresh = null; + this.csrmRefresh(pending); + } + } + 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 ?? undefined; + 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 !== undefined) { + 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; +}; +var GroupStage = class extends BeanStub { + 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 = undefined; + this.strategyType = undefined; + 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; + } + 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 !== undefined && !this.columnsInvalidated && this.isAlive()) { + return strategy; + } + this.columnsInvalidated = false; + const wantedType = this.getWantedStrategyType(); + if (wantedType === this.strategyType) { + if (strategy !== undefined) { + 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 !== undefined) { + 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 === undefined) { + 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 === undefined) { + 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 = undefined; + 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 = undefined; + rootSibling.aggData = null; + } + for (let i = 0, allLeafsLen = allLeafs.length ?? 0;i < allLeafsLen; ++i) { + const row = allLeafs[i]; + const sibling = row.sibling; + row._leafs = undefined; + 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 = undefined; +}; +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; +} +var GroupCellRendererCtrl = class extends BeanStub { + constructor() { + super(...arguments); + 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(); + } + getCellAriaRole() { + const colDefAriaRole = this.params.colDef?.cellAriaRole; + const columnColDefAriaRole = this.params.column?.getColDef().cellAriaRole; + return colDefAriaRole || columnColDefAriaRole || "gridcell"; + } + 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; + } + addGroupValue() { + const { + params: { value, valueFormatted } + } = this; + const innerCompDetails = this.getInnerCompDetails(); + this.comp.setInnerRenderer(innerCompDetails, valueFormatted ?? value ?? null); + } + setupExpand() { + const { colModel } = this.beans; + const { eGridCell, suppressDoubleClickExpand } = this.params; + const addIconToDom = (iconName, element) => { + const icon = _createIconNoSpan(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); + _setAriaExpanded(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); + _removeAriaExpanded(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, { + allChildrenCountChanged: onExpandableChanged, + masterChanged: onExpandableChanged, + groupChanged: onExpandableChanged, + hasChildrenChanged: onExpandableChanged, + expandedChanged: onExpandedChanged + }); + }; + setupListeners(); + onExpandableChanged(); + } + 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; + } + 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 = _getCellRendererDetails(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 _getCellRendererDetails(userCompFactory, { ...relatedColDef ?? params.colDef, cellRenderer: "agFindCellRenderer" }, params); + } + } + 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; + } + 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); + } + 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(); + } + 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 : undefined; + const prev = typeof previousValue === "object" ? previousValue : undefined; + 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, + 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); + } + isGroupCellEditable(node) { + const column = this.params.column; + return !!column && (!!column.getColDef().groupRowEditable || this.gos.get("enableGroupEdit")) && column.isCellEditable(node); + } + onExpandClicked(mouseEvent) { + if (_isStopPropagationForAgGrid(mouseEvent)) { + return; + } + _stopPropagationForAgGrid(mouseEvent); + this.onExpandOrContract(mouseEvent); + } + onKeyDown(event) { + const isEnterKey = event.key === KeyCode.ENTER; + if (!isEnterKey || this.params.suppressEnterExpand) { + return; + } + if (this.isGroupCellEditable(this.params.node)) { + return; + } + this.onExpandOrContract(event); + } + onCellDblClicked(mouseEvent) { + if (_isStopPropagationForAgGrid(mouseEvent)) { + return; + } + const targetIsExpandIcon = _isElementInEventPath(this.eExpanded, mouseEvent) || _isElementInEventPath(this.eContracted, mouseEvent); + if (!targetIsExpandIcon) { + this.onExpandOrContract(mouseEvent); + } + } + 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(); + } +}; +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 Component { + constructor() { + super(GroupCellRendererElement); + this.eExpanded = RefPlaceholder; + this.eContracted = RefPlaceholder; + this.eCheckbox = RefPlaceholder; + this.eValue = RefPlaceholder; + this.eChildCount = RefPlaceholder; + } + 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) => _setDisplayed(this.eContracted, expanded), + setExpandedDisplayed: (expanded) => _setDisplayed(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) { + _setAriaRole(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; + } +}; +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)}"; +var ShowRowGroupColValueService = class extends BeanStub { + constructor() { + super(...arguments); + this.beanName = "showRowGroupColValueSvc"; + } + 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 }; + } + 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; + } + 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); + } + getDisplayedNode(node, column, onlyHideOpenParents = false) { + const gos = this.gos; + const isGroupHideOpenParents = gos.get("groupHideOpenParents"); + const isShowOpenedGroupValue = gos.get("showOpenedGroup") && !onlyHideOpenParents; + if (!isGroupHideOpenParents && !isShowOpenedGroupValue) { + return; + } + const showRowGroup = column.colDef.showRowGroup; + if (showRowGroup === true) { + if (node.group) { + return; + } + return node.parent ?? undefined; + } + let pointer = node; + while (pointer && pointer.rowGroupColumn?.getId() != showRowGroup) { + const isFirstChild = pointer === pointer.parent?.getFirstChild(); + if (!isShowOpenedGroupValue && !isFirstChild) { + return; + } + pointer = pointer.parent; + } + if (pointer === node) { + return; + } + return pointer ?? undefined; + } +}; +var ShowRowGroupColsService = class extends BeanStub { + 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; + } +}; +var StickyRowFeature = class extends BeanStub { + constructor(createRowCon, destroyRowCtrls) { + super(); + this.createRowCon = createRowCon; + this.destroyRowCtrls = destroyRowCtrls; + this.stickyTopRowCtrls = []; + this.stickyBottomRowCtrls = []; + this.extraTopHeight = 0; + this.extraBottomHeight = 0; + } + postConstruct() { + this.isClientSide = _isClientSideRowModel(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); + } + getLastPixelOfGroup(row) { + return this.isClientSide ? getClientSideLastPixelOfGroup(row) : getServerSideLastPixelOfGroup(row); + } + 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(); + } + } + 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 = _last(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; +} +var StickyRowService = class extends BeanStub { + constructor() { + super(...arguments); + this.beanName = "stickyRowSvc"; + } + createStickyRowFeature(ctrl, createRowCon, destroyRowCtrls) { + const gos = this.gos; + if (_isGroupRowsSticky(gos) && _isClientSideRowModel(gos) || _isServerSideRowModel(gos)) { + return ctrl.createManagedBean(new StickyRowFeature(createRowCon, destroyRowCtrls)); + } + return; + } +}; +var GroupCellRendererModule = { + moduleName: "GroupCellRenderer", + version: VERSION2, + userComponents: { + agGroupRowRenderer: GroupCellRenderer, + agGroupCellRenderer: GroupCellRenderer + }, + dynamicBeans: { groupCellRendererCtrl: GroupCellRendererCtrl }, + icons: { + groupContracted: "tree-closed", + groupExpanded: "tree-open" + }, + css: [groupCellStyles_default], + dependsOn: [EnterpriseCoreModule] +}; +var GroupColumnModule = { + moduleName: "GroupColumn", + version: VERSION2, + beans: [ + AutoColService, + ShowRowGroupColsService, + ShowRowGroupColValueService, + RowGroupColsSvc, + PivotColsSvc, + ValueColsSvc + ], + dependsOn: [EnterpriseCoreModule, GroupCellRendererModule] +}; +var ChangedPathModule = { + moduleName: "ChangedPath", + version: VERSION2, + beans: [ChangedPathFactory], + dependsOn: [EnterpriseCoreModule] +}; +var ClientSideRowModelHierarchyModule = { + moduleName: "ClientSideRowModelHierarchy", + version: VERSION2, + rowModels: ["clientSide"], + beans: [GroupStage, FlattenStage, ClientSideExpansionService], + dependsOn: [EnterpriseCoreModule, ChangedPathModule] +}; +var StickyRowModule = { + moduleName: "StickyRow", + version: VERSION2, + beans: [StickyRowService] +}; +var GroupEditModule = { + moduleName: "GroupEdit", + version: VERSION2, + beans: [GroupEditService], + dependsOn: [EnterpriseCoreModule, ClientSideRowModelHierarchyModule] +}; +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) ?? _parseDateTimeFromString; + date = parseDate(innerValue) ?? null; + } + return date; +}; +var getDatePartValueGetter = (beans, col, index, map) => (params) => { + const date = getDate(beans, col, params.node); + const parts = _getDateParts(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; +} +var GroupHierarchyColService = class extends BeanStub { + constructor() { + super(...arguments); + this.beanName = "groupHierarchyColSvc"; + this.columns = null; + this.sourceColumnMap = /* @__PURE__ */ new WeakMap; + 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); + _updateColsMap(cols); + } + createColumns(cols) { + const newSourceColumnMap = /* @__PURE__ */ new WeakMap; + const newInverseColumnMap = /* @__PURE__ */ new WeakMap; + const list = this.createGroupHierarchyColumns(cols, newSourceColumnMap, newInverseColumnMap); + const areSame = _areColIdsEqual(list, this.columns?.list ?? []); + if (areSame) { + return; + } + _destroyColumnTree(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) => _columnsMatch(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) => _columnsMatch(_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 AgColumn(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 _addColumnDefaultAndTypes(beans, colDef, colDef.colId, true); + } + const base = _addColumnDefaultAndTypes(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)); +} +var GroupHierarchyModule = { + moduleName: "GroupHierarchy", + version: VERSION2, + beans: [GroupHierarchyColService], + dependsOn: [ChangedPathModule] +}; +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; +}; +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; +} +var GroupStrategy = class extends BeanStub { + constructor() { + super(...arguments); + 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 = _csrmFirstLeaf(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) { + _forEachChangedGroupDepthFirst(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); + } + } + sortChildren(rootNode, changedPath) { + _forEachChangedGroupDepthFirst(rootNode, true, undefined, (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" + }); + } + } + 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; + } + 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); + } + 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) { + _warn(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 = undefined; + const rowGroupColumn = groupNode.rowGroupColumn; + const leafNode = rowGroupColumn && _csrmFirstLeaf(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 = undefined; + } + } + } +}; +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 !== undefined) { + const parent = node.parent; + if (!parent) { + break; + } + node._leafs = undefined; + node = parent; + } +}; +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 ?? []; +} +var SharedRowGroupingModule = { + moduleName: "SharedRowGrouping", + version: VERSION2, + apiFunctions: { + setRowGroupColumns, + removeRowGroupColumns, + addRowGroupColumns, + getRowGroupColumns, + moveRowGroupColumn + }, + dependsOn: [ + EnterpriseCoreModule, + SharedAggregationModule, + GroupColumnModule, + StickyRowModule, + GroupHierarchyModule + ] +}; +var RowGroupingModule = { + moduleName: "RowGrouping", + version: VERSION2, + dynamicBeans: { groupStrategy: GroupStrategy }, + rowModels: ["clientSide"], + dependsOn: [SharedRowGroupingModule, AggregationModule, ClientSideRowModelHierarchyModule, GroupEditModule] +}; +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(); +} +var SOURCE_PASTE2 = "paste"; +var EXPORT_TYPE_DRAG_COPY = "dragCopy"; +var EXPORT_TYPE_CLIPBOARD = "clipboard"; +function stringToArray(strData, delimiter = ",") { + const data = []; + const isNewline = (char) => char === "\r" || char === ` +`; + 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 === undefined || 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 === ` +`) { + position++; + } + continue; + } + } + data[row][column] += currentChar; + } + return data; +} +var ClipboardService = class extends BeanStub { + 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 (_isClientSideRowModel(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) => { + _warn(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 _exists(delimiter) ? delimiter : "\t"; + } + 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(undefined, { source: SOURCE_PASTE2 }); + }; + this.doPasteOperation(pasteOperation); + } + 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); + _forEachChangedGroupDepthFirst(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_PASTE2); + changedPath?.addCell(rowNode.parent, column.getId()); + const { rowIndex, rowPinned } = currentRow; + const cellId = _createCellId({ 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 && isSpecialCol(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); + } + } + 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_PASTE2); + changedPath?.addCell(rowNode.parent, column.getId()); + const { rowIndex, rowPinned } = currentRow; + const cellId = _createCellId({ rowIndex, column, rowPinned }); + cellsToFlash[cellId] = true; + }); + } + }; + this.iterateActiveRanges(rowCallback, true); + }; + this.doPasteOperation(pasteOperation); + } + removeLastLineIfBlank(parsedData) { + const lastLine = _last(parsedData); + const lastLineIsBlank = lastLine && lastLine.length === 1 && lastLine[0] === ""; + if (lastLineIsBlank) { + if (parsedData.length === 1) { + return; + } + _removeFromArray(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 + }); + } + } + 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 = _getRowNode(beans, rowPointer); + rowPointer = _getRowBelow(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_PASTE2); + const { rowIndex, rowPinned } = rowNode; + const cellId = _createCellId({ 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; + } else if (this.shouldCopyRows(rowSelection)) { + this.copySelectedRowsToClipboard(copyParams); + cellClearType = 1; + } else if (focusSvc.isAnyCellFocused()) { + this.copyFocusedCellToClipboard(copyParams); + cellClearType = 2; + } + 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) { + rangeSvc.clearCellRangeCellValues({ cellEventSource: "clipboardSvc" }); + } else if (type === 1) { + this.clearSelectedRows(); + } else { + const focusedCell = focusSvc.getFocusedCell(); + if (focusedCell == null) { + return; + } + const rowNode = _getRowNode(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 = _getRowNode(beans, currentRow); + isLastRow = _isSameRow(currentRow, lastRow); + rowCallback(currentRow, rowNode, cellRange, rangeIndex++); + currentRow = _getRowBelow(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 = _isClientSideRowModel(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(` +`), 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 = _createCellId({ rowIndex, column, rowPinned }); + cellsToFlash[cellId] = true; + } + if (_isSameRow(node, lastRow)) { + break; + } + node = _getRowBelow(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 = _createCellId({ 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 = _createCellId(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); + } + 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) => { + _warn(40, { e, method: "writeText" }); + this.copyDataToClipboardLegacy(data); + }); + return; + } + this.copyDataToClipboardLegacy(data); + } + copyDataToClipboardLegacy(data) { + this.executeOnTempElement((element) => { + const eDocument = _getDocument(this.beans); + const focusedElementBefore = _getActiveDomElement(this.beans); + element.value = data || " "; + element.select(); + element.focus({ preventScroll: true }); + const result = eDocument.execCommand("copy"); + if (!result) { + _warn(41); + } + if (focusedElementBefore?.focus != null) { + focusedElementBefore.focus({ preventScroll: true }); + } + }); + } + executeOnTempElement(callbackNow, callbackAfter) { + if (!this.gridCtrl) { + return; + } + const eDoc = _getDocument(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) { + _warn(42); + } + if (callbackAfter) { + window.setTimeout(() => { + callbackAfter(eTempInput); + eTempInput.remove(); + }, 100); + } else { + eTempInput.remove(); + } + } +}; +var ClipboardModule = { + moduleName: "Clipboard", + version: VERSION2, + beans: [ClipboardService], + apiFunctions: { + copyToClipboard, + cutToClipboard, + copySelectedRowsToClipboard, + copySelectedRangeToClipboard, + copySelectedRangeDown, + pasteFromClipboard + }, + dependsOn: [EnterpriseCoreModule, CsvExportModule, KeyboardNavigationModule, HighlightChangesModule] +}; +var DetailCellRendererCtrl = class extends BeanStub { + 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 = _isSameRow(row, eventRow); + if (!isSameRow) { + return; + } + _focusInto(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) { + _warn(170, { providedStrategy }); + } + this.refreshStrategy = "rows"; + } + createDetailGrid() { + const { params, gos } = this; + if (_missing(params.detailGridOptions)) { + _warn(171); + return; + } + const masterTheme = gos.get("theme"); + const detailTheme = params.detailGridOptions.theme; + if (detailTheme && detailTheme !== masterTheme) { + _warn(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) { + _warn(172); + return; + } + const successCallback = (rowData) => { + const mostRecentCall = this.loadRowDataVersion === versionThisCall; + if (mostRecentCall) { + this.comp.setRowData(rowData); + } + }; + const funcParams = { + node: params.node, + data: params.node.data, + successCallback, + context: _addGridCommonParams(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; + } +}; +var DetailFrameworkComponentWrapper = class { + constructor(parentWrapper) { + this.parentWrapper = parentWrapper; + } + wrap(frameworkComponent, mandatoryMethods, optionalMethods, componentType) { + return this.parentWrapper.wrap(frameworkComponent, mandatoryMethods, optionalMethods, componentType); + } +}; +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 Component { + constructor() { + super(...arguments); + this.eDetailGrid = RefPlaceholder; + } + 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 (_missing(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 { + _warn(168); + setDefaultTemplate(); + } + if (this.eDetailGrid == null) { + _warn(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); + } +}; +function operateOnStore(beans, callback) { + const store = beans.masterDetailSvc?.store; + return store ? callback(store) : undefined; +} +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++); + } + }); + }); +} +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%}"; +var MasterDetailService = class extends BeanStub { + constructor() { + super(...arguments); + this.beanName = "masterDetailSvc"; + this.store = {}; + } + isEnabled() { + return this.gos.get("masterDetail"); + } + postConstruct() { + const gos = this.gos; + if (_isClientSideRowModel(gos)) { + this.enabled = this.isEnabled(); + } + if (_isServerSideRowModel(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 = undefined; + } + 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 || !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); + } + } + } + } + getDetail(masterNode) { + if (!masterNode.master || !masterNode.expanded) { + return null; + } + let detailNode = masterNode.detailNode; + if (detailNode) { + return detailNode; + } + detailNode = new RowNode(this.beans); + detailNode.detail = true; + detailNode.selectable = false; + detailNode.parent = masterNode; + if (_exists(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 (_isClientSideRowModel(gos, rowModel) || _isServerSideRowModel(gos, rowModel)) { + rowModel.onRowHeightChanged(); + } + }; + window.setTimeout(updateRowHeightFunc, 0); + } + }; + const resizeObserverDestroyFunc = _observeResize(beans, eDetailGui, checkRowSizeFunc); + rowCtrl.addDestroyFunc(resizeObserverDestroyFunc); + checkRowSizeFunc(); + } + destroy() { + this.store = {}; + super.destroy(); + } +}; +var SharedMasterDetailModule = { + moduleName: "SharedMasterDetail", + version: VERSION2, + 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: VERSION2, + dependsOn: [SharedMasterDetailModule, ClientSideRowModelHierarchyModule, EventApiModule] +}; +var AbstractSelectionHandle = class extends Component { + 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 = _getPageBody(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" : "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 = _getPageBody(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 ?? _last(this.beans.rangeSvc.getCellRanges()); + const start = cellRangeToUse.startRow; + const end = cellRangeToUse.endRow; + if (start && end) { + const isBefore = _isRowBefore(end, start); + if (isBefore) { + this.rangeStartRow = end; + this.rangeEndRow = start; + } else { + this.rangeStartRow = start; + this.rangeEndRow = end; + } + } + if (oldCellComp !== cellCtrl || !_isVisible(eGui)) { + this.cellCtrl = cellCtrl; + const eParentOfValue = cellCtrl.comp.getParentOfValue(); + if (eParentOfValue) { + eParentOfValue.appendChild(eGui); + } + } + this.cellRange = cellRangeToUse; + } + clearValues() { + this.lastCellHovered = undefined; + } + destroy() { + if (!this.shouldDestroyOnEndDragging && this.dragging) { + _setDisplayed(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(); +}; +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; +} +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; + } + postConstruct() { + super.postConstruct(); + this.addManagedElementListeners(this.getGui(), { + dblclick: this.onDblClick.bind(this) + }); + } + onDblClick(e) { + _stopPropagationForAgGrid(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" ? _last(visibleCols.allCols) : _last(initialRange.columns) + }); + this.isUp = false; + this.isLeft = false; + if (finalRange) { + this.performFill({ + event: e, + initialRange, + finalRange + }); + } + this.dragAxis = undefined; + } + 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 isRowNumberCol(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") { + _warn(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 ? _getRowBelow(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 = _getRowNode(beans, currentRow); + if (!rowNode) { + break; + } + if (isVertical && column) { + fillValues(values, column, rowNode, () => !_isSameRow(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] : _last(initialRange.columns))); + } + } + finished = _isSameRow(currentRow, this.isUp ? finalRangeStartRow : finalRangeEndRow); + currentRow = this.isUp ? _getRowAbove(this.beans, currentRow) : _getRowBelow(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, sourceCol ? currentValue : _toStringOrNull(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(undefined, columns); + } + this.beans.editSvc?.stopEditing(undefined, { 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 = _addGridCommonParams(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 isNumeric2 = (v) => typeof v === "number" && Number.isFinite(v) || typeof v === "string" && /^[+-]?\d+(?:\.\d+)?$/.test(v.trim()); + const allNumbers = values.every(({ value }) => isNumeric2(value)); + if (event.altKey || !allNumbers) { + const valueForFunctions = String(_last(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 ? undefined : sourceCol, + sourceRowNode + }; + } + return { + value: _last(findLineByLeastSquares(values.map(({ value }) => Number(value)))), + fromUserFunction: false + }; + } + clearValues() { + this.clearMarkedPath(); + this.clearCellValues(); + this.lastCellMarked = undefined; + 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 (_isSameRow(currentPosition, initialPosition)) { + return; + } + const isBefore = _isRowBefore(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 = _isSameRow(row, initialPosition); + if (isMovingUp) { + this.isUp = true; + } + if (!isInitialRow) { + const cell = _getCellByPosition(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", _isSameRow(row, endPosition)); + } + } + } + if (_isSameRow(row, endPosition)) { + break; + } + } while (row = isMovingUp ? _getRowAbove(this.beans, row) : _getRowBelow(beans, row)); + } + reduceVertical(initialPosition, endPosition) { + let row = initialPosition; + const beans = this.beans; + do { + const cellRange = this.cellRange; + const colLen = cellRange.columns.length; + const isLastRow = _isSameRow(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 = _getCellByPosition(beans, celPos); + if (cell) { + this.markedCells.push(cell); + cell.comp.toggleCss("ag-selection-fill-bottom", _isSameRow(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 = _isSameRow(row, rangeEndRow); + const cell = _getCellByPosition(beans, { + rowIndex: row.rowIndex, + rowPinned: row.rowPinned, + column + }); + if (cell) { + this.markedCells.push(cell); + const cellComp = cell.comp; + cellComp.toggleCss("ag-selection-fill-top", _isSameRow(row, rangeStartRow)); + cellComp.toggleCss("ag-selection-fill-bottom", _isSameRow(row, rangeEndRow)); + if (isMovingLeft) { + this.isLeft = true; + cellComp.toggleCss("ag-selection-fill-left", column === colsToMark[0]); + } else { + cellComp.toggleCss("ag-selection-fill-right", column === _last(colsToMark)); + } + } + row = _getRowBelow(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 = _isSameRow(row, rangeEndRow); + const cell = _getCellByPosition(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 = _getRowBelow(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); + } +}; +var AgRangeHandle = class extends AbstractSelectionHandle { + constructor() { + super({ tag: "div", cls: "ag-range-handle" }); + this.type = 1; + this.rangeFixed = false; + } + onDrag(_) { + const lastCellHovered = this.getLastCellHovered(); + if (!lastCellHovered) { + return; + } + const rangeSvc = this.beans.rangeSvc; + const targetRange = this.cellRange ?? _last(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 = !_isSameRow(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 ?? _last(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; + } +}; +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}"; +function getCellRanges(beans) { + return beans.rangeSvc?.getCellRanges() ?? null; +} +function addCellRange(beans, params) { + beans.rangeSvc?.addCellRange(params); +} +function clearRangeSelection(beans) { + beans.rangeSvc?.removeAllCellRanges(); +} +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 !== undefined; + 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 !== undefined; + 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); + _setAriaSelected(eGui, rangeCount > 0 ? true : undefined); + 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) => [CellRangeType.DIMENSION, CellRangeType.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 && _isSameRow(startRow, cellPosition)) { + top = true; + } + if (!bottom && _isSameRow(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 === CellRangeType.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 : [_last(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 === CellRangeType.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) && _missing(cellRangeType); + const type = selectionHandleFill ? 0 : 1; + if (this.selectionHandle && this.selectionHandle.getType() !== type) { + this.selectionHandle = beans.context.destroyBean(this.selectionHandle); + } + if (!this.selectionHandle) { + const selectionHandle = beans.registry.createDynamicBean(type === 0 ? "fillHandle" : "rangeHandle", false); + if (selectionHandle) { + this.selectionHandle = beans.context.createBean(selectionHandle); + } + } + this.selectionHandle?.refresh(this.cellCtrl, cellRange); + } + destroy() { + this.unsetComp(); + } +}; +var DragListenerFeature = class extends BeanStub { + 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(); + } + } +}; +var HeaderGroupCellMouseListenerFeature = class extends BeanStub { + 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); + } +}; +var RangeHeaderHighlightFeature = class extends BeanStub { + 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; + } +}; +var RangeService = class extends BeanStub { + constructor() { + super(...arguments); + this.beanName = "rangeSvc"; + this.rangeSelectionExtensions = []; + this.cellRanges = []; + this.bodyScrollListener = this.onBodyScroll.bind(this); + this.dragging = false; + 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 AutoScrollService({ + 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) { + _removeFromArray(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)); + } + onDragStart(mouseEvent) { + const gos = this.gos; + const target = mouseEvent.target; + if (!_isCellSelectionEnabled(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 || _exists(_last(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 = _last(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 = undefined; + this.lastCellHovered = undefined; + if (this.intersectionRange) { + this.intersectionRange = false; + this.intersectLastRange(); + } + this.dispatchChangedEvent(false, true, id); + } + 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 = !_areEqual(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 = _last(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 _last(allPositions) - allPositions[0] + 1 === rangeColumns.length; + } + getRangeStartRow(cellRange) { + if (cellRange.startRow && cellRange.endRow) { + return _isRowBefore(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 _isRowBefore(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: _interpretAsRightClick(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, + 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 + }) : undefined; + 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 = _getFirstRow(beans); + const lastRow = _getLastRow(beans); + const startRow = this.getRangeStartRow(containingRange); + const endRow = this.getRangeEndRow(containingRange); + if (!startRow && _isSameRow(firstRow, cell)) { + replaceEdgeRow(containingRange, _getRowBelow(beans, firstRow), "top"); + } else if (!endRow && _isSameRow(lastRow, cell)) { + replaceEdgeRow(containingRange, _getRowAbove(beans, lastRow), "bottom"); + } else if (_isSameRow(startRow, endRow)) { + _removeFromArray(cellRanges, containingRange); + } else if (_isSameRow(startRow, cell)) { + replaceEdgeRow(containingRange, _getRowBelow(beans, cell), "top"); + } else if (_isSameRow(endRow, cell)) { + replaceEdgeRow(containingRange, _getRowAbove(beans, cell), "bottom"); + } else { + const rowAbove = _getRowAbove(beans, cell); + const rowBelow = _getRowBelow(beans, cell); + containingRange.startRow = startRow; + containingRange.endRow = rowAbove ?? undefined; + cellRanges.push({ + ...containingRange, + startRow: rowBelow ?? undefined, + endRow + }); + } + this.dispatchChangedEvent(true, true); + } + setRangeToCell(cell, appendRange = false) { + const { gos } = this; + if (!_isCellSelectionEnabled(gos)) { + return; + } + this.updateSelectionModeForCell(cell); + const columns = this.calculateColumnsBetween(cell.column, cell.column); + if (!columns) { + return; + } + const { suppressMultiRanges } = this.getMultiRangeContext(); + if (suppressMultiRanges || !appendRange || _missing(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 = _last(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 = _isRowBefore(endRow, startRow); + if (isBottomUp) { + currentRow = startRow; + } else { + currentRow = endRow; + } + const stepFn = targetCount > 0 ? _getRowBelow : _getRowAbove; + 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 = _last(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 = _last(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 = _last(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[_last(allIndices)] + }; + } + extendLatestRangeInDirection(event) { + if (this.isEmpty() || !this.newestRangeStartCell) { + return; + } + const key = event.key; + const ctrlKey = event.ctrlKey || event.metaKey; + const lastRange = _last(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 (!_isCellSelectionEnabled(this.gos)) { + return; + } + this.removeAllCellRanges(true); + this.addCellRange(params); + } + setCellRanges(cellRanges) { + if (_areEqual(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); + } + 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 ? _last(columns) : columns[0]) + }; + } + addCellRange(params) { + const gos = this.gos; + if (!_isCellSelectionEnabled(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 === undefined) { + 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 = _getFirstRow(beans); + const lastRow = _getLastRow(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 = _isSameRow(range.startRow, startRow) && _isSameRow(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 = _isRowBefore(startRow, endRow) ? endRow : startRow; + const isRightColumn = allColumns.indexOf(cell.column) === _last(allPositions); + const isLastRow = cell.rowIndex === lastRow.rowIndex && _makeNull(cell.rowPinned) === _makeNull(lastRow.rowPinned); + return isRightColumn && isLastRow; + } + 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 = _isSameRow(thisRow, firstRow); + const equalsLastRow = _isSameRow(thisRow, lastRow); + if (equalsFirstRow || equalsLastRow) { + return true; + } + const afterFirstRow = !_isRowBefore(thisRow, firstRow); + const beforeLastRow = _isRowBefore(thisRow, lastRow); + return afterFirstRow && beforeLastRow; + } + intersectLastRange(fromMouseClick) { + const { editingWithRanges, suppressMultiRanges } = this.getMultiRangeContext(); + if (editingWithRanges || suppressMultiRanges || fromMouseClick && this.dragging || this.isEmpty()) { + return; + } + const lastRange = _last(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 (_isRowBefore(intersectionEndRow, startRow) || _isRowBefore(endRow, intersectionStartRow)) { + newRanges.push(range); + continue; + } + const rangeCountBefore = newRanges.length; + if (_isRowBefore(startRow, intersectionStartRow)) { + const top = { + columns: [...cols], + startColumn: lastRange.startColumn, + startRow: { ...startRow }, + endRow: _getRowAbove(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 (_isRowBefore(intersectionEndRow, endRow)) { + newRanges.push({ + columns: [...cols], + startColumn: lastRange.startColumn, + startRow: _getRowBelow(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 : 0; + } + 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 === _last(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 ? undefined : columns); + } else if (columnA && columnB) { + processedColumns = this.calculateColumnsBetween(columnA, columnB); + if (processedColumns?.length) { + startsOnTheRight = processedColumns[0] !== this.getColumnFromModel(columnA); + } + } + return processedColumns ? { + columns: processedColumns, + startsOnTheRight + } : undefined; + } + verifyCellRanges(gos) { + const { suppressMultiRanges } = this.getMultiRangeContext(); + const invalid = _isUsingNewCellSelectionAPI(gos) && suppressMultiRanges && this.cellRanges.length > 1; + if (invalid) { + _warn(93); + } + return !invalid; + } + forEachRowInRange(cellRange, callback) { + const topRow = this.getRangeStartRow(cellRange); + const bottomRow = this.getRangeEndRow(cellRange); + let currentRow = topRow; + while (currentRow) { + callback(currentRow); + if (_isSameRow(currentRow, bottomRow)) { + break; + } + currentRow = _getRowBelow(this.beans, currentRow); + } + } + forEachEditableCellInRanges(cellRanges, callback) { + const { beans } = this; + for (const cellRange of cellRanges) { + this.forEachRowInRange(cellRange, (rowPosition) => { + const rowNode = _getRowNode(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); + } + }); + } + } + 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 && _areCellsEqual(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) { + 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 : undefined; + } + 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 = _last(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) { + _warn(178, { colId: fromColumn.getId() }); + return; + } + const toIndex = isSameColumn ? fromIndex : allColumns.indexOf(toColumn); + if (toIndex < 0) { + _warn(178, { colId: toColumn.getId() }); + return; + } + if (isSameColumn || this.selectionMode === 1) { + 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); + } + 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 = _getFirstRow(beans); + const lastRow = _getLastRow(beans); + if (!firstRow || !lastRow) { + return; + } + if (event.key === KeyCode.ENTER) { + event.preventDefault(); + } + if (event.shiftKey) { + const root = ctx.root; + if (!root) { + return; + } + const column = clickedColumn.isColumn ? clickedColumn : _last(clickedColumn.getLeafColumns()); + const range = this.findContainingRange({ columns: [root], startRow: firstRow, endRow: lastRow }, true); + if (!range) { + _removeFromArray(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) { + _removeAllFromArray(range.columns, columns); + if (columns.includes(range.startColumn)) { + range.startColumn = range.columns[0]; + } + if (range.columns.length === 0) { + _removeFromArray(this.cellRanges, range); + } + this.dispatchChangedEvent(true, true); + } + selectColumns(columns, startRow, endRow) { + return this.addCellRange({ + columns, + columnStart: columns[0], + columnEnd: _last(columns), + rowStartIndex: startRow.rowIndex, + rowStartPinned: startRow.rowPinned, + rowEndIndex: endRow.rowIndex, + rowEndPinned: endRow.rowPinned + }); + } +}; +function createRowPosition(rowIndex, rowPinned) { + return rowIndex != null ? { rowIndex, rowPinned } : undefined; +} +function rowMax(rows) { + let max; + for (const row of rows) { + if (max === undefined || _isRowBefore(max, row)) { + max = row; + } + } + return max; +} +function rowMin(rows) { + let min; + for (const row of rows) { + if (min === undefined || _isRowBefore(row, min)) { + min = row; + } + } + return min; +} +function isLastCellOfRange(cellRange, cell) { + const { startRow, endRow } = cellRange; + const lastRow = _isRowBefore(startRow, endRow) ? endRow : startRow; + const isLastRow = cell.rowIndex === lastRow.rowIndex && cell.rowPinned === lastRow.rowPinned; + const rangeFirstIndexColumn = cellRange.columns[0]; + const rangeLastIndexColumn = _last(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 || _isRowBefore(range.startRow, range.endRow) ? "startRow" : "endRow"; + } else { + key = !range.startRow || !range.endRow || _isRowBefore(range.startRow, range.endRow) ? "endRow" : "startRow"; + } + range[key] = row ?? undefined; +} +var CellSelectionModule = { + moduleName: "CellSelection", + version: VERSION2, + beans: [RangeService], + dynamicBeans: { fillHandle: AgFillHandle, rangeHandle: AgRangeHandle }, + apiFunctions: { + getCellRanges, + addCellRange, + clearRangeSelection, + clearCellSelection: clearRangeSelection + }, + dependsOn: [EnterpriseCoreModule, KeyboardNavigationModule, DragModule], + css: [rangeSelection_default] +}; +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; +} +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 BeanStub { + 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 !== undefined) { + 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" : undefined; + 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); + } + } + } + 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}`; + } + 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, undefined, false); + colDef.colId = id; + colDef.aggFunc = potentialAggCol.getAggFunc(); + colDef.valueGetter = (params) => params.data?.[id]; + return colDef; + } + const col = { + colId: id, + headerName: key, + 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; + } +}; +var PivotResultColsService = class extends BeanStub { + constructor() { + super(...arguments); + this.beanName = "pivotResultCols"; + } + wireBeans(beans) { + this.colModel = beans.colModel; + this.visibleCols = beans.visibleCols; + } + destroy() { + _destroyColumnTree(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 = _areEqual(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 !== undefined) { + 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 = undefined; + 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 || undefined, source); + _destroyColumnTree(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; + } + const searchForColDefs = (colDefs2) => { + colDefs2.forEach((abstractColDef) => { + const isGroup = _exists(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); + } + } +}; +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 BeanStub { + 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; + } + 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; + _forEachChangedGroupDepthFirst(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 (_missing(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; + } +}; +var SharedPivotModule = { + moduleName: "SharedPivot", + version: VERSION2, + 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: VERSION2, + rowModels: ["clientSide"], + beans: [PivotStage], + dependsOn: [SharedPivotModule, RowGroupingModule, ClientSideRowModelHierarchyModule] +}; +var PATH_KEY_SEPARATOR = String.fromCodePoint(31, 41150, 8291); +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); +} +var OP_SYMBOLS_DESC = [...new Set(OP_DEFS.map((d) => d.symbol))].sort((a, b) => b.length - a.length); +var MS_PER_DAY = 24 * 60 * 60 * 1000; +var WrappedFunctionMarker = Symbol("WrappedFunctionMarker"); +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"]); +function isComboChart(chartType) { + return COMBO_CHART_TYPES.has(chartType); +} +function getCanonicalChartType(chartType) { + return chartType === "doughnut" ? "donut" : chartType; +} +function getSeriesTypeIfExists(chartType) { + return CHART_TYPE_TO_SERIES_TYPE[chartType]; +} +var ALL_AXIS_TYPES = ["number", "category", "grouped-category", "log", "time"]; +var STATIC_INBUILT_STOCK_THEME_AXES_OVERRIDES = ALL_AXIS_TYPES.reduce((r, n) => ({ ...r, [n]: { title: { _enabledFromTheme: true } } }), {}); +var validateIfDefined = (validationFn) => { + return (value) => { + if (value == undefined) { + return true; + } + return validationFn(value); + }; +}; +var legacyChartTypes = ["doughnut"]; +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"; +}); +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)); +} +var miniLineData = [ + [1, 3, 5], + [2, 6, 4], + [5, 3, 1] +]; +var miniStackedLineData = stackData(miniLineData); +var miniNormalizedLineData = normalizeStackData(miniStackedLineData); +var miniAreaData = miniLineData; +var miniStackedAreaData = stackData(miniAreaData); +var miniNormalizedAreaData = normalizeStackData(miniStackedAreaData); +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]; + +// index.js +ModuleRegistry.registerModules([ + ValidationModule, + ColumnAutoSizeModule, + CellStyleModule, + QuickFilterModule, + RowSelectionModule, + TextEditorModule, + ClientSideRowModelModule, + MultiFilterModule, + CellSelectionModule, + PivotModule, + MasterDetailModule, + SideBarModule, + ColumnsToolPanelModule, + ColumnMenuModule, + StatusBarModule, + ExcelExportModule, + ClipboardModule, + NumberFilterModule, + TextFilterModule, + SetFilterModule, + DateFilterModule +]); +var Grid = (props) => { + const { data, options, api, on, class: className, style = "height: 100%; width: 100%", dark } = props; + let gridApi = null; + let cleanupFn = null; + const getDark = () => dark !== undefined ? typeof dark === "function" ? dark() : dark : document.documentElement.getAttribute("data-theme") === "dark" || window.matchMedia("(prefers-color-scheme: dark)").matches; + const getTheme = () => { + const isDark = getDark(); + if (isDark) { + return themeQuartz.withParams({ + headerFontSize: 14, + headerVerticalPaddingScale: 0.4, + rowVerticalPaddingScale: 0.4, + backgroundColor: "#1d1d1d", + foregroundColor: "#ffffff", + headerBackgroundColor: "#2a2a2a", + headerForegroundColor: "#ffffff", + oddRowBackgroundColor: "#262626", + borderColor: "#404040", + browserColorScheme: "dark" + }); + } + return themeQuartz.withParams({ + browserColorScheme: "light", + headerFontSize: 14, + headerVerticalPaddingScale: 0.4, + rowVerticalPaddingScale: 0.4 + }); + }; + const initGrid = (container) => { + if (cleanupFn) { + cleanupFn(); + cleanupFn = null; + } + if (gridApi && !gridApi.isDestroyed()) { + gridApi.destroy(); + if (api) + api.current = null; + gridApi = null; + } + if (!container) + return; + const initialData = typeof data === "function" ? data() : data; + const initialOptions = typeof options === "function" ? options() : options; + const commonEvents = [ + "onFilterChanged", + "onModelUpdated", + "onGridSizeChanged", + "onFirstDataRendered", + "onRowValueChanged", + "onSelectionChanged", + "onCellClicked", + "onCellDoubleClicked", + "onCellValueChanged", + "onRowClicked", + "onSortChanged", + "onContextMenu", + "onColumnResized", + "onColumnMoved", + "onRowDataUpdated", + "onCellEditingStarted", + "onCellEditingStopped", + "onPaginationChanged", + "onBodyScroll" + ]; + const eventHandlers = {}; + commonEvents.forEach((eventName) => { + if (on?.[eventName]) { + eventHandlers[eventName] = (params) => on[eventName](params); + } + }); + const gridOptions = { + ...initialOptions, + theme: getTheme(), + rowData: initialData || [], + onGridReady: (params) => { + gridApi = params.api; + if (api) + api.current = gridApi; + if (on?.onGridReady) + on.onGridReady(params); + if (initialOptions?.autoSizeColumns) { + params.api.autoSizeAllColumns(); + } + }, + ...eventHandlers + }; + gridApi = createGrid(container, gridOptions); + const stopData = watch(() => { + if (!gridApi || gridApi.isDestroyed()) + return; + const newData = typeof data === "function" ? data() : data; + if (Array.isArray(newData)) { + const currentData = gridApi.getGridOption("rowData"); + if (newData !== currentData) { + gridApi.setGridOption("rowData", newData); + } + } + }); + const stopTheme = watch(() => { + if (!gridApi || gridApi.isDestroyed()) + return; + getDark(); + const newTheme = getTheme(); + const currentTheme = gridApi.getGridOption("theme"); + if (JSON.stringify(newTheme) !== JSON.stringify(currentTheme)) { + gridApi.setGridOption("theme", newTheme); + } + }); + const stopOptions = watch(() => { + if (!gridApi || gridApi.isDestroyed() || !options) + return; + const newOptions = typeof options === "function" ? options() : options; + if (newOptions) { + Object.entries(newOptions).forEach(([key, val]) => { + try { + gridApi.setGridOption(key, val); + } catch (e) {} + }); + } + }); + cleanupFn = () => { + stopData(); + stopTheme(); + stopOptions(); + if (gridApi && !gridApi.isDestroyed()) { + gridApi.destroy(); + if (api) + api.current = null; + gridApi = null; + } + }; + onUnmount(() => { + if (cleanupFn) { + cleanupFn(); + cleanupFn = null; + } + }); + }; + return h("div", { + class: className, + style, + ref: initGrid + }); +}; +export { + Grid +}; diff --git a/dist/sigpro-grid.esm.min.js b/dist/sigpro-grid.esm.min.js index 9e446d7..bff62d2 100644 --- a/dist/sigpro-grid.esm.min.js +++ b/dist/sigpro-grid.esm.min.js @@ -1,205 +1,70 @@ -var{defineProperty:BQ,getOwnPropertyNames:g9}=Object;var GU=Object.prototype.hasOwnProperty;function DU(G){return this[G]}var L=(G,D,z)=>{var B=g9(D);for(let Q of B)if(!GU.call(G,Q)&&Q!=="default")BQ(G,Q,{get:DU.bind(D,Q),enumerable:!0});if(z){for(let Q of B)if(!GU.call(z,Q)&&Q!=="default")BQ(z,Q,{get:DU.bind(D,Q),enumerable:!0});return z}};var T9=(G)=>G;function y9(G,D){this[G]=T9.bind(null,D)}var x9=(G,D)=>{for(var z in D)BQ(G,z,{get:D[z],enumerable:!0,configurable:!0,set:y9.bind(D,z)})};import{ModuleRegistry as Hn,ValidationModule as _n,ColumnAutoSizeModule as kn,CellStyleModule as wn,QuickFilterModule as Kn,RowSelectionModule as fn,TextEditorModule as Nn,ClientSideRowModelModule as Fn,themeQuartz as WzG,iconSetQuartzLight as qzG,createGrid as En}from"ag-grid-community";var $={};x9($,{getMultipleSheetsAsExcel:()=>x1,exportMultipleSheetsAsExcel:()=>mX,distributeGroupValue:()=>i8,_AgVirtualListDragFeature:()=>C6,_AgVirtualList:()=>R6,_AgTabbedLayout:()=>YJ,_AgSliderSelector:()=>WG,_AgSlider:()=>kG,_AgPanel:()=>LJ,_AgMenuList:()=>uB,_AgMenuItemRenderer:()=>O6,_AgMenuItemComponent:()=>NB,_AgInputRangeSelector:()=>b6,_AgInputRange:()=>V6,_AgGroupComponentSelector:()=>p,_AgGroupComponent:()=>jG,_AgDialog:()=>SJ,_AgContextMenuService:()=>v6,_AgColorPickerSelector:()=>uY,_AgColorPicker:()=>XJ,ViewportRowModelModule:()=>a7,TreeDataModule:()=>$8,StatusBarModule:()=>xB,SparklinesModule:()=>T8,SideBarModule:()=>jD,SetFilterModule:()=>R7,ServerSideRowModelModule:()=>L8,ServerSideRowModelApiModule:()=>S8,RowNumbersModule:()=>bJ,RowGroupingPanelModule:()=>o7,RowGroupingModule:()=>VJ,RowGroupingEditModule:()=>d8,RichSelectModule:()=>I7,RangeSelectionModule:()=>qb,PivotModule:()=>pB,NewFiltersToolPanelModule:()=>B8,MultiFilterModule:()=>iB,MenuModule:()=>Qf,MasterDetailModule:()=>lB,LicenseManager:()=>j1,IntegratedChartsModule:()=>j9,GroupFilterModule:()=>r7,GridChartsModule:()=>Sn,FormulaModule:()=>g8,FindModule:()=>x8,FiltersToolPanelModule:()=>z8,ExcelExportModule:()=>cB,ContextMenuModule:()=>FJ,ColumnsToolPanelModule:()=>yB,ColumnMenuModule:()=>W0,ClipboardModule:()=>nB,CellSelectionModule:()=>Xz,BatchEditModule:()=>c8,AllEnterpriseModule:()=>Yn,AiToolkitModule:()=>o6,AggregationModule:()=>MJ,AdvancedFilterModule:()=>l6});L($,XzG);import{BeanStub as c9,_getDocument as h9}from"ag-grid-community";import{_exists as i9,_logPreInitWarn as n9}from"ag-grid-community";import{Component as l9,RefPlaceholder as p9}from"ag-grid-community";import{BaseCreator as r9,_addGridCommonParams as zU,_downloadFile as P1,_getHeaderClassesFromColDef as a9,_getHeaderRowCount as e9,_warn as W6}from"ag-grid-community";import{BaseGridSerializingSession as G$,_addGridCommonParams as QQ,_isExpressionString as D$,_last as z$,_mergeDeep as B$,_warn as Q$}from"ag-grid-community";import{_escapeString as J$}from"ag-grid-community";import{_escapeString as H$,_warn as ZJ}from"ag-grid-community";import{_escapeString as JU}from"ag-grid-community";import{_escapeString as NL}from"ag-grid-community";import{_escapeString as gL}from"ag-grid-community";import{_escapeString as HS}from"ag-grid-community";import{_escapeString as LU}from"ag-grid-community";import{_errMsg as vX}from"ag-grid-community";import{KeyCode as MG,RefPlaceholder as sX,_AgTabGuardComp as oX,_createAgElement as rX,_getAriaPosInSet as aX,_observeResize as eX,_requestAnimationFrame as YU,_setAriaLabel as GY,_setAriaPosInSet as DY,_setAriaRole as zY,_setAriaSetSize as BY,_waitUntil as QY}from"ag-grid-community";import{AutoScrollService as ZY,_AgBeanStub as $Y,_radioCssClass as WU}from"ag-grid-community";import{AgAbstractLabel as SY,AgInputNumberFieldSelector as XY,RefPlaceholder as LQ}from"ag-grid-community";import{AgAbstractInputField as YY}from"ag-grid-community";import{AgPickerField as WY,_createElement as qU}from"ag-grid-community";import{KeyCode as xG,RefPlaceholder as cG,_AgComponentStub as qY,_exists as HY,_setDisplayed as _Y}from"ag-grid-community";import{AgInputTextField as kY,RefPlaceholder as wY}from"ag-grid-community";import{_AgComponentStub as FY,_AgTabGuardFeature as EY,_findNextFocusableElement as IY,_setDisplayed as _U}from"ag-grid-community";import{RefPlaceholder as E0,_AgComponentStub as kU,_AgPositionableFeature as MY,_getActiveDomElement as AY,_getInnerHeight as RY,_getInnerWidth as CY,_isVisible as VY,_setDisplayed as bY}from"ag-grid-community";import{AgPromise as SQ,KeyCode as AG,_AgTabGuardComp as jY,_createAgElement as PY,_last as gY}from"ag-grid-community";import{KeyCode as wU,_AgBeanStub as TY,_createElement as yY,_setAriaDisabled as xY,_setAriaExpanded as cY,_setAriaHasPopup as hY,_setAriaRole as iY}from"ag-grid-community";import{KeyCode as nY,_AgTabGuardComp as dY}from"ag-grid-community";import{_AgBeanStub as pY,_AgComponentStub as mY,_anchorElementToMouseMoveEvent as KU,_createAgElement as tY,_focusInto as sY,_getPageBody as oY,_getRootNode as rY,_isPromise as aY,_isVisible as eY}from"ag-grid-community";import{_AgComponentStub as B4,_createAgElement as I0,_isNodeOrElement as Q4,_setAriaChecked as J4,_setAriaExpanded as U4}from"ag-grid-community";import{KeyCode as wz,RefPlaceholder as fU,_AgTabGuardComp as Z4,_clearElement as $4,_createAgElement as M0,_findNextFocusableElement as L4,_focusInto as NU,_getActiveDomElement as FU,_getDocument as S4,_isKeyboardMode as X4,_setAriaLabel as EU,_setAriaRole as Y4}from"ag-grid-community";import{TabGuardClassNames as W4,_FOCUS_MANAGED_CLASS as q4,_findFocusableElements as H4}from"ag-grid-community";import{AgCheckboxSelector as k4,AgToggleButton as w4,KeyCode as Kz,RefPlaceholder as Gz,_AgComponentStub as j6,_isComponent as XQ,_removeFromParent as K4,_setAriaExpanded as f4,_setAriaRole as YQ,_setDisplayed as AD}from"ag-grid-community";import{TooltipModule as M4,_FilterCoreModule as A4,_FilterValueModule as R4,_PopupModule as C4,_SharedDragAndDropModule as V4}from"ag-grid-community";import{BeanStub as P4,_exists as g4,_parseDateTimeFromString as IU,_serialiseDate as MU,_toStringOrNull as xD}from"ag-grid-community";import{_parseBigIntOrNull as P6}from"ag-grid-community";import{BeanStub as l4,_exists as p4,_isClientSideRowModel as m4,_isServerSideRowModel as t4,_warn as s4}from"ag-grid-community";import{BeanStub as o4,_getAbsoluteHeight as r4,_getAbsoluteWidth as a4,_removeFromParent as e4}from"ag-grid-community";import{_STOP_PROPAGATION_CALLBACKS as GW,_focusNextGridCoreContainer as DW}from"ag-grid-community";import{AgFilterButtonSelector as zW,Component as BW,RefPlaceholder as fz,_createIconNoSpan as QW,_makeNull as JW,_setDisabled as RU,_setDisplayed as CU}from"ag-grid-community";import{AgInputTextFieldSelector as UW,Component as ZW,KeyCode as RG,RefPlaceholder as $W,_isNothingFocused as LW,_makeNull as VU}from"ag-grid-community";import{AgPopupComponent as SW,KeyCode as XW,RefPlaceholder as YW,_exists as WW,_fuzzySuggestions as qW,_isVisible as HW}from"ag-grid-community";import{_STOP_PROPAGATION_CALLBACKS as _W}from"ag-grid-community";import{Component as kW,_clearElement as wW,_createElement as KW,_exists as fW}from"ag-grid-community";import{Component as CW,KeyCode as Nz,_clearElement as VW,_findNextFocusableElement as bW,_focusInto as vW,_getActiveDomElement as OW,_getFloatingFiltersHeight as uW,_setAriaColIndex as jW,_setAriaColSpan as PW,_setAriaRole as gW,_setAriaRowIndex as TW,_setDisplayed as yW}from"ag-grid-community";import{Component as hW,FilterButtonComp as iW,RefPlaceholder as nW,_exists as dW,_removeFromParent as lW}from"ag-grid-community";import{BeanStub as pW,DragSourceType as mW}from"ag-grid-community";import{Component as sW,RefPlaceholder as oW,_setAriaLabel as rW,_setAriaLevel as aW}from"ag-grid-community";import{AgInputTextFieldSelector as eW,_setAriaLabel as Gq,_setAriaLabelledBy as Dq,_setDisplayed as zq,_stopPropagationForAgGrid as Bq}from"ag-grid-community";import{AgInputTextFieldSelector as vU,AgPickerField as Qq,KeyCode as o,RefPlaceholder as OU,_addGridCommonParams as Jq,_addOrRemoveAttribute as Uq,_clearElement as HQ,_createIconNoSpan as Zq,_debounce as _Q,_exists as $q,_fuzzySuggestions as Lq,_getActiveDomElement as uU,_getEditorRendererDetails as Sq,_isElementOverflowingCallback as Xq,_isEventFromPrintableCharacter as Yq,_isVisible as Wq,_setAriaActiveDescendant as qq,_setScrollLeft as jU,_stopPropagationForAgGrid as Hq}from"ag-grid-community";import{_consoleError as kQ}from"ag-grid-community";import{Component as Kq,KeyCode as oG,_clearElement as fq,_findFocusableElements as Nq,_findNextFocusableElement as Fq,_getActiveDomElement as PU,_getDocument as Eq,_setAriaPosInSet as Iq,_setAriaRole as Mq,_setAriaSetSize as Aq}from"ag-grid-community";import{Component as Rq,RefPlaceholder as gU}from"ag-grid-community";import{KeyCode as uq,_addOrRemoveAttribute as jq,_createElement as TU,_createIconNoSpan as Pq,_requestAnimationFrame as wQ,_setAriaActiveDescendant as gq,_setAriaControlsAndLabel as Tq,_setAriaLabel as yq,_setDisplayed as kD}from"ag-grid-community";import{Component as xq,_addGridCommonParams as cq,_clearElement as hq,_createElement as yU,_exists as Fz,_getEditorRendererDetails as iq,_isElementOverflowingCallback as nq,_setAriaSelected as dq,_toString as lq}from"ag-grid-community";import{BeanStub as eq,KeyCode as Ez,_getActiveDomElement as iU,_isStopPropagationForAgGrid as nU,_stopPropagationForAgGrid as R0}from"ag-grid-community";import{DragSourceType as zH,KeyCode as KQ,RefPlaceholder as rG,TabGuardComp as BH,_createElement as dU,_createIconNoSpan as Iz,_removeAriaExpanded as QH,_setAriaDisabled as lU,_setAriaExpanded as pU,_setAriaLabel as C0,_setAriaLevel as JH,_setDisplayed as V0,_setVisible as UH,_stopPropagationForAgGrid as fQ}from"ag-grid-community";import{Component as ZH,_exists as Mz,_removeFromParent as $H,_toStringOrNull as LH}from"ag-grid-community";import{AgInputDateField as b0,AgInputNumberField as XH,AgInputTextField as v0,Component as YH,KeyCode as NQ,RefPlaceholder as mU,_exists as WH,_setAriaDescribedBy as qH,_setAriaLabel as HH,_setDisplayed as tU,_stopPropagationForAgGrid as FQ}from"ag-grid-community";import{Component as KH}from"ag-grid-community";import{AgInputTextFieldSelector as NH,_setAriaLabel as FH,_setAriaLabelledBy as EH,_stopPropagationForAgGrid as IH}from"ag-grid-community";import{ColumnApiModule as gH}from"ag-grid-community";import{STRUCTURED_SCHEMA_FEATURES as TH}from"ag-grid-community";import{_ColumnMoveModule as E_,_PopupModule as I_,_SharedDragAndDropModule as M_}from"ag-grid-community";import{_HorizontalResizeModule as A_}from"ag-grid-community";import{_unwrapUserComp as R_}from"ag-grid-community";import{BeanStub as y_}from"ag-grid-community";import{Component as x_,KeyCode as O0,ManagedFocusFeature as c_,RefPlaceholder as h_,_addFocusableContainerListener as i_,_addGridCommonParams as sU,_findNextFocusableElement as n_,_focusInto as d_,_focusNextGridCoreContainer as l_,_getActiveDomElement as oU,_isVisible as p_,_removeFromParent as rU,_setAriaControlsAndLabel as m_,_skipFocusableContainerListenerForAgGrid as t_,_warn as IQ}from"ag-grid-community";import{Component as o_,KeyCode as r_,_clearElement as a_,_focusNextGridCoreContainer as e_,_stopPropagationForAgGrid as Gk}from"ag-grid-community";import{Component as Dk,RefPlaceholder as MQ,_createIconNoSpan as zk,_setAriaExpanded as Bk}from"ag-grid-community";import{_warn as r6}from"ag-grid-community";import{Component as Yk,RefPlaceholder as Wk}from"ag-grid-community";import{Component as qk}from"ag-grid-community";import{_warn as Mk}from"ag-grid-community";import{Component as Ak,FilterButtonComp as Rk,_addGridCommonParams as Ck,_areEqual as aG,_clearElement as Vk,_last as bk,_warn as vk}from"ag-grid-community";import{Component as Ok,PositionableFeature as uk,RefPlaceholder as eU}from"ag-grid-community";import{AgCheckboxSelector as Pk,AgInputTextFieldSelector as gk,Component as Tk,KeyCode as yk,RefPlaceholder as AQ,_createIconNoSpan as RQ,_debounce as xk,_setDisplayed as hD}from"ag-grid-community";import{Component as dk,DragSourceType as lk,_exists as GZ,_setAriaLabel as pk,_setAriaLevel as mk,_warn as tk,isProvidedColumnGroup as sk}from"ag-grid-community";import{AgProvidedColumnGroup as ok,_warn as rk,isProvidedColumnGroup as ak}from"ag-grid-community";import{_last as ek}from"ag-grid-community";import{LocalEventService as z3}from"ag-grid-community";import{isProvidedColumnGroup as B3}from"ag-grid-community";import{AgCheckboxSelector as Q3,Component as J3,DragSourceType as U3,KeyCode as CQ,RefPlaceholder as Az,TouchListener as zZ,_createIcon as BZ,_createIconNoSpan as Z3,_getShouldDisplayTooltip as $3,_getToolPanelClassesFromColDef as L3,_setAriaDescribedBy as S3,_setAriaExpanded as X3,_setAriaLabel as Y3,_setDisplayed as VQ}from"ag-grid-community";import{Component as w3,_createIconNoSpan as QZ,_focusInto as K3,isColumn as f3,isProvidedColumnGroup as N3}from"ag-grid-community";import{AgPromise as $Z,_STOP_PROPAGATION_CALLBACKS as E3,_addGridCommonParams as I3,_warn as M3}from"ag-grid-community";import{_getRootNode as A3,_isBrowserFirefox as R3,_isBrowserSafari as C3}from"ag-grid-community";import{AgCheckboxSelector as T3,Component as y3,DragSourceType as x3,KeyCode as c3,RefPlaceholder as XZ,TouchListener as h3,_createIconNoSpan as i3,_getShouldDisplayTooltip as n3,_getToolPanelClassesFromColDef as d3,_setAriaDescribedBy as l3,_setAriaLabel as p3,_setDisplayed as m3,_warn as t3}from"ag-grid-community";import{BeanStub as Jw}from"ag-grid-community";import{_addFocusableContainerListener as Uw,_createIconNoSpan as Zw}from"ag-grid-community";import{DragSourceType as YZ,_shouldUpdateColVisibilityAfterGroup as $w}from"ag-grid-community";import{Component as Lw,KeyCode as iD,ManagedFocusFeature as Sw,PositionableFeature as Xw,_areEqual as Yw,_clearElement as WZ,_createElement as u0,_createIconNoSpan as Ww,_findFocusableElements as qw,_findNextFocusableElement as vQ,_getActiveDomElement as qZ,_isKeyboardMode as Hw,_last as _w,_setAriaHidden as kw,_setAriaLabel as ww,_setAriaPosInSet as Kw,_setAriaRole as fw,_setAriaSetSize as Nw}from"ag-grid-community";import{Component as Iw,DragSourceType as Mw,KeyCode as nD,RefPlaceholder as Aw,_createElement as Rw}from"ag-grid-community";import{Component as Cw,KeyCode as _Z,RefPlaceholder as OQ,TouchListener as Vw,_createIconNoSpan as kZ,_setAriaLabel as bw,_setDisplayed as vw}from"ag-grid-community";import{_addFocusableContainerListener as Pw,_createIconNoSpan as gw}from"ag-grid-community";import{_createIconNoSpan as Tw}from"ag-grid-community";import{AgToggleButtonSelector as xw,Component as cw,RefPlaceholder as hw}from"ag-grid-community";import{BeanStub as lw}from"ag-grid-community";import{BeanStub as pw,_applyColumnState as J0,_areEqual as j0,isColumnGroupAutoCol as mw,isSpecialCol as tw}from"ag-grid-community";import{_ColumnMoveModule as DK,_PopupModule as zK,_SharedDragAndDropModule as BK,_SharedMenuModule as QK}from"ag-grid-community";import{BeanStub as JK,_createIconNoSpan as f7,_warn as fZ}from"ag-grid-community";import{BeanStub as LK,_addGridCommonParams as SK,_findNextFocusableElement as XK}from"ag-grid-community";import{BeanStub as WK,_addGridCommonParams as qK,_getDisplaySortForColumn as HK,_getGrandTotalRow as _K,_isClientSideRowModel as kK,_isLegacyMenuEnabled as wK}from"ag-grid-community";import{BeanStub as KK,_createIconNoSpan as a,_exists as fK,_getRowNode as NK,_normalizeSortType as FK,_resetColumnState as EK,_warn as IK}from"ag-grid-community";import{BeanStub as vK,_addGridCommonParams as OK,_attemptToRestoreCellFocus as uK,_exists as NZ,_getGrandTotalRow as jK,_isIOSUserAgent as PK}from"ag-grid-community";import{AgPromise as TQ,BeanStub as F7,Component as TK,FilterComp as yK,RefPlaceholder as xK,_createElement as cK,_createIconNoSpan as yQ,_error as hK,_focusInto as iK,_isColumnMenuAnchoringEnabled as nK,_isLegacyMenuEnabled as P0,_setColMenuVisible as EZ,_warn as dK,isColumn as lK}from"ag-grid-community";import{BeanStub as aK,_findTabbableParent as eK,_getActiveDomElement as Gf,_isNothingFocused as IZ,_isVisible as Df,_last as zf}from"ag-grid-community";import{_EditCoreModule as Jf}from"ag-grid-community";import{AgAbstractCellEditor as Uf,KeyCode as MZ,_addGridCommonParams as Zf,_consoleError as $f,_missing as AZ,_warn as Cz}from"ag-grid-community";import{_ColumnFilterModule as Sf}from"ag-grid-community";import{AgInputTextFieldSelector as Xf,KeyCode as Vz,ProvidedFilter as Yf,RefPlaceholder as bz,_areEqual as Wf,_createIconNoSpan as qf,_exists as Hf,_getActiveDomElement as _f,_makeNull as CZ,_setDisplayed as xQ,_warn as vz}from"ag-grid-community";import{AgCheckboxSelector as wf,Component as Kf,RefPlaceholder as g0,_addGridCommonParams as ff,_createIcon as cQ,_getCellRendererDetails as VZ,_getShouldDisplayTooltip as Nf,_isShowTooltipWhenTruncated as Ff,_setAriaChecked as Ef,_setAriaDescribedBy as If,_setAriaExpanded as Mf,_setAriaLabel as Af,_setAriaLabelledBy as Rf,_setAriaLevel as Cf,_setDisplayed as hQ,_toStringOrNull as bZ,_warn as Vf}from"ag-grid-community";import{_defaultComparator as uf,_last as jf,_makeNull as Pf,_toStringOrNull as gf,_translate as Tf,_warn as yf}from"ag-grid-community";import{_getDateParts as nf,_warn as df}from"ag-grid-community";import{BeanStub as tf,_addGridCommonParams as sf,_debounce as of,_error as OZ,_isClientSideRowModel as rf,_last as af,_makeNull as iQ,_toStringOrNull as nQ}from"ag-grid-community";import{AgPromise as ef,BeanStub as GN,_makeNull as DN}from"ag-grid-community";import{AgPromise as T0,BeanStub as QN,_addGridCommonParams as JN,_defaultComparator as uZ,_error as UN,_makeNull as ZN,_warn as jZ}from"ag-grid-community";import{AgInputTextFieldSelector as SN,Component as XN,RefPlaceholder as YN,_error as WN}from"ag-grid-community";import{_KeyboardNavigationModule as _N}from"ag-grid-community";import{AgPromise as y0,Component as kN,RefPlaceholder as lQ,_addFocusableContainerListener as wN,_addGridCommonParams as PZ,_clearElement as pQ,_removeFromParent as KN,_warn as fN}from"ag-grid-community";import{Component as CN,RefPlaceholder as Oz,_createCellId as VN,_exists as bN,_formatNumberCommas as vN,_getRowBelow as ON,_getRowNode as uN,_isRowBefore as jN,_missing as mQ,_parseBigIntOrNull as PN}from"ag-grid-community";import{Component as gN,RefPlaceholder as gZ,_addGridCommonParams as TN}from"ag-grid-community";import{_formatNumberCommas as lN}from"ag-grid-community";import{_formatNumberCommas as mN}from"ag-grid-community";import{_formatNumberCommas as TZ}from"ag-grid-community";import{_formatNumberCommas as oN}from"ag-grid-community";import{_unwrapUserComp as aN}from"ag-grid-community";import{BeanStub as GF}from"ag-grid-community";import{_SharedExportModule as zF}from"ag-grid-community";import{_warn as BF}from"ag-grid-community";import{_ColumnFilterModule as LF}from"ag-grid-community";import{AgPromise as eG,FilterWrapperComp as SF,LocalEventService as XF,ProvidedFilter as YF,_getFilterModel as WF,_refreshFilterUi as qF,_refreshHandlerAndUi as yZ,_removeFromArray as HF,_updateFilterModel as _F}from"ag-grid-community";import{AgPromise as dD,KeyCode as uz,TabGuardComp as kF,_createElement as wF,_focusInto as KF,_getActiveDomElement as fF,_isNothingFocused as NF,_setAriaRole as FF}from"ag-grid-community";import{ProvidedFilter as EF}from"ag-grid-community";import{BeanStub as MF,_removeFromArray as AF,_warn as xZ}from"ag-grid-community";import{BeanStub as CF,_getDefaultSimpleFilter as VF,_getFilterParamsForDataType as bF}from"ag-grid-community";import{AgPromise as tQ,_getFilterDetails as OF,_isUseApplyButton as uF,_refreshFilterUi as jF,_warn as PF}from"ag-grid-community";import{AgPromise as gF,Component as TF,_clearElement as yF,_error as xF,_getDefaultFloatingFilterType as cF,_getFloatingFilterCompDetails as hF,_mergeDeep as iF,_setDisplayed as jz}from"ag-grid-community";import{_ColumnFilterModule as lF,_PopupModule as pF}from"ag-grid-community";import{BeanStub as mF,_exists as tF}from"ag-grid-community";import{BeanStub as oF,_exists as cZ,_last as rF}from"ag-grid-community";import{BeanStub as LE,_getGroupAggFiltering as SE}from"ag-grid-community";import{BeanStub as HE,_forEachChangedGroupDepthFirst as hZ,_getGrandTotalRow as _E,_getGroupAggFiltering as kE,_warn as wE}from"ag-grid-community";import{BeanStub as EE,_forEachChangedGroupDepthFirst as IE,_getGroupAggFiltering as ME}from"ag-grid-community";import{BeanStub as RE,_addGridCommonParams as CE,_getGrandTotalRow as VE,_getGroupTotalRowCallback as bE,_warn as vE}from"ag-grid-community";import{_createRowNodeSibling as OE}from"ag-grid-community";import{BaseColsService as PE,_exists as gE,_removeFromArray as TE,_warn as yE}from"ag-grid-community";import{BaseColsService as xE,_removeFromArray as cE}from"ag-grid-community";import{BaseColsService as hE,_removeFromArray as iE,_shouldUpdateColVisibilityAfterGroup as nE}from"ag-grid-community";import{AgColumn as lE,BeanStub as pE,GROUP_AUTO_COLUMN_ID as iZ,_addColumnDefaultAndTypes as mE,_applyColumnState as tE,_areColIdsEqual as sE,_columnsMatch as oE,_convertColumnEventSourceType as rE,_destroyColumnTree as nZ,_getColumnStateFromColDef as aE,_isColumnsSortingCoupledToGroup as eE,_isGroupHideColumnsUntilExpanded as GI,_isGroupMultiAutoColumn as DI,_isGroupUseEntireRow as zI,_mergeDeep as BI,_missing as sQ,_updateColsMap as QI,_warn as JI,isColumnGroupAutoCol as UI}from"ag-grid-community";import{BeanStub as $I}from"ag-grid-community";import{_exists as WI}from"ag-grid-community";import{BeanStub as qI,_addGridCommonParams as HI,_createGlobalRowEvent as _I,_setAriaExpanded as kI}from"ag-grid-community";import{BeanStub as KI}from"ag-grid-community";import{_getGrandTotalRow as fI,_getGroupTotalRowCallback as NI,_isGroupMultiAutoColumn as FI}from"ag-grid-community";import{BeanStub as II,_ChangedRowNodes as d7,_csrmFirstLeaf as MI,_csrmReorderAllLeafs as AI,_getCellByPosition as RI,_isClientSideRowModel as CI,_prevOrNextDisplayedRow as VI}from"ag-grid-community";import{BeanStub as uI}from"ag-grid-community";import{Component as TI,RefPlaceholder as Pz,_setAriaRole as yI,_setDisplayed as sZ}from"ag-grid-community";import{BeanStub as xI,KeyCode as oZ,_createIconNoSpan as cI,_getCellRendererDetails as rZ,_getCheckboxLocation as hI,_getCheckboxes as iI,_getInnerCellRendererDetails as x0,_isElementInEventPath as aZ,_isRowSelection as nI,_isStopPropagationForAgGrid as eZ,_removeAriaExpanded as dI,_setAriaExpanded as lI,_stopPropagationForAgGrid as pI}from"ag-grid-community";import{BeanStub as sI}from"ag-grid-community";import{BeanStub as rI}from"ag-grid-community";import{BeanStub as eI,_isClientSideRowModel as GM,_isGroupRowsSticky as DM,_isServerSideRowModel as zM}from"ag-grid-community";import{BeanStub as BM,_getRowHeightForNode as QM,_isClientSideRowModel as JM,_isGroupRowsSticky as UM,_last as ZM}from"ag-grid-community";import{AgColumn as YM,BeanStub as WM,GROUP_HIERARCHY_COLUMN_ID_PREFIX as qM,_addColumnDefaultAndTypes as z2,_areColIdsEqual as HM,_columnsMatch as B2,_destroyColumnTree as _M,_removeAllFromArray as kM,_updateColsMap as wM}from"ag-grid-community";import{_MONTHS as s7,_getDateParts as KM,_parseDateTimeFromString as fM}from"ag-grid-community";import{Component as RM,_createElement as CM}from"ag-grid-community";import{AgPromise as gz,AgSelect as vM,FilterComp as OM,RefPlaceholder as J2,TabGuardComp as uM,_clearElement as oQ,_createElement as jM,_setDisplayed as PM,_warn as rQ}from"ag-grid-community";import{BeanStub as xM,_warn as U2}from"ag-grid-community";import{BeanStub as hM}from"ag-grid-community";import{AgInputTextField as nM,AgPromise as aQ,Component as dM,RefPlaceholder as lM,_clearElement as pM,_isGroupMultiAutoColumn as mM}from"ag-grid-community";import{BeanStub as oM,RowNode as rM,_csrmFirstLeaf as Z2,_forEachChangedGroupDepthFirst as $2,_warn as aM}from"ag-grid-community";import{BeanStub as $A,RowNode as X2,_addGridCommonParams as LA,_getRowHeightAsNumber as Y2,_getRowIdCallback as SA,_warn as XA}from"ag-grid-community";import{CsvExportModule as WA,HighlightChangesModule as qA,_KeyboardNavigationModule as HA}from"ag-grid-community";import{BeanStub as FA,_createCellId as lD,_exists as EA,_forEachChangedGroupDepthFirst as IA,_getActiveDomElement as MA,_getDocument as W2,_getRowBelow as eQ,_getRowNode as G1,_isClientSideRowModel as q2,_isSameRow as H2,_last as AA,_removeFromArray as RA,_warn as c0,isColumnSelectionCol as CA,isSpecialCol as VA}from"ag-grid-community";import{CellStyleModule as OA,_SharedDragAndDropModule as uA}from"ag-grid-community";import{Component as PA,Direction as gA,_getRowNode as TA}from"ag-grid-community";import{AgColumn as cA,BeanStub as hA,KeyCode as B1,ROW_NUMBERS_COLUMN_ID as iA,_addGridCommonParams as nA,_applyColumnState as dA,_areColIdsEqual as lA,_convertColumnEventSourceType as pA,_createElement as mA,_debounce as tA,_destroyColumnTree as _2,_getColumnStateFromColDef as sA,_getFirstRow as oA,_getRowNode as rA,_interpretAsRightClick as aA,_isRowNumbers as pD,_selectAllCells as eA,_setAriaLabel as GR,_updateColsMap as DR,isRowNumberCol as wD}from"ag-grid-community";import{_isRowNumbers as zR,_warn as BR}from"ag-grid-community";import{_ColumnFilterModule as G8}from"ag-grid-community";import{Component as UR,RefPlaceholder as k2}from"ag-grid-community";import{AgInputTextFieldSelector as ZR,Component as $R,RefPlaceholder as w2,_createIconNoSpan as Q1,_debounce as LR,_setDisplayed as Tz}from"ag-grid-community";import{Component as WR,_addGridCommonParams as qR,_clearElement as HR,_exists as J1,_getActiveDomElement as _R,_mergeDeep as kR,_setAriaLabel as wR,_warn as K2,isProvidedColumnGroup as f2}from"ag-grid-community";import{Component as KR,FilterComp as fR,KeyCode as N2,RefPlaceholder as yz,_clearElement as NR,_createElement as FR,_createIconNoSpan as U1,_setAriaExpanded as F2,_setAriaLabel as ER,_setAriaRole as IR,_setDisplayed as zD}from"ag-grid-community";import{Component as AR,RefPlaceholder as RR,_clearElement as CR,_createIconNoSpan as VR,_getShouldDisplayTooltip as bR,_setAriaLabel as vR,_setAriaRole as OR,isProvidedColumnGroup as i0}from"ag-grid-community";import{BeanStub as yR,FilterComp as xR}from"ag-grid-community";import{BeanStub as hR,_addGridCommonParams as iR,_getDefaultSimpleFilter as nR,_getFilterParamsForDataType as dR,_isSetFilterByDefault as lR,_warn as pR}from"ag-grid-community";import{_removeFromParent as mR,_translate as tR}from"ag-grid-community";import{Component as aR,_warn as eR}from"ag-grid-community";import{Component as GC,FilterButtonComp as DC,RefPlaceholder as zC,_focusInto as I2,_getActiveDomElement as BC,_isNothingFocused as M2,_removeFromParent as QC,_translateForFilter as JC}from"ag-grid-community";import{Component as UC,_clearElement as A2,_createElement as ZC,_createIconNoSpan as $C}from"ag-grid-community";import{Component as XC,RefPlaceholder as mD,_clearElement as YC,_createIcon as Z1,_removeFromParent as WC,_setAriaControls as R2,_setAriaExpanded as qC,_setAriaLabel as C2,_setDisplayed as HC}from"ag-grid-community";import{AgSelectSelector as _C,Component as kC,RefPlaceholder as wC,_removeFromParent as KC}from"ag-grid-community";import{Component as FC}from"ag-grid-community";import{EventApiModule as uC}from"ag-grid-community";import{Component as jC,RefPlaceholder as PC,_getGridRegisteredModules as gC,_missing as TC,_warn as V2,createGrid as yC}from"ag-grid-community";import{BeanStub as xC,_addGridCommonParams as cC,_focusInto as hC,_isSameRow as iC,_missing as nC,_warn as n0}from"ag-grid-community";import{BeanStub as eC,RowNode as GV,_exists as DV,_getClientSideRowModel as zV,_isClientSideRowModel as b2,_isServerSideRowModel as v2,_observeResize as BV}from"ag-grid-community";import{_DragModule as UV,_KeyboardNavigationModule as ZV}from"ag-grid-community";import{_addGridCommonParams as $V,_getCellByPosition as d0,_getFillHandle as $1,_getLastRow as LV,_getNormalisedMousePosition as O2,_getRowAbove as L1,_getRowBelow as xz,_getRowNode as SV,_isRowBefore as XV,_isSameRow as FG,_last as tD,_stopPropagationForAgGrid as YV,_toStringOrNull as WV,_warn as qV,isRowNumberCol as HV}from"ag-grid-community";import{Component as _V,_areCellsEqual as kV,_getCellPositionForEvent as wV,_getPageBody as u2,_isRowBefore as KV,_isVisible as fV,_last as NV,_setDisplayed as FV}from"ag-grid-community";import{CellRangeType as P2,_isSameRow as AV,_last as g2}from"ag-grid-community";import{AutoScrollService as vV,BeanStub as OV,KeyCode as uV,_areCellsEqual as jV,_areEqual as y2,_exists as PV,_getAbsoluteRowIndex as x2,_getCellCtrlForEventTarget as gV,_getEnableColumnSelection as TV,_getFirstRow as S1,_getLastRow as X1,_getRowAbove as cz,_getRowBelow as sD,_getRowCtrlForEventTarget as yV,_getRowNode as xV,_getSuppressMultiRanges as cV,_interpretAsRightClick as hV,_isCellSelectionEnabled as l0,_isDomLayout as iV,_isRowBefore as XG,_isSameRow as CG,_isUsingNewCellSelectionAPI as nV,_last as DG,_makeNull as c2,_missing as dV,_removeAllFromArray as lV,_removeFromArray as p0,_warn as Y1}from"ag-grid-community";import{CellRangeType as hz,_isSameRow as h2,_last as pV,_missing as mV,_setAriaSelected as tV}from"ag-grid-community";import{BeanStub as Qb,_isCellSelectionEnabled as d2}from"ag-grid-community";import{BeanStub as Ub}from"ag-grid-community";import{BeanStub as $b}from"ag-grid-community";import{_CsrmSsrmSharedApiModule as Hb,_RowModelSharedApiModule as _b,_SharedRowSelectionModule as kb,_SortModule as wb,_SsrmInfiniteSharedApiModule as Kb,onRowHeightChanged as fb,resetRowHeights as Nb}from"ag-grid-community";import{Component as Fb,RefPlaceholder as p2,_createIconNoSpan as Eb}from"ag-grid-community";import{_ColumnGroupModule as Rb}from"ag-grid-community";import{BeanStub as cb}from"ag-grid-community";import{BeanStub as db,_areEqual as lb,_createColumnTree as pb,_createColumnTreeWithIds as mb,_destroyColumnTree as t2,_exists as tb,_getColumnsFromTree as sb}from"ag-grid-community";import{BeanStub as rb,_forEachChangedGroupDepthFirst as ab,_jsonEquals as eb,_missing as Gv}from"ag-grid-community";import{BeanStub as zv,RowNode as Bv,_removeFromArray as Qv,_warn as t0}from"ag-grid-community";import{BeanStub as $v,RowNode as Lv,_doOnce as Sv,_exists as H1,_getGroupTotalRowCallback as r2,_getRowHeightAsNumber as Xv,_getRowHeightForNode as a2,_warn as Yv}from"ag-grid-community";import{BeanStub as Hv,_isServerSideRowModel as _v}from"ag-grid-community";import{BeanStub as wv,_isServerSideRowModel as Kv,_jsonEquals as fv}from"ag-grid-community";import{BeanStub as Fv}from"ag-grid-community";import{BeanStub as Iv,_isServerSideRowModel as Mv}from"ag-grid-community";import{BeanStub as Rv,_warn as Cv}from"ag-grid-community";import{BeanStub as bv,RowNode as vv,_debounce as Ov,_getRowHeightAsNumber as uv,_getRowHeightForNode as dz,_isGetRowHeightFunction as jv,_isRowSelection as Pv,_jsonEquals as gv,_warn as Tv}from"ag-grid-community";import{_getServerSideRowModel as mB,_warn as xv}from"ag-grid-community";import{RowNode as sv,_exists as ov,_getRowHeightForNode as rv}from"ag-grid-community";import{BeanStub as av}from"ag-grid-community";import{BeanStub as ev}from"ag-grid-community";import{BaseSelectionService as DO,_error as zO,_getGroupSelectsDescendants as G5,_getRowSelectionMode as D5,_isMultiRowSelection as BO,_isRowSelection as a0,_isUsingNewRowSelectionAPI as QO,_warn as ED}from"ag-grid-community";import{BeanStub as JO,_error as e0,_isMultiRowSelection as z5,_isUsingNewRowSelectionAPI as UO,_warn as GB}from"ag-grid-community";import{BeanStub as ZO,_error as KD,_isMultiRowSelection as $O,_warn as LO}from"ag-grid-community";import{BeanStub as XO}from"ag-grid-community";import{BeanStub as WO,_addGridCommonParams as qO,_getMaxConcurrentDatasourceRequests as HO}from"ag-grid-community";import{BeanStub as kO,_warn as Q5}from"ag-grid-community";import{BeanStub as wO,ServerSideTransactionResultStatus as k1,_getGroupTotalRowCallback as J5,_getRowHeightAsNumber as U5,_getRowIdCallback as KO,_warn as fO}from"ag-grid-community";import{BeanStub as NO,_getRowHeightAsNumber as FO,_getRowIdCallback as EO,_warn as IO}from"ag-grid-community";import{BeanStub as VO,_isServerSideRowModel as Z5}from"ag-grid-community";import{BeanStub as vO,ServerSideTransactionResultStatus as fD}from"ag-grid-community";import{AgAbstractCellEditor as uO,KeyCode as K1,RefPlaceholder as jO,_isBrowserSafari as PO,_placeCaretAtEnd as gO}from"ag-grid-community";import{AgContentEditableField as TO,_createElement as yO,_getDocument as vJ,_getWindow as X8,_placeCaretAtEnd as xO}from"ag-grid-community";import{BeanStub as nO,KeyCode as iG,_getDocument as dO}from"ag-grid-community";import{isSpecialCol as lO}from"ag-grid-community";import{BeanStub as Gu,_last as N1,isSpecialCol as Du}from"ag-grid-community";import{BeanStub as Ku,_addGridCommonParams as fu,_isExpressionString as Nu}from"ag-grid-community";import{BeanStub as Eu}from"ag-grid-community";import{BeanStub as Mu,_convertColumnEventSourceType as Au,_isExpressionString as Ru,_warn as oD}from"ag-grid-community";import{_getClientSideRowModel as Cu,_isExpressionString as Vu}from"ag-grid-community";import{_getClientSideRowModel as yu}from"ag-grid-community";import{_getClientSideRowModel as TJ}from"ag-grid-community";import{_preInitErrMsg as Pj}from"ag-grid-community";import{Component as Tj,RefPlaceholder as yj,_batchCall as xj,_formatNumberCommas as cj,_setAriaLabel as hj,_setAriaLabelledBy as A5}from"ag-grid-community";import{Component as SP,_clearElement as XP,_createElement as YP,_toString as b5}from"ag-grid-community";import{BeanStub as HP,_addGridCommonParams as v5,_debounce as _P,_isClientSideRowModel as O5,_isFullWidthGroupRow as kP,_jsonEquals as wP,_missing as C1,_toString as y8,isSpecialCol as KP}from"ag-grid-community";import{_EditCoreModule as FP}from"ag-grid-community";import{_isClientSideRowModel as EP,_warn as IP}from"ag-grid-community";import{BeanStub as VP}from"ag-grid-community";import{_PopupModule as PP,_SharedDragAndDropModule as gP,_preInitErrMsg as l8}from"ag-grid-community";import{BeanStub as TP}from"ag-grid-community";import{BeanStub as xP}from"ag-grid-community";import{_parseDateTimeFromString as cP}from"ag-grid-community";import{_warn as Gg}from"ag-grid-community";import{GROUP_AUTO_COLUMN_ID as Yg}from"ag-grid-community";import{BeanStub as Eg,CellRangeType as pz,_normalizeSortType as Ig,isColumnGroupAutoCol as Mg}from"ag-grid-community";import{BeanStub as Ag,GROUP_AUTO_COLUMN_ID as Rg,_isClientSideRowModel as Cg,_isServerSideRowModel as Vg,_last as bg,_warn as b1}from"ag-grid-community";import{BeanStub as Og,_getRowNode as ug,_warn as g5}from"ag-grid-community";import{BeanStub as Pg,_warn as v1}from"ag-grid-community";import{BeanStub as ig,TabGuardComp as ng,_findFocusableElements as G9,_findNextFocusableElement as dg}from"ag-grid-community";import{Component as lg}from"ag-grid-community";import{BeanStub as pg,_removeFromParent as mg}from"ag-grid-community";import{AgInputNumberFieldSelector as tg,Component as sg}from"ag-grid-community";import{AgCheckboxSelector as rg,Component as ag}from"ag-grid-community";import{AgCheckboxSelector as GT,Component as DT}from"ag-grid-community";import{AgCheckboxSelector as BT,Component as QT,RefPlaceholder as JT}from"ag-grid-community";import{BeanStub as XT,Component as YT,RefPlaceholder as WT,_addGridCommonParams as qT,_createIconNoSpan as HT,_focusInto as _T,_isNothingFocused as kT}from"ag-grid-community";import{BeanStub as fT,_warn as NT}from"ag-grid-community";import{BeanStub as AT,_warn as y5}from"ag-grid-community";import{BeanStub as VT}from"ag-grid-community";import{BeanStub as OT,_focusInto as uT,_warn as zB}from"ag-grid-community";import{Component as jT,RefPlaceholder as mz,_addGridCommonParams as PT,_clearElement as gT,_errMsg as x5,_focusGridInnerElement as TT,_focusInto as yT,_getAbsoluteHeight as xT,_getAbsoluteWidth as cT,_mergeDeep as hT,_removeFromParent as iT,_setDisplayed as c5,_warn as h5}from"ag-grid-community";import{BeanStub as nT,_warn as i5}from"ag-grid-community";import{_warnOnce as U0}from"ag-grid-community";import{AgPromise as Yy,Component as Wy,_warn as qy}from"ag-grid-community";import{Component as Hy,RefPlaceholder as _y,_clearElement as ky,_createElement as wy,_createIconNoSpan as Ky}from"ag-grid-community";import{AgPromise as Ny,Component as Fy,_createElement as d5}from"ag-grid-community";import{AgToggleButton as Ey,Component as Iy,_getDocument as My,_setDisplayed as Ay,_warn as Ry}from"ag-grid-community";import{AgSelect as Cy,AgToggleButton as Vy}from"ag-grid-community";import{AgSelect as by,Component as vy}from"ag-grid-community";import{AgSelect as Oy,Component as uy,DragSourceType as $9,_escapeString as jy,_getActiveDomElement as Py,_removeFromParent as gy}from"ag-grid-community";import{AgSelect as l5,AgToggleButton as ny,Component as dy,RefPlaceholder as ly}from"ag-grid-community";import{BeanStub as py}from"ag-grid-community";import{AgCheckbox as ty,AgSelect as sy,Component as oy,_areEqual as ry,_clearElement as ay}from"ag-grid-community";import{AgToggleButton as Gx}from"ag-grid-community";import{Component as Qx,_warn as p5}from"ag-grid-community";import{AgCheckbox as Jx,AgSelectSelector as Ux,Component as Zx,RefPlaceholder as BB,_removeFromParent as m5,_setDisplayed as $x}from"ag-grid-community";import{AgAbstractLabel as Lx,AgInputNumberFieldSelector as Sx,RefPlaceholder as QB,_exists as Xx,_getActiveDomElement as Yx,_setFixedWidth as Wx}from"ag-grid-community";import{AgSelectSelector as Hx,Component as _x,RefPlaceholder as kx,_removeFromParent as wx}from"ag-grid-community";import{Component as fx,RefPlaceholder as Nx}from"ag-grid-community";import{Component as Ex}from"ag-grid-community";import{AgSelect as Ax,Component as Rx,RefPlaceholder as Cx}from"ag-grid-community";import{Component as bx,RefPlaceholder as vx}from"ag-grid-community";import{Component as Ox}from"ag-grid-community";import{Component as jx,RefPlaceholder as Px}from"ag-grid-community";import{BeanStub as yx}from"ag-grid-community";import{AgCheckbox as cx,AgSelect as hx,Component as ix,RefPlaceholder as t5}from"ag-grid-community";import{AgSelect as O1,Component as dx,RefPlaceholder as lx,_error as px,_removeFromParent as mx}from"ag-grid-community";import{Component as tx,RefPlaceholder as sx,_removeFromParent as ox}from"ag-grid-community";import{Component as ax}from"ag-grid-community";import{Component as Gc}from"ag-grid-community";import{Component as zc}from"ag-grid-community";import{AgSelectSelector as Qc,Component as Jc}from"ag-grid-community";import{AgSelectSelector as Zc,Component as $c,RefPlaceholder as Lc,_removeFromParent as Sc}from"ag-grid-community";import{Component as Yc}from"ag-grid-community";import{Component as qc}from"ag-grid-community";import{AgSelectSelector as _c,Component as kc,RefPlaceholder as wc}from"ag-grid-community";import{Component as Nc}from"ag-grid-community";import{Component as Ic,RefPlaceholder as Mc}from"ag-grid-community";import{AgInputTextField as Ac,Component as Rc}from"ag-grid-community";import{Component as Oc,RefPlaceholder as oz,_areEqual as uc,_clearElement as o5,_createIconNoSpan as r5,_getAbsoluteWidth as jc,_radioCssClass as a5,_setDisplayed as Pc}from"ag-grid-community";import{Component as gc,KeyCode as e5,_setAriaLabel as Tc,_warn as G6}from"ag-grid-community";import{Component as yc,_error as xc}from"ag-grid-community";import{_last as X9}from"ag-grid-community";import{_flatten as Qh}from"ag-grid-community";import{_flatten as Yh}from"ag-grid-community";import{BeanStub as fi,_error as Ni}from"ag-grid-community";import{_errMsg as Ri}from"ag-grid-community";import{AllCommunityModule as Xn}from"ag-grid-community";import"ag-grid-community";var d9=class{constructor(){this.ieCompatibility=!1}init(){this.ieCompatibility=this.md5("hello")!="5d41402abc4b2a76b9719d911017c592"}md5cycle(G,D){let z=G[0],B=G[1],Q=G[2],J=G[3];z=this.ff(z,B,Q,J,D[0],7,-680876936),J=this.ff(J,z,B,Q,D[1],12,-389564586),Q=this.ff(Q,J,z,B,D[2],17,606105819),B=this.ff(B,Q,J,z,D[3],22,-1044525330),z=this.ff(z,B,Q,J,D[4],7,-176418897),J=this.ff(J,z,B,Q,D[5],12,1200080426),Q=this.ff(Q,J,z,B,D[6],17,-1473231341),B=this.ff(B,Q,J,z,D[7],22,-45705983),z=this.ff(z,B,Q,J,D[8],7,1770035416),J=this.ff(J,z,B,Q,D[9],12,-1958414417),Q=this.ff(Q,J,z,B,D[10],17,-42063),B=this.ff(B,Q,J,z,D[11],22,-1990404162),z=this.ff(z,B,Q,J,D[12],7,1804603682),J=this.ff(J,z,B,Q,D[13],12,-40341101),Q=this.ff(Q,J,z,B,D[14],17,-1502002290),B=this.ff(B,Q,J,z,D[15],22,1236535329),z=this.gg(z,B,Q,J,D[1],5,-165796510),J=this.gg(J,z,B,Q,D[6],9,-1069501632),Q=this.gg(Q,J,z,B,D[11],14,643717713),B=this.gg(B,Q,J,z,D[0],20,-373897302),z=this.gg(z,B,Q,J,D[5],5,-701558691),J=this.gg(J,z,B,Q,D[10],9,38016083),Q=this.gg(Q,J,z,B,D[15],14,-660478335),B=this.gg(B,Q,J,z,D[4],20,-405537848),z=this.gg(z,B,Q,J,D[9],5,568446438),J=this.gg(J,z,B,Q,D[14],9,-1019803690),Q=this.gg(Q,J,z,B,D[3],14,-187363961),B=this.gg(B,Q,J,z,D[8],20,1163531501),z=this.gg(z,B,Q,J,D[13],5,-1444681467),J=this.gg(J,z,B,Q,D[2],9,-51403784),Q=this.gg(Q,J,z,B,D[7],14,1735328473),B=this.gg(B,Q,J,z,D[12],20,-1926607734),z=this.hh(z,B,Q,J,D[5],4,-378558),J=this.hh(J,z,B,Q,D[8],11,-2022574463),Q=this.hh(Q,J,z,B,D[11],16,1839030562),B=this.hh(B,Q,J,z,D[14],23,-35309556),z=this.hh(z,B,Q,J,D[1],4,-1530992060),J=this.hh(J,z,B,Q,D[4],11,1272893353),Q=this.hh(Q,J,z,B,D[7],16,-155497632),B=this.hh(B,Q,J,z,D[10],23,-1094730640),z=this.hh(z,B,Q,J,D[13],4,681279174),J=this.hh(J,z,B,Q,D[0],11,-358537222),Q=this.hh(Q,J,z,B,D[3],16,-722521979),B=this.hh(B,Q,J,z,D[6],23,76029189),z=this.hh(z,B,Q,J,D[9],4,-640364487),J=this.hh(J,z,B,Q,D[12],11,-421815835),Q=this.hh(Q,J,z,B,D[15],16,530742520),B=this.hh(B,Q,J,z,D[2],23,-995338651),z=this.ii(z,B,Q,J,D[0],6,-198630844),J=this.ii(J,z,B,Q,D[7],10,1126891415),Q=this.ii(Q,J,z,B,D[14],15,-1416354905),B=this.ii(B,Q,J,z,D[5],21,-57434055),z=this.ii(z,B,Q,J,D[12],6,1700485571),J=this.ii(J,z,B,Q,D[3],10,-1894986606),Q=this.ii(Q,J,z,B,D[10],15,-1051523),B=this.ii(B,Q,J,z,D[1],21,-2054922799),z=this.ii(z,B,Q,J,D[8],6,1873313359),J=this.ii(J,z,B,Q,D[15],10,-30611744),Q=this.ii(Q,J,z,B,D[6],15,-1560198380),B=this.ii(B,Q,J,z,D[13],21,1309151649),z=this.ii(z,B,Q,J,D[4],6,-145523070),J=this.ii(J,z,B,Q,D[11],10,-1120210379),Q=this.ii(Q,J,z,B,D[2],15,718787259),B=this.ii(B,Q,J,z,D[9],21,-343485551),G[0]=this.add32(z,G[0]),G[1]=this.add32(B,G[1]),G[2]=this.add32(Q,G[2]),G[3]=this.add32(J,G[3])}cmn(G,D,z,B,Q,J){return D=this.add32(this.add32(D,G),this.add32(B,J)),this.add32(D<>>32-Q,z)}ff(G,D,z,B,Q,J,U){return this.cmn(D&z|~D&B,G,D,Q,J,U)}gg(G,D,z,B,Q,J,U){return this.cmn(D&B|z&~B,G,D,Q,J,U)}hh(G,D,z,B,Q,J,U){return this.cmn(D^z^B,G,D,Q,J,U)}ii(G,D,z,B,Q,J,U){return this.cmn(z^(D|~B),G,D,Q,J,U)}md51(G){let D=G.length,z=[1732584193,-271733879,-1732584194,271733878],B;for(B=64;B<=G.length;B+=64)this.md5cycle(z,this.md5blk(G.substring(B-64,B)));G=G.substring(B-64);let Q=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];for(B=0;B>2]|=G.charCodeAt(B)<<(B%4<<3);if(Q[B>>2]|=128<<(B%4<<3),B>55){this.md5cycle(z,Q);for(B=0;B<16;B++)Q[B]=0}return Q[14]=D*8,this.md5cycle(z,Q),z}md5blk(G){let D=[];for(let z=0;z<64;z+=4)D[z>>2]=G.charCodeAt(z)+(G.charCodeAt(z+1)<<8)+(G.charCodeAt(z+2)<<16)+(G.charCodeAt(z+3)<<24);return D}rhex(G){let D="0123456789abcdef".split(""),z="",B=0;for(;B<4;B++)z+=D[G>>B*8+4&15]+D[G>>B*8&15];return z}hex(G){for(let D=0;D>16)+(D>>16)+(z>>16)<<16|z&65535}},w0={"01":"GRID","02":"CHARTS","0102":"BOTH"};var Y6=class G{constructor(D){this.watermarkMessage=void 0,this.totalMessageLength=124,this.document=D,this.md5=new d9,this.md5.init()}validateLicense(){let D=this.getLicenseDetails(G.licenseKey),z=`AG Grid ${D.currentLicenseType==="BOTH"?"and AG Charts ":""}Enterprise`,B=D.suppliedLicenseType===void 0?"":`AG ${D.suppliedLicenseType==="BOTH"?"Grid and AG Charts":D.suppliedLicenseType==="GRID"?"Grid":"Charts"} Enterprise`;if(D.missing){if(!this.isWebsiteUrl()||this.isForceWatermark())this.outputMissingLicenseKey(z)}else if(D.expired){let Q=G.getGridReleaseDate(),J=G.formatDate(Q);this.outputExpiredKey(D.expiry,J,z,B)}else if(!D.valid)this.outputInvalidLicenseKey(!!D.incorrectLicenseType,z,B);else if(D.isTrial&&D.trialExpired)this.outputExpiredTrialKey(D.expiry,z,B)}static extractExpiry(D){let z=D.substring(D.lastIndexOf("_")+1,D.length);return new Date(parseInt(G.decode(z),10))}static extractLicenseComponents(D){let z=D.replace(/[\u200B-\u200D\uFEFF]/g,"");if(z=z.replace(/\r?\n|\r/g,""),D.length<=32)return{md5:null,license:D,version:null,isTrial:null};let B=z.length-32,Q=z.substring(B),J=z.substring(0,B),[U,Z,S]=G.extractBracketedInformation(z);return{md5:Q,license:J,version:U,isTrial:Z,type:S}}getLicenseDetails(D){let z=G.chartsLicenseManager?"BOTH":"GRID";if(!D?.length)return{licenseKey:D,valid:!1,missing:!0,currentLicenseType:z};let B=G.getGridReleaseDate(),{md5:Q,license:J,version:U,isTrial:Z,type:S}=G.extractLicenseComponents(D),X=Q===this.md5.md5(J)&&!D.includes("For_Trialing_ag-Grid_Only"),Y=void 0,W=void 0,q=null,H=!1,_=void 0;function k(){Y=qq,U){case"legacy":case"2":{if(Z)k();break}case"3":if(!S?.length)X=!1;else if(_=S,S!==w0["01"]&&S!==w0["0102"]||z==="BOTH"&&_!=="BOTH")X=!1,H=!0;else if(Z)k()}}if(!X)return{licenseKey:D,valid:X,incorrectLicenseType:H,currentLicenseType:z,suppliedLicenseType:_};return{licenseKey:D,valid:X,expiry:G.formatDate(q),expired:W,version:U,isTrial:Z,trialExpired:Y,incorrectLicenseType:H,currentLicenseType:z,suppliedLicenseType:_}}isDisplayWatermark(){return this.isForceWatermark()||!this.isLocalhost()&&!this.isWebsiteUrl()&&!!this.watermarkMessage?.length}getWatermarkMessage(){return this.watermarkMessage||""}getHostname(){let z=(this.document.defaultView||window).location,{hostname:B=""}=z;return B}isForceWatermark(){let z=(this.document.defaultView||window).location,{pathname:B}=z;return B?B.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(D){let z=["January","February","March","April","May","June","July","August","September","October","November","December"],B=D.getDate(),Q=D.getMonth(),J=D.getFullYear();return B+" "+z[Q]+" "+J}static getGridReleaseDate(){return new Date(parseInt(G.decode(G.RELEASE_INFORMATION),10))}static decode(D){let B="",Q,J,U,Z,S,X,Y,W=0,q=D.replace(/[^A-Za-z0-9+/=]/g,"");while(W>4,J=(S&15)<<4|X>>2,U=(X&3)<<6|Y,B=B+String.fromCharCode(Q),X!=64)B=B+String.fromCharCode(J);if(Y!=64)B=B+String.fromCharCode(U)}return B=G.utf8_decode(B),B}static utf8_decode(D){D=D.replace(/rn/g,"n");let z="";for(let B=0;B127&&Q<2048)z+=String.fromCharCode(Q>>6|192),z+=String.fromCharCode(Q&63|128);else z+=String.fromCharCode(Q>>12|224),z+=String.fromCharCode(Q>>6&63|128),z+=String.fromCharCode(Q&63|128)}return z}static setChartsLicenseManager(D){this.chartsLicenseManager=D,this.chartsLicenseManager?.setLicenseKey(this.licenseKey,!0)}static setLicenseKey(D){if(i9(this.licenseKey)&&this.licenseKey!==D)n9(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=D,this.chartsLicenseManager?.setLicenseKey(D,!0)}static extractBracketedInformation(D){if(!D.includes("["))return["legacy",!1,void 0];let z=D.match(/\[(.*?)\]/g).map((Z)=>Z.replace("[","").replace("]",""));if(!z||z.length===0)return["legacy",!1,void 0];let B=z.filter((Z)=>Z==="TRIAL").length===1,Q=z.filter((Z)=>Z.indexOf("v")===0)[0],J=Q?Q.replace("v",""):"legacy",U=w0[z.filter((Z)=>w0[Z])[0]];return[J,B,U]}centerPadAndOutput(D){let z=this.totalMessageLength-D.length}padAndOutput(D,z="*",B=""){}outputInvalidLicenseKey(D,z,B){}outputExpiredTrialKey(D,z,B){}outputMissingLicenseKey(D){}outputExpiredKey(D,z,B,Q){}};Y6.RELEASE_INFORMATION="MTc3NDQyNTc0Nzc3NQ==";var az=Y6,m9='.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}',t9={tag:"div",cls:"ag-watermark",children:[{tag:"div",ref:"eLicenseTextRef",cls:"ag-watermark-text"}]},s9=class extends l9{constructor(){super(t9);this.eLicenseTextRef=p9,this.registerCSS(m9)}wireBeans(G){this.licenseManager=G.licenseManager}postConstruct(){let G=this.shouldDisplayWatermark();if(this.setDisplayed(G),G)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()}},o9={selector:"AG-WATERMARK",component:s9},j1=class extends c9{constructor(){super(...arguments);this.beanName="licenseManager"}postConstruct(){this.validateLicense()}validateLicense(){let G=this.beans;if(G.withinStudio)this.licenseManager={isDisplayWatermark:()=>!1,getWatermarkMessage:()=>""};else{let D=new az(h9(G));this.licenseManager=D,D.validateLicense()}}static getLicenseDetails(G){return new az(null).getLicenseDetails(G)}getWatermarkSelector(){return o9}isDisplayWatermark(){return this.licenseManager.isDisplayWatermark()}getWatermarkMessage(){return this.licenseManager.getWatermarkMessage()}static setLicenseKey(G){az.setLicenseKey(G)}static setChartsLicenseManager(G){az.setChartsLicenseManager(G)}},U$=9525,BU={"0":1,"0.00":2,"#,##0":3,"#,##0.00":4,"0%":9,"0.00%":10,"0.00E+00":11,"# ?/?":12,"# ??/??":13,"mm-dd-yy":14,"d-mmm-yy":15,"d-mmm":16,"mmm-yy":17,"h:mm AM/PM":18,"h:mm:ss AM/PM":19,"h:mm":20,"h:mm:ss":21,"m/d/yy h:mm":22,"#,##0 ;(#,##0)":37,"#,##0 ;[Red](#,##0)":38,"#,##0.00;(#,##0.00)":39,"#,##0.00;[Red](#,##0.00)":40,"mm:ss":45,"[h]:mm:ss":46,"mmss.0":47,"##0.0E+0":48,"@":49},K0=`\r -`;function QU(G,D,z){if(!D&&D!==""&&D!==0)return"";let B=D;if(typeof D==="boolean"){if(z)B=z(D)}return` ${G}="${B}"`}function Z$(G={}){let B=["version"];if(!G.version)G.version="1.0";if(G.encoding)B.push("encoding");if(G.standalone)B.push("standalone");return``${J}="${G[J]}"`).join(" ")} ?>`}function q6(G,D){let z="";if(G.properties){if(G.properties.prefixedAttributes)G.properties.prefixedAttributes.forEach((Q)=>{for(let J of Object.keys(Q.map))z+=QU(Q.prefix+J,Q.map[J],D)});if(G.properties.rawMap)for(let Q of Object.keys(G.properties.rawMap))z+=QU(Q,G.properties.rawMap[Q],D)}let B="<"+G.name+z;if(!G.children&&G.textNode==null)return B+"/>"+K0;if(G.textNode!=null)return B+">"+G.textNode+""+K0;if(B+=">"+K0,G.children)for(let Q of G.children)B+=q6(Q,D);return B+""+K0}var $$=(G)=>{return Math.round(G*96/72)},yD=(G)=>{return Math.ceil(G*U$)},L$=(G)=>{if(G===void 0)return;let z=["Automatic","Roman","Swiss","Modern","Script","Decorative"].indexOf(G||"Automatic");return Math.max(z,0)},$B=(G,D)=>{if(!D)return;let z;if(typeof D==="number")z=D;else z=D({rowIndex:G});return z},S$=(G,D)=>{let{colSpan:z,column:B}=G.position;if(!G.width)return;if(z){let Q=D.slice(B-1,B+z-1),J=0;for(let U=0;U{let{rowSpan:z,row:B}=G.position;if(!G.height)return;if(z){let Q=0,J=0;for(let U=B;U{let z=Z$({encoding:"UTF-8",standalone:"yes"}),B=q6(G);if(D)return B;return`${z}${B}`},OD=(G)=>{let B=String.fromCharCode,Q=Math.floor(G/26),J=G%26;if(!Q||G===26)return B(65+G-1);if(!J)return OD(Q-1)+"Z";if(Q<26)return B(65+Q-1)+B(65+J-1);return OD(Q)+B(65+J-1)},Y$=(G)=>{return G.replaceAll(` -`,"_x000a_")},kB=(G)=>{if(G==null)return null;let D="";for(let z=0;z=0&&B<=31&&B!==10){let U=`_x${B.toString(16).toUpperCase().padStart(4,"0")}_`;D+=U}else D+=G[z]}return D},W$=(G)=>{let D=[];for(let z of G.keys()){let B=z.toString(),Q={name:"t",textNode:J$(kB(B))};if(B.trim().length!==B.length)Q.properties={rawMap:{"xml:space":"preserve"}};D.push({name:"si",children:[Q]})}return D},q$=class extends G${constructor(G){super(G);this.mixedStyles={},this.mixedStyleCounter=0,this.rows=[],this.frozenRowCount=0,this.skipFrozenRows=!1,this.frozenColumnCount=0,this.skipFrozenColumns=!1,this.formulaSvc=G.formulaSvc,this.config=Object.assign({},G),this.workbook=G.workbook,this.stylesByIds={};for(let z of this.config.baseExcelStyles)this.stylesByIds[z.id]=z;let D={id:"_quotePrefix",quotePrefix:1};this.stylesByIds[D.id]=D,this.excelStyles=[...this.config.baseExcelStyles,D]}addCustomContent(G){for(let D of G){let z=this.rows.length+1,B;if(!this.config.suppressRowOutline&&D.outlineLevel!=null)B=D.outlineLevel;let Q={height:$B(z,D.height||this.config.rowHeight),cells:(D.cells||[]).map((J,U)=>{let Z=this.addImage(z,this.columnsToExport[U],J.data?.value),S=null;if(J.styleId)S=typeof J.styleId==="string"?[J.styleId]:J.styleId;let X=this.getStyleId(S);if(Z)return this.createCell(X,this.getDataTypeForValue(Z.value),Z.value==null?"":Z.value);let Y=J.data?.value??"",W=this.getDataTypeForValue(Y);if(J.mergeAcross)return this.createMergedCell(X,W,Y,J.mergeAcross);return this.createCell(X,W,Y)}),outlineLevel:B};if(D.collapsed!=null)Q.collapsed=D.collapsed;if(D.hidden!=null)Q.hidden=D.hidden;this.rows.push(Q)}}onNewHeaderGroupingRow(){let G=[],{freezeRows:D,headerRowHeight:z}=this.config;if(this.rows.push({cells:G,height:$B(this.rows.length+1,z)}),D)this.frozenRowCount++;return{onColumn:(B,Q,J,U,Z)=>{let S=this.config.styleLinker({rowType:"HEADER_GROUPING",rowIndex:1,value:`grouping-${Q}`,columnGroup:B});G.push({...this.createMergedCell(this.getStyleId(S),this.getDataTypeForValue("string"),Q,U),collapsibleRanges:Z})}}}onNewHeaderRow(){let{freezeRows:G,headerRowHeight:D}=this.config;if(G)this.frozenRowCount++;return this.onNewRow(this.onNewHeaderColumn,D)}onNewBodyRow(G){let{freezeRows:D,rowHeight:z}=this.config;if(!this.skipFrozenRows)if(D==="headersAndPinnedRows"&&G?.rowPinned==="top")this.frozenRowCount++;else if(typeof D==="function")if(D(QQ(this.gos,{node:G})))this.frozenRowCount++;else this.skipFrozenRows=!0;else this.skipFrozenRows=!0;let B=this.onNewRow(this.onNewBodyColumn,z);if(G)this.addRowOutlineIfNecessary(G);return B}prepare(G){super.prepare(G),this.columnsToExport=[...G],this.cols=G.map((D,z)=>this.convertColumnToExcel(D,z))}parse(){let G=this.rows.reduce((z,B)=>Math.max(z,B.cells.length),0);while(this.cols.length{let B=this.extractHeaderValue(z),Q=this.config.styleLinker({rowType:"HEADER",rowIndex:G,value:B,column:z});D.push(this.createCell(this.getStyleId(Q),this.getDataTypeForValue("string"),B))}}onNewBodyColumn(G,D){let z=0,{freezeColumns:B,rightToLeft:Q}=this.config;return(J,U,Z)=>{if(z>0){z-=1;return}if(!this.skipFrozenColumns){let w=J.getPinned();if(B==="pinned"&&w&&(w===!0||w==="left")!==Q)this.frozenColumnCount++;else if(typeof B==="function"&&B(QQ(this.gos,{column:J})))this.frozenColumnCount++;else this.skipFrozenColumns=!0}let{value:S,valueFormatted:X}=this.extractRowCellValue({column:J,node:Z,currentColumnIndex:U,accumulatedRowIndex:G,type:"excel",useRawFormula:!0}),Y=S,W=typeof Y==="bigint"?Y.toString():Y,q=this.config.styleLinker({rowType:"BODY",rowIndex:G,value:Y,column:J,node:Z}),H=this.getStyleId(q),_=J.getColSpan(Z),k=this.addImage(G,J,W);if(k)D.push(this.createCell(H,this.getDataTypeForValue(k.value),k.value==null?"":k.value));else if(_>1)z=_-1,D.push(this.createMergedCell(H,this.getDataTypeForValue(Y),W,_-1));else{let w=J.isAllowFormula()&&this.formulaSvc?.isFormula(W),K=this.createCell(H,w?"f":this.getDataTypeForValue(Y),w?this.formulaSvc?.updateFormulaByOffset({value:W,rowDelta:G-(Z.formulaRowIndex+1),useRefFormat:!1}):W,X);D.push(K)}}}onNewRow(G,D){let z=[];return this.rows.push({cells:z,height:$B(this.rows.length+1,D)}),{onColumn:G.bind(this,this.rows.length,z)()}}addWorksheetToWorkbook(G){let{excelStyles:D,config:z}=this;if(this.mapSharedStrings(G),this.frozenColumnCount)z.frozenColumnCount=this.frozenColumnCount;if(this.frozenRowCount)z.frozenRowCount=this.frozenRowCount;return this.workbook.addWorksheet(D,G,z)}mapSharedStrings(G){let D;for(let z of G.table.rows)for(let B of z.cells){let Q=B.data;if(!Q||Q.type!=="s")continue;let J=Q.value;if(J==null)continue;if(J===""){D??(D=this.workbook.getStringPosition("").toString()),Q.value=D;continue}Q.value=this.workbook.getStringPosition(String(J)).toString()}}getDataTypeForValue(G){if(G===void 0)return"empty";let D="s";try{if(this.isNumerical(G))D="n"}catch(z){}return D}getTypeFromStyle(G,D){if(this.isFormula(D))return"f";if(G?.dataType)switch(G.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:Q$(162,{id:G.id,dataType:G.dataType})}return null}addImage(G,D,z){if(!this.config.addImageToCell)return;let B=this.config.addImageToCell(G,D,z);if(!B)return;return this.workbook.addBodyImageToMap(B.image,G,D,this.columnsToExport,this.config.rowHeight),B}createCell(G,D,z,B){let Q=this.getStyleById(G);if(!Q?.dataType&&D==="s"&&B!=null)z=B;let J=this.getTypeFromStyle(Q,z)||D,{value:U,escaped:Z}=this.getCellValue(J,z),S=[];if(Q)S.push(G);if(Z)S.push("_quotePrefix");return G=this.getStyleId(S)||void 0,{styleId:G,data:{type:J,value:U}}}createMergedCell(G,D,z,B){let Q=z==null?"":z;return{styleId:this.getStyleById(G)?G:void 0,data:{type:D,value:D==="s"?String(Q):z},mergeAcross:B}}getCellValue(G,D){let z=!1;if(D==null||G==="s"&&D==="")return{value:"",escaped:!1};if(G==="s"){if(D=String(D),D[0]==="'")z=!0,D=D.slice(1)}else if(G==="f")D=this.addXlfnPrefix(D).slice(1);else if(G==="n"){let B=Number(D);if(isNaN(B))D="";else if(D!=="")D=B.toString()}return{value:D,escaped:z}}addXlfnPrefix(G){if(!G)return G;let D=/(^|[^A-Z0-9._])(CONCAT)(\s*\()/gi;return G.replace(D,(z,B,Q,J)=>`${B}_xlfn.${Q}${J}`)}getStyleId(G){if(!G?.length)return null;let D=G.filter((B)=>this.stylesByIds[B]!=null);if(!D.length)return null;if(D.length===1)return D[0];let z=D.join("-");if(!this.mixedStyles[z])this.addNewMixedStyle(D);return this.mixedStyles[z].excelID}addNewMixedStyle(G){this.mixedStyleCounter+=1;let D=`mixedStyle${this.mixedStyleCounter}`,z={};for(let Q of G){let J=this.stylesByIds[Q];if(J)B$(z,J,!0,!0)}z.id=D;let B=G.join("-");this.mixedStyles[B]={excelID:D,key:B,result:z},this.excelStyles.push(z),this.stylesByIds[D]=z}isFormula(G){if(G==null)return!1;let D=String(G);return this.config.autoConvertFormulas&&D$(D)}isNumerical(G){if(typeof G==="bigint")return!1;return isFinite(G)&&G!==""&&!isNaN(parseFloat(G))}getStyleById(G){if(G==null)return null;return this.stylesByIds[G]||null}},_$={getTemplate(G){let{name:D,ContentType:z,Extension:B,PartName:Q}=G;return{name:D,properties:{rawMap:{Extension:B,PartName:Q,ContentType:z}}}}},k$=_$,vB=(G)=>G==="jpg"?"jpeg":G,w$={getTemplate({sheetLen:G,hasCustomProperties:D}){let z=Array(G).fill(void 0).map((W,q)=>({name:"Override",ContentType:"application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml",PartName:`/xl/worksheets/sheet${q+1}.xml`})),B=qD.size,Q=mG.size,J={};Qz.forEach((W)=>{J[vB(W.type)]=!0});let U=Array(B).fill(void 0).map((W,q)=>({name:"Override",ContentType:"application/vnd.openxmlformats-officedocument.drawing+xml",PartName:`/xl/drawings/drawing${q+1}.xml`})),Z=[];uG.forEach(({name:W})=>{Z.push({name:"Override",ContentType:"application/vnd.openxmlformats-officedocument.spreadsheetml.table+xml",PartName:`/xl/tables/${W}.xml`})});let S=D?[{name:"Override",ContentType:"application/vnd.openxmlformats-officedocument.custom-properties+xml",PartName:"/docProps/custom.xml"}]:[],X=Object.keys(J).map((W)=>({name:"Default",ContentType:`image/${W}`,Extension:W}));if(Q)X.push({name:"Default",Extension:"vml",ContentType:"application/vnd.openxmlformats-officedocument.vmlDrawing"});let Y=[...X,{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"},...z,{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"},...U,...Z,{name:"Override",ContentType:"application/vnd.openxmlformats-package.core-properties+xml",PartName:"/docProps/core.xml"},...S].map((W)=>k$.getTemplate(W));return{name:"Types",properties:{rawMap:{xmlns:"http://schemas.openxmlformats.org/package/2006/content-types"}},children:Y}}},K$=w$,f$={getTemplate(G){let z=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:G},{name:"dc:title",textNode:"Workbook"},{name:"dcterms:created",properties:{rawMap:{"xsi:type":"dcterms:W3CDTF"}},textNode:z},{name:"dcterms:modified",properties:{rawMap:{"xsi:type":"dcterms:W3CDTF"}},textNode:z}]}}},N$=f$,F$="{D5CDD505-2E9C-101B-9397-08002B2CF9AE}",E$=(G)=>{return Object.keys(G).filter((z)=>z&&G[z]!=null).map((z,B)=>({name:"property",properties:{rawMap:{fmtid:F$,pid:(B+2).toString(),name:JU(z)??""}},children:[{name:"vt:lpwstr",textNode:JU(kB(String(G[z])))??""}]}))},I$={getTemplate(G){return{name:"Properties",properties:{rawMap:{xmlns:"http://schemas.openxmlformats.org/officeDocument/2006/custom-properties","xmlns:vt":"http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes"}},children:E$(G)}}},M$=I$,UU=(G,D)=>({name:`xdr:${G}`,children:[{name:"xdr:col",textNode:D.col.toString()},{name:"xdr:colOff",textNode:D.offsetX.toString()},{name:"xdr:row",textNode:D.row.toString()},{name:"xdr:rowOff",textNode:D.offsetY.toString()}]}),A$=(G)=>{let D=[{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(G.recolor?.toLowerCase()){case"grayscale":case"sepia":case"washout":D.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:D}},R$=(G,D)=>({name:"xdr:nvPicPr",children:[{name:"xdr:cNvPr",properties:{rawMap:{id:D,name:G.id,descr:G.altText!=null?G.altText:void 0}},children:[A$(G)]},{name:"xdr:cNvPicPr",properties:{rawMap:{preferRelativeResize:"0"}},children:[{name:"a:picLocks"}]}]}),ZU=(G)=>{if(!G.saturation&&!G.tint)return;let D=[];if(G.saturation)D.push({name:"a:satMod",properties:{rawMap:{val:G.saturation*1000}}});if(G.tint)D.push({name:"a:tint",properties:{rawMap:{val:G.tint*1000}}});return D},C$=(G,D)=>{return{name:"a:duotone",children:[{name:"a:prstClr",properties:{rawMap:{val:G.color}},children:ZU(G)},{name:"a:srgbClr",properties:{rawMap:{val:D.color}},children:ZU(D)}]}},V$=(G,D)=>{let z;if(G.transparency){let B=Math.min(Math.max(G.transparency,0),100);z=[{name:"a:alphaModFix",properties:{rawMap:{amt:1e5-Math.round(B*1000)}}}]}if(G.recolor){if(!z)z=[];switch(G.recolor.toLocaleLowerCase()){case"grayscale":z.push({name:"a:grayscl"});break;case"sepia":z.push(C$({color:"black"},{color:"D9C3A5",tint:50,saturation:180}));break;case"washout":z.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${D}`,"xmlns:r":"http://schemas.openxmlformats.org/officeDocument/2006/relationships"}},children:z},{name:"a:stretch",children:[{name:"a:fillRect"}]}]}},b$=(G,D)=>{let z={name:"a:xfrm",children:[{name:"a:off",properties:{rawMap:{x:0,y:0}}},{name:"a:ext",properties:{rawMap:{cx:D.width,cy:D.height}}}]};if(G.rotation){let J=G.rotation;z.properties={rawMap:{rot:Math.min(Math.max(J,0),360)*60000}}}return{name:"xdr:spPr",children:[z,{name:"a:prstGeom",properties:{rawMap:{prst:"rect"}},children:[{name:"a:avLst"}]}]}},v$=(G)=>{G.fitCell=!!G.fitCell||!G.width||!G.height;let{position:D={},fitCell:z,width:B=0,height:Q=0,totalHeight:J,totalWidth:U}=G,{offsetX:Z=0,offsetY:S=0,row:X=1,rowSpan:Y=1,column:W=1,colSpan:q=1}=D;return{from:{row:X-1,col:W-1,offsetX:yD(Z),offsetY:yD(S)},to:{row:X-1+(z?1:Y-1),col:W-1+(z?1:q-1),offsetX:yD(B+Z),offsetY:yD(Q+S)},height:yD(J||Q),width:yD(U||B)}},O$=(G,D,z,B)=>{return{name:"xdr:pic",children:[R$(G,D+1),V$(G,z+1),b$(G,B)]}},u$={getTemplate(G){let{sheetIndex:D}=G,z=qD.get(D),B=Jz.get(D),Q=z.map((J,U)=>{let Z=v$(J);return{name:"xdr:twoCellAnchor",properties:{rawMap:{editAs:"absolute"}},children:[UU("from",Z.from),UU("to",Z.to),O$(J,U,B.get(J.id).index,Z),{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:Q}}},j$=u$,P$={getTemplate(G){let{Id:D,Type:z,Target:B}=G;return{name:"Relationship",properties:{rawMap:{Id:D,Type:z,Target:B}}}}},g$=P$,T$={getTemplate(G){let D=G.map((z)=>g$.getTemplate(z));return{name:"Relationships",properties:{rawMap:{xmlns:"http://schemas.openxmlformats.org/package/2006/relationships"}},children:D}}},Y0=T$,y$={getTemplate(G){return{name:"sst",properties:{rawMap:{xmlns:"http://schemas.openxmlformats.org/spreadsheetml/2006/main",count:G.size,uniqueCount:G.size}},children:W$(G)}}},x$=y$,c$=(G)=>{switch(G){case 1:return"thin";case 2:return"medium";case 3:return"thick";default:return"hair"}},h$={None:"None",Dot:"Dotted",Dash:"Dashed",Double:"Double",DashDot:"DashDot",DashDotDot:"DashDotDot",SlantDashDot:"SlantDashDot",Continuous:"Continuous"},i$=["Dashed","DashDot","DashDotDot"],n$={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"},d$={Automatic:"general",Left:"left",Center:"center",Right:"right",Fill:"fill",Justify:"justify",CenterAcrossSelection:"centerContinuous",Distributed:"distributed",JustifyDistributed:"justify"},l$={Automatic:void 0,Top:"top",Bottom:"bottom",Center:"center",Justify:"justify",Distributed:"distributed",JustifyDistributed:"justify"},p$=(G)=>{if(!G)return"none";return n$[G]||G},LD=(G)=>{if(G==null)return G;if(G.charAt(0)==="#")G=G.substring(1);return G.length===6?"FF"+G:G},f0=(G,D)=>{if(!G)return"thin";let z=c$(D);if(G==="Continuous")return z;let B=h$[G];if(z==="medium"&&i$.some((Q)=>Q===B))return`medium${B}`;return`${B.charAt(0).toLowerCase()}${B.substring(1)}`},m$=(G)=>{return d$[G]||"general"},t$=(G)=>{return l$[G]||void 0},kz=(G)=>{return{name:"color",properties:{rawMap:{rgb:LD(G||"#000000")}}}},s$={getTemplate(G){let{left:D,right:z,top:B,bottom:Q,diagonal:J}=G,U=D?[kz(D.color)]:void 0,Z=z?[kz(z.color)]:void 0,S=B?[kz(B.color)]:void 0,X=Q?[kz(Q.color)]:void 0,Y=J?[kz(J.color)]:void 0;return{name:"border",children:[{name:"left",properties:{rawMap:{style:D?.style}},children:U},{name:"right",properties:{rawMap:{style:z?.style}},children:Z},{name:"top",properties:{rawMap:{style:B?.style}},children:S},{name:"bottom",properties:{rawMap:{style:Q?.style}},children:X},{name:"diagonal",properties:{rawMap:{style:J?.style}},children:Y}]}}},o$=s$,r$={getTemplate(G){return{name:"borders",properties:{rawMap:{count:G.length}},children:G.map((D)=>o$.getTemplate(D))}}},a$=r$,e$=(G)=>{let z=["Context","LeftToRight","RightToLeft"].indexOf(G);return Math.max(z,0)},GL={getTemplate(G){let{horizontal:D,indent:z,readingOrder:B,rotate:Q,shrinkToFit:J,vertical:U,wrapText:Z}=G;return{name:"alignment",properties:{rawMap:{horizontal:D&&m$(D),indent:z,readingOrder:B&&e$(B),textRotation:Q,shrinkToFit:J,vertical:U&&t$(U),wrapText:Z}}}}},DL=GL,zL={getTemplate(G){let D=G.protected===!1?0:1;return{name:"protection",properties:{rawMap:{hidden:G.hideFormula===!0?1:0,locked:D}}}}},BL=zL,QL={getTemplate(G){let{alignment:D,borderId:z,fillId:B,fontId:Q,numFmtId:J,protection:U,quotePrefix:Z,xfId:S}=G,X=[];if(D)X.push(DL.getTemplate(D));if(U)X.push(BL.getTemplate(U));return{name:"xf",properties:{rawMap:{applyAlignment:D?1:void 0,applyProtection:U?1:void 0,applyBorder:z?1:void 0,applyFill:B?1:void 0,borderId:z,fillId:B,applyFont:Q?1:void 0,fontId:Q,applyNumberFormat:J?1:void 0,numFmtId:J,quotePrefix:Z?1:void 0,xfId:S}},children:X.length?X:void 0}}},H6=QL,JL={getTemplate(G){return{name:"cellStyleXfs",properties:{rawMap:{count:G.length}},children:G.map((D)=>H6.getTemplate(D))}}},UL=JL,ZL={getTemplate(G){let{builtinId:D,name:z,xfId:B}=G;return{name:"cellStyle",properties:{rawMap:{builtinId:D,name:z,xfId:B}}}}},$L=ZL,LL={getTemplate(G){return{name:"cellStyles",properties:{rawMap:{count:G.length}},children:G.map((D)=>$L.getTemplate(D))}}},SL=LL,XL={getTemplate(G){return{name:"cellXfs",properties:{rawMap:{count:G.length}},children:G.map((D)=>H6.getTemplate(D))}}},YL=XL,WL={getTemplate(G){let{patternType:D,fgTheme:z,fgTint:B,fgRgb:Q,bgRgb:J,bgIndexed:U}=G,Z={name:"patternFill",properties:{rawMap:{patternType:D}}};if(z||B||Q)Z.children=[{name:"fgColor",properties:{rawMap:{theme:z,tint:B,rgb:Q}}}];if(U||J){if(!Z.children)Z.children=[];Z.children.push({name:"bgColor",properties:{rawMap:{indexed:U,rgb:J}}})}return{name:"fill",children:[Z]}}},qL=WL,HL={getTemplate(G){return{name:"fills",properties:{rawMap:{count:G.length}},children:G.map((D)=>qL.getTemplate(D))}}},_L=HL,kL={getTemplate(G){let{size:D,colorTheme:z,color:B="FF000000",fontName:Q="Calibri",family:J,scheme:U,italic:Z,bold:S,strikeThrough:X,outline:Y,shadow:W,underline:q,verticalAlign:H}=G,_=[{name:"sz",properties:{rawMap:{val:D}}},{name:"color",properties:{rawMap:{theme:z,rgb:B}}},{name:"name",properties:{rawMap:{val:Q}}}];if(J)_.push({name:"family",properties:{rawMap:{val:J}}});if(U)_.push({name:"scheme",properties:{rawMap:{val:U}}});if(Z)_.push({name:"i"});if(S)_.push({name:"b"});if(X)_.push({name:"strike"});if(Y)_.push({name:"outline"});if(W)_.push({name:"shadow"});if(q)_.push({name:"u",properties:{rawMap:{val:q}}});if(H)_.push({name:"vertAlign",properties:{rawMap:{val:H}}});return{name:"font",children:_}}},wL=kL,KL={getTemplate(G){return{name:"fonts",properties:{rawMap:{count:G.length}},children:G.map((D)=>wL.getTemplate(D))}}},fL=KL;function FL(G){let D=G.split(/(\[[^\]]*\])/);for(let z=0;zIL.getTemplate(D))}}},AL=ML,wB,rD,G0,D0,z0,_6,KB,k6,g1,w6=(G,D)=>{if(G.includes("mixedStyle")&&D>1)G+=`_${D}`;return G},K6=()=>{wB={base:0},rD=[],G0=[{fontName:"Calibri",colorTheme:"1",family:"2",scheme:"minor"}],D0=[{patternType:"none"},{patternType:"gray125"}],z0=[{left:void 0,right:void 0,top:void 0,bottom:void 0,diagonal:void 0}],_6=[{borderId:0,fillId:0,fontId:0,numFmtId:0}],KB=[{borderId:0,fillId:0,fontId:0,numFmtId:0,xfId:0}],k6=[{builtinId:0,name:"Normal",xfId:0}]},RL=(G)=>{let D=p$(G.pattern),z=LD(G.color),B=LD(G.patternColor),Q=D0.findIndex((J)=>{let{patternType:U,fgRgb:Z,bgRgb:S}=J;return!(U!=D||Z!=z||S!=B)});if(Q===-1)Q=D0.length,D0.push({patternType:D,fgRgb:z,bgRgb:B});return Q},CL=(G)=>{if(BU[G])return BU[G];let D=rD.findIndex((z)=>z.formatCode===G);if(D===-1)D=rD.length+164,rD.push({formatCode:G,numFmtId:D});else D=rD[D].numFmtId;return D},VL=(G)=>{let{borderBottom:D,borderTop:z,borderLeft:B,borderRight:Q}=G,J,U,Z,S,X,Y,W,q;if(B)Z=f0(B.lineStyle,B.weight),W=LD(B.color);if(Q)S=f0(Q.lineStyle,Q.weight),q=LD(Q.color);if(D)J=f0(D.lineStyle,D.weight),X=LD(D.color);if(z)U=f0(z.lineStyle,z.weight),Y=LD(z.color);let H=z0.findIndex((_)=>{let{left:k,right:w,top:K,bottom:f}=_;if(!k&&(Z||W))return!1;if(!w&&(S||q))return!1;if(!K&&(U||Y))return!1;if(!f&&(J||X))return!1;let{style:N,color:F}=k||{},{style:E,color:I}=w||{},{style:V,color:A}=K||{},{style:R,color:O}=f||{};if(N!=Z||F!=W)return!1;if(E!=S||I!=q)return!1;if(V!=U||A!=Y)return!1;if(R!=J||O!=X)return!1;return!0});if(H===-1)H=z0.length,z0.push({left:{style:Z,color:W},right:{style:S,color:q},top:{style:U,color:Y},bottom:{style:J,color:X},diagonal:{style:void 0,color:void 0}});return H},bL=(G)=>{let{fontName:D="Calibri",color:z,size:B,bold:Q,italic:J,outline:U,shadow:Z,strikeThrough:S,underline:X,family:Y,verticalAlign:W}=G,q=LD(z),H=L$(Y),_=X?X.toLocaleLowerCase():void 0,k=W?W.toLocaleLowerCase():void 0,w=G0.findIndex((K)=>{return!(K.fontName!=D||K.color!=q||K.size!=B||K.bold!=Q||K.italic!=J||K.outline!=U||K.shadow!=Z||K.strikeThrough!=S||K.underline!=_||K.verticalAlign!=k||K.family!=H)});if(w===-1)w=G0.length,G0.push({fontName:D,color:q,size:B,bold:Q,italic:J,outline:U,shadow:Z,strikeThrough:S,underline:_,verticalAlign:k,family:H!=null?H.toString():void 0});return w},vL=(G)=>{let{alignment:D,borders:z,font:B,interior:Q,numberFormat:J,protection:U,quotePrefix:Z}=G,{id:S}=G,X=0,Y=0,W=0,q=0;if(!S)return;if(S=w6(S,g1),wB[S]!=null)return;if(Q)X=RL(Q);if(z)Y=VL(z);if(B)W=bL(B);if(J)q=CL(J.format);wB[S]=KB.length,KB.push({alignment:D,borderId:Y||0,fillId:X||0,fontId:W||0,numFmtId:q||0,protection:U,quotePrefix:Z,xfId:0})},OL={getTemplate(G){let D=AL.getTemplate(rD),z=fL.getTemplate(G0.map((S)=>({...S,size:S.size!=null?S.size:G}))),B=_L.getTemplate(D0),Q=a$.getTemplate(z0),J=UL.getTemplate(_6),U=YL.getTemplate(KB),Z=SL.getTemplate(k6);return K6(),{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:[D,z,B,Q,J,U,Z,{name:"tableStyles",properties:{rawMap:{count:0,defaultPivotStyle:"PivotStyleLight16",defaultTableStyle:"TableStyleMedium2"}}}]}}},uL=(G,D)=>{return wB[w6(G,D)]||0},jL=(G,D)=>{if(g1=D,g1===1)K6();G.forEach(vL)},PL=OL,TL={getTemplate(G,D){let{name:z,columns:B,rowRange:Q,displayName:J,showRowStripes:U,showColumnStripes:Z,showFilterButtons:S,highlightFirstColumn:X,highlightLastColumn:Y}=G||{},W=!Q||Q[0]-Q[1]===0;if(!G||!z||!Array.isArray(B)||!B.length||W)return{name:"table"};let q=B.map((f,N)=>({name:"filterColumn",properties:{rawMap:{colId:N.toString(),hiddenButton:S[N]?0:1}}})),H=`A${Q[0]}`,_=`${OD(B.length)}${Q[1]}`,k=`${H}:${_}`,w=`${D+1}`,K=D?`${J}_${w}`:J;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:K,displayName:K,ref:k,totalsRowShown:0,id:w}},children:[{name:"autoFilter",properties:{rawMap:{ref:k}},children:q},{name:"tableColumns",properties:{rawMap:{count:B.length}},children:B.map((f,N)=>({name:"tableColumn",properties:{rawMap:{id:(N+1).toString(),name:gL(Y$(f)),dataCellStyle:"Normal"}}}))},{name:"tableStyleInfo",properties:{rawMap:{name:"TableStyleLight1",showFirstColumn:X?1:0,showLastColumn:Y?1:0,showRowStripes:U?1:0,showColumnStripes:Z?1:0}}}]}}},yL=TL,NG=(G)=>{let[D,z,B,Q]=G;return{name:`a:${D}`,children:[{name:`a:${z}`,properties:{rawMap:{val:B,lastClr:Q}}}]}},xL={getTemplate(){return{name:"a:clrScheme",properties:{rawMap:{name:"Office"}},children:[NG(["dk1","sysClr","windowText","000000"]),NG(["lt1","sysClr","window","FFFFFF"]),NG(["dk2","srgbClr","44546A"]),NG(["lt2","srgbClr","E7E6E6"]),NG(["accent1","srgbClr","4472C4"]),NG(["accent2","srgbClr","ED7D31"]),NG(["accent3","srgbClr","A5A5A5"]),NG(["accent4","srgbClr","FFC000"]),NG(["accent5","srgbClr","5B9BD5"]),NG(["accent6","srgbClr","70AD47"]),NG(["hlink","srgbClr","0563C1"]),NG(["folHlink","srgbClr","954F72"])]}}},cL=xL,C=(G)=>{let[D,z,B,Q]=G;return{name:`a:${D}`,properties:{rawMap:{script:B,typeface:z,panose:Q}}}},hL={getTemplate(){return{name:"a:fontScheme",properties:{rawMap:{name:"Office"}},children:[{name:"a:majorFont",children:[C(["latin","Calibri Light",void 0,"020F0302020204030204"]),C(["ea",""]),C(["cs",""]),C(["font","游ゴシック Light","Jpan"]),C(["font","맑은 고딕","Hang"]),C(["font","等线 Light","Hans"]),C(["font","新細明體","Hant"]),C(["font","Times New Roman","Arab"]),C(["font","Times New Roman","Hebr"]),C(["font","Tahoma","Thai"]),C(["font","Nyala","Ethi"]),C(["font","Vrinda","Beng"]),C(["font","Shruti","Gujr"]),C(["font","MoolBoran","Khmr"]),C(["font","Tunga","Knda"]),C(["font","Raavi","Guru"]),C(["font","Euphemia","Cans"]),C(["font","Plantagenet Cherokee","Cher"]),C(["font","Microsoft Yi Baiti","Yiii"]),C(["font","Microsoft Himalaya","Tibt"]),C(["font","MV Boli","Thaa"]),C(["font","Mangal","Deva"]),C(["font","Gautami","Telu"]),C(["font","Latha","Taml"]),C(["font","Estrangelo Edessa","Syrc"]),C(["font","Kalinga","Orya"]),C(["font","Kartika","Mlym"]),C(["font","DokChampa","Laoo"]),C(["font","Iskoola Pota","Sinh"]),C(["font","Mongolian Baiti","Mong"]),C(["font","Times New Roman","Viet"]),C(["font","Microsoft Uighur","Uigh"]),C(["font","Sylfaen","Geor"]),C(["font","Arial","Armn"]),C(["font","Leelawadee UI","Bugi"]),C(["font","Microsoft JhengHei","Bopo"]),C(["font","Javanese Text","Java"]),C(["font","Segoe UI","Lisu"]),C(["font","Myanmar Text","Mymr"]),C(["font","Ebrima","Nkoo"]),C(["font","Nirmala UI","Olck"]),C(["font","Ebrima","Osma"]),C(["font","Phagspa","Phag"]),C(["font","Estrangelo Edessa","Syrn"]),C(["font","Estrangelo Edessa","Syrj"]),C(["font","Estrangelo Edessa","Syre"]),C(["font","Nirmala UI","Sora"]),C(["font","Microsoft Tai Le","Tale"]),C(["font","Microsoft New Tai Lue","Talu"]),C(["font","Ebrima","Tfng"])]},{name:"a:minorFont",children:[C(["latin","Calibri",void 0,"020F0502020204030204"]),C(["ea",""]),C(["cs",""]),C(["font","游ゴシック","Jpan"]),C(["font","맑은 고딕","Hang"]),C(["font","等线","Hans"]),C(["font","新細明體","Hant"]),C(["font","Arial","Arab"]),C(["font","Arial","Hebr"]),C(["font","Tahoma","Thai"]),C(["font","Nyala","Ethi"]),C(["font","Vrinda","Beng"]),C(["font","Shruti","Gujr"]),C(["font","DaunPenh","Khmr"]),C(["font","Tunga","Knda"]),C(["font","Raavi","Guru"]),C(["font","Euphemia","Cans"]),C(["font","Plantagenet Cherokee","Cher"]),C(["font","Microsoft Yi Baiti","Yiii"]),C(["font","Microsoft Himalaya","Tibt"]),C(["font","MV Boli","Thaa"]),C(["font","Mangal","Deva"]),C(["font","Gautami","Telu"]),C(["font","Latha","Taml"]),C(["font","Estrangelo Edessa","Syrc"]),C(["font","Kalinga","Orya"]),C(["font","Kartika","Mlym"]),C(["font","DokChampa","Laoo"]),C(["font","Iskoola Pota","Sinh"]),C(["font","Mongolian Baiti","Mong"]),C(["font","Arial","Viet"]),C(["font","Microsoft Uighur","Uigh"]),C(["font","Sylfaen","Geor"]),C(["font","Arial","Armn"]),C(["font","Leelawadee UI","Bugi"]),C(["font","Microsoft JhengHei","Bopo"]),C(["font","Javanese Text","Java"]),C(["font","Segoe UI","Lisu"]),C(["font","Myanmar Text","Mymr"]),C(["font","Ebrima","Nkoo"]),C(["font","Nirmala UI","Olck"]),C(["font","Ebrima","Osma"]),C(["font","Phagspa","Phag"]),C(["font","Estrangelo Edessa","Syrn"]),C(["font","Estrangelo Edessa","Syrj"]),C(["font","Estrangelo Edessa","Syre"]),C(["font","Nirmala UI","Sora"]),C(["font","Microsoft Tai Le","Tale"]),C(["font","Microsoft New Tai Lue","Talu"]),C(["font","Ebrima","Tfng"])]}]}}},iL=hL,vG=(G,D,z)=>({name:`a:${G}`,properties:{rawMap:{val:D}},children:z}),JQ=(G)=>{let[D,z,B,Q,J,U]=G,Z=[];if(Z.push(vG("satMod",B)),Q)Z.push(vG("lumMod",Q));if(J)Z.push(vG("tint",J));if(U)Z.push(vG("shade",U));return{name:"a:gs",properties:{rawMap:{pos:D}},children:[{name:"a:schemeClr",properties:{rawMap:{val:z}},children:Z}]}},fB=(G,D)=>({name:"a:solidFill",children:[vG("schemeClr",G,D)]}),T1=(G)=>{let[D,z,B,Q,J]=G,[U,Z]=J;return{name:"a:gradFill",properties:{rawMap:{rotWithShape:D}},children:[{name:"a:gsLst",children:[JQ(z),JQ(B),JQ(Q)]},{name:"a:lin",properties:{rawMap:{ang:U,scaled:Z}}}]}},UQ=(G)=>{let[D,z,B,Q]=G;return{name:"a:ln",properties:{rawMap:{w:D,cap:z,cmpd:B,algn:Q}},children:[fB("phClr"),vG("prstDash","solid"),{name:"a:miter",properties:{rawMap:{lim:"800000"}}}]}},ZQ=(G)=>{let D=[];if(G){let[z,B,Q,J,U]=G;D.push({name:"a:outerShdw",properties:{rawMap:{blurRad:z,dist:B,dir:Q,algn:J,rotWithShape:U}},children:[vG("srgbClr","000000",[vG("alpha","63000")])]})}return{name:"a:effectStyle",children:[Object.assign({},{name:"a:effectLst"},D.length?{children:D}:{})]}},nL=()=>({name:"a:fillStyleLst",children:[fB("phClr"),T1(["1",["0","phClr","105000","110000","67000"],["50000","phClr","103000","105000","73000"],["100000","phClr","109000","105000","81000"],["5400000","0"]]),T1(["1",["0","phClr","103000","102000","94000"],["50000","phClr","110000","100000",void 0,"100000"],["100000","phClr","120000","99000",void 0,"78000"],["5400000","0"]])]}),dL=()=>({name:"a:lnStyleLst",children:[UQ(["6350","flat","sng","ctr"]),UQ(["12700","flat","sng","ctr"]),UQ(["19050","flat","sng","ctr"])]}),lL=()=>({name:"a:effectStyleLst",children:[ZQ(),ZQ(),ZQ(["57150","19050","5400000","ctr","0"])]}),pL=()=>({name:"a:bgFillStyleLst",children:[fB("phClr"),fB("phClr",[vG("tint","95000"),vG("satMod","170000")]),T1(["1",["0","phClr","150000","102000","93000","98000"],["50000","phClr","130000","103000","98000","90000"],["100000","phClr","120000",void 0,void 0,"63000"],["5400000","0"]])]}),mL={getTemplate(){return{name:"a:fmtScheme",properties:{rawMap:{name:"Office"}},children:[nL(),dL(),lL(),pL()]}}},tL=mL,sL={getTemplate(){return{name:"a:themeElements",children:[cL.getTemplate(),iL.getTemplate(),tL.getTemplate()]}}},oL=sL,rL={getTemplate(){return{name:"a:theme",properties:{prefixedAttributes:[{prefix:"xmlns:",map:{a:"http://schemas.openxmlformats.org/drawingml/2006/main"}}],rawMap:{name:"Office Theme"}},children:[oL.getTemplate(),{name:"a:objectDefaults"},{name:"a:extraClrSchemeLst"}]}}},aL=rL,eL=()=>({name:"o:shapelayout",properties:{prefixedAttributes:[{prefix:"v:",map:{ext:"edit"}}]},children:[{name:"o:idmap",properties:{prefixedAttributes:[{prefix:"v:",map:{ext:"edit"}}],rawMap:{data:"1"}}}]}),GS=()=>({name:"v:stroke",properties:{rawMap:{joinstyle:"miter"}}}),DS=(G)=>({name:"v:formulas",children:G.map((D)=>({name:"v:f",properties:{rawMap:{eqn:D}}}))}),zS=()=>({name:"v:path",properties:{prefixedAttributes:[{prefix:"o:",map:{connecttype:"rect",extrusionok:"f"}}],rawMap:{gradientshapeok:"t"}}}),f6=(G)=>{let{aspectratio:D,rotation:z}=G||{},B={};if(D)B.aspectratio="t";if(z)B.rotation="t";return{name:"o:lock",properties:{prefixedAttributes:[{prefix:"v:",map:{ext:"edit"}}],rawMap:B}}};function BS(G,D,z,B,Q){return(G-D)/(z-D)*(Q-B)+B}var QS=(G,D)=>{let z,{recolor:B,brightness:Q,contrast:J,id:U}=G;if(B){if(z={},B==="Washout"||B==="Grayscale")z.gain="19661f",z.blacklevel="22938f";if(B==="Black & White"||B==="Grayscale"){if(z.grayscale="t",B==="Black & White")z.bilevel="t"}}if(!B||B==="Grayscale"){if(!z)z={};if(J!=null&&J!==50){let Z="1";if(J>=0){if(J<50)Z=String(J/50);else if(J<100)Z=String(50/(100-J));else if(J===100)Z="2147483647f"}z.gain=Z}if(Q!=null&&Q!==50)z.blacklevel=BS(Q,0,100,-0.5,0.5).toString()}return{name:"v:imagedata",properties:{prefixedAttributes:[{prefix:"o:",map:{relid:`rId${D}`,title:U}}],rawMap:z}}},JS=()=>{let G=["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:[GS(),DS(G),zS(),f6({aspectratio:!0})]}},$U=(G)=>Math.floor((G??0)*0.74999943307122),US=(G,D)=>{let{width:z=0,height:B=0,altText:Q}=G,J=$U(z),U=$U(B);return{name:"v:shape",properties:{rawMap:{id:G.headerFooterPosition,"o:spid":"_x0000_s1025",style:`position: absolute; margin-left: 0; margin-top: 10in; margin-bottom: 0; margin-right: 0; width: ${J}pt; height: ${U}pt; z-index: ${D+1}`,type:"#_x0000_t75",alt:Q}},children:[QS(G,D+1),f6({rotation:!0})]}},ZS={getTemplate(G){let D=mG.get(G.sheetIndex)||[],z=[eL(),JS(),...D.map((B,Q)=>US(B,Q))];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:z}}},$S=ZS,LS={getTemplate(G,D){let z=(D+1).toString();return{name:"sheet",properties:{rawMap:{name:G,sheetId:z,"r:id":`rId${z}`}}}}},SS=LS,XS={getTemplate(G){return{name:"sheets",children:G.map((D,z)=>SS.getTemplate(D,z))}}},YS=XS,WS={getTemplate(G,D){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:D}}}]},YS.getTemplate(G)]}}},qS=WS,_S=(G)=>Math.ceil((G-12)/7+1),kS={getTemplate(G){let{min:D,max:z,outlineLevel:B,s:Q,width:J,hidden:U,bestFit:Z}=G,S=1,X="0";if(J>1)S=_S(J),X="1";return{name:"col",properties:{rawMap:{min:D,max:z,outlineLevel:B!=null?B:void 0,width:S,style:Q,hidden:U?"1":"0",bestFit:Z?"1":"0",customWidth:X}}}}},wS=kS,KS={getTemplate(G){return{name:"mergeCell",properties:{rawMap:{ref:G}}}}},fS=KS,NS=(G)=>{let D=G.charAt(0).toLowerCase();return D==="s"?"inlineStr":D},FS={getTemplate(G,D,z){let{ref:B,data:Q,styleId:J}=G,{type:U,value:Z}=Q||{type:"empty",value:null},S=U;if(U==="f")S="str";else if(U.charAt(0)===U.charAt(0).toUpperCase())S=NS(U);let X={name:"c",properties:{rawMap:{r:B,t:S==="empty"?void 0:S,s:J?uL(J,z):void 0}}};if(S==="empty")return X;let Y;if(S==="str"&&U==="f")Y=[{name:"f",textNode:LU(kB(Z))}];else if(S==="inlineStr")Y=[{name:"is",children:[{name:"t",textNode:LU(kB(Z))}]}];else Y=[{name:"v",textNode:Z}];return Object.assign({},X,{children:Y})}},ES=FS,IS=(G,D)=>{let z=[],B=0;for(let Q=0;Q=0;Q--){let J=[],U=G[z[Q].pos];for(let Z=1;Z<=U.mergeAcross;Z++)J.push({ref:`${OD(z[Q].excelPos+1+Z)}${D+1}`,styleId:U.styleId,data:{type:"empty",value:null}});if(J.length)G.splice(z[Q].pos+1,0,...J)}},MS=(G)=>G.data?.value!==""||G.styleId!==void 0,AS={getTemplate(G,D,z){let{collapsed:B,hidden:Q,height:J,outlineLevel:U,cells:Z=[]}=G;IS(Z,D);let S=Z.filter(MS).map((X,Y)=>ES.getTemplate(X,Y,z));return{name:"row",properties:{rawMap:{r:D+1,collapsed:B?"1":"0",hidden:Q?"1":"0",ht:J,customHeight:J!=null?"1":"0",spans:"1:1",outlineLevel:U||void 0}},children:S}}},RS=AS,CS=(G,D,z)=>{let B=[],Q=[];G.forEach((Z,S)=>{let X=Z.cells,Y=0,W;X.forEach((q,H)=>{let _=H+Y+1,k=OD(_),w=S+1;if(q.mergeAcross){Y+=q.mergeAcross;let f=OD(H+Y+1);B.push(`${k}${w}:${f}${w}`)}if(!D[_-1])D[_-1]={};let{collapsibleRanges:K}=q;if(K)K.forEach((f)=>{Q.push([_+f[0],_+f[1]])});W=D[_-1],W.min=_,W.max=_,q.ref=`${k}${w}`})}),Q.sort((Z,S)=>{if(Z[0]!==S[0])return Z[0]-S[0];return S[1]-Z[1]});let J=new Map,U=new Map;return Q.filter((Z)=>{let S=Z.toString();if(J.get(S))return!1;return J.set(S,!0),!0}).forEach((Z)=>{let S=D.find((Y)=>Y.min==Z[0]&&Y.max==Z[1]),X=U.get(Z[0]);D.push({min:Z[0],max:Z[1],outlineLevel:z?void 0:X||1,width:(S||{width:100}).width}),U.set(Z[0],(X||0)+1)}),B},VS=(G)=>{if(!G||G!=="Portrait"&&G!=="Landscape")return"portrait";return G.toLocaleLowerCase()},bS=(G)=>{if(G==null)return 1;let z=["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(G);return z===-1?1:z+1},vS=(G)=>{let D={"&[Page]":"&P","&[Pages]":"&N","&[Date]":"&D","&[Time]":"&T","&[Tab]":"&A","&[Path]":"&Z","&[File]":"&F","&[Picture]":"&G"};for(let z of Object.keys(D))G=G.replace(z,D[z]);return G},OS=(G)=>{if(G==="Center")return"C";if(G==="Right")return"R";return"L"},uS=(G,D)=>{if(!D)return G;if(G+="&"",G+=D.fontName||"Calibri",D.bold!==D.italic)G+=D.bold?",Bold":",Italic";else if(D.bold)G+=",Bold Italic";else G+=",Regular";if(G+=""",D.size)G+=`&${D.size}`;if(D.strikeThrough)G+="&S";if(D.underline)G+=`&${D.underline==="Double"?"E":"U"}`;if(D.color)G+=`&K${D.color.replace("#","").toUpperCase()}`;return G},jS=(G,D,z)=>G.reduce((B,Q,J)=>{let U=OS(Q.position),Z=uS(`${B}&${U}`,Q.font),S=["Left","Center","Right"];if(!Q.position)Q.position=S[J];let{image:X}=Q;if(Q.value==="&[Picture]"&&X){let Y=`${U}${D}${z}`;N6(X,Y)}return`${Z}${HS(vS(Q.value))}`},""),PS=(G)=>{let D=["all","first","even"],z=[];return D.forEach((B)=>{let Q=G[B],J=B==="all"?"odd":B;if(!Q)return;for(let U of Object.keys(Q)){let Z=Q[U],S=`${U.charAt(0).toUpperCase()}${U.slice(1)}`,X=U[0].toUpperCase();if(Z){let Y=B==="all"?"":B.toUpperCase();z.push({name:`${J}${S}`,properties:{rawMap:{"xml:space":"preserve"}},textNode:jS(Z,X,Y)})}}}),z},gS=(G)=>{return(D)=>{if(G.length)D.children.push({name:"cols",children:G.map((z)=>wS.getTemplate(z))});return D}},TS=(G,D)=>{return(z)=>{if(G.length)z.children.push({name:"sheetData",children:G.map((B,Q)=>RS.getTemplate(B,Q,D))});return z}},yS=(G)=>{let D=G.length;if(!D)return"";let z=Array(D+1);z[0]=D;for(let Q=1;Q<=D;Q++)z[Q]=G.charCodeAt(Q-1)&255;let B=0;for(let Q=z.length-1;Q>=0;Q--){let J=z[Q],U=(B&16384)===0?0:1,Z=B<<1&32767;B=(U|Z)^J}return(B^52811).toString(16).toUpperCase().padStart(4,"0")},xS=(G)=>{return(D)=>{if(!G)return D;let z=typeof G==="boolean"?{}:G,B={sheet:1},Q=z.password?yS(z.password):"";if(Q)B.password=Q;let J={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(J).forEach((U)=>{let Z=z[U];if(Z==null||Z===J[U])return;B[U]=Z?0:1}),D.children.push({name:"sheetProtection",properties:{rawMap:B}}),D}},cS=(G)=>{return(D)=>{if(G.length)D.children.push({name:"mergeCells",properties:{rawMap:{count:G.length}},children:G.map((z)=>fS.getTemplate(z))});return D}},hS=(G)=>{return(D)=>{let{top:z=0.75,right:B=0.7,bottom:Q=0.75,left:J=0.7,header:U=0.3,footer:Z=0.3}=G;return D.children.push({name:"pageMargins",properties:{rawMap:{bottom:Q,footer:Z,header:U,left:J,right:B,top:z}}}),D}},iS=(G)=>{return(D)=>{if(G)D.children.push({name:"pageSetup",properties:{rawMap:{horizontalDpi:0,verticalDpi:0,orientation:VS(G.orientation),paperSize:bS(G.pageSize)}}});return D}},nS=(G)=>{return(D)=>{if(!G)return D;let z=G.first!=null?1:0,B=G.even!=null?1:0;return D.children.push({name:"headerFooter",properties:{rawMap:{differentFirst:z,differentOddEven:B}},children:PS(G)}),D}},dS=(G)=>{return(D)=>{if(G)D.children.push({name:"tableParts",properties:{rawMap:{count:"1"}},children:[{name:"tablePart",properties:{rawMap:{"r:id":`rId${++D.rIdCounter}`}}}]});return D}},lS=(G)=>{return(D)=>{if(qD.get(G)?.length)D.children.push({name:"drawing",properties:{rawMap:{"r:id":`rId${++D.rIdCounter}`}}});return D}},pS=(G)=>{return(D)=>{if(mG.get(G))D.children.push({name:"legacyDrawingHF",properties:{rawMap:{"r:id":`rId${++D.rIdCounter}`}}});return D}},mS=(G=0,D=0)=>{let z=G>0||D>0;return z?[{name:"pane",properties:{rawMap:{state:z?"frozen":void 0,topLeftCell:z?`${OD(G+1)}${D+1}`:void 0,xSplit:G===0?void 0:G,ySplit:D===0?void 0:D}}}]:void 0},tS=(G=!1,D,z)=>{return(B)=>{return B.children.push({name:"sheetViews",children:[{name:"sheetView",properties:{rawMap:{rightToLeft:G===!0?"1":"0",workbookViewId:"0"}},children:mS(D,z)}]}),B}},sS=()=>{return(G)=>{return G.children.push({name:"sheetPr",children:[{name:"outlinePr",properties:{rawMap:{summaryBelow:0}}}]}),G}},oS=(G)=>{return(D)=>{let z=G.reduce((B,Q)=>{if(Q.outlineLevel&&Q.outlineLevel>B)return Q.outlineLevel;return B},0);return D.children.push({name:"sheetFormatPr",properties:{rawMap:{baseColWidth:10,defaultRowHeight:16,outlineLevelRow:z?z:void 0}}}),D}},rS={getTemplate(G){let{worksheet:D,currentSheet:z,config:B}=G,{margins:Q={},pageSetup:J,headerFooterConfig:U,suppressColumnOutline:Z,rightToLeft:S,frozenRowCount:X,frozenColumnCount:Y,protectSheet:W}=B,{table:q}=D,{rows:H,columns:_}=q,k=_?.length?CS(H,_,!!Z):[],w=uG.get(z),{children:K}=[sS(),tS(S,Y,X),oS(H),gS(_),TS(H,z+1),xS(W),cS(k),hS(Q),iS(J),nS(U),lS(z),pS(z),dS(w)].reduce((f,N)=>N(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:K}}},aS=rS,MD=new Map,KG=[],bD=[],vD=new Map,WD=new Map,qD=new Map,mG=new Map,Qz=new Map,Jz=new Map,uG=new Map,eS="AG-GRID-TABLE",$J="SINGLE_SHEET";function GX(){return $J}function DX(G){$J=G}function zX(G,D,z){ZX(D),jL(G,KG.length);let B=Object.assign({},z);if(z.exportAsExcelTable&&z.pivotModeActive)ZJ(163,{featureName:"pivot mode"}),B.exportAsExcelTable=!1;JX(D,B);let Q=MX(D,B);return AX(Q),Q}function BX(G){return G.replace(/^[^a-zA-Z_]+/,"_").replace(/\s/g,"_").replace(/[^a-zA-Z0-9_]/g,"_")}function QX(G,D){if(uG.has(G)){ZJ(164);return}uG.set(G,D)}function JX(G,D){let{exportAsExcelTable:z,prependContent:B,appendContent:Q,headerRowCount:J=0}=D;if(!z)return;let U=typeof z==="boolean"?{}:z,{name:Z,showColumnStripes:S,showRowStripes:X,showFilterButton:Y,highlightFirstColumn:W,highlightLastColumn:q}=U,H=BX(Z||eS),_=KG.length-1,{table:k}=G,{rows:w,columns:K}=k,f=B?B.length:0,N=Q?Q.length:0,F=w.length,E=K.length,I=[],V=[];for(let A=0;AJ.id===G.id))Q.push(G)}function UX(G,D,z,B,Q){let J=KG.length,{row:U,column:Z}=G.position||{},S=G;if(B){if(D!=null&&z!=null&&(!U||!Z)){if(!G.position)G.position={};G.position=Object.assign({},G.position,{row:D,column:B.indexOf(z)+1})}S$(S,B),X$(S,Q)}F6({imageToAdd:S,idx:J});let X=Jz.get(J);if(!X)X=new Map,Jz.set(J,X);let Y=qD.get(J);if(!Y)qD.set(J,[S]);else Y.push(S);if(!X.get(G.id))X.set(G.id,{index:X.size,type:G.imageType})}function F6(G){let{imageToAdd:D,idx:z}=G,B=WD.get(D.id);if(B){let Q=B.find((J)=>J.sheetId===z);if(Q)Q.image.push(D);else B.push({sheetId:z,image:[D]})}else WD.set(D.id,[{sheetId:z,image:[D]}]),Qz.set(D.id,{type:D.imageType,index:Qz.size})}function ZX(G){let D=H$(G.name)||"",z="";while(KG.indexOf(`${D}${z}`)!==-1)if(z==="")z="_1";else z=`_${parseInt(z.slice(1),10)+1}`;G.name=`${D}${z}`,KG.push(G.name)}function $X(G){if(MD.has(G))return MD.get(G);return MD.set(G,MD.size),MD.size-1}function LX(){MD.clear(),WD.clear(),qD.clear(),mG.clear(),Qz.clear(),Jz.clear(),uG.clear(),KG=[],bD=[],vD=new Map,$J="SINGLE_SHEET"}function SX(G){return SG(qS.getTemplate(KG,G))}function XX(G){return SG(PL.getTemplate(G))}function YX(){return SG(x$.getTemplate(MD))}function WX(G){return SG(N$.getTemplate(G))}function qX(G){return SG(M$.getTemplate(G))}function HX(G,D){return SG(K$.getTemplate({sheetLen:G,hasCustomProperties:D}))}function _X(G){let D=[{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(G)D.push({Id:"rId3",Type:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/custom-properties",Target:"docProps/custom.xml"});let z=Y0.getTemplate(D);return SG(z)}function kX(){return SG(aL.getTemplate())}function wX(G,D){return SG(yL.getTemplate(G,D))}function KX(G){let D=Array(G).fill(void 0).map((B,Q)=>({Id:`rId${Q+1}`,Type:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet",Target:`worksheets/sheet${Q+1}.xml`})),z=Y0.getTemplate([...D,{Id:`rId${G+1}`,Type:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme",Target:"theme/theme1.xml"},{Id:`rId${G+2}`,Type:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles",Target:"styles.xml"},{Id:`rId${G+3}`,Type:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/sharedStrings",Target:"sharedStrings.xml"}]);return SG(z)}function fX(G){return SG(j$.getTemplate({sheetIndex:G}))}function NX(G){let D=Jz.get(G)||[],z=[];for(let[B,Q]of D){let{index:J,type:U}=Q;z.push({Id:`rId${J+1}`,Type:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/image",Target:`../media/image${Qz.get(B).index+1}.${vB(U)}`})}return SG(Y0.getTemplate(z))}function FX(G){return SG($S.getTemplate({sheetIndex:G}),!0)}function EX(G){let D=mG.get(G)||[],z=[];for(let B=0;B{if(!G.size)return;let z=new Map;D.forEach((B,Q)=>{if(G.has(B))z.set(Q,G.get(B))}),G.clear(),z.forEach((B,Q)=>G.set(Q,B))},AX=(G)=>{let D=vD.get(G)??[];D.push(KG.length-1),vD.set(G,D),bD.push(G)},RX=(G)=>{let D=new Map(vD),z=[];for(let B of G){let Q=D.get(B);if(!Q?.length)return null;let J=Q.shift();z.push(J),D.set(B,Q)}return z},CX=(G)=>{if(!G.length||bD.length===0)return null;let D=new Set,z=[];for(let B of G){let Q=bD.findIndex((J,U)=>!D.has(U)&&J===B);if(Q===-1)return null;D.add(Q),z.push(Q)}return z},VX=(G)=>{let D=new Map;G.forEach((z,B)=>D.set(z,B)),KG=G.map((z)=>KG[z]),bD=G.map((z)=>bD[z]),N0(qD,G),N0(mG,G),N0(uG,G),N0(Jz,G),WD.forEach((z)=>{z.forEach((B)=>{let Q=D.get(B.sheetId);if(Q!=null)B.sheetId=Q})}),vD=new Map,bD.forEach((z,B)=>{let Q=vD.get(z)??[];Q.push(B),vD.set(z,Q)})},bX=(G)=>{if(G.length<=1)return;let D=RX(G)??CX(G);if(!D)return;VX(D)},OB=class{getStringPosition(G){return $X(G)}addBodyImageToMap(G,D,z,B,Q){UX(G,D,z,B,Q)}addHeaderFooterImageToMap(G,D){N6(G,D)}addWorksheet(G,D,z){return zX(G,D,z)}syncOrderWithSheetData(G){bX(G)}reset(){LX()}setFactoryMode(G){DX(G)}getFactoryMode(){return GX()}getSheetNames(){return[...KG]}},OX=async(G)=>{let D=0,z=[],B=new WritableStream({write:(U)=>{z.push(U),D+=U.length}}),Q=new ReadableStream({start:(U)=>{let Z=new FileReader;Z.onload=(S)=>{if(S.target?.result)U.enqueue(S.target.result);U.close()},Z.readAsArrayBuffer(G)}}),J=new window.CompressionStream("deflate-raw");return await Q.pipeThrough(J).pipeTo(B),{size:D,content:new Blob(z)}},uX=async(G)=>{let D=new Blob([G]),{size:z,content:B}=await OX(D),Q=new Uint8Array(await B.arrayBuffer());return{size:z,content:Q}},jX=(G)=>{let D=G.getHours();return D<<=6,D=D|G.getMinutes(),D<<=5,D=D|G.getSeconds()/2,D},PX=(G)=>{let D=G.getFullYear()-1980;return D<<=4,D=D|G.getMonth()+1,D<<=5,D=D|G.getDate(),D};function LG(G,D){let z="";for(let B=0;B>>=8;return z}var SU=(G)=>{if(!G.length)return 0;let D=-1,z=0,B=0,Q=0;for(let J=0;J>>8^Q;return D^-1},XU=(G)=>{if(!G.length)return 0;if(typeof G==="string")return SU(new TextEncoder().encode(G));return SU(G)},gX=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 TX(G){let D=String.fromCharCode;function z(W){let q=[];if(!W)return[];let H=W.length,_=0,k,w;while(_=55296&&k<=56319&&_=55296&&W<=57343)throw Error(vX(255,{point:W}))}function Q(W,q){return D(W>>q&63|128)}function J(W){if((W&4294967168)==0)return D(W);let q="";if((W&4294965248)==0)q=D(W>>6&31|192);else if((W&4294901760)==0)B(W),q=D(W>>12&15|224),q+=Q(W,6);else if((W&4292870144)==0)q=D(W>>18&7|240),q+=Q(W,12),q+=Q(W,6);return q+=D(W&63|128),q}let U=z(G),Z=U.length,S=-1,X,Y="";while(++S{let{content:U,path:Z,created:S}=G,X=jX(S),Y=PX(S),W=XU(Q),q=J!==void 0?J:B,H=TX(Z),_=H!==Z,k="";if(_){let N=LG(1,1)+LG(XU(H),4)+H;k="up"+LG(N.length,2)+N}let w="\x14\x00"+(_?"\x00\b":"\x00\x00")+LG(D?8:0,2)+LG(X,2)+LG(Y,2)+LG(q?W:0,4)+LG(J??B,4)+LG(B,4)+LG(H.length,2)+LG(k.length,2),K="PK\x03\x04"+w+H+k,f="PK\x01\x02\x14\x00"+w+"\x00\x00\x00\x00\x00\x00"+(U?"\x00\x00\x00\x00":"\x10\x00\x00\x00")+LG(z,4)+H+k;return{localFileHeader:Uint8Array.from(K,(N)=>N.charCodeAt(0)),centralDirectoryHeader:Uint8Array.from(f,(N)=>N.charCodeAt(0))}},I6=(G)=>{let D;if(typeof G==="string"){let z=atob(G.split(";base64,")[1]);D=Uint8Array.from(z,(B)=>B.charCodeAt(0))}else D=G;return{size:D.length,content:D}},yX=async(G)=>{let{content:D}=G,{size:z,content:B}=!D?{size:0,content:Uint8Array.from([])}:I6(D),Q,J,U=!1;if(G.type==="file"&&B&&z>0){let S=await uX(B);Q=S.content,J=S.size,U=!0}return{rawContent:B,rawSize:z,deflatedContent:Q,deflatedSize:J,isCompressed:U}},xX=(G,D)=>{let{content:z}=G,{content:B}=!z?{content:Uint8Array.from([])}:I6(z);return{...E6(G,!1,D,B.length,B,void 0),content:B,isCompressed:!1}},cX=(G,D,z)=>{let B="PK\x05\x06\x00\x00\x00\x00"+LG(G,2)+LG(G,2)+LG(D,4)+LG(z,4)+"\x00\x00";return Uint8Array.from(B,(Q)=>Q.charCodeAt(0))},M6=class{constructor(){this.folders=[],this.files=[]}addFolders(G){G.forEach(this.addFolder.bind(this))}addFolder(G){this.folders.push({path:G,created:new Date,isBase64:!1,type:"folder"})}addFile(G,D,z=!1){this.files.push({path:G,created:new Date,content:z?D:new TextEncoder().encode(D),isBase64:z,type:"file"})}async getZipFile(G="application/zip"){let D=await this.buildCompressedFileStream();return this.clearStream(),new Blob([D],{type:G})}getUncompressedZipFile(G="application/zip"){let D=this.buildFileStream();return this.clearStream(),new Blob([D],{type:G})}clearStream(){this.folders=[],this.files=[]}packageFiles(G){let D=0,z=0;for(let X of G){let{localFileHeader:Y,centralDirectoryHeader:W,content:q}=X;D+=Y.length+q.length,z+=W.length}let B=new Uint8Array(D),Q=new Uint8Array(z),J=0,U=0;for(let X of G){let{localFileHeader:Y,centralDirectoryHeader:W,content:q}=X;B.set(Y,J),J+=Y.length,B.set(q,J),J+=q.length,Q.set(W,U),U+=W.length}let Z=cX(G.length,z,D),S=new Uint8Array(B.length+Q.length+Z.length);return S.set(B),S.set(Q,B.length),S.set(Z,B.length+Q.length),S}async buildCompressedFileStream(){let G=[...this.folders,...this.files],D=await Promise.all(G.map(yX)),z=[],B=0;for(let Q=0;Q{if(G.addFolders(["_rels/","docProps/","xl/","xl/theme/","xl/_rels/","xl/worksheets/"]),!WD.size)return;G.addFolders(["xl/worksheets/_rels","xl/drawings/","xl/drawings/_rels","xl/media/"]);let D=0;WD.forEach((z)=>{let B=z[0].image[0],{base64:Q,imageType:J}=B;G.addFile(`xl/media/image${++D}.${vB(J)}`,Q,!0)})},iX=(G,D)=>{let z=0,B=0;for(let Q=0;Q0&&qD.has(Q),Z=uG.size>0&&uG.get(Q),S=WD.size&&mG.has(Q);if(!U&&!Z&&!S)continue;let X,Y,W;if(U)nX(G,Q,z),Y=z,z++;if(S)dX(G,Q,B),W=B,B++;if(Z)X=Z.name;let q=`xl/worksheets/_rels/sheet${Q+1}.xml.rels`;G.addFile(q,IX({tableName:X,drawingIndex:Y,vmlDrawingIndex:W}))}},nX=(G,D,z)=>{let Q=`xl/drawings/drawing${z+1}.xml`,J=`xl/drawings/_rels/drawing${z+1}.xml.rels`;G.addFile(J,NX(D)),G.addFile(Q,fX(D))},dX=(G,D,z)=>{let Q=`xl/drawings/vmlDrawing${z+1}.vml`,J=`xl/drawings/_rels/vmlDrawing${z+1}.vml.rels`;G.addFile(Q,FX(D)),G.addFile(J,EX(D))},lX=(G)=>{let D=uG,z=Array.from(D.keys());for(let B=0;B{let U=!!J&&Object.keys(J).some((Z)=>J[Z]!=null);if(G.addFile("xl/workbook.xml",SX(Q)),G.addFile("xl/styles.xml",XX(D)),G.addFile("xl/sharedStrings.xml",YX()),G.addFile("xl/theme/theme1.xml",kX()),G.addFile("xl/_rels/workbook.xml.rels",KX(B)),G.addFile("docProps/core.xml",WX(z)),U)G.addFile("docProps/custom.xml",qX(J));G.addFile("[Content_Types].xml",HX(B,U)),G.addFile("_rels/.rels",_X(U))},A6=(G,D,z={},B)=>{if(!D||D.length===0)return W6(159),B.reset(),!1;B.syncOrderWithSheetData(D);let{fontSize:Q=11,author:J="AG Grid",activeTab:U=0,customMetadata:Z}=z,S=D.length,X=Math.max(Math.min(U,S-1),0);return hX(G),lX(G),iX(G,D),pX(G,Q,J,S,X,Z),B.reset(),!0},y1=(G,D=new OB)=>{let{data:z,fontSize:B,author:Q,activeSheetIndex:J,customMetadata:U}=G,Z=G.mimeType||"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",S=new M6;if(!A6(S,z,{author:Q,fontSize:B,activeTab:J,customMetadata:U},D))return Promise.resolve(void 0);return S.getZipFile(Z)},x1=(G,D=new OB)=>{let{data:z,fontSize:B,author:Q,activeSheetIndex:J,customMetadata:U}=G,Z=G.mimeType||"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",S=new M6;if(!A6(S,z,{author:Q,fontSize:B,activeTab:J,customMetadata:U},D))return;return S.getUncompressedZipFile(Z)},mX=(G)=>{let{fileName:D="export.xlsx"}=G,z=new OB;y1(G,z).then((B)=>{if(B){let Q=typeof D==="function"?D():D;P1(Q,B)}})},tX=class extends r9{constructor(){super(...arguments);this.beanName="excelCreator",this.workbook=new OB}getMergedParams(G){let D=this.gos.get("defaultExcelExportParams");return Object.assign({},D,G)}export(G){if(this.isExportSuppressed()){W6(160);return}let D=()=>{let B=this.getMergedParams(G),Q=this.getData(B),{fontSize:J,author:U,mimeType:Z,customMetadata:S}=B,X={data:[Q],fontSize:J,author:U,mimeType:Z,customMetadata:S};this.packageCompressedFile(X).then((Y)=>{if(Y){let{fileName:W}=B,q=typeof W==="function"?W(zU(this.gos,{})):W;P1(this.getFileName(q),Y)}})},{overlays:z}=this.beans;if(z)z.showExportOverlay(D);else D()}exportDataAsExcel(G){this.export(G)}getDataAsExcel(G){let D=this.getMergedParams(G),z=this.getData(D),{fontSize:B,author:Q,mimeType:J,customMetadata:U}=D,Z={data:[z],fontSize:B,author:Q,mimeType:J,customMetadata:U};return this.packageFile(Z)}setFactoryMode(G){this.workbook.setFactoryMode(G)}getFactoryMode(){return this.workbook.getFactoryMode()}getSheetDataForExcel(G){let D=this.getMergedParams(G);return this.getData(D)}getMultipleSheetsAsExcel(G){return x1(G,this.workbook)}exportMultipleSheetsAsExcel(G){y1(G,this.workbook).then((D)=>{let{fileName:z="export.xlsx"}=G;if(D){let B=typeof z==="function"?z():z;P1(B,D)}})}getDefaultFileExtension(){return"xlsx"}createSerializingSession(G){let{colModel:D,colNames:z,rowGroupColsSvc:B,valueSvc:Q,formula:J,gos:U}=this.beans,Z=U.get("excelStyles")||[],S=this.createStyleLinker(Z),X={...G,colModel:D,colNames:z,rowGroupColsSvc:B,valueSvc:Q,formulaSvc:J,gos:U,suppressRowOutline:G.suppressRowOutline||G.skipRowGroups,headerRowHeight:G.headerRowHeight||G.rowHeight,baseExcelStyles:Z,rightToLeft:G.rightToLeft??U.get("enableRtl"),styleLinker:S,headerRowCount:e9(D),pivotModeActive:D.isPivotActive(),workbook:this.workbook};return new q$(X)}createStyleLinker(G){let D=[],z=new Set,B=new Map;G.forEach((U,Z)=>{D.push(U.id),z.add(U.id),B.set(U.id,Z)});let{gos:Q,cellStyles:J}=this.beans;return(U)=>{let{rowType:Z,rowIndex:S,value:X,column:Y,columnGroup:W,node:q}=U,H=Z==="HEADER",_=Z==="HEADER_GROUPING",k=H?Y:W,w=[];if(H||_){if(w.push("header"),_)w.push("headerGroup");if(k)w=w.concat(a9(k.getDefinition(),Q,Y||null,W||null));return w}let K=["cell"];if(!D.length)return K;let f=Y.getDefinition();return J?.processAllCellClasses(f,zU(Q,{value:X,data:q.data,node:q,colDef:f,column:Y,rowIndex:S}),(N)=>{if(z.has(N))K.push(N)}),K.sort((N,F)=>{let E=B.get(N)??-1,I=B.get(F)??-1;return E===I?0:Ethis.onFocusIn(G),onFocusOut:(G)=>this.onFocusOut(G),focusInnerElement:(G)=>this.focusInnerElement(G),onTabKeyDown:(G)=>this.onTabKeyDown(G),handleKeyDown:(G)=>this.handleKeyDown(G)},this.stopPropagationCallbacks),this.refreshAriaProperties(),this.addManagedEventListeners({stylesChanged:this.onStylesChanged.bind(this)})}onStylesChanged(G){if(G.listItemHeightChanged)this.rowHeight=this.getItemHeight(),this.refresh()}refreshAriaProperties(){let D=this.getLocaleTextFunc()("ariaDefaultListName",this.listName||"List"),z=this.eContainer;zY(z,this.model?.getRowCount()>0?this.ariaRole:"presentation"),GY(z,D)}addResizeObserver(){let G=()=>YU(this.beans,()=>this.drawVirtualRows()),D=eX(this.beans,this.getGui(),G);this.addDestroyFunc(D)}focusInnerElement(G){return this.focusRow(G?this.model.getRowCount()-1:0),!0}onFocusIn(G){let D=G.target;if(D.classList.contains("ag-virtual-list-item"))this.lastFocusedRowIndex=aX(D)-1}onFocusOut(G){if(!this.getFocusableElement().contains(G.relatedTarget))this.lastFocusedRowIndex=null}handleKeyDown(G){let{key:D,shiftKey:z}=G;switch(D){case MG.UP:case MG.DOWN:{let B=D===MG.UP;if(G.preventDefault(),z)this.moveItem(B);else this.navigate(B)}break;case MG.PAGE_HOME:case MG.PAGE_END:case MG.PAGE_UP:case MG.PAGE_DOWN:if(this.navigateToPage(D)!==null)G.preventDefault();break}}onTabKeyDown(G){this.stopPropagationCallbacks?.stopPropagation(G),this.forceFocusOutOfContainer(G.shiftKey)}getNextRow(G){if(this.lastFocusedRowIndex==null)return;let D=this.lastFocusedRowIndex+(G?-1:1);if(D<0||D>=this.model.getRowCount())return;return D}moveItem(G){if(!this.moveItemCallback)return;let D=this.getComponentAt(this.lastFocusedRowIndex);if(!D)return;this.moveItemCallback(D,G)}navigate(G){let D=this.getNextRow(G);if(D===void 0)return;this.focusRow(D)}navigateToPage(G,D="focused"){let z=!1;if(D==="focused")D=this.getLastFocusedRow(),z=!0;let B=this.model.getRowCount()-1,Q=-1;if(G===MG.PAGE_HOME)Q=0;else if(G===MG.PAGE_END)Q=B;else if(G===MG.PAGE_DOWN)Q=Math.min(D+this.pageSize,B);else if(G===MG.PAGE_UP)Q=Math.max(D-this.pageSize,0);if(Q===-1)return null;if(z)this.focusRow(Q);else this.ensureIndexVisible(Q);return Q}getLastFocusedRow(){return this.lastFocusedRowIndex}focusRow(G){if(this.isScrolling)return;this.isScrolling=!0,this.ensureIndexVisible(G),YU(this.beans,()=>{if(this.isScrolling=!1,!this.isAlive())return;let D=this.renderedRows.get(G);if(D)D.eDiv.focus()})}getComponentAt(G){let D=this.renderedRows.get(G);return D&&D.rowComponent}forEachRenderedRow(G){this.renderedRows.forEach((D,z)=>G(D.rowComponent,z))}getItemHeight(){if(!this.isHeightFromTheme)return this.rowHeight;return this.beans.environment.getDefaultListItemHeight()}ensureIndexVisible(G,D=!0){let z=this.model.getRowCount();if(typeof G!=="number"||G<0||G>=z)return!1;let B=G*this.rowHeight,Q=B+this.rowHeight,J=this.getGui(),U=J.scrollTop,Z=J.offsetHeight,S=U+Z,X=D?0:this.rowHeight,Y=U>B+X,W=S{if(!this.isAlive())return;if(this.canSoftRefresh(G))this.drawVirtualRows(!0);else this.clearVirtualRows(),this.drawVirtualRows()})}awaitStable(G){if(this.awaitStableCallbacks.push(G),this.awaitStableCallbacks.length>1)return;let D=this.model.getRowCount();QY(this,()=>this.eContainer.clientHeight>=D*this.rowHeight,()=>{if(!this.isAlive())return;let z=this.awaitStableCallbacks;this.awaitStableCallbacks=[];for(let B of z)B()})}canSoftRefresh(G){return!!(G&&this.renderedRows.size&&typeof this.model.areRowsEqual==="function"&&this.componentUpdater)}clearVirtualRows(){this.renderedRows.forEach((G,D)=>this.removeRow(D))}drawVirtualRows(G){if(!this.isAlive()||!this.model)return;let D=this.getGui(),z=D.scrollTop,B=z+D.offsetHeight;if(z===B)this.clearVirtualRows();else{let Q=Math.floor(z/this.rowHeight),J=Math.floor(B/this.rowHeight);this.pageSize=Math.floor((B-z)/this.rowHeight),this.ensureRowsRendered(Q,J,G)}}ensureRowsRendered(G,D,z){if(this.renderedRows.forEach((B,Q)=>{if((QD)&&Q!==this.lastFocusedRowIndex)this.removeRow(Q)}),z)this.refreshRows();for(let B=G;B<=D;B++){if(this.renderedRows.has(B))continue;if(B=D.getRowCount())return;let{cssIdentifier:z,ariaRole:B,renderedRows:Q,eContainer:J}=this,U=D.getRow(G),Z=B==="tree"?"treeitem":"option",S=rX({tag:"div",cls:`ag-virtual-list-item ag-${z}-virtual-list-item`,role:Z,attrs:{tabindex:"-1"}});BY(S,D.getRowCount()),DY(S,G+1);let X=this.rowHeight;S.style.height=`${X}px`,S.style.top=`${X*G}px`;let Y=this.componentCreator(U,S);if(Y.addGuiEventListener("focusin",()=>this.lastFocusedRowIndex=G),S.appendChild(Y.getGui()),Q.has(G-1))Q.get(G-1).eDiv.insertAdjacentElement("afterend",S);else if(Q.has(G+1))Q.get(G+1).eDiv.insertAdjacentElement("beforebegin",S);else J.appendChild(S);Q.set(G,{rowComponent:Y,eDiv:S,value:U})}removeRow(G){let D=this.renderedRows.get(G);D.eDiv.remove(),this.destroyBean(D.rowComponent),this.renderedRows.delete(G)}refreshRows(){let G=this.model.getRowCount();this.renderedRows.forEach((D,z)=>{if(z>=G)this.removeRow(z);else{let B=this.model.getRow(z);if(this.model.areRowsEqual?.(D.value,B))this.componentUpdater(B,D.rowComponent);else this.removeRow(z)}})}addScrollListener(){this.addGuiEventListener("scroll",()=>this.drawVirtualRows(),{passive:!0})}setModel(G){this.model=G}getAriaElement(){return this.eContainer}destroy(){if(!this.isAlive())return;this.clearVirtualRows(),this.awaitStableCallbacks.length=0,super.destroy()}},LY='.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}',$Q="ag-list-item-hovered",C6=class extends $Y{constructor(G,D,z){super();this.comp=G,this.virtualList=D,this.params=z,this.currentDragValue=null,this.lastHoveredListItem=null}postConstruct(){this.beans.environment.addGlobalCSS(LY,"component-AgVirtualListDragFeature"),this.params.addListeners(this,this.listItemDragStart.bind(this),this.listItemDragEnd.bind(this)),this.createDropTarget(),this.createAutoScrollService()}listItemDragStart(G){this.currentDragValue=this.params.getCurrentDragValue(G),this.moveBlocked=this.params.isMoveBlocked(this.currentDragValue)}listItemDragEnd(){window.setTimeout(()=>{this.currentDragValue=null,this.moveBlocked=!1},10)}createDropTarget(){let G={isInterestedIn:(D)=>D===this.params.dragSourceType,getIconName:()=>this.moveBlocked?"pinned":"move",getContainer:()=>this.comp.getGui(),onDragging:(D)=>this.onDragging(D),onDragStop:()=>this.onDragStop(),onDragLeave:()=>this.onDragLeave(),onDragCancel:()=>this.onDragCancel()};this.beans.dragAndDrop?.addDropTarget(G)}createAutoScrollService(){let G=this.virtualList.getGui();this.autoScrollService=new ZY({scrollContainer:G,scrollAxis:"y",getVerticalPosition:()=>G.scrollTop,setVerticalPosition:(D)=>G.scrollTop=D})}onDragging(G){if(!this.currentDragValue||this.moveBlocked)return;let D=this.getListDragItem(G),z=this.virtualList.getComponentAt(D.rowIndex);if(!z)return;let B=z.getGui().parentElement;if(this.lastHoveredListItem&&this.lastHoveredListItem.rowIndex===D.rowIndex&&this.lastHoveredListItem.position===D.position)return;this.autoScrollService.check(G.event),this.clearHoveredItems(),this.lastHoveredListItem=D,WU(B,$Q),WU(B,`ag-item-highlight-${D.position}`)}getListDragItem(G){let D=this.virtualList.getGui(),z=Number.parseFloat(window.getComputedStyle(D).paddingTop),B=this.virtualList.getRowHeight(),Q=this.virtualList.getScrollTop(),J=Math.max(0,(G.y-z+Q)/B),U=this.params.getNumRows(this.comp)-1,Z=Math.min(U,J)|0;return{rowIndex:Z,position:Math.round(J)>J||J>U?"bottom":"top",component:this.virtualList.getComponentAt(Z)}}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 G=this.virtualList.getGui();for(let D of G.querySelectorAll(`.${$Q}`))for(let z of[$Q,"ag-item-highlight-top","ag-item-highlight-bottom"])D.classList.remove(z);this.lastHoveredListItem=null}},V6=class extends YY{constructor(G){super(G,"ag-range-field","range")}postConstruct(){super.postConstruct();let{min:G,max:D,step:z}=this.config;if(G!=null)this.setMinValue(G);if(D!=null)this.setMaxValue(D);this.setStep(z||1)}addInputListeners(){this.addManagedElementListeners(this.eInput,{input:(G)=>{let D=G.target.value;this.setValue(D)}})}setMinValue(G){return this.min=G,this.eInput.setAttribute("min",G.toString()),this}setMaxValue(G){return this.max=G,this.eInput.setAttribute("max",G.toString()),this}setStep(G){return this.eInput.setAttribute("step",G.toString()),this}setValue(G,D){if(this.min!=null)G=Math.max(parseFloat(G),this.min).toString();if(this.max!=null)G=Math.min(parseFloat(G),this.max).toString();let z=super.setValue(G,D);return this.eInput.value=G,z}},b6={selector:"AG-INPUT-RANGE",component:V6},kG=class extends SY{constructor(G){super(G,`
- -
- - -
-
`,[b6,XY]);this.eLabel=LQ,this.eSlider=LQ,this.eText=LQ,this.labelAlignment="top"}postConstruct(){super.postConstruct(),this.eSlider.addCss("ag-slider-field");let{minValue:G,maxValue:D,textFieldWidth:z,step:B,value:Q,onValueChange:J}=this.config;if(G!=null)this.setMinValue(G);if(D!=null)this.setMaxValue(D);if(z!=null)this.setTextFieldWidth(z);if(B!=null)this.setStep(B);if(Q!=null)this.setValue(Q);if(J!=null)this.onValueChange(J)}onValueChange(G){return this.addManagedListeners(this.eText,{fieldValueChanged:()=>{let D=parseFloat(this.eText.getValue());this.eSlider.setValue(D.toString(),!0),G(D||0)}}),this.addManagedListeners(this.eSlider,{fieldValueChanged:()=>{let D=this.eSlider.getValue();this.eText.setValue(D,!0),G(parseFloat(D))}}),this}setSliderWidth(G){return this.eSlider.setWidth(G),this}setTextFieldWidth(G){return this.eText.setWidth(G),this}setMinValue(G){return this.eSlider.setMinValue(G),this.eText.setMin(G),this}setMaxValue(G){return this.eSlider.setMaxValue(G),this.eText.setMax(G),this}getValue(){return this.eText.getValue()}setValue(G,D){if(this.getValue()===G)return this;if(this.eText.setValue(G,!0),this.eSlider.setValue(G,!0),!D)this.dispatchLocalEvent({type:"fieldValueChanged"});return this}setStep(G){return this.eSlider.setStep(G),this.eText.setStep(G),this}},WG={selector:"AG-SLIDER",component:kG},KY=class extends kY{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=wY}wireBeans(G){this.color=G.agChartsExports._Util.Color}setColor(G){let D=G.toRgbaString();this.setValue(this.color.fromString(D).toHexString().toUpperCase(),!0),this.eColor.style.backgroundColor=D}setValue(G,D){let z=this.color.validColorString(G??"");if(this.eInput.setCustomValidity(z?"":this.getLocaleTextFunc()("invalidColor","Color value is invalid")),super.setValue(G,D),z&&!D)this.dispatchLocalEvent({type:"colorChanged"});return this}onColorChanged(G){this.addManagedListeners(this,{colorChanged:()=>G(this.color.fromString(this.value))})}},fY={selector:"AG-COLOR-INPUT",component:KY},HU=8,F0=[],NY=class extends qY{constructor(G){super(`
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- -
-
-
`,[fY]);this.H=1,this.S=1,this.B=1,this.A=1,this.isSpectrumDragging=!1,this.isSpectrumHueDragging=!1,this.isSpectrumAlphaDragging=!1,this.colorChanged=!1,this.spectrumColor=cG,this.spectrumVal=cG,this.spectrumDragger=cG,this.spectrumHue=cG,this.spectrumHueSlider=cG,this.spectrumAlpha=cG,this.spectrumAlphaSlider=cG,this.colorInput=cG,this.recentColors=cG,this.picker=G.picker}wireBeans(G){this._Color=G.agChartsExports._Util.Color}postConstruct(){this.initTabIndex(),this.initRecentColors(),this.addGuiEventListener("focus",()=>this.spectrumColor.focus()),this.addGuiEventListener("keydown",(G)=>{if(G.key===xG.ENTER&&!G.defaultPrevented)this.destroy()}),this.addManagedListeners(this.spectrumColor,{keydown:(G)=>this.moveDragger(G)}),this.addManagedListeners(this.spectrumAlphaSlider,{keydown:(G)=>this.moveAlphaSlider(G)}),this.addManagedListeners(this.spectrumHueSlider,{keydown:(G)=>this.moveHueSlider(G)}),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",(G)=>{this.onSpectrumDraggerMove(G),this.onSpectrumHueMove(G),this.onSpectrumAlphaMove(G)}),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:(G)=>{if(G.key===xG.ENTER||G.key===xG.SPACE)G.preventDefault(),this.onRecentColorClick(G)}})}initTabIndex(){let G=this.tabIndex=this.gos.get("tabIndex").toString();this.spectrumColor.setAttribute("tabindex",G),this.spectrumHueSlider.setAttribute("tabindex",G),this.spectrumAlphaSlider.setAttribute("tabindex",G)}refreshSpectrumRect(){return this.spectrumValRect=this.spectrumVal.getBoundingClientRect()}refreshHueRect(){return this.spectrumHueRect=this.spectrumHue.getBoundingClientRect()}refreshAlphaRect(){return this.spectrumAlphaRect=this.spectrumAlpha.getBoundingClientRect()}onSpectrumDraggerDown(G){G.preventDefault(),this.refreshSpectrumRect(),this.isSpectrumDragging=!0,this.moveDragger(G)}onSpectrumDraggerMove(G){if(this.isSpectrumDragging)this.moveDragger(G)}onSpectrumHueDown(G){this.refreshHueRect(),this.isSpectrumHueDragging=!0,this.moveHueSlider(G)}onSpectrumHueMove(G){if(this.isSpectrumHueDragging)this.moveHueSlider(G)}onSpectrumAlphaDown(G){this.refreshAlphaRect(),this.isSpectrumAlphaDragging=!0,this.moveAlphaSlider(G)}onSpectrumAlphaMove(G){if(this.isSpectrumAlphaDragging)this.moveAlphaSlider(G)}onMouseUp(){this.isSpectrumDragging=!1,this.isSpectrumHueDragging=!1,this.isSpectrumAlphaDragging=!1}moveDragger(G){let D=this.spectrumValRect;if(!D)return;let z,B;if(G instanceof MouseEvent)z=G.clientX-D.left,B=G.clientY-D.top;else{let Q=G.key===xG.LEFT,J=G.key===xG.RIGHT,U=G.key===xG.UP,Z=G.key===xG.DOWN,S=U||Z,X=Q||J;if(!S&&!X)return;G.preventDefault();let{x:Y,y:W}=this.getSpectrumValue();z=Y+(X?Q?-5:5:0),B=W+(S?U?-5:5:0)}z=Math.max(z,0),z=Math.min(z,D.width),B=Math.max(B,0),B=Math.min(B,D.height),this.setSpectrumValue(z/D.width,1-B/D.height)}moveHueSlider(G){let D=this.spectrumHueRect;if(!D)return;let z=this.moveSlider(this.spectrumHueSlider,G);if(z==null)return;this.H=1-z/D.width,this.update()}moveAlphaSlider(G){let D=this.spectrumAlphaRect;if(!D)return;let z=this.moveSlider(this.spectrumAlphaSlider,G);if(z==null)return;this.A=z/D.width,this.update()}moveSlider(G,D){let z=G.getBoundingClientRect(),B=G.parentElement?.getBoundingClientRect();if(!G||!B)return null;let Q=z.width/2,J;if(D instanceof MouseEvent)J=Math.floor(D.clientX-B.left);else{let U=D.key===xG.LEFT,Z=D.key===xG.RIGHT;if(!U&&!Z)return null;D.preventDefault();let S=U?-5:5;J=parseFloat(G.style.left)+Q+S}return J=Math.max(J,0),J=Math.min(J,B.width),G.style.left=J-Q+"px",J}update(G){let{A:D,S:z,B,H:Q,_Color:J}=this,U=Q*360,Z=J.fromHSB(U,z,B,D),S=Z.toRgbaString(),Y=J.fromHSB(U,z,B).toRgbaString(),q=J.fromHSB(U,1,1).toRgbaString(),H=this.picker;if(J.fromString(H.getValue()).toRgbaString()!==S)this.colorChanged=!0;if(H.setValue(S),this.spectrumColor.style.backgroundColor=q,this.spectrumDragger.style.backgroundColor=Y,this.spectrumHueSlider.style.backgroundColor=q,this.spectrumAlpha.style.setProperty("--ag-internal-spectrum-alpha-color-from",J.fromHSB(U,z,B,0).toRgbaString()),this.spectrumAlpha.style.setProperty("--ag-internal-spectrum-alpha-color-to",Y),this.spectrumAlpha.style.setProperty("--ag-internal-spectrum-alpha-color",S),!G)this.colorInput.setColor(Z)}setSpectrumValue(G,D,z){let B=this.spectrumValRect||this.refreshSpectrumRect();if(B==null)return;let Q=this.spectrumDragger,J=Q.getBoundingClientRect();G=Math.max(0,G),G=Math.min(1,G),D=Math.max(0,D),D=Math.min(1,D),this.S=G,this.B=D,Q.style.left=G*B.width-J.width/2+"px",Q.style.top=(1-D)*B.height-J.height/2+"px",this.update(z)}getSpectrumValue(){let G=this.spectrumDragger,D=G.getBoundingClientRect(),z=parseFloat(G.style.left)+D.width/2,B=parseFloat(G.style.top)+D.height/2;return{x:z,y:B}}initRecentColors(){let G=F0,D=G.map((z,B)=>{return`
`});this.recentColors.innerHTML=D.join(""),_Y(this.recentColors,!!G.length)}setValue(G){let D=this._Color.fromString(G);this.setColor(D,!0)}setColor(G,D){let[z,B,Q]=G.toHSB();this.H=(isNaN(z)?0:z)/360,this.A=G.a;let J=this.spectrumHueRect||this.refreshHueRect(),U=this.spectrumAlphaRect||this.refreshAlphaRect();this.spectrumHueSlider.style.left=`${(this.H-1)*-J.width-this.spectrumHueSlider.getBoundingClientRect().width/2}px`,this.spectrumAlphaSlider.style.left=`${this.A*U.width-this.spectrumAlphaSlider.getBoundingClientRect().width/2}px`,this.setSpectrumValue(B,Q,!D)}onRecentColorClick(G){let D=G.target;if(!HY(D.id))return;let z=parseInt(D.id,10);this.setValue(F0[z]),this.destroy()}addRecentColor(){let D=this._Color.fromHSB(this.H*360,this.S,this.B,this.A).toRgbaString(),z=F0;if(!this.colorChanged||z[0]===D)return;if(z=z.filter((B)=>B!=D),z=[D].concat(z),z.length>HU)z=z.slice(0,HU);F0=z}destroy(){this.addRecentColor(),super.destroy()}},vY=".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 OY(G){return G??(G=G||"default"),{tag:"div",cls:`ag-panel ag-${G}-panel`,attrs:{tabindex:"-1"},children:[{tag:"div",ref:"eTitleBar",cls:`ag-panel-title-bar ag-${G}-panel-title-bar ag-unselectable`,children:[{tag:"span",ref:"eTitle",cls:`ag-panel-title-bar-title ag-${G}-panel-title-bar-title`},{tag:"div",ref:"eTitleBarButtons",cls:`ag-panel-title-bar-buttons ag-${G}-panel-title-bar-buttons`}]},{tag:"div",ref:"eContentWrapper",cls:`ag-panel-content-wrapper ag-${G}-panel-content-wrapper`}]}}var LJ=class extends kU{constructor(G){super(OY(G.cssIdentifier));this.config=G,this.closable=!0,this.eContentWrapper=E0,this.eTitleBar=E0,this.eTitleBarButtons=E0,this.eTitle=E0,this.registerCSS(vY)}postConstruct(){let{component:G,closable:D,hideTitleBar:z,title:B,minWidth:Q=250,width:J,minHeight:U=250,height:Z,centered:S,popup:X,x:Y,y:W,postProcessPopupParams:q}=this.config,H=this.beans,_=this.createManagedBean(new MY(this.getGui(),{minWidth:Q,width:J,minHeight:U,height:Z,centered:S,x:Y,y:W,popup:X,calculateTopBuffer:()=>this.positionableFeature.getHeight()-this.getBodyHeight()}));this.positionableFeature=_;let k=this.getGui();if(G)this.setBodyComponent(G);if(!z){if(B)this.setTitle(B);this.setClosable(D!=null?D:this.closable)}else bY(this.eTitleBar,!1);if(this.addManagedElementListeners(this.eTitleBar,{mousedown:(K)=>{if(k.contains(K.relatedTarget)||k.contains(AY(H))||this.eTitleBarButtons.contains(K.target)){K.preventDefault();return}let f=this.eContentWrapper.querySelector("button, [href], input, select, textarea, [tabindex]");if(f)f.focus()}}),X&&_.isPositioned())return;if(this.renderComponent)this.renderComponent();let w;if(q){let{type:K,eventSource:f,mouseEvent:N}=q;w=()=>H.popupSvc?.callPostProcessPopup(q,K,k,f,N)}_.initialisePosition(w),this.eContentWrapper.style.height="0"}renderComponent(){let G=this.getGui();G.focus(),this.close=()=>{G.remove(),this.destroy()}}getHeight(){return this.positionableFeature.getHeight()}setHeight(G){this.positionableFeature.setHeight(G)}getWidth(){return this.positionableFeature.getWidth()}setWidth(G){this.positionableFeature.setWidth(G)}setClosable(G){if(G!==this.closable)this.closable=G;if(G){let D=this.closeButtonComp=new kU({tag:"div",cls:"ag-button"});this.createBean(D);let z=D.getGui(),B=this.beans.iconSvc.createIconNoSpan("close",this.beans);B.classList.add("ag-panel-title-bar-button-icon"),z.appendChild(B),this.addTitleBarButton(D),D.addManagedElementListeners(z,{click:this.onBtClose.bind(this)})}else if(this.closeButtonComp)this.closeButtonComp.getGui().remove(),this.closeButtonComp=this.destroyBean(this.closeButtonComp)}setBodyComponent(G){G.setParentComponent(this),this.eContentWrapper.appendChild(G.getGui())}addTitleBarButton(G,D){let z=this.eTitleBarButtons,B=z.children,Q=B.length;if(D==null)D=Q;D=Math.max(0,Math.min(D,Q)),G.addCss("ag-panel-title-bar-button");let J=G.getGui();if(D===0)z.prepend(J);else if(D===Q)z.append(J);else B[D-1].after(J);G.setParentComponent(this)}getBodyHeight(){return RY(this.eContentWrapper)}getBodyWidth(){return CY(this.eContentWrapper)}setTitle(G){this.eTitle.innerText=G}onBtClose(){this.close()}destroy(){if(this.closeButtonComp)this.closeButtonComp=this.destroyBean(this.closeButtonComp);let G=this.getGui();if(G&&VY(G))this.close();super.destroy()}},SJ=class extends LJ{constructor(G,D){super({...G,popup:!0});this.callbacks=D,this.isMaximizable=!1,this.isMaximized=!1,this.maximizeListeners=[],this.resizeListenerDestroy=null,this.lastPosition={x:0,y:0,width:0,height:0}}wireBeans(G){this.popupSvc=G.popupSvc}postConstruct(){let G=this.getGui(),{movable:D,resizable:z,maximizable:B,modal:Q}=this.config;if(this.addCss("ag-dialog"),super.postConstruct(),this.tabGuardFeature=this.createManagedBean(new EY(this,this.callbacks?.stopPropagationCallbacks)),this.tabGuardFeature.initialiseTabGuard({isFocusableContainer:!0,onFocusIn:()=>{this.popupSvc?.bringPopupToFront(G)},onTabKeyDown:(J)=>{if(Q)return;let U=J.shiftKey,Z=IY(this.beans,G,!1,U);if(!Z||this.tabGuardFeature.getTabGuardCtrl().isTabGuard(Z)){if(this.callbacks?.focusNextContainer(this.beans,U))J.preventDefault()}}}),D)this.setMovable(D);if(B)this.setMaximizable(B);if(z)this.setResizable(z);if(!this.config.modal)this.callbacks?.configureFocusableContainer(this.beans,this)}setAllowFocus(G){this.tabGuardFeature.getTabGuardCtrl().setAllowFocus(G)}renderComponent(){let G=this.getGui(),{alwaysOnTop:D,modal:z,title:B,afterGuiAttached:Q}=this.config,J=this.getLocaleTextFunc(),U=this.popupSvc?.addPopup({modal:z,eChild:G,closeOnEsc:!0,closedCallback:this.onClosed.bind(this),alwaysOnTop:D,ariaLabel:B||J("ariaLabelDialog","Dialog"),afterGuiAttached:Q});if(U)this.close=U.hideFunc}onClosed(G){this.destroy(),this.config.closedCallback?.(G)}setMaximized(G){if(this.isMaximizable&&G!==this.isMaximized)this.toggleMaximize()}toggleMaximize(){let G=this.positionableFeature.getPosition();if(this.isMaximized){let{x:D,y:z,width:B,height:Q}=this.lastPosition;this.setWidth(B),this.setHeight(Q),this.positionableFeature.offsetElement(D,z)}else this.lastPosition.width=this.getWidth(),this.lastPosition.height=this.getHeight(),this.lastPosition.x=G.x,this.lastPosition.y=G.y,this.positionableFeature.offsetElement(0,0),this.setHeight("100%"),this.setWidth("100%");this.isMaximized=!this.isMaximized,this.refreshMaximizeIcon()}refreshMaximizeIcon(){_U(this.maximizeIcon,!this.isMaximized),_U(this.minimizeIcon,this.isMaximized)}clearMaximizebleListeners(){if(this.maximizeListeners.length){for(let G of this.maximizeListeners)G();this.maximizeListeners.length=0}if(this.resizeListenerDestroy)this.resizeListenerDestroy(),this.resizeListenerDestroy=null}destroy(){this.maximizeButtonComp=this.destroyBean(this.maximizeButtonComp),this.clearMaximizebleListeners(),super.destroy()}setResizable(G){this.positionableFeature.setResizable(G)}setMovable(G){this.positionableFeature.setMovable(G,this.eTitleBar)}setMaximizable(G){if(!G){if(this.clearMaximizebleListeners(),this.maximizeButtonComp)this.destroyBean(this.maximizeButtonComp),this.maximizeButtonComp=this.maximizeIcon=this.minimizeIcon=void 0;return}let D=this.eTitleBar;if(!D||G===this.isMaximizable)return;this.isMaximizable=G;let z=this.buildMaximizeAndMinimizeElements();this.refreshMaximizeIcon(),z.addManagedElementListeners(z.getGui(),{click:this.toggleMaximize.bind(this)}),this.addTitleBarButton(z,0),this.maximizeListeners.push(...this.addManagedElementListeners(D,{dblclick:this.toggleMaximize.bind(this)})),[this.resizeListenerDestroy]=this.addManagedListeners(this.positionableFeature,{resize:()=>{this.isMaximized=!1,this.refreshMaximizeIcon()}})}buildMaximizeAndMinimizeElements(){let G=this.maximizeButtonComp=this.createBean(new FY({tag:"div",cls:"ag-dialog-button"})),D=G.getGui(),z=this.beans.iconSvc;return this.maximizeIcon=z.createIconNoSpan("maximize"),D.appendChild(this.maximizeIcon),this.maximizeIcon.classList.add("ag-panel-title-bar-button-icon"),this.minimizeIcon=z.createIconNoSpan("minimize"),D.appendChild(this.minimizeIcon),this.minimizeIcon.classList.add("ag-panel-title-bar-button-icon"),G}},XJ=class extends WY{constructor(G){super({pickerAriaLabelKey:"ariaLabelColorPicker",pickerAriaLabelValue:"Color Picker",pickerType:"ag-list",className:"ag-color-picker",pickerIcon:"chartsColorPicker",...G})}postConstruct(){if(this.eDisplayFieldColor=qU({tag:"span",cls:"ag-color-picker-color"}),this.eDisplayFieldText=qU({tag:"span",cls:"ag-color-picker-value"}),this.eDisplayField.append(this.eDisplayFieldColor,this.eDisplayFieldText),super.postConstruct(),this.value)this.setValue(this.value)}createPickerComponent(){let G=this.eWrapper.getBoundingClientRect(),D=this.beans.popupSvc.getParentRect();return this.createBean(new SJ({closable:!1,modal:!0,hideTitleBar:!0,minWidth:190,width:190,height:250,x:G.right-D.left-190,y:G.top-D.top-250-(this.config.pickerGap??0),postProcessPopupParams:{type:"colorPicker",eventSource:this.eWrapper}},this.config.dialogCallbacks))}renderAndPositionPicker(){let G=this.pickerComponent,D=this.createBean(new NY({picker:this}));return G.addCss("ag-color-dialog"),D.addDestroyFunc(()=>{if(G.isAlive())this.destroyBean(G)}),G.setParentComponent(this),G.setBodyComponent(D),D.setValue(this.getValue()),D.getGui().focus(),G.addDestroyFunc(()=>{if(!this.isDestroyingPicker){if(this.beforeHidePicker(),this.isDestroyingPicker=!0,D.isAlive())this.destroyBean(D);if(this.isAlive())this.getFocusableElement().focus()}else this.isDestroyingPicker=!1}),()=>this.pickerComponent?.close()}setValue(G){if(this.value===G)return this;return this.eDisplayFieldColor.style.backgroundColor=G,this.eDisplayFieldText.textContent=this.beans.agChartsExports._Util.Color.fromString(G).toHexString().toUpperCase(),super.setValue(G)}getValue(){return this.value}},uY={selector:"AG-COLOR-PICKER",component:XJ},lY=class extends dY{constructor(G){super();this.setTemplateFromElement(G.getGui(),void 0,void 0,!0)}postConstruct(){this.initialiseTabGuard({onTabKeyDown:(G)=>this.onTabKeyDown(G),handleKeyDown:(G)=>this.handleKeyDown(G)})}handleKeyDown(G){if(G.key===nY.ESCAPE)this.closePanel()}onTabKeyDown(G){if(G.defaultPrevented)return;this.closePanel(),G.preventDefault()}closePanel(){let G=this.parentComponent;G.closeSubMenu(),setTimeout(()=>G.getGui().focus(),0)}},NB=class extends TY{constructor(G){super();this.callbacks=G,this.ACTIVATION_DELAY=80,this.isActive=!1,this.subMenuIsOpen=!1,this.subMenuIsOpening=!1,this.suppressRootStyles=!0,this.suppressAria=!0,this.suppressFocus=!0}init(G){let{menuItemDef:D,isAnotherSubMenuOpen:z,level:B,childComponent:Q,contextParams:J}=G;return this.params=G.menuItemDef,this.level=B,this.isAnotherSubMenuOpen=z,this.childComponent=Q,this.contextParams=J,this.cssClassPrefix=this.params.menuItemParams?.cssClassPrefix??"ag-menu-option",this.callbacks.getMenuItemComp(this.beans,this.params,{...D,level:B,isAnotherSubMenuOpen:z,openSubMenu:(U)=>this.openSubMenu(U),closeSubMenu:()=>this.closeSubMenu(),closeMenu:(U)=>this.closeMenu(U),updateTooltip:(U,Z)=>this.refreshTooltip(U,Z),onItemActivated:()=>this.onItemActivated()}).then((U)=>{if(!U)return;this.menuItemComp=U;let Z=U.configureDefaults?.();if(Z)this.configureDefaults(Z===!0?void 0:Z)})}addListeners(G,D){if(!D?.suppressClick)this.addManagedElementListeners(G,{click:(z)=>this.onItemSelected(z)});if(!D?.suppressKeyboardSelect)this.addManagedElementListeners(G,{keydown:(z)=>{if(z.key===wU.ENTER||z.key===wU.SPACE)z.preventDefault(),this.onItemSelected(z)}});if(!D?.suppressMouseDown)this.addManagedElementListeners(G,{mousedown:(z)=>{z.stopPropagation(),z.preventDefault()}});if(!D?.suppressMouseOver)this.addManagedElementListeners(G,{mouseenter:()=>this.onMouseEnter(),mouseleave:()=>this.onMouseLeave()})}isDisabled(){return!!this.params.disabled}openSubMenu(G=!1,D){if(this.closeSubMenu(),!this.params.subMenu)return;this.subMenuIsOpening=!0;let z=yY({tag:"div",cls:"ag-menu",role:"presentation"});this.eSubMenuGui=z;let B,Q=()=>{this.subMenuIsOpening=!1};if(this.childComponent){let X=this.createBean(new lY(this.childComponent));X.setParentComponent(this);let Y=X.getGui(),W="mouseenter",q=()=>this.cancelDeactivate();if(Y.addEventListener(W,q),B=()=>{Y.removeEventListener(W,q),this.destroyBean(X)},z.appendChild(Y),this.childComponent.afterGuiAttached)Q=()=>{this.childComponent.afterGuiAttached(),this.subMenuIsOpening=!1}}else if(this.params.subMenu){let X=this.createBean(new uB(this.level+1,this.contextParams,this.callbacks));if(X.setParentComponent(this),X.addMenuItems(this.params.subMenu),z.appendChild(X.getGui()),this.addManagedListeners(X,{closeMenu:(Y)=>this.dispatchLocalEvent(Y)}),X.addGuiEventListener("mouseenter",()=>this.cancelDeactivate()),B=()=>this.destroyBean(X),G)Q=()=>{X.activateFirstItem(),this.subMenuIsOpening=!1}}let J=this.beans.popupSvc,U=()=>{let X=this.eGui;J?.positionPopupForMenu({eventSource:X,ePopup:z,event:D instanceof MouseEvent?D:void 0,additionalParams:this.callbacks.getPostProcessPopupParams(this.contextParams)})},Z=this.getLocaleTextFunc(),S=J?.addPopup({modal:!0,eChild:z,positionCallback:U,anchorToElement:this.eGui,ariaLabel:Z("ariaLabelSubMenu","SubMenu"),afterGuiAttached:Q});this.subMenuIsOpen=!0,this.setAriaExpanded(!0),this.hideSubMenu=()=>{if(S)S.hideFunc();this.subMenuIsOpen=!1,this.setAriaExpanded(!1),B(),this.menuItemComp.setExpanded?.(!1),this.eSubMenuGui=void 0},this.menuItemComp.setExpanded?.(!0)}setAriaExpanded(G){if(!this.suppressAria)cY(this.eGui,G)}closeSubMenu(){if(!this.hideSubMenu)return;this.hideSubMenu(),this.hideSubMenu=null,this.setAriaExpanded(!1)}isSubMenuOpen(){return this.subMenuIsOpen}isSubMenuOpening(){return this.subMenuIsOpening}activate(G,D){if(this.cancelActivate(),this.params.disabled&&!D)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:!D}));if(G&&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(G){this.parentComponent=G}getSubMenuGui(){return this.eSubMenuGui}onItemSelected(G){if(this.menuItemComp.select?.(),this.params.action)this.beans.frameworkOverrides.wrapOutgoing(()=>this.params.action(this.gos.addCommon({...this.contextParams})));else this.openSubMenu(G&&G.type==="keydown",G);if(this.params.subMenu&&!this.params.action||this.params.suppressCloseOnSelect)return;this.closeMenu(G)}closeMenu(G){let D={type:"closeMenu"};if(G)if(G instanceof MouseEvent)D.mouseEvent=G;else D.keyboardEvent=G;this.dispatchLocalEvent(D)}onItemActivated(){let G={type:"menuItemActivated",menuItem:this};this.dispatchLocalEvent(G)}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(G){let D=this.menuItemComp.getGui(),{cssClassPrefix:z,params:{cssClasses:B,disabled:Q}}=this,J=this.menuItemComp.getRootElement?.();if(J){if(!G)D.classList.add("ag-menu-option-custom");D=J}if(this.suppressRootStyles=!!G,!this.suppressRootStyles){D.classList.add(z);for(let U of B??[])D.classList.add(U);if(Q)D.classList.add(`${z}-disabled`)}return D}applyAriaProperties(G){let{params:{checked:D,subMenu:z,subMenuRole:B,disabled:Q}}=this,J=D!=null;if(iY(G,J?"menuitemcheckbox":"menuitem"),z)hY(G,B??"menu");if(Q)xY(G,!0)}configureDefaults(G){if(!this.menuItemComp){setTimeout(()=>this.configureDefaults(G));return}let{suppressRootStyles:D,suppressTooltip:z,suppressAria:B,suppressTabIndex:Q,suppressFocus:J}=G||{},{params:{tooltip:U,disabled:Z}}=this,S=this.eGui=this.refreshRootElementGui(!!D);if(this.suppressAria=!!B,!B)this.applyAriaProperties(S);if(!Q)S.setAttribute("tabindex","-1");if(!z)this.refreshTooltip(U);if(!Z)this.addListeners(S,G);this.suppressFocus=!!J}refreshTooltip(G,D){if(this.tooltip=G,this.tooltipFeature=this.destroyBean(this.tooltipFeature),!G||!this.menuItemComp)return;let z=this.beans.registry.createDynamicBean("tooltipFeature",!1,{getGui:()=>this.getGui(),getTooltipValue:()=>this.tooltip,getLocation:()=>"menu",shouldDisplayTooltip:D});if(z)this.tooltipFeature=this.createBean(z)}destroy(){this.tooltipFeature=this.destroyBean(this.tooltipFeature),this.menuItemComp?.destroy?.(),super.destroy()}},uB=class extends jY{constructor(G=0,D,z){super({tag:"div",cls:"ag-menu-list",role:"menu"});this.level=G,this.menuActionParams=D,this.callbacks=z,this.menuItems=[]}postConstruct(){this.initialiseTabGuard({onTabKeyDown:(G)=>this.onTabKeyDown(G),handleKeyDown:(G)=>this.callbacks.preserveRangesWhile(this.beans,()=>this.handleKeyDown(G)),onFocusIn:(G)=>this.handleFocusIn(G),onFocusOut:(G)=>this.handleFocusOut(G)})}onTabKeyDown(G){if(!this.getParentComponent()?.getGui()?.classList.contains("ag-focus-managed"))G.preventDefault();if(G.shiftKey)this.closeIfIsChild(G)}handleKeyDown(G){switch(G.key){case AG.UP:case AG.RIGHT:case AG.DOWN:case AG.LEFT:G.preventDefault(),this.handleNavKey(G.key);break;case AG.ESCAPE:if(this.closeIfIsChild())this.callbacks.stopPropagationCallbacks.stopPropagation(G);break}}handleFocusIn(G){let D=G.relatedTarget;if(!this.tabGuardFeature.getTabGuardCtrl().isTabGuard(D)&&(this.getGui().contains(D)||this.activeMenuItem?.getSubMenuGui()?.contains(D)))return;if(this.activeMenuItem)this.activeMenuItem.activate();else this.activateFirstItem()}handleFocusOut(G){let D=G.relatedTarget;if(!this.activeMenuItem||this.getGui().contains(D)||this.activeMenuItem.getSubMenuGui()?.contains(D))return;if(!this.activeMenuItem.isSubMenuOpening())this.activeMenuItem.deactivate()}clearActiveItem(){if(this.activeMenuItem)this.activeMenuItem.deactivate(),this.activeMenuItem=null}addMenuItems(G){if(G==null)return;SQ.all(G.map((D)=>{if(D==="separator")return SQ.resolve({eGui:this.createSeparator()});else if(typeof D==="string")return this.callbacks.warnNoItem?.(D),SQ.resolve({eGui:null});else return this.addItem(D)})).then((D)=>{for(let z of D??[])if(z?.eGui){if(this.appendChild(z.eGui),z.comp)this.menuItems.push(z.comp)}})}addItem(G){let D=this.createManagedBean(new NB(this.callbacks));return D.init({menuItemDef:G,isAnotherSubMenuOpen:()=>this.menuItems.some((z)=>z.isSubMenuOpen()),level:this.level,contextParams:this.menuActionParams}).then(()=>{return D.setParentComponent(this),this.addManagedListeners(D,{closeMenu:(z)=>{this.dispatchLocalEvent(z)},menuItemActivated:(z)=>{if(this.activeMenuItem&&this.activeMenuItem!==z.menuItem)this.activeMenuItem.deactivate();this.activeMenuItem=z.menuItem}}),{comp:D,eGui:D.getGui()}})}activateFirstItem(){let G=this.menuItems.filter((D)=>!D.isDisabled())[0];if(!G)return;G.activate()}createSeparator(){let G={tag:"div",cls:"ag-menu-separator-part"};return PY({tag:"div",cls:"ag-menu-separator",attrs:{"aria-hidden":"true"},children:[G,G,G,G]})}handleNavKey(G){switch(G){case AG.UP:case AG.DOWN:{let z=this.findNextItem(G===AG.UP);if(z&&z!==this.activeMenuItem)z.activate(!1,!0);return}}let D=this.gos.get("enableRtl")?AG.RIGHT:AG.LEFT;if(G===D)this.closeIfIsChild();else this.openChild()}closeIfIsChild(G){let D=this.getParentComponent();if(D&&D instanceof NB){if(G)G.preventDefault();return D.closeSubMenu(),D.getGui().focus(),!0}return!1}openChild(){if(this.activeMenuItem)this.activeMenuItem.openSubMenu(!0)}findNextItem(G){let D=[...this.menuItems];if(!D.length)return;if(!this.activeMenuItem)return G?gY(D):D[0];if(G)D.reverse();let z,B=!1;for(let Q of D){if(!B){if(Q===this.activeMenuItem)B=!0;continue}z=Q;break}if(B&&!z)return D[0];return z||this.activeMenuItem}destroy(){this.clearActiveItem(),super.destroy()}},G4="ag-menu",D4="ag-context-menu-loading-icon",v6=class extends pY{constructor(G){super();this.params=G,this.destroyLoadingSpinner=null,this.lastPromise=0}hideActiveMenu(){this.destroyBean(this.activeMenu)}showMenu(G,D,z){let{getMenuItems:B,shouldBlockMenuOpen:Q}=this.params,J=B(G,D);if(aY(J)){let U=this.lastPromise+1;if(this.lastPromise=U,!this.destroyLoadingSpinner)this.createLoadingIcon(D);return J.then((Z)=>{if(this.lastPromise!==U)return;let{target:S}=D,X=!S;if(Z?.length&&(X||eY(S))&&!Q?.())this.createContextMenu({menuItems:Z,menuActionParams:G,mouseEvent:D,anchorToElement:z});this.destroyLoadingSpinner?.()}),!0}if(!J?.length)return!1;return this.createContextMenu({menuItems:J,menuActionParams:G,mouseEvent:D,anchorToElement:z}),!0}createLoadingIcon(G){let{beans:D}=this,z=this.getLocaleTextFunc(),B=D.iconSvc.createIconNoSpan("loadingMenuItems"),Q=tY({tag:"div",cls:D4});Q.appendChild(B);let J=rY(D),U=oY(D);if(!U)return;U.appendChild(Q),D.ariaAnnounce?.announceValue(z("ariaLabelLoadingContextMenu","Loading Context Menu"),"contextmenu"),D.environment.applyThemeClasses(Q),KU(Q,G,D);let Z=(S)=>{KU(Q,S,D)};J.addEventListener("mousemove",Z),this.destroyLoadingSpinner=()=>{J.removeEventListener("mousemove",Z),Q.remove(),this.destroyLoadingSpinner=null}}createContextMenu(G){let{mapMenuItems:D,menuItemCallbacks:z,beforeMenuOpen:B,onMenuClose:Q,afterMenuDestroyed:J,onVisibleChanged:U,onMenuOpen:Z}=this.params,{menuItems:S,menuActionParams:X,mouseEvent:Y,anchorToElement:W}=G,q=this.beans.popupSvc,_=new z4(D?(F)=>D(S,X,F):()=>S,X,z);this.createBean(_);let k=_.getGui();B?.(X);let w={additionalParams:z.getPostProcessPopupParams(X),type:"contextMenu",mouseEvent:Y,ePopup:k,nudgeY:1},K=this.getLocaleTextFunc(),f=q?.addPopup({modal:!0,eChild:k,closeOnEsc:!0,closedCallback:(F)=>{z.preserveRangesWhile(this.beans,()=>{Q?.(),this.destroyBean(_),J?.(),U?.(!1,F===void 0?"api":"ui")})},click:Y,positionCallback:()=>{let F=this.gos.get("enableRtl");q?.positionPopupUnderMouseEvent({...w,nudgeX:F?(k.offsetWidth+1)*-1:1})},anchorToElement:W,ariaLabel:K("ariaLabelContextMenu","Context Menu")});if(f)Z?.(),_.afterGuiAttached({container:"contextMenu",hidePopup:f.hideFunc});if(this.activeMenu)this.hideActiveMenu();if(this.activeMenu=_,_.addEventListener("destroyed",()=>{if(this.activeMenu===_)this.activeMenu=null}),f)_.addEventListener("closeMenu",(F)=>f.hideFunc({mouseEvent:F.mouseEvent??void 0,keyboardEvent:F.keyboardEvent??void 0,forceHide:!0}));let N=Y&&Y instanceof MouseEvent&&Y.type==="mousedown";U?.(!0,N?"api":"ui")}destroy(){this.destroyLoadingSpinner?.(),super.destroy()}},z4=class extends mY{constructor(G,D,z){super({tag:"div",cls:G4,role:"presentation"});this.getMenuItems=G,this.menuActionParams=D,this.callbacks=z,this.menuList=null}postConstruct(){let G=this.createManagedBean(new uB(0,this.menuActionParams,this.callbacks)),D=this.getMenuItems(()=>this.getGui());G.addMenuItems(D),this.appendChild(G),this.menuList=G,G.addEventListener("closeMenu",(z)=>this.dispatchLocalEvent(z))}afterGuiAttached({hidePopup:G}){if(G)this.addDestroyFunc(G);let D=this.menuList;if(D)this.callbacks.preserveRangesWhile(this.beans,()=>sY(D.getGui()))}},O6=class extends B4{constructor(G){super({tag:"div"});this.callbacks=G}init(G){this.params=G,this.cssClassPrefix=this.params.cssClassPrefix??"ag-menu-option",this.addAriaAttributes(),this.addIcon(),this.addName(),this.addShortcut(),this.addSubMenu()}configureDefaults(){return!0}addAriaAttributes(){let{checked:G,subMenu:D}=this.params,z=this.getGui();if(G)J4(z,G);if(D)U4(z,!1)}addIcon(){if(this.params.isCompact)return;let G=I0({tag:"span",ref:"eIcon",cls:`${this.getClassName("part")} ${this.getClassName("icon")}`,role:"presentation"}),{checked:D,icon:z}=this.params;if(D)G.appendChild(this.beans.iconSvc.createIconNoSpan("check"));else if(z)if(Q4(z))G.appendChild(z);else if(typeof z==="string")G.innerHTML=z;else this.callbacks?.warnNoIcon?.();this.getGui().appendChild(G)}addName(){let G=I0({tag:"span",ref:"eName",cls:`${this.getClassName("part")} ${this.getClassName("text")}`,children:this.params.name||""});this.getGui().appendChild(G)}addShortcut(){if(this.params.isCompact)return;let G=I0({tag:"span",ref:"eShortcut",cls:`${this.getClassName("part")} ${this.getClassName("shortcut")}`,children:this.params.shortcut||""});this.getGui().appendChild(G)}addSubMenu(){let G=I0({tag:"span",ref:"ePopupPointer",cls:`${this.getClassName("part")} ${this.getClassName("popup-pointer")}`}),D=this.getGui();if(this.params.subMenu){let z=this.gos.get("enableRtl")?"subMenuOpenRtl":"subMenuOpen";G.appendChild(this.beans.iconSvc.createIconNoSpan(z))}D.appendChild(G)}getClassName(G){return`${this.cssClassPrefix}-${G}`}};function c1(G,D){if(!D)return null;let z=H4(G),B=z.indexOf(D);if(B===-1)return null;let Q=-1;for(let J=B-1;J>=0;J--)if(z[J].classList.contains(W4.TAB_GUARD_TOP)){Q=J;break}if(Q<=0)return null;return z[Q-1]}function u6(G,D){if(!D)return!1;let z=G.querySelectorAll(`.${q4}`);if(!z.length)return!1;for(let B=0;Bthis.activeItem?.tabbedItem?.afterDetachedCallback?.())}setupHeader(){let{enableCloseButton:G,cssClass:D}=this.params,z=(B,Q)=>{if(B.classList.add(`ag-tabs-${Q}`),D)B.classList.add(`${D}-${Q}`)};if(G)this.setupCloseButton(z),this.eTabHeader=M0({tag:"div",role:"presentation"}),z(this.eHeader,"header-wrapper"),this.eHeader.appendChild(this.eTabHeader);else this.eTabHeader=this.eHeader;Y4(this.eTabHeader,"tablist"),z(this.eTabHeader,"header")}setupCloseButton(G){let D=M0({tag:"button"});G(D,"close-button");let z=this.beans.iconSvc.createIconNoSpan("close");EU(D,this.params.closeButtonAriaLabel),D.appendChild(z),this.addManagedElementListeners(D,{click:()=>this.params.onCloseClicked?.()});let B=M0({tag:"div",role:"presentation"});G(B,"close-button-wrapper"),B.appendChild(D),this.eHeader.appendChild(B),this.eCloseButton=D}handleKeyDown(G){switch(G.key){case wz.RIGHT:case wz.LEFT:{if(!this.eTabHeader.contains(FU(this.beans)))return;let D=G.key===wz.RIGHT,z=this.gos.get("enableRtl"),B=this.items.indexOf(this.activeItem),Q=D!==z?Math.min(B+1,this.items.length-1):Math.max(B-1,0);if(B===Q)return;G.preventDefault();let J=this.items[Q];this.showItemWrapper(J),J.eHeaderButton.focus();break}case wz.UP:case wz.DOWN:G.stopPropagation();break}}onTabKeyDown(G){if(G.defaultPrevented)return;let{beans:D,eHeader:z,eBody:B,activeItem:Q,params:J}=this,{suppressTrapFocus:U,enableCloseButton:Z}=J,S=FU(D),X=G.target,Y=G.shiftKey;if(z.contains(S)){if(G.preventDefault(),Z&&Y&&!this.eCloseButton?.contains(S))this.eCloseButton?.focus();else if(U&&Y)c1(S4(D).body,X)?.focus();else this.focusBody(G.shiftKey);return}let W=null;if(u6(B,X)){if(Y)W=c1(B,X);if(!W&&!U)W=Q.eHeaderButton}if(!W&&B.contains(S)){if(W=L4(D,B,!1,Y),!W){if(U&&!Y)this.forceFocusOutOfContainer(Y);else if(Z&&!Y)G.preventDefault(),this.eCloseButton?.focus();else G.preventDefault(),this.focusHeader();return}}if(W)G.preventDefault(),W.focus()}focusInnerElement(G){if(G)return this.focusBody(!0);else return this.focusHeader(),!0}focusHeader(G){this.activeItem.eHeaderButton.focus({preventScroll:G})}focusBody(G){return NU(this.eBody,G)}setAfterAttachedParams(G){this.afterAttachedParams=G}showFirstItem(){if(this.items.length>0)this.showItemWrapper(this.items[0])}addItem(G){let D=M0({tag:"span",cls:"ag-tab",role:"tab",attrs:{tabindex:"-1"}});D.appendChild(G.title),this.eTabHeader.appendChild(D),EU(D,G.titleLabel);let z={tabbedItem:G,eHeaderButton:D};this.items.push(z),D.addEventListener("click",this.showItemWrapper.bind(this,z))}showItem(G){let D=this.items.find((z)=>z.tabbedItem===G);if(D)this.showItemWrapper(D)}showItemWrapper(G){let{tabbedItem:D,eHeaderButton:z}=G;if(this.params.onItemClicked?.({item:D}),this.activeItem===G){this.params.onActiveItemClicked?.();return}if(this.lastScrollListener)this.lastScrollListener=this.lastScrollListener();if($4(this.eBody),D.bodyPromise.then((B)=>{this.eBody.appendChild(B);let Q=!X4();if(!this.params.suppressFocusBodyOnOpen)NU(this.eBody,!1,Q);if(D.afterAttachedCallback)D.afterAttachedCallback(this.afterAttachedParams);if(this.params.keepScrollPosition){let J=D.getScrollableContainer?.()||B;[this.lastScrollListener]=this.addManagedElementListeners(J,{scroll:()=>{this.tabbedItemScrollMap.set(D.name,J.scrollTop)}});let U=this.tabbedItemScrollMap.get(D.name);if(U!==void 0)setTimeout(()=>{J.scrollTop=U},0)}}),this.activeItem)this.activeItem.eHeaderButton.classList.remove("ag-tab-selected"),this.activeItem.tabbedItem.afterDetachedCallback?.();z.classList.add("ag-tab-selected"),this.activeItem=G}},N4=".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 F4(G){let D=G.cssIdentifier||"default",z=G.direction||"vertical";return{tag:"div",cls:`ag-group ag-${D}-group`,role:"presentation",children:[{tag:"div",ref:"eToolbar",cls:`ag-group-toolbar ag-${D}-group-toolbar`,children:[{tag:"ag-checkbox",ref:"cbGroupEnabled"}]},{tag:"div",ref:"eContainer",cls:`ag-group-container ag-group-container-${z} ag-${D}-group-container`}]}}var jG=class extends j6{constructor(G={}){super(F4(G),[k4]);this.params=G,this.suppressEnabledCheckbox=!0,this.suppressToggleExpandOnEnableChange=!1,this.eToolbar=Gz,this.cbGroupEnabled=Gz,this.eContainer=Gz,this.registerCSS(N4);let{enabled:D,items:z,suppressEnabledCheckbox:B,expanded:Q,suppressToggleExpandOnEnableChange:J,useToggle:U}=G;if(this.cssIdentifier=G.cssIdentifier||"default",this.enabled=D!=null?D:!0,this.items=z||[],this.useToggle=U??!1,this.alignItems=G.alignItems||"center",this.expanded=Q==null?!0:Q,B!=null)this.suppressEnabledCheckbox=B;if(J!=null)this.suppressToggleExpandOnEnableChange=J}postConstruct(){if(this.setupTitleBar(),this.items.length){let Q=this.items;this.items=[],this.addItems(Q)}let G=this.getLocaleTextFunc();if(this.cbGroupEnabled.setLabel(G("enabled","Enabled")),this.enabled)this.setEnabled(this.enabled,void 0,!0);this.setAlignItems(this.alignItems);let{onEnableChange:D,onExpandedChange:z,suppressOpenCloseIcons:B}=this.params;if(this.hideEnabledCheckbox(this.suppressEnabledCheckbox),this.hideOpenCloseIcons(B??!1),this.refreshChildDisplay(),AD(this.eContainer,this.expanded),this.cbGroupEnabled.onValueChange((Q)=>{this.setEnabled(Q,!0,this.suppressToggleExpandOnEnableChange),this.dispatchEnableChangeEvent(Q)}),D!=null)this.onEnableChange(D);if(z!=null)this.onExpandedChange(z)}refreshChildDisplay(){AD(this.eToolbar,this.expanded&&!this.suppressEnabledCheckbox),this.eTitleBar?.refreshOnExpand(this.expanded)}isExpanded(){return this.expanded}setAlignItems(G){if(this.alignItems!==G)this.removeCss(`ag-group-item-alignment-${this.alignItems}`);this.alignItems=G;let D=`ag-group-item-alignment-${this.alignItems}`;return this.addCss(D),this}toggleGroupExpand(G,D){if(this.eTitleBar?.isSuppressCollapse()&&!this.useToggle)G=!0,D=!0;else if(G=G!=null?G:!this.expanded,this.expanded===G)return this;if(this.expanded=G,this.refreshChildDisplay(),AD(this.eContainer,G),!D)this.dispatchLocalEvent({type:G?"expanded":"collapsed"});return this}addItems(G){for(let D of G)this.addItem(D)}prependItem(G){this.insertItem(G,!0)}addItem(G){this.insertItem(G,!1)}updateItems(G){let D=this.items,z=0;for(let B=0;BG(D.enabled)}),this}onExpandedChange(G){return this.addManagedListeners(this,{expanded:()=>G(!0),collapsed:()=>G(!1)}),this}hideEnabledCheckbox(G){return this.suppressEnabledCheckbox=G,this.refreshChildDisplay(),this.refreshDisabledStyles(),this}hideOpenCloseIcons(G){return this.eTitleBar?.hideOpenCloseIcons(G),this}refreshDisabledStyles(){let G=!this.enabled;this.eContainer.classList.toggle("ag-disabled",G),this.eTitleBar?.refreshDisabledStyles(this.suppressEnabledCheckbox&&G),this.eContainer.classList.toggle("ag-disabled-group-container",G)}setupTitleBar(){let G=this.useToggle?this.createToggleTitleBar():this.createDefaultTitleBar();this.eToolbar.insertAdjacentElement("beforebegin",G.getGui())}createDefaultTitleBar(){let G=this.createManagedBean(new I4(this.params));return this.eTitleBar=G,G.refreshOnExpand(this.expanded),this.addManagedListeners(G,{expandedChanged:(D)=>this.toggleGroupExpand(D.expanded)}),G}createToggleTitleBar(){let G=this.createManagedBean(new w4({value:this.enabled,label:this.params.title,labelAlignment:"left",labelWidth:"flex",onValueChange:(D)=>{this.setEnabled(D,!0),this.dispatchEnableChangeEvent(D)}}));return G.addCss("ag-group-title-bar"),G.addCss(`ag-${this.params.cssIdentifier??"default"}-group-title-bar ag-unselectable`),this.eToggle=G,this.toggleGroupExpand(this.enabled),G}},WQ="ag-disabled-group-title-bar";function E4(G){let D=G.cssIdentifier??"default";return{tag:"div",cls:`ag-group-title-bar ag-${D}-group-title-bar ag-unselectable`,role:G.suppressKeyboardNavigation?"presentation":"group",children:[{tag:"span",ref:"eGroupOpenedIcon",cls:`ag-group-title-bar-icon ag-${D}-group-title-bar-icon`,role:"presentation"},{tag:"span",ref:"eGroupClosedIcon",cls:`ag-group-title-bar-icon ag-${D}-group-title-bar-icon`,role:"presentation"},{tag:"span",ref:"eTitle",cls:`ag-group-title ag-${D}-group-title`}]}}var I4=class extends j6{constructor(G={}){super(E4(G));this.suppressOpenCloseIcons=!1,this.suppressKeyboardNavigation=!1,this.eGroupOpenedIcon=Gz,this.eGroupClosedIcon=Gz,this.eTitle=Gz;let{title:D,suppressOpenCloseIcons:z,suppressKeyboardNavigation:B}=G;if(!!D&&D.length>0)this.title=D;if(z!=null)this.suppressOpenCloseIcons=z;this.suppressKeyboardNavigation=B??!1}postConstruct(){this.setTitle(this.title),this.hideOpenCloseIcons(this.suppressOpenCloseIcons),this.setupExpandContract()}setupExpandContract(){let G=this.beans.iconSvc;this.eGroupClosedIcon.appendChild(G.createIconNoSpan("accordionClosed")),this.eGroupOpenedIcon.appendChild(G.createIconNoSpan("accordionOpen")),this.addManagedElementListeners(this.getGui(),{click:()=>this.dispatchExpandChanged(),keydown:(D)=>{switch(D.key){case Kz.ENTER:case Kz.SPACE:D.preventDefault(),this.dispatchExpandChanged();break;case Kz.RIGHT:case Kz.LEFT:D.preventDefault(),this.dispatchExpandChanged(D.key===Kz.RIGHT);break}}})}refreshOnExpand(G){this.refreshAriaStatus(G),this.refreshOpenCloseIcons(G)}refreshAriaStatus(G){if(!this.suppressOpenCloseIcons)f4(this.getGui(),G)}refreshOpenCloseIcons(G){let D=!this.suppressOpenCloseIcons;AD(this.eGroupOpenedIcon,D&&G),AD(this.eGroupClosedIcon,D&&!G)}isSuppressCollapse(){return this.suppressOpenCloseIcons}dispatchExpandChanged(G){let D={type:"expandedChanged",expanded:G};this.dispatchLocalEvent(D)}setTitle(G){let D=this.getGui(),z=!!G&&G.length>0;if(G=z?G:void 0,this.eTitle.textContent=G??"",AD(D,z),G!==this.title)this.title=G;let B=D.classList.contains(WQ);return this.refreshDisabledStyles(B),this}addWidget(G){return this.getGui().appendChild(G),this}hideOpenCloseIcons(G){if(this.suppressOpenCloseIcons=G,G)this.dispatchExpandChanged(!0);return this}refreshDisabledStyles(G){let D=this.getGui();if(G)D.classList.add(WQ),D.removeAttribute("tabindex"),YQ(D,"presentation");else if(D.classList.remove(WQ),typeof this.title==="string"&&!this.suppressKeyboardNavigation)this.activateTabIndex([D]),YQ(D,"group");else D.removeAttribute("tabindex"),YQ(D,"presentation")}},p={selector:"AG-GROUP-COMPONENT",component:jG},j="35.2.0",i={moduleName:"EnterpriseCore",version:j,beans:[j1],icons:{accordionOpen:"tree-open",accordionClosed:"tree-closed",accordionIndeterminate:"tree-indeterminate",close:"cross",cancel:"cancel",maximize:"maximize",minimize:"minimize",columnDrag:"grip"},dependsOn:[],setLicenseKey:j1.setLicenseKey},b4=".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}";function v4(G){return G.filterManager?.getAdvFilterModel()??null}function O4(G,D){G.filterManager?.setAdvFilterModel(D)}function u4(G){G.filterManager?.toggleAdvFilterBuilder(!0,"api")}function j4(G){G.filterManager?.toggleAdvFilterBuilder(!1,"api")}var T4={ariaAdvancedFilterBuilderItem:(G)=>`${G[0]}. Level ${G[1]}. Press ENTER to edit`,ariaAdvancedFilterBuilderItemValidation:(G)=>`${G[0]}. Level ${G[1]}. ${G[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:(G)=>`Expression has an error. ${G[0]} - ${G[1]}.`,advancedFilterValidationMessageAtEnd:(G)=>`Expression has an error. ${G[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."};function h1(G,D,z){if(!G)return"";let B=z-D;return B?G.slice(0,G.length-B):G}function XD(G,D,z,B,Q,J,U){let Z=z+(!G.length||U?0:1),S=0;if(Q){if(G[Z]===" ")S=1;else if(B+=" ",J)B+='"'}return{updatedValue:G.slice(0,D)+B+G.slice(Z),updatedPosition:D+B.length+S}}function y4(G,D,z){let B=D;while(B{if(this.quotes||isNaN(this.modelValue))this.valid=!1,this.validationMessage=this.params.advFilterExpSvc.translate("advancedFilterValidationNotANumber")},bigint:()=>{if(this.quotes||P6(this.modelValue)===null)this.valid=!1,this.validationMessage=this.params.advFilterExpSvc.translate("advancedFilterValidationNotABigInt")},date:(Q)=>{if(Q==null)this.valid=!1,this.validationMessage=this.params.advFilterExpSvc.translate("advancedFilterValidationInvalidDate")},dateString:(...Q)=>this.filterValidationSetters.date(...Q),dateTime:(...Q)=>this.filterValidationSetters.date(...Q),dateTimeString:(...Q)=>this.filterValidationSetters.date(...Q),boolean(){},object(){},text(){}}}parse(G,D){if(G===" ")if(this.quotes)this.operand+=G;else return this.parseOperand(!1,D),!0;else if(G===")")if(this.baseCellDataType==="number"||!this.quotes)return this.parseOperand(!1,D-1),!0;else this.operand+=G;else if(!this.operand&&!this.quotes&&(G==="'"||G==='"'))this.quotes=G;else if(this.quotes&&G===this.quotes)return this.parseOperand(!1,D),!1;else this.operand+=G;return}complete(G){this.parseOperand(!0,G)}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(G,D){let{advFilterExpSvc:z}=this.params;if(this.endPosition=D,this.modelValue=this.operand,G&&this.quotes)this.valid=!1,this.validationMessage=z.translate("advancedFilterValidationMissingQuote");else if(this.modelValue==="")this.valid=!1,this.validationMessage=z.translate("advancedFilterValidationMissingValue");else{let B=z.getOperandModelValue(this.operand,this.baseCellDataType,this.column);if(B!=null)this.modelValue=B;this.filterValidationSetters[this.baseCellDataType](B)}}},n1="[",d1="]",i4=class{constructor(G,D){this.params=G,this.startPosition=D,this.isAwaiting=!0,this.operandValueGetters={number:Number,bigint:(z)=>P6(z),date:(z)=>this.params.valueSvc.parseValue(this.columnParser.column,null,z,void 0),dateString:(z)=>this.operandValueGetters.date(z),dateTime:(z)=>this.operandValueGetters.date(z),dateTimeString:(z)=>this.operandValueGetters.date(z),boolean:(z)=>z,object:(z)=>z,text:(z)=>z}}parseExpression(){let G=this.startPosition,{expression:D}=this.params;while(G{return(J,U,Z)=>Z.operators[z].evaluator(J.getValue(B,U),U,Z.evaluatorParams[Q],D==null?void 0:Z.operands[D])})}getAutocompleteListParams(G){if(this.isColumnPosition(G))return this.getColumnAutocompleteListParams(G);if(this.isOperatorPosition(G))return this.getOperatorAutocompleteListParams(G);if(this.isBeyondEndPosition(G))return;return{enabled:!1}}updateExpression(G,D,z){let{expression:B}=this.params;if(this.isColumnPosition(G))return XD(this.params.expression,this.startPosition,this.columnParser?.getColId()?this.columnParser.endPosition:i1(B,G).endPosition,this.params.advFilterExpSvc.getColumnValue(D),!0);else if(this.isOperatorPosition(G)){let Q=this.getBaseCellDataTypeFromOperatorAutocompleteType(z),J=this.hasOperand(Q,D.key),U=J&&this.doesOperandNeedQuotes(Q),Z;if(this.operatorParser?.startPosition!=null&&Gthis.endPosition+1&&this.endPosition+10,Q=this.columnParser?.hasEndChar&&z.length===D.length+2;if(B)return z.slice(1,Q?-1:void 0);return z}getOperatorAutocompleteListParams(G){let D=this.columnParser?.column;if(!D)return{enabled:!1};let z=this.columnParser.baseCellDataType,B=this.operatorParser?.startPosition!=null&&G0}doesOperandNeedQuotes(G){return G!=="number"&&G!=="bigint"}addToListAndGetIndex(G,D){let z=G.length;return G.push(D),z}};function jB(G,D,z){let B=!1,Q=G.toLocaleLowerCase(),J=Q+" ",U=Object.keys(D).find((Z)=>{let S=D[Z],X=z(S).toLocaleLowerCase();if(X.startsWith(J))B=!0;return X===Q});if(U)return U;else if(B)return null;else return}function qJ(G,D){return(D??Object.keys(G)).map((B)=>({key:B,displayValue:G[B].displayValue}))}var AU=class{constructor(G){this.params=G,this.initOperators()}getEntries(G){return qJ(this.operators,G)}findOperator(G){return jB(G,this.operators,({displayValue:D})=>D)}initOperators(){let{translate:G}=this.params;this.operators={contains:{displayValue:G("advancedFilterContains"),evaluator:(D,z,B,Q)=>this.evaluateExpression(D,z,B,Q,!1,(J,U)=>J.includes(U)),numOperands:1},notContains:{displayValue:G("advancedFilterNotContains"),evaluator:(D,z,B,Q)=>this.evaluateExpression(D,z,B,Q,!0,(J,U)=>!J.includes(U)),numOperands:1},equals:{displayValue:G("advancedFilterTextEquals"),evaluator:(D,z,B,Q)=>this.evaluateExpression(D,z,B,Q,!1,(J,U)=>J===U),numOperands:1},notEqual:{displayValue:G("advancedFilterTextNotEqual"),evaluator:(D,z,B,Q)=>this.evaluateExpression(D,z,B,Q,!0,(J,U)=>J!=U),numOperands:1},startsWith:{displayValue:G("advancedFilterStartsWith"),evaluator:(D,z,B,Q)=>this.evaluateExpression(D,z,B,Q,!1,(J,U)=>J.startsWith(U)),numOperands:1},endsWith:{displayValue:G("advancedFilterEndsWith"),evaluator:(D,z,B,Q)=>this.evaluateExpression(D,z,B,Q,!1,(J,U)=>J.endsWith(U)),numOperands:1},blank:{displayValue:G("advancedFilterBlank"),evaluator:(D)=>D==null||typeof D==="string"&&D.trim().length===0,numOperands:0},notBlank:{displayValue:G("advancedFilterNotBlank"),evaluator:(D)=>D!=null&&(typeof D!=="string"||D.trim().length>0),numOperands:0}}}evaluateExpression(G,D,z,B,Q,J){if(G==null)return Q;return z.caseSensitive?J(z.valueConverter(G,D),B):J(z.valueConverter(G,D).toLocaleLowerCase(),B.toLocaleLowerCase())}},cD=class{constructor(G){this.params=G,this.initOperators()}getEntries(G){return qJ(this.operators,G)}findOperator(G){return jB(G,this.operators,({displayValue:D})=>D)}initOperators(){let{translate:G,equals:D}=this.params;this.operators={equals:{displayValue:G("advancedFilterEquals"),evaluator:(z,B,Q,J)=>this.evaluateSingleOperandExpression(z,B,Q,J,!!Q.includeBlanksInEquals,D),numOperands:1},notEqual:{displayValue:G("advancedFilterNotEqual"),evaluator:(z,B,Q,J)=>this.evaluateSingleOperandExpression(z,B,Q,J,!!Q.includeBlanksInEquals,(U,Z)=>!D(U,Z)),numOperands:1},greaterThan:{displayValue:G("advancedFilterGreaterThan"),evaluator:(z,B,Q,J)=>this.evaluateSingleOperandExpression(z,B,Q,J,!!Q.includeBlanksInGreaterThan,(U,Z)=>U>Z),numOperands:1},greaterThanOrEqual:{displayValue:G("advancedFilterGreaterThanOrEqual"),evaluator:(z,B,Q,J)=>this.evaluateSingleOperandExpression(z,B,Q,J,!!Q.includeBlanksInGreaterThan,(U,Z)=>U>=Z),numOperands:1},lessThan:{displayValue:G("advancedFilterLessThan"),evaluator:(z,B,Q,J)=>this.evaluateSingleOperandExpression(z,B,Q,J,!!Q.includeBlanksInLessThan,(U,Z)=>Uthis.evaluateSingleOperandExpression(z,B,Q,J,!!Q.includeBlanksInLessThan,(U,Z)=>U<=Z),numOperands:1},blank:{displayValue:G("advancedFilterBlank"),evaluator:(z)=>z==null,numOperands:0},notBlank:{displayValue:G("advancedFilterNotBlank"),evaluator:(z)=>z!=null,numOperands:0}}}evaluateSingleOperandExpression(G,D,z,B,Q,J){if(G==null)return Q;return J(z.valueConverter(G,D),B)}},n4=class{constructor(G){this.params=G,this.initOperators()}getEntries(G){return qJ(this.operators,G)}findOperator(G){return jB(G,this.operators,({displayValue:D})=>D)}initOperators(){let{translate:G}=this.params;this.operators={true:{displayValue:G("advancedFilterTrue"),evaluator:(D)=>!!D,numOperands:0},false:{displayValue:G("advancedFilterFalse"),evaluator:(D)=>D===!1,numOperands:0},blank:{displayValue:G("advancedFilterBlank"),evaluator:(D)=>D==null,numOperands:0},notBlank:{displayValue:G("advancedFilterNotBlank"),evaluator:(D)=>D!=null,numOperands:0}}}},d4=class extends P4{constructor(){super(...arguments);this.beanName="advFilterExpSvc",this.filterOperandGetters={number:(G)=>xD(G.filter)??"",bigint:(G)=>xD(G.filter)??"",date:(G)=>{let D=this.colModel.getColDefCol(G.colId);if(!D)return null;return this.valueSvc.formatValue(D,null,IU(xD(G.filter)??""))},dateTime:(G)=>this.filterOperandGetters.date(G),dateString:(G)=>{let D=this.colModel.getColDefCol(G.colId);if(!D)return null;let{filter:z}=G,Q=this.dataTypeSvc?.getDateFormatterFunction(D)?.(IU(xD(G.filter)??"")??void 0)??z;return this.valueSvc.formatValue(D,null,Q)},dateTimeString:(G)=>this.filterOperandGetters.dateString(G),boolean:()=>null,object:()=>null,text:()=>null},this.operandModelValueGetters={number:(G)=>g4(G)?Number(G):null,bigint:(G)=>G,date:(G,D,z)=>MU(this.valueSvc.parseValue(D,null,G,void 0),!!this.dataTypeSvc?.getDateIncludesTimeFlag(z)),dateTime:(...G)=>this.operandModelValueGetters.date(...G),dateString:(G,D,z)=>{let B=this.valueSvc.parseValue(D,null,G,void 0);if(this.dataTypeSvc)return MU(this.dataTypeSvc.getDateParserFunction(D)(B)??null,this.dataTypeSvc.getDateIncludesTimeFlag(z));return B},dateTimeString:(...G)=>this.operandModelValueGetters.dateString(...G),boolean:(G)=>G,object:(G)=>G,text:(G)=>G},this.columnNameToIdMap={},this.columnAutocompleteEntries=null,this.expressionEvaluatorParams={}}wireBeans(G){this.valueSvc=G.valueSvc,this.colModel=G.colModel,this.colNames=G.colNames,this.dataTypeSvc=G.dataTypeSvc}postConstruct(){this.expressionJoinOperators=this.generateExpressionJoinOperators(),this.expressionOperators=this.generateExpressionOperators()}parseJoinOperator(G){let{type:D}=G;return this.expressionJoinOperators[D]??D}getColumnDisplayValue(G){let{colId:D}=G,B=this.getColumnAutocompleteEntries().find(({key:J})=>J===D),Q;if(B)Q=B.displayValue,this.columnNameToIdMap[Q.toLocaleUpperCase()]={colId:D,columnName:Q};else Q=D;return Q}getOperatorDisplayValue(G){return this.getExpressionOperator(G.filterType,G.type)?.displayValue??G.type}getOperandModelValue(G,D,z){return this.operandModelValueGetters[D](G,z,D)}getOperandDisplayValue(G,D){let{filter:z,filterType:B}=G;if(z==null)return"";let Q=this.filterOperandGetters[B](G);if(B!=="number"&&B!=="bigint"){if(Q??(Q=xD(z)??""),!D)Q=`"${Q}"`}return D?Q:` ${Q}`}parseColumnFilterModel(G){let D=this.getColumnDisplayValue(G)??"",z=this.getOperatorDisplayValue(G)??"",B=this.getOperandDisplayValue(G);return`[${D}] ${z}${B}`}updateAutocompleteCache(G,D){if(D==="column"){let{key:z,displayValue:B}=G;this.columnNameToIdMap[G.displayValue.toLocaleUpperCase()]={colId:z,columnName:B}}}translate(G,D){let z=T4[G];if(typeof z==="function")z=z(D);return this.getLocaleTextFunc()(G,z,D)}generateAutocompleteListParams(G,D,z){return{enabled:!0,type:D,searchString:z,entries:G}}getColumnAutocompleteEntries(){if(this.columnAutocompleteEntries)return this.columnAutocompleteEntries;let G=this.colModel.getColDefCols()??[],D=[],z=this.gos.get("includeHiddenColumnsInAdvancedFilter");for(let B of G)if(B.getColDef().filter&&(z||B.isVisible()||B.isRowGroupActive()))D.push({key:B.getColId(),displayValue:this.colNames.getDisplayNameForColumn(B,"advancedFilter")});return D.sort((B,Q)=>{let J=B.displayValue??"",U=Q.displayValue??"";if(JJ)return 1;return 0}),D}getOperatorAutocompleteEntries(G,D){let z=this.getActiveOperators(G);return this.getDataTypeExpressionOperator(D).getEntries(z)}getJoinOperatorAutocompleteEntries(){return Object.entries(this.expressionJoinOperators).map(([G,D])=>({key:G,displayValue:D}))}getDefaultAutocompleteListParams(G){return this.generateAutocompleteListParams(this.getColumnAutocompleteEntries(),"column",G)}getDataTypeExpressionOperator(G){return this.expressionOperators[G]}getExpressionOperator(G,D){return this.getDataTypeExpressionOperator(G)?.operators?.[D]}getExpressionJoinOperators(){return this.expressionJoinOperators}getColId(G){let D=G.toLocaleUpperCase(),z=this.columnNameToIdMap[D];if(z)return z;let Q=this.getColumnAutocompleteEntries().find(({displayValue:J})=>J.toLocaleUpperCase()===D);if(Q){let{key:J,displayValue:U}=Q,Z={colId:J,columnName:U};return this.columnNameToIdMap[D]=Z,Z}return null}getExpressionEvaluatorParams(G){let D=this.expressionEvaluatorParams[G];if(D)return D;let z=this.colModel.getColDefCol(G);if(!z)return{valueConverter:(J)=>J};switch(this.dataTypeSvc?.getBaseDataType(z)){case"dateTimeString":case"dateString":D={valueConverter:this.dataTypeSvc?.getDateParserFunction(z)??((J)=>J)};break;case"object":if(z.getColDef().filterValueGetter)D={valueConverter:(J)=>J};else D={valueConverter:(J,U)=>this.valueSvc.formatValue(z,U,J)??(typeof J.toString==="function"?J.toString():"")};break;case"text":case void 0:D={valueConverter:(J)=>xD(J)};break;default:D={valueConverter:(J)=>J};break}let{filterParams:Q}=z.getColDef();if(Q)["caseSensitive","includeBlanksInEquals","includeBlanksInLessThan","includeBlanksInGreaterThan"].forEach((J)=>{let U=Q[J];if(U)D[J]=U});return this.expressionEvaluatorParams[G]=D,D}getColumnDetails(G){let D=this.colModel.getColDefCol(G)??void 0,z=(D?this.dataTypeSvc?.getBaseDataType(D):void 0)??"text";return{column:D,baseCellDataType:z}}generateExpressionOperators(){let G=(z,B)=>this.translate(z,B),D={translate:G,equals:(z,B)=>z.getTime()===B.getTime()};return{text:new AU({translate:G}),boolean:new n4({translate:G}),object:new AU({translate:G}),number:new cD({translate:G,equals:(z,B)=>z===B}),bigint:new cD({translate:G,equals:(z,B)=>z===B}),date:new cD(D),dateString:new cD(D),dateTime:new cD(D),dateTimeString:new cD(D)}}getColumnValue({displayValue:G}){return`${n1}${G}${d1}`}generateExpressionJoinOperators(){return{AND:this.translate("advancedFilterAnd"),OR:this.translate("advancedFilterOr")}}getActiveOperators(G){let D=G.getColDef().filterParams?.filterOptions;if(!D)return;return D.every((B)=>typeof B==="string")?D:void 0}resetColumnCaches(){this.columnAutocompleteEntries=null,this.columnNameToIdMap={},this.expressionEvaluatorParams={}}},g6={stopPropagationCallbacks:GW,focusNextContainer:(G,D)=>{return DW(G,D)},configureFocusableContainer:(G,D)=>{let z=G.ctrlsSvc.get("gridCtrl");z.addFocusableContainer(D),D.addDestroyFunc(()=>z.removeFocusableContainer(D))}},PB=class extends SJ{constructor(G){super(G,g6)}getFocusableContainerName(){return"dialog"}},T6=".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)}",Lz=class extends R6{constructor(G){super(_W,G)}},NW={tag:"div",cls:"ag-autocomplete-row",role:"presentation",children:[{tag:"div",cls:"ag-autocomplete-row-label"}]},FW=class extends kW{constructor(){super(NW);this.hasHighlighting=!1}setState(G,D){this.value=G,this.render(),this.updateSelected(D)}updateSelected(G){this.toggleCss("ag-autocomplete-row-selected",G)}setSearchString(G){let D=!1,{value:z}=this;if(z&&fW(G)){let B=z.toLocaleLowerCase().indexOf(G.toLocaleLowerCase());if(B>=0){D=!0,this.hasHighlighting=!0;let Q=B+G.length,J=this.getGui().lastElementChild;wW(J),J.append(z.slice(0,B),KW({tag:"b",children:z.slice(B,Q)}),z.slice(Q))}}if(!D&&this.hasHighlighting)this.hasHighlighting=!1,this.render()}render(){this.getGui().lastElementChild.textContent=this.value??" "}},EW={tag:"div",cls:"ag-autocomplete-list-popup",children:[{tag:"div",ref:"eList",cls:"ag-autocomplete-list"}]},y6=class extends SW{constructor(G){super(EW);this.params=G,this.eList=YW,this.searchString="",this.lastAutoListHeight=null}postConstruct(){this.autocompleteEntries=this.params.autocompleteEntries,this.virtualList=this.createManagedBean(new Lz({cssIdentifier:"autocomplete"})),this.virtualList.setComponentCreator(this.createRowComponent.bind(this)),this.eList.appendChild(this.virtualList.getGui()),this.virtualList.setModel({getRowCount:()=>this.autocompleteEntries.length,getRow:(D)=>this.autocompleteEntries[D]});let G=this.virtualList.getGui();this.addManagedListeners(G,{click:()=>this.params.onConfirmed(),mousemove:this.onMouseMove.bind(this),mousedown:(D)=>D.preventDefault()}),this.setSelectedValue(0),this.updateListHeight()}onNavigationKeyDown(G,D){G.preventDefault();let z=this.autocompleteEntries.indexOf(this.selectedValue),B=D===XW.UP?z-1:z+1;this.checkSetSelectedValue(B)}setSearch(G){if(this.searchString=G,WW(G))this.runSearch();else this.autocompleteEntries=this.params.autocompleteEntries,this.virtualList.refresh(),this.checkSetSelectedValue(0),this.updateListHeight();this.updateSearchInList()}runContainsSearch(G,D){let z,B=!1,Q=G.toLocaleLowerCase(),J=D.filter((U)=>{let S=U.toLocaleLowerCase().indexOf(Q),X=S===0,Y=S>=0;if(Y&&(!z||!B&&X||B===X&&U.lengthJ.toLocaleLowerCase().startsWith(z));return{topMatch:B[0],allMatches:B}}runSearch(){let{autocompleteEntries:G,useFuzzySearch:D,useStartsWithSearch:z,forceLastSelection:B}=this.params,Q=G.map((X)=>X.displayValue??X.key),J,U;if(D)J=qW({inputValue:this.searchString,allSuggestions:Q,hideIrrelevant:!0}).values,U=J.length?J[0]:void 0;else{let X=z?this.runStartsWithSearch(this.searchString,Q):this.runContainsSearch(this.searchString,Q);J=X.allMatches,U=X.topMatch}let Z=G.filter(({key:X,displayValue:Y})=>J.includes(Y??X));if(!Z.length&&this.selectedValue&&B?.(this.selectedValue,this.searchString))Z=[this.selectedValue];if(this.autocompleteEntries=Z,this.virtualList.refresh(),this.updateListHeight(),!U)return;let S=J.indexOf(U);this.checkSetSelectedValue(S)}updateSearchInList(){this.virtualList.forEachRenderedRow((G)=>G.setSearchString(this.searchString))}updateListHeight(){if(!this.params.autoSizeList)return;let G=this.autocompleteEntries.length,D=this.virtualList.getRowHeight(),z=this.params.maxVisibleItems??G,Q=Math.min(G,z)*D;if(G===0)Q=D;if(this.lastAutoListHeight===Q)return;if(this.lastAutoListHeight=Q,this.eList.style.height=`${Q}px`,HW(this.eList))this.params.onListHeightChanged?.()}checkSetSelectedValue(G){if(G>=0&&G{z.updateSelected(G===B)})}createRowComponent(G){let D=new FW;return this.createBean(D),D.setState(G.displayValue??G.key,G===this.selectedValue),D}onMouseMove(G){let D=this.virtualList,z=D.getGui().getBoundingClientRect(),B=D.getScrollTop(),Q=G.clientY-z.top+B,J=Math.floor(Q/D.getRowHeight());this.checkSetSelectedValue(J)}afterGuiAttached(){this.virtualList.refresh(),this.updateListHeight()}getSelectedValue(){if(!this.autocompleteEntries.length)return null;return this.selectedValue??null}},IW={tag:"div",cls:"ag-autocomplete",role:"presentation",children:[{tag:"ag-input-text-field",ref:"eAutocompleteInput"}]},MW=class extends ZW{constructor(){super(IW,[UW]);this.eAutocompleteInput=$W,this.isListOpen=!1,this.lastPosition=0,this.valid=!0,this.registerCSS(T6)}wireBeans(G){this.popupSvc=G.popupSvc}postConstruct(){this.eAutocompleteInput.onValueChange((G)=>this.onValueChanged(G)),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(G){let D=VU(G);this.updateValue(D),this.updateAutocompleteList(D)}updateValue(G){this.updateLastPosition(),this.dispatchLocalEvent({type:"eventValueChanged",value:G}),this.validate(G)}updateAutocompleteList(G){let D=this.listGenerator?.(G,this.lastPosition)??{enabled:!1};if(!D.type||D.type!==this.autocompleteListParams?.type){if(this.isListOpen)this.closeList()}let z=this.isListOpen;if(this.autocompleteListParams=D,D?.enabled){if(!z)this.openList();let{searchString:B}=D;this.autocompleteList.setSearch(B??"")}else if(z)this.closeList()}onKeyDown(G){let D=G.key;switch(this.updateLastPosition(),D){case RG.ENTER:this.onEnterKeyDown(G);break;case RG.TAB:this.onTabKeyDown(G);break;case RG.DOWN:case RG.UP:this.onUpDownKeyDown(G,D);break;case RG.LEFT:case RG.RIGHT:case RG.PAGE_HOME:case RG.PAGE_END:setTimeout(()=>{this.updatePositionAndList()});break;case RG.ESCAPE:this.onEscapeKeyDown(G);break;case RG.SPACE:if(G.ctrlKey&&!this.isListOpen)G.preventDefault(),this.forceOpenList();break}}confirmSelection(){let G=this.autocompleteList?.getSelectedValue();if(G)this.closeList(),this.dispatchLocalEvent({type:"eventOptionSelected",value:this.getValue(),position:this.lastPosition,updateEntry:G,autocompleteType:this.autocompleteListParams.type})}onTabKeyDown(G){if(this.isListOpen)G.preventDefault(),G.stopPropagation(),this.confirmSelection()}onEnterKeyDown(G){if(G.preventDefault(),this.isListOpen)this.confirmSelection();else this.onCompleted()}onUpDownKeyDown(G,D){if(G.preventDefault(),!this.isListOpen)this.forceOpenList();else this.autocompleteList?.onNavigationKeyDown(G,D)}onEscapeKeyDown(G){if(this.isListOpen)G.preventDefault(),G.stopPropagation(),this.closeList(),this.setCaret(this.lastPosition,!0)}onFocusOut(){if(this.isListOpen)this.closeList()}updatePositionAndList(){this.updateLastPosition(),this.updateAutocompleteList(this.eAutocompleteInput.getValue()??null)}setCaret(G,D){if(D||LW(this.beans))this.eAutocompleteInput.getFocusableElement().focus();let z=this.eAutocompleteInput.getInputElement();if(z.setSelectionRange(G,G),G===z.value.length)z.scrollLeft=z.scrollWidth}forceOpenList(){this.onValueChanged(this.eAutocompleteInput.getValue())}updateLastPosition(){this.lastPosition=this.eAutocompleteInput.getInputElement().selectionStart??0}validate(G){if(!this.validator)return;let D=this.validationMessage=this.validator(G);this.eAutocompleteInput.getInputElement().setCustomValidity(D??""),this.valid=!D,this.dispatchLocalEvent({type:"eventValidChanged",isValid:this.valid,validationMessage:D})}openList(){this.isListOpen=!0,this.autocompleteList=this.createBean(new y6({autocompleteEntries:this.autocompleteListParams.entries,onConfirmed:()=>this.confirmSelection(),forceLastSelection:this.forceLastSelection}));let G=this.autocompleteList.getGui(),D={ePopup:G,type:"autocomplete",eventSource:this.getGui(),position:"under",alignSide:this.gos.get("enableRtl")?"right":"left",keepWithinBounds:!0},z=this.popupSvc.addPopup({eChild:G,anchorToElement:this.getGui(),positionCallback:()=>this.popupSvc.positionPopupByComponent(D),ariaLabel:this.listAriaLabel});this.hidePopup=z.hideFunc,this.autocompleteList.afterGuiAttached()}closeList(){this.isListOpen=!1,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 VU(this.eAutocompleteInput.getValue())}setInputPlaceholder(G){return this.eAutocompleteInput.setInputPlaceholder(G),this}setInputAriaLabel(G){return this.eAutocompleteInput.setInputAriaLabel(G),this}setListAriaLabel(G){return this.listAriaLabel=G,this}setListGenerator(G){return this.listGenerator=G,this}setValidator(G){return this.validator=G,this}isValid(){return this.valid}setValue(G){let{value:D,position:z,silent:B,updateListOnlyIfOpen:Q,restoreFocus:J}=G;if(this.eAutocompleteInput.setValue(D,!0),this.setCaret(z??this.lastPosition,J),!B)this.updateValue(D);if(!Q||this.isListOpen)this.updateAutocompleteList(D)}setForceLastSelection(G){return this.forceLastSelection=G,this}setInputDisabled(G){return this.eAutocompleteInput.setDisabled(G),this}},AW={selector:"AG-AUTOCOMPLETE",component:MW},qQ={buttons:["apply"],suppressBuilderButton:!1},bU={apply:"advancedFilterApply",clear:"advancedFilterClear",cancel:"advancedFilterCancel",reset:"advancedFilterReset"},RW={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"}]}]},x6=class extends BW{constructor(){super(RW,[AW,zW]);this.eAutocomplete=fz,this.eButtons=fz,this.eBuilderFilterButton=fz,this.eBuilderFilterButtonIcon=fz,this.eBuilderFilterButtonLabel=fz,this.expressionParser=null,this.isApplyDisabled=!0,this.builderOpen=!1}wireBeans(G){this.advFilterExpSvc=G.advFilterExpSvc,this.advancedFilter=G.advancedFilter,this.filterManager=G.filterManager,this.registry=G.registry}postConstruct(){this.tooltipFeature=this.createOptionalManagedBean(this.registry.createDynamicBean("tooltipFeature",!1,{getGui:()=>this.getGui(),getTooltipShowDelayOverride:()=>1000,getLocation:()=>"advancedFilter"})),this.eAutocomplete.setListGenerator((z,B)=>this.generateAutocompleteListParams(B)).setValidator(()=>this.validateValue()).setForceLastSelection((z,B)=>this.forceLastSelection(z,B)).setInputAriaLabel(this.advFilterExpSvc.translate("ariaAdvancedFilterInput")).setListAriaLabel(this.advFilterExpSvc.translate("ariaLabelAdvancedFilterAutocomplete")),this.refresh(),this.addManagedListeners(this.eAutocomplete,{eventValueChanged:({value:z})=>this.onValueChanged(z),eventValueConfirmed:({isValid:z})=>this.onValueConfirmed(z),eventOptionSelected:({position:z,updateEntry:B,autocompleteType:Q})=>this.onOptionSelected(z,B,Q),eventValidChanged:({isValid:z,validationMessage:B})=>this.onValidChanged(z,B)});let{buttons:G,suppressBuilderButton:D}={...qQ,...this.gos.get("advancedFilterParams")};this.setupButtons(G),this.setupBuilderButton(D),this.beans.gos.addManagedPropertyListener("advancedFilterParams",(z)=>{let B={...qQ,...z.currentValue},Q={...qQ,...z.previousValue};if(B.buttons!==Q.buttons){let J=B.buttons.map((U)=>({type:U,label:this.advFilterExpSvc.translate(bU[U])}));this.eButtons.updateButtons(J)}if(B.suppressBuilderButton!==Q.suppressBuilderButton)CU(this.eBuilderFilterButton,!B.suppressBuilderButton)})}refresh(){let G=this.advancedFilter.getExpressionDisplayValue();this.eAutocomplete.setValue({value:G??"",position:G?.length,updateListOnlyIfOpen:!0})}setInputDisabled(G){this.eAutocomplete.setInputDisabled(G),this.eButtons.updateValidity(!G&&!this.isApplyDisabled&&!this.advancedFilter.isCurrentExpressionApplied())}setupButtons(G){let D=G.map((B)=>({type:B,label:this.advFilterExpSvc.translate(bU[B])})),z=(B)=>()=>{this.updateModel(B)};this.eButtons.addManagedListeners(this.eButtons,{apply:z("apply"),clear:z("clear"),reset:z("reset"),cancel:z("cancel")}),this.eButtons.updateButtons(D)}updateModel(G){switch(G){case"apply":this.onValueConfirmed(this.eAutocomplete.isValid());break;case"reset":this.advancedFilter.setModel(null),this.filterManager?.onFilterChanged({source:"advancedFilter"});break;case"cancel":this.advancedFilter.setModel(this.advancedFilter.getModel()),this.filterManager?.onFilterChanged({source:"advancedFilter"});break;case"clear":this.eAutocomplete.setValue({value:"",restoreFocus:!0});break}}setupBuilderButton(G){this.eBuilderFilterButtonIcon.appendChild(QW("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()}),CU(this.eBuilderFilterButton,!G)}onValueChanged(G){G=JW(G),this.advancedFilter.setExpressionDisplayValue(G),this.expressionParser=this.advancedFilter.createExpressionParser(G);let D=this.expressionParser?.parseExpression();if(D&&D!==G)this.eAutocomplete.setValue({value:D,silent:!0,restoreFocus:!0})}onValueConfirmed(G){if(!G||this.isApplyDisabled)return;this.eButtons?.updateValidity(!1),this.advancedFilter.applyExpression(),this.filterManager?.onFilterChanged({source:"advancedFilter"})}onOptionSelected(G,D,z){let{updatedValue:B,updatedPosition:Q,hideAutocomplete:J}=this.updateExpression(G,D,z);this.eAutocomplete.setValue({value:B,position:Q,updateListOnlyIfOpen:J,restoreFocus:!0})}validateValue(){return this.expressionParser?.isValid()?null:this.expressionParser?.getValidationMessage()??null}onValidChanged(G,D){this.isApplyDisabled=!G||this.advancedFilter.isCurrentExpressionApplied(),this.eButtons.updateValidity(!this.isApplyDisabled),this.tooltipFeature?.setTooltipAndRefresh(D)}generateAutocompleteListParams(G){return this.expressionParser?this.expressionParser.getAutocompleteListParams(G):this.advFilterExpSvc.getDefaultAutocompleteListParams("")}updateExpression(G,D,z){return this.advFilterExpSvc.updateAutocompleteCache(D,z),this.expressionParser?.updateExpression(G,D,z)??this.advancedFilter.getDefaultExpression(D)}forceLastSelection({key:G,displayValue:D},z){return!!z.toLocaleLowerCase().match(`^${(D??G).toLocaleLowerCase()}\\s*$`)}openBuilder(){if(this.builderOpen)return;this.builderOpen=!0,RU(this.eBuilderFilterButton,!0),this.advancedFilter.getCtrl().toggleFilterBuilder({source:"ui",eventSource:this.eBuilderFilterButton})}closeBuilder(){if(!this.builderOpen)return;this.builderOpen=!1,RU(this.eBuilderFilterButton,!1),this.eBuilderFilterButton.focus()}},xW={tag:"div",cls:"ag-advanced-filter-header",role:"row"},cW=class extends CW{constructor(G){super(xW);this.enabled=G}wireBeans(G){this.colModel=G.colModel,this.focusSvc=G.focusSvc,this.ctrlsSvc=G.ctrlsSvc}postConstruct(){this.setupAdvancedFilter(this.enabled),this.addDestroyFunc(()=>this.destroyBean(this.eAdvancedFilter));let G=()=>{if(this.enabled)this.setEnabledHeight()};this.addManagedEventListeners({gridColumnsChanged:()=>this.onGridColumnsChanged(),columnHeaderHeightChanged:G,stylesChanged:G}),this.addManagedPropertyListener("headerHeight",G),this.addManagedPropertyListener("floatingFiltersHeight",G),this.addGuiEventListener("keydown",(D)=>this.onKeyDown(D)),this.addGuiEventListener("focusout",(D)=>{if(!this.getFocusableElement().contains(D.relatedTarget))this.focusSvc.clearAdvancedFilterColumn()})}getFocusableElement(){return this.eAdvancedFilter?.getGui()??this.getGui()}setEnabled(G){if(G===this.enabled)return;this.setupAdvancedFilter(G)}refresh(){this.eAdvancedFilter?.refresh()}getHeight(){return this.height}setInputDisabled(G){this.eAdvancedFilter?.setInputDisabled(G)}setupAdvancedFilter(G){let D=this.getGui();if(G){this.eAdvancedFilter=this.createBean(new x6);let z=this.eAdvancedFilter.getGui();this.eAdvancedFilter.addCss("ag-advanced-filter-header-cell"),this.setEnabledHeight(),this.setAriaRowIndex(),gW(z,"gridcell"),jW(z,1),this.setAriaColumnCount(z),D.appendChild(z)}else VW(D),this.destroyBean(this.eAdvancedFilter),this.height=0;yW(D,G),this.enabled=G}setEnabledHeight(){let G=this.getGui();this.height=uW(this.beans);let D=`${this.height}px`;G.style.height=D,G.style.minHeight=D}setAriaColumnCount(G){PW(G,this.colModel.getCols().length)}setAriaRowIndex(){TW(this.getGui(),this.ctrlsSvc.getHeaderRowContainerCtrl()?.getRowCount()??0)}onGridColumnsChanged(){if(!this.eAdvancedFilter)return;this.setAriaColumnCount(this.eAdvancedFilter.getGui()),this.setAriaRowIndex()}onKeyDown(G){switch(G.key){case Nz.ENTER:{if(this.hasFocus()){if(vW(this.getFocusableElement()))G.preventDefault()}break}case Nz.ESCAPE:if(!this.hasFocus())this.getFocusableElement().focus();break;case Nz.UP:this.navigateUpDown(!0,G);break;case Nz.DOWN:this.navigateUpDown(!1,G);break;case Nz.TAB:if(this.hasFocus())this.navigateLeftRight(G);else{let D=bW(this.beans,this.getFocusableElement(),null,G.shiftKey);if(D)G.preventDefault(),D.focus();else this.navigateLeftRight(G)}break}}navigateUpDown(G,D){if(this.hasFocus()){if(this.focusSvc.focusNextFromAdvancedFilter(G))D.preventDefault()}}navigateLeftRight(G){if(G.shiftKey?this.focusSvc.focusLastHeader():this.focusSvc.focusNextFromAdvancedFilter(!1,!0))G.preventDefault()}hasFocus(){return OW(this.beans)===this.getFocusableElement()}},c6=class extends C6{},tW=class extends pW{constructor(G,D){super();this.comp=G,this.virtualList=D}postConstruct(){this.createManagedBean(new c6(this.comp,this.virtualList,{dragSourceType:mW.AdvancedFilterBuilder,addListeners:(G,D,z)=>{G.addManagedListeners(this,{advancedFilterBuilderDragStarted:D,advancedFilterBuilderDragEnded:z})},getCurrentDragValue:(G)=>this.getCurrentDragValue(G),isMoveBlocked:()=>!1,getNumRows:(G)=>G.getNumItems(),moveItem:(G,D)=>this.moveItem(G,D)}))}getCurrentDragValue(G){return G.item}moveItem(G,D){this.comp.moveItem(G,D)}},_q=100;function kq(G){let{host:D,source:z,useAsyncSearch:B,onMisconfiguredSearchSource:Q,onFirstValuesPageLoaded:J}=G,U=new wq({host:D,source:z,onMisconfiguredSearchSource:Q,onFirstValuesPageLoaded:J??(()=>{})}),Z=typeof z.loadValuesPage==="function";return{controller:U,hasPagedSource:Z,onSearch:B?(S)=>U.onSearch(S):void 0,onLoadMoreRows:Z?(S)=>U.loadValuesPage(S??"down"):void 0}}var wq=class{constructor(G){this.ctrlParams=G,this.currentSearchRequest=0,this.currentValuesPageRequest=0,this.valuesPageLoading=!1,this.valuesPageHasMoreNext=!1,this.valuesPageHasMorePrev=!1,this.valuesPageLoadedValues=[],this.valuesPageSearch="",this.valuesPageWindowStartRow=0,this.destroyed=!1}destroy(){this.destroyed=!0,this.currentSearchRequest++,this.currentValuesPageRequest++}onSearch(G){if(this.destroyed)return;if(this.isValuesPaged()){this.resetValuesPage(G);return}let D=++this.currentSearchRequest,{host:z,source:B,onMisconfiguredSearchSource:Q}=this.ctrlParams;if(z.setValueList({refresh:!0,valueList:void 0}),!G)return;if(typeof B.searchValues!=="function"){Q?.();return}let J;try{J=B.searchValues(G)}catch(U){if(kQ("Rich Select",U),D===this.currentSearchRequest)z.setValueList({refresh:!0,valueList:[]});return}if(Array.isArray(J)){Q?.(),z.setValueList({refresh:!0,valueList:J});return}z.setValueList({valueList:J.then((U)=>{if(D===this.currentSearchRequest)return U}).catch((U)=>{if(kQ("Rich Select",U),D===this.currentSearchRequest)return[]}),refresh:!0})}resetValuesPage(G){if(this.destroyed)return;this.valuesPageSearch=G,this.valuesPageLoadedValues=[],this.valuesPageWindowStartRow=this.resolveValuesPageStartRow(G),this.valuesPageNextCursor=void 0,this.valuesPageHasMoreNext=!0,this.valuesPageHasMorePrev=this.valuesPageWindowStartRow>0,this.valuesPageLoading=!1,this.currentValuesPageRequest++,this.ctrlParams.host.setValueList({valueList:void 0,refresh:!0,isInitial:!0}),this.loadValuesPage("down")}loadValuesPage(G){if(this.destroyed)return;let D=this.ctrlParams.source.loadValuesPage;if(typeof D!=="function"||this.valuesPageLoading)return;if(G==="up"&&!this.valuesPageHasMorePrev||G==="down"&&!this.valuesPageHasMoreNext)return;let z=Math.max(this.ctrlParams.source.valuesPageSize??_q,1),B=G==="up"?Math.max(this.valuesPageWindowStartRow-z,0):this.valuesPageWindowStartRow+this.valuesPageLoadedValues.length,Q=G==="up"?this.valuesPageWindowStartRow:B+z;if(B>=Q){if(G==="up")this.valuesPageHasMorePrev=!1;else this.valuesPageHasMoreNext=!1;return}let J=this.currentValuesPageRequest,U={search:this.valuesPageSearch,startRow:B,endRow:Q,cursor:G==="down"?this.valuesPageNextCursor:void 0};if(this.valuesPageLoading=!0,this.valuesPageLoadedValues.length===0)this.ctrlParams.host.setIsLoading();let Z;try{Z=D(U)}catch(S){this.handleValuesPageError(S,J);return}Promise.resolve(Z).then((S)=>this.applyValuesPageResult(S,z,J,G,B,Q)).catch((S)=>this.handleValuesPageError(S,J))}applyValuesPageResult(G,D,z,B,Q,J){if(this.destroyed||z!==this.currentValuesPageRequest)return;this.valuesPageLoading=!1;let U=this.valuesPageLoadedValues.length===0,Z=G?.values??[];if(B==="up"){if(Z.length)this.valuesPageLoadedValues=[...Z,...this.valuesPageLoadedValues],this.valuesPageWindowStartRow=Q;let S=J-Q;this.valuesPageHasMorePrev=Q>0&&Z.length>=S}else{if(Z.length)this.valuesPageLoadedValues=[...this.valuesPageLoadedValues,...Z];this.valuesPageNextCursor=G?.cursor;let S=this.valuesPageLoadedValues.length;if(typeof G?.lastRow==="number")this.valuesPageHasMoreNext=this.valuesPageWindowStartRow+S=D}if(this.ctrlParams.host.setValueList({valueList:this.valuesPageLoadedValues,refresh:!0,isInitial:!0,scrollToCurrentValue:U,prependedRowCount:B==="up"?Z.length:void 0}),U)this.ctrlParams.onFirstValuesPageLoaded()}handleValuesPageError(G,D){if(kQ("Rich Select",G),this.destroyed||D!==this.currentValuesPageRequest)return;this.valuesPageLoading=!1,this.valuesPageHasMoreNext=!1,this.valuesPageHasMorePrev=!1,this.ctrlParams.host.setValueList({valueList:this.valuesPageLoadedValues,refresh:!0,isInitial:!0})}resolveValuesPageStartRow(G){if(G)return 0;let D=this.ctrlParams.source.valuesPageInitialStartRow?.(G);return Math.max(Math.floor(D??0),0)}isValuesPaged(){return typeof this.ctrlParams.source.loadValuesPage==="function"}},Cq={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"}]},Vq=class extends Rq{constructor(G){super(Cq);this.config=G,this.eText=gU,this.eButton=gU}postConstruct(){let{config:G,eButton:D}=this,{onKeyDown:z,onButtonClick:B}=G;if(this.getGui().setAttribute("tabindex",String(this.gos.get("tabIndex"))),this.addGuiEventListener("focus",()=>{this.eButton.focus()}),z)this.addGuiEventListener("keydown",z);if(B)this.addManagedElementListeners(D,{click:B})}toggleCloseButtonClass(G,D){this.eButton.classList.toggle(G,D)}setText(G){this.eText.textContent=G}getText(){return this.eText.textContent}},bq={tag:"div",cls:"ag-pill-container"},vq=class extends Kq{constructor(){super(bq);this.pills=[]}init(G){this.params=G,this.getKey=G.valueFormatter??((D)=>String(D)),this.refresh()}refresh(){this.clearPills();let{params:G,onPillKeyDown:D,getKey:z}=this,B=G.getValue();if(!Array.isArray(B)){if(B==null)return;B=[B]}let Q=G.valueFormatter??((U)=>String(U)),J=B.length;Mq(this.getGui(),J===0?"presentation":"listbox");for(let U=0;Uthis.onPillButtonClick(S),onKeyDown:D.bind(this)})),X=S.getGui();if(Iq(X,U+1),Aq(X,J),G.onPillMouseDown)S.addGuiEventListener("mousedown",G.onPillMouseDown);if(G.announceItemFocus)S.addGuiEventListener("focus",G.announceItemFocus);S.setText(Q(Z)??""),S.toggleCloseButtonClass("ag-icon-cancel",!0),this.appendChild(X),this.pills.push({key:z(Z)??U.toString(),pill:S})}}onNavigationKeyDown(G){let{key:D}=G,z=this.gos.get("enableRtl"),B=!z&&D===oG.LEFT||z&&D===oG.RIGHT,Q=!z&&D===oG.RIGHT||z&&D===oG.LEFT;if(!this.pills.length||!B&&!Q)return;G.preventDefault();let{beans:J,params:U}=this,Z=PU(J),S=this.getGui(),X=Nq(S);if(S.contains(Z)){let Y=X.find((q)=>q.contains(Z));if(Y&&Y!==Z)Y.focus();let W=Fq(J,S,!1,B);if(W)W.focus();else if(Q)U.focusAfterForwardBoundary?.()}else if(X.length>0)X[Q?0:X.length-1].focus()}clearPills(){let G=this.getGui();if(G.contains(PU(this.beans))&&this.params.eWrapper)this.params.eWrapper.focus();fq(G),this.destroyBeans(this.pills.map(({pill:D})=>D)),this.pills=[]}onPillButtonClick(G){this.deletePill(G)}onPillKeyDown(G){let D=G.key;if(D===oG.LEFT||D===oG.RIGHT){if(G.stopPropagation(),this.params.onHorizontalArrowKeyDown)this.params.onHorizontalArrowKeyDown(G);else this.onNavigationKeyDown(G);return}if(D!==oG.DELETE&&D!==oG.BACKSPACE)return;G.preventDefault();let z=Eq(this.beans),B=this.pills.findIndex(({pill:J})=>J.getGui().contains(z.activeElement));if(B===-1)return;let Q=this.pills[B];if(Q?.pill)this.deletePill(Q.pill,B)}deletePill(G,D){let{getKey:z,pills:B,params:Q}=this,J=(B[D??-1]??B.find(({pill:Z})=>Z===G))?.key,U=(Q.getValue()||[]).filter((Z)=>z(Z)!==J);if(Q.setValue(U),!U.length)if(Q.focusAfterDelete)Q.focusAfterDelete();else Q.eWrapper?.focus();else if(D!=null){let{pill:Z}=B[Math.min(D,B.length-1)];if(Z)Z.getFocusableElement().focus()}}destroy(){this.clearPills(),super.destroy()}},Oq=".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}",pq={tag:"div",cls:"ag-rich-select-row",role:"presentation"},mq=class extends xq{constructor(G){super(pq);this.params=G,this.valueFormatter=HJ(G.valueFormatter)}wireBeans(G){this.userCompFactory=G.userCompFactory,this.registry=G.registry}postConstruct(){this.tooltipFeature=this.createOptionalManagedBean(this.registry.createDynamicBean("highlightTooltipFeature",!1,{getGui:()=>this.getGui(),shouldDisplayTooltip:()=>this.shouldDisplayTooltip?.()??!0},this))}setState(G){let D=this.valueFormatter(G);if(!this.populateWithRenderer(G,D))this.populateWithoutRenderer(G,D);this.value=G}highlightString(G){let{parsedValue:D,params:z}=this;if(z.cellRenderer||!Fz(D))return;let B=Fz(G);if(B){let Q=D?.toLocaleLowerCase().indexOf(G.toLocaleLowerCase());if(Q>=0){let J=Q+G.length,U=this.getGui().querySelector("span");if(U)hq(U),U.append(D.slice(0,Q),yU({tag:"span",cls:"ag-rich-select-row-text-highlight",children:D.slice(Q,J)}),D.slice(J))}else B=!1}if(!B)this.renderValueWithoutRenderer(D)}updateSelected(G){let D=this.getGui();dq(D.parentElement,G),this.toggleCss("ag-rich-select-row-selected",G)}getValue(){return this.value}toggleHighlighted(G){this.toggleCss("ag-rich-select-row-highlighted",G),this.dispatchLocalEvent({type:"itemHighlighted",highlighted:G})}populateWithoutRenderer(G,D){let z=this.getGui(),B=yU({tag:"span"});B.style.overflow="hidden",B.style.textOverflow="ellipsis";let Q=lq(Fz(D)?D:G);this.parsedValue=Fz(Q)?Q:null,z.appendChild(B),this.renderValueWithoutRenderer(Q),this.shouldDisplayTooltip=nq(()=>B),this.tooltipFeature?.setTooltipAndRefresh(this.parsedValue)}renderValueWithoutRenderer(G){let D=this.getGui().querySelector("span");if(!D)return;D.textContent=Fz(G)?G:" "}populateWithRenderer(G,D){let z,B,{cellRenderer:Q,cellRendererParams:J}=this.params;if(Q){let U=this.getParentComponent()?.getParentComponent();B=iq(this.userCompFactory,this.params,cq(this.gos,{value:G,valueFormatted:D,cellRendererParams:J,getValue:()=>U?.getValue(),setValue:(Z)=>{U?.setValue(Z,!0)},setTooltip:(Z,S)=>{this.gos.assertModuleRegistered("Tooltip",3),this.shouldDisplayTooltip=S,this.tooltipFeature?.setTooltipAndRefresh(Z)}}))}if(B)z=B.newAgStackInstance();if(z)h6(z,this.getGui());if(z)return z.then((U)=>{this.addDestroyFunc(()=>{this.destroyBean(U)})}),!0;return!1}},xU="ag-rich-select-list",cU="ag-rich-select-row",A0=0,tq=1,LB=2,l1=3,sq=class extends Lz{constructor(G,D,z){super({cssIdentifier:"rich-select"});this.params=G,this.richSelectWrapper=D,this.getSearchString=z,this.lastRowHovered=-1,this.selectedItems=new Set,this.loadingState=l1,this.loadMoreRowsThreshold=10,this.valueFormatter=HJ(G.valueFormatter),this.setComponentCreator(this.createRowComponent.bind(this)),this.setComponentUpdater(()=>{})}postConstruct(){super.postConstruct();let G=this.getLocaleTextFunc();this.loadingLabel=G("loadingOoo","Loading..."),this.noMatchesLabel=G("noMatches","No matches to show"),this.eLoadingIcon=Pq("richSelectLoading",this.beans,null),this.eStateCompLabel=TU({tag:"span",cls:"ag-loading-text",children:this.loadingLabel}),this.eStateComp=TU({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);let{cellRowHeight:D,pickerAriaLabelKey:z,pickerAriaLabelValue:B}=this.params;if(D)this.setRowHeight(D);let Q=this.getGui(),J=this.getAriaElement();this.addManagedListeners(Q,{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)}),Q.classList.add(xU);let U=`${xU}-${this.getCompId()}`;J.setAttribute("id",U);let Z=G(z,B);yq(J,Z),Tq(this.richSelectWrapper,J)}setIsLoading(){this.setLoadingState(A0)}setLoadingState(G){let D=this.loadingState!==G;if(this.loadingState=G,this.toggleStateComp(),this.toggleVisibility(),D){let z=this.getStateAnnouncementText(G);if(z)this.stateAnnouncementCallback?.(z)}}toggleStateComp(){let{eStateComp:G,eStateCompLabel:D,eLoadingIcon:z,loadingState:B,loadingLabel:Q,noMatchesLabel:J,params:U}=this;if(!G)return;if(B===A0){if(D.textContent=Q,z)kD(z,!0);kD(G,!0);return}if(B===LB&&U.allowNoResultsCopy){if(D.textContent=J,z)kD(z,!1);kD(G,!0);return}kD(G,!1)}shouldBeVisible(){if(this.loadingState===LB)return!!this.params.allowNoResultsCopy;return this.loadingState!==l1}toggleVisibility(G){let D=this.getGui();if(G===void 0)kD(D,this.shouldBeVisible());else kD(D,G);this.scheduleMaybeRequestMoreRows()}setLoadMoreRowsCallback(G,D=10){this.loadMoreRowsCallback=G,this.loadMoreRowsThreshold=Math.max(D,1),this.maybeRequestMoreRows()}setStateAnnouncementCallback(G){this.stateAnnouncementCallback=G}navigateToPage(G){let D=super.navigateToPage(G,this.lastRowHovered);if(D!=null)wQ(this.beans,()=>{if(!this.isAlive())return null;this.highlightIndex(D)});return D}drawVirtualRows(G){if(super.drawVirtualRows(G),this.refreshSelectedItems(),this.lastRowHovered!==-1)this.updateRenderedHighlightState(this.lastRowHovered)}highlightFilterMatch(G){this.forEachRenderedRow((D)=>{D.highlightString(G)})}onNavigationKeyDown(G,D){wQ(this.beans,()=>{if(!this.currentList||!this.isAlive())return;let z=this.currentList.length,B=this.lastRowHovered,Q=G===uq.DOWN?1:-1,J=Math.min(Math.max(B===-1?0:B+Q,0),z-1);this.highlightIndex(J),D()})}selectValue(G){if(!this.currentList||G==null)return!1;let D=this.getIndicesForValues(G),z=D.length>0;if(z)this.refresh(),this.ensureIndexVisible(D[0]),this.refresh(!0);if(this.selectListItems(Array.isArray(G)?G:[G]),z)this.highlightIndex(D[0],!0);return z}selectListItems(G,D=!1){if(!D)this.selectedItems.clear();for(let z=0;zG.length,getRow:(z)=>G[z],areRowsEqual:(z,B)=>z===B})}offsetHoveredIndexOnPrependedRows(G){if(G<=0||this.lastRowHovered<0)return;this.lastRowHovered+=G}restoreScrollOnPrependedRows(G,D){if(D<=0)return;let z=this.getGui(),B=this.getRowHeight(),Q=G+D*B;this.awaitStable(()=>{if(!this.isAlive())return;z.scrollTop=Q})}getSelectedItems(){return this.selectedItems}getLastItemHovered(){return this.currentList?.[this.lastRowHovered]}highlightIndex(G,D){if(!this.currentList)return;if(G<0||G>=this.currentList.length)this.lastRowHovered=-1,this.setActiveOption();else if(this.lastRowHovered=G,this.ensureIndexVisible(G,!D)&&!D)this.refresh(!0);this.updateRenderedHighlightState(G)}updateRenderedHighlightState(G){let D;this.forEachRenderedRow((z,B)=>{let Q=G===B;if(z.toggleHighlighted(Q),Q)D=`${cU}-${z.getCompId()}`}),this.setActiveOption(D)}setActiveOption(G){gq(this.richSelectWrapper,G??null),jq(this.richSelectWrapper,"data-active-option",G)}getIndicesForValues(G){let{currentList:D}=this;if(!D||D.length===0||G===void 0)return[];let z=Array.isArray(G)?G:[G];if(z.length===0)return[];let B=[],Q;for(let J of z){let U=D.indexOf(J);if(U===-1&&J!=null){Q??(Q=D.map((S)=>this.valueFormatter(S)));let Z=this.getComparableFormattedValue(J);U=Q.indexOf(Z)}if(U>=0)B.push(U)}return B}toggleListItemSelection(G){let D=this.findItemInSelected(G);if(D!==void 0)this.selectedItems.delete(D);else this.selectedItems.add(G);this.refreshSelectedItems(),this.dispatchValueSelected()}refreshSelectedItems(){this.forEachRenderedRow((G)=>{let D=this.findItemInSelected(G.getValue())!==void 0;G.updateSelected(D)})}findItemInSelected(G){if(typeof G==="object"){if(this.selectedItems.has(G))return G;let D=this.valueFormatter(G);for(let z of this.selectedItems)if(this.valueFormatter(z)===D)return z}else return this.selectedItems.has(G)?G:void 0}getComparableFormattedValue(G){return G!=null&&typeof G==="object"?this.valueFormatter(G):String(G??"")}createRowComponent(G,D){let z=new mq(this.params);D.setAttribute("id",`${cU}-${z.getCompId()}`),z.setParentComponent(this),this.createBean(z),z.setState(G);let{highlightMatch:B,searchType:Q="fuzzy"}=this.params;if(B&&Q!=="fuzzy")z.highlightString(this.getSearchString());return z}getRowForMouseEvent(G){if(!this.model)return-1;let z=this.getGui().getBoundingClientRect(),B=this.getScrollTop(),Q=G.clientY-z.top+B;return Math.min(Math.max(Math.floor(Q/this.getRowHeight()),0),this.model.getRowCount()-1)}onMouseMove(G){let D=this.getRowForMouseEvent(G);if(D!==-1&&D!=this.lastRowHovered)this.lastRowHovered=D,this.highlightIndex(D,!0)}onGuiScroll(){this.maybeRequestMoreRows(!0)}scheduleMaybeRequestMoreRows(){if(this.beans){wQ(this.beans,()=>this.maybeRequestMoreRows(!1));return}this.maybeRequestMoreRows(!1)}maybeRequestMoreRows(G=!1){let D=this.loadMoreRowsCallback,z=this.currentList;if(!D||!z||this.loadingState===A0)return;let B=this.getGui();if(B.clientHeight<=0)return;let J=(B.scrollHeight-(B.scrollTop+B.clientHeight))/this.getRowHeight(),U=B.scrollTop/this.getRowHeight(),Z=B.scrollHeight>B.clientHeight;if(U<=this.loadMoreRowsThreshold&&(G||!Z))D("up");if(J<=this.loadMoreRowsThreshold)D("down")}getStateAnnouncementText(G){if(G===A0)return this.loadingLabel;if(G===LB&&this.params.allowNoResultsCopy)return this.noMatchesLabel;return}onMouseDown(G){G.preventDefault()}onMouseOut(G){if(!this.getGui().contains(G.relatedTarget))this.highlightIndex(-1)}onClick(G){let{multiSelect:D}=this.params;if(!this.currentList?.length)return;let z=this.getRowForMouseEvent(G),B=this.currentList[z];if(D)this.toggleListItemSelection(B);else this.selectListItems([B]),this.dispatchValueSelected()}dispatchValueSelected(){this.dispatchLocalEvent({type:"richSelectListRowSelected",fromEnterKey:!1,value:this.selectedItems})}destroy(){super.destroy(),this.eStateComp=void 0}};function oq(G){if(!G)return l1;if(G.length)return tq;return LB}var hU=300,rq={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"}}]}]},gB=class extends Qq{constructor(G){let D=HJ(G?.valueFormatter),z=G?.agComponents?.includes(vU)?G.agComponents:[vU,...G?.agComponents??[]];super({...G,pickerAriaLabelKey:G?.pickerAriaLabelKey??"ariaLabelRichSelectField",pickerAriaLabelValue:G?.pickerAriaLabelValue??"Rich Select Field",pickerType:G?.pickerType??"ag-list",className:G?.className??"ag-rich-select",pickerIcon:G?.pickerIcon??"richSelectOpen",ariaRole:G?.ariaRole??"combobox",template:G?.template??rq,agComponents:z,modalPicker:G?.modalPicker??!1,valueFormatter:D,maxPickerHeight:G?.maxPickerHeight??"calc(var(--ag-row-height) * 6.5)"});this.searchString="",this.loadMoreRowsThreshold=10,this.hasPagedAsyncSource=!1,this.searchStringCreator=null,this.eInput=OU,this.eDeselect=OU,this.skipWrapperAnnouncement=!1,this.onPillHorizontalArrowKeyDown=(S)=>{this.handleHorizontalNavigationKey(S)},this.valueFormatter=D;let{value:B,valueList:Q,searchStringCreator:J,onSearch:U}=G??{};if(B!==void 0)this.value=B;if(J)this.searchStringCreator=J;if(Q!=null)this.setValueList({valueList:Q,isInitial:!0});let{searchDebounceDelay:Z=hU}=this.config;if(U)this.onSearchCallbackDebounced=_Q(this,U,Z);this.registerCSS(Oq)}wireBeans(G){this.userCompFactory=G.userCompFactory,this.ariaAnnounce=G.ariaAnnounce,this.registry=G.registry}postConstruct(){this.tooltipFeature=this.createOptionalManagedBean(this.registry.createDynamicBean("tooltipFeature",!1,{getGui:()=>this.getGui(),shouldDisplayTooltip:()=>this.shouldDisplayTooltip?.()??!0})),super.postConstruct(),this.createListComponent(),this.eDeselect.appendChild(Zq("richSelectRemove",this.beans));let{allowTyping:G,placeholder:D,multiSelect:z,suppressDeselectAll:B,suppressMultiSelectPillRenderer:Q}=this.config;if(this.eDeselect.classList.add("ag-hidden"),G){if(this.eInput.setAutoComplete(!1).setInputPlaceholder(D),!z)this.eDisplayField.classList.add("ag-hidden");else if(this.eWrapper.classList.add("ag-rich-select-typing-multi"),!Q)this.eDisplayField.classList.add("ag-rich-select-pill-display")}else this.eInput.setDisplayed(!1);this.setupAriaProperties();let{searchDebounceDelay:J=300}=this.config;if(this.clearSearchString=_Q(this,this.clearSearchString.bind(this),J),this.renderSelectedValue(),G)this.eInput.onValueChange((U)=>{this.openPickerOnTypingIfNeeded(U),this.updateTypingMultiSelectPlaceholder(U),this.searchTextFromString(U)});if(this.addManagedElementListeners(this.eWrapper,{focus:this.onWrapperFocus.bind(this)}),this.addManagedElementListeners(this.eWrapper,{focusout:this.onWrapperFocusOut.bind(this)}),!B)this.addManagedElementListeners(this.eDeselect,{mousedown:this.onDeselectAllMouseDown.bind(this),click:this.onDeselectAllClick.bind(this)})}setupAriaProperties(){let{eWrapper:G,gos:D}=this;G.tabIndex=D.get("tabIndex");let z=this.getLocaleTextFunc();this.ariaDeleteSelection=z("ariaLabelRichSelectDeleteSelection","Press DELETE to deselect item"),this.ariaDeselectAllItems=z("ariaLabelRichSelectDeselectAllItems","Press DELETE to deselect all items"),this.ariaToggleSelection=z("ariaLabelRichSelectToggleSelection","Press SPACE to toggle selection")}createListComponent(){this.listComponent=this.createBean(new sq(this.config,this.getFocusableElement(),()=>this.searchString)),this.listComponent.setLoadMoreRowsCallback(this.loadMoreRowsCallback,this.loadMoreRowsThreshold),this.listComponent.setStateAnnouncementCallback((G)=>this.announceAriaValue(G)),this.listComponent.setParentComponent(this),this.addManagedListeners(this.listComponent,{richSelectListRowSelected:(G)=>{this.onListValueSelected(G.value,G.fromEnterKey)}})}renderSelectedValue(G){let{value:D,eDisplayField:z,config:B,gos:Q}=this,{allowTyping:J,cellRenderer:U,cellRendererParams:Z,initialInputValue:S,multiSelect:X,suppressDeselectAll:Y,suppressMultiSelectPillRenderer:W,onSearch:q}=B,H=this.valueFormatter(D),_=!!(J&&X);if(J){let K=_?S??this.eInput.getValue()??"":S??(D===""?"":H);if(this.eInput.setValue(K,!!G&&!!q),!_)return;this.updateTypingMultiSelectPlaceholder(K)}if(X&&!Y){let K=D==null||Array.isArray(D)&&D.length===0;this.eDeselect.classList.toggle("ag-hidden",K)}let k;if(X&&!W){this.createOrUpdatePillContainer(z);return}if(U&&!J)k=Sq(this.userCompFactory,B,Jq(this.gos,{value:D,valueFormatted:H,cellRendererParams:Z,getValue:()=>this.getValue(),setValue:(K)=>{this.setValue(K,!0)},setTooltip:(K,f)=>{Q.assertModuleRegistered("Tooltip",3),this.shouldDisplayTooltip=f,this.tooltipFeature?.setTooltipAndRefresh(K)}}));let w;if(k)w=k.newAgStackInstance();if(w)HQ(z),h6(w,z),w.then((K)=>{this.addDestroyFunc(()=>this.destroyBean(K))});else{if(D!=null)z.innerText=H,z.classList.remove("ag-display-as-placeholder");else{let{placeholder:K}=B;if($q(K))z.textContent=K,z.classList.add("ag-display-as-placeholder");else HQ(z)}this.shouldDisplayTooltip=Xq(()=>this.eDisplayField),this.tooltipFeature?.setTooltipAndRefresh(H??null)}}createPickerComponent(){let{values:G}=this;if(G)this.setValueList({valueList:G});return this.listComponent}setSearchStringCreator(G){this.searchStringCreator=G}setAsyncValuesSource(G){let{source:D,thresholdRows:z,useAsyncSearch:B,onMisconfiguredSearchSource:Q,onFirstValuesPageLoaded:J}=G;this.asyncRequests?.destroy();let U=kq({host:{setValueList:(Z)=>this.setValueList(Z),setIsLoading:()=>this.setIsLoading()},source:D,useAsyncSearch:B,onMisconfiguredSearchSource:Q,onFirstValuesPageLoaded:J});if(this.asyncRequests=U.controller,this.hasPagedAsyncSource=U.hasPagedSource,U.onSearch){let{searchDebounceDelay:Z=hU}=this.config;this.onSearchCallbackDebounced=_Q(this,U.onSearch,Z)}else if(!this.config.onSearch)this.onSearchCallbackDebounced=void 0;this.setLoadMoreRowsCallback(U.onLoadMoreRows,z??this.loadMoreRowsThreshold)}resetAsyncValues(G=""){if(!this.hasPagedAsyncSource)return;this.asyncRequests?.resetValuesPage(G)}setLoadMoreRowsCallback(G,D=10){this.loadMoreRowsCallback=G,this.loadMoreRowsThreshold=Math.max(D,1),this.listComponent?.setLoadMoreRowsCallback(this.loadMoreRowsCallback,this.loadMoreRowsThreshold)}setIsLoading(){this.listComponent?.setIsLoading()}setValueListInternal(G){let{listComponent:D,isPickerDisplayed:z,value:B}=this,{valueList:Q,refresh:J,isInitial:U,scrollToCurrentValue:Z=!0,prependedRowCount:S=0}=G;if(U)this.setValues(Q);if(!D)return;let X=S>0?D.getScrollTop():void 0;if(S>0)D.offsetHoveredIndexOnPrependedRows(S);if(D.setCurrentList(Q),!J)return;if(z&&X!=null&&S>0)D.restoreScrollOnPrependedRows?.(X,S);if(this.values){D.refresh(!0);let Y=B!=null&&D.getIndicesForValues(B).length>0;if(z&&Y&&Z)D.selectValue(B)}else if(z){if(!D.selectValue(B))D.refresh()}this.alignPickerToComponent()}setValueList(G){let{valueList:D}=G;if(!D||Array.isArray(D)){this.setValueListInternal(G);return}this.listComponent?.setIsLoading(),D.then((z)=>{if(z!==void 0)this.setValueListInternal({...G,valueList:z})}).catch(()=>{this.setValueListInternal({...G,valueList:[],refresh:!0})})}setValues(G){this.values=G,this.searchStrings=this.getSearchStringsFromValues(G||[])}showPicker(){let{listComponent:G,value:D}=this;if(!G)return;super.showPicker();let z=D??null;G.selectValue(z);let B=G.getIndicesForValues(z)[0];if(B!=null)this.tooltipFeature?.attemptToHideTooltip(),G.highlightIndex(B);else G.refresh()}createOrUpdatePillContainer(G){if(!this.pillContainer){let z=this.pillContainer=this.createBean(new vq);this.addDestroyFunc(()=>{this.destroyBean(this.pillContainer),this.pillContainer=null}),HQ(G),G.appendChild(z.getGui());let{config:B,eWrapper:Q,ariaDeleteSelection:J}=this;z.init({eWrapper:Q,valueFormatter:this.valueFormatter,onPillMouseDown:(U)=>{U.stopImmediatePropagation()},announceItemFocus:()=>{this.announceAriaValue(J)},focusAfterDelete:B.allowTyping?()=>this.focusTypingInputAtBoundary():void 0,focusAfterForwardBoundary:B.allowTyping?()=>this.focusTypingInputAtBoundary():void 0,onHorizontalArrowKeyDown:this.onPillHorizontalArrowKeyDown,getValue:()=>this.getValue(),setValue:(U)=>this.setValue(U,!0)})}let D=this.pillContainer.getGui().childElementCount;this.doWhileBlockingAnnouncement(()=>this.pillContainer?.refresh()),this.scrollTypingMultiSelectPillsToEndOnAdd(D)}scrollTypingMultiSelectPillsToEndOnAdd(G){let{allowTyping:D,multiSelect:z,suppressMultiSelectPillRenderer:B}=this.config;if(!D||!z||B)return;let Q=this.pillContainer?.getGui();if(!Q||Q.childElementCount<=G)return;jU(Q,Q.scrollWidth,this.isRtl())}doWhileBlockingAnnouncement(G){this.skipWrapperAnnouncement=!0,G(),this.skipWrapperAnnouncement=!1}isPreviousHorizontalNavigation(G){return G===o.LEFT!==this.isRtl()}isRtl(){return!!this.gos?.get("enableRtl")}isTypingInputAtPillBoundary(){let G=this.eInput.getInputElement(),{selectionStart:D,selectionEnd:z,value:B}=G;if(D==null||z==null||D!==z)return!1;return this.isRtl()?D===(B??"").length:D===0}focusTypingInputAtBoundary(){let G=this.eInput.getInputElement();G.focus();let D=this.isRtl()?G.value.length:0;G.setSelectionRange(D,D)}getActiveElementForKeyboardNavigation(){if(this.beans?.eRootDiv)return uU(this.beans);let G=this.getTypingInputElement();if(!G)return document.activeElement;return G.ownerDocument?.activeElement??document.activeElement}onWrapperFocus(){let{eInput:G,config:D}=this,{allowTyping:z,multiSelect:B,suppressDeselectAll:Q}=D;if(z){let J=G.getFocusableElement();J.focus(),J.select()}else if(B&&!Q&&!this.skipWrapperAnnouncement)this.announceAriaValue(this.ariaDeselectAllItems)}onWrapperFocusOut(G){if(!this.eWrapper.contains(G.relatedTarget))this.hidePicker()}onDeselectAllMouseDown(G){G.stopImmediatePropagation()}onDeselectAllClick(){this.setValue([],!0)}buildSearchStringFromKeyboardEvent(G){let{key:D}=G;if(D===o.BACKSPACE)this.searchString=this.searchString.slice(0,-1),D="";else if(!Yq(G))return;G.preventDefault(),this.searchTextFromCharacter(D)}searchTextFromCharacter(G){this.searchString+=G,this.runSearch(),this.clearSearchString()}searchTextFromString(G){if(G==null)G="";if(this.searchString=G,this.onSearchCallbackDebounced)this.setValueList({valueList:void 0,refresh:!0});this.runSearch()}getSearchStringsFromValues(G){if(typeof G[0]==="object"&&this.searchStringCreator)return this.searchStringCreator(G);return G.map((D)=>D===""?"":this.valueFormatter(D))}filterListModel(G){let{filterList:D}=this.config;if(!D)return;this.setValueList({valueList:G,refresh:!0})}runSearch(){if(!this.listComponent)return;if(this.onSearchCallbackDebounced){this.onSearchCallbackDebounced(this.searchString);return}let G=this.searchStrings;if(!G){this.listComponent.highlightIndex(-1);return}let{suggestions:D,filteredValues:z}=this.getSuggestionsAndFilteredValues(this.searchString,G),{filterList:B,highlightMatch:Q,searchType:J="fuzzy"}=this.config,U=!!(B&&this.searchString!=="");if(this.filterListModel(U?z:this.values||[]),!this.highlightEmptyValue())this.highlightListValue(D,z,U);if(Q&&J!=="fuzzy")this.listComponent?.highlightFilterMatch(this.searchString);this.listComponent?.toggleVisibility()}highlightEmptyValue(){if(this.searchString===""){let G=this.searchStrings?.indexOf("");if(G!==void 0&&G!==-1)return this.listComponent?.highlightIndex(G),!0}return!1}highlightListValue(G,D,z){if(G.length){let B=z?0:this.searchStrings?.indexOf(G[0]);if(B!==void 0)this.listComponent?.highlightIndex(B)}else if(this.listComponent?.highlightIndex(-1),!z||D.length)this.listComponent?.ensureIndexVisible(0);else if(z){let B=this.getFocusableElement();Uq(B,"data-active-option",null),qq(B,null)}}getSuggestionsAndFilteredValues(G,D){let z=[],B=[];if(!G.length)return{suggestions:z,filteredValues:B};let{searchType:Q="fuzzy",filterList:J}=this.config,U=this.values||[];if(Q==="fuzzy"){let Z=Lq({inputValue:G,allSuggestions:D,hideIrrelevant:!0});z=Z.values;let S=Z.indices;if(J&&S.length)for(let X=0;X{let X=Z.toLocaleLowerCase(),Y=this.searchString.toLocaleLowerCase(),W=Q==="match"?X.startsWith(Y):X.includes(Y);if(J&&W)B.push(U[S]);return W});return{suggestions:z,filteredValues:B}}clearSearchString(){this.searchString=""}setValue(G,D,z,B){if(this.value===G)return this.updateTypingMultiSelectPlaceholder(),this;let Q=Array.isArray(G);if(G!=null){if(!Q){if(!this.listComponent?.getIndicesForValues(G)?.length)return this}if(!z)this.listComponent?.selectValue(G)}if(super.setValue(G,D),!B)this.renderSelectedValue(z);else this.updateTypingMultiSelectPlaceholder();return this}onNavigationKeyDown(G,D,z){G.preventDefault();let B=D===o.DOWN;if(!this.isPickerDisplayed&&B){this.showPicker();return}this.listComponent?.onNavigationKeyDown(D,z)}onEnterKeyDown(G){let D=!!(this.config.allowTyping&&this.config.multiSelect);if(!this.isPickerDisplayed){if(D)G.preventDefault(),this.dispatchPickerEventAndHidePicker(this.value,!0);return}if(G.preventDefault(),this.listComponent?.getCurrentList()){let z=this.listComponent.getLastItemHovered();if(D){if(z!==void 0){let B=this.getCurrentSelectionWithAppendedItem(z);this.listComponent.selectValue(B),this.setValue(B,!1,!0),this.resetTypingMultiSelectSearchState(),this.hidePicker()}return}if(this.config.multiSelect||z===void 0)this.dispatchPickerEventAndHidePicker(this.value,!0);else this.onListValueSelected(new Set([z]),!0)}}getCurrentSelectionWithAppendedItem(G){let D=this.getValue(),z=Array.isArray(D)?[...D]:D!=null?[D]:[];if(!z.some((B)=>this.areValuesEquivalent(B,G)))z.push(G);return z}areValuesEquivalent(G,D){if(G===D)return!0;if(typeof G==="object"&&typeof D==="object"&&G!=null&&D!=null)return this.valueFormatter(G)===this.valueFormatter(D);return!1}resetTypingMultiSelectSearchState(){if(this.searchString="",this.eInput.setValue("",!0),this.onSearchCallbackDebounced){this.setValueList({valueList:void 0,refresh:!0});return}if(this.config.filterList&&this.values)this.setValueList({valueList:this.values,refresh:!0})}updateTypingMultiSelectPlaceholder(G){let{allowTyping:D,multiSelect:z,placeholder:B}=this.config;if(!D||!z)return;let Q=G??this.eInput.getValue()??"",J=Q.length>0,U=this.value,Z=(Array.isArray(U)?U.length>0:U!=null)||(this.listComponent?.getSelectedItems().size??0)>0,S=!J&&!Z?B:"";this.eInput.setInputPlaceholder(S),this.updateTypingMultiSelectInputSize(Q,S)}updateTypingMultiSelectInputSize(G,D){let z=this.getTypingInputElement();if(!z)return;let Q=Math.max(1,Math.min((G||D||"").length+1,32));if(z.size!==Q)z.size=Q;if(G){let J=this.pillContainer?.getGui();if(J)jU(J,J.scrollWidth,this.isRtl())}}getTypingInputElement(){let G=this.eInput.getInputElement;if(typeof G!=="function")return;return G.call(this.eInput)}openPickerOnTypingIfNeeded(G){let{isPickerDisplayed:D,config:{allowTyping:z,multiSelect:B}}=this;if(z&&B&&!D&&!!G)this.showPicker()}onDeleteKeyDown(G){let{eWrapper:D,beans:z}=this;if(uU(z)===D)G.preventDefault(),this.setValue([],!0)}onBackspaceKeyDown(G){if(!this.isTypingInputAtPillBoundary())return;let D=this.getValue(),z=Array.isArray(D)?D:D!=null?[D]:Array.from(this.listComponent?.getSelectedItems()??[]);if(!z.length)return;G.preventDefault(),this.setValue(z.slice(0,-1),!0)}onTabKeyDown(){let{config:G,isPickerDisplayed:D,listComponent:z}=this,{multiSelect:B}=G;if(!D||!z)return;if(B){let Q=this.getValueFromSet(z.getSelectedItems());if(Q)this.setValue(Q,!1,!0,!0)}else{let Q=z.getLastItemHovered();if(Q!==void 0)this.setValue(Q,!1,!0)}this.hidePicker()}getValueFromSet(G){let{multiSelect:D}=this.config;if(!D)return G.size?G.values().next().value:null;let z=Array.from(G);return z.length?z:null}onListValueSelected(G,D){let z=this.getValueFromSet(G);this.setValue(z,!1,!0);let{multiSelect:B,allowTyping:Q}=this.config;if(B&&Q)this.resetTypingMultiSelectSearchState(),this.hidePicker();else if(!B)this.dispatchPickerEventAndHidePicker(z,D)}dispatchPickerEventAndHidePicker(G,D){let z={type:"fieldPickerValueSelected",fromEnterKey:D,value:G};this.dispatchLocalEvent(z),this.hidePicker()}getFocusableElement(){let{allowTyping:G}=this.config;if(G)return this.eInput.getFocusableElement();return super.getFocusableElement()}handleHorizontalNavigationKey(G){let{allowTyping:D,multiSelect:z}=this.config;if(!D){G.preventDefault(),this.listComponent?.highlightIndex(-1),this.pillContainer?.onNavigationKeyDown(G);return}let B=this.pillContainer;if(!B)return;if(!z)return;let Q=this.getActiveElementForKeyboardNavigation(),J=this.isPreviousHorizontalNavigation(G.key),U=this.eInput.getInputElement();if(Q===U){if(J&&this.isTypingInputAtPillBoundary())this.listComponent?.highlightIndex(-1),B.onNavigationKeyDown(G);return}if(B.getGui().contains(Q)){this.listComponent?.highlightIndex(-1);let Z=Q;if(B.onNavigationKeyDown(G),!J&&this.getActiveElementForKeyboardNavigation()===Z)this.focusTypingInputAtBoundary()}}handlePageNavigationKey(G,D){let{allowTyping:z}=this.config;if(z&&(D===o.PAGE_HOME||D===o.PAGE_END)){G.preventDefault();let B=this.eInput.getInputElement(),Q=D===o.PAGE_HOME?0:B.value.length;B.setSelectionRange(Q,Q);return}if(G.preventDefault(),this.pickerComponent)this.listComponent?.navigateToPage(D)}handleVerticalNavigationKey(G,D,z){if(z)return;this.onNavigationKeyDown(G,D,()=>{if(this.config.multiSelect)this.doWhileBlockingAnnouncement(()=>this.eWrapper.focus()),this.announceAriaValue(this.ariaToggleSelection)})}handleEscapeKey(G){if(!this.isPickerDisplayed)return;if(Wq(this.listComponent.getGui()))G.preventDefault(),Hq(G);this.hidePicker()}handleEnterKey(G,D){if(D){G.preventDefault();return}this.onEnterKeyDown(G)}handleSpaceKey(G,D){let{allowTyping:z,multiSelect:B}=this.config,{isPickerDisplayed:Q,listComponent:J}=this,U=!D&&Q&&B&&!!J&&(!z||(this.eInput.getValue()??"")==="");if(!z||D||U)G.preventDefault();if(U&&J){let Z=J.getLastItemHovered();if(Z!==void 0)J.toggleListItemSelection(Z)}}handleBackspaceKey(G,D){if(!D&&this.config.allowTyping&&this.config.multiSelect)this.onBackspaceKeyDown(G)}handleDeleteKey(G){if(this.config.multiSelect&&!this.config.suppressDeselectAll)this.onDeleteKeyDown(G)}handleSearchWithoutTyping(G){if(!this.config.allowTyping)this.buildSearchStringFromKeyboardEvent(G)}onKeyDown(G){let{key:D,isComposing:z}=G;switch(D){case o.LEFT:case o.RIGHT:this.handleHorizontalNavigationKey(G);break;case o.PAGE_HOME:case o.PAGE_END:case o.PAGE_UP:case o.PAGE_DOWN:this.handlePageNavigationKey(G,D);break;case o.DOWN:case o.UP:this.handleVerticalNavigationKey(G,D,z);break;case o.ESCAPE:this.handleEscapeKey(G);break;case o.ENTER:this.handleEnterKey(G,z);break;case o.SPACE:this.handleSpaceKey(G,z);break;case o.BACKSPACE:this.handleBackspaceKey(G,z);break;case o.TAB:this.onTabKeyDown();break;case o.DELETE:this.handleDeleteKey(G);break;default:this.handleSearchWithoutTyping(G)}}announceAriaValue(G){this.ariaAnnounce?.announceValue(G,"richSelect")}destroy(){if(this.asyncRequests?.destroy(),this.asyncRequests=void 0,this.hasPagedAsyncSource=!1,this.listComponent)this.listComponent=this.destroyBean(this.listComponent);this.searchStrings=void 0,super.destroy()}};function h6(G,D){G.then((z)=>{let B=z.getGui();if(B!=null)D.appendChild(B)})}function HJ(G){return(D)=>G?.(D)??String(D??"")}var aq={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"}}]}]},i6=class extends gB{constructor(G){super({...G,template:aq,agComponents:[eW]});this.params=G}showPicker(){setTimeout(()=>super.showPicker())}hidePicker(){setTimeout(()=>super.hidePicker())}postConstruct(){super.postConstruct();let{wrapperClassName:G,ariaLabel:D}=this.params;if(zq(this.eDisplayField,!1),G)this.eWrapper.classList.add(G);Dq(this.eWrapper,""),Gq(this.eWrapper,D)}onEnterKeyDown(G){if(Bq(G),this.isPickerDisplayed)super.onEnterKeyDown(G);else G.preventDefault(),this.showPicker()}},n6=class extends eq{constructor(G,D,z){super();this.eGui=G,this.focusWrapper=D,this.eFocusableComp=z}postConstruct(){this.addManagedElementListeners(this.eGui,{keydown:(D)=>{switch(D.key){case Ez.TAB:if(!D.defaultPrevented)R0(D);break;case Ez.UP:case Ez.DOWN:R0(D);break;case Ez.ESCAPE:if(nU(D))return;if(this.eGui.contains(iU(this.beans)))D.preventDefault(),R0(D),this.focusWrapper.focus();break}}});let G="ag-advanced-filter-builder-virtual-list-item-highlight";this.addManagedListeners(this.focusWrapper,{keydown:(D)=>{if(D.key===Ez.ENTER){if(nU(D))return;if(iU(this.beans)===this.focusWrapper)D.preventDefault(),R0(D),this.eFocusableComp.getFocusableElement().focus()}},focusin:()=>{this.focusWrapper.classList.add(G)},focusout:(D)=>{if(!this.focusWrapper.contains(D.relatedTarget))this.focusWrapper.classList.remove(G)}})}};function d6(G,D){return{pickerAriaLabelKey:"ariaLabelAdvancedFilterBuilderAddField",pickerAriaLabelValue:"Advanced Filter Builder Add Field",pickerType:"ag-list",valueList:[{key:"condition",displayValue:G("advancedFilterBuilderAddCondition")},{key:"join",displayValue:G("advancedFilterBuilderAddJoin")}],valueFormatter:(z)=>z==null?"":z.displayValue??z.key,pickerIcon:"advancedFilterBuilderAdd",maxPickerWidth:`${D??120}px`,wrapperClassName:"ag-advanced-filter-builder-item-button",ariaLabel:G("advancedFilterBuilderAddButtonTooltip")}}var GH={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"}]}]}]},DH=class extends sW{constructor(G,D){super(GH);this.item=G,this.focusWrapper=D,this.eItem=oW}wireBeans(G){this.advFilterExpSvc=G.advFilterExpSvc,this.registry=G.registry}postConstruct(){aW(this.focusWrapper,2);let G=d6((z)=>this.advFilterExpSvc.translate(z),this.gos.get("advancedFilterBuilderParams")?.addSelectWidth),D=this.createManagedBean(new i6(G));this.addManagedListeners(D,{fieldPickerValueSelected:({value:z})=>{this.dispatchLocalEvent({type:"advancedFilterBuilderAdded",item:this.item,isJoin:z.key==="join"})}}),this.eItem.appendChild(D.getGui()),this.createOptionalManagedBean(this.registry.createDynamicBean("tooltipFeature",!1,{getGui:()=>D.getGui(),getLocation:()=>"advancedFilter",getTooltipValue:()=>this.advFilterExpSvc.translate("advancedFilterBuilderAddButtonTooltip")})),this.createManagedBean(new n6(this.getGui(),this.focusWrapper,D)),rW(this.focusWrapper,this.advFilterExpSvc.translate("ariaAdvancedFilterBuilderItem",[this.advFilterExpSvc.translate("advancedFilterBuilderAddButtonTooltip"),`${this.item.level+1}`]))}afterAdd(){}},SH=class extends ZH{constructor(){super({tag:"div",cls:"ag-advanced-filter-builder-item-condition",role:"presentation"});this.validationMessage=null}wireBeans(G){this.advFilterExpSvc=G.advFilterExpSvc}init(G){let{item:D,createPill:z}=G;this.item=D,this.createPill=z,this.filterModel=D.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(G){let D=this.advFilterExpSvc.getColumnDetails(G.colId);if(this.baseCellDataType=D.baseCellDataType,this.column=D.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:!0,getEditorParams:()=>({values:this.advFilterExpSvc.getColumnAutocompleteEntries()}),update:(z)=>this.setColumnKey(z),pickerAriaLabelKey:"ariaLabelAdvancedFilterBuilderColumnSelectField",pickerAriaLabelValue:"Advanced Filter Builder Column Select Field",ariaLabel:this.advFilterExpSvc.translate("ariaAdvancedFilterBuilderColumn")}),this.getGui().appendChild(this.eColumnPill.getGui()),Mz(this.getColumnKey())){if(this.createOperatorPill(),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:!0,getEditorParams:()=>({values:this.getOperatorAutocompleteEntries()}),update:(G)=>this.setOperatorKey(G),pickerAriaLabelKey:"ariaLabelAdvancedFilterBuilderOptionSelectField",pickerAriaLabelValue:"Advanced Filter Builder Option Select Field",ariaLabel:this.advFilterExpSvc.translate("ariaAdvancedFilterBuilderOption")}),this.eColumnPill.getGui().insertAdjacentElement("afterend",this.eOperatorPill.getGui())}createOperandPill(){let{filter:G}=this.filterModel,D=(typeof G==="number"||typeof G==="bigint"?LH(G):G)??"";this.eOperandPill=this.createPill({key:D,valueFormatter:(z)=>this.advFilterExpSvc.getOperandDisplayValue({...this.filterModel,filter:z},!0),baseCellDataType:this.baseCellDataType,cssClass:"ag-advanced-filter-builder-value-pill",isSelect:!1,update:(z)=>this.setOperand(z),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,!0)}hasOperand(){return this.numOperands>0}getOperatorAutocompleteEntries(){return this.column?this.advFilterExpSvc.getOperatorAutocompleteEntries(this.column,this.baseCellDataType):[]}setColumnKey(G){if(!this.eOperatorPill)this.createOperatorPill();let D=this.advFilterExpSvc.getColumnDetails(G);this.column=D.column;let z=D.baseCellDataType;if(this.baseCellDataType!==z){if(this.baseCellDataType=z,this.setOperatorKey(void 0),this.eOperatorPill)$H(this.eOperatorPill.getGui()),this.destroyBean(this.eOperatorPill),this.createOperatorPill();this.validate()}this.filterModel.colId=G,this.filterModel.filterType=this.baseCellDataType}setOperatorKey(G){let D=this.getNumOperands(G);if(D!==this.numOperands){if(this.numOperands=D,D===0)this.destroyOperandPill();else if(this.createOperandPill(),this.baseCellDataType!=="number")this.setOperand("")}this.filterModel.type=G,this.validate()}setOperand(G){let D=G;if(this.baseCellDataType==="number")D=Mz(G)?Number(G):"";this.filterModel.filter=D,this.validate()}getNumOperands(G){return this.advFilterExpSvc.getExpressionOperator(this.baseCellDataType,G)?.numOperands??0}destroyOperandPill(){delete this.filterModel.filter,this.eOperandPill?.getGui().remove(),this.destroyBean(this.eOperandPill),this.eOperandPill=void 0}validate(){let G=null;if(!Mz(this.getColumnKey()))G=this.advFilterExpSvc.translate("advancedFilterBuilderValidationSelectColumn");else if(!Mz(this.getOperatorKey()))G=this.advFilterExpSvc.translate("advancedFilterBuilderValidationSelectOption");else if(this.numOperands>0&&!Mz(this.getOperandDisplayValue()))G=this.advFilterExpSvc.translate("advancedFilterBuilderValidationEnterValue");if(this.item.valid=!G,G!==this.validationMessage)this.validationMessage=G,this.dispatchLocalEvent({type:"advancedFilterBuilderValidChanged"})}getDefaultColumnDisplayValue(){return this.advFilterExpSvc.translate("advancedFilterBuilderSelectColumn")}getDefaultOptionSelectValue(){return this.advFilterExpSvc.translate("advancedFilterBuilderSelectOption")}},_H={number:[XH],bigint:[v0],boolean:[v0],object:[v0],text:[v0],date:[b0],dateString:[b0],dateTime:[b0,(G)=>G.setIncludeTime(!0)],dateTimeString:[b0,(G)=>G.setIncludeTime(!0)]},kH={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"}]}]},wH=class extends YH{constructor(G){super(kH);this.params=G,this.ePill=mU,this.eLabel=mU;let{value:D,valueFormatter:z}=G;this.value=D,this.displayValue=z(D)}wireBeans(G){this.advFilterExpSvc=G.advFilterExpSvc}postConstruct(){let{cssClass:G,ariaLabel:D}=this.params;this.ePill.classList.add(G),this.activateTabIndex([this.ePill]),this.eLabel.id=`${this.getCompId()}`,qH(this.ePill,this.eLabel.id),HH(this.ePill,D),this.renderValue(),this.addManagedListeners(this.ePill,{click:(z)=>{z.preventDefault(),this.showEditor()},keydown:(z)=>{if(z.key===NQ.ENTER)z.preventDefault(),FQ(z),this.showEditor()}}),this.addDestroyFunc(()=>this.destroyBean(this.eEditor))}getFocusableElement(){return this.ePill}showEditor(){if(this.eEditor)return;tU(this.ePill,!1),this.eEditor=this.createEditorComp(this.params.type),this.eEditor.setValue(this.value);let G=this.eEditor.getGui();this.eEditor.addManagedElementListeners(G,{keydown:(D)=>{switch(D.key){case NQ.ENTER:D.preventDefault(),FQ(D),this.updateValue(!0);break;case NQ.ESCAPE:D.preventDefault(),FQ(D),this.hideEditor(!0);break}},focusout:()=>this.updateValue(!1)}),this.getGui().appendChild(G),this.eEditor.getFocusableElement().focus()}createEditorComp(G){let[D,z]=_H[G],B=this.createBean(new D);return z?.(B),B}hideEditor(G){let{eEditor:D}=this;if(!D)return;if(this.eEditor=void 0,D.getGui().remove(),this.destroyBean(D),tU(this.ePill,!0),G)this.ePill.focus()}renderValue(){let G,{displayValue:D,eLabel:z,params:B}=this,{type:Q}=B,{classList:J}=z;if(J.remove("ag-advanced-filter-builder-value-empty","ag-advanced-filter-builder-value-number","ag-advanced-filter-builder-value-text"),!WH(D))G=this.advFilterExpSvc.translate("advancedFilterBuilderEnterValue"),J.add("ag-advanced-filter-builder-value-empty");else if(Q==="number"||Q==="bigint")G=D,J.add("ag-advanced-filter-builder-value-number");else G=`"${D}"`,J.add("ag-advanced-filter-builder-value-text");z.textContent=G}updateValue(G){if(!this.eEditor)return;let D=this.eEditor.getValue()??"";this.dispatchLocalEvent({type:"fieldValueChanged",value:D}),this.value=D,this.displayValue=this.params.valueFormatter(D),this.renderValue(),this.hideEditor(G)}},fH=class extends KH{wireBeans(G){this.advFilterExpSvc=G.advFilterExpSvc}constructor(){super({tag:"div",cls:"ag-advanced-filter-builder-item-condition",role:"presentation"})}init(G){let{item:D,createPill:z}=G,B=D.filterModel;this.filterModel=B,this.ePill=z({key:B.type,displayValue:this.advFilterExpSvc.parseJoinOperator(B),cssClass:"ag-advanced-filter-builder-join-pill",isSelect:!0,getEditorParams:()=>({values:this.advFilterExpSvc.getJoinOperatorAutocompleteEntries()}),update:(Q)=>B.type=Q,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()}},MH={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"}}]}]},AH=class extends gB{constructor(G){super({...G,template:MH,agComponents:[NH]});this.params=G}getFocusableElement(){return this.eWrapper}showPicker(){setTimeout(()=>super.showPicker())}hidePicker(){setTimeout(()=>super.hidePicker())}postConstruct(){super.postConstruct();let{wrapperClassName:G,ariaLabel:D}=this.params;this.eWrapper.classList.add(G),EH(this.eWrapper,""),FH(this.eWrapper,D)}createPickerComponent(){if(!this.values){let{values:G}=this.params.getEditorParams();this.values=G;let D=this.value.key,z=G.find((B)=>B.key===D)??{key:D,displayValue:this.value.displayValue};this.value=z}return super.createPickerComponent()}onEnterKeyDown(G){if(IH(G),this.isPickerDisplayed)super.onEnterKeyDown(G);else G.preventDefault(),this.showPicker()}},RH={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"}]}]},EQ=class extends BH{constructor(G,D,z){super(RH);this.item=G,this.dragFeature=D,this.focusWrapper=z,this.eTreeLines=rG,this.eDragHandle=rG,this.eButtons=rG,this.eValidation=rG,this.eMoveUpButton=rG,this.eMoveDownButton=rG,this.eAddButton=rG,this.eRemoveButton=rG,this.moveUpDisabled=!1,this.moveDownDisabled=!1}wireBeans(G){this.dragAndDrop=G.dragAndDrop,this.advFilterExpSvc=G.advFilterExpSvc,this.registry=G.registry}postConstruct(){let{filterModel:G,level:D,showMove:z}=this.item,B=G.filterType==="join";if(this.ePillWrapper=this.createManagedBean(B?new fH:new SH),this.ePillWrapper.init({item:this.item,createPill:(Q)=>this.createPill(Q)}),this.eDragHandle.insertAdjacentElement("afterend",this.ePillWrapper.getGui()),D===0){let Q=dU({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(Q),V0(this.eDragHandle,!1),V0(this.eButtons,!1),pU(this.focusWrapper,!0)}else this.setupTreeLines(D),this.eDragHandle.appendChild(Iz("advancedFilterBuilderDrag",this.beans)),this.setupValidation(),this.setupMoveButtons(z),this.setupAddButton(),this.setupRemoveButton(),this.setupDragging(),this.updateAriaExpanded();JH(this.focusWrapper,D+1),this.initialiseTabGuard({}),this.createManagedBean(new n6(this.getGui(),this.focusWrapper,this.ePillWrapper)),this.updateAriaLabel(),this.addManagedListeners(this.ePillWrapper,{advancedFilterBuilderValueChanged:()=>this.dispatchLocalEvent({type:"advancedFilterBuilderValueChanged"}),advancedFilterBuilderValidChanged:()=>this.updateValidity()})}setState(G){let{level:D}=this.item;if(D===0)return;let{showMove:z}=this.item,{disableMoveUp:B,disableMoveDown:Q,treeLines:J,showStartTreeLine:U}=G;if(this.updateTreeLines(J,U),this.updateAriaExpanded(),z)this.moveUpDisabled=!!B,this.moveDownDisabled=!!Q,this.eMoveUpButton.classList.toggle("ag-advanced-filter-builder-item-button-disabled",B),this.eMoveDownButton.classList.toggle("ag-advanced-filter-builder-item-button-disabled",Q),lU(this.eMoveUpButton,!!B),lU(this.eMoveDownButton,!!Q),this.moveUpTooltipFeature?.refreshTooltip(),this.moveDownTooltipFeature?.refreshTooltip()}focusMoveButton(G){(G?this.eMoveUpButton:this.eMoveDownButton).focus()}afterAdd(){this.ePillWrapper.getFocusableElement().focus()}setupTreeLines(G){for(let D=0;Dthis.eValidation,getLocation:()=>"advancedFilter",getTooltipValue:()=>this.ePillWrapper.getValidationMessage(),getTooltipShowDelayOverride:()=>1000})),this.updateValidity()}setupAddButton(){let G=d6((z)=>this.advFilterExpSvc.translate(z),this.gos.get("advancedFilterBuilderParams")?.addSelectWidth),D=this.createManagedBean(new i6(G));this.addManagedListeners(D,{fieldPickerValueSelected:({value:z})=>this.dispatchLocalEvent({type:"advancedFilterBuilderAdded",item:this.item,isJoin:z.key==="join"})}),this.eAddButton.appendChild(D.getGui()),this.createOptionalManagedBean(this.registry.createDynamicBean("tooltipFeature",!1,{getGui:()=>this.eAddButton,getLocation:()=>"advancedFilter",getTooltipValue:()=>this.advFilterExpSvc.translate("advancedFilterBuilderAddButtonTooltip")}))}setupRemoveButton(){this.eRemoveButton.appendChild(Iz("advancedFilterBuilderRemove",this.beans)),this.addManagedListeners(this.eRemoveButton,{click:()=>this.removeItem(),keydown:(G)=>{if(G.key===KQ.ENTER)G.preventDefault(),fQ(G),this.removeItem()}}),this.createOptionalManagedBean(this.registry.createDynamicBean("tooltipFeature",!1,{getGui:()=>this.eRemoveButton,getLocation:()=>"advancedFilter",getTooltipValue:()=>this.advFilterExpSvc.translate("advancedFilterBuilderRemoveButtonTooltip")})),C0(this.eRemoveButton,this.advFilterExpSvc.translate("advancedFilterBuilderRemoveButtonTooltip")),this.activateTabIndex([this.eRemoveButton])}setupMoveButtons(G){if(G)this.eMoveUpButton.appendChild(Iz("advancedFilterBuilderMoveUp",this.beans)),this.addManagedListeners(this.eMoveUpButton,{click:()=>this.moveItem(!0),keydown:(D)=>{if(D.key===KQ.ENTER)D.preventDefault(),fQ(D),this.moveItem(!0)}}),this.moveUpTooltipFeature=this.createOptionalManagedBean(this.registry.createDynamicBean("tooltipFeature",!1,{getGui:()=>this.eMoveUpButton,getLocation:()=>"advancedFilter",getTooltipValue:()=>this.moveUpDisabled?null:this.advFilterExpSvc.translate("advancedFilterBuilderMoveUpButtonTooltip")})),C0(this.eMoveUpButton,this.advFilterExpSvc.translate("advancedFilterBuilderMoveUpButtonTooltip")),this.eMoveDownButton.appendChild(Iz("advancedFilterBuilderMoveDown",this.beans)),this.addManagedListeners(this.eMoveDownButton,{click:()=>this.moveItem(!1),keydown:(D)=>{if(D.key===KQ.ENTER)D.preventDefault(),fQ(D),this.moveItem(!1)}}),this.moveDownTooltipFeature=this.createOptionalManagedBean(this.registry.createDynamicBean("tooltipFeature",!1,{getGui:()=>this.eMoveDownButton,getLocation:()=>"advancedFilter",getTooltipValue:()=>this.moveDownDisabled?null:this.advFilterExpSvc.translate("advancedFilterBuilderMoveDownButtonTooltip")})),C0(this.eMoveDownButton,this.advFilterExpSvc.translate("advancedFilterBuilderMoveDownButtonTooltip")),this.activateTabIndex([this.eMoveUpButton,this.eMoveDownButton]);else V0(this.eMoveUpButton,!1),V0(this.eMoveDownButton,!1)}updateValidity(){UH(this.eValidation,!this.item.valid),this.validationTooltipFeature?.refreshTooltip(),this.updateAriaLabel()}createPill(G){let{key:D,cssClass:z,update:B,ariaLabel:Q}=G,J=(U)=>{if(U==null)return;B(U),this.dispatchLocalEvent({type:"advancedFilterBuilderValueChanged"})};if(G.isSelect){let{getEditorParams:U,pickerAriaLabelKey:Z,pickerAriaLabelValue:S,displayValue:X}=G,Y=this.gos.get("advancedFilterBuilderParams"),W=`${Y?.pillSelectMinWidth??140}px`,q=`${Y?.pillSelectMaxWidth??200}px`,H=this.createBean(new AH({pickerAriaLabelKey:Z,pickerAriaLabelValue:S,pickerType:"ag-list",value:{key:D,displayValue:X},valueFormatter:(_)=>_==null?"":_.displayValue??_.key,variableWidth:!0,minPickerWidth:W,maxPickerWidth:q,getEditorParams:U,wrapperClassName:z,ariaLabel:Q,pickerIcon:"advancedFilterBuilderSelectOpen"}));return this.addManagedListeners(H,{fieldPickerValueSelected:({value:_})=>J(_?.key)}),H}else{let{baseCellDataType:U,valueFormatter:Z}=G,S=this.createBean(new wH({value:D,valueFormatter:Z,cssClass:z,type:U,ariaLabel:Q}));return this.addManagedListeners(S,{fieldValueChanged:({value:X})=>J(X)}),S}}setupDragging(){let G={type:zH.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(G,!0),this.addDestroyFunc(()=>this.dragAndDrop.removeDragSource(G))}updateAriaLabel(){let G=this.ePillWrapper.getAriaLabel(),D=`${this.item.level+1}`,z=this.ePillWrapper.getValidationMessage(),B;if(z)B=this.advFilterExpSvc.translate("ariaAdvancedFilterBuilderItemValidation",[G,D,z]);else B=this.advFilterExpSvc.translate("ariaAdvancedFilterBuilderItem",[G,D]);C0(this.focusWrapper,B)}updateAriaExpanded(){QH(this.focusWrapper);let{filterModel:G}=this.item;if(G?.filterType==="join"&&G.conditions.length)pU(this.focusWrapper,!0)}removeItem(){this.dispatchLocalEvent({type:"advancedFilterBuilderRemoved",item:this.item})}moveItem(G){this.dispatchLocalEvent({type:"advancedFilterBuilderMoved",item:this.item,backwards:G})}},CH={apply:"advancedFilterBuilderApply",clear:"advancedFilterBuilderClear",cancel:"advancedFilterBuilderCancel",reset:"advancedFilterBuilderReset"},VH={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"}]},bH=class extends hW{constructor(){super(VH);this.eList=nW}wireBeans(G){this.filterManager=G.filterManager,this.advancedFilter=G.advancedFilter,this.advFilterExpSvc=G.advFilterExpSvc}postConstruct(){let G=this.gos.get("advancedFilterBuilderParams");this.params={buttons:["apply","cancel"],...G},this.addManagedPropertyListener("advancedFilterBuilderParams",({currentValue:D})=>{this.params.showMoveButtons=!!D?.showMoveButtons,this.params.buttons=D?.buttons??["apply","cancel"],this.refreshList(!1)}),this.filterModel=this.setupFilterModel(),this.setupVirtualList(),this.dragFeature=this.createManagedBean(new tW(this,this.virtualList)),this.resetButtonsPanel(this.params.buttons)}refresh(){let G=this.virtualList,D=G.getLastFocusedRow();if(this.setupFilterModel(),this.validateItems(),this.refreshList(!1),D!=null){if(!G.getComponentAt(D))D=0;G.focusRow(D)}}getNumItems(){return this.items.length}moveItem(G,D){if(!D||!G)return;this.moveItemToIndex(G,D.rowIndex,D.position)}afterGuiAttached(){this.virtualList.awaitStable(()=>this.virtualList.focusRow(0))}setupVirtualList(){let G=this.virtualList=this.createManagedBean(new Lz({cssIdentifier:"advanced-filter-builder",ariaRole:"tree",listName:this.advFilterExpSvc.translate("ariaAdvancedFilterBuilderList"),moveItemCallback:this.virtualListMoveItemCallback.bind(this)}));G.setComponentCreator(this.createItemComponent.bind(this)),G.setComponentUpdater(this.updateItemComponent.bind(this)),G.setRowHeight(40),this.eList.appendChild(G.getGui()),G.setModel({getRowCount:()=>this.items?.length||0,getRow:(D)=>this.items[D],areRowsEqual:(D,z)=>D===z}),this.buildList(),G.refresh()}resetButtonsPanel(G){let D=G&&G.length>0,z=this.eButtons;if(D){let B=G.map((J)=>({type:J,label:this.advFilterExpSvc.translate(CH[J])}));if(!z){z=this.createBean(new iW),this.appendChild(z.getGui());let J=(U)=>({event:Z})=>{this.updateModel(U),this.afterAction(U,Z)};z.addManagedListeners(z,{apply:J("apply"),clear:J("clear"),reset:J("reset"),cancel:J("cancel")}),this.eButtons=z}z.updateButtons(B);let Q=z.getApplyButton();if(Q){let J=(U)=>this.toggleCss("ag-advanced-filter-builder-validation",U);this.addManagedElementListeners(Q,{mouseenter:()=>J(!0),mouseleave:()=>J(!1)})}}else if(z)lW(z.getGui()),this.eButtons=this.destroyBean(z)}updateModel(G){switch(G){case"apply":this.advancedFilter.setModel(this.filterModel),this.filterManager?.onFilterChanged({source:"advancedFilter"});break;case"reset":this.advancedFilter.setModel(null),this.filterManager?.onFilterChanged({source:"advancedFilter"});break;case"cancel":break;case"clear":this.filterModel=this.formatFilterModel(null),this.refreshList(!1);break}}afterAction(G,D){switch(G){case"apply":{D?.preventDefault(),this.close();break}case"reset":{this.close();break}case"cancel":{this.close();break}}}removeItemFromParent(G){let D=G.parent.conditions.indexOf(G.filterModel);return G.parent.conditions.splice(D,1),D}moveItemToIndex(G,D,z){let B=this.items[D],Q=B.filterModel?.filterType==="join"&&z==="bottom",J=Q?B.filterModel:B.parent;if(!J)return;if(this.isChildOrSelf(J,G.filterModel)||B===G)return;this.removeItemFromParent(G);let U;if(Q)U=0;else if(U=J.conditions.indexOf(B.filterModel),U===-1)U=J.conditions.length;else if(z==="bottom")U+=1;J.conditions.splice(U,0,G.filterModel),this.refreshList(!1)}isChildOrSelf(G,D){return G===D||D.filterType==="join"&&D.conditions.some((z)=>this.isChildOrSelf(G,z))}setupFilterModel(){let G=this.formatFilterModel(this.advancedFilter.getModel());return this.stringifiedModel=JSON.stringify(G),G}formatFilterModel(G){if(G=G??{filterType:"join",type:"AND",conditions:[]},G.filterType!=="join")G={filterType:"join",type:"AND",conditions:[G]};return G}buildList(){let G=(D,z,B,Q)=>{if(z.push({filterModel:D,level:B,parent:Q,valid:!0,showMove:this.params.showMoveButtons}),D.filterType==="join"){for(let J of D.conditions)G(J,z,B+1,D);if(B===0)z.push({filterModel:null,level:B+1,parent:D,valid:!0})}};this.items=[],G(this.filterModel,this.items,0)}refreshList(G){if(!G){let D=[];for(let z of this.items)if(!z.valid)D.push(z.filterModel);if(this.buildList(),D.length){for(let z of this.items)if(z.filterModel&&D.includes(z.filterModel))z.valid=!1}}this.virtualList.refresh(G),this.validate()}updateItemComponent(G,D){let z=this.items.indexOf(G),B=(Z,S)=>{let Y=this.items.find((W)=>W.filterModel===Z)?.parent;if(Y){let{conditions:W}=Y;B(Y,S),S.push(W[W.length-1]===Z)}},Q=[],{filterModel:J}=G;if(J)B(J,Q),Q[0]=!1;let U=J?.filterType==="join"&&!!J.conditions.length;D.setState({disableMoveUp:z===1,disableMoveDown:!this.canMoveDown(G,z),treeLines:Q,showStartTreeLine:U})}createItemComponent(G,D){let z=this.createBean(G.filterModel?new EQ(G,this.dragFeature,D):new DH(G,D));if(z.addManagedListeners(z,{advancedFilterBuilderRemoved:({item:B})=>this.removeItem(B),advancedFilterBuilderValueChanged:()=>this.validate(),advancedFilterBuilderAdded:({item:B,isJoin:Q})=>this.addItem(B,Q),advancedFilterBuilderMoved:({item:B,backwards:Q})=>this.moveItemUpDown(B,Q)}),z instanceof EQ)this.updateItemComponent(G,z);return z}addItem(G,D){let{parent:z,level:B,filterModel:Q}=G,J=Q?.filterType==="join",U=D?{filterType:"join",type:"AND",conditions:[]}:{},Z=J?Q:z,S=J?0:Z.conditions.indexOf(Q);if(S>=0){if(!J)S+=1;Z.conditions.splice(S,0,U)}else Z.conditions.push(U);let X=this.items.indexOf(G),Y=X>=0;if(Y){if(G.filterModel)X++;let W=[{filterModel:U,level:J?B+1:B,parent:Z,valid:D,showMove:this.params.showMoveButtons}];this.items.splice(X,0,...W)}if(this.refreshList(Y),Y)this.virtualList.getComponentAt(X)?.afterAdd()}removeItem(G){let D=G.parent,{filterModel:z}=G,B=D.conditions.indexOf(z);D.conditions.splice(B,1);let Q=G.filterModel?.filterType==="join",J=this.items.indexOf(G),U=!Q&&J>=0;if(U)this.items.splice(J,1);if(this.refreshList(U),J>=0)this.virtualList.focusRow(J)}moveItemUpDown(G,D,z){let B=this.items.indexOf(G),Q=D?B-1:B+1;if(Q===0||!D&&!this.canMoveDown(G,B))return;let J=this.items[Q],U=this.removeItemFromParent(G),{level:Z,filterModel:S,parent:X}=G,{level:Y,filterModel:W,parent:q}=J;if(D)if(Y===Z&&W.filterType==="join")W.conditions.push(S);else if(Y<=Z){let k=q.conditions.indexOf(W);q.conditions.splice(k,0,S)}else X.conditions[U-1].conditions.push(S);else if(Y===Z)if(W.filterType==="join")W.conditions.splice(0,0,S);else{let k=q.conditions.indexOf(W);q.conditions.splice(k+1,0,S)}else if(UK.filterModel===X),w=k.parent.conditions.indexOf(k.filterModel)+1;k.parent.conditions.splice(w,0,S)}this.refreshList(!1);let H=this.items.findIndex(({filterModel:k})=>k===S);if(H<0)return;let _=this.virtualList.getComponentAt(H);if(!(_ instanceof EQ))return;if(!z)_.focusMoveButton(D)}virtualListMoveItemCallback(G,D){let z=G.item,B=this.items.indexOf(z);if(B<=0||B===this.items.length-1)return;if(D&&B===1||!D&&!this.canMoveDown(z,B))return;this.moveItemUpDown(z,D,!0),this.virtualList.focusRow(B+(D?-1:1))}canMoveDown(G,D){return!(G.level===1&&D===this.items.length-2||G.level===1&&G.parent.conditions[G.parent.conditions.length-1]===G.filterModel)}close(){this.advancedFilter.getCtrl().toggleFilterBuilder({source:"ui"})}validate(){let G=this.items.every(({valid:z})=>z),D=null;if(G){if(G=JSON.stringify(this.filterModel)!==this.stringifiedModel,!G)D=this.advFilterExpSvc.translate("advancedFilterBuilderValidationAlreadyApplied")}else D=this.advFilterExpSvc.translate("advancedFilterBuilderValidationIncomplete");this.eButtons?.updateValidity(G,D)}validateItems(){let G=(z)=>{z.type=void 0},D=(z)=>{delete z.filter};for(let z of this.items){if(!z.valid||!z.filterModel||z.filterModel.filterType==="join")continue;let{filterModel:B}=z,{colId:Q}=B,J=this.advFilterExpSvc.getColumnAutocompleteEntries().find(({key:X})=>X===Q),U=this.advFilterExpSvc.getColumnDetails(B.colId);if(!J||!U.column){z.valid=!1,B.colId=void 0,G(B),D(B);continue}let S=this.advFilterExpSvc.getDataTypeExpressionOperator(U.baseCellDataType).operators[B.type];if(!S){z.valid=!1,G(B),D(B);continue}if(S.numOperands>0&&!dW(B.filter))z.valid=!1}}},vH=class extends o4{constructor(G){super();this.enabled=G}wireBeans(G){this.ctrlsSvc=G.ctrlsSvc,this.popupSvc=G.popupSvc,this.advFilterExpSvc=G.advFilterExpSvc,this.environment=G.environment}postConstruct(){this.hasAdvancedFilterParent=!!this.gos.get("advancedFilterParent"),this.ctrlsSvc.whenReady(this,()=>this.setAdvancedFilterComp()),this.addManagedEventListeners({advancedFilterEnabledChanged:({enabled:G})=>this.onEnabledChanged(G)}),this.addManagedPropertyListener("advancedFilterParent",()=>this.updateComps()),this.addManagedPropertyListener("advancedFilterBuilderParams",(G)=>{if(G.currentValue?.suppressFullScreenButton!==G.previousValue?.suppressFullScreenButton)this.eBuilderDialog?.setMaximizable(G.currentValue?.suppressFullScreenButton??!0)}),this.addDestroyFunc(()=>{if(this.destroyAdvancedFilterComp(),this.destroyBean(this.eBuilderComp),this.eBuilderDialog?.isAlive())this.destroyBean(this.eBuilderDialog)})}setupHeaderComp(G){if(this.eHeaderComp)this.eHeaderComp?.getGui().remove(),this.destroyBean(this.eHeaderComp);this.eHeaderComp=this.createManagedBean(new cW(this.enabled&&!this.hasAdvancedFilterParent)),G.insertAdjacentElement("beforebegin",this.eHeaderComp.getGui())}focusHeaderComp(){if(this.eHeaderComp)return this.eHeaderComp.getFocusableElement().focus(),!0;return!1}refreshComp(){this.eFilterComp?.refresh(),this.eHeaderComp?.refresh()}refreshBuilderComp(){this.eBuilderComp?.refresh()}getHeaderHeight(){return this.eHeaderComp?.getHeight()??0}setInputDisabled(G){this.eFilterComp?.setInputDisabled(G),this.eHeaderComp?.setInputDisabled(G)}toggleFilterBuilder(G){let{source:D,force:z,eventSource:B}=G;if(z&&this.eBuilderDialog||z===!1&&!this.eBuilderDialog)return;if(this.eBuilderDialog){this.builderDestroySource=D,this.destroyBean(this.eBuilderDialog);return}this.setInputDisabled(!0);let{width:Q,height:J,minWidth:U}=this.getBuilderDialogSize(),{suppressFullScreenButton:Z}={suppressFullScreenButton:!1,...this.gos.get("advancedFilterBuilderParams")};this.eBuilderComp=this.createBean(new bH),this.eBuilderDialog=this.createBean(new PB({title:this.advFilterExpSvc.translate("advancedFilterBuilderTitle"),component:this.eBuilderComp,width:Q,height:J,resizable:!0,movable:!0,maximizable:!Z,centered:!0,closable:!0,minWidth:U,afterGuiAttached:()=>this.eBuilderComp?.afterGuiAttached(),postProcessPopupParams:{type:"advancedFilterBuilder",eventSource:B}})),this.dispatchFilterBuilderVisibleChangedEvent(D,!0),this.eBuilderDialog.addEventListener("destroyed",()=>{this.destroyBean(this.eBuilderComp),this.eBuilderComp=void 0,this.eBuilderDialog=void 0,this.setInputDisabled(!1),this.dispatchLocalEvent({type:"advancedFilterBuilderClosed"}),this.dispatchFilterBuilderVisibleChangedEvent(this.builderDestroySource??"ui",!1),this.builderDestroySource=void 0})}dispatchFilterBuilderVisibleChangedEvent(G,D){this.eventSvc.dispatchEvent({type:"advancedFilterBuilderVisibleChanged",source:G,visible:D})}getBuilderDialogSize(){let G=this.gos.get("advancedFilterBuilderParams")?.minWidth??500,D=this.popupSvc.getPopupParent(),z=Math.round(a4(D))-2,B=Math.round(r4(D)*0.75)-2,Q=Math.min(Math.max(700,G),z),J=Math.min(600,B);return{width:Q,height:J,minWidth:G}}onEnabledChanged(G){this.enabled=G,this.updateComps()}updateComps(){this.setAdvancedFilterComp(),this.setHeaderCompEnabled(),this.eventSvc.dispatchEvent({type:"headerHeightChanged"})}setAdvancedFilterComp(){if(this.destroyAdvancedFilterComp(),!this.enabled)return;let G=this.gos.get("advancedFilterParent");if(this.hasAdvancedFilterParent=!!G,G){let D=this.createBean(new x6),z=D.getGui();this.environment.applyThemeClasses(z),z.classList.add(this.gos.get("enableRtl")?"ag-rtl":"ag-ltr"),G.appendChild(z),this.eFilterComp=D}}setHeaderCompEnabled(){this.eHeaderComp?.setEnabled(this.enabled&&!this.hasAdvancedFilterParent)}destroyAdvancedFilterComp(){if(this.eFilterComp)e4(this.eFilterComp.getGui()),this.destroyBean(this.eFilterComp)}},OH=class{constructor(G){this.params=G,this.operators=[],this.operatorStartPositions=[],this.operatorEndPositions=[],this.activeOperator=0,this.validationError=null}parseExpression(G){this.operators.push(""),this.operatorStartPositions.push(G),this.operatorEndPositions.push(void 0);let{expression:D}=this.params;while(GQ===this.parsedOperator);return this.params.advFilterExpSvc.generateAutocompleteListParams(B,"join",z)}updateExpression(G,D,z){let{expression:B}=this.params,Q=D.displayValue??D.key;if(z===0)for(let Z=this.operatorEndPositions.length-1;Z>0;Z--){let S=this.operatorEndPositions[Z];if(S==null)continue;B=XD(B,this.operatorStartPositions[Z],S,Q).updatedValue}let J=this.operatorStartPositions.length>z?this.operatorStartPositions[z]:G,U=(this.operatorEndPositions.length>z?this.operatorEndPositions[z]:void 0)??i1(B,G,!0).endPosition;return XD(B,J,U,Q,!0)}getNumOperators(){return this.operators.length}getLastOperatorEndPosition(){return this.operatorEndPositions[this.operatorEndPositions.length-1]}parseOperator(G){let D=this.operators.length>this.activeOperator?this.operators[this.activeOperator]:"",z=this.params.advFilterExpSvc.getExpressionJoinOperators(),B=jB(D,z,(Q)=>Q);if(B){this.operatorEndPositions[this.activeOperator]=G;let Q=z[B];if(this.activeOperator){if(B!==this.parsedOperator){if(!this.validationError)this.validationError={message:this.params.advFilterExpSvc.translate("advancedFilterValidationJoinOperatorMismatch"),startPosition:G-D.length+1,endPosition:G};return!1}}else this.parsedOperator=B;if(D!==Q)WJ(this.params,D,Q,G),this.operators[this.activeOperator]=Q;return!0}else if(B===null)return!1;else{if(!this.validationError)this.validationError={message:this.params.advFilterExpSvc.translate("advancedFilterValidationInvalidJoinOperator"),startPosition:G-D.length+1,endPosition:G};return!0}}},uH=class G{constructor(D,z){this.params=D,this.startPosition=z,this.expectingExpression=!0,this.expectingOperator=!1,this.expressionParsers=[],this.operatorParser=new OH(this.params),this.missingEndBracket=!1,this.extraEndBracket=!1}parseExpression(){let D=this.startPosition,{expression:z}=this.params;while(D0)this.missingEndBracket=!0;return D}isValid(){return!this.missingEndBracket&&!this.extraEndBracket&&this.expressionParsers.length===this.operatorParser.getNumOperators()+1&&this.operatorParser.isValid()&&this.expressionParsers.every((D)=>D.isValid())}getValidationError(){let D=this.operatorParser.getValidationError();for(let B=0;BJ.getFunction(D)),Q=z==="&&"?"every":"some";return(J,U,Z)=>B[Q]((S)=>S(J,U,Z))}getAutocompleteListParams(D){if(this.endPosition!=null&&D>this.endPosition+1)return;if(!this.expressionParsers.length)return this.getColumnAutocompleteListParams();let z=this.getExpressionParserIndex(D);if(z==null){if(this.params.expression[D]==="(")return{enabled:!1};return this.getColumnAutocompleteListParams()}let Q=this.expressionParsers[z].getAutocompleteListParams(D);if(!Q){if(zthis.endPosition+1)return null;else return this.operatorParser.updateExpression(D,z,J);return Z}getModel(){if(this.expressionParsers.length>1)return{filterType:"join",type:this.operatorParser.getModel(),conditions:this.expressionParsers.map((D)=>D.getModel())};else return this.expressionParsers[0].getModel()}getColumnAutocompleteListParams(){return this.params.advFilterExpSvc.generateAutocompleteListParams(this.params.advFilterExpSvc.getColumnAutocompleteEntries(),"column","")}getExpressionParserIndex(D){let z;for(let B=0;BD)break;z=B}return z}},jH=class{constructor(G){this.params=G,this.valid=!1}parseExpression(){this.joinExpressionParser=new uH(this.params,0);let G=this.joinExpressionParser.parseExpression();return this.valid=G>=this.params.expression.length-1&&this.joinExpressionParser.isValid(),this.params.expression}isValid(){return this.valid}getValidationMessage(){let G=this.joinExpressionParser.getValidationError();if(!G)return null;let{message:D,startPosition:z,endPosition:B}=G;return z{let z=this.colModel.getColDefCol(G);return z?this.filterValueSvc.getValue(z,D):void 0}},this.addManagedPropertyListener("enableAdvancedFilter",(G)=>this.setEnabled(!!G.currentValue)),this.addManagedEventListeners({newColumnsLoaded:(G)=>this.onNewColumnsLoaded(G)}),this.addManagedPropertyListener("includeHiddenColumnsInAdvancedFilter",()=>{if(this.updateValidity())this.filterManager?.onFilterChanged({source:"advancedFilter"})})}isEnabled(){return this.enabled}isFilterPresent(){return!!this.expressionFunction}doesFilterPass(G){return this.expressionFunction(this.expressionProxy,G,this.expressionParams)}getModel(){let G=this.createExpressionParser(this.appliedExpression);return G?.parseExpression(),G?.getModel()??null}setModel(G){let D=(B,Q)=>{if(B.filterType==="join"){let J=this.advFilterExpSvc.parseJoinOperator(B),U=B.conditions.map((Z)=>D(Z)).filter((Z)=>p4(Z)).join(` ${J} `);return Q||B.conditions.length<=1?U:`(${U})`}else return this.advFilterExpSvc.parseColumnFilterModel(B)},z=G?D(G,!0):null;this.setExpressionDisplayValue(z),this.applyExpression(),this.ctrl.refreshComp(),this.ctrl.refreshBuilderComp()}getExpressionDisplayValue(){return this.expression}setExpressionDisplayValue(G){this.expression=G}isCurrentExpressionApplied(){return this.appliedExpression===this.expression}createExpressionParser(G){if(!G)return null;return new jH({expression:G,colModel:this.colModel,dataTypeSvc:this.dataTypeSvc,valueSvc:this.valueSvc,advFilterExpSvc:this.advFilterExpSvc})}getDefaultExpression(G){let D=this.advFilterExpSvc.getColumnValue(G)+" ";return{updatedValue:D,updatedPosition:D.length}}isHeaderActive(){return!this.gos.get("advancedFilterParent")}getCtrl(){return this.ctrl}setEnabled(G,D){let z=this.enabled,B=m4(this.gos)||t4(this.gos);if(G&&!B)s4(123);if(this.enabled=G&&B,!D&&this.enabled!==z)this.eventSvc.dispatchEvent({type:"advancedFilterEnabledChanged",enabled:this.enabled})}applyExpression(){let G=this.createExpressionParser(this.expression);G?.parseExpression(),this.applyExpressionFromParser(G)}getAppliedExpressionDisplayValue(){return this.appliedExpression}applyExpressionFromParser(G){if(this.isValid=!G||G.isValid(),!G||!this.isValid){this.expressionFunction=null,this.expressionParams=null,this.appliedExpression=null;return}let{expressionFunction:D,params:z}=G.getFunction();this.expressionFunction=D,this.expressionParams=z,this.appliedExpression=this.expression}updateValidity(){this.advFilterExpSvc.resetColumnCaches();let G=this.createExpressionParser(this.expression);G?.parseExpression();let z=(!G||G.isValid())!==this.isValid;return this.applyExpressionFromParser(G),this.ctrl.refreshComp(),this.ctrl.refreshBuilderComp(),z}onNewColumnsLoaded(G){if(G.source!=="gridInitializing"||!this.dataTypeSvc?.isPendingInference)return;this.ctrl.setInputDisabled(!0);let[D]=this.addManagedEventListeners({dataTypesInferred:()=>{D?.(),this.ctrl.setInputDisabled(!1)}})}},l6={moduleName:"AdvancedFilter",version:j,beans:[PH,d4],icons:{advancedFilterBuilder:"group",advancedFilterBuilderDrag:"grip",advancedFilterBuilderInvalid:"not-allowed",advancedFilterBuilderMoveUp:"up",advancedFilterBuilderMoveDown:"down",advancedFilterBuilderAdd:"plus",advancedFilterBuilderRemove:"minus",advancedFilterBuilderSelectOpen:"small-down",richSelectRemove:"cancel",richSelectLoading:"loading"},apiFunctions:{getAdvancedFilterModel:v4,setAdvancedFilterModel:O4,showAdvancedFilterBuilder:u4,hideAdvancedFilterBuilder:j4},dependsOn:[i,A4,V4,C4,R4,M4],css:[b4]},Sz=class{constructor(G){this._defs={},this._nullable=!1,this.description=G}_collectNestedDefs(G){let D={...this._defs};for(let z of G)if(z&&typeof z==="object"&&"$defs"in z)Object.assign(D,z.$defs),delete z.$defs;return D}_toJSON(G={}){let D={type:this._nullable?[this.type,"null"]:this.type,description:this.description,...G};if(Object.keys(this._defs).length>0)D.$defs=this._defs;return D}nullable(){return this._nullable=!0,this}define(G,D){return this._defs[G]=D,this}},yH=class extends Sz{constructor(G){super(typeof G==="string"?G:G?.description);if(this.type="string",typeof G==="object"&&G)this._pattern=G.pattern,this._format=G.format}pattern(G){return this._pattern=G,this}format(G){return this._format=G,this}toJSON(){return this._toJSON({pattern:this._pattern,format:this._format})}},xH=class extends Sz{constructor(G){super(typeof G==="string"?G:G?.description);if(this.type="number",typeof G==="object"&&G)this._minimum=G.minimum,this._maximum=G.maximum,this._exclusiveMinimum=G.exclusiveMinimum,this._exclusiveMaximum=G.exclusiveMaximum,this._multipleOf=G.multipleOf}minimum(G){return this._minimum=G,this}exclusiveMinimum(G){return this._exclusiveMinimum=G,this}maximum(G){return this._maximum=G,this}exclusiveMaximum(G){return this._exclusiveMaximum=G,this}multipleOf(G){return this._multipleOf=G,this}toJSON(){return this._toJSON({minimum:this._minimum,exclusiveMinimum:this._exclusiveMinimum,maximum:this._maximum,exclusiveMaximum:this._exclusiveMaximum,multipleOf:this._multipleOf})}},p6=class extends Sz{constructor(G,D){super(D);this._enum=G,this.type="string"}toJSON(){return this._toJSON({enum:this._enum})}},cH=class extends p6{constructor(G,D){super([G],D)}},hH=class extends Sz{constructor(G){super(G);this.type="boolean"}toJSON(){return this._toJSON()}},iH=class extends Sz{constructor(G,D){super(typeof D==="string"?D:D?.description);if(this.items=G,this.type="array",typeof D==="object"&&D)this._minItems=D.minItems,this._maxItems=D.maxItems}minItems(G){return this._minItems=G,this}maxItems(G){return this._maxItems=G,this}toJSON(){let G=this.items.toJSON(),D=this._collectNestedDefs([G]);return this._defs=D,this._toJSON({items:G,minItems:this._minItems,maxItems:this._maxItems})}},nH=class extends Sz{constructor(G,D){super(D);this.properties=G,this.type="object"}toJSON(){let G=Object.fromEntries(Object.keys(this.properties).map((z)=>[z,this.properties[z].toJSON()])),D=this._collectNestedDefs(Object.values(G));return this._defs=D,this._toJSON({required:Object.keys(this.properties),additionalProperties:!1,properties:G})}},dH=class{constructor(G,D){this.schemas=G,this._nullable=!1,this._defs={},this.description=D}nullable(){return this._nullable=!0,this}define(G,D){return this._defs[G]=D,this}_collectNestedDefs(G){let D=this._defs;for(let z of G)if(z&&typeof z==="object"&&"$defs"in z)Object.assign(D,z.$defs),delete z.$defs;return D}toJSON(){let G=this.schemas.map((B)=>B.toJSON()),D=this._collectNestedDefs(G),z={anyOf:this._nullable?[...G,{type:"null"}]:G};if(this.description)z.description=this.description;if(Object.keys(D).length>0)z.$defs=D;return z}},lH=class{constructor(G){this.id=G}nullable(){return this}toJSON(){return{$ref:`#/$defs/${this.id}`}}},M={string:(G)=>new yH(G),number:(G)=>new xH(G),enum:(G,D)=>new p6(G,D),boolean:(G)=>new hH(G),array:(G,D)=>new iH(G,D),object:(G,D)=>new nH(G,D),union:(G,D)=>new dH(G,D),literal:(G,D)=>new cH(G,D),ref:(G)=>new lH(G)},pH=(G)=>{let{aggFuncSvc:D}=G;if(!D)return;let B=G.colModel.getCols().filter((Q)=>Q.isAllowValue()&&D.getFuncNames(Q).length>0);if(B.length===0)return;return M.object({aggregationModel:M.array(M.union(B.map((Q)=>M.object({colId:M.literal(Q.getColId(),"Column identifier"),aggFunc:M.enum(G.aggFuncSvc?.getFuncNames(Q)||[],"Aggregation function")}))),"Array of column aggregations")},"Aggregation configuration for the grid").nullable()},mH=(G)=>{let z=G.colModel.getCols().filter((Q)=>Q.isResizable());if(z.length===0)return;let B=z.map((Q)=>Q.getColId());return M.object({columnSizingModel:M.array(M.union([M.object({colId:M.ref("resizableColumnId"),width:M.number("Fixed width in pixels").minimum(20)}),M.object({colId:M.ref("resizableColumnId"),flex:M.number("Flex sizing ratio").minimum(0)})]),"Array of column sizing configurations")},"Column sizing configuration for the grid").define("resizableColumnId",M.enum(B,"Column ID that supports resizing"))},tH=()=>{return M.object({hiddenColIds:M.array(M.ref("allColumnIds"),"Array of column IDs to hide")},"Column visibility configuration for the grid").nullable()},sH=({colModel:G,dataTypeSvc:D})=>{if(!D)return;let z=G.getCols(),B={boolean:[],object:[],date:[],dateString:[],dateTime:[],dateTimeString:[],number:[],bigint:[],text:[]};for(let U of z){let Z=D.getBaseDataType(U);if(Z)B[Z].push(U.colId)}let Q=[],J={};for(let U of Object.keys(B))if(B[U].length>0){let Z=`${U}AdvancedFilterModel`,S=J_[U];J[Z]=S(B[U]),Q.push({$ref:`#/$defs/${Z}`})}return J.joinAdvancedFilterModel=M.object({filterType:M.literal("join","Filter type identifier for joining multiple advanced filter conditions"),type:M.enum(["AND","OR"],"Logical operator to combine multiple advanced filter conditions"),conditions:M.array(M.ref("advancedFilterModel"),"Array of advanced filter conditions to be combined")}),J.advancedFilterModel={anyOf:[...Q,{$ref:"#/$defs/joinAdvancedFilterModel"}]},M.object({advancedFilterModel:M.ref("advancedFilterModel")},"Advanced filter configuration for the grid").nullable()},oH=(G)=>{return M.object({filterType:M.literal("boolean","Filter type identifier for boolean column filters"),colId:M.enum(G,"Column identifier for the boolean column to filter"),type:M.enum(["true","false"],"Boolean value to filter by")})},rH=(G)=>{return M.object({filterType:M.literal("object","Filter type identifier for object column filters"),colId:M.enum(G,"Column identifier for the object column to filter"),filter:M.string("Filter value to compare against object column values").nullable(),type:M.enum(["equals","notEqual","contains","notContains","startsWith","endsWith","blank","notBlank"],"Object filter operation type")})},aH=(G)=>{return M.object({filterType:M.literal("date","Filter type identifier for date column filters"),colId:M.enum(G,"Column identifier for the date column to filter"),filter:M.string({pattern:"^\\d{4}-\\d{2}-\\d{2}$",description:"Date value in YYYY-MM-DD format"}).nullable(),type:M.enum(["equals","notEqual","lessThan","lessThanOrEqual","greaterThan","greaterThanOrEqual","blank","notBlank"],"Date filter operation type")})},eH=(G)=>{return M.object({filterType:M.literal("date","Filter type identifier for date string column filters"),colId:M.enum(G,"Column identifier for the date string column to filter"),filter:M.string({pattern:"^\\d{4}-\\d{2}-\\d{2}$",description:"Date value in YYYY-MM-DD format"}).nullable(),type:M.enum(["equals","notEqual","lessThan","lessThanOrEqual","greaterThan","greaterThanOrEqual","blank","notBlank"],"Date string filter operation type")})},G_=(G)=>{return M.object({filterType:M.literal("dateTime","Filter type identifier for datetime column filters"),colId:M.enum(G,"Column identifier for the datetime column to filter"),filter:M.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:M.enum(["equals","notEqual","lessThan","lessThanOrEqual","greaterThan","greaterThanOrEqual","blank","notBlank"],"DateTime filter operation type")})},D_=(G)=>{return M.object({filterType:M.literal("dateTimeString","Filter type identifier for datetime string column filters"),colId:M.enum(G,"Column identifier for the datetime string column to filter"),filter:M.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:M.enum(["equals","notEqual","lessThan","lessThanOrEqual","greaterThan","greaterThanOrEqual","blank","notBlank"],"DateTime string filter operation type")})},z_=(G)=>{return M.object({filterType:M.literal("number","Filter type identifier for number column filters"),colId:M.enum(G,"Column identifier for the number column to filter"),filter:M.number("Numeric value to filter by").nullable(),type:M.enum(["equals","notEqual","lessThan","lessThanOrEqual","greaterThan","greaterThanOrEqual","blank","notBlank"],"Number filter operation type")})},B_=(G)=>{return M.object({filterType:M.literal("bigint","Filter type identifier for bigint column filters"),colId:M.enum(G,"Column identifier for the bigint column to filter"),filter:M.string({pattern:"^-?\\d+$",description:"BigInt value to filter by"}).nullable(),type:M.enum(["equals","notEqual","lessThan","lessThanOrEqual","greaterThan","greaterThanOrEqual","blank","notBlank"],"BigInt filter operation type")})},Q_=(G)=>{return M.object({filterType:M.literal("text","Filter type identifier for text column filters"),colId:M.enum(G,"Column identifier for the text column to filter"),filter:M.string("Text value to filter by").nullable(),type:M.enum(["equals","notEqual","contains","notContains","startsWith","endsWith","blank","notBlank"],"Text filter operation type")})},J_={boolean:oH,object:rH,date:aH,dateString:eH,dateTime:G_,dateTimeString:D_,number:z_,bigint:B_,text:Q_},U_="agTextColumnFilter",m6="agNumberColumnFilter",t6="agDateColumnFilter",Z_="agSetColumnFilter",$_="agMultiColumnFilter",L_=[U_,m6,t6],S_=(G,D)=>{let{advancedFilter:z}=G;if(z?.isEnabled())return sH(G);else return X_(G,D)},X_=(G,D)=>{let{gos:z,colFilter:B,colModel:Q}=G;if(!B)return;let U=Q.getCols().filter((X)=>X.isFilterAllowed());if(U.length===0)return;let Z={},S=z.get("enableFilterHandlers");for(let X of U){let Y=D?.columns?D.columns[X.getColId()]:void 0,W=X.getColDef(),q=B.getDefaultFilter(X),H=Y?.includeSetValues??!1,_=s6(W.filter,W.filterParams,q,(k=!1,w=0)=>{if(!H)return[];let K=void 0;if(!k)K=B.getHandler(X,!0);else if(S)K=B.getHandler(X,!0).getHandler(w);if(!K)return[];return K.getFilterKeys()});if(_)Z[X.colId]=_.nullable()}return M.object({filterModel:M.object(Z)}).nullable()};function s6(G,D,z,B){let Q=void 0;if(typeof G==="string")Q=G;else if(typeof G==="object"&&typeof G.component==="string")Q=G.component;else if(G===!0||typeof G==="object"&&G.component===!0)Q=z;if(!Q)return null;if(L_.includes(Q)){let J=D?.maxNumConditions,U=D?.filterOptions?D.filterOptions.map((S)=>{if(typeof S==="string")return S;if(typeof S==="object"&&S.displayKey)return S.displayKey;return null}).filter(Boolean):void 0,Z=D?.useIsoSeparator||!1;return Y_(Q,{maxConditions:J,filterOptions:U,useIsoSeparator:Z})}else if(Q===Z_)return __(B);else if(Q===$_)return k_(D.filters,z,B);return null}var Y_=(G,D)=>{if(G===t6)return H_(D);else if(G===m6)return q_(D);else return W_(D)},_J=(G,D,z=2)=>{if(z===1)return G;return M.object({filterType:M.literal(D,`Filter type identifier for ${D} filters with multiple conditions`),operator:M.enum(["AND","OR"],"Logical operator to combine multiple filter conditions. Must be included even with a single filter to adhere to the API."),conditions:M.array(G,"Array of filter conditions to be combined").minItems(2).maxItems(z)})},W_=(G)=>{let D=G.filterOptions??["contains","notContains","equals","notEqual","startsWith","endsWith","blank","notBlank"],z=M.object({filterType:M.literal("text","Filter type identifier for text filters"),type:M.enum(D,"Text filter operation type"),filter:M.string("Primary filter value").nullable(),filterTo:M.string("Secondary filter value for range operations").nullable()});return _J(z,"text",G.maxConditions)},q_=(G)=>{let D=G.filterOptions??["equals","notEqual","greaterThan","greaterThanOrEqual","lessThan","lessThanOrEqual","inRange","blank","notBlank"],z=M.object({filterType:M.literal("number","Filter type identifier for number filters"),type:M.enum(D,"Number filter operation type"),filter:M.number("Primary filter value").nullable(),filterTo:M.number("Secondary filter value for range operations").nullable()});return _J(z,"number",G.maxConditions)},H_=(G)=>{let D=G.filterOptions??["equals","notEqual","lessThan","greaterThan","inRange","blank","notBlank"],z=G.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}$",B=M.object({filterType:M.literal("date","Filter type identifier for date filters"),type:M.enum(D,"Date filter operation type"),dateFrom:M.string({pattern:z,description:"Primary date filter value in YYYY-MM-DD HH:mm:ss format"}).nullable(),dateTo:M.string({pattern:z,description:"Secondary date filter value for range operations in YYYY-MM-DD HH:mm:ss format"}).nullable()});return _J(B,"date",G.maxConditions)},__=(G)=>{let D=G?G().filter(Boolean):[];return M.object({filterType:M.literal("set","Filter type identifier for set filters"),values:M.array(D.length>0?M.enum(D,"Available values to filter by"):M.string("Filter values"),"Array of values to include in the filter")})},k_=(G,D,z=()=>[])=>{return M.object({filterType:M.literal("multi","Filter type identifier for multi-condition filters"),filterModels:M.array(M.union(G.map((B,Q)=>s6(B.filter,B.filterParams,D,()=>z(!0,Q))),"Union of different filter types that can be combined").nullable(),"Array of filter conditions to be combined with AND/OR logic")})},w_=(G)=>{let z=G.colModel.getCols().filter((B)=>B.isAllowPivot()).map((B)=>B.getColId());if(z.length===0)return;return M.object({pivotMode:M.boolean("Whether pivot mode is enabled"),pivotColIds:M.array(M.enum(z,"Column ID that supports pivoting"),"Array of column IDs to use as pivot columns")},"Pivot configuration for the grid").nullable()},K_=(G)=>{let z=G.colModel.getCols().filter((Q)=>Q.isAllowRowGroup());if(z.length===0)return;let B=z.map((Q)=>Q.getColId());return M.object({groupColIds:M.array(M.enum(B,"Column ID that supports row grouping"),"Array of column IDs to group by")},"Row grouping configuration for the grid")},f_=(G)=>{let{sortSvc:D}=G;if(!D)return;let B=G.colModel.getCols().filter((J)=>J.isSortable());if(B.length===0)return;let Q=B.map((J)=>J.getColId());return M.object({sortModel:M.array(M.object({colId:M.enum(Q,"Column ID that supports sorting"),sort:M.enum(["asc","desc"],"Sort direction: ascending or descending"),type:M.enum(["default","absolute"],"Sort type: default or absolute values")}),"Array of sort configurations")},"Sort configuration for the grid").nullable()},N_={aggregation:pH,filter:S_,sort:f_,pivot:w_,columnVisibility:tH,columnSizing:mH,rowGroup:K_};function F_(G,D){let z=G.colModel.getCols().map((Z)=>Z.getColId()),B={};for(let Z of TH){if(D?.exclude?.includes(Z))continue;let S=N_[Z],X=S(G,D);if(X)B[Z]=X.nullable()}let Q=D?.columns??{},J=z.map((Z)=>{if(Q[Z]?.description)return`${Z}: ${Q[Z].description}`;else return Z}).filter(Boolean).join(` -`);return M.object(B).define("allColumnIds",M.enum(z,J)).toJSON()}var o6={moduleName:"AiToolkit",version:j,beans:[],dependsOn:[i,gH],apiFunctions:{getStructuredSchema:F_}};function C_(G){return G.sideBar?.comp.isDisplayed()??!1}function V_(G,D){G.sideBar?.comp.setDisplayed(D)}function b_(G,D){G.sideBar?.comp.setSideBarPosition(D)}function v_(G,D,z){G.sideBar?.comp.openToolPanel(D,"api",z)}function O_(G){G.sideBar?.comp.close("api")}function u_(G){return G.sideBar?.comp.openedItem()??null}function j_(G){G.sideBar?.comp.refresh()}function P_(G){return G.sideBar?.comp.isToolPanelShowing()??!1}function g_(G,D){let z=G.sideBar?.comp.getToolPanelInstance(D);return R_(z)}function T_(G){return G.sideBar?.comp.getDef()}var s_=`.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)}}`,Qk={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"}]}]},Jk=class extends Dk{constructor(G){super();this.toolPanelDef=G,this.eToggleButton=MQ,this.eIconWrapper=MQ,this.eLabel=MQ}getToolPanelId(){return this.toolPanelDef.id}postConstruct(){this.setTemplate(Qk,[]),this.setLabel(),this.setIcon(),this.addManagedElementListeners(this.eToggleButton,{click:this.onButtonPressed.bind(this)}),this.eToggleButton.setAttribute("id",`ag-${this.getCompId()}-button`)}setLabel(){let G=this.toolPanelDef,D=this.getLocaleTextFunc()(G.labelKey,G.labelDefault);this.eLabel.textContent=D}setIcon(){this.eIconWrapper.insertAdjacentElement("afterbegin",zk(this.toolPanelDef.iconKey,this.beans))}onButtonPressed(){this.dispatchLocalEvent({type:"toggleButtonClicked"})}setSelected(G){this.toggleCss("ag-selected",G),Bk(this.eToggleButton,G)}},Uk={tag:"div",cls:"ag-side-buttons",role:"tablist"},Zk=class extends o_{constructor(){super(Uk);this.buttonComps=[]}postConstruct(){this.addManagedElementListeners(this.getFocusableElement(),{keydown:this.handleKeyDown.bind(this)})}handleKeyDown(G){if(G.key!==r_.TAB||!G.shiftKey)return;if(e_(this.beans,!0)){G.preventDefault();return}Gk(G)}setActiveButton(G){for(let D of this.buttonComps)D.setSelected(G===D.getToolPanelId())}addButtonComp(G){let D=this.createBean(new Jk(G));return this.buttonComps.push(D),this.appendChild(D),D.addEventListener("toggleButtonClicked",()=>{this.dispatchLocalEvent({type:"sideBarButtonClicked",toolPanelId:G.id})}),D}clearButtons(){this.buttonComps=this.destroyBeans(this.buttonComps),a_(this.getGui())}destroy(){this.clearButtons(),super.destroy()}},$k={selector:"AG-SIDE-BAR-BUTTONS",component:Zk},a6={id:"columns",labelDefault:"Columns",labelKey:"columns",iconKey:"columnsToolPanel",toolPanel:"agColumnsToolPanel"},e6={id:"filters",labelDefault:"Filters",labelKey:"filters",iconKey:"filtersToolPanel",toolPanel:"agFiltersToolPanel"},Lk={id:"filters-new",labelDefault:"Filters",labelKey:"filters",iconKey:"filtersToolPanel",toolPanel:"agNewFiltersToolPanel"},B0={columns:a6,filters:e6,"filters-new":Lk};function p1(G){if(!G)return;if(G===!0)return{toolPanels:[a6,e6],defaultToolPanel:"columns"};if(typeof G==="string")return p1([G]);if(Array.isArray(G)){let D=[];for(let z of G){let B=B0[z];if(!B){r6(215,{key:z,defaultByKey:B0});continue}D.push(B)}if(D.length===0)return;return{toolPanels:D,defaultToolPanel:D[0].id}}return{toolPanels:Sk(G.toolPanels),defaultToolPanel:G.defaultToolPanel,hiddenByDefault:G.hiddenByDefault,position:G.position,hideButtons:G.hideButtons}}function Sk(G){let D=[];if(!G)return D;return G.forEach((z)=>{let B=Xk(z);if(!B)return;D.push(B)}),D}function Xk(G){if(typeof G!=="string")return G;if(B0[G])return B0[G];return r6(215,{key:G,defaultByKey:B0}),null}var Hk=class extends qk{constructor(){super({tag:"div",cls:"ag-tool-panel-horizontal-resize"});this.minWidth=100,this.maxWidth=null}postConstruct(){let G=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(G),this.inverted=this.gos.get("enableRtl")}dispatchResizeEvent(G,D,z){this.eventSvc.dispatchEvent({type:"toolPanelSizeChanged",width:z,started:G,ended:D})}onResizeStart(){this.startingWidth=this.elementToResize.offsetWidth,this.dispatchResizeEvent(!0,!1,this.startingWidth)}onResizeEnd(G){return this.onResizing(G,!0)}onResizing(G,D=!1){let z=this.inverted?-1:1,B=Math.max(this.minWidth,Math.floor(this.startingWidth-G*z));if(this.maxWidth!=null)B=Math.min(this.maxWidth,B);this.elementToResize.style.setProperty("--ag-horizontal-size",`${B}px`),this.dispatchResizeEvent(!1,D,B)}};function _k(G,D,z){return G.getCompDetails(D,kk,void 0,z,!0)}var kk={name:"toolPanel",optionalMethods:["refresh","getState"]},wk={tag:"div",cls:"ag-tool-panel-wrapper",role:"tabpanel",children:[{tag:"div",cls:"ag-tool-panel-content",ref:"eContent"}]},Kk=class extends Yk{constructor(){super(wk);this.eContent=Wk,this.animationId=0,this.defParent=null}postConstruct(){let G=this.getGui(),D=this.resizeBar=this.createManagedBean(new Hk);G.setAttribute("id",`ag-${this.getCompId()}`),D.elementToResize=G,this.appendChild(D)}getToolPanelId(){return this.toolPanelId}getDefParent(){return this.defParent}setDefParent(G){this.defParent=G}setToolPanelDef(G,D){let{id:z,minWidth:B,maxWidth:Q,width:J,parent:U}=G;if(this.toolPanelId=z,this.defParent=U??null,J)this.getGui().style.setProperty("--ag-side-bar-panel-width",`${J}px`);let Z=_k(this.beans.userCompFactory,G,D);if(Z==null)return!1;let S=Z.newAgStackInstance();this.params=Z.params,S.then(this.setToolPanelComponent.bind(this));let X=this.resizeBar;if(B!=null)X.minWidth=B;if(Q!=null)X.maxWidth=Q;return!0}setToolPanelComponent(G){this.toolPanelCompInstance=G;let{eContent:D}=this;D.appendChild(G.getGui()),this.addDestroyFunc(()=>{this.destroyBean(G)})}getToolPanelInstance(){return this.toolPanelCompInstance}setResizerSizerSide(G){let D=this.gos.get("enableRtl"),z=G==="left",B=D?z:!z;this.resizeBar.inverted=B}refresh(){this.toolPanelCompInstance?.refresh(this.params)}animateDisplayed(G){if(this.isDisplayed()===G)return;let D=++this.animationId,{eContent:z}=this,B=()=>{if(this.animationId===D)Q.classList.remove("ag-tool-panel-animating"),z.style.width="",Q.style.width=""},Q=this.getGui(),J=Q.offsetWidth;this.setDisplayed(G),Q.classList.add("ag-tool-panel-animating");let U=getComputedStyle(Q).transitionDuration;if(!parseFloat(U)){B();return}Q.style.transition="none",Q.style.width="",z.style.width=`${z.offsetWidth}px`,Q.style.width=`${J}px`;let Z=Q.offsetWidth;Q.style.transition="",Q.style.width=G?"":"0";let S=setTimeout(B,100);Q.addEventListener("transitionstart",()=>clearTimeout(S),{once:!0}),Q.addEventListener("transitionend",B,{once:!0})}},fk={tag:"div",cls:"ag-side-bar ag-unselectable",children:[{tag:"ag-side-bar-buttons",ref:"sideBarButtons"}]},Nk=class extends x_{constructor(){super(fk,[$k]);this.sideBarButtons=h_,this.toolPanelWrappers=[],this.registerCSS(s_)}postConstruct(){this.sideBarButtons.addEventListener("sideBarButtonClicked",this.onToolPanelButtonClicked.bind(this));let{beans:G,gos:D}=this,{sideBar:z}=D.get("initialState")??{};this.setSideBarDef({sideBarDef:p1(D.get("sideBar")),sideBarState:z}),this.addManagedPropertyListener("sideBar",()=>this.setState()),G.sideBar.comp=this;let B=this.getFocusableElement();this.createManagedBean(new c_(B,{onTabKeyDown:this.onTabKeyDown.bind(this),handleKeyDown:this.handleKeyDown.bind(this)})),i_(G,this,B),this.addManagedPropertyListener("enableAdvancedFilter",this.onAdvancedFilterChanged.bind(this))}getFocusableContainerName(){return"sideBar"}onTabKeyDown(G){if(G.defaultPrevented)return;let{beans:D,sideBarButtons:z}=this,B=this.getGui(),Q=z.getGui(),J=oU(D),U=B.querySelector(".ag-tool-panel-wrapper:not(.ag-hidden)"),Z=G.target,S=G.shiftKey;if(!U){if(l_(D,S,!0))return G.preventDefault(),!0;return t_(G),!1}if(Q.contains(J)){if(d_(U,S))G.preventDefault();return}if(!S)return;let X=null;if(U.contains(J))X=n_(D,U,void 0,!0);else if(u6(U,Z))X=c1(U,Z);if(!X)X=Q.querySelector(".ag-selected button"),X=p_(X)?X:null;if(X&&X!==G.target)G.preventDefault(),X.focus()}handleKeyDown(G){let D=oU(this.beans),z=this.sideBarButtons;if(!z.getGui().contains(D))return;let B=z.getGui(),Q=Array.prototype.slice.call(B.querySelectorAll(".ag-side-button")),J=Q.findIndex((S)=>S.contains(D)),U=null;switch(G.key){case O0.LEFT:case O0.UP:U=Math.max(0,J-1);break;case O0.RIGHT:case O0.DOWN:U=Math.min(J+1,Q.length-1);break}if(U===null)return;let Z=Q[U].querySelector("button");if(Z)Z.focus(),G.preventDefault()}onToolPanelButtonClicked(G){let D=G.toolPanelId;if(this.openedItem()===D)this.openToolPanel(void 0,"sideBarButtonClicked");else this.openToolPanel(D,"sideBarButtonClicked")}clearDownUi(){this.sideBarButtons.clearButtons(),this.destroyToolPanelWrappers()}setSideBarDef({sideBarDef:G,sideBarState:D,existingToolPanelWrappers:z}){if(this.setDisplayed(!1),this.sideBar=G,G)this.sideBarButtons.setDisplayed(!G.hideButtons);if(G?.toolPanels){let B=G.toolPanels;if(this.createToolPanelsAndSideButtons(B,D,z),!this.toolPanelWrappers.length)return;let Q=D?D.visible:!G.hiddenByDefault;if(this.setDisplayed(Q),this.setSideBarPosition(D?D.position:G.position),Q)if(D){let{openToolPanel:J}=D;if(J)this.openToolPanel(J,"sideBarInitializing")}else this.openToolPanel(G.defaultToolPanel,"sideBarInitializing")}}getDef(){return this.sideBar}setSideBarPosition(G){if(!G)G="right";this.position=G;let D=G==="left",z=D?"right":"left";this.toggleCss("ag-side-bar-left",D),this.toggleCss("ag-side-bar-right",!D);for(let B of this.toolPanelWrappers)B.setResizerSizerSide(z);return this.dispatchSideBarUpdated(),this}setDisplayed(G,D){super.setDisplayed(G,D),this.dispatchSideBarUpdated()}getState(){let G={};for(let D of this.toolPanelWrappers)G[D.getToolPanelId()]=D.getToolPanelInstance()?.getState?.();return{visible:this.isDisplayed(),position:this.position,openToolPanel:this.openedItem(),toolPanels:G}}createToolPanelsAndSideButtons(G,D,z){for(let B of G)this.createToolPanelAndSideButton(B,D?.toolPanels?.[B.id],z?.[B.id])}validateDef(G){let{id:D,toolPanel:z}=G;if(D==null)return IQ(212),!1;if(aU(z)){if(this.beans.filterManager?.isAdvFilterEnabled())return IQ(213),!1}return!0}createToolPanelAndSideButton(G,D,z){if(!this.validateDef(G)){this.destroyBean(z);return}let B;if(z)B=z,B.setDefParent(G.parent??null);else if(B=this.createBean(new Kk),!B.setToolPanelDef(G,sU(this.gos,{initialState:D,onStateUpdated:()=>this.dispatchSideBarUpdated()})))return;B.setDisplayed(!1),this.renderToolPanelUnderParent(B,G.parent),this.toolPanelWrappers.push(B);let Q=this.sideBarButtons.addButtonComp(G);m_(Q.eToggleButton,B.getGui())}refresh(){for(let G of this.toolPanelWrappers)G.refresh()}renderToolPanelUnderParent(G,D){let z=G.getGui();if(D)this.beans.environment.applyThemeClasses(D,["ag-external","ag-tool-panel-external"]),z.classList.add(this.gos.get("enableRtl")?"ag-rtl":"ag-ltr");let B=D??G.getDefParent()??this.getGui();if(z.parentElement!==B)B.appendChild(z)}getWrapper(G){return this.toolPanelWrappers.find((D)=>D.getToolPanelId()===G)}openToolPanel(G,D="api",z){let B=this.openedItem(),J=!!G&&!!B||D==="sideBarInitializing";for(let S of this.toolPanelWrappers){let X=G===S.getToolPanelId();if(X)this.renderToolPanelUnderParent(S,z??null);if(J)S.setDisplayed(X);else S.animateDisplayed(X)}let U=this.openedItem();if(B!==U)this.sideBarButtons.setActiveButton(G),this.raiseToolPanelVisibleEvent(G,B??void 0,D)}getToolPanelInstance(G){let D=this.getWrapper(G);if(!D){IQ(214,{key:G});return}return D.getToolPanelInstance()}raiseToolPanelVisibleEvent(G,D,z){let B=!!G&&!!D,Q=this.eventSvc;if(D)Q.dispatchEvent({type:"toolPanelVisibleChanged",source:z,key:D,visible:!1,switchingToolPanel:B});if(G)Q.dispatchEvent({type:"toolPanelVisibleChanged",source:z,key:G,visible:!0,switchingToolPanel:B})}close(G="api"){this.openToolPanel(void 0,G)}isToolPanelShowing(){return!!this.openedItem()}openedItem(){let G=null;for(let D of this.toolPanelWrappers)if(D.isDisplayed())G=D.getToolPanelId();return G}setState(G){let D=p1(this.gos.get("sideBar")),z={};if(D&&this.sideBar)D.toolPanels?.forEach((B)=>{let{id:Q}=B;if(!Q)return;let J=this.sideBar.toolPanels?.find((X)=>X.id===Q);if(!J||B.toolPanel!==J.toolPanel)return;let U=this.getWrapper(Q);if(!U)return;let Z=sU(this.gos,{...B.toolPanelParams??{},initialState:G?.toolPanels?.[Q],onStateUpdated:()=>this.dispatchSideBarUpdated()});if(U.getToolPanelInstance()?.refresh(Z)!==!0)return;this.toolPanelWrappers=this.toolPanelWrappers.filter((X)=>X!==U),rU(U.getGui()),z[Q]=U});this.clearDownUi(),this.setSideBarDef({sideBarDef:D,sideBarState:G,existingToolPanelWrappers:z})}dispatchSideBarUpdated(){this.eventSvc.dispatchEvent({type:"sideBarUpdated"})}destroyToolPanelWrappers(){for(let G of this.toolPanelWrappers)rU(G.getGui()),this.destroyBean(G);this.toolPanelWrappers.length=0}onAdvancedFilterChanged(){if(this.sideBar?.toolPanels?.some((D)=>aU(typeof D==="string"?D:D.toolPanel)))this.setState()}destroy(){this.destroyToolPanelWrappers(),super.destroy()}};function aU(G){return G==="agFiltersToolPanel"||G==="agNewFiltersToolPanel"}var Fk={selector:"AG-SIDE-BAR",component:Nk},Ek=class extends y_{constructor(){super(...arguments);this.beanName="sideBar"}getSelector(){return Fk}},jD={moduleName:"SideBar",version:j,beans:[Ek],apiFunctions:{isSideBarVisible:C_,setSideBarVisible:V_,setSideBarPosition:b_,openToolPanel:v_,closeToolPanel:O_,getOpenedToolPanel:u_,refreshToolPanel:j_,isToolPanelShowing:P_,getToolPanelInstance:g_,getSideBar:T_},dependsOn:[i,A_]},Ik='.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}',G7=class extends O6{constructor(){super({warnNoIcon:()=>Mk(227)})}},TB={moduleName:"MenuItem",version:j,userComponents:{agMenuItem:G7},icons:{check:"tick",subMenuOpen:"small-right",subMenuOpenRtl:"small-left"},css:[Ik]},jk=".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}",ck=300,hk={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"}]},ik=class extends Tk{constructor(){super(hk,[Pk,gk]);this.eExpand=AQ,this.eSelect=AQ,this.eFilterTextField=AQ}postConstruct(){this.createExpandIcons(),this.addManagedListeners(this.eExpand,{click:this.onExpandClicked.bind(this),keydown:(D)=>{if(D.key===yk.SPACE)D.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 G=this.getLocaleTextFunc();this.eSelect.setInputAriaLabel(G("ariaColumnSelectAll","Toggle All Columns Visibility")),this.eFilterTextField.setInputAriaLabel(G("ariaFilterColumnsInput","Filter Columns Input")),this.activateTabIndex([this.eExpand])}onFunctionsReadOnlyPropChanged(){let G=this.gos.get("functionsReadOnly");this.eSelect.setReadOnly(G),this.eSelect.toggleCss("ag-column-select-column-readonly",G)}init(G){this.params=G;let D=this.gos.get("functionsReadOnly");if(this.eSelect.setReadOnly(D),this.eSelect.toggleCss("ag-column-select-column-readonly",D),this.beans.colModel.ready)this.showOrHideOptions()}createExpandIcons(){let G=this.beans;this.eExpand.appendChild(this.eExpandChecked=RQ("columnSelectOpen",G)),this.eExpand.appendChild(this.eExpandUnchecked=RQ("columnSelectClosed",G)),this.eExpand.appendChild(this.eExpandIndeterminate=RQ("columnSelectIndeterminate",G)),this.setExpandState(0)}showOrHideOptions(){let G=this.params,D=!G.suppressColumnFilter,z=!G.suppressColumnSelectAll,B=!G.suppressColumnExpandAll,Q=!!this.beans.colModel.colDefCols?.treeDepth,J=this.getLocaleTextFunc();this.eFilterTextField.setInputPlaceholder(J("searchOoo","Search...")),hD(this.eFilterTextField.getGui(),D),hD(this.eSelect.getGui(),z),hD(this.eExpand,B&&Q)}onFilterTextChanged(){if(!this.onFilterTextChangedDebounced)this.onFilterTextChangedDebounced=xk(this,()=>{let G=this.eFilterTextField.getValue();this.dispatchLocalEvent({type:"filterChanged",filterText:G})},ck);this.onFilterTextChangedDebounced()}onSelectClicked(){this.dispatchLocalEvent({type:this.selectState?"unselectAll":"selectAll"})}onExpandClicked(){this.dispatchLocalEvent({type:this.expandState===0?"collapseAll":"expandAll"})}setExpandState(G){this.expandState=G,hD(this.eExpandChecked,G===0),hD(this.eExpandUnchecked,G===1),hD(this.eExpandIndeterminate,G===2)}setSelectionState(G){this.selectState=G,this.eSelect.setValue(this.selectState)}},nk={selector:"AG-PRIMARY-COLS-HEADER",component:ik};function Dz(G){return!!G&&typeof G.children<"u"}function JD(G){return Dz(G)?G.groupId:G.colId}function D7(G,D,z){let B=(U,Z)=>{let X=U.children.map(JD).includes(JD(Z)),Y=ek(U.children),W=Y&&JD(Y)!==JD(Z);return X&&W};if(!Dz(G))return!0;let Q=G,J=z;if(B(Q,J))return Q.children.push(J),!0;if(Q.groupId===D){if(!Q.children.map(JD).includes(JD(J)))return Q.children.push(J),!0}for(let U=Q.children.length-1;U>=0;U--)if(D7(Q.children[U],D,z))break;return!1}function z7(G){let D=(Q,J)=>{return Dz(Q)&&Dz(J)&&JD(Q)===JD(J)},z=(Q,J)=>{if(!Dz(J))return Q;let U=Q,Z=J;if(Z.children&&Z.groupId){if(D7(U,Z.groupId,Z.children[0]))return U}for(let S of Z.children)z(U,S);return U},B=[];for(let Q=1;Q<=G.length;Q++){let J=G[Q-1],U=G[Q];if(D(J,U))G[Q]=z(J,U);else B.push(J)}return B}function B7(G,D){let z=[],B=(J,U)=>{if(Dz(J)){let Z=J,S=typeof Z.groupId<"u"?Z.groupId:Z.headerName,X=new ok(Z,S,!1,U),Y=[];for(let W of Z.children){let q=B(W,U+1);if(q)Y.push(q)}return X.setChildren(Y),X}else{let Z=J,S=Z.colId?Z.colId:Z.field,X=G.getColDefCol(S);if(!X)z.push(Z);return X}},Q=[];for(let J of D){let U=B(J,0);if(U)Q.push(U)}if(z.length>0)rk(217,{invalidColIds:z});return Q}function Q7(G,D){let z=J7(D3(G)),B=z7(z);D(B)}function G3(G,D){let z=J7(G),B=z7(z);D(B)}function J7(G){let D=(z,B)=>{let Q;if(ak(z))if(z.isPadding())Q=B;else{let U=Object.assign({},z.getColGroupDef());U.groupId=z.getGroupId(),U.children=[B],Q=U}else{let U=Object.assign({},z.getColDef());U.colId=z.getColId(),Q=U}let J=z.getOriginalParent();if(J)return D(J,Q);else return Q};return G.map((z)=>D(z,z.getColDef()))}function D3(G){return G.getCols().filter((D)=>{let z=D.getColDef();return D.isPrimary()&&!z.showRowGroup})}var DZ=class{constructor(G,D,z,B=!1,Q){if(this.displayName=G,this.depth=z,this.group=B,this.localEventService=new z3,B)this.columnGroup=D,this._expanded=Q,this.children=[];else this.column=D}get expanded(){return!!this._expanded}set expanded(G){if(G===this._expanded)return;this._expanded=G,this.localEventService.dispatchEvent({type:"expandedChanged"})}addEventListener(G,D){this.localEventService.addEventListener(G,D)}removeEventListener(G,D){this.localEventService.removeEventListener(G,D)}};function x(G){return!!G?.buttons?.includes("apply")}function YG(G,D){if(!x(D))return;let z=G.sideBar?.comp.openedItem();if(!z)return;G.sideBar?.comp.getToolPanelInstance(z)?.refreshDeferredUi()}function U7(G,D,z,B,Q){let J=W3(D);Z7(G,J,z,B,Q)}function Z7(G,D,z,B,Q){if(G.columnStateUpdateStrategy.getPivotMode(x(Q)))H3(G,D,z,B,Q);else q3(G,D,z,B,Q)}function W3(G){let D=[],z=(B)=>{for(let Q of B){if(!Q.passesFilter)continue;if(Q.group)z(Q.children);else D.push(Q.column)}};return z(G),D}function q3(G,D,z,B,Q){let J=G.columnStateUpdateStrategy,U=[];for(let Z of D){if(Z.getColDef().lockVisible)continue;if(J.isColumnVisibleInToolPanel(x(Q),Z)!==z)U.push({colId:Z.getId(),hide:!z})}J.applyColumnState(x(Q),U,B),YG(G,Q)}function H3(G,D,z,B,Q){_3(G,D,z,B,Q)}function _3(G,D,z,B,Q){let J=G.columnStateUpdateStrategy,U=[],X=z?(Y)=>{if(J.isColumnSelectedInPivotModeToolPanel(x(Q),Y))return;if(Y.isAllowValue()){let W=typeof Y.getAggFunc()==="string"?Y.getAggFunc():G.aggFuncSvc?.getDefaultAggFunc(Y);U.push({colId:Y.getId(),aggFunc:W})}else if(Y.isAllowRowGroup())U.push({colId:Y.getId(),rowGroup:!0});else if(Y.isAllowPivot())U.push({colId:Y.getId(),pivot:!0})}:(Y)=>{if(J.isColumnSelectedInPivotModeToolPanel(x(Q),Y))U.push({colId:Y.getId(),pivot:!1,rowGroup:!1,aggFunc:null})};D.forEach(X),J.applyColumnState(x(Q),U,B),YG(G,Q)}function $7(G,D){let{columns:z,visibleState:B,pivotState:Q,eventType:J}=D,U=G.columnStateUpdateStrategy,Z=U.getPivotMode(x(D)),S=z.map((X)=>{let Y=X.getColId();if(Z){let W=Q?.[Y];return{colId:Y,pivot:W?.pivot,rowGroup:W?.rowGroup,aggFunc:W?.aggFunc}}else return{colId:Y,hide:!B?.[Y]}});U.applyColumnState(x(D),S,J),YG(G,D)}function k3(G){return{pivot:G.isPivotActive(),rowGroup:G.isRowGroupActive(),aggFunc:G.isValueActive()?G.getAggFunc():void 0}}function L7(G,D,z){if(!z)return k3(G);let B=D.getRowGroupColumns(z).includes(G),Q=D.getPivotColumns(z).includes(G),J=D.getValueColumns(z).includes(G);return{pivot:Q,rowGroup:B,aggFunc:J?D.getColumnAggFunc(z,G):void 0}}var S7=(G,D)=>{if(!D)return[];let z=G;for(let B=0,Q=D.length;B{let B=G.aggData;if(B===D)return;if(G.aggData=D,G.__localEventService)F3(G,B,D,z)},JZ=(G,D,z)=>{aD(G,D,z);let B=G.pinnedSibling;if(B)aD(B,D,z);let Q=G.sibling;if(Q){aD(Q,D,z);let J=Q.pinnedSibling;if(J)aD(J,D,z)}},F3=(G,D,z,B)=>{if(!z){if(!D)return;let U=Object.keys(D);for(let Z=0,S=U.length;Z{let Q=D.getCol(z),J=G._groupData;if(!J)J={},G._groupData=J;let U=Q.getColId(),Z=J[U];if(Z===B)return;J[U]=B,G.dispatchCellChangedEvent(Q,B,Z)},ZZ=(G,D,z)=>{if(!G)return;let B=G.group;if(B===z)return;if(G.group=z,G.updateHasChildren(),B&&!z)aD(G,null,D.colModel),G.setAllChildrenCount(null);D.selectionSvc?.updateRowSelectable(G),G.dispatchRowEvent("groupChanged")},kJ=(G,D,z)=>{ZZ(G,D,z),ZZ(G.pinnedSibling,D,z)},Z0=(G,D)=>{let{gos:z,rowGroupColsSvc:B}=D;if(!B||!G)return!1;let Q=z.get("groupLockGroupColumns");if(!G.isRowGroupActive()||Q===0)return!1;if(Q===-1)return!0;let J=B.columns.findIndex((U)=>U.getColId()===G.getColId());return Q>J},Q0=(G,D,z)=>{let Q=G(D,`${D==="groupBy"?"Group by":"Un-Group by"} ${z}`,[z]);if(Q.indexOf(z)>=0)return Q;else return`${Q} ${z}`};function V3(G){let D=A3(G),z="getSelection"in D?D.getSelection():null,B=[];for(let Q=0;Q<(z?.rangeCount??0);Q++){let J=z?.getRangeAt(Q);if(J)B.push(J)}return{selection:z,ranges:B}}function b3(G,D){if(!G.gos.get("enableCellTextSelection"))return D();if(!R3()&&!C3())return D();let{selection:B,ranges:Q}=V3(G);D(),B?.removeAllRanges();for(let J of Q)B?.addRange(J)}var v3={name:"menuItem",optionalMethods:["setActive","select","setExpanded","configureDefaults"]},wJ={getMenuItemComp:(G,D,z)=>{return G.userCompFactory.getCompDetails(D,v3,"agMenuItem",I3(G.gos,z),!0)?.newAgStackInstance()??$Z.resolve()},getPostProcessPopupParams:({column:G,node:D})=>({column:G,rowNode:D}),preserveRangesWhile:b3,stopPropagationCallbacks:E3,warnNoItem:(G)=>{M3(228,{menuItemOrString:G})}},O3=class extends NB{constructor(){super(wJ)}},KJ=class extends uB{constructor(G,D={column:null,node:null,value:null}){super(G,D,wJ)}},X7=class extends w3{constructor(G,D,z,B={}){super({tag:"div",cls:"ag-menu"});this.column=G,this.mouseEventOrTouch=D,this.parentEl=z,this.params=B,this.displayName=null}postConstruct(){let{column:G,beans:{colNames:D}}=this;this.initializeProperties(G);let z;if(f3(G))z=D.getDisplayNameForColumn(G,"columnToolPanel");else z=D.getDisplayNameForProvidedColumnGroup(null,G,"columnToolPanel");if(this.displayName=z,this.buildMenuItemMap(),this.isActive()){let B=this.mouseEventOrTouch;if("preventDefault"in B)B.preventDefault();let Q=this.getMappedMenuItems();if(Q.length===0)return;this.displayContextMenu(Q)}}initializeProperties(G){let D=this.beans.columnStateUpdateStrategy,z;if(N3(G))z=G.getLeafColumns();else z=[G];this.columns=z;let B=D.getPivotMode(x(this.params));this.allowScrollIntoView=!B&&z.some(this.isColumnValidForScrollIntoView),this.allowGrouping=z.some((Q)=>Q.isPrimary()&&Q.isAllowRowGroup()),this.allowValues=z.some((Q)=>Q.isPrimary()&&Q.isAllowValue()),this.allowPivoting=B&&z.some((Q)=>Q.isPrimary()&&Q.isAllowPivot())}buildMenuItemMap(){let G=this.getLocaleTextFunc(),{beans:D,displayName:z}=this,B=this.beans.columnStateUpdateStrategy,Q=new Map;this.menuItemMap=Q;let J=x(this.params),U=B.getPivotMode(J),Z=new Set(B.getRowGroupColumns(J).map((H)=>H.getColId())),S=new Set(B.getValueColumns(J).map((H)=>H.getColId())),X=new Set(B.getPivotColumns(J).map((H)=>H.getColId()));Q.set("scrollIntoView",{allowedFunction:(H)=>!H.isPinned()&&!U&&this.isColumnValidForScrollIntoView(H),activeFunction:()=>!1,activateLabel:()=>G("scrollColumnIntoView",`Scroll ${z} into View`,[z]),activateFunction:()=>{let H=this.columns.find(this.isColumnValidForScrollIntoView);if(H)this.beans.ctrlsSvc.getScrollFeature().ensureColumnVisible(H)},deActivateFunction:()=>{},addIcon:"ensureColumnVisible"});let Y=(H)=>H.isPrimary()&&H.isAllowRowGroup()&&!Z0(H,D);Q.set("rowGroup",{allowedFunction:Y,activeFunction:(H)=>Z.has(H.getColId()),activateLabel:()=>Q0(G,"groupBy",z),deactivateLabel:()=>Q0(G,"ungroupBy",z),activateFunction:()=>{let H=this.addColumnsToList(B.getRowGroupColumns(J),Y);B.setRowGroupColumns(J,H,"toolPanelUi"),YG(this.beans,this.params)},deActivateFunction:()=>{let H=this.removeColumnsFromList(B.getRowGroupColumns(J),Y);B.setRowGroupColumns(J,H,"toolPanelUi"),YG(this.beans,this.params)},addIcon:"menuAddRowGroup",removeIcon:"menuRemoveRowGroup"});let W=(H)=>H.isPrimary()&&H.isAllowValue();Q.set("value",{allowedFunction:W,activeFunction:(H)=>S.has(H.getColId()),activateLabel:()=>G("addToValues",`Add ${z} to values`,[z]),deactivateLabel:()=>G("removeFromValues",`Remove ${z} from values`,[z]),activateFunction:()=>{let H=this.addColumnsToList(B.getValueColumns(J),W);B.setValueColumns(J,H,"toolPanelUi"),YG(this.beans,this.params)},deActivateFunction:()=>{let H=this.removeColumnsFromList(B.getValueColumns(J),W);B.setValueColumns(J,H,"toolPanelUi"),YG(this.beans,this.params)},addIcon:"valuePanel",removeIcon:"valuePanel"});let q=(H)=>U&&H.isPrimary()&&H.isAllowPivot();Q.set("pivot",{allowedFunction:q,activeFunction:(H)=>X.has(H.getColId()),activateLabel:()=>G("addToLabels",`Add ${z} to labels`,[z]),deactivateLabel:()=>G("removeFromLabels",`Remove ${z} from labels`,[z]),activateFunction:()=>{let H=this.addColumnsToList(B.getPivotColumns(J),q);B.setPivotColumns(J,H,"toolPanelUi"),YG(this.beans,this.params)},deActivateFunction:()=>{let H=this.removeColumnsFromList(B.getPivotColumns(J),q);B.setPivotColumns(J,H,"toolPanelUi"),YG(this.beans,this.params)},addIcon:"pivotPanel",removeIcon:"pivotPanel"})}isColumnValidForScrollIntoView(G){if(!G.isVisible())return!1;let z=G.getParent();if(!z)return!0;return z.getDisplayedChildren()?.includes(G)??!0}addColumnsToList(G,D){return[...G].concat(this.columns.filter((z)=>D(z)&&!G.includes(z)))}removeColumnsFromList(G,D){return G.filter((z)=>!D(z)||!this.columns.includes(z))}displayContextMenu(G){let D=this.getGui(),z=this.createBean(new KJ),B=this.getLocaleTextFunc(),Q=()=>{};D.appendChild(z.getGui()),z.addMenuItems(G),z.addManagedListeners(z,{closeMenu:()=>{this.parentEl.focus(),Q()}});let J=this.beans.popupSvc,U=J.addPopup({modal:!0,eChild:D,closeOnEsc:!0,afterGuiAttached:()=>K3(z.getGui()),ariaLabel:B("ariaLabelContextMenu","Context Menu"),closedCallback:(Z)=>{if(Z instanceof KeyboardEvent)this.parentEl.focus();this.destroyBean(z)}});if(U)Q=U.hideFunc;J.positionPopupUnderMouseEvent({type:"columnContextMenu",mouseEvent:this.mouseEventOrTouch,ePopup:D})}isActive(){return this.allowScrollIntoView||this.allowGrouping||this.allowValues||this.allowPivoting}getMappedMenuItems(){let G=[],{menuItemMap:D,columns:z,displayName:B,beans:Q}=this;for(let J of D.values()){let U=z.some((S)=>J.allowedFunction(S)&&!J.activeFunction(S)),Z=z.some((S)=>J.allowedFunction(S)&&J.activeFunction(S));if(U)G.push({name:J.activateLabel(B),icon:QZ(J.addIcon,Q,null),action:()=>J.activateFunction()});if(Z&&J.removeIcon&&J.deactivateLabel)G.push({name:J.deactivateLabel(B),icon:QZ(J.removeIcon,Q,null),action:()=>J.deActivateFunction?.()})}return G}},u3={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"}]},Y7=class extends J3{constructor(G,D,z,B,Q){super();this.modelItem=G,this.allowDragging=D,this.eventType=z,this.focusWrapper=B,this.params=Q,this.cbSelect=Az,this.eLabel=Az,this.eGroupOpenedIcon=Az,this.eGroupClosedIcon=Az,this.eColumnGroupIcons=Az,this.processingColumnStateChange=!1;let{columnGroup:J,depth:U,displayName:Z}=G;this.columnGroup=J,this.columnDepth=U,this.displayName=Z}postConstruct(){this.setTemplate(u3,[Q3]);let{beans:G,cbSelect:D,eLabel:z,displayName:B,columnDepth:Q,modelItem:J,focusWrapper:U,columnGroup:Z}=this,{registry:S,gos:X}=G,Y=Z3("columnDrag",G);this.eDragHandle=Y,Y.classList.add("ag-drag-handle","ag-column-select-column-group-drag-handle");let W=D.getGui(),q=D.getInputElement();W.after(Y),q.setAttribute("tabindex","-1"),z.textContent=B??"",this.setupExpandContract(),this.addCss("ag-column-select-indent-"+Q),this.getGui().style.setProperty("--ag-indentation-level",String(Q)),this.tooltipFeature=this.createOptionalManagedBean(S.createDynamicBean("tooltipFeature",!1,{getGui:()=>this.focusWrapper,getLocation:()=>"columnToolPanelColumnGroup",shouldDisplayTooltip:$3(X,()=>z)})),this.addManagedEventListeners({columnPivotModeChanged:this.onColumnStateChanged.bind(this)}),this.addManagedElementListeners(z,{click:this.onLabelClicked.bind(this)}),this.addManagedListeners(D,{fieldValueChanged:this.onCheckboxChanged.bind(this)}),this.addManagedListeners(J,{expandedChanged:this.onExpandChanged.bind(this)});let H=new zZ(this.getGui(),!1);this.addManagedListeners(H,{longTap:(k)=>this.onContextMenu(k.touchStart)}),this.addDestroyFunc(H.destroy.bind(H)),this.addManagedListeners(U,{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 _=L3(Z.getColGroupDef(),X,null,Z);for(let k of _)this.toggleCss(k,!0)}getColumns(){return this.columnGroup.getLeafColumns()}setupTooltip(){let G=this.columnGroup.getColGroupDef();if(!G)return;let D=()=>this.tooltipFeature?.setTooltipAndRefresh(G.headerTooltip);D(),this.addManagedEventListeners({newColumnsLoaded:D})}handleKeyDown(G){switch(G.key){case CQ.LEFT:G.preventDefault(),this.modelItem.expanded=!1;break;case CQ.RIGHT:G.preventDefault(),this.modelItem.expanded=!0;break;case CQ.SPACE:if(G.preventDefault(),this.isSelectable())this.onSelectAllChanged(!this.isSelected());break}}onContextMenu(G){let{columnGroup:D,gos:z}=this;if(z.get("functionsReadOnly"))return;let B=this.createBean(new X7(D,G,this.focusWrapper,this.params));this.addDestroyFunc(()=>{if(B.isAlive())this.destroyBean(B)})}addVisibilityListenersToAllChildren(){let G=this.onColumnStateChanged.bind(this);for(let D of this.columnGroup.getLeafColumns())this.addManagedListeners(D,{visibleChanged:G,columnValueChanged:G,columnPivotChanged:G,columnRowGroupChanged:G})}setupDragging(){if(!this.allowDragging){VQ(this.eDragHandle,!1);return}let G=this.beans,{gos:D,eventSvc:z,dragAndDrop:B}=G,Q=!D.get("suppressDragLeaveHidesColumns"),J={type:U3.ToolPanel,eElement:this.eDragHandle,dragItemName:this.displayName,getDefaultIconName:()=>Q?"hide":"notAllowed",getDragItem:()=>this.createDragItem(),onDragStarted:()=>{Q=!D.get("suppressDragLeaveHidesColumns"),z.dispatchEvent({type:"columnPanelItemDragStart",column:this.columnGroup})},onDragStopped:()=>{z.dispatchEvent({type:"columnPanelItemDragEnd"})},onGridEnter:(U)=>{if(Q)$7(G,{columns:this.columnGroup.getLeafColumns(),visibleState:U?.visibleState,pivotState:U?.pivotState,eventType:this.eventType,buttons:this.params.buttons})},onGridExit:()=>{if(Q)this.onChangeCommon(!1)}};B.addDragSource(J,!0),this.addDestroyFunc(()=>B.removeDragSource(J))}createDragItem(){let G=this.columnGroup.getLeafColumns(),D={},z={},B=this.beans.columnStateUpdateStrategy,Q=x(this.params);for(let J of G){let U=J.getId();D[U]=J.isVisible(),z[U]=L7(J,B,Q)}return{columns:G,visibleState:D,pivotState:z}}setupExpandContract(){let{beans:G,eGroupClosedIcon:D,eGroupOpenedIcon:z,eColumnGroupIcons:B}=this;D.appendChild(BZ("columnSelectClosed",G,null)),z.appendChild(BZ("columnSelectOpen",G,null));let Q=this.onExpandOrContractClicked.bind(this);this.addManagedElementListeners(D,{click:Q}),this.addManagedElementListeners(z,{click:Q});let J=new zZ(B,!0);this.addManagedListeners(J,{tap:Q}),this.addDestroyFunc(J.destroy.bind(J))}onLabelClicked(){let G=!this.cbSelect.getValue();this.onChangeCommon(G)}onCheckboxChanged(G){this.onChangeCommon(G.selected)}getVisibleLeafColumns(){let G=[],D=(z)=>{for(let B of z)if(B.passesFilter)if(B.group)D(B.children);else G.push(B.column)};return D(this.modelItem.children),G}onChangeCommon(G){if(this.refreshAriaLabel(),this.processingColumnStateChange)return;U7(this.beans,this.modelItem.children,G,this.eventType,this.params)}refreshAriaLabel(){let{cbSelect:G,focusWrapper:D,displayName:z}=this,B=this.getLocaleTextFunc(),Q=B("ariaColumnGroup","Column Group"),J=G.getValue(),U=J===void 0?B("ariaIndeterminate","indeterminate"):J?B("ariaVisible","visible"):B("ariaHidden","hidden"),Z=B("ariaToggleVisibility","Press SPACE to toggle visibility");Y3(D,`${z} ${Q}`),G.setInputAriaLabel(`${Z} (${U})`),S3(D,G.getInputElement().id)}onColumnStateChanged(){let G=this.workOutSelectedValue(),D=this.workOutReadOnlyValue();this.processingColumnStateChange=!0;let z=this.cbSelect;z.setValue(G),z.setReadOnly(D),this.toggleCss("ag-column-select-column-group-readonly",D),this.processingColumnStateChange=!1}workOutSelectedValue(){let D=this.beans.columnStateUpdateStrategy.getPivotMode(x(this.params)),z=this.getVisibleLeafColumns(),B=0,Q=0;for(let J of z)if(D||!J.getColDef().lockVisible)if(this.isColumnChecked(J))B++;else Q++;if(B>0&&Q>0)return;return B>0}workOutReadOnlyValue(){let G=this.beans.columnStateUpdateStrategy.getPivotMode(x(this.params)),D=0;for(let z of this.columnGroup.getLeafColumns())if(G){if(z.isAnyFunctionAllowed())D++}else if(!z.getColDef().lockVisible)D++;return D===0}isColumnChecked(G){let D=this.beans.columnStateUpdateStrategy;if(D.getPivotMode(x(this.params)))return D.isColumnSelectedInPivotModeToolPanel(x(this.params),G);return D.isColumnVisibleInToolPanel(x(this.params),G)}onExpandOrContractClicked(){let G=this.modelItem,D=G.expanded;G.expanded=!D}onExpandChanged(){this.setOpenClosedIcons(),this.refreshAriaExpanded()}setOpenClosedIcons(){let G=this.modelItem.expanded;VQ(this.eGroupClosedIcon,!G),VQ(this.eGroupOpenedIcon,G)}refreshAriaExpanded(){X3(this.focusWrapper,this.modelItem.expanded)}getDisplayName(){return this.displayName}onSelectAllChanged(G){let D=this.cbSelect,z=D.getValue();if(!D.isReadOnly()&&(G&&!z||!G&&z))D.toggle()}isSelected(){return this.cbSelect.getValue()}isSelectable(){return!this.cbSelect.isReadOnly()}setSelected(G){this.cbSelect.setValue(G,!0)}},bQ=(G)=>{if(B3(G))return G.getLeafColumns();return G?[G]:[]},j3=(G,D,z,B)=>{if(!D||!G)return null;let Q=B.indexOf(D),J=z?Q:Q+1,U=P3(B,G,J);return J-U},P3=(G,D,z)=>{if(!D)return 0;let B=D[0],Q=D.length;if(G.indexOf(B){let Q=x(B);if(G.get("suppressMovableColumns")||D.columnStateUpdateStrategy.getPivotMode(Q))return!0;return!!z.find(({colDef:Z})=>!!Z.suppressMovable||!!Z.lockPosition)},SZ=(G,D,z,B)=>{if(!z)return;let{component:Q}=z,J=null,U=z.position==="top";if(Q instanceof Y7)J=Q.getColumns()[0],U=!0;else if(Q)J=Q.column;if(!J)return;let Z=x(B),S=Z?G.columnStateUpdateStrategy.getPrimaryColumns(Z):G.colModel.getCols(),X=j3(D,J,U,S);if(X!=null)G.columnStateUpdateStrategy.moveColumns(Z,D,X,"toolPanelUi"),YG(G,B)},g3=(G)=>{return G.column},s3={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"}]},o3=class extends y3{constructor(G,D,z,B,Q){super();this.modelItem=G,this.allowDragging=D,this.groupsExist=z,this.focusWrapper=B,this.params=Q,this.eLabel=XZ,this.cbSelect=XZ,this.processingColumnStateChange=!1;let{column:J,depth:U,displayName:Z}=G;this.column=J,this.columnDepth=U,this.displayName=Z}postConstruct(){this.setTemplate(s3,[T3]);let{beans:G,cbSelect:D,displayName:z,eLabel:B,columnDepth:Q,groupsExist:J,column:U,gos:Z,focusWrapper:S}=this,X=i3("columnDrag",G);this.eDragHandle=X,X.classList.add("ag-drag-handle","ag-column-select-column-drag-handle");let Y=D.getGui(),W=D.getInputElement();if(Y.after(X),W.setAttribute("tabindex","-1"),B.textContent=z,J)this.addCss("ag-column-select-add-group-indent");this.addCss(`ag-column-select-indent-${Q}`),this.getGui().style.setProperty("--ag-indentation-level",String(Q)),this.tooltipFeature=this.createOptionalManagedBean(G.registry.createDynamicBean("tooltipFeature",!1,{getGui:()=>this.focusWrapper,getLocation:()=>"columnToolPanelColumn",shouldDisplayTooltip:n3(Z,()=>B),getAdditionalParams:()=>({colDef:U.getColDef()})})),this.setupDragging();let q=this.onColumnStateChanged.bind(this);this.addManagedEventListeners({columnPivotModeChanged:q}),this.addManagedListeners(U,{columnValueChanged:q,columnPivotChanged:q,columnRowGroupChanged:q,visibleChanged:q}),this.addManagedListeners(S,{keydown:this.handleKeyDown.bind(this),contextmenu:this.onContextMenu.bind(this)});let H=new h3(S);this.addManagedListeners(H,{longTap:(k)=>this.onContextMenu(k.touchStart)}),this.addDestroyFunc(H.destroy.bind(H)),this.addManagedPropertyListener("functionsReadOnly",this.onColumnStateChanged.bind(this)),this.addManagedListeners(D,{fieldValueChanged:this.onCheckboxChanged.bind(this)}),this.addManagedElementListeners(B,{click:this.onLabelClicked.bind(this)}),this.onColumnStateChanged(),this.refreshAriaLabel(),this.setupTooltip();let _=d3(U.getColDef(),Z,U,null);for(let k of _)this.toggleCss(k,!0)}getColumn(){return this.column}setupTooltip(){let G=()=>this.tooltipFeature?.setTooltipAndRefresh(this.column.getColDef().headerTooltip);G(),this.addManagedEventListeners({newColumnsLoaded:G})}onContextMenu(G){let{column:D,gos:z}=this;if(z.get("functionsReadOnly"))return;let B=this.createBean(new X7(D,G,this.focusWrapper,this.params));this.addDestroyFunc(()=>{if(B.isAlive())this.destroyBean(B)})}handleKeyDown(G){if(G.key===c3.SPACE){if(G.preventDefault(),this.isSelectable())this.onSelectAllChanged(!this.isSelected())}}onLabelClicked(){if(this.gos.get("functionsReadOnly"))return;let G=!this.cbSelect.getValue();this.onChangeCommon(G)}onCheckboxChanged(G){this.onChangeCommon(G.selected)}onChangeCommon(G){if(this.cbSelect.isReadOnly())return;if(this.refreshAriaLabel(),this.processingColumnStateChange)return;Z7(this.beans,[this.column],G,"toolPanelUi",this.params)}refreshAriaLabel(){let{cbSelect:G,focusWrapper:D,displayName:z}=this,B=this.getLocaleTextFunc(),Q=B("ariaColumn","Column"),J=G.getValue()?B("ariaVisible","visible"):B("ariaHidden","hidden"),U=B("ariaToggleVisibility","Press SPACE to toggle visibility");p3(D,`${z} ${Q}`),this.cbSelect.setInputAriaLabel(`${U} (${J})`),l3(D,G.getInputElement().id)}setupDragging(){let G=this.eDragHandle;if(!this.allowDragging){m3(G,!1);return}let D=this.beans,{gos:z,eventSvc:B,dragAndDrop:Q}=D;if(x(this.params))G.setAttribute("data-column-tool-panel-deferred","");let J=!z.get("suppressDragLeaveHidesColumns"),U={type:x3.ToolPanel,eElement:G,dragItemName:this.displayName,getDefaultIconName:()=>J&&!x(this.params)?"hide":"notAllowed",getDragItem:()=>this.createDragItem(),onDragStarted:()=>{J=!z.get("suppressDragLeaveHidesColumns"),B.dispatchEvent({type:"columnPanelItemDragStart",column:this.column})},onDragStopped:()=>{B.dispatchEvent({type:"columnPanelItemDragEnd"})},onGridEnter:(Z)=>{if(J&&!x(this.params))$7(D,{columns:[this.column],visibleState:Z?.visibleState,pivotState:Z?.pivotState,eventType:"toolPanelUi",buttons:this.params.buttons})},onGridExit:()=>{if(J&&!x(this.params))this.onChangeCommon(!1)}};Q.addDragSource(U,!0),this.addDestroyFunc(()=>Q.removeDragSource(U))}createDragItem(){let G=this.column.getColId(),D={[G]:this.column.isVisible()},z=this.beans.columnStateUpdateStrategy,B={[G]:L7(this.column,z,x(this.params))};return{columns:[this.column],visibleState:D,pivotState:B}}onColumnStateChanged(){this.processingColumnStateChange=!0;let G=this.beans.columnStateUpdateStrategy,D=G.getPivotMode(x(this.params));if(D){let Q=G.isColumnSelectedInPivotModeToolPanel(x(this.params),this.column);this.cbSelect.setValue(Q)}else this.cbSelect.setValue(G.isColumnVisibleInToolPanel(x(this.params),this.column));let z=!0,B=!0;if(D){let Q=this.gos.get("functionsReadOnly"),J=!this.column.isAnyFunctionAllowed();z=!Q&&!J,B=z}else{let{enableRowGroup:Q,enableValue:J,lockPosition:U,suppressMovable:Z,lockVisible:S}=this.column.getColDef(),X=!!Q||!!J,Y=!!U||!!Z;z=!S,B=X||!Y}this.cbSelect.setReadOnly(!z),this.eDragHandle.classList.toggle("ag-column-select-column-readonly",!B),this.toggleCss("ag-column-select-column-readonly",!B&&!z),this.cbSelect.setPassive(!1),this.processingColumnStateChange=!1}getDisplayName(){return this.displayName}onSelectAllChanged(G){let D=this.cbSelect;if(G!==D.getValue()){if(!D.isReadOnly())D.toggle()}}isSelected(){return this.cbSelect.getValue()}isSelectable(){return!this.cbSelect.isReadOnly()}isExpandable(){return!1}setExpanded(G){t3(158)}},r3=class{constructor(G){this.items=G}getRowCount(){return this.items.length}getRow(G){return this.items[G]}},a3="ag-column-select-list",e3=class extends dk{constructor(){super({tag:"div",cls:a3,role:"presentation"});this.destroyColumnItemFuncs=[],this.hasLoadedInitialState=!1,this.isInitialState=!1,this.skipRefocus=!1}wireBeans(G){this.colModel=G.colModel}destroy(){this.destroyColumnTree(),super.destroy()}destroyColumnTree(){this.allColsTree=[];for(let G of this.destroyColumnItemFuncs)G();this.destroyColumnItemFuncs=[]}init(G,D,z){this.params=G;let{suppressSyncLayoutWithGrid:B,contractColumnSelection:Q,suppressColumnMove:J}=G;if(this.allowDragging=D,this.eventType=z,!B)this.addManagedEventListeners({columnMoved:this.onColumnsChanged.bind(this)});this.addManagedEventListeners({newColumnsLoaded:this.onColumnsChanged.bind(this)});let U=this.fireSelectionChangedEvent.bind(this);this.addManagedEventListeners({columnPivotChanged:U,columnPivotModeChanged:U,columnRowGroupChanged:U,columnValueChanged:U,columnVisible:U,newColumnsLoaded:U}),this.expandGroupsByDefault=!Q;let Z=J||B,S=this.createManagedBean(new Lz({cssIdentifier:"column-select",ariaRole:"tree",moveItemCallback:(X,Y)=>{if(Z)return;this.moveItems(X,Y)}}));if(this.virtualList=S,this.appendChild(S.getGui()),S.setComponentCreator((X,Y)=>{return mk(Y,X.depth+1),this.createComponentFromItem(X,Y)}),this.colModel.ready)this.onColumnsChanged();if(Z)return;this.createItemDragFeature()}createItemDragFeature(){let{gos:G,beans:D,virtualList:z}=this;this.createManagedBean(new c6(this,z,{dragSourceType:lk.ToolPanel,addListeners:(B,Q,J)=>{B.addManagedEventListeners({columnPanelItemDragStart:Q,columnPanelItemDragEnd:J})},getCurrentDragValue:(B)=>g3(B),isMoveBlocked:(B)=>LZ(G,D,bQ(B),this.params),getNumRows:(B)=>B.getDisplayedColsList().length,moveItem:(B,Q)=>SZ(D,bQ(B),Q,this.params)}))}moveItems(G,D){let{gos:z,beans:B}=this,{modelItem:Q}=G,{group:J,columnGroup:U,column:Z,expanded:S}=Q,X=bQ(J?U:Z);if(LZ(z,B,X,this.params))return;let Y=this.displayedColsList.indexOf(Q),W=D?-1:1,q=0;if(D){let _=G.columnDepth>0?Z.getParent()?.getChildren():null;if(_?.length&&Z===_[0])q=-1}else if(J)q=S?Q.children.length:0;let H=Math.min(Math.max(Y+q+W,0),this.displayedColsList.length-1);this.skipRefocus=!0,SZ(B,X,{rowIndex:H,position:D?"top":"bottom",component:this.virtualList.getComponentAt(H)},this.params),this.focusRowIfAlive(H-q).then(()=>{this.skipRefocus=!1})}createComponentFromItem(G,D){let z=this.allowDragging;if(G.group){let Q=new Y7(G,z,this.eventType,D,this.params);return this.createBean(Q),Q}let B=new o3(G,z,this.groupsExist,D,this.params);return this.createBean(B),B}onColumnsChanged(){let G=this.params;if(!this.hasLoadedInitialState)this.hasLoadedInitialState=!0,this.isInitialState=!!G.initialState;let D=this.getExpandedStates(),z=this.colModel.isPivotMode(),B=x(G),Q=B&&this.beans.columnStateUpdateStrategy.hasDeferredColumnOrder(B);if((!G.suppressSyncLayoutWithGrid||B)&&!z||Q)this.buildTreeFromWhatGridIsDisplaying();else this.buildTreeFromProvidedColumnDefs();this.setExpandedStates(D),this.markFilteredColumns(),this.flattenAndFilterModel(),this.isInitialState=!1}getDisplayedColsList(){return this.displayedColsList}getExpandedStates(){let G={};if(this.isInitialState){let{expandedGroupIds:D}=this.params.initialState;for(let z of D)G[z]=!0;return G}if(!this.allColsTree)return{};return this.forEachItem((D)=>{if(!D.group)return;let z=D.columnGroup;if(z)G[z.getId()]=D.expanded}),G}setExpandedStates(G){if(!this.allColsTree)return;let{isInitialState:D}=this;this.forEachItem((z)=>{if(!z.group)return;let B=z.columnGroup;if(B){let Q=G[B.getId()];if(Q!=null||D)z.expanded=!!Q}})}buildTreeFromWhatGridIsDisplaying(){let G=x(this.params);if(G&&this.beans.columnStateUpdateStrategy.hasDeferredColumnOrder(G)){let D=this.beans.columnStateUpdateStrategy.getPrimaryColumns(G);if(D.length>0){G3(D,this.setColumnLayout.bind(this));return}}if(this.params.suppressSyncLayoutWithGrid){this.buildTreeFromProvidedColumnDefs();return}Q7(this.colModel,this.setColumnLayout.bind(this))}setColumnLayout(G){let D=B7(this.colModel,G);this.buildListModel(D),this.groupsExist=G.some((z)=>{return z&&typeof z.children<"u"}),this.markFilteredColumns(),this.flattenAndFilterModel()}buildTreeFromProvidedColumnDefs(){let G=this.colModel;this.buildListModel(G.getColDefColTree()),this.groupsExist=!!G.colDefCols?.treeDepth}buildListModel(G){let D=this.onColumnExpanded.bind(this),z=(Z)=>{Z.addEventListener("expandedChanged",D);let S=Z.removeEventListener.bind(Z,"expandedChanged",D);this.destroyColumnItemFuncs.push(S)},B=this.beans.colNames,Q=(Z,S,X)=>{for(let Y of Z)if(sk(Y))J(Y,S,X);else U(Y,S,X)},J=(Z,S,X)=>{if(Z.getColGroupDef()?.suppressColumnsToolPanel)return;if(Z.isPadding()){Q(Z.getChildren(),S,X);return}let q=B.getDisplayNameForProvidedColumnGroup(null,Z,"columnToolPanel"),H=new DZ(q,Z,S,!0,this.expandGroupsByDefault);X.push(H),z(H),Q(Z.getChildren(),S+1,H.children)},U=(Z,S,X)=>{if(Z.getColDef()?.suppressColumnsToolPanel)return;let W=B.getDisplayNameForColumn(Z,"columnToolPanel");X.push(new DZ(W,Z,S))};this.destroyColumnTree(),Q(G,0,this.allColsTree)}onColumnExpanded(){this.flattenAndFilterModel()}flattenAndFilterModel(){this.displayedColsList=[];let G=(B)=>{if(!B.passesFilter)return;if(this.displayedColsList.push(B),B.group&&B.expanded)B.children.forEach(G)},D=this.virtualList;this.allColsTree.forEach(G),D.setModel(new r3(this.displayedColsList));let z=null;if(!this.skipRefocus)z=D.getLastFocusedRow();if(D.refresh(),z!=null)this.focusRowIfAlive(z);this.notifyListeners(),this.refreshAriaLabel()}refreshAriaLabel(){let G=this.getLocaleTextFunc(),D=G("ariaColumnPanelList","Column List"),z=G("columns","Columns"),B=this.displayedColsList.length;pk(this.virtualList.getAriaElement(),`${D} ${B} ${z}`)}focusRowIfAlive(G){if(G===-1)return Promise.resolve();return new Promise((D)=>{window.setTimeout(()=>{if(this.isAlive())this.virtualList.focusRow(G);D()},0)})}forEachItem(G){let D=(B)=>{for(let Q of B)if(G(Q),Q.group)D(Q.children)},z=this.allColsTree;if(!z)return;D(z)}doSetExpandedAll(G){this.forEachItem((D)=>{if(D.group)D.expanded=G})}setGroupsExpanded(G,D){if(!D){this.doSetExpandedAll(G);return}let z=[];this.forEachItem((Q)=>{if(!Q.group)return;let J=Q.columnGroup.getId();if(D.indexOf(J)>=0)Q.expanded=G,z.push(J)});let B=D.filter((Q)=>!z.includes(Q));if(B.length>0)tk(157,{unrecognisedGroupIds:B})}getExpandState(){let G=0,D=0;if(this.forEachItem((z)=>{if(!z.group)return;if(z.expanded)G++;else D++}),G>0&&D>0)return 2;if(D>0)return 1;return 0}doSetSelectedAll(G){U7(this.beans,this.allColsTree,G,this.eventType,this.params),this.syncVisibleSelectionState(),this.fireSelectionChangedEvent()}syncVisibleSelectionState(){for(let G=0;G{if(Q.group)return;if(!Q.passesFilter)return;let J=Q.column,U=J.getColDef(),Z;if(B){if(!J.isAllowPivot()&&!J.isAllowRowGroup()&&!J.isAllowValue())return;Z=z.isColumnSelectedInPivotModeToolPanel(x(this.params),J)??!1}else{if(U.lockVisible)return;Z=z.isColumnVisibleInToolPanel(x(this.params),J)??!1}if(Z)G++;else D++}),G>0&&D>0)return;return!(G===0||D>0)}setFilterText(G){this.filterText=GZ(G)?G.toLowerCase():null,this.markFilteredColumns(),this.flattenAndFilterModel()}markFilteredColumns(){let G=(z)=>{if(!GZ(this.filterText))return!0;let B=z.displayName;return B==null||B.toLowerCase().indexOf(this.filterText)!==-1},D=(z,B)=>{let Q=!1;if(z.group){let U=G(z);for(let Z of z.children){let S=D(Z,U||B);if(S)Q=S}}let J=B||Q?!0:G(z);return z.passesFilter=J,J};for(let z of this.allColsTree)D(z,!1)}notifyListeners(){this.fireGroupExpandedEvent(),this.fireSelectionChangedEvent()}fireGroupExpandedEvent(){let G=this.getExpandState();this.dispatchLocalEvent({type:"groupExpanded",state:G})}fireSelectionChangedEvent(){if(!this.allColsTree)return;let G=this.getSelectionState();this.dispatchLocalEvent({type:"selectionChanged",state:G})}getExpandedGroups(){let G=[];if(!this.allColsTree)return G;return this.forEachItem((D)=>{if(D.group&&D.expanded)G.push(D.columnGroup.getId())}),G}},Gw={selector:"AG-PRIMARY-COLS-LIST",component:e3},Dw={tag:"div",cls:"ag-column-select",children:[{tag:"ag-primary-cols-header",ref:"primaryColsHeaderPanel"},{tag:"ag-primary-cols-list",ref:"primaryColsListPanel"}]},W7=class extends Ok{constructor(){super(Dw,[nk,Gw]);this.primaryColsHeaderPanel=eU,this.primaryColsListPanel=eU,this.registerCSS(jk)}init(G,D,z){let{primaryColsHeaderPanel:B,primaryColsListPanel:Q}=this;B.init(D);let{suppressColumnFilter:J,suppressColumnSelectAll:U}=D;if(D.suppressColumnExpandAll&&J&&U)B.setDisplayed(!1);this.addManagedListeners(Q,{groupExpanded:(S)=>{B.setExpandState(S.state),D.onStateUpdated()},selectionChanged:(S)=>B.setSelectionState(S.state)}),Q.init(D,G,z),this.addManagedListeners(B,{expandAll:Q.doSetExpandedAll.bind(Q,!0),collapseAll:Q.doSetExpandedAll.bind(Q,!1),selectAll:Q.doSetSelectedAll.bind(Q,!0),unselectAll:Q.doSetSelectedAll.bind(Q,!1),filterChanged:(S)=>Q.setFilterText(S.filterText)}),this.positionableFeature=this.createManagedBean(new uk(this.getGui(),{minHeight:100}))}toggleResizable(G){this.positionableFeature.setResizable(G?{bottom:!0}:!1)}expandGroups(G){this.primaryColsListPanel.setGroupsExpanded(!0,G)}collapseGroups(G){this.primaryColsListPanel.setGroupsExpanded(!1,G)}setColumnLayout(G){this.primaryColsListPanel.setColumnLayout(G)}syncLayoutWithGrid(){this.primaryColsListPanel.onColumnsChanged()}getExpandedGroups(){return this.primaryColsListPanel.getExpandedGroups()}},zw=".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)}",Bw="ag-column-panel-deferred",Qw=class extends Ak{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 G=this.captureGridState();if(!this.beans.columnStateUpdateStrategy.hasPendingChanges(this.isDeferModeEnabled)){this.lastKnownGridState=G;return}let D=this.lastKnownGridState&&this.isGridStateEqual(this.lastKnownGridState,G);if(this.lastKnownGridState=G,!D)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(zw)}wireBeans(G){this.colToolPanelFactory=G.colToolPanelFactory}setVisible(G){if(super.setDisplayed(G),G&&!this.initialised)this.init(this.params)}init(G){let z={...Ck(this.gos,{suppressColumnMove:!1,suppressColumnSelectAll:!1,suppressColumnFilter:!1,suppressColumnExpandAll:!1,contractColumnSelection:!1,suppressPivotMode:!1,suppressRowGroups:!1,suppressValues:!1,suppressPivots:!1,suppressSyncLayoutWithGrid:!1}),...G};this.params=z;let{childDestroyFuncs:B,colToolPanelFactory:Q,gos:J}=this,U=J.isModuleRegistered("SharedPivot"),Z=U||J.isModuleRegistered("SharedRowGrouping");if(this.isDeferModeEnabled=x(z),this.toggleCss(Bw,this.isDeferModeEnabled),!z.suppressPivotMode&&Q&&U)this.pivotModePanel=Q.createPivotModePanel(this,B,z,this.onPivotModePanelValueChanged);let S=this.createBean(new W7);if(this.primaryColsPanel=S,B.push(()=>this.destroyBean(this.primaryColsPanel)),S.init(!0,z,"toolPanelUi"),S.addCss("ag-column-panel-column-select"),this.appendChild(S),Q){if(!z.suppressRowGroups&&Z)this.rowGroupDropZonePanel=Q.createRowGroupPanel(this,B,z);if(!z.suppressValues&&Z)this.valuesDropZonePanel=Q.createValuesPanel(this,B,z);if(!z.suppressPivots&&U)this.pivotDropZonePanel=Q.createPivotPanel(this,B,z);this.setLastVisible();let[X]=this.addManagedEventListeners({columnPivotModeChanged:()=>{this.resetChildrenHeight(),this.setLastVisible()}});B.push(()=>X())}if(this.isDeferModeEnabled){let X=this.onExternalGridChange;B.push(...this.addManagedEventListeners({columnEverythingChanged:this.onColumnEverythingChanged,sortChanged:X,columnVisible:X,columnRowGroupChanged:X,columnValueChanged:X,columnPivotChanged:X,columnPivotModeChanged:X,newColumnsLoaded:X,...z.suppressSyncLayoutWithGrid?{}:{columnMoved:X}}))}if(z.buttons){if(!z.buttons.includes("apply"))vk(298);if(z.buttons.length)this.initDeferredButtons(z.buttons)}this.initialised=!0}initDeferredButtons(G){let D=this.createBean(new Rk({className:"ag-column-panel-buttons"}));this.deferredButtonsComp=D,this.childDestroyFuncs.push(()=>{this.deferredButtonsComp=this.destroyBean(this.deferredButtonsComp)});let z=this.getLocaleTextFunc(),B=G.map((Q)=>({type:Q,label:z(Q==="apply"?"applyColumnToolPanel":"cancelColumnToolPanel",Q==="apply"?"Apply":"Cancel")}));D.updateButtons(B),D.updateValidity(!1),D.addManagedListeners(D,{apply:this.onDeferredApply,cancel:this.onDeferredCancel}),this.appendChild(D)}resetDeferredState(){this.beans.columnStateUpdateStrategy.reset(this.isDeferModeEnabled),this.deferredButtonsComp?.updateValidity(!1),this.refreshToolPanelLayouts(),this.pivotModePanel?.refreshEditStrategy()}captureGridState(){let{beans:G}=this,D=(z)=>(z??[]).map((B)=>B.getColId());return{rowGroupColIds:D(G.rowGroupColsSvc?.columns),valueColIds:D(G.valueColsSvc?.columns),pivotColIds:D(G.pivotColsSvc?.columns),pivotMode:G.colModel.isPivotMode(),columnOrder:G.colModel.getCols().map((z)=>z.getColId()),visibleColIds:G.colModel.getCols().filter((z)=>z.isVisible()).map((z)=>z.getColId()),sortState:G.colModel.getCols().filter((z)=>z.getSort()).map((z)=>`${z.getColId()}:${z.getSort()}:${z.getSortIndex()}`),aggFuncState:(G.valueColsSvc?.columns??[]).map((z)=>z.getAggFunc()),widthState:G.colModel.getCols().map((z)=>`${z.getColId()}:${z.getActualWidth()}`)}}isGridStateEqual(G,D){return aG(G.rowGroupColIds,D.rowGroupColIds)&&aG(G.valueColIds,D.valueColIds)&&aG(G.pivotColIds,D.pivotColIds)&&G.pivotMode===D.pivotMode&&aG(G.columnOrder,D.columnOrder)&&aG(G.visibleColIds,D.visibleColIds)&&aG(G.sortState,D.sortState)&&aG(G.aggFuncState,D.aggFuncState)&&aG(G.widthState,D.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(G){let D=this.colToolPanelFactory;if(!D)return;this.pivotModePanel=D.setPanelVisible(this.pivotModePanel,G,D.createPivotModePanel.bind(D,this,this.childDestroyFuncs,this.params,this.onPivotModePanelValueChanged,!0)),this.setLastVisible()}setRowGroupsSectionVisible(G){let D=this.colToolPanelFactory;if(!D)return;this.rowGroupDropZonePanel=D.setPanelVisible(this.rowGroupDropZonePanel,G,D.createRowGroupPanel.bind(D,this,this.childDestroyFuncs,this.params)),this.setLastVisible()}setValuesSectionVisible(G){let D=this.colToolPanelFactory;if(!D)return;this.valuesDropZonePanel=D.setPanelVisible(this.valuesDropZonePanel,G,D.createValuesPanel.bind(D,this,this.childDestroyFuncs,this.params)),this.setLastVisible()}setPivotSectionVisible(G){let D=this.colToolPanelFactory;if(!D)return;this.pivotDropZonePanel=D.setPanelVisible(this.pivotDropZonePanel,G,D.createPivotPanel.bind(D,this,this.childDestroyFuncs,this.params)),this.pivotDropZonePanel?.setDisplayed(G),this.setLastVisible()}setResizers(){for(let G of[this.primaryColsPanel,this.rowGroupDropZonePanel,this.valuesDropZonePanel,this.pivotDropZonePanel]){if(!G)continue;let D=G.getGui();G.toggleResizable(!D.classList.contains("ag-last-column-drop")&&!D.classList.contains("ag-hidden")&&!D.classList.contains("ag-last-visible-child"))}}setLastVisible(){let G=this.getGui(),D=Array.prototype.slice.call(G.querySelectorAll(".ag-column-drop"));for(let Q of D)Q.classList.remove("ag-last-column-drop");let z=G.querySelectorAll(".ag-column-drop:not(.ag-hidden)"),B=bk(z);if(B)B.classList.add("ag-last-column-drop");this.primaryColsPanel.getGui().classList.toggle("ag-last-visible-child",!B),this.setResizers()}resetChildrenHeight(){let D=this.getGui().children;for(let z=0;zJ.getGui().getBoundingClientRect()),Q=B.findIndex((J)=>this.horizontal?J.right>z&&J.leftz);if(Q===-1){let J=this.gos.get("enableRtl");if(B.every((S)=>z>(this.horizontal?S.right:S.bottom)))return J&&this.horizontal?0:this.childPillComponents.length;if(B.every((S)=>z<(this.horizontal?S.left:S.top)))return J&&this.horizontal?this.childPillComponents.length:0;return this.insertIndex}if(this.insertIndex<=Q)return Q+1;return Q}checkDragStartedBySelf(G){if(this.state!=="notDragging")return;this.state="rearrangeItems",this.potentialDndItems=this.getItems(G.dragSource.getDragItem()),this.refreshGui(),this.checkInsertIndex(G),this.refreshGui()}onDragging(G){if(this.checkDragStartedBySelf(G),this.checkInsertIndex(G))this.refreshGui()}handleDragEnterEnd(G){}onDragEnter(G){let D=this.getItems(G.dragSource.getDragItem());this.state="newItemsIn";let z=D.filter((Q)=>this.isItemDroppable(Q,G)),B=z.every((Q)=>this.childPillComponents.map((J)=>J.getItem()).indexOf(Q)!==-1);if(z.length===0)return;if(this.potentialDndItems=z,B){this.state="notDragging";return}this.handleDragEnterEnd(G),this.checkInsertIndex(G),this.refreshGui()}isPotentialDndItems(){return!!this.potentialDndItems?.length}handleDragLeaveEnd(G){}onDragLeave(G){if(this.state==="rearrangeItems"){let D=this.getItems(G.dragSource.getDragItem());this.removeItems(D)}if(this.isPotentialDndItems())this.handleDragLeaveEnd(G),this.potentialDndItems=[],this.refreshGui();this.state="notDragging"}onDragCancel(G){if(this.isPotentialDndItems()){if(this.state==="newItemsIn")this.handleDragLeaveEnd(G);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(G){let D=this.getExistingItems().filter((z)=>!G.includes(z));this.updateItems(D),this.refreshGui()}addItems(G){if(!G)return;let D=this.getExistingItems().slice(),z=G.filter((B)=>D.indexOf(B)<0);HZ(D,z,this.insertIndex),this.updateItems(D),this.refreshGui()}addItem(G){this.insertIndex=this.getExistingItems().length,this.addItems([G])}rearrangeItems(G,D){let z;if(!D)z=this.getNonGhostItems().slice();else z=this.getExistingItems().filter((B)=>G.indexOf(B)===-1);if(HZ(z,G,this.insertIndex),Yw(z,this.getExistingItems()))return!1;return this.updateItems(z),this.refreshGui(),!0}refreshGui(){let G=0;if(!this.horizontal)G=this.ePillDropList.scrollTop;let D=this.resizeEnabled,z=this.getFocusedItem(),{eGridDiv:B}=this.beans,Q=Hw(),J=null;if(Q)J=vQ(this.beans,B)??vQ(this.beans,B,!1,!0);if(this.toggleResizable(!1),this.destroyGui(),this.addIconAndTitleToGui(),this.addEmptyMessageToGui(),this.addItemsToGui(),G!==0)this.ePillDropList.scrollTop=G;if(D)this.toggleResizable(D);if(Q)this.restoreFocus(z,J)}getFocusedItem(){let G=this.getGui(),D=qZ(this.beans);if(!G.contains(D))return-1;return Array.from(G.querySelectorAll(".ag-column-drop-cell")).indexOf(D)}focusItemAtIndex(G){let D=this.getGui(),B=Array.from(D.querySelectorAll(".ag-column-drop-cell"))[G];if(!B)return;B.focus({preventScroll:!0})}restoreFocus(G,D){let z=this.getGui(),B=Array.from(z.querySelectorAll(".ag-column-drop-cell"));if(G===-1)return;if(B.length===0)D.focus();let Q=Math.min(B.length-1,G),J=B[Q];if(J)J.focus()}focusList(G){let D=G?this.childPillComponents.length-1:0;this.restoreFocus(D,this.getFocusableElement())}getNonGhostItems(){let G=this.getExistingItems();if(this.isPotentialDndItems())return G.filter((D)=>!this.potentialDndItems.includes(D));return G}addItemsToGui(){let D=this.getNonGhostItems().map((z)=>this.createItemComponent(z,!1));if(this.isPotentialDndItems()){let z=this.potentialDndItems.map((B)=>this.createItemComponent(B,!0));if(this.insertIndex>=D.length)D.push(...z);else D.splice(this.insertIndex,0,...z)}this.appendChild(this.ePillDropList),D.forEach((z,B)=>{if(B>0)this.addArrow(this.ePillDropList);this.ePillDropList.appendChild(z.getGui())}),this.addAriaLabelsToComponents()}addAriaLabelsToComponents(){let{childPillComponents:G,ePillDropList:D}=this,z=G.length;fw(D,z===0?"presentation":"listbox");for(let B=0;Bthis.destroyBean(z)),!D)this.childPillComponents.push(z);return z}addIconAndTitleToGui(){let{title:G,icon:D}=this.params;if(!G||!D)return;let z=u0({tag:"div"});if(kw(z,!0),this.addElementClasses(z,"title-bar"),this.addElementClasses(D,"icon"),this.toggleCss("ag-column-drop-empty",this.isExistingItemsEmpty()),z.appendChild(D),!this.horizontal){let B=u0({tag:"span"});this.addElementClasses(B,"title"),B.textContent=G,z.appendChild(B)}this.appendChild(z)}isExistingItemsEmpty(){return this.getExistingItems().length===0}addEmptyMessageToGui(){let{emptyMessage:G}=this.params;if(!G||!this.isExistingItemsEmpty()||this.isPotentialDndItems())return;let D=u0({tag:"span"});D.textContent=G,this.addElementClasses(D,"empty-message"),this.ePillDropList.appendChild(D)}addArrow(G){if(this.horizontal){let D=this.gos.get("enableRtl"),z=Ww(D?"panelDelimiterRtl":"panelDelimiter",this.beans);this.addElementClasses(z,"cell-separator"),G.appendChild(z)}}},Ow={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"}]},H7=class extends Cw{constructor(G,D,z,B,Q){super();this.dragSourceDropTarget=G,this.ghost=D,this.horizontal=z,this.template=B,this.agComponents=Q,this.eText=OQ,this.eDragHandle=OQ,this.eButton=OQ}postConstruct(){this.setTemplate(this.template??Ow,this.agComponents);let G=this.getGui(),{beans:D,eDragHandle:z,eText:B,eButton:Q}=this;if(this.addElementClasses(G),this.addElementClasses(z,"drag-handle"),this.addElementClasses(B,"text"),this.addElementClasses(Q,"button"),z.appendChild(kZ("columnDrag",D)),Q.appendChild(kZ("cancel",D)),this.tooltipFeature=this.createOptionalManagedBean(D.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 G=this.getLocaleTextFunc(),D=[this.getAriaDisplayName()];this.addAdditionalAriaInstructions(D,G),bw(this.getGui(),D.join(". "))}addAdditionalAriaInstructions(G,D){if(this.isRemovable()){let z=D("ariaDropZoneColumnComponentDescription","Press DELETE to remove");G.push(z)}}setupTooltip(){let G=()=>this.tooltipFeature?.setTooltipAndRefresh(this.getTooltip());G(),this.addManagedEventListeners({newColumnsLoaded:G})}getDragSourceId(){return}getDefaultIconName(){return"notAllowed"}addDragSource(){let{beans:{dragAndDrop:G},eDragHandle:D}=this,z=this.createGetDragItem(),B=this.getDefaultIconName(),Q={type:this.getDragSourceType(),sourceId:this.getDragSourceId(),eElement:D,getDefaultIconName:()=>B,getDragItem:z,dragItemName:this.getDisplayName()};G?.addDragSource(Q,!0),this.addDestroyFunc(()=>G?.removeDragSource(Q))}setupComponents(){if(this.eText.textContent=this.getDisplayValue(),this.setupRemove(),this.ghost)this.addCss("ag-column-drop-cell-ghost")}isRemovable(){return!0}refreshRemove(){vw(this.eButton,this.isRemovable())}setupRemove(){this.refreshRemove();let G={type:"columnRemove"};this.addGuiEventListener("keydown",(z)=>this.onKeyDown(z)),this.addManagedElementListeners(this.eButton,{click:(z)=>{this.dispatchLocalEvent(G),z.stopPropagation()}});let D=new Vw(this.eButton);this.addManagedListeners(D,{tap:()=>this.dispatchLocalEvent(G)}),this.addDestroyFunc(D.destroy.bind(D))}onKeyDown(G){if(G.key===_Z.DELETE){if(this.isRemovable())G.preventDefault(),this.dispatchLocalEvent({type:"columnRemove"})}}getDisplayValue(){return this.getDisplayName()}addElementClasses(G,D){D=D?`-${D}`:"";let z=this.horizontal?"horizontal":"vertical";G.classList.add(`ag-column-drop-cell${D}`,`ag-column-drop-${z}-cell${D}`)}destroy(){super.destroy(),this.dragSourceDropTarget=null}},uw=class extends H7{constructor(G,D,z,B,Q,J){super(D,z,Q);this.column=G,this.dropZonePurpose=B,this.updateParams=J,this.eSortIndicator=Aw,this.popupShowing=!1,this.deferApply=x(J)}postConstruct(){let{sortSvc:G,colNames:D}=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"}},G?{tag:"ag-sort-indicator",ref:"eSortIndicator"}:void 0,{tag:"span",ref:"eButton",cls:"ag-column-drop-cell-button",role:"presentation"}]},G)this.agComponents=[G.getSortIndicatorSelector()];if(this.displayName=D.getDisplayNameForColumn(this.column,"columnDrop"),super.postConstruct(),this.deferApply)this.eDragHandle.setAttribute("data-column-tool-panel-deferred","");if(G)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(G,D){let z=this.gos.get("rowGroupPanelSuppressSort"),B=this.gos.get("functionsReadOnly");if(this.isAggregationZone()&&!B){let Q=D("ariaDropZoneColumnValueItemDescription","Press ENTER to change the aggregation type");G.push(Q)}if(this.isGroupingZone()&&this.column.isSortable()&&!z){let Q=D("ariaDropZoneColumnGroupItemDescription","Press ENTER to sort");G.push(Q)}super.addAdditionalAriaInstructions(G,D)}isMovable(){return this.isDraggable()}isDraggable(){return this.isReadOnly()}isRemovable(){return this.isReadOnly()}isReadOnly(){return!this.isGroupingAndLocked()&&!this.gos.get("functionsReadOnly")}getAriaDisplayName(){let G=this.getLocaleTextFunc(),{name:D,aggFuncName:z}=this.getColumnAndAggFuncName(),B=G("ariaDropZoneColumnComponentAggFuncSeparator"," of "),Q={asc:G("ariaDropZoneColumnComponentSortAscending","ascending"),desc:G("ariaDropZoneColumnComponentSortDescending","descending")},J=this.getCurrentSortDirection(this.column),U=this.gos.get("rowGroupPanelSuppressSort");return[z&&`${z}${B}`,D,this.isGroupingZone()&&!U&&J&&`, ${Q[J]}`].filter((Z)=>!!Z).join("")}getColumnAndAggFuncName(){let G=this.displayName,D="";if(this.isAggregationZone()){let z=this.beans.columnStateUpdateStrategy.getColumnAggFunc(this.deferApply,this.column),B=typeof z==="string"?z:"agg";D=this.getLocaleTextFunc()(B,B)}return{name:G,aggFuncName:D}}setupSort(){if(!this.column.isSortable()||!this.isGroupingZone())return;let{gos:G,column:D,eSortIndicator:z}=this;if(!G.get("rowGroupPanelSuppressSort")){z.setupSort(D,!0,this.getSortDefOverride.bind(this));let B=(Q)=>{Q.preventDefault(),this.beans.columnStateUpdateStrategy.progressSortFromEvent(this.deferApply,D,Q),z.refresh(),this.setupAria(),YG(this.beans,this.updateParams)};this.addGuiEventListener("click",B),this.addGuiEventListener("keydown",(Q)=>{if(Q.key===nD.ENTER&&this.isGroupingZone())B(Q)})}}getCurrentSortDirection(G){return this.beans.columnStateUpdateStrategy.getSortDef(this.deferApply,G)?.direction??null}getSortDefOverride(){if(!this.deferApply)return;return this.beans.columnStateUpdateStrategy.getSortDef(this.deferApply,this.column)}getDefaultIconName(){return"hide"}createGetDragItem(){let{column:G}=this;return()=>{let D={};return D[G.getId()]=G.isVisible(),{columns:[G],visibleState:D}}}setupComponents(){if(super.setupComponents(),this.isAggregationZone()&&!this.gos.get("functionsReadOnly"))this.addGuiEventListener("click",this.onShowAggFuncSelection.bind(this))}onKeyDown(G){if(super.onKeyDown(G),G.key===nD.ENTER&&this.isAggregationZone()&&!this.gos.get("functionsReadOnly"))G.preventDefault(),this.onShowAggFuncSelection()}getDisplayValue(){let{name:G,aggFuncName:D}=this.getColumnAndAggFuncName();return this.isAggregationZone()?`${D}(${G})`:G}onShowAggFuncSelection(){if(this.popupShowing)return;this.popupShowing=!0;let{aggFuncSvc:G,popupSvc:D}=this.beans,z=new Lz({cssIdentifier:"select-agg-func"}),B=G.getFuncNames(this.column),Q=this.getGui(),J=z.getGui();z.setModel({getRow:function(H){return B[H]},getRowCount:function(){return B.length}}),this.createBean(z);let U=Rw({tag:"div",cls:"ag-select-agg-func-popup"});U.style.top="0px",U.style.left="0px",U.appendChild(J),U.style.width=`${Q.clientWidth}px`;let[Z]=this.addManagedElementListeners(U,{focusout:(H)=>{if(!U.contains(H.relatedTarget)&&Y)Y.hideFunc()}}),S=(H)=>{if(this.destroyBean(z),this.popupShowing=!1,H?.key==="Escape")Q.focus();if(Z)Z()},X=this.getLocaleTextFunc(),Y=D.addPopup({modal:!0,eChild:U,closeOnEsc:!0,closedCallback:S,ariaLabel:X("ariaLabelAggregationFunction","Aggregation Function")});if(Y)z.setComponentCreator(this.createAggSelect.bind(this,Y.hideFunc));z.addGuiEventListener("keydown",(H)=>{if(H.key===nD.ENTER||H.key===nD.SPACE){let _=z.getLastFocusedRow();if(_==null)return;let k=z.getComponentAt(_);if(k)k.selectItem()}}),D.positionPopupByComponent({type:"aggFuncSelect",eventSource:Q,ePopup:U,keepWithinBounds:!0,additionalParams:{column:this.column},position:"under"}),z.refresh();let W=this.beans.columnStateUpdateStrategy.getColumnAggFunc(this.deferApply,this.column),q=B.findIndex((H)=>H===W);if(q===-1)q=0;z.focusRow(q)}createAggSelect(G,D){let z=()=>{if(G(),this.getGui().focus(),this.beans.columnStateUpdateStrategy.setColumnAggFunc(this.deferApply,this.column,D,"toolPanelDragAndDrop"),this.column){let Z=this.getGui().querySelector(".ag-column-drop-cell-text");if(Z)Z.textContent=this.getDisplayValue();this.setupAria()}YG(this.beans,this.updateParams)},B=this.getLocaleTextFunc(),Q=(D||"").toString(),J=B(Q,Q);return new jw(z,J)}isGroupingAndLocked(){return this.isGroupingZone()&&Z0(this.column,this.beans)}isAggregationZone(){return this.dropZonePurpose==="aggregation"}isGroupingZone(){return this.dropZonePurpose==="rowGroup"}getDragSourceType(){return Mw.ToolPanel}destroy(){super.destroy(),this.column=null}},jw=class extends Iw{constructor(G,D){super({tag:"div",cls:"ag-select-agg-func-item",children:D});this.selectItem=G,this.addGuiEventListener("click",this.selectItem)}},fJ=class extends q7{constructor(G,D,z){super(G);this.dropZonePurpose=D,this.updateParams=z,this.addElementClasses(this.getGui(),this.dropZonePurpose.toLowerCase())}init(G){super.init(G),this.addManagedEventListeners({newColumnsLoaded:this.refreshGui.bind(this)}),this.addManagedPropertyListeners(["functionsReadOnly","rowGroupPanelSuppressSort","groupLockGroupColumns"],this.refreshGui.bind(this))}getItems(G){return G.columns??[]}isInterestedIn(G,D){if(G===YZ.HeaderCell)return!0;if(G!==YZ.ToolPanel)return!1;if(!this.horizontal)return!0;return!D.hasAttribute("data-column-tool-panel-deferred")}minimumAllowedNewInsertIndex(){let{gos:G,rowGroupColsSvc:D}=this.beans,z=G.get("groupLockGroupColumns"),B=D?.columns.length??0;if(z===-1)return B;return Math.min(z,B)}showOrHideColumnOnExit(G){return this.isRowGroupPanel()&&$w(this.gos,!0)&&!G.fromNudge}handleDragEnterEnd(G){if(this.showOrHideColumnOnExit(G)){let B=G.dragSource.getDragItem().columns;this.setColumnsVisible(B,!1,"uiColumnDragged")}}handleDragLeaveEnd(G){if(this.showOrHideColumnOnExit(G)){let z=G.dragSource.getDragItem();this.setColumnsVisible(z.columns,!0,"uiColumnDragged")}}setColumnsVisible(G,D,z){if(!G)return;if(x(this.updateParams))return;let B=G.filter((Q)=>!Q.getColDef().lockVisible);this.beans.columnStateUpdateStrategy.setColumnsVisible(!1,B,D,z)}isRowGroupPanel(){return this.dropZonePurpose==="rowGroup"}createPillComponent(G,D,z,B){return new uw(G,D,z,this.dropZonePurpose,B,this.updateParams)}},_7=class extends fJ{constructor(G,D){super(G,"pivot",D)}postConstruct(){let G=this.getLocaleTextFunc(),D=G("pivotColumnsEmptyMessage","Drag here to set column labels"),z=G("pivots","Column Labels");if(super.init({icon:Zw("pivotPanel",this.beans,null),emptyMessage:D,title:z}),this.horizontal)Uw(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 G=this.beans.colModel,D=G.isPivotMode();if(this.horizontal)switch(this.gos.get("pivotPanelShow")){case"always":this.setDisplayed(D);break;case"onlyWhenPivoting":{let z=G.isPivotActive();this.setDisplayed(D&&z);break}default:this.setDisplayed(!1);break}else this.setDisplayed(this.beans.columnStateUpdateStrategy.getPivotMode(x(this.updateParams)))}isItemDroppable(G,D){if(this.gos.get("functionsReadOnly")||!G.isPrimary())return!1;let z=this.beans.columnStateUpdateStrategy.getPivotColumns(x(this.updateParams)).includes(G);return G.isAllowPivot()&&(!z||this.isSourceEventFromTarget(D))}updateItems(G){this.beans.columnStateUpdateStrategy.setPivotColumns(x(this.updateParams),G,"toolPanelUi"),YG(this.beans,this.updateParams)}getIconName(){return this.isPotentialDndItems()?"pivot":"notAllowed"}getExistingItems(){return this.beans.columnStateUpdateStrategy.getPivotColumns(x(this.updateParams))}getFocusableContainerName(){return"pivotToolbar"}},k7=class extends fJ{constructor(G,D){super(G,"rowGroup",D)}postConstruct(){let G=this.getLocaleTextFunc(),D=G("rowGroupColumnsEmptyMessage","Drag here to set row groups"),z=G("groups","Row Groups");if(super.init({icon:gw("rowGroupPanel",this.beans,null),emptyMessage:D,title:z}),this.horizontal)Pw(this.beans,this,this.getGui());this.addManagedEventListeners({columnRowGroupChanged:this.refreshGui.bind(this)})}getAriaLabel(){return this.getLocaleTextFunc()("ariaRowGroupDropZonePanelLabel","Row Groups")}isItemDroppable(G,D){if(this.gos.get("functionsReadOnly")||!G.isPrimary()||G.colDef.showRowGroup)return!1;let z=this.beans.columnStateUpdateStrategy.getRowGroupColumns(x(this.updateParams)).includes(G);return G.isAllowRowGroup()&&(!z||this.isSourceEventFromTarget(D))}updateItems(G){this.beans.columnStateUpdateStrategy.setRowGroupColumns(x(this.updateParams),G,"toolPanelUi"),YG(this.beans,this.updateParams)}getIconName(){return this.isPotentialDndItems()?"group":"notAllowed"}getExistingItems(){return this.beans.columnStateUpdateStrategy.getRowGroupColumns(x(this.updateParams))}getFocusableContainerName(){return"rowGroupToolbar"}},yw=class extends fJ{constructor(G,D){super(G,"aggregation",D)}postConstruct(){let G=this.getLocaleTextFunc(),D=G("valueColumnsEmptyMessage","Drag here to aggregate"),z=G("values","Values");super.init({icon:Tw("valuePanel",this.beans,null),emptyMessage:D,title:z}),this.addManagedEventListeners({columnValueChanged:this.refreshGui.bind(this)})}getAriaLabel(){return this.getLocaleTextFunc()("ariaValuesDropZonePanelLabel","Values")}getIconName(){return this.isPotentialDndItems()?"aggregate":"notAllowed"}isItemDroppable(G,D){if(this.gos.get("functionsReadOnly")||!G.isPrimary())return!1;let z=this.beans.columnStateUpdateStrategy.getValueColumns(x(this.updateParams)).includes(G);return G.isAllowValue()&&(!z||this.isSourceEventFromTarget(D))}updateItems(G){this.beans.columnStateUpdateStrategy.setValueColumns(x(this.updateParams),G,"toolPanelUi"),YG(this.beans,this.updateParams)}getExistingItems(){return this.beans.columnStateUpdateStrategy.getValueColumns(x(this.updateParams))}},iw={tag:"div",cls:"ag-pivot-mode-panel",children:[{tag:"ag-toggle-button",ref:"cbPivotMode",cls:"ag-pivot-mode-select"}]},nw=class extends cw{constructor(G,D){super();this.params=G,this.onPivotModeValueChanged=D,this.cbPivotMode=hw}getCurrentPivotMode(){return this.beans.columnStateUpdateStrategy.getPivotMode(x(this.params))}syncFromGrid(){this.cbPivotMode.setValue(this.getCurrentPivotMode())}refreshEditStrategy(){this.syncFromGrid()}postConstruct(){this.setTemplate(iw,[xw]);let G=this.cbPivotMode;G.setValue(this.getCurrentPivotMode());let D=this.getLocaleTextFunc();G.setLabel(D("pivotMode","Pivot Mode"));let z=()=>{let Q=!!G.getValue();this.beans.columnStateUpdateStrategy.setPivotMode(x(this.params),Q,"toolPanelUi"),this.onPivotModeValueChanged?.()},B=()=>{G.setValue(this.getCurrentPivotMode())};this.addManagedListeners(G,{fieldValueChanged:z}),this.addManagedEventListeners({newColumnsLoaded:B,columnPivotModeChanged:B})}},dw=class extends Jw{constructor(){super(...arguments);this.beanName="colToolPanelFactory"}setPanelVisible(G,D,z){if(G)G.setDisplayed(D);else if(D)G=z();return G}createRowGroupPanel(G,D,z){return this.createPanel(G,D,new k7(!1,z))}createValuesPanel(G,D,z){return this.createPanel(G,D,new yw(!1,z))}createPivotPanel(G,D,z){return this.createPanel(G,D,new _7(!1,z))}createPivotModePanel(G,D,z,B,Q){return this.createPanel(G,D,new nw(z,B),Q)}createPanel(G,D,z,B){if(z=G.createBean(z),D.push(()=>G.destroyBean(z)),B)G.prependChild(z);else G.appendChild(z);return z}},wZ=()=>{},sw=class extends pw{constructor(){super(...arguments);this.beanName="columnStateUpdateExecutionStrategy"}applyColumnState(G,D,z){this.getUpdateStrategy(G).applyColumnState(D,z)}commit(G){this.getUpdateStrategy(G).commit()}hasPendingChanges(G){return this.getUpdateStrategy(G).hasPendingChanges()}moveColumns(G,D,z,B){this.getUpdateStrategy(G).moveColumns(D,z,B)}reset(G){this.getUpdateStrategy(G).reset()}setColumnsVisible(G,D,z,B){this.getUpdateStrategy(G).setColumnsVisible(D,z,B)}isColumnVisibleInToolPanel(G,D){return this.getUpdateStrategy(G).isColumnVisibleInToolPanel(D)}setRowGroupColumns(G,D,z){this.getUpdateStrategy(G).setRowGroupColumns(D,z)}getRowGroupColumns(G){return this.getUpdateStrategy(G).getRowGroupColumns()}getPrimaryColumns(G){return this.getUpdateStrategy(G).getPrimaryColumns()}hasDeferredColumnOrder(G){return this.getUpdateStrategy(G).hasDeferredColumnOrder()}setValueColumns(G,D,z){this.getUpdateStrategy(G).setValueColumns(D,z)}getValueColumns(G){return this.getUpdateStrategy(G).getValueColumns()}setColumnAggFunc(G,D,z,B){this.getUpdateStrategy(G).setColumnAggFunc(D,z,B)}getColumnAggFunc(G,D){return this.getUpdateStrategy(G).getColumnAggFunc(D)}setPivotColumns(G,D,z){this.getUpdateStrategy(G).setPivotColumns(D,z)}getPivotColumns(G){return this.getUpdateStrategy(G).getPivotColumns()}setPivotMode(G,D,z){this.getUpdateStrategy(G).setPivotMode(D,z)}getPivotMode(G){return this.getUpdateStrategy(G).getPivotMode()}isColumnSelectedInPivotModeToolPanel(G,D){return this.getUpdateStrategy(G).isColumnSelectedInPivotModeToolPanel(D)}progressSortFromEvent(G,D,z){this.getUpdateStrategy(G).progressSortFromEvent(D,z)}getSortDef(G,D){return this.getUpdateStrategy(G).getSortDef(D)}getUpdateStrategy(G){return G?this.getDeferredUpdateStrategy():this.getSyncUpdateStrategy()}getSyncUpdateStrategy(){return this.syncUpdateStrategy??(this.syncUpdateStrategy=new ow(this.beans))}getDeferredUpdateStrategy(){return this.deferredUpdateStrategy??(this.deferredUpdateStrategy=new rw(this.beans))}},ow=class{constructor(G){this.beans=G,this.lastPivotColIds=[],this.reset=wZ,this.commit=wZ,this.hasPendingChanges=()=>!1,this.hasDeferredColumnOrder=()=>!1}applyColumnState(G,D){if(G.length===0)return;J0(this.beans,{state:G},D)}moveColumns(G,D,z){this.beans.colMoves?.moveColumns(G,D,z),aw(this.beans)}setColumnsVisible(G,D,z){let B=G.filter((Q)=>!Q.getColDef().lockVisible);this.beans.colModel.setColsVisible(B,D,z)}setRowGroupColumns(G,D){this.beans.rowGroupColsSvc?.setColumns(G,D)}getRowGroupColumns(){return this.beans.rowGroupColsSvc?.columns??[]}getPrimaryColumns(){return NJ(this.beans)}setValueColumns(G,D){this.beans.valueColsSvc?.setColumns(G,D)}getValueColumns(){return this.beans.valueColsSvc?.columns??[]}setColumnAggFunc(G,D,z){this.beans.valueColsSvc?.setColumnAggFunc?.(G,D,z)}getColumnAggFunc(G){return G.getAggFunc()}setPivotColumns(G,D){this.lastPivotColIds=G.map((z)=>z.getColId()),this.beans.pivotColsSvc?.setColumns(G,D)}getPivotColumns(){return this.beans.pivotColsSvc?.columns??[]}setPivotMode(G,D){let{colModel:z,gos:B,ctrlsSvc:Q}=this.beans;if(G===z.isPivotMode())return;let J=this.beans.pivotColsSvc?.columns.map((U)=>U.getColId())??[];if(J.length>0)this.lastPivotColIds=J;if(!G){let U=this.beans.colModel.getColDefCols()??[];J0(this.beans,{state:U.map((Z)=>({colId:Z.getColId(),pivot:!1,pivotIndex:null}))},D)}if(B.updateGridOptions({options:{pivotMode:G},source:D}),G&&this.lastPivotColIds.length>0)this.beans.pivotColsSvc?.setColumns(this.lastPivotColIds,D);for(let U of Q.getHeaderRowContainerCtrls())U.refresh()}progressSortFromEvent(G,D){this.beans.sortSvc?.progressSortFromEvent(G,D)}isColumnVisibleInToolPanel(G){return G.isVisible()}isColumnSelectedInPivotModeToolPanel(G){return G.isAnyFunctionActive()}getPivotMode(){return this.beans.colModel.isPivotMode()}getSortDef(G){return G.getSortDef()}},rw=class{constructor(G){this.beans=G,this.state={},this.sequence=0,this.lastPivotColIds=[]}reset(){this.sequence=0,this.state={}}hasPendingChanges(){let{state:G,beans:D}=this,{columnState:z,columnOrder:B,rowGroup:Q,aggregation:J,pivot:U,pivotMode:Z,sort:S,aggFuncs:X}=G,Y=(W)=>(W??[]).map((q)=>q.getColId());if(z)for(let[W,q]of z.patches){let H=D.colModel.getColDefCol(W);if(!H)continue;if(q.hide!==void 0&&q.hide!==!H.isVisible()||q.rowGroup!==void 0&&!!q.rowGroup!==H.isRowGroupActive()||q.pivot!==void 0&&!!q.pivot!==H.isPivotActive()||q.aggFunc!==void 0&&(q.aggFunc??null)!==(H.getAggFunc()??null))return!0}if(B&&!j0(B.colIds,jQ(D)))return!0;if(Q&&!j0(Q.colIds,Y(D.rowGroupColsSvc?.columns)))return!0;if(J&&!j0(J.colIds,Y(D.valueColsSvc?.columns)))return!0;if(U&&!j0(U.colIds,Y(D.pivotColsSvc?.columns)))return!0;if(Z&&Z.pivotMode!==D.colModel.isPivotMode())return!0;if(S){for(let[W,q]of S.sortDefsByColId){let H=D.colModel.getColDefCol(W);if(!H)continue;if((q?.direction??null)!==(H.getSortDef()?.direction??null))return!0}if(S.baselineCleared){let W=NJ(D);for(let q of W)if(!S.sortDefsByColId.has(q.getColId())&&q.getSortDef()!==null)return!0}}if(X)for(let[W,q]of X.values){let H=D.colModel.getColDefCol(W);if(!H)continue;if(q!==H.getAggFunc())return!0}return!1}commit(){let{beans:G,state:D}=this,z=[];for(let Q of Object.keys(D)){let J=D[Q];if(J)z.push({type:Q,...J})}let B=z.sort((Q,J)=>Q.seq-J.seq);for(let Q of B)switch(Q.type){case"columnState":{J0(G,{state:[...Q.patches.values()]},Q.eventType);break}case"columnOrder":{let J=Q.colIds.map((U)=>G.colModel.getColDefCol(U)).filter((U)=>!!U&&$0(U));if(!G.colModel.isPivotMode())for(let U=0;U$0(W)),Y=(X>=0?X:0)+U;if(S[Y]!==Z)G.colMoves?.moveColumns([Z],Y,Q.eventType,!0)}w7(G,J);break}case"rowGroup":{G.rowGroupColsSvc?.setColumns(Q.colIds,Q.eventType);break}case"aggregation":{G.valueColsSvc?.setColumns(Q.colIds,Q.eventType);break}case"pivot":{this.lastPivotColIds=Q.colIds,G.pivotColsSvc?.setColumns(Q.colIds,Q.eventType);break}case"pivotMode":{let{colModel:J,ctrlsSvc:U,gos:Z,stateSvc:S}=G;if(Q.pivotMode!==J.isPivotMode()){let X=G.pivotColsSvc?.columns.map((q)=>q.getColId())??[];if(X.length>0)this.lastPivotColIds=X;let Y=S?.getState().pivot?.pivotColIds??X,W=Q.pivotMode?this.state.pivot?.colIds??this.lastPivotColIds:Y;if(S?.setState({...S.getState(),pivot:{pivotMode:Q.pivotMode,pivotColIds:W}},["pivot"]),!Q.pivotMode){let q=G.colModel.getColDefCols()??[];J0(G,{state:q.map((H)=>({colId:H.getColId(),pivot:!1,pivotIndex:null}))},Q.eventType)}if(Z.updateGridOptions({options:{pivotMode:Q.pivotMode},source:Q.eventType}),Q.pivotMode&&W.length>0)G.pivotColsSvc?.setColumns(W,Q.eventType);for(let q of U.getHeaderRowContainerCtrls())q.refresh()}break}case"sort":{let J=[],U=0;for(let[Z,S]of Q.sortDefsByColId)J.push({colId:Z,sort:S?.direction??null,sortIndex:S?.direction?U++:null,sortType:S?.type??void 0});J0(G,{state:J,defaultState:Q.baselineCleared?{sort:null,sortIndex:null,sortType:void 0}:void 0},Q.eventType);break}case"aggFuncs":{for(let[J,U]of Q.values){let Z=G.colModel.getColDefCol(J);if(!Z)continue;G.valueColsSvc?.setColumnAggFunc?.(Z,U,Q.eventType)}break}}this.reset()}applyColumnState(G,D){for(let B of G)PQ(this.state,B);let z=SB(this.state);z.seq=hG(this.sequence),this.sequence=z.seq,z.eventType=D}moveColumns(G,D,z){let B=new Set(G.map((S)=>S.getColId())),J=(this.state.columnOrder?.colIds??jQ(this.beans)).filter((S)=>!B.has(S)),U=G.map((S)=>S.getColId()),Z=hG(this.sequence);this.sequence=Z,this.state.columnOrder={colIds:[...J.slice(0,D),...U,...J.slice(D)],eventType:z,seq:Z}}setColumnsVisible(G,D,z){for(let Q of G){if(Q.getColDef().lockVisible)continue;PQ(this.state,{colId:Q.getColId(),hide:!D})}let B=SB(this.state);B.seq=hG(this.sequence),this.sequence=B.seq,B.eventType=z}setRowGroupColumns(G,D){gQ(this.state,"rowGroup");let z=hG(this.sequence);this.sequence=z,this.state.rowGroup={colIds:G.map((B)=>B.getColId()),eventType:D,seq:z}}setValueColumns(G,D){gQ(this.state,"aggFunc");let z=new Set((this.beans.valueColsSvc?.columns??[]).map((J)=>J.getColId())),B=KZ(this.state);for(let J of G)if(!z.has(J.getColId())&&!B.values.has(J.getColId())){let U=J.getAggFunc(),Z=U!=null?U:this.beans.aggFuncSvc?.getDefaultAggFunc(J);if(Z!=null)B.values.set(J.getColId(),Z)}let Q=hG(this.sequence);this.sequence=Q,B.seq=Q,B.eventType=D,this.state.aggregation={colIds:G.map((J)=>J.getColId()),eventType:D,seq:Q}}setColumnAggFunc(G,D,z){PQ(this.state,{colId:G.getColId(),aggFunc:D});let B=SB(this.state);B.seq=hG(this.sequence),this.sequence=B.seq,B.eventType=z;let Q=KZ(this.state);Q.seq=B.seq,Q.eventType=z,Q.values.set(G.getColId(),D)}getColumnAggFunc(G){let D=G.getColId();if(this.state.aggFuncs?.values.has(D))return this.state.aggFuncs.values.get(D);return G.getAggFunc()}isColumnVisibleInToolPanel(G){let D=this.state.columnState?.patches.get(G.getColId());if(D?.hide!==void 0)return!D.hide;return G.isVisible()}isColumnSelectedInPivotModeToolPanel(G){let D=G.getColId(),z=this.state.columnState?.patches.get(D),B;if(z?.rowGroup!==void 0)B=!!z.rowGroup;else if(this.state.rowGroup)B=this.state.rowGroup.colIds.includes(D);else B=G.isRowGroupActive();let Q;if(z?.pivot!==void 0)Q=!!z.pivot;else if(this.state.pivot)Q=this.state.pivot.colIds.includes(D);else Q=G.isPivotActive();let J;if(z?.aggFunc!==void 0)J=z.aggFunc!=null;else if(this.state.aggregation)J=this.state.aggregation.colIds.includes(D);else J=G.isValueActive();return B||Q||J}setPivotColumns(G,D){gQ(this.state,"pivot");let z=hG(this.sequence);this.sequence=z,this.state.pivot={colIds:G.map((B)=>B.getColId()),eventType:D,seq:z}}setPivotMode(G,D){let z=hG(this.sequence);this.sequence=z,this.state.pivotMode={pivotMode:G,eventType:D,seq:z}}getRowGroupColumns(){return Rz(this.beans,uQ(this.state.rowGroup?.colIds,this.beans.rowGroupColsSvc?.columns,this.state.columnState?.patches,(G)=>G.rowGroup==null?void 0:!!G.rowGroup))}getPrimaryColumns(){return Rz(this.beans,this.state.columnOrder?.colIds??jQ(this.beans))}hasDeferredColumnOrder(){return!!this.state.columnOrder}getValueColumns(){return Rz(this.beans,uQ(this.state.aggregation?.colIds,this.beans.valueColsSvc?.columns,this.state.columnState?.patches,(G)=>G.aggFunc===void 0?void 0:G.aggFunc!=null))}getPivotColumns(){if(!this.getPivotMode())return[];let G=this.beans.pivotColsSvc?.columns,D=G?.length?G:Rz(this.beans,this.lastPivotColIds);return Rz(this.beans,uQ(this.state.pivot?.colIds,D,this.state.columnState?.patches,(z)=>z.pivot==null?void 0:!!z.pivot))}getPivotMode(){return this.state.pivotMode?.pivotMode??this.beans.colModel.isPivotMode()}getSortDef(G){let D=this.state.sort,z=G.getColId(),B=D?.sortDefsByColId;if(B?.has(z))return B.get(z)??null;if(D?.baselineCleared)return null;return G.getSortDef()}progressSortFromEvent(G,D){let z=this.state.sort??{sortDefsByColId:new Map,baselineCleared:!1,seq:0,eventType:"toolPanelUi"},{sortSvc:B}=this.beans,Q=G.getColId(),J;if(z.sortDefsByColId.has(Q))J=z.sortDefsByColId.get(Q);else if(z.baselineCleared)J=null;else J=G.getSortDef();let U=B?.getNextSortDirection(G,J);if(!U)return;let{gos:Z}=this.beans;if(!(((Z.get("multiSortKey")==="ctrl"?D.ctrlKey||D.metaKey:D.shiftKey)||Z.get("alwaysMultiSort"))&&!Z.get("suppressMultiSort")))z.sortDefsByColId.clear(),z.baselineCleared=!0;z.sortDefsByColId.set(Q,U.direction?U:null),z.seq=hG(this.sequence),this.sequence=z.seq,this.state.sort=z}};function Rz(G,D){if(!D)return[];return D.map((z)=>G.colModel.getColDefCol(z)).filter((z)=>!!z)}function uQ(G,D,z,B){let Q=[...G??D?.map((U)=>U.getColId())??[]];if(!z?.size)return Q;let J=new Set(Q);for(let[U,Z]of z){let S=B(Z);if(S===void 0)continue;if(S){if(!J.has(U))Q.push(U),J.add(U);continue}if(!J.has(U))continue;J.delete(U);let X=Q.indexOf(U);if(X>=0)Q.splice(X,1)}return Q}function aw(G){let D=G.colModel.getCols().filter((z)=>$0(z)).map((z)=>G.colModel.getColDefCol(z.getColId())).filter((z)=>!!z);w7(G,D)}function w7(G,D){let z=ew(G);if(!z)return;let B=new Set(D);z.list=[...D,...z.list.filter((Q)=>$0(Q)&&!B.has(Q))]}function jQ(G){return NJ(G).map((D)=>D.getColId())}function NJ(G){return(G.colModel.getColDefCols()??G.colModel.getCols()).filter((D)=>$0(D))}function ew(G){let D=G.colModel.colDefCols,z=D?.list;if(!Array.isArray(z))return;return D}function $0(G){if(!G.isPrimary())return!1;return!mw(G)&&!tw(G)}function hG(G){return G+1}function PQ(G,D){let z=SB(G),B=z.patches.get(D.colId);z.patches.set(D.colId,B?{...B,...D}:D)}function gQ(G,D){let z=G.columnState?.patches;if(!z?.size)return;for(let[B,Q]of z){if(!(D in Q))continue;let J={...Q};if(delete J[D],Object.keys(J).length===1){z.delete(B);continue}z.set(B,J)}}function SB(G){let{columnState:D}=G;if(!D)D={patches:new Map,seq:0,eventType:"toolPanelUi"},G.columnState=D;return D}function KZ(G){let{aggFuncs:D}=G;if(!D)D={values:new Map,seq:0,eventType:"toolPanelUi"},G.aggFuncs=D;return D}var GK=class extends lw{constructor(){super(...arguments);this.beanName="columnStateUpdateStrategy"}applyColumnState(G,D,z){this.delegate("applyColumnState",G,D,z)}commit(G){this.delegate("commit",G)}hasPendingChanges(G){return this.delegate("hasPendingChanges",G)}moveColumns(G,D,z,B){this.delegate("moveColumns",G,D,z,B)}reset(G){this.delegate("reset",G)}setColumnsVisible(G,D,z,B){this.delegate("setColumnsVisible",G,D,z,B)}isColumnVisibleInToolPanel(G,D){return this.delegate("isColumnVisibleInToolPanel",G,D)}setRowGroupColumns(G,D,z){this.delegate("setRowGroupColumns",G,D,z)}getRowGroupColumns(G){return this.delegate("getRowGroupColumns",G)}getPrimaryColumns(G){return this.delegate("getPrimaryColumns",G)}hasDeferredColumnOrder(G){return this.delegate("hasDeferredColumnOrder",G)}setValueColumns(G,D,z){this.delegate("setValueColumns",G,D,z)}getValueColumns(G){return this.delegate("getValueColumns",G)}setColumnAggFunc(G,D,z,B){this.delegate("setColumnAggFunc",G,D,z,B)}getColumnAggFunc(G,D){return this.delegate("getColumnAggFunc",G,D)}setPivotColumns(G,D,z){this.delegate("setPivotColumns",G,D,z)}getPivotColumns(G){return this.delegate("getPivotColumns",G)}setPivotMode(G,D,z){this.delegate("setPivotMode",G,D,z)}getPivotMode(G){return this.delegate("getPivotMode",G)}isColumnSelectedInPivotModeToolPanel(G,D){return this.delegate("isColumnSelectedInPivotModeToolPanel",G,D)}progressSortFromEvent(G,D,z){this.delegate("progressSortFromEvent",G,D,z)}getSortDef(G,D){return this.delegate("getSortDef",G,D)}getUpdateStrategy(){return this.executionStrategy??(this.executionStrategy=this.createManagedBean(new sw))}delegate(G,...D){let z=this.getUpdateStrategy();return z[G].bind(z)(...D)}},K7={moduleName:"SharedColumnStateUpdateStrategy",version:j,beans:[GK],dependsOn:[i]},yB={moduleName:"ColumnsToolPanel",version:j,beans:[dw],userComponents:{agColumnsToolPanel:Qw},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:[i,K7,jD,E_,M_,I_,TB]},UK=class extends JK{constructor(){super(...arguments);this.beanName="chartMenuItemMapper"}getChartItems(G){let D=this.beans,z=D.chartSvc,B=G==="pivotChart";if(!z)return null;let Q=this.getLocaleTextFunc.bind(this),J=B?new ZK(D,z,Q):new $K(D,z,Q),U=z.isEnterprise(),Z=J.getMenuItem();if(Z?.subMenu&&!U){let X=(Y)=>({...Y,subMenu:Y.subMenu?.filter((W)=>!W._enterprise).map((W)=>X(W))});Z=X(Z)}let S=this.gos.get("chartToolPanelsDef")?.settingsPanel?.chartGroupsDef;if(S)Z=this.filterAndOrderChartMenu(Z,S,J.getConfigLookup());return this.cleanInternals(Z)}cleanInternals(G){if(!G)return G;let D=(z)=>{delete z?._key,delete z?._enterprise;for(let B of z?.subMenu??[])D(B);return z};return D(G)}buildLookup(G){let D={},z=(B)=>{if(D[B._key]=B,B.subMenu)for(let Q of B.subMenu)z(Q)};return z(G),D}filterAndOrderChartMenu(G,D,z){let B=this.buildLookup(G),Q={...G,subMenu:[]};for(let J of Object.keys(D)){let U=D[J],Z=z[J];if(Z===null)continue;if(Z==null){fZ(173,{group:J});continue}let S=B[Z._key];if(S)if(S.subMenu){let X=U.map((Y)=>{let W=Z[Y];if(W==null){fZ(174,{group:J,chartType:Y});return}return B[W]}).filter((Y)=>Y!==void 0);if(X.length>0)S.subMenu=X,Q.subMenu?.push(S)}else Q.subMenu?.push(S)}if(Q.subMenu?.length==0)return null;return Q}},ZK=class{constructor(G,D,z){this.beans=G,this.chartSvc=D,this.getLocaleTextFunc=z}getMenuItem(){let G=this.getLocaleTextFunc(),D=(z,B,Q,J,U=!1)=>{return{name:G(z,B+"‎"),action:()=>this.chartSvc.createPivotChart({chartType:Q}),_key:J,_enterprise:U}};return{name:G("pivotChart","Pivot Chart"),_key:"pivotChart",subMenu:[{_key:"pivotColumnChart",name:G("columnChart","Column"),subMenu:[D("groupedColumn","Grouped","groupedColumn","pivotGroupedColumn"),D("stackedColumn","Stacked","stackedColumn","pivotStackedColumn"),D("normalizedColumn","100% Stacked","normalizedColumn","pivotNormalizedColumn")]},{_key:"pivotBarChart",name:G("barChart","Bar"),subMenu:[D("groupedBar","Grouped","groupedBar","pivotGroupedBar"),D("stackedBar","Stacked","stackedBar","pivotStackedBar"),D("normalizedBar","100% Stacked","normalizedBar","pivotNormalizedBar")]},{_key:"pivotPieChart",name:G("pieChart","Pie"),subMenu:[D("pie","Pie","pie","pivotPie"),D("donut","Donut","donut","pivotDonut")]},{_key:"pivotLineChart",name:G("lineChart","Line"),subMenu:[D("lineChart","Line","line","pivotLineChart"),D("stackedLine","Stacked","stackedLine","pivotStackedLine"),D("normalizedLine","100% Stacked","normalizedLine","pivotNormalizedLine")]},{_key:"pivotAreaChart",name:G("areaChart","Area"),subMenu:[D("areaChart","Area","area","pivotArea"),D("stackedArea","Stacked","stackedArea","pivotStackedArea"),D("normalizedArea","100% Stacked","normalizedArea","pivotNormalizedArea")]},{_key:"pivotXYChart",name:G("xyChart","X Y (Scatter)"),subMenu:[D("scatter","Scatter","scatter","pivotScatter"),D("bubble","Bubble","bubble","pivotBubble")]},{_key:"pivotStatisticalChart",_enterprise:!1,name:G("statisticalChart","Statistical"),subMenu:[D("histogramChart","Histogram","histogram","pivotHistogram",!1)]},{_key:"pivotHierarchicalChart",_enterprise:!0,name:G("hierarchicalChart","Hierarchical"),subMenu:[D("treemapChart","Treemap","treemap","pivotTreemap",!0),D("sunburstChart","Sunburst","sunburst","pivotSunburst",!0)]},{_key:"pivotFunnel",name:G("funnel","Funnel"),subMenu:[D("funnel","Funnel","funnel","pivotFunnel"),D("coneFunnel","Cone Funnel","coneFunnel","pivotConeFunnel"),D("pyramid","Pyramid","pyramid","pivotPyramid")]},{_key:"pivotCombinationChart",name:G("combinationChart","Combination"),subMenu:[D("columnLineCombo","Column & Line","columnLineCombo","pivotColumnLineCombo"),D("AreaColumnCombo","Area & Column","areaColumnCombo","pivotAreaColumnCombo")]}],icon:f7("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}}},$K=class{constructor(G,D,z){this.beans=G,this.chartSvc=D,this.getLocaleTextFunc=z}getMenuItem(){let G=this.getLocaleTextFunc(),D=(z,B,Q,J,U=!1)=>{return{name:G(z,B),action:()=>this.chartSvc.createChartFromCurrentRange(Q),_key:J,_enterprise:U}};return{name:G("chartRange","Chart Range"),_key:"chartRange",subMenu:[{name:G("columnChart","Column"),subMenu:[D("groupedColumn","Grouped","groupedColumn","rangeGroupedColumn"),D("stackedColumn","Stacked","stackedColumn","rangeStackedColumn"),D("normalizedColumn","100% Stacked","normalizedColumn","rangeNormalizedColumn")],_key:"rangeColumnChart"},{name:G("barChart","Bar"),subMenu:[D("groupedBar","Grouped","groupedBar","rangeGroupedBar"),D("stackedBar","Stacked","stackedBar","rangeStackedBar"),D("normalizedBar","100% Stacked","normalizedBar","rangeNormalizedBar")],_key:"rangeBarChart"},{name:G("pieChart","Pie"),subMenu:[D("pie","Pie","pie","rangePie"),D("donut","Donut","donut","rangeDonut")],_key:"rangePieChart"},{name:G("lineChart","Line"),subMenu:[D("lineChart","Line","line","rangeLineChart"),D("stackedLine","Stacked","stackedLine","rangeStackedLine"),D("normalizedLine","100% Stacked","normalizedLine","rangeNormalizedLine")],_key:"rangeLineChart"},{name:G("areaChart","Area"),subMenu:[D("areaChart","Area","area","rangeArea"),D("stackedArea","Stacked","stackedArea","rangeStackedArea"),D("normalizedArea","100% Stacked","normalizedArea","rangeNormalizedArea")],_key:"rangeAreaChart"},{name:G("xyChart","X Y (Scatter)"),subMenu:[D("scatter","Scatter","scatter","rangeScatter"),D("bubble","Bubble","bubble","rangeBubble")],_key:"rangeXYChart"},{name:G("polarChart","Polar"),subMenu:[D("radarLine","Radar Line","radarLine","rangeRadarLine"),D("radarArea","Radar Area","radarArea","rangeRadarArea"),D("nightingale","Nightingale","nightingale","rangeNightingale"),D("radialColumn","Radial Column","radialColumn","rangeRadialColumn"),D("radialBar","Radial Bar","radialBar","rangeRadialBar")],_key:"rangePolarChart",_enterprise:!0},{name:G("statisticalChart","Statistical"),subMenu:[D("boxPlot","Box Plot","boxPlot","rangeBoxPlot",!0),D("histogramChart","Histogram","histogram","rangeHistogram",!1),D("rangeBar","Range Bar","rangeBar","rangeRangeBar",!0),D("rangeArea","Range Area","rangeArea","rangeRangeArea",!0)],_key:"rangeStatisticalChart",_enterprise:!1},{name:G("hierarchicalChart","Hierarchical"),subMenu:[D("treemap","Treemap","treemap","rangeTreemap"),D("sunburst","Sunburst","sunburst","rangeSunburst")],_key:"rangeHierarchicalChart",_enterprise:!0},{name:G("specializedChart","Specialized"),subMenu:[D("heatmap","Heatmap","heatmap","rangeHeatmap"),D("waterfall","Waterfall","waterfall","rangeWaterfall")],_key:"rangeSpecializedChart",_enterprise:!0},{name:G("funnel","Funnel"),subMenu:[D("funnel","Funnel","funnel","rangeFunnel"),D("coneFunnel","Cone Funnel","coneFunnel","rangeConeFunnel"),D("pyramid","Pyramid","pyramid","rangePyramid")],_key:"rangeFunnel",_enterprise:!0},{name:G("combinationChart","Combination"),subMenu:[D("columnLineCombo","Column & Line","columnLineCombo","rangeColumnLineCombo"),D("AreaColumnCombo","Area & Column","areaColumnCombo","rangeAreaColumnCombo")],_key:"rangeCombinationChart"}],icon:f7("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}}}},YK=class extends LK{constructor(){super(...arguments);this.beanName="colChooserFactory"}createColumnSelectPanel(G,D,z,B){let Q=G.createManagedBean(new W7),J=B??D?.getColDef().columnChooserParams??{},{contractColumnSelection:U,suppressColumnExpandAll:Z,suppressColumnFilter:S,suppressColumnSelectAll:X,suppressSyncLayoutWithGrid:Y,columnLayout:W}=J;if(Q.init(!!z,SK(this.gos,{suppressColumnMove:!1,suppressValues:!1,suppressPivots:!1,suppressRowGroups:!1,suppressPivotMode:!1,contractColumnSelection:!!U,suppressColumnExpandAll:!!Z,suppressColumnFilter:!!S,suppressColumnSelectAll:!!X,suppressSyncLayoutWithGrid:!!W||!!Y,onStateUpdated:()=>{}}),"columnMenu"),W)Q.setColumnLayout(W);return Q}showColumnChooser({column:G,chooserParams:D,eventSource:z,headerPosition:B}){this.hideActiveColumnChooser();let Q=this.createColumnSelectPanel(this,G,!0,D),J=this.getLocaleTextFunc(),U=this.beans,{visibleCols:Z,focusSvc:S,menuUtils:X}=U,Y=Z.allCols.indexOf(G),W=G?S.focusedHeader??B??null:null;this.activeColumnChooserDialog=this.createBean(new PB({title:J("chooseColumns","Choose Columns"),component:Q,width:300,height:300,resizable:!0,movable:!0,centered:!0,closable:!0,afterGuiAttached:()=>{XK(U,Q.getGui())?.focus({preventScroll:!0}),this.dispatchVisibleChangedEvent(!0,G)},closedCallback:(q)=>{let H=this.activeColumnChooser.getGui();if(this.destroyBean(this.activeColumnChooser),this.activeColumnChooser=void 0,this.activeColumnChooserDialog=void 0,this.dispatchVisibleChangedEvent(!1,G),G)X.restoreFocusOnClose({column:G,headerPosition:W,columnIndex:Y,eventSource:z},H,q,!0)},postProcessPopupParams:{type:"columnChooser",column:G,eventSource:z}})),this.activeColumnChooser=Q}hideActiveColumnChooser(){this.destroyBean(this.activeColumnChooserDialog)}dispatchVisibleChangedEvent(G,D){this.eventSvc.dispatchEvent({type:"columnMenuVisibleChanged",visible:G,switchingTab:!1,key:"columnChooser",column:D??null})}},MK={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 AK(G,D){let z=MK[D];if(z)G.assertModuleRegistered(z,`menu item '${D}'`)}var ND="separator";function N7(G,D){if(!G)return;for(let z=G.length-2;z>=0;z--){let B=G[z]===D,Q=G[z+1]===D;if(B&&Q)G.splice(z+1,1)}}var RK={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:(G)=>({type:FK(G.getSortDef()?.type),direction:null})}},CK=class extends KK{constructor(){super(...arguments);this.beanName="menuItemMapper"}mapWithStockItems(G,D,z,B,Q){if(!G)return[];let J=[],U=this.getLocaleTextFunc(),{beans:Z,gos:S}=this,{pinnedCols:X,colAutosize:Y,aggFuncSvc:W,rowGroupColsSvc:q,colNames:H,colModel:_,clipboardSvc:k,expansionSvc:w,focusSvc:K,csvCreator:f,excelCreator:N,menuSvc:F,colChooserFactory:E,sortSvc:I,chartMenuItemMapper:V,valueColsSvc:A,pinnedRowModel:R}=Z,O=(u,v,h,P)=>{switch(AK(S,u),u){case"pinSubMenu":return X&&v?{name:U("pinColumn","Pin Column"),icon:a("menuPin",Z,null),subMenu:["clearPinned","pinLeft","pinRight"]}:null;case"pinLeft":return X&&v?{name:U("pinLeft","Pin Left"),action:()=>X.setColsPinned([v],"left",P),checked:!!v&&v.isPinnedLeft()}:null;case"pinRight":return X&&v?{name:U("pinRight","Pin Right"),action:()=>X.setColsPinned([v],"right",P),checked:!!v&&v.isPinnedRight()}:null;case"clearPinned":return X&&v?{name:U("noPin","No Pin"),action:()=>X.setColsPinned([v],null,P),checked:!!v&&!v.isPinned()}:null;case"pinRowSubMenu":{let b=S.get("enableRowPinning"),g=[],c=z?.rowPinned??z?.pinnedSibling?.rowPinned;if(c)g.push("unpinRow");if(b&&b!=="bottom"&&c!="top")g.push("pinTop");if(b&&b!=="top"&&c!="bottom")g.push("pinBottom");return R?.isManual()?{name:U("pinRow","Pin Row"),icon:a("rowPin",Z,v),subMenu:g}:null}case"pinTop":return R?.isManual()?{name:U("pinTop","Pin to Top"),icon:a("rowPinTop",Z,v),action:({node:b,column:g})=>b&&R.pinRow(b,"top",g)}:null;case"pinBottom":return R?.isManual()?{name:U("pinBottom","Pin to Bottom"),icon:a("rowPinBottom",Z,v),action:({node:b,column:g})=>b&&R.pinRow(b,"bottom",g)}:null;case"unpinRow":return R?.isManual()?{name:U("unpinRow","Unpin Row"),icon:a("rowUnpin",Z,v),action:({node:b,column:g})=>b&&R.pinRow(b,null,g)}:null;case"valueAggSubMenu":if(W&&A&&(v?.isPrimary()||v?.getColDef().pivotValueColumn))return{name:U("valueAggregation","Value Aggregation"),icon:a("menuValue",Z,null),subMenu:VK(v,W,A,U),disabled:S.get("functionsReadOnly")};else return null;case"autoSizeThis":return Y?{name:U("autosizeThisColumn","Autosize This Column"),action:()=>v&&Y.autoSizeColumn(v,P,S.get("skipHeaderOnAutoSize"))}:null;case"autoSizeAll":return Y?{name:U("autosizeAllColumns","Autosize All Columns"),action:()=>Y.autoSizeAllColumns({source:P,skipHeader:S.get("skipHeaderOnAutoSize")})}:null;case"rowGroup":return q?{name:Q0(U,"groupBy",H.getDisplayNameForColumn(v,"header")),disabled:S.get("functionsReadOnly")||v?.isRowGroupActive()||!v?.getColDef().enableRowGroup,action:()=>q.addColumns([v],P),icon:a("menuAddRowGroup",Z,null)}:null;case"rowUnGroup":if(q&&S.isModuleRegistered("SharedRowGrouping")){let b=v?.getColDef().showRowGroup,g=S.get("groupLockGroupColumns"),c,s,m;if(b===!0)c=U("ungroupAll","Un-Group All"),s=S.get("functionsReadOnly")||g===-1||g>=(q.columns.length??0),m=()=>q.setColumns(q.columns.slice(0,g),P);else if(typeof b==="string"){let zG=_.getColDefCol(b),fG=zG!=null?H.getDisplayNameForColumn(zG,"header"):b;c=Q0(U,"ungroupBy",fG),s=S.get("functionsReadOnly")||Z0(zG,Z),m=()=>{q.removeColumns([b],P)}}else c=Q0(U,"ungroupBy",H.getDisplayNameForColumn(v,"header")),s=S.get("functionsReadOnly")||!v?.isRowGroupActive()||!v?.getColDef().enableRowGroup||Z0(v,Z),m=()=>q.removeColumns([v],P);return{name:c,disabled:s,action:m,icon:a("menuRemoveRowGroup",Z,null)}}else return null;case"resetColumns":return{name:U("resetColumns","Reset Columns"),action:()=>EK(Z,P)};case"expandAll":return w?{name:U("expandAll","Expand All Row Groups"),action:()=>w.expandAll(!0)}:null;case"contractAll":return w?{name:U("collapseAll","Collapse All Row Groups"),action:()=>w.expandAll(!1)}:null;case"copy":return k?{name:U("copy","Copy"),shortcut:U("ctrlC","Ctrl+C"),icon:a("clipboardCopy",Z,null),action:()=>k.copyToClipboard()}:null;case"copyWithHeaders":return k?{name:U("copyWithHeaders","Copy with Headers"),icon:a("clipboardCopy",Z,null),action:()=>k.copyToClipboard({includeHeaders:!0})}:null;case"copyWithGroupHeaders":return k?{name:U("copyWithGroupHeaders","Copy with Group Headers"),icon:a("clipboardCopy",Z,null),action:()=>k.copyToClipboard({includeHeaders:!0,includeGroupHeaders:!0})}:null;case"cut":if(k){let b=K.getFocusedCell(),g=b?NK(Z,b):null,c=g?b?.column.isCellEditable(g):!1;return{name:U("cut","Cut"),shortcut:U("ctrlX","Ctrl+X"),icon:a("clipboardCut",Z,null),disabled:!c||S.get("suppressCutToClipboard"),action:()=>k.cutToClipboard(void 0,"contextMenu")}}else return null;case"paste":if(k){let b=S.get("suppressClipboardApi")||S.get("suppressClipboardPaste")||!v||!z||!v.isCellEditable(z)||v.isSuppressPaste(z);return{name:U("paste","Paste"),shortcut:U("ctrlV","Ctrl+V"),icon:a("clipboardPaste",Z,null),disabled:b,action:()=>k.pasteFromClipboard()}}else return null;case"export":{let b=[];if(!S.get("suppressCsvExport")&&f)b.push("csvExport");if(!S.get("suppressExcelExport")&&N)b.push("excelExport");return b.length?{name:U("export","Export"),subMenu:b,icon:a("save",Z,null)}:null}case"csvExport":return f?{name:U("csvExport","CSV Export"),icon:a("csvExport",Z,null),action:()=>f.exportDataAsCsv()}:null;case"excelExport":return N?{name:U("excelExport","Excel Export"),icon:a("excelExport",Z,null),action:()=>N.exportDataAsExcel()}:null;case"separator":return u;case"pivotChart":case"chartRange":return V.getChartItems(u);case"columnFilter":return F&&v?{name:U("columnFilter","Column Filter"),icon:a("filter",Z,null),action:()=>F.showFilterMenu({column:v,buttonElement:h(),containerType:"columnFilter",positionBy:"button"})}:null;case"columnChooser":{let b=K.focusedHeader;return E?{name:U("columnChooser","Choose Columns"),icon:a("columns",Z,null),action:()=>E.showColumnChooser({column:v,eventSource:h(),headerPosition:b})}:null}case"sortUnSort":case"sortAscending":case"sortDescending":case"sortAbsoluteAscending":case"sortAbsoluteDescending":{if(!I||!v)return null;let{fallback:b,getSortDef:g}=RK[u];return{name:U(u,b),icon:a(u,Z,null),action:()=>I.setSortForColumn(v,g(v),!1,P)}}default:return IK(176,{key:u}),null}};for(let u of G){let v;if(typeof u==="string")v=O(u,D,B,Q);else v={...u};if(!v)continue;let h=v,{subMenu:P}=h;if(P&&P instanceof Array)h.subMenu=this.mapWithStockItems(P,D,z,B,Q);if(v!=null)J.push(v)}return N7(J,ND),J}};function VK(G,D,z,B){let Q;if(G.isPrimary())Q=G;else{let U=G.getColDef().pivotValueColumn;Q=fK(U)?U:void 0}let J=[];if(Q){let U=Q.isValueActive(),Z=D.getFuncNames(Q);J.push({name:B("noAggregation","None"),action:()=>{z.removeColumns([Q],"contextMenu"),z.setColumnAggFunc(Q,void 0,"contextMenu")},checked:!U});for(let S of Z)J.push({name:B(S,D.getDefaultFuncLabel(S)),action:()=>{z.setColumnAggFunc(Q,S,"contextMenu"),z.addColumns([Q],"contextMenu")},checked:U&&Q.getAggFunc()===S})}return J}var bK=class extends WK{constructor(){super(...arguments);this.beanName="colMenuFactory"}createMenu(G,D,z,B){let Q=G.createManagedBean(new KJ(0,{column:z??null,node:null,value:null})),J=this.beans.menuItemMapper.mapWithStockItems(D,z??null,null,B,"columnMenu");return Q.addMenuItems(J),Q}getMenuItems(G=null,D=null){let z=this.getDefaultMenuOptions(G),B,Q=(G?.getColDef()??D?.getColGroupDef())?.mainMenuItems;if(Array.isArray(Q))B=Q;else if(typeof Q==="function")B=Q(qK(this.gos,{column:G,columnGroup:D,defaultItems:z}));else{let J=this.gos.getCallback("getMainMenuItems");if(J)B=J({column:G,columnGroup:D,defaultItems:z});else B=z}return N7(B,ND),B}getDefaultMenuOptions(G){let D=[],{beans:z,gos:B}=this,{colChooserFactory:Q,rowGroupColsSvc:J,colModel:U,expansionSvc:Z,sortSvc:S,menuSvc:X,pinnedCols:Y,aggFuncSvc:W,colAutosize:q}=z,H=wK(B),_=()=>{if(!H&&Q)D.push("columnChooser");D.push("resetColumns")};if(!G)return _(),D;let{colDef:k}=G,w=Y&&!k.lockPinned,K=J?.columns.length??0,f=K>0,N=_K(B),F=B.get("treeData"),E=G.isPrimary(),I=!E||W&&G.isAllowValue()&&(f||N||F);if(S&&!H&&G.isSortable()){let{isDefaultSortAllowed:V,isAbsoluteSortAllowed:A,isAbsoluteSort:R,isDefaultSort:O,isAscending:u,isDescending:v,direction:h}=HK(G,z);if(V&&!(u&&O))D.push("sortAscending");if(V&&!(v&&O))D.push("sortDescending");if(A&&!(u&&R))D.push("sortAbsoluteAscending");if(A&&!(v&&R))D.push("sortAbsoluteDescending");if(h)D.push("sortUnSort");D.push(ND)}if(X?.isFilterMenuItemEnabled(G))D.push("columnFilter"),D.push(ND);if(w)D.push("pinSubMenu");if(I)D.push("valueAggSubMenu");if(w||I)D.push(ND);if(q){if(!k.suppressAutoSize)D.push("autoSizeThis");D.push("autoSizeAll"),D.push(ND)}if(J&&B.isModuleRegistered("SharedRowGrouping")){let V=D.length;if(k.showRowGroup)D.push("rowUnGroup");else if(G.isAllowRowGroup()&&E)if(G.isRowGroupActive()){if(!Z0(G,z))D.push("rowUnGroup")}else D.push("rowGroup");if(D.length>V)D.push(ND)}if(_(),Z&&(kK(B)||B.get("ssrmExpandAllAffectsAllRows"))&&(F||K>(U.isPivotMode()?1:0)))D.push("expandAll"),D.push("contractAll");return D}},FZ="ag-context-menu-open",gK=class extends vK{constructor(){super(...arguments);this.beanName="contextMenuSvc",this.focusedCell=null}postConstruct(){this.menu=this.createManagedBean(new v6({menuItemCallbacks:wJ,getMenuItems:this.getMenuItems.bind(this),mapMenuItems:this.mapWithStockItems.bind(this),beforeMenuOpen:this.beforeMenuOpen.bind(this),onMenuOpen:this.onMenuOpen.bind(this),onMenuClose:this.onMenuClose.bind(this),afterMenuDestroyed:this.afterMenuDestroyed.bind(this),onVisibleChanged:this.dispatchVisibleChangedEvent.bind(this),shouldBlockMenuOpen:()=>!!this.beans.overlays?.exclusive}))}hideActiveMenu(){this.menu.hideActiveMenu()}getMenuItems(G,D){let{column:z,node:B,value:Q}=G,J=[],{clipboardSvc:U,chartSvc:Z,csvCreator:S,excelCreator:X,colModel:Y,rangeSvc:W,gos:q}=this.beans;if(NZ(B)&&U){if(z){if(!q.get("suppressCutToClipboard"))J.push("cut");J.push("copy","copyWithHeaders","copyWithGroupHeaders","paste","separator")}}if(q.get("enableCharts")&&Z){if(Y.isPivotMode())J.push("pivotChart");if(W&&!W.isEmpty())J.push("chartRange")}if(NZ(B)){let w=q.get("enableRowPinning"),K=q.get("isRowPinnable");if(w){let I=B.level>-1&&B.footer,V=B.level===-1&&B.footer,A=jK(q);if(V&&!(A==="pinnedBottom"||A==="pinnedTop")||!V&&!I){if(K?.(B)??!0)J.push("pinRowSubMenu")}}let f=q.get("suppressExcelExport")||!X,N=q.get("suppressCsvExport")||!S;if(!PK()&&(!f||!N))J.push("export")}let H=J.length?J:void 0,_=z?.getColDef().contextMenuItems;if(Array.isArray(_))return _;if(typeof _==="function")return _(OK(q,{column:z,node:B,value:Q,defaultItems:H,event:D}));return q.getCallback("getContextMenuItems")?.({column:z,node:B,value:Q,defaultItems:H,event:D})??J}getContextMenuPosition(G,D){let z=this.getRowCtrl(G),B=this.getCellGui(z,D);if(!B)return{x:0,y:z?.getRowYPosition()??0};let Q=B.getBoundingClientRect();return{x:Q.x+Q.width/2,y:Q.y+Q.height/2}}showContextMenu(G){let D=G.rowNode??null,z=G.column??null,{anchorToElement:B,value:Q,source:J}=G;if(D&&z&&Q==null)Q=this.beans.valueSvc.getValueForDisplay({column:z,node:D,from:"edit"}).value;if(B==null)B=this.getContextMenuAnchorElement(D,z);this.beans.menuUtils.onContextMenu({mouseEvent:G.mouseEvent??null,touchEvent:G.touchEvent??null,showMenuCallback:(U)=>this.menu.showMenu({node:D,column:z,value:Q},U,B),source:J})}handleContextMenuMouseEvent(G,D,z,B){let Q=B?.rowNode??z?.rowNode??null,J=B?.column??z?.findFullWidthInfoForEvent(G||D)?.column??null,{valueSvc:U,ctrlsSvc:Z}=this.beans,S=J?U.getValue(J,Q,"edit"):null,X=Z.getGridBodyCtrl(),Y=B?B.eGui:X.eGridBody;this.showContextMenu({mouseEvent:G,touchEvent:D,rowNode:Q,column:J,value:S,anchorToElement:Y,source:"ui"})}beforeMenuOpen(G){if(!G.column)this.beans.focusSvc.clearFocusedCell()}onMenuOpen(){let{ctrlsSvc:G,focusSvc:D}=this.beans;G.getGridBodyCtrl().eGridBody.classList.add(FZ),this.focusedCell=D.getFocusedCell()}onMenuClose(){this.beans.ctrlsSvc.getGridBodyCtrl().eGridBody.classList.remove(FZ)}afterMenuDestroyed(){let{beans:G,focusedCell:D}=this;uK(G,D)}dispatchVisibleChangedEvent(G,D){this.eventSvc.dispatchEvent({type:"contextMenuVisibleChanged",visible:G,source:D})}getRowCtrl(G){let{rowIndex:D,rowPinned:z}=G||{};if(D==null)return;return this.beans.rowRenderer.getRowByPosition({rowIndex:D,rowPinned:z})||void 0}getCellGui(G,D){if(!G||!D)return;return G.getCellCtrl(D)?.eGui||void 0}getContextMenuAnchorElement(G,D){let z=this.beans.ctrlsSvc.getGridBodyCtrl().eGridBody,B=this.getRowCtrl(G);if(!B)return z;let Q=this.getCellGui(B,D);if(Q)return Q;if(B.isFullWidth())return B.getFullWidthElement();return z}mapWithStockItems(G,D,z){let{column:B,node:Q}=D;return this.beans.menuItemMapper.mapWithStockItems(G,B,Q,z,"contextMenu")}},UD="filterMenuTab",ZD="generalMenuTab",FD="columnsMenuTab",XB=[ZD,UD,FD],pK=class extends F7{constructor(){super(...arguments);this.beanName="enterpriseMenuFactory"}hideActiveMenu(){this.destroyBean(this.activeMenu)}showMenuAfterMouseEvent(G,D,z,B,Q){let{column:J,columnGroup:U}=this.splitColumnOrGroup(G),Z=Q?"filterMenuTab":void 0;this.showMenu(J,U,(S)=>{let X=S.getGui();if(this.beans.popupSvc.positionPopupUnderMouseEvent({type:z,additionalParams:{column:J},mouseEvent:D,ePopup:X}),Z)S.showTab?.(Z);this.dispatchVisibleChangedEvent(!0,!1,J,U,Z)},z,Z,void 0,D.target,B)}splitColumnOrGroup(G){let D=G&&lK(G);return{column:D?G:void 0,columnGroup:D?void 0:G}}showMenuAfterButtonClick(G,D,z,B,Q){let J=-1,U="left";if(this.gos.get("enableRtl"))J=1,U="right";let Z=Q?"filterMenuTab":void 0,S=Z?[Z]:void 0,X=P0(this.gos),Y=(X?9:4)*J,W=X?-23:4,{column:q,columnGroup:H}=this.splitColumnOrGroup(G);this.showMenu(q,H,(_)=>{let k=_.getGui();if(this.beans.popupSvc.positionPopupByComponent({type:z,additionalParams:{column:q},eventSource:D,ePopup:k,alignSide:U,nudgeX:Y,nudgeY:W,position:"under",keepWithinBounds:!0}),Z)_.showTab?.(Z);this.dispatchVisibleChangedEvent(!0,!1,q,H,Z)},z,Z,S,D,B)}showMenu(G,D,z,B,Q,J,U,Z){let S=this.getMenuParams(G,D,J,U);if(!S)return;let{menu:X,eMenuGui:Y,anchorToElement:W,restoreFocusParams:q}=S,H=[],{menuUtils:_,popupSvc:k}=this.beans;H.push((K)=>{let f=X.getGui();if(this.destroyBean(X),G)EZ(G,!1,"contextMenu"),_.restoreFocusOnClose(q,f,K);Z?.()});let w=this.getLocaleTextFunc();if(k.addPopup({modal:!0,eChild:Y,closeOnEsc:!0,closedCallback:(K)=>{for(let f of H)f(K);this.dispatchVisibleChangedEvent(!1,!1,G,D,Q)},afterGuiAttached:(K)=>X.afterGuiAttached(Object.assign({},{container:B},K)),positionCallback:Q?()=>z(X):void 0,ariaLabel:w("ariaLabelColumnMenu","Column Menu")}),!Q)X.showTabBasedOnPreviousSelection?.(),z(X);if(nK(this.gos)){let K=k.setPopupPositionRelatedToElement(Y,W);if(K&&G)this.addStopAnchoring(K,G,H)}if(X.addEventListener("tabSelected",(K)=>{this.dispatchVisibleChangedEvent(!1,!0,G),this.lastSelectedTab=K.key,this.dispatchVisibleChangedEvent(!0,!0,G)}),G)EZ(G,!0,"contextMenu");this.activeMenu=X,X.addEventListener("destroyed",()=>{if(this.activeMenu===X)this.activeMenu=null})}addStopAnchoring(G,D,z){G.then((B)=>{D.__addEventListener("leftChanged",B),D.__addEventListener("visibleChanged",B),z.push(()=>{D.__removeEventListener("leftChanged",B),D.__removeEventListener("visibleChanged",B)})})}getMenuParams(G,D,z,B){let{focusSvc:Q,visibleCols:J,ctrlsSvc:U}=this.beans,Z={column:G,headerPosition:Q.focusedHeader,columnIndex:J.allCols.indexOf(G),eventSource:B},S=this.createMenu(G,D,Z,z,B);return S?{menu:S,eMenuGui:S.getGui(),anchorToElement:B||U.getGridBodyCtrl().eGridBody,restoreFocusParams:Z}:void 0}createMenu(G,D,z,B,Q){if(P0(this.gos))return this.createBean(new mK(G,z,this.lastSelectedTab,B,Q));else{let J=this.beans.colMenuFactory.getMenuItems(G,D);return J.length?this.createBean(new tK(J,G,z,Q)):void 0}}dispatchVisibleChangedEvent(G,D,z,B,Q){this.eventSvc.dispatchEvent({type:"columnMenuVisibleChanged",visible:G,switchingTab:D,key:this.lastSelectedTab??Q??(P0(this.gos)?ZD:"columnMenu"),column:z??null,columnGroup:B??null})}isMenuEnabled(G){if(!P0(this.gos))return!0;let D=!this.beans.filterManager?.isFilterAllowed(G),z=G.getColDef().menuTabs??XB;return(D&&z.includes(UD)?z.length-1:z.length)>0}showMenuAfterContextMenuEvent(G,D,z){this.beans.menuUtils.onContextMenu({mouseEvent:D,touchEvent:z,source:"ui",showMenuCallback:(B)=>{return this.showMenuAfterMouseEvent(G,B,"columnMenu"),!0}})}},mK=class extends F7{constructor(G,D,z,B,Q){super();this.column=G,this.restoreFocusParams=D,this.initialSelection=z,this.restrictTo=B,this.sourceElement=Q,this.tabFactories={},this.includeChecks={};let{tabFactories:J,includeChecks:U}=this;J[ZD]=this.createMainPanel.bind(this),J[UD]=this.createFilterPanel.bind(this),J[FD]=this.createColumnsPanel.bind(this),U[ZD]=()=>!0,U[UD]=()=>G?!!this.beans.filterManager?.isFilterAllowed(G):!1,U[FD]=()=>!0}postConstruct(){let G=this.getTabsToCreate().map((z)=>this.createTab(z)),D=new YJ({items:G,cssClass:"ag-menu",onActiveItemClicked:this.onHidePopup.bind(this),onItemClicked:this.onTabItemClicked.bind(this)});this.tabbedLayout=this.createBean(D),this.mainMenuList?.setParentComponent(D),this.addDestroyFunc(()=>this.destroyBean(D))}getTabsToCreate(){if(this.restrictTo)return this.restrictTo;return(this.column?.getColDef().menuTabs??XB).filter((G)=>this.isValidMenuTabItem(G)&&this.isNotSuppressed(G))}isValidMenuTabItem(G){let D=!0,z=XB;if(this.restrictTo!=null)D=this.restrictTo.indexOf(G)>-1,z=this.restrictTo;if(D=D&&XB.indexOf(G)>-1,!D)dK(175,{menuTabName:G,itemsToConsider:z});return D}isNotSuppressed(G){return this.includeChecks[G]()}createTab(G){return this.tabFactories[G]()}showTabBasedOnPreviousSelection(){this.showTab(this.initialSelection)}showTab(G){let{tabItemColumns:D,tabbedLayout:z,tabItemFilter:B,tabItemGeneral:Q}=this;if(D&&G===FD)z.showItem(D);else if(B&&G===UD)z.showItem(B);else if(Q&&G===ZD)z.showItem(Q);else z.showFirstItem()}onTabItemClicked(G){let D=null;switch(G.item){case this.tabItemColumns:D=FD;break;case this.tabItemFilter:D=UD;break;case this.tabItemGeneral:D=ZD;break}if(D)this.activateTab(D)}activateTab(G){let D={type:"tabSelected",key:G};this.dispatchLocalEvent(D)}createMainPanel(){let{beans:G,column:D}=this,z=G.colMenuFactory,B=z.createMenu(this,z.getMenuItems(D),this.column,()=>this.sourceElement??this.getGui());this.mainMenuList=B,B.addEventListener("closeMenu",this.onHidePopup.bind(this));let Q={title:yQ("legacyMenu",G,D),titleLabel:ZD.replace("MenuTab",""),bodyPromise:TQ.resolve(B.getGui()),name:ZD};return this.tabItemGeneral=Q,Q}onHidePopup(G){this.beans.menuUtils.closePopupAndRestoreFocusOnSelect(this.hidePopupFunc,this.restoreFocusParams,G)}createFilterPanel(){let G=this.column?this.createBean(new yK(this.column,"COLUMN_MENU")):null;if(this.filterComp=G,!G?.hasFilter())hK(119);let D=(B)=>G?.afterGuiAttached(B),z=()=>G?.afterGuiDetached();return this.tabItemFilter={title:yQ("filterTab",this.beans,this.column),titleLabel:UD.replace("MenuTab",""),bodyPromise:TQ.resolve(G?.getGui()),afterAttachedCallback:D,afterDetachedCallback:z,name:UD},this.tabItemFilter}createColumnsPanel(){let G=cK({tag:"div",cls:"ag-menu-column-select-wrapper"}),{beans:D,column:z}=this,Q=D.colChooserFactory.createColumnSelectPanel(this,z).getGui();Q.classList.add("ag-menu-column-select"),G.appendChild(Q);let J={title:yQ("columns",D,z),titleLabel:FD.replace("MenuTab",""),bodyPromise:TQ.resolve(G),name:FD};return this.tabItemColumns=J,J}afterGuiAttached(G){let{container:D,hidePopup:z}=G;if(this.tabbedLayout.setAfterAttachedParams({container:D,hidePopup:z}),z)this.hidePopupFunc=z,this.addDestroyFunc(z)}getGui(){return this.tabbedLayout.getGui()}destroy(){super.destroy(),this.destroyBean(this.filterComp)}},tK=class extends TK{constructor(G,D,z,B){super({tag:"div",ref:"eColumnMenu",cls:"ag-menu ag-column-menu",role:"presentation"});this.menuItems=G,this.column=D,this.restoreFocusParams=z,this.sourceElement=B,this.eColumnMenu=xK}postConstruct(){let G=this.beans.colMenuFactory.createMenu(this,this.menuItems,this.column,()=>this.sourceElement??this.getGui());this.mainMenuList=G,G.addEventListener("closeMenu",this.onHidePopup.bind(this)),this.eColumnMenu.appendChild(G.getGui())}onHidePopup(G){this.beans.menuUtils.closePopupAndRestoreFocusOnSelect(this.hidePopupFunc,this.restoreFocusParams,G)}afterGuiAttached({hidePopup:G}){if(G)this.hidePopupFunc=G,this.addDestroyFunc(G);iK(this.mainMenuList.getGui())}};function sK(G,D){let{contextMenuSvc:z}=G;if(!z)return;let{rowNode:B,column:Q,value:J,x:U,y:Z}=D||{},{x:S,y:X}=z.getContextMenuPosition(B,Q);if(U!=null)S=U;if(Z!=null)X=Z;z.showContextMenu({mouseEvent:new MouseEvent("mousedown",{clientX:S,clientY:X}),rowNode:B,column:Q,value:J,source:"api"})}function oK(G,D){G.colChooserFactory?.showColumnChooser({chooserParams:D})}function rK(G){G.colChooserFactory?.hideActiveColumnChooser()}var Bf=class extends aK{constructor(){super(...arguments);this.beanName="menuUtils"}restoreFocusOnClose(G,D,z,B){let{eventSource:Q}=G,J=z instanceof KeyboardEvent;if(!B&&!J||!Q)return;let U=Gf(this.beans);if(!D.contains(U)&&!IZ(this.beans))return;this.focusHeaderCell(G)}closePopupAndRestoreFocusOnSelect(G,D,z){let B;if(z?.keyboardEvent)B=z.keyboardEvent;G(B&&{keyboardEvent:B});let Q=this.beans,J=Q.focusSvc,U=J.getFocusedCell();if(IZ(Q))if(U){let{rowIndex:Z,rowPinned:S,column:X}=U;J.setFocusedCell({rowIndex:Z,column:X,rowPinned:S,forceBrowserFocus:!0,preventScrollOnBrowserFocus:!0})}else this.focusHeaderCell(D)}onContextMenu(G){let{mouseEvent:D,touchEvent:z,showMenuCallback:B,source:Q}=G;if(!this.gos.get("allowContextMenuWithControlKey")){if(D&&(D.ctrlKey||D.metaKey))return}if(D)this.blockMiddleClickScrollsIfNeeded(D);if(Q==="ui"&&this.gos.get("suppressContextMenu"))return;let J=D??z.touches[0];if(B(J)){let U=D??z;if(U?.cancelable)U.preventDefault()}}async focusHeaderCell(G){let{column:D,columnIndex:z,headerPosition:B,eventSource:Q}=G,{visibleCols:J,headerNavigation:U,focusSvc:Z}=this.beans,S=await J.allCols.some((X)=>X===D);if(!this.isAlive())return;if(D?.isAlive()&&S&&Q&&Df(Q)){let X=eK(Q);if(X)U?.scrollToColumn(D),X.focus()}else if(B&&z!==-1){let X=J.allCols,Y=X[z]||zf(X);if(Y)Z.focusHeaderPosition({headerPosition:{headerRowIndex:B.headerRowIndex,column:Y}})}}blockMiddleClickScrollsIfNeeded(G){if(this.gos.get("suppressMiddleClickScrolls")&&G.which===2)G.preventDefault()}},E7={moduleName:"MenuCore",version:j,beans:[CK,UK,Bf],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:[i,zK,QK,TB]},W0={moduleName:"ColumnMenu",version:j,beans:[pK,bK,YK],icons:{ensureColumnVisible:"column-arrow",legacyMenu:"menu",filterTab:"filter",columnSelectClosed:"tree-closed",columnSelectOpen:"tree-open",columnSelectIndeterminate:"tree-indeterminate"},apiFunctions:{showColumnChooser:oK,hideColumnChooser:rK},dependsOn:[E7,BK,DK]},FJ={moduleName:"ContextMenu",version:j,beans:[gK],apiFunctions:{showContextMenu:sK},dependsOn:[E7]},Qf={moduleName:"Menu",version:j,dependsOn:[W0,FJ]},Lf=10,RZ=class extends Uf{constructor(){super({tag:"div",cls:"ag-cell-edit-wrapper"});this.pendingInitialEventKey=null,this.initialEventKeyProcessed=!1}initialiseEditor(G){let{cellStartedEdit:D,values:z,valuesPage:B,eventKey:Q}=this.params;if(this.pendingInitialEventKey=null,this.initialEventKeyProcessed=!1,AZ(z)&&AZ(B))Cz(180);let J=this.resolveAsyncMode(),{params:U,valueList:Z}=this.buildRichSelectParams(J),S=this.createManagedBean(new gB(U));this.eEditor=S,S.addCss("ag-cell-editor"),this.appendChild(S);let X=this.getAsyncValuesSource(J);if(X)S.setAsyncValuesSource({source:X,thresholdRows:this.params.valuesPageLoadThreshold??Lf,useAsyncSearch:J.isFullAsync,onMisconfiguredSearchSource:J.isFullAsync?()=>Cz(294):void 0,onFirstValuesPageLoaded:()=>{if(this.pendingInitialEventKey!=null)this.consumeInitialEventKey(this.pendingInitialEventKey),this.pendingInitialEventKey=null}});if(this.eEditor.setValueList({valueList:Z,refresh:!0,isInitial:!0}),J.isValuesPaged)if(this.eEditor.resetAsyncValues(""),J.isFullAsync)this.consumeInitialEventKey(Q);else this.pendingInitialEventKey=Q;else if(Z&&!Array.isArray(Z))Z.then((Y)=>{let W=this.getSearchStringCallback(Y);if(W)S.setSearchStringCreator(W);this.consumeInitialEventKey(Q)}).catch((Y)=>{$f("Rich Select",Y),this.consumeInitialEventKey(Q)});this.addManagedListeners(S,{fieldPickerValueSelected:this.onEditorPickerValueSelected.bind(this)}),this.focusAfterAttached=D}onEditorPickerValueSelected(G){if(this.gos.get("editType")!=="fullRow")setTimeout(()=>this.params.stopEditing(!G.fromEnterKey))}getPlaceholderText(G=this.isFullAsync()){let{valuePlaceholder:D}=this.params;if(D!==void 0)return D;let z=this.getLocaleTextFunc();return G?z("typeToSearchOoo","Type to search..."):z("advancedFilterBuilderSelectOption","Select an option...")}isFullAsync(){let{allowTyping:G,filterListAsync:D,values:z,valuesPage:B}=this.params,Q=typeof z==="function"||typeof B==="function";if(D&&!G)return Cz(294),!1;if(!Q&&D)return Cz(294),!1;return!!(G&&D&&Q)}isValuesPaged(){return typeof this.params.valuesPage==="function"}resolveAsyncMode(){return{isValuesPaged:this.isValuesPaged(),isFullAsync:this.isFullAsync()}}getInitialValueList(G=this.resolveAsyncMode()){let D=this.params,{values:z}=D;if(G.isValuesPaged)return;if(!z)return[];if(Array.isArray(z))return z;if(typeof z!=="function")return[];if(G.isFullAsync)return;return z({...D})}buildRichSelectParams(G=this.resolveAsyncMode()){let D=this.params,{cellRenderer:z,cellRendererParams:B,cellHeight:Q,value:J,values:U,formatValue:Z,searchDebounceDelay:S,valueListGap:X,valueListMaxHeight:Y,valueListMaxWidth:W,allowTyping:q,filterList:H,searchType:_,highlightMatch:k,eventKey:w,multiSelect:K,suppressDeselectAll:f,suppressMultiSelectPillRenderer:N}=D,{isValuesPaged:F,isFullAsync:E}=G,I=Z??((v)=>String(v??"")),A={value:J,cellRenderer:z,cellRendererParams:B,cellRowHeight:Q,searchDebounceDelay:S,valueFormatter:(v)=>{if(Array.isArray(v))return v.map((h)=>I(h)).join(", ");return I(v)},pickerAriaLabelKey:"ariaLabelRichSelectField",pickerAriaLabelValue:"Rich Select Field",pickerType:"virtual-list",pickerGap:X,allowTyping:q,filterList:H,searchType:_,highlightMatch:k,maxPickerHeight:Y,maxPickerWidth:W,placeholder:this.getPlaceholderText(E),initialInputValue:w?.length===1?w:w===MZ.BACKSPACE?"":void 0,multiSelect:K,suppressDeselectAll:f,suppressMultiSelectPillRenderer:N},R=this.getInitialValueList(G),O=Array.isArray(U),u=typeof U==="function";if(F){if(R)A.valueList=R;if(E)A.allowNoResultsCopy=!0,A.filterList=!0}else if(O)A.valueList=R,A.searchStringCreator=this.getSearchStringCallback(R);else if(u&&E)A.allowNoResultsCopy=!0,A.filterList=!0;return{params:A,valueList:R}}getAsyncValuesSource(G=this.resolveAsyncMode()){let{isFullAsync:D,isValuesPaged:z}=G;if(!D&&!z)return;return{searchValues:D?(B)=>this.getAsyncSearchValues(B):void 0,loadValuesPage:z?(B)=>this.getAsyncValuesPage(B):void 0,valuesPageInitialStartRow:z?(B)=>this.resolveValuesPageInitialStartRow(B):void 0,valuesPageSize:z?this.params.valuesPageSize:void 0}}getAsyncSearchValues(G){let{values:D}=this.params;if(typeof D!=="function")return[];return D({...this.params,search:G})}getAsyncValuesPage(G){let{valuesPage:D}=this.params;if(typeof D!=="function")return{values:[]};return D({...this.params,search:G.search,startRow:G.startRow,endRow:G.endRow,cursor:G.cursor})}resolveValuesPageInitialStartRow(G){if(G)return 0;let{valuesPageInitialStartRow:D,value:z}=this.params,B=typeof D==="function"?D(z):D;return Math.max(Math.floor(B??0),0)}getSearchStringCallback(G){if(typeof G[0]!=="object")return;let D=this.params,{colDef:z,formatValue:B}=D,Q=B??((U)=>String(U??""));if(z.cellEditorParams?.formatValue)return(U)=>U.map(Q);let{keyCreator:J}=z;if(J){Cz(266);let{column:U,node:Z,data:S}=D;return(X)=>X.map((Y)=>{let W=Zf(this.gos,{value:Y,colDef:z,column:U,node:Z,data:S});return J(W)})}return(U)=>U.map(Q)}afterGuiAttached(){let{focusAfterAttached:G,params:D}=this;setTimeout(()=>{if(!this.isAlive())return;let z=this.eEditor,{allowTyping:B,eventKey:Q,cellStartedEdit:J}=D;if(G){let U=z.getFocusableElement();if(U.focus(),B&&(!Q||Q.length!==1))U.select()}if(J)z.showPicker();if(this.pendingInitialEventKey==null)this.consumeInitialEventKey(Q)})}consumeInitialEventKey(G){if(!G||this.initialEventKeyProcessed)return;this.initialEventKeyProcessed=!0,this.processEventKey(G)}processEventKey(G){if(!G)return;if(G===MZ.BACKSPACE)this.eEditor.searchTextFromString(null);else if(G?.length===1)this.eEditor.searchTextFromString(G)}focusIn(){this.eEditor.getFocusableElement().focus()}agSetEditValue(G){this.params.value=G,this.eEditor.setValue(G??null,!0)}getValue(){let{params:G}=this,D=this.eEditor.getValue();return G.parseValue?.(D)??D}isPopup(){return!1}getValidationElement(){return this.eEditor.getAriaElement()}getValidationErrors(){let{params:G}=this,{getValidationErrors:D}=G;if(!D)return null;return D({value:this.getValue(),internalErrors:null,cellEditorParams:G})}},I7={moduleName:"RichSelect",version:j,beans:[],userComponents:{agRichSelect:RZ,agRichSelectCellEditor:RZ},icons:{richSelectOpen:"small-down",richSelectRemove:"cancel",richSelectLoading:"loading"},dependsOn:[i,Jf]},RD="__AG_SELECT_ALL__",CD="__AG_ADD_SELECTION_TO_FILTER__",kf=class{constructor(G,D,z,B){this.valueSvc=G,this.getValueFormatter=D,this.formatter=z,this.column=B,this.displayedKeys=[]}updateDisplayedValuesToAllAvailable(G,D,z){this.displayedKeys=Array.from(z)}updateDisplayedValuesToMatchMiniFilter(G,D,z,B,Q){this.displayedKeys=[];let J=this.getValueFormatter();for(let U of z)if(U==null){if(Q)this.displayedKeys.push(U)}else{let Z=G(U),S=this.valueSvc.formatValue(this.column,null,Z,J,!1),X=this.formatter(S);if(B(X))this.displayedKeys.push(U)}}getDisplayedValueCount(){return this.displayedKeys.length}getDisplayedItem(G){return this.displayedKeys[G]}getSelectAllItem(){return RD}getAddSelectionToFilterItem(){return CD}getDisplayedKeys(){return this.displayedKeys}forEachDisplayedKey(G){this.displayedKeys.forEach(G)}someDisplayedKey(G){return this.displayedKeys.some(G)}hasGroups(){return!1}refresh(){}},bf={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"}]},vf={tag:"div",cls:"ag-set-filter-item",children:[{tag:"ag-checkbox",ref:"eCheckbox",cls:"ag-set-filter-item-checkbox"}]},Of=class extends Kf{constructor(G){super(G.isGroup?bf:vf,[wf]);this.eCheckbox=g0,this.eGroupOpenedIcon=g0,this.eGroupClosedIcon=g0,this.eGroupIndeterminateIcon=g0,this.formattedValue=null,this.focusWrapper=G.focusWrapper,this.value=G.value,this.params=G.params,this.translate=G.translate,this.valueFormatter=G.valueFormatter,this.item=G.item,this.isSelected=G.isSelected,this.isTree=G.isTree,this.depth=G.depth??0,this.isGroup=G.isGroup,this.groupsExist=G.groupsExist,this.isExpanded=G.isExpanded,this.hasIndeterminateExpandState=G.hasIndeterminateExpandState}postConstruct(){if(this.tooltipFeature=this.createOptionalManagedBean(this.beans.registry.createDynamicBean("tooltipFeature",!1,{getGui:()=>this.focusWrapper,getLocation:()=>"setFilterValue",shouldDisplayTooltip:()=>this.shouldDisplayTooltip?.()??!0,getAdditionalParams:()=>{let{colDef:G,column:D}=this.params,z={colDef:G,column:D,valueFormatted:this.formattedValue??void 0};if(this.isTree)z.level=this.depth;return z}})),this.addDestroyFunc(()=>this.destroyCellRendererComponent?.()),this.render(),this.eCheckbox.setLabelEllipsis(!0).setValue(this.isSelected,!0).setDisabled(!!this.params.readOnly).getInputElement().setAttribute("tabindex","-1"),this.refreshVariableAriaLabels(),this.isTree){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");Cf(this.getAriaElement(),this.depth+1)}if(this.refreshAriaChecked(),this.params.readOnly)return;this.eCheckbox.onValueChange((G)=>this.onCheckboxChanged(!!G))}getFocusableElement(){return this.focusWrapper}setupExpansion(){let{eGroupClosedIcon:G,eGroupOpenedIcon:D,eGroupIndeterminateIcon:z,hasIndeterminateExpandState:B,beans:Q}=this;G.appendChild(cQ("setFilterGroupClosed",Q,null)),D.appendChild(cQ("setFilterGroupOpen",Q,null));let J=this.onExpandOrContractClicked.bind(this);if(this.addManagedElementListeners(G,{click:J}),this.addManagedElementListeners(D,{click:J}),B)z.appendChild(cQ("setFilterGroupIndeterminate",Q,null)),this.addManagedElementListeners(z,{click:J});this.setExpandedIcons(),this.refreshAriaExpanded()}onExpandOrContractClicked(){this.setExpanded(!this.isExpanded)}setExpanded(G,D){if(this.isGroup&&G!==this.isExpanded){this.isExpanded=G;let z={type:"expandedChanged",isExpanded:!!G,item:this.item};if(!D)this.dispatchLocalEvent(z);this.setExpandedIcons(),this.refreshAriaExpanded()}}setExpandedIcons(){let{isExpanded:G,hasIndeterminateExpandState:D,eGroupClosedIcon:z,eGroupOpenedIcon:B,eGroupIndeterminateIcon:Q}=this;if(hQ(z,D?G===!1:!G),hQ(B,G===!0),D)hQ(Q,G===void 0)}onCheckboxChanged(G){this.isSelected=G;let D={type:"selectionChanged",isSelected:G,item:this.item};this.dispatchLocalEvent(D),this.refreshVariableAriaLabels(),this.refreshAriaChecked()}toggleSelected(){if(this.params.readOnly)return;this.setSelected(!this.isSelected)}setSelected(G,D){this.isSelected=G,this.eCheckbox.setValue(G,D),this.refreshAriaChecked()}refreshVariableAriaLabels(){if(!this.isTree)return;let G=this.getLocaleTextFunc(),D=this.eCheckbox.getValue(),z=D===void 0?G("ariaIndeterminate","indeterminate"):D?G("ariaVisible","visible"):G("ariaHidden","hidden"),B=G("ariaToggleVisibility","Press SPACE to toggle visibility");Rf(this.eCheckbox.getInputElement(),void 0),this.eCheckbox.setInputAriaLabel(`${B} (${z})`)}setupFixedAriaLabels(G){if(!this.isTree)return;let z=this.getLocaleTextFunc()("ariaFilterValue","Filter Value"),B=this.getAriaElement();Af(B,`${G} ${z}`),If(B,this.eCheckbox.getInputElement().id)}refreshAriaChecked(){let G=this.getAriaElement();Ef(G,this.eCheckbox.getValue())}refreshAriaExpanded(){Mf(this.getAriaElement(),!!this.isExpanded)}refresh(G,D,z){if(this.item=G,D!==this.isSelected)this.setSelected(D,!0);this.setExpanded(z,!0);let{cellRendererComponent:B,cellRendererParams:Q,beans:J,params:U}=this;if(this.valueFunction){let Z=this.valueFunction();if(this.setTooltipAndCellRendererParams(Z,Z),!B)this.renderCellWithoutCellRenderer()}if(B){let Z=VZ(J.userCompFactory,U,Q);if(!B.refresh?.(Z?.params??Q)){let X=B;this.renderCell(),this.destroyBean(X)}}}render(){let{params:{column:G}}=this,{value:D}=this,z=null;if(typeof D==="function")this.valueFunction=D,z=this.valueFunction(),D=z;else if(this.isTree)z=bZ(D);else z=this.getFormattedValue(G,D);this.formattedValue=z,this.setTooltipAndCellRendererParams(D,z),this.renderCell()}setTooltipAndCellRendererParams(G,D){let z=this.gos;if(this.params.showTooltips&&(!Ff(z)||!this.params.cellRenderer)){let B=D!=null?D:bZ(G);this.shouldDisplayTooltip=Nf(z,()=>this.eCheckbox.getGui().querySelector(".ag-label")),this.tooltipFeature?.setTooltipAndRefresh(B)}this.cellRendererParams=ff(z,{value:G,valueFormatted:D,colDef:this.params.colDef,column:this.params.column,setTooltip:(B,Q)=>{z.assertModuleRegistered("Tooltip",3),this.shouldDisplayTooltip=Q,this.tooltipFeature?.setTooltipAndRefresh(B)}})}getFormattedValue(G,D){return this.beans.valueSvc.formatValue(G,null,D,this.valueFormatter,!1)}renderCell(){let D=VZ(this.beans.userCompFactory,this.params,this.cellRendererParams)?.newAgStackInstance();if(D==null){this.renderCellWithoutCellRenderer();return}D.then((z)=>{if(z)this.cellRendererComponent=z,this.eCheckbox.setLabel(z.getGui()),this.destroyCellRendererComponent=()=>this.destroyBean(z)})}renderCellWithoutCellRenderer(){let{valueFormatted:G,value:D}=this.cellRendererParams,z=(G==null?D:G)??this.translate("blanks");if(typeof z!=="string")Vf(208),z="";this.eCheckbox.setLabel(z),this.setupFixedAriaLabels(z)}getComponentHolder(){return this.params.column.getColDef()}},xf={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:(G)=>`is (${G[0]})`,filterSummaryListLong:(G)=>`is (${G[0]}) and ${G[1]} more`};function m1(G,D,z){let B=G;if(!B)return null;if(B=B.map((Q)=>gf(Pf(Q))),!D&&z&&B.some((Q)=>Q==null)){if(jf(B)==null)return null;return B.filter((Q)=>Q!=null)}return B}function _G(G,D,z){return Tf(G,xf,D,z)}function cf(G){if(G.excelMode==="windows"){if(!G.buttons)G.buttons=["apply","cancel"];if(G.closeOnApply==null)G.closeOnApply=!0}else if(G.excelMode==="mac"){if(!G.buttons)G.buttons=["reset"];if(G.applyMiniFilterWhileTyping==null)G.applyMiniFilterWhileTyping=!0;if(G.debounceMs==null)G.debounceMs=500}if(G.excelMode&&G.defaultToNothingSelected)G.defaultToNothingSelected=!1,yf(207)}function hf(){return([G,D],[z,B])=>{if(D==null)return B==null?0:-1;else if(B==null)return 1;for(let Q=0;Q=B.length)return 1;let J=uf(D[Q],B[Q]);if(J!==0)return J}return 0}}var vZ=class{constructor(G,D,z,B){this.formatter=G,this.treeListPathGetter=D,this.treeListFormatter=z,this.treeDataOrGrouping=B,this.allDisplayedItemsTree=new Map,this.activeDisplayedItemsFlat=[],this.selectAllItem={depth:0,filterPasses:!0,available:!0,treeKey:RD,children:this.allDisplayedItemsTree,expanded:!0,key:RD,parentTreeKeys:[]},this.addSelectionToFilterItem={depth:0,filterPasses:!0,available:!0,treeKey:CD,expanded:!0,key:CD,parentTreeKeys:[]}}updateParams(G,D){this.treeListPathGetter=G,this.treeListFormatter=D}updateDisplayedValuesToAllAvailable(G,D,z,B){if(B==="reload")this.generateItemTree(G,D,z);else if(B==="otherFilter")this.updateAvailable(z),this.updateExpandAll();else if(B==="miniFilter")this.resetFilter(),this.updateExpandAll();this.flattenItems()}updateDisplayedValuesToMatchMiniFilter(G,D,z,B,Q,J){if(J==="reload")this.generateItemTree(G,D,z);else if(J==="otherFilter")this.updateAvailable(z);this.updateFilter(B,Q),this.updateExpandAll(),this.flattenItems()}generateItemTree(G,D,z){let B=new Map;this.allDisplayedItemsTree=B;let Q=!1,J=this.getTreeListPathGetter(G,z);for(let U of D){let Z=G(U),S=J(Z)??[null],X=S.length;if(X>1)Q=!0;let Y=z.has(U),W=B,q,H=[];for(let _=0;_B;let z=!1;for(let B of D){let Q=G(B);if(Q instanceof Date){z=!0;break}else if(Q!=null)break}if(z)return(B)=>nf(B,!1);return df(211),(B)=>[String(B)]}flattenItems(){this.activeDisplayedItemsFlat=[];let G=(D)=>{for(let z of D.values()){if(!z.filterPasses||!z.available)continue;if(this.activeDisplayedItemsFlat.push(z),z.children&&z.expanded)G(z.children)}};G(this.allDisplayedItemsTree)}resetFilter(){let G=(D)=>{let z=D.children;if(z)for(let B of z.values())G(B);D.filterPasses=!0};for(let D of this.allDisplayedItemsTree.values())G(D)}updateFilter(G,D){let z=(B)=>{if(!B.available)return!1;if(B.treeKey==null)return D;return G(this.formatter(this.treeListFormatter?this.treeListFormatter(B.treeKey,B.depth,B.parentTreeKeys):B.treeKey))};for(let B of this.allDisplayedItemsTree.values())this.recursiveItemCheck(B,!1,z,"filterPasses")}getDisplayedValueCount(){return this.activeDisplayedItemsFlat.length}getDisplayedItem(G){return this.activeDisplayedItemsFlat[G]}getSelectAllItem(){return this.selectAllItem}getAddSelectionToFilterItem(){return this.addSelectionToFilterItem}getDisplayedKeys(){let G=[];return this.forEachDisplayedKey((D)=>G.push(D)),G}forEachDisplayedKey(G){let D=(z,B)=>{let Q=z.children;if(Q){if(!z.expanded||!B){for(let J of Q.values())if(J.filterPasses)D(J,!1)}}else G(z.key)};for(let z of this.activeDisplayedItemsFlat)D(z,!0)}someDisplayedKey(G){let D=(z,B)=>{let Q=z.children;if(Q){if(!z.expanded||!B){for(let J of Q.values())if(J.filterPasses&&D(J,!1))return!0;return!1}}else return G(z.key);return!1};return this.activeDisplayedItemsFlat.some((z)=>D(z,!0))}hasGroups(){return this.groupsExist}refresh(){this.updateExpandAll(),this.flattenItems()}updateExpandAll(){let G=(z,B,Q)=>{for(let J of z.values()){if(!J.filterPasses||!J.available||!J.children)continue;if(B=B||!!J.expanded,Q=Q||!J.expanded,B&&Q)return;let U=G(J.children,B,Q);if(U===void 0)return;else if(U)B=!0;else Q=!0}return B&&Q?void 0:B},D=this.getSelectAllItem();D.expanded=G(D.children,!1,!1)}recursiveItemCheck(G,D,z,B){let Q=!1,J=G.children;if(J)for(let Z of J.values()){let S=this.recursiveItemCheck(Z,D||z(G),z,B);Q=Q||S}let U=D||Q||z(G);return G[B]=U,U}updateAvailable(G){let D=(z)=>G.has(z.key);for(let z of this.allDisplayedItemsTree.values())this.recursiveItemCheck(z,!1,D,"available")}},M7=class extends Yf{constructor(){super("setFilter","set-filter");this.filterType="set",this.eMiniFilter=bz,this.eFilterLoading=bz,this.eFilterLoadingIcon=bz,this.eSetFilterList=bz,this.eFilterNoMatches=bz,this.hardRefreshVirtualList=!1,this.miniFilterText=null,this.addCurrentSelectionToFilter=!1,this.selectedKeys=new Set}setParams(G){super.setParams(G);let D=this.updateHandler(G.getHandler()),{column:z,textFormatter:B,treeList:Q,treeListPathGetter:J,treeListFormatter:U}=G;if(this.formatter=B??((Z)=>Z??null),this.displayValueModel=Q?new vZ(this.formatter,J,U,D.isTreeDataOrGrouping()):new kf(this.beans.valueSvc,()=>this.handler.valueFormatter,this.formatter,z),D.valueModel.allKeys.then((Z)=>{if(!this.isAlive())return;this.updateDisplayedValues("reload",Z??[]),this.resetSelectionState(Z??[])}),D.valueModel.isLoading())this.setIsLoading(!0);this.initialiseFilterBodyUi()}refresh(G){if(this.params.treeList!==G.treeList)return!1;return this.updateHandler(G.getHandler()),super.refresh(G)}updateParams(G,D){if(super.updateParams(G,D),this.updateMiniFilter(),G.suppressSelectAll!==D.suppressSelectAll)this.createVirtualListModel(G);let{textFormatter:z,treeListPathGetter:B,treeListFormatter:Q}=G;if(this.formatter=z??((J)=>J??null),this.displayValueModel instanceof vZ)this.displayValueModel.updateParams(B,Q);this.handler.refreshFilterValues(!0)}updateHandler(G){if(this.handler!==G){for(let z of this.handlerDestroyFuncs??[])z();this.handlerDestroyFuncs=[...this.addManagedListeners(G,{anyFilterChanged:(z)=>{G.valueModel.allKeys.then((B)=>{if(this.isAlive()){if(this.updateDisplayedValues("otherFilter",B??[]),z.updated)this.checkAndRefreshVirtualList(),this.showOrHideResults()}})},dataChanged:({hardRefresh:z})=>{G.valueModel.allKeys.then((B)=>{if(this.isAlive()){if(this.updateDisplayedValues("reload",B??[]),this.setSelectedModel(this.state.model?.values??null),z)this.hardRefreshVirtualList=!0;this.checkAndRefreshVirtualList()}})}}),...this.addManagedListeners(G.valueModel,{loadingStart:()=>this.setIsLoading(!0),loadingEnd:()=>this.setIsLoading(!1)})],this.handler=G}return G}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:_G(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:_G(this,"noMatches")},{tag:"div",ref:"eSetFilterList",cls:"ag-set-filter-list",role:"presentation"}]}}getAgComponents(){return[Xf]}handleKeyDown(G){if(super.handleKeyDown(G),G.defaultPrevented)return;let D=()=>{if(!this.eSetFilterList.contains(_f(this.beans)))return;let z=this.virtualList.getLastFocusedRow();if(z==null)return;let B=this.virtualList.getComponentAt(z);if(B==null)return;G.preventDefault();let{readOnly:Q}=this.params;if(Q)return;return B};switch(G.key){case Vz.SPACE:D()?.toggleSelected();break;case Vz.ENTER:this.handleKeyEnter(G);break;case Vz.LEFT:D()?.setExpanded(!1);break;case Vz.RIGHT:D()?.setExpanded(!0);break}}handleKeyEnter(G){G.preventDefault();let{excelMode:D,readOnly:z}=this.params;if(!D||!!z)return;if(this.params.onAction("apply",void 0,G),this.params.excelMode==="mac")this.eMiniFilter.getInputElement().select()}setModelAndRefresh(G){return this.setSelectedModel(G).then(()=>{if(this.isAlive())this.checkAndRefreshVirtualList()})}setModelIntoUi(G){this.setMiniFilter(this.params.state.state?.miniFilterValue??null,!0);let D=G==null?null:G.values;return this.setModelAndRefresh(D)}getModelFromUi(){let G=this.getSelectedModel();if(!G)return null;return{values:G,filterType:this.filterType}}areNonNullModelsEqual(G,D){return Wf(G.values,D.values)}setIsLoading(G){if(xQ(this.eFilterLoading,G),!G)this.hardRefreshVirtualList=!0}initialiseFilterBodyUi(){this.initVirtualList(),this.initMiniFilter(),this.initLoading()}initLoading(){let G=qf("setFilterLoading",this.beans,this.params.column);if(G)this.eFilterLoadingIcon.appendChild(G)}initVirtualList(){let G=_G(this,"ariaFilterList"),D=!!this.params.treeList,z=this.virtualList=this.createBean(new Lz({cssIdentifier:"filter",ariaRole:D?"tree":"listbox",listName:G})),B=this.eSetFilterList;if(D)B.classList.add("ag-set-filter-tree-list");B.appendChild(z.getGui());let{cellHeight:Q}=this.params;if(Q!=null)z.setRowHeight(Q);let J=(Z,S)=>this.createSetListItem(Z,D,S);z.setComponentCreator(J);let U=(Z,S)=>this.updateSetListItem(Z,S);z.setComponentUpdater(U),this.createVirtualListModel(this.params)}createVirtualListModel(G){let D;if(G.suppressSelectAll)D=new lf(this.displayValueModel);else D=new pf(this.displayValueModel,this.showAddCurrentSelectionToFilter.bind(this));if(G.treeList)D=new mf(D);this.virtualList.setModel(D)}getSelectAllLabel(){let G=this.miniFilterText==null||!this.params.excelMode?"selectAll":"selectAllSearchResults";return _G(this,G)}getAddSelectionToFilterLabel(){return _G(this,"addCurrentSelectionToFilter")}createSetListItem(G,D,z){let B=this.displayValueModel.hasGroups(),{isSelected:Q,isExpanded:J}=this.isSelectedExpanded(G),{value:U,depth:Z,isGroup:S,hasIndeterminateExpandState:X,selectedListener:Y,expandedListener:W}=this.newSetListItemAttributes(G),q={focusWrapper:z,value:U,params:this.params,translate:(_)=>_G(this,_),valueFormatter:this.handler.valueFormatter,item:G,isSelected:Q,isTree:D,depth:Z,groupsExist:B,isGroup:S,isExpanded:J,hasIndeterminateExpandState:X},H=this.createBean(new Of(q));if(H.addEventListener("selectionChanged",Y),W)H.addEventListener("expandedChanged",W);return H}newSetTreeItemAttributes(G){let D=this.displayValueModel.hasGroups();if(G.key===RD)return{value:()=>this.getSelectAllLabel(),isGroup:D,depth:G.depth,hasIndeterminateExpandState:!0,selectedListener:(z)=>this.onSelectAll(z.isSelected),expandedListener:(z)=>this.onExpandAll(z.item,z.isExpanded)};if(G.key===CD)return{value:()=>this.getAddSelectionToFilterLabel(),depth:G.depth,isGroup:!1,hasIndeterminateExpandState:!1,selectedListener:(z)=>{this.addCurrentSelectionToFilter=z.isSelected,this.refreshAfterSelection()}};if(G.children)return{value:this.params.treeListFormatter?.(G.treeKey,G.depth,G.parentTreeKeys)??G.treeKey,depth:G.depth,isGroup:!0,selectedListener:(z)=>this.onGroupItemSelected(z.item,z.isSelected),expandedListener:(z)=>this.onExpandedChanged(z.item,z.isExpanded)};return{value:this.params.treeListFormatter?.(G.treeKey,G.depth,G.parentTreeKeys)??G.treeKey,depth:G.depth,selectedListener:(z)=>this.onItemSelected(z.item.key,z.isSelected)}}newSetListItemAttributes(G){if(this.isSetFilterModelTreeItem(G))return this.newSetTreeItemAttributes(G);if(G===RD)return{value:()=>this.getSelectAllLabel(),selectedListener:(D)=>this.onSelectAll(D.isSelected)};if(G===CD)return{value:()=>this.getAddSelectionToFilterLabel(),selectedListener:(D)=>{this.addCurrentSelectionToFilter=D.isSelected,this.refreshAfterSelection()}};return{value:this.handler.valueModel.allValues.get(G)??null,selectedListener:(D)=>this.onItemSelected(D.item,D.isSelected)}}updateSetListItem(G,D){let{isSelected:z,isExpanded:B}=this.isSelectedExpanded(G);D.refresh(G,z,B)}isSelectedExpanded(G){let D,z;if(this.isSetFilterModelTreeItem(G))if(z=G.expanded,G.key===RD)D=this.isSelectAllSelected();else if(G.key===CD)D=this.isAddCurrentSelectionToFilterChecked();else if(G.children)D=this.areAllChildrenSelected(G);else D=this.selectedKeys.has(G.key);else if(G===RD)D=this.isSelectAllSelected();else if(G===CD)D=this.isAddCurrentSelectionToFilterChecked();else D=this.selectedKeys.has(G);return{isSelected:D,isExpanded:z}}isSetFilterModelTreeItem(G){return G?.treeKey!==void 0}initMiniFilter(){let{eMiniFilter:G}=this;this.updateMiniFilter(),G.onValueChange(()=>this.onMiniFilterInput()),G.setInputAriaLabel(_G(this,"ariaSearchFilterValues")),this.addManagedElementListeners(G.getInputElement(),{keydown:(D)=>this.onMiniFilterKeyDown(D)})}updateMiniFilter(){let{eMiniFilter:G,miniFilterText:D,params:z}=this;G.setDisplayed(!z.suppressMiniFilter),G.setValue(D)}afterGuiAttached(G){super.afterGuiAttached(G),this.resetExpansion(),this.refreshVirtualList();let{eMiniFilter:D}=this;if(D.setInputPlaceholder(_G(this,"searchOoo")),!G?.suppressFocus)if(D.isDisplayed())D.getFocusableElement().focus();else this.virtualList.awaitStable(()=>this.virtualList.focusRow(0))}afterGuiDetached(){super.afterGuiDetached();let{column:G,excelMode:D,model:z,onStateChange:B}=this.params;if(this.beans.colFilter?.shouldKeepStateOnDetach(G))return;if(D)this.resetMiniFilter();if(D||z!==this.state.model)B({model:z,state:this.getState()}),this.showOrHideResults()}canApply(G){return this.params.excelMode?G==null||G.values.length>0:!0}onNewRowsLoaded(){}setFilterValues(G){vz(283),this.handler.setFilterValues(G)}resetFilterValues(){vz(283),this.handler.resetFilterValues()}refreshFilterValues(){vz(283),this.doRefreshFilterValues()}doRefreshFilterValues(){this.handler.refreshFilterValues()}onAnyFilterChanged(){}onMiniFilterInput(G){if(!this.doSetMiniFilter(this.eMiniFilter.getValue()))return;if(G){this.showOrHideResults();return}let{applyMiniFilterWhileTyping:D,readOnly:z,excelMode:B}=this.params,Q=!z&&(D||!!B),J=D&&!z?"debounce":void 0;this.updateUiAfterMiniFilterChange(Q,J)}updateUiAfterMiniFilterChange(G,D){if(G){let{excelMode:z,readOnly:B,model:Q}=this.params;if(z&&!B&&this.miniFilterText==null)this.setModelAndRefresh(Q?.values??null);else this.selectAllMatchingMiniFilter(!0)}this.checkAndRefreshVirtualList(),this.onUiChanged(G?D:"prevent"),this.showOrHideResults()}showOrHideResults(){let G=this.miniFilterText!=null&&this.displayValueModel.getDisplayedValueCount()<1;xQ(this.eFilterNoMatches,G),xQ(this.eSetFilterList,!G)}resetMiniFilter(){this.eMiniFilter.setValue(null,!0),this.doSetMiniFilter(null)}onMiniFilterKeyDown(G){let{excelMode:D,readOnly:z}=this.params;if(G.key===Vz.ENTER&&!D&&!z)this.updateUiAfterMiniFilterChange(!0,"immediately")}focusRowIfAlive(G){if(G==null)return Promise.resolve();return new Promise((D)=>{window.setTimeout(()=>{if(this.isAlive())this.virtualList.focusRow(G);D()},0)})}onSelectAll(G){if(G)this.selectAllMatchingMiniFilter();else this.deselectAllMatchingMiniFilter();this.refreshAfterSelection()}onGroupItemSelected(G,D){let z=(B)=>{if(!B.filterPasses)return;let Q=B.children;if(Q)for(let J of Q.values())z(J);else this.setKeySelected(B.key,D)};z(G),this.refreshAfterSelection()}onItemSelected(G,D){this.setKeySelected(G,D),this.refreshAfterSelection()}onExpandAll(G,D){let z=(B)=>{if(B.filterPasses&&B.available&&B.children){for(let Q of B.children.values())z(Q);B.expanded=D}};z(G),this.refreshAfterExpansion()}onExpandedChanged(G,D){G.expanded=D,this.refreshAfterExpansion()}refreshAfterExpansion(){let G=this.virtualList.getLastFocusedRow();this.updateDisplayedValues("expansion"),this.checkAndRefreshVirtualList(),this.focusRowIfAlive(G)}refreshAfterSelection(){let G=this.virtualList.getLastFocusedRow();this.checkAndRefreshVirtualList(),this.onUiChanged(),this.focusRowIfAlive(G)}setMiniFilter(G,D){this.eMiniFilter.setValue(G,D),this.onMiniFilterInput(D)}doSetMiniFilter(G){if(G=CZ(G),this.miniFilterText===G)return!1;if(G===null)this.addCurrentSelectionToFilter=!1;return this.miniFilterText=G,this.updateDisplayedValues("miniFilter"),!0}getMiniFilter(){return this.miniFilterText}getUiChangeEventParams(){return{miniFilterValue:this.miniFilterText}}getState(){let G=this.miniFilterText;return G?{miniFilterValue:G}:void 0}checkAndRefreshVirtualList(){if(this.virtualList.refresh(!this.hardRefreshVirtualList),this.hardRefreshVirtualList)this.hardRefreshVirtualList=!1}getFilterKeys(){return vz(283),this.handler.getFilterKeys()}getFilterValues(){return vz(283),this.handler.getFilterValues()}refreshVirtualList(){if(this.params.refreshValuesOnOpen)this.doRefreshFilterValues();else this.checkAndRefreshVirtualList()}isSelectAllSelected(){if(!this.params.defaultToNothingSelected){if(this.hasSelections()&&this.isNothingVisibleSelected())return!1;if(this.isEverythingVisibleSelected())return!0}else{if(this.hasSelections()&&this.isEverythingVisibleSelected())return!0;if(this.isNothingVisibleSelected())return!1}return}areAllChildrenSelected(G){let D=(z)=>{if(z.children){let B=!1,Q=!1;for(let J of z.children.values()){if(!J.filterPasses||!J.available)continue;let U=D(J);if(U===void 0)return;if(U)B=!0;else Q=!0;if(B&&Q)return}return B}else return this.selectedKeys.has(z.key)};if(!this.params.defaultToNothingSelected)return D(G);else return this.hasSelections()&&D(G)}resetExpansion(){if(!this.params.treeList)return;let G=this.displayValueModel.getSelectAllItem();if(this.isSetFilterModelTreeItem(G)){let D=(z)=>{let B=z.children;if(B){for(let Q of B.values())D(Q);z.expanded=!1}};D(G),this.updateDisplayedValues("expansion")}}getModelAsString(G){return this.handler.getModelAsString(G)}getPositionableElement(){return this.eSetFilterList}updateDisplayedValues(G,D){if(G==="expansion"){this.displayValueModel.refresh();return}let z=this.handler,B=z.valueModel;if(this.miniFilterText==null){this.displayValueModel.updateDisplayedValuesToAllAvailable((Z)=>B.allValues.get(Z)??null,D,B.availableKeys,G);return}let Q=z.caseFormat(this.formatter(this.miniFilterText)||""),J=(Z)=>Z!=null&&z.caseFormat(Z).includes(Q),U=!!this.params.excelMode&&J(_G(this,"blanks"));this.displayValueModel.updateDisplayedValuesToMatchMiniFilter((Z)=>B.allValues.get(Z)??null,D,B.availableKeys,J,U,G)}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()&&Hf(this.miniFilterText)&&this.miniFilterText.length>0}selectAllMatchingMiniFilter(G=!1){if(this.miniFilterText==null)this.selectedKeys=new Set(this.handler.valueModel.allValues.keys());else{if(G)this.selectedKeys.clear();this.displayValueModel.forEachDisplayedKey((D)=>this.selectedKeys.add(D))}}deselectAllMatchingMiniFilter(){if(this.miniFilterText==null)this.selectedKeys.clear();else this.displayValueModel.forEachDisplayedKey((G)=>this.selectedKeys.delete(G))}setKeySelected(G,D){if(D)this.selectedKeys.add(G);else{if(this.params.excelMode&&this.isEverythingVisibleSelected())this.resetSelectionState(this.displayValueModel.getDisplayedKeys());this.selectedKeys.delete(G)}}isEverythingVisibleSelected(){return!this.displayValueModel.someDisplayedKey((G)=>!this.selectedKeys.has(G))}isNothingVisibleSelected(){return!this.displayValueModel.someDisplayedKey((G)=>this.selectedKeys.has(G))}getSelectedModel(){if(!this.hasSelections())return null;let G=this.isAddCurrentSelectionToFilterChecked()?this.params.model?.values:void 0;if(G?.length){if(this.selectedKeys){let D=new Set([...G,...this.selectedKeys]);return Array.from(D)}return Array.from(G)}return Array.from(this.selectedKeys)}setSelectedModel(G){let D=this.handler,z=D.valueModel;return z.allKeys.then((B)=>{if(G==null)this.resetSelectionState(B??[]);else{this.selectedKeys.clear();let Q=new Map;z.allValues.forEach((J,U)=>{Q.set(D.caseFormat(U),U)}),G.forEach((J)=>{let U=D.caseFormat(CZ(J)),Z=Q.get(U);if(Z!==void 0)this.selectedKeys.add(Z)})}})}resetSelectionState(G){if(this.params.defaultToNothingSelected)this.selectedKeys.clear();else this.selectedKeys=new Set(G)}getFilterHandler(){return this.handler}destroy(){this.virtualList=this.destroyBean(this.virtualList);for(let G of this.handlerDestroyFuncs??[])G();this.handler=void 0,this.displayValueModel=void 0,this.selectedKeys.clear(),super.destroy()}},lf=class{constructor(G){this.model=G}getRowCount(){return this.model.getDisplayedValueCount()}getRow(G){return this.model.getDisplayedItem(G)}areRowsEqual(G,D){return G===D}},pf=class{constructor(G,D){this.model=G,this.showAddCurrentSelectionToFilter=D}getRowCount(){let D=this.showAddCurrentSelectionToFilter()?2:1;return this.model.getDisplayedValueCount()+D}getRow(G){if(G===0)return this.model.getSelectAllItem();let D=this.showAddCurrentSelectionToFilter(),z=D?2:1;if(G===1&&D)return this.model.getAddSelectionToFilterItem();return this.model.getDisplayedItem(G-z)}areRowsEqual(G,D){return G===D}},mf=class{constructor(G){this.model=G}getRowCount(){return this.model.getRowCount()}getRow(G){return this.model.getRow(G)}areRowsEqual(G,D){if(G==null&&D==null)return!0;return G!=null&&D!=null&&G.treeKey===D.treeKey&&G.depth===D.depth}},zN=class extends GN{constructor(G,D,z,B,Q){super();this.createKey=G,this.caseFormat=D,this.getValue=z,this.isTreeDataOrGrouping=B,this.isTreeData=Q}extractUniqueValuesAsync(G,D){return new ef((z)=>{if(this.beans.rowModel.rowCountReady)z(this.extractUniqueValues(G,D));else{let[B]=this.addManagedEventListeners({rowCountReady:()=>{B?.(),z(this.extractUniqueValues(G,D))}})}})}extractUniqueValues(G,D){let z=new Map,B=this.extractExistingFormattedKeys(D),Q=new Set,J=this.isTreeData(),U=this.isTreeDataOrGrouping(),Z=this.beans.rowGroupColsSvc?.columns,S=this.gos.get("groupAllowUnbalanced"),X=(Y,W)=>{let q=this.caseFormat(Y);if(!Q.has(q)){Q.add(q);let H=Y,_=DN(W),k=B?.get(q);if(k!=null)H=k,_=D.get(k);z.set(H,_)}};return this.beans.rowModel.forEachLeafNode((Y)=>{if(!Y.data||!G(Y))return;if(U){this.addValueForTreeDataOrGrouping(Y,J,Z,X,S);return}let W=this.getValue(Y);if(W!=null&&Array.isArray(W)){for(let q of W)X(this.createKey(q,Y),q);if(W.length===0)X(null,null)}else X(this.createKey(W,Y),W)}),z}addValueForTreeDataOrGrouping(G,D,z=[],B,Q){let J;if(D){if(G.childrenAfterGroup?.length)return;J=G.getRoute()??[G.key??G.id]}else J=z.map((Z)=>this.beans.valueSvc.getKeyForNode(Z,G)),J.push(this.getValue(G));let U=m1(J,D,Q);B(this.createKey(U),U)}extractExistingFormattedKeys(G){if(!G)return null;let D=new Map;return G.forEach((z,B)=>{D.set(this.caseFormat(B),B)}),D}},BN=class{constructor(G){this.caseFormat=G,this.keys=null}isNull(){return this.keys==null}isEmpty(){return!this.keys?.size}update(G){let D=new Set;this.keys=D;let z=G?.values;if(z){let B=this.caseFormat;for(let Q=0,J=z.length;Q{return G[G.PROVIDED_LIST=0]="PROVIDED_LIST",G[G.PROVIDED_CALLBACK=1]="PROVIDED_CALLBACK",G[G.TAKEN_FROM_GRID_VALUES=2]="TAKEN_FROM_GRID_VALUES",G})(A7||{}),dQ=A7,$N=class extends QN{constructor(G,D,z,B,Q){super();this.clientSideValuesExtractor=G,this.caseFormat=D,this.createKey=z,this.isTreeDataOrGrouping=B,this.params=Q,this.allValues=new Map,this.availableKeys=new Set,this.providedValues=null,this.initialised=!1}postConstruct(){let G=this.params,D=G.handlerParams.filterParams.values;if(this.updateParams(G),D==null)this.valuesType=2;else this.valuesType=Array.isArray(D)?0:1,this.providedValues=D;this.updateAllValues()}refresh(G){let D=G.handlerParams;if(D.source!=="colDef")return;let{values:z,suppressSorting:B}=D.filterParams,Q=this.providedValues,J=this.params.handlerParams.filterParams.suppressSorting;if(this.params=G,this.updateParams(G),this.providedValues=z??null,this.providedValues!==Q||B!==J){if(!z||z.length===0)this.valuesType=2,this.providedValues=null;else this.valuesType=Array.isArray(z)?0:1;this.updateAllValues()}}updateParams(G){let{handlerParams:{colDef:D,filterParams:{comparator:z,treeList:B,treeListPathGetter:Q}},usingComplexObjects:J}=G,U=z??D.comparator,Z=this.isTreeDataOrGrouping(),S;if(Z&&!U)S=hf();else if(B&&!Q&&!U)S=([X,Y],[W,q])=>uZ(Y,q);else S=([X,Y],[W,q])=>U(Y,q);this.entryComparator=S,this.keyComparator=U??uZ,this.compareByValue=!!(J&&U||Z||B&&!Q)}updateAllValues(){return this.allKeys=new T0((G)=>{switch(this.valuesType){case 2:this.getValuesFromRowsAsync().then((D)=>G(this.processAllValues(D)));break;case 0:{G(this.processAllValues(this.uniqueValues(this.validateProvidedValues(this.providedValues))));break}case 1:{this.dispatchLocalEvent({type:"loadingStart"});let D=this.providedValues,{column:z,colDef:B}=this.params.handlerParams,Q=JN(this.gos,{success:(J)=>{this.dispatchLocalEvent({type:"loadingEnd"}),G(this.processAllValues(this.uniqueValues(this.validateProvidedValues(J))))},colDef:B,column:z});window.setTimeout(()=>D(Q),0);break}}}),this.allKeys.then((G)=>{this.updateAvailableKeys(G??[]),this.initialised=!0}),this.allKeys}getAvailableValues(G){return this.sortKeys(this.getValuesFromRows(G))}overrideValues(G){return this.allKeys.then(()=>{this.valuesType=0,this.providedValues=G})}refreshAvailable(){return new T0((G)=>{if(this.showAvailableOnly()){this.allKeys.then((D)=>{let z=D??[];this.updateAvailableKeys(z),G(!0)});return}G(!1)})}refreshAll(){return new T0((G)=>{this.allKeys.then(()=>{this.updateAllValues().then(()=>{G()})})})}isLoading(){return!this.initialised&&this.valuesType===1}isInitialised(){return this.initialised}getValueForFormatter(G){return this.initialised?this.allValues.get(G):G}getAvailableKeys(G){return this.initialised?G.filter((D)=>this.availableKeys.has(D)):G}getParamsForValuesFromRows(G){if(!this.clientSideValuesExtractor){UN(113);return}return G&&!this.params.handlerParams.filterParams.caseSensitive?this.allValues:void 0}getValuesFromRows(G){let D=this.getParamsForValuesFromRows(!0);return this.clientSideValuesExtractor?.extractUniqueValues(G,D)??null}getValuesFromRowsAsync(){let G=this.getParamsForValuesFromRows(!1);return this.clientSideValuesExtractor?.extractUniqueValuesAsync(()=>!0,G)??T0.resolve(null)}processAllValues(G){let D=this.sortKeys(G);return this.allValues=G??new Map,D}uniqueValues(G){let D=new Map,z=new Set,{caseFormat:B,createKey:Q}=this;for(let J of G??[]){let U=ZN(J),Z=Q(U),S=B(Z);if(!z.has(S))z.add(S),D.set(Z,U)}return D}validateProvidedValues(G){if(this.params.usingComplexObjects&&G?.length){let D=G[0];if(D&&typeof D!=="object"&&typeof D!=="function")if(this.createKey(D)==null)jZ(209);else jZ(210)}return G}sortKeys(G){let D=G??new Map,z=this.params.handlerParams.filterParams;if(z.suppressSorting)return Array.from(D.keys());let B;if(this.compareByValue)B=Array.from(D.entries()).sort(this.entryComparator).map(([Q])=>Q);else B=Array.from(D.keys()).sort(this.keyComparator);if(z.excelMode&&D.has(null))B=B.filter((Q)=>Q!=null),B.push(null);return B}showAvailableOnly(){return this.valuesType===2}updateAvailableKeys(G){let D=this.showAvailableOnly()?this.getAvailableValues((z)=>this.params.handlerParams.doesRowPassOtherFilter(z)):G;this.availableKeys=new Set(D),window.setTimeout(()=>{if(this.isAlive())this.dispatchLocalEvent({type:"availableValuesChanged"})})}},LN=class extends tf{constructor(){super(...arguments);this.filterType="set",this.treeDataTreeList=!1,this.groupingTreeList=!1,this.caseSensitive=!1,this.noValueFormatterSupplied=!1}init(G){this.updateParams(G);let D=this.isTreeDataOrGrouping.bind(this),z=()=>this.treeDataTreeList,B=this.createKey,Q=this.caseFormat.bind(this),{gos:J,beans:U}=this,Z=rf(J,U.rowModel)?this.createManagedBean(new zN(B,Q,G.getValue,D,z)):void 0,S=this.createManagedBean(new $N(Z,Q,B,D,{handlerParams:G,usingComplexObjects:!!(G.filterParams.keyCreator??G.colDef.keyCreator)}));this.addManagedListeners(S,{availableValuesChanged:G.onModelAsStringChange}),this.valueModel=S,this.appliedModel=new BN(this.caseFormat.bind(this)),this.appliedModel.update(G.model),this.validateModel(G),this.addEventListenersForDataChanges()}refresh(G){this.updateParams(G),this.valueModel.refresh({handlerParams:G,usingComplexObjects:!!(G.filterParams.keyCreator??G.colDef.keyCreator)}),this.appliedModel.update(G.model),this.validateModel(G)}updateParams(G){this.params=G;let{colDef:D,filterParams:{caseSensitive:z,treeList:B,keyCreator:Q,valueFormatter:J}}=G;this.caseSensitive=!!z;let U=!!D.showRowGroup;this.treeDataTreeList=this.gos.get("treeData")&&!!B&&U,this.groupingTreeList=!!this.beans.rowGroupColsSvc?.columns.length&&!!B&&U;let Z=Q??D.keyCreator;this.createKey=this.generateCreateKey(Z,this.isTreeDataOrGrouping()),this.setValueFormatter(J,Z,!!B,!!D.refData)}doesFilterPass(G){let{appliedModel:D,treeDataTreeList:z,groupingTreeList:B}=this;if(D.isNull())return!0;if(D.isEmpty())return!1;let{node:Q}=G;if(z)return this.doesFilterPassForTreeData(Q);if(B)return this.doesFilterPassForGrouping(Q);let J=this.params.getValue(Q);if(J!=null&&Array.isArray(J)){if(J.length===0)return D.has(null);return J.some((U)=>D.has(this.createKey(U,Q)))}return D.has(this.createKey(J,Q))}getFormattedValue(G){let D=this.valueModel.getValueForFormatter(G);if(this.noValueFormatterSupplied&&this.isTreeDataOrGrouping()&&Array.isArray(D))D=af(D);let z=this.beans.valueSvc.formatValue(this.params.column,null,D,this.valueFormatter,!1);return(z==null?nQ(D):z)??_G(this,"blanks")}getModelAsString(G,D){let{values:z}=G??{},B=D==="filterToolPanel";if(z==null)return B?_G(this,"filterSummaryListInactive"):"";let Q=this.valueModel.getAvailableKeys(z),J=Q.length,U=B?3:10,Z=Q.slice(0,U).map((S)=>this.getFormattedValue(S));if(B){let S=Z.join(_G(this,"filterSummaryListSeparator"));if(J>3)return _G(this,"filterSummaryListLong",[S,String(J-3)]);else return _G(this,"filterSummaryListShort",[S])}return`(${J}) ${Z.join(",")}${J>10?",...":""}`}onAnyFilterChanged(){window.setTimeout(()=>{if(!this.isAlive())return;this.valueModel.refreshAvailable().then((G)=>{this.dispatchLocalEvent({type:"anyFilterChanged",updated:!!G})})})}onNewRowsLoaded(){this.syncAfterDataChange()}setFilterValues(G){this.valueModel.overrideValues(G).then(()=>{this.refreshFilterValues()})}resetFilterValues(){this.valueModel.valuesType=dQ.TAKEN_FROM_GRID_VALUES,this.syncAfterDataChange()}refreshFilterValues(G){if(!this.valueModel.isInitialised())return;this.valueModel.refreshAll().then(()=>{this.dispatchLocalEvent({type:"dataChanged",hardRefresh:!0}),this.validateModel(this.params,void 0,!G)})}getFilterKeys(){return Array.from(this.valueModel.allValues.keys())}getFilterValues(){return Array.from(this.valueModel.allValues.values())}isTreeDataOrGrouping(){return this.treeDataTreeList||this.groupingTreeList}caseFormat(G){if(G==null||typeof G!=="string")return G;return this.caseSensitive?G:G.toUpperCase()}addEventListenersForDataChanges(){this.addManagedPropertyListeners(["groupAllowUnbalanced"],()=>this.syncAfterDataChange());let G=of(this,this.syncAfterDataChange.bind(this),0);this.addManagedEventListeners({cellValueChanged:(D)=>{if(D.column===this.params.column)G()}})}syncAfterDataChange(){if(!this.isValuesTakenFromGrid())return;this.valueModel.refreshAll().then(()=>{this.dispatchLocalEvent({type:"dataChanged"}),this.validateModel(this.params,{afterDataChange:!0})})}validateModel(G,D,z){let B=this.valueModel;B.allKeys.then(()=>{let Q=G.model;if(Q==null)return;let J=new Map,U=(H)=>J.set(this.caseFormat(H),H);if(z)for(let H of B.availableKeys)U(H);else B.allValues.forEach((H,_)=>U(_));let Z=[],S=!1;for(let H of Q.values){let _=this.caseFormat(iQ(H)),k=J.get(_);if(k!==void 0){if(Z.push(k),k!==H)S=!0}else S=!0}let X=Z.length,Y=G.filterParams;if(X===0&&Y.excelMode){G.onModelChange(null,D);return}let q=!Y.defaultToNothingSelected&&(this.valueModel.valuesType===dQ.TAKEN_FROM_GRID_VALUES||!Y.suppressClearModelOnRefreshValues)&&X===J.size;if(S||!Q.filterType||q){let H=q?null:{filterType:this.filterType,values:Z};G.onModelChange(H,D)}})}isValuesTakenFromGrid(){return this.valueModel.valuesType===dQ.TAKEN_FROM_GRID_VALUES}doesFilterPassForTreeData(G){if(G.childrenAfterGroup?.length)return!1;let{gos:D,appliedModel:z}=this;return z.has(this.createKey(m1(G.getRoute()??[G.key??G.id],!0,D.get("groupAllowUnbalanced"))))}doesFilterPassForGrouping(G){let{appliedModel:D,params:z,gos:B,beans:{rowGroupColsSvc:Q,valueSvc:J}}=this,U=(Q?.columns??[]).map((Z)=>J.getKeyForNode(Z,G));return U.push(z.getValue(G)),D.has(this.createKey(m1(U,!1,B.get("groupAllowUnbalanced"))))}generateCreateKey(G,D){if(D&&!G)return OZ(250),()=>null;if(G)return(z,B=null)=>{let Q=this.getKeyCreatorParams(z,B);return iQ(G(Q))};return(z)=>iQ(nQ(z))}getKeyCreatorParams(G,D=null){let{colDef:z,column:B}=this.params;return sf(this.gos,{value:G,colDef:z,column:B,node:D,data:D?.data})}setValueFormatter(G,D,z,B){let Q=G;if(!Q){if(D&&!z){OZ(249);return}if(this.noValueFormatterSupplied=!0,!B)Q=(J)=>nQ(J.value)}this.valueFormatter=Q}getCrossFilterModel(G){let{createKey:D,valueModel:z,params:B}=this;return G(D,z.availableKeys,B.model?.values)}destroy(){this.appliedModel.destroy(),super.destroy(),this.valueModel=void 0}},qN={tag:"div",cls:"ag-floating-filter-input ag-set-floating-filter-input",role:"presentation",children:[{tag:"ag-input-text-field",ref:"eFloatingFilterText"}]},HN=class extends XN{constructor(){super(qN,[SN]);this.eFloatingFilterText=YN}init(G){this.params=G,this.eFloatingFilterText.setDisabled(!0).addGuiEventListener("click",()=>this.params.showParentFilter()),this.setParams(G)}setParams(G){let D=this.beans.colNames.getDisplayNameForColumn(G.column,"header",!0),z=this.getLocaleTextFunc();if(this.eFloatingFilterText.setInputAriaLabel(`${D} ${z("ariaFilterInput","Filter Input")}`),this.gos.get("enableFilterHandlers")){let B=G;this.updateFloatingFilterText(B.model)}}refresh(G){this.params=G,this.setParams(G)}onParentModelChanged(G){this.updateFloatingFilterText(G)}parentSetFilterInstance(G){this.params.parentFilterInstance((D)=>{if(!(D instanceof M7)){WN(248);return}G(D)})}updateFloatingFilterText(G){if(G==null)this.eFloatingFilterText.setValue("");else if(this.gos.get("enableFilterHandlers"))this.eFloatingFilterText.setValue(this.params.getHandler().getModelAsString?.(G)??"");else this.parentSetFilterInstance((D)=>{this.eFloatingFilterText.setValue(D.getModelAsString(G))})}},R7={moduleName:"SetFilter",version:j,userComponents:{agSetColumnFilter:{classImp:M7,params:{useForm:!0},processParams:(G)=>{return cf(G),G}},agSetColumnFloatingFilter:HN},dynamicBeans:{agSetColumnFilterHandler:LN},icons:{setFilterGroupClosed:"tree-closed",setFilterGroupOpen:"tree-open",setFilterGroupIndeterminate:"tree-indeterminate",setFilterLoading:"loading"},dependsOn:[i,Sf]},NN=".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 FN(G,D,z){return G.getCompDetails(D,EN,void 0,z,!0)}var EN={name:"statusPanel",optionalMethods:["refresh"]},IN={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]}},MN={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"}]},AN=class extends kN{constructor(){super(MN);this.updateQueued=!1,this.panelsPromise=y0.resolve(),this.eStatusBarLeft=lQ,this.eStatusBarCenter=lQ,this.eStatusBarRight=lQ,this.compDestroyFunctions={},this.registerCSS(NN)}wireBeans(G){this.userCompFactory=G.userCompFactory,this.statusBarSvc=G.statusBarSvc}postConstruct(){this.processStatusPanels(new Map),this.addManagedPropertyListeners(["statusBar"],this.handleStatusBarChanged.bind(this)),wN(this.beans,this,this.getGui())}getFocusableContainerName(){return"statusBar"}getValidPanels(){let G=this.gos,D=G.get("statusBar")?.statusPanels;if(!D)return D;return D.filter((z)=>{let{rowModels:B,warnArgs:Q}=IN[z.statusPanel]??{};if(!B)return!0;if(B.includes(G.get("rowModelType")))return!0;return fN(...Q),!1})}processStatusPanels(G){let D=this.getValidPanels();if(D){let z=D.filter((J)=>J.align==="left"),B=D.filter((J)=>J.align==="center"),Q=D.filter((J)=>!J.align||J.align==="right");this.panelsPromise=y0.all([this.createAndRenderComponents(z,this.eStatusBarLeft,G),this.createAndRenderComponents(B,this.eStatusBarCenter,G),this.createAndRenderComponents(Q,this.eStatusBarRight,G)])}else this.setDisplayed(!1)}handleStatusBarChanged(){if(this.updateQueued)return;this.updateQueued=!0,this.panelsPromise.then(()=>{this.updateStatusBar(),this.updateQueued=!1})}updateStatusBar(){let G=this.getValidPanels(),D=Array.isArray(G)&&G.length>0;this.setDisplayed(D);let z=new Map;if(D)for(let B of G){let Q=B.key??B.statusPanel,J=this.statusBarSvc.getStatusPanel(Q);if(J?.refresh){let U=PZ(this.gos,{...B.statusPanelParams??{},key:Q});if(J.refresh(U))z.set(Q,J),delete this.compDestroyFunctions[Q],KN(J.getGui())}}if(this.resetStatusBar(),D)this.processStatusPanels(z)}resetStatusBar(){pQ(this.eStatusBarLeft),pQ(this.eStatusBarCenter),pQ(this.eStatusBarRight),this.destroyComponents(),this.statusBarSvc.unregisterAllComponents()}destroy(){this.destroyComponents(),super.destroy()}destroyComponents(){for(let G of Object.values(this.compDestroyFunctions))G();this.compDestroyFunctions={}}createAndRenderComponents(G,D,z){let B=[];for(let Q of G){let J=Q.key||Q.statusPanel,U=z.get(J),Z;if(U)Z=y0.resolve(U);else{let S=FN(this.userCompFactory,Q,PZ(this.gos,{key:J}));if(S==null)continue;Z=S.newAgStackInstance()}B.push({key:J,promise:Z})}return y0.all(B.map((Q)=>Q.promise)).then(()=>{for(let Q of B)Q.promise.then((J)=>{let U=()=>{this.destroyBean(J)};if(this.isAlive())this.statusBarSvc.registerStatusPanel(Q.key,J),D.appendChild(J.getGui()),this.compDestroyFunctions[Q.key]=U;else U()})})}},RN={selector:"AG-STATUS-BAR",component:AN},yN={tag:"div",cls:"ag-status-name-value",children:[{tag:"span",ref:"eLabel"},": ",{tag:"span",ref:"eValue",cls:"ag-status-name-value-value"}]},xN=BigInt(Number.MIN_SAFE_INTEGER),cN=BigInt(Number.MAX_SAFE_INTEGER),q0=class extends gN{constructor(){super(yN);this.eLabel=gZ,this.eValue=gZ}setLabel(G,D){this.setDisplayed(!1),this.eLabel.textContent=this.getLocaleTextFunc()(G,D)}setValue(G,D){let z=null,B;if(typeof G==="bigint"){if(B=G,G>=xN&&G<=cN)z=Number(G)}else z=G;this.eValue.textContent=this.valueFormatter(TN(this.gos,{value:z,bigintValue:B,totalRows:D,key:this.key}))}},hN={selector:"AG-NAME-VALUE",component:q0},C7=(G)=>{let D=0;return G.forEachNodeAfterFilter((z)=>{if(z.data)D++}),D},H0=(G)=>{let D=0;return G.forEachNode((z)=>{if(z.data)D++}),D};function iN(G,D){if(typeof G!=="number")return"";return vN(Math.round(G*100)/100,D)}var nN={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"}]},dN=class extends CN{constructor(){super(nN,[hN]);this.sumAggregationComp=Oz,this.countAggregationComp=Oz,this.minAggregationComp=Oz,this.maxAggregationComp=Oz,this.avgAggregationComp=Oz}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(G){this.refresh(G)}refresh(G){this.params=G;let D=G.valueFormatter??((B)=>{let{value:Q,bigintValue:J}=B;if(J!=null)return J.toString();return iN(Q,this.getLocaleTextFunc.bind(this))}),z=["avg","count","min","max","sum"];for(let B of z){let Q=this.getAllowedAggregationValueComponent(B);if(Q)Q.key=B,Q.valueFormatter=D.bind(this)}return this.onCellSelectionChanged(),!0}setAggregationComponentValue(G,D,z){let B=this.getAllowedAggregationValueComponent(G),Q=H0(this.beans.rowModel);if(bN(B)&&B)B.setValue(D,Q),B.setDisplayed(z);else this.getAggregationValueComponent(G)?.setDisplayed(!1)}getAllowedAggregationValueComponent(G){let{aggFuncs:D}=this.params;if(!D||D.includes(G))return this.getAggregationValueComponent(G);return null}getAggregationValueComponent(G){let D=`${G}AggregationComp`;return this[D]}onCellSelectionChanged(){let G=this.beans,{rangeSvc:D,valueSvc:z}=G,B=D?.getCellRanges(),Q=0,J=0n,U=!1,Z=!1,S=0,X=0,Y=null,W=null,q=null,H=null,_=(R)=>{if(typeof R==="number"){if(Q+=R,Y===null||RW)W=R;if(!Number.isInteger(R)||!Number.isSafeInteger(R))Z=!0;else{let O=BigInt(R);if(J+=O,q===null||OH)H=O}}else{if(U=!0,J+=R,q===null||RH)H=R;let O=Number(R);if(Q+=O,Y===null||OW)W=O}X++},k={};if(B?.length&&D)for(let R=0;R{if(u===null)return;let b=VN({rowPinned:u.rowPinned,column:P,rowIndex:u.rowIndex});if(k[b])return;k[b]=!0;let g=uN(G,u);if(mQ(g))return;let c=z.getValue(P,g,"data");if(mQ(c)||c==="")return;if(S++,typeof c==="object"&&"value"in c){if(c=c.value,c==="")return}if(typeof c==="string"){let s=c.trim();if(s==="")return;let m=Number(s);if(!Number.isFinite(m))return;if(Q+m>=Number.MAX_SAFE_INTEGER||Q+m<=Number.MIN_SAFE_INTEGER||m>=Number.MAX_SAFE_INTEGER||m<=Number.MIN_SAFE_INTEGER){if(c=PN(s),c===null)c=m}else c=m}if(typeof c==="number"&&!isNaN(c)||typeof c==="bigint")_(c)}),u=ON(G,u)}}let w=S>1,K=X>1,f=U&&!Z,N;if(f)N=J/BigInt(X);else N=Q/X;let F=K?f?J:Q:null,E=K?f?q:Y:null,I=K?f?H:W:null,V=K?N:null,A=K;this.setAggregationComponentValue("count",S,w),this.setAggregationComponentValue("sum",F,K),this.setAggregationComponentValue("min",E,K),this.setAggregationComponentValue("max",I,K),this.setAggregationComponentValue("avg",V,A)}},pN=class extends q0{postConstruct(){this.setLabel("filteredRows","Filtered"),this.addCss("ag-status-panel"),this.addCss("ag-status-panel-filtered-row-count"),this.setDisplayed(!0);let G=this.onDataChanged.bind(this);this.addManagedEventListeners({modelUpdated:G})}onDataChanged(){let{rowModel:G}=this.beans,D=H0(G),z=C7(G);this.setValue(z,D),this.setDisplayed(D!==z)}init(G){this.refresh(G),this.onDataChanged()}updateValueFormatter(G){this.valueFormatter=G??(({value:D})=>lN(D,this.getLocaleTextFunc.bind(this)))}refresh(G){let{key:D,valueFormatter:z}=G;return this.key=D,this.updateValueFormatter(z),!0}},tN=class extends q0{postConstruct(){this.setLabel("selectedRows","Selected"),this.addCss("ag-status-panel"),this.addCss("ag-status-panel-selected-row-count");let G=this.onRowSelectionChanged.bind(this);this.addManagedEventListeners({modelUpdated:G,selectionChanged:G})}onRowSelectionChanged(){let{selectionSvc:G,rowModel:D}=this.beans,z=G?.getSelectionCount()??0,B=H0(D);if(this.setValue(z,B),z<0){this.setDisplayed(!0);return}this.setDisplayed(z>0)}init(G){this.refresh(G),this.onRowSelectionChanged()}updateValueFormatter(G){this.valueFormatter=G??(({value:D})=>{if(D==null||D>=0)return mN(D,this.getLocaleTextFunc.bind(this));return this.getLocaleTextFunc()("statusBarLastRowUnknown","?")})}refresh(G){let{key:D,valueFormatter:z}=G;return this.key=D,this.updateValueFormatter(z),!0}},sN=class extends q0{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:G}=this.beans,D=C7(G),z=H0(G);this.setValue(D,z)}init(G){this.refresh(G),this.onDataChanged()}updateValueFormatter(G){this.valueFormatter=G??(({value:D,totalRows:z})=>{let B=this.getLocaleTextFunc.bind(this),Q=TZ(D,B),J=TZ(z??D,B);if(D===z)return Q;let U=B();return`${Q} ${U("of","of")} ${J}`})}refresh(G){let{key:D,valueFormatter:z}=G;return this.key=D,this.updateValueFormatter(z),!0}},rN=class extends q0{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 G=H0(this.beans.rowModel);this.setValue(G,G)}init(G){this.refresh(G),this.onDataChanged()}updateValueFormatter(G){this.valueFormatter=G??(({value:D})=>oN(D,this.getLocaleTextFunc.bind(this)))}refresh(G){let{key:D,valueFormatter:z}=G;return this.key=D,this.updateValueFormatter(z),!0}};function eN(G,D){let z=G.statusBarSvc?.getStatusPanel(D);return aN(z)}var DF=class extends GF{constructor(){super();this.beanName="statusBarSvc",this.comps=new Map}registerStatusPanel(G,D){this.comps.set(G,D)}unregisterStatusPanel(G){this.comps.delete(G)}unregisterAllComponents(){this.comps.clear()}getStatusPanel(G){return this.comps.get(G)}destroy(){this.unregisterAllComponents(),super.destroy()}},xB={moduleName:"StatusBar",version:j,beans:[DF],userComponents:{agAggregationComponent:dN,agTotalRowCountComponent:rN,agFilteredRowCountComponent:pN,agTotalAndFilteredRowCountComponent:sN,agSelectedRowCountComponent:tN},selectors:[RN],apiFunctions:{getStatusPanel:eN},dependsOn:[i,_N]};function V7(G){if(G.excelCreator?.getFactoryMode()==="MULTI_SHEET")return BF(161),!1;return!0}function QF(G,D){if(V7(G))return G.excelCreator?.getDataAsExcel(D);return}function JF(G,D){if(V7(G))G.excelCreator?.exportDataAsExcel(D)}function UF(G,D){return G.excelCreator?.setFactoryMode("MULTI_SHEET"),G.excelCreator?.getSheetDataForExcel(D)}function ZF(G,D){return G.excelCreator?.getMultipleSheetsAsExcel(D)}function $F(G,D){G.excelCreator?.exportMultipleSheetsAsExcel(D)}var cB={moduleName:"ExcelExport",version:j,beans:[tX],apiFunctions:{getDataAsExcel:QF,exportDataAsExcel:JF,getSheetDataForExcel:UF,getMultipleSheetsAsExcel:ZF,exportMultipleSheetsAsExcel:$F},dependsOn:[zF,i]};function hB(G){let{filters:D}=G;return D&&D.length>0?D:[{filter:"agTextColumnFilter"},{filter:"agSetColumnFilter"}]}function FB(G,D){if(G==null)return;for(let z=G.length-1;z>=0;z--)D(G[z],z)}function IF(G,D){if(D.title!=null)return D.title;return G instanceof EF?G.getFilterTitle():"Filter"}function EB(G,D,z,B){let Q=[],J=G?.filterModels;for(let U=0;UU==null)?null:{filterType:"multi",filterModels:Q}}function dG(G,D){return G?.filterModels?.[D]??null}function IB(G,D,z,B){let Q=z.filterValueGetter;return Q?G.colFilter.createGetValue(D,Q):B}var b7=class extends kF{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:(G)=>this.onFocusIn(G)})}refreshGui(G){if(G===this.lastOpenedInContainer)return dD.resolve();return this.tabGuardFeature.removeAllChildrenExceptTabGuards(),this.destroyChildren(),dD.all(this.getFilterWrappers().map((D,z)=>{if(!D)return dD.resolve(null);let B=this.getFilterFromWrapper(D),Q=this.getCompFromWrapper(D),J=this.filterDefs[z],U=IF(B,J),Z;if(J.display==="subMenu"&&G!=="toolPanel")Z=this.insertFilterMenu(Q,B,U).then((S)=>S.getGui());else if(J.display==="subMenu"||J.display==="accordion"){let S=this.insertFilterGroup(B,Q,U);Z=dD.resolve(S.getGui())}else Z=dD.resolve(Q.getGui());return Z})).then((D)=>{D.forEach((z,B)=>{if(!z)return;if(B>0)this.appendChild(wF({tag:"div",cls:"ag-filter-separator"}));this.appendChild(z)}),this.filterGuis=D,this.lastOpenedInContainer=G})}destroyChildren(){for(let G of this.guiDestroyFuncs)G();this.guiDestroyFuncs.length=0,this.filterGuis.length=0}insertFilterMenu(G,D,z){let B=G.getGui();FF(B,"dialog");let Q=this.createBean(new O3),J={getGui:()=>G.getGui(),afterGuiAttached:(U)=>{if(G.afterGuiAttached?.(U),G!==D)D.afterGuiAttached?.(U)}};return Q.init({menuItemDef:{name:z,subMenu:[],subMenuRole:"dialog",cssClasses:["ag-multi-filter-menu-item"],menuItem:G7,menuItemParams:{cssClassPrefix:"ag-compact-menu-option",isCompact:!0}},level:0,isAnotherSubMenuOpen:()=>!1,childComponent:J,contextParams:{column:null,node:null,value:null}}).then(()=>{Q.setParentComponent(this),this.guiDestroyFuncs.push(()=>this.destroyBean(Q)),this.addManagedListeners(Q,{menuItemActivated:(Z)=>{if(this.lastActivatedMenuItem&&this.lastActivatedMenuItem!==Z.menuItem)this.lastActivatedMenuItem.deactivate();this.lastActivatedMenuItem=Z.menuItem}});let U=Q.getGui();return Q.addManagedElementListeners(U,{keydown:(Z)=>{let{key:S}=Z;switch(S){case uz.UP:case uz.RIGHT:case uz.DOWN:case uz.LEFT:if(Z.preventDefault(),S===uz.RIGHT)Q.openSubMenu(!0);break}},focusin:()=>Q.activate(),focusout:()=>{if(!Q.isSubMenuOpen()&&!Q.isSubMenuOpening())Q.deactivate()}}),Q})}insertFilterGroup(G,D,z){let B=this.createBean(new jG({title:z,cssIdentifier:"multi-filter"}));if(this.guiDestroyFuncs.push(()=>this.destroyBean(B)),B.addItem(D.getGui()),B.toggleGroupExpand(!1),G.afterGuiAttached)B.addManagedListeners(B,{expanded:()=>G.afterGuiAttached({container:this.lastOpenedInContainer,suppressFocus:!0,hidePopup:this.hidePopup})});return B}afterGuiAttached(G){let D;if(G)this.hidePopup=G.hidePopup,D=this.refreshGui(G.container);else this.hidePopup=void 0,D=dD.resolve();let z=G?.suppressFocus;D.then(()=>{let{filterDefs:B,filterGuis:Q,beans:J}=this,U=this.getFilterWrappers(),Z=!!z;if(B)FB(B,(X,Y)=>{let W=Y===0,q=X.display&&X.display!=="inline",H=z||!W||q,_={...G??{},suppressFocus:H},k=U[Y],w=k?this.getFilterFromWrapper(k):void 0;if(k){let K=this.getCompFromWrapper(k);if(K!==w)K.afterGuiAttached(_)}if(w){if(this.executeFunctionIfExistsOnFilter(w,"afterGuiAttached",_),W&&!H)Z=!0}if(!z&&W&&q){let K=Q[Y];if(K){if(!KF(K))K.focus({preventScroll:!0});Z=!0}}});let S=fF(J);if(!Z&&(NF(J)||this.getGui().contains(S)))this.forceFocusOutOfContainer(!0)})}afterGuiDetached(){this.executeFunctionIfExists("afterGuiDetached")}onAnyFilterChanged(){this.executeFunctionIfExists("onAnyFilterChanged",(G)=>this.executeOnWrapper(G,"onAnyFilterChanged"))}onNewRowsLoaded(){this.executeFunctionIfExists("onNewRowsLoaded",(G)=>this.executeOnWrapper(G,"onNewRowsLoaded"))}destroy(){this.destroyChildren(),this.hidePopup=void 0,super.destroy()}executeOnWrapper(G,D){}executeFunctionIfExists(G,D){FB(this.getFilterWrappers(),(z)=>{if(z)D?.(z),this.executeFunctionIfExistsOnFilter(this.getFilterFromWrapper(z),G)})}executeFunctionIfExistsOnFilter(G,D,...z){let B=G[D];if(typeof B==="function")B.apply(G,z)}onFocusIn(G){let D=this.lastActivatedMenuItem;if(D!=null&&!D.getGui().contains(G.target))D.deactivate(),this.lastActivatedMenuItem=null}},v7=class extends b7{constructor(){super(...arguments);this.filterType="multi",this.wrappers=[],this.activeFilterIndices=[],this.afterFiltersReadyFuncs=[]}init(G){this.params=G,this.filterDefs=hB(G);let D=WF(this.beans.colFilter.model,G.column.getColId()),{filterChangedCallback:z}=G;this.filterChangedCallback=z;let B=this.filterDefs.map((Q,J)=>this.createFilter(Q,J,D));return new eG((Q)=>{eG.all(B).then((J)=>{this.wrappers=J,this.refreshGui("columnMenu").then(()=>{Q()})})}).then(()=>{for(let Q of this.afterFiltersReadyFuncs)Q();this.afterFiltersReadyFuncs.length=0})}refresh(G){return this.params=G,!0}isFilterActive(){return this.wrappers.some((G)=>{if(!G)return!1;let{filter:D,handler:z,model:B}=G;if(z)return B!=null;return D.isFilterActive()})}getLastActiveFilterIndex(){let G=this.activeFilterIndices;return G.length>0?G[G.length-1]:null}doesFilterPass(G,D){return this.wrappers.every((z,B)=>{if(!z||D!=null&&B===D)return!0;let{handler:Q,filter:J,model:U}=z;if(Q)return U==null||Q.doesFilterPass({...G,model:U,handlerParams:z.handlerParams});return!J.isFilterActive()||J.doesFilterPass(G)})}getModelFromUi(){return{filterType:this.filterType,filterModels:this.wrappers.map((D)=>{if(!D)return null;let z=D.filter;if(typeof z.getModelFromUi==="function")return z.getModelFromUi();return null})}}getModel(){if(!this.isFilterActive())return null;return{filterType:this.filterType,filterModels:this.wrappers.map((D)=>{if(!D)return null;let{filter:z,handler:B,model:Q}=D;if(B)return Q;return z.isFilterActive()?z.getModel():null})}}setModel(G){let D=(B,Q)=>{return new eG((J)=>{let U=B.setModel(Q);if(U)U.then(J);else J()})},z=[];return this.wrappers.forEach((B,Q)=>{if(!B)return;let J=dG(G,Q),{filter:U,filterParams:Z,handler:S,handlerParams:X,state:Y}=B;if(S){let W={model:J,state:Y?.state};B.state=W,B.model=J,z.push(yZ(()=>eG.resolve({filter:U,filterParams:Z}),S,X,J,W,"api").then(()=>{this.updateActiveListForHandler(Q,B.model)}))}else z.push(D(U,J).then(()=>{this.updateActiveListForFilter(Q,U)}))}),eG.all(z).then(()=>{})}applyModel(G="api"){let D=!1;for(let z of this.wrappers)if(z){let B=z.filter;if(B instanceof YF)D=B.applyModel(G)||D}return D}getChildFilterInstance(G){return this.wrappers[G]?.filter}getNumChildFilters(){return this.wrappers.length}destroy(){for(let G of this.wrappers)this.destroyBean(G?.filter),this.destroyBean(G?.handler);this.wrappers.length=0,super.destroy()}getFilterWrappers(){return this.wrappers}getFilterFromWrapper(G){return G.filter}getCompFromWrapper(G){return G.comp}executeOnWrapper(G,D){G.handler?.[D]?.()}createFilter(G,D,z){let B=this.params.column,Q=null,J,U=this.beans,Z=(H,_)=>{let k=this.wrappers[D];if(!k)return;let w={model:H,state:k.state?.state};k.state=w,k.model=H,yZ(()=>eG.resolve({filter:k.filter,filterParams:k.filterParams}),k.handler,k.handlerParams,H,w,"ui").then(()=>{this.onHandlerModelChanged(D,k.model,_)})},{compDetails:S,handler:X,handlerParams:Y,createFilterUi:W}=U.colFilter.createFilterInstance(B,G,"agTextColumnFilter",(H,_)=>{let k={...H,filterChangedCallback:_?()=>{}:(w)=>{this.executeWhenAllFiltersReady(()=>this.onFilterModelChanged(D,w))},doesRowPassOtherFilter:(w)=>H.doesRowPassOtherFilter(w)&&this.doesFilterPass({node:w,data:w.data},D),getValue:IB(U,B,G,H.getValue)};if(_)Q=dG(z,D),J=this.updateDisplayParams(k,D,Q,()=>S,()=>X,Z);return k});if(!W)return eG.resolve(null);let q;if(X){let{doesRowPassOtherFilter:H,getValue:_}=Y;q={...Y,onModelChange:Z,doesRowPassOtherFilter:(k)=>H(k)&&this.doesFilterPass({node:k,data:k.data},D),getValue:IB(U,B,G,_)},X.init?.({...q,model:Q,source:"init"})}return W().then((H)=>{if(!X)return{filter:H,comp:H};let _=S?.params,k=J(H);return{filter:H,comp:k,filterParams:_,handler:X,handlerParams:q,model:Q}})}updateDisplayParams(G,D,z,B,Q,J){let U=this.params.column,Z=new XF;G.model=z,G.state={model:z},G.onModelChange=J,G.getHandler=Q;let S=(Y,W)=>{Y.state=W,Z.dispatchEvent({type:"filterStateChanged",column:U,state:W})};G.onStateChange=(Y)=>{let W=this.wrappers[D];if(!W)return;S(W,Y),qF(W.filter,W.filterParams,W.model??null,Y,"ui")};let X=(Y,W,q)=>{let H=this.wrappers[D];if(!H)return;let _=()=>H?.model??null;_F({action:W,filterParams:H.filterParams,getFilterUi:()=>{let k=eG.resolve(H.filter);return{created:!0,filterParams:H.filterParams,compDetails:B(),create:()=>k,promise:k}},getModel:_,getState:()=>H?.state??{model:_()},updateState:(k)=>S(H,k),updateModel:(k)=>H.filterParams?.onModelChange(k,q),processModelToApply:H.handler?.processModelToApply?.bind(H.handler)})};return G.onAction=(Y,W,q)=>{X(U,Y,W),Z.dispatchEvent({type:"filterAction",column:U,action:Y,event:q})},(Y)=>{let W=B()?.params;return this.createManagedBean(new SF(U,{comp:Y,params:W,isHandler:!0},Z,X,!1))}}executeWhenAllFiltersReady(G){if((this.wrappers?.length??0)>0)G();else this.afterFiltersReadyFuncs.push(G)}updateActiveListForFilter(G,D){this.updateActiveList(G,()=>D?.isFilterActive())}updateActiveListForHandler(G,D){this.updateActiveList(G,()=>D!=null)}updateActiveList(G,D){let z=this.activeFilterIndices;if(HF(this.activeFilterIndices,G),D())z.push(G)}onFilterModelChanged(G,D){this.updateActiveListForFilter(G,this.wrappers[G]?.filter),this.filterChanged(G,D)}onHandlerModelChanged(G,D,z){this.updateActiveListForHandler(G,D),this.filterChanged(G,z)}filterChanged(G,D){this.filterChangedCallback(D),this.wrappers.forEach((z,B)=>{if(G===B||!z)return;let{filter:Q,handler:J}=z;if(J?.onAnyFilterChanged?.(),typeof Q.onAnyFilterChanged==="function")Q.onAnyFilterChanged()})}getModelAsString(G){if(!G?.filterModels?.length)return"";let D=this.getLastActiveFilterIndex()??0;return this.wrappers[D]?.filter?.getModelAsString?.(G.filterModels[D])??""}},RF=class extends MF{constructor(){super(...arguments);this.filterType="multi",this.handlerWrappers=[],this.activeFilterIndices=[],this.filterDefs=[]}init(G){this.params=G;let D=hB(G.filterParams);this.filterDefs=D,D.forEach((z,B)=>{let Q=this.beans.colFilter.createHandler(G.column,z,"agTextColumnFilter");if(this.handlerWrappers.push(Q),!Q){xZ(278,{colId:G.column.getColId()});return}let{handler:J,handlerParams:U}=Q;J.init?.({...this.updateHandlerParams(U,B,!0),model:dG(G.model,B),source:"init"})}),this.resetActiveList(G.model)}refresh(G){this.params=G;let{model:D,source:z,filterParams:B}=G,Q=B?.filters;if(this.handlerWrappers.forEach((J,U)=>{if(J){let Z=this.updateHandlerParams(G,U,!1,Q?.[U].filterParams);J.handlerParams=Z,J.handler.refresh?.({...Z,model:dG(D,U),source:z})}}),G.source!=="floating"&&G.source!=="ui")this.resetActiveList(G.model);if(G.additionalEventAttributes?.fromButtons)this.onAnyFilterChanged()}updateHandlerParams(G,D,z,B){let{onModelChange:Q,doesRowPassOtherFilter:J,getValue:U}=G,Z={...G,onModelChange:(S,X)=>Q(EB(this.params.model,this.handlerWrappers.length,S,D),X),doesRowPassOtherFilter:(S)=>J(S)&&this.doesFilterPass({node:S,data:S.data,model:this.params.model,handlerParams:Z},D),getValue:IB(this.beans,G.column,this.filterDefs[D],U),filterParams:this.updateFilterParams(G,z,B)};return Z}updateFilterParams(G,D,z){let B=G.filterParams;if(z?.buttons&&D)xZ(292,{colId:G.column.getColId()});let Q=z?{...B,...z}:B;if(!Q.buttons)return Q;if(z)return delete Q.buttons,Q;let{buttons:J,...U}=Q;return U}doesFilterPass(G,D){let z=G.model?.filterModels;if(z==null)return!0;return this.handlerWrappers.every((B,Q)=>{let J=z[Q];if(J==null||D!=null&&Q===D)return!0;let U=B?.handler;return!U||U.doesFilterPass({...G,model:J,handlerParams:B.handlerParams})})}resetActiveList(G){this.activeFilterIndices=[];let D=G?.filterModels;if(D==null)return;for(let z=0;z0?G[G.length-1]:null}getModelAsString(G,D){let z=D==="filterToolPanel",B=()=>z?this.getLocaleTextFunc()("filterSummaryInactive","is (All)"):"";if(!G?.filterModels?.length)return B();let Q=this.getLastActiveFilterIndex()??0;return this.handlerWrappers[Q]?.handler.getModelAsString?.(G.filterModels[Q],D)??B()}getHandler(G){return this.handlerWrappers[G]?.handler}onAnyFilterChanged(){FB(this.handlerWrappers,(G)=>G?.handler?.onAnyFilterChanged?.())}onNewRowsLoaded(){FB(this.handlerWrappers,(G)=>G?.handler?.onNewRowsLoaded?.())}destroy(){for(let G of this.handlerWrappers)this.destroyBean(G?.handler);this.handlerWrappers.length=0,super.destroy()}},vF=class extends CF{constructor(){super(...arguments);this.beanName="multiFilter"}getParamsForDataType(G,D,z,B){let Q=G?.filters,J=this.beans;if(!Q)Q=[{filter:VF(z.baseDataType)},{filter:"agSetColumnFilter"}];let U=this.getLocaleTextFunc();return Q=Q.map((Z)=>{let{filter:S,filterParams:X,filterValueGetter:Y}=Z;if(typeof S!=="string")return Z;let{filterParams:W,filterValueGetter:q}=bF(S,X,Y??D,z,B,J,U);return{...Z,filterParams:W,filterValueGetter:q}}),{filterParams:{...G,filters:Q}}}},O7=class extends b7{constructor(){super(...arguments);this.filterType="multi",this.filters=[],this.filterParams=[],this.validity=[]}init(G){this.params=G;let D=hB(G).map((B)=>{if(B.filterParams?.buttons){PF(292,{colId:G.column.getColId()});let Q={...B.filterParams};return delete Q.buttons,{...B,filterParams:Q}}return B});this.filterDefs=D,this.allState=G.state;let z=this.filterDefs.map((B,Q)=>this.createFilter(B,Q));return new tQ((B)=>{tQ.all(z).then((Q)=>{this.filters=Q,this.refreshGui("columnMenu").then(()=>{B()})})})}refresh(G){let{model:D,state:z,source:B}=G;if(B==="colDef")return!1;this.params=G;let Q=this.filterParams;if(z===this.allState)return!0;this.allState=z;let J=z.state;return this.filters.forEach((U,Z)=>{let S=dG(D,Z),X={state:J?.[Z],model:dG(z.model,Z)};jF(U,Q[Z],S,X,B)}),!0}getLastActiveFilterIndex(){return this.getHandler().getLastActiveFilterIndex?.()??null}getChildFilterInstance(G){return this.filters[G]??void 0}getNumChildFilters(){return this.filters.length}destroy(){for(let G of this.filters)this.destroyBean(G);this.filters.length=0,super.destroy()}getFilterWrappers(){return this.filters}getFilterFromWrapper(G){return G}getCompFromWrapper(G){return G}createFilter(G,D){let z=this.beans.userCompFactory,B=this.updateParams(G,this.params,D),Q=OF(z,G,B,"agTextColumnFilter");if(!Q)return tQ.resolve(null);return this.filterParams[D]=Q.params,Q.newAgStackInstance()}updateParams(G,D,z){let{doesRowPassOtherFilter:B,model:Q,onModelChange:J,state:U,onStateChange:Z,column:S,source:X,onAction:Y,onUiChange:W,getValue:q}=D,H=dG(Q,z),_=U?{model:dG(U.model,z),state:U.state?.[z]}:{model:H},k=()=>{let K=this.getHandler();this.filters.forEach((f,N)=>{if(z!==N)K.getHandler(N)?.onAnyFilterChanged?.(),f?.onAnyFilterChanged?.()})},w=this.beans.colFilter;return{...w.createBaseFilterParams(S),...G,doesRowPassOtherFilter:(K)=>B(K)&&this.getHandler().doesFilterPass({node:K,data:K.data,model:this.params.model,handlerParams:w.getHandlerParams(S)},z),model:H,state:_,onModelChange:(K,f)=>{let{filters:N,params:F}=this,E=EB(F.model,N.length,K,z);this.updateActiveList(z,K),J(E,f),k()},onStateChange:(K)=>this.onStateChange(Z,z,K),getHandler:()=>this.getHandler().getHandler(z),onAction:(K,f,N)=>{if(uF(D))return;let F=K==="apply"||K==="reset";if(F)this.updateActiveList(z,dG(this.params.state.model,z));if(Y(K,f,N),F)k()},onUiChange:W,source:X,getValue:IB(this.beans,S,G,q)}}updateActiveList(G,D){this.getHandler().updateActiveList?.(G,D)}getHandler(){return this.params.getHandler()}onStateChange(G,D,z){let{model:B,state:Q,valid:J}=z,U=this.validity;U[D]=J;let Z=this.allState,S=EB(Z.model,this.filters.length,B,D),X=U.every((q)=>q!==!1),Y=[...Z.state??[]];Y[D]=Q;let W={state:Y,model:S,valid:X};this.allState=W,G(W)}getModelAsString(G){return this.getHandler().getModelAsString?.(G)??""}},nF={tag:"div",cls:"ag-multi-floating-filter ag-floating-filter-input"},dF=class extends TF{constructor(){super(nF);this.floatingFilters=[],this.compDetailsList=[]}init(G){this.params=G;let{compDetailsList:D}=this.getCompDetailsList(G);return this.setParams(D)}setParams(G){let D=[];return G.forEach((z)=>{let B=z?.newAgStackInstance();if(B!=null)this.compDetailsList.push(z),D.push(B)}),gF.all(D).then((z)=>{z.forEach((B,Q)=>{this.floatingFilters.push(B);let J=B.getGui();if(this.appendChild(J),Q>0)jz(J,!1)})})}refresh(G){this.params=G;let{compDetailsList:D,floatingFilterParamsList:z}=this.getCompDetailsList(G);if(D.length===this.compDetailsList.length&&D.every((Q,J)=>!this.beans.colFilter?.areFilterCompsDifferent(this.compDetailsList[J],Q))){if(z.forEach((Q,J)=>{this.floatingFilters[J].refresh?.(Q)}),this.gos.get("enableFilterHandlers")){let Q=G;if(Q.model==null)this.floatingFilters.forEach((J,U)=>{jz(J.getGui(),U===0)});else{let J=Q.getHandler()?.getLastActiveFilterIndex?.();this.floatingFilters.forEach((U,Z)=>{let S=J==null?Z===0:Z===J;jz(U.getGui(),S)})}}}else yF(this.getGui()),this.destroyBeans(this.floatingFilters),this.floatingFilters=[],this.compDetailsList=[],this.setParams(D)}getCompDetailsList(G){let D=[],z=[],B=G.filterParams,Q=G.currentParentModel,J=hB(B);return J.forEach((U,Z)=>{let S={...G,parentFilterInstance:(Y)=>{this.parentMultiFilterInstance((W)=>{let q=W.getChildFilterInstance(Z);if(q==null)return;Y(q)})},currentParentModel:()=>Q()?.filterModels?.[Z]??null};if(this.gos.get("enableFilterHandlers")){let Y=S;Y.model=Y.model?.filterModels?.[Z]??null;let{onModelChange:W,getHandler:q}=Y;Y.onModelChange=(H,_)=>W(EB(this.params.model,J.length,H,Z),_),Y.getHandler=()=>{return q().getHandler(Z)}}iF(S.filterParams,U.filterParams);let X=this.getCompDetails(U,S);if(X)D.push(X),z.push(S)}),{compDetailsList:D,floatingFilterParamsList:z}}onParentModelChanged(G,D){if(D?.afterFloatingFilter)return;this.parentMultiFilterInstance((z)=>{if(G==null)this.floatingFilters.forEach((B,Q)=>{B.onParentModelChanged(null,D),jz(B.getGui(),Q===0)});else{let B=z.getLastActiveFilterIndex();this.floatingFilters.forEach((Q,J)=>{let U=G.filterModels.length>J?G.filterModels[J]:null;Q.onParentModelChanged(U,D);let Z=B==null?J===0:J===B;jz(Q.getGui(),Z)})}})}destroy(){this.destroyBeans(this.floatingFilters),this.floatingFilters.length=0,super.destroy()}getCompDetails(G,D){let{colFilter:z,frameworkOverrides:B,userCompFactory:Q}=this.beans,J=cF(B,G,()=>z.getDefaultFloatingFilter(this.params.column))??"agReadOnlyFloatingFilter";return hF(Q,G,D,J)}parentMultiFilterInstance(G){this.params.parentFilterInstance((D)=>{if(!(D instanceof v7||D instanceof O7))xF(120);G(D)})}},iB={moduleName:"MultiFilter",version:j,userComponents:{agMultiColumnFilter:{getComp:(G)=>G.gos.get("enableFilterHandlers")?{classImp:O7,params:{useForm:!0}}:v7},agMultiColumnFloatingFilter:dF},beans:[vF],dynamicBeans:{agMultiColumnFilterHandler:RF},dependsOn:[i,LF,TB]},sF=class extends mF{constructor(){super(...arguments);this.beanName="aggColNameSvc"}getHeaderName(G,D){if(this.gos.get("suppressAggFuncInHeader"))return D;let{valueColsSvc:z,colModel:B,rowGroupColsSvc:Q}=this.beans,J=G.getColDef().pivotValueColumn,U=tF(J),Z=null,S;if(U){let X=z?.columns??[],Y=this.gos.get("removePivotHeaderRowWhenSingleValueColumn")&&X.length===1,W=G.getColDef().pivotTotalColumnIds!==void 0;if(Y&&!W)return D;Z=J?J.getAggFunc():null,S=!0}else{let X=G.isValueActive(),Y=Q?.columns.length!==0,W=B.isPivotMode()||Y||this.gos.get("treeData");if(X&&W)Z=G.getAggFunc(),S=!0;else S=!1}if(S){let X=typeof Z==="string"?Z:"func";return`${this.getLocaleTextFunc()(X,X)}(${D})`}return D}},aF={sum:"Sum",first:"First",last:"Last",min:"Min",max:"Max",count:"Count",avg:"Average"},eF=class extends oF{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 G=this.aggFuncsMap;G.sum=GE,G.first=DE,G.last=zE,G.min=BE,G.max=QE,G.count=UE,G.avg=$E,this.initialised=!0}isAggFuncPossible(G,D){let B=this.getFuncNames(G).includes(D),Q=cZ(this.aggFuncsMap[D]);return B&&Q}getDefaultFuncLabel(G){return aF[G]??G}getDefaultAggFunc(G){let D=G.getColDef().defaultAggFunc;if(cZ(D)&&this.isAggFuncPossible(G,D))return D;if(this.isAggFuncPossible(G,"sum"))return"sum";let z=this.getFuncNames(G);return z?.length?z[0]:null}addAggFuncs(G){if(this.init(),!G)return;for(let D of Object.keys(G))if(G[D])this.aggFuncsMap[D]=G[D]}getAggFunc(G){return this.init(),this.aggFuncsMap[G]}getFuncNames(G){let D=G.getColDef().allowedAggFuncs;return D==null?Object.keys(this.aggFuncsMap).sort():D}clear(){this.aggFuncsMap={}}};function GE(G){let{values:D}=G,z=null;for(let B=0;B0?G.values[0]:null}function zE(G){return G.values.length>0?rF(G.values):null}function BE(G){let{values:D}=G,z=null;for(let B=0;BQ))z=Q}return z}function QE(G){let{values:D}=G,z=null;for(let B=0;B0)Q=z/(typeof z==="number"?B:BigInt(B));let J=G.rowNode?.aggData?.[G.column?.getColId()];if(J&&J.count===B&&J.value===Q)return J;let U=Object.create(ZE);return U.count=B,U.value=Q,U}var XE=class extends LE{constructor(){super(...arguments);this.beanName="aggChildrenSvc"}getAggregatedChildren(G,D,z){if(!G?.group)return[];if(G.rowPinned){if(G=G.pinnedSibling,!G)return[]}let B=this.gos,Q=u7(G,D,B);if(!z)return Q;let J=[];return j7(Q,D,B,J),J}},u7=(G,D,z)=>{let B=D?.colDef,Q=B?.pivotKeys;if(Q){if(G.leafGroup&&Q.length&&!B.pivotTotalColumnIds)return S7(G.childrenMapped,Q);return G.childrenAfterFilter??G.childrenAfterGroup??[]}if(SE(z)||z.get("suppressAggFilteredOnly"))return G.childrenAfterGroup??[];return G.childrenAfterFilter??G.childrenAfterGroup??[]},j7=(G,D,z,B)=>{for(let Q=0,J=G.length;Q{JZ(I,null,F)})}return}this.hadAgg=!0;let{colModel:J,aggFuncSvc:U}=z,Z=D.get("alwaysAggregateAtRootLevel")||!!_E(D)||J.isPivotMode(),S=!kE(D)&&!D.get("suppressAggFilteredOnly"),X=z.valueSvc,Y=z.gridApi,W=z.gridOptions.context,q=Q??[],H=q.length,_=G?.kind==="cells"?G:void 0,k,w=Array(H);for(let F=0;F=0)k=_;w[F]={column:E,colId:E.colId,colDef:E.colDef,aggFunc:P7(E.getAggFunc(),U,E),colSlot:I}}let K=FE(J,z.pivotResultCols,U),f=H>0?Array(H):null,N=z.rowModel;hZ(N.rootNode,N.hierarchical,G,(F)=>{if(F.level===-1&&!Z){aD(F,null,J);return}let E;if(B)E=B({nodes:F.childrenAfterFilter});else if(!f)E=null;else if(K)E=NE(F,K,X,Y,W);else E=fE(F,w,H,f,k,S,X,Y,W);JZ(F,E,J)})}},fE=(G,D,z,B,Q,J,U,Z,S)=>{let X=(J?G.childrenAfterFilter:G.childrenAfterGroup)??[],Y=X.length,W=G.data,q=Object.create(null),H=Q?Q.getSlot(G):-1,_=H>=0?G.aggData:void 0,k=0;for(let w=0;w=0&&!Q.hasCellBySlot(H,K.colSlot)){if(B[w]=null,_)q[K.colId]=_[K.colId]}else B[w]=Array(Y),++k}if(k===0)return q;for(let w=0;w{let J=D.length,U=G.leafGroup,Z=G.data,S=G.childrenMapped,X=G.childrenAfterFilter??[],Y=Object.create(null),W,q;for(let H=0;H{if(typeof G==="function")return G;if(G==null)return null;let B=D.getAggFunc(G);if(typeof B!=="function")return wE(109,{inputValue:G.toString(),allSuggestions:D.getFuncNames(z)}),null;return B},FE=(G,D,z)=>{if(!G.isPivotActive())return null;let B=D?.getAggregationOrderedList();if(!B||B.length===0)return null;let Q=B.length,J=Array(Q),U=0;for(let Z=0;Z{let D=G.childrenAfterAggFilter,z=0;if(D){let Q=D.length;z=Q;for(let J=0;J=0?null:z;G.setAllChildrenCount(B),G.pinnedSibling?.setAllChildrenCount(B)},this.setAllChildrenCountGridGrouping=(G)=>{let D=G.childrenAfterAggFilter,z=0;for(let B=0,Q=D.length;B!_.node.group,X=(_)=>_.node.leafGroup,Y=ME(this.gos)||(J?X:S),W=Z?this.setAllChildrenCountTreeData:this.setAllChildrenCountGridGrouping,q=(_,k=!1)=>{if(_.childrenAfterFilter){if(_.childrenAfterAggFilter=_.childrenAfterFilter,k){let w=_.childrenAfterAggFilter;for(let K=0,f=w.length;K{if(_.childrenAfterAggFilter=_.childrenAfterFilter?.filter((k)=>{if(Y({node:k})){if(Q.doesRowPassAggregateFilters({rowNode:k}))return q(k,!0),!0}return k.childrenAfterAggFilter?.length})||null,_.hasChildren())W(_);else _.setAllChildrenCount(null),_.pinnedSibling?.setAllChildrenCount(null);if(_.sibling)_.sibling.childrenAfterAggFilter=_.childrenAfterAggFilter};IE(D.rootNode,D.hierarchical,G,U?H:q)}};function pG(G,D){if(G.sibling)return;let z=OE(G,D);z.footer=!0,z.setRowTop(null),z.setRowIndex(null),z.oldRowTop=null,z.id="rowGroupFooter_"+G.id,z.sibling=G,G.sibling=z}function EJ(G){let D=G.sibling;if(!D)return;D._destroy(!1),G.sibling=void 0,D.sibling=void 0}var uE=class extends RE{constructor(){super(...arguments);this.beanName="footerSvc"}addTotalRows(G,D,z,B,Q,J){let U=G;if(Q){let X=B&&VE(this.gos);if(jE(J,X))pG(D,this.beans),z(D.sibling,U++);return U}let Z=bE(this.gos);if((B&&Z({node:D}))===J)pG(D,this.beans),z(D.sibling,U++);return U}getTopDisplayIndex(G,D,z,B){let Q=D;if(G[0].footer){if(D===0)return 0;Q-=1}let J=G[G.length-1],U=Q>=z.length;if(J.footer&&U)return J.rowIndex;return B(Q)}doesCellShowTotalPrefix(G,D){if(!G.footer||!D?.getColDef().showRowGroup)return!1;if(this.gos.get("treeData"))return!0;if(G.level===-1)return this.beans.showRowGroupCols?.columns[0]===D;return!!G.rowGroupColumn&&D?.isRowGroupDisplayed(G.rowGroupColumn.getId())}applyTotalPrefix(G,D,z,B){let Q=B.getColDef().cellRendererParams?.totalValueGetter;if(Q){let J=CE(this.gos,{column:B,node:z,value:G,formattedValue:D});if(typeof Q==="function")return Q(J);if(typeof Q==="string")return this.beans.expressionSvc?.evaluate(Q,J);vE(179)}if(z.level===-1)return this.getLocaleTextFunc()("footerTotal","Total")+" ";return this.getTotalValue(D??G)??""}getTotalValue(G){return this.getLocaleTextFunc()("footerTotal","Total")+" "+(G??"")}};function jE(G,D){switch(D){case"top":case"pinnedTop":return G==="top";case"bottom":case"pinnedBottom":return G==="bottom";default:return!1}}var g7=class extends PE{constructor(){super(...arguments);this.beanName="valueColsSvc",this.eventName="columnValueChanged",this.columnProcessors={set:(G,D,z)=>this.setValueActive(D,G,z),add:(G,D,z)=>this.setValueActive(!0,G,z),remove:(G,D,z)=>this.setValueActive(!1,G,z)},this.columnExtractors={setFlagFunc:(G,D,z)=>this.setColValueActive(G,D,z),getIndexFunc:()=>{return},getInitialIndexFunc:()=>{return},getValueFunc:(G)=>{let D=G.aggFunc;if(D===null||D==="")return null;if(D===void 0)return;return!!D},getInitialValueFunc:(G)=>{return G.initialAggFunc!=null&&G.initialAggFunc!=""}},this.modifyColumnsNoEventsCallbacks={addCol:(G)=>this.columns.push(G),removeCol:(G)=>TE(this.columns,G)}}extractCols(G,D){this.columns=super.extractCols(G,D);for(let z of this.columns){let B=z.getColDef();if(B.aggFunc!=null&&B.aggFunc!="")this.setColAggFunc(z,B.aggFunc);else if(!z.getAggFunc())this.setColAggFunc(z,B.initialAggFunc)}return this.columns}setColumnAggFunc(G,D,z){if(!G)return;let B=this.colModel.getColDefCol(G);if(!B)return;this.setColAggFunc(B,D),this.dispatchColumnChangedEvent(this.eventSvc,this.eventName,[B],z)}syncColumnWithState(G,D,z){let B=z("aggFunc").value1;if(B!==void 0)if(typeof B==="string"){if(this.setColAggFunc(G,B),!G.isValueActive())this.setColValueActive(G,!0,D),this.modifyColumnsNoEventsCallbacks.addCol(G)}else{if(gE(B))yE(33);if(G.isValueActive())this.setColValueActive(G,!1,D),this.modifyColumnsNoEventsCallbacks.removeCol(G)}}setValueActive(G,D,z){if(G===D.isValueActive())return;if(this.setColValueActive(D,G,z),G&&!D.getAggFunc()&&this.aggFuncSvc){let B=this.aggFuncSvc.getDefaultAggFunc(D);this.setColAggFunc(D,B)}}setColAggFunc(G,D){G.aggFunc=D,G.dispatchStateUpdatedEvent("aggFunc")}setColValueActive(G,D,z){if(G.aggregationActive!==D)G.aggregationActive=D,G.dispatchColEvent("columnValueChanged",z)}},IJ={moduleName:"SharedAggregation",version:j,beans:[eF,sF,uE,g7],apiFunctions:{addAggFuncs:YE,clearAggFuncs:WE,setColumnAggFunc:qE},dependsOn:[i]},MJ={moduleName:"Aggregation",version:j,beans:[KE,AE,XE],rowModels:["clientSide"],dependsOn:[IJ]},T7=class extends xE{constructor(){super(...arguments);this.beanName="pivotColsSvc",this.eventName="columnPivotChanged",this.columnProcessors={set:(G,D,z)=>this.setColPivotActive(G,D,z),add:(G,D,z)=>this.setColPivotActive(G,!0,z),remove:(G,D,z)=>this.setColPivotActive(G,!1,z)},this.columnOrdering={enableProp:"pivot",initialEnableProp:"initialPivot",indexProp:"pivotIndex",initialIndexProp:"initialPivotIndex"},this.columnExtractors={setFlagFunc:(G,D,z)=>this.setColPivotActive(G,D,z),getIndexFunc:(G)=>G.pivotIndex,getInitialIndexFunc:(G)=>G.initialPivotIndex,getValueFunc:(G)=>G.pivot,getInitialValueFunc:(G)=>G.initialPivot},this.modifyColumnsNoEventsCallbacks={addCol:(G)=>{if(!this.columns.includes(G))this.columns.push(G)},removeCol:(G)=>cE(this.columns,G)}}syncColumnWithState(G,D,z,B){let{value1:Q,value2:J}=z("pivot","pivotIndex");if(Q!==void 0||J!==void 0){if(typeof J==="number"||Q){if(!G.isPivotActive())this.setColPivotActive(G,!0,D),this.modifyColumnsNoEventsCallbacks.addCol(G);if(B&&typeof J==="number")B[G.getId()]=J}else if(G.isPivotActive())this.setColPivotActive(G,!1,D),this.modifyColumnsNoEventsCallbacks.removeCol(G)}}setColPivotActive(G,D,z){if(G.pivotActive!==D){if(G.pivotActive=D,D)this.beans.groupHierarchyColSvc?.insertVirtualColumnsForCol(this.columns,G)?.forEach((Q)=>this.setColPivotActive(Q,D,z));G.dispatchColEvent("columnPivotChanged",z)}G.dispatchStateUpdatedEvent("pivot")}},dE=class extends hE{constructor(){super(...arguments);this.beanName="rowGroupColsSvc",this.eventName="columnRowGroupChanged",this.columnProcessors={set:(G,D,z)=>this.setActive(D,G,z),add:(G,D,z)=>this.setActive(!0,G,z),remove:(G,D,z)=>this.setActive(!1,G,z)},this.columnOrdering={enableProp:"rowGroup",initialEnableProp:"initialRowGroup",indexProp:"rowGroupIndex",initialIndexProp:"initialRowGroupIndex"},this.columnExtractors={setFlagFunc:(G,D,z)=>this.setColRowGroupActive(G,D,z),getIndexFunc:(G)=>G.rowGroupIndex,getInitialIndexFunc:(G)=>G.initialRowGroupIndex,getValueFunc:(G)=>G.rowGroup,getInitialValueFunc:(G)=>G.initialRowGroup},this.modifyColumnsNoEventsCallbacks={addCol:(G)=>{if(!this.columns.includes(G))this.columns.push(G)},removeCol:(G)=>iE(this.columns,G)}}moveColumn(G,D,z){if(this.columns.length===0)return;let B=this.columns[G],Q=this.columns.slice(G,D);this.columns.splice(G,1),this.columns.splice(D,0,B),this.updateIndexMap(),this.eventSvc.dispatchEvent({type:this.eventName,columns:Q,column:Q.length===1?Q[0]:null,source:z})}syncColumnWithState(G,D,z,B){let{value1:Q,value2:J}=z("rowGroup","rowGroupIndex");if(Q!==void 0||J!==void 0){if(typeof J==="number"||Q){if(!G.isRowGroupActive())this.setColRowGroupActive(G,!0,D),this.modifyColumnsNoEventsCallbacks.addCol(G);if(B&&typeof J==="number")B[G.getId()]=J}else if(G.isRowGroupActive())this.setColRowGroupActive(G,!1,D),this.modifyColumnsNoEventsCallbacks.removeCol(G)}}setActive(G,D,z){if(G===D.isRowGroupActive())return;this.setColRowGroupActive(D,G,z);let B=this.beans.groupHierarchyColSvc?.getColumn(D);if(nE(this.gos,G)&&!B)this.colModel.setColsVisible([D],!G,z)}setColRowGroupActive(G,D,z){if(G.rowGroupActive!==D){if(G.rowGroupActive=D,D)this.beans.groupHierarchyColSvc?.insertVirtualColumnsForCol(this.columns,G)?.forEach((Q)=>this.setColRowGroupActive(Q,D,z));G.dispatchColEvent("columnRowGroupChanged",z)}G.dispatchStateUpdatedEvent("rowGroup")}},ZI=class extends pE{constructor(){super(...arguments);this.beanName="autoColSvc"}postConstruct(){this.addManagedPropertyListener("autoGroupColumnDef",this.updateColumns.bind(this)),this.setupGroupHideColumnsUntilExpanded()}setupGroupHideColumnsUntilExpanded(){let G=()=>this.updateGroupColumnVisibility();this.addManagedEventListeners({modelUpdated:G}),this.addManagedPropertyListeners(["groupHideColumnsUntilExpanded","groupDisplayType","groupHideOpenParents"],G)}addColumns(G){let{columns:D}=this;if(D==null)return;G.list=D.list.concat(G.list),G.tree=D.tree.concat(G.tree),QI(G)}createColumns(G,D,z){let B=this.beans,{colModel:Q,gos:J,rowGroupColsSvc:U,colGroupSvc:Z}=B,S=Q.isPivotMode(),X=zI(J,S),Y=S?J.get("pivotSuppressAutoColumn"):this.isSuppressAutoCol(),W=U?.columns,H=!(W&&W.length>0||J.get("treeData"))||Y||X,_=()=>{if(this.columns)nZ(B,this.columns.tree),this.columns=null};if(H){_();return}let k=this.generateAutoCols(W),w=sE(k,this.columns?.list||null),K=G.treeDepth,N=(this.columns?this.columns.treeDepth:-1)==K;if(w&&N){let V=new Map(k.map((A)=>[A.getId(),A]));for(let A of this.columns?.list??[]){let R=V.get(A.getId());if(R)A.setColDef(R.getColDef(),null,z)}return}_();let F=Z?.findDepth(G.tree)??0,E=Z?.balanceTreeForAutoCols(k,F)??[];this.columns={list:k,tree:E,treeDepth:F,map:{}},D((V)=>{if(!V)return null;let A=V.filter((R)=>!UI(R));return[...k,...A]})}updateColumns(G){let D=rE(G.source);this.columns?.list.forEach((z,B)=>this.updateOneAutoCol(z,B,D))}getColumn(G){return this.columns?.list.find((D)=>oE(D,G))??null}getColumns(){return this.columns?.list??null}generateAutoCols(G=[]){let D=[],{gos:z}=this,B=z.get("treeData"),Q=DI(z);if(B&&Q)JI(182),Q=!1;if(Q)G.forEach((J,U)=>{D.push(this.createOneAutoCol(J,U))});else D.push(this.createOneAutoCol());return D}isSuppressAutoCol(){let G=this.gos;if(G.get("groupDisplayType")==="custom")return!0;return G.get("treeDataDisplayType")==="custom"}createOneAutoCol(G,D){let z;if(G)z=`${iZ}-${G.getId()}`;else z=iZ;let B=this.createAutoColDef(z,G,D);B.colId=z;let Q=new lE(B,null,z,!0);return this.createBean(Q),Q}updateOneAutoCol(G,D,z){let B=G.getColDef(),Q=typeof B.showRowGroup=="string"?B.showRowGroup:void 0,J=this.beans,U=Q!=null?J.colModel.getColDefCol(Q):void 0,Z=G.getId(),S=this.createAutoColDef(Z,U??void 0,D);G.setColDef(S,null,z),tE(J,{state:[aE(S,Z)]},z)}createAutoColDef(G,D,z){let B=this.createBaseColDef(D),Q=this.gos.get("autoGroupColumnDef");if(BI(B,Q),B=mE(this.beans,B,G,!0),Q?.groupRowEditable==null)B.groupRowEditable=void 0;if(Q?.groupRowValueSetter==null)B.groupRowValueSetter=void 0;if(!this.gos.get("treeData")){if(sQ(B.field)&&sQ(B.valueGetter)&&sQ(B.filterValueGetter)&&B.filter!=="agGroupColumnFilter")B.filter=!1}if(z&&z>0)B.headerCheckboxSelection=!1;let J=eE(this.gos),U=B.valueGetter||B.field!=null;if(J&&!U)B.sortIndex=void 0,B.initialSort=void 0;return B}createBaseColDef(G){let D=this.gos.get("autoGroupColumnDef"),B={headerName:this.getLocaleTextFunc()("group","Group"),showRowGroup:G?.getColId()??!0};if(!(D&&(D.cellRenderer||D.cellRendererSelector)))B.cellRenderer="agGroupCellRenderer";if(G)B.headerName=this.beans.colNames.getDisplayNameForColumn(G,"header")??void 0,B.headerValueGetter=G.colDef.headerValueGetter;return B}getDeepestExpandedLevel(G,D){let z=-1;if(!G)return z;for(let B of G){if(!B.group||!B.expanded)continue;if(B.level>z)z=B.level;if(z>=D)return z;let Q=this.getDeepestExpandedLevel(B.childrenAfterGroup,D);if(Q>z)z=Q;if(z>=D)return z}return z}updateGroupColumnVisibility(){let G=this.columns?.list;if(!G||G.length===0)return;let{gos:D,visibleCols:z,rowModel:B}=this.beans,Q=GI(D),J=!1,U=(S,X)=>{if(X!==S.isVisible())S.setVisible(X,"api"),J=!0},Z=()=>{for(let S of G)U(S,!0)};if(!Q)Z();else if(G.length>1){let S=G.length-2,X=B?.rootNode?.childrenAfterGroup,Y=this.getDeepestExpandedLevel(X,S);if(Y>=S)Z();else for(let W=0;W=W)}if(J)z.refresh("api")}destroy(){nZ(this.beans,this.columns?.tree),super.destroy()}},t1=null,dZ=(G)=>{let D=t1,z=new Uint32Array(1<<32-Math.clz32(G|63));if(D)z.set(D);return t1=z,z},LI=(G,D,z,B)=>{let Q=D-B,J=z-1;if(Q===1){let X=0;while(G[X].level===J)++X;if(X0){let Y=G[X];G.copyWithin(1,0,X),G[0]=Y}return G}let U=Array(Q),Z=0,S=0;for(let X=0;X{let z=G[0].level+1,B=z,Q=0,J=z,U=t1;if(!U||z>=U.length)U=dZ(z);++U[z];for(let W=1;Wz){if(z=q,z>=U.length)U=dZ(z)}else if(q=0)return U.fill(0,B,z+1),G;let Z=U[B],S=U[z];if(Z+S===D)return U[B]=0,U[z]=0,LI(G,D,z,S);let X=0;for(let W=z;W>=B;--W){let q=U[W];U[W]=X,X+=q}let Y=Array(D);for(let W=0;W{if(D===2){if(G[0].level16)return SI(G,D);for(let z=1;z=0&&G[J].level=0)z.set(D,-1),D=D.parent;return}let B=this.rows;do z.set(D,-1),B.push(D),D=D.parent;while(D!=null&&!z.has(D));this.unsorted=!0}addCell(G,D){if(D==null){this.addRow(G);return}if(G==null)return;let z=this.slots,B=this.bits,Q=z.get(D)??this.ensureCol(D),J=z.get(G);if(J===void 0)J=this.ensureRow(G);else if(J<0)return;let U=Q<32?B:this.extraBits[(Q>>>5)-1],Z=1<<(Q&31),S=U[J];if((S&Z)!==0)return;U[J]=S|Z;let X=G.parent;while(X!=null){let Y=z.get(X);if(Y<0)break;let W=U[Y];if((W&Z)!==0)break;U[Y]=W|Z,X=X.parent}}hasRow(G){return this.slots.has(G)}getSortedRows(){if(!this.unsorted)return this.rows;this.unsorted=!1;let G=y7(this.rows);return this.rows=G,G}getSlot(G){return this.slots.get(G)??-1}hasCellBySlot(G,D){if(G<0)return!0;if(D<32)return D>=0&&(this.bits[G]&1<>>5)-1][G]&1<<(D&31))!==0}ensureRow(G){let D=this.slots,z=this.rows,B=this.bits,Q=this.extraBits,J=B.push(0),U=J-1;if(Q!==null)for(let S=0,X=Q.length;S=32){let z=(D>>>5)-1,B=this.extraBits;if(B===null)B=[],this.extraBits=B;if(z>=B.length)B.push(Array(this.bits.length).fill(0))}return D}},lZ=class{constructor(){this.kind="rows",this.rows=[],this.unsorted=!1,this.rowSet=new Set}addRow(G){let D=G;if(D==null)return;let z=this.rowSet;if(z.has(D))return;let B=this.rows;do z.add(D),B.push(D),D=D.parent;while(D!=null&&!z.has(D));this.unsorted=!0}addCell(G,D){this.addRow(G)}hasRow(G){return this.rowSet.has(G)}getSortedRows(){if(!this.unsorted)return this.rows;this.unsorted=!1;let G=y7(this.rows);return this.rows=G,G}},YI=class extends $I{constructor(){super(...arguments);this.beanName="changedPathFactory"}newPath(G){return G?new XI:new lZ}ensureRowsPath(G){let D=G.changedPath;if(!D&&G.changedRowNodes&&!G.newData){let z=this.beans.rowModel;if(z.hierarchical)D=new lZ,G.changedPath=D,D.addRow(z.rootNode)}return D}},x7=class extends qI{addExpandedCss(G,D){if(D.isExpandable())G.push("ag-row-group"),G.push(D.expanded?"ag-row-group-expanded":"ag-row-group-contracted")}getRowExpandedListeners(G){let{rowNode:D}=G,z=this.updateExpandedCss.bind(this,G,D);return{expandedChanged:z,hasChildrenChanged:z}}setExpanded(G,D,z,B){if(G.expanded===D)return;G._expanded=D,G.dispatchRowEvent("expandedChanged");let Q={..._I(G,this.gos,"rowGroupOpened"),expanded:D,event:z||null};this.dispatchExpandedEvent(Q,B)}defaultExpanded(G){let z=this.beans.gos,B=G.level??0,Q=G.group&&z.get("isGroupOpenByDefault");if(!Q){let U=z.get("groupDefaultExpanded");return U===-1||B{let J=Q.rowComp;J.toggleCss("ag-row-group",z),J.toggleCss("ag-row-group-expanded",z&&B),J.toggleCss("ag-row-group-contracted",z&&!B),kI(Q.element,z&&B)})}dispatchStateUpdatedEvent(){this.eventSvc.dispatchEvent({type:"rowExpansionStateChanged"})}},wI=class extends x7{constructor(){super(...arguments);this.beanName="expansionSvc",this.events=null,this.dispatchExpandedDebounced=null}destroy(){super.destroy(),this.events=null,this.dispatchExpandedDebounced=null}setExpansionState(G){let D=new Set(G.expandedRowGroupIds);this.beans.rowModel.forEachNode((z)=>{let B=z.id;if(!B)return;z._expanded=D.has(B)}),this.onGroupExpandedOrCollapsed()}getInternalExpansionState(G=!1){let D=[],z=[];return this.beans.rowModel.forEachNode((B)=>{let Q=B.id;if(!Q)return;if(B.expanded)D.push(Q);else if(G&&B.isExpandable())z.push(Q)}),{expandedRowGroupIds:D,collapsedRowGroupIds:z}}getExpansionState(){return this.getInternalExpansionState()}isExpanded(G){if(G.footer)return!!G._expanded;if(!(G.group||G.master)||G.leafGroup&&this.beans.colModel.isPivotMode())return!1;let D=G._expanded;if(D===null)D=this.defaultExpanded(G)??!1,G._expanded=D;return!!D}resetExpansion(){let{rowModel:G}=this.beans;G.forEachNode((D)=>{if(!D.group&&!D.master)return;D._expanded=null}),this.onGroupExpandedOrCollapsed()}expandAll(G){let{gos:D,rowModel:z,colModel:B,eventSvc:Q}=this.beans,J=D.get("treeData"),U=B.isPivotActive(),Z=(X)=>{if(!X)return;for(let Y of X){let W=()=>{Y._expanded=G,Z(Y.childrenAfterGroup)};if(Y.master){W();continue}if(J){if(WI(Y.childrenAfterGroup))W();continue}if(U){if(!Y.leafGroup)W();continue}if(Y.group)W()}},S=z.rootNode;if(S)Z(S.childrenAfterGroup);this.onGroupExpandedOrCollapsed(),Q.dispatchEvent({type:"expandOrCollapseAll",source:G?"expandAll":"collapseAll"})}onGroupExpandedOrCollapsed(){this.dispatchStateUpdatedEvent(),this.beans.rowModel.reMapRows()}setDetailsExpansionState(G){let D=this.getInternalExpansionState(!0),z=D.collapsedRowGroupIds.length===0;if(D.expandedRowGroupIds.length===0===z)return;return z?G.expandAll():G.collapseAll()}dispatchExpandedEvent(G,D){if((this.events??(this.events=[])).push(G),D){this.dispatchExpandedEvents();return}let z=this.dispatchExpandedDebounced;if(!z){if(!this.isAlive())return;z=this.debounce(()=>this.dispatchExpandedEvents()),this.dispatchExpandedDebounced=z}z()}dispatchExpandedEvents(){let{eventSvc:G,rowRenderer:D}=this.beans,z=this.events,B=z?.length;if(!B)return;this.events=null;let Q=Array(B);for(let J=0;Jwindow.setTimeout(G,0);let z=!1;return()=>{if(!D.active){window.setTimeout(G,0);return}if(z)return;z=!0,D.addDestroyTask(()=>{z=!1,G()})}}};function c7(G){let D=G.get("groupHideParentOfSingleChild");if(!D){if(D=G.get("groupRemoveSingleChildren"),!D&&G.get("groupRemoveLowestSingleChildren"))D="leafGroupsOnly"}return{groupHideParentOfSingleChild:D,isGroupMultiAutoColumn:FI(G),hideOpenParents:G.get("groupHideOpenParents"),grandTotalRow:fI(G),groupTotalRow:NI(G)}}function h7(G,D,z){return G.groupHideParentOfSingleChild===!0&&z&&D.childrenAfterGroup.length===1}function i7(G,D,z){return G.groupHideParentOfSingleChild==="leafGroupsOnly"&&z&&D.leafGroup&&D.childrenAfterGroup.length===1}function n7(G,D,z,B,Q,J){if(B&&!z)return!1;if(Q||J)return!1;if(!G.hideOpenParents)return!0;if(D.master||D.level===-1)return!0;if(!(B&&D.leafGroup)&&D.expanded)return!1;return!0}var EI=class extends KI{constructor(){super(...arguments);this.beanName="flattenStage",this.step="map",this.refreshProps=["groupHideParentOfSingleChild","groupRemoveSingleChildren","groupRemoveLowestSingleChildren","groupTotalRow","masterDetail"]}execute(){let{beans:G,gos:D}=this,z=[],B=G.rowModel.rootNode;if(!B)return z;let Q=G.colModel.isPivotMode(),J=Q&&B.leafGroup&&B.aggData,U=J?[B]:B.childrenAfterSort,Z=c7(D);this.recursivelyAddToRowsToDisplay(Z,U,z,Q,0);let S=z.length>0,X=Z.grandTotalRow;if(!J&&S&&X)if(pG(B,G),X==="pinnedBottom"||X==="pinnedTop")this.beans.pinnedRowModel?.setGrandTotalPinned(X==="pinnedBottom"?"bottom":"top");else{let W=X==="top";this.addRowNodeToRowsToDisplay(Z,B.sibling,z,0,W)}return z}recursivelyAddToRowsToDisplay(G,D,z,B,Q){if(!D?.length)return;let J=this.beans.masterDetailSvc;for(let U=0;Uthis.onCsrmCellChange(G),batchEditingStopped:()=>this.flushGroupEdits()})}destroy(){this.stopDragging(!0),super.destroy()}isGroupingDrop(G){if(!G.rowDragManaged||!G.sameGrid)return!1;if(!this.gos.get("refreshAfterGroupEdit"))return!1;return!!this.beans.rowGroupColsSvc?.columns?.length&&!this.beans.colModel.isPivotMode()}initDraggingGroups(G){let D=new Map,z=(B)=>{let Q=B.childrenAfterGroup;if(Q){if(D.has(B))return;let J=Q.slice();D.set(B,J);for(let U of J)z(U)}};for(let B of G.rows)if(B.group)z(B);this.draggingGroups=D}canSetParent(G){if(!G.sameGrid)return!1;if(this.beans.groupStage?.treeData)return!0;if(G.rowDragManaged&&!this.gos.get("refreshAfterGroupEdit"))return!1;return!!this.beans.rowGroupColsSvc?.columns?.length}canDropRow(G,D){if(this.beans.groupStage?.treeData)return!vI(G,D.newParent);let{position:z,target:B,newParent:Q,rootNode:J}=D,U=G.parent;if(G.group&&(mZ(G,B)||mZ(G,Q)))return!1;if(z==="inside")return!0;if(Q&&Q!==U)return Q!==J||U===J;let Z=Q??B?.parent??J;if(Z!==U)return!1;let S=G.group?G.level:U.level??-1,X=-1;if(B)X=B.group?B.level:B.parent?.level??-1;else if(Z)X=Z.level;if(S>=0&&X>=0&&X!==S)return!1;return!0}fixRowsDrop(G,D,z,B){let Q=!!this.beans.groupStage?.treeData;if(G.treeData=Q,!(!!this.beans.rowGroupColsSvc?.columns?.length||this.gos.get("pivotMode"))&&!Q)return;if(!this.draggingGroups&&this.isGroupingDrop(G)&&!G.suppressMoveWhenRowDragging)this.initDraggingGroups(G);let U=G.target,Z=null,S=!1,X=G.rootNode,Y=this.beans.rowModel,W=this.canStartGroup(U,Q);this.updateDropTarget(G,z,W);let q=this.beans.pageBounds?.getLastRow?.()??Y.getRowCount()-1;if(D){if(!U||B>=0.5&&U.rowIndex===q)Z=X;else if(G.moved&&U&&this.dropGroupThrottled&&this.shouldDropTargetBeParent(G))Z=U;if(!Z)Z=U?.parent??X}if(!z&&U&&W&&!(U.group&&U.expanded))this.startDropGroupDelay(U);if(Z){if(U&&Z===U&&Z!==X){let H=Z.expanded?VI(Y,1,U):null;if(H?.parent===Z)U=H,B=-0.5;else S=!0}if(U&&!S){let H=U;while(H&&H!==X&&H!==Z)U=H,H=H.parent}}G.target=U,G.newParent=Z,G.yDelta=B,G.inside=S}clearNewSameParent(G,D){let z=G.newParent;if(z&&(!D||OI(G.rows,z)))G.newParent=null}updateDropTarget(G,D,z){let B=z?G.target:null;if(this.dropGroupTarget&&this.dropGroupTarget!==B)this.resetDragGroup();if(!B?.childrenAfterSort?.length)return;if(D&&this.dropGroupThrottled&&!B.expanded&&B.isExpandable?.())B.setExpanded(!0,void 0,!0);if(this.canDropInTarget(B,G))this.dropGroupThrottled=!0,this.dropGroupTarget=B}canDropInTarget(G,D){if(G.expanded)return!0;if(!G.group)return!1;if(D.pointerPos==="inside")return!0;if(D.treeData)return!1;let z=D.rows,B=G.level;for(let Q=0,J=z.length;Q{this.dropGroupTimer=null,this.dropGroupThrottled=!0,this.beans.dragAndDrop?.nudge()},D)}resetDragGroup(){if(this.dropGroupTimer!==null)window.clearTimeout(this.dropGroupTimer),this.dropGroupTimer=null;this.dropGroupTarget=null,this.dropGroupThrottled=!1}stopDragging(G){if(G)this.draggingGroups=null;this.resetDragGroup()}shouldDropTargetBeParent({target:G,rows:D,pointerPos:z,treeData:B}){if(!G||z==="none")return!1;if(z==="inside")return!0;if(!B&&G.group&&!G.expanded)return!0;if(z==="above")return!1;let Q=this.beans.rowModel,U=G.rowIndex+1,Z;do Z=Q.getRow(U++);while(Z?.footer);let S=this.draggingGroups?.get(G)??G.childrenAfterGroup;if(Z&&Z.parent===G&&S?.length){let X=new Set(D);for(let Y=0,W=S.length;Y{if(X.has(f))return;if(X.add(f),q??(q=this.newGroupValues(J)),this.setRowGroup(f,q))W.add(f)},_=(f)=>{let N=this.draggingGroups?.get(f)??f.childrenAfterGroup,F=N?.length;if(F)for(let E=0;E=0)H(I);else _(I)}};for(let f of G.rows)if(f.group)_(f);else{let N=f.sourceRowIndex>=0&&!f.destroyed?f:this.csrmFirstLeaf(f);if(N)H(N)}let k=z==="inside"?"above":z,w=z==="inside"?this.findFirstLeafForParent(J,X)??B:B,K=!1;if(X.size&&k!=="none")K=AI(Q._leafs,X,w,k==="above");if(!W.size&&!K)return!1;Y.reordered=K;for(let f of X)Y.updates.add(f);if(this.csrmRefresh(Y),S)S.focusCell();else U.clearFocusedCell();return!0}canStartGroup(G,D){if(!G||G.level<0||G.footer||G.detail)return!1;if(G.group)return!0;return D}flushGroupEdits(){let G=this.pendingEditRefresh;if(G)this.pendingEditRefresh=null,this.csrmRefresh(G)}csrmRefresh(G){let D=this.beans.rowModel;if(!D.rootNode)return;D.refreshModel({step:"group",keepRenderedRows:!0,animate:!this.gos.get("suppressAnimationFrame"),changedRowNodes:G})}newGroupValues(G){let D=this.beans.rowGroupColsSvc?.columns??[],z=Array(D.length),B=-1,Q=G;while(Q&&Q.level>=0){let J=D[Q.level];if(J){let U=J.getColId(),Z=Q.level;if(z[Z]=Q.groupData?.[U]??Q.key??void 0,Z>B)B=Z}Q=Q.parent}return{values:z,columns:D,maxLevel:B}}setRowGroup(G,{values:D,columns:z,maxLevel:B}){if(B<0)return!1;let{valueSvc:Q,changeDetectionSvc:J}=this.beans,U=!1;J?.beginDeferred();try{for(let Z=0;ZB)continue;let X=D[Z],Y=Q.getValue(S,G,"data");if(Y===X||Y==null&&X==null)continue;let W=X,q=Q.parseValue(S,G,X,Y);if(q!==void 0)W=q;if(G.setDataValue(S,W,"rowDrag"))U=!0}}finally{J?.endDeferred()}return U}onCsrmCellChange(G){let{column:D,node:z,source:B}=G;if(!this.gos.get("refreshAfterGroupEdit"))return;if(B==="rowDrag")return;if(!D?.isRowGroupActive())return;if(z.group||!z.data)return;if(this.beans.editSvc?.isBatchEditing()){let J=this.pendingEditRefresh;if(!J)J=pZ(),this.pendingEditRefresh=J;J.updates.add(z)}else{let J=pZ();J.updates.add(z),this.csrmRefresh(J)}}csrmFirstLeaf(G){if(!G)return null;let D=this.draggingGroups,z=D?.get(G)??G.childrenAfterGroup;while(z?.length){let B=z[0];if(B.sourceRowIndex>=0){if(!B.destroyed)return B;return this.firstAliveChildLeaf(B)}z=D?.get(B)??B.childrenAfterGroup}return MI(G)}firstAliveChildLeaf(G){let D=this.draggingGroups?.get(G)??G.childrenAfterGroup;if(D){for(let z of D)if(z.sourceRowIndex>=0&&!z.destroyed)return z}return null}findFirstLeafForParent(G,D){if(!G)return null;let z=this.draggingGroups?.get(G)??G?.childrenAfterGroup;if(!z)return null;for(let B=0,Q=z.length;B=0&&!D.has(J))return J;let U=this.findFirstLeafForParent(J,D);if(U!==null)return U}return null}},pZ=()=>{let G=new d7;return G.reordered=!0,G},mZ=(G,D)=>{if(!G||!D)return!1;let z=D;while(z){if(z===G)return!0;z=z.parent}return!1},vI=(G,D)=>{if(!D||G.parent===D)return!1;let z=D,B=G.id;while(z){if(z===G)return!0;if(B!=null&&z.id===B)return!0;z=z.parent}return!1},OI=(G,D)=>{for(let z=0,B=G.length;zthis.strategy?.onShowRowGroupColsSetChanged()})}invalidateGroupCols(){this.columnsInvalidated=!0,this.strategy?.invalidateGroupCols?.()}destroy(){this.strategy=this.destroyBean(this.strategy),super.destroy()}getNonLeaf(G){return this.strategy?.nonLeafsById?.get(G)}getNestedDataGetter(){return this.getStrategy()?.nestedDataGetter}onPropChange(G){let D=this.gos,z=this.strategy?.nestedDataGetter;if(G.has("treeData"))this.gosTreeData=D.get("treeData")&&this.hasTreeData,this.columnsInvalidated=!0;return this.strategy?.onPropChange?.(G),this.getNestedDataGetter()!==z}extractData(){let G=this.beans.rowModel.rootNode,D=this.nested?G?.childrenAfterGroup:G?._leafs;if(!D)return this.gos.get("rowData")??[];let z=D.length,B=Array(z),Q=0;for(let J=0;J{let D=G.sibling;if(!D)return null;let z=D._leafs;if(z!==void 0)return z;return MB(D)},MB=(G)=>{let D=G.childrenAfterGroup,z=D?.length;if(G._leafs=null,!z)return null;let B,Q=z===1?D[0]:null;if(Q?.group&&Q.sourceRowIndex<0){if(B=Q._leafs,B===void 0)B=MB(Q)}else if(G.leafGroup)B=D;else{B=[];for(let J=0;J=0)B.push(U);if(!U.group)continue;let Z=U._leafs;if(Z===void 0)Z=MB(U);if(Z)for(let S=0,X=Z.length;S{let{_leafs:B,sibling:Q}=G;if(G.treeNodeFlags=0,G.childrenAfterGroup=B,G.childrenMapped=null,G._groupData=void 0,G.aggData=null,Q)Q.childrenAfterGroup=G.childrenAfterGroup,Q.childrenAfterAggFilter=G.childrenAfterAggFilter,Q.childrenAfterFilter=G.childrenAfterFilter,Q.childrenAfterSort=G.childrenAfterSort,Q.childrenMapped=null,Q._groupData=void 0,Q.aggData=null;for(let J=0,U=B.length??0;J{G.key=null,G.treeNodeFlags=0,G.allChildrenCount=null,G.childrenAfterGroup=null,G.childrenAfterAggFilter=null,G.childrenAfterFilter=null,G.childrenAfterSort=null,G.childrenMapped=null,G.level=0,G._groupData=void 0};function G2(G,D,z){let B=G,Q=B.level-D.level;if(Q<=0)return!1;if(!z.get("groupHideOpenParents"))return!1;for(let U=0;U{let{rowDragSvc:D}=this.beans;if(!this.params.rowDrag||!D)return;let z=D.createRowDragComp(()=>this.params.value,this.params.node);this.createManagedBean(z),this.eGui.insertAdjacentElement("afterbegin",z.getGui())};this.setupExpand(),G(),this.setupCheckbox(),this.addGroupValue(),this.setupIndent()}getCellAriaRole(){let G=this.params.colDef?.cellAriaRole,D=this.params.column?.getColDef().cellAriaRole;return G||D||"gridcell"}isEmbeddedRowMismatch(){if(!this.params.fullWidth||!this.gos.get("embedFullWidthRows"))return!1;let{visibleCols:G}=this.beans,D=this.params.pinned==="left",z=this.params.pinned==="right",B=!D&&!z;if(this.gos.get("enableRtl")){if(G.isPinningLeft())return!z;return!B}if(G.isPinningLeft())return!D;return!B}addGroupValue(){let{params:{value:G,valueFormatted:D}}=this,z=this.getInnerCompDetails();this.comp.setInnerRenderer(z,D??G??null)}setupExpand(){let{colModel:G}=this.beans,{eGridCell:D,suppressDoubleClickExpand:z}=this.params,B=(S,X)=>{let Y=cI(S,this.beans,null);if(Y)X.appendChild(Y),this.addDestroyFunc(()=>Y.remove())};B("groupExpanded",this.eExpanded),B("groupContracted",this.eContracted);let Q=this.comp,J=()=>{if(!this.isExpandable())return;let X=!!this.displayedNode.expanded;Q.setExpandedDisplayed(X),Q.setContractedDisplayed(!X),lI(D,X)},U=()=>{let S=this.isExpandable();Q.toggleCss("ag-cell-expandable",S),Q.toggleCss("ag-row-group",S);let X=!S&&G.isPivotMode();Q.toggleCss("ag-pivot-leaf-group",X);let Y=!G.isPivotMode()&&(!this.displayedNode.footer||this.displayedNode.level!==-1);Q.toggleCss("ag-row-group-leaf-indent",!S&&Y);let W=this.getChildCount(),q=W>0?`(${W})`:"";if(Q.setChildCount(q),!S)Q.setExpandedDisplayed(!1),Q.setContractedDisplayed(!1),dI(D);else J()};(()=>{if(!z&&!this.isGroupCellEditable(this.displayedNode))this.addManagedListeners(D,{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(D,{keydown:this.onKeyDown.bind(this)}),this.addManagedListeners(this.displayedNode,{allChildrenCountChanged:U,masterChanged:U,groupChanged:U,hasChildrenChanged:U,expandedChanged:J})})(),U()}getInnerCompDetails(){let{userCompFactory:G,findSvc:D}=this.beans,z=this.params;if(z.fullWidth){let S=this.gos.get("groupRowRendererParams"),X=x0(G,S,z);if(X)return X;if(D?.isMatch(z.node,null))return x0(G,{...S,innerRenderer:"agFindCellRenderer"},z);return}let B=(S)=>S&&S.componentClass==this.compClass,Q=x0(G,z,z);if(Q&&!B(Q))return Q;let{displayedNode:{rowGroupColumn:J}}=this,U=J?.colDef,Z=J&&z.column?.isRowGroupDisplayed(J.getId());if(U&&Z){let S=rZ(G,U,z);if(S)if(B(S)){if(U?.cellRendererParams?.innerRenderer)return x0(G,U.cellRendererParams,z)}else return S}if(D?.isMatch(z.node,z.column))return rZ(G,{...U??z.colDef,cellRenderer:"agFindCellRenderer"},z)}getChildCount(){let{column:G,suppressCount:D}=this.params;if(D)return 0;let{allChildrenCount:z,rowGroupColumn:B}=this.displayedNode;if(!((z??0)>0&&(!B||!G||G?.isRowGroupDisplayed(B.getId()))))return 0;if(this.gos.get("showOpenedGroup")&&this.displayedNode!==this.node&&!G2(this.node,this.displayedNode,this.gos))return 0;return z??0}isExpandable(){let{node:G,column:D,colDef:z}=this.params;if(!this.displayedNode.isExpandable())return!1;if(G.rowPinned)return!1;if(!D)return!0;if(G.hasChildren()&&z){let{showRowGroup:J}=z;if(!J)return!1;if(J===!0)return!0}if(G===this.displayedNode){if(G.rowGroupColumn){if(D?.isRowGroupDisplayed(G.rowGroupColumn.getId()))return!0}if(G.master)return z?.showRowGroup===!0||z?.showRowGroup==null;return!1}return G2(this.node,this.displayedNode,this.gos)}setupIndent(){let{suppressPadding:G,node:D,colDef:z}=this.params;if(G)return;let B=()=>{let Q=D.uiLevel;if(z&&z.showRowGroup!==!0)Q=0;let J="ag-row-group-indent-"+Q;if(J===this.indentClass)return;if(this.indentClass)this.comp.toggleCss(this.indentClass,!1);this.indentClass=J,this.comp.toggleCss(J,!0),this.eGui.style.setProperty("--ag-indentation-level",String(Q))};this.addManagedListeners(D,{uiLevelChanged:B.bind(this)}),B()}setupCheckbox(){let{node:G}=this.params;if(!(!G.footer&&!G.rowPinned&&!G.detail))return;this.addManagedPropertyListener("rowSelection",({currentValue:z,previousValue:B})=>{let Q=typeof z==="object"?z:void 0,J=typeof B==="object"?B:void 0;if(Q?.checkboxLocation!==J?.checkboxLocation)this.destroyCheckbox(),this.addCheckbox()}),this.addCheckbox()}addCheckbox(){let{selectionSvc:G}=this.beans;if(!G||!nI(this.gos))return;let{node:D,column:z}=this.params,B=this.gos.get("rowSelection"),Q=hI(B);if(Q==="selectionColumn")return;if(Q==="autoGroupColumn"){let X=z?.getColDef().showRowGroup!=null,Y=!z&&D.group;if(!(X||Y))return}let J=typeof B==="object"?iI(B):this.params.checkbox;if(!(typeof J==="function"||J===!0))return;if(typeof z?.getColDef().showRowGroup==="string"&&!this.isExpandable()){this.comp.setCheckboxSpacing(!0);return}let S=G.createCheckboxSelectionComponent();this.cbComp=S,this.createBean(S),S.init({rowNode:D,column:z,overrides:{isVisible:J,callbackParams:this.params,removeHidden:!0}}),this.eCheckbox.appendChild(S.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(G){let D=this.params.column;return!!D&&(!!D.getColDef().groupRowEditable||this.gos.get("enableGroupEdit"))&&D.isCellEditable(G)}onExpandClicked(G){if(eZ(G))return;pI(G),this.onExpandOrContract(G)}onKeyDown(G){if(G.key!==oZ.ENTER||this.params.suppressEnterExpand)return;if(this.isGroupCellEditable(this.params.node))return;this.onExpandOrContract(G)}onCellDblClicked(G){if(eZ(G))return;if(!(aZ(this.eExpanded,G)||aZ(this.eContracted,G)))this.onExpandOrContract(G)}onExpandOrContract(G){if(!this.isExpandable())return;let D=this.displayedNode,z=!D.expanded;if(!z&&D.sticky)this.beans.ctrlsSvc.getScrollFeature().setVerticalScrollPosition(D.rowTop-D.stickyRowTop);D.setExpanded(z,G)}destroy(){super.destroy(),this.destroyCheckbox()}},mI={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"}]},D2=class extends TI{constructor(){super(mI);this.eExpanded=Pz,this.eContracted=Pz,this.eCheckbox=Pz,this.eValue=Pz,this.eChildCount=Pz}init(G){let D={setInnerRenderer:(J,U)=>this.setRenderDetails(J,U),setChildCount:(J)=>this.eChildCount.textContent=J,toggleCss:(J,U)=>this.toggleCss(J,U),setContractedDisplayed:(J)=>sZ(this.eContracted,J),setExpandedDisplayed:(J)=>sZ(this.eExpanded,J),setCheckboxVisible:(J)=>this.eCheckbox.classList.toggle("ag-invisible",!J),setCheckboxSpacing:(J)=>this.eCheckbox.classList.toggle("ag-group-checkbox-spacing",J)},z=this.createManagedBean(new l7),B=!G.colDef,Q=this.getGui();if(z.init(D,Q,this.eCheckbox,this.eExpanded,this.eContracted,this.constructor,G),B)yI(Q,z.getCellAriaRole())}setRenderDetails(G,D){if(G)G.newAgStackInstance().then((z)=>{if(!z)return;let B=()=>this.destroyBean(z);if(this.isAlive())this.eValue.appendChild(z.getGui()),this.addDestroyFunc(B);else B()});else this.eValue.innerText=D}destroy(){this.destroyBean(this.innerCellRenderer),super.destroy()}refresh(){return!1}},tI=".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)}",oI=class extends sI{constructor(){super(...arguments);this.beanName="showRowGroupColValueSvc"}getGroupValue(G,D,z){if(!D){if(!G.group)return null;return{displayedNode:G,value:G.groupValue}}let B=this.beans.valueSvc,Q=D.colDef.showRowGroup;if(!Q)return null;if(G.level===-1&&G.footer)return{displayedNode:G,value:null};if(typeof Q==="string"){if((this.beans.rowGroupColsSvc?.getColumnIndex(Q)??-1)>G.level)return null;let Z=this.getDisplayedNode(G,D,!0);if(Z)return{displayedNode:Z,value:B.getValue(D,Z,"data",z)}}let J=B.getValue(D,G,"data",z);if(J==null){let U=this.getDisplayedNode(G,D);if(U)return{displayedNode:U,value:B.getValue(D,U,"data",z)}}return{displayedNode:G,value:J}}formatAndPrefixGroupColValue(G,D,z=!1){let B=this.formatGroupColValue(G,D,z),{value:Q,displayedNode:J}=G,U=this.beans.footerSvc;if(U?.doesCellShowTotalPrefix(J,D))return U.applyTotalPrefix(Q,B,J,D);if(J.footer&&J.level===-1)return null;return B}formatGroupColValue(G,D,z=!1){let B=this.beans.valueSvc,{displayedNode:Q,value:J}=G,U=Q.rowGroupColumn,Z=Q.group&&!D;if(U&&(Z||D?.isRowGroupDisplayed(U.colId))){if(z&&U.colDef.useValueFormatterForExport===!1)return null;let X=B.formatValue(U,Q,J);if(X==null&&Q.key==="")return this.getLocaleTextFunc()("blanks","(Blanks)");return X}if(!D||Q.group)return null;if(z&&D.colDef.useValueFormatterForExport===!1)return null;return B.formatValue(D,Q,J)}getDisplayedNode(G,D,z=!1){let B=this.gos,Q=B.get("groupHideOpenParents"),J=B.get("showOpenedGroup")&&!z;if(!Q&&!J)return;let U=D.colDef.showRowGroup;if(U===!0){if(G.group)return;return G.parent??void 0}let Z=G;while(Z&&Z.rowGroupColumn?.getId()!=U){let S=Z===Z.parent?.getFirstChild();if(!J&&!S)return;Z=Z.parent}if(Z===G)return;return Z??void 0}},aI=class extends rI{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:G,rowGroupColsSvc:D}=this.beans,z=this.columns,B=this.colsSet,Q=this.colsMap;Q.clear();let J=z.length,U=0,Z=!1,S=G.getCols();for(let X=0,Y=S.length;X=J||!B.has(W)),z[U++]=W}if(Z||(Z=U!==J),Z){z.length=U,B.clear();for(let X=0;X{this.gridBodyCtrl=G.gridBodyCtrl}),this.resetStickyContainers()}setOffsetTop(G){if(this.extraTopHeight===G)return;this.extraTopHeight=G,this.eventSvc.dispatchEvent({type:"stickyTopOffsetChanged",offset:G})}setOffsetBottom(G){if(this.extraBottomHeight===G)return;this.extraBottomHeight=G}resetOffsets(){this.setOffsetBottom(0),this.setOffsetTop(0)}getLastPixelOfGroup(G){return this.isClientSide?SM(G):LM(G)}getFirstPixelOfGroup(G){if(G.footer)return G.sibling.rowTop+G.sibling.rowHeight-1;if(G.hasChildren())return G.rowTop-1;return 0}updateStickyRows(G){let D=G==="top",z=0;if(!this.canRowsBeSticky())return this.refreshNodesAndContainerHeight(G,new Set,z);let B=new Set,{rowModel:Q,rowRenderer:J,pinnedRowModel:U,pageBounds:Z,rowContainerHeight:S}=this.beans,{pageFirstPixel:X,pageLastPixel:Y}=Z.getCurrentPagePixelRange(),W=D?J.firstVisibleVPixel-this.extraTopHeight:J.lastVisibleVPixel-this.extraTopHeight,q=S.divStretchOffset??0,H=X+q,_=Y+q,k=(N)=>{if(B.add(N),D){let F=this.getLastPixelOfGroup(N),E=W+z+N.rowHeight;if(FE)N.stickyRowTop=z-(F-E);else N.stickyRowTop=z}z=0,B.forEach((F)=>{let E=F.stickyRowTop+F.rowHeight;if(z{if(!N.displayed)return!1;if(N.footer){if(w===!0)return!1;if(w==="grand"&&N.level===-1)return!1;if(w==="group"&&N.level>-1)return!1;let F=N.sibling.rowIndex?N.sibling.rowIndex+1===N.rowIndex:!1;if(G==="bottom"&&F)return!1;if(N.level===-1&&U?.getGrandTotalPinned())return!1;return!B.has(N)}if(N.isExpandable()){if(K===!0)return!1;if(G==="bottom")return!1;return!B.has(N)&&!!N.expanded}return!1};for(let N=0;N<100;N++){let F=W+z;if(!D)F=W-z;if(D&&F_)F=_;let E=Q.getRowIndexAtPixel(F),I=Q.getRow(E);if(I==null)break;let A=this.getStickyAncestors(I).find((O)=>(D?O.rowIndexE)&&f(O));if(A){k(A);continue}if((D?I.rowTopF)&&f(I)){k(I);continue}break}if(!D)B.forEach((N)=>{N.stickyRowTop=z-(N.stickyRowTop+N.rowHeight)});return this.refreshNodesAndContainerHeight(G,B,z)}areFooterRowsStickySuppressed(){let G=this.gos.get("suppressStickyTotalRow");if(G===!0)return!0;let D=G==="group",z=G==="grand";if(D&&z)return!0;if(z)return"grand";if(D)return"group";return!1}canRowsBeSticky(){let G=UM(this.gos),D=this.areFooterRowsStickySuppressed(),z=this.gos.get("suppressGroupRowsSticky");return G&&(!D||!z)}getStickyAncestors(G){let D=[],z=G.footer?G.sibling:G.parent;while(z){if(z.sibling)D.push(z.sibling);D.push(z),z=z.parent}return D.reverse()}checkStickyRows(){let G=this.updateStickyRows("top"),D=this.updateStickyRows("bottom");return G||D}destroyStickyCtrls(){this.resetStickyContainers()}resetStickyContainers(){this.refreshNodesAndContainerHeight("top",new Set,0),this.refreshNodesAndContainerHeight("bottom",new Set,0)}refreshStickyNode(G){let D=new Set;if(this.stickyTopRowCtrls.some((z)=>z.rowNode===G)){for(let z=0;z{if(Z.has(H))return;H.sticky=!0,S.push(this.createRowCon(H,!1,!1))});let X=!!S.length||U.length!==Q.length;if(B){if(this.topContainerHeight!==z)this.topContainerHeight=z,this.gridBodyCtrl.setStickyTopHeight(z),X=!0}else if(this.bottomContainerHeight!==z)this.bottomContainerHeight=z,this.gridBodyCtrl.setStickyBottomHeight(z),X=!0;this.destroyRowCtrls(J,!1);let Y=[...U,...S];if(Y.sort((H,_)=>_.rowNode.rowIndex-H.rowNode.rowIndex),!B)Y.reverse();for(let H of Y)H.setRowTop(H.rowNode.stickyRowTop);let W=this.beans.pageBounds,q=0;if(B){for(let H of D)if(H.rowIndexthis.topContainerHeight)q=this.topContainerHeight;this.setOffsetTop(q)}else{for(let H of D)if(H.rowIndex>W.getLastRow())q+=H.rowHeight;if(q>this.bottomContainerHeight)q=this.bottomContainerHeight;this.setOffsetBottom(q)}if(!X)return!1;if(B)this.stickyTopRowCtrls=Y;else this.stickyBottomRowCtrls=Y;return!0}ensureRowHeightsValid(){let G=!1,D=(z)=>{let B=z.rowNode;if(B.rowHeightEstimated){let Q=QM(this.beans,B);B.setRowHeight(Q.height),G=!0}};return this.stickyTopRowCtrls.forEach(D),this.stickyBottomRowCtrls.forEach(D),G}};function LM(G){if(G.isExpandable()||G.footer){if(G.master&&G.detailNode)return G.detailNode.rowTop+G.detailNode.rowHeight;if(!G.sibling||Math.abs(G.sibling.rowIndex-G.rowIndex)===1){let z=G.childStore?.getStoreBounds();if(G.footer)z=G.sibling.childStore?.getStoreBounds();return(z?.heightPx??0)+(z?.topPx??0)}if(G.footer)return G.rowTop+G.rowHeight;return G.sibling.rowTop+G.sibling.rowHeight}return Number.MAX_SAFE_INTEGER}function SM(G){if(G.isExpandable()||G.footer){if(G.footer&&G.rowIndex===0)return Number.MAX_SAFE_INTEGER;if(!G.sibling||Math.abs(G.sibling.rowIndex-G.rowIndex)===1){let B=G.footer?G.sibling:G;while(B.isExpandable()&&B.expanded)if(B.master&&B.detailNode)B=B.detailNode;else if(B.childrenAfterSort){if(B.childrenAfterSort.length===0)break;B=ZM(B.childrenAfterSort)}return B.rowTop+B.rowHeight}if(G.footer)return G.rowTop+G.rowHeight;return G.sibling.rowTop+G.sibling.rowHeight}return Number.MAX_SAFE_INTEGER}var XM=class extends eI{constructor(){super(...arguments);this.beanName="stickyRowSvc"}createStickyRowFeature(G,D,z){let B=this.gos;if(DM(B)&&GM(B)||zM(B))return G.createManagedBean(new $M(D,z));return}},p7={moduleName:"GroupCellRenderer",version:j,userComponents:{agGroupRowRenderer:D2,agGroupCellRenderer:D2},dynamicBeans:{groupCellRendererCtrl:l7},icons:{groupContracted:"tree-closed",groupExpanded:"tree-open"},css:[tI],dependsOn:[i]},m7={moduleName:"GroupColumn",version:j,beans:[ZI,aI,oI,dE,T7,g7],dependsOn:[i,p7]},AJ={moduleName:"ChangedPath",version:j,beans:[YI],dependsOn:[i]},_0={moduleName:"ClientSideRowModelHierarchy",version:j,rowModels:["clientSide"],beans:[jI,EI,wI],dependsOn:[i,AJ]},RJ={moduleName:"StickyRow",version:j,beans:[XM]},t7={moduleName:"GroupEdit",version:j,beans:[bI],dependsOn:[i,_0]},NM=({valueSvc:G,dataTypeSvc:D},z,B)=>{let Q=G.getValue(z,B,"data"),J=null;if(Q instanceof Date)J=Q;else if(typeof Q==="string")J=(D?.getDateParserFunction(z)??fM)(Q)??null;return J},GD=(G,D,z,B)=>(Q)=>{let J=NM(G,D,Q.node),U=KM(J);if(!U)return null;return B?.(U[z])??U[z]},DD=({colNames:G},D,z)=>(B)=>{let Q=G.getDisplayNameForColumn(D,B.location);if(Q)return`${Q} (${z})`;return""},FM=Object.fromEntries(s7.map((G)=>[G,G.toLowerCase()])),EM=(G)=>{let D=s7[Number.parseInt(G,10)-1]??G,z=FM[D]??G;return{month:D,localeKey:z}};function Q2(G){return G.groupHierarchy??G.rowGroupingHierarchy}var IM=class extends WM{constructor(){super(...arguments);this.beanName="groupHierarchyColSvc",this.columns=null,this.sourceColumnMap=new WeakMap,this.inverseColumnMap=new WeakMap}addColumns(G){let D=this.columns;if(D==null)return;G.list=D.list.filter((z)=>!G.list.some((B)=>B.getColId()===z.getColId())).concat(G.list),G.tree=D.tree.filter((z)=>!G.tree.some((B)=>B.getId()===z.getId())).concat(G.tree),wM(G)}createColumns(G){let D=new WeakMap,z=new WeakMap,B=this.createGroupHierarchyColumns(G,D,z);if(HM(B,this.columns?.list??[]))return;_M(this.beans,this.columns?.tree),this.columns=null;let{colGroupSvc:J}=this.beans,U=J?.findDepth(G.tree)??0,Z=J?.balanceTreeForAutoCols(B,U)??[];this.columns={list:B,tree:Z,treeDepth:U,map:{}},this.sourceColumnMap=D,this.inverseColumnMap=z}updateColumns(G){}getColumn(G){return this.columns?.list.find((D)=>B2(D,G))??null}getColumns(){return this.columns?.list??null}expandColumnInto(G,D){let z=this.getVirtualColumnsForColumn(D).concat(D);for(let B of z)if(!G.some((Q)=>B2(Q,B)||Q.getColId()===B.getColId()))G.push(B)}compareVirtualColumns(G,D){let z=this.inverseColumnMap.get(G),B=this.inverseColumnMap.get(D);if(z&&z===B){let Q=this.sourceColumnMap.get(z)??[];return Q?.indexOf(G)-Q?.indexOf(D)}if(this.sourceColumnMap.get(G)?.includes(D))return 1;if(this.sourceColumnMap.get(D)?.includes(G))return-1;return null}insertVirtualColumnsForCol(G,D){let z=this.getVirtualColumnsForColumn(D);if(!z)return[];let B=G.indexOf(D);if(B<0)B=G.length-1;return kM(G,z),G.splice(B,0,...z),z}getVirtualColumnsForColumn(G){if(this.isGroupHierarchyColsEnabledForCol(G))return this.sourceColumnMap.get(G)??[];return[]}isGroupHierarchyColsEnabled(G){return G.list.some((D)=>this.isGroupHierarchyColsEnabledForCol(D))}isGroupHierarchyColsEnabledForCol(G){let D=G.getColDef();return!!(Q2(D)&&(D.rowGroup||D.enableRowGroup||D.rowGroupIndex!=null||D.pivot||D.enablePivot||D.pivotIndex!=null))}createGroupHierarchyColDefs(G){let D=[],z=G.getColDef(),B=Q2(z);if(!B)return D;if(!this.isGroupHierarchyColsEnabledForCol(G))return D;for(let Q of B){let J=null;if(typeof Q==="string")J=this.createColDefForPart(Q,G,z);else J=Q;if(J)D.push(J)}return D}createGroupHierarchyColumns(G,D,z){if(!this.isGroupHierarchyColsEnabled(G))return[];let B=[];for(let Q of G.list)for(let J of this.createGroupHierarchyColDefs(Q)){let U=J.colId;this.gos.validateColDef(J,U,!0);let Z=new YM(J,null,U,!0);this.createBean(Z),B.push(Z),MM(D,Q,Z),z.set(Z,Q)}return B}createColDefForPart(G,D,z){let{beans:B,gos:Q}=this,J=`${qM}-${D.getColId()}-${G}`,U={enableRowGroup:z.enableRowGroup,rowGroup:z.rowGroup,enablePivot:z.enablePivot,hide:!0,editable:!1},Z=Q.get("groupHierarchyConfig")??{};if(G in Z){let W={...U,...Z[G]};return W.colId??(W.colId=J),z2(B,W,W.colId,!0)}let S=z2(B,{colId:J,...U},J,!0),X=this.getLocaleTextFunc(),Y=(W,q)=>X?.(W,q)??q;switch(G){case"year":return{...S,headerValueGetter:DD(B,D,Y(G,"Year")),valueGetter:GD(B,D,0)};case"quarter":return{...S,headerValueGetter:DD(B,D,Y(G,"Quarter")),valueGetter:GD(B,D,1,(W)=>(Math.floor(Number(W)/4)+1).toString())};case"month":return{...S,headerValueGetter:DD(B,D,Y(G,"Month")),valueGetter:GD(B,D,1)};case"formattedMonth":return{...S,headerValueGetter:DD(B,D,Y("month","Month")),valueGetter:GD(B,D,1,(W)=>{let q=EM(W);return Y(q.localeKey,q.month)})};case"day":return{...S,headerValueGetter:DD(B,D,Y(G,"Day")),valueGetter:GD(B,D,2)};case"hour":return{...S,headerValueGetter:DD(B,D,Y(G,"Hour")),valueGetter:GD(B,D,3)};case"minute":return{...S,headerValueGetter:DD(B,D,Y(G,"Minute")),valueGetter:GD(B,D,4)};case"second":return{...S,headerValueGetter:DD(B,D,Y(G,"Second")),valueGetter:GD(B,D,5)};default:return null}}};function MM(G,D,z){let B=G.get(D);G.set(D,(B??[]).concat(z))}var AM={moduleName:"GroupHierarchy",version:j,beans:[IM],dependsOn:[AJ]},VM=class extends RM{constructor(){super()}postConstruct(){this.setGui(this.createNorthPanel());let G=this.onRowGroupChanged.bind(this);this.addManagedEventListeners({columnRowGroupChanged:G,newColumnsLoaded:G}),this.addManagedPropertyListener("rowGroupPanelShow",G),this.addManagedPropertyListener("pivotPanelShow",()=>this.onPivotPanelShow()),this.onRowGroupChanged()}createNorthPanel(){let G=CM({tag:"div",cls:"ag-column-drop-wrapper",role:"presentation"}),D=new k7(!0);this.rowGroupComp=this.createManagedBean(D);let z=new _7(!0);this.pivotComp=this.createManagedBean(z),G.appendChild(D.getGui()),G.appendChild(z.getGui());let B=this.onDropPanelVisible.bind(this);return this.addManagedListeners(D,{displayChanged:B}),this.addManagedListeners(z,{displayChanged:B}),this.onDropPanelVisible(),G}onDropPanelVisible(){let{rowGroupComp:G,pivotComp:D}=this,z=G.isDisplayed()&&D.isDisplayed(),B="ag-column-drop-horizontal-half-width";G.toggleCss("ag-column-drop-horizontal-half-width",z),D.toggleCss("ag-column-drop-horizontal-half-width",z)}onRowGroupChanged(){let G=this.rowGroupComp;if(!G)return;let D=this.gos.get("rowGroupPanelShow");if(D==="always")G.setDisplayed(!0);else if(D==="onlyWhenGrouping"){let z=this.beans.rowGroupColsSvc?.columns?.length!==0;G.setDisplayed(z)}else G.setDisplayed(!1)}onPivotPanelShow(){let G=this.pivotComp;if(!G)return;let D=this.gos.get("pivotPanelShow");if(D==="always")G.setDisplayed(!0);else if(D==="onlyWhenPivoting"){let z=this.beans.colModel.isPivotActive();G.setDisplayed(z)}else G.setDisplayed(!1)}getFocusableContainers(){return[this.rowGroupComp,this.pivotComp].filter((G)=>!!G)}},bM={selector:"AG-GRID-HEADER-DROP-ZONES",component:VM};function gM(G){if(G.buttons)G.buttons=[];return G}var TM={tag:"div",cls:"ag-group-filter",children:[{tag:"div",ref:"eGroupField"},{tag:"div",ref:"eUnderlyingFilter"}]},yM=class extends uM{constructor(){super(TM);this.filterType="group",this.eGroupField=J2,this.eUnderlyingFilter=J2}wireBeans(G){this.groupFilterSvc=G.groupFilter}postConstruct(){this.initialiseTabGuard({})}init(G){return this.params=G,this.updateParams().then(()=>{this.addHandlerListeners(this.updateGroups.bind(this))})}refresh(G){let D=G;if(this.params=D,D.source==="colDef")this.updateParams();return!0}updateParams(){return this.validateParams(),this.updateGroups()}validateParams(){let{colDef:G}=this.params;if(G.field)rQ(234);if(G.filterValueGetter)rQ(235);if(G.filterParams)rQ(236)}addHandlerListeners(G){let D=this.addManagedListeners(this.getHandler(),{sourceColumnsChanged:()=>{this.updateGroups()},destroyed:()=>{for(let z of D)z();this.addHandlerListeners(G)}})}updateGroups(){let{sourceColumns:G,selectedColumn:D}=this.updateGroupField();return this.dispatchLocalEvent({type:"columnsChanged"}),this.getUnderlyingFilters(G,D)}updateGroupField(){this.groupColumn=this.params.column;let G=this.getHandler();if(!G)return{sourceColumns:null};let{sourceColumns:D,hasMultipleColumns:z,selectedColumn:B}=G,Q=this.eGroupField;if(oQ(Q),this.eGroupFieldSelect)this.destroyBean(this.eGroupFieldSelect);if(z&&D)this.createGroupFieldSelectElement(D,B),Q.appendChild(this.eGroupFieldSelect.getGui()),Q.appendChild(jM({tag:"div",cls:"ag-filter-separator"}));return PM(Q,z),{sourceColumns:D,selectedColumn:B}}createGroupFieldSelectElement(G,D){let z=this.createManagedBean(new vM);this.eGroupFieldSelect=z;let B=this.getLocaleTextFunc();if(z.setLabel(B("groupFilterSelect","Select field:")),z.setLabelAlignment("top"),z.addOptions(G.map((Q)=>({value:Q.getColId(),text:this.beans.colNames.getDisplayNameForColumn(Q,"groupFilter",!1)??void 0}))),z.setValue(D.getColId()),z.onValueChange((Q)=>this.updateSelectedColumn(Q)),z.addCss("ag-group-filter-field-select-wrapper"),G.length===1)z.setDisabled(!0)}getUnderlyingFilters(G,D){if(!G)return this.filterColumnPairs=void 0,this.selectedFilter=void 0,gz.resolve();let z=[],B=[],Q=this.beans.colFilter;for(let J of G){let U=Q.getOrCreateFilterUi(J);if(U)z.push(U.then((Z)=>{if(Z)B.push({filter:Z,column:J});if(J.getColId()===D.getColId())this.selectedFilter=Z??void 0}))}return gz.all(z).then(()=>{this.filterColumnPairs=B})}addUnderlyingFilterElement(G){if(oQ(this.eUnderlyingFilter),!G)return gz.resolve();let D=this.createManagedBean(new OM(G,"COLUMN_MENU"));if(this.filterComp=D,!D.hasFilter())return gz.resolve();return this.eUnderlyingFilter.appendChild(D.getGui()),D.getFilter()?.then(()=>{if(D.afterGuiAttached?.(this.afterGuiAttachedParams),!this.afterGuiAttachedParams?.suppressFocus&&this.eGroupFieldSelect&&!this.eGroupFieldSelect.isDisabled())this.eGroupFieldSelect.getFocusableElement().focus()})??gz.resolve()}updateSelectedColumn(G){if(!G)return;this.filterComp?.afterGuiDetached(),this.destroyBean(this.filterComp);let D=this.getFilterColumnPair(G),z=D?.column;this.selectedFilter=D?.filter,this.getHandler().setSelectedColumn(z),this.dispatchLocalEvent({type:"columnsChanged"}),this.addUnderlyingFilterElement(z)}isFilterActive(){return this.groupFilterSvc.isFilterActive(this.groupColumn)}doesFilterPass(){return!0}getModel(){return null}setModel(){}afterGuiAttached(G){this.afterGuiAttachedParams=G,this.addUnderlyingFilterElement(this.getHandler().selectedColumn)}afterGuiDetached(){oQ(this.eUnderlyingFilter),this.selectedFilter?.afterGuiDetached?.()}getSelectedColumn(){return this.getHandler().selectedColumn}getHandler(){return this.params.getHandler()}getFilterColumnPair(G){if(!G)return;return this.filterColumnPairs?.find(({column:D})=>D.getColId()===G)}},cM=class extends xM{init(G){this.params=G,this.validateModel(G),this.updateColumns(),this.addManagedEventListeners({columnRowGroupChanged:this.updateColumns.bind(this),filterDestroyed:(D)=>this.onFilterDestroyed(D)})}refresh(G){if(this.params=G,this.validateModel(G),G.source==="colDef")this.updateColumns()}doesFilterPass(){return!0}setSelectedColumn(G){this.selectedColumn=G,this.dispatchLocalEvent({type:"selectedColumnChanged"})}validateModel(G){if(G.model!=null)G.onModelChange(null)}getSourceColumns(){let G=this.params.column;if(this.gos.get("treeData"))return U2(237),[];let D=this.beans.groupFilter.getSourceColumns(G);if(!D)return U2(183),[];return D}updateColumns(){let G=this.getSourceColumns(),D=G.filter((Q)=>Q.isFilterAllowed());this.sourceColumns=D;let z,B;if(!D.length)z=void 0,B=!1;else if(G.length===1)z=D[0],B=!1;else{if(z=this.selectedColumn,!z||!D.some((Q)=>Q.getId()===z.getId()))z=D[0];B=!0}this.selectedColumn=z,this.hasMultipleColumns=B,this.dispatchLocalEvent({type:"sourceColumnsChanged"})}onFilterDestroyed({column:G,source:D}){if(D==="gridDestroyed")return;let z=G.getColId();if(this.sourceColumns?.some((B)=>B.getColId()===z))setTimeout(()=>{if(this.isAlive())this.updateColumns()})}},iM=class extends hM{constructor(){super(...arguments);this.beanName="groupFilter"}postConstruct(){this.addManagedEventListeners({columnRowGroupChanged:()=>this.updateFilterFlags("columnRowGroupChanged")})}isGroupFilter(G){return G.getColDef().filter==="agGroupColumnFilter"}isFilterAllowed(G){let D=this.beans.colFilter;return!!this.getSourceColumns(G)?.some((z)=>D?.isFilterAllowed(z))}isFilterActive(G){let D=this.beans.colFilter;return!!this.getSourceColumns(G)?.some((z)=>D?.isFilterActive(z))}getSourceColumns(G){return this.beans.showRowGroupCols?.getSourceColumnsForGroupColumn(G)}updateFilterFlags(G,D){let{autoColSvc:z,colFilter:B}=this.beans;z?.getColumns()?.forEach((Q)=>{if(this.isGroupFilter(Q))B?.setColFilterActive(Q,this.isFilterActive(Q),G,D)})}},tM={tag:"div",ref:"eFloatingFilter",cls:"ag-group-floating-filter ag-floating-filter-input",role:"presentation"},sM=class extends dM{constructor(){super(tM);this.eFloatingFilter=lM,this.haveAddedColumnListeners=!1}init(G){this.params=G;let D=mM(this.gos),z=this.onColChange.bind(this),B=(Q)=>{if(D)this.setupUnderlyingFloatingFilterElement().then(()=>Q());else this.setupReadOnlyFloatingFilterElement(),Q()};if(this.gos.get("enableFilterHandlers"))return new aQ((Q)=>B(Q)).then(()=>{this.addHandlerListeners(G,z)});else return new aQ((Q)=>{this.params.parentFilterInstance((J)=>{this.parentFilterInstance=J,B(Q)})}).then(()=>{this.addManagedListeners(this.parentFilterInstance,{columnsChanged:z})})}refresh(G){if(this.params=G,this.setParams(),this.gos.get("enableFilterHandlers"))if(this.showingUnderlyingFloatingFilter){let D=this.getSelectedColumn(),z=this.beans.colFilter.getFloatingFilterCompDetails(D,this.params.showParentFilter);this.underlyingFloatingFilter?.refresh?.(z?.params)}else this.updateDisplayedValue()}setParams(){let G=this.beans.colNames.getDisplayNameForColumn(this.params.column,"header",!0),D=this.getLocaleTextFunc();this.eFloatingFilterText?.setInputAriaLabel(`${G} ${D("ariaFilterInput","Filter Input")}`)}addHandlerListeners(G,D){let z=this.addManagedListeners(G.getHandler(),{selectedColumnChanged:D,sourceColumnsChanged:D,destroyed:()=>{for(let B of z)B();this.addHandlerListeners(this.params,D)}})}setupReadOnlyFloatingFilterElement(){if(!this.eFloatingFilterText)this.eFloatingFilterText=this.createManagedBean(new nM),this.eFloatingFilterText.setDisabled(!0).addGuiEventListener("click",()=>this.params.showParentFilter()),this.setParams();this.updateDisplayedValue(),this.eFloatingFilter.appendChild(this.eFloatingFilterText.getGui())}setupUnderlyingFloatingFilterElement(){this.showingUnderlyingFloatingFilter=!1,this.underlyingFloatingFilter=void 0,pM(this.eFloatingFilter);let G=this.getSelectedColumn();if(G&&!G.isVisible()){let D=this.beans.colFilter,z=D.getFloatingFilterCompDetails(G,this.params.showParentFilter);if(z){if(!this.haveAddedColumnListeners)this.haveAddedColumnListeners=!0,this.addManagedListeners(G,{visibleChanged:this.onColumnVisibleChanged.bind(this),colDefChanged:this.onColDefChanged.bind(this)});return z.newAgStackInstance().then((B)=>{this.underlyingFloatingFilter=B,this.underlyingFloatingFilter?.onParentModelChanged(D.getModelForColumn(G)),this.appendChild(B.getGui()),this.showingUnderlyingFloatingFilter=!0})}}return this.setupReadOnlyFloatingFilterElement(),aQ.resolve()}getSelectedColumn(){if(this.gos.get("enableFilterHandlers"))return this.params.getHandler().selectedColumn;else return this.parentFilterInstance.getSelectedColumn()}onColumnVisibleChanged(){this.setupUnderlyingFloatingFilterElement()}onColDefChanged(G){if(!G.column)return;let D=this.beans.colFilter.getFloatingFilterCompDetails(G.column,this.params.showParentFilter);if(D)this.underlyingFloatingFilter?.refresh?.(D.params)}onParentModelChanged(G,D){if(this.showingUnderlyingFloatingFilter)this.underlyingFloatingFilter?.onParentModelChanged(this.beans.colFilter.getModelForColumn(this.getSelectedColumn()),D);else this.updateDisplayedValue()}updateDisplayedValue(){let G=this.eFloatingFilterText;if(!G)return;let D=this.beans.colFilter,z=this.getSelectedColumn(),B=(Q)=>{if(!Q)G.setValue(""),G.setDisplayed(!1);else{let J=z?D.getModelForColumn(z):null;G.setValue(J==null?"":Q.getModelAsString?.(J)??""),G.setDisplayed(!0)}};if(!z)B();else if(this.gos.get("enableFilterHandlers"))B(D.getHandler(z));else D.getOrCreateFilterUi(z)?.then((Q)=>{B(Q)})}onColChange(){if(!this.showingUnderlyingFloatingFilter)this.updateDisplayedValue()}},eM=(G,D)=>{if(!G){D.length=0;return}let z=G.length;D.length=z;for(let B=0;B{let z=G.length;if(z!==D?.length)return!0;for(let B=0;B0){z=!0;break}if(!z)return!1;return G.sort(L2),!0}function L2(G,D){let z=G.sourceRowIndex,B=D.sourceRowIndex,Q=z>=0,J=B>=0,U=Q&&J,Z=!Q&&!J;if(U)return z-B;if(Z)return G.__objectId-D.__objectId;if(Q)return 1;return-1}var zA=class extends oM{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 G=this.nonLeafsById;for(let D of G.values())D._destroy(!1);G.clear()}loadGroupData(G){if(!G.group)return G._groupData=null,null;let D=G.rowGroupColumn,{valueSvc:z,showRowGroupCols:B}=this.beans,Q={};if(G._groupData=Q,!D)return Q;let J=Z2(G),U=D.getId();if(!B)return Q;let Z=B.columns;for(let S=0,X=Z.length;S{let B=z.childrenAfterGroup,Q=B?.length;if(!Q)return;let J=Array(Q),U=0,Z=!1,S;for(let X=0;X1)}}if(Q.size)for(let S of Q){this.insertOneNode(G,S);let X=S.parent;D?.addRow(X),J||(J=(X?.childrenAfterGroup?.length??0)>1)}if(Z.size)S2(Z),this.removeEmptyGroups(Z,U);if(J)this.sortChildren(G,D)}sortChildren(G,D){$2(G,!0,void 0,(z)=>{if(DA(z.childrenAfterGroup))D?.addRow(z)})}orderGroups(G){let D=this.gos.getCallback("initialGroupOrderComparator");if(!D)return;let z=this.beans,B=z.gridApi,Q=z.gridOptions.context,J=(Z,S)=>D({api:B,context:Q,nodeA:Z,nodeB:S}),U=(Z)=>{let S=Z.childrenAfterGroup,X=S?.length;if(!X||Z.leafGroup)return;if(X>1)S.sort(J);for(let Y=0,W=X;Y=0;--Z){let{col:S}=U[Z],X=z.getKeyForNode(S,D);if(X==null||X===""){if(!B)continue;X=""}if(!Q?.parent||Q.key!==X){J=!0;break}Q=Q.parent}if(J||(J=!!Q?.parent),!J)return!1;return this.removeFromParent(D),this.insertOneNode(G,D),D.setData(D.data),!0}groupShouldBeRemoved(G){let D=this.getChildrenMappedKey(G.key,G.rowGroupColumn),z=G.parent?.childrenMapped;if(z?!z[D]:!0)return!1;return!!G.group&&(G.childrenAfterGroup?.length??0)===0}removeEmptyGroups(G,D){let z=this.beans.selectionSvc,B,Q=Array.from(G),J=this.nonLeafsById;do{G.clear();for(let U=0;U=Z-1,k=this.createGroup(z,X,W,H,_,D);this.addToParent(k,z),z=k}if(!z.group)aM(184,{parentGroupData:z.data,childNodeData:D.data});D.parent=z,D.level=z.level+1,z.childrenAfterGroup.push(D),z.updateHasChildren(),YB(z)}createGroup(G,D,z,B,Q,J){let U=D.col,Z=(G.level>=0?G.id+"-":"row-group-")+(U.getColId()+"-"+z),S=this.nonLeafsById,X=S.get(Z),Y=!0;if(X){if(X.childrenAfterGroup!==null)return X._expanded??(X._expanded=null),X;Y=!1,YB(X)}else X=new rM(this.beans),X.group=!0,X.key=z,X.id=Z,X.aggData=null,S.set(Z,X);let W=(k)=>{k.childrenAfterGroup=q,k.childrenMapped=H,k.parent=G,k.level=B,k.rowGroupIndex=B,k.leafGroup=Q},q=[],H={};if(W(X),X.field=D.field??null,X.rowGroupColumn=U,X.groupValue=this.beans.valueSvc.getValue(U,J,"data"),X._expanded??(X._expanded=null),Y)return X.setAllChildrenCount(0),X.updateHasChildren(),X;let _=X.sibling;if(_)W(_);return X.dispatchRowEvent("hasChildrenChanged"),X}getChildrenMappedKey(G,D){return D?D.getId()+"-"+G:G}onShowRowGroupColsSetChanged(){let{rowModel:G,valueSvc:D}=this.beans;for(let B of this.nonLeafsById.values()){B._groupData=void 0;let Q=B.rowGroupColumn,J=Q&&Z2(B);B.groupValue=J&&D.getValue(Q,J,"data")}let z=G.rootNode?._leafs;if(z)for(let B=0,Q=z.length;B{for(let D of G){let z=D?.childrenAfterGroup;if(!z)continue;let B=z.length,Q=0;for(let J=0;J{while(G._leafs!==void 0){let D=G.parent;if(!D)break;G._leafs=void 0,G=D}};function BA(G,D){G.rowGroupColsSvc?.setColumns(D,"api")}function QA(G,D){G.rowGroupColsSvc?.removeColumns(D,"api")}function JA(G,D){G.rowGroupColsSvc?.addColumns(D,"api")}function UA(G,D,z){G.rowGroupColsSvc?.moveColumn?.(D,z,"api")}function ZA(G){return G.rowGroupColsSvc?.columns??[]}var CJ={moduleName:"SharedRowGrouping",version:j,apiFunctions:{setRowGroupColumns:BA,removeRowGroupColumns:QA,addRowGroupColumns:JA,getRowGroupColumns:ZA,moveRowGroupColumn:UA},dependsOn:[i,IJ,m7,RJ,AM]},VJ={moduleName:"RowGrouping",version:j,dynamicBeans:{groupStrategy:zA},rowModels:["clientSide"],dependsOn:[CJ,MJ,_0,t7]},o7={moduleName:"RowGroupingPanel",version:j,selectors:[bM],icons:{pivotPanel:"pivot",rowGroupPanel:"group",panelDelimiter:"small-right",panelDelimiterRtl:"small-left"},dependsOn:[K7,pF]},r7={moduleName:"GroupFilter",version:j,userComponents:{agGroupColumnFilter:{classImp:yM,processParams:gM},agGroupColumnFloatingFilter:sM},beans:[iM],dynamicBeans:{agGroupColumnFilterHandler:cM},dependsOn:[i,lF]},YA=class extends $A{constructor(){super(...arguments);this.beanName="rowModel",this.hierarchical=!1,this.firstRow=-1,this.lastRow=-1,this.rowCount=-1,this.rowNodesByIndex={},this.rootNode=null,this.viewportChangedContext=!1}ensureRowHeightsValid(G,D,z,B){return!1}postConstruct(){let G=this.beans,D=new X2(G);this.rootNode=D,D.level=-1,this.rowHeight=Y2(G),this.addManagedEventListeners({viewportChanged:this.onViewportChanged.bind(this)}),this.addManagedPropertyListener("viewportDatasource",()=>this.updateDatasource()),this.addManagedPropertyListener("rowHeight",()=>{this.rowHeight=Y2(G),this.updateRowHeights()})}start(){this.updateDatasource()}isLastRowIndexKnown(){return!0}destroy(){this.destroyDatasource(),super.destroy(),this.rootNode=null}destroyDatasource(){let G=this.datasource;if(!G)return;G.destroy?.(),this.beans.rowRenderer.datasourceChanged(),this.firstRow=-1,this.lastRow=-1}updateDatasource(){let G=this.gos.get("viewportDatasource");if(G)this.setViewportDatasource(G)}getPageSize(){return this.gos.get("viewportRowModelPageSize")}getBufferSize(){return this.gos.get("viewportRowModelBufferSize")}calculateFirstRow(G){let D=this.getBufferSize(),z=this.getPageSize(),B=G-D;if(B<0)return 0;return Math.floor(B/z)*z}calculateLastRow(G){if(G===-1)return G;let D=this.getBufferSize(),z=this.getPageSize(),B=G+D,Q=Math.ceil(B/z)*z,J=this.rowCount-1;return Math.min(Q,J)}onViewportChanged(G){let D=this.calculateFirstRow(G.firstRow),z=this.calculateLastRow(G.lastRow);if(this.firstRow!==D||this.lastRow!==z)this.firstRow=D,this.lastRow=z,this.purgeRowsNotInViewport(),this.viewportChangedContext=!0,this.datasource?.setViewportRange(this.firstRow,this.lastRow),this.viewportChangedContext=!1}purgeRowsNotInViewport(){let G=this.rowNodesByIndex;for(let D of Object.keys(G)){let z=parseInt(D,10);if(zthis.lastRow){if(this.isRowFocused(z)||this.beans.editSvc?.isRowEditing(G[z]))continue;delete G[z]}}}isRowFocused(G){let D=this.beans.focusSvc.getFocusCellToUseAfterRefresh();if(!D)return!1;if(D.rowPinned!=null)return!1;return D.rowIndex===G}setViewportDatasource(G){if(this.destroyDatasource(),this.datasource=G,this.rowCount=-1,!G.init)XA(226);else G.init(LA(this.gos,{setRowCount:this.setRowCount.bind(this),setRowData:this.setRowData.bind(this),getRow:this.getRow.bind(this)}))}getType(){return"viewport"}getRow(G){if(!this.rowNodesByIndex[G])this.rowNodesByIndex[G]=this.createBlankRowNode(G);return this.rowNodesByIndex[G]}getRowNode(G){let D;return this.forEachNode((z)=>{if(z.id===G)D=z}),D}getRowCount(){return this.rowCount===-1?0:this.rowCount}getRowIndexAtPixel(G){if(this.rowHeight!==0)return Math.floor(G/this.rowHeight);return 0}resetRowHeights(){}onRowHeightChanged(){}getRowBounds(G){let D=this.rowHeight;return{rowHeight:D,rowTop:D*G}}updateRowHeights(){let G=this.rowHeight;this.forEachNode((D)=>{D.setRowHeight(G),D.setRowTop(G*D.rowIndex)}),this.eventSvc.dispatchEvent({type:"modelUpdated",newData:!1,newPage:!1,keepRenderedRows:!0,animate:!1})}getTopLevelRowCount(){return this.getRowCount()}getTopLevelRowDisplayedIndex(G){return G}isEmpty(){return this.rowCount>0}getOverlayType(){return null}isRowsToRender(){return this.rowCount>0}getNodesInRangeForSelection(G,D){let z=G.rowIndex,B=D.rowIndex,Q=zthis.lastRow,J=Bthis.lastRow;if(Q||J)return[];let U=[],Z=z<=B?z:B,S=z<=B?B:z;for(let X=Z;X<=S;X++)U.push(this.rowNodesByIndex[X]);return U}forEachNode(G){let D=0;for(let z of Object.keys(this.rowNodesByIndex)){let B=parseInt(z,10),Q=this.rowNodesByIndex[B];G(Q,D),D++}}setRowData(G){let D=SA(this.beans.gos),z=new Map;if(D)for(let B of Object.values(this.rowNodesByIndex))z.set(B.id,B);for(let B=this.firstRow;B<=this.lastRow;B++){let Q=G[B];if(!Q)continue;let J,U;if(D)J=D({data:Q,rowPinned:void 0,level:0,parentKeys:void 0}),U=z.get(J);else U=this.rowNodesByIndex[B];if(U)U.updateData(Q),U.setRowIndex(B),U.setRowTop(this.rowHeight*B);else U=this.createBlankRowNode(B),U.setDataAndId(Q,J??B.toString());this.rowNodesByIndex[B]=U}if(!this.viewportChangedContext)this.eventSvc.dispatchEvent({type:"modelUpdated",newData:!1,newPage:!1,keepRenderedRows:!0,animate:!1})}createBlankRowNode(G){let D=new X2(this.beans),z=this.rowHeight;return D.setRowHeight(z),D.setRowTop(z*G),D.setRowIndex(G),D}setRowCount(G,D=!1){if(G===this.rowCount)return;this.rowCount=G;let z=this.eventSvc;z.dispatchEventOnce({type:"rowCountReady"}),z.dispatchEvent({type:"modelUpdated",newData:!1,newPage:!1,keepRenderedRows:D,animate:!1})}isRowPresent(G){return!!this.getRowNode(G.id)}},a7={moduleName:"ViewportRowModel",version:j,rowModels:["viewport"],beans:[YA],dependsOn:[i]};function _A(G,D){G.clipboardSvc?.copyToClipboard(D)}function kA(G,D){G.clipboardSvc?.cutToClipboard(D)}function wA(G,D){G.clipboardSvc?.copySelectedRowsToClipboard(D)}function KA(G,D){G.clipboardSvc?.copySelectedRangeToClipboard(D)}function fA(G){G.clipboardSvc?.copyRangeDown()}function NA(G){G.clipboardSvc?.pasteFromClipboard()}var h0="paste",D1="dragCopy",z1="clipboard";function bA(G,D=","){let z=[],B=(J)=>J==="\r"||J===` -`,Q=!1;if(G==="")return[[""]];for(let J=0,U=0,Z=0;Z{if(!z[J])z[J]=[];if(!z[J][U])z[J][U]=""};if(W(),X==='"'){if(Q)if(Y==='"')z[J][U]+='"',Z++;else Q=!1;else if(S===void 0||S===D||B(S))Q=!0}if(!Q&&X!=='"'){if(X===D){U++,W();continue}else if(B(X)){if(U=0,J++,W(),X==="\r"&&Y===` -`)Z++;continue}}z[J][U]+=X}return z}var vA=class extends FA{constructor(){super(...arguments);this.beanName="clipboardSvc",this.clientSideRowModel=null,this.gridCtrl=null,this.lastPasteOperationTime=0,this.navigatorApiFailed=!1}postConstruct(){let{gos:G,rowModel:D,ctrlsSvc:z}=this.beans;if(q2(G,D))this.clientSideRowModel=D;z.whenReady(this,(B)=>{this.gridCtrl=B.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((D)=>{c0(40,{e:D,method:"readText"}),this.navigatorApiFailed=!0,this.pasteFromClipboardLegacy()});else this.pasteFromClipboardLegacy()}pasteFromClipboardLegacy(){let G=!1,D=(z)=>{let B=Date.now();if(B-this.lastPasteOperationTime<50)G=!0,z.preventDefault();this.lastPasteOperationTime=B};this.executeOnTempElement((z)=>{z.addEventListener("paste",D),z.focus({preventScroll:!0})},(z)=>{let B=z.value;if(!G)this.processClipboardData(B);else this.refocusLastFocusedCell();z.removeEventListener("paste",D)})}refocusLastFocusedCell(){let{focusSvc:G}=this.beans,D=G.getFocusedCell();if(D)G.setFocusedCell({rowIndex:D.rowIndex,column:D.column,rowPinned:D.rowPinned,forceBrowserFocus:!0})}getClipboardDelimiter(){let G=this.gos.get("clipboardDelimiter");return EA(G)?G:"\t"}processClipboardData(G){if(G==null)return;let D=bA(G,this.getClipboardDelimiter()),z=this.gos.getCallback("processDataFromClipboard");if(z)D=z({data:D});if(D==null)return;if(this.gos.get("suppressLastEmptyLineOnPaste"))this.removeLastLineIfBlank(D);let{rangeSvc:B,editSvc:Q}=this.beans,J=(U,Z,S,X)=>{if(B?.isMoreThanOneCell()&&!this.hasOnlyOneValueToPaste(D))this.pasteIntoActiveRange(D,U,Z,X);else this.pasteStartingFromFocusedCell(D,U,Z,S,X);Q?.stopEditing(void 0,{source:h0})};this.doPasteOperation(J)}doPasteOperation(G){let{eventSvc:z,focusSvc:B,rowRenderer:Q,gos:J}=this.beans;z.dispatchEvent({type:"pasteStart",source:"clipboard"});let{clientSideRowModel:U}=this,Z=U?.rootNode,S=Z&&this.beans.changedPathFactory?.newPath(J.get("aggregateOnlyChangedColumns")),X={},Y=[],W=B.getFocusedCell();G(X,Y,W,S);let q=Y.slice();if(S)U.doAggregate(S),IA(Z,U.hierarchical,S,(H)=>{q.push(H)});Q.refreshCells({rowNodes:q}),this.dispatchFlashCells(X),this.fireRowChanged(Y),this.refocusLastFocusedCell(),z.dispatchEvent({type:"pasteEnd",source:"clipboard"})}getPreProcessRangeCallback(G){return(D)=>{let{rangeSvc:z}=this.beans;if(!z)return;let{rowDiff:B,colDiff:Q}=this.getAdjustedRangeDimensionForPaste(D,G);if(B!==0)z.extendRangeRowCountBy(D,B);if(Q!==0)z.extendRangeColumnCountBy(D,Q)}}getAdjustedRangeDimensionForPaste(G,D){let z=this.beans.rangeSvc,B=D.length,Q=z.getRangeRowCount(G),J=Q>=B&&Q%B===0,U=D[0].length,Z=G.columns.length,S=Z>=U&&Z%U===0;return{rowDiff:J?0:B-Q,colDiff:S?0:U-Z}}pasteIntoActiveRange(G,D,z,B){let Q=0,J=0,U=(Z,S,X,Y)=>{if(Y-Q>=G.length){if(Y%G.length!==0)return;Q+=J,J=0}let q=G[Y-Q];z.push(S);let H=this.gos.getCallback("processCellFromClipboard"),_=X.columns,k=_.findIndex(CA);if(k!==-1)_.splice(k,1);for(let w=0;w<_.length;w++){let K=_[w];if(!K.isCellEditable(S)||K.isSuppressPaste(S))continue;let f=w;if(w>=q.length)f=w%q.length;let N=this.processCell(S,K,q[f],D1,H,!0);S.setDataValue(K,N,h0),B?.addCell(S.parent,K.getId());let{rowIndex:F,rowPinned:E}=Z,I=lD({rowIndex:F,column:K,rowPinned:E});D[I]=!0}J++};this.iterateActiveRanges(U,!1,this.getPreProcessRangeCallback(G))}getDisplayedColumnsStartingAt(G){let D=G,z=[],{visibleCols:B}=this.beans;while(D&&VA(D))D=B.getColAfter(D);while(D!=null)z.push(D),D=B.getColAfter(D);return z}pasteStartingFromFocusedCell(G,D,z,B,Q){if(!B)return;let J={rowIndex:B.rowIndex,rowPinned:B.rowPinned},U=this.getDisplayedColumnsStartingAt(B.column);if(this.isPasteSingleValueIntoRange(G))this.pasteSingleValueIntoRange(G,z,D,Q);else this.pasteMultipleValues(G,J,z,U,D,z1,Q)}isPasteSingleValueIntoRange(G){let D=this.beans.rangeSvc;return this.hasOnlyOneValueToPaste(G)&&!!D&&!D.isEmpty()}pasteSingleValueIntoRange(G,D,z,B){let Q=G[0][0],J=(U,Z,S)=>{D.push(Z),S.columns.forEach((X)=>this.updateCellValue(Z,X,Q,z,z1,B))};this.iterateActiveRanges(J)}hasOnlyOneValueToPaste(G){return G.length===1&&G[0].length===1}copyRangeDown(){let{rangeSvc:G,gos:D,formula:z,valueSvc:B}=this.beans;if(!G||G.isEmpty())return;let Q=[],J=(U,Z,S,X)=>{let Y=D.getCallback("processCellForClipboard"),W=D.getCallback("processCellFromClipboard"),q=(H,_,k)=>{let{columns:w}=k;if(!Q.length)w.forEach((K)=>{let f=this.processCell(_,K,B.getValue(K,_,"batch"),D1,Y,!1,!0);Q.push(f)});else Z.push(_),w.forEach((K,f)=>{if(!K.isCellEditable(_)||K.isSuppressPaste(_))return;if(K.isAllowFormula()&&z?.isFormula(Q[f]))Q[f]=z?.updateFormulaByOffset({value:Q[f],rowDelta:1});let F=this.processCell(_,K,Q[f],D1,W,!0);_.setDataValue(K,F,h0),X?.addCell(_.parent,K.getId());let{rowIndex:E,rowPinned:I}=H,V=lD({rowIndex:E,column:K,rowPinned:I});U[V]=!0})};this.iterateActiveRanges(q,!0)};this.doPasteOperation(J)}removeLastLineIfBlank(G){let D=AA(G);if(D&&D.length===1&&D[0]===""){if(G.length===1)return;RA(G,D)}}fireRowChanged(G){if(this.gos.get("editType")!=="fullRow")return;for(let D of G)this.eventSvc.dispatchEvent({type:"rowValueChanged",node:D,data:D.data,rowIndex:D.rowIndex,rowPinned:D.rowPinned})}shouldSkipPasteRow(G,D,z){if(G.detail||G.footer)return!0;if(z&&G.group){for(let B of D)if(B.isCellEditable(G))return!1;return!0}return!1}pasteMultipleValues(G,D,z,B,Q,J,U){let Z=D,S=this.beans,{gos:X}=S,Y=this.clientSideRowModel!=null&&!X.get("enableGroupEdit")&&!X.get("treeData"),W=()=>{while(Z){let q=G1(S,Z);if(Z=eQ(S,{rowPinned:Z.rowPinned,rowIndex:Z.rowIndex}),q!=null&&!this.shouldSkipPasteRow(q,B,Y))return q}return null};for(let q of G){let H=W();if(!H)continue;q.forEach((_,k)=>this.updateCellValue(H,B[k],_,Q,J,U)),z.push(H)}}updateCellValue(G,D,z,B,Q,J){if(!G||!D?.isCellEditable(G)||D?.isSuppressPaste(G))return;let U=this.processCell(G,D,z,Q,this.gos.getCallback("processCellFromClipboard"),!0);G.setDataValue(D,U,h0);let{rowIndex:Z,rowPinned:S}=G,X=lD({rowIndex:Z,column:D,rowPinned:S});B[X]=!0,J?.addCell(G.parent,D.getId())}copyToClipboard(G={}){this.copyOrCutToClipboard(G)}cutToClipboard(G={},D="api"){if(this.gos.get("suppressCutToClipboard"))return;this.eventSvc.dispatchEvent({type:"cutStart",source:D}),this.copyOrCutToClipboard(G,!0),this.eventSvc.dispatchEvent({type:"cutEnd",source:D})}copyOrCutToClipboard(G,D){let{includeHeaders:z,includeGroupHeaders:B}=G,{gos:Q,focusSvc:J}=this.beans;if(z==null)z=Q.get("copyHeadersToClipboard");if(B==null)B=Q.get("copyGroupHeadersToClipboard");let U={includeHeaders:z,includeGroupHeaders:B},Z=Q.get("rowSelection"),S=Q.get("cellSelection"),X=null;if(this.shouldCopyCells(S,Z))this.copySelectedRangeToClipboard(U),X=0;else if(this.shouldCopyRows(Z))this.copySelectedRowsToClipboard(U),X=1;else if(J.isAnyCellFocused())this.copyFocusedCellToClipboard(U),X=2;if(D&&X!==null)this.clearCellsAfterCopy(X)}shouldCopyCells(G,D){let{rangeSvc:z,selectionSvc:B,gos:Q}=this.beans;if(!z||z.isEmpty())return!1;if(G)return!(typeof D==="object"&&D.copySelectedRows&&!B?.isEmpty());else{let J=Q.get("suppressCopySingleCellRanges");return!(!z.isMoreThanOneCell()&&J)}}shouldCopyRows(G){let{selectionSvc:D,gos:z}=this.beans;if(D?.isEmpty()??!0)return!1;if(G&&typeof G!=="string")return G.copySelectedRows??!1;else return!z.get("suppressCopyRowsToClipboard")}clearCellsAfterCopy(G){let D=this.beans,{rangeSvc:z,focusSvc:B,eventSvc:Q}=D;if(Q.dispatchEvent({type:"keyShortcutChangedCellStart"}),G===0)z.clearCellRangeCellValues({cellEventSource:"clipboardSvc"});else if(G===1)this.clearSelectedRows();else{let J=B.getFocusedCell();if(J==null)return;let U=G1(D,J);if(U)this.clearCellValue(U,J.column)}Q.dispatchEvent({type:"keyShortcutChangedCellEnd"})}clearSelectedRows(){let{selectionSvc:G,visibleCols:D}=this.beans,z=G?.getSelectedNodes()??[],B=D.allCols;for(let Q of z)for(let J of B)this.clearCellValue(Q,J)}clearCellValue(G,D){if(!D.isCellEditable(G))return;let z=this.beans.valueSvc.getDeleteValue(D,G);G.setDataValue(D,z,"clipboardSvc")}iterateActiveRanges(G,D,z){let B=this.beans.rangeSvc;if(!B||B.isEmpty())return;let Q=B.getCellRanges(),J=D?[Q[0]]:Q;for(let U of J)this.iterateActiveRange({cellRange:U,rowCallback:G,preProcessRange:z})}iterateActiveRange(G){let{cellRange:D,preProcessRange:z,rowCallback:B}=G,{beans:Q}=this,{rangeSvc:J}=Q;if(!J)return;if(z)z(D);let U=J.getRangeStartRow(D),Z=J.getRangeEndRow(D),S=0,X=!1;while(!X&&U!=null){let Y=G1(Q,U);X=H2(U,Z),B(U,Y,D,S++),U=eQ(Q,U)}}copySelectedRangeToClipboard(G={}){let D=this.beans.rangeSvc;if(!D||D.isEmpty())return;let z=D.areAllRangesAbleToMerge(),{data:B,cellsToFlash:Q}=z?this.buildDataFromMergedRanges(D,G):this.buildDataFromRanges(D,G);this.copyDataToClipboard(B),this.dispatchFlashCells(Q)}buildDataFromMergedRanges(G,D){let z=new Set,B=G.getCellRanges(),Q=new Map,J=[],U={},Z=q2(this.gos,this.beans.rowModel),S=new Set;if(!Z)this.beans.rowModel.forEachNode((q)=>{S.add(q.rowIndex)});for(let q of B){q.columns.forEach((k)=>z.add(k));let{rowPositions:H,cellsToFlash:_}=this.getRangeRowPositionsAndCellsToFlash(G,q);for(let k of H){let w=S.has(k.rowIndex);if(!Z&&!w)continue;let K=`${k.rowIndex}-${k.rowPinned||"null"}`;if(!Q.get(K))Q.set(K,!0),J.push(k)}Object.assign(U,_)}let X=this.beans.visibleCols.allCols,Y=Array.from(z);return Y.sort((q,H)=>{let _=X.indexOf(q),k=X.indexOf(H);return _-k}),{data:this.buildExportParams({columns:Y,rowPositions:J,includeHeaders:D.includeHeaders,includeGroupHeaders:D.includeGroupHeaders}),cellsToFlash:U}}buildDataFromRanges(G,D){let z=G.getCellRanges(),B=[],Q={};for(let J of z){let{rowPositions:U,cellsToFlash:Z}=this.getRangeRowPositionsAndCellsToFlash(G,J);Object.assign(Q,Z),B.push(this.buildExportParams({columns:J.columns,rowPositions:U,includeHeaders:D.includeHeaders,includeGroupHeaders:D.includeGroupHeaders}))}return{data:B.join(` -`),cellsToFlash:Q}}getRangeRowPositionsAndCellsToFlash(G,D){let z=[],B={},Q=G.getRangeStartRow(D),J=G.getRangeEndRow(D),U=Q;while(U){z.push(U);for(let Z of D.columns){let{rowIndex:S,rowPinned:X}=U,Y=lD({rowIndex:S,column:Z,rowPinned:X});B[Y]=!0}if(H2(U,J))break;U=eQ(this.beans,U)}return{rowPositions:z,cellsToFlash:B}}getCellsToFlashFromRowNodes(G){let D=this.beans.visibleCols.allCols,z={};for(let B=0;B{let{value:W,valueFormatted:q}=this.beans.valueSvc.getValueForDisplay({column:Y,node:X,includeValueFormatted:!0,from:"batch"}),H=q??W??"",_=J.getCallback("processCellForClipboard");if(!_)return H;return _({column:Y,node:X,value:H,type:z1,formatValue:(k)=>this.beans.valueSvc.formatValue(Y,X,k)??k,parseValue:(k)=>this.beans.valueSvc.parseValue(Y,X,k,W)??k})},S={columnKeys:D,rowPositions:z,skipColumnHeaders:!B,skipColumnGroupHeaders:!Q,suppressQuotes:!0,columnSeparator:this.getClipboardDelimiter(),onlySelected:!z,valueFrom:"batch",processCellCallback:J.getCallback("processCellForClipboard"),processRowGroupCallback:Z,processHeaderCallback:J.getCallback("processHeaderForClipboard"),processGroupHeaderCallback:J.getCallback("processGroupHeaderForClipboard")};return U.getDataAsCsv(S,!0)}dispatchFlashCells(G){window.setTimeout(()=>{this.eventSvc.dispatchEvent({type:"flashCells",cells:G})},0)}processCell(G,D,z,B,Q,J,U){let{valueSvc:Z,formula:S}=this.beans;if(Q)return Q({column:D,node:G,value:z,type:B,formatValue:(Y)=>Z.formatValue(D,G??null,Y)??Y,parseValue:(Y)=>Z.parseValue(D,G??null,Y,Z.getValue(D,G,"edit"))});if(J&&D.getColDef().useValueParserForImport!==!1)return Z.parseValue(D,G??null,z,Z.getValue(D,G,"edit"));if(U&&D.getColDef().useValueFormatterForExport!==!1){if(S?.isFormula(z))return z;return Z.formatValue(D,G??null,z)??z}return z}copyDataToClipboard(G){let D=this.gos.getCallback("sendToClipboard");if(D){D({data:G});return}if(!this.gos.get("suppressClipboardApi")&&navigator.clipboard){navigator.clipboard.writeText(G).catch((B)=>{c0(40,{e:B,method:"writeText"}),this.copyDataToClipboardLegacy(G)});return}this.copyDataToClipboardLegacy(G)}copyDataToClipboardLegacy(G){this.executeOnTempElement((D)=>{let z=W2(this.beans),B=MA(this.beans);if(D.value=G||" ",D.select(),D.focus({preventScroll:!0}),!z.execCommand("copy"))c0(41);if(B?.focus!=null)B.focus({preventScroll:!0})})}executeOnTempElement(G,D){if(!this.gridCtrl)return;let z=W2(this.beans),B=z.createElement("textarea"),Q=B.style;Q.width="1px",Q.height="1px";let J=z.documentElement;Q.top=J.scrollTop+"px",Q.left=J.scrollLeft+"px",Q.position="absolute",Q.opacity="0",this.gridCtrl.getGui().appendChild(B);try{G(B)}catch(Z){c0(42)}if(D)window.setTimeout(()=>{D(B),B.remove()},100);else B.remove()}},nB={moduleName:"Clipboard",version:j,beans:[vA],apiFunctions:{copyToClipboard:_A,cutToClipboard:kA,copySelectedRowsToClipboard:wA,copySelectedRangeToClipboard:KA,copySelectedRangeDown:fA,pasteFromClipboard:NA},dependsOn:[i,WA,HA,qA]},jA=".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}}",yA={tag:"div",cls:"ag-row-numbers-resizer"},xA=class extends PA{constructor(G){super(yA);this.cellCtrl=G,this.initialYPosition=-1,this.dragging=!1}postConstruct(){let{beans:G,cellCtrl:D}=this,{dragSvc:z,environment:B}=G;this.defaultRowHeight=B.getDefaultRowHeight(),z.addDragSource({dragStartPixels:0,eElement:this.getGui(),onDragStart:this.onDragStart.bind(this),onDragging:this.onDragging.bind(this),onDragStop:this.onDragStop.bind(this),onDragCancel:this.onDragCancel.bind(this),includeTouch:!0,stopPropagationForTouch:!0});let Q=D.getRowPosition();this.node=TA(this.beans,Q)}onDragStart(G){if(!this.node)return;let{beans:{ctrlsSvc:D,eventSvc:z}}=this;D.get("gridCtrl").setResizeCursor(gA.Vertical),this.dragging=!0,this.initialHeight=this.node.rowHeight,z.dispatchEvent({type:"rowResizeStarted",node:this.node,event:G,rowHeight:this.initialHeight})}onDragging(G){let{clientY:D}=G;if(this.cellCtrl.rowNode.rowPinned==="bottom")D*=-1;if(this.initialYPosition===-1||!this.dragging){this.initialYPosition=D;return}let{beans:z,initialHeight:B,initialYPosition:Q,defaultRowHeight:J,node:U}=this;if(B==null)return;let Z=U?.rowHeight,S=Math.max(B-(Q-D),J);if(Z===S)return;U?.setRowHeight(S);let{rowRenderer:X,rowModel:Y,pinnedRowModel:W}=z,q=!!U?.rowPinned;if(q)X.redraw({afterScroll:!0});if(!q||W?.isManual())Y.onRowHeightChanged({animate:!1})}onDragStop(G){this.beans.eventSvc.dispatchEvent({type:"rowResizeEnded",node:this.node,event:G,rowHeight:this.node?.rowHeight}),this.clearDragDetails(!0)}onDragCancel(){this.clearDragDetails(!0)}clearDragDetails(G){if(this.initialYPosition=-1,this.initialHeight=null,this.dragging=!1,G)this.beans.ctrlsSvc.get("gridCtrl").setResizeCursor(!1)}destroy(){this.clearDragDetails(!1),this.node=void 0,super.destroy()}};function e7(G){let D=zR(G);return!(!D||typeof D!=="object"||!D.enableRowResizer)}var QR=class{constructor(G,D){this.beans=G,this.cellCtrl=D}refreshRowResizer(){if(!e7(this.beans)||!this.isRowResizeSupported(this.cellCtrl.rowNode))this.removeRowResizerFromCellComp();else this.addResizerToCellComp()}isRowResizeSupported(G){let{pinnedRowModel:D,rowModel:z,visibleCols:B}=this.beans,Q=!!z.onRowHeightChanged;if(B.autoHeightCols.length)return BR(276),!1;if(G.rowPinned!=null)return D?.isManual()?Q:!0;return Q}addResizerToCellComp(){let{beans:G,cellCtrl:D}=this,{rowResizer:z}=this;if(!z){if(z=G.registry.createDynamicBean("rowNumberRowResizer",!1,D),!z)return;this.rowResizer=G.context.createBean(z)}D.comp.setRowResizerElement(z.getGui())}removeRowResizerFromCellComp(){let{rowResizer:G,beans:{context:D},cellCtrl:z}=this;if(!G)return;z.comp?.setRowResizerElement(null),this.rowResizer=D.destroyBean(G)}destroy(){this.removeRowResizerFromCellComp()}},JR=class extends hA{constructor(){super(...arguments);this.beanName="rowNumbersSvc",this.isIntegratedWithSelection=!1,this.lastColumnResized=0}postConstruct(){let G=tA(this,this.refreshCells.bind(this),10);this.addManagedEventListeners({columnResized:()=>{this.lastColumnResized=Date.now()},cellFocused:this.onGridCellFocused.bind(this),modelUpdated:(D)=>{G(!1,!D.keepRenderedRows)},rangeSelectionChanged:()=>this.refreshCells(!0),pinnedRowsChanged:()=>G(!1,!0)}),this.addManagedPropertyListeners(["rowNumbers","cellSelection"],(D)=>{this.updateColumns(D)}),this.refreshSelectionIntegration(),this.registerRangeSelectionExtension()}shouldSkipColumn(G){return pD(this.beans)&&wD(G)}isAllColumnsSelectionCell(G){return pD(this.beans)&&wD(G.column)}isAllColumnsRange(G,D){if(!pD(this.beans)||D.length===0)return!1;return G.columns.length===D.length&&D.every((z)=>G.columns.includes(z))}registerRangeSelectionExtension(){let G=this.beans.rangeSvc;if(!G)return;G.registerRangeSelectionExtension(this),this.addDestroyFunc(()=>G.unregisterRangeSelectionExtension?.(this))}addColumns(G){if(this.columns==null)return;G.list=this.columns.list.concat(G.list),G.tree=this.columns.tree.concat(G.tree),DR(G)}createColumns(G,D){let z=()=>{_2(this.beans,this.columns?.tree),this.columns=null},{beans:B}=this;if(!pD(B)){z();return}let Q=G.treeDepth,U=(this.columns?.treeDepth??-1)==Q,Z=this.generateRowNumberCols();if(lA(Z,this.columns?.list??[])&&U)return;z();let{colGroupSvc:X}=this.beans,Y=X?.findDepth(G.tree)??0,W=X?.balanceTreeForAutoCols(Z,Y)??[];this.columns={list:Z,tree:W,treeDepth:Y,map:{}},D((H)=>{if(!H)return null;let _=H.filter((k)=>!wD(k));return[...Z,..._]})}handleMouseDownOnCell(G,D){if(!this.isIntegratedWithSelection||D.target.classList.contains("ag-row-numbers-resizer")){if(this.beans.rangeSvc)D.preventDefault();return D.stopImmediatePropagation(),!1}if(!D.shiftKey&&!aA(this.beans,D))this.focusFirstRenderedCellAtRowPosition(G);return!0}handleKeyDownOnCell(G,D){if(!this.isIntegratedWithSelection)return!1;if(D.key===B1.ENTER)return this.selectRowCells(G,D),D.preventDefault(),!0;return!1}selectRowCells(G,D){let{rangeSvc:z}=this.beans;if(!z)return;z.handleCellKeyboardSelect(D,G)}updateColumns(G){let D=pA(G.source);this.refreshSelectionIntegration();for(let z of this.columns?.list??[]){let B=this.createRowNumbersColDef();z.setColDef(B,null,D),dA(this.beans,{state:[sA(B,z.getColId())]},D)}}getColumn(){return this.columns?.list.find(wD)??null}getColumns(){return this.columns?.list??null}setupForHeader(G){let{column:D,eGridHeader:z}=G.params;if(!wD(D))return;GR(z,"Row Number"),this.addManagedElementListeners(z,{click:this.onHeaderClick.bind(this),keydown:this.onHeaderKeyDown.bind(this),focus:this.onHeaderFocus.bind(this)})}onGridCellFocused(G){if(!this.isIntegratedWithSelection||G.rowIndex==null||!G.column||!wD(G.column))return;let z=this.getLocaleTextFunc()("ariaSelectAllRowCells","Press Enter to select all cells on this row");this.beans.ariaAnnounce?.announceValue(z,"ariaSelectAllRowCells")}createRowNumbersRowResizerFeature(G){if(!e7(this.beans))return;return new QR(this.beans,G)}refreshSelectionIntegration(){let{beans:G}=this,{gos:D,rangeSvc:z}=G,B=D.get("cellSelection");this.refreshRowNumberOverrides(),this.isIntegratedWithSelection=!!z&&!!B&&!this.isSuppressCellSelectionIntegration}refreshRowNumberOverrides(){let G=pD(this.beans);if(this.rowNumberOverrides={},this.isSuppressCellSelectionIntegration=!1,!G||typeof G!=="object")return;if(G.suppressCellSelectionIntegration)this.isSuppressCellSelectionIntegration=!0;let D=["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(let z of D)if(G[z]!=null)this.rowNumberOverrides[z]=G[z]}onHeaderFocus(){if(!this.isIntegratedWithSelection)return;let D=this.getLocaleTextFunc()("ariaSelectAllCells","Press Space or Enter to select all cells");this.beans.ariaAnnounce?.announceValue(D,"ariaSelectAllCells")}onHeaderKeyDown(G){if(!this.isIntegratedWithSelection||G.key!==B1.SPACE&&G.key!==B1.ENTER)return;G.preventDefault(),this.selectAllCellsFromHeader()}onHeaderClick(G){if(Date.now()-this.lastColumnResized<100||!this.isIntegratedWithSelection||this.getColumn()?.resizing)return;this.focusAllCellsFromHeaderClick()}selectAllCellsFromHeader(){eA(this.beans)}focusAllCellsFromHeaderClick(){this.selectAllCellsFromHeader(),this.focusFirstRenderedCellAtRowPosition()}refreshCells(G,D){let z=this.getColumn();if(!z)return;if(D){let B=this.beans.autoWidthCalc?.getPreferredWidthForElements([this.createDummyElement(z)],2);if(B!=null)this.beans.colResize?.setColumnWidths([{key:z,newWidth:B}],!1,!0,"rowNumbersService")}this.beans.rowRenderer.refreshCells({columns:[z],force:G})}createDummyElement(G){let D=mA({tag:"div",cls:"ag-cell-value ag-cell"}),z=String(this.beans.rowModel.getRowCount()+1);if(typeof this.rowNumberOverrides.valueFormatter==="function"){let B=nA(this.beans.gos,{data:void 0,value:z,node:null,column:G,colDef:G.colDef});z=this.rowNumberOverrides.valueFormatter(B)}return D.textContent=z,D}createRowNumbersColDef(){let{gos:G,contextMenuSvc:D}=this.beans,z=G.get("enableRtl");return{minWidth:60,width:60,resizable:!1,valueGetter:this.valueGetter.bind(this),contextMenuItems:this.isIntegratedWithSelection||!D?void 0:()=>[],...this.rowNumberOverrides,colId:iA,chartDataType:"excluded",suppressHeaderMenuButton:!0,sortable:!1,suppressMovable:!0,lockPinned:!0,pinned:z?"right":"left",lockPosition:z?"right":"left",editable:!1,suppressFillHandle:!0,suppressAutoSize:!0,suppressSizeToFit:!0,suppressHeaderContextMenu:!0,headerClass:this.getHeaderClass(),cellClass:this.getCellClass.bind(this),cellAriaRole:"rowheader"}}valueGetter(G){let D=G.node,z=this.beans.formula?.active,B=D?.pinnedSibling;if(D?.rowPinned&&B){let Q=z?B.formulaRowIndex:B.rowIndex;return`${Q==null?"-":Q+1}`}return String(((z?D?.formulaRowIndex:D?.rowIndex)||0)+1)}getHeaderClass(){let G=["ag-row-number-header"];if(this.isIntegratedWithSelection)G.push("ag-row-number-selection-enabled");return G}getCellClass(G){let{beans:D}=this,{rangeSvc:z,gos:B}=D,{node:Q}=G,J=["ag-row-number-cell"],U=B.get("cellSelection");if(!z||!U)return J;if(this.isIntegratedWithSelection)J.push("ag-row-number-selection-enabled");let Z=z.getCellRanges();if(!Z.length)return J;let S=this.beans.visibleCols.allCols.length-1,X=typeof U==="object"&&U.enableHeaderHighlight;for(let Y of Z)if(z.isRowInRange({rowIndex:Q.rowIndex,rowPinned:Q.rowPinned},Y)){if(X)J.push("ag-row-number-range-highlight");if(Y.columns.length===S)J.push("ag-row-number-range-selected")}return J}generateRowNumberCols(){let{gos:G,beans:D}=this;if(!pD(D))return[];let z=this.createRowNumbersColDef(),B=z.colId;G.validateColDef(z,B,!0);let Q=new cA(z,null,B,!1);return this.createBean(Q),[Q]}focusFirstRenderedCellAtRowPosition(G){let D=this.beans.editSvc;if(D?.isEditing()&&D.isRangeSelectionEnabledWhileEditing?.())return;if(!G){if(G=oA(this.beans),!G)return}let{beans:z,gos:B}=this,{visibleCols:Q,colViewport:J}=z,U=B.get("enableRtl")?Q.rightCols:Q.leftCols,Z;if(U.length==1){let W=rA(z,G);if(!W)return;Z=J.getColsWithinViewport(W)}else Z=U;let S=Z.find((W)=>!wD(W));if(!S)return;let{rowPinned:X,rowIndex:Y}=G;setTimeout(()=>{z.focusSvc.setFocusedCell({rowIndex:Y,rowPinned:X,column:S,forceBrowserFocus:!0,preventScrollOnBrowserFocus:!0})})}destroy(){_2(this.beans,this.columns?.tree),this.rowNumberOverrides=null,super.destroy()}},bJ={moduleName:"RowNumbers",version:j,beans:[JR],dynamicBeans:{rowNumberRowResizer:xA},dependsOn:[i,OA,uA],css:[jA]},SR={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"}]},XR=class extends $R{constructor(){super(...arguments);this.eExpand=w2,this.eFilterTextField=w2}postConstruct(){this.setTemplate(SR,[ZR]);let G=this.getLocaleTextFunc();this.eFilterTextField.setAutoComplete(!1).setInputAriaLabel(G("ariaFilterColumnsInput","Filter Columns Input")).onValueChange(this.onSearchTextChanged.bind(this)),this.createExpandIcons(),this.setExpandState(0),this.addManagedElementListeners(this.eExpand,{click:this.onExpandClicked.bind(this)}),this.addManagedEventListeners({newColumnsLoaded:this.showOrHideOptions.bind(this)})}init(G){if(this.params=G,this.beans.colModel.ready)this.showOrHideOptions()}createExpandIcons(){let{eExpand:G,beans:D}=this;G.appendChild(this.eExpandChecked=Q1("accordionOpen",D)),G.appendChild(this.eExpandUnchecked=Q1("accordionClosed",D)),G.appendChild(this.eExpandIndeterminate=Q1("accordionIndeterminate",D))}showOrHideOptions(){let{params:G,eFilterTextField:D}=this,z=!G.suppressFilterSearch,B=!G.suppressExpandAll,Q=this.getLocaleTextFunc();D.setInputPlaceholder(Q("searchOoo","Search..."));let J=(Z)=>Z.getOriginalParent()&&Z.isFilterAllowed(),U=this.beans.colModel.getCols().some(J);Tz(D.getGui(),z),Tz(this.eExpand,B&&U)}onSearchTextChanged(){if(!this.onSearchTextChangedDebounced)this.onSearchTextChangedDebounced=LR(this,()=>this.dispatchLocalEvent({type:"searchChanged",searchText:this.eFilterTextField.getValue()}),300);this.onSearchTextChangedDebounced()}onExpandClicked(){let G=this.currentExpandState===0?{type:"collapseAll"}:{type:"expandAll"};this.dispatchLocalEvent(G)}setExpandState(G){this.currentExpandState=G,Tz(this.eExpandChecked,G===0),Tz(this.eExpandUnchecked,G===1),Tz(this.eExpandIndeterminate,G===2)}},YR={selector:"AG-FILTERS-TOOL-PANEL-HEADER",component:XR},MR={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"}]},D8=class extends KR{constructor(G,D){super(MR);this.hideHeader=G,this.expandedCallback=D,this.eFilterToolPanelHeader=yz,this.eFilterName=yz,this.agFilterToolPanelBody=yz,this.eFilterIcon=yz,this.eExpand=yz,this.expanded=!1}postConstruct(){let{beans:G,eExpand:D,eFilterIcon:z}=this,B=U1("accordionOpen",G);this.eExpandChecked=B;let Q=U1("accordionClosed",G);this.eExpandUnchecked=Q,D.appendChild(B),D.appendChild(Q);let J=this.getLocaleTextFunc();ER(z,J("ariaFilterActive","Filter Active")),IR(z,"img")}setColumn(G){this.column=G;let{beans:D,eFilterToolPanelHeader:z,eFilterIcon:B,eExpandChecked:Q,hideHeader:J}=this;if(this.eFilterName.innerText=D.colNames.getDisplayNameForColumn(G,"filterToolPanel",!1)||"",this.addManagedListeners(z,{click:this.toggleExpanded.bind(this),keydown:this.onKeyDown.bind(this)}),this.addManagedEventListeners({filterOpened:this.onFilterOpened.bind(this)}),this.addInIcon("filterActive",B,G),zD(B,this.isFilterActive()),zD(Q,!1),J)zD(z,!1),z.removeAttribute("tabindex");else z.setAttribute("tabindex","0");this.addManagedListeners(G,{filterChanged:this.onFilterChanged.bind(this)})}onKeyDown(G){let{key:D}=G,{ENTER:z,SPACE:B,LEFT:Q,RIGHT:J}=N2;if(D!==z&&D!==B&&D!==Q&&D!==J)return;if(G.preventDefault(),D===z||D===B)this.toggleExpanded();else if(D===N2.LEFT)this.collapse();else this.expand()}getColumn(){return this.column}getColumnFilterName(){return this.beans.colNames.getDisplayNameForColumn(this.column,"filterToolPanel",!1)}addCssClassToTitleBar(G){this.eFilterToolPanelHeader.classList.add(G)}addInIcon(G,D,z){if(D==null)return;let B=U1(G,this.beans,z);D.appendChild(B)}isFilterActive(){return!!this.beans.colFilter?.isFilterActive(this.column)}onFilterChanged(){zD(this.eFilterIcon,this.isFilterActive()),this.dispatchLocalEvent({type:"filterChanged"})}toggleExpanded(){if(this.expanded)this.collapse();else this.expand()}expand(){if(this.expanded)return;this.expanded=!0,F2(this.eFilterToolPanelHeader,!0),zD(this.eExpandChecked,!0),zD(this.eExpandUnchecked,!1),this.addFilterElement(),this.expandedCallback()}addFilterElement(G){let D=FR({tag:"div",cls:"ag-filter-toolpanel-instance-filter"}),z=this.createManagedBean(new fR(this.column,"TOOLBAR"));if(this.filterComp=z,!z.hasFilter())return;z.getFilter()?.then((B)=>{if(this.underlyingFilter=B,!B)return;D.appendChild(z.getGui()),this.agFilterToolPanelBody.appendChild(D),z.afterGuiAttached({container:"toolPanel",suppressFocus:G})})}collapse(){if(!this.expanded)return;this.expanded=!1,F2(this.eFilterToolPanelHeader,!1),this.removeFilterElement(),zD(this.eExpandChecked,!1),zD(this.eExpandUnchecked,!0);let G=this.filterComp;G?.afterGuiDetached(),this.destroyBean(G),this.expandedCallback()}removeFilterElement(){NR(this.agFilterToolPanelBody)}isExpanded(){return this.expanded}onPanelHidden(){if(!this.expanded)return;let G=this.underlyingFilter;if(!G)return;G.afterGuiDetached?.()}onFilterOpened(G){if(G.source!=="COLUMN_MENU")return;if(G.column!==this.column)return;if(!this.expanded)return;this.collapse()}},BD=class extends AR{constructor(G,D,z,B,Q){super();this.columnGroup=G,this.childFilterComps=D,this.expandedCallback=z,this.depth=B,this.showingColumn=Q,this.filterGroupComp=RR}postConstruct(){let G={cssIdentifier:"filter-toolpanel",direction:"vertical"};this.setTemplate({tag:"div",cls:"ag-filter-toolpanel-group-wrapper",children:[{tag:"ag-group-component",ref:"filterGroupComp"}]},[p],{filterGroupComp:G}),this.setGroupTitle();let{filterGroupComp:D,depth:z,childFilterComps:B,gos:Q}=this;D.setAlignItems("stretch"),D.addCss(`ag-filter-toolpanel-group-level-${z}`),D.getGui().style.setProperty("--ag-indentation-level",String(z)),D.addCssClassToTitleBar(`ag-filter-toolpanel-group-level-${z}-header`);for(let U of B)D.addItem(U),U.addCssClassToTitleBar(`ag-filter-toolpanel-group-level-${z+1}-header`),U.getGui().style.setProperty("--ag-indentation-level",String(z+1));let J=this.showingColumn?this.columnGroup:void 0;this.tooltipFeature=this.createOptionalManagedBean(this.beans.registry.createDynamicBean("tooltipFeature",!1,{getGui:()=>this.getGui(),getLocation:()=>"filterToolPanelColumnGroup",shouldDisplayTooltip:bR(Q,()=>D.getGui().querySelector(".ag-group-title")),getAdditionalParams:()=>({colDef:J?.getColDef(),column:J})})),this.refreshFilterClass(),this.addExpandCollapseListeners(),this.addFilterChangedListeners(),this.setupTooltip(),this.addInIcon("filterActive")}setupTooltip(){if(!this.showingColumn)return;let G=()=>{this.tooltipFeature?.setTooltipAndRefresh(this.columnGroup.getColDef().headerTooltip)};G(),this.addManagedEventListeners({newColumnsLoaded:G})}addCssClassToTitleBar(G){this.filterGroupComp.addCssClassToTitleBar(G)}onPanelHidden(){for(let G of this.childFilterComps)G.onPanelHidden()}isColumnGroup(){return i0(this.columnGroup)}isExpanded(){return this.filterGroupComp.isExpanded()}getChildren(){return this.childFilterComps}getFilterGroupName(){return this.filterGroupName??""}getFilterGroupId(){return this.columnGroup.getId()}hideGroupItem(G,D){this.filterGroupComp.hideItem(G,D)}hideGroup(G){this.setDisplayed(!G)}addInIcon(G){let D=VR(G,this.beans);if(D){D.classList.add("ag-filter-toolpanel-group-instance-header-icon");let z=this.getLocaleTextFunc();vR(D,z("ariaFilterActive","Filter Active")),OR(D,"img")}this.filterGroupComp.addTitleBarWidget(D)}forEachToolPanelFilterChild(G){for(let D of this.childFilterComps)if(D instanceof D8)G(D)}addExpandCollapseListeners(){let G=this.isColumnGroup()?()=>this.expandedCallback():()=>this.forEachToolPanelFilterChild((z)=>z.expand()),D=this.isColumnGroup()?()=>this.expandedCallback():()=>this.forEachToolPanelFilterChild((z)=>z.collapse());this.addManagedListeners(this.filterGroupComp,{expanded:G,collapsed:D})}getColumns(){if(i0(this.columnGroup))return this.columnGroup.getLeafColumns();return[this.columnGroup]}addFilterChangedListeners(){for(let G of this.getColumns())this.addManagedListeners(G,{filterChanged:()=>this.refreshFilterClass()});if(!i0(this.columnGroup))this.addManagedEventListeners({filterOpened:this.onFilterOpened.bind(this)})}refreshFilterClass(){let G=this.getColumns(),D=()=>G.some((z)=>z.isFilterActive());this.filterGroupComp.toggleCss("ag-has-filter",D())}onFilterOpened(G){if(G.source!=="COLUMN_MENU")return;if(G.column!==this.columnGroup)return;if(!this.isExpanded())return;this.collapse()}expand(){this.filterGroupComp.toggleGroupExpand(!0)}collapse(){this.filterGroupComp.toggleGroupExpand(!1)}setGroupTitle(){let G=this.columnGroup,D=i0(G)?this.getColumnGroupName(G):this.getColumnName(G);this.filterGroupName=D,this.filterGroupComp.setTitle(D||"")}getColumnGroupName(G){return this.beans.colNames.getDisplayNameForProvidedColumnGroup(null,G,"filterToolPanel")}getColumnName(G){return this.beans.colNames.getDisplayNameForColumn(G,"filterToolPanel",!1)}destroyFilters(){this.childFilterComps=this.destroyBeans(this.childFilterComps),CR(this.getGui())}destroy(){this.destroyFilters(),super.destroy()}},uR=class extends WR{constructor(){super({tag:"div",cls:"ag-filter-list-panel"});this.initialised=!1,this.hasLoadedInitialState=!1,this.isInitialState=!1,this.filterGroupComps=[],this.suppressOnColumnsChanged=!1,this.onColumnsChangedPending=!1}wireBeans(G){this.colModel=G.colModel}init(G){this.initialised=!0;let D=qR(this.gos,{suppressExpandAll:!1,suppressFilterSearch:!1,suppressSyncLayoutWithGrid:!1});if(kR(D,G),this.params=D,!D.suppressSyncLayoutWithGrid)this.addManagedEventListeners({columnMoved:()=>this.onColumnsChanged()});if(this.addManagedEventListeners({newColumnsLoaded:()=>this.onColumnsChanged(),toolPanelVisibleChanged:(z)=>{if(z.key==="filters"&&!z.visible)this.onPanelHidden()},dragStarted:()=>{this.suppressOnColumnsChanged=!0},dragStopped:()=>{if(this.suppressOnColumnsChanged=!1,this.onColumnsChangedPending)this.onColumnsChangedPending=!1,this.onColumnsChanged()}}),this.colModel.ready)this.onColumnsChanged()}onColumnsChanged(){if(this.suppressOnColumnsChanged){this.onColumnsChangedPending=!0;return}let G=this.colModel.isPivotMode();if(!this.params.suppressSyncLayoutWithGrid&&!G)this.syncFilterLayout();else this.buildTreeFromProvidedColumnDefs();this.refreshAriaLabel()}syncFilterLayout(){Q7(this.colModel,this.setFiltersLayout.bind(this)),this.refreshAriaLabel()}buildTreeFromProvidedColumnDefs(){let G=this.colModel.getColDefColTree();this.recreateFilters(G)}setFiltersLayout(G){let D=B7(this.colModel,G);this.recreateFilters(D)}recreateFilters(G){let D=_R(this.beans);if(!this.hasLoadedInitialState)this.hasLoadedInitialState=!0,this.isInitialState=!!this.params.initialState;let z=this.getExpansionState();this.destroyFilters();let B=this.recursivelyAddComps(G,0,z);this.filterGroupComps=B;let Q=B.length;if(Q){for(let U of B)this.appendChild(U);this.setFirstAndLastVisible(0,Q-1)}let J=this.searchFilterText;if(J1(J))this.searchFilters(J);if(this.fireExpandedEvent(),this.getGui().contains(D))D.focus();this.isInitialState=!1,this.refreshAriaLabel()}recursivelyAddComps(G,D,z){return G.map((B)=>{if(f2(B))return this.recursivelyAddFilterGroupComps(B,D,z)?.flatMap((S)=>S)??[];let Q=B;if(!this.shouldDisplayFilter(Q))return[];let U=new D8(D===0,()=>this.onFilterExpanded());if(this.createBean(U),U.setColumn(Q),z.get(Q.getId()))U.expand();if(D>0)return U;let Z=this.createBean(new BD(Q,[U],this.onGroupExpanded.bind(this),D,!0));if(Z.addCssClassToTitleBar("ag-filter-toolpanel-header"),!z.get(Z.getFilterGroupId()))Z.collapse();return Z}).flatMap((B)=>B)}refreshAriaLabel(){let G=this.getLocaleTextFunc(),D=G("ariaFilterPanelList","Filter List"),z=G("filters","Filters"),B=this.getGui(),Q=".ag-filter-toolpanel-group-wrapper",J=".ag-filter-toolpanel-group-item",U=".ag-hidden",S=B.querySelectorAll(".ag-filter-toolpanel-group-item:not(.ag-filter-toolpanel-group-wrapper, .ag-hidden)").length;wR(this.getAriaElement(),`${D} ${S} ${z}`)}recursivelyAddFilterGroupComps(G,D,z){if(!this.filtersExistInChildren(G.getChildren()))return;if(G.getColGroupDef()?.suppressFiltersToolPanel)return[];let Q=G.isPadding()?D:D+1,J=this.recursivelyAddComps(G.getChildren(),Q,z).flatMap((S)=>S);if(G.isPadding())return J;let U=new BD(G,J,this.onGroupExpanded.bind(this),D,!1);this.createBean(U),U.addCssClassToTitleBar("ag-filter-toolpanel-header");let Z=z.get(U.getFilterGroupId());if(this.isInitialState&&!Z||Z===!1)U.collapse();return[U]}filtersExistInChildren(G){return G.some((D)=>{if(f2(D))return this.filtersExistInChildren(D.getChildren());return this.shouldDisplayFilter(D)})}shouldDisplayFilter(G){let D=G.getColDef()?.suppressFiltersToolPanel;return G.isFilterAllowed()&&!D}getExpansionState(){let G=new Map;if(this.isInitialState){let{expandedColIds:z,expandedGroupIds:B}=this.params.initialState;for(let Q of z)G.set(Q,!0);for(let Q of B)G.set(Q,!0);return G}let D=(z)=>{G.set(z.getFilterGroupId(),z.isExpanded());for(let B of z.getChildren())if(B instanceof BD)D(B);else G.set(B.getColumn().getId(),B.isExpanded())};return this.filterGroupComps.forEach(D),G}refresh(){}setVisible(G){if(super.setDisplayed(G),G&&!this.initialised)this.init(this.params)}expandFilterGroups(G,D){let z=[],B=(Q)=>{let J=Q.getFilterGroupId();if(!D||D.includes(J)){if(G&&Q.isColumnGroup())Q.expand();else Q.collapse();z.push(J)}for(let Z of Q.getChildren())if(Z instanceof BD)B(Z)};if(this.filterGroupComps.forEach(B),this.onGroupExpanded(),D){let Q=D.filter((J)=>z.indexOf(J)<0);if(Q.length>0)K2(166,{unrecognisedGroupIds:Q})}}expandFilters(G,D){let z=[],B=(Q)=>{if(Q instanceof BD){let Z=!1;for(let S of Q.getChildren())if(B(S)){if(G)Q.expand(),Z=!0;else if(!Q.isColumnGroup())Q.collapse()}return Z}let J=Q.getColumn().getColId(),U=!D||D.includes(J);if(U){if(G)Q.expand();else Q.collapse();z.push(J)}return U};if(this.filterGroupComps.forEach(B),this.onGroupExpanded(),D){let Q=D.filter((J)=>z.indexOf(J)<0);if(Q.length>0)K2(167,{unrecognisedColIds:Q})}}onGroupExpanded(){this.fireExpandedEvent()}onFilterExpanded(){this.dispatchLocalEvent({type:"filterExpanded"})}fireExpandedEvent(){let G=0,D=0,z=(Q)=>{if(!Q.isColumnGroup())return;if(Q.isExpanded())G++;else D++;for(let J of Q.getChildren())if(J instanceof BD)z(J)};this.filterGroupComps.forEach(z);let B;if(G>0&&D>0)B=2;else if(D>0)B=1;else B=0;this.dispatchLocalEvent({type:"groupExpanded",state:B})}performFilterSearch(G){this.searchFilterText=J1(G)?G.toLowerCase():null,this.searchFilters(this.searchFilterText)}searchFilters(G){let D=(J)=>{return!J1(G)||J.toLowerCase().indexOf(G)!==-1},z=(J,U)=>{if(!(J instanceof BD))return D(J.getColumnFilterName()||"");let Z=J.getChildren(),S=D(J.getFilterGroupName()),X=U||S;if(X){J.hideGroup(!1);for(let W=0;W{let H=z(W,U);if(J.hideGroupItem(!H,q),H)Y=!0}),J.hideGroup(!Y),Y},B,Q;this.filterGroupComps.forEach((J,U)=>{z(J,!1);let Z=J.getGui()?.classList.contains("ag-hidden");if(B===void 0){if(!Z)B=U,Q=U}else if(!Z&&Q!==U)Q=U}),this.setFirstAndLastVisible(B,Q),this.refreshAriaLabel()}setFirstAndLastVisible(G,D){this.filterGroupComps.forEach((z,B)=>{if(z.removeCss("ag-first-group-visible"),z.removeCss("ag-last-group-visible"),B===G)z.addCss("ag-first-group-visible");if(B===D)z.addCss("ag-last-group-visible")})}onPanelHidden(){for(let G of this.filterGroupComps)G.onPanelHidden()}getExpandedFiltersAndGroups(){let G=[],D=new Set,z=(B)=>{if(B instanceof BD){for(let J of B.getChildren())z(J);let Q=B.getFilterGroupId();if(B.isExpanded()&&!D.has(Q))G.push(Q)}else if(B.isExpanded())D.add(B.getColumn().getColId())};return this.filterGroupComps.forEach(z),{expandedGroupIds:G,expandedColIds:Array.from(D)}}destroyFilters(){this.filterGroupComps=this.destroyBeans(this.filterGroupComps),HR(this.getGui())}destroy(){this.destroyFilters(),super.destroy()}},jR={selector:"AG-FILTERS-TOOL-PANEL-LIST",component:uR},PR=".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}",gR={tag:"div",cls:"ag-filter-toolpanel",children:[{tag:"ag-filters-tool-panel-header",ref:"filtersToolPanelHeaderPanel"},{tag:"ag-filters-tool-panel-list",ref:"filtersToolPanelListPanel"}]},TR=class extends UR{constructor(){super(gR,[YR,jR]);this.filtersToolPanelHeaderPanel=k2,this.filtersToolPanelListPanel=k2,this.initialised=!1,this.listenerDestroyFuncs=[],this.registerCSS(PR)}init(G){if(this.initialised){for(let Z of this.listenerDestroyFuncs)Z();this.listenerDestroyFuncs=[]}this.initialised=!0;let z={...{suppressExpandAll:!1,suppressFilterSearch:!1,suppressSyncLayoutWithGrid:!1},...G};this.params=z;let{filtersToolPanelHeaderPanel:B,filtersToolPanelListPanel:Q}=this;B.init(z),Q.init(z);let{suppressExpandAll:J,suppressFilterSearch:U}=z;if(J&&U)B.setDisplayed(!1);this.listenerDestroyFuncs.push(...this.addManagedListeners(B,{expandAll:()=>Q.expandFilterGroups(!0),collapseAll:()=>Q.expandFilterGroups(!1),searchChanged:(Z)=>Q.performFilterSearch(Z.searchText)}),...this.addManagedListeners(Q,{filterExpanded:z.onStateUpdated,groupExpanded:(Z)=>{B.setExpandState(Z.state),z.onStateUpdated()}}))}setVisible(G){if(super.setDisplayed(G),G&&!this.initialised)this.init(this.params)}setFilterLayout(G){this.filtersToolPanelListPanel.setFiltersLayout(G)}expandFilterGroups(G){this.filtersToolPanelListPanel.expandFilterGroups(!0,G)}collapseFilterGroups(G){this.filtersToolPanelListPanel.expandFilterGroups(!1,G)}expandFilters(G){this.filtersToolPanelListPanel.expandFilters(!0,G)}collapseFilters(G){this.filtersToolPanelListPanel.expandFilters(!1,G)}syncLayoutWithGrid(){this.filtersToolPanelListPanel.syncFilterLayout()}refresh(G){return this.init(G),!0}getState(){return this.filtersToolPanelListPanel.getExpandedFiltersAndGroups()}},cR=class extends yR{constructor(){super(...arguments);this.beanName="filterPanelSvc",this.states=new Map,this.orderedStates=[],this.initialStateApplied=!1,this.columnsLoaded=!1,this.isActive=!1}postConstruct(){if(!this.gos.get("enableFilterHandlers"))return;let G=this.updateFilterStates.bind(this),D=()=>this.dispatchStatesUpdates(void 0,!0),z=this.onFilterDestroyed.bind(this);this.addManagedEventListeners({newColumnsLoaded:()=>{if(this.columnsLoaded=!0,!this.initialStateApplied)this.applyState();G()},dataTypesInferred:G,filterChanged:G,filterDestroyed:z,filterHandlerDestroyed:z,filterOpened:D,filterClosed:D});let B=({column:Q})=>{this.states.get(Q.getColId())?.refresh?.(),D()};this.addManagedListeners(this.beans.colFilter,{filterStateChanged:B,filterModelAsStringChanged:B})}updateParams(G,D){this.params=G;let z=!1;if(D){if(this.currState=D,this.columnsLoaded){let B=new Set(D.filters?.map((Q)=>Q.colId));for(let Q of this.getIds())if(!B.has(Q))this.remove(Q);this.clear(),this.applyState(),this.updateFilterStates(),z=!0}}if(!z)this.dispatchStatesUpdates();this.beans.colFilter?.setGlobalButtons(!!G.buttons?.length)}getIds(){return Array.from(this.states.keys())}getAvailable(){let G=this.beans,D=[];for(let z of G.colModel.getColDefCols()??[]){let B=z.getColId();if(z.isFilterAllowed()&&!z.colDef.suppressFiltersToolPanel&&!this.states.get(B))D.push({id:B,name:E2(G,z)})}return D}add(G){this.createFilter(G,!0),this.dispatchStatesUpdates(G)}remove(G){let{states:D,orderedStates:z,beans:{colFilter:B,selectableFilter:Q}}=this,J=D.get(G);if(!J)return;J.destroy?.();let U=J.state.column;D.delete(G),Q?.clearActive(G),B?.destroyFilter(U),this.eventSvc.dispatchEvent({type:"filterSwitched",column:U});let Z=z.indexOf(G);z.splice(Z,1);let S=z[Z];this.dispatchStatesUpdates(S)}getState(G){return this.states.get(G)?.state}updateFilterState(G,D,z,B){let Q=this.getState(G);if(!Q)return;if(Q[D]=z,!B)this.dispatchLocalEvent({type:"filterPanelStateChanged",id:G,state:Q})}expand(G,D){let z=this.states.get(G);if(!z)return;z.destroy?.();let{handler:B,state:{column:Q}}=z,J=this.createFilterState(Q,B,D);this.states.set(G,J),this.dispatchLocalEvent({type:"filterPanelStateChanged",id:G,state:J.state})}updateType(G,D){let z=this.states.get(G);if(!z)return;let B=z.state;if(B.expanded===!1)return;let Q=B.filterDefs;if(!Q)return;let{colFilter:J,selectableFilter:U}=this.beans;U?.setActive(G,Q,D),J.filterParamsChanged(G,"columnFilter");let Z=B.column;this.eventSvc.dispatchEvent({type:"filterSwitched",column:Z});let S=this.states.get(G);if(!S)return;let X=S.state;this.dispatchLocalEvent({type:"filterPanelStateChanged",id:G,state:X})}getActions(){let G=this.params?.buttons;if(!G?.length)return;let D=!!this.beans.colFilter?.canApplyAll();return{actions:G,canApply:D}}doAction(G){this.beans.colFilter?.updateAllModels(G)}getGridState(){let G=[];return this.states.forEach((D,z)=>{G.push({colId:z,expanded:D.state.expanded})}),{filters:G}}createFilter(G,D){let z=this.createFilterStateWrapper(G,D);if(z)this.states.set(G,z),this.orderedStates.push(G)}createFilterStateWrapper(G,D){let{colModel:z,colFilter:B}=this.beans,Q=z.getColDefCol(G);if(Q&&!Q.colDef.suppressFiltersToolPanel){let J=B.getHandler(Q,!0);if(J)return this.createFilterState(Q,J,D)}return}updateFilterStates(){if(!this.params)return;let G=this.beans.colFilter.getModel(),D=new Set;for(let z of Object.keys(G)){let B=this.states.get(z);if(!B)this.createFilter(z);else B.refresh?.();D.add(z)}this.states.forEach((z,B)=>{if(!D.has(B))z.refresh?.()}),this.dispatchStatesUpdates()}createFilterState(G,D,z){let B=this.beans,{colFilter:Q,selectableFilter:J}=B,U=E2(B,G),Z=G.getColId(),S=()=>!!this.params?.buttons&&Q.hasUnappliedModel(Z),X=S();if(z){let Y=G.colDef,{filterDefs:W,activeFilterDef:q}=J?.getDefs(G,Y)??{},H=this.createBean(new xR(G,"TOOLBAR",!0));return{state:{column:G,name:U,isEditing:X,expanded:z,detail:H.getGui(),activeFilterDef:q,filterDefs:W,afterGuiAttached:H.afterGuiAttached.bind(H),afterGuiDetached:H.afterGuiDetached.bind(H)},handler:D,refresh:()=>{this.updateFilterState(Z,"isEditing",S())},destroy:()=>this.destroyBean(H)}}else{let Y=G.getColId(),W=()=>D.getModelAsString?.(Q.getStateForColumn(Y).model,"filterToolPanel")??"";return{state:{column:G,name:U,isEditing:X,expanded:!1,summary:W()},handler:D,refresh:()=>{this.updateFilterState(Y,"isEditing",S(),!0),this.updateFilterState(Y,"summary",W())}}}}onFilterDestroyed({column:G,source:D}){let{colFilter:z,filterManager:B}=this.beans;if(!z?.isAlive()||!B?.isFilterAllowed(G))return;let Q=this.states,J=G.getColId(),U=Q.get(J);if(U){let Z=this.createFilterStateWrapper(J,U.state.expanded);if(Z)U.destroy?.(),Q.set(J,Z);else this.remove(J);if(D==="api")this.dispatchStatesUpdates()}}dispatchStatesUpdates(G,D){this.dispatchLocalEvent({type:"filterPanelStatesChanged",activeId:G,action:D})}applyState(){if(this.params&&this.columnsLoaded){this.initialStateApplied=!0;for(let{colId:G,expanded:D}of this.currState?.filters??[])this.createFilter(G,D)}}destroy(){this.clear(),this.params=void 0,this.currState=void 0,super.destroy()}clear(){let{states:G,orderedStates:D}=this;G.forEach((z)=>z.destroy?.()),G.clear(),D.length=0}};function E2(G,D){return G.colNames.getDisplayNameForColumn(D,"filterToolPanel")??D.getColId()}var sR={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 zz(G,D){return tR(G,sR,D)}function oR(G,D,z){let B=0;for(let Q=0;Q{let{filter:F,filterParams:E,name:I,filterValueGetter:V=S.filterValueGetter}=N,A=H?{...H,...E}:E,R;if(Y&&W)if(F==="agMultiColumnFilter")R=B.multiFilter?.getParamsForDataType(A,V,Y,W);else R=dR(F,A,V,Y,W,B,this.getLocaleTextFunc());let O;if(!I){let u=F;if(typeof F==="boolean")u=U?.getDefaultFilterFromDataType(()=>X);if(typeof u==="string")O=zz(this,`${u}DisplayName`);else pR(280,{colId:G.getColId()}),O=""}if(H||R||O)return{...N,filterParams:A,name:O??I,...R};return N},w=(q??this.getDefaultFilters(G)).map(k),K=z??this.selectedFilters.get(G.getColId())??_??(!q&&lR(Q)?1:0);if(K>=w.length)K=0;let f=w[K];return{filterDefs:w,activeFilterDef:f}}setActive(G,D,z,B){let Q=D.indexOf(z);if(Q<0)return;let{selectedFilters:J,valueGetters:U}=this;J.set(G,Q);let Z=z.filterValueGetter;if(Z)U.set(G,Z);else U.delete(G);if(!B)this.onChange()}clearActive(G){let{selectedFilters:D,valueGetters:z}=this;D.delete(G),z.delete(G),this.onChange()}getState(){return Object.fromEntries(this.selectedFilters)}setState(G){this.clearAll();let D=this.beans.colModel;for(let z of Object.keys(G)){let B=D.getColDefCol(z);if(B){let Q=this.getDefs(B,B.colDef,G[z]);if(Q)this.setActive(z,Q.filterDefs,Q.activeFilterDef,!0)}}}destroy(){this.clearAll(),super.destroy()}clearAll(){let{selectedFilters:G,valueGetters:D}=this;G.clear(),D.clear()}onChange(){this.dispatchLocalEvent({type:"selectedFilterChanged"})}getDefaultFilters(G){let D=this.beans,{gos:z,dataTypeSvc:B}=D,Q=z.isModuleRegistered("MultiFilter"),J=B?.getBaseDataType(G);return[{filter:nR(J,!1)},{filter:"agSetColumnFilter"},...Q?[{filter:"agMultiColumnFilter"}]:[]]}},LC={tag:"div",cls:"ag-filter-card ag-filter-card-add"},SC=class extends UC{constructor(G){super(LC);this.options=new Map,this.setOptions(G)}postConstruct(){this.showButton()}refresh(G){this.setOptions(G);let{eSelect:D,options:z}=this;if(D)D.setValueList({valueList:Array.from(z.keys()),refresh:!0})}showButton(){A2(this.getGui()),this.destroySelect();let G=ZC({tag:"button",cls:"ag-button ag-standard-button ag-filter-add-button",children:[{tag:"span",children:[()=>$C("filterAdd",this.beans)]},{tag:"span",cls:"ag-filter-add-button-label",children:zz(this,"addFilterCard")}]});this.activateTabIndex([G]);let D=this.showSelect.bind(this);G.addEventListener("click",D),this.removeButton=()=>{G.removeEventListener("click",D)},this.appendChild(G),G.focus()}showSelect(){A2(this.getGui()),this.destroyButton();let G="ariaLabelAddFilterField",D={className:"ag-filter-add-select",pickerType:"virtual-list",pickerAriaLabelKey:G,pickerAriaLabelValue:zz(this,G),placeholder:zz(this,"addFilterPlaceholder"),value:"",valueList:Array.from(this.options.keys()),searchType:"matchAny",allowTyping:!0,filterList:!0,highlightMatch:!0,valueFormatter:(B)=>this.options.get(B)},z=this.createManagedBean(new gB(D));this.eSelect=z,this.appendChild(z.getGui()),z.showPicker(),z.getFocusableElement().focus(),z.addManagedListeners(z,{fieldPickerValueSelected:({value:B})=>this.dispatchLocalEvent({type:"filterSelected",id:B}),pickerHidden:()=>{this.showButton()}})}setOptions(G){let D=this.options;D.clear();for(let{id:z,name:B}of G)D.set(z,B)}destroySelect(){this.eSelect=this.destroyBean(this.eSelect)}destroyButton(){this.removeButton=this.removeButton?.()}destroy(){this.destroySelect(),this.destroyButton(),super.destroy()}},fC={tag:"div",cls:"ag-filter-card-body",children:[{tag:"ag-select",cls:"ag-filter-type-select",ref:"eFilterType"}]},NC=class extends kC{constructor(){super(...arguments);this.eFilterType=wC}postConstruct(){let G={onValueChange:(D)=>this.dispatchLocalEvent({type:"filterTypeChanged",filterDef:D})};this.setTemplate(fC,[_C],{eFilterType:G}),this.eFilterType.setDisplayed(!1)}refresh(G){let D=this.state;this.state=G;let{activeFilterDef:z,filterDefs:B,detail:Q,afterGuiAttached:J,afterGuiDetached:U}=G,{activeFilterDef:Z,filterDefs:S,detail:X}=D??{},Y=this.eFilterType;if(B!==S){Y.clearOptions();let W=B?.map((q)=>({value:q,text:q.name}));if(W)Y.clearOptions().addOptions(W).setValue(z,!0);Y.setDisplayed(!!W)}else if(z!==Z)Y.setValue(z,!0);if(Q!==X){if(X)KC(X),U();this.appendChild(Q),J({container:"newFiltersToolPanel",suppressFocus:!0})}}},EC={tag:"div",cls:"ag-filter-card-summary",attrs:{"aria-hidden":"true"}},IC=class extends FC{constructor(){super(EC)}refresh(G){this.getGui().textContent=G.summary}},MC={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"}]}]}]},AC=class extends XC{constructor(G){super(MC);this.id=G,this.eTitle=mD,this.eExpand=mD,this.eDelete=mD,this.eExpandIcon=mD,this.eDeleteIcon=mD,this.eEditing=mD}postConstruct(){let{beans:G,eDelete:D,eExpand:z,eDeleteIcon:B,eEditing:Q,id:J}=this,U=G.filterPanelSvc;C2(D,zz(this,"ariaLabelFilterCardDelete")),B.appendChild(Z1("close",G,null)),this.activateTabIndex([z,D]),this.addManagedElementListeners(z,{click:()=>U.expand(J,!this.state?.expanded)}),this.addManagedElementListeners(D,{click:()=>U.remove(J)}),this.addManagedEventListeners({filterOpened:this.onFilterOpened.bind(this)}),Q.appendChild(Z1("filterCardEditing",G,null))}refresh(G){let{eExpand:D,eEditing:z,state:B,beans:Q}=this;this.state=G;let{name:J,expanded:U,isEditing:Z}=G;if(this.eTitle.textContent=J,HC(z,Z),!B||U!==B.expanded)this.toggleExpand(G);let S=U?null:`${J} ${G.summary}`;if(Z)S=`${S??J}. ${zz(this,"ariaLabelFilterCardHasEdits")}`;C2(D,S);let X=(W)=>{if(!W)return;return WC(W.getGui()),this.destroyBean(W)},Y=(W,q,H)=>{if(!W)W=this.createBean(new q),H?.(W),this.appendChild(W.getGui());return W.refresh(G),W};if(G.expanded){this.summaryComp=X(this.summaryComp);let W=Y(this.detailComp,NC,(H)=>H.addManagedListeners(H,{filterTypeChanged:({filterDef:_})=>Q.filterPanelSvc.updateType(this.id,_)}));this.detailComp=W;let q=`ag-${this.getCompId()}-filter`;W.getGui().id=q,R2(D,q)}else this.detailComp=X(this.detailComp),this.summaryComp=Y(this.summaryComp,IC),R2(D,null)}toggleExpand(G){let D=!!G.expanded,{eExpandIcon:z,eExpand:B,beans:Q}=this;YC(z),z.appendChild(Z1(D?"filterCardCollapse":"filterCardExpand",Q,null)),qC(B,D)}onFilterOpened(G){let{state:D,beans:z,id:B}=this;if(G.source==="COLUMN_MENU"&&G.column===D?.column&&D?.expanded)z.filterPanelSvc.expand(B,!1)}destroy(){this.detailComp=this.destroyBean(this.detailComp),this.summaryComp=this.destroyBean(this.summaryComp),this.state=void 0,super.destroy()}};function RC(G){return!!G?.id}function CC(G){return!!G?.action}var VC={tag:"div",cls:"ag-filter-panel",children:[{tag:"div",cls:"ag-filter-panel-container",ref:"eContainer"}]},bC=class extends GC{constructor(){super(VC);this.eContainer=zC,this.filters=new Map}refresh(G){if(CC(G)){this.refreshActions();return}if(RC(G)){this.filters.get(G.id)?.refresh(G.state);return}let{eContainer:D,filters:z,beans:B}=this,Q=B.filterPanelSvc,J=Q.getIds(),U=new Map,Z=!M2(B),S=Z?BC(B):void 0,X=Z&&D.contains(S),Y=[],W=[];for(let K of J){let f=z.get(K)??this.createBean(new AC(K));f.refresh(Q.getState(K)),U.set(K,f),W.push(f.getGui())}this.filters=U;let q=[];z.forEach((K,f)=>{if(Y.push(K.getGui()),!U.has(f))q.push(K)});let H=this.addFilterComp;if(H)Y.push(H.getGui());let _=Q.getAvailable();if(_.length){if(!H)H=this.createBean(new SC(_)),H.addManagedListeners(H,{filterSelected:({id:K})=>Q.add(K)});H.refresh(_),W.push(H.getGui())}else H=this.destroyBean(H);this.addFilterComp=H,oR(D,W,Y);for(let K of q)this.destroyBean(K);let k=G?.activeId,w=k&&U.get(k)?.getGui();if(w)I2(w);else if(X&&M2(B))I2(W[W.length-1]??D);this.refreshActions()}refreshActions(){let G=this.beans.filterPanelSvc,{actions:D,canApply:z}=G.getActions()??{},B=this.buttonComp;if(D?.length){let Q=D.map((J)=>({type:J,label:JC(this,`${J}Filter`)}));if(!B){B=this.createBean(new DC({className:"ag-filter-panel-buttons"})),this.getGui().appendChild(B.getGui());let J={};for(let U of["apply","clear","reset","cancel"])J[U]=()=>G.doAction(U);B.addManagedListeners(B,J)}B.updateButtons(Q),B.updateValidity(z!==!1)}else if(B)QC(B.getGui()),B=this.destroyBean(B);this.buttonComp=B}destroy(){this.beans.filterPanelSvc?.clear?.(),this.addFilterComp=this.destroyBean(this.addFilterComp),this.buttonComp=this.destroyBean(this.buttonComp);let G=this.filters;G.forEach((D)=>this.destroyBean(D)),G.clear(),super.destroy()}},vC=".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)}",OC=class extends aR{constructor(){super();this.registerCSS(vC)}init(G){if(!this.gos.get("enableFilterHandlers")){eR(282);return}let D=this.beans.filterPanelSvc;D.isActive=!0,this.addDestroyFunc(()=>{D.isActive=!1}),this.updateParams(G,G.initialState);let z=this.createManagedBean(new bC);this.filterPanel=z;let B=(Q)=>{z.refresh(Q),G.onStateUpdated()};B(),this.addManagedListeners(D,{filterPanelStatesChanged:B,filterPanelStateChanged:B})}getGui(){return this.filterPanel?.getGui()}refresh(G){return this.updateParams(G,G.initialState),!0}updateParams(G,D){this.beans.filterPanelSvc?.updateParams(G,D)}getState(){return this.beans.filterPanelSvc?.getGridState()??{}}},z8={moduleName:"FiltersToolPanel",version:j,userComponents:{agFiltersToolPanel:TR},icons:{filtersToolPanel:"filter"},dependsOn:[jD,i,G8]},B8={moduleName:"NewFiltersToolPanel",version:j,userComponents:{agNewFiltersToolPanel:OC},beans:[cR,rR],icons:{filterAdd:"filter-add",filtersToolPanel:"filter",richSelectOpen:"small-down",richSelectRemove:"cancel",richSelectLoading:"loading",filterCardExpand:"chevron-down",filterCardCollapse:"chevron-up",filterCardEditing:"edit"},dependsOn:[jD,i,G8]},Q8=class extends xC{constructor(){super(...arguments);this.loadRowDataVersion=0}wireBeans(G){this.environment=G.environment}init(G,D){if(this.params=D,this.comp=G,D.pinned!=null)return;this.setAutoHeightClasses(),this.setupRefreshStrategy(),this.createDetailGrid(),this.loadRowData(),this.addManagedEventListeners({fullWidthRowFocused:this.onFullWidthRowFocused.bind(this)})}onFullWidthRowFocused(G){let D=this.params,z={rowIndex:D.node.rowIndex,rowPinned:D.node.rowPinned},B={rowIndex:G.rowIndex,rowPinned:G.rowPinned};if(!iC(z,B))return;hC(this.comp.getGui(),G.fromBelow)}setAutoHeightClasses(){let G=this.gos.get("detailRowAutoHeight"),D=G?"ag-details-row-auto-height":"ag-details-row-fixed-height",z=G?"ag-details-grid-auto-height":"ag-details-grid-fixed-height",B=this.comp;B.toggleCss(D,!0),B.toggleDetailGridCss(z,!0)}setupRefreshStrategy(){let G=this.params.refreshStrategy;if(G=="everything"||G=="nothing"||G=="rows"){this.refreshStrategy=G;return}if(G!=null)n0(170,{providedStrategy:G});this.refreshStrategy="rows"}createDetailGrid(){let{params:G,gos:D}=this;if(nC(G.detailGridOptions)){n0(171);return}let z=D.get("theme"),B=G.detailGridOptions.theme;if(B&&B!==z)n0(267);let Q={themeStyleContainer:this.environment.eStyleContainer,...G.detailGridOptions,theme:z};if(D.get("detailRowAutoHeight"))Q.domLayout="autoHeight";this.comp.setDetailGrid(Q)}registerDetailWithMaster(G){let{params:D,beans:{selectionSvc:z,findSvc:B,expansionSvc:Q}}=this,J=D.node.id,U=D.api,Z={id:J,api:G},S=D.node;if(U.isDestroyed())return;U.addDetailGridInfo(J,Z),S.detailGridInfo=Z;let X=S.parent;B?.registerDetailGrid(S,G);function Y(){if(X)z?.refreshMasterNodeState(X)}function W({source:H}){if(H==="expandAll")return G.expandAll();if(H==="collapseAll")return G.collapseAll()}function q({node:H,source:_}){if(H!==X||_==="masterDetail"||G.isDestroyed())return;z?.setDetailSelectionState(X,D.detailGridOptions,G)}G.addEventListener("firstDataRendered",()=>{if(G.isDestroyed()||U.isDestroyed())return;z?.setDetailSelectionState(X,D.detailGridOptions,G),G.addEventListener("selectionChanged",Y),U.addEventListener("rowSelected",q);let _=`${"CsrmSsrmSharedApi"}Module`;if(G.isModuleRegistered(_))U.addEventListener("expandOrCollapseAll",W),Q?.setDetailsExpansionState(G)}),this.addManagedListeners(X,{masterChanged:(H)=>{if(!H.node.master)this.onDestroy(Z)}}),this.addDestroyFunc(()=>this.onDestroy(Z))}onDestroy(G){let{params:D}=this,z=D.node,B=D.api;if(z.detailGridInfo!==G)return;if(!B.isDestroyed())B.removeDetailGridInfo(z.id);z.detailGridInfo=null}loadRowData(){this.loadRowDataVersion++;let G=this.loadRowDataVersion,D=this.params;if(D.detailGridOptions?.rowModelType==="serverSide"){D.node.detailGridInfo?.api?.refreshServerSide({purge:!0});return}let z=D.getDetailRowData;if(!z){n0(172);return}let B=(J)=>{if(this.loadRowDataVersion===G)this.comp.setRowData(J)},Q={node:D.node,data:D.node.data,successCallback:B,context:cC(this.gos,{}).context};z(Q)}refresh(){switch(this.refreshStrategy){case"nothing":return!0;case"everything":return!1}return this.loadRowData(),!0}},dC=class{constructor(G){this.parentWrapper=G}wrap(G,D,z,B){return this.parentWrapper.wrap(G,D,z,B)}},lC={tag:"div",cls:"ag-details-row"},pC={tag:"div",cls:"ag-details-row",role:"gridcell",children:[{tag:"div",ref:"eDetailGrid",cls:"ag-details-grid",role:"presentation"}]},mC=class extends jC{constructor(){super(...arguments);this.eDetailGrid=PC}wireBeans(G){this.context=G.context}init(G){this.params=G,this.selectAndSetTemplate();let D={toggleCss:(z,B)=>this.toggleCss(z,B),toggleDetailGridCss:(z,B)=>this.eDetailGrid.classList.toggle(z,B),setDetailGrid:(z)=>this.setDetailGrid(z),setRowData:(z)=>this.setRowData(z),getGui:()=>this.eDetailGrid};this.ctrl=this.createManagedBean(new Q8),this.ctrl.init(D,G)}refresh(){return this.ctrl?.refresh()??!1}selectAndSetTemplate(){let G=this.params;if(G.pinned){this.setTemplate(lC);return}let D=()=>{this.setTemplate(pC)};if(TC(G.template))D();else if(typeof G.template==="string")this.setTemplate(G.template,[]);else if(typeof G.template==="function"){let z=G.template,B=z(G);this.setTemplate(B,[])}else V2(168),D();if(this.eDetailGrid==null)V2(169)}setDetailGrid(G){if(!this.eDetailGrid)return;let D=this.context.getBean("frameworkCompWrapper"),z=new dC(D),{frameworkOverrides:B}=this.beans,Q=yC(this.eDetailGrid,G,{frameworkOverrides:B,providedBeanInstances:{frameworkCompWrapper:z},modules:gC(this.params.api.getGridId(),G.rowModelType??"clientSide")});this.detailApi=Q,this.ctrl?.registerDetailWithMaster(Q),this.addDestroyFunc(()=>{Q.destroy()})}setRowData(G){this.detailApi?.setGridOption("rowData",G)}};function dB(G,D){let z=G.masterDetailSvc?.store;return z?D(z):void 0}function tC(G,D,z){dB(G,(B)=>{B[D]=z})}function sC(G,D){dB(G,(z)=>{delete z[D]})}function oC(G,D){return dB(G,(z)=>z[D])}function rC(G,D){dB(G,(z)=>{let B=0;Object.values(z).forEach((Q)=>{if(Q)D(Q,B++)})})}var aC=".ag-details-row{width:100%}.ag-details-row-fixed-height{height:100%}.ag-details-grid{width:100%}.ag-details-grid-fixed-height{height:100%}",QV=class extends eC{constructor(){super(...arguments);this.beanName="masterDetailSvc",this.store={}}isEnabled(){return this.gos.get("masterDetail")}postConstruct(){let G=this.gos;if(b2(G))this.enabled=this.isEnabled();if(v2(G))this.addEventListeners()}addEventListeners(){let G=(B)=>{this.setMaster(B.node,!1,!0)},D,z=()=>{if(D){for(let B of D)B();D=void 0}if(this.isEnabled())D=this.addManagedListeners(this.beans.eventSvc,{rowNodeDataChanged:G})};z(),this.gos.addPropertyEventListener("masterDetail",z)}refreshModel(G){if(G.changedProps){let D=this.isEnabled();if(this.enabled!==D){this.setMasters(null);return}}if(G.rowDataUpdated)this.setMasters(G.changedRowNodes)}setMaster(G,D,z){let B=G.master,Q=this.isEnabled(),J=Q,U=this.gos,Z=U.get("isRowMaster"),S=U.get("treeData");if(Q)if(D||z){if(Z){let X=G.data;J=!!X&&!!Z(X)}}else J=B;if(!S){if(J&&D||!J&&B)G._expanded??(G._expanded=null)}if(J!==B)G.master=J,G.dispatchRowEvent("masterChanged")}setMasters(G){if(this.enabled=this.isEnabled(),G){for(let D of G.updates)this.setMaster(D,!1,!0);for(let D of G.adds)this.setMaster(D,!0,!1)}else{let D=zV(this.beans)?.rootNode?._leafs;if(D)for(let z=0,B=D.length;z{let U=D.clientHeight;if(U!=null&&U>0){let Z=()=>{let{rowModel:S}=this.beans,{rowNode:X}=G;if(X.setRowHeight(U),b2(z,S)||v2(z,S))S.onRowHeightChanged()};window.setTimeout(Z,0)}},J=BV(B,D,Q);G.addDestroyFunc(J),Q()}destroy(){this.store={},super.destroy()}},JV={moduleName:"SharedMasterDetail",version:j,beans:[QV],userComponents:{agDetailCellRenderer:mC},dynamicBeans:{detailCellRendererCtrl:Q8},apiFunctions:{addDetailGridInfo:tC,removeDetailGridInfo:sC,getDetailGridInfo:oC,forEachDetailGridInfo:rC},dependsOn:[i,p7,RJ],css:[aC]},lB={moduleName:"MasterDetail",version:j,dependsOn:[JV,_0,uC]},J8=class extends _V{constructor(){super(...arguments);this.changedCalculatedValues=!1,this.dragging=!1,this.shouldDestroyOnEndDragging=!1}postConstruct(){this.beans.dragSvc.addDragSource({dragStartPixels:0,eElement:this.getGui(),onDragging:(G)=>{let D=!1;if(!this.dragging)D=!0,this.dragging=!0,u2(this.beans).classList?.add(this.getDraggingCssClass());if(this.updateValuesOnMove(G),D){this.changedCalculatedValues=!1;return}if(this.beans.rangeSvc.autoScrollService.check(G),this.changedCalculatedValues)this.onDrag(G),this.changedCalculatedValues=!1},onDragStop:(G)=>{this.dragging=!1,this.onDragEnd(G),this.clearDragProperties()},onDragCancel:()=>{this.dragging=!1,this.onDragCancel(),this.clearDragProperties()}}),this.addManagedEventListeners({cellSelectionChanged:this.updateLocalRangeIfNeeded.bind(this)}),this.addManagedElementListeners(this.getGui(),{pointerdown:j2,mousedown:j2})}getLastCellHovered(){return this.lastCellHovered}getDraggingCssClass(){return`ag-dragging-${this.type===0?"fill":"range"}-handle`}updateValuesOnMove(G){let D=wV(this.gos,G);if(!D||this.shouldSkipCell(D)||this.lastCellHovered&&kV(D,this.lastCellHovered))return;this.lastCellHovered=D,this.changedCalculatedValues=!0}clearDragProperties(){if(this.clearValues(),this.beans.rangeSvc.autoScrollService.ensureCleared(),u2(this.beans).classList?.remove(this.getDraggingCssClass()),this.shouldDestroyOnEndDragging)this.destroy()}getType(){return this.type}refresh(G,D){let z=this.cellCtrl,B=this.getGui(),Q=D??NV(this.beans.rangeSvc.getCellRanges()),J=Q.startRow,U=Q.endRow;if(J&&U)if(KV(U,J))this.rangeStartRow=U,this.rangeEndRow=J;else this.rangeStartRow=J,this.rangeEndRow=U;if(z!==G||!fV(B)){this.cellCtrl=G;let Z=G.comp.getParentOfValue();if(Z)Z.appendChild(B)}this.cellRange=Q}clearValues(){this.lastCellHovered=void 0}destroy(){if(!this.shouldDestroyOnEndDragging&&this.dragging){FV(this.getGui(),!1),this.shouldDestroyOnEndDragging=!0;return}this.shouldDestroyOnEndDragging=!1,super.destroy(),this.getGui()?.remove()}updateLocalRangeIfNeeded(G){if(!this.cellRange)return;let{id:D,type:z}=this.cellRange;if(!D||D!==G.id)return;let B=this.beans.rangeSvc?.getCellRanges().find((Q)=>Q.id===D&&Q.type===z);if(B&&B!==this.cellRange)this.cellRange=B}},j2=(G)=>{G.stopPropagation()};function EV(G){let D=G.length,z=0;if(D<=1)return G;for(let W=0;W1){z=Math.max(z,parseInt(H[1],10));continue}if(Math.floor(q)===q)continue;z=Math.max(z,q.toString().split(".")[1].length)}let B=0,Q=0,J=0,U=0,Z=0;for(let W=0;WU?"x":"y";else S=Z;if(S!==this.dragAxis)this.dragAxis=S,this.changedCalculatedValues=!0}shouldSkipCell(G){return HV(G.column)}onDrag(G){if(!this.initialPosition){let z=this.cellCtrl;if(!z)return;this.initialPosition=z.cellPosition}let D=this.getLastCellHovered();if(D)this.markPathFrom(this.initialPosition,D)}onDragEnd(G){if(this.initialXY=null,!this.markedCells.length)return;let D=this.dragAxis==="x",{cellRange:z,rangeStartRow:B,rangeEndRow:Q,beans:{rangeSvc:J}}=this,U=z.columns.length,Z;if(!this.isUp&&!this.isLeft)Z=J.createCellRangeFromCellRangeParams({rowStartIndex:B.rowIndex,rowStartPinned:B.rowPinned,columnStart:z.columns[0],rowEndIndex:D?Q.rowIndex:this.lastCellMarked.rowIndex,rowEndPinned:D?Q.rowPinned:this.lastCellMarked.rowPinned,columnEnd:D?this.lastCellMarked.column:z.columns[U-1]});else{let S=D?B:this.lastCellMarked;Z=J.createCellRangeFromCellRangeParams({rowStartIndex:S.rowIndex,rowStartPinned:S.rowPinned,columnStart:D?this.lastCellMarked.column:z.columns[0],rowEndIndex:Q.rowIndex,rowEndPinned:Q.rowPinned,columnEnd:z.columns[U-1]})}if(Z)this.performFill({event:G,initialRange:z,finalRange:Z,shouldUpdateRange:!0})}onDragCancel(){if(this.initialXY=null,!this.markedCells.length)return;this.clearMarkedPath()}performFill({event:G,initialRange:D,finalRange:z,shouldUpdateRange:B}){let{eventSvc:Q,rangeSvc:J}=this.beans;if(Q.dispatchEvent({type:"fillStart"}),this.handleValueChanged(D,z,G),B)J.setCellRanges([z]);Q.dispatchEvent({type:"fillEnd",initialRange:D,finalRange:z})}getFillHandleDirection(){let G=$1(this.gos)?.direction;if(!G)return"xy";if(G!=="x"&&G!=="y"&&G!=="xy")return qV(177),"xy";return G}handleValueChanged(G,D,z){let{beans:B}=this,{rangeSvc:Q,gos:J,valueSvc:U}=B,Z=Q.getRangeEndRow(G),S=Q.getRangeStartRow(G),X=Q.getRangeEndRow(D),Y=Q.getRangeStartRow(D),W=this.dragAxis==="y";if(this.isReduce&&!$1(J)?.suppressClearOnFillReduction){let I=W?G.columns:G.columns.filter((A)=>D.columns.indexOf(A)<0),V=W?xz(B,X):Y;if(V)this.clearCellsInRange(V,Z,I);return}let q=[],H=[],_=[],k=[],w=!0,K=0,f=()=>{q.length=0,H.length=0,_.length=0,k.length=0,K=0},N=(I,V)=>{let A=this.isUp?Z:S,R=!1;if(W)w=!0,f();while(!R&&A){let O=SV(B,A);if(!O)break;if(W&&I)F(q,I,O,()=>!FG(A,this.isUp?S:Z));else if(V){w=!0,f();for(let u of V)F(q,u,O,()=>u!==(this.isLeft?G.columns[0]:tD(G.columns)))}R=FG(A,this.isUp?Y:X),A=this.isUp?L1(this.beans,A):xz(B,A)}},F=(I,V,A,R)=>{let O,u=!1;if(w)O=U.getValue(V,A,"edit"),H.push(O),_.push(U.getValue(V,A,"edit",!0)),k.push(U.getValueForDisplay({column:V,node:A,from:"edit"}).valueFormatted),w=R();else{let{value:v,fromUserFunction:h,sourceCol:P,sourceRowNode:b}=this.processValues({event:z,values:I,initialValues:H,initialNonAggregatedValues:_,initialFormattedValues:k,col:V,rowNode:A,idx:K++});if(O=v,V.isCellEditable(A)){let g=U.getValue(V,A,"edit");if(!h){if(P){let c=P.getColDef();if(c.useValueFormatterForExport!==!1&&c.valueFormatter){let s=U.getValueForDisplay({column:P,node:b,includeValueFormatted:!0,from:"edit"}).valueFormatted;if(s!=null)O=s}}if(V.getColDef().useValueParserForImport!==!1)O=U.parseValue(V,A,P?O:WV(O),g)}if(!h||g!==O)A.setDataValue(V,O,"rangeSvc");else u=!0}}if(!u)I.push({value:O,column:V,rowNode:A})},{changeDetectionSvc:E}=this.beans;E?.beginDeferred();try{if(W)G.columns.forEach((I)=>{N(I)});else{let I=this.isLeft?[...D.columns].reverse():D.columns;N(void 0,I)}this.beans.editSvc?.stopEditing(void 0,{source:"fillHandle"})}finally{E?.endDeferred()}}clearCellsInRange(G,D,z){let B={startRow:G,endRow:D,columns:z,startColumn:z[0]};this.beans.rangeSvc.clearCellRangeCellValues({cellRanges:[B],restoreSourceInBatch:!0})}processValues(G){let{formula:D,valueSvc:z}=this.beans,{event:B,values:Q,initialValues:J,initialNonAggregatedValues:U,initialFormattedValues:Z,col:S,rowNode:X,idx:Y}=G,W=$1(this.gos)?.setFillValue,q=this.dragAxis==="y",H;if(q)H=this.isUp?"up":"down";else H=this.isLeft?"left":"right";if(W){let w=$V(this.gos,{event:B,values:Q.map(({value:f})=>f),initialValues:J,initialNonAggregatedValues:U,initialFormattedValues:Z,currentIndex:Y,currentCellValue:z.getValue(S,X,"edit"),direction:H,column:S,rowNode:X}),K=W(w);if(K!==!1)return{value:K,fromUserFunction:!0}}let _=(w)=>typeof w==="number"&&Number.isFinite(w)||typeof w==="string"&&/^[+-]?\d+(?:\.\d+)?$/.test(w.trim()),k=Q.every(({value:w})=>_(w));if(B.altKey||!k){let w=String(tD(Q)?.value??"");if(k&&J.length===1){let I=this.isUp||this.isLeft?-1:1;return{value:parseFloat(w)+1*I,fromUserFunction:!1}}let{value:K,column:f,rowNode:N}=Q[Y%Q.length],F,E=f.isAllowFormula()&&D?.isFormula(w);if(E){let I=H==="up"?-1:H==="down"?1:0,V=H==="left"?-1:H==="right"?1:0;F=D.updateFormulaByOffset({value:w,rowDelta:I,columnDelta:V})}else F=K;return{value:F,fromUserFunction:!1,sourceCol:E?void 0:f,sourceRowNode:N}}return{value:tD(EV(Q.map(({value:w})=>Number(w)))),fromUserFunction:!1}}clearValues(){this.clearMarkedPath(),this.clearCellValues(),this.lastCellMarked=void 0,super.clearValues()}clearMarkedPath(){for(let G of this.markedCells){if(!G.isAlive())continue;let{comp:D}=G;D.toggleCss("ag-selection-fill-top",!1),D.toggleCss("ag-selection-fill-right",!1),D.toggleCss("ag-selection-fill-bottom",!1),D.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(G,D){if(this.clearMarkedPath(),this.clearCellValues(),this.dragAxis==="y"){if(FG(D,G))return;let z=XV(D,G),{rangeStartRow:B,rangeEndRow:Q}=this;if(z&&(D.rowPinned==B.rowPinned&&D.rowIndex>=B.rowIndex||B.rowPinned!=Q.rowPinned&&D.rowPinned==Q.rowPinned&&D.rowIndex<=Q.rowIndex))this.reduceVertical(G,D),this.isReduce=!0;else this.extendVertical(G,D,z),this.isReduce=!1}else{let z=G.column,B=D.column;if(z===B)return;let Q=this.beans.visibleCols.allCols,J=Q.indexOf(z),U=Q.indexOf(B);if(U<=J&&U>=Q.indexOf(this.cellRange.columns[0]))this.reduceHorizontal(G,D),this.isReduce=!0;else this.extendHorizontal(G,D,U=4),G.toggleCss(sV,J),tV(B,Q>0?!0:void 0),G.toggleCss(oV,this.isSingleCell()),this.updateRangeBorders(),this.refreshRangeStyleAndHandle()}updateRangeBorders(){let G=this.getRangeBorders(),D=this.isSingleCell(),z=!D&&G.top,B=!D&&G.right,Q=!D&&G.bottom,J=!D&&G.left,U=this.cellComp;U.toggleCss(aV,z),U.toggleCss(eV,B),U.toggleCss(Gb,Q),U.toggleCss(Db,J)}isSingleCell(){let{rangeSvc:G}=this;return this.rangeCount===1&&!!G&&!G.isMoreThanOneCell()}getHasChartRange(){let{rangeSvc:G}=this;if(!this.rangeCount||!G)return!1;let D=G.getCellRanges();return D.length>0&&D.every((z)=>[hz.DIMENSION,hz.VALUE].includes(z.type))}updateRangeBordersIfRangeCount(){if(this.rangeCount>0)this.updateRangeBorders(),this.refreshRangeStyleAndHandle()}getRangeBorders(){let G=this.beans.gos.get("enableRtl"),D=!1,z=!1,B=!1,Q=!1,{rangeSvc:J,beans:{visibleCols:U},cellCtrl:{cellPosition:Z}}=this,S=Z.column,X=J.getCellRanges().filter((q)=>J.isCellInSpecificRange(Z,q));if(!X.length)return{top:D,right:z,bottom:B,left:Q};let Y,W;if(G)Y=U.getColAfter(S),W=U.getColBefore(S);else Y=U.getColBefore(S),W=U.getColAfter(S);if(!Y)Q=!0;if(!W)z=!0;for(let q=0;q=0;B--){let Q=z[B],J=Q.colorClass;if(!J)continue;if(G.isCellInSpecificRange(this.cellCtrl.cellPosition,Q))return J}return null}refreshHandleColor(G){let D=this.selectionHandle?.getGui?.(),z=G?.colorClass??null;if(!D){this.handleColorClass=null;return}if(this.handleColorClass&&this.handleColorClass!==z)D.classList.remove(this.handleColorClass);if(z)D.classList.add(z);else if(this.handleColorClass)D.classList.remove(this.handleColorClass);this.handleColorClass=z??null}getRangeForHandle(){let{gos:G,editSvc:D}=this.beans,z=this.rangeSvc,B=z.getCellRanges(),Q=B.length;if(this.rangeCount<1||Q<1)return null;let J=D?.isRangeSelectionEnabledWhileEditing(),U=J?B:[pV(B)];for(let Z of U){let{cellPosition:S,column:X}=this.cellCtrl,Y=n2(G)&&!X.isSuppressFillHandle(),W=zb(G),H=!D?.isEditing(this.cellCtrl,{withOpenEditor:!0})&&(J||Q===1&&(Y||W));if(this.hasChartRange)H=Z.type===hz.VALUE;if(H&&Z.endRow!=null&&z.isContiguousRange(Z)&&z.isBottomRightCell(Z,S))return Z}return null}addSelectionHandle(G){let{beans:D}=this,z=D.editSvc?.isRangeSelectionEnabledWhileEditing(),B=G.type,J=!z&&n2(D.gos)&&mV(B)?0:1;if(this.selectionHandle&&this.selectionHandle.getType()!==J)this.selectionHandle=D.context.destroyBean(this.selectionHandle);if(!this.selectionHandle){let U=D.registry.createDynamicBean(J===0?"fillHandle":"rangeHandle",!1);if(U)this.selectionHandle=D.context.createBean(U)}this.selectionHandle?.refresh(this.cellCtrl,G)}destroy(){this.unsetComp()}},Jb=class extends Qb{constructor(G){super();this.eContainer=G}postConstruct(){let{beans:G,gos:D,eContainer:z}=this,B=G.rangeSvc,Q={eElement:z,onDragStart:B.onDragStart.bind(B),onDragStop:B.onDragStop.bind(B),onDragging:B.onDragging.bind(B)},J=G.dragSvc,U=J.addDragSource.bind(J,Q),Z=J.removeDragSource.bind(J,Q);if(this.addManagedPropertyListeners(["enableRangeSelection","cellSelection"],()=>{if(d2(D))U();else Z()}),this.addDestroyFunc(Z),d2(D))U()}},Zb=class extends Ub{constructor(G,D){super();this.column=G,this.eGui=D}postConstruct(){this.addManagedElementListeners(this.eGui,{click:(G)=>G&&this.onClick(G)})}onClick(G){this.beans.rangeSvc?.handleColumnSelection(this.column,G)}},Lb=class extends $b{constructor(G,D){super();this.column=G,this.comp=D,this.columnMap=new Map,this.isActive=!1,this.resetColumnMap()}postConstruct(){this.addManagedPropertyListener("cellSelection",()=>{this.refreshActive()}),this.refreshActive(),this.setupRangeHeaderHighlight()}resetColumnMap(){this.columnMap.clear();let G;if(this.column.isColumn)G=[this.column];else G=this.column.getDisplayedLeafColumns();for(let D of G)this.columnMap.set(D,!1)}refreshActive(){let{gos:G,rangeSvc:D}=this.beans,z=G.get("cellSelection");this.isActive=!!(z&&D&&typeof z==="object"&&z.enableHeaderHighlight)}setupRangeHeaderHighlight(){let G=this.onRangeSelectionChanged.bind(this);this.addManagedEventListeners({rangeSelectionChanged:G,columnPinned:G,columnMoved:G,columnGroupOpened:G}),G()}onRangeSelectionChanged(){if(!this.isActive)return;this.resetColumnMap();let G=this.beans.rangeSvc.getCellRanges(),D=!1,z=!0;for(let B of G){if(D)break;for(let Q of B.columns)if(this.columnMap.has(Q))this.columnMap.set(Q,!0),D||(D=!0)}for(let B of Array.from(this.columnMap.values()))if(B===!1){z=!1;break}this.comp.toggleCss("ag-header-range-highlight",D&&z)}destroy(){super.destroy(),this.comp=null,this.column=null}},Sb=class extends OV{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(G){this.rowModel=G.rowModel,this.dragSvc=G.dragSvc,this.colModel=G.colModel,this.visibleCols=G.visibleCols,this.cellNavigation=G.cellNavigation,this.ctrlsSvc=G.ctrlsSvc}postConstruct(){let G=this.onColumnsChanged.bind(this),D=()=>this.removeAllCellRanges(),z=this.refreshLastRangeStart.bind(this);this.addManagedEventListeners({newColumnsLoaded:G,columnVisible:G,columnValueChanged:G,columnPivotModeChanged:D,columnRowGroupChanged:D,columnPivotChanged:D,columnGroupOpened:z,columnMoved:z,columnPinned:z}),this.ctrlsSvc.whenReady(this,(B)=>{let Q=B.gridBodyCtrl;this.autoScrollService=new vV({scrollContainer:Q.eBodyViewport,scrollAxis:"xy",getVerticalPosition:()=>Q.scrollFeature.getVScrollPosition().top,setVerticalPosition:(J)=>Q.scrollFeature.setVerticalScrollPosition(J),getHorizontalPosition:()=>Q.scrollFeature.getHScrollPosition().left,setHorizontalPosition:(J)=>Q.scrollFeature.setHorizontalScrollPosition(J),shouldSkipVerticalScroll:()=>!iV(this.gos,"normal"),shouldSkipHorizontalScroll:()=>!Q.scrollFeature.isHorizontalScrollShowing()})})}registerRangeSelectionExtension(G){if(this.rangeSelectionExtensions.includes(G))return;this.rangeSelectionExtensions.push(G)}unregisterRangeSelectionExtension(G){p0(this.rangeSelectionExtensions,G)}shouldSuppressRangeSelection(G){return this.rangeSelectionExtensions.some((D)=>D.shouldSuppressRangeSelection?.(G))}shouldSkipColumn(G){return this.rangeSelectionExtensions.some((D)=>D.shouldSkipColumn?.(G))}isAllColumnsSelectionCell(G){return this.rangeSelectionExtensions.some((D)=>D.isAllColumnsSelectionCell?.(G))}isAllColumnsRange(G,D){return this.rangeSelectionExtensions.some((z)=>z.isAllColumnsRange?.(G,D))}updateSelectionModeForCell(G){this.setSelectionMode(this.isAllColumnsSelectionCell(G))}onDragStart(G){let D=this.gos,z=G.target;if(!l0(D)||yV(D,z)?.isSuppressMouseEvent(G))return;if(this.shouldSuppressRangeSelection(z))return;let{shiftKey:B}=G,Q=this.isMultiRange(G),J=B&&!!this.cellRanges?.length;if(!Q&&(!J||PV(DG(this.cellRanges).type)))this.removeAllCellRanges(!0);let U=this.dragSvc.startTarget;if(U)this.updateValuesOnMove(U);if(!this.lastCellHovered)return;if(this.dragging=!0,this.lastMouseEvent=G,this.intersectionRange=Q&&this.getCellRangeCount(this.lastCellHovered)>1,!J)this.setNewestRangeStartCell(this.lastCellHovered);if(this.cellRanges.length>0)this.draggingRange=DG(this.cellRanges);else{let Z={rowIndex:this.lastCellHovered.rowIndex,rowPinned:this.lastCellHovered.rowPinned},S=this.getColumnsFromModel([this.lastCellHovered.column]);if(!S?.length)return;this.draggingRange={startRow:Z,endRow:Z,columns:S,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(G){let{dragging:D,lastCellHovered:z,newestRangeStartCell:B,autoScrollService:Q,cellHasChanged:J}=this;if(!D||!G)return;this.updateValuesOnMove(G.target),this.lastMouseEvent=G;let U=(H)=>z&&z.rowPinned===H&&B.rowPinned===H,Z=U("top")||U("bottom");if(Q.check(G,Z),!J||!z)return;let S=B?.column,X=z?.column,Y=this.calculateColumnsBetween(S,X);if(!Y)return;let{rowIndex:W,rowPinned:q}=z;this.draggingRange.endRow={rowIndex:W,rowPinned:q},this.draggingRange.columns=Y,this.dispatchChangedEvent(!1,!1,this.draggingRange.id)}onDragStop(){if(!this.dragging)return;let{id:G}=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,G)}onColumnsChanged(){this.refreshLastRangeStart();let G=this.visibleCols.allCols;for(let z of this.cellRanges){let B=z.columns;if(z.columns=z.columns.filter((J)=>J.isVisible()&&G.indexOf(J)!==-1),!y2(B,z.columns))this.dispatchChangedEvent(!1,!0,z.id)}let D=this.cellRanges.length;if(this.cellRanges=this.cellRanges.filter((z)=>z.columns.length>0),D>this.cellRanges.length)this.dispatchChangedEvent(!1,!0)}refreshLastRangeStart(){let G=DG(this.cellRanges);if(!G)return;this.refreshRangeStart(G)}isContiguousRange(G){let D=G.columns;if(!D.length)return!1;let z=this.visibleCols.allCols,B=D.map((Q)=>z.indexOf(Q)).sort((Q,J)=>Q-J);return DG(B)-B[0]+1===D.length}getRangeStartRow(G){if(G.startRow&&G.endRow)return XG(G.startRow,G.endRow)?G.startRow:G.endRow;return{rowIndex:0,rowPinned:(this.beans.pinnedRowModel?.getPinnedTopRowCount()??0)>0?"top":null}}getRangeEndRow(G){if(G.startRow&&G.endRow)return XG(G.startRow,G.endRow)?G.endRow:G.startRow;let D=this.beans.pinnedRowModel?.getPinnedBottomRowCount()??0;if(D>0)return{rowIndex:D-1,rowPinned:"bottom"};return{rowIndex:this.rowModel.getRowCount()-1,rowPinned:null}}getRangeRowCount(G){let D=this.beans,z=this.getRangeStartRow(G),B=this.getRangeEndRow(G),Q=x2(D,z);return x2(D,B)-Q+1}handleCellMouseDown(G,D){let z=G.ctrlKey||G.metaKey;this.handleCellSelectionInput(D,{target:G.target,shiftKey:G.shiftKey,isRightClick:hV(this.beans,G),isMultiRange:this.isMultiRange(G),isMultiKey:z,preventDefault:()=>G.preventDefault()})}handleCellKeyboardSelect(G,D){let z=G.ctrlKey||G.metaKey;this.handleCellSelectionInput(D,{target:G.target,shiftKey:G.shiftKey,isRightClick:!1,isMultiRange:this.isMultiRangeForKeyState(z),isMultiKey:z,preventDefault:()=>G.preventDefault()})}handleCellSelectionInput(G,D){let{target:z,shiftKey:B,isRightClick:Q,isMultiRange:J,isMultiKey:U,preventDefault:Z}=D;if(this.shouldSuppressRangeSelection(z))return;let S=this.isAllColumnsSelectionCell(G);if(S)Z();if(B)return this.extendLatestRangeToCell(G);if(S&&Q)return;this.updateSelectionModeForCell(G);let X=this.calculateColumnsBetween(G.column,G.column);if(!X)return;let Y=S?this.findContainingRange({columns:X,startRow:G,endRow:G}):void 0;if(S&&!!Y&&J&&U&&Y)this.removeRowFromAllColumnsRange(G,Y);else this.setRangeToCell(G,J)}isMultiRange(G){return this.isMultiRangeForKeyState(G.ctrlKey||G.metaKey)}isMultiRangeForKeyState(G){let{editingWithRanges:D,allowMulti:z}=this.getMultiRangeContext();return D||(z?G:!1)}getMultiRangeContext(){let{gos:G,editSvc:D}=this.beans,z=!!D?.isEditing()&&!!D?.isRangeSelectionEnabledWhileEditing(),B=cV(G)&&!z;return{editingWithRanges:z,suppressMultiRanges:B,allowMulti:!B}}removeRowFromAllColumnsRange(G,D){let{beans:z,cellRanges:B}=this,Q=S1(z),J=X1(z),U=this.getRangeStartRow(D),Z=this.getRangeEndRow(D);if(!U&&CG(Q,G))m0(D,sD(z,Q),"top");else if(!Z&&CG(J,G))m0(D,cz(z,J),"bottom");else if(CG(U,Z))p0(B,D);else if(CG(U,G))m0(D,sD(z,G),"top");else if(CG(Z,G))m0(D,cz(z,G),"bottom");else{let S=cz(z,G),X=sD(z,G);D.startRow=U,D.endRow=S??void 0,B.push({...D,startRow:X??void 0,endRow:Z})}this.dispatchChangedEvent(!0,!0)}setRangeToCell(G,D=!1){let{gos:z}=this;if(!l0(z))return;this.updateSelectionModeForCell(G);let B=this.calculateColumnsBetween(G.column,G.column);if(!B)return;let{suppressMultiRanges:Q}=this.getMultiRangeContext();if(Q||!D||dV(this.cellRanges))this.removeAllCellRanges(!0);let J={rowIndex:G.rowIndex,rowPinned:G.rowPinned},U={startRow:J,endRow:J,columns:B,startColumn:G.column},Z=this.ensureRangeStartColumn(U);if(!Z)return;this.cellRanges.push(U),this.setNewestRangeStartCell({...G,column:Z}),this.onDragStop(),this.dispatchChangedEvent(!0,!0)}getRangeLastColumn(G){let D=G.columns[0],z=DG(G.columns);return this.newestRangeStartCell?.column===D?z:D}extendRangeRowCountBy(G,D){let{beans:z}=this,{startRow:B,endRow:Q}=G;if(!B||!Q)return;let J=0,U,Z=XG(Q,B);if(Z)U=B;else U=Q;let S=D>0?sD:cz,X=Math.abs(D);while(JD.indexOf(B)).filter((B)=>B>-1).sort((B,Q)=>B-Q);return{left:D[z[0]],right:D[DG(z)]}}extendLatestRangeInDirection(G){if(this.isEmpty()||!this.newestRangeStartCell)return;let D=G.key,z=G.ctrlKey||G.metaKey,B=DG(this.cellRanges),Q=this.newestRangeStartCell,J=B.endRow.rowIndex,U=B.endRow.rowPinned,S={column:this.getRangeLastColumn(B),rowIndex:J,rowPinned:U},X=this.cellNavigation.getNextCellToFocus(D,S,z);if(!X)return;if(this.shouldSkipColumn(X.column))return;return this.setCellRange({rowStartIndex:Q.rowIndex,rowStartPinned:Q.rowPinned,rowEndIndex:X.rowIndex,rowEndPinned:X.rowPinned,columnStart:Q.column,columnEnd:X.column}),X}setCellRange(G){if(!l0(this.gos))return;this.removeAllCellRanges(!0),this.addCellRange(G)}setCellRanges(G){if(y2(this.cellRanges,G))return;if(!this.verifyCellRanges(this.gos))return;this.setSelectionMode(!1),this.removeAllCellRanges(!0);let D=this.getColumnsFromModel(this.visibleCols.allCols)??[],z=!1;for(let B of G){if(B.columns&&B.startRow){let Q=this.getColumnsFromModel(B.columns);if(!Q||Q.length===0)continue;B.columns=Q;let{startRow:J}=B;this.setNewestRangeStartCell({rowIndex:J.rowIndex,rowPinned:J.rowPinned,column:B.columns[0]})}if(!z&&D.length>0&&this.isAllColumnsRange(B,D))z=!0;this.cellRanges.push(B)}this.setSelectionMode(z),this.dispatchChangedEvent(!1,!0)}clearCellRangeCellValues(G){let{beans:D,eventSvc:z}=this,{cellEventSource:B="rangeSvc",dispatchWrapperEvents:Q,wrapperEventSource:J="deleteKey",restoreSourceInBatch:U}=G,{cellRanges:Z}=G;if(Q)z.dispatchEvent({type:"cellSelectionDeleteStart",source:J}),z.dispatchEvent({type:"rangeDeleteStart",source:J});if(!Z)Z=this.cellRanges;let{valueSvc:S,editSvc:X}=D,Y=!!X?.isBatchEditing(),{changeDetectionSvc:W}=D;W?.beginDeferred();try{this.forEachEditableCellInRanges(Z,(q,H)=>{if(U&&Y){X?.batchResetToSourceValue({rowNode:q,column:H});return}let _=S.getDeleteValue(H,q);q.setDataValue(H,_,B)})}finally{W?.endDeferred()}if(Q)z.dispatchEvent({type:"cellSelectionDeleteEnd",source:J}),z.dispatchEvent({type:"rangeDeleteEnd",source:J})}createCellRangeFromCellRangeParams(G){return this.createPartialCellRangeFromRangeParams(G,!1)}createPartialCellRangeFromRangeParams(G,D){let{columns:z,columnStart:B,columnEnd:Q,rowStartIndex:J,rowStartPinned:U,rowEndIndex:Z,rowEndPinned:S}=G,X=this.getColumnsFromParams(z,B,Q);if(!X||!D&&X.columns.length===0)return;let{columns:Y,startsOnTheRight:W}=X,q=l2(J,U),H=l2(Z,S);return{startRow:q,endRow:H,columns:Y,startColumn:this.getColumnFromModel(B)??(W?DG(Y):Y[0])}}addCellRange(G){let D=this.gos;if(!l0(D)||!this.verifyCellRanges(D))return;this.setSelectionMode(!1);let z=this.createCellRangeFromCellRangeParams(G);if(z){if(z.startRow)this.setNewestRangeStartCell({rowIndex:z.startRow.rowIndex,rowPinned:z.startRow.rowPinned,column:z.startColumn});return this.cellRanges.push(z),this.dispatchChangedEvent(!1,!0,z.id),z}}getCellRanges(){return this.cellRanges}isEmpty(){return this.cellRanges.length===0}isMoreThanOneCell(){let G=this.cellRanges.length;if(G===0)return!1;if(G>1)return!0;let D=this.cellRanges[0],z=this.getRangeStartRow(D),B=this.getRangeEndRow(D);return z.rowPinned!==B.rowPinned||z.rowIndex!==B.rowIndex||D.columns.length!==1}areAllRangesAbleToMerge(){let G=new Map;if(this.cellRanges.length<=1)return!0;for(let B of this.cellRanges)this.forEachRowInRange(B,(Q)=>{let J=`${Q.rowPinned||"normal"}_${Q.rowIndex}`,U=G.get(J),Z=B.columns.map((S)=>S.getId());if(U){let S=Z.filter((X)=>U.indexOf(X)===-1);U.push(...S)}else G.set(J,Z)});let z;for(let B of G.values()){let Q=B.sort().join();if(z===void 0){z=Q;continue}if(z!==Q)return!1}return!0}removeAllCellRanges(G){if(this.isEmpty())return;if(this.onDragStop(),this.cellRanges.length=0,!G)this.dispatchChangedEvent(!1,!0)}isCellInAnyRange(G){return this.getCellRangeCount(G)>0}isCellInSpecificRange(G,D){let z=D.columns?.includes(G.column),B=this.isRowInRange(G,D);return z&&B}isColumnInAnyRange(G){let{beans:D}=this,z=S1(D),B=X1(D);if(!z||!B)return!1;let Q=G.isColumn?[G]:G.getDisplayedLeafColumns();return this.findContainingRange({columns:Q,startRow:z,endRow:B},!0)!=null}findContainingRange({columns:G,startRow:D,endRow:z},B=!1){let Q=this.cellRanges;for(let J=Q.length-1;J>=0;J--){let U=Q[J],Z=G.every((X)=>U.columns.includes(X)),S=!1;if(B)S=CG(U.startRow,D)&&CG(U.endRow,z);else{let X=D&&this.isRowInRange(D,U),Y=z&&this.isRowInRange(z,U);S=!!X&&!!Y}if(Z&&S)return U}}isBottomRightCell(G,D){let z=this.visibleCols.allCols,B=G.columns.map((X)=>z.indexOf(X)).sort((X,Y)=>X-Y),{startRow:Q,endRow:J}=G,U=XG(Q,J)?J:Q,Z=z.indexOf(D.column)===DG(B),S=D.rowIndex===U.rowIndex&&c2(D.rowPinned)===c2(U.rowPinned);return Z&&S}getCellRangeCount(G){return this.cellRanges.filter((D)=>this.isCellInSpecificRange(G,D)).length}isRowInRange(G,D){let z=this.getRangeStartRow(D),B=this.getRangeEndRow(D),Q=CG(G,z),J=CG(G,B);if(Q||J)return!0;let U=!XG(G,z),Z=XG(G,B);return U&&Z}intersectLastRange(G){let{editingWithRanges:D,suppressMultiRanges:z}=this.getMultiRangeContext();if(D||z||G&&this.dragging||this.isEmpty())return;let B=DG(this.cellRanges),Q=this.getRangeStartRow(B),J=this.getRangeEndRow(B),U=[];for(let Z of this.cellRanges.slice(0,-1)){let S=this.getRangeStartRow(Z),X=this.getRangeEndRow(Z),Y=Z.columns,W=Y.filter((H)=>B.columns.indexOf(H)===-1);if(W.length===Y.length){U.push(Z);continue}if(XG(J,S)||XG(X,Q)){U.push(Z);continue}let q=U.length;if(XG(S,Q)){let H={columns:[...Y],startColumn:B.startColumn,startRow:{...S},endRow:cz(this.beans,Q)};U.push(H)}if(W.length>0){let H={columns:W,startColumn:W.includes(B.startColumn)?B.startColumn:W[0],startRow:Xb([{...Q},{...S}]),endRow:Yb([{...J},{...X}])};U.push(H)}if(XG(J,X))U.push({columns:[...Y],startColumn:B.startColumn,startRow:sD(this.beans,J),endRow:{...X}});if(U.length-q===1)U[U.length-1].id=Z.id}if(this.cellRanges=U,G)this.dispatchChangedEvent(!1,!0)}createRangeHighlightFeature(G,D,z){G.createManagedBean(new Lb(D,z))}setSelectionMode(G){this.selectionMode=G?1:0}refreshRangeStart(G){let{columns:D}=G,z=this.ensureRangeStartColumn(G);if(!z)return;let B=(S,X)=>{let Y=G.columns.filter((W)=>W!==S);if(S)G.startColumn=S,G.columns=X?[S,...Y]:[...Y,S];else G.columns=Y},{left:Q,right:J}=this.getRangeEdgeColumns(G);if(z===D[0]&&z!==Q){B(Q,!0);return}if(z===DG(D)&&z===J)B(J,!1)}setNewestRangeStartCell(G){this.newestRangeStartCell=G}getColumnsFromParams(G,D,z){let B=!G&&!D&&!z,Q,J=!1;if(B||G)Q=this.getColumnsFromModel(B?void 0:G);else if(D&&z){if(Q=this.calculateColumnsBetween(D,z),Q?.length)J=Q[0]!==this.getColumnFromModel(D)}return Q?{columns:Q,startsOnTheRight:J}:void 0}verifyCellRanges(G){let{suppressMultiRanges:D}=this.getMultiRangeContext(),z=nV(G)&&D&&this.cellRanges.length>1;if(z)Y1(93);return!z}forEachRowInRange(G,D){let z=this.getRangeStartRow(G),B=this.getRangeEndRow(G),Q=z;while(Q){if(D(Q),CG(Q,B))break;Q=sD(this.beans,Q)}}forEachEditableCellInRanges(G,D){let{beans:z}=this;for(let B of G)this.forEachRowInRange(B,(Q)=>{let J=xV(z,Q);if(!J)return;for(let U=0;U0,X=D.ctrlKey||D.metaKey,Y=!Z||X,W=S1(B),q=X1(B);if(!W||!q)return;if(D.key===uV.ENTER)D.preventDefault();if(D.shiftKey){let _=Q.root;if(!_)return;let k=G.isColumn?G:DG(G.getLeafColumns()),w=this.findContainingRange({columns:[_],startRow:W,endRow:q},!0);if(!w){p0(J,Q.lastCellRange),this.selectColumns(this.calculateColumnsBetween(_,k),W,q);return}this.updateRangeRowBoundary({cellRange:w,boundary:"end",cellPosition:{column:k,...q}});return}if(S&&(U||!X&&!Z))this.removeAllCellRanges(!0);let H=(_,k)=>{let w=this.findContainingRange({columns:_,startRow:W,endRow:q},!0);if(w&&Y)this.deselectColumnsFromRange(w,_);else{let K=this.selectColumns(_,W,q);if(K)Q.lastCellRange=K}Q.root=k};if(G.isColumn)H([G],G);else{let _=G.getDisplayedLeafColumns();H(_,_[0])}}deselectColumnsFromRange(G,D){if(lV(G.columns,D),D.includes(G.startColumn))G.startColumn=G.columns[0];if(G.columns.length===0)p0(this.cellRanges,G);this.dispatchChangedEvent(!0,!0)}selectColumns(G,D,z){return this.addCellRange({columns:G,columnStart:G[0],columnEnd:DG(G),rowStartIndex:D.rowIndex,rowStartPinned:D.rowPinned,rowEndIndex:z.rowIndex,rowEndPinned:z.rowPinned})}};function l2(G,D){return G!=null?{rowIndex:G,rowPinned:D}:void 0}function Xb(G){let D;for(let z of G)if(D===void 0||XG(D,z))D=z;return D}function Yb(G){let D;for(let z of G)if(D===void 0||XG(z,D))D=z;return D}function Wb(G,D){let{startRow:z,endRow:B}=G,Q=XG(z,B)?B:z,J=D.rowIndex===Q.rowIndex&&D.rowPinned===Q.rowPinned,U=G.columns[0],Z=DG(G.columns),S=G.startColumn===U?Z:U;return D.column===S&&J}function m0(G,D,z){let B;if(z==="top")B=!G.startRow||!G.endRow||XG(G.startRow,G.endRow)?"startRow":"endRow";else B=!G.startRow||!G.endRow||XG(G.startRow,G.endRow)?"endRow":"startRow";G[B]=D??void 0}var Xz={moduleName:"CellSelection",version:j,beans:[Sb],dynamicBeans:{fillHandle:MV,rangeHandle:RV},apiFunctions:{getCellRanges:VV,addCellRange:bV,clearRangeSelection:T2,clearCellSelection:T2},dependsOn:[i,ZV,UV],css:[CV]},qb={moduleName:"RangeSelection",version:j,dependsOn:[Xz]},Ib={tag:"div",cls:"ag-loading",children:[{tag:"span",ref:"eLoadingIcon",cls:"ag-loading-icon"},{tag:"span",ref:"eLoadingText",cls:"ag-loading-text"}]},Mb=class extends Fb{constructor(){super(Ib);this.eLoadingIcon=p2,this.eLoadingText=p2}init(G){if(G.node.failedLoad)this.setupFailed();else this.setupLoading()}setupFailed(){this.eLoadingText.textContent=this.getLocaleTextFunc()("loadingError","ERR")}setupLoading(){let G=Eb("groupLoading",this.beans,null);if(G)this.eLoadingIcon.appendChild(G);this.eLoadingText.textContent=this.getLocaleTextFunc()("loadingOoo","Loading...")}refresh(G){return!1}},Ab={moduleName:"LoadingCellRenderer",version:j,userComponents:{agLoadingCellRenderer:Mb},icons:{groupLoading:"loading"},dependsOn:[i]};function Cb(G){return G.colModel.isPivotMode()}function Vb(G,D,z){return G.pivotResultCols?.lookupPivotResultCol(D,z)??null}function bb(G,D){G.valueColsSvc?.setColumns(D,"api")}function vb(G){return G.valueColsSvc?.columns??[]}function Ob(G,D){G.valueColsSvc?.removeColumns(D,"api")}function ub(G,D){G.valueColsSvc?.addColumns(D,"api")}function jb(G,D){G.pivotColsSvc?.setColumns(D,"api")}function Pb(G,D){G.pivotColsSvc?.removeColumns(D,"api")}function gb(G,D){G.pivotColsSvc?.addColumns(D,"api")}function Tb(G){return G.pivotColsSvc?.columns??[]}function yb(G,D){G.pivotResultCols?.setPivotResultCols(D,"api")}function xb(G){let D=G.pivotResultCols?.getPivotResultCols();return D?D.list:null}var m2="PivotRowTotal_",hb=({headerName:G},{headerName:D})=>{if(G&&!D)return 1;else if(!G&&D)return-1;else if(!G&&!D)return 0;if(GD)return 1;else return 0},ib=(G)=>(D,z)=>G(D.headerName,z.headerName),nb=class extends cb{constructor(){super(...arguments);this.beanName="pivotColDefSvc"}wireBeans(G){this.colModel=G.colModel,this.pivotColsSvc=G.pivotColsSvc,this.valueColsSvc=G.valueColsSvc,this.colNames=G.colNames}postConstruct(){let G=()=>this.gos.get("serverSidePivotResultFieldSeparator")??"_";this.fieldSeparator=G(),this.addManagedPropertyListener("serverSidePivotResultFieldSeparator",()=>{this.fieldSeparator=G()});let D=()=>this.gos.get("pivotDefaultExpanded");this.pivotDefaultExpanded=D(),this.addManagedPropertyListener("pivotDefaultExpanded",()=>{this.pivotDefaultExpanded=D()})}createPivotColumnDefs(G){let D=this.createPivotColumnsFromUniqueValues(G);function z(Q,J=[]){return Q.forEach((U)=>{if(U.children!==void 0)z(U.children,J);else J.push(U)}),J}let B=z(D);return this.addRowGroupTotals(D,B),this.addExpandablePivotGroups(D,B),this.addPivotTotalsToGroups(D,B),D}createPivotColumnsFromUniqueValues(G){let D=this.pivotColsSvc?.columns??[],z=D.length;return this.recursivelyBuildGroup(0,G,[],z,D)}recursivelyBuildGroup(G,D,z,B,Q){if(G>=B)return this.buildMeasureCols(z);let{pivotComparator:J}=Q[G].getColDef(),U=J?ib(J):hb,Z=this.valueColsSvc?.columns;if(Z?.length===1&&this.gos.get("removePivotHeaderRowWhenSingleValueColumn")&&G===B-1){let X=[];for(let Y of D.keys()){let W=[...z,Y],q=this.createColDef(Z[0],Y,W);q.columnGroupShow="open",X.push(q)}return X.sort(U),X}let S=[];for(let X of D.keys()){let Y=this.pivotDefaultExpanded===-1||G{let B=this.colNames.getDisplayNameForColumn(z,"header"),Q=this.createColDef(z,B,G);return Q.columnGroupShow="open",Q})}addExpandablePivotGroups(G,D){let z=this.gos.get("suppressExpandablePivotGroups");if(z||this.gos.get("pivotColumnGroupTotals"))return;let B=(Q,J,U)=>{if("children"in Q){let{valueColsSvc:X}=this,{columns:Y=[]}=X??{},W=new Map;Q.children.forEach((_)=>{B(_,J,W)});let q=!Q.children.some((_)=>_.children),H=q&&Y.length===1&&this.gos.get("removePivotHeaderRowWhenSingleValueColumn");for(let _ of Y){let k=this.colNames.getDisplayNameForColumn(_,"header"),w=this.createColDef(_,k,Q.pivotKeys);if(w.pivotTotalColumnIds=W.get(_.getColId()),w.columnGroupShow=!z?"closed":"open",w.aggFunc=_.getAggFunc(),!q||H)Q.children.push(w),J.push(w)}this.merge(U,W);return}if(!Q.pivotValueColumn)return;let Z=Q.pivotValueColumn.getColId();if(U.has(Z))U.get(Z).push(Q.colId);else U.set(Z,[Q.colId])};G.forEach((Q)=>{B(Q,D,new Map)})}addPivotTotalsToGroups(G,D){if(!this.gos.get("pivotColumnGroupTotals"))return;let z=this.gos.get("pivotColumnGroupTotals")==="after",B=this.valueColsSvc?.columns,Q=B?.map((J)=>J.getAggFunc());if(!Q||Q.length<1||!this.sameAggFuncs(Q))return;if(B){let J=B[0];G.forEach((U)=>{this.recursivelyAddPivotTotal(U,D,J,z)})}}recursivelyAddPivotTotal(G,D,z,B){let Q=G;if(!Q.children){let U=G;return U.colId?[U.colId]:null}let J=[];if(Q.children.forEach((U)=>{let Z=this.recursivelyAddPivotTotal(U,D,z,B);if(Z)J=J.concat(Z)}),Q.children.length>1){let Z=this.getLocaleTextFunc()("pivotColumnGroupTotals","Total"),S=this.createColDef(z,Z,G.pivotKeys,!0);S.pivotTotalColumnIds=J,S.aggFunc=z.getAggFunc(),S.columnGroupShow=this.gos.get("suppressExpandablePivotGroups")?"open":void 0;let X=G.children;if(B)X.push(S);else X.unshift(S);D.push(S)}return J}addRowGroupTotals(G,D){if(!this.gos.get("pivotRowTotals"))return;let z=this.gos.get("pivotRowTotals")==="after",Q=(this.valueColsSvc?.columns??[]).slice();if(!z)Q.reverse();let J=Q.length>1||!this.gos.get("removePivotHeaderRowWhenSingleValueColumn");for(let U=0;UJ.data?.[J.colDef.field],Q.pivotKeys=z,Q.pivotValueColumn=G,Q.filter===!0)Q.filter="agNumberColumnFilter";return Q}sameAggFuncs(G){if(G.length==1)return!0;for(let D=1;D{let J=[...G.has(B)?G.get(B):[],...z];G.set(B,J)})}generateColumnGroupId(G){return`pivotGroup_${(this.pivotColsSvc?.columns??[]).map((z)=>z.getColId()).join("-")}_${G.join("-")}`}generateColumnId(G,D){return`pivot_${(this.pivotColsSvc?.columns??[]).map((B)=>B.getColId()).join("-")}_${G.join("-")}_${D}`}createColDefsFromFields(G){let D=new Map;for(let Q=0;Q{let S=[];for(let[W,q]of U){let H=z(`${Q}${this.fieldSeparator}${W}`,W,q,Z+1);S.push(H)}if(S.length===0){let W=this.colModel.getColDefCol(J);if(W){let H=this.colNames.getDisplayNameForColumn(W,"header")??J,_=this.createColDef(W,H,void 0,!1);return _.colId=Q,_.aggFunc=W.getAggFunc(),_.valueGetter=(k)=>k.data?.[Q],_}return{colId:Q,headerName:J,valueGetter:(H)=>H.data?.[Q]}}if(this.gos.get("removePivotHeaderRowWhenSingleValueColumn")&&S.length===1&&"colId"in S[0])return S[0].headerName=J,S[0];return{openByDefault:this.pivotDefaultExpanded===-1||Z{Q.forEach((J)=>{if(tb(J.children)){let Z=J;if(z)z(Z);B(Z.children)}else{let Z=J;if(D)D(Z)}})};if(G)B(G)}},s2="Exceeded maximum allowed pivot column count.",WB=(G)=>{let D={};return G.forEach((z,B)=>D[B]=z instanceof Map?WB(z):z),D},Dv=class extends rb{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(G){this.valueSvc=G.valueSvc,this.colModel=G.colModel,this.pivotResultCols=G.pivotResultCols,this.rowGroupColsSvc=G.rowGroupColsSvc,this.valueColsSvc=G.valueColsSvc,this.pivotColsSvc=G.pivotColsSvc,this.pivotColDefSvc=G.pivotColDefSvc}execute(G){if(this.colModel.isPivotActive())return this.executePivotOn(G);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(G){let D=this.valueColsSvc?.columns.length??1,z=this.gos.get("pivotMaxGeneratedColumns");this.maxUniqueValues=z===-1?-1:z/D;let B;try{B=this.bucketUpRowNodes(G)}catch(K){if(K.message===s2)return this.pivotResultCols.setPivotResultCols([],"rowModelUpdated"),this.eventSvc.dispatchEvent({type:"pivotMaxColumnsExceeded",message:K.message}),this.lastTimeFailed=!0,!1;throw K}let Q=this.setUniqueValues(B),J=this.valueColsSvc?.columns??[],U=J.map((K)=>`${K.getId()}-${K.getColDef().headerName}`).join("#"),Z=J.map((K)=>K.getAggFunc().toString()).join("#"),S=this.aggregationColumnsHashLastTime!==U,X=this.aggregationFuncsHashLastTime!==Z;this.aggregationColumnsHashLastTime=U,this.aggregationFuncsHashLastTime=Z;let Y=(this.rowGroupColsSvc?.columns??[]).map((K)=>K.getId()).join("#"),W=Y!==this.groupColumnsHashLastTime;this.groupColumnsHashLastTime=Y;let q=this.gos.get("pivotRowTotals"),H=this.gos.get("pivotColumnGroupTotals"),_=this.gos.get("suppressExpandablePivotGroups"),k=this.gos.get("removePivotHeaderRowWhenSingleValueColumn"),w=q!==this.pivotRowTotalsLastTime||H!==this.pivotColumnGroupTotalsLastTime||_!==this.suppressExpandablePivotGroupsLastTime||k!==this.removePivotHeaderRowWhenSingleValueColumnLastTime;if(this.pivotRowTotalsLastTime=q,this.pivotColumnGroupTotalsLastTime=H,this.suppressExpandablePivotGroupsLastTime=_,this.removePivotHeaderRowWhenSingleValueColumnLastTime=k,this.lastTimeFailed||Q||S||W||X||w){let K=this.pivotColDefSvc.createPivotColumnDefs(this.uniqueValues);return this.pivotResultCols.setPivotResultCols(K,"rowModelUpdated"),this.lastTimeFailed=!1,!0}return this.lastTimeFailed=!1,!1}setUniqueValues(G){if(!eb(WB(this.uniqueValues),WB(G)))return this.uniqueValues=G,!0;return!1}bucketUpRowNodes(G){this.currentUniqueCount=0;let D=new Map;ab(this.beans.rowModel.rootNode,this.beans.rowModel.hierarchical,G,(B)=>{if(B.leafGroup)B.childrenMapped=null});let z=(B)=>{if(B.leafGroup)this.bucketRowNode(B,D);else{let Q=B.childrenAfterFilter;if(Q)for(let J=0,U=Q.length;Jthis.maxUniqueValues;if(U&&q)throw Error(s2)}if(!Q.has(W))Q.set(W,[]);Q.get(W).push(Y)}if(z===D.length-1)return Q;let Z=new Map;for(let S of Q.keys())Z.set(S,this.bucketChildren(Q.get(S),D,z+1,B.get(S)));return Z}},U8={moduleName:"SharedPivot",version:j,beans:[ob,nb,T7],apiFunctions:{isPivotMode:Cb,getPivotResultColumn:Vb,setValueColumns:bb,getValueColumns:vb,removeValueColumns:Ob,addValueColumns:ub,setPivotColumns:jb,removePivotColumns:Pb,addPivotColumns:gb,getPivotColumns:Tb,setPivotResultColumns:yb,getPivotResultColumns:xb},dependsOn:[CJ,Rb]},pB={moduleName:"Pivot",version:j,rowModels:["clientSide"],beans:[Dv],dependsOn:[U8,VJ,_0]},o2=(G)=>{let D=G.split(".");if(D.includes("__proto__"))return()=>{};let z=D.length;if(z<2)return(B)=>B?.[G];return(B)=>{let Q=0;do if(B=B?.[D[Q++]],Q===z)return B;while(typeof B==="object")}},HG=2147483648,wG=1073741824,s0=536870912,nz=268435455,W1=String.fromCodePoint(31,41150,8291),q1=3,Jv=class extends zv{constructor(){super(...arguments);this.nestedDataGetter=null,this.parentIdGetter=null,this.nonLeafsById=null,this.nodesToUnselect=null,this.fullReload=!1}postConstruct(){this.onPropChange(null)}onPropChange(G){let D=this.gos;if(!G||G.has("treeDataParentIdField")){let z=D.get("treeDataParentIdField"),B=z?o2(z):null;if(this.fullReload||(this.fullReload=this.parentIdGetter!==B),this.parentIdGetter=B,B)this.nestedDataGetter=null}if(!G||G.has("treeDataChildrenField")){let z=this.parentIdGetter?"":D.get("treeDataChildrenField"),B=z?o2(z):null;this.fullReload||(this.fullReload=this.nestedDataGetter!==B),this.nestedDataGetter=B}}destroy(){this.nodesToUnselect=null,this.reset(),super.destroy()}reset(){this.clearNonLeafs(),this.deselectHiddenNodes(!1),this.fullReload=!0}clearNonLeafs(){let G=this.nonLeafsById;if(G){for(let D of G.values())D._destroy(!1);G.clear(),this.nonLeafsById=null}}getNonLeaf(G){return this.nonLeafsById?.get(G)}loadGroupData(G){let D=G.key;if(D==null)return G._groupData=null,null;let z={};G._groupData=z;let B=this.beans.showRowGroupCols?.columns;if(B)for(let Q=0,J=B.length;Q0&&Z!==X)this.handleCycles(G),this.traverseRoot(G,B);return G.treeNodeFlags=0,this.deselectHiddenNodes(U||Q),S}flagUpdatedNodes(G){let{adds:D,updates:z,removals:B}=G,Q=B.length>0;if(D.size>0){Q=!0;for(let J of D)J.treeNodeFlags|=wG}if(z.size>0){Q=!0;for(let J of z)J.treeNodeFlags|=wG}return Q}initRowsParents(G){let D=G._leafs,z=D.length,B=!1;for(let Q=0;Q=0||B.treeNodeFlags&s0||B.treeParent===null){B.treeNodeFlags=Q;break}B.treeNodeFlags=Q|s0|G.treeNodeFlags&wG,G=B}return D}destroyFillerRows(G){let D=this.nonLeafsById;if(D){for(let z of D.values())if(z.treeParent===null||(z.treeNodeFlags&nz)===0)D.delete(z.id),z._destroy(G),this.hideRow(z);if(D.size===0)this.nonLeafsById=null}}initRowsChildrenSize(G){this.initRowChildrenSize(G);let D=G._leafs,z=D.length;for(let Q=0;Q=0){if(D!==null){G.childrenAfterGroup=null,G.childrenAfterFilter=null,G.childrenAfterAggFilter=null,G.childrenAfterSort=null;let U=G.sibling;if(U)U.childrenAfterGroup=null,U.childrenAfterFilter=null,U.childrenAfterAggFilter=null,U.childrenAfterSort=null}}else if(Q!==J||D===z)if(!D||D===z){G.childrenAfterGroup=D=Array(J);let U=G.sibling;if(U)U.childrenAfterGroup=D}else D.length=J}preprocessRows(G){let D=G._leafs,z=D.length,B=0,Q=!1;for(let J=0;J0)B?.addRow(G);G._leafs=void 0}return U+1}handleCycles(G){let D=new Set,z=(J)=>{if(D.has(J))return!1;D.add(J);for(let U of J.childrenAfterGroup??[])z(U);return!0};z(G);let B=G.childrenAfterGroup;B.length=0;let Q=G._leafs;for(let J=0,U=Q.length;J=0;--q){let H=D.get(S.slice(0,B[q]));if(H){W=H,Y=q+1;break}}if(Y0?D[Q-1]+q1:0,U=D[Q];B+="-"+Q+"-"+G.slice(J,U),++Q}return B+"-"+z+"-"}deselectHiddenNodes(G){let D=this.beans.selectionSvc,z=this.nodesToUnselect,B="rowDataChanged";if(z)this.nodesToUnselect=null,D?.setNodesSelected({newValue:!1,nodes:z,suppressFinishActions:!0,source:"rowDataChanged"});if(z||G)D?.updateGroupsFromChildrenSelections?.("rowDataChanged");if(z){let Q=D?.getSelectedNodes()??null;this.eventSvc.dispatchEvent({type:"selectionChanged",source:"rowDataChanged",selectedNodes:Q,serverSideState:null})}}hideRow(G){if(G.isSelected())(this.nodesToUnselect??(this.nodesToUnselect=[])).push(G);G.parent=null,G.group=!1,G.treeParent=null,G.treeNodeFlags=0,G.childrenAfterGroup=null,G.childrenAfterFilter=null,G.childrenAfterAggFilter=null,G.childrenAfterSort=null,G._leafs=void 0,G._groupData=null,G.aggData=null;let D=G.sibling;if(D)D.childrenAfterGroup=null,D.childrenAfterFilter=null,D.childrenAfterAggFilter=null,D.childrenAfterSort=null;if(G.updateHasChildren(),G.rowIndex!==null)G.clearRowTopAndRowIndex()}onShowRowGroupColsSetChanged(){let G=this.beans.rowModel.rootNode._leafs;if(!G)return;for(let z=0,B=G.length;zG.sourceRowIndex-D.sourceRowIndex,Zv=(G,D)=>{if(D._expanded!==void 0&&G._expanded===void 0&&G.treeParent!==null&&G.sourceRowIndex<0)G._expanded=D._expanded},o0=(G,D)=>{let z=G._groupData!==void 0;G.key=D,G.groupValue=D;let B=G.sibling;if(B)B.key=D;if(z)G._groupData=void 0,G.setData(G.data)},Z8={moduleName:"SharedTreeData",version:j,dependsOn:[i,IJ,m7,AJ,RJ]},$8={moduleName:"TreeData",version:j,dynamicBeans:{treeGroupStrategy:Jv},rowModels:["clientSide"],dependsOn:[Z8,MJ,_0,t7]},Wv="ag-Grid-MissingKey",qv=class extends $v{constructor(){super(...arguments);this.beanName="ssrmBlockUtils"}wireBeans(G){this.valueSvc=G.valueSvc,this.showRowGroupCols=G.showRowGroupCols,this.nodeManager=G.ssrmNodeManager,this.expansionSvc=G.expansionSvc,this.serverSideRowModel=G.rowModel,this.storeFactory=G.ssrmStoreFactory}createRowNode(G){let D=new Lv(this.beans),z=G.rowHeight!=null?G.rowHeight:Xv(this.beans);if(D.setRowHeight(z),D.group=G.group,D.leafGroup=G.leafGroup,D.level=G.level,D.uiLevel=G.level,D.parent=G.parent,D.stub=!0,D.__needsRefreshWhenVisible=!1,D.group)D.expanded=!1,D.field=G.field,D.rowGroupColumn=G.rowGroupColumn,D.rowGroupIndex=G.level;return D}destroyRowNode(G,D=!1){if(G.childStore&&!D)this.destroyBean(G.childStore),G.childStore=null;let z=G.sibling;if(z&&!G.footer)this.destroyRowNode(z,!1);if(G._destroy(!0),G.id!=null)this.nodeManager.removeNode(G)}setTreeGroupInfo(G){G.updateHasChildren();let D=this.gos.get("getServerSideGroupKey"),z=G.hasChildren();if(z&&D!=null)G.key=D(G.data);if(!z&&G.childStore!=null){if(this.destroyBean(G.childStore),G.childStore=null,!G.master)G.expanded=!1}}setRowGroupInfo(G){if(G.key=this.valueSvc.getValue(G.rowGroupColumn,G,"data"),G.key===null||G.key===void 0)Sv(()=>{Yv(190,{rowGroupId:G.rowGroupColumn?.getId(),data:G.data})},"SSBlock-BadKey");if(this.gos.get("groupAllowUnbalanced")&&G.key===""){let Q=this.serverSideRowModel.getParams();G.childStore=this.createBean(this.storeFactory.createStore(Q,G))}if(r2(this.beans.gos)({node:G})){if(pG(G,this.beans),G.sibling)G.sibling.uiLevel=G.uiLevel+1}}setMasterDetailInfo(G){let D=this.gos.get("isRowMaster");if(D!=null)G.master=D(G.data);else G.master=!0}updateDataIntoRowNode(G,D){if(G.updateData(D),this.gos.get("treeData"))this.setTreeGroupInfo(G),this.setChildCountIntoRowNode(G),this.updateRowFooter(G);else if(G.group)this.setChildCountIntoRowNode(G),this.updateRowFooter(G);else if(this.gos.get("masterDetail"));}updateRowFooter(G){if(G.footer)return;if(G.group){if(r2(this.beans.gos)({node:G})&&!G.sibling){pG(G,this.beans);return}}if(G.sibling)EJ(G)}setDataIntoRowNode(G,D,z,B){G.stub=!1;let Q=this.gos.get("treeData");G.setDataAndId(D,z);let J=G.group;if((Q||!J)&&this.gos.get("masterDetail"))this.setMasterDetailInfo(G);if(Q)this.setTreeGroupInfo(G);else if(J)this.setRowGroupInfo(G);if(Q||J)this.setGroupDataIntoRowNode(G),this.setChildCountIntoRowNode(G);if(H1(D))G.setRowHeight(a2(this.beans,G,!1,B).height),G.sibling?.setRowHeight(a2(this.beans,G.sibling,!1,B).height)}setChildCountIntoRowNode(G){let D=this.gos.get("getChildCount");if(D)G.setAllChildrenCount(D(G.data))}setGroupDataIntoRowNode(G){let D=G.key;if(G.groupValue=D,G.sibling)G.sibling.groupValue=D;let z=this.showRowGroupCols?.columns;if(!z)return;let B=this.gos.get("treeData");for(let Q of z){let J=G._groupData;if(!J)J={},G._groupData=J;if(B)J[Q.getColId()]=D;else if(Q.isRowGroupDisplayed(G.rowGroupColumn.getId())){let U=this.valueSvc.getValue(G.rowGroupColumn,G,"data");J[Q.getColId()]=U}}}clearDisplayIndex(G){if(G.clearRowTopAndRowIndex(),G.hasChildren()&&!!G.childStore)G.childStore?.clearDisplayIndexes();if(G.master&&G.detailNode)G.detailNode?.clearRowTopAndRowIndex()}setDisplayIndex(G,D,z,B){let Q=this.gos.get("groupAllowUnbalanced")&&G.group&&G.key==="";if(this.gos.get("groupHideOpenParents")&&G.group&&G.expanded||Q)G.setRowIndex(null),G.setRowTop(null);else G.setRowIndex(D.value++),G.setRowTop(z.value),z.value+=G.rowHeight;if(G.setUiLevel(B),G.footer)return;if(G.master){if(G.expanded&&G.detailNode)G.detailNode.setRowIndex(D.value++),G.detailNode.setRowTop(z.value),z.value+=G.detailNode.rowHeight;else if(G.detailNode)G.detailNode.clearRowTopAndRowIndex()}if(G.hasChildren()&&!!G.childStore){let S=G.childStore;if(G.expanded||Q)S.setDisplayIndexes(D,z,Q?B:B+1);else S.clearDisplayIndexes()}}extractRowBounds(G,D){let z=(B)=>({rowHeight:B.rowHeight,rowTop:B.rowTop});if(G.rowIndex===D)return z(G);if(G.hasChildren()&&G.expanded&&!!G.childStore){let B=G.childStore;if(B.isDisplayIndexInStore(D))return B.getRowBounds(D)}else if(G.master&&G.expanded&&G.detailNode){if(G.detailNode.rowIndex===D)return z(G.detailNode)}}isPixelInNodeRange(G,D){if(!H1(G.rowTop)||!H1(G.rowHeight))return!1;return D>=G.rowTop&&D=0){if(z.key==="")D.push(Wv);else D.push(z.key);z=z.parent}if(D.length>0)return D.reverse().join("-");return}checkOpenByDefault(G){let D=!!this.expansionSvc?.isNodeExpanded(G),z=G._expanded;if(!!z!==D)G.setExpanded(D);else if(z===void 0)G._expanded=D}},kv=class extends Hv{constructor(){super(...arguments);this.beanName="ssrmExpandListener"}postConstruct(){if(!_v(this.gos))return;this.addManagedEventListeners({rowExpansionStateChanged:this.onRowExpandStateChanged.bind(this)})}onRowExpandStateChanged(){let G=this.beans,D=G.expansionSvc;G.rowModel.forEachNode((z)=>{D.updateExpandedState(z)}),this.eventSvc.dispatchEvent({type:"storeUpdated"})}},Nv=class extends wv{constructor(){super(...arguments);this.beanName="ssrmFilterListener"}wireBeans(G){this.serverSideRowModel=G.rowModel,this.filterManager=G.filterManager,this.listenerUtils=G.ssrmListenerUtils}postConstruct(){if(!Kv(this.gos))return;this.addManagedEventListeners({advancedFilterEnabledChanged:()=>this.onFilterChanged(!0),filterChanged:()=>this.onFilterChanged()})}onFilterChanged(G){let D=this.serverSideRowModel.getParams();if(!D)return;let z=D.filterModel,B,Q;if(this.filterManager?.isAdvFilterEnabled()){B=this.filterManager.getAdvFilterModel();let S=G?Object.keys(z??{}):this.getAdvancedFilterColumns(z),X=this.getAdvancedFilterColumns(B);for(let Y of S)X.add(Y);Q=Array.from(X)}else if(B=this.filterManager?.getFilterModel()??{},G){let S=this.getAdvancedFilterColumns(z);for(let X of Object.keys(B))S.add(X);Q=Array.from(S)}else Q=this.findChangedColumns(z,B);let J=this.listenerUtils.isSortingWithValueColumn(Q),U=this.listenerUtils.isSortingWithSecondaryColumn(Q),Z={valueColChanged:J,secondaryColChanged:U,changedColumns:Q};this.serverSideRowModel.refreshAfterFilter(B,Z)}findChangedColumns(G,D){let z={};for(let Q of Object.keys(G))z[Q]=!0;for(let Q of Object.keys(D))z[Q]=!0;let B=[];for(let Q of Object.keys(z))if(!fv(G[Q],D[Q]))B.push(Q);return B}getAdvancedFilterColumns(G){let D=new Set;if(!G)return D;let z=(B)=>{if(B.filterType==="join")for(let Q of B.conditions)z(Q);else D.add(B.colId)};return z(G),D}},Ev=class extends Fv{constructor(){super(...arguments);this.beanName="ssrmListenerUtils"}wireBeans(G){this.pivotResultCols=G.pivotResultCols,this.valueColsSvc=G.valueColsSvc}isSortingWithValueColumn(G){let D=(this.valueColsSvc?.columns??[]).map((z)=>z.getColId());for(let z=0;z-1)return!0;return!1}isSortingWithSecondaryColumn(G){let D=this.pivotResultCols?.getPivotResultCols();if(!D)return!1;let z=D.list.map((B)=>B.getColId());for(let B=0;B-1)return!0;return!1}},Av=class extends Iv{constructor(){super(...arguments);this.beanName="ssrmSortSvc"}wireBeans(G){this.sortSvc=G.sortSvc,this.serverSideRowModel=G.rowModel,this.listenerUtils=G.ssrmListenerUtils}postConstruct(){if(!Mv(this.gos))return;this.addManagedEventListeners({sortChanged:this.onSortChanged.bind(this)})}onSortChanged(){let G=this.serverSideRowModel.getParams();if(!G)return;let D=this.sortSvc.getSortModel(),z=G.sortModel,B=this.findChangedColumnsInSort(D,z),Q=this.listenerUtils.isSortingWithValueColumn(B),J=this.listenerUtils.isSortingWithSecondaryColumn(B),U={valueColChanged:Q,secondaryColChanged:J,changedColumns:B};this.serverSideRowModel.refreshAfterSort(D,U)}findChangedColumnsInSort(G,D){let z=[];for(let J of[G,D])if(J){let U=J.map((Z)=>Z.colId);z=z.concat(U)}let B=(J,U)=>{let Z=J?J.sort:null,S=U?U.sort:null;return Z!==S},Q=(J,U)=>{let Z=J?D.indexOf(J):-1,S=U?G.indexOf(U):-1;return Z!==S};return z.filter((J)=>{let U=D.find((S)=>S.colId===J),Z=G.find((S)=>S.colId===J);return B(U,Z)||Q(U,Z)})}},Vv=class extends Rv{constructor(){super(...arguments);this.beanName="ssrmNodeManager",this.rowNodes=new Map}addRowNode(G){let D=G.id;if(this.rowNodes.has(D))Cv(187,{rowId:D,firstData:this.rowNodes.get(D).data,secondData:G.data});this.rowNodes.set(D,G)}removeNode(G){let D=G.id;this.rowNodes.delete(D)}destroy(){this.clear(),super.destroy()}clear(){this.rowNodes.clear(),super.destroy()}},yv=class extends bv{constructor(){super(...arguments);this.beanName="rowModel",this.hierarchical=!0,this.started=!1,this.managingPivotResultColumns=!1,this.onRowHeightChanged_debounced=Ov(this,this.onRowHeightChanged.bind(this),100)}wireBeans(G){this.colModel=G.colModel,this.colNames=G.colNames,this.pivotResultCols=G.pivotResultCols,this.rowGroupColsSvc=G.rowGroupColsSvc,this.pivotColsSvc=G.pivotColsSvc,this.valueColsSvc=G.valueColsSvc,this.filterManager=G.filterManager,this.sortSvc=G.sortSvc,this.rowRenderer=G.rowRenderer,this.nodeManager=G.ssrmNodeManager,this.storeFactory=G.ssrmStoreFactory,this.pivotColDefSvc=G.pivotColDefSvc}ensureRowHeightsValid(){return!1}start(){this.started=!0,this.updateDatasource()}destroyDatasource(){if(!this.datasource)return;if(this.datasource.destroy)this.datasource.destroy();this.rowRenderer.datasourceChanged(),this.datasource=void 0}postConstruct(){let G=this.resetRootStore.bind(this);this.addManagedEventListeners({newColumnsLoaded:this.onColumnEverything.bind(this),storeUpdated:this.onStoreUpdated.bind(this),columnValueChanged:G,columnPivotChanged:G,columnRowGroupChanged:G,columnPivotModeChanged:G}),this.addManagedPropertyListeners(["masterDetail","treeData","removePivotHeaderRowWhenSingleValueColumn","cacheBlockSize"],G),this.addManagedPropertyListeners(["groupAllowUnbalanced","groupTotalRow"],()=>this.onStoreUpdated()),this.addManagedPropertyListener("rowHeight",()=>this.resetRowHeights()),this.verifyProps(),this.addManagedPropertyListener("serverSideDatasource",()=>this.updateDatasource())}updateDatasource(){let G=this.gos.get("serverSideDatasource");if(G)this.setDatasource(G)}verifyProps(){if(Pv(this.gos)&&!this.gos.exists("getRowId"))Tv(188,{feature:"selection"})}setDatasource(G){if(!this.started)return;this.destroyDatasource(),this.datasource=G,this.resetRootStore()}applyRowData(G,D,z){let B=this.getRootStore();if(!B)return;let Q=B.getChildStore(z);if(!Q)return;Q.applyRowData(G,D,G.rowData.length)}isLastRowIndexKnown(){let G=this.getRootStore();if(!G)return!1;return G.isLastRowIndexKnown()}onColumnEverything(){if(!this.storeParams){this.resetRootStore();return}let G=this.columnsToValueObjects(this.rowGroupColsSvc?.columns),D=this.columnsToValueObjects(this.valueColsSvc?.columns),z=this.columnsToValueObjects(this.pivotColsSvc?.columns),B=(X)=>{let Y={};for(let H of X.oldCols)Y[H.id]=H;let W=X.newCols.every((H)=>{let _=Y[H.id];if(_)delete Y[H.id];return _&&_.field===H.field&&_.aggFunc===H.aggFunc}),q=!X.allowRemovedColumns&&!!Object.values(Y).length;return W&&!q},Q=!gv(this.storeParams.sortModel,this.sortSvc?.getSortModel()??[]),J=!B({oldCols:this.storeParams.rowGroupCols,newCols:G}),U=!B({oldCols:this.storeParams.pivotCols,newCols:z}),Z=!!G?.length&&!B({oldCols:this.storeParams.valueCols,newCols:D,allowRemovedColumns:!0});if(Q||J||U||Z)this.resetRootStore();else{let X=this.createStoreParams();this.storeParams.rowGroupCols=X.rowGroupCols,this.storeParams.pivotCols=X.pivotCols,this.storeParams.valueCols=X.valueCols}}destroyRootStore(){if(!this.rootNode?.childStore)return;this.rootNode.childStore=this.destroyBean(this.rootNode.childStore),this.nodeManager.clear()}refreshAfterSort(G,D){if(this.storeParams)this.storeParams.sortModel=G;let z=this.getRootStore();if(!z)return;z.refreshAfterSort(D),this.onStoreUpdated()}generateSecondaryColumns(G){if(!this.pivotColDefSvc){this.gos.assertModuleRegistered("SharedPivot",2);return}let D=this.pivotColDefSvc.createColDefsFromFields(G);this.managingPivotResultColumns=!0,this.pivotResultCols?.setPivotResultCols(D,"rowModelUpdated")}resetRowHeights(){let G=this.resetRowHeightsForAllRowNodes(),D=dz(this.beans,this.rootNode);if(this.rootNode.setRowHeight(D.height,D.estimated),this.rootNode.sibling){let z=dz(this.beans,this.rootNode.sibling);this.rootNode.sibling.setRowHeight(z.height,z.estimated)}if(G)this.onRowHeightChanged()}resetRowHeightsForAllRowNodes(){let G=!1;return this.forEachNode((D)=>{let z=dz(this.beans,D);D.setRowHeight(z.height,z.estimated);let B=D.detailNode;if(B){let Q=dz(this.beans,B);B.setRowHeight(Q.height,Q.estimated)}if(D.sibling){let Q=dz(this.beans,D.sibling);B?.setRowHeight(Q.height,Q.estimated)}G=!0}),G}resetRootStore(){if(this.destroyRootStore(),this.rootNode=new vv(this.beans),this.rootNode.group=!0,this.rootNode.level=-1,this.datasource)this.storeParams=this.createStoreParams(),this.rootNode.childStore=this.createBean(this.storeFactory.createStore(this.storeParams,this.rootNode)),this.updateRowIndexesAndBounds();if(this.managingPivotResultColumns)this.pivotResultCols?.setPivotResultCols(null,"api"),this.managingPivotResultColumns=!1;this.dispatchModelUpdated(!0)}columnsToValueObjects(G=[]){return G.map((D)=>({id:D.getId(),aggFunc:D.getAggFunc(),displayName:this.colNames.getDisplayNameForColumn(D,"model"),field:D.getColDef().field}))}createStoreParams(){let G=this.columnsToValueObjects(this.rowGroupColsSvc?.columns),D=this.columnsToValueObjects(this.valueColsSvc?.columns),z=this.columnsToValueObjects(this.pivotColsSvc?.columns),B=jv(this.gos);return{valueCols:D,rowGroupCols:G,pivotCols:z,pivotMode:this.colModel.isPivotMode(),filterModel:this.filterManager?.isAdvFilterEnabled()?this.filterManager?.getAdvFilterModel():this.filterManager?.getFilterModel()??{},sortModel:this.sortSvc?.getSortModel()??[],datasource:this.datasource,lastAccessedSequence:{value:0},dynamicRowHeight:B}}getParams(){return this.storeParams}dispatchModelUpdated(G=!1){this.eventSvc.dispatchEvent({type:"modelUpdated",animate:!G,keepRenderedRows:!G,newPage:!1,newData:!1})}onStoreUpdated(){this.updateRowIndexesAndBounds(),this.dispatchModelUpdated()}onRowHeightChanged(){this.updateRowIndexesAndBounds(),this.dispatchModelUpdated()}updateRowIndexesAndBounds(){let G=this.getRootStore();if(!G)return;G.setDisplayIndexes({value:0},{value:0},0)}retryLoads(){let G=this.getRootStore();if(!G)return;G.retryLoads(),this.onStoreUpdated()}getRow(G){let D=this.getRootStore();if(!D)return;return D.getRowUsingDisplayIndex(G)}refreshAfterFilter(G,D){if(this.storeParams)this.storeParams.filterModel=G;let z=this.getRootStore();if(!z)return;z.refreshAfterFilter(D),this.onStoreUpdated()}getRootStore(){return this.rootNode?.childStore}getRowCount(){let G=this.getRootStore();if(!G)return 0;return G.getDisplayIndexEnd()}getTopLevelRowCount(){let G=this.getRootStore();if(!G)return 1;return G.getRowCount()}getTopLevelRowDisplayedIndex(G){let D=this.getRootStore();if(!D)return G;return D.getTopLevelRowDisplayedIndex(G)}getRowBounds(G){let D=this.getRootStore();if(!D)return{rowTop:0,rowHeight:uv(this.beans)};return D.getRowBounds(G)}getBlockStates(){let G=this.getRootStore();if(!G)return;let D={};return G.forEachStoreDeep((z)=>{let B=z.getBlockStates();for(let Q of Object.keys(B))D[Q]=B[Q]}),D}getRowIndexAtPixel(G){let D=this.getRootStore();if(G<=0||!D)return 0;return D.getRowIndexAtPixel(G)}isEmpty(){return!1}getOverlayType(){if(this.getRootStore()?.getDisplayIndexEnd()===0)return this.filterManager?.isAnyFilterPresent()?"noMatchingRows":"noRows";return null}isRowsToRender(){return this.getRootStore()!=null&&this.getRowCount()>0}getType(){return"serverSide"}forEachNode(G){let D=this.getRootStore();if(!D)return;D.forEachNodeDeep(G)}forEachDisplayedNode(G){let D=(z,B)=>{if(z.stub||!z.displayed)return;G(z,B)};this.forEachNode(D)}forEachNodeAfterFilterAndSort(G,D=!1){let z=this.getRootStore();if(!z)return;z.forEachNodeDeepAfterFilterAndSort(G,void 0,D)}executeOnStore(G,D){if(!this.started)return!1;let z=this.getRootStore();if(!z)return!0;let B=z.getChildStore(G);if(B)D(B);return!0}refreshStore(G={}){let D=G.route?G.route:[];this.executeOnStore(D,(z)=>z.refreshStore(G.purge==!0))}getStoreState(){let G=[],D=this.getRootStore();if(D)D.addStoreStates(G);return G}getNodesInRangeForSelection(G,D){let z=G.rowIndex,B=D.rowIndex;if(z===null&&B===null)return[];if(B===null)return G?[G]:[];if(z===null)return[D];let Q=[],[J,U]=[z,B].sort((Z,S)=>Z-S);if(this.forEachNode((Z)=>{let S=Z.rowIndex;if(S==null||Z.stub)return;if(S>=J&&S<=U)Q.push(Z)}),Q.length!==U-J+1)return null;return Q}getRowNode(G){let D;return this.forEachNode((z)=>{if(z.id===G)D=z;if(z.detailNode&&z.detailNode.id===G)D=z.detailNode}),D}isRowPresent(G){return!!this.getRowNode(G.id)}setRowCount(G,D){let z=this.getRootStore();if(!z)return;z.setRowCount(G,D)}destroy(){this.destroyDatasource(),this.destroyRootStore(),super.destroy()}onRowHeightChangedDebounced(){this.onRowHeightChanged_debounced()}};function cv(G){return G.selectionSvc?.getSelectionState()??null}function hv(G,D){G.selectionSvc?.setSelectionState(D,"api")}function iv(G,D){return G.ssrmTxnManager?.applyTransaction(D)}function nv(G,D){let z=D.startRow??0,B=D.route??[];if(z<0){xv(189,{startRow:z});return}mB(G)?.applyRowData(D.successParams,z,B)}function dv(G,D,z){return G.ssrmTxnManager?.applyTransactionAsync(D,z)}function lv(G){mB(G)?.retryLoads()}function pv(G){return G.ssrmTxnManager?.flushAsyncTransactions()}function mv(G,D){mB(G)?.refreshStore(D)}function tv(G){return mB(G)?.getStoreState()??[]}var r0=class extends av{constructor(){super(...arguments);this.name="expand",this.expanded=new Set,this.collapsed=new Set,this.initialState=new Map}setExpandedState({expandedRowGroupIds:G,collapsedRowGroupIds:D}){this.expanded=new Set(G),this.collapsed=new Set(D);for(let z of this.expanded)this.initialState.set(z,!1);for(let z of this.collapsed)this.initialState.set(z,!0)}getExpandedState(){return{expandedRowGroupIds:Array.from(this.expanded),collapsedRowGroupIds:Array.from(this.collapsed)}}setRowExpanded(G,D){let z=G.id,B=this.initialState.get(z)===D;if(D){if(this.collapsed.delete(z),!B)this.expanded.add(z);return}if(this.expanded.delete(z),!B)this.collapsed.add(z)}isRowExpanded(G){let D=G.id;if(this.expanded.has(D))return!0;if(this.collapsed.has(D))return!1;let z=this.initialState.get(D);if(z!=null)return z;let B=this.getInitialRowState(G);return this.initialState.set(D,B),B}getInitialRowState(G){if(!G.isExpandable())return!1;let D=this.gos.getCallback("isServerSideGroupOpenByDefault");if(!D)return!1;let z={data:G.data,rowNode:G};return D(z)}isRowInitialised(G){return this.initialState.has(G)}expandAll(G){this.beans.rowModel.forEachNode((D)=>{this.setRowExpanded(D,G)})}},e2=class extends ev{constructor(){super(...arguments);this.name="expandAll",this.allExpanded=void 0,this.flipped=new Set}setExpandedState(G){this.allExpanded=G.expandAll,this.flipped=new Set(G.invertedRowGroupIds)}getExpandedState(){return{expandAll:this.allExpanded,invertedRowGroupIds:Array.from(this.flipped)}}setRowExpanded(G,D){let z=G.id;if(D===this.allExpanded){this.flipped.delete(z);return}this.flipped.add(z)}isRowExpanded(G){let D=G.id;return this.allExpanded!==this.flipped.has(D)}isRowInitialised(){return!0}expandAll(G){this.allExpanded=G,this.flipped.clear()}},GO=class extends x7{constructor(){super(...arguments);this.beanName="expansionSvc"}wireBeans(G){this.serverSideRowModel=G.rowModel,this.storeFactory=G.ssrmStoreFactory}setStrategy(G){this.destroyBean(this.strategy),this.strategy=this.createManagedBean(G)}postConstruct(){let G=()=>{this.setStrategy(new r0)};this.addManagedEventListeners({columnRowGroupChanged:G,columnPivotChanged:G,columnPivotModeChanged:G}),this.addManagedPropertyListener("ssrmExpandAllAffectsAllRows",(D)=>{if(!D.currentValue)this.setStrategy(new r0),this.updateAllNodes(),this.dispatchStateUpdatedEvent()}),G()}setExpansionState(G){let D="expandAll"in G,z=this.isExpandAllStrategy(this.strategy);if(D!==z)this.setStrategy(D?new e2:new r0);this.strategy.setExpandedState(G),this.dispatchStateUpdatedEvent(),this.updateAllNodes()}getExpansionState(){return this.strategy.getExpandedState()}updateAllNodes(){this.serverSideRowModel.forEachNode((G)=>{super.setExpanded(G,this.isNodeExpanded(G))})}isExpanded(G){let D=G._expanded;if(D===null)D=this.defaultExpanded(G),G._expanded=D;return D}isNodeExpanded(G){return this.strategy.isRowExpanded(G)}setExpanded(G,D,z,B){this.strategy.setRowExpanded(G,D),super.setExpanded(G,D,z),this.dispatchStateUpdatedEvent(),this.updateExpandedState(G)}resetExpansion(){this.setStrategy(new r0),this.updateAllNodes(),this.dispatchStateUpdatedEvent()}expandAll(G){let D=this.beans.gos.get("ssrmExpandAllAffectsAllRows");if(!this.isExpandAllStrategy(this.strategy)&&D)this.setStrategy(new e2);this.strategy.expandAll(G),this.updateAllNodes(),this.dispatchStateUpdatedEvent(),this.beans.eventSvc.dispatchEvent({type:"expandOrCollapseAll",source:G?"expandAll":"collapseAll"})}isExpandAllStrategy(G){return G.name==="expandAll"}onGroupExpandedOrCollapsed(){}setDetailsExpansionState(G){let{gos:D}=this.beans;if(!D.get("ssrmExpandAllAffectsAllRows"))return;let z=this.getExpansionState();if(z.expandAll===void 0)return;let Q=z.expandAll&&z.invertedRowGroupIds.length===0;if((!z.expandAll&&z.invertedRowGroupIds.length===0)===Q)return;return Q?G.expandAll():G.collapseAll()}dispatchExpandedEvent(G){this.eventSvc.dispatchEvent(G),this.beans.rowRenderer.refreshRowByNode(G.node)}updateExpandedState(G){let D=G.childStore;if(G.expanded){if(G.master&&!G.detailNode)G.detailNode=this.createDetailNode(G);if(!D&&G.hasChildren()){let z=this.serverSideRowModel.getParams();G.childStore=this.createBean(this.storeFactory.createStore(z,G))}}else if(D&&this.gos.get("purgeClosedRowNodes"))G.childStore=this.destroyBean(D)}createDetailNode(G){let D=new sv(this.beans);if(D.detail=!0,D.selectable=!1,D.parent=G,ov(G.id))D.id="detail_"+G.id;D.data=G.data,D.level=G.level+1;let z=200,B=rv(this.beans,D).height;return D.rowHeight=B?B:z,D}},_1=class extends JO{constructor(G){super();this.selectionCtx=G,this.selectedState={selectAll:!1,toggledNodes:new Set},this.selectAllUsed=!1,this.selectedNodes={}}getSelectedState(){return{selectAll:this.selectedState.selectAll,toggledNodes:[...this.selectedState.toggledNodes]}}setSelectedState(G){if(typeof G!=="object"){e0(116);return}if(!("selectAll"in G)){e0(116);return}if(typeof G.selectAll!=="boolean"){e0(117);return}if(!("toggledNodes"in G)||!Array.isArray(G.toggledNodes))return GB(197);let D={selectAll:G.selectAll,toggledNodes:new Set};G.toggledNodes.forEach((B)=>{if(typeof B==="string")D.toggledNodes.add(B);else GB(196,{key:B})});let z=D.selectAll||D.toggledNodes.size>1;if(UO(this.gos)&&!z5(this.gos)&&z){GB(130);return}this.selectedState=D}deleteSelectionStateFromParent(G,D){if(this.selectedState.toggledNodes.size===0)return!1;let z=!1;for(let B of D)if(this.selectedState.toggledNodes.delete(B))z=!0;return z}setNodesSelected(G){let{nodes:D,clearSelection:z,newValue:B,source:Q}=G;if(D.length===0)return 0;let J=z&&B;if(!z5(this.gos)||J){if(D.length>1)return e0(130),0;let Z=D[0],S=Z.footer?Z.sibling:Z;if(B&&S.selectable)this.selectedNodes={[S.id]:S},this.selectedState={selectAll:!1,toggledNodes:new Set([S.id])};else this.selectedNodes={},this.selectedState={selectAll:!1,toggledNodes:new Set};return 1}let U=(Z,S=B)=>{let X=Z.footer?Z.sibling:Z;if(S&&X.selectable)this.selectedNodes[X.id]=X;else delete this.selectedNodes[X.id];if(S===this.selectedState.selectAll||!X.selectable)this.selectedState.toggledNodes.delete(X.id);else this.selectedState.toggledNodes.add(X.id)};for(let Z of D)U(Z);if(D.length===1&&Q==="api")this.selectionCtx.setRoot(D[0].footer?D[0].sibling:D[0]);return 1}processNewRow(G){if(this.selectedNodes[G.id])this.selectedNodes[G.id]=G}isNodeSelected(G){let D=this.selectedState.toggledNodes.has(G.id);return this.selectedState.selectAll?!D:D}getSelectedNodes(G=!1,D=!0){let{selectedState:{selectAll:z},selectedNodes:B,selectAllUsed:Q}=this;if(D&&Q)GB(199);return G&&z?null:Object.values(B)}getSelectedRows(){return(this.getSelectedNodes()??[]).map((G)=>G.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(!0)}deselectAllRowNodes(){this.reset(!1)}reset(G){this.selectedState={selectAll:G,toggledNodes:new Set},this.selectedNodes={},this.selectAllUsed||(this.selectAllUsed=G)}getSelectAllState(){if(this.selectedState.selectAll){if(this.selectedState.toggledNodes.size>0)return null;return!0}if(this.selectedState.toggledNodes.size>0)return null;return!1}},DB=class extends ZO{constructor(G){super();this.selectionCtx=G,this.selectedState={selectAllChildren:!1,toggledNodes:new Map}}wireBeans(G){this.rowModel=G.rowModel,this.rowGroupColsSvc=G.rowGroupColsSvc,this.filterManager=G.filterManager,this.selectionSvc=G.selectionSvc}postConstruct(){this.addManagedEventListeners({modelUpdated:()=>this.removeRedundantState(),columnRowGroupChanged:()=>this.selectionSvc.reset("rowGroupChanged")})}getSelectedState(){let{gos:G,rowGroupColsSvc:D,selectedState:z}=this,B=G.get("treeData"),Q=(J,U,Z)=>{let S={nodeId:Z};if(B||D&&U<=D.columns.length)S.selectAllChildren=J.selectAllChildren;if(J.toggledNodes.size){let X=[];J.toggledNodes.forEach((Y,W)=>{let q=Q(Y,U+1,W);X.push(q)}),S.toggledNodes=X}return S};return Q(z,0)}setSelectedState(G){if("selectAll"in G){KD(111);return}let D=(z,B)=>{if(typeof z!=="object")throw KD(243),Error();if("selectAllChildren"in z&&typeof z.selectAllChildren!=="boolean")throw KD(244),Error();if("toggledNodes"in z){if(!Array.isArray(z.toggledNodes))throw KD(245),Error();if(!z.toggledNodes.every((S)=>typeof S==="object"&&("nodeId"in S)&&typeof S.nodeId==="string"))throw KD(246),Error()}let Q=z.selectAllChildren??!B,J=z.toggledNodes?.map((Z)=>[Z.nodeId,D(Z,Q)]);if(J?.some(([,Z])=>Q===Z.selectAllChildren&&Z.toggledNodes.size===0))throw KD(247),Error();return{selectAllChildren:Q,toggledNodes:new Map(J)}};try{this.selectedState=D(G,!!G.selectAllChildren)}catch(z){}}deleteSelectionStateFromParent(G,D){let z=this.selectedState,B=[...G];while(z&&B.length)z=z.toggledNodes.get(B.pop());if(!z)return!1;let Q=!1;for(let J of D)if(z?.toggledNodes.delete(J))Q=!0;if(Q)this.removeRedundantState();return Q}setNodesSelected({nodes:G,newValue:D,clearSelection:z,source:B}){if(G.length===0)return 0;let Q=z&&D;if(!$O(this.gos)||Q){if(G.length>1)return KD(130),0;this.deselectAllRowNodes()}for(let J of G){let U=J.footer?J.sibling:J,Z=this.getRouteToNode(U);this.recursivelySelectNode(Z,this.selectedState,D)}if(this.removeRedundantState(),G.length===1&&B==="api")this.selectionCtx.setRoot(G[0].footer?G[0].sibling:G[0]);return 1}isNodeSelected(G){let D=this.getRouteToNode(G);return this.isNodePathSelected(D,this.selectedState)}isNodePathSelected([G,...D],z){if(D.length===0){let B=z.toggledNodes.has(G.id);if(G.hasChildren()){if(z.toggledNodes.get(G.id)?.toggledNodes.size)return}return z.selectAllChildren?!B:B}if(z.toggledNodes.has(G.id)){let B=z.toggledNodes.get(G.id);if(B)return this.isNodePathSelected(D,B)}return z.selectAllChildren}getRouteToNode(G){let D=[],z=G;while(z.parent)D.push(z),z=z.parent;return D.reverse()}removeRedundantState(){if(this.filterManager?.isAnyFilterPresent())return;let G=(D=this.selectedState,z,B)=>{if(D.toggledNodes.forEach((U,Z)=>{G(U,Z,D)}),z){let Z=this.rowModel.getRowNode(z)?.childStore;if(Z?.isLastRowIndexKnown()){if(D.toggledNodes.size>=Z.getRowCount()){for(let Y of D.toggledNodes.entries()){let[W,q]=Y;if(q.toggledNodes.size>0)return;if(!this.rowModel.getRowNode(W))return}D.selectAllChildren=!D.selectAllChildren,D.toggledNodes.clear()}}}let Q=D.toggledNodes.size===0,J=B?.selectAllChildren===D.selectAllChildren;if(Q&&J)B?.toggledNodes.delete(z)};G()}recursivelySelectNode([G,...D],z,B){if(!G)return;if(!D.length){let Z=G.selectable;if(z.selectAllChildren===B||!Z){z.toggledNodes.delete(G.id);return}let X={selectAllChildren:B,toggledNodes:new Map};z.toggledNodes.set(G.id,X);return}let J=z.toggledNodes.has(G.id),U=z.toggledNodes.get(G.id)??{selectAllChildren:z.selectAllChildren,toggledNodes:new Map};if(!J)z.toggledNodes.set(G.id,U);if(this.recursivelySelectNode(D,U,B),z.selectAllChildren===U.selectAllChildren&&U.toggledNodes.size===0)z.toggledNodes.delete(G.id)}getSelectedNodes(G=!1){if(LO(202),this.selectedState.selectAllChildren&&G)return null;let D=[];return this.rowModel.forEachNode((z)=>{if(z.isSelected())D.push(z)}),D}processNewRow(){}getSelectedRows(){return this.getSelectedNodes()?.map((G)=>G.data)??[]}getSelectionCount(){return-1}isEmpty(){return!this.selectedState.selectAllChildren&&!this.selectedState.toggledNodes?.size}selectAllRowNodes(){this.reset(!0)}deselectAllRowNodes(){this.reset(!1)}reset(G){this.selectedState={selectAllChildren:G,toggledNodes:new Map}}getSelectAllState(){if(this.selectedState.selectAllChildren){if(this.selectedState.toggledNodes.size>0)return null;return!0}if(this.selectedState.toggledNodes.size>0)return null;return!1}},SO=class extends DO{constructor(){super(...arguments);this.beanName="selectionSvc"}postConstruct(){super.postConstruct(),this.addManagedPropertyListeners(["groupSelectsChildren","rowSelection"],()=>{let z=G5(this.gos),B=z&&this.selectionStrategy instanceof _1?DB:!z&&this.selectionStrategy instanceof DB?_1:void 0;if(B)this.destroyBean(this.selectionStrategy),this.selectionStrategy=this.createManagedBean(new B(this.selectionCtx)),this.shotgunResetNodeSelectionState(),this.dispatchSelectionChanged("api")}),this.addManagedPropertyListeners(["rowSelection"],()=>{let z=D5(this.gos);if(z!==this.selectionMode)this.selectionMode=z,this.deselectAllRowNodes({source:"api"})}),this.selectionMode=D5(this.gos);let D=!G5(this.gos)?_1:DB;this.selectionStrategy=this.createManagedBean(new D(this.selectionCtx))}handleSelectionEvent(G,D,z){if(this.isRowSelectionBlocked(D))return 0;let B=0,Q=this.inferNodeSelections(D,G.shiftKey,G.metaKey||G.ctrlKey,z);if(Q==null)return 0;if(this.selectionCtx.selectAll=!1,"select"in Q){if(Q.reset)this.selectionStrategy.deselectAllRowNodes({source:"api"});else this.selectionStrategy.setNodesSelected({nodes:Q.deselect,newValue:!1,source:z});B=this.selectionStrategy.setNodesSelected({nodes:Q.select,newValue:!0,source:z})}else B=this.selectionStrategy.setNodesSelected({nodes:[Q.node],newValue:Q.newValue,clearSelection:Q.clearSelection,event:G,source:z});return this.shotgunResetNodeSelectionState(z),this.dispatchSelectionChanged(z),B}getSelectionState(){return this.selectionStrategy.getSelectedState()}setSelectionState(G,D){if(!a0(this.gos)){if(G)ED(132);return}if(Array.isArray(G))return;if(G)this.selectionStrategy.setSelectedState(G),this.shotgunResetNodeSelectionState(),this.dispatchSelectionChanged(D);else this.deselectAllRowNodes({source:D})}setNodesSelected(G){if(!a0(this.gos)&&G.newValue)return ED(132),0;let{nodes:D,...z}=G;if(D.length>1&&this.selectionMode!=="multiRow")return ED(130),0;let B={nodes:D.filter((J)=>J.selectable),...z};if(!B.nodes.length)return 0;let Q=this.selectionStrategy.setNodesSelected(B);return this.shotgunResetNodeSelectionState(B.source),this.dispatchSelectionChanged(B.source),Q}deleteSelectionStateFromParent(G,D){if(!this.selectionStrategy.deleteSelectionStateFromParent(G,D))return;this.shotgunResetNodeSelectionState(),this.dispatchSelectionChanged("api")}shotgunResetNodeSelectionState(G){this.beans.rowModel.forEachNode((D)=>{if(D.stub)return;let z=this.selectionStrategy.isNodeSelected(D);if(z!==D.isSelected())this.selectRowNode(D,z,void 0,G)})}getSelectedNodes(){return this.selectionStrategy.getSelectedNodes()??[]}getSelectedRows(){return this.selectionStrategy.getSelectedRows()}getSelectionCount(){return this.selectionStrategy.getSelectionCount()}syncInRowNode(G){this.selectionStrategy.processNewRow(G);let D=this.selectionStrategy.isNodeSelected(G);if(D!=!1&&!G.selectable){this.selectionStrategy.setNodesSelected({nodes:[G],newValue:!1,source:"api"}),this.shotgunResetNodeSelectionState(),this.dispatchSelectionChanged("api");return}G.__selected=D}reset(){this.selectionStrategy.deselectAllRowNodes({source:"api"}),this.selectionCtx.reset()}isEmpty(){return this.selectionStrategy.isEmpty()}hasNodesToSelect(){return!0}selectAllRowNodes(G){if(!a0(this.gos)){ED(132);return}if(B5(G),QO(this.gos)&&!BO(this.gos))return ED(130);this.selectionStrategy.selectAllRowNodes(G),this.selectionCtx.selectAll=!0,this.beans.rowModel.forEachNode((D)=>{if(D.stub)return;this.selectRowNode(D,!0,void 0,G.source)}),this.dispatchSelectionChanged(G.source)}deselectAllRowNodes(G){B5(G),this.selectionStrategy.deselectAllRowNodes(G),this.selectionCtx.selectAll=!1,this.beans.rowModel.forEachNode((D)=>{if(D.stub)return;this.selectRowNode(D,!1,void 0,G.source)}),this.dispatchSelectionChanged(G.source)}getSelectAllState(G){return this.selectionStrategy.getSelectAllState(G)}getBestCostNodeSelection(){return ED(194,{method:"getBestCostNodeSelection"})}updateSelectable(){if(!a0(this.gos))return;let G=[];if(this.beans.rowModel.forEachNode((D)=>{if(!this.updateRowSelectable(D,!0)&&D.isSelected())G.push(D)}),G.length)this.setNodesSelected({nodes:G,newValue:!1,source:"selectableChanged"})}dispatchSelectionChanged(G){this.eventSvc.dispatchEvent({type:"selectionChanged",source:G,selectedNodes:this.selectionStrategy instanceof DB?null:this.selectionStrategy.getSelectedNodes(!0,!1),serverSideState:this.getSelectionState()})}updateSelectableAfterGrouping(){return zO(194,{method:"updateSelectableAfterGrouping"})}refreshMasterNodeState(){}setDetailSelectionState(){return}};function B5({selectAll:G}){if(G==="filtered"||G==="currentPage")ED(195,{justCurrentPage:G==="currentPage"})}var YO=class extends XO{constructor(){super(...arguments);this.beanName="rowChildrenSvc"}getHasChildrenValue(G){let D=this.gos.get("treeData"),z=this.gos.get("isServerSideGroup");return!G.stub&&!G.footer&&(D?!!z&&z(G.data):!!G.group)}},_O=class extends WO{constructor(){super(...arguments);this.beanName="lazyBlockLoadingSvc",this.outboundRequests=0,this.cacheLoadingNodesMap=new Map,this.isCheckQueued=!1,this.nextBlockToLoad=void 0}wireBeans(G){this.rowRenderer=G.rowRenderer,this.rowModel=G.rowModel}postConstruct(){this.maxOutboundRequests=HO(this.gos)}subscribe(G){this.cacheLoadingNodesMap.set(G,new Set)}unsubscribe(G){this.cacheLoadingNodesMap.delete(G)}queueLoadCheck(){if(this.isCheckQueued)return;this.isCheckQueued=!0,setTimeout(()=>{this.queueLoadAction(),this.isCheckQueued=!1})}onLoadComplete(){this.outboundRequests-=1,this.queueLoadCheck()}hasAvailableLoadBandwidth(){if(this.maxOutboundRequests===void 0)return!0;return this.outboundRequests{if(!B.isAlive())return;this.loaderTimeout=void 0,this.attemptLoad(B,z,Q),this.nextBlockToLoad=void 0},this.gos.get("blockLoadDebounceMillis"))}}attemptLoad(G,D,z){if(!this.hasAvailableLoadBandwidth())return;this.executeLoad(G,D,z),this.queueLoadCheck()}executeLoad(G,D,z){let B=G.getSsrmParams(),Q={startRow:D,endRow:z,rowGroupCols:B.rowGroupCols,valueCols:B.valueCols,pivotCols:B.pivotCols,pivotMode:B.pivotMode,groupKeys:G.store.getParentNode().getRoute()??[],filterModel:B.filterModel,sortModel:B.sortModel},J=this.cacheLoadingNodesMap.get(G),U=()=>{for(let W=0;W{for(let W=0;W{this.onLoadComplete(),G.onLoadSuccess(D,z-D,W),U()},X=()=>{this.onLoadComplete(),G.onLoadFailed(D,z-D),U()},Y=qO(this.gos,{request:Q,success:S,fail:X,parentNode:G.store.getParentNode()});Z(),this.outboundRequests+=1,G.getSsrmParams().datasource?.getRows(Y)}getBlockToLoad(){let G=this.rowRenderer.firstRenderedRow,D=this.rowRenderer.lastRenderedRow;for(let Z=G;Z<=D;Z++){let S=this.rowModel.getRow(Z);if(!S)continue;let X=S.parent?.childStore;if(!X)continue;let Y=X.getCache(),W=Y.getNodes().getBy("node",S);if(!W)continue;if(this.cacheLoadingNodesMap.get(Y)?.has(W.index))continue;if(S.__needsRefreshWhenVisible||S.stub&&!S.failedLoad)return{cache:Y,index:Y.getBlockStartIndex(W.index)}}let z=null,B=null,Q=Number.MAX_SAFE_INTEGER;for(let Z of this.cacheLoadingNodesMap.keys())Z.getNodesToRefresh().forEach((X)=>{if(X.rowIndex==null){B=X,z=Z;return}let Y=Z.getNodes().getBy("node",X);if(!Y)return;if(this.cacheLoadingNodesMap.get(Z)?.has(Y.index))return;let q=Math.abs(G-X.rowIndex),H=Math.abs(X.rowIndex-D);if(q[D,new Map]))}getSize(){return this.maps.get(this.indexes[0]).size}getBy(G,D){return this.maps.get(G).get(D)}set(G){for(let D of this.indexes)this.maps.get(D).set(G[D],G)}delete(G){for(let D of this.indexes)this.maps.get(D).delete(G[D])}clear(){this.maps.forEach((G)=>G.clear())}getIterator(G){return this.maps.get(G).values()}forEach(G){let D=this.getIterator(this.indexes[0]),z;while(z=D.next()){if(z.done)break;G(z.value)}}find(G){let D=this.getIterator(this.indexes[0]),z;while(z=D.next()){if(z.done)break;if(G(z.value))return z.value}}filter(G){let D=this.getIterator(this.indexes[0]),z,B=[];while(z=D.next()){if(z.done)break;if(G(z.value))B.push(z.value)}return B}},AO=100,w1=class extends NO{constructor(G,D,z,B){super();this.live=!0,this.removedNodeCache=new Map,this.store=G,this.numberOfRows=D,this.isLastRowKnown=z,this.storeParams=B}wireBeans(G){this.rowRenderer=G.rowRenderer,this.blockUtils=G.ssrmBlockUtils,this.focusSvc=G.focusSvc,this.nodeManager=G.ssrmNodeManager,this.serverSideRowModel=G.rowModel,this.rowNodeSorter=G.rowNodeSorter,this.sortSvc=G.sortSvc,this.lazyBlockLoadingSvc=G.lazyBlockLoadingSvc,this.colModel=G.colModel}postConstruct(){this.lazyBlockLoadingSvc.subscribe(this),this.nodeMap=new MO("index","id","node"),this.nodeDisplayIndexMap=new Map,this.nodesToRefresh=new Set;let{blockUtils:G,gos:D,store:z}=this;this.defaultNodeIdPrefix=G.createNodeIdPrefix(z.getParentNode()),this.getRowIdFunc=EO(D),this.isMasterDetail=D.get("masterDetail")}destroy(){this.lazyBlockLoadingSvc.unsubscribe(this),this.numberOfRows=0,this.nodeMap.forEach((G)=>this.blockUtils.destroyRowNode(G.node)),this.nodeMap.clear(),this.nodeDisplayIndexMap.clear(),this.nodesToRefresh.clear(),this.live=!1,super.destroy()}getRowByDisplayIndex(G){if(!this.store.isDisplayIndexInStore(G))return;let D=this.nodeDisplayIndexMap.get(G);if(D){if(D.stub||D.__needsRefreshWhenVisible)this.lazyBlockLoadingSvc.queueLoadCheck();return D}if(this.gos.get("groupHideOpenParents")||this.gos.get("groupAllowUnbalanced")){let S=this.nodeMap.find((X)=>!!X.node.childStore?.isDisplayIndexInStore(G));if(S)return S.node.childStore?.getRowUsingDisplayIndex(G)}if(G===this.store.getDisplayIndexStart())return this.createStubNode(0,G);let B=this.nodeDisplayIndexMap.get(G-1);if(B){if(this.isMasterDetail&&B.master&&B.expanded)return B.detailNode;if(B.expanded&&B.childStore?.isDisplayIndexInStore(G))return B.childStore?.getRowUsingDisplayIndex(G);let S=this.nodeMap.getBy("node",B);return this.createStubNode(S.index+1,G)}let Q=this.getSurroundingNodesByDisplayIndex(G);if(Q==null){let S=this.store.getRowCount()-(this.store.getDisplayIndexEnd()-G);return this.createStubNode(S,G)}let{previousNode:J,nextNode:U}=Q;if(J?.node.expanded&&J.node.childStore?.isDisplayIndexInStore(G))return J.node.childStore?.getRowUsingDisplayIndex(G);if(U){let S=U.node.rowIndex-G,X=U.index-S;return this.createStubNode(X,G)}let Z=this.store.getRowCount()-(this.store.getDisplayIndexEnd()-G);return this.createStubNode(Z,G)}createStubNode(G,D){let z=this.store.getRowBounds(D),B=this.createRowAtIndex(G,null,(Q)=>{Q.setRowIndex(D),Q.setRowTop(z.rowTop),this.nodeDisplayIndexMap.set(D,Q)});if(G===0&&this.gos.get("groupHideOpenParents")){let Q=this.store.getParentNode().groupData;if(Q)for(let J of Object.keys(Q))UZ(B,this.colModel,J,Q[J])}return this.lazyBlockLoadingSvc.queueLoadCheck(),B}getRowByStoreIndex(G){return this.nodeMap.getBy("index",G)?.node}skipDisplayIndexes(G,D,z){if(G===0)return;let B=FO(this.beans);D.value+=G,z.value+=G*B}setDisplayIndexes(G,D,z){this.nodeDisplayIndexMap.clear();let B={};this.nodeMap.forEach((U)=>{B[U.index]=U.node});let Q=-1;for(let U of Object.keys(B)){let Z=B[U],S=Number(U),X=S-1-Q;this.skipDisplayIndexes(X,G,D);let Y=S===0;if(Z.firstChild!==Y)Z.firstChild=Y,Z.dispatchRowEvent("firstChildChanged");if(Y&&this.gos.get("groupHideOpenParents")){let W=this.store.getParentNode().groupData;if(W)for(let q of Object.keys(W))UZ(Z,this.colModel,q,Y?W[q]:void 0)}if(this.blockUtils.setDisplayIndex(Z,G,D,z),Z.rowIndex!=null)this.nodeDisplayIndexMap.set(Z.rowIndex,Z);Q=S}let J=this.numberOfRows-1-Q;this.skipDisplayIndexes(J,G,D),this.purgeExcessRows()}getRowCount(){return this.numberOfRows}setRowCount(G,D){if(this.numberOfRows=G,D!=null){if(this.isLastRowKnown=D,D===!1)this.numberOfRows+=1}this.fireStoreUpdatedEvent()}getNodes(){return this.nodeMap}getNodeCachedByDisplayIndex(G){return this.nodeDisplayIndexMap.get(G)??null}getNodesToRefresh(){return this.nodesToRefresh}getSurroundingNodesByDisplayIndex(G){let D,z;if(this.nodeMap.forEach((B)=>{if(G>B.node.rowIndex){if(z==null||z.node.rowIndexB.node.rowIndex)D=B}),!z&&!D)return null;return{previousNode:z,nextNode:D}}getDisplayIndexFromStoreIndex(G){let D=this.nodeMap.getBy("index",G);if(D)return D.node.rowIndex;let z,B;if(this.nodeMap.forEach((U)=>{if(G>U.index){if(B==null||B.indexU.index)z=U}),!z)return this.store.getDisplayIndexEnd()-(this.numberOfRows-G);if(!B)return this.store.getDisplayIndexStart()+G;let Q=G-B.index;return(B.node.childStore?.getDisplayIndexEnd()??B.node.rowIndex)+Q}createRowAtIndex(G,D,z){let B=this.nodeMap.getBy("index",G);if(B){let{node:J}=B;if(J.__needsRefreshWhenVisible=!1,this.doesNodeMatch(D,J))return this.blockUtils.updateDataIntoRowNode(J,D),this.nodesToRefresh.delete(J),J;if(this.getRowIdFunc==null&&J.hasChildren()&&J.expanded)return this.nodesToRefresh.delete(J),J;this.destroyRowAtIndex(G)}if(D&&this.getRowIdFunc!=null){let J=this.getRowId(D),U=J&&this.removedNodeCache?.get(J);if(U)return this.removedNodeCache?.delete(J),this.blockUtils.updateDataIntoRowNode(U,D),this.nodeMap.set({id:U.id,node:U,index:G}),this.nodesToRefresh.delete(U),U.__needsRefreshWhenVisible=!1,U;let Z=this.nodeMap.getBy("id",J);if(Z){this.nodeMap.delete(Z);let{node:S,index:X}=Z;if(this.blockUtils.updateDataIntoRowNode(S,D),this.nodeMap.set({id:S.id,node:S,index:G}),this.nodesToRefresh.delete(S),S.__needsRefreshWhenVisible=!1,this.getBlockStartIndex(X)===this.getBlockStartIndex(G))return S;return this.markBlockForVerify(X),S}}let Q=this.blockUtils.createRowNode(this.store.getRowDetails());if(D!=null){let J=this.getPrefixedId(this.store.getIdSequence().value++);this.blockUtils.setDataIntoRowNode(Q,D,J,void 0),this.blockUtils.checkOpenByDefault(Q),this.nodeManager.addRowNode(Q)}if(this.nodeMap.set({id:Q.id,node:Q,index:G}),z)z(Q);return Q}getBlockStates(){let G={},D={};this.nodeMap.forEach(({node:J,index:U})=>{let Z=this.getBlockStartIndex(U);if(!J.stub&&!J.failedLoad)G[Z]=(G[Z]??0)+1;let S="loaded";if(J.failedLoad)S="failed";else if(this.lazyBlockLoadingSvc.isRowLoading(this,Z))S="loading";else if(this.nodesToRefresh.has(J)||J.stub)S="needsLoading";if(!D[Z])D[Z]=new Set;D[Z].add(S)});let z={loading:4,failed:3,needsLoading:2,loaded:1},B=this.blockUtils.createNodeIdPrefix(this.store.getParentNode()),Q={};for(let J of Object.keys(D)){let Z=[...D[J]].sort((Y,W)=>(z[Y]??0)-(z[W]??0))[0],S=Number(J)/this.getBlockSize(),X=B?`${B}-${S}`:String(S);Q[X]={blockNumber:S,startRow:Number(J),endRow:Number(J)+this.getBlockSize(),pageStatus:Z,loadedRowCount:G[J]??0}}return Q}destroyRowAtIndex(G){let D=this.nodeMap.getBy("index",G);if(!D)return;if(this.nodeMap.delete(D),this.nodeDisplayIndexMap.delete(D.node.rowIndex),this.nodesToRefresh.size>0)this.removedNodeCache.set(D.node.id,D.node);else this.blockUtils.destroyRowNode(D.node);this.nodesToRefresh.delete(D.node)}getSsrmParams(){return this.store.getSsrmParams()}getPrefixedId(G){if(this.defaultNodeIdPrefix)return this.defaultNodeIdPrefix+"-"+G;else return G.toString()}markBlockForVerify(G){let[D,z]=this.getBlockBounds(G);this.nodeMap.filter((Q)=>Q.index>=D&&Q.index{Q.__needsRefreshWhenVisible=!0})}doesNodeMatch(G,D){if(D.stub)return!1;let z=this.getRowId(G);return z===null?D.data===G:D.id===z}purgeStubsOutsideOfViewport(){let{firstRenderedRow:G,lastRenderedRow:D}=this.rowRenderer,z=this.getBlockStartIndex(G),[,B]=this.getBlockBounds(D);this.nodeMap.forEach((Q)=>{if(this.lazyBlockLoadingSvc.isRowLoading(this,Q.index)||Q.node.failedLoad)return;if(Q.node.stub&&(Q.indexB))this.destroyRowAtIndex(Q.index)})}getBlocksDistanceFromRow(G,D){let z={};return G.forEach(({node:B,index:Q})=>{let[J,U]=this.getBlockBounds(Q);if(J in z)return;let Z=Math.abs(B.rowIndex-D),S,X=this.nodeMap.getBy("index",[U-1]);if(X)S=Math.abs(X.node.rowIndex-D);let Y=S==null||Z{let k=this.getBlockStartIndex(H);if(z.add(k),_.rowIndex>=G&&_.rowIndex<=D)B.add(k)});let Q=Math.max(B.size,this.storeParams.maxBlocksInCache??0),U=z.size-Q;if(U<=0)return;let{MAX_SAFE_INTEGER:Z,MIN_SAFE_INTEGER:S}=Number;B.forEach((H)=>{if(Z>H)Z=H;if(S{let k=this.getBlockStartIndex(_);return!(k>=Z&&k<=S)&&!this.isNodeCached(H)});if(X.length===0)return;let Y=G+(D-G)/2,W=this.getBlocksDistanceFromRow(X,Y),q=this.getBlockSize();W.sort((H,_)=>Math.sign(_[1]-H[1]));for(let H=0;H{let Q=this.getRowId(B);if(D.has(Q)){z.add(Q);return}D.add(Q)}),[...z]}onLoadSuccess(G,D,z){if(!this.live)return;let B=z.groupLevelInfo;if(this.store.setStoreInfo(B),this.getRowIdFunc!=null){let U=this.extractDuplicateIds(z.rowData);if(U.length>0){let Z=U.join(", ");IO(205,{duplicateIdText:Z}),this.onLoadFailed(G,D);return}}if(z.pivotResultFields)this.serverSideRowModel.generateSecondaryColumns(z.pivotResultFields);let Q=this.nodesToRefresh.size>0;if(z.rowData.forEach((U,Z)=>{let S=G+Z,X=this.nodeMap.getBy("index",S);if(X?.node?.stub){this.createRowAtIndex(S,U);return}if(X&&this.doesNodeMatch(U,X.node)){this.blockUtils.updateDataIntoRowNode(X.node,U),this.nodesToRefresh.delete(X.node),X.node.__needsRefreshWhenVisible=!1;return}this.createRowAtIndex(S,U)}),z.rowCount!=null&&z.rowCount!==-1)this.numberOfRows=z.rowCount,this.isLastRowKnown=!0;else if(D>z.rowData.length)this.numberOfRows=G+z.rowData.length,this.isLastRowKnown=!0;else if(!this.isLastRowKnown){let U=G+z.rowData.length+1;if(U>this.numberOfRows)this.numberOfRows=U}if(this.isLastRowKnown)this.nodeMap.filter((Z)=>Z.index>=this.numberOfRows).forEach((Z)=>this.destroyRowAtIndex(Z.index));this.fireStoreUpdatedEvent();let J=this.nodesToRefresh.size===0;if(Q&&J)this.fireRefreshFinishedEvent()}fireRefreshFinishedEvent(){if(this.nodesToRefresh.size!==0)return;this.removedNodeCache.forEach((D)=>{this.blockUtils.destroyRowNode(D)}),this.removedNodeCache=new Map,this.store.fireRefreshFinishedEvent()}isStoreFullyLoaded(){let G=this.isLastRowKnown,D=this.nodeMap.getSize()===this.numberOfRows;if(!G||!D)return;if(this.nodesToRefresh.size>0)return;let z=-1;return this.nodeMap.find((Q)=>{if(z+=1,Q.index!==z)return!0;if(Q.node.__needsRefreshWhenVisible)return!0;if(Q.node.stub)return!0;return!1})==null}isLastRowIndexKnown(){return this.isLastRowKnown}onLoadFailed(G,D){if(!this.live)return;let z=this.nodesToRefresh.size>0;for(let Q=G;Q{if(G.node.stub&&!G.node.failedLoad)return;this.nodesToRefresh.add(G.node)}),this.lazyBlockLoadingSvc.queueLoadCheck(),this.isLastRowKnown&&this.numberOfRows===0)this.numberOfRows=1,this.isLastRowKnown=!1,this.fireStoreUpdatedEvent()}isNodeInCache(G){return!!this.nodeMap.getBy("id",G)}fireStoreUpdatedEvent(){if(!this.live)return;this.store.fireStoreUpdatedEvent()}getRowId(G){if(this.getRowIdFunc==null)return null;let{level:D}=this.store.getRowDetails(),z=this.store.getParentNode().getRoute()??[];return this.getRowIdFunc({data:G,parentKeys:z.length>0?z:void 0,level:D})}getOrderedNodeMap(){let G={};return this.nodeMap.forEach((D)=>G[D.index]=D),G}clearDisplayIndexes(){this.nodeDisplayIndexMap.clear()}clientSideSortRows(){let G=this.sortSvc?.getSortOptions()??[],D=G.some((U)=>U.sort!=null),z=this.rowNodeSorter;if(!D||!z)return;let B=Array(this.nodeMap.getSize()),Q=this.nodeMap;Q.forEach((U)=>B[U.index]=U.node),Q.clear();let J=z.doFullSortInPlace(B,G);for(let U=0,Z=J.length;U{let B=this.getRowId(z),Q=this.nodeMap.getBy("id",B);if(Q)this.blockUtils.updateDataIntoRowNode(Q.node,z),D.push(Q.node)}),D}insertRowNodes(G,D){let z=this.store.getRowCount()-(this.store.getParentNode().sibling?1:0),B=D==null&&this.isLastRowKnown?z:D;if(B==null||z{let X=this.getRowId(S);if(X&&this.isNodeInCache(X))return;Q[X]=S});let J=Object.values(Q),U=J.length;if(U===0)return[];let Z=this.nodeMap.filter((S)=>S.index>=B);return Z.forEach((S)=>this.nodeMap.delete(S)),Z.forEach((S)=>{this.nodeMap.set({node:S.node,index:S.index+U,id:S.id})}),this.numberOfRows+=U,J.map((S,X)=>this.createRowAtIndex(B+X,S))}removeRowNodes(G,D){let z=[],B=[],Q=0,J=[...G],U=this.getOrderedNodeMap(),Z=-1;for(let X of Object.keys(U)){Z+=1;let Y=U[X],W=J.findIndex((H)=>H===Y.id);if(W!==-1){J.splice(W,1),this.destroyRowAtIndex(Number(X)),z.push(Y.node),Q+=1;continue}if(Q===0)continue;let q=Number(X);if(Z!==q)B.push(Y.node);this.nodeMap.delete(Y),this.nodeMap.set({id:Y.id,node:Y.node,index:q-Q})}if(D!=null&&D>=0)this.numberOfRows=D,this.isLastRowKnown=!0;else this.numberOfRows-=Q;if(J.length>0&&B.length>0)B.forEach((X)=>X.__needsRefreshWhenVisible=!0),this.lazyBlockLoadingSvc.queueLoadCheck();return z}getBlockSize(){return this.storeParams.cacheBlockSize||AO}getBlockStartIndex(G){let D=this.getBlockSize();return G-G%D}getBlockBounds(G){let D=this.getBlockStartIndex(G),z=this.getBlockSize();return[D,D+z]}},RO=class extends wO{constructor(G,D,z){super();this.idSequence={value:0},this.ssrmParams=G,this.parentRowNode=z,this.storeParams=D,this.level=z.level+1,this.group=G.rowGroupCols?this.levelD({level:this.level,parentKeys:this.parentRowNode.getRoute()??[],data:q})),W=[...new Set(Y)];U=this.cache.removeRowNodes(W,G.rowCount)}let Z=this.gos.get("serverSideEnableClientSideSort"),S=Q?.length||J?.length;if(B&&Z&&S)this.cache.clientSideSortRows();return this.updateSelectionAfterTransaction(Q,U),{status:k1.Applied,update:Q,add:J,remove:U}}updateSelectionAfterTransaction(G,D){if(!this.selectionSvc)return;let z=[];for(let B of G??[])if(B.isSelected()&&!B.selectable)z.push(B);for(let B of D??[])if(B.isSelected())z.push(B);if(z.length)this.selectionSvc.setNodesSelected({newValue:!1,clearSelection:!1,nodes:z,source:"rowDataChanged"})}clearDisplayIndexes(){if(this.displayIndexStart=void 0,this.displayIndexEnd=void 0,this.cache.getNodes().forEach((G)=>this.blockUtils.clearDisplayIndex(G.node)),this.parentRowNode.sibling)this.blockUtils.clearDisplayIndex(this.parentRowNode.sibling);this.cache.clearDisplayIndexes()}getDisplayIndexStart(){return this.displayIndexStart}getDisplayIndexEnd(){return this.displayIndexEnd}getRowCount(){if(this.parentRowNode.sibling)return this.cache.getRowCount()+1;return this.cache.getRowCount()}setRowCount(G,D){this.cache.setRowCount(G,D)}isDisplayIndexInStore(G){if(this.cache.getRowCount()===0)return!1;return this.displayIndexStart<=G&&G-1&&J5(this.gos)({node:this.parentRowNode});if(!B)EJ(this.parentRowNode);if(B==="top")pG(this.parentRowNode,this.beans),this.blockUtils.setDisplayIndex(this.parentRowNode.sibling,G,D,z);if(this.cache.setDisplayIndexes(G,D,z),B==="bottom")pG(this.parentRowNode,this.beans),this.blockUtils.setDisplayIndex(this.parentRowNode.sibling,G,D,z);this.displayIndexEnd=G.value,this.heightPx=D.value-this.topPx}forEachStoreDeep(G,D={value:0}){G(this,D.value++),this.cache.getNodes().forEach((z)=>{let B=z.node.childStore;if(B)B.forEachStoreDeep(G,D)})}forEachNodeDeep(G,D={value:0}){this.cache.getNodes().forEach((z)=>{G(z.node,D.value++);let B=z.node.childStore;if(B)B.forEachNodeDeep(G,D)})}forEachNodeDeepAfterFilterAndSort(G,D={value:0},z=!1){let B=this.parentRowNode.level>-1&&J5(this.gos)({node:this.parentRowNode});if(B==="top")G(this.parentRowNode.sibling,D.value++);let Q=this.cache.getOrderedNodeMap();for(let J of Object.values(Q)){G(J.node,D.value++);let U=J.node.childStore;if(U)U.forEachNodeDeepAfterFilterAndSort(G,D,z)}if(B==="bottom")G(this.parentRowNode.sibling,D.value++)}retryLoads(){this.cache.getNodes().forEach(({node:G})=>{if(G.failedLoad)G.failedLoad=!1,G.__needsRefreshWhenVisible=!0,G.stub=!0}),this.forEachChildStoreShallow((G)=>G.retryLoads()),this.fireStoreUpdatedEvent()}getRowUsingDisplayIndex(G){if(this.parentRowNode.sibling&&G===this.parentRowNode.sibling.rowIndex)return this.parentRowNode.sibling;return this.cache.getRowByDisplayIndex(G)}getRowBounds(G){if(!this.isDisplayIndexInStore(G))return null;let D=this.cache.getNodeCachedByDisplayIndex(G);if(D){let Z=this.blockUtils.extractRowBounds(D,G);if(Z)return Z}let{previousNode:z,nextNode:B}=this.cache.getSurroundingNodesByDisplayIndex(G)??{};if(z){let Z=this.blockUtils.extractRowBounds(z.node,G);if(Z!=null)return Z}let Q=U5(this.beans);if(B){let Z=(B.node.rowIndex-G)*Q;return{rowTop:B.node.rowTop-Z,rowHeight:Q}}let J=this.topPx+this.heightPx,U=(this.getDisplayIndexEnd()-G)*Q;return{rowTop:J-U,rowHeight:Q}}isPixelInRange(G){return G>=this.topPx&&G=this.topPx+this.heightPx)return this.getDisplayIndexEnd()-1;if(this.parentRowNode.sibling&&G>this.parentRowNode.sibling.rowTop&&G{let X=Math.abs(G-S.rowTop);if(S.rowTop{let z=this.cache.getNodes().find((B)=>B.node.key==D);if(!z)return null;return z.node})}forEachChildStoreShallow(G){this.cache.getNodes().forEach(({node:D})=>{if(D.childStore)G(D.childStore)})}refreshAfterSort(G){if(this.storeUtils.isServerSideSortAllLevels()||this.storeUtils.isServerRefreshNeeded(this.parentRowNode,this.ssrmParams.rowGroupCols,G)){let z=this.cache.isStoreFullyLoaded(),B=this.gos.get("serverSideEnableClientSideSort");if(!(z&&B)){let J=this.cache.getRowCount(),U=this.cache.isLastRowIndexKnown();this.destroyBean(this.cache),this.cache=this.createManagedBean(new w1(this,J,U,this.storeParams));return}this.cache.clientSideSortRows()}this.forEachChildStoreShallow((z)=>z.refreshAfterSort(G))}refreshAfterFilter(G){if(!this.storeUtils.isServerSideOnlyRefreshFilteredGroups()||this.storeUtils.isServerRefreshNeeded(this.parentRowNode,this.ssrmParams.rowGroupCols,G)){this.refreshStore(!0);return}this.forEachChildStoreShallow((z)=>z.refreshAfterFilter(G))}refreshStore(G){if(G){this.destroyBean(this.cache),this.cache=this.createManagedBean(new w1(this,1,!1,this.storeParams)),this.fireStoreUpdatedEvent();return}this.cache.markNodesForRefresh()}getTopLevelRowDisplayedIndex(G){return this.cache.getDisplayIndexFromStoreIndex(G)??G}isLastRowIndexKnown(){return this.cache.isLastRowIndexKnown()}getRowNodesInRange(G,D){return this.cache.getNodes().filter(({node:z})=>{return z.rowIndex>=G.rowIndex&&z.rowIndex<=D.rowIndex}).map(({node:z})=>z)}addStoreStates(G){G.push({route:this.parentRowNode.getRoute()??[],rowCount:this.getRowCount(),lastRowIndexKnown:this.isLastRowIndexKnown(),info:this.info,maxBlocksInCache:this.storeParams.maxBlocksInCache,cacheBlockSize:this.storeParams.cacheBlockSize}),this.forEachChildStoreShallow((D)=>D.addStoreStates(G))}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(G){if(G)Object.assign(this.info,G)}fireStoreUpdatedEvent(){this.eventSvc.dispatchEvent({type:"storeUpdated"})}fireRefreshFinishedEvent(){this.eventSvc.dispatchEvent({type:"storeRefreshed",route:this.parentRowNode.getRoute()})}getBlockStates(){return this.cache.getBlockStates()}getStoreBounds(){return{topPx:this.topPx,heightPx:this.heightPx}}getCache(){return this.cache}getFirstNode(){return this.cache.getNodes().getBy("index",0)?.node??null}},CO=class extends kO{constructor(){super(...arguments);this.beanName="ssrmStoreFactory"}wireBeans(G){this.colModel=G.colModel,this.rowGroupColsSvc=G.rowGroupColsSvc,this.pivotColsSvc=G.pivotColsSvc,this.rowAutoHeight=G.rowAutoHeight}createStore(G,D){let z=this.getStoreParams(G,D);return new RO(G,z,D)}getStoreParams(G,D){let z=this.getLevelSpecificParams(D),B=this.getBlockSize(z),Q=this.getMaxBlocksInCache(G,z);return{cacheBlockSize:B,maxBlocksInCache:Q}}getMaxBlocksInCache(G,D){let z=D?.maxBlocksInCache!=null?D.maxBlocksInCache:this.gos.get("maxBlocksInCache");if(!(z!=null&&z>=0))return;if(G.dynamicRowHeight){Q5(203);return}if(this.rowAutoHeight?.active){Q5(204);return}return z}getBlockSize(G){let D=G?.cacheBlockSize!=null?G.cacheBlockSize:this.gos.get("cacheBlockSize");if(D!=null&&D>0)return D;else return 100}getLevelSpecificParams(G){let D=this.gos.getCallback("getServerSideGroupLevelParams");if(!D)return;let z={level:G.level+1,parentRowNode:G.level>=0?G:void 0,rowGroupColumns:this.rowGroupColsSvc?.columns??[],pivotColumns:this.pivotColsSvc?.columns??[],pivotMode:this.colModel.isPivotMode()};return D(z)}},bO=class extends VO{constructor(){super(...arguments);this.beanName="ssrmStoreUtils"}wireBeans(G){this.colModel=G.colModel,this.serverSideRowModel=G.rowModel,this.storeFactory=G.ssrmStoreFactory}getChildStore(G,D,z){if(!G?.length)return D;let B=G[0],Q=z(B);if(Q){if(G.length===1&&!Q.childStore){let Z=this.serverSideRowModel.getParams();Q.childStore=this.createBean(this.storeFactory.createStore(Z,Q))}let J=G.slice(1,G.length),U=Q.childStore;return U?U.getChildStore(J):null}return null}isServerRefreshNeeded(G,D,z){if(z.valueColChanged||z.secondaryColChanged)return!0;let B=G.level+1;if(!(B-1)return!0;return this.colModel.getCols().filter((Y)=>Y.getColDef().showRowGroup&&z.changedColumns.includes(Y.getId())).map((Y)=>Y.getColDef().showRowGroup).some((Y)=>Y===!0||Y===U)}getServerSideInitialRowCount(){return this.gos.get("serverSideInitialRowCount")}isServerSideSortAllLevels(){return this.gos.get("serverSideSortAllLevels")&&Z5(this.gos)}isServerSideOnlyRefreshFilteredGroups(){return this.gos.get("serverSideOnlyRefreshFilteredGroups")&&Z5(this.gos)}},OO=class extends vO{constructor(){super(...arguments);this.beanName="ssrmTxnManager",this.asyncTransactions=[]}wireBeans(G){this.valueCache=G.valueCache,this.serverSideRowModel=G.rowModel,this.selectionSvc=G.selectionSvc}applyTransactionAsync(G,D){if(this.asyncTransactionsTimeout==null)this.scheduleExecuteAsync();this.asyncTransactions.push({transaction:G,callback:D})}scheduleExecuteAsync(){let G=this.gos.get("asyncTransactionWaitMillis");this.asyncTransactionsTimeout=window.setTimeout(()=>{this.executeAsyncTransactions()},G)}executeAsyncTransactions(){if(!this.asyncTransactions)return;let G=[],D=[],z=[],B=!1;for(let Q of this.asyncTransactions){let J;if(!this.serverSideRowModel.executeOnStore(Q.transaction.route,(S)=>{J=S.applyTransaction(Q.transaction)}))J={status:fD.StoreNotStarted};else if(J==null)J={status:fD.StoreNotFound};if(D.push(J),J.status==fD.StoreLoading){z.push(Q);continue}if(Q.callback)G.push(()=>Q.callback(J));if(J.status===fD.Applied)B=!0}if(G.length>0)window.setTimeout(()=>{for(let Q of G)Q()},0);if(this.asyncTransactionsTimeout=void 0,this.asyncTransactions=z,B)this.valueCache?.onDataChanged(),this.eventSvc.dispatchEvent({type:"storeUpdated"});if(D.length>0)this.eventSvc.dispatchEvent({type:"asyncTransactionsFlushed",results:D})}flushAsyncTransactions(){if(this.asyncTransactionsTimeout!=null)clearTimeout(this.asyncTransactionsTimeout);this.executeAsyncTransactions()}applyTransaction(G){let D;if(!this.serverSideRowModel.executeOnStore(G.route,(B)=>{D=B.applyTransaction(G)}))return{status:fD.StoreNotStarted};else if(D){if(this.valueCache?.onDataChanged(),D.remove&&this.selectionSvc){let B=D.remove.map((Q)=>Q.id);this.selectionSvc.deleteSelectionStateFromParent(G.route||[],B)}return this.eventSvc.dispatchEvent({type:"storeUpdated"}),D}else return{status:fD.StoreNotFound}}},L8={moduleName:"ServerSideRowModel",version:j,rowModels:["serverSide"],beans:[yv,kv,bO,qv,Vv,OO,Nv,CO,Ev,SO,_O,YO,GO,Av],dependsOn:[i,wb,kb,U8,Z8,Ab]},S8={moduleName:"ServerSideRowModelApi",version:j,apiFunctions:{getServerSideSelectionState:cv,setServerSideSelectionState:hv,applyServerSideTransaction:iv,applyServerSideTransactionAsync:dv,applyServerSideRowData:nv,retryServerSideLoads:lv,flushServerSideAsyncTransactions:pv,refreshServerSide:mv,getServerSideGroupLevelState:tv,resetRowHeights:Nb,onRowHeightChanged:fb},dependsOn:[i,_b,Hb,Kb]},$5=/\$?[A-Za-z]+\$?[0-9]+(?::\$?[A-Za-z]+\$?[0-9]+)?/g,cO=/^(\$?)([A-Za-z]+)(\$?)([0-9]+)(?::(\$?)([A-Za-z]+)(\$?)([0-9]+))?$/,hO=/[A-Za-z0-9]/,L0=(G)=>{return!!G&&hO.test(G)},tB=(G)=>{return!!G&&/[A-Za-z]/.test(G)},L5=(G)=>{return L0(G??void 0)},Y8=(G,D,z)=>{let B=D>0?G[D-1]:null;if(L5(B))return!1;if(z.endsWith(":"))return!0;let Q=D+z.length,J=Q{let B=(D.allowTrailingColon??!1)&&G.endsWith(":")?G.slice(0,-1):G,Q=cO.exec(B);if(!Q)return null;let[,J,U,Z,S,X,Y,W,q]=Q;return{startCol:U,startRow:S,startColAbsolute:J==="$",startRowAbsolute:Z==="$",...!!(Y&&q)?{endCol:Y,endRow:q,endColAbsolute:X==="$",endRowAbsolute:W==="$"}:null}},W8=(G)=>{let D=[],z,B=0;$5.lastIndex=0;while((z=$5.exec(G))!=null){let Q=z[0],J=z.index??0,U=J+Q.length;if(U","&"]),H8=(G,D)=>{for(let z=D-1;z>=0;z--){let B=G[z];if(B!=null&&B.trim()!=="")return B}return null},pO="ag-formula-token-color",mO="ag-formula-range-color",uJ=(G,D)=>{let z=D??0;return{tokenClass:`${pO}-${z+1}`,rangeClass:`${mO}-${z+1}`,colorIndex:z}},f1=(G)=>{if(!G)return null;let D=/ag-formula-range-color-(\d+)/.exec(G);if(!D)return null;let z=parseInt(D[1],10);return Number.isFinite(z)?z-1:null},tO=(G,D,z)=>{if(!G)return;let{rangeClass:B}=uJ(D,z);G.colorClass=B},_8=(G,D)=>{let z=OJ(D,{allowTrailingColon:!0});if(!z)return null;let{formula:B}=G,{startCol:Q,startRow:J,endCol:U,endRow:Z}=z,S=Q,X=U??Q,Y=B?.getColByRef(S),W=B?.getColByRef(X);if(!Y||!W)return null;let q=parseInt(J,10)-1,H=Z?parseInt(Z,10)-1:q;if(q<0||H<0)return null;let _=G.rowModel;if(!_?.getFormulaRow(q)||!_.getFormulaRow(H))return null;return{rowStartIndex:q,rowEndIndex:H,columnStart:Y,columnEnd:W}},sO=(G)=>{let D=G.rangeSvc?.getCellRanges(),z=D?.length?D[D.length-1]:null;if(!z)return null;return QD(G,z)},QD=(G,D)=>{let{rangeSvc:z,formula:B}=G;if(!z||!B)return null;let Q=z.getRangeStartRow(D),J=z.getRangeEndRow(D);if(!Q||!J||Q.rowPinned||J.rowPinned)return null;let U=Math.min(Q.rowIndex,J.rowIndex)+1,Z=Math.max(Q.rowIndex,J.rowIndex)+1,S=D.columns?.filter((w)=>!lO(w)&&!!B.getColRef(w));if(!S?.length)return null;let X=[...S],Y=X[0],W=X[X.length-1],q=B.getColRef(Y),H=B.getColRef(W);if(!q||!H)return null;if(q===H&&U===Z)return`${q}${U}`;return`${q}${U}:${H}${Z}`},Yz=(G,D)=>{let z=W8(D),{formula:B}=G;if(!B)return z;let Q=[],J=0;for(let U of z){if(!_8(G,U.ref))continue;Q.push({...U,index:J}),J+=1}return Q},S5=(G,D)=>{return Yz(G,D).map(({ref:B,index:Q})=>({ref:B,index:Q}))},oO=class extends nO{constructor(G){super();this.field=G,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(G){if(this.functionAutocompleteList)switch(G.key){case iG.ENTER:case iG.TAB:G.preventDefault(),G.stopPropagation(),this.confirmFunctionAutocomplete();return;case iG.ESCAPE:G.preventDefault(),G.stopPropagation(),this.closeFunctionAutocomplete();return;case iG.UP:case iG.DOWN:this.functionAutocompleteList.onNavigationKeyDown(G,G.key);return}switch(G.key){case iG.LEFT:case iG.RIGHT:case iG.PAGE_HOME:case iG.PAGE_END:this.scheduleFunctionAutocompleteUpdate();break}}scheduleFunctionAutocompleteUpdate(){setTimeout(()=>{if(!this.isAlive())return;this.updateFunctionAutocomplete()})}updateFunctionAutocomplete(){if(!this.isContentFocused()){this.closeFunctionAutocomplete();return}let{field:G,beans:D}=this,z=G.getCurrentValue();if(!z.trimStart().startsWith("=")){this.closeFunctionAutocomplete();return}let Q=G.getCaretOffsetsForAutocomplete(z);if(!Q){this.closeFunctionAutocomplete();return}if(aO(D,z,Q.valueOffset)){this.closeFunctionAutocomplete();return}let J=rO(z,Q.valueOffset,D.formula??null);if(!J){this.closeFunctionAutocomplete();return}let{prefix:U}=J;if(!U.length){this.closeFunctionAutocomplete();return}let Z=this.getFunctionAutocompleteEntries();if(!Z.length){this.closeFunctionAutocomplete();return}let S=U.toLocaleLowerCase();if(!Z.some(({key:Y})=>Y.toLocaleLowerCase().startsWith(S))){this.closeFunctionAutocomplete();return}if(this.functionAutocompleteToken=J,this.openFunctionAutocomplete(Z),this.functionAutocompleteList&&this.functionAutocompleteSearch!==U)this.functionAutocompleteList.setSearch(U),this.functionAutocompleteSearch=U}getFunctionAutocompleteEntries(){let G=this.beans.formula,D=G?.active?G.getFunctionNames?.()??[]:[];if(!this.functionAutocompleteEntries||this.functionAutocompleteEntries.length!==D.length)this.functionAutocompleteEntries=D.map((z)=>({key:z}));return this.functionAutocompleteEntries}openFunctionAutocomplete(G){if(this.functionAutocompleteList||!G.length)return;let D=this.beans.popupSvc;if(!D)return;let z=null,B=()=>{if(this.functionAutocompleteList&&z)D.positionPopupByComponent(z)};this.functionAutocompleteList=this.createManagedBean(new y6({autocompleteEntries:G,onConfirmed:()=>this.confirmFunctionAutocomplete(),useStartsWithSearch:!0,autoSizeList:!0,maxVisibleItems:10,onListHeightChanged:B}));let Q=this.functionAutocompleteList.getGui();z={ePopup:Q,type:"autocomplete",eventSource:this.field.getGui(),position:"under",alignSide:this.gos.get("enableRtl")?"right":"left",keepWithinBounds:!0};let J=D.addPopup({eChild:Q,anchorToElement:this.field.getGui(),positionCallback:B,ariaLabel:"Formula functions"});this.functionAutocompleteHidePopup=J.hideFunc,this.functionAutocompleteList.afterGuiAttached()}closeFunctionAutocomplete(){if(this.functionAutocompleteToken=null,this.functionAutocompleteSearch=null,!this.functionAutocompleteList)return;this.functionAutocompleteHidePopup?.(),this.functionAutocompleteHidePopup=void 0,this.destroyBean(this.functionAutocompleteList),this.functionAutocompleteList=null}confirmFunctionAutocomplete(){let G=this.functionAutocompleteToken,D=this.functionAutocompleteList?.getSelectedValue();if(!G||!D){this.closeFunctionAutocomplete();return}let{field:z}=this,B=z.getCurrentValue(),Q=D.key,J=B.slice(0,G.start)+Q+B.slice(G.end),U=G.start+Q.length,Z=J[U]==="("?J:J.slice(0,U)+"("+J.slice(U);z.getContentElement().focus({preventScroll:!0}),z.applyFormulaValueChange({currentValue:B,nextValue:Z,caret:U+1}),this.closeFunctionAutocomplete()}isContentFocused(){return dO(this.beans).activeElement===this.field.getContentElement()}},rO=(G,D,z)=>{if(D<0||D>G.length||eO(G,D))return null;let B=D;while(B>0&&L0(G[B-1]))B--;let Q=D;while(Q{for(let B of Yz(G,D))if(z>=B.start&&z<=B.end)return!0;return!1},eO=(G,D)=>{let z=!1;for(let B=0;B{this.rangeSelectionEnabled=!1,this.suppressRangeEvents=!1,this.ignoreNextRangeEvent=!1,this.skipNextValueUpdate=!1,this.clearTrackedRanges(!0)}}postConstruct(){this.addManagedEventListeners({cellSelectionChanged:this.onCellSelectionChanged.bind(this)}),this.addDestroyFunc(()=>this.disableRangeSelectionWhileEditing()),this.addDestroyFunc(()=>this.unregisterActiveEditor())}onValueUpdated(G,D){if(this.skipNextValueUpdate){this.skipNextValueUpdate=!1;return}if(!this.isActiveEditor())return;if(D){if(this.enableRangeSelectionWhileEditing())this.skipNextValueUpdate=!0,this.field.setValue(G,!0);this.syncRangesFromFormula(G);return}this.disableRangeSelectionWhileEditing()}setEditingCellRef(G,D,z){this.editingColumn=G,this.editingRowIndex=D??void 0,this.editingCellRef=z}setEditorActive(G){if(G){this.registerActiveEditor();return}this.unregisterActiveEditor()}withSelectionChangeHandlingSuppressed(G){let D=this.suppressSelectionChangeHandling;this.suppressSelectionChangeHandling=!0;try{G()}finally{this.suppressSelectionChangeHandling=D}}deactivateForFocusLoss(){if(!this.isActiveEditor())return;this.handleEditorDeactivated(),this.beans.editSvc?.disableRangeSelectionWhileEditing?.(),this.unregisterActiveEditor()}registerActiveEditor(){let G=this.field.getCompId(),{formulaInputManager:D}=this.beans;if(!D)return;if(!D.registerActiveEditor(G,this.handleEditorDeactivated))return;this.rangeSelectionEnabled=!1,this.suppressRangeEvents=!1,this.ignoreNextRangeEvent=!1,this.skipNextValueUpdate=!1,this.clearTrackedRanges(!1);let B=this.field.getCurrentValue(),Q=B.trimStart().startsWith("=");this.onValueUpdated(B,Q)}unregisterActiveEditor(){let G=this.field.getCompId(),{formulaInputManager:D}=this.beans;if(!D)return;D.unregisterActiveEditor(G,this.handleEditorDeactivated)}isActiveEditor(){let G=this.field.getCompId(),{formulaInputManager:D}=this.beans;return!!D&&D.isActiveEditor(G)}getTrackedRefCount(G){return this.trackedRangeRefs.get(G)??0}hasTrackedRef(G){return this.getTrackedRefCount(G)>0}addTrackedRef(G){this.trackedRangeRefs.set(G,this.getTrackedRefCount(G)+1)}removeTrackedRef(G){let D=this.getTrackedRefCount(G)-1;if(D<=0){this.trackedRangeRefs.delete(G);return}this.trackedRangeRefs.set(G,D)}enableRangeSelectionWhileEditing(){if(this.rangeSelectionEnabled)return!1;return this.rangeSelectionEnabled=!0,this.beans.editSvc?.enableRangeSelectionWhileEditing?.(),!0}disableRangeSelectionWhileEditing(){if(!this.rangeSelectionEnabled&&!this.trackedRangeRefs.size)return;this.rangeSelectionEnabled=!1,this.beans.editSvc?.disableRangeSelectionWhileEditing?.(),this.clearTrackedRanges(this.isActiveEditor())}clearTrackedRanges(G=!0){if(G)Array.from(this.trackedRangeRefs.keys()).forEach((z)=>this.removeRangeForRef(z));this.trackedRangeRefs.clear(),this.trackedRanges.clear()}getLiveRanges(){return this.beans.rangeSvc?.getCellRanges()??[]}withSuppressedRangeEvents(G){this.suppressRangeEvents=!0,G(),this.suppressRangeEvents=!1}setCellRangesSilently(G){let D=this.beans.rangeSvc;if(!D)return;this.withSuppressedRangeEvents(()=>D.setCellRanges(G))}getColorIndexForTokenOrRef(G,D){return this.field.getColorIndexForToken(D??null)??this.field.getColorIndexForRef(G)}normaliseRefForComparison(G){if(!G)return null;return(G.endsWith(":")?G.slice(0,-1):G).replace(/\$/g,"").toUpperCase()}tagRangeColor(G,D,z){let{rangeClass:B}=uJ(D,z);if(G.colorClass===B)return!1;return tO(G,D,z),!0}trackRange(G,D,z){let B=this.trackedRanges.get(G),Q=z!==void 0?z:B?.tokenIndex??null;if(!B)this.addTrackedRef(D);else if(B.ref!==D)this.removeTrackedRef(B.ref),this.addTrackedRef(D);this.trackedRanges.set(G,{ref:D,tokenIndex:Q})}getUntrackedFormulaRangesByRef(){let G=new Map,D=this.getLiveRanges();for(let z of D){if(this.trackedRanges.has(z))continue;if(f1(z.colorClass)==null)continue;let B=QD(this.beans,z);if(!B||B===this.editingCellRef)continue;let Q=G.get(B);if(Q)Q.push(z);else G.set(B,[z])}return G}syncRangesFromFormula(G){let D=G??this.field.getCurrentValue()??"";if(!this.rangeSelectionEnabled){this.clearTrackedRanges();return}let z=S5(this.beans,D),B=new Map;for(let X of z){let{ref:Y,index:W}=X;if(Y===this.editingCellRef)continue;let q=B.get(Y)??[];q.push(W),B.set(Y,q)}for(let X of Array.from(this.trackedRangeRefs.keys()))if(!B.has(X))this.removeRangeForRef(X);if(!this.beans.rangeSvc)return;let J=new Set(this.getLiveRanges());for(let[X,Y]of this.trackedRanges.entries())if(!J.has(X))this.trackedRanges.delete(X),this.removeTrackedRef(Y.ref);let U=this.getUntrackedFormulaRangesByRef(),Z=!1;for(let[X,Y]of B.entries()){let W=[];for(let[H,_]of this.trackedRanges.entries())if(_.ref===X)W.push(H);let q=U.get(X);while(W.lengthY.length){let H=W.pop();if(H)this.removeTrackedRange(H)}while(W.length!S.includes(W));if(Y.length!==X.length)this.setCellRangesSilently(Y),Z=!0}if(Z)this.refreshRangeStyling()}onCellSelectionChanged(G){if(!this.isActiveEditor()||!this.rangeSelectionEnabled||!this.beans.editSvc?.isRangeSelectionEnabledWhileEditing?.())return;if(this.ignoreNextRangeEvent){this.ignoreNextRangeEvent=!1;return}if(this.suppressSelectionChangeHandling)return;let{finished:D,started:z}=G,B=this.getLiveRanges(),Q=B.filter((W)=>!this.isSpecialOnlyRange(W));if(Q.length!==B.length){this.setCellRangesSilently(Q),this.refocusEditingCell();return}let J=B.length?N1(B):null,U=J?QD(this.beans,J):null,Z=!!J&&!this.trackedRanges.has(J)&&!!U&&U!==this.editingCellRef,S=D&&(z||Z),X=this.ensureTrackedRangeColors();if(this.suppressRangeEvents){if(X)this.refreshRangeStyling();return}if(z||Z)this.field.rememberCaret();if(!Z&&this.handleRemovedRangeTokens()){this.field.restoreCaretAfterToken(),this.refocusEditingCell();return}if(this.updateTrackedRangeTokens())return;let Y=sO(this.beans);if(!Y||Y===this.editingCellRef){this.refocusEditingCell();return}if(S){let{action:W,previousRef:q,tokenIndex:H}=this.field.applyRangeInsert(Y);if(W==="none"){this.keepLatestSelectionOnly(J),this.beans.editSvc?.stopEditing(void 0,{source:"edit"});return}if(W==="replace"&&q===Y){this.discardLatestRangeForRef(Y),this.field.restoreCaretAfterToken(),this.refocusEditingCell();return}this.tagLatestRangeForRef(Y,H),this.handleRangeTokenUpdate(q,Y,!0,W==="insert",H),this.syncRangesFromFormula(this.field.getCurrentValue()),this.field.restoreCaretAfterToken(),this.refocusEditingCell();return}if(!z&&!D){let{previousRef:W,tokenIndex:q}=this.field.insertOrReplaceToken(Y,!1);this.tagLatestRangeForRef(Y,q),this.handleRangeTokenUpdate(W,Y,!1,!1),this.refocusEditingCell();return}if(this.tagLatestRangeForRef(Y),D)this.field.restoreCaretAfterToken(),this.refocusEditingCell()}keepLatestSelectionOnly(G){if(!G||this.getLiveRanges().length<=1)return;this.setCellRangesSilently([G])}isSpecialOnlyRange(G){let D=G.columns;return!!D?.length&&D.every((z)=>Du(z))}handleRangeTokenUpdate(G,D,z,B,Q){if(z){if(!B&&G&&G!==D)this.removeRangeForRef(G,Q);this.addRangeForRef(D,!0,Q);return}if(B||!G){this.addTrackedRef(D);return}if(G!==D)this.removeTrackedRef(G),this.addTrackedRef(D)}addRangeForRef(G,D,z){let B=this.beans.rangeSvc;if(!B)return;let Q;if(!D){let J=_8(this.beans,G);if(!J)return;this.withSuppressedRangeEvents(()=>{Q=B.addCellRange(J)})}else Q=this.findLatestRangeForRef(G,!0)??this.findLatestRangeForRef(G,!1);if(Q){let J=this.getColorIndexForTokenOrRef(G,z);this.tagRangeColor(Q,G,J),this.trackRange(Q,G,z),this.refreshRangeStyling()}return Q}findLatestRangeForRef(G,D){let z=this.getLiveRanges();for(let B=z.length-1;B>=0;B--){let Q=z[B];if(QD(this.beans,Q)!==G)continue;if(D&&this.trackedRanges.has(Q))continue;return Q}return}tagLatestRangeForRef(G,D){let{trackedRanges:z}=this,B=this.getLiveRanges(),Q=B.length?N1(B):null;if(!Q)return;let J=z.get(Q)?.tokenIndex??null,U=this.getColorIndexForTokenOrRef(G,D??J);this.tagRangeColor(Q,G,U),this.refreshRangeStyling()}discardLatestRangeForRef(G){let D=this.getLiveRanges();if(!D.length)return;let z=N1(D);if(QD(this.beans,z)!==G)return;if(this.trackedRanges.has(z)){this.removeTrackedRange(z);return}this.setCellRangesSilently(D.slice(0,-1))}ensureTrackedRangeColors(){let G=this.getLiveRanges();if(!G.length)return!1;let D=!1;for(let z of G){let B=this.trackedRanges.get(z),Q=B?.ref??QD(this.beans,z);if(!Q||!this.hasTrackedRef(Q))continue;let J=B?.tokenIndex??null,U=this.field.getColorIndexForToken(J),Z=f1(z.colorClass),S=U??(this.field.hasColorForRef(Q)?this.field.getColorIndexForRef(Q):this.field.moveColorToRef(void 0,Q,Z??void 0));if(S==null)continue;if(this.tagRangeColor(z,Q,S))D=!0;if(!this.trackedRanges.has(z))this.trackRange(z,Q,J)}return D}handleRemovedRangeTokens(){if(!this.beans.rangeSvc||this.trackedRanges.size===0)return!1;let G=this.field.getCurrentValue(),D=S5(this.beans,G).filter(({ref:S})=>S!==this.editingCellRef);if(!D.length)return!1;let z=this.getLiveRanges(),B=new Set(z),Q=new Map;for(let S of z){let X=QD(this.beans,S);if(!X||X===this.editingCellRef)continue;Q.set(X,(Q.get(X)??0)+1)}let J=new Map;for(let S of D){let{ref:X}=S;J.set(X,(J.get(X)??0)+1)}for(let[S,X]of Array.from(J.entries())){let Y=Q.get(S)??0,W=X-Y;if(W>0)J.set(S,W);else J.delete(S)}if(!J.size)return!1;let U=[];for(let[S,X]of Array.from(this.trackedRanges.entries())){if(B.has(S))continue;let{ref:Y}=X,W=J.get(Y)??0;if(W<=0)continue;J.set(Y,W-1),U.push({range:S,tracked:X})}if(!U.length)return!1;U.sort((S,X)=>(X.tracked.tokenIndex??-1)-(S.tracked.tokenIndex??-1));let Z=!1;for(let{range:S,tracked:X}of U){let{ref:Y,tokenIndex:W}=X;Z=this.field.removeTokenRef(Y,W??null)||Z,this.trackedRanges.delete(S),this.removeTrackedRef(Y)}if(Z)this.syncRangesFromFormula(this.field.getCurrentValue());return Z}refreshRangeStyling(){let{eventSvc:G}=this.beans;if(!G)return;this.ensureTrackedRangeColors(),this.ignoreNextRangeEvent=!0,G.dispatchEvent({type:"cellSelectionChanged",started:!1,finished:!1})}refocusEditingCell(){let{focusSvc:G}=this.beans,{editingColumn:D,editingRowIndex:z}=this;if(!G||D==null||z==null)return;G.setFocusedCell({column:D,rowIndex:z,rowPinned:null,preventScrollOnBrowserFocus:!0})}removeTrackedRange(G){let D=this.trackedRanges.get(G);if(!D)return;let z=this.getLiveRanges(),B=z.filter((Q)=>Q!==G);if(B.length!==z.length)this.setCellRangesSilently(B);this.trackedRanges.delete(G),this.removeTrackedRef(D.ref)}removeRangeForRef(G,D){if(!G||!this.hasTrackedRef(G))return;if(D!=null){let z=!1;for(let[B,Q]of Array.from(this.trackedRanges.entries())){let{ref:J,tokenIndex:U}=Q;if(J!==G||U!==D)continue;this.removeTrackedRange(B),z=!0;break}if(!z){for(let[B,Q]of Array.from(this.trackedRanges.entries()))if(Q.ref===G){this.removeTrackedRange(B);break}}return}for(let[z,B]of Array.from(this.trackedRanges.entries()))if(B.ref===G)this.removeTrackedRange(z)}updateTrackedRangeTokens(){if(!this.beans.rangeSvc)return!1;let G=this.getLiveRanges(),D=this.normaliseRefForComparison(this.editingCellRef),z=!1;for(let B of G){let Q=this.trackedRanges.get(B);if(!Q)continue;let{ref:J,tokenIndex:U}=Q,Z=QD(this.beans,B),S=this.normaliseRefForComparison(J),X=this.normaliseRefForComparison(Z);if(!Z||!X||X===S||X===D)continue;let{colorClass:Y}=B,q=this.field.getColorIndexForToken(U??null)??this.field.moveColorToRef(J,Z,f1(Y)??void 0),H=this.field.replaceTokenRef(J,Z,q,U);if(H==null)continue;this.tagRangeColor(B,Z,q),this.trackRange(B,Z,H??U??null),z=!0}if(z)this.refreshRangeStyling();return z}},F1=7,Bu={"/":"÷","*":"×"},Qu={"÷":"/","×":"*"},Ju=class extends TO{constructor(){super({renderValueToElement:!1,className:"ag-formula-input-field"});this.currentValue="",this.selectionCaretOffset=null,this.lastTokenValueOffset=null,this.lastTokenValueLength=null,this.lastTokenCaretOffset=null,this.focusFromMouseTime=null,this.suppressNextFocusCaretPlacement=!1,this.formulaColorByRef=new Map,this.registerCSS(iO),this.registerCSS(T6)}postConstruct(){super.postConstruct(),this.rangeSyncFeature=this.createManagedBean(new zu(this)),this.autocompleteFeature=this.createManagedBean(new oO(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(G,D){let z=G==null?"":String(G),{isFormula:B,hasFormulaPrefix:Q}=this.getFormulaState(z);if(!B)return this.applyPlainValue(z,{silent:D,dispatch:!0}),this.rangeSyncFeature?.onValueUpdated(z,Q),this;return this.applyFormulaValue(z,{currentValue:this.getCurrentValue(),silent:D}),this.rangeSyncFeature?.onValueUpdated(z,Q),this}getCurrentValue(){let G=Y5(this.getContentElement());if(G!==this.currentValue)this.setEditorValue(G,!0);return this.currentValue}setEditingCellRef(G,D){let z=G?this.beans.formula?.getColRef(G):void 0,B=z&&D!=null&&D!==void 0?`${z}${D+1}`:void 0;if(!B){this.rangeSyncFeature?.setEditingCellRef(void 0,void 0,void 0);return}this.rangeSyncFeature?.setEditingCellRef(G,D,B)}rememberCaret(){let G=ID(this.beans,this.getContentElement(),this.getCurrentValue());this.selectionCaretOffset=G??this.currentValue.length}setEditorValue(G,D=!1){return this.currentValue=G,super.setValue(G,D),this}renderFormula(G){Xu({beans:this.beans,contentElement:this.getContentElement(),getColorIndexForToken:this.getColorIndexForToken.bind(this),...G})}renderPlainValue(G,D){let z=this.getContentElement(),B=D??ID(this.beans,z,this.currentValue);z.textContent=G??"";let Q=B!=null?Math.min(B,G.length):null;s1(this.beans,z,Q)}withSelectionChangeHandlingSuppressed(G){if(!this.rangeSyncFeature){G();return}this.rangeSyncFeature.withSelectionChangeHandlingSuppressed(G)}getColorIndexForRef(G){if(!E1(this.beans))return null;let D=this.formulaColorByRef.get(G);if(D!=null)return D;let z=this.formulaColorByRef.size%F1;return this.formulaColorByRef.set(G,z),z}getColorIndexForToken(G){if(!E1(this.beans)||G==null)return null;return G%F1}hasColorForRef(G){return this.formulaColorByRef.has(G)}moveColorToRef(G,D,z){let B=G&&this.formulaColorByRef.has(G)?this.getColorIndexForRef(G):z??this.formulaColorByRef.get(D)??this.getColorIndexForRef(D);if(G&&G!==D)this.formulaColorByRef.delete(G);if(B==null)return null;return this.formulaColorByRef.set(D,B),B}updateFormulaColorsFromValue(G){if(G=G==null?"":String(G),!E1(this.beans)){this.formulaColorByRef.clear();return}let D=Uu(this.beans,G),z=D.length!==this.formulaColorByRef.size,B=new Map;if(D.forEach((Q,J)=>{let U=J%F1;if(B.set(Q,U),this.formulaColorByRef.get(Q)!==U)z=!0}),!z)return;this.formulaColorByRef.clear(),B.forEach((Q,J)=>this.formulaColorByRef.set(J,Q))}onContentInput(){let G=this.getContentElement(),D=this.getCurrentValue(),z=ID(this.beans,G,D),B=Y5(G),{isFormula:Q,hasFormulaPrefix:J}=this.getFormulaState(B);if(!Q){this.applyPlainValue(B,{caret:z,dispatch:!0}),this.rangeSyncFeature?.onValueUpdated(B,J);return}this.applyFormulaValue(B,{currentValue:D,caret:z??void 0,dispatch:!0}),this.rangeSyncFeature?.onValueUpdated(B,J)}onContentFocus(){if(this.rangeSyncFeature?.setEditorActive(!0),this.suppressNextFocusCaretPlacement){this.suppressNextFocusCaretPlacement=!1;return}let{focusFromMouseTime:G}=this,D=G!=null;if(this.focusFromMouseTime=null,D)return;xO(this.beans,this.getContentElement())}onContentBlur(G){this.focusFromMouseTime=null;let D=G.relatedTarget,z=D?.closest(".ag-cell-editor"),B=D?.closest(".ag-cell");if(!D||this.getGui().contains(D)||!z||!B)return;this.rangeSyncFeature?.deactivateForFocusLoss()}onContentMouseDown(){this.focusFromMouseTime=Date.now()}insertOrReplaceToken(G,D){let z=this.getTokenInsertOffsets(D);if(!z)return{};let{caretOffset:B,valueOffset:Q}=z,J=D||this.lastTokenValueLength==null?0:this.lastTokenValueLength,U=this.getCurrentValue(),Z=U.slice(0,Q)+G+U.slice(Q+J),S=I1(this.beans,Z,Q)?.index??null,X;return this.applyFormulaValueChange({currentValue:U,nextValue:Z,caret:B+G.length,updateTracking:()=>{X=this.updateLastTokenTracking(G,B,Q)}}),{previousRef:X,tokenIndex:S}}removeTokenRef(G,D){let z=this.getCurrentValue(),B=Yz(this.beans,z),Q;if(D!=null){if(Q=B.find((S)=>S.index===D),Q&&Q.ref!==G)Q=void 0}if(!Q)Q=B.find((S)=>S.ref===G);if(!Q)return!1;let J=z.slice(0,Q.start)+z.slice(Q.end),U=this.selectionCaretOffset??Q.start,Z=Math.min(U,J.length);return this.applyFormulaValueChange({currentValue:z,nextValue:J,caret:Z,updateTracking:()=>{this.lastTokenValueOffset=null,this.lastTokenValueLength=null,this.lastTokenCaretOffset=Z,this.lastTokenRef=void 0}}),!0}applyRangeInsert(G){let D=this.getCurrentValue(),z=this.getCaretOffsets(D);if(!z){let{previousRef:S,tokenIndex:X}=this.insertOrReplaceToken(G,!0);return{action:"insert",previousRef:S,tokenIndex:X}}let{valueOffset:B}=z,Q=I1(this.beans,D,B);if(Q){let{end:S,ref:X}=Q;if(X.endsWith(":")&&B===S){let{previousRef:q,tokenIndex:H}=this.insertOrReplaceToken(G,!0);return{action:"insert",previousRef:q,tokenIndex:H}}let{previousRef:Y,tokenIndex:W}=this.replaceTokenAtMatch(Q,G);return{action:"replace",previousRef:Y,tokenIndex:W}}let J=Zu(D,B);if(J){let S=D.slice(0,J.start)+G+D.slice(J.end),X=I1(this.beans,S,J.start)?.index??null,{previousRef:Y}=this.replaceTokenAtMatch(J,G,X);return{action:"replace",previousRef:Y,tokenIndex:X}}if(!$u(D,B))return{action:"none"};let{previousRef:U,tokenIndex:Z}=this.insertOrReplaceToken(G,!0);return{action:"insert",previousRef:U,tokenIndex:Z}}restoreCaretAfterToken(){let D=(this.lastTokenCaretOffset??ID(this.beans,this.getContentElement(),this.getCurrentValue())??this.currentValue.length)+(this.lastTokenValueLength??0);this.selectionCaretOffset=null,this.suppressNextFocusCaretPlacement=!0,setTimeout(()=>{if(!this.isAlive())return;if(this.getContentElement().focus({preventScroll:!0}),vJ(this.beans).activeElement===this.getContentElement())this.suppressNextFocusCaretPlacement=!1;s1(this.beans,this.getContentElement(),D)})}replaceTokenAtMatch(G,D,z){let B=this.getCurrentValue(),Q=B.slice(0,G.start)+D+B.slice(G.end);return this.applyFormulaValueChange({currentValue:B,nextValue:Q,caret:G.start+D.length,updateTracking:()=>{this.updateLastTokenTracking(D,G.start,G.start)}}),{previousRef:G.ref,tokenIndex:z??G.index}}getValueOffsetFromCaret(G){let D=this.getContentElement(),z=G,B=0;for(let Q of Array.from(D.childNodes)){let J=Uz(Q),U=sB(Q).length;if(z<=J)return B+(J===U?z:0);z-=J,B+=U}return this.currentValue.length}getTokenInsertOffsets(G){return this.getCaretOffsets(this.getCurrentValue(),{useCachedCaret:!0,useCachedValueOffset:!G})}getCaretOffsetsForAutocomplete(G){return this.getCaretOffsets(G)}getCaretOffsets(G,D={useCachedCaret:!1,useCachedValueOffset:!1}){let{beans:z}=this,{useCachedCaret:B,useCachedValueOffset:Q}=D,J=this.getContentElement(),U=B?this.selectionCaretOffset??ID(z,J,G)??this.currentValue.length:ID(z,J,G);if(U==null)return null;let Z=Q&&this.lastTokenValueOffset!=null?this.lastTokenValueOffset:this.getValueOffsetFromCaret(U);if(Z==null)return null;return{caretOffset:U,valueOffset:Z}}updateLastTokenTracking(G,D,z){let B=this.lastTokenRef;return this.lastTokenValueOffset=z,this.lastTokenValueLength=G.length,this.lastTokenCaretOffset=D,this.lastTokenRef=G,B}getFormulaState(G){let D=G.trimStart().startsWith("=");return{isFormula:this.beans.formula?.isFormula(G)??D,hasFormulaPrefix:D}}dispatchValueChanged(){this.dispatchLocalEvent({type:"fieldValueChanged"})}applyPlainValue(G,D){if(this.formulaColorByRef.clear(),this.renderPlainValue(G,D.caret),this.setEditorValue(G,D.silent),D.dispatch)this.dispatchValueChanged();this.autocompleteFeature?.onPlainValueUpdated()}applyFormulaValue(G,D){if(this.updateFormulaColorsFromValue(G),this.renderFormula({value:G,currentValue:D.currentValue??this.getCurrentValue(),caret:D.caret??void 0}),this.setEditorValue(G,D.silent),D.dispatch)this.dispatchValueChanged();this.autocompleteFeature?.onFormulaValueUpdated()}applyFormulaValueChange(G){let{currentValue:D,nextValue:z,caret:B}=G;this.updateFormulaColorsFromValue(z),G.updateTracking?.(),this.setEditorValue(z),this.renderFormula({currentValue:D,value:z,caret:B}),this.dispatchValueChanged(),this.autocompleteFeature?.onFormulaValueUpdated()}replaceTokenRef(G,D,z,B){let Q=this.getContentElement(),J;if(B!=null){if(J=Q.querySelector(`.ag-formula-token[data-formula-token-index="${B}"]`)??void 0,J&&W5(J)!==G)J=void 0}if(!J)J=Array.from(Q.querySelectorAll(".ag-formula-token")).find((W)=>W5(W)===G);if(!J)return null;let U=X5(Q,J),Z=X5(Q,J,!0);if(U==null||Z==null)return null;let S=this.getCurrentValue();if(z!=null)this.formulaColorByRef.set(D,z);let X=S.slice(0,Z)+D+S.slice(Z+G.length),Y=Yu(J);return this.applyFormulaValueChange({currentValue:S,nextValue:X,caret:U+D.length,updateTracking:()=>{this.updateLastTokenTracking(D,U,Z)}}),Y??B??null}},E1=(G)=>{let{gos:D,rangeSvc:z}=G;return!!z&&!!D.get("cellSelection")},Uu=(G,D)=>{let z=[],B=new Set;for(let Q of Yz(G,D)){let J=Q.ref;if(B.has(J))continue;B.add(J),z.push(J)}return z},I1=(G,D,z)=>{for(let B of Yz(G,D))if(z>=B.start&&z<=B.end)return{ref:B.ref,start:B.start,end:B.end,index:B.index};return null},Zu=(G,D)=>{for(let z of W8(G))if(D>=z.start&&D<=z.end)return{ref:z.ref,start:z.start,end:z.end,index:z.index};return null},$u=(G,D)=>{let z=H8(G,D);return z==null||q8.has(z)},Lu=(G,D,z)=>{let B=[],Q=0,J=Yz(G,D),U=vJ(G);for(let Z of J){if(Z.start>Q)B.push(U.createTextNode(q5(D.slice(Q,Z.start))));let S=z(Z.index);B.push(Su(Z.ref,S,S!=null,Z.index)),Q=Z.end}if(Q{let Q={"aria-label":G,"data-formula-ref":G,"data-formula-token-index":B.toString()},J;if(z&&D!=null){let Z=uJ(G,D);J=Z.tokenClass,Q["data-formula-range-class"]=Z.rangeClass}let U=yO({tag:"span",cls:"ag-formula-token",attrs:Q,children:G});if(J)U.classList.add(J);return U},Xu=(G)=>{let{beans:D,contentElement:z,currentValue:B,value:Q,getColorIndexForToken:J,caret:U}=G,Z=U??ID(D,z,B),S=Q.length;z.textContent="";for(let Y of Lu(D,Q,J))z.append(Y);let X=Z!=null?Math.min(Z,S):null;s1(D,z,X)},X5=(G,D,z=!1)=>{if(!G.contains(D))return null;let B=0;for(let Q of Array.from(G.childNodes)){if(Q===D)return B;B+=z?sB(Q).length:Uz(Q)}return null},Y5=(G)=>{let D="";return G.childNodes.forEach((z)=>{D+=sB(z)}),D},sB=(G)=>{if(G.nodeType===Node.TEXT_NODE)return w8(G.textContent??"");if(G.nodeType===Node.ELEMENT_NODE)return Array.from(G.childNodes).map((D)=>sB(D)).join("");return""},Uz=(G)=>{if(G.nodeType===Node.TEXT_NODE)return G.textContent?.length??0;if(G.nodeType===Node.ELEMENT_NODE)return Array.from(G.childNodes).reduce((D,z)=>D+Uz(z),0);return 0},k8=(G,D)=>{let z=D;for(let B=0;BJ){z-=J;continue}if(Q.nodeType===Node.TEXT_NODE)return{node:Q,localOffset:z};return k8(Q,z)}return{node:G,localOffset:G.childNodes.length}},s1=(G,D,z)=>{if(z==null)return;let B=X8(G),Q=vJ(G),J=B.getSelection(),U=Q.createRange(),{node:Z,localOffset:S}=k8(D,z);if(!Z||!J||!D.isConnected||!Z.isConnected)return;U.setStart(Z,S),U.collapse(!0),J.removeAllRanges();try{J.addRange(U)}catch{}},ID=(G,D,z)=>{let Q=X8(G).getSelection();if(!Q||Q.rangeCount===0)return z?.length??null;let J=Q.getRangeAt(0);if(!D.contains(J.startContainer))return z?.length??null;if(J.startContainer===D){let S=0;for(let X=0;Xw8(G.textContent??G.dataset.formulaRef??""),Yu=(G)=>{let D=G.dataset.formulaTokenIndex;if(!D)return null;let z=parseInt(D,10);return Number.isFinite(z)?z:null},q5=(G)=>G.replace(/[/*]/g,(D)=>Bu[D]??D),w8=(G)=>G.replace(/[÷×]/g,(D)=>Qu[D]??D),Wu={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!"]},qu=(G,D)=>{if(!D?.length)return G;let z=G,B=0;while(B{if(!G?.length)return;return G.map((D)=>String(D))},jJ=(G)=>{return Wu[G]},Hu=(G,D)=>{let[,z]=jJ(G);return qu(z,K8(D))},_u=(G,D,z)=>{let[B,Q]=jJ(D),J=K8(z);return G(B,Q,J)},ku=class extends uO{constructor(){super({tag:"div",cls:"ag-cell-edit-wrapper"});this.eEditor=jO,this.focusAfterAttached=!1}initialiseEditor(G){let D=this.createManagedBean(new Ju);this.eEditor=D,D.addCss("ag-cell-editor"),this.appendChild(D),this.addManagedElementListeners(D.getContentElement(),{keydown:(U)=>this.onFormulaInputKeyDown(U,G.onKeyDown)});let{eventKey:z,cellStartedEdit:B}=G,Q;if(B)if(this.focusAfterAttached=!0,z===K1.BACKSPACE||z===K1.DELETE)Q="";else if(z&&z.length===1)Q=z;else Q=this.getStartValue(G);else Q=this.getStartValue(G);let J=Q==null?"":String(Q);this.eEditor.setEditingCellRef(G.column,G.rowIndex),this.eEditor.setValue(J,!0)}onFormulaInputKeyDown(G,D){let{key:z}=G;if(z!==K1.TAB||G.defaultPrevented)return;let{focusSvc:B}=this.beans,Q=B?.getFocusedCell();this.eEditor.withSelectionChangeHandlingSuppressed(()=>{D?.(G)});let J=B?.getFocusedCell(),U=!1;if(Q&&J){let{rowIndex:S,rowPinned:X,column:Y}=Q,{rowIndex:W,rowPinned:q,column:H}=J;U=S!==W||X!==q||Y!==H}let{defaultPrevented:Z}=G;if(Z||U)G.preventDefault();G.stopPropagation()}getStartValue(G){let{value:D}=G;return D?.toString()??D}agSetEditValue(G){this.params.value=G;let D=this.getStartValue(this.params);this.eEditor.setValue(D??"",!0)}isPopup(){return!1}afterGuiAttached(){if(!this.focusAfterAttached)return;let{beans:G,eEditor:D}=this;if(!PO())this.focusIn();gO(G,D.getContentElement())}focusIn(){this.eEditor.getContentElement().focus({preventScroll:!0})}getValue(){let G=this.eEditor.getCurrentValue(),{value:D,parseValue:z}=this.params;if(typeof G==="string"&&this.isFormulaText(G))return G;if(G==null&&D==null)return D;return z(String(G))}getValidationElement(){return this.eEditor.getContentElement()}getValidationErrors(){let{params:G}=this,D=this.eEditor.getCurrentValue(),z=this.getLocaleTextFunc(),{getValidationErrors:B,validateFormulas:Q}=G,J=null;if((Q===!0||!!B)&&typeof D==="string"&&this.isFormulaText(D)){if(!this.beans.formula?.normaliseFormula(D,!0))J=[_u(z,1)]}if(B)return B({value:this.getValue(),internalErrors:J,cellEditorParams:G});return J}isFormulaText(G){let D=G==null?"":String(G);return this.beans.formula?.isFormula(D)??D.trimStart().startsWith("=")}},wu='.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)}',Fu=class extends Ku{constructor(){super(...arguments);this.beanName="formulaDataSvc",this.hasSource=!1}postConstruct(){let G=this.gos.get("formulaDataSource");if(G)this.setDataSource(G)}hasDataSource(){return this.hasSource}getFormula(G){let D=this.dataSource?.getFormula(G);return Nu(D)?D:void 0}setFormula(G){this.dataSource?.setFormula(G)}setDataSource(G){this.dataSource=G,this.hasSource=!0,G.init?.(this.createInitParams())}createInitParams(){return fu(this.gos,{})}destroy(){this.dataSource?.destroy?.(),super.destroy()}},Iu=class extends Eu{constructor(){super(...arguments);this.beanName="formulaInputManager",this.activeEditor=null,this.activeEditorDeactivate=null}postConstruct(){this.registerRangeSelectionExtension()}registerActiveEditor(G,D){if(this.activeEditor===G&&this.activeEditorDeactivate===D)return!1;let z=this.activeEditorDeactivate;if(z&&z!==D)z();return this.activeEditor=G,this.activeEditorDeactivate=D,!0}unregisterActiveEditor(G,D){if(this.activeEditor===G&&this.activeEditorDeactivate===D)this.activeEditor=null,this.activeEditorDeactivate=null}isActiveEditor(G){return this.activeEditor===G}shouldSuppressRangeSelection(G){let D=G;if(!D?.closest)return!1;if(this.activeEditor!=null)return!!D.closest(".ag-cell-editor");return!!D.closest(".ag-formula-input-field")}registerRangeSelectionExtension(){let G=this.beans.rangeSvc;if(!G)return;G.registerRangeSelectionExtension(this),this.addDestroyFunc(()=>G.unregisterRangeSelectionExtension?.(this))}},f8=[{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"}],AB=new Map;for(let G of f8){let D=AB.get(G.symbol)??[];D.push(G),AB.set(G.symbol,D)}function Bz(G,D){let z=AB.get(G)??[];return D?z.find((B)=>B.fixity===D):z[0]}var bu=[...new Set(f8.map((G)=>G.symbol))].sort((G,D)=>D.length-G.length),o1=AB,vu=(G)=>{if(!G?.length)return;return G.map((D)=>String(D))},T=class extends Error{constructor(G,D,z){let B=typeof G==="string",Q=!B&&Array.isArray(D)?vu(D):void 0,J=B?G:Hu(G,Q);super(J);if(this.name="FormulaError",B)this.type=typeof D==="string"?D:"#ERROR!",this.errorId=null,this.localeKey=null,this.defaultMessage=G,this.variableValues=void 0;else{let[U,Z,S]=jJ(G);this.type=z??S??"#ERROR!",this.errorId=G,this.localeKey=U,this.defaultMessage=Z,this.variableValues=Q}}getTranslatedMessage(G){if(!this.localeKey)return this.message;return G(this.localeKey,this.defaultMessage,this.variableValues)}},JG=class extends T{constructor(G,D,z,B){super(G,B,"#PARSE!");this.errorStart=D,this.errorEnd=z}},Ou=(G,D,z)=>{let B=D.trim();if(B.startsWith('"')&&B.endsWith('"')&&B.length>2)return B.slice(1,-1);if(B.toLowerCase()==="true")return!0;if(B.toLowerCase()==="false")return!1;let Q=Number(B);if(!isNaN(Q))return Q;let J=OJ(B);if(J){let{startCol:U,startRow:Z,startColAbsolute:S,startRowAbsolute:X,endCol:Y,endRow:W,endColAbsolute:q,endRowAbsolute:H}=J,_=(w,K,f,N,F)=>{let E=w||F?K.toUpperCase():G.formula?.getColByRef(K)?.colId,I=f||F?N:Cu(G)?.getFormulaRow(Number(N)-1)?.id;if(E==null||I==null)throw new JG(2,0,0,[B]);return{column:{id:E,absolute:w},row:{id:I,absolute:f}}},k=_(S,U,X,Z,z);if(Y&&W){let w=_(q??!1,Y,H??!1,W,z);k.endColumn=w.column,k.endRow=w.row}return k}return null};function uu(G){let D=[],z=0,B=(Q,J)=>{let U=J,Z=()=>Q[U]==="$"?(U++,!0):!1,S=()=>{let q=U;while(Uq},X=()=>{let q=U;while(Uq},Y=()=>{let q=U;if(Z(),!S())return U=q,!1;if(Z(),!X())return U=q,!1;return!0};if(!Y())return 0;if(Q[U]===":"){let q=U;if(U++,!Y())throw new JG(3,q,U)}let W=Q.slice(J,U);if(!Y8(Q,J,W))return 0;return U-J};while(z=G.length)throw new JG(4,z,G.length);D.push(G.slice(z,U+1)),z=U+1;continue}if(/[0-9]/.test(Q)||Q==="."&&/[0-9]/.test(G[z+1])){let U=z+1;while(U0){D.push(G.slice(z,z+U)),z+=U;continue}let Z=z+1;while(ZG.startsWith(U,z));if(!J)throw new JG(5,z,z+1,[Q]);D.push(J),z+=J.length}return D}function ju(G,D){if(G.fixity!=="infix"||D.fixity!=="infix")return!0;if(G.associativity==="right"&&G.precedence===D.precedence)return!1;return G.precedence>=D.precedence}function Pu(G,D){let z=o1.get(G);if(!z)return null;let B=D!==void 0&&o1.has(D);if(D!==void 0&&!B&&!(D==="("||D===",")&&D!=="("||D===")")return z.find((U)=>U.fixity==="postfix")??z.find((U)=>U.fixity==="infix")??null;return z.find((U)=>U.fixity==="prefix")??z.find((U)=>U.fixity==="infix")??null}function gu(G,D,z){let B=uu(D),Q=[],J=[],U=()=>{let S=J.pop();if(!S)throw new JG(6,0,0);if(S.kind==="op"){let X=S.def;if(X.fixity!=="infix"){let q=Q.pop();if(!q)throw new JG(7,0,0,[X.symbol]);if(X.symbol==="+"&&X.fixity==="prefix"){Q.push(q);return}if(X.fixity==="postfix"&&X.symbol==="%"){Q.push({type:"operation",operation:X.symbol,operands:[q]});return}if(X.symbol==="-"&&X.fixity==="prefix")Q.push({type:"operation",operation:"-",operands:[{type:"operand",value:0},q]});else Q.push({type:"operation",operation:X.symbol,operands:[q]});return}let Y=Q.pop(),W=Q.pop();if(!W||!Y)throw new JG(7,0,0,[X.symbol]);Q.push({type:"operation",operation:X.symbol,operands:[W,Y]});return}throw new JG(8,0,0)},Z=0;while(ZW.outLen)q.args.push(Q.pop());Z++;continue}if(S===")"){while(!0){let H=J[J.length-1];if(!H||H.kind==="parenthesis")break;if(H.kind==="op")U();else throw new JG(12,Z,Z+1)}let W=J[J.length-1];if(!W||W.kind!=="parenthesis")throw new JG(13,Z,Z+1);let q=W.outLen;if(J.pop(),J[J.length-1]?.kind==="function"){let H=J.pop();if(Q.length>q)H.args.push(Q.pop());Q.push({type:"operation",operation:H.name,operands:H.args})}Z++;continue}let X=o1.has(S)?Pu(S,B[Z-1]):null;if(X){while(!0){let W=J[J.length-1];if(!W||W.kind!=="op")break;if(ju(W.def,X))U();else break}J.push({kind:"op",def:X}),Z++;continue}let Y=Ou(G,S,z);if(Y==null)throw new JG(14,0,S.length,[S]);Q.push({type:"operand",value:Y}),Z++}while(J.length)if(J[J.length-1].kind==="op")U();else throw new JG(15,0,0);if(Q.length!==1)throw new JG(16,0,0);return Q[0]}var r1=(G,D,z=!1)=>{if(!Vu(D))throw new JG(17,0,1);let B=D.slice(1).trim();return E8(gu(G,B,z))};function PJ(G,D){return G.type==="operation"&&G.operation.toUpperCase()===D.toUpperCase()}function N8(G,D=!1){if(!G)return D;if(G.type!=="operand")return D;return!!G.value}function F8(G){if(!G||G.type!=="operand")return null;let D=G.value;if(typeof D==="string")return D;if(typeof D==="number"||typeof D==="boolean")return String(D);return null}function H5(G){if(!PJ(G,"COLUMN"))return null;let D=F8(G.operands[0]);if(D==null)return null;let z=N8(G.operands[1],!1);return{id:D,absolute:z}}function _5(G){if(!PJ(G,"ROW"))return null;let D=F8(G.operands[0]);if(D==null)return null;let z=N8(G.operands[1],!1);return{id:D,absolute:z}}function Tu(G){if(!PJ(G,"REF"))return null;let D=G.operands;if(D.length!==2&&D.length!==4)return null;let z=H5(D[0]),B=_5(D[1]);if(!z||!B)return null;let Q={column:z,row:B};if(D.length===4){let J=H5(D[2]),U=_5(D[3]);if(!J||!U)return null;Q.endColumn=J,Q.endRow=U}return{type:"operand",value:Q}}function E8(G){if(G.type==="operation"){let D=G.operands.map(E8),z={type:"operation",operation:G.operation,operands:D};return Tu(z)??z}return G}var oB=(G)=>G.type==="operation";function I8(G,D){let z=G.colModel.getColById(D);if(z)return G.formula?.getColRef(z)??null;return null}function xu(G,D){return G.formula?.getColByRef?.(D)?.colId??null}function cu(G,D,z){let B=G.getColById(z);if(!B)return null;let Q=D.indexOf(B);return Q>=0?Q:null}function hu(G,D){let z=G[D];return z?z.getId()??null:null}function gJ(G,D){let z=G.rowModel?.getRowNode?.(D);if(z?.formulaRowIndex!=null)return z.formulaRowIndex+1;return null}function M8(G,D){return yu(G)?.getFormulaRow?.(D-1)?.id??null}function a1(G){if(G.includes('"'))throw new T(18);return`"${G}"`}function iu(G,D){let z=/^[A-Za-z]+$/.test(D.id);if(D.absolute){if(z)return D.id.toUpperCase();let B=I8(G,D.id);if(B)return B.toUpperCase();throw new T(19,[D.id])}else{if(z){let B=xu(G,D.id);if(B)return B}return D.id}}function nu(G,D){let{id:z,absolute:B}=D;if(B){if(M8(G,Number(z))==null)throw new T(20,[z])}else if(gJ(G,z)==null)throw new T(21,[z]);return z}function k5(G,D){if(D.absolute)return D.id;let z=I8(G,D.id);if(z)return z.toUpperCase();throw new T(22,[D.id])}function w5(G,D){if(D.absolute){let B=Number(D.id);if(Number.isFinite(B)&&B>=1)return B;throw new T(23,[D.id])}let z=gJ(G,D.id);if(z!=null)return z;throw new T(24,[D.id])}function du(G,D,z){let B=(Z,S)=>(Z?"$":"")+String(S),Q=z?D.column.id:k5(G,D.column),J=z?D.row.id:w5(G,D.row),U=B(D.column.absolute,Q)+B(D.row.absolute,J);if(D.endColumn&&D.endRow){let Z=z?D.endColumn.id:k5(G,D.endColumn),S=z?D.endRow.id:w5(G,D.endRow);return`${U}:${B(D.endColumn.absolute,Z)}${B(D.endRow.absolute,S)}`}return U}function lu(G,D){let z=(J)=>`COLUMN(${a1(iu(G,J))}${J.absolute?",true":""})`,B=(J)=>`ROW(${a1(nu(G,J))}${J.absolute?",true":""})`,Q=`REF(${z(D.column)},${B(D.row)}`;if(D.endColumn&&D.endRow)return`${Q},${z(D.endColumn)},${B(D.endRow)})`;return`${Q})`}function A8(G){if(!oB(G)||G.operation!=="-"||G.operands.length!==2)return null;let[D,z]=G.operands;if(D.type==="operand"&&D.value===0)return z;return null}function pu(G){if(!oB(G))return!1;return!!Bz(G.operation,"infix")}function K5(G,D,z){if(!oB(D))return!1;if(A8(D))return!1;let B=Bz(D.operation,"infix");if(!B||B.fixity!=="infix")return!1;let Q=G.precedence,J=B.precedence;if(JQ)return!1;if(G.associativity==="right"){let Z=B.symbol===G.symbol;return z==="left"&&Z}if(G.isAssociative!==!0)return z==="right";return!1}function mu(G){if(!oB(G))return!1;let D=Bz(G.operation,"infix");if(!D)return!1;return D.symbol!=="^"}function f5(G,D,z,B){let Q=(U)=>z?lu(G,U):du(G,U,B);function J(U){if(U.type==="operand"){let X=U.value;if(typeof X==="string")return a1(X);if(typeof X==="number")return String(X);if(typeof X==="boolean")return X?"TRUE":"FALSE";return Q(X)}let Z=A8(U);if(Z){let X=J(Z);return mu(Z)?`-(${X})`:`-${X}`}let S=U.operation.toUpperCase();if(U.operands.length===1){let X=U.operands[0],Y=Bz(S,"postfix");if(Y)return`${J(X)}${Y.symbol}`;let W=Bz(S,"prefix");if(W){let q=J(X);return pu(X)?`${W.symbol}(${q})`:`${W.symbol}${q}`}return`${S}(${J(X)})`}if(U.operands.length===2){let X=Bz(S,"infix");if(X){let[Y,W]=U.operands,q=K5(X,Y,"left")?`(${J(Y)})`:J(Y),H=K5(X,W,"right")?`(${J(W)})`:J(W);return`${q}${X.symbol}${H}`}}return`${S}(${U.operands.map(J).join(",")})`}return"="+J(D)}function R8(G){return!!(G.endColumn&&G.endRow)}function yJ(G,D){let{row:z,column:B}=D,Q=z.absolute?TJ(G)?.getFormulaRow(Number(z.id)-1):G.rowModel.getRowNode(z.id),J=B.absolute?G.formula.getColByRef(B.id):G.colModel.getColById(B.id);if(!Q||!J)return null;return{row:Q,column:J}}function C8(G,D,z,B){if(D.type==="operand"){let Z=D.value;if(typeof Z!=="object")return Z;if(R8(Z))throw new T(25);let S=yJ(G,Z);if(!S)throw new T(26);return z(S)}let Q=G.formula?.getFunction(D.operation);if(!Q)throw new T(27,[D.operation]);let{args:J,values:U}=ou(G,D.operands,z,B);return Q({row:B.row,column:B.column,args:J,values:U})}function V8(G,D,z,B){if(D.type==="operand"){let J=D.value;if(typeof J!=="object")return{kind:"value",value:J};if(R8(J))return au(G,J,z);let U=yJ(G,J);if(!U)throw new T(26);return{kind:"value",value:z(U)}}return{kind:"value",value:C8(G,D,z,B)}}var tu=class{constructor(G,D,z,B){this.beans=G,this.operandNodes=D,this.getCellValue=z,this.caller=B,this.i=0,this.res={done:!1,value:void 0}}next(){if(this.i>=this.operandNodes.length)return this.res.done=!0,this.res.value=void 0,this.res;return this.res.done=!1,this.res.value=V8(this.beans,this.operandNodes[this.i++],this.getCellValue,this.caller),this.res}[Symbol.iterator](){return this}},su=class{constructor(G,D,z,B){this.beans=G,this.operandNodes=D,this.getCellValue=z,this.caller=B,this.i=0,this.inner=null,this.res={done:!1,value:void 0}}next(){while(!0){if(this.inner){let D=this.inner.next();if(!D.done)return this.res.done=!1,this.res.value=D.value,this.res;this.inner=null;continue}if(this.i>=this.operandNodes.length)return this.res.done=!0,this.res.value=void 0,this.res;let G=V8(this.beans,this.operandNodes[this.i++],this.getCellValue,this.caller);if(G.kind==="value")return this.res.done=!1,this.res.value=G.value,this.res;this.inner=G[Symbol.iterator]()}}[Symbol.iterator](){return this}};function ou(G,D,z,B){let Q={[Symbol.iterator](){return new tu(G,D,z,B)}},J={[Symbol.iterator](){return new su(G,D,z,B)}};return{args:Q,values:J}}function RB(G,D){if(D.absolute){let B=Number(D.id)-1;if(!Number.isFinite(B)||B<0)throw new T(28);return B}let z=G.rowModel?.getRowNode?.(D.id);if(z?.formulaRowIndex==null)throw new T(29);return z.formulaRowIndex}function CB(G,D){if(D.absolute){let B=G.formula?.getColByRef(D.id);if(!B)throw new T(30);return B}let z=G.colModel.getColById(D.id);if(!z)throw new T(31);return z}var ru=class{constructor(G,D,z,B,Q,J){this.beans=G,this.rowStartIndex=D,this.rowEndIndex=z,this.colStart=B,this.colEnd=Q,this.getCellValue=J,this.cols=null,this.currentRowIndex=this.rowStartIndex,this.currentColIdx=-1,this.colStartIdx=-1,this.colEndIdx=-1,this.res={done:!1,value:void 0}}initColsOnce(){if(this.cols)return;this.cols=this.beans.colModel.getCols()??[];let G=b8(this.beans,this.colStart,this.colEnd);if(!G){this.colStartIdx=-1,this.colEndIdx=-1;return}[this.colStartIdx,this.colEndIdx]=G,this.currentColIdx=this.colStartIdx}next(){if(!this.cols){if(this.initColsOnce(),this.colStartIdx<0)return this.res.done=!0,this.res}if(this.currentRowIndex<=this.rowEndIndex){let G=TJ(this.beans)?.getFormulaRow(this.currentRowIndex);if(!G)throw new T(32);let D=this.cols[this.currentColIdx];if(this.currentColIdxB)throw new T(36,[D,B]);if(Q.length{return G.kind==="range"},v8=(G)=>{return G.kind==="value"},zj=["<=",">=","<>","<",">","="];function Bj(G){for(let D of zj)if(G.startsWith(D))return D;return null}function GJ(G){if(typeof G==="number"&&Number.isFinite(G))return G;if(G instanceof Date)return+G;if(typeof G==="string"){let D=Number(G);if(!Number.isNaN(D))return D}return null}function O8(G){if(G==null)return"";switch(typeof G){case"string":return G;case"number":return String(G);case"boolean":return G?"TRUE":"FALSE"}if(G instanceof Date)return String(+G);return String(G)}function Qj(G){let D="^";for(let z=0;z{let B=GJ(D),Q=GJ(z);if(B==null||Q==null)B=D,Q=O8(z).toUpperCase();switch(G){case"<":return Q":return Q>B;case"<=":return Q<=B;case">=":return Q>=B;case"=":return Q===B;case"<>":return Q!==B}return!1},Uj=(G,D,z)=>{let B=O8(z),Q=D.test(B);return G==="="?Q:!Q},Zj=(G)=>G==null||G==="";function u8(G){if(typeof G==="number")return(U)=>GJ(U)===G;if(typeof G!=="string")return(U)=>G===U;let D=G.trim();if(D==="")return Zj;let z=Bj(D),B=z?D.substring(z.length):D;if(!/[*?]/.test(B))return Jj.bind(null,z??"=",B.toUpperCase());if(z&&z!=="="&&z!=="<>")throw new T(38);let J=Qj(B);return Uj.bind(null,z??"=",J)}var N5=(G,D,z)=>{if(!z||D===0||z.absolute)return;let{visibleCols:B,colModel:Q}=G,J=B.allCols,U=cu(Q,J,z.id);if(U==null)return;let Z=U+D;if(Z<0)return;let S=hu(J,Z);if(S)z.id=S},F5=(G,D,z,B)=>{if(!z||D===0||z.absolute)return;if(B){let Z=Number(z.id);if(!Number.isFinite(Z))return;z.id=String(Z+D);return}let Q=gJ(G,z.id);if(Q==null)return;let J=Q+D;if(J<1)return;let U=M8(G,J);if(U)z.id=U},$j=(G)=>{return!!G&&typeof G==="object"&&G!==null&&"row"in G&&"column"in G},j8=(G,D,z,B,Q)=>{if(D.type==="operand"){let{value:J}=D;if(!$j(J))return;let{row:U,column:Z,endRow:S,endColumn:X}=J;F5(G,z,U,Q),N5(G,B,Z),F5(G,z,S,Q),N5(G,B,X);return}if(D.type==="operation")for(let J of D.operands)j8(G,J,z,B,Q)},Lj=({values:G})=>{let D=0;for(let z of G)if(z!=null&&z!==""&&!isNaN(z))D++;return D},Sj=({values:G})=>{let D=0;for(let z of G)if(z!=null&&z!=="")D++;return D},Xj=({values:G})=>{let D=0;for(let z of G)if(z==null||z==="")D++;return D},Yj=({args:G})=>{let[D,z]=IG(G,"COUNTIF",2);if(!e1(D))throw new T(65);if(!v8(z))throw new T(66);let B=u8(z.value),Q=0;for(let J of D)if(B(J))Q++;return Q},Wj=()=>new Date,qj=()=>{let G=new Date;return new Date(G.getFullYear(),G.getMonth(),G.getDate())},Hj=({values:G})=>{let[D,z]=IG(G,"EQUALS",2);return D===z},_j=({values:G})=>{let[D,z]=IG(G,"NOT_EQUALS",2);return D!==z},kj=({values:G})=>{let[D,z]=IG(G,"GT",2);return D>z},wj=({values:G})=>{let[D,z]=IG(G,"GTE",2);return D>=z},Kj=({values:G})=>{let[D,z]=IG(G,"LT",2);return D{let[D,z]=IG(G,"LTE",2);return D<=z},Nj=({values:G})=>{let[D,z,B]=IG(G,"IF",3);return D?z:B},Fj=({values:G})=>{let D=null;for(let z of G){if(z==null)continue;if(D===null||z{let D=null;for(let z of G){if(z==null)continue;if(D===null||z>D)D=z}if(D===null)throw new T(69);return D},Ij=(G)=>typeof G==="number"&&Number.isFinite(G),P8=86400000;function Mj(G){return G.getTime()/P8}function rB(G){return new Date(G*P8)}function Zz(G){return G instanceof Date}function PG(G,D){if(typeof D==="bigint"){let z=Number(D);if(Number.isFinite(z))return z;throw new T(48,[G])}if(Ij(D))return D;if(Zz(D))return Mj(D);if(typeof D==="boolean")return D?1:0;if(typeof D==="string"){let z=Number(D.trim());if(Number.isFinite(z))return z}throw new T(48,[G])}function $z(G,D){if(typeof D==="bigint")return D;return PG(G,D)}function OG(G,D){if(typeof D==="bigint")return D;if(!Number.isFinite(D)||!Number.isInteger(D))throw new T(49,[G]);return BigInt(D)}var E5=({values:G})=>{let D=1,z=null;for(let B of Wz(G)){let Q=$z("PRODUCT",B);if(typeof Q==="bigint"){if(z??(z=OG("PRODUCT",D)),Q===0n)return 0n;z*=Q;continue}if(z!=null){z*=OG("PRODUCT",Q);continue}if(Q===0)return 0;D*=Q}return z??D},Aj=({values:G})=>{let[D,z]=IG(Wz(G),"DIVIDE",2),B=PG("DIV",D),Q=PG("DIV",z);if(B==null||Q==null)throw new T(54);if(Q===0)throw new T(55);return B/Q},M1=({values:G})=>{let D=!1,z=0,B=null,Q=!1;for(let J of Wz(G)){D||(D=Zz(J));let U=$z("SUM",J);if(typeof U==="bigint"){if(D)throw new T(56);B??(B=OG("SUM",z)),B+=U,Q=!0;continue}if(typeof B==="bigint"){if(D)throw new T(56);B+=OG("SUM",U),Q=!0;continue}z+=U,Q=!0}if(!Q)throw new T(57);if(typeof B==="bigint")return B;return D?rB(z):z},Rj=({values:G})=>{let[D,z]=IG(Wz(G),"MINUS",2),B=Zz(D),Q=Zz(z);if(B||Q){let Z=PG("MINUS",D),S=PG("MINUS",z);if(B&&!Q)return rB(Z-S);if(B&&Q)return Z-S;return Z-S}let J=$z("MINUS",D),U=$z("MINUS",z);if(typeof J==="bigint"||typeof U==="bigint")return OG("MINUS",J)-OG("MINUS",U);return J-U},Cj=({values:G})=>{let[D]=IG(G,"PERCENT",1),z=PG("PERCENT",D);if(z==null)throw new T(70);return z/100},I5=({values:G})=>{let[D,z]=IG(G,"POWER",2),B=PG("POWER",D),Q=PG("POWER",z);if(B==null||Q==null)throw new T(71);return Math.pow(B,Q)},Vj=({values:G})=>{let D=0,z=0,B=!0;for(let J of Wz(G)){let U=PG("AVG",J);if(U==null)continue;D+=U,z++,B&&(B=Zz(J))}if(z===0)throw new T(58);let Q=D/z;return B?rB(Q):Q},bj=({values:G})=>{let D=!0,z=[];for(let J of Wz(G)){let U=PG("MEDIAN",J);if(U==null)throw new T(59);z.push(U),D&&(D=Zz(J))}if(z.length===0)throw new T(60);z.sort((J,U)=>J-U);let B=Math.floor(z.length/2),Q=z.length%2===1?z[B]:(z[B-1]+z[B])/2;return D?rB(Q):Q},vj=()=>Math.random(),Oj=({args:G})=>{let[D,z,B]=Dj(G,"SUMIF",2,3);if(!e1(D))throw new T(61);if(!v8(z))throw new T(62);if(B&&!e1(B))throw new T(63);let Q=u8(z.value);if(!B){let W=0,q=null;for(let H of D)if(Q(H)){let _=$z("SUMIF",H);if(typeof _==="bigint")q??(q=OG("SUMIF",W)),q+=_;else if(q!=null)q+=OG("SUMIF",_);else W+=_}return q??W}let J=D.rowEnd-D.rowStart,U=B.rowEnd-B.rowStart;if(J!==U)throw new T(64);let Z=D[Symbol.iterator](),S=B[Symbol.iterator](),X=0,Y=null;while(!0){let W=Z.next(),q=S.next();if(W.done||q.done){if(W.done!==q.done)throw new T(64);break}if(Q(W.value)){let H=$z("SUMIF",q.value);if(typeof H==="bigint")Y??(Y=OG("SUMIF",X)),Y+=H;else if(Y!=null)Y+=OG("SUMIF",H);else X+=H}}return Y??X},A1=({values:G})=>{let D="";for(let z of G){if(z==null)continue;switch(typeof z){case"string":{D+=z;break}case"number":{D+=String(z);break}case"boolean":{D+=z?"TRUE":"FALSE";break}case"object":{D+=z.toString();break}default:throw new T(67)}}return D},M5={IF:Nj,NOW:Wj,TODAY:qj,PRODUCT:E5,SUM:M1,ADD:M1,SUMIF:Oj,POWER:I5,MIN:Fj,MAX:Ej,AVERAGE:Vj,MEDIAN:bj,COUNT:Lj,COUNTA:Sj,COUNTBLANK:Xj,COUNTIF:Yj,RAND:vj,CONCAT:A1,CONCATENATE:A1,"+":M1,"-":Rj,"*":E5,"/":Aj,"^":I5,"%":Cj,"=":Hj,"&":A1,"<>":_j,">":kj,">=":wj,"<":Kj,"<=":fj},uj=class{constructor(G,D,z,B){this.rowNode=G,this.column=D,this.formulaString=z,this.beans=B,this.error=null,this.ast=null,this.astStale=!0,this._value=void 0,this._valueStale=!0}setFormulaString(G){if(this.formulaString===G)return;this.formulaString=G,this.astStale=!0,this._valueStale=!0}setComputedValue(G){this._value=G,this._valueStale=!1,this.error=null}setError(G){this.error=G,this._valueStale=!1}isValueReady(){return!this._valueStale}getValue(){return this.error?.type??this._value}getError(){return this.error}getAst(){if(!this.astStale)return this.ast;let G=r1(this.beans,this.formulaString);return this.ast=G??null,this.astStale=!1,this.ast}},jj=class extends Mu{constructor(){super(...arguments);this.beanName="formula",this.cachedResult=new WeakMap,this.colRefMap=new Map,this.functionNames=null,this.active=!1}setFormulasActive(G){let z=G.list.some((B)=>B.isAllowFormula())&&this.checkForIncompatibleServices(G);if(z!==this.active)this.active=z,this.refreshFormulas(!0)}checkForIncompatibleServices(G){if(this.gos.get("masterDetail"))return oD(295,{blockedService:"Master Detail"}),!1;if(this.gos.get("treeData"))return oD(295,{blockedService:"Tree Data"}),!1;if(this.gos.get("enableCellExpressions"))return oD(295,{blockedService:"Cell Expressions"}),!1;return G.list.every((D)=>{if(D.isAllowPivot()||D.isPivotActive())return oD(295,{blockedService:"Column Pivoting"}),!1;if(D.isAllowRowGroup()||D.isRowGroupActive())return oD(295,{blockedService:"Row Groups"}),!1;if(D.isAllowValue()||D.isValueActive()||D.getAggFunc())return oD(295,{blockedService:"Value Aggregation"}),!1;return!0})}postConstruct(){this.setupFunctions();let G=()=>{if(this.active)this.refreshFormulas(!0)},D=()=>{if(this.active)this.setupColRefMap()};this.addManagedPropertyListeners(["masterDetail","enableCellExpressions"],(z)=>{let{colModel:B}=this.beans;if(B.cols?.list.some((J)=>J.isAllowFormula()))B.refreshAll(Au(z.source))}),this.addManagedListeners(this.beans.eventSvc,{modelUpdated:G,cellValueChanged:G,rowDataUpdated:G,newColumnsLoaded:D,columnMoved:D})}updateFormulaByOffset(G){let{value:D,rowDelta:z=0,columnDelta:B=0,useRefFormat:Q=!0}=G,{beans:J}=this;try{let U=!Q,Z=r1(J,D,U);return j8(J,Z,z,B,U),f5(J,Z,Q,U)}catch{return D}}setupFunctions(){this.supportedOperations=new Map,Object.keys(M5).forEach((D)=>{this.supportedOperations.set(D,M5[D])}),this.functionNames=null;let G=this.gos.get("formulaFuncs");if(G)Object.keys(G).forEach((D)=>{this.supportedOperations.set(D.toUpperCase(),G[D].func)})}getFunctionNames(){if(this.functionNames)return this.functionNames;let G=[];for(let D of this.supportedOperations.keys()){if(!tB(D[0]))continue;if(![...D].every((z)=>L0(z)))continue;G.push(D)}return G.sort((D,z)=>D.localeCompare(z)),this.functionNames=G,G}setupColRefMap(){if(!this.active){this.colRefMap=new Map;return}let G="abcdefghijklmnopqrstuvwxyz",D=G.length,z=this.beans.colModel.getCols(),B=new Map,Q=0;z?.forEach((J)=>{if(!J.isPrimary())return;let U="",Z=Q++;while(!0){if(U=G[Z%D]+U,Z{let U=G.get(Q);if(U?.has(J))throw new T(51);if(!U)U=new Set,G.set(Q,U);U.add(J)},z=(Q,J)=>{let U=G.get(Q);if(U){if(U.delete(J),U.size===0)G.delete(Q)}},B=(Q)=>{for(let[J,U]of G)for(let Z of U)this.ensureCellFormula(J,Z)?.setError(Q)};return this.activeCtx={setVisited:z,setVisiting:D,errorAllVisitors:B}}makeFormulaFrame(G){let z=this.ensureCellFormula(G.row,G.column).getAst();if(!z)throw new T(52);let B=Gj(this.beans,z,this.ensureCellFormula.bind(this));return{address:G,ast:z,unresolvedDepIterator:B}}resolveValue(G,D){let z=this.ensureCellFormula(D,G);if(!z)return this.fetchRawValue(G,D);if(z.isValueReady())return z.getValue();let B=!!this.activeCtx,{setVisited:Q,setVisiting:J,errorAllVisitors:U}=this.getVisitorContext(),Z=[];try{J(D,G),Z.push(this.makeFormulaFrame({row:D,column:G}));while(Z.length){let{address:S,ast:X,unresolvedDepIterator:Y}=Z[Z.length-1],{row:W,column:q}=S,H=this.ensureCellFormula(W,q);if(H.isValueReady()){if(Z.pop(),Q(W,q),H.error)throw H.error;continue}let _=Y.next();if(!_.done){let f=_.value,N=this.ensureCellFormula(f.row,f.column);if(!N||N.isValueReady())continue;J(f.row,f.column),Z.push(this.makeFormulaFrame(f));continue}let k=C8(this.beans,X,(f)=>{let N=this.ensureCellFormula(f.row,f.column);if(N){if(!N.isValueReady())throw new T(53);let F=N.getError();if(F)throw F;return N.getValue()}return this.fetchRawValue(f.column,f.row)},{row:W,column:q}),w=this.coerceFormulaValue(q,k),K=H.getError();if(K)throw Q(W,q),K;H.setComputedValue(w),Q(W,q),Z.pop()}if(!z.isValueReady())throw new T(53);return z.getValue()}catch(S){let X=S instanceof T?S:new T(String(S?.message??S));return U(X),X.type}finally{if(!B)this.activeCtx=null}}},g8={moduleName:"Formula",version:j,userComponents:{agFormulaCellEditor:ku},beans:[jj,Fu,Iu],dependsOn:[bJ],css:[wu]},gj=".ag-sparkline-wrapper{height:100%;line-height:normal;position:absolute;top:0;width:100%}",R1=Symbol("WrappedFunctionMarker"),R5=(G,D)=>{if(G[R1])return G;let z=(...B)=>D(G,...B);return z[R1]=R1,z},ij="Sparkline - ${chartType} displaying ${count} values between ${min} and ${max}. Starts at ${start} and ends at ${end}.",nj="Sparkline - ${chartType} displaying 1 value, ${value}.",dj="Sparkline - ${chartType} displaying no values.",lj=(G,D)=>{let z=D?.type??"line";switch(z){case"line":return G("lineChart","Line");case"area":return G("areaChart","Area");case"bar":return G("barChart","Bar");default:return z}},pj=(G,D)=>{let z=0,B=Number.POSITIVE_INFINITY,Q=Number.NEGATIVE_INFINITY,J,U;for(let Z of G){let S=oj(Z,D);if(S==null)continue;if(J==null)J=S;U=S,z++,B=Math.min(B,S),Q=Math.max(Q,S)}return z===0?{count:z}:{count:z,min:B,max:Q,start:J,end:U}};function mj(G){let{translate:D,chartType:z,summary:B,formatNumber:Q}=G,J,U,Z,S;if(!tj(B))J="ariaSparklineChartDescriptionEmpty",U=dj,Z=[z],S={chartType:z};else if(B.count===1){let X=Q(B.start);J="ariaSparklineChartDescriptionSingleValue",U=nj,Z=[z,X],S={chartType:z,value:X}}else{let[X,Y,W,q,H]=[B.count,B.min,B.max,B.start,B.end].map(Q);J="ariaSparklineChartDescription",U=ij,Z=[z,X,Y,W,q,H],S={chartType:z,count:X,min:Y,max:W,start:q,end:H}}return{template:D(J,U,Z),values:S}}var tj=(G)=>G.count>0&&G.min!=null&&G.max!=null&&G.start!=null&&G.end!=null,sj=(G,D)=>G.replace(/\$\{([^}]+)\}/g,(z,B)=>D[B]??z),oj=(G,D)=>{if(typeof G==="number")return Number.isFinite(G)?G:null;if(G&&typeof G==="object"){let z=Array.isArray(G)?G[1]:G[D];return typeof z==="number"&&Number.isFinite(z)?z:null}return null};function rj(G){return{content:`${G.xValue} ${G.yValue}`}}function aj(G){return{content:`${G.yValue}`}}var C5="ag-sparkline",ej=class extends Tj{constructor(){super({tag:"div",cls:`${C5}-wrapper`,children:[{tag:"span",ref:"eSparkline"}]});this.eSparkline=yj,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(G=!0){return()=>this.updateSize(this.params?.column?.getActualWidth()??0,(this.params?.node.rowHeight??0)-2,G)}initGridObserver(){let G=this.createListener(),D=this.createListener(!1),z=this.params?.column,B=this.params?.node;z.__addEventListener("columnStateUpdated",G),B.__addEventListener("heightChanged",G),this.addDestroyFunc(()=>{z.__removeEventListener("columnStateUpdated",G),B.__removeEventListener("heightChanged",G)}),D()}updateSize(G,D,z=!0){if(G-=this.env.getCellPadding(),G!==this.cachedWidth||D!==this.cachedHeight){this.cachedWidth=G,this.cachedHeight=D;let B=this.refresh.bind(this);if(z)xj(()=>this.isAlive()&&B());else B()}}init(G){this.params=G;let{eParentOfValue:D}=G,z=`${C5}-cell-renderer-${this.getCompId()}`;this.getGui().setAttribute("id",z),A5(D,z),this.addDestroyFunc(()=>A5(D)),this.initGridObserver()}refresh(G=this.params){var D;this.params=G;let z=this.processData(G?.value);this.refreshAriaLabel(z);let B=this.cachedWidth,Q=this.cachedHeight,J=this.gos.get("styleNonce");if(!this.sparklineInstance&&G&&B>0&&Q>0){if(this.sparklineOptions={container:this.eSparkline,width:B,height:Q,...G.sparklineOptions,...J?{styleNonce:J}:{},data:z},(D=this.sparklineOptions).type??(D.type="line"),this.sparklineOptions.tooltip?.renderer)this.wrapTooltipRenderer();else{let Z=this.getDefaultTooltipRenderer();this.sparklineOptions.tooltip={...this.sparklineOptions.tooltip,renderer:Z}}let U=this.sparklineOptions?.theme;if(this.sparklineOptions.type==="bar"&&this.sparklineOptions.itemStyler)this.wrapItemStyler(this.sparklineOptions);else if(U?.overrides?.bar?.series?.itemStyler)this.wrapItemStyler(U.overrides.bar.series);return this.sparklineInstance=G.createSparkline(this.sparklineOptions),!0}else if(this.sparklineInstance)return this.sparklineInstance.update({...this.sparklineOptions,data:z,width:B,height:Q,...J?{styleNonce:J}:{}}),!0;return!1}refreshAriaLabel(G){let D=this.getLocaleTextFunc(),z=this.getLocaleTextFunc.bind(this),B=this.params?.sparklineOptions?.yKey??this.sparklineOptions?.yKey??"y",Q=pj(G,B),J=this.params?.sparklineOptions??this.sparklineOptions,{template:U,values:Z}=mj({translate:D,chartType:lj(D,J),summary:Q,formatNumber:(S)=>cj(S,z)});hj(this.getGui(),sj(U,Z))}processData(G){if(!G?.length)return G??[];if(this.dataRef!==G)this.dataRef=G,this.processedData=Array.isArray(G[0])?G.filter((D)=>D!=null):G;return this.processedData}createContext(){return{data:this.params?.data,cellData:this.params?.value}}getDefaultTooltipRenderer(G){let D=G?.title,z=this.sparklineOptions.xKey,B=Array.isArray(this.sparklineOptions.data?.[0]);return!D&&(z||B)?rj:aj}wrapItemStyler(G){G.itemStyler=R5(G.itemStyler,(D,z)=>{return D({...z,context:this.createContext()})})}wrapTooltipRenderer(){this.sparklineOptions.tooltip={...this.sparklineOptions.tooltip,renderer:R5(this.sparklineOptions.tooltip.renderer,(G,D)=>{let z=G({...D,context:this.createContext()});if(typeof z==="string")return z;return{...this.getDefaultTooltipRenderer(z)(D),...z}})}}destroy(){super.destroy(),this.sparklineInstance?.destroy()}},V5="Sparklines",T8={moduleName:V5,version:j,dependsOn:[i],validate:()=>{return{isValid:!1,message:Pj(258)}},with:(G)=>{return G.setup(),{moduleName:V5,version:j,dependsOn:[i],css:[gj],userComponents:{agSparklineCellRenderer:{classImp:ej,params:{createSparkline:G.createSparkline}}},validate:()=>{return{isValid:!0}}}}},GP=".ag-find-cell{display:block;overflow:hidden;text-overflow:ellipsis}.ag-find-match{background-color:var(--ag-find-match-background-color);color:var(--ag-find-match-color)}.ag-find-active-match{background-color:var(--ag-find-active-match-background-color);color:var(--ag-find-active-match-color)}";function DP(G){G.findSvc?.next()}function zP(G){G.findSvc?.previous()}function BP(G){return G.findSvc?.totalMatches??0}function QP(G,D,z){G.findSvc?.goTo(D,z)}function JP(G){G.findSvc?.clearActive()}function UP(G){return G.findSvc?.activeMatch}function ZP(G,D){let{node:z,column:B}=D;return G.findSvc?.getNumMatches(z,B)??0}function $P(G,D){return G.findSvc?.getParts(D)??[]}function LP(G){return G.findSvc?.refresh(!0)}var WP={tag:"span",cls:"ag-find-cell"},qP=class extends SP{constructor(){super(WP)}init(G){this.refresh(G)}refresh(G){let{node:D,column:z}=G,{findSvc:B,valueSvc:Q}=this.beans,{value:J,valueFormatted:U}=Q.getValueForDisplay({column:z,node:D,includeValueFormatted:!0,from:"edit"}),Z=U??J??"",S=this.getGui();XP(S);let X=B?.getParts({value:Z,node:D,column:z??null});if(!X)S.textContent=b5(Z)??"",S.classList.remove("ag-find-cell-active-match");else{let Y=!1;for(let{value:W,match:q,activeMatch:H}of X){let _=b5(W)??"";if(q){let k=YP({tag:"mark",cls:"ag-find-match"});if(k.textContent=_,H)k.classList.add("ag-find-active-match"),Y=!0;S.appendChild(k)}else S.appendChild(document.createTextNode(_))}S.classList.toggle("ag-find-cell-active-match",Y)}return!0}};function u5(G){return G?.toLocaleLowerCase()}function lz(G,D,z){let B=D(y8(z)),Q=0;if(B?.length){let J=-1;while(!0)if(J=B.indexOf(G,J+1),J!=-1)Q++;else break}return Q}var fP=class extends HP{constructor(){super(...arguments);this.beanName="findSvc",this.active=!1,this.topMatches=new Map,this.topNodes=[],this.topNumMatches=0,this.centerMatches=new Map,this.centerNodes=[],this.centerNumMatches=0,this.bottomMatches=new Map,this.bottomNodes=[],this.caseFormat=u5,this.scrollOnRefresh=!1,this.totalMatches=0}postConstruct(){if(!O5(this.gos))return;let G=this.refresh.bind(this,!1),D=this.refresh.bind(this,!0),z=_P(this,()=>{if(this.isAlive())D()},0);this.refreshDebounced=z,this.addManagedPropertyListener("findSearchValue",G),this.addManagedPropertyListener("findOptions",({currentValue:Q,previousValue:J})=>{if(!wP(Q,J))G()}),this.addManagedPropertyListeners(["groupSuppressBlankHeader","showOpenedGroup"],D),this.addManagedEventListeners({modelUpdated:D,displayedColumnsChanged:D,pinnedRowDataChanged:D,cellValueChanged:z,rowNodeDataChanged:z,cellEditingStopped:z,cellEditValuesChanged:z,batchEditingStopped:z});let B=this.beans.rowSpanSvc;if(B)this.addManagedListeners(B,{spannedCellsUpdated:z});G()}next(){this.findAcrossContainers(!1,["top",null,"bottom"],1,1)}previous(){this.findAcrossContainers(!0,["bottom",null,"top"],this.totalMatches,-1)}goTo(G,D){if(!D&&G===this.activeMatch?.numOverall)return;let{topMatches:z,topNumMatches:B,centerMatches:Q,centerNumMatches:J,bottomMatches:U}=this;if(G<=B){this.goToInContainer(z,G,0);return}if(G<=J){this.goToInContainer(Q,G,B);return}this.goToInContainer(U,G,B+J)}clearActive(){if(this.activeMatch)this.setActive(void 0)}isMatch(G,D){return this.active&&!!this.getMatches(G.rowPinned).get(G)?.some(([z])=>z===D)}getNumMatches(G,D){return this.getMatches(G.rowPinned).get(G)?.find(([z])=>z===D)?.[1]??0}getParts(G){let{value:D,node:z,column:B,precedingNumMatches:Q}=G,J=this.findSearchValue,U=y8(D)??"";if(C1(J))return[{value:U}];let Z=this.caseFormat(U)??"",S=this.getActiveMatchNum(z,B)-(Q??0),X=0,Y=0,W=J.length,q=[];while(!0){let H=Z.indexOf(J,X);if(H!=-1){if(Y++,H>X)q.push({value:U.slice(X,H)});let _=H+W;q.push({value:U.slice(H,_),match:!0,activeMatch:Y===S}),X=_}else{if(Xz.get("findOptions")?.searchDetail,Q=(J)=>{let Z=this.centerMatches.get(G)?.[0]?.[1]??0;if(J!==Z)this.refreshDebounced()};if(D.addEventListener("findChanged",(J)=>{if(D.isDestroyed()||!this.isAlive()||!this.active||!B())return;Q(J.totalMatches)}),D.addEventListener("gridPreDestroyed",()=>{if(!this.isAlive()||!this.active||!B())return;let J=G.parent,U=this.findSearchValue;if(!J||!U)return;let Z=z.get("detailCellRendererParams")?.getFindMatches?.({node:J,data:J.data,findSearchValue:z.get("findSearchValue"),updateMatches:this.refreshDebounced,getMatchesForValue:(S)=>lz(U,this.caseFormat,S)})??0;Q(Z)}),B())D.setGridOption("findSearchValue",z.get("findSearchValue"))}refresh(G){let D=new Set([...this.topNodes,...this.centerNodes,...this.bottomNodes]);this.topNodes=[],this.centerNodes=[],this.bottomNodes=[];let{topNodes:z,topMatches:B,centerMatches:Q,centerNodes:J,bottomNodes:U,bottomMatches:Z,beans:{gos:S,visibleCols:X,rowModel:Y,valueSvc:W,pinnedRowModel:q,pagination:H,rowSpanSvc:_,masterDetailSvc:k,colModel:w},findSearchValue:K}=this,f=S.get("findOptions"),N=f?.caseSensitive?(y)=>y??void 0:u5;this.caseFormat=N;let F=S.get("findSearchValue"),E=N(F?.trim());this.findSearchValue=E,B.clear(),Q.clear(),Z.clear();let I=G?this.activeMatch:void 0;this.activeMatch=void 0;let V=S.get("masterDetail")&&f?.searchDetail&&k;if(C1(E)){if(this.active=!1,this.topNumMatches=0,this.centerNumMatches=0,this.totalMatches=0,this.refreshRows(D),V){let y=k.store;for(let _D of Object.keys(y))y[_D]?.api?.findClearActive()}if(!C1(K))this.dispatchFindChanged();return}let A=X.allCols,R=S.getCallback("isFullWidthRow"),O=S.get("detailCellRendererParams"),u=S.get("fullWidthCellRendererParams"),v=S.get("groupRowRendererParams"),h=c7(S),P=w.isPivotMode(),b=0,g,c,s=!1,m=(y,_D,sG,GQ)=>{if(!sG)return;let n=g.get(y);if(!n){if(n=[],g.set(y,n),c.push(y),!GQ)D.add(y)}n.push([_D,sG]),b+=sG},zG=(y)=>{if(s){let{rowIndex:n,parent:GG}=y;while(n==null&&GG)n=GG.rowIndex,GG=GG.parent;if(n==null||!H.isRowInPage(n))return}let _D=y.hasChildren();if(!n7(h,y,_D,P,h7(h,y,_D),i7(h,y,_D)))return;let sG=y.data;if(R?.({rowNode:y})){if(u){let n=u.getFindMatches?.({node:y,data:sG,findSearchValue:F,updateMatches:this.refreshDebounced,getMatchesForValue:(GG)=>lz(E,N,GG)})??0;m(y,null,n)}return}if(kP(S,y,P)){let n,GG=v?.getFindText;if(GG){let gD=W.getValueForDisplay({node:y,from:"batch"}).value;n=GG(v5(S,{value:gD,node:y,data:sG,column:null,colDef:null,getValueFormatted:()=>{let{valueFormatted:TD}=W.getValueForDisplay({node:y,includeValueFormatted:!0,from:"batch"});return TD}}))}else{let{value:gD,valueFormatted:TD}=W.getValueForDisplay({node:y,includeValueFormatted:!0,from:"batch"});n=TD??gD}let yG=lz(E,N,n);m(y,null,yG);return}let GQ=y.level>0&&S.get("groupHideOpenParents")&&y.parent?.getFirstChild()===y&&!y.parent?.expanded;for(let n of A){if(KP(n))continue;let GG=_?.getCellSpan(n,y);if(GG&&GG.firstNode!==y)continue;if(n.colDef.showRowGroup&&GQ)continue;let yG,gD=n.colDef,TD=gD.getFindText;if(TD){let DQ=W.getValueForDisplay({column:n,node:y,from:"batch"}).value;yG=TD(v5(S,{value:DQ,node:y,data:sG,column:n,colDef:gD,getValueFormatted:()=>{let{valueFormatted:zQ}=W.getValueForDisplay({column:n,node:y,includeValueFormatted:!0,from:"batch"});return zQ}}))}else{let{value:DQ,valueFormatted:zQ}=W.getValueForDisplay({column:n,node:y,includeValueFormatted:!0,from:"batch"});yG=zQ??DQ}let P9=lz(E,N,yG);m(y,n,P9)}if(y.master&&V){let n=y.detailNode;if(n){let GG=n.detailGridInfo?.api;if(GG){GG.setGridOption("findSearchValue",F);let yG=GG.findGetTotalMatches();m(n,null,yG);return}}if(O){let GG=O.getFindMatches?.({node:y,data:sG,findSearchValue:F,updateMatches:this.refreshDebounced,getMatchesForValue:(yG)=>lz(E,N,yG)})??0;m(n??{parent:y,dummy:!0},null,GG,!n)}}};g=B,c=z,q?.forEachPinnedRow("top",zG),this.topNumMatches=b;let fG=b;if(g=Q,c=J,b=0,s=!!H&&!!f?.currentPageOnly,Y.forEachNodeAfterFilterAndSort(zG,!0),this.centerNumMatches=b,fG+=b,g=Z,c=U,b=0,s=!1,q?.forEachPinnedRow("bottom",zG),fG+=b,this.totalMatches=fG,this.active=!0,this.refreshRows(D),I)this.resetActiveMatch(I);this.dispatchFindChanged()}resetActiveMatch(G){let{column:D,numInMatch:z}=G,B=G.node;if(B.dummy){let X=B.parent?.detailNode;if(!X)return;B=X}let Q=B.rowPinned??null;if(!this.getMatches(Q)?.get(B)?.some(([X,Y])=>X===D&&Y>=z))return;let U=0;if(Q==null)U=this.topNumMatches;else if(Q==="bottom")U=this.topNumMatches+this.centerNumMatches;(()=>{let X=this.getMatches(Q);for(let Y of X.keys()){let W=Y===B,q=X.get(Y);for(let[H,_]of q){if(W&&H===D){U+=z;return}U+=_}}})();let S={...G,node:B,numOverall:U};if(this.activeMatch=S,this.refreshRows(new Set([B]),D==null?void 0:new Set([D])),this.scrollOnRefresh)this.scrollOnRefresh=!1,this.scrollToActive(S);this.setDetailActive(S)}refreshRows(G,D){if(!G.size)return;this.beans.rowRenderer.refreshCells({rowNodes:[...G],columns:D?[...D]:void 0,force:!0,suppressFlash:!0})}findAcrossContainers(G,D,z,B){if(!this.totalMatches){this.setActive();return}let Q=this.activeMatch,J=D;if(Q){let{column:U,node:Z,numInMatch:S,numOverall:X}=Q,Y=Z.rowPinned??null,W=X+B;if(this.findInContainer(Y,G,W,Z,U,S))return;let H=D.indexOf(Y),_=D.length;if(D.slice(H+1,_).some((w)=>this.findInContainer(w,G,W)))return;J=D.slice(0,H+1)}J.some((U)=>this.findInContainer(U,G,z))}findInContainer(G,D,z,B,Q,J){let U=this.getMatches(G),Z=this.getRowNodes(G),S=D?-1:1;if(B!=null){let q=U.get(B),H=q?.findIndex(([k])=>k===Q);if(H!=null&&H!=-1){let[k,w]=q[H];if(D?J>1:JH===B);X=Z[q+S]}if(X==null)return!1;let Y=U.get(X),W=Y?.[D?Y.length-1:0];if(W){let[q,H]=W;return this.setActive({column:q,node:X,numInMatch:D?H:1,numOverall:z}),!0}return!1}dispatchFindChanged(){let{eventSvc:G,activeMatch:D,totalMatches:z,findSearchValue:B}=this;G.dispatchEvent({type:"findChanged",activeMatch:D,totalMatches:z,findSearchValue:B})}setActive(G){if(G&&G.node.rowIndex==null){let z=G.node,B=z.footer?z.sibling:z.parent;while(B&&B.level!==-1)B.expanded=!0,B=B.parent;this.activeMatch=G,this.scrollOnRefresh=!0,this.beans.expansionSvc?.onGroupExpandedOrCollapsed();return}let D=this.activeMatch;if(this.activeMatch=G,this.refreshAndScrollToActive(G,D),G)this.setDetailActive(G);this.dispatchFindChanged()}setDetailActive({node:G,numInMatch:D}){if(G.detail)G.detailGridInfo?.api?.findGoTo(D)}refreshAndScrollToActive(G,D){if(G||D){let z=new Set,B=new Set,Q=!1,J=(U)=>{if(!U)return;let{node:Z,column:S}=U;if(z.add(Z),S==null)Q=!0;else B.add(S)};J(G),J(D),this.refreshRows(z,Q?void 0:B)}if(G)this.scrollToActive(G)}scrollToActive({node:{rowPinned:G,rowIndex:D},column:z}){let{ctrlsSvc:B,pagination:Q,gos:J}=this.beans,U=B.getScrollFeature();if(G==null&&D!=null){if(Q&&!J.get("findOptions")?.currentPageOnly&&!Q.isRowInPage(D))Q.goToPageWithIndex(D);U.ensureIndexVisible(D)}U.ensureColumnVisible(z)}goToInContainer(G,D,z){let B=z;for(let Q of G.keys()){let J=G.get(Q);for(let[U,Z]of J){if(D<=B+Z){this.setActive({column:U,node:Q,numInMatch:D-B,numOverall:D});return}B+=Z}}}getMatches(G){if(G==="top")return this.topMatches;else if(G==="bottom")return this.bottomMatches;else return this.centerMatches}getRowNodes(G){if(G==="top")return this.topNodes;else if(G==="bottom")return this.bottomNodes;else return this.centerNodes}getActiveMatchNum(G,D){let z=this.activeMatch;return z!=null&&z.node===G&&z.column===D?z.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()}},NP={moduleName:"FindCore",version:j,rowModels:["clientSide"],beans:[fP],userComponents:{agFindCellRenderer:qP},css:[GP]},x8={moduleName:"Find",version:j,apiFunctions:{findGetTotalMatches:BP,findGoTo:QP,findNext:DP,findPrevious:zP,findGetActiveMatch:UP,findGetNumMatches:ZP,findGetParts:$P,findClearActive:JP,findRefresh:LP},dependsOn:[i,NP]};function MP({editSvc:G,gos:D,rowModel:z}){if(!EP(D,z)){IP(289,{rowModelType:D.get("rowModelType")});return}G?.startBatchEditing()}function AP({editSvc:G}){G?.stopBatchEditing({cancel:!0,source:"api",forceCancel:!0})}function RP({editSvc:G}){G?.stopBatchEditing({source:"api",forceStop:!0,commit:!0})}function CP(G){return G.editSvc?.isBatchEditing()??!1}var c8={moduleName:"BatchEdit",version:j,beans:[],apiFunctions:{isBatchEditing:CP,startBatchEdit:MP,cancelBatchEdit:AP,commitBatchEdit:RP},dependsOn:[FP,i],css:[]},VB=(G,D)=>{if(D===!1||D===null)return!1;if(h8(G))return D==="overwrite"?"overwrite":!1;if(typeof D==="string")return D;if(G==="sum")return"uniform";if(G==="avg"||G==null)return"overwrite";return D===!0?"overwrite":!1},h8=(G)=>G==="count"||G==="min"||G==="max"||G==="first"||G==="last",bP=(G)=>G==="sum"||G==="avg",VG=(G)=>{if(typeof G==="number")return G;if(typeof G==="bigint"||typeof G==="string"){let D=Number(G);return Number.isFinite(D)?D:0}if(typeof G==="boolean")return G?1:0;if(G!=null&&typeof G==="object"){if(typeof G.toNumber==="function")return VG(G.toNumber());if("value"in G)return VG(G.value)}return 0},j5=(G)=>Number.isFinite(G)?BigInt(Math.round(G)):0n,eD=(G)=>{if(typeof G==="bigint")return G;if(typeof G==="number")return j5(G);if(typeof G==="boolean")return G?1n:0n;if(typeof G==="string")try{return BigInt(G)}catch{return j5(Number(G))}if(G!=null&&typeof G==="object"){if(typeof G.toNumber==="function")return eD(G.toNumber());if("value"in G)return eD(G.value)}return 0n},xJ=(G)=>{let D=typeof G;if(D==="number"||D==="bigint"||D==="boolean")return!0;if(D==="string")return Number.isFinite(Number(G));if(G!=null&&D==="object"){if(typeof G.toNumber==="function")return!0;if("value"in G)return xJ(G.value)}return!1},vP=(G)=>{if(G.cellDataType==="bigint")return 0;let D=G.cellEditorParams;if(D==null||typeof D!=="object")return;let z=D.precision;if(typeof z==="number"&&Number.isInteger(z)&&z>=0)return z;let B=D.step;if(typeof B==="number"&&Number.isInteger(B))return 0;return},OP=class{constructor(G,D,z){this.params=G;let{aggregatedChildren:B,column:Q,newValue:J}=G,U=eD(J),Z=eD(G.oldValue),S=B.length,X=BigInt(S);if(this.children=B,this.column=Q,this.count=S,this.bigCount=X,this.newValue=J,this.strategy=VB(z,D?.distribution),z==="avg")this.target=U*X,this.oldTarget=Z*X;else this.target=U,this.oldTarget=Z;this.getVal=D?.getValue,this.setVal=D?.setValue}run(){let{strategy:G,newValue:D}=this;if(G===!1)return!1;if(G==="overwrite")return this.writeAll(D);let{target:z,oldTarget:B}=this;if(z===0n&&!xJ(D))return this.writeAll(D);if(G==="increment"&&z===B)return!1;if(G==="uniform")return this.writeUniformDirect(z);if(G==="increment")return this.writeIncrementDirect(z-B);return this.writePercentage()}readOne(G){let{children:D,column:z,getVal:B}=this,Q=D[G];if(B){let{colDef:J,api:U,context:Z}=this.params;return eD(B({node:Q,data:Q.data,column:z,colDef:J,api:U,context:Z,groupParams:this.params}))}return eD(Q.getDataValue(z,"value"))}writeOne(G,D){let{children:z,column:B,setVal:Q}=this,J=z[G];if(Q){let{colDef:U,api:Z,context:S}=this.params;return Q({node:J,data:J.data,column:B,colDef:U,api:Z,context:S,groupParams:this.params,value:D})}return J.setDataValue(B,D,"data")}writeAll(G){let{count:D}=this,z=!1;for(let B=0;B=0n?1n:-1n,Z=!1;for(let S=0;S=0n?1n:-1n,Z=!1;for(let S=0;S0n&&Z=0?Y:void 0;else this.precision=vP(J);this.getVal=D?.getValue,this.setVal=D?.setValue}run(){let{strategy:G,newValue:D}=this;if(G===!1)return!1;if(G==="overwrite")return this.writeAll(D);if(this.target===0&&!xJ(D))return this.writeAll(D);if(G==="increment"&&this.target===this.oldTarget)return!1;switch(G){case"uniform":return this.distributeUniform();case"increment":return this.distributeIncrement();default:return this.isAvg?this.distributePercentageAvg():this.distributePercentage()}}readOne(G){let{column:D,getVal:z}=this;if(z){let{colDef:B,api:Q,context:J}=this.params;return VG(z({node:G,data:G.data,column:D,colDef:B,api:Q,context:J,groupParams:this.params}))}return VG(G.getDataValue(D,"value"))}readValueAndCount(G){let{column:D,getVal:z}=this,B;if(z){let{colDef:Q,api:J,context:U}=this.params;B=z({node:G,data:G.data,column:D,colDef:Q,api:J,context:U,groupParams:this.params})}else B=G.getDataValue(D);if(G.group){if(B!=null&&typeof B==="object"){let{value:Q,count:J}=B;if(Q!=null&&typeof J==="number"&&J>0)return typeof Q==="number"?B:{value:VG(Q),count:J}}return{value:VG(B),count:G.allLeafChildren?.length||1}}return{value:VG(B),count:1}}writeOne(G,D){let{column:z,setVal:B}=this;if(B){let{colDef:Q,api:J,context:U}=this.params;return B({node:G,data:G.data,column:z,colDef:Q,api:J,context:U,groupParams:this.params,value:D})}return G.setDataValue(z,D,"data")}writeAll(G){let{children:D,count:z}=this,B=!1;for(let Q=0;Q=0?1:-1,Y=!1;for(let W=0;W=0?1:-1,W=!1;for(let q=0;q=0?1:-1,q=!1;for(let H=0;H=0?1:-1,k=!1;for(let w=0;w{let{aggregatedChildren:z,colDef:B}=G;if(z.length===0)return!1;let Q=B.aggFunc??null,J=n8(D,Q);if(J===!1)return!1;if(typeof J==="function")return J(G)??!0;if(B.cellDataType==="bigint")return new OP(G,J,Q).run();return new uP(G,J,Q).run()};function n8(G,D){if(!G)return;let z=G.distribution;if(z===!1||z===null)return!1;let B=h8(D),Q=G.default;if(typeof z==="object"){let J=typeof D==="string"?z[D]:void 0;if(J!==void 0)return V1(J,B,G);if(B)return!1;return V1(Q,!1,G)??DJ(G)}if(B)return z==="overwrite"?DJ(G,"overwrite"):!1;if(z===void 0&&!bP(D)){let J=V1(Q,!1,G);if(J!==void 0)return J}return G}function V1(G,D,z){if(G===!1||G===null)return!1;if(G===void 0)return;if(typeof G==="function")return G;if(typeof G==="object"){let B=G.distribution;if(D&&B!=="overwrite"&&B!==!0)return!1;let{precision:Q,getValue:J,setValue:U}=z;return{distribution:D?"overwrite":B,precision:G.precision??Q,getValue:G.getValue??J,setValue:G.setValue??U}}if(D&&G!=="overwrite"&&G!==!0)return!1;return DJ(z,D?"overwrite":G)}function DJ(G,D){return{distribution:D,precision:G.precision,getValue:G.getValue,setValue:G.setValue}}var jP=class extends VP{constructor(){super(...arguments);this.beanName="rowGroupingEditValueSvc"}isGroupCellEditable(G,D){let z=D.getColDef();if(!D.isColumnFunc(G,z.groupRowEditable))return!1;let B=z.groupRowValueSetter;if(typeof B==="function")return!0;let Q=z.aggFunc??null;if(typeof B==="object"){let J=n8(B,Q);return typeof J==="function"||J!==!1&&VB(Q,J?.distribution)!==!1}return VB(Q,B??void 0)!==!1}setGroupDataValue(G,D,z,B,Q,J){let U=D.getColDef(),Z=U.groupRowValueSetter;if(Z==null){let Y=U.groupRowEditable;Z=Y&&D.isColumnFunc(G,Y)?!0:void 0}if(!Z)return;let S=this.gos.addCommon({node:G,data:G.data,oldValue:B,newValue:z,colDef:U,column:D,eventSource:Q,valueChanged:J,aggregatedChildren:this.beans.aggChildrenSvc?.getAggregatedChildren(G,D)??[]});return(typeof Z==="function"?Z(S):i8(S,Z===!0?void 0:Z))??!0}},d8={moduleName:"RowGroupingEdit",version:j,beans:[jP],dependsOn:[i,CJ]},yP=class extends TP{constructor(G){super();this.beanName="agChartsExports",this.isEnterprise=!1,this.create=G.create,this._Theme=G._Theme,this._Scene=G._Scene,this.isEnterprise=G.isEnterprise,this._Util=G._Util}};function P5(G){if(G.chart!=null)return G.chart;return G}var hP=new Set(["__proto__","constructor","prototype"]);function $D(G,D,z){if(G==null)return z;let B=D.split("."),Q=G;while(B.length>1)if(Q=Q[B.shift()],Q==null)return z;let J=Q[B[0]];return J!=null?J:z}function iP(G,D,z){if(G==null)return;let B=D.split("."),Q=G;B.filter((J)=>!hP.has(J)).forEach((J,U)=>{if(!Q[J])Q[J]={};if(U{let N=(F)=>{if(!F)return!1;return Object.keys(F).some((E)=>$D(F[E],"title.enabled",!1))};return N(q)||N(H)})()):void 0,Zg(),B,k,q,H,{...J??{}},Q].filter((N)=>!!N).reduce((N,F)=>({baseTheme:N,overrides:F}),W);if(U&&X===Z){let N=G.agChartsExports._Theme.getChartTheme(W).palette;if(!Bg(U,N))f.palette=U}return f}function Bg(G,D){let z=(B,Q)=>{if(B===Q)return!0;if(B?.length!==Q?.length)return!1;return B?.every((J,U)=>J===Q?.[U])??!1};return z(G.fills,D.fills)&&z(G.strokes,D.strokes)}function iJ(G,D){return Object.keys(D.themes).includes(G)}function Qg(G,D,z){let Q={tooltip:{delay:500},legend:{listeners:{legendItemClick:(U)=>{let Z=G.getChart(),S=[U.seriesId,`${U.seriesId}-filtered-out`];for(let X of Z.series.filter((Y)=>S.includes(Y.id)))X.toggleSeriesItem(void 0,"category",U.itemId,void 0)}}},listeners:{click:(U)=>D.crossFilterCallback(U,!0)}};if(z==="pie"||z==="donut")return{[z]:{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"}]}]}},...Q}};let J={};if(z!=="line")J.fill={$if:[{$isEven:[{$value:"$index"}]},{$palette:"fill"},{$mix:[{$path:["../$prevIndex/fill",{$palette:"fill"}]},{$ref:"backgroundColor"},0.7]}]};return{[z]:{series:{stroke:{$if:[{$isEven:[{$value:"$index"}]},{$palette:"stroke"},{$mix:[{$path:["../$prevIndex/fill",{$palette:"stroke"}]},{$ref:"backgroundColor"},0.7]}]},...J},...Q}}}var Jg=o8.reduce((G,D)=>({...G,[D]:{title:{_enabledFromTheme:!0}}}),{});function Ug(G,D,z){let B=G.getExtraPaddingDirections();return{common:{...D?{animation:{duration:500}}:void 0,axes:Jg,padding:{top:!z&&B.includes("top")?40:20,right:B.includes("right")?30:20,bottom:B.includes("bottom")?40:20,left:B.includes("left")?30:20}}}}function Zg(){return{pie:{series:{title:{_enabledFromTheme:!0},calloutLabel:{_enabledFromTheme:!0},sectorLabel:{enabled:!1,_enabledFromTheme:!0}}},donut:{series:{title:{_enabledFromTheme:!0},calloutLabel:{_enabledFromTheme:!0},sectorLabel:{enabled:!1,_enabledFromTheme:!0}}}}}function $g(G){let D=G.getChartThemeName(),z=G.getChartThemes();if(!z.includes(D))D=z[0];return D}function r8(G,D){let{customChartThemes:z}=G,B=z?.[D];if(!B)Gg(140,{name:D});return B}function nJ(G,D){let z={highlightedItem:{strokeWidth:2}};if(!D)z.unhighlightedSeries={opacity:1};if(!G)z.unhighlightedItem={opacity:1};return z}var qz=class{constructor(G){if(this.chartProxyParams=G,this.clearThemeOverrides=!1,this.agChartsExports=G.agChartsExports,this.chart=G.chartInstance,this.chartType=G.chartType,this.crossFiltering=G.crossFiltering,this.crossFilterCallback=G.crossFilterCallback,this.standaloneChartType=l(this.chartType),this.chart==null)this.chart=G.agChartsExports.create(this.getCommonChartOptions());else this.clearThemeOverrides=!0}crossFilteringReset(){}update(G){this.getChartRef().update(this.getUpdateOptions(G,this.getCommonChartOptions(G.updatedOverrides)))}updateThemeOverrides(G){this.getChartRef().updateDelta({theme:{overrides:G}})}getChart(){return P5(this.chart)}getChartRef(){return this.chart}downloadChart(G,D,z){let{chart:B}=this,Q=P5(B),J=D||Q.title.node.getPlainText(),{width:U,height:Z}=G||{};B.download({width:U,height:Z,fileName:J,fileFormat:z})}getChartImageDataURL(G){return this.getChart().getCanvasDataURL(G)}getChartOptions(){return this.chart.getOptions()}getChartThemeOverrides(){return this.getChartOptions().theme.overrides??{}}getChartPalette(){return this.agChartsExports._Theme.getChartTheme(this.getChartOptions().theme).palette}setPaired(G){let D=l(this.chartProxyParams.chartType);this.chart.updateDelta({theme:{overrides:{[D]:{paired:G}}}})}isPaired(){let G=l(this.chartProxyParams.chartType);return $D(this.getChartThemeOverrides(),`${G}.paired`,!0)}lookupCustomChartTheme(G){return r8(this.chartProxyParams,G)}getSeriesGroupType(){return}transformCategoryData(G,D){return G.map((z,B)=>{let Q=z[D],J=Q?.toString?Q.toString():"",U={...z};return U[D]={id:B,value:Q,toString:()=>J},U})}getCommonChartOptions(G){let D=this.clearThemeOverrides?{}:this.chart?.getOptions()??{},z=this.chart!=null?this.getActiveFormattingPanelOverrides():void 0;this.clearThemeOverrides=!1;let B=this.chartProxyParams.styleNonce,Q=zg(this.chartProxyParams,this,this.agChartsExports.isEnterprise,this.getChartThemeDefaults(),G??z);return{...D,mode:"integrated",...B?{styleNonce:B}:{},suppressFieldDotNotation:!0,theme:Q,container:this.chartProxyParams.parentElement}}getChartThemeDefaults(){let G={enabled:!0,snap:!0,label:{enabled:!1}},D=this.agChartsExports.isEnterprise?{zoom:{enabled:!0},animation:{enabled:!0,duration:500},axes:{number:{crosshair:G},category:{crosshair:G},log:{crosshair:G},time:{crosshair:G}}}:{};D.minHeight=0,D.minWidth=0,D.navigator={enabled:!1,height:18},D.context=this.chartProxyParams.context;let z={common:D};return this.setSeriesChartThemeDefaults(z),z}setSeriesChartThemeDefaults(G){let D=this.getSeriesChartThemeDefaults();if(!D)return;G[this.standaloneChartType]=D}getSeriesChartThemeDefaults(){return}getActiveFormattingPanelOverrides(){if(this.clearThemeOverrides)return{};return this.chart?.getOptions().theme?.overrides??{}}destroy({keepChartInstance:G=!1}={}){if(G)return this.chart.resetAnimations(),this.chart;this.destroyChart()}destroyChart(){if(this.chart)this.chart.destroy(),this.chart=void 0}},HD=class extends qz{constructor(){super(...arguments);this.crossFilteringAllPoints=new Set,this.crossFilteringSelectedPoints=[],this.isSingleSeries=!1}getUpdateOptions(G,D){let z=this.getAxes(G,D);return{...D,data:this.getData(G,z),axes:z,series:this.getSeries(G)}}getData(G,D){let z=["area","line"].includes(this.standaloneChartType);return this.crossFiltering&&z?this.getCrossFilterData(G):this.getDataTransformedData(G,D)}getDataTransformedData(G,D){let z=D.x.type,{categories:B,data:Q}=G,[J]=B;switch(z){case"category":return this.transformCategoryData(Q,J.id);case"time":return this.transformTimeData(Q,J.id,J.convertTime);default:return Q}}getXAxisType(G){if(G.grouping)return"grouped-category";else if(this.isXAxisOfType(G,"time",(D)=>D instanceof Date))return"time";else if(this.isXAxisOfType(G,"number"))return"number";return"category"}isXAxisOfType(G,D,z){let[B]=G.categories;if(B?.chartDataType)return B.chartDataType===D;if(!z)return!1;let Q=G.data[0];if(!Q)return!1;return z(Q[B.id])}transformTimeData(G,D,z){if(G[0]?.[D]instanceof Date)return G;return G.map((Q)=>{let J=Q[D];return typeof J==="string"?{...Q,[D]:z?z(J):cP(J)}:Q})}crossFilteringReset(){this.crossFilteringSelectedPoints=[],this.crossFilteringAllPoints.clear()}crossFilteringPointSelected(G){return this.crossFilteringSelectedPoints.length==0||this.crossFilteringSelectedPoints.includes(G)}crossFilteringDeselectedPoints(){return this.crossFilteringSelectedPoints.length>0&&this.crossFilteringAllPoints.size!==this.crossFilteringSelectedPoints.length}extractLineAreaCrossFilterSeries(G,D){let[z]=D.categories,B=(Q)=>{if(this.standaloneChartType==="area")return D.getCrossFilteringContext().lastSelectedChartId===D.chartId?Q+"-total":Q;return Q+"-total"};return G.map((Q)=>{if(Q.yKey=B(Q.yKey),Q.listeners={seriesNodeClick:(J)=>{let U=J.datum[Q.xKey],Z=J.event.metaKey||J.event.ctrlKey;this.crossFilteringAddSelectedPoint(Z,U),this.crossFilterCallback(J)}},Q.marker={itemStyler:(J)=>{let U=J.datum[z.id],Z=J.highlightState==="highlighted-item";return{fill:Z?"yellow":J.fill,size:Z?14:this.crossFilteringPointSelected(U)?8:0}}},this.standaloneChartType==="area")Q.fillOpacity=this.crossFilteringDeselectedPoints()?0.3:1;if(this.standaloneChartType==="line")Q.strokeOpacity=this.crossFilteringDeselectedPoints()?0.3:1;return Q})}getCrossFilterData(G){this.crossFilteringAllPoints.clear();let[D]=G.categories,z=G.fields[0].colId,B=`${z}-filtered-out`,Q=G.getCrossFilteringContext().lastSelectedChartId;return G.data.map((J)=>{let U=J[D.id];this.crossFilteringAllPoints.add(U);let Z=this.crossFilteringPointSelected(U);if(this.standaloneChartType==="area"&&Q===G.chartId)J[`${z}-total`]=Z?J[z]:J[z]+J[B];if(this.standaloneChartType==="line")J[`${z}-total`]=Z?J[z]:J[z]+J[B];return J})}crossFilteringAddSelectedPoint(G,D){if(G)this.crossFilteringSelectedPoints.push(D);else this.crossFilteringSelectedPoints=[D]}isHorizontal(G){let D=this.standaloneChartType;if(D!=="waterfall"&&D!=="box-plot"&&D!=="range-bar")return!1;let z=G.theme,B=(Q)=>{let J=Q?.overrides?.[D]?.series?.direction;if(J!=null)return J==="horizontal";if(typeof Q?.baseTheme==="object")return B(Q.baseTheme);return!1};return B(z)}getSeriesChartThemeDefaults(){return{series:{highlight:nJ(this.crossFiltering,this.isSingleSeries)}}}},Lg=class extends HD{getSeries(G){let D=G.fields[0];return[{type:this.standaloneChartType,xKey:D.colId,xName:D.displayName,yName:this.chartProxyParams.translate("histogramFrequency"),areaPlot:!1}]}getAxes(G){return{x:{type:"number",position:"bottom"},y:{type:"number",position:"left"}}}},Sg=class extends HD{constructor(){super(...arguments);this.isSingleSeries=!0}getAxes(G,D){let z=this.isHorizontal(D),B=z?"y":"x",Q=z?"x":"y";return{[B]:{type:this.getXAxisType(G),position:z?"left":"bottom"},[Q]:{type:"number",position:z?"bottom":"left"}}}getSeries(G){let[D]=G.categories,[z]=G.fields;return[{type:this.standaloneChartType,xKey:D.id,xName:D.name,yKey:z.colId,yName:z.displayName??void 0}]}},Xg=class extends qz{getUpdateOptions(G,D){return{...D,data:this.transformFunnelCategories(G),series:this.getSeries(G)}}transformFunnelCategories(G){let{data:D}=G,[{id:z}]=G.categories;return D.map((B,Q)=>({...B,[z]:{name:B[z],id:Q,toString:()=>String(B[z])}}))}getSeriesChartThemeDefaults(){let G={crosshair:{enabled:!1}};return{zoom:{enabled:!1},...this.chartType!=="pyramid"&&{axes:{category:G,number:G}}}}getSeries(G){let[{id:D}]=G.categories,[{colId:z}]=G.fields;return[{type:this.standaloneChartType,stageKey:D,valueKey:z}]}},qB="AG-GRID-DEFAULT-LABEL-KEY";function Wg(G,D){let z=a8(G,B,Q);return dJ(z);function B(U){return D.length}function Q(U,Z){let S=D[Z],X=U[S];return J(X)}function J(U){if(U==null)return null;return String(U)}}function qg(G,D){let z=a8(G,B,Q);return dJ(z);function B(J){return D(J)?.length??0}function Q(J,U){let Z=D(J);return Z?Z[U]:Z}}function dJ(G,D=null,z){let{depth:B,rootValues:Q,value:J,children:U}=G;if(Q)return Q.map((S)=>({[qB]:D,...S}));else if(B===0)return[{[qB]:D,...J}];let Z=[];for(let[S,X]of U.entries())Z.push(...dJ(X,S,!0));return z?[{[qB]:D,children:Z,...J??{}}]:Z}function a8(G,D,z){let B={depth:0,children:new Map};for(let J of G){let U=D(J);Q(J,U,z,0,B)}return B;function Q(J,U,Z,S,X){if(S===U){if(S===0){if(!X.rootValues)X.rootValues=[];X.rootValues.push(J)}else X.value=J;return X}else{let Y=Z(J,S),W=X.children.get(Y),q=Q(J,U,Z,S+1,W||{depth:0,children:new Map});return X.children.set(Y,q),X.depth=Math.max(1+q.depth,X.depth),X}}}var Hg=class extends qz{getUpdateOptions(G,D){let{fields:z}=G,[B,Q]=z;return{...D,series:this.getSeries(B,Q),data:this.getData(G,B,Q)}}getSeriesChartThemeDefaults(){return{gradientLegend:{gradient:{preferredLength:200},position:"right"}}}getSeries(G,D){return[{type:this.standaloneChartType,labelKey:qB,sizeKey:G?.colId,sizeName:G?.displayName??void 0,colorKey:D?.colId,colorName:D?.displayName??void 0}]}getData(G,D,z){let{categories:B,data:Q,groupData:J,grouping:U}=G;if(U){let Z=z?Q.concat(J?.map((S)=>{let X={...S};return delete X[D.colId],X})??[]):Q;return qg(Z,(S)=>S[Yg]?.value??null)}else{let Z=B.map(({id:S})=>S);return Wg(Q,Z)}}},_g=class extends qz{getAxes(G){let D=this.standaloneChartType==="radial-bar";return{angle:{type:D?"angle-number":"angle-category"},radius:{type:D?"radius-category":"radius-number"}}}getSeries(G){let{fields:D,categories:z,seriesGroupType:B}=G,[Q]=z,J=this.standaloneChartType==="radial-bar",U=this.getSeriesGroupTypeOptions(B);return D.map((Z)=>{return{type:this.standaloneChartType,angleKey:J?Z.colId:Q.id,angleName:J?Z.displayName??void 0:Q.name,radiusKey:J?Q.id:Z.colId,radiusName:J?Q.name:Z.displayName??void 0,...U}})}getSeriesGroupType(){let G=this.standaloneChartType;if(!["nightingale","radial-bar","radial-column"].includes(G))return;let D=this.getChart().series?.[0]?.properties.toJson(),z=()=>D.normalizedTo?"normalized":"stacked";if(G==="nightingale")return D.grouped?"grouped":z();else return D.stacked?z():"grouped"}getUpdateOptions(G,D){let z=this.getAxes(G);return{...D,data:this.getData(G,z),axes:z,series:this.getSeries(G)}}getData(G,D){if(D.angle.type==="angle-category"||D.radius.type==="radius-category"){let[B]=G.categories;return this.transformCategoryData(G.data,B.id)}else return G.data}getSeriesGroupTypeOptions(G){if(!G)return{};return{grouped:G==="grouped"||void 0,stacked:G!=="grouped"||void 0,normalizedTo:G==="normalized"?100:void 0}}getSeriesChartThemeDefaults(){return{series:{highlight:nJ(this.crossFiltering)}}}},kg="AG-GRID-DEFAULT-HEATMAP-CATEGORY-KEY",wg="AG-GRID-DEFAULT-HEATMAP-SERIES-KEY",Kg="AG-GRID-DEFAULT-HEATMAP-VALUE-KEY";function fg(G,D){return G.reduce((z,B,Q,J)=>z.concat(D(B,Q,J)),[])}var Ng=class extends qz{getUpdateOptions(G,D){let z=wg,B=Kg,Q=kg;return{...D,series:this.getSeries(G,z,B,Q),data:this.getData(G,z,B,Q)}}getSeries(G,D,z,B){let[Q]=G.categories;return[{type:this.standaloneChartType,yKey:B,xKey:D,colorKey:z,yName:Q.name,xName:void 0,colorName:void 0}]}getData(G,D,z,B){let[Q]=G.categories;return fg(G.data,(J,U)=>{let Z=J[Q.id],S=Z==null?"":String(Z),X={id:U,value:Z,toString:()=>S};return G.fields.map(({colId:Y,displayName:W})=>({...J,[D]:W,[z]:J[Y],[B]:X}))})}getSeriesChartThemeDefaults(){return{gradientLegend:{gradient:{preferredLength:200},position:"right"},series:{tooltip:{renderer:Fg}}}}};function Fg(G){let{xKey:D,yKey:z,colorKey:B,yName:Q,datum:J}=G;return{title:"",data:[{label:Q,value:J[z]},{label:J[D],value:B&&J[B]}].map(({label:Z,value:S})=>({label:String(Z),value:String(S)}))}}var vg=class extends Ag{wireBeans(G){this.sortSvc=G.sortSvc,this.gridRowModel=G.rowModel,this.colModel=G.colModel,this.valueSvc=G.valueSvc,this.pivotResultCols=G.pivotResultCols,this.rowNodeSorter=G.rowNodeSorter}getData(G){if(G.crossFiltering){if(G.grouping)return b1(141),{chartData:[],colNames:{}};if(!Cg(this.gos))return b1(142),{chartData:[],colNames:{}}}if(Vg(this.gos)&&G.pivoting)this.updatePivotKeysForSSRM();let z=this.extractRowsFromGridRowModel(G);return z.chartData=this.aggregateRowsByDimension(G,z.chartData),z}extractRowsFromGridRowModel(G){let{crossFiltering:D,startRow:z,endRow:B,valueCols:Q,dimensionCols:J,grouping:U,crossFilteringSort:Z,combineGroupValues:S}=G,X=[],Y={},W={},q={},H={},_=[],k;if(D)H=this.getFilteredRowNodes(),_=this.getAllRowNodes(Z),k=_.length;else{let F=this.gridRowModel.getRowCount()-1;if(z===B&&z===0&&J.length===0&&Q.length===0)k=0;else k=(B>=0?Math.min(B,F):F)-z+1}if(k>0)for(let F of Q){let E=[],I=F.getColDef().pivotKeys;if(I)E=I.slice();let V=F.getColDef().headerName;if(V)E.push(V);if(E.length>0)Y[F.getId()]=E}let w=0,K=0,f={};for(let F=0;Fh.filter(Boolean).join(" - ")};if(S){let g=P.toString(),c=f[g];if(c)P=c;else f[g]=P}if(I[A]=P,E.group)W[v.toString()]=F-w;let b=v.slice(1,v.length).toString();if(b)q[b]=W[b]}else I[A]=O}else I[gG]=F+1}for(let V of Q){let A=V.getColId();if(D){let R=A+"-filtered-out",O=this.valueSvc.getValue(V,E,"data"),u=O;if(O!=null){if(typeof O.toNumber==="function")u=O.toNumber();else if(typeof O.value==="number")u=O.value}if(H[E.id])I[A]=u,I[R]=G.aggFunc||G.isScatter?void 0:0;else I[A]=G.aggFunc||G.isScatter?void 0:0,I[R]=u}else{let R=this.valueSvc.getValue(V,E,"data");if(R&&typeof R.value==="number")R=R.value;if(R&&Object.prototype.hasOwnProperty.call(R,"toString"))R=parseFloat(R.toString());I[A]=R!=null&&typeof R.toNumber==="function"?R.toNumber():R}}X.push(I)}let N;if(U){let F=Object.values(q),E=X;X=[],N=[];for(let I=0;Itypeof N[H]<"u").map((N)=>N[H]),k=S({values:_,column:q,colDef:q.colDef,pivotResultColumn:void 0,rowNode:void 0,data:void 0,aggregatedChildren:[],api:X,context:Y});W[H]=k&&typeof k.value<"u"?k.value:k;let w=`${H}-filtered-out`,K=W.__children.filter((N)=>typeof N[w]<"u").map((N)=>N[w]),f=S({values:K,column:q,colDef:q.colDef,pivotResultColumn:void 0,rowNode:void 0,data:void 0,aggregatedChildren:[],api:X,context:Y});W[w]=f&&typeof f.value<"u"?f.value:f}else{let _=W.__children.map((w)=>w[H]),k=S({values:_,column:q,colDef:q.colDef,pivotResultColumn:void 0,rowNode:void 0,data:void 0,aggregatedChildren:[],api:X,context:Y});W[H]=k&&typeof k.value<"u"?k.value:k}}}return U}updatePivotKeysForSSRM(){let G=this.pivotResultCols?.getPivotResultCols()?.list;if(!G)return;let D=this.extractPivotKeySeparator(G);for(let z of G)if(D==="")z.getColDef().pivotKeys=[];else{let B=z.getColId().split(D);z.getColDef().pivotKeys=B.slice(0,B.length-1)}}extractPivotKeySeparator(G){if(G.length===0)return"";let D=(B,Q)=>{let J=B.getGroupId();if(!B.getParent())return Q.split(J)[1][0];return D(B.getParent(),J)},z=G[0];if(z.getParent()==null)return"";return D(z.getParent(),z.getColId())}getGroupLabels(G,D){let z=[D];while(G&&G.level!==0)if(G=G.parent,G)if(G.group){let B=this.colModel.getCol(Rg);if(B){let Q=this.valueSvc.getValue(B,G,"data"),J=Q?.toString?String(Q.toString()):" ";z.push(J)}}else z.push(G.key);return z}getFilteredRowNodes(){let G={};return this.gridRowModel.forEachNodeAfterFilterAndSort((D)=>{G[D.id]=D}),G}getAllRowNodes(G){let D=[];this.gridRowModel.forEachNode((Q)=>{D.push(Q)});let z=this.rowNodeSorter;if(!z)return D;let B=G===!0?this.sortSvc?.getSortOptions():G;if(!B||B.length==0)return D;return z.doFullSortInPlace(D,B)}},jg=class extends Og{constructor(){super(...arguments);this.valueColsWithoutSeriesType=new Set}wireBeans(G){this.colModel=G.colModel,this.colNames=G.colNames,this.valueSvc=G.valueSvc}postConstruct(){let G=()=>this.valueColsWithoutSeriesType.clear();this.addManagedEventListeners({newColumnsLoaded:G,rowDataUpdated:G})}getColumn(G){return this.colModel.getColDefCol(G)}getAllDisplayedColumns(){return this.beans.visibleCols.allCols}getColDisplayName(G){return this.colNames.getDisplayNameForColumn(G,"chart")}getColGroupDisplayName(G){return this.colNames.getDisplayNameForColumnGroup(G,"chart")}getRowGroupColumns(){return this.beans.rowGroupColsSvc?.columns??[]}getGroupDisplayColumns(){return this.beans.showRowGroupCols?.columns??[]}isPivotMode(){return this.colModel.isPivotMode()}isPivotActive(){return this.colModel.isPivotActive()}getChartColumns(){let G=this.colModel.getCols(),D=new Set,z=new Set;for(let B of G){let Q=B.getColDef(),J=Q.chartDataType;if(J)switch(J){case"category":case"time":D.add(B);continue;case"series":z.add(B);continue;case"excluded":continue;default:g5(153,{chartDataType:J});break}if(Q.colId==="ag-Grid-AutoColumn"){D.add(B);continue}if(!B.isPrimary()){z.add(B);continue}(this.isInferredValueCol(B)?z:D).add(B)}return{dimensionCols:D,valueCols:z}}isInferredValueCol(G){let D=G.getColId();if(D==="ag-Grid-AutoColumn")return!1;let z=ug(this.beans,{rowIndex:0,rowPinned:null});if(!z)return this.valueColsWithoutSeriesType.has(D);let B=this.valueSvc.getValue(G,z,"data");if(B==null)B=this.extractLeafData(z,G);if(B!=null){if(typeof B.toNumber==="function")B=B.toNumber();else if(typeof B.value==="number")B=B.value}let Q=typeof B==="number"||G.colDef.cellDataType==="number"||["series","time"].includes(G.colDef.chartDataType);if(Q)this.valueColsWithoutSeriesType.add(D);else if(B==null&&G.colDef.cellDataType!=="number")g5(265,{colId:D});return Q}extractLeafData(G,D){let z=G.data&&this.valueSvc.getValue(D,G,"data");if(z!=null)return z;let B=G.childrenAfterGroup;if(B)for(let Q=0,J=B.length;Q0;if(this.chartDataModel.chartType==="customCombo"||G)this.chartDataModel.chartType="customCombo",this.savedCustomSeriesChartTypes=this.seriesChartTypes||[]}updateSeriesChartTypes(){if(!this.chartDataModel.isComboChart())return;if(this.seriesChartTypes=this.seriesChartTypes.map((G)=>{let D=["groupedColumn","stackedColumn","stackedArea"].includes(G.chartType);return G.secondaryAxis=D?!1:G.secondaryAxis,G}),this.chartDataModel.chartType==="customCombo"){this.updateSeriesChartTypesForCustomCombo();return}this.updateChartSeriesTypesForBuiltInCombos()}updateSeriesChartTypesForCustomCombo(){if(!(this.seriesChartTypes&&this.seriesChartTypes.length>0)&&!this.suppressComboChartWarnings)v1(150);this.seriesChartTypes=this.seriesChartTypes.map((B)=>{if(!gg.has(B.chartType))v1(151,{chartType:B.chartType}),B.chartType="line";return B});let D=(B)=>{if(!this.savedCustomSeriesChartTypes||this.savedCustomSeriesChartTypes.length===0)this.savedCustomSeriesChartTypes=this.seriesChartTypes;let Q=this.savedCustomSeriesChartTypes.find((J)=>J.colId===B.colId);if(!Q){if(B.selected&&!this.suppressComboChartWarnings)v1(152,{colId:B.colId});return{colId:B.colId,chartType:"line",secondaryAxis:!1}}return Q},z=this.chartDataModel.valueColState.map(D);this.seriesChartTypes=z,this.savedCustomSeriesChartTypes=z,this.suppressComboChartWarnings=!0}updateChartSeriesTypesForBuiltInCombos(){let{chartType:G,valueColState:D}=this.chartDataModel,z=G==="columnLineCombo"?"groupedColumn":"stackedArea",B=G==="columnLineCombo"?"line":"groupedColumn",Q=D.filter((U)=>U.selected),J=Math.ceil(Q.length/2);this.seriesChartTypes=Q.map((U,Z)=>{let S=Z>=J?B:z;return{colId:U.colId,chartType:S,secondaryAxis:!1}})}},gG="AG-GRID-DEFAULT-CATEGORY",yg=class extends Eg{constructor(G){super();this.unlinked=!1,this.chartData=[],this.valueColState=[],this.dimensionColState=[],this.colNames={},this.crossFiltering=!1,this.crossFilteringSort=!0,this.grouping=!1,this.useGroupColumnAsCategory=!1,this.params=G,this.chartId=G.chartId,this.setParams(G)}wireBeans(G){this.rangeSvc=G.rangeSvc,this.chartTranslation=G.chartTranslation}setParams(G){let{chartType:D,pivotChart:z,chartThemeName:B,switchCategorySeries:Q,aggFunc:J,cellRange:U,suppressChartRanges:Z,unlinkChart:S,crossFiltering:X,crossFilteringSort:Y,seriesGroupType:W,useGroupColumnAsCategory:q}=G;this.chartType=D,this.pivotChart=z??!1,this.chartThemeName=B,this.switchCategorySeries=!!Q,this.aggFunc=J,this.referenceCellRange=U,this.suppliedCellRange=U,this.suppressChartRanges=Z??!1,this.unlinked=!!S,this.crossFiltering=!!X,this.crossFilteringSort=Y??!0,this.seriesGroupType=W,this.useGroupColumnAsCategory=!!q}postConstruct(){this.datasource=this.createManagedBean(new vg),this.chartColSvc=this.createManagedBean(new jg),this.comboChartModel=this.createManagedBean(new Tg(this)),this.updateCellRanges({setColsFromRange:!0}),this.updateData()}updateModel(G){let{cellRange:D,seriesChartTypes:z}=G;if(D!==this.suppliedCellRange)this.dimensionCellRange=void 0,this.valueCellRange=void 0;if(this.setParams(G),this.updateSelectedDimensions(D?.columns),this.updateCellRanges({setColsFromRange:!0}),this.isComboChart()||z)this.comboChartModel.update(z);if(!this.unlinked)this.updateData()}updateCellRanges(G){let{updatedColState:D,resetOrder:z,maintainColState:B,setColsFromRange:Q}=G??{};if(this.valueCellRange)this.referenceCellRange=this.valueCellRange;let{dimensionCols:J,valueCols:U}=this.chartColSvc.getChartColumns(),Z=this.getAllColumnsFromRanges();if(D)this.updateColumnState(D,z);if(this.setDimensionCellRange(J,Z,D),this.setValueCellRange(U,Z,Q),!D&&!B)this.resetColumnState(),this.syncDimensionCellRange();this.comboChartModel.updateSeriesChartTypes()}updateData(){let{startRow:G,endRow:D}=this.getRowIndexes();if(this.pivotChart)this.resetColumnState();this.grouping=this.isGrouping();let z={aggFunc:this.aggFunc,dimensionCols:this.getSelectedDimensions(),grouping:this.grouping,pivoting:this.isPivotActive(),crossFiltering:this.crossFiltering,crossFilteringSort:this.getCrossFilteringSort(),valueCols:this.getSelectedValueCols(),startRow:G,endRow:D,isScatter:["scatter","bubble"].includes(this.chartType),combineGroupValues:rP(l(this.chartType))},{chartData:B,colNames:Q,groupChartData:J}=this.datasource.getData(z);this.chartData=B,this.groupChartData=J,this.colNames=Q,this.categoryAxisType=void 0}isGrouping(){let G=this.gos.get("treeData"),D=G?null:this.chartColSvc.getRowGroupColumns(),z=G||D&&D.length>0,B=this.getSelectedDimensions().map(({colId:U})=>U),J=this.chartColSvc.getGroupDisplayColumns().map((U)=>U.getColId()).some((U)=>B.includes(U));return!!z&&J}getSelectedValueCols(){return this.valueColState.filter((G)=>G.selected).map((G)=>G.column)}getSelectedDimensions(){return this.dimensionColState.filter((G)=>G.selected)}getValueColState(){return this.valueColState.map(this.displayNameMapper.bind(this))}displayNameMapper(G){let{column:D}=G;if(D){let z=this.getColDisplayName(D);G.displayName=this.isPivotMode()?this.getPivotDisplayName(D,z):z}else{let z=this.colNames[G.colId];G.displayName=z?z.join(" - "):this.getColDisplayName(D)}return G}getPivotDisplayName(G,D){let z=!1,B=[D],Q=(J)=>{if(!J)return;let U=this.chartColSvc.getColGroupDisplayName(J);if(U?.length)B.unshift(U),Q(J.getParent());else z=!0};if(Q(G.getParent()),z){let J=this.colNames[G.getColId()];if(J)B=J}return B.join(" - ")}getColDisplayName(G){return this.chartColSvc.getColDisplayName(G)}isPivotMode(){return this.chartColSvc.isPivotMode()}getChartDataType(G){let D=this.chartColSvc.getColumn(G);return D?D.getColDef().chartDataType:void 0}getConvertTime(G){let D=this.chartColSvc.getColumn(G);if(D?.colDef.cellDataType==="dateString")return this.beans.dataTypeSvc?.getDateParserFunction(D);return}isPivotActive(){return this.chartColSvc.isPivotActive()}createCellRange(G,...D){return{id:this.chartId,startRow:this.referenceCellRange.startRow,endRow:this.referenceCellRange.endRow,columns:D,startColumn:G===pz.DIMENSION||this.referenceCellRange.startColumn==null?D[0]:this.referenceCellRange.startColumn,type:G}}getAllColumnsFromRanges(){if(this.pivotChart)return new Set(this.chartColSvc.getAllDisplayedColumns());let G=this.dimensionCellRange||this.valueCellRange?[]:this.referenceCellRange.columns;if(this.dimensionCellRange)G.push(...this.dimensionCellRange.columns);if(this.valueCellRange)G.push(...this.valueCellRange.columns);return new Set(G)}getRowIndexes(){let G=0,D=0,{rangeSvc:z,valueCellRange:B,dimensionCellRange:Q}=this,J=B||Q;if(z&&J){G=z.getRangeStartRow(J).rowIndex;let U=z.getRangeEndRow(J);D=U.rowPinned==="bottom"?-1:U.rowIndex}return{startRow:G,endRow:D}}resetColumnState(){let{dimensionCols:G,valueCols:D}=this.chartColSvc.getChartColumns(),z=this.getAllColumnsFromRanges(),B=this.valueColState.length<1;this.dimensionColState=[],this.valueColState=[];let Q=VD(l(this.chartType)),J=!1,U=1,Z=this.suppliedCellRange.columns[0],S=this.gos.get("treeData"),X=S?null:this.chartColSvc.getRowGroupColumns(),Y=S||X&&X.length>0;G.forEach((H)=>{let _=Mg(H),k=this.crossFiltering&&this.aggFunc?Z.getColId()===H.getColId():this.useGroupColumnAsCategory&&Y&&_||(!J||Q)&&z.has(H);if(this.dimensionColState.push({column:H,colId:H.getColId(),displayName:this.getColDisplayName(H),selected:k,order:U++}),k)J=!0});let W={colId:gG,displayName:this.chartTranslation.translate("defaultCategory"),selected:!J,order:0};this.dimensionColState.unshift(W);let q=this.referenceCellRange.columns.filter((H)=>D.has(H));D.forEach((H)=>{if(B&&this.referenceCellRange.columns.includes(H))H=q.shift();this.valueColState.push({column:H,colId:H.getColId(),displayName:this.getColDisplayName(H),selected:z.has(H),order:U++})})}updateColumnState(G,D){let z=(X)=>X.colId===G.colId,{dimensionColState:B,valueColState:Q}=this,J=B.find(z),U=Q.find(z);if(J)if(!VD(l(this.chartType))){let Y=G.selected?J:B.filter((W)=>W!==J).find(({selected:W})=>W);B.forEach((W)=>W.selected=W===Y)}else J.selected=G.selected;else if(U)U.selected=G.selected;let Z=[...B,...Q],S=[];if(!D)Z.forEach((X,Y)=>{if(Y===G.order)S.push(G.colId);if(X.colId!==G.colId)S.push(X.colId)}),Z.forEach((X)=>{let Y=S.indexOf(X.colId);X.order=Y>=0?S.indexOf(X.colId):Z.length-1});this.reorderColState()}reorderColState(){let G=(D,z)=>D.order-z.order;this.dimensionColState.sort(G),this.valueColState.sort(G)}setDimensionCellRange(G,D,z){this.dimensionCellRange=void 0;let B=VD(l(this.chartType));if(!z&&!this.dimensionColState.length){let Z=[];if(G.forEach((S)=>{if(Z.length>0&&!B||!D.has(S))return;Z.push(S)}),Z.length>0)this.dimensionCellRange=this.createCellRange(pz.DIMENSION,...Z);return}let Q=z?[z]:[];if(this.crossFiltering&&this.aggFunc){let Z=this.suppliedCellRange.columns[0];Q=this.dimensionColState.filter((S)=>S.colId===Z.getColId())}else if(B||Q.length===0||Q.some(({column:Z})=>!Z||!G.has(Z)))Q=this.dimensionColState.filter((Z)=>Z.selected);let J=Q.length===1?Q[0].colId===gG:!1,U=Q.map(({column:Z})=>Z).filter((Z)=>Z!=null);if(U.length>0&&!J)this.dimensionCellRange=this.createCellRange(pz.DIMENSION,...U)}setValueCellRange(G,D,z){this.valueCellRange=void 0;let B=[],Q=bB(this.chartType),J=0;if(G.forEach((U)=>{if(z){if((Q==null||JZ.selected&&Z.colId===U.getColId()))B.push(U)}),B.length>0){let U=[];if(this.valueColState.length>0)U=this.valueColState.map((Z)=>Z.colId);else D.forEach((Z)=>U.push(Z.getColId()));B.sort((Z,S)=>U.indexOf(Z.getColId())-U.indexOf(S.getColId())),this.valueCellRange=this.createCellRange(pz.VALUE,...B)}}resetCellRanges(G,D){if(!G&&!D)return;let{dimensionCols:z,valueCols:B}=this.chartColSvc.getChartColumns(),Q=this.getAllColumnsFromRanges();if(G)this.setDimensionCellRange(z,Q);if(D)this.setValueCellRange(B,Q)}updateSelectedDimensions(G){let D=new Set(G.map((B)=>B.getColId()));if(!VD(l(this.chartType))){let Q=(this.dimensionColState.find((J)=>D.has(J.colId))||this.dimensionColState[0]).colId;this.dimensionColState=this.dimensionColState.map((J)=>({...J,selected:J.colId===Q}))}else{let B=this.dimensionColState.filter((J)=>D.has(J.colId)),Q=new Set(B.map((J)=>J.colId));this.dimensionColState=this.dimensionColState.map((J)=>({...J,selected:Q.has(J.colId)}))}}syncDimensionCellRange(){let G=this.getSelectedDimensions();if(G.length===0)return;let D=G.map(({column:z})=>z).filter((z)=>z!=null);if(D.length>0)this.dimensionCellRange=this.createCellRange(pz.DIMENSION,...D)}isComboChart(G){return cJ(G??this.chartType)}getCrossFilteringSort(){let G=this.crossFilteringSort;if(typeof G==="boolean")return G;let D=[];return G.forEach(({sort:z,colId:B})=>{let Q=this.chartColSvc.getColumn(B);if(Q)D.push({sort:z,column:Q,type:Ig(Q.getSortDef()?.type)})}),D}},e8=class extends HD{getAxes(G,D){return{x:{type:this.getXAxisType(G),position:this.isHorizontal(D)?"left":"bottom"},y:{type:"number",position:this.isHorizontal(D)?"bottom":"left"}}}computeSeriesStatistics(G,D){let{data:z,fields:B}=G,[Q]=G.categories,J=Q.id||gG,U=this.groupDataByCategory(J,z);return Array.from(U).map(([Z,S])=>{let X={[Q.id]:Z};return B.forEach((Y,W)=>{let q=S.map((_)=>_[Y.colId]).filter((_)=>typeof _==="number"&&!isNaN(_)),H=D(q);for(let _ of Object.keys(H)){let k=`${_}:${W}`;X[k]=q.length>0?H[_]:null}}),X})}groupDataByCategory(G,D){let z=(B)=>{if(G===gG)return 1;let Q=B[G];if(Q===null||Q===void 0)return"";return Q instanceof Date?Q.getTime():Q};return D.reduce((B,Q)=>{let J=z(Q),U=B.get(J);if(U)U.push(Q);else B.set(J,[Q]);return B},new Map)}},xg=class extends e8{getSeries(G){let[D]=G.categories;return G.fields.map((z,B)=>({type:this.standaloneChartType,xKey:D.id,xName:D.name,yName:z.displayName??void 0,minName:"Min",q1Name:"Q1",medianName:"Median",q3Name:"Q3",maxName:"Max",minKey:`min:${B}`,q1Key:`q1:${B}`,medianKey:`median:${B}`,q3Key:`q3:${B}`,maxKey:`max:${B}`}))}getData(G){return this.computeSeriesStatistics(G,(D)=>{let z=D.sort((B,Q)=>B-Q);return{min:z[0],q1:this.quantile(z,0.25),median:this.quantile(z,0.5),q3:this.quantile(z,0.75),max:z[z.length-1]}})}quantile(G,D){let z=(G.length-1)*D,B=Math.floor(z),Q=z-B;if(G[B+1]!==void 0)return G[B]+Q*(G[B+1]-G[B]);return G[B]}},cg=class extends e8{getSeries(G){let[D]=G.categories;return G.fields.map((z,B)=>({type:this.standaloneChartType,xKey:D.id,xName:D.name,yName:z.displayName??void 0,yLowName:"Min",yHighName:"Max",yLowKey:`min:${B}`,yHighKey:`max:${B}`}))}getData(G){return this.computeSeriesStatistics(G,(D)=>{return{min:Math.min(...D),max:Math.max(...D)}})}},hg=class extends xP{constructor(){super(...arguments);this.beanName="enterpriseChartProxyFactory"}createChartProxy(G){switch(G.chartType){case"histogram":return new Lg(G);case"radarLine":case"radarArea":case"nightingale":case"radialColumn":case"radialBar":return new _g(G);case"rangeBar":case"rangeArea":return new cg(G);case"boxPlot":return new xg(G);case"treemap":case"sunburst":return new Hg(G);case"heatmap":return new Ng(G);case"waterfall":return new Sg(G);case"funnel":case"coneFunnel":case"pyramid":return new Xg(G)}return}},D9=class extends pg{constructor(G,D,z,B){super();this.chartController=G,this.eGui=D,this.cssClass=z,this.createPanels=B,this.panels=[]}postConstruct(){this.addManagedListeners(this.chartController,{chartUpdated:()=>this.refreshPanels(!0),chartApiUpdate:()=>this.refreshPanels(!1)})}addComponent(G){this.createBean(G),this.panels.push(G),G.addCss(this.cssClass),this.eGui.appendChild(G.getGui())}refreshPanels(G){let D=this.chartController.getChartType(),z=this.chartController.isGrouping(),B=l(D);if(G&&D===this.chartType&&z===this.isGrouping)return;this.destroyPanels(),this.createPanels(D,B),this.chartType=D,this.isGrouping=z}destroyPanels(){for(let G of this.panels)mg(G.getGui()),this.destroyBean(G);this.panels=[]}destroy(){this.destroyPanels(),super.destroy()}},og=class extends sg{constructor(G){super();this.chartMenuParamsFactory=G}wireBeans(G){this.chartTranslation=G.chartTranslation}postConstruct(){let G=this.chartMenuParamsFactory.addEnableParams("animation.enabled",{cssIdentifier:"charts-advanced-settings-top-level",direction:"vertical",suppressOpenCloseIcons:!0,title:this.chartTranslation.translate("animation"),suppressEnabledCheckbox:!0,useToggle:!0}),D=this.chartMenuParamsFactory.getDefaultNumberInputParams("animation.duration","durationMillis",{min:0});this.setTemplate(`
- - - -
`,[p,tg],{animationGroup:G,animationHeightInput:D})}},z9=class extends XJ{constructor(G){super({...G,dialogCallbacks:g6})}},TG={selector:"AG-COLOR-PICKER",component:z9},eg=class extends ag{constructor(G){super();this.chartMenuParamsFactory=G}wireBeans(G){this.chartTranslation=G.chartTranslation}postConstruct(){let G=this.chartMenuParamsFactory.addEnableParams("crosshair.enabled",{cssIdentifier:"charts-advanced-settings-top-level",direction:"vertical",suppressOpenCloseIcons:!0,title:this.chartTranslation.translate("crosshair"),suppressEnabledCheckbox:!0,useToggle:!0}),D=this.chartMenuParamsFactory.getDefaultCheckboxParams("crosshair.label.enabled","crosshairLabel"),z=this.chartMenuParamsFactory.getDefaultCheckboxParams("crosshair.snap","crosshairSnap"),B=this.chartMenuParamsFactory.getDefaultColorPickerParams("crosshair.stroke","color");this.setTemplate(`
- - - - - -
`,[p,rg,TG],{crosshairGroup:G,crosshairLabelCheckbox:D,crosshairSnapCheckbox:z,crosshairStrokeColorPicker:B})}},zT=class extends DT{constructor(G){super();this.chartMenuParamsFactory=G}wireBeans(G){this.chartTranslation=G.chartTranslation}postConstruct(){let G=this.chartMenuParamsFactory.addEnableParams("navigator.enabled",{cssIdentifier:"charts-advanced-settings-top-level",direction:"vertical",suppressOpenCloseIcons:!0,title:this.chartTranslation.translate("navigator"),suppressEnabledCheckbox:!0,useToggle:!0}),D=this.chartMenuParamsFactory.getDefaultSliderParams("navigator.height","height",60);D.minValue=10;let z=this.chartMenuParamsFactory.getDefaultCheckboxParams("navigator.miniChart.enabled","miniChart");this.setTemplate(`
- - - - -
`,[p,WG,GT],{navigatorGroup:G,navigatorHeightSlider:D,navigatorMiniChartCheckbox:z})}},UT=class extends QT{constructor(G){super();this.chartMenuParamsFactory=G,this.zoomScrollingStepInput=JT}wireBeans(G){this.chartTranslation=G.chartTranslation}postConstruct(){let G=this.chartMenuParamsFactory.addEnableParams("zoom.enabled",{cssIdentifier:"charts-advanced-settings-top-level",direction:"vertical",suppressOpenCloseIcons:!0,title:this.chartTranslation.translate("zoom"),suppressEnabledCheckbox:!0,useToggle:!0}),D=this.chartMenuParamsFactory.getDefaultCheckboxParams("zoom.enableScrolling","scrollingZoom"),z=this.chartMenuParamsFactory.getDefaultSliderParams("zoom.scrollingStep","scrollingStep",1);z.step=0.01,z.minValue=z.step;let B=this.chartMenuParamsFactory.getDefaultCheckboxParams("zoom.enableSelecting","selectingZoom");D.onValueChange=((Q)=>(J)=>{if(!Q)return;Q(J),this.zoomScrollingStepInput.setDisabled(!J)})(D.onValueChange),this.setTemplate(`
- - - - - -
`,[p,BT,WG],{zoomGroup:G,zoomScrollingCheckbox:D,zoomScrollingStepInput:z,zoomSelectingCheckbox:B}),this.zoomScrollingStepInput.setDisabled(!D.value)}},ZT=["navigator","zoom","animation","crosshair"],$T=class extends lg{constructor(G){super('
');this.chartMenuContext=G}postConstruct(){this.chartPanelFeature=this.createManagedBean(new D9(this.chartMenuContext.chartController,this.getGui(),"ag-chart-advanced-settings-section",(G,D)=>this.createPanels(G,D))),this.chartPanelFeature.refreshPanels()}createPanels(G,D){for(let z of ZT){if(!this.isGroupPanelShownForSeries(z,D))continue;let B=this.createPanel(z);this.chartPanelFeature.addComponent(B)}}isGroupPanelShownForSeries(G,D){return G==="animation"||SD(D)&&!zJ(D)}createPanel(G){let{chartMenuParamsFactory:D,chartAxisMenuParamsFactory:z}=this.chartMenuContext;switch(G){case"navigator":return new zT(D);case"zoom":return new UT(D);case"animation":return new og(D);case"crosshair":return new eg(z)}}},LT=class extends ig{constructor(){super(...arguments);this.beanName="advSettingsMenuFactory"}showMenu(G,D){this.hideMenu();let z=this.createBean(new ST(G));this.activeDialog=this.createBean(new PB({title:this.beans.chartTranslation.translate("advancedSettings"),component:z,width:300,height:400,resizable:!0,movable:!0,centered:!0,closable:!0,afterGuiAttached:()=>{G9(z.getGui())[0]?.focus()},closedCallback:()=>{this.activeMenu=this.destroyBean(this.activeMenu),this.activeDialog=void 0,D?.focus({preventScroll:!0})}})),this.activeMenu=z}hideMenu(){if(this.activeDialog)this.destroyBean(this.activeDialog)}destroy(){this.activeMenu=this.destroyBean(this.activeMenu),this.activeDialog=this.destroyBean(this.activeDialog),super.destroy()}},ST=class extends ng{constructor(G){super('
');this.chartMenuContext=G}postConstruct(){this.advancedSettingsPanel=this.createManagedBean(new $T(this.chartMenuContext)),this.getGui().appendChild(this.advancedSettingsPanel.getGui()),this.initialiseTabGuard({onTabKeyDown:this.onTabKeyDown.bind(this),focusTrapActive:!0})}onTabKeyDown(G){if(G.defaultPrevented)return;G.preventDefault();let D=G.shiftKey,z=this.advancedSettingsPanel.getGui(),B=dg(this.beans,z,!1,D);if(B)B.focus();else{let Q=G9(z);if(Q.length)Q[D?Q.length-1:0].focus()}}},wT=class extends XT{constructor(){super(...arguments);this.beanName="chartMenuListFactory"}wireBeans(G){this.popupSvc=G.popupSvc,this.chartMenuSvc=G.chartMenuSvc,this.chartTranslation=G.chartTranslation}showMenuList(G){let{eventSource:D,showMenu:z,chartMenuContext:B,closeOnElementClick:Q}=G,J=this.chartMenuSvc.doChartToolPanelsExist(B.chartController),U=this.mapWithStockItems(this.getMenuItems(B.chartController,J),B,z,D,J);if(!U.length)return;let Z=this.createBean(new KT(U));this.activeChartMenuList=Z;let S=-1,X="left";if(this.gos.get("enableRtl"))S=1,X="right";let Y=Z.getGui();this.popupSvc.addPopup({modal:!0,eChild:Y,closeOnEsc:!0,alwaysOnTop:!0,closedCallback:()=>{if(this.destroyBean(Z),this.activeChartMenuList=void 0,kT(this.beans))D.focus({preventScroll:!0})},afterGuiAttached:(W)=>{Z.afterGuiAttached(W,Q)},positionCallback:()=>{this.popupSvc.positionPopupByComponent({type:"chartMenu",eventSource:D,ePopup:Y,alignSide:X,nudgeX:4*S,nudgeY:4,position:"under",keepWithinBounds:!0})},ariaLabel:"Chart Menu"})}getMenuItems(G,D){let z=[...D?["chartEdit"]:[],...G.isEnterprise()?["chartAdvancedSettings"]:[],G.isChartLinked()?"chartUnlink":"chartLink","chartDownload"],B=this.gos.get("chartMenuItems");if(!B)return z;else if(Array.isArray(B))return B;else return B(qT(this.gos,{defaultItems:z,chartId:G.getChartId()}))}mapWithStockItems(G,D,z,B,Q){if(!G)return[];let J=[];for(let U of G){let Z;if(typeof U==="string")Z=this.getStockMenuItem(U,D,z,B,Q);else Z={...U};if(!Z)continue;let{subMenu:S}=Z;if(Array.isArray(S))Z.subMenu=this.mapWithStockItems(S,D,z,B,Q);J.push(Z)}return J}getStockMenuItem(G,D,z,B,Q){switch(G){case"chartEdit":return Q?this.createMenuItem(this.chartTranslation.translate("chartEdit"),"chartsMenuEdit",z):null;case"chartAdvancedSettings":return this.createMenuItem(this.chartTranslation.translate("chartAdvancedSettings"),"chartsMenuAdvancedSettings",()=>this.chartMenuSvc.openAdvancedSettings(D,B));case"chartUnlink":return D.chartController.isChartLinked()?this.createMenuItem(this.chartTranslation.translate("chartUnlink"),"unlinked",()=>this.chartMenuSvc.toggleLinked(D)):null;case"chartLink":return!D.chartController.isChartLinked()?this.createMenuItem(this.chartTranslation.translate("chartLink"),"linked",()=>this.chartMenuSvc.toggleLinked(D)):null;case"chartDownload":return this.createMenuItem(this.chartTranslation.translate("chartDownload"),"chartsDownload",()=>this.chartMenuSvc.downloadChart(D))}return null}createMenuItem(G,D,z){return{name:G,icon:HT(D,this.beans,null),action:z}}destroy(){this.destroyBean(this.activeChartMenuList),super.destroy()}},KT=class extends YT{constructor(G){super(` - - `);this.menuItems=G,this.eChartsMenu=WT}postConstruct(){this.mainMenuList=this.createManagedBean(new KJ(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:G},D){let z=Date.now();if(G){if(this.hidePopupFunc=G,this.addDestroyFunc(G),D){let B=()=>{if(Date.now()-z<500)return;this.hidePopupFunc()};D.addEventListener("click",B),this.addDestroyFunc(()=>{D?.removeEventListener("click",B)})}}_T(this.mainMenuList.getGui())}},FT=class extends fT{constructor(){super(...arguments);this.beanName="chartCrossFilterSvc"}filter(G,D=!1){let z=this.beans.filterManager,B=z?.getFilterModel()??{};if(D){if(Object.keys(B).length>0)z?.setFilterModel(null);return}let Q=T5(G);if(Q.indexOf("-filtered-out"))Q=Q.replace("-filtered-out","");this.updateFilters(B,G,Q)}updateFilters(G,D,z){let B=T5(D),Q=this.convertRawValue(z,D.datum[B]);if(Q===void 0)return;let J=this.beans.filterManager;J?.getColumnFilterInstance(z).then((U)=>{let Z=U?.filterType,S,X=(_)=>_;if(Z==="multi"){let _=IT(U);S=_.setFilter,X=_.processModel??X}else if(Z==="set")S=U;if(!S){NT(154,{colId:z});return}let Y=D.event.metaKey||D.event.ctrlKey,W=S.getFilterHandler().getCrossFilterModel((_,k,w)=>MT(Y,_(Q),k,w)),q=X(W),H=Y?{...G}:{};H[z]=q,J?.setFilterModel(H)})}convertRawValue(G,D){let{colModel:z,dataTypeSvc:B}=this.beans,Q=z.getColById(G),J=Q?.colDef;if(J&&B&&J.chartDataType==="time"&&J.cellDataType==="dateString")return B.getDateFormatterFunction(Q)(D);return D}};function ET(G,D,z){let B=Array(z);for(let Q=0;QET(Q,z,D)}}return{}}function T5(G){return G.xKey||G.calloutLabelKey}function MT(G,D,z,B){let Q;if(G)if(z.has(D)&&(B==null||B.includes(D))){if(Q=[],B==null){for(let J of z)if(J!==D)Q.push(J)}else for(let J of B)if(J!==D&&z.has(J))Q.push(J)}else{if(B==null)Q=Array.from(z);else{Q=[];for(let J of B)if(z.has(J))Q.push(J)}Q.push(D)}else Q=[D];return{filterType:"set",values:Q}}var RT=["chartUnlink","chartLink","chartDownload","chartMenu"],HB={settings:"chartSettings",data:"chartData",format:"chartFormat"},CT=class extends AT{constructor(){super(...arguments);this.beanName="chartMenuSvc"}wireBeans(G){this.advSettingsMenuFactory=G.advSettingsMenuFactory}downloadChart(G,D,z,B){G.chartController.getChartProxy().downloadChart(D,z,B)}toggleLinked(G){G.chartController.detachChartRange()}openAdvancedSettings(G,D){this.advSettingsMenuFactory?.showMenu(G,D)}hideAdvancedSettings(){this.advSettingsMenuFactory?.hideMenu()}getChartToolbarOptions(){let G=["chartMenu"],D=this.gos.getCallback("getChartToolbarItems");return D?D({defaultItems:G}).filter((B)=>{if(!RT.includes(B))return y5(155,{option:B}),!1;return!0}):G}getChartToolPanels(G){let D=this.gos.get("chartToolPanelsDef"),B=D?.panels?.map((U)=>{let Z=HB[U];if(!Z)y5(156,{panel:U});return Z}).filter((U)=>Boolean(U))??Object.values(HB);if(G.isPivotChart())B=B.filter((U)=>U!=="chartData");let Q=D?.defaultToolPanel,J=Q&&HB[Q]||B[0];return{panels:B,defaultPanel:J}}doesChartToolbarExist(){return this.getChartToolbarOptions().length>0}doChartToolPanelsExist(G){let{panels:D}=this.getChartToolPanels(G);return D.length>0}},bT={pivotChartTitle:"Pivot Chart",rangeChartTitle:"Range Chart",settings:"Chart",data:"Set Up",format:"Customize",categories:"Categories",defaultCategory:"(None)",series:"Series",switchCategorySeries:"Switch Category / Series",categoryValues:"Category Values",seriesLabels:"Series Labels",aggregate:"Aggregate",xyValues:"X Y Values",paired:"Paired Mode",axis:"Axis",xAxis:"Horizontal Axis",yAxis:"Vertical Axis",polarAxis:"Polar Axis",radiusAxis:"Radius Axis",navigator:"Navigator",zoom:"Zoom",animation:"Animation",crosshair:"Crosshair",color:"Color",thickness:"Thickness",preferredLength:"Preferred Length",xType:"X Type",axisType:"Axis Type",automatic:"Automatic",category:"Category",number:"Number",time:"Time",timeFormat:"Time Format",autoRotate:"Auto Rotate",labelRotation:"Rotation",circle:"Circle",polygon:"Polygon",square:"Square",cross:"Cross",diamond:"Diamond",plus:"Plus",triangle:"Triangle",heart:"Heart",orientation:"Orientation",fixed:"Fixed",parallel:"Parallel",perpendicular:"Perpendicular",radiusAxisPosition:"Position",ticks:"Ticks",gridLines:"Grid Lines",width:"Width",height:"Height",length:"Length",padding:"Padding",spacing:"Spacing",chartStyle:"Chart Style",title:"Title",chartTitles:"Titles",chartTitle:"Chart Title",chartSubtitle:"Subtitle",horizontalAxisTitle:"Horizontal Axis Title",verticalAxisTitle:"Vertical Axis Title",polarAxisTitle:"Polar Axis Title",titlePlaceholder:"Chart Title",background:"Background",font:"Font",weight:"Weight",top:"Top",right:"Right",bottom:"Bottom",left:"Left",labels:"Labels",calloutLabels:"Callout Labels",sectorLabels:"Sector Labels",positionRatio:"Position Ratio",size:"Size",shape:"Shape",minSize:"Minimum Size",maxSize:"Maximum Size",legend:"Legend",position:"Position",markerSize:"Marker Size",markerStroke:"Marker Stroke",markerPadding:"Marker Padding",itemSpacing:"Item Spacing",itemPaddingX:"Item Padding X",itemPaddingY:"Item Padding Y",layoutHorizontalSpacing:"Horizontal Spacing",layoutVerticalSpacing:"Vertical Spacing",strokeWidth:"Stroke Width",offset:"Offset",offsets:"Offsets",tooltips:"Tooltips",callout:"Callout",markers:"Markers",shadow:"Shadow",blur:"Blur",xOffset:"X Offset",yOffset:"Y Offset",lineWidth:"Line Width",lineDash:"Line Dash",lineDashOffset:"Dash Offset",scrollingZoom:"Scrolling",scrollingStep:"Scrolling Step",selectingZoom:"Selecting",durationMillis:"Duration (ms)",crosshairLabel:"Label",crosshairSnap:"Snap to Node",normal:"Normal",bold:"Bold",italic:"Italic",boldItalic:"Bold Italic",predefined:"Predefined",fillOpacity:"Fill Opacity",strokeColor:"Line Color",strokeOpacity:"Line Opacity",miniChart:"Mini-Chart",histogramBinCount:"Bin count",connectorLine:"Connector Line",seriesItems:"Series Items",seriesItemType:"Item Type",seriesItemPositive:"Positive",seriesItemNegative:"Negative",seriesItemLabels:"Item Labels",columnGroup:"Column",barGroup:"Bar",pieGroup:"Pie",lineGroup:"Line",scatterGroup:"X Y (Scatter)",areaGroup:"Area",polarGroup:"Polar",statisticalGroup:"Statistical",hierarchicalGroup:"Hierarchical",specializedGroup:"Specialized",combinationGroup:"Combination",groupedColumnTooltip:"Grouped",stackedColumnTooltip:"Stacked",normalizedColumnTooltip:"100% Stacked",groupedBarTooltip:"Grouped",stackedBarTooltip:"Stacked",normalizedBarTooltip:"100% Stacked",pieTooltip:"Pie",donutTooltip:"Donut",lineTooltip:"Line",stackedLineTooltip:"Stacked",normalizedLineTooltip:"100% Stacked",groupedAreaTooltip:"Area",stackedAreaTooltip:"Stacked",normalizedAreaTooltip:"100% Stacked",scatterTooltip:"Scatter",bubbleTooltip:"Bubble",histogramTooltip:"Histogram",radialColumnTooltip:"Radial Column",radialBarTooltip:"Radial Bar",radarLineTooltip:"Radar Line",radarAreaTooltip:"Radar Area",nightingaleTooltip:"Nightingale",rangeBarTooltip:"Range Bar",rangeAreaTooltip:"Range Area",boxPlotTooltip:"Box Plot",treemapTooltip:"Treemap",sunburstTooltip:"Sunburst",waterfallTooltip:"Waterfall",heatmapTooltip:"Heatmap",columnLineComboTooltip:"Column & Line",areaColumnComboTooltip:"Area & Column",customComboTooltip:"Custom Combination",innerRadius:"Inner Radius",startAngle:"Start Angle",endAngle:"End Angle",reverseDirection:"Reverse Direction",groupPadding:"Group Padding",seriesPadding:"Series Padding",tile:"Tile",whisker:"Whisker",cap:"Cap",capLengthRatio:"Length Ratio",labelPlacement:"Placement",inside:"Inside",outside:"Outside",noDataToChart:"No data available to be charted.",pivotChartRequiresPivotMode:"Pivot Chart requires Pivot Mode enabled.",chartSettingsToolbarTooltip:"Menu",chartLinkToolbarTooltip:"Linked to Grid",chartUnlinkToolbarTooltip:"Unlinked from Grid",chartDownloadToolbarTooltip:"Download Chart",chartMenuToolbarTooltip:"Menu",chartEdit:"Edit Chart",chartAdvancedSettings:"Advanced Settings",chartLink:"Link to Grid",chartUnlink:"Unlink from Grid",chartDownload:"Download Chart",histogramFrequency:"Frequency",seriesChartType:"Series Chart Type",seriesType:"Series Type",secondaryAxis:"Secondary Axis",seriesAdd:"Add a series",categoryAdd:"Add a category",bar:"Bar",column:"Column",histogram:"Histogram",advancedSettings:"Advanced Settings",direction:"Direction",horizontal:"Horizontal",vertical:"Vertical",seriesGroupType:"Group Type",groupedSeriesGroupType:"Grouped",stackedSeriesGroupType:"Stacked",normalizedSeriesGroupType:"100% Stacked",legendEnabled:"Enabled",groupedColumnFull:"Grouped Column",stackedColumnFull:"Stacked Column",normalizedColumnFull:"100% Stacked Column",groupedBarFull:"Grouped Bar",stackedBarFull:"Stacked Bar",normalizedBarFull:"100% Stacked Bar",stackedAreaFull:"Stacked Area",normalizedAreaFull:"100% Stacked Area",stackedLineFull:"Stacked Line",normalizedLineFull:"100% Stacked Line",customCombo:"Custom Combination",funnel:"Funnel",coneFunnel:"Cone Funnel",pyramid:"Pyramid",funnelGroup:"Funnel",funnelTooltip:"Funnel",coneFunnelTooltip:"Cone Funnel",pyramidTooltip:"Pyramid",dropOff:"Drop-Off",stageLabels:"Stage Labels",reverse:"Reverse",tooltipMode:"Tooltip Mode",tooltipModeSingle:"Single",tooltipModeShared:"Multiple",tooltipModeCompact:"Compact",groupedColumn:"Grouped",stackedColumn:"Stacked",pie:"Pie",donut:"Donut",line:"Line",scatter:"Scatter",bubble:"Bubble",area:"Area",stackedArea:"Stacked",radarLine:"Radar Line",radarArea:"Radar Area",nightingale:"Nightingale",radialColumn:"Radial Column",radialBar:"Radial Bar",boxPlot:"Box Plot",rangeBar:"Range Bar",rangeArea:"Range Area",treemap:"Treemap",sunburst:"Sunburst",waterfall:"Waterfall",heatmap:"Heatmap",columnLineCombo:"Column & Line",AreaColumnCombo:"Area & Column",ariaChartMenuClose:"Close Chart Edit Menu",ariaChartSelected:"Selected",group:"Group",timeFormatSlashesDDMMYYYY:"DD/MM/YYYY",timeFormatSlashesMMDDYYYY:"MM/DD/YYYY",timeFormatSlashesDDMMYY:"DD/MM/YY",timeFormatSlashesMMDDYY:"MM/DD/YY",timeFormatDotsDDMYY:"DD.M.YY",timeFormatDotsMDDYY:"M.DD.YY",timeFormatDashesYYYYMMDD:"YYYY-MM-DD",timeFormatSpacesDDMMMMYYYY:"DD MMMM YYYY",timeFormatHHMMSS:"HH:MM:SS",timeFormatHHMMSSAmPm:"HH:MM:SS AM/PM",sum:"Sum",first:"First",last:"Last",min:"Min",max:"Max",count:"Count",avg:"Average"},vT=class extends VT{constructor(){super(...arguments);this.beanName="chartTranslation"}translate(G){let D=this.getLocaleTextFunc(),z=bT[G];return D(G,z)}},Hz=(G)=>{return(D)=>{if(D==null)return!0;return G(D)}},n5=(G)=>typeof G==="string",lJ=(G)=>typeof G==="boolean",dT=(G)=>typeof G==="object",bG=(G,D)=>(z)=>`AG Grid - unable to update chart as invalid params supplied: \`${G}: ${z}\`, expected ${D}.`,B9=(G)=>{return`${G} is not supported in AG Charts Community ('ag-charts-enterprise' hasn't been loaded). See https://www.ag-grid.com/javascript-data-grid/integrated-charts-installation/ for more details.`},lT=["doughnut"],pJ=["type","chartId","chartType","chartThemeName","chartThemeOverrides","unlinkChart"];function pT(G){return!!m8(G)||cJ(G)}function mT(G){return lT.includes(G)}var tT=Hz((G)=>{if(pT(G))return!0;if(mT(G)){let D=S0(G);return U0(`The chart type '${G}' has been deprecated. Please use '${D}' instead.`),D}return!1}),sT=Hz((G)=>{return typeof G==="object"}),oT=Hz((G)=>{return typeof G==="object"}),rT=Hz((G)=>{return typeof G==="string"||typeof G==="function"}),Q9=(G)=>({property:"chartType",validationFn:Hz((D)=>G||!D||!mP(D)),warnMessage:(D)=>B9(`The '${D}' chart type`)}),J9=(G)=>({property:"switchCategorySeries",validationFn:Hz((D)=>{if(!D||G)return!0;return}),warnMessage:()=>B9("'switchCategorySeries' has been ignored as it"),warnIfFixed:!0}),mJ=()=>[{property:"chartId",validationFn:n5,warnMessage:bG("chartId","string")},{property:"chartType",validationFn:tT,warnMessage:bG("chartType","ChartType")},{property:"chartThemeName",validationFn:n5,warnMessage:bG("chartThemeName","string")},{property:"chartThemeOverrides",validationFn:sT,warnMessage:bG("chartThemeOverrides","AgChartThemeOverrides")},{property:"unlinkChart",validationFn:lJ,warnMessage:bG("unlinkChart","boolean")}],U9=(G)=>[{property:"cellRange",validationFn:oT,warnMessage:bG("cellRange","ChartParamsCellRange")},{property:"suppressChartRanges",validationFn:lJ,warnMessage:bG("suppressChartRanges","boolean")},{property:"aggFunc",validationFn:rT,warnMessage:bG("aggFunc","string or IAggFunc")},J9(G)];function aT(G,D){switch(G.type){case"rangeChartUpdate":return Gy(G,D);case"pivotChartUpdate":return Dy(G);case"crossFilterChartUpdate":return zy(G,D);default:return U0(`Invalid value supplied for 'type': ${G.type}. It must be either 'rangeChartUpdate', 'pivotChartUpdate', or 'crossFilterChartUpdate'.`),!1}}function eT(G,D){return aB(G,[Q9(D),J9(D)])}function Gy(G,D){let z=[...mJ(),Q9(D),...U9(D),{property:"seriesChartTypes",validationFn:(B)=>B===void 0||Array.isArray(B)&&B.every(dT),warnMessage:bG("seriesChartTypes","Array of SeriesChartType")},{property:"useGroupColumnAsCategory",validationFn:lJ,warnMessage:bG("useGroupColumnAsCategory","boolean")}];return aB(G,z,[...pJ,"cellRange","suppressChartRanges","switchCategorySeries","aggFunc","seriesChartTypes","seriesGroupType","useGroupColumnAsCategory"],"UpdateRangeChartParams")}function Dy(G){let D=[...mJ()];return aB(G,D,[...pJ],"UpdatePivotChartParams")}function zy(G,D){let z=[...mJ(),...U9(D)];return aB(G,z,[...pJ,"cellRange","suppressChartRanges","aggFunc"],"UpdateCrossFilterChartParams")}function aB(G,D,z,B){let Q=void 0;for(let J of D){let{property:U,validationFn:Z,warnMessage:S,warnIfFixed:X}=J;if(U in G){let Y=G[U],W=Z(Y);if(W===!0)continue;if(W===!1)return U0(S(Y)),!1;if(Q=Q||{...G},Q[U]=W,X)U0(S(Y))}}if(z){for(let J of Object.keys(G))if(!z.includes(J))return U0(`Unexpected property supplied. ${B} does not contain: \`${J}\`.`),!1}if(Q)return Q;return!0}var Z9=["ag-default","ag-material","ag-sheets","ag-polychroma","ag-vivid"],By=class extends nT{constructor(G){super();this.model=G,this.isEnterprise=()=>this.agChartsExports.isEnterprise}wireBeans(G){this.rangeSvc=G.rangeSvc,this.agChartsExports=G.agChartsExports}postConstruct(){if(this.setChartRange(),this.model.unlinked){if(this.rangeSvc)this.rangeSvc.setCellRanges([])}let G=this.updateForGridChange.bind(this,{});this.addManagedEventListeners({cellSelectionChanged:(D)=>{if(D.id&&D.id===this.model.chartId)this.updateForRangeChange()},columnMoved:G,columnPinned:G,columnVisible:G,columnRowGroupChanged:G,modelUpdated:G,cellValueChanged:this.updateForDataChange.bind(this),cellEditValuesChanged:this.updateForDataChange.bind(this)})}update(G){if(!this.validUpdateType(G))return!1;let D=aT(G,this.agChartsExports.isEnterprise);if(!D)return!1;let z=D===!0?G:D;return this.applyValidatedChartParams(z),!0}applyValidatedChartParams(G){let{chartId:D,chartType:z,chartThemeName:B,unlinkChart:Q}=G,U={...{chartId:D,pivotChart:this.model.pivotChart,chartType:z??this.model.chartType,chartThemeName:B??this.model.chartThemeName,unlinkChart:Q??this.model.unlinked,cellRange:this.model.suppliedCellRange,switchCategorySeries:this.model.switchCategorySeries,aggFunc:this.model.aggFunc,seriesChartTypes:void 0,suppressChartRanges:!1,crossFiltering:!1}};switch(G.type){case"rangeChartUpdate":U.cellRange=this.createCellRange(G)??this.model.suppliedCellRange,U.switchCategorySeries=G.switchCategorySeries??this.model.switchCategorySeries,U.aggFunc=G.aggFunc??this.model.aggFunc,U.seriesChartTypes=G.seriesChartTypes,U.suppressChartRanges=G.suppressChartRanges??this.model.suppressChartRanges,U.seriesGroupType=G.seriesGroupType??this.model.seriesGroupType,U.useGroupColumnAsCategory=G.useGroupColumnAsCategory??this.model.useGroupColumnAsCategory;break;case"crossFilterChartUpdate":U.cellRange=this.createCellRange(G)??this.model.suppliedCellRange,U.switchCategorySeries=!1,U.aggFunc=G.aggFunc??this.model.aggFunc,U.crossFiltering=!0,U.crossFilteringSort=this.model.crossFilteringSort,U.suppressChartRanges=G.suppressChartRanges??this.model.suppressChartRanges;break;case"pivotChartUpdate":U.switchCategorySeries=!1;break}if(this.model.updateModel(U),U.unlinkChart||U.suppressChartRanges)this.rangeSvc?.setCellRanges([]);else this.setChartRange()}updateForGridChange(G){if(this.model.unlinked)return;let{maintainColState:D,setColsFromRange:z}=G??{};this.model.updateCellRanges({maintainColState:D,setColsFromRange:z}),this.model.updateData(),this.setChartRange()}updateForDataChange(){if(this.model.unlinked)return;this.model.updateData(),this.raiseChartModelUpdateEvent()}updateForRangeChange(){this.updateForGridChange({setColsFromRange:!0}),this.raiseChartRangeSelectionChangedEvent()}updateForPanelChange(G){if(this.model.updateCellRanges(G),this.model.updateData(),G.skipAnimation)this.getChartProxy().getChartRef().skipAnimations();this.setChartRange(),this.raiseChartRangeSelectionChangedEvent()}updateThemeOverrides(G){this.chartProxy.updateThemeOverrides(G)}getChartUpdateParams(G){let z=this.getSelectedValueColState().map((Z)=>({colId:Z.colId,displayName:Z.displayName})),B=this.getChartData(),Q=this.getSelectedDimensions(),J=this.model,U={data:B,groupData:J.groupChartData,grouping:this.isGrouping(),categories:Q.map(({colId:Z,displayName:S})=>{let X=J.categoryAxisType??J.getChartDataType(Z);return{id:Z,name:S,chartDataType:X,convertTime:X==="time"?J.getConvertTime(Z):void 0}}),fields:z,chartId:this.getChartId(),getCrossFilteringContext:()=>({lastSelectedChartId:"xxx"}),seriesChartTypes:this.getSeriesChartTypes(),updatedOverrides:G,seriesGroupType:J.seriesGroupType};return this.isCategorySeriesSwitched()?this.invertCategorySeriesParams(U):U}invertCategorySeriesParams(G){let[D]=G.categories,z=[{id:gG,name:""}],B=G.data.map((J,U)=>{let Z=`${D.id}:${U}`,S=J[D.id],X=S==null?"":String(S);return{colId:Z,displayName:X}}),Q=G.fields.map((J)=>{let U={[gG]:J.displayName};for(let[Z,S]of G.data.entries()){let X=`${D.id}:${Z}`,Y=S[J.colId];U[X]=Y}return U});return{...G,categories:z,fields:B,data:Q}}getChartModel(){let G=this.model.pivotChart?"pivot":"range",D=this.isComboChart()?this.model.comboChartModel.seriesChartTypes:void 0;return{modelType:G,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:D,seriesGroupType:this.model.seriesGroupType,useGroupColumnAsCategory:this.model.useGroupColumnAsCategory}}getChartId(){return this.model.chartId}getChartData(){return this.model.chartData}getChartType(){return this.model.chartType}setChartType(G){this.updateMultiSeriesAndCategory(this.model.chartType,G),this.model.chartType=G,this.model.comboChartModel.updateSeriesChartTypes(),this.model.switchCategorySeries=!1,this.model.categoryAxisType=void 0,this.model.seriesGroupType=void 0,this.raiseChartModelUpdateEvent()}isCategorySeriesSwitched(){return this.model.switchCategorySeries&&!this.model.isGrouping()}switchCategorySeries(G){if(!s8(this.getChartType()))return;this.model.switchCategorySeries=G,this.raiseChartModelUpdateEvent()}getAggFunc(){return this.model.aggFunc}setAggFunc(G,D){if(this.model.aggFunc===G)return;if(this.model.aggFunc=G,D)return;this.model.updateData(),this.raiseChartModelUpdateEvent()}updateMultiSeriesAndCategory(G,D){let z=(Z,S)=>{let X=0;for(let Y of Z){if(!Y.selected)continue;if(X>=S)Y.selected=!1;else X++}if(X===0)Z[0].selected=!0},B=QJ(D),Q=bB(D),J=B!=null&&(QJ(G)??100)>(B??100),U=Q!=null&&(bB(G)??100)>(Q??100);if(J)z(this.model.dimensionColState,B);if(U)z(this.model.valueColState,Q);if(J||U)this.model.resetCellRanges(J,U),this.setChartRange(!0)}setChartThemeName(G,D){if(this.model.chartThemeName=G,!D)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")||Z9}getThemes(){return this.getThemeNames().map((D)=>{let B=iJ(D,this.agChartsExports._Theme)?D:this.chartProxy.lookupCustomChartTheme(D);return this.agChartsExports._Theme.getChartTheme(B)})}getPalettes(){return this.getThemes().map((D)=>{return D.palette})}getSelectedValueColState(){return this.model.getValueColState().filter((G)=>G.selected)}getSelectedDimensions(){return this.model.getSelectedDimensions()}getColStateForMenu(){return{dimensionCols:this.model.dimensionColState,valueCols:this.model.getValueColState()}}setChartRange(G=!1){if(this.rangeSvc&&!this.model.suppressChartRanges&&!this.model.unlinked)this.rangeSvc.setCellRanges(this.getCellRanges());if(!G)this.raiseChartModelUpdateEvent()}detachChartRange(){if(this.model.unlinked=!this.model.unlinked,this.model.unlinked){if(this.rangeSvc)this.rangeSvc.setCellRanges([])}else this.updateForGridChange();this.dispatchLocalEvent({type:"chartLinkedChanged"})}setChartProxy(G){this.chartProxy=G}getChartProxy(){return this.chartProxy}isActiveXYChart(){return["scatter","bubble"].includes(this.getChartType())}isChartLinked(){return!this.model.unlinked}customComboExists(){let G=this.model.comboChartModel.savedCustomSeriesChartTypes;return G&&G.length>0}getSeriesChartTypes(){return this.model.comboChartModel.seriesChartTypes}isComboChart(G){return this.model.isComboChart(G)}updateSeriesChartType(G,D,z){let B=this.model.comboChartModel.seriesChartTypes.find((Q)=>Q.colId===G);if(B){let Q=this.model.chartType!=="customCombo";if(Q)this.model.chartType="customCombo";let J=B.chartType;if(D!=null)B.chartType=D;if(z!=null)B.secondaryAxis=z;if(this.model.comboChartModel.savedCustomSeriesChartTypes=this.model.comboChartModel.seriesChartTypes,this.model.comboChartModel.updateSeriesChartTypes(),this.updateForDataChange(),Q)this.dispatchLocalEvent({type:"chartTypeChanged"});if(J!==D)this.dispatchLocalEvent({type:"chartSeriesChartTypeChanged"});this.raiseChartOptionsChangedEvent()}}getActiveSeriesChartTypes(){let G=this.getSelectedValueColState().map((D)=>D.colId);return this.getSeriesChartTypes().filter((D)=>G.includes(D.colId))}getChartSeriesTypes(G){let D=G??this.getChartType();return this.isComboChart(D)?["line","bar","area"]:[l(D)]}getChartSeriesType(){let G=this.getSeriesChartTypes();if(G.length===0)return"bar";let D=G[0].chartType;if(D==="columnLineCombo")return"bar";if(D==="areaColumnCombo")return"area";return l(D)}getCellRanges(){return[this.model.dimensionCellRange,this.model.valueCellRange].filter((G)=>G)}createCellRange(G){return G.cellRange&&this.rangeSvc?.createPartialCellRangeFromRangeParams(G.cellRange,!0)}validUpdateType(G){if(!G.type)return i5(136),!1;let D={"Range Chart":()=>!this.isPivotChart()&&!this.isCrossFilterChart(),"Pivot Chart":()=>this.isPivotChart(),"Cross Filter Chart":()=>this.isCrossFilterChart()},z=Object.keys(D).find((Q)=>D[Q]())??"Range Chart",B=G.type===`${z[0].toLowerCase()}${z.slice(1).replace(/ /g,"")}Update`;if(!B)i5(137,{currentChartType:z,type:G.type});return B}getCellRangeParams(){let G=this.getCellRanges(),D=G[0],z=D?.startRow||null,B=D?.endRow||null;return{rowStartIndex:z?.rowIndex??null,rowStartPinned:z?.rowPinned,rowEndIndex:B?.rowIndex??null,rowEndPinned:B?.rowPinned,columns:G.reduce((Q,J)=>Q.concat(J.columns.map((U)=>U.getId())),[])}}setCategoryAxisType(G){this.model.categoryAxisType=G,this.raiseChartModelUpdateEvent()}getSeriesGroupType(){return this.model.seriesGroupType??this.chartProxy.getSeriesGroupType()}setSeriesGroupType(G){this.model.seriesGroupType=G,this.raiseChartModelUpdateEvent()}raiseChartModelUpdateEvent(){this.dispatchLocalEvent({type:"chartModelUpdate"}),this.raiseChartOptionsChangedEvent()}raiseChartUpdatedEvent(){this.dispatchLocalEvent({type:"chartUpdated"})}raiseChartApiUpdateEvent(){this.dispatchLocalEvent({type:"chartApiUpdate"})}raiseChartOptionsChangedEvent(){let{chartId:G,chartType:D}=this.getChartModel();this.eventSvc.dispatchEvent({type:"chartOptionsChanged",chartId:G,chartType:D,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(){if(super.destroy(),this.rangeSvc)this.rangeSvc.setCellRanges([])}},Qy=class extends HD{getAxes(G){let D={x:{type:this.getXAxisType(G),position:"bottom"},y:{type:"number",position:"left"}};if(this.isNormalised())D.y.label={...D.y.label,formatter:(z)=>Math.round(z.value)+"%"};return D}getSeries(G){let[D]=G.categories,z=G.fields.map((B)=>({type:this.standaloneChartType,xKey:D.id,xName:D.name,yKey:B.colId,yName:B.displayName,normalizedTo:this.chartType==="normalizedArea"?100:void 0,stacked:["normalizedArea","stackedArea"].includes(this.chartType)}));return this.crossFiltering?this.extractLineAreaCrossFilterSeries(z,G):z}isNormalised(){return!this.crossFiltering&&this.chartType==="normalizedArea"}},Jy=new Set(["bar","groupedBar","stackedBar","normalizedBar"]),Uy=class extends HD{getAxes(G){let D={x:{type:this.getXAxisType(G),position:this.isHorizontal()?"left":"bottom"},y:{type:"number",position:this.isHorizontal()?"bottom":"left"}};if(this.isNormalised())D.y.label={...D.y.label,formatter:(z)=>Math.round(z.value)+"%"};return D}getSeries(G){let[D]=G.categories,z=G.fields.map((B)=>({type:this.standaloneChartType,direction:this.isHorizontal()?"horizontal":"vertical",stacked:this.crossFiltering||sP(this.chartType),normalizedTo:this.isNormalised()?100:void 0,xKey:D.id,xName:D.name,yKey:B.colId,yName:B.displayName}));return this.crossFiltering?this.extractCrossFilterSeries(z):z}extractCrossFilterSeries(G){let D=[];for(let z=0;zMath.round(z.value)+"%"};return D}getSeries(G){let[D]=G.categories,z=["normalizedLine","stackedLine"].includes(this.chartType),B=G.fields.map((Q)=>({type:this.standaloneChartType,xKey:D.id,xName:D.name,yKey:Q.colId,yName:Q.displayName,normalizedTo:z&&this.isNormalised()?100:void 0,stacked:z}));return this.crossFiltering?this.extractLineAreaCrossFilterSeries(B,G):B}isNormalised(){let G=["normalizedLine"];return!this.crossFiltering&&G.includes(this.chartType)}},$y=class extends HD{getAxes(G){return{x:{type:"number",position:"bottom"},y:{type:"number",position:"left"}}}getSeries(G){let[D]=G.categories,z=this.isPaired(),B=this.getSeriesDefinitions(G.fields,z),Q=D.id===gG?void 0:D,J=B.map((U)=>{if(U?.sizeField)return{type:"bubble",xKey:U.xField.colId,xName:U.xField.displayName??void 0,yKey:U.yField.colId,yName:U.yField.displayName??void 0,title:`${U.yField.displayName} vs ${U.xField.displayName}`,sizeKey:U.sizeField.colId,sizeName:U.sizeField.displayName??"",labelKey:Q?Q.id:U.yField.colId,labelName:Q?Q.name:void 0};return{type:"scatter",xKey:U.xField.colId,xName:U.xField.displayName??void 0,yKey:U.yField.colId,yName:U.yField.displayName??void 0,title:`${U.yField.displayName} vs ${U.xField.displayName}`,labelKey:Q?Q.id:U.yField.colId,labelName:Q?Q.name:void 0}});return this.crossFiltering?this.extractCrossFilterSeries(J,G):J}extractCrossFilterSeries(G,D){let{data:z}=D,B=(S)=>`${S}-filtered-out`,Q=(S,X)=>{let Y=[1/0,-1/0];if(X!=null)for(let W of S){let q=W[X]??W[B(X)];if(qY[1])Y[1]=q}if(Y[0]<=Y[1])return Y;return},J=(S)=>{let X=void 0;if(S.type==="bubble"){let{sizeKey:Y}=S;X=Q(z,Y)}return{...S,domain:X,highlight:{highlightedItem:{fill:"yellow"}},listeners:{...S.listeners,seriesNodeClick:this.crossFilterCallback}}},U=(S)=>{let{yKey:X,xKey:Y}=S,W={};if(S.type==="bubble")W={sizeKey:B(S.sizeKey)};return{...S,...W,yKey:B(X),xKey:B(Y),showInLegend:!1,listeners:{...S.listeners,seriesNodeClick:(q)=>{let H=q.datum[B(Y)],_={...q,xKey:Y,datum:{...q.datum,[Y]:H}};this.crossFilterCallback(_)}}}},Z=G.map(J);return[...Z,...Z.map(U)]}getSeriesDefinitions(G,D){if(G.length<2)return[];let z=this.chartType==="bubble";if(D){if(z)return G.map((Q,J)=>J%3===0?{xField:Q,yField:G[J+1],sizeField:G[J+2]}:null).filter((Q)=>Q?.yField&&Q.sizeField);return G.map((Q,J)=>J%2===0?{xField:Q,yField:G[J+1]}:null).filter((Q)=>Q?.yField)}let B=G[0];if(z)return G.map((Q,J)=>J%2===1?{xField:B,yField:Q,sizeField:G[J+1]}:null).filter((Q)=>Q?.sizeField);return G.filter((Q,J)=>J>0).map((Q)=>({xField:B,yField:Q}))}},Ly=class extends HD{getAxes(G){let D=G?G.fields:[],z=new Map(D.map((U)=>[U.colId,U])),{primaryYKeys:B,secondaryYKeys:Q}=this.getYKeys(D,G.seriesChartTypes),J={x:{type:this.getXAxisType(G),position:"bottom"}};if(B.length>0)J.y={type:"number",position:"left"};if(Q.length>0)Q.forEach((U)=>{let Z=z.get(U);if(!(Z&&Z.colId===U))return;let X={type:"number",position:"right"};J[`y_${U}`]=X});return J}getSeries(G){let{fields:D,seriesChartTypes:z}=G,[B]=G.categories;return D.map((Q)=>{let J=z.find((U)=>U.colId===Q.colId);if(J){let U=J.chartType,S=["groupedColumn","groupedBar"].includes(U)?{grouped:!0}:{},X=J.secondaryAxis?`y_${Q.colId}`:"y";return{type:l(U),xKey:B.id,yKey:Q.colId,yName:Q.displayName,yKeyAxis:X,stacked:["stackedArea","stackedColumn"].includes(U),...S}}})}getYKeys(G,D){let z=[],B=[];for(let Q of G){let J=Q.colId,U=D.find((Z)=>Z.colId===J);if(U)if(U.secondaryAxis)B.push(J);else z.push(J)}return{primaryYKeys:z,secondaryYKeys:B}}setSeriesChartThemeDefaults(G){let D=this.getSeriesChartThemeDefaults();if(!D)return;let z=new Set;for(let B of this.chartProxyParams.seriesChartTypes)z.add(B.chartType);for(let B of z)G[l(B)]=D}};function Sy(G){let D=G.currentOffset;G.currentOffset-=G.offsetAmount;let z=G.currentOffset;return G.currentOffset-=G.offsetAmount,{outerRadiusOffset:D,innerRadiusOffset:z}}var Xy=class extends qz{getUpdateOptions(G,D){return{...D,data:this.crossFiltering?this.getCrossFilterData(G):G.data,series:this.getSeries(G)}}getSeries(G){let[D]=G.categories,z=G.fields.length,B={currentOffset:0,offsetAmount:z>1?20:40},Q=this.getFields(G).map((J)=>{let U={type:this.standaloneChartType,angleKey:J.colId,angleName:J.displayName,sectorLabelKey:J.colId,calloutLabelName:D.name,calloutLabelKey:D.id};if(this.chartType==="donut"||this.chartType==="doughnut"){let{outerRadiusOffset:Z,innerRadiusOffset:S}=Sy(B),X=J.displayName?{title:{text:J.displayName,showInLegend:z>1}}:void 0;return{...U,type:"donut",outerRadiusOffset:Z,innerRadiusOffset:S,...X}}return U});return this.crossFiltering?this.extractCrossFilterSeries(Q):Q}getCrossFilterData(G){let D=G.fields[0].colId,z=`${D}-filtered-out`;return G.data.map((B)=>{let Q=B[D]+B[z];return B[`${D}-total`]=Q,B[z]=1,B[D]=B[D]/Q,B})}extractCrossFilterSeries(G){let D=G[0],z=D.angleKey,B={...D,radiusMin:0,radiusMax:1,listeners:{seriesNodeClick:this.crossFilterCallback},legendItemKey:D.calloutLabelKey,angleKey:`${z}-total`},Q={...B,radiusKey:z,sectorLabelKey:`${z}-total`};return[{...B,radiusKey:`${z}-filtered-out`,showInLegend:!1},Q]}getFields(G){return this.chartType==="pie"?G.fields.slice(0,1):G.fields}getSeriesChartThemeDefaults(){return{series:{highlight:nJ(this.crossFiltering)}}}},fy=class extends Hy{constructor(){super('
');this.eMenu=_y,this.buttonListenersDestroyFuncs=[]}wireBeans(G){this.chartTranslation=G.chartTranslation}updateParams(G){let{buttons:D}=G;this.createButtons(D)}createButtons(G){for(let z of this.buttonListenersDestroyFuncs)z?.();this.buttonListenersDestroyFuncs=[];let D=this.eMenu;ky(D);for(let z of G){let{buttonName:B,iconName:Q,callback:J}=z,U=this.createButton(Q),Z=this.chartTranslation.translate(B+"ToolbarTooltip");if(Z&&U instanceof HTMLElement)U.title=Z;this.buttonListenersDestroyFuncs.push(...this.addManagedElementListeners(U,{click:(S)=>J(S.currentTarget)})),D.appendChild(U)}}createButton(G){let D=Ky(G,this.beans);D.classList.add("ag-chart-menu-icon");let z=wy({tag:"button",attrs:{type:"button"},cls:"ag-chart-menu-toolbar-button"});return z.appendChild(D),z}destroy(){this.buttonListenersDestroyFuncs=[],super.destroy()}},Ty=".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)}}",yy=class extends uy{constructor(G){super('');this.config=G??{};let{selectedValueList:D,valueFormatter:z,valueList:B}=this.config;this.selectedValues=D??[],this.valueList=B??[],this.valueFormatter=z??((Q)=>jy(Q)),this.registerCSS(Ty)}postConstruct(){let{ariaLabel:G,onValuesChange:D,dragSourceId:z}=this.config;if(this.dropZonePanel=this.createManagedBean(new cy({getValues:()=>this.selectedValues,setValues:(Q)=>this.updateValues(Q),isDraggable:()=>this.selectedValues.length>1},(Q)=>this.valueFormatter(Q),G,z)),this.getGui().appendChild(this.dropZonePanel.getGui()),this.initSelect(),D!=null)this.onValuesChange=D}setValues(G,D){let{added:z,removed:B,updated:Q}=this.getChanges(this.valueList,G),J=!1;if(z.length||B.length||Q.length)J=!0;return this.valueList=G,this.updateValues(D,J,!0),this}setValueFormatter(G){return this.valueFormatter=G,this}initSelect(){let G=this.createSelectOptions();if(!G.length)return!1;let{selectPlaceholder:D}=this.config;return this.eSelect=this.createBean(new Oy({options:G,placeholder:D,onValueChange:(z)=>this.addValue(z),pickerIcon:"chartsMenuAdd"})),this.getGui().appendChild(this.eSelect.getGui()),!0}createSelectOptions(){let G=[],{maxSelection:D}=this.config;if(D&&this.selectedValues.length>=D)return G;for(let z of this.valueList)if(!this.selectedValues.includes(z))G.push({value:z,text:this.valueFormatter(z)});return G}addValue(G){this.dropZonePanel.addItem(G)}updateValues(G,D,z){let B=this.selectedValues;this.selectedValues=G;let Q=this.getChanges(B,G),J=D||Q.added.length||Q.removed.length,U=Py(this.beans),Z=this.eSelect?.getGui().contains(U),S=this.dropZonePanel?.getGui().contains(U);if(!z)this.onValuesChange?.(Q);let X=J?!this.refreshSelect():!1;if(this.dropZonePanel.refreshGui(),J&&Z)if(X)this.dropZonePanel.focusList(!0);else this.eSelect?.getFocusableElement().focus();if(S&&!G.length)this.eSelect?.getFocusableElement().focus()}getChanges(G,D){let z=D.filter((J)=>!G.includes(J)),B=G.filter((J)=>!D.includes(J)),Q=D.filter((J,U)=>G[U]!==J);return{added:z,removed:B,updated:Q,selected:D}}refreshSelect(){if(!this.eSelect)return this.initSelect();let G=this.createSelectOptions();if(!G.length)return gy(this.eSelect.getGui()),this.eSelect=this.destroyBean(this.eSelect),!1;return this.eSelect.clearOptions().addOptions(G).setValue(void 0,!0),!0}destroy(){this.destroyBean(this.eSelect),super.destroy()}},xy=class extends H7{constructor(G,D,z,B,Q,J){super(D,z,!1);this.value=G,this.valueFormatter=B,this.draggable=Q,this.sourceId=J}getItem(){return this.value}getDisplayName(){return this.valueFormatter(this.value)}getAriaDisplayName(){return this.getDisplayName()}getTooltip(){return}createGetDragItem(){return()=>({value:this.value})}getDragSourceType(){return $9.ChartPanel}getDragSourceId(){return this.sourceId}isMovable(){return this.isDraggable()}isDraggable(){return this.draggable}},cy=class extends q7{constructor(G,D,z,B){super(!1);this.model=G,this.valueFormatter=D,this.ariaLabel=z,this.sourceId=B}postConstruct(){super.init()}isItemDroppable(G,D){return this.isSourceEventFromTarget(D)||this.sourceId!=null&&this.sourceId===D.dragSource.sourceId}updateItems(G){this.model.setValues(G)}getExistingItems(){return this.model.getValues()}getIconName(){return this.isPotentialDndItems()?"move":"notAllowed"}getAriaLabel(){return this.ariaLabel}createPillComponent(G,D,z){return new xy(G,D,z,this.valueFormatter,this.model.isDraggable(),this.sourceId)}getItems(G){return[G.value]}isInterestedIn(G){return G===$9.ChartPanel}},L9=class extends vy{constructor(G,D,z,B){super(B);this.chartController=G,this.allowMultipleSelection=D,this.maxSelection=z}wireBeans(G){this.chartTranslation=G.chartTranslation}addItem(G){this.groupComp.addItem(G)}createGroup(G,D,z,B,Q){if(this.allowMultipleSelection){let J=G.filter((U)=>U.selected);this.valuePillSelect=this.groupComp.createManagedBean(new yy({valueList:G,selectedValueList:J,valueFormatter:D,selectPlaceholder:this.chartTranslation.translate(z),dragSourceId:B,onValuesChange:(U)=>this.onValueChange(U),maxSelection:this.maxSelection})),this.groupComp.addItem(this.valuePillSelect)}else{let J=this.createValueSelectParams(G);J.onValueChange=(U)=>{for(let Z of G)Z.selected=!1;if(U.selected=!0,U.colId===gG)this.chartController.setAggFunc(void 0,!0);this.chartController.updateForPanelChange({updatedColState:U,skipAnimation:Q?.()})},this.valueSelect=this.groupComp.createManagedBean(new by(J)),this.groupComp.addItem(this.valueSelect)}}refreshValueSelect(G){if(!this.valueSelect)return;let{options:D,value:z}=this.createValueSelectParams(G);this.valueSelect.clearOptions().addOptions(D).setValue(z,!0)}createValueSelectParams(G){let D;return{options:G.map((B)=>{let Q=B.displayName??"";if(B.selected)D=B;return{value:B,text:Q}}),value:D}}onValueChange({added:G,updated:D,removed:z,selected:B}){let Q,J,U=()=>{B.forEach((Z,S)=>{Z.order=S}),J=!0};if(G.length)Q=G[0],Q.selected=!0,U();else if(z.length)Q=z[0],Q.selected=!1;else if(D.length)U(),Q=D[0];if(Q)this.chartController.updateForPanelChange({updatedColState:Q,resetOrder:J})}destroy(){this.valuePillSelect=void 0,this.valueSelect=void 0,super.destroy()}},hy="sum",iy=class extends L9{constructor(G,D,z,B,Q){super(G,z,void 0,'
');this.title=D,this.dimensionCols=B,this.isOpen=Q}postConstruct(){this.groupComp=this.createBean(new jG({title:this.title,enabled:!0,suppressEnabledCheckbox:!0,suppressOpenCloseIcons:!1,cssIdentifier:"charts-data",expanded:this.isOpen})),this.createGroup(this.dimensionCols,(G)=>G.displayName??"","categoryAdd","categorySelect",()=>!this.chartController.getAggFunc()),this.createAggFuncControls(this.dimensionCols),this.getGui().appendChild(this.groupComp.getGui())}refresh(G){this.valuePillSelect?.setValues(G,G.filter((D)=>D.selected)),this.refreshValueSelect(G),this.refreshAggFuncControls(G,this.chartController.getAggFunc())}createAggFuncControls(G){let D=this.chartController.getAggFunc();this.groupComp.addItem(this.aggFuncToggle=this.createBean(new Vy({label:this.chartTranslation.translate("aggregate"),labelAlignment:"left",labelWidth:"flex",inputWidth:"flex",value:D!=null,onValueChange:(z)=>{let B=z?hy:void 0;this.chartController.setAggFunc(B),this.aggFuncSelect?.setValue(B,!0),this.aggFuncSelect?.setDisplayed(B!=null)}}))),this.groupComp.addItem(this.aggFuncSelect=this.createBean(new Cy({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 D==="string"?D:void 0,onValueChange:(z)=>{this.chartController.setAggFunc(z)}}))),this.refreshAggFuncControls(G,D)}refreshAggFuncControls(G,D){let B=G.filter((Q)=>Q.selected).some((Q)=>Q.colId!==gG);this.aggFuncToggle?.setValue(D!=null),this.aggFuncSelect?.setValue(typeof D==="string"?D:void 0,!0),this.aggFuncToggle?.setDisplayed(B),this.aggFuncSelect?.setDisplayed(B&&D!=null)}clearAggFuncControls(){this.aggFuncToggle=this.destroyBean(this.aggFuncToggle),this.aggFuncSelect=this.destroyBean(this.aggFuncSelect)}destroy(){this.clearAggFuncControls(),this.groupComp=this.destroyBean(this.groupComp),super.destroy()}},uD=class extends py{constructor(G){super();this.chartOptionsProxy=G}wireBeans(G){this.chartTranslation=G.chartTranslation}getDefaultColorPickerParams(G,D,z){return this.addValueParams(G,{label:this.chartTranslation.translate(D??"color"),labelWidth:"flex",inputWidth:"flex",labelAlignment:"top",pickerGap:6},z)}getDefaultNumberInputParams(G,D,z){return this.addValueParams(G,{label:this.chartTranslation.translate(D),labelAlignment:"top",labelWidth:"flex",inputWidth:"flex",precision:z?.precision,step:z?.step,min:z?.min,max:z?.max},{parseInputValue:(B)=>{let Q=Number(B);return isNaN(Q)?void 0:Q},formatInputValue:(B)=>{return B==null?"":`${B}`}})}getDefaultSliderParams(G,D,z,B){let Q=this.chartOptionsProxy.getValue(G)??0;if(B&&Array.isArray(Q))Q=Q[0];let J=this.getDefaultSliderParamsWithoutValueParams(Q,D,z);return J.onValueChange=(U)=>this.chartOptionsProxy.setValue(G,B?[U]:U),J}getDefaultSliderParamsWithoutValueParams(G,D,z){return{label:this.chartTranslation.translate(D),minValue:0,maxValue:Math.max(G,z),textFieldWidth:45,value:`${G}`}}getDefaultCheckboxParams(G,D,z){let B=this.chartOptionsProxy.getValue(G),Q={label:this.chartTranslation.translate(D),value:B,readOnly:z?.readOnly,passive:z?.passive};return Q.onValueChange=(J)=>{this.chartOptionsProxy.setValue(G,typeof J==="boolean"?J:void 0)},Q}getDefaultToggleParams(G,D,z){let B=this.chartOptionsProxy.getValue(G),Q={label:this.chartTranslation.translate(D),labelAlignment:"left",labelWidth:"flex",inputWidth:"flex",value:B,readOnly:z?.readOnly,passive:z?.passive};return Q.onValueChange=(J)=>{this.chartOptionsProxy.setValue(G,typeof J==="boolean"?J:void 0)},Q}getDefaultSelectParams(G,D,z){return this.getDefaultSelectParamsWithoutValueParams(D,z,this.chartOptionsProxy.getValue(G),(B)=>{this.chartOptionsProxy.setValue(G,B)})}getDefaultSelectParamsWithoutValueParams(G,D,z,B){return{label:this.chartTranslation.translate(G),labelAlignment:"top",options:D,pickerGap:6,value:z,onValueChange:B}}getDefaultFontPanelParams(G,D){let z=(B)=>`${G}.${B}`;return this.addEnableParams(z("enabled"),{name:this.chartTranslation.translate(D),suppressEnabledCheckbox:!1,chartMenuParamsFactory:this,keyMapper:z})}addValueParams(G,D,z){let B=this.chartOptionsProxy.getValue(G);return D.value=z?.formatInputValue?z.formatInputValue(B):B,D.onValueChange=(Q)=>{let J=z?.parseInputValue?z.parseInputValue(Q):Q;this.chartOptionsProxy.setValue(G,J)},D}addEnableParams(G,D){return D.enabled=this.chartOptionsProxy.getValue(G)??!1,D.onEnableChange=(z)=>this.chartOptionsProxy.setValue(G,z),D}getChartOptions(){return this.chartOptionsProxy}},my=class extends dy{constructor(G,D){super();this.chartMenuContext=G,this.isOpen=D,this.chartSpecificGroup=ly,this.hasContent=!1}wireBeans(G){this.chartTranslation=G.chartTranslation,this.chartSvc=G.chartSvc}postConstruct(){let D={title:this.getTitle(),enabled:!0,suppressEnabledCheckbox:!0,suppressOpenCloseIcons:!1,cssIdentifier:"charts-data",expanded:this.isOpen,items:[...this.createDirectionSelect(),this.createReverseSelect(),this.createGroupTypeSelect()]};this.setTemplate(` -
- -
`,[p],{chartSpecificGroup:D}),this.setDisplayed(this.hasContent)}refresh(){this.hasContent=!1,this.chartSpecificGroup.setTitle(this.getTitle()),this.updateDirectionSelect(),this.updateReverseSelect(),this.updateGroupTypeSelect(),this.setDisplayed(this.hasContent)}getTitle(){let G=this.chartMenuContext.chartController.getChartType();return this.chartTranslation.translate(hJ(G))}createDirectionSelect(){if(!this.chartSvc.isEnterprise())return[];let{chartOptionsService:G,chartController:D}=this.chartMenuContext,z=G.getSeriesOptionsProxy(()=>l(D.getChartType())),B=this.createManagedBean(new uD(z)),Q=["horizontal","vertical"].map((Z)=>({value:Z,text:this.chartTranslation.translate(Z)})),J=B.getDefaultSelectParams("direction","direction",Q),U=J.onValueChange;return J.onValueChange=(Z)=>{U(Z),D.raiseChartModelUpdateEvent()},this.directionSelect=this.createManagedBean(new l5(J)),this.updateDirectionSelect(),[this.directionSelect]}createReverseSelect(){let{chartMenuParamsFactory:G}=this.chartMenuContext,D=G.getDefaultToggleParams("series.reverse","reverse");return this.reverseToggle=this.createManagedBean(new ny(D)),this.updateReverseSelect(),this.reverseToggle}updateReverseSelect(){let G=this.chartMenuContext.chartController.getChartType()==="pyramid";this.updateDisplayed(this.reverseToggle,G)}updateDirectionSelect(){let G=eP(this.chartMenuContext.chartController.getChartType());this.updateDisplayed(this.directionSelect,G)}createGroupTypeSelect(){let{chartController:G,chartMenuParamsFactory:D}=this.chartMenuContext;return this.groupTypeSelect=this.createManagedBean(new l5(D.getDefaultSelectParamsWithoutValueParams("seriesGroupType",lP.map((z)=>({value:z,text:this.chartTranslation.translate(`${z}SeriesGroupType`)})),G.getSeriesGroupType(),(z)=>G.setSeriesGroupType(z)))),this.updateGroupTypeSelect(),this.groupTypeSelect}updateGroupTypeSelect(){let G=["radialColumn","radialBar","nightingale"].includes(this.chartMenuContext.chartController.getChartType());this.updateDisplayed(this.groupTypeSelect,G)}updateDisplayed(G,D){if(G?.setDisplayed(D),G)this.hasContent=this.hasContent||D}},ey=class extends oy{constructor(G,D,z){super('
');this.chartController=G,this.columns=D,this.isOpen=z,this.selectedColIds=[],this.chartTypeComps=new Map,this.secondaryAxisComps=new Map}wireBeans(G){this.chartTranslation=G.chartTranslation}postConstruct(){this.createSeriesChartTypeGroup(this.columns)}refresh(G){if(!ry(this.getValidColIds(G),this.selectedColIds))this.recreate(G);else this.refreshComps()}recreate(G){this.isOpen=this.seriesChartTypeGroupComp.isExpanded(),ay(this.getGui()),this.destroyBean(this.seriesChartTypeGroupComp),this.columns=G,this.selectedColIds=[],this.clearComps(),this.postConstruct()}getValidColIds(G){let D=this.chartController.getSeriesChartTypes();return G.filter((z)=>z.selected&&!!D.filter((B)=>B.colId===z.colId)[0]).map(({colId:z})=>z)}createSeriesChartTypeGroup(G){this.seriesChartTypeGroupComp=this.createBean(new jG({title:this.chartTranslation.translate("seriesChartType"),enabled:!0,suppressEnabledCheckbox:!0,suppressOpenCloseIcons:!1,cssIdentifier:"charts-data",expanded:this.isOpen}));let D=this.chartController.getSeriesChartTypes();for(let z of G){if(!z.selected)continue;let B=D.filter((X)=>X.colId===z.colId)[0];if(!B)continue;this.selectedColIds.push(z.colId);let Q=this.seriesChartTypeGroupComp.createManagedBean(new jG({title:z.displayName,enabled:!0,suppressEnabledCheckbox:!0,suppressOpenCloseIcons:!0,cssIdentifier:"charts-format-sub-level"})),J=(X)=>["groupedColumn","stackedColumn","stackedArea"].includes(X),U=this.seriesChartTypeGroupComp.createManagedBean(new ty({label:this.chartTranslation.translate("secondaryAxis"),labelWidth:"flex",disabled:J(B.chartType),value:!!B.secondaryAxis,onValueChange:(X)=>this.chartController.updateSeriesChartType(z.colId,void 0,X)}));Q.addItem(U);let Z=["line","area","stackedArea","groupedColumn","stackedColumn"].map((X)=>({value:X,text:this.chartTranslation.translate(hJ(X))})),S=Q.createManagedBean(new sy({options:Z,value:B.chartType,onValueChange:(X)=>this.chartController.updateSeriesChartType(z.colId,X)}));Q.addItem(S),this.seriesChartTypeGroupComp.addItem(Q),this.chartTypeComps.set(z.colId,S),this.secondaryAxisComps.set(z.colId,U)}this.getGui().appendChild(this.seriesChartTypeGroupComp.getGui())}refreshComps(){let G=this.chartController.getSeriesChartTypes();for(let D of this.selectedColIds){let z=G.find((J)=>J.colId===D);if(!z)continue;let B=this.chartTypeComps.get(D),Q=this.secondaryAxisComps.get(D);B?.setValue(z.chartType),Q?.setValue(!!z.secondaryAxis),Q?.setDisabled(this.isSecondaryAxisDisabled(z.chartType))}}clearComps(){this.chartTypeComps.clear(),this.secondaryAxisComps.clear()}isSecondaryAxisDisabled(G){return["groupedColumn","stackedColumn","stackedArea"].includes(G)}destroy(){this.clearComps(),this.seriesChartTypeGroupComp=this.destroyBean(this.seriesChartTypeGroupComp),super.destroy()}},Dx=class extends L9{constructor(G,D,z,B,Q,J,U){super(G,B,Q,'
');this.chartOptionsService=D,this.title=z,this.valueCols=J,this.isOpen=U}postConstruct(){if(this.groupComp=this.createBean(new jG({title:this.title,enabled:!0,suppressEnabledCheckbox:!0,suppressOpenCloseIcons:!1,cssIdentifier:"charts-data",expanded:this.isOpen})),this.chartController.isActiveXYChart()){let G=this.groupComp.createManagedBean(new Gx({label:this.chartTranslation.translate("paired"),labelAlignment:"left",labelWidth:"flex",inputWidth:"flex",value:this.chartOptionsService.getPairedMode(),onValueChange:(D)=>{this.chartOptionsService.setPairedMode(!!D),this.chartController.updateForGridChange({maintainColState:!0})}}));this.groupComp.addItem(G)}this.createGroup(this.valueCols,this.generateGetSeriesLabel(this.valueCols),"seriesAdd","seriesSelect"),this.getGui().appendChild(this.groupComp.getGui())}refresh(G){this.valuePillSelect?.setValueFormatter(this.generateGetSeriesLabel(G)),this.valuePillSelect?.setValues(G,G.filter((D)=>D.selected)),this.refreshValueSelect(G)}generateGetSeriesLabel(G){if(!this.chartController.isActiveXYChart())return(J)=>J.displayName??"";let D=G.filter((J)=>J.selected),z=this.chartController.getChartType()==="bubble",B=this.chartOptionsService.getPairedMode(),Q=new Map;return Q.set(0,"X"),Q.set(1,"Y"),Q.set(2,"size"),(J)=>{let U=J.displayName??"";if(!J.selected)return U;let Z=D.indexOf(J);if(Z===-1)return U;let S;if(B)S=Q.get(Z%(z?3:2));else if(Z===0)S="X";else S=z&&Z%2===0?"size":"Y";return`${U} (${S})`}}destroy(){this.groupComp=this.destroyBean(this.groupComp),super.destroy()}},zx={groups:[{type:"categories",isOpen:!0},{type:"series",isOpen:!0},{type:"seriesChartType",isOpen:!0},{type:"chartSpecific",isOpen:!0}]},Bx=class extends Iy{constructor(G){super('
');this.chartMenuContext=G,this.isSwitchCategorySeriesToggled=!1,this.restoreSwitchCategorySeriesToggleFocus=!1,this.panels=[],this.chartController=G.chartController}wireBeans(G){this.chartTranslation=G.chartTranslation,this.chartSvc=G.chartSvc}postConstruct(){this.createSwitchCategorySeriesToggle(),this.isSwitchCategorySeriesToggled=this.chartController.isCategorySeriesSwitched(),this.updatePanels();let G=this.updatePanels.bind(this);this.addManagedListeners(this.chartController,{chartModelUpdate:G,chartApiUpdate:G})}destroy(){this.clearPanelComponents(),super.destroy()}updatePanels(){let G=this.chartType,D=this.isSwitchCategorySeriesToggled,{dimensionCols:z,valueCols:B}=this.chartController.getColStateForMenu();this.chartType=this.chartController.getChartType(),this.isSwitchCategorySeriesToggled=this.chartController.isCategorySeriesSwitched();let Q=this.isSwitchCategorySeriesToggled!==D;if(this.canRefresh(G,this.chartType)&&!Q)this.categoriesDataPanel?.refresh(z),this.seriesDataPanel?.refresh(B),this.seriesChartTypePanel?.refresh(B),this.chartSpecificPanel?.refresh();else this.recreatePanels(z,B);let J=s8(this.chartType)&&this.chartSvc.isEnterprise()&&!this.chartController.isGrouping();if(Ay(this.switchCategorySeriesToggle.getGui(),J),Q)this.switchCategorySeriesToggle?.setValue(this.chartController.isCategorySeriesSwitched());if(this.restoreSwitchCategorySeriesToggleFocus){if(this.restoreSwitchCategorySeriesToggleFocus=!1,J)this.switchCategorySeriesToggle.getFocusableElement().focus()}}canRefresh(G,D){if(G===void 0)return!1;if(G===D)return!0;let z=(B)=>["columnLineCombo","areaColumnCombo","customCombo"].includes(B);if(z(G)&&z(D))return!0;return!1}recreatePanels(G,D){this.clearPanelComponents();let{chartType:z}=this;if(!z)return;let B=this.chartController.isCategorySeriesSwitched();this.getDataPanelDef().groups?.forEach(({type:Q,isOpen:J})=>{if(Q===(B?"series":"categories"))this.categoriesDataPanel=this.createBean(new iy(this.chartController,this.getCategoryGroupTitle(B),this.getCategoryGroupMultipleSelect(z,B),G,J)),this.panels.push(this.categoriesDataPanel);else if(Q===(B?"categories":"series"))this.seriesDataPanel=this.createBean(new Dx(this.chartController,this.chartMenuContext.chartOptionsService,this.getSeriesGroupTitle(B),this.getSeriesGroupMultipleSelect(z,B),this.getSeriesGroupMaxSelection(z,B),D,J)),this.panels.push(this.seriesDataPanel);else if(Q==="seriesChartType"){if(this.chartController.isComboChart())this.seriesChartTypePanel=this.createBean(new ey(this.chartController,D,J)),this.panels.push(this.seriesChartTypePanel)}else if(Q==="chartSpecific")this.chartSpecificPanel=this.createBean(new my(this.chartMenuContext,J)),this.panels.push(this.chartSpecificPanel);else Ry(144,{type:Q})}),(B?this.categoriesDataPanel:this.seriesDataPanel)?.addItem(this.switchCategorySeriesToggle.getGui()),this.addPanelComponents()}addPanelComponents(){if(!this.panels.length)return;let D=My(this.beans).createDocumentFragment();for(let z of this.panels)z.addCss("ag-chart-data-section"),D.appendChild(z.getGui());this.getGui().appendChild(D)}clearPanelComponents(){for(let G of this.panels)G.getGui().remove(),this.destroyBean(G);this.panels=[]}getDataPanelDef(){return this.gos.get("chartToolPanelsDef")?.dataPanel??zx}getCategoryGroupTitle(G){if(G)return this.chartTranslation.translate("seriesLabels");return this.chartTranslation.translate(this.chartController.isActiveXYChart()?"labels":"categories")}getCategoryGroupMultipleSelect(G,D){if(D)return!1;return QJ(G)!==1}getSeriesGroupTitle(G){if(G)return this.chartTranslation.translate("categoryValues");return this.chartTranslation.translate(this.chartController.isActiveXYChart()?"xyValues":"series")}getSeriesGroupMultipleSelect(G,D){return this.getSeriesGroupMaxSelection(G,D)!==1}getSeriesGroupMaxSelection(G,D){if(D)return;return bB(G)}createSwitchCategorySeriesToggle(){this.switchCategorySeriesToggle=this.createManagedBean(new Ey({label:this.chartTranslation.translate("switchCategorySeries"),labelAlignment:"left",labelWidth:"flex",inputWidth:"flex",value:this.chartController.isCategorySeriesSwitched(),onValueChange:(G)=>{this.restoreSwitchCategorySeriesToggleFocus=!0,this.chartController.switchCategorySeries(G)}}))}},qx=class extends Lx{constructor(G){super(G,`
-
-
-
-
-
-
-
- -
-
`,[Sx]);this.eLabel=QB,this.eParentCircle=QB,this.eChildCircle=QB,this.eAngleValue=QB,this.radius=0,this.offsetX=0,this.offsetY=0}wireBeans(G){this.dragSvc=G.dragSvc}postConstruct(){super.postConstruct();let{value:G,onValueChange:D}=this.config;if(G!=null)this.setValue(G,void 0,!0);if(D!=null)this.onValueChange(D);if(this.dragListener={eElement:this.eParentCircle,dragStartPixels:0,onDragStart:()=>{this.parentCircleRect=this.eParentCircle.getBoundingClientRect()},onDragging:(z)=>this.calculateAngleDrag(z),onDragStop:()=>{}},this.dragSvc?.addDragSource(this.dragListener),this.eAngleValue.setLabel("").setLabelWidth(5).setInputWidth(45).setMin(0).setMax(360).setValue(`${this.degrees}`).onValueChange((z)=>{if(z==null||z==="")z="0";z=this.eAngleValue.normalizeValue(z);let B=parseFloat(z);if(B>180)B=B-360;this.setValue(B)}),this.updateNumberInput(),Xx(this.getValue()))this.eAngleValue.setValue(this.normalizeNegativeValue(this.getValue()).toString());this.addManagedListeners(this,{fieldValueChanged:()=>{if(this.eAngleValue.getInputElement().contains(Yx(this.beans)))return;this.updateNumberInput()}})}updateNumberInput(){let G=this.normalizeNegativeValue(this.getValue());this.eAngleValue.setValue(G.toString())}positionChildCircle(G){let D=this.parentCircleRect||{width:24,height:24},z=this.eChildCircle,B=D.width/2,Q=D.height/2;z.style.left=`${B+Math.cos(G)*8}px`,z.style.top=`${Q+Math.sin(G)*8}px`}calculatePolar(){let G=this.offsetX,D=this.offsetY,z=Math.atan2(D,G);this.degrees=this.toDegrees(z),this.radius=Math.sqrt(G*G+D*D),this.positionChildCircle(z)}calculateCartesian(){let G=this.toRadians(this.getValue()),D=this.getRadius();this.setOffsetX(Math.cos(G)*D).setOffsetY(Math.sin(G)*D)}setOffsetX(G){if(this.offsetX!==G)this.offsetX=G,this.calculatePolar();return this}setOffsetY(G){if(this.offsetY!==G)this.offsetY=G,this.calculatePolar();return this}calculateAngleDrag(G){let D=this.parentCircleRect,z=D.width/2,B=D.height/2,Q=G.clientX-D.left,J=G.clientY-D.top,U=Q-z,Z=J-B,S=Math.atan2(Z,U);this.setValue(S,!0)}toDegrees(G){return G/Math.PI*180}toRadians(G){return G/180*Math.PI}normalizeNegativeValue(G){return G<0?360+G:G}normalizeAngle180(G){if(G%=Math.PI*2,G<-Math.PI)G+=Math.PI*2;else if(G>=Math.PI)G-=Math.PI*2;return G}getRadius(){return this.radius}setRadius(G){if(this.radius===G)return this;return this.radius=G,this.calculateCartesian(),this}onValueChange(G){return this.addManagedListeners(this,{fieldValueChanged:()=>{G(this.degrees)}}),this}getValue(G){return G?this.toRadians(this.degrees):this.degrees}setValue(G,D,z){let B;if(!D)B=this.normalizeAngle180(this.toRadians(G));else B=G;if(G=this.toDegrees(B),this.degrees!==G){if(this.degrees=Math.floor(G),this.calculateCartesian(),this.positionChildCircle(B),!z)this.dispatchLocalEvent({type:"fieldValueChanged"})}return this}setWidth(G){return Wx(this.getGui(),G),this}setDisabled(G){return super.setDisabled(G),this.eAngleValue.setDisabled(G),this}destroy(){this.dragSvc?.removeDragSource(this.dragListener),super.destroy()}};function Kx(G){return G[0].toUpperCase()+G.substring(1).toLowerCase()}var YD=class extends _x{constructor(G){super();this.params=G,this.fontGroup=kx,this.activeComps=[],this.chartOptions=G.chartMenuParamsFactory.getChartOptions()}wireBeans(G){this.chartTranslation=G.chartTranslation}postConstruct(){let{cssIdentifier:G="charts-format-sub-level",name:D,enabled:z,onEnableChange:B,suppressEnabledCheckbox:Q,chartMenuParamsFactory:J,keyMapper:U}=this.params,Z={cssIdentifier:G,direction:"vertical",suppressOpenCloseIcons:!0,title:D,enabled:z,suppressEnabledCheckbox:!0,onEnableChange:(S)=>{if(B)B(S)},useToggle:!Q};this.setTemplate(`
- - - -
- - -
-
-
`,[p,Hx,TG],{fontGroup:Z,familySelect:this.getFamilySelectParams(),weightStyleSelect:this.getWeightStyleSelectParams(),sizeSelect:this.getSizeSelectParams(),colorPicker:J.getDefaultColorPickerParams(U("color"))}),this.toggleCss("ag-font-panel-no-header",!D)}addItem(G,D){if(D)this.fontGroup.prependItem(G);else this.fontGroup.addItem(G);this.activeComps.push(G)}setEnabled(G){this.fontGroup.setEnabled(G)}getFamilySelectParams(){let G=["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"],D=this.getInitialFontValue("fontFamily"),z=G[0];if(D){let J=G.map((U)=>U.toLowerCase()).indexOf(D.toLowerCase());if(J>=0)z=G[J];else{let U=Kx(D);G.push(U),z=U}}let B=G.sort().map((Q)=>({value:Q,text:Q}));return this.params.chartMenuParamsFactory.getDefaultSelectParamsWithoutValueParams("font",B,`${z}`,(Q)=>this.setFont({fontFamily:Q}))}getSizeSelectParams(){let G=[8,10,12,14,16,18,20,22,24,26,28,30,32,34,36],D=this.getInitialFontValue("fontSize");if(!G.includes(D))G.push(D);let z=G.sort((B,Q)=>B-Q).map((B)=>({value:`${B}`,text:`${B}`}));return this.params.chartMenuParamsFactory.getDefaultSelectParamsWithoutValueParams("size",z,`${D}`,(B)=>this.setFont({fontSize:parseInt(B,10)}))}getWeightStyleSelectParams(){let G=this.getInitialFontValue("fontWeight")??"normal",D=this.getInitialFontValue("fontStyle")??"normal",z=[{name:"normal",weight:"normal",style:"normal"},{name:"bold",weight:"bold",style:"normal"},{name:"italic",weight:"normal",style:"italic"},{name:"boldItalic",weight:"bold",style:"italic"}],B=z.find((J)=>J.weight===G&&J.style===D);if(!B)B={name:"predefined",weight:G,style:D},z.unshift(B);let Q=z.map((J)=>({value:J.name,text:this.chartTranslation.translate(J.name)}));return this.params.chartMenuParamsFactory.getDefaultSelectParamsWithoutValueParams("weight",Q,B.name,(J)=>{let U=z.find((Z)=>Z.name===J);this.setFont({fontWeight:U.weight,fontStyle:U.style})})}destroyActiveComps(){for(let G of this.activeComps)wx(G.getGui()),this.destroyBean(G)}destroy(){this.destroyActiveComps(),super.destroy()}setFont(G){let{keyMapper:D}=this.params;for(let z of Object.keys(G)){let B=G[z];if(B)this.chartOptions.setValue(D(z),B)}}getInitialFontValue(G){let{keyMapper:D}=this.params;return this.chartOptions.getValue(D(G))}},Fx=class extends fx{constructor(G){super();this.chartMenuUtils=G,this.axisTicksSizeSlider=Nx}wireBeans(G){this.chartTranslation=G.chartTranslation}postConstruct(){let{chartMenuUtils:G}=this,D=G.addEnableParams("tick.enabled",{cssIdentifier:"charts-format-sub-level",direction:"vertical",suppressOpenCloseIcons:!0,title:this.chartTranslation.translate("ticks"),suppressEnabledCheckbox:!0,useToggle:!0}),z=G.getDefaultColorPickerParams("tick.stroke"),B=G.getDefaultSliderParams("tick.width","width",10),Q=G.getDefaultSliderParams("tick.size","length",30);this.setTemplate(`
- - - - - -
`,[p,TG,WG],{axisTicksGroup:D,axisTicksColorPicker:z,axisTicksWidthSlider:B,axisTicksSizeSlider:Q})}setTickSizeSliderDisplayed(G){this.axisTicksSizeSlider.setDisplayed(G)}},Ix=class extends Ex{constructor(G){super();this.chartMenuUtils=G,this.chartOptions=G.getChartOptions()}wireBeans(G){this.chartTranslation=G.chartTranslation}postConstruct(){let G=this.chartMenuUtils.addEnableParams("gridLine.enabled",{cssIdentifier:"charts-format-sub-level",direction:"vertical",suppressOpenCloseIcons:!0,title:this.chartTranslation.translate("gridLines"),suppressEnabledCheckbox:!0,useToggle:!0}),D=this.getGridLineColorPickerParams("color"),z=this.getGridLineWidthSliderParams("thickness"),B=this.getGridLineDashSliderParams("lineDash");this.setTemplate(`
- - - - - -
`,[p,TG,WG],{gridLineGroup:G,gridLineColorPicker:D,gridLineWidthSlider:z,gridLineLineDashSlider:B})}getGridLineColorPickerParams(G){return this.chartMenuUtils.getDefaultColorPickerParams("gridLine.style",G,{formatInputValue:(D)=>{return D?.[0]?.stroke},parseInputValue:(D)=>{let z=this.chartOptions.getValue("gridLine.style")??[];if(z.length===0)return[{stroke:D,lineDash:[]}];return[{...z[0],stroke:D}]}})}getGridLineWidthSliderParams(G){return this.chartMenuUtils.getDefaultSliderParams("gridLine.width",G,10)}getGridLineDashSliderParams(G){let z=this.chartOptions.getValue("gridLine.style")?.[0]?.lineDash?.[0],B=this.chartMenuUtils.getDefaultSliderParamsWithoutValueParams(z??0,G,30);return B.onValueChange=(Q)=>{let J=this.chartOptions.getValue("gridLine.style.0.stroke");this.chartOptions.setValue("gridLine.style",[{lineDash:[Q],stroke:J}])},B}},Mx="%d %B %Y",JB=class extends Zx{constructor(G,D){super();this.axisType=G,this.options=D,this.axisGroup=BB,this.axisTypeSelect=BB,this.axisPositionSelect=BB,this.axisTimeFormatSelect=BB,this.activePanels=[],this.updateFuncs=[];let{chartOptionsService:z,seriesType:B,chartController:Q}=D;this.chartOptionsService=z,this.chartController=Q,this.chartOptionsSeriesProxy=z.getSeriesOptionsProxy(()=>B)}wireBeans(G){this.chartTranslation=G.chartTranslation}postConstruct(){let{isExpandedOnInit:G,chartOptionsService:D,registerGroupComponent:z}=this.options,B=this.axisType,Q={cssIdentifier:"charts-format-top-level",direction:"vertical",title:this.translate(B),expanded:G,suppressEnabledCheckbox:!0},J=D.getCartesianAxisOptionsProxy(this.axisType),U=this.createManagedBean(new uD(J)),Z=this.createManagedBean(new uD(D.getCartesianAxisThemeOverridesProxy(this.axisType))),S=this.getAxisTypeSelectParams(U,D.getCartesianAxisAppliedThemeOverridesProxy(this.axisType)),X=this.getAxisPositionSelectParams(U),Y=this.getAxisTimeFormatSelectParams(U),W=this.getAxisColorInputParams(Z),q=this.getAxisLineWidthSliderParams(Z);if(this.setTemplate(`
- - - - - - - -
`,[p,Ux,TG,WG],{axisGroup:Q,axisTypeSelect:S??void 0,axisPositionSelect:X??void 0,axisTimeFormatSelect:Y??void 0,axisColorInput:W,axisLineWidthSlider:q}),z(this.axisGroup),this.axisTypeSelect.setDisplayed(!!S.options?.length),!X)this.removeTemplateComponent(this.axisPositionSelect);let H=()=>{let k=J.getValue("type")==="time";$x(this.axisTimeFormatSelect.getGui(),k)};if(!Y)this.removeTemplateComponent(this.axisTimeFormatSelect);else H(),this.addManagedEventListeners({chartOptionsChanged:()=>{H()}});this.initGridLines(Z),this.initAxisTicks(Z),this.initAxisLabels(Z);let _=()=>{for(let k of this.updateFuncs)k()};this.addManagedListeners(this.chartController,{chartUpdated:_,chartModelUpdate:()=>setTimeout(()=>{if(!this.isAlive())return;this.refreshAxisTypeSelect(U),H()})})}getAxisTypeSelectParams(G,D){let z=G.getChartOptions(),B=this.getAxisTypeSelectOptions(),Q=G.getDefaultSelectParams("type","axisType",B);return Q.onValueChange=(J)=>{let U=z.getValue("type");if(J===U)return;let Z=D.getValue("*"),S=U==="time",X=J==="time",Y=S!==X?X?Mx:void 0:null;if(Y===void 0)z.clearValue?.("label","format");if(this.chartOptionsService.setCartesianCategoryAxisType(this.axisType,J),Y!=null)z.setValue("label.format",Y);D.setValue("*",Z)},Q}refreshAxisTypeSelect(G){let D=this.getAxisTypeSelectOptions(),z=!!D.length;if(this.axisTypeSelect.setDisplayed(z),!z)return;this.axisTypeSelect.clearOptions().addOptions(D).setValue(G.getChartOptions().getValue("type"))}getAxisTypeSelectOptions(){let G=this.chartController,D=G.getChartType(),z=()=>{let B=G.getChartData()[0];if(!B)return!1;return G.getSelectedDimensions().every((Q)=>!isNaN(parseFloat(B[Q.colId])))};if(["heatmap","histogram","boxPlot","rangeBar","scatter","bubble"].includes(D)||G.isGrouping()||!this.isCategoryAxis()||G.isCategorySeriesSwitched()||!z())return[];return["category","number","time"].map((B)=>({value:B,text:this.translate(B)}))}isCategoryAxis(){let G=this.chartOptionsSeriesProxy.getValue("direction")==="horizontal";return G&&this.axisType==="yAxis"||!G&&this.axisType==="xAxis"}getAxisPositionSelectParams(G){let D=((z,B)=>{if(z==="heatmap")return null;if(B==="xAxis")return[{value:"top",text:this.translate("top")},{value:"bottom",text:this.translate("bottom")}];if(B==="yAxis")return[{value:"left",text:this.translate("left")},{value:"right",text:this.translate("right")}]})(this.chartController.getChartType(),this.axisType);if(!D)return null;return G.getDefaultSelectParams("position","position",D)}getAxisTimeFormatSelectParams(G){if(!this.isCategoryAxis())return null;let D=[{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 G.getDefaultSelectParams("label.format","timeFormat",D)}getAxisColorInputParams(G){return G.getDefaultColorPickerParams("line.stroke")}getAxisLineWidthSliderParams(G){let D=G.getChartOptions(),z=()=>{if(!D.getValue("line.enabled"))return null;return D.getValue("line.width")},B=(J)=>{D.setValues([{expression:"line.enabled",value:J!=null},{expression:"line.width",value:J??0}])},Q=G.getDefaultSliderParamsWithoutValueParams(z()??0,"thickness",10);return Q.onValueChange=(J)=>{B(J===0?null:J)},Q}initGridLines(G){if(this.chartController.getChartType()==="heatmap")return;let z=this.createBean(new Ix(G));this.axisGroup.addItem(z),this.activePanels.push(z)}initAxisTicks(G){if(!this.hasConfigurableAxisTicks())return;let D=this.createBean(new Fx(G));this.axisGroup.addItem(D),this.activePanels.push(D);let z=()=>D.setTickSizeSliderDisplayed(this.isGroupedCategoryAxis());this.updateFuncs.push(z),z()}hasConfigurableAxisTicks(){switch(this.chartController.getChartType()){case"radarLine":case"radarArea":case"rangeBar":case"boxPlot":case"waterfall":return!1;default:return!0}}initAxisLabels(G){let D={name:this.translate("labels"),enabled:!0,suppressEnabledCheckbox:!0,chartMenuParamsFactory:G,keyMapper:(B)=>`label.${B}`},z=this.createBean(new YD(D));this.axisGroup.addItem(z),this.activePanels.push(z),this.addAdditionalLabelComps(z,G)}addAdditionalLabelComps(G,D){this.addLabelPadding(G,D);let z=this.createRotationWidget("labelRotation",D),B=this.initLabelRotation(z,D);G.addItem(B),G.addItem(z)}initLabelRotation(G,D){let z=D.getChartOptions(),B=()=>{return z.getValue("label.rotation")},Q=()=>{return z.getValue("label.autoRotate")},J=(Y)=>{if(Y)this.prevRotation=B();z.setValues([{expression:"label.autoRotate",value:Y},{expression:"label.rotation",value:Y?void 0:this.prevRotation}]),G.setDisplayed(!Y)},Z=typeof B()==="number"?!1:Q(),S=this.createBean(new Jx({label:this.translate("autoRotate"),value:Z,onValueChange:J}));G.setDisplayed(!Z);let X=()=>S.setDisplayed(this.isGroupedCategoryAxis());return this.updateFuncs.push(X),X(),S}createRotationWidget(G,D){let z=D.getChartOptions(),B=()=>{return z.getValue("label.rotation")},Q=(S)=>{return z.setValue("label.rotation",S)},J=String.fromCharCode(176),U=`${this.chartTranslation.translate(G)} ${J}`,Z=new qx({label:U,labelWidth:"flex",value:B()??0,onValueChange:Q});return this.updateFuncs.push(()=>{Z.setValue(B()??0)}),this.createBean(Z)}isGroupedCategoryAxis(){if(this.chartOptionsService.getCartesianAxisOptionsProxy(this.axisType).getValue("type")==="grouped-category")return!this.isCategoryAxis();return!0}addLabelPadding(G,D){let z=this.createBean(new kG(D.getDefaultSliderParams("label.spacing","padding",30)));G.addItem(z)}translate(G){return this.chartTranslation.translate(G)}removeTemplateComponent(G){m5(G.getGui()),this.destroyBean(G)}destroyActivePanels(){for(let G of this.activePanels)m5(G.getGui()),this.destroyBean(G)}destroy(){this.destroyActivePanels(),super.destroy()}},Vx=class extends Rx{constructor(G){super();this.options=G,this.axisGroup=Cx}wireBeans(G){this.chartTranslation=G.chartTranslation}postConstruct(){let{isExpandedOnInit:G,chartAxisMenuParamsFactory:D,registerGroupComponent:z}=this.options,B={cssIdentifier:"charts-format-top-level",direction:"vertical",title:this.translate("polarAxis"),expanded:G,suppressEnabledCheckbox:!0},Q=D.getDefaultColorPickerParams("line.stroke"),J=D.getDefaultSliderParams("line.width","thickness",10);this.setTemplate(`
- - - - -
`,[p,TG,WG],{axisGroup:B,axisColorInput:Q,axisLineWidthSlider:J}),z(this.axisGroup),this.initAxis(),this.initAxisLabels(),this.initRadiusAxis()}initAxis(){let G=this.options.chartController.getChartType();if(["radarLine","radarArea"].includes(G)){let z=[{value:"circle",text:this.translate("circle")},{value:"polygon",text:this.translate("polygon")}];this.axisGroup.addItem(this.createSelect({labelKey:"shape",options:z,property:"shape"}))}if(G!=="pie")this.axisGroup.addItem(this.createSlider({labelKey:"innerRadius",defaultMaxValue:1,property:"innerRadiusRatio"}))}initAxisLabels(){let G={name:this.translate("labels"),enabled:!0,suppressEnabledCheckbox:!0,chartMenuParamsFactory:this.options.chartAxisMenuParamsFactory,keyMapper:(B)=>`label.${B}`},D=this.createManagedBean(new YD(G)),z=this.createOrientationWidget();D.addItem(z),this.axisGroup.addItem(D)}createOrientationWidget(){let G=[{value:"fixed",text:this.translate("fixed")},{value:"parallel",text:this.translate("parallel")},{value:"perpendicular",text:this.translate("perpendicular")}];return this.createSelect({labelKey:"orientation",options:G,property:"label.orientation"})}initRadiusAxis(){let G=l(this.options.chartController.getChartType());if(!oP(G))return;let D=[this.createSlider({labelKey:"groupPadding",defaultMaxValue:1,property:"paddingInner"}),this.createSlider({labelKey:"seriesPadding",defaultMaxValue:1,property:"groupPaddingInner"})],z=this.createManagedBean(new jG({cssIdentifier:"charts-format-sub-level",direction:"vertical",suppressOpenCloseIcons:!0,enabled:!0,suppressEnabledCheckbox:!0,title:this.translate("padding"),items:D})).hideEnabledCheckbox(!0).hideOpenCloseIcons(!0);this.axisGroup.addItem(z)}createSlider(G){let{labelKey:D,defaultMaxValue:z,step:B=0.05,property:Q}=G,J=this.options.chartAxisMenuParamsFactory.getDefaultSliderParams(Q,D,z);return J.step=B,this.createManagedBean(new kG(J))}createSelect(G){let{labelKey:D,options:z,property:B}=G;return this.createManagedBean(new Ax(this.options.chartAxisMenuParamsFactory.getDefaultSelectParams(B,D,z)))}translate(G){return this.chartTranslation.translate(G)}},ux=class extends Ox{constructor(G){super();this.chartMenuUtils=G}wireBeans(G){this.chartTranslation=G.chartTranslation}postConstruct(){let G=this.chartMenuUtils.addEnableParams("background.visible",{cssIdentifier:"charts-format-sub-level",direction:"vertical",suppressOpenCloseIcons:!0,title:this.chartTranslation.translate("background"),suppressEnabledCheckbox:!0,useToggle:!0}),D=this.chartMenuUtils.getDefaultColorPickerParams("background.fill");this.setTemplate(`
- - - -
`,[p,TG],{chartBackgroundGroup:G,colorPicker:D})}},gx=class extends jx{constructor(G,D){super();this.chartMenuUtils=G,this.chartController=D,this.paddingTopSlider=Px}wireBeans(G){this.chartTranslation=G.chartTranslation}postConstruct(){let G={cssIdentifier:"charts-format-sub-level",direction:"vertical",suppressOpenCloseIcons:!0,title:this.chartTranslation.translate("padding"),suppressEnabledCheckbox:!0},D=(z)=>this.chartMenuUtils.getDefaultSliderParams("padding."+z,z,200);this.setTemplate(`
- - - - - - -
`,[p,WG],{chartPaddingGroup:G,paddingTopSlider:D("top"),paddingRightSlider:D("right"),paddingBottomSlider:D("bottom"),paddingLeftSlider:D("left")}),this.addManagedEventListeners({chartOptionsChanged:(z)=>{this.updateTopPadding(z.chartOptions)}})}updateTopPadding(G){let D=[...this.chartController.getChartSeriesTypes(),"common"].map((z)=>G?.[z]?.padding?.top).find((z)=>z!=null);if(D!=null)this.paddingTopSlider.setValue(`${D}`)}},Tx=class extends bx{constructor(G){super();this.options=G,this.chartGroup=vx}wireBeans(G){this.chartTranslation=G.chartTranslation}postConstruct(){let{chartController:G,chartMenuParamsFactory:D,isExpandedOnInit:z,registerGroupComponent:B}=this.options,Q={cssIdentifier:"charts-format-top-level",direction:"vertical",title:this.chartTranslation.translate("chartStyle"),expanded:z,suppressEnabledCheckbox:!0,items:[this.createManagedBean(new gx(D,G)),this.createManagedBean(new ux(D))]};this.setTemplate(`
- -
`,[p],{chartGroup:Q}),B(this.chartGroup)}},xx=class extends yx{constructor(G){super();this.groupContainer=G,this.id=0,this.groupComponents=new Map}addGroupComponent(G){let D=this.id++;if(this.groupComponents.set(D,G),G.isExpanded())this.expandedGroupComponent=D;G.onExpandedChange((z)=>{if(z){let B=this.expandedGroupComponent;if(this.expandedGroupComponent=D,B!=null){let Q=G.getGui(),J=Q.offsetTop-this.groupContainer.parentElement.scrollTop;this.groupComponents.get(B)?.toggleGroupExpand(!1,!0);let U=Q.offsetTop-J;if(U<0)U=0;if(U!==this.groupContainer.parentElement.scrollTop)this.groupContainer.parentElement.scrollTop=U}}else this.expandedGroupComponent=void 0})}destroy(){this.groupComponents.clear(),super.destroy()}},nx=class extends ix{constructor(G,D){super();this.options=G,this.legendGroup=t5,this.enabledGroup=t5,this.isGradient=["treemap","sunburst","heatmap"].includes(G.seriesType),this.key=this.isGradient?"gradientLegend":"legend",this.chartController=D.chartController}wireBeans(G){this.chartTranslation=G.chartTranslation}postConstruct(){let{chartMenuParamsFactory:G,isExpandedOnInit:D,registerGroupComponent:z}=this.options,B=this.createManagedBean(new hx(G.getDefaultSelectParams(`${this.key}.position`,"position",["top","right","bottom","left"].map((U)=>({value:U,text:this.chartTranslation.translate(U)})))));this.enabledGroup=this.createManagedBean(new jG(G.addEnableParams(`${this.key}.enabled`,{cssIdentifier:"charts-format-sub-level",direction:"vertical",suppressOpenCloseIcons:!0,title:this.chartTranslation.translate("legendEnabled"),suppressEnabledCheckbox:!0,useToggle:!0,items:[this.createLabelPanel(G),B,...this.getItems(G)]})));let Q={cssIdentifier:"charts-format-top-level",direction:"vertical",title:this.chartTranslation.translate("legend"),suppressEnabledCheckbox:!0,expanded:D,items:[this.enabledGroup]};this.setTemplate(`
- - -
`,[p],{legendGroup:Q}),z(this.legendGroup);let J=this.updateLegendEnabledState.bind(this);this.addManagedListeners(this.chartController,{chartModelUpdate:J,chartApiUpdate:J})}updateLegendEnabledState(){let{valueCols:G}=this.chartController.getColStateForMenu();this.enabledGroup.setEnabled(G.filter((D)=>D.selected).length>1)}getItems(G){let D=(z,B,Q)=>this.createManagedBean(new kG(G.getDefaultSliderParams(`${this.key}.${z}`,B,Q)));if(this.isGradient)return[this.createManagedBean(new cx(G.addValueParams("gradientLegend.reverseOrder",{label:this.chartTranslation.translate("reverseDirection"),labelWidth:"flex"}))),D("gradient.thickness","thickness",40),D("gradient.preferredLength","preferredLength",300),D("spacing","spacing",200)];return[D("spacing","spacing",200),D("item.marker.size","markerSize",40),D("item.marker.strokeWidth","markerStroke",10),D("item.marker.padding","itemSpacing",20),D("item.paddingX","layoutHorizontalSpacing",50),D("item.paddingY","layoutVerticalSpacing",50)]}createLabelPanel(G){let D=this.isGradient?"gradientLegend.scale.label":"legend.item.label",z={enabled:!0,suppressEnabledCheckbox:!0,chartMenuParamsFactory:G,keyMapper:(B)=>`${D}.${B}`,cssIdentifier:"charts-format-sub-level-no-header"};return this.createManagedBean(new YD(z))}},rx=class extends tx{constructor(G){super();this.params=G,this.toggleableGroup=sx,this.activeComps=[],this.chartOptions=G.chartMenuParamsFactory.getChartOptions()}postConstruct(){let{tag:G,cssIdentifier:D="charts-format-sub-level",title:z,suppressEnabledCheckbox:B}=this.params,Q=this.params.chartMenuParamsFactory.addEnableParams(`${G}.enabled`,{cssIdentifier:D,direction:"vertical",suppressOpenCloseIcons:!0,title:z,suppressEnabledCheckbox:!0,useToggle:!B});this.setTemplate(`
- - -
`,[p],{toggleableGroup:Q}),this.toggleCss("ag-toggleable-group-panel-no-header",!z)}addItem(G,D){if(D)this.toggleableGroup.prependItem(G);else this.toggleableGroup.addItem(G);this.activeComps.push(G)}setEnabled(G){this.toggleableGroup.setEnabled(G)}destroyActiveComps(){for(let G of this.activeComps)ox(G.getGui()),this.destroyBean(G)}destroy(){this.destroyActiveComps(),super.destroy()}},ex=class extends ax{constructor(G){super();this.chartMenuUtils=G}wireBeans(G){this.chartTranslation=G.chartTranslation}postConstruct(){let G={cssIdentifier:"charts-format-sub-level",direction:"vertical",title:this.chartTranslation.translate("callout"),enabled:!0,suppressOpenCloseIcons:!0,suppressEnabledCheckbox:!0};this.setTemplate(`
- - - - - -
`,[p,WG],{calloutGroup:G,calloutLengthSlider:this.chartMenuUtils.getDefaultSliderParams("calloutLine.length","length",40),calloutStrokeWidthSlider:this.chartMenuUtils.getDefaultSliderParams("calloutLine.strokeWidth","strokeWidth",10),labelOffsetSlider:this.chartMenuUtils.getDefaultSliderParams("calloutLabel.offset","offset",30)})}},Dc=class extends Gc{constructor(G){super();this.chartMenuUtils=G}wireBeans(G){this.chartTranslation=G.chartTranslation}postConstruct(){let G={cssIdentifier:"charts-format-sub-level",direction:"vertical",title:this.chartTranslation.translate("cap"),enabled:!0,suppressOpenCloseIcons:!0,suppressEnabledCheckbox:!0},D=this.chartMenuUtils.getDefaultSliderParams("cap.lengthRatio","capLengthRatio",1);D.step=0.05,this.setTemplate(`
- - - -
`,[p,WG],{capsGroup:G,capLengthRatioSlider:D})}},Bc=class extends zc{constructor(G){super();this.chartMenuUtils=G}wireBeans(G){this.chartTranslation=G.chartTranslation}postConstruct(){let G={cssIdentifier:"charts-format-sub-level",direction:"vertical",title:this.chartTranslation.translate("connectorLine"),enabled:!0,suppressOpenCloseIcons:!0,suppressEnabledCheckbox:!0};this.setTemplate(`
- - - - - - -
`,[p,TG,WG],{lineGroup:G,lineColorPicker:this.chartMenuUtils.getDefaultColorPickerParams("line.stroke"),lineStrokeWidthSlider:this.getSliderParams("strokeWidth",10,"line.strokeWidth"),lineDashSlider:this.getSliderParams("lineDash",30,"line.lineDash",1,!0),lineOpacitySlider:this.getSliderParams("strokeOpacity",1,"line.strokeOpacity",0.05)})}getSliderParams(G,D,z,B=1,Q=!1){let J=this.chartMenuUtils.getDefaultSliderParams(z,G,D,Q);return J.step=B,J}};function S9(G){return["square","circle","cross","diamond","plus","triangle","heart"].map((D)=>({value:D,text:G.translate(D)}))}var Uc=class extends Jc{constructor(G){super();this.chartMenuUtils=G}wireBeans(G){this.chartTranslation=G.chartTranslation}postConstruct(){let G=this.chartMenuUtils.addEnableParams("marker.enabled",{cssIdentifier:"charts-format-sub-level",direction:"vertical",title:this.chartTranslation.translate("markers"),suppressEnabledCheckbox:!0,useToggle:!0,suppressOpenCloseIcons:!0});this.setTemplate(`
- - - - - -
`,[p,Qc,WG],{seriesMarkersGroup:G,seriesMarkerShapeSelect:this.chartMenuUtils.getDefaultSelectParams("marker.shape","shape",S9(this.chartTranslation)),seriesMarkerSizeSlider:this.chartMenuUtils.getDefaultSliderParams("marker.size","size",60),seriesMarkerStrokeWidthSlider:this.chartMenuUtils.getDefaultSliderParams("marker.strokeWidth","strokeWidth",10)})}},Xc=class extends $c{constructor(G){super();this.chartMenuUtils=G,this.seriesItemsGroup=Lc,this.activePanels=[]}wireBeans(G){this.chartTranslation=G.chartTranslation}postConstruct(){let G={cssIdentifier:"charts-format-sub-level",direction:"vertical",title:this.chartTranslation.translate("seriesItems"),enabled:!0,suppressOpenCloseIcons:!0,suppressEnabledCheckbox:!0};this.setTemplate(`
- - - -
`,[p,Zc],{seriesItemsGroup:G,seriesItemSelect:this.getSeriesItemsParams()}),this.initSeriesControls()}getSeriesItemsParams(){let G=[{value:"positive",text:this.chartTranslation.translate("seriesItemPositive")},{value:"negative",text:this.chartTranslation.translate("seriesItemNegative")}],D=(z)=>{this.destroyActivePanels(),this.initSeriesControls(z)};return this.chartMenuUtils.getDefaultSelectParamsWithoutValueParams("seriesItemType",G,"positive",D)}initSeriesControls(G="positive"){this.initSlider("strokeWidth",10,`item.${G}.strokeWidth`),this.initSlider("lineDash",30,`item.${G}.lineDash`,1,!0),this.initSlider("strokeOpacity",1,`item.${G}.strokeOpacity`,0.05,!1),this.initSlider("fillOpacity",1,`item.${G}.fillOpacity`,0.05,!1),this.initItemLabels(G)}initSlider(G,D,z,B=1,Q=!1){let J=this.chartMenuUtils.getDefaultSliderParams(z,G,D,Q);J.step=B;let U=this.seriesItemsGroup.createManagedBean(new kG(J));this.seriesItemsGroup.addItem(U),this.activePanels.push(U)}initItemLabels(G){let D=this.chartMenuUtils.getDefaultFontPanelParams(`item.${G}.label`,"seriesItemLabels"),z=this.createBean(new YD(D));this.seriesItemsGroup.addItem(z),this.activePanels.push(z)}destroyActivePanels(){for(let G of this.activePanels)Sc(G.getGui()),this.destroyBean(G)}destroy(){this.destroyActivePanels(),super.destroy()}},Wc=class extends Yc{constructor(G,D="shadow"){super();this.chartMenuUtils=G,this.propertyKey=D}wireBeans(G){this.chartTranslation=G.chartTranslation}postConstruct(){let G=this.propertyKey,D=this.chartMenuUtils.addEnableParams(`${G}.enabled`,{cssIdentifier:"charts-format-sub-level",direction:"vertical",suppressOpenCloseIcons:!0,title:this.chartTranslation.translate("shadow"),suppressEnabledCheckbox:!0,useToggle:!0}),z=this.chartMenuUtils.getDefaultColorPickerParams(`${G}.color`);this.setTemplate(`
- - - - - - -
`,[p,TG,WG],{shadowGroup:D,shadowColorPicker:z,shadowBlurSlider:this.getSliderParams("blur",0,20),shadowXOffsetSlider:this.getSliderParams("xOffset",-10,10),shadowYOffsetSlider:this.getSliderParams("yOffset",-10,10)})}getSliderParams(G,D,z){let B=`${this.propertyKey}.${G}`,Q=this.chartMenuUtils.getDefaultSliderParams(B,G,z);return Q.minValue=D,Q}},Hc=class extends qc{constructor(G){super();this.chartMenuUtils=G}wireBeans(G){this.chartTranslation=G.chartTranslation}postConstruct(){let G={cssIdentifier:"charts-format-sub-level",direction:"vertical",enabled:!0,suppressOpenCloseIcons:!0,suppressEnabledCheckbox:!0};this.setTemplate(`
- - - - - - - - -
`,[p,WG],{groupSpacing:{...G,title:this.chartTranslation.translate("group")},tileSpacing:{...G,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(G,D){return this.chartMenuUtils.getDefaultSliderParams(D,G,10)}};function Kc(G){return G[0].toUpperCase()+G.substring(1)}var fc=class extends kc{constructor(G){super();this.chartMenuUtils=G,this.tooltipMode=wc}postConstruct(){let{chartMenuUtils:G,beans:D}=this,z="tooltip",B=D.chartTranslation,Q=G.addEnableParams("tooltip.enabled",{cssIdentifier:"charts-format-sub-level",direction:"vertical",suppressOpenCloseIcons:!0,title:B.translate("tooltips"),suppressEnabledCheckbox:!0,useToggle:!0}),J="tooltipMode",U=["single","shared","compact"].map((X)=>({value:X,text:B.translate(`tooltipMode${Kc(X)}`)})),Z="tooltip.mode",S=G.getDefaultSelectParams("tooltip.mode","tooltipMode",U);this.setTemplate(`
- - - -
`,[p,_c],{tooltipGroup:Q,tooltipMode:S}),this.addManagedEventListeners({chartOptionsChanged:()=>{let X=G.getChartOptions().getValue("tooltip.mode");this.tooltipMode.setValue(X,!0)}})}},Fc=class extends Nc{constructor(G){super();this.chartMenuUtils=G}wireBeans(G){this.chartTranslation=G.chartTranslation}postConstruct(){let G={cssIdentifier:"charts-format-sub-level",direction:"vertical",title:this.chartTranslation.translate("whisker"),enabled:!0,suppressOpenCloseIcons:!0,suppressEnabledCheckbox:!0};this.setTemplate(`
- - - - - - - -
`,[p,TG,WG],{whiskersGroup:G,whiskerColorPicker:this.chartMenuUtils.getDefaultColorPickerParams("whisker.stroke"),whiskerThicknessSlider:this.chartMenuUtils.getDefaultSliderParams("whisker.strokeWidth","strokeWidth",10),whiskerOpacitySlider:this.chartMenuUtils.getDefaultSliderParams("whisker.strokeOpacity","strokeOpacity",1),whiskerLineDashSlider:this.chartMenuUtils.getDefaultSliderParams("whisker.lineDash","lineDash",30,!0),whiskerLineDashOffsetSlider:this.chartMenuUtils.getDefaultSliderParams("whisker.lineDashOffset","lineDashOffset",30)})}},t="tooltips",BG="strokeWidth",tz="lineWidth",ZG="lineDash",e="lineOpacity",$G="fillOpacity",r="labels",nG="shadow",UB="stageLabels",sz="markers",Ec=class extends dx{constructor(G){super();this.options=G,this.seriesGroup=lx,this.activePanels=[],this.widgetFuncs={lineWidth:()=>this.initStrokeWidth(tz),[BG]:()=>this.initStrokeWidth("strokeWidth"),lineColor:()=>this.initLineColor(),[ZG]:()=>this.initLineDash(),[e]:()=>this.initOpacity("strokeOpacity"),[$G]:()=>this.initOpacity("fillOpacity"),markers:()=>new Uc(this.chartMenuUtils),[r]:()=>this.initLabels(),sectorLabels:()=>this.initSectorLabels(),[nG]:()=>new Wc(this.chartMenuUtils),[t]:()=>new fc(this.options.chartMenuParamsFactory),bins:()=>this.initBins(),whiskers:()=>new Fc(this.chartMenuUtils),caps:()=>new Dc(this.chartMenuUtils),connectorLine:()=>new Bc(this.chartMenuUtils),seriesItems:()=>new Xc(this.chartMenuUtils),tileSpacing:()=>new Hc(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:[t,BG,ZG,e,$G,r,nG],pie:[t,BG,e,$G,r,"sectorLabels",nG],donut:[t,BG,e,$G,r,"sectorLabels",nG],line:[t,tz,ZG,e,sz,r],scatter:[t,"shape","size",BG,r],bubble:[t,"shape","minSize","maxSize",BG,r],area:[t,tz,ZG,e,$G,sz,r,nG],histogram:[t,"bins",BG,ZG,e,$G,r,nG],"radial-column":[t,BG,ZG,e,$G,r],"radial-bar":[t,BG,ZG,e,$G,r],"radar-line":[t,BG,ZG,e,sz,r],"radar-area":[t,BG,ZG,e,$G,sz,r],nightingale:[t,BG,ZG,e,$G,r],"box-plot":[t,BG,ZG,e,$G,"whiskers","caps"],"range-bar":[t,BG,ZG,e,$G,r],"range-area":[t,tz,ZG,e,$G,sz,r,nG],treemap:[t,"tileSpacing"],sunburst:[t],heatmap:[t,r,"lineColor",tz,e],waterfall:[t,"connectorLine","seriesItems"],funnel:[t,BG,ZG,e,$G,r,"dropoff",UB,nG],"cone-funnel":[t,BG,ZG,e,$G,r,UB],pyramid:[t,BG,ZG,e,$G,r,UB,nG]},this.seriesType=G.seriesType}wireBeans(G){this.chartTranslation=G.chartTranslation}postConstruct(){let{isExpandedOnInit:G,chartOptionsService:D,chartController:z,registerGroupComponent:B}=this.options,Q={cssIdentifier:"charts-format-top-level",direction:"vertical",title:this.translate("series"),expanded:G,suppressEnabledCheckbox:!0};this.setTemplate(`
- - -
`,[p],{seriesGroup:Q}),B(this.seriesGroup),this.chartMenuUtils=this.createManagedBean(new uD(D.getSeriesOptionsProxy(()=>this.seriesType))),this.addManagedListeners(z,{chartSeriesChartTypeChanged:this.refreshWidgets.bind(this)}),this.refreshWidgets()}refreshWidgets(){let{chartController:G}=this.options;this.destroyActivePanels(),G.getChartProxy().getChart().waitForUpdate().then(()=>{if(!this.isAlive())return;if(G.isComboChart())this.updateSeriesType(),this.initSeriesSelect();for(let B of this.seriesWidgetMappings[this.seriesType]??[]){let Q=this.widgetFuncs[B](),J;if(Array.isArray(Q)){let U=this.createBean(Q[0]);J=U,Q[1](U)}else J=this.createBean(Q);this.seriesGroup.addItem(J),this.activePanels.push(J)}}).catch((z)=>px(105,{e:z}))}initSeriesSelect(){let G=this.createBean(new O1(this.chartMenuUtils.getDefaultSelectParamsWithoutValueParams("seriesType",this.getSeriesSelectOptions(),`${this.seriesType}`,(D)=>{this.seriesType=D,this.refreshWidgets()})));this.seriesGroup.addItem(G),this.activePanels.push(G)}initLineColor(){return new z9(this.chartMenuUtils.getDefaultColorPickerParams("stroke","strokeColor"))}initStrokeWidth(G,D){return new kG(this.chartMenuUtils.getDefaultSliderParams(D?`${D}.${G}`:"strokeWidth",G,10))}initLineDash(G){return new kG(this.chartMenuUtils.getDefaultSliderParams(G?`${G}.lineDash`:"lineDash","lineDash",30,!0))}initOpacity(G,D){let z=this.chartMenuUtils.getDefaultSliderParams(D?`${D}.${G}`:G,G,1);return z.step=0.05,new kG(z)}initDropOff(){return[new rx({tag:"dropOff",cssIdentifier:"charts-format-sub-level",title:this.translate("dropOff"),suppressEnabledCheckbox:!1,chartMenuParamsFactory:this.chartMenuUtils}),(z)=>{for(let B of[this.initStrokeWidth("strokeWidth","dropOff"),this.initLineDash("dropOff"),this.initOpacity("strokeOpacity","dropOff"),this.initOpacity("fillOpacity","dropOff")]){let Q=z.createManagedBean(B);z.addItem(Q),this.activePanels.push(Q)}}]}initLabels(){let G=t8(this.seriesType),D=G?"calloutLabel":"label",z=G?"calloutLabels":"labels",B=this.chartMenuUtils.getDefaultFontPanelParams(D,z);return[new YD(B),(U)=>{if(G){let Z=U.createManagedBean(new ex(this.chartMenuUtils));U.addItem(Z),this.activePanels.push(Z)}if(this.seriesType==="range-bar"){let Z=[{value:"inside",text:this.translate("inside")},{value:"outside",text:this.translate("outside")}],S=U.createManagedBean(new O1(this.chartMenuUtils.getDefaultSelectParams("label.placement","labelPlacement",Z)));U.addItem(S),this.activePanels.push(S);let X=U.createManagedBean(new kG(this.chartMenuUtils.getDefaultSliderParams("label.padding","padding",200)));U.addItem(X),this.activePanels.push(X)}}]}initSectorLabels(){let G=this.chartMenuUtils.getDefaultFontPanelParams("sectorLabel","sectorLabels");return[new YD(G),(B)=>{let Q=this.chartMenuUtils.getDefaultSliderParams("sectorLabel.positionRatio","positionRatio",1);Q.step=0.05;let J=B.createManagedBean(new kG(Q));B.addItem(J)}]}initStageLabels(){return new YD(this.chartMenuUtils.getDefaultFontPanelParams("stageLabel",UB))}initBins(){let G=this.chartMenuUtils.getDefaultSliderParams("binCount","histogramBinCount",20),D=this.chartMenuUtils.getChartOptions(),z=(D.getValue("bins")??D.getValue("calculatedBins",!0)).length;return G.value=`${z}`,G.maxValue=Math.max(z,20),new kG(G)}initShape(){return new O1(this.chartMenuUtils.getDefaultSelectParams("shape","shape",S9(this.chartTranslation)))}initSize(G,D){return new kG(this.chartMenuUtils.getDefaultSliderParams(G,D,60))}getSeriesSelectOptions(){let G=this.getActiveSeriesTypes();return["area","bar","line"].filter((D)=>G.includes(D)).map((D)=>({value:D,text:this.translate(D)}))}updateSeriesType(){let G=this.getActiveSeriesTypes();if(!G.includes(this.seriesType)&&G.length>0)this.seriesType=G[0]}getActiveSeriesTypes(){return this.options.chartController.getActiveSeriesChartTypes().map((G)=>l(G.chartType))}translate(G){return this.chartTranslation.translate(G)}destroyActivePanels(){for(let G of this.activePanels)mx(G.getGui()),this.destroyBean(G)}destroy(){this.destroyActivePanels(),super.destroy()}},ez=class extends Rc{constructor(G,D,z){super("
");this.chartMenuUtils=G,this.name=D,this.key=z,this.chartOptions=G.getChartOptions()}wireBeans(G){this.chartTranslation=G.chartTranslation}postConstruct(){this.initFontPanel()}hasTitle(){let G=this.chartOptions.getValue(this.key);return G?.enabled&&G.text&&G.text.length>0}initFontPanel(){let G=this.hasTitle(),D={name:this.chartTranslation.translate(this.name),enabled:G,suppressEnabledCheckbox:!1,chartMenuParamsFactory:this.chartMenuUtils,keyMapper:(z)=>`${this.key}.${z}`,onEnableChange:(z)=>this.onEnableChange(z)};this.fontPanel=this.createManagedBean(new YD(D)),this.fontPanel.addItem(this.createBean(new Ac(this.getTextInputParams())),!0),this.fontPanel.addItem(this.createBean(new kG(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(G){this.chartOptions.setValue(`${this.key}.enabled`,G)}},Cc=class extends ez{wireBeans(G){super.wireBeans(G),this.chartMenuSvc=G.chartMenuSvc}postConstruct(){this.titlePlaceholder=this.chartTranslation.translate("titlePlaceholder"),super.postConstruct(),this.addManagedEventListeners({chartTitleEdit:()=>{this.fontPanel.setEnabled(this.hasTitle())}})}getTextInputParams(){let G=super.getTextInputParams();if(this.shouldOverrideTextWithPlaceholder(G.value))G.value=this.titlePlaceholder;return G}getSpacingSliderParams(){let G=super.getSpacingSliderParams();return G.value="10",G}onEnableChange(G){if(this.chartMenuSvc.doesChartToolbarExist()){let z=this.chartOptions.getValue("padding.top");this.chartOptions.setValue("padding.top",G?z-20:z+20)}this.chartOptions.setValue(`${this.key}.enabled`,G);let D=this.chartOptions.getValue(`${this.key}.text`);if(G&&this.shouldOverrideTextWithPlaceholder(D))this.chartOptions.setValue(`${this.key}.text`,this.titlePlaceholder)}shouldOverrideTextWithPlaceholder(G){return G==="Title"||G?.trim().length===0}},Vc=class extends Ic{constructor(G){super();this.options=G,this.titleGroup=Mc}wireBeans(G){this.chartTranslation=G.chartTranslation}postConstruct(){let{chartMenuParamsFactory:G,chartAxisMenuParamsFactory:D,chartOptionsService:z,seriesType:B,isExpandedOnInit:Q=!1,registerGroupComponent:J}=this.options,U=[];if(SD(B)&&B!=="pyramid"){let S=(X)=>this.createManagedBean(new uD(z.getCartesianAxisThemeOverridesProxy(X)));U.push(this.createManagedBean(new ez(S("xAxis"),"horizontalAxisTitle","title"))),U.push(this.createManagedBean(new ez(S("yAxis"),"verticalAxisTitle","title")))}else if(BJ(B))U.push(this.createManagedBean(new ez(D,"polarAxisTitle","title")));let Z={cssIdentifier:"charts-format-top-level",direction:"vertical",title:this.chartTranslation.translate("chartTitles"),expanded:Q,suppressEnabledCheckbox:!0,items:[this.createManagedBean(new Cc(G,"chartTitle","title")),this.createManagedBean(new ez(G,"chartSubtitle","subtitle")),...U]};this.setTemplate(`
- -
`,[p],{titleGroup:Z}),J(this.titleGroup)}},bc={groups:[{type:"chart"},{type:"titles"},{type:"legend"},{type:"series"},{type:"axis"}]},s5=["axis","horizontalAxis","verticalAxis"],vc=class extends Qx{constructor(G){super('
');this.chartMenuContext=G}postConstruct(){this.groupExpansionFeature=this.createManagedBean(new xx(this.getGui())),this.chartPanelFeature=this.createManagedBean(new D9(this.chartMenuContext.chartController,this.getGui(),"ag-chart-format-section",(G,D)=>this.createPanels(D))),this.chartPanelFeature.refreshPanels()}createPanels(G){let D=!1;this.getFormatPanelDef().groups?.forEach(({type:z,isOpen:B=!1})=>{if(!this.isGroupPanelShownInSeries(z,G))return;if(B){if(D)p5(145,{group:z});D=!0}let Q=(U)=>this.groupExpansionFeature.addGroupComponent(U),J={...this.chartMenuContext,isExpandedOnInit:B,seriesType:G,registerGroupComponent:Q};switch(z){case"chart":this.chartPanelFeature.addComponent(new Tx(J));break;case"titles":this.chartPanelFeature.addComponent(new Vc(J));break;case"legend":this.chartPanelFeature.addComponent(new nx(J,this.chartMenuContext));break;case"axis":if(BJ(G))this.chartPanelFeature.addComponent(new Vx(J));else if(SD(G))this.chartPanelFeature.addComponent(new JB("xAxis",J)),this.chartPanelFeature.addComponent(new JB("yAxis",J));break;case"horizontalAxis":this.chartPanelFeature.addComponent(new JB("xAxis",J));break;case"verticalAxis":this.chartPanelFeature.addComponent(new JB("yAxis",J));break;case"series":this.chartPanelFeature.addComponent(new Ec(J));break;default:p5(147,{group:z})}})}getFormatPanelDef(){let G=this.gos.get("chartToolPanelsDef")?.formatPanel;return G?G:bc}isGroupPanelShownInSeries(G,D){let z=["chart","titles","legend","series"].includes(G)||SD(D)&&s5.includes(G)||BJ(D)&&G==="axis",B=zJ(D)&&G==="legend"||zJ(D)&&s5.includes(G);return z&&!B}},cc="ag-chart-mini-thumbnail-canvas",PD=class extends yc{constructor(G,D,z){super();this.agChartsExports=D,this.tooltipName=z,this.size=58,this.padding=5;let{_Scene:B}=D;this.root=new B.Group;let Q=G.ownerDocument.createElement("canvas"),J=new B.Scene({canvasElement:Q,pixelRatio:G.ownerDocument.defaultView?.devicePixelRatio??1,width:this.size,height:this.size,willReadFrequently:!1});J.canvas.element.classList.add(cc),J.setRoot(this.root),J.setContainer(G),this.scene=J}wireBeans(G){this.chartTranslation=G.chartTranslation}postConstruct(){this.scene.canvas.element.title=this.chartTranslation.translate(this.tooltipName);try{this.scene.render()}catch(G){xc(108,{e:G})}}};function k0(G){let{stacked:D,size:z,padding:B,xScalePadding:Q,xScaleDomain:J,yScaleDomain:U,agChartsExports:{_Scene:Z}}=G,S=new Z.CategoryScale;S.domain=J,S.range=[B,z-B],S.paddingInner=Q,S.paddingOuter=Q;let X=new Z.LinearScale;X.domain=U,X.range=[z-B,B];let Y=(W,q,H)=>{return W.map((_,k)=>{let w=H.convert(_),K=new Z.Rect;return K.x=q.convert(k),K.y=w,K.width=q.bandwidth,K.height=H.convert(0)-w,K.strokeWidth=0,K.crisp=!0,K})};if(D)return G.data.map((W)=>Y(W,S,X));return Y(G.data,S,X)}function hc(G,D,z,B){let Q=[],J=[];for(let S of D)for(let[X,Y]of S)Q.push(X),J.push(Y);let U=new G.LinearScale;U.domain=[Math.min(...Q),Math.max(...Q)],U.range=[B,z-B];let Z=new G.LinearScale;return Z.domain=[Math.min(...J),Math.max(...J)],Z.range=[z-B,B],{xScale:U,yScale:Z}}function Y9(G,D,z,B){let Q=[0,D[0].length-1],J=D.reduce((S,X)=>{for(let Y of X){if(YS[1])S[1]=Y}return S},[1/0,-1/0]);J[0]--,J[J.length-1]++;let U=new G.LinearScale;U.domain=Q,U.range=[B,z-B];let Z=new G.LinearScale;return Z.domain=J,Z.range=[z-B,B],{xScale:U,yScale:Z}}function W9(G,D,z){return G.map((B)=>B.map((Q,J)=>[J>0?"lineTo":"moveTo",D.convert(J),z.convert(Q)]))}function ic(G,D,z){return G.map(([B,Q],J)=>[J>0?"lineTo":"moveTo",D.convert(B),z.convert(Q)])}function nc(G){let D=G[0],z=G[1],B=X9(G);if(z[1]!==B[1]||z[2]!==B[2])G.push([D[0],z[1],z[2]]);return G}function q9(G,D){let z=new G.Path;return D.forEach(([B,Q,J])=>z.path[B](Q,J)),z}function dc(G,D,z){return G.map((B,Q,J)=>{let Z=[...z?lc(J,Q,D):H9(B,D)].reverse().map(([Y,W,q])=>["lineTo",W,q]),S=B[0],X=X9(Z);if(S[1]!==X[1]||S[2]!==X[2])Z.push(["lineTo",S[1],S[2]]);return[...B,...Z]})}function lc(G,D,z){if(D===0)return H9(G[D],z);return[...G[D-1]]}function H9(G,D){return G.map(([z,B])=>[z,B,D.convert(0)])}function _9(G,D){let z=q9(G,D);return z.fill=void 0,z.lineCap="round",z.strokeWidth=3,z}function pc({_Scene:G},D,z,B,Q){let{xScale:J,yScale:U}=hc(G,z,B,Q),Y=z.map((q)=>ic(q,J,U)).map((q)=>nc(q)).map((q)=>_9(G,q)).reduce((q,H)=>q.concat(H),[]),W=new G.Group;return W.setClipRect(new G.BBox(Q,Q,B-Q*2,B-Q*2)),W.append(Y),D.append(W),Y}function tJ({_Scene:G},D,z,B,Q){let{xScale:J,yScale:U}=Y9(G,z,B,Q),S=W9(z,J,U).map((Y)=>_9(G,Y)),X=new G.Group;return X.setClipRect(new G.BBox(Q,Q,B-Q*2,B-Q*2)),X.append(S),D.append(X),S}function mc(G,D,z,B,Q,J=!1){let{xScale:U,yScale:Z}=Y9(G,z,B,Q),S=dc(W9(z,U,Z),Z,J),X=new G.Group;X.setClipRect(new G.BBox(Q,Q,B-Q*2,B-Q*2));let Y=S.map((W)=>q9(G,W));return X.append(Y),D.append(X),Y}function k9(G){return G.map((D,z,B)=>D.map((Q,J)=>B.slice(0,z+1).reduce((U,Z)=>U+Z[J],0)))}function w9(G){let D=G.map((z,B)=>G.reduce((Q,J)=>Math.max(Q,J[B]),0));return G.map((z)=>z.map((B,Q)=>B/D[Q]*19))}function K9(G,D,z,B,Q,J,U=0){let{_Scene:Z}=G,S=new Z.LinearScale;S.domain=[0,7],S.range=[-Math.PI,Math.PI].map((_)=>_+Math.PI/2);let X=new Z.LinearScale;X.domain=[0,10],X.range=[Q,J];let Y=[],W=B/2,q=z.map((_)=>{let k=new Z.Path;return k.strokeWidth=1,k.strokeOpacity=0.5,k.lineCap="round",k.fill=void 0,k.fillOpacity=0.8,_.forEach((w,K)=>{let f=S.convert(K),N=Q+J-X.convert(w),F=N*Math.cos(f)+W,E=N*Math.sin(f)+W;if(k.path[K>0?"lineTo":"moveTo"](F,E),U>0){let I=new Z.Marker({shape:"circle"});I.x=F,I.y=E,I.size=U,Y.push(I)}}),k.path.closePath(),k}),H=new Z.Group;return H.append([...q,...Y]),D.append(H),{paths:q,markers:Y}}function eB(G){let[D,z]=[1/0,-1/0];return{processedData:G.reduce((Q,J,U)=>{let Z=U>0?Q[U-1]:void 0;Q[U]??(Q[U]=[]);let S=Q[U];return J.forEach((X,Y)=>{if(Z)X+=Z[Y];if(S[Y]=X,S[Y]z)z=S[Y]}),Q},[]),min:D,max:z}}var tc=[[[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]]],sJ=class extends PD{constructor(G,D,z,B,Q,J="funnelTooltip",U=tc){super(G,D,J);this.shapes=pc(D,this.root,U,this.size,this.padding),this.updateColors(z,B)}updateColors(G,D){for(let z of this.shapes)z.fill=G[0],z.stroke=D[0],z.strokeWidth=0}},sc={chartType:"funnel",miniChart:sJ},oc=[[[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]]],rc=class extends sJ{constructor(G,D,z,B,Q,J="coneFunnelTooltip"){super(G,D,z,B,Q,J,oc)}updateColors(G,D){this.shapes.forEach((z,B)=>{z.fill=G[0],z.fillOpacity=1-B*0.2,z.stroke=D[0],z.strokeWidth=0})}},ac={chartType:"coneFunnel",miniChart:rc},ec=[[[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]]],Gh=class extends sJ{constructor(G,D,z,B,Q,J="pyramidTooltip"){super(G,D,z,B,Q,J,ec)}updateColors(G,D){this.shapes.forEach((z,B)=>{z.fill=G[B],z.stroke=D[B],z.strokeWidth=0})}},Dh={chartType:"pyramid",miniChart:Gh},qG=class extends PD{constructor(G,D,z){super(G,D,z);this.stroke="gray",this.axisOvershoot=3}postConstruct(){let{_Scene:G}=this.agChartsExports,D=this.size,z=this.padding,B=new G.Line;B.x1=z,B.y1=z,B.x2=z,B.y2=D-z+this.axisOvershoot,B.stroke=this.stroke;let Q=new G.Line;Q.x1=z-this.axisOvershoot+1,Q.y1=D-z,Q.x2=D-z+1,Q.y2=D-z,Q.stroke=this.stroke;let J=this.root;J.append(B),J.append(Q),super.postConstruct()}},zh=class extends qG{constructor(G,D,z,B){super(G,D,"groupedColumnTooltip");this.columnData=[2,3,4];let{root:Q,columnData:J,size:U,padding:Z}=this;this.columns=k0({stacked:!1,root:Q,data:J,size:U,padding:Z,xScaleDomain:[0,1,2],yScaleDomain:[0,4],xScalePadding:0.3,agChartsExports:D}),Q.append(this.columns),this.updateColors(z,B)}updateColors(G,D){this.columns.forEach((z,B)=>{z.fill=G[B],z.stroke=D[B]})}},Bh={chartType:"groupedColumn",miniChart:zh},Jh=[[8,12,16],[6,9,12],[2,3,4]],f9=class extends qG{constructor(G,D,z,B,Q,J=Jh,U=[0,16],Z="stackedColumnTooltip"){super(G,D,Z);let{root:S,size:X,padding:Y}=this;this.stackedColumns=k0({stacked:!0,root:S,data:J,size:X,padding:Y,xScaleDomain:[0,1,2],yScaleDomain:U,xScalePadding:0.3,agChartsExports:D}),S.append(Qh(this.stackedColumns)),this.updateColors(z,B)}updateColors(G,D){this.stackedColumns.forEach((z,B)=>{for(let Q of z)Q.fill=G[B],Q.stroke=D[B]})}},Uh={chartType:"stackedColumn",miniChart:f9},Zh=[[10,10,10],[6,7,8],[2,4,6]],$h=class extends f9{constructor(G,D,z,B,Q){super(G,D,z,B,Q,Zh,[0,10],"normalizedColumnTooltip")}},Lh={chartType:"normalizedColumn",miniChart:$h},Sh=class extends qG{constructor(G,D,z,B){super(G,D,"groupedBarTooltip");let{_Scene:Q}=D,J=this.padding,U=this.size,Z=[2,3,4],S=new Q.CategoryScale;S.domain=[0,1,2],S.range=[J,U-J],S.paddingInner=0.3,S.paddingOuter=0.3;let X=new Q.LinearScale;X.domain=[0,4],X.range=[U-J,J];let Y=X.convert(0),W=S.bandwidth;this.bars=Z.map((q,H)=>{let _=new Q.Rect;return _.x=J,_.y=S.convert(H),_.width=Y-X.convert(q),_.height=W,_.strokeWidth=0,_.crisp=!0,_}),this.updateColors(z,B),this.root.append(this.bars)}updateColors(G,D){this.bars.forEach((z,B)=>{z.fill=G[B],z.stroke=D[B]})}},Xh={chartType:"groupedBar",miniChart:Sh},Wh=[[8,12,16],[6,9,12],[2,3,4]],N9=class extends qG{constructor(G,D,z,B,Q,J=Wh,U=[0,16],Z="stackedBarTooltip"){super(G,D,Z);let{_Scene:S}=D,X=this.size,Y=this.padding,W=new S.CategoryScale;W.domain=[0,1,2],W.range=[Y,X-Y],W.paddingInner=0.3,W.paddingOuter=0.3;let q=new S.LinearScale;q.domain=U,q.range=[X-Y,Y];let H=q.convert(0),_=W.bandwidth;this.bars=J.map((k)=>k.map((w,K)=>{let f=new S.Rect;return f.x=Y,f.y=W.convert(K),f.width=H-q.convert(w),f.height=_,f.strokeWidth=0,f.crisp=!0,f})),this.updateColors(z,B),this.root.append(Yh(this.bars))}updateColors(G,D){this.bars.forEach((z,B)=>z.forEach((Q)=>{Q.fill=G[B],Q.stroke=D[B]}))}},qh={chartType:"stackedBar",miniChart:N9},Hh=[[10,10,10],[6,7,8],[2,4,6]],_h=class extends N9{constructor(G,D,z,B,Q){super(G,D,z,B,Q,Hh,[0,10],"normalizedBarTooltip")}},kh={chartType:"normalizedBar",miniChart:_h},F9=class extends PD{constructor(G,D,z,B,Q,J=0.6,U="donutTooltip"){super(G,D,U);let{size:Z,padding:S,agChartsExports:{_Scene:X}}=this,Y=(Z-S*2)/2,W=Y+S,q=X.toRadians,H=[[q(-90),q(30)],[q(30),q(120)],[q(120),q(180)],[q(180),q(210)],[q(210),q(240)],[q(240),q(270)]];this.sectors=H.map(([_,k])=>{let w=new X.Sector;return w.centerX=W,w.centerY=W,w.innerRadius=Y*J,w.outerRadius=Y,w.startAngle=_,w.endAngle=k,w.stroke=void 0,w.strokeWidth=0,w.inset=0.75,w}),this.updateColors(z,B),this.root.append(this.sectors)}updateColors(G,D){this.sectors.forEach((z,B)=>{z.fill=G[B%G.length],z.stroke=D[B%D.length]})}},D6={chartType:"donut",miniChart:F9},wh=class extends F9{constructor(G,D,z,B,Q){super(G,D,z,B,Q,0,"pieTooltip")}},Kh={chartType:"pie",miniChart:wh},oJ=[[1,3,5],[2,6,4],[5,3,1]],rJ=class extends qG{constructor(G,D,z,B,Q,J=oJ,U="lineTooltip"){super(G,D,U);let{size:Z,padding:S,root:X}=this;this.lines=tJ(D,X,J,Z,S),this.updateColors(z,B)}updateColors(G,D){this.lines.forEach((z,B)=>{z.stroke=G[B]})}},fh={chartType:"line",miniChart:rJ},E9=k9(oJ),Nh=class extends rJ{constructor(G,D,z,B,Q,J=E9,U="stackedLineTooltip"){super(G,D,z,B,Q,J,U)}},Fh={chartType:"stackedLine",miniChart:Nh},Eh=w9(E9),Ih=class extends rJ{constructor(G,D,z,B,Q,J=Eh,U="normalizedLineTooltip"){super(G,D,z,B,Q,J,U)}},Mh={chartType:"normalizedLine",miniChart:Ih},Ah=class extends qG{constructor(G,D,z,B){super(G,D,"scatterTooltip");let{size:Q,padding:J,agChartsExports:{_Scene:U}}=this,Z=[[[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]]],S=new U.LinearScale;S.domain=[-0.5,4],S.range=[J*2,Q-J];let X=new U.LinearScale;X.domain=[-0.5,3.5],X.range=[Q-J,J];let Y=[];Z.forEach((q)=>{q.forEach(([H,_])=>{let k=new U.Arc;k.strokeWidth=0,k.centerX=S.convert(H),k.centerY=X.convert(_),k.radius=2.5,Y.push(k)})}),this.points=Y,this.updateColors(z,B);let W=new U.Group;W.setClipRect(new U.BBox(J,J,Q-J*2,Q-J*2)),W.append(this.points),this.root.append(W)}updateColors(G,D){this.points.forEach((z,B)=>{z.stroke=D[B%D.length],z.fill=G[B%G.length]})}},Rh={chartType:"scatter",miniChart:Ah},Ch=class extends qG{constructor(G,D,z,B){super(G,D,"bubbleTooltip");let{size:Q,padding:J,agChartsExports:{_Scene:U}}=this,Z=[[[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]]],S=new U.LinearScale;S.domain=[0,1],S.range=[J*2,Q-J];let X=new U.LinearScale;X.domain=[0,1],X.range=[Q-J,J];let Y=[];Z.forEach((q)=>{q.forEach(([H,_,k])=>{let w=new U.Arc;w.strokeWidth=0,w.centerX=S.convert(H),w.centerY=X.convert(_),w.radius=k,w.fillOpacity=0.7,Y.push(w)})}),this.points=Y,this.updateColors(z,B);let W=new U.Group;W.setClipRect(new U.BBox(J,J,Q-J*2,Q-J*2)),W.append(this.points),this.root.append(W)}updateColors(G,D){this.points.forEach((z,B)=>{z.stroke=D[B%D.length],z.fill=G[B%G.length]})}},Vh={chartType:"bubble",miniChart:Ch},I9=oJ,M9=class extends qG{constructor(G,D,z,B,Q,J=I9,U="groupedAreaTooltip",Z=!1){super(G,D,U);this.areas=mc(D._Scene,this.root,J,this.size,this.padding,Z),this.updateColors(z,B)}updateColors(G,D){this.areas.forEach((z,B)=>{z.fill=G[B],z.stroke=D[B],z.strokeWidth=1,z.strokeOpacity=0.75,z.fillOpacity=0.7})}},bh={chartType:"area",miniChart:M9},A9=k9(I9),R9=class extends M9{constructor(G,D,z,B,Q,J=A9,U="stackedAreaTooltip"){super(G,D,z,B,Q,J,U,!0)}updateColors(G,D){this.areas.forEach((z,B)=>{z.fill=G[B],z.stroke=D[B]})}},vh={chartType:"stackedArea",miniChart:R9},Oh=w9(A9),uh=class extends R9{constructor(G,D,z,B,Q,J=Oh,U="normalizedAreaTooltip"){super(G,D,z,B,Q,J,U)}},jh={chartType:"normalizedArea",miniChart:uh},Ph=class extends qG{constructor(G,D,z,B){super(G,D,"histogramTooltip");let{padding:Q,size:J,agChartsExports:{_Scene:U}}=this,Z=[2,5,11,13,10,6,1],S=new U.LinearScale;S.domain=[0,Z.length],S.range=[Q,J-Q];let X=new U.LinearScale;X.domain=[0,Z.reduce((W,q)=>Math.max(W,q),0)],X.range=[J-Q,Q];let Y=X.convert(0);this.bars=Z.map((W,q)=>{let H=X.convert(W),_=S.convert(q),k=S.convert(q+1),w=new U.Rect;return w.x=_,w.y=H,w.width=k-_,w.height=Y-H,w.strokeWidth=1,w.strokeOpacity=0.75,w.crisp=!0,w}),this.updateColors(z,B),this.root.append(this.bars)}updateColors([G],[D]){for(let z of this.bars)z.fill=G,z.stroke=D}},gh={chartType:"histogram",miniChart:Ph},_z=class extends PD{constructor(G,D,z){super(G,D,z);this.stroke="gray",this.showRadiusAxisLine=!0,this.showAngleAxisLines=!0}postConstruct(){let{_Scene:G}=this.agChartsExports,D=this.size,z=this.padding,B=z*2,Q=(D-B)/2,J=this.showAngleAxisLines?[Q,Q*0.8,Q*0.6,Q*0.4]:[],U=new G.Line;U.x1=D/2,U.y1=z,U.x2=D/2,U.y2=D-z-Q-J[J.length-1],U.stroke=this.stroke,U.strokeOpacity=0.5,U.fill=void 0,U.visible=this.showRadiusAxisLine;let Z=z+Q;this.gridLines=J.map((X,Y)=>{let W=new G.Path;return W.path.arc(Z,Z,X,0,2*Math.PI),W.strokeWidth=1,W.stroke=this.stroke,W.strokeOpacity=Y===0?0.5:0.2,W.fill=void 0,W});let S=this.root;if(S.append(U),this.gridLines.length>0)S.append(this.gridLines);super.postConstruct()}},Th=class extends _z{constructor(G,D,z,B){super(G,D,"radialColumnTooltip");this.data=[[6,8,10,2,6,5],[4,4,3,6,4,4],[5,4,2,9,8,9]],this.showRadiusAxisLine=!1;let{padding:Q,size:J,data:U,agChartsExports:{_Scene:Z}}=this,S=(J-Q*2)/2,Y=S*0.4,W=new Z.CategoryScale;W.domain=U[0].map((K,f)=>f),W.range=[0,2*Math.PI],W.paddingInner=0,W.paddingOuter=0;let q=W.bandwidth*0.7,{processedData:H,max:_}=eB(U),k=new Z.LinearScale;k.domain=[0,_],k.range=[Y,S];let w=this.size/2;this.series=H.map((K,f)=>{let F=f===0?void 0:H[f-1],E=new Z.TranslatableGroup({zIndex:1e6}),I=K.map((V,A)=>{let R=F?.[A],O=k.convert(V),u=k.convert(R??0),v=W.convert(A),h=v+q,P=Z.getRadialColumnWidth(v,h,S,0.5,0.5),b=new Z.RadialColumnShape;return b.columnWidth=P,b.innerRadius=u,b.outerRadius=O,b.startAngle=v,b.endAngle=h,b.isBeveled=!0,b.axisInnerRadius=Y,b.axisOuterRadius=S,b.stroke=void 0,b.strokeWidth=0,b});return E.append(I),E.translationX=w,E.translationY=w,E}),this.root.append(this.series),this.updateColors(z,B)}updateColors(G,D){this.series.forEach((z,B)=>{for(let Q of z.children())Q.fill=G[B%G.length],Q.stroke=D[B%D.length]})}},yh={chartType:"radialColumn",miniChart:Th},xh=class extends _z{constructor(G,D,z,B){super(G,D,"radialBarTooltip");this.data=[[6,8,10],[4,4,3],[5,4,2]],this.showRadiusAxisLine=!1;let{size:Q,padding:J,data:U,agChartsExports:{_Scene:Z}}=this,S=(Q-J)/2,Y=S*0.4,W=new Z.CategoryScale;W.domain=U[0].map((N,F)=>F),W.range=[Y,S],W.paddingInner=0.5,W.paddingOuter=0;let q=W.bandwidth,{processedData:H,max:_}=eB(U),k=new Z.LinearScale;k.domain=[0,Math.ceil(_*1.5)];let w=1.5*Math.PI,K=w+2*Math.PI;k.range=[w,K];let f=Q/2;this.series=H.map((N,F)=>{let E=F<0?void 0:H[F-1],I=new Z.Group({zIndex:1e6}),V=N.map((A,R)=>{let O=E?.[R]??0,u=W.convert(R),v=u-q,h=k.convert(O),P=k.convert(A),b=new Z.Sector;return b.centerX=f,b.centerY=f,b.innerRadius=v,b.outerRadius=u,b.startAngle=h,b.endAngle=P,b.stroke=void 0,b.strokeWidth=0,b});return I.append(V),I}),this.root.append(this.series),this.updateColors(z,B)}updateColors(G,D){this.series.forEach((z,B)=>{for(let Q of z.children())Q.fill=G[B%G.length],Q.stroke=D[B%D.length]})}},ch={chartType:"radialBar",miniChart:xh},hh=class extends _z{constructor(G,D,z,B){super(G,D,"radarLineTooltip");this.markerSize=4,this.data=[[8,7,8,7,8,8,7,8],[6,8,5,10,6,7,4,6],[0,3,3,5,4,4,2,0]],this.showRadiusAxisLine=!1;let{size:Q,padding:J,root:U,data:Z}=this,S=(Q-J*2)/2,X=0,{paths:Y,markers:W}=K9(D,U,Z,Q,S,X,this.markerSize);this.lines=Y,this.markers=W,this.updateColors(z,B)}updateColors(G,D){this.lines.forEach((z,B)=>{let Q=this.data[B].length;z.stroke=G[B];let J=B*Q,U=J+Q,Z=this.markers.slice(J,U);for(let S of Z)S.stroke=D[B],S.fill=G[B]})}},ih={chartType:"radarLine",miniChart:hh},nh=class extends _z{constructor(G,D,z,B){super(G,D,"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]];let{size:Q,padding:J,root:U,data:Z}=this;this.showRadiusAxisLine=!1;let S=(Q-J*2)/2,X=S-Q*0.3;this.areas=K9(D,U,Z,Q,S,X).paths,this.updateColors(z,B)}updateColors(G,D){this.areas.forEach((z,B)=>{z.fill=G[B],z.stroke=D[B]})}},dh={chartType:"radarArea",miniChart:nh},lh=class extends _z{constructor(G,D,z,B){super(G,D,"nightingaleTooltip");this.data=[[6,10,9,8,7,8],[4,6,5,4,5,5],[3,5,4,3,4,7]],this.showRadiusAxisLine=!1;let{size:Q,padding:J,data:U,agChartsExports:{_Scene:Z}}=this,S=(Q-J*2)/2,X=new Z.CategoryScale;X.domain=U[0].map((k,w)=>w),X.range=[-Math.PI,Math.PI],X.paddingInner=0,X.paddingOuter=0;let Y=X.bandwidth*0.7,{processedData:W,max:q}=eB(U),H=new Z.LinearScale;H.domain=[0,q],H.range=[0,S];let _=Q/2;this.series=W.map((k,w)=>{let K=w<0?void 0:W[w-1],f=new Z.Group({zIndex:1e6}),N=k.map((F,E)=>{let I=K?.[E],V=H.convert(F),A=H.convert(I??0),R=X.convert(E),O=R+Y,u=new Z.Sector;return u.centerX=_,u.centerY=_,u.innerRadius=A,u.outerRadius=V,u.startAngle=R,u.endAngle=O,u.stroke=void 0,u.strokeWidth=0,u});return f.append(N),f}),this.root.append(this.series),this.updateColors(z,B)}updateColors(G,D){this.series.forEach((z,B)=>{for(let Q of z.children())Q.fill=G[B%G.length],Q.stroke=D[B%D.length]})}},ph={chartType:"nightingale",miniChart:lh},mh=class extends qG{constructor(G,D,z,B){super(G,D,"rangeBarTooltip");let Q=[3,3.5,3];this.bars=this.createRangeBar(this.root,Q,this.size,this.padding,"vertical"),this.updateColors(z,B)}updateColors(G,D){this.bars.forEach((z,B)=>{z.fill=G[B],z.stroke=D[B]})}createRangeBar(G,D,z,B,Q){let J=Q==="horizontal",U=2*B,{_Scene:Z}=this.agChartsExports,S=new Z.CategoryScale;S.domain=D.map((_,k)=>k),S.range=[B,z-B],S.paddingInner=0.3,S.paddingOuter=0.3;let X=0.7,Y=1.3,W=new Z.LinearScale;W.domain=[D.reduce((_,k)=>Math.min(_,k),1/0)*X,D.reduce((_,k)=>Math.max(_,k),0)*Y],W.range=[U,z-U];let q=S.bandwidth,H=D.map((_,k)=>{let[w,K]=[_*X,_*Y],f=S.convert(k),N=W.convert(w),F=W.convert(K)-N,E=new Z.Rect;return E.x=J?N:f,E.y=J?f:N,E.width=J?F:q,E.height=J?q:F,E.strokeWidth=0,E.crisp=!0,E});return G.append(H),H}},th={chartType:"rangeBar",miniChart:mh},sh=class extends qG{constructor(G,D,z,B){super(G,D,"rangeAreaTooltip");let Q=4,J=[u1({offset:0.375*Q,length:Q,pattern:{low:3,high:5,period:Q}}),u1({offset:0.375*Q,length:Q,pattern:{low:2.25,high:4.25,period:Q}}),u1({offset:0.75*Q,length:Q,pattern:{low:2.5,high:4.5,period:Q}})],U=1.75,Z=J.map((Y)=>Y.map(([W,q])=>({x:W,low:q-0.5*U,high:q+0.5*U}))),{lines:S,areas:X}=this.createRangeArea(this.root,Z,this.size,this.padding);this.lines=S,this.areas=X,this.updateColors(z,B)}updateColors(G,D){G=B6(G,1,2),D=B6(D,1,2),this.lines.forEach(([z,B],Q)=>{z.fill=void 0,z.stroke=D[Q],B.fill=void 0,B.stroke=D[Q]}),this.areas.forEach((z,B)=>{z.fill=G[B]})}createRangeArea(G,D,z,B){let Q=D.reduce((k,w)=>w.reduce((K,{x:f})=>Math.min(K,f),k),1/0),J=D.reduce((k,w)=>w.reduce((K,{x:f})=>Math.max(K,f),k),-1/0),U=D.reduce((k,w)=>w.reduce((K,{low:f})=>Math.min(K,f),k),1/0),Z=D.reduce((k,w)=>w.reduce((K,{high:f})=>Math.max(K,f),k),-1/0),{_Scene:S}=this.agChartsExports,X=new S.LinearScale;X.domain=[Q,J],X.range=[B,z-B];let Y=2*B,W=new S.LinearScale;W.domain=[U,Z],W.range=[z-Y,Y];let q=[],H=[];return D.map((k)=>{let w=new S.Path,K=new S.Path,f=new S.Path;return q.push([w,K]),H.push(f),w.strokeWidth=0,K.strokeWidth=0,f.strokeWidth=0,f.fillOpacity=0.8,w.path.clear(),K.path.clear(),f.path.clear(),k.map((N,F)=>{let{x:E,low:I,high:V}=N,A=X.convert(E),R=W.convert(I),O=W.convert(V),u=F>0?"lineTo":"moveTo";return w.path[u](A,O),K.path[u](A,R),f.path[u](A,O),[A,R]})}).forEach((k,w)=>{let K=k.length-1,f=H[w];for(let N=K;N>=0;N--){let[F,E]=k[N];f.path.lineTo(F,E)}}),G.append(H.concat(...q)),{lines:q,areas:H}}};function u1(G){let{offset:D,length:z,pattern:B}=G,Q=Z(D,z,B),J=0,U=z;if(Q.length===0||Q[0][0]!==0)Q.unshift(S(0,D,B));if(Q[Q.length-1][0]!==U)Q.push(S(U,D,B));return Q;function Z(Y,W,q){let{period:H}=q,_=Y/H,w=[0,0.5].map((f)=>f-_).map(z6).sort((f,N)=>f-N);return Array.from({length:Math.floor(w.length*(H/W))},(f,N)=>w[N%w.length]+Math.floor(N/w.length)).map((f)=>f*H).map((f)=>S(f,Y,q))}function S(Y,W,q){return[Y,X(W+Y,q)]}function X(Y,W){let{low:q,high:H,period:_}=W,k=z6(Y/_),w=k>0.5?1-2*(k-0.5):2*k;return q+(H-q)*w}}function z6(G){let D=G%1;return D<0?D+1:D}function B6(G,D,z){let B=[...G],Q=B[D];return B[D]=B[z],B[z]=Q,B}var oh={chartType:"rangeArea",miniChart:sh},rh=class extends qG{constructor(G,D,z,B,Q){super(G,D,"boxPlotTooltip");let{size:J,padding:U,agChartsExports:{_Scene:Z}}=this,S=[11,11.5,10.5],X=1.2,Y=1.1,W=0.9,q=0.8,H=new Z.LinearScale;H.domain=[S.reduce((K,f)=>Math.min(K,f),1/0)*q,S.reduce((K,f)=>Math.max(K,f),0)*X],H.range=[J-1.5*U,U];let _=new Z.CategoryScale;_.domain=S.map((K,f)=>f),_.range=[U,J-U],_.paddingInner=0.4,_.paddingOuter=0.2;let k=Math.round(_.bandwidth),w=Math.round(_.bandwidth/2);this.boxPlotGroups=S.map((K,f)=>{let[N,F,E,I]=[K*q,K*W,K*Y,K*X],V=Math.round(H.convert(E)),A=Math.round(_.convert(f)),R=Math.round(A+k),O=Math.round(H.convert(F)),u=Math.round(H.convert(N)),v=Math.round(H.convert(K)),h=Math.round(H.convert(I)),P=A+w,b=new Z.Group,g=new Z.Rect,c=new Z.Line,s=new Z.Line,m=new Z.Line,zG=new Z.Line,fG=new Z.Line;return g.x=A,g.y=V,g.width=k,g.height=O-V,g.strokeWidth=1,g.strokeOpacity=0.75,g.crisp=!0,this.setLineProperties(c,A,R,v,v),this.setLineProperties(s,P,P,h,V),this.setLineProperties(m,P,P,u,O),this.setLineProperties(zG,A,R,h,h),this.setLineProperties(fG,A,R,u,u),b.append([g,c,s,m,zG,fG]),b}),this.updateColors(z,B,Q),this.root.append(this.boxPlotGroups)}updateColors(G,D,z){let{_Theme:B}=this.agChartsExports;this.boxPlotGroups.forEach((Q,J)=>{for(let U of Q.children()){let Z=G[J%G.length];U.fill=z?Z:B.resolveOperation({$mix:[Z,{$ref:"backgroundColor"},0.7]}),U.stroke=D[J%D.length]}})}setLineProperties(G,D,z,B,Q){G.x1=D,G.x2=z,G.y1=B,G.y2=Q,G.strokeOpacity=0.75}},ah={chartType:"boxPlot",miniChart:rh},eh=class extends PD{constructor(G,D,z,B,Q){super(G,D,"treemapTooltip");let{size:J,padding:U,agChartsExports:{_Scene:Z}}=this,S=[[1,1],[3,2,1]],Y=S.length%2===0?0.3:0.2,W=[U,J-U],q=S.length,H=q*(q+1)/2,_=Y/(q-1),k=W[1]-W[0],w=k-Y,K=W[0];this.rects=S.reduce((N,F,E)=>{N??(N=[]);let I=(q-E)/H,V=w*I,A=F.length,R=F.reduce((P,b)=>P+b,0),O=Y/(A-1||1),u=A>1?k-Y:k,v=W[0],h=F.map((P)=>{let b=new Z.Rect,g=u*P/R;return b.x=K,b.y=v,b.width=V,b.height=g,b.strokeWidth=0.75,b.crisp=!0,v+=g+O,b});return K+=V+_,N.push(...h),N},[]),this.updateColors(z,B,Q);let f=new Z.Group;f.setClipRect(new Z.BBox(U,U,J-U,J-U)),f.append(this.rects),this.root.append(f)}updateColors(G,D,z){let{_Theme:B}=this.agChartsExports;this.rects.forEach((Q,J)=>{Q.fill=G[J%D.length],Q.stroke=z?D[J%D.length]:B.resolveOperation({$ref:"backgroundColor"})})}},Gi={chartType:"treemap",miniChart:eh},Di=class extends _z{constructor(G,D,z,B){super(G,D,"sunburstTooltip");this.data=[[[],[]],[[],[]],[[],[]]],this.angleOffset=-Math.PI/2,this.innerRadiusRatio=0,this.showRadiusAxisLine=!1,this.showAngleAxisLines=!1;let{data:Q,size:J,padding:U,angleOffset:Z,innerRadiusRatio:S,agChartsExports:{_Scene:X}}=this,Y=(J-U*2)/2,W=[Z+0,Z+2*Math.PI],q=Math.abs(W[1]-W[0]),H=[Y*S,Y],_=Math.abs(H[1]-H[0]),k=0,w=(E,I)=>{for(let V of E){let A=I+1;k=Math.max(k,A),w(V,A)}};w(Q,0);let K=_/k,f=this.size/2,N=W[0];this.series=[];let F=(E,I,V,A,R)=>{if(!Array.isArray(E))return;let u=I+1,v=V;E.forEach((h,P,b)=>{let g=R;if(!g)g=new X.Group,this.series.push(g);let c=H[0]+I*K,s=H[0]+u*K,m=1/b.length,zG=v,fG=zG+A*m,y=new X.Sector;y.centerX=f,y.centerY=f,y.innerRadius=c,y.outerRadius=s,y.startAngle=zG,y.endAngle=fG,y.stroke=void 0,y.strokeWidth=0,y.inset=0.75,v=fG,g.append(y),F(h,u,zG,Math.abs(fG-zG),g)})};F(Q,0,N,q),this.root.append(this.series),this.updateColors(z,B)}updateColors(G,D){this.series.forEach((z,B)=>{for(let Q of z.children())Q.fill=G[B%G.length],Q.stroke=D[B%D.length]})}},zi={chartType:"sunburst",miniChart:Di},Bi=class extends PD{constructor(G,D,z,B,Q){super(G,D,"heatmapTooltip");let{size:J,padding:U,agChartsExports:{_Scene:Z}}=this,S=3,X=Array.from({length:S},(w,K)=>Array.from({length:S},(f,N)=>N)),Y=X.map((w,K)=>K),W=new Z.CategoryScale;W.domain=Y,W.range=[U,J-U],W.paddingInner=0.01,W.paddingOuter=0.1;let q=new Z.CategoryScale;q.domain=Y,q.range=[U,J-U],q.paddingInner=0.01,q.paddingOuter=0.1;let H=W.bandwidth??0,_=q.bandwidth??0;this.rects=X.reduce((w,K,f)=>{w??(w=[]);let N=K.map((F,E)=>{let I=new Z.Rect;return I.x=W.convert(f),I.y=q.convert(E),I.width=H,I.height=_,I.strokeWidth=0,I.crisp=!0,I});return w.push(...N),w},[]),this.updateColors(z,B,Q);let k=new Z.Group;k.setClipRect(new Z.BBox(U,U,J-U,J-U)),k.append(this.rects),this.root.append(k)}updateColors(G,D,z){let{_Theme:B,_Util:Q}=this.agChartsExports,J=z?[G[0],G[1]]:B.resolveOperation({$palette:"divergingColors"}),U=z?D[0]:B.resolveOperation({$ref:"backgroundColor"}),Z=Q.interpolateColor(J[0],J[1]);this.rects.forEach((S,X)=>{S.fill=Z(X*0.2),S.stroke=U})}},Qi={chartType:"heatmap",miniChart:Bi},Ji=class extends qG{constructor(G,D,z,B,Q){super(G,D,"waterfallTooltip");this.data=[4,3,-3,6,-3],this.bars=this.createWaterfall(this.root,this.data,this.size,this.padding,"vertical").bars,this.updateColors(z,B,Q)}updateColors(G,D,z){let{data:B,agChartsExports:{_Theme:Q}}=this,J={fill:z?G[0]:Q.resolveOperation({$palette:"altUp.fill"}),stroke:z?D[0]:Q.resolveOperation({$palette:"altUp.stroke"})},U={fill:z?G[1]:Q.resolveOperation({$palette:"altDown.fill"}),stroke:z?D[1]:Q.resolveOperation({$palette:"altDown.stroke"})};this.bars.forEach((Z,S)=>{let X=B[S]>=0;Z.fill=X?J.fill:U.fill,Z.stroke=X?J.stroke:U.stroke})}createWaterfall(G,D,z,B,Q){let J=2*B,{processedData:U,min:Z,max:S}=eB(D.map((N)=>[N])),X=U.reduce((N,F)=>N.concat(F),[]),{_Scene:Y}=this.agChartsExports,W=new Y.LinearScale;W.domain=[Math.min(Z,0),S],W.range=[z-J,J];let q=new Y.CategoryScale;q.domain=D.map((N,F)=>F),q.range=[B,z-B],q.paddingInner=0.2,q.paddingOuter=0.3;let H=q.bandwidth,_=new Y.Path;_.stroke="#575757",_.strokeWidth=0;let k=Math.floor(_.strokeWidth)%2/2,w=_.path;w.clear();let K=Q==="horizontal",f=X.map((N,F)=>{let E=F>0?X[F-1]:0,V=D[F]>0,A=Math.round(W.convert(N)),R=Math.round(W.convert(E)),O=(V?A:R)-k,u=(V?R:A)+k,v=Math.abs(u-O),h=q.convert(F),P=new Y.Rect;P.x=K?O:h,P.y=K?h:O,P.width=K?v:H,P.height=K?H:v,P.strokeWidth=0,P.crisp=!0;let b=A+k,g=R+k;if(F>0){let m=K?g:P.x,zG=K?P.y:g;w.lineTo(m,zG)}let c=K?b:P.x,s=K?P.y:b;return w.moveTo(c,s),P});return G.append([_,...f]),{bars:f}}},Ui={chartType:"waterfall",miniChart:Ji},Zi=class extends qG{constructor(G,D,z,B){super(G,D,"columnLineComboTooltip");this.columnData=[3,4],this.lineData=[[5,4,6,5,4]];let{root:Q,columnData:J,lineData:U,size:Z,padding:S}=this;this.columns=k0({stacked:!1,root:Q,data:J,size:Z,padding:S,xScaleDomain:[0,1],yScaleDomain:[0,4],xScalePadding:0.5,agChartsExports:D}),Q.append(this.columns),this.lines=tJ(D,Q,U,Z,S),this.updateColors(z,B)}updateColors(G,D){this.columns.forEach((z,B)=>{z.fill=G[B],z.stroke=D[B]}),this.lines.forEach((z,B)=>{z.stroke=G[B+2]})}},$i={chartType:"columnLineCombo",miniChart:Zi},Li=class extends qG{constructor(G,D,z,B){super(G,D,"areaColumnComboTooltip");this.columnData=[3,4.5],this.areaData=[[5,4,6,5,4]];let{root:Q,columnData:J,areaData:U,size:Z,padding:S,agChartsExports:{_Scene:X}}=this;this.columns=k0({stacked:!1,root:Q,data:J,size:Z,padding:S,xScaleDomain:[0,1],yScaleDomain:[0,6],xScalePadding:0.5,agChartsExports:D});let Y=new X.CategoryScale;Y.range=[S,Z-S],Y.domain=[0,1,2,3,4],Y.paddingInner=1,Y.paddingOuter=0;let W=new X.LinearScale;W.range=[Z-S,S],W.domain=[0,6];let q=[],H=W.convert(0),_=Y.convert(0);U.forEach((K,f)=>{let N=q[f]||(q[f]=[]);K.forEach((E,I)=>{let V=E,A=I,R=Y.convert(A),O=W.convert(V);N[I]={x:R,y:O}});let F=Y.convert(K.length-1);q[f].push({x:F,y:H},{x:_,y:H})}),this.areas=q.map((K)=>{let f=new X.Path;f.strokeWidth=0,f.fillOpacity=0.8;let N=f.path;return K.forEach((F,E)=>N[E>0?"lineTo":"moveTo"](F.x,F.y)),f});let k=new X.Group;k.setClipRect(new X.BBox(S,S,Z-S*2,Z-S*2));let w=new X.Group;w.setClipRect(new X.BBox(S,S,Z-S*2,Z-S*2)),k.append(this.areas),w.append(this.columns),Q.append(k),Q.append(w),this.updateColors(z,B)}updateColors(G,D){this.areas.forEach((z,B)=>{z.fill=G[B],z.stroke=D[B]}),this.columns.forEach((z,B)=>{z.fill=G[B+1],z.stroke=D[B+1]})}},Si={chartType:"areaColumnCombo",miniChart:Li},Xi=class extends PD{constructor(G,D,z,B){super(G,D,"customComboTooltip");this.columnData=[3,4],this.lineData=[[5,4,6,5,4]];let{root:Q,columnData:J,lineData:U,size:Z,padding:S,agChartsExports:{_Scene:X}}=this;this.columns=k0({stacked:!1,root:Q,data:J,size:Z,padding:S,xScaleDomain:[0,1],yScaleDomain:[0,4],xScalePadding:0.5,agChartsExports:D}),Q.append(this.columns),this.lines=tJ(this.agChartsExports,Q,U,Z,S);let Y="grey",W=3,q=new X.Line;q.x1=S,q.y1=S,q.x2=S,q.y2=Z-S+W,q.stroke=Y;let H=new X.Line;H.x1=S-W+1,H.y1=Z-S,H.x2=Z-S+1,H.y2=Z-S,H.stroke=Y;let _=new X.Path;this.buildPenIconPath(_),_.fill="whitesmoke",_.stroke="darkslategrey",_.strokeWidth=1,Q.append([H,q,_]),this.updateColors(z,B)}updateColors(G,D){this.columns.forEach((z,B)=>{z.fill=G[B],z.stroke=D[B]}),this.lines.forEach((z,B)=>{z.stroke=G[B+2]})}buildPenIconPath(G){let{path:D}=G;D.moveTo(25.76,43.46),D.lineTo(31.27,48.53),D.moveTo(49.86,22),D.lineTo(49.86,22),D.cubicCurveTo(49.01994659053345,21.317514933510974,47.89593834348529,21.09645997825817,46.86,21.41),D.lineTo(46.86,21.41),D.cubicCurveTo(45.55460035985361,21.77260167850787,44.38777081121966,22.517979360321792,43.51,23.55),D.lineTo(25.51,43.8),D.lineTo(25.43,43.89),D.lineTo(23.01,51.89),D.lineTo(22.83,52.46),D.lineTo(31.02,48.86),D.lineTo(49.02,28.52),D.lineTo(49.02,28.52),D.cubicCurveTo(49.940716461596224,27.521914221246085,50.54302631059587,26.2720342455763,50.75,24.93),D.lineTo(50.75,24.93),D.cubicCurveTo(50.95363374988308,23.866379846512814,50.62080640232334,22.77066734274871,49.86,22),D.closePath(),D.moveTo(41.76,25.5),D.lineTo(47.34,30.5),D.moveTo(40.74,26.65),D.lineTo(46.25,31.71)}},Yi={chartType:"customCombo",miniChart:Xi},Q6={columnGroup:{column:{range:!0,pivot:!0,enterprise:!1,icon:Bh},stackedColumn:{range:!0,pivot:!0,enterprise:!1,icon:Uh},normalizedColumn:{range:!0,pivot:!0,enterprise:!1,icon:Lh}},barGroup:{bar:{range:!0,pivot:!0,enterprise:!1,icon:Xh},stackedBar:{range:!0,pivot:!0,enterprise:!1,icon:qh},normalizedBar:{range:!0,pivot:!0,enterprise:!1,icon:kh}},pieGroup:{pie:{range:!0,pivot:!0,enterprise:!1,icon:Kh},donut:{range:!0,pivot:!0,enterprise:!1,icon:D6},doughnut:{range:!0,pivot:!0,enterprise:!1,icon:D6}},lineGroup:{line:{range:!0,pivot:!0,enterprise:!1,icon:fh},stackedLine:{range:!0,pivot:!0,enterprise:!1,icon:Fh},normalizedLine:{range:!0,pivot:!0,enterprise:!1,icon:Mh}},scatterGroup:{scatter:{range:!0,pivot:!0,enterprise:!1,icon:Rh},bubble:{range:!0,pivot:!0,enterprise:!1,icon:Vh}},areaGroup:{area:{range:!0,pivot:!0,enterprise:!1,icon:bh},stackedArea:{range:!0,pivot:!0,enterprise:!1,icon:vh},normalizedArea:{range:!0,pivot:!0,enterprise:!1,icon:jh}},polarGroup:{radarLine:{range:!0,pivot:!1,enterprise:!0,icon:ih},radarArea:{range:!0,pivot:!1,enterprise:!0,icon:dh},nightingale:{range:!0,pivot:!1,enterprise:!0,icon:ph},radialColumn:{range:!0,pivot:!1,enterprise:!0,icon:yh},radialBar:{range:!0,pivot:!1,enterprise:!0,icon:ch}},statisticalGroup:{boxPlot:{range:!0,pivot:!1,enterprise:!0,icon:ah},histogram:{range:!0,pivot:!1,enterprise:!1,icon:gh},rangeBar:{range:!0,pivot:!1,enterprise:!0,icon:th},rangeArea:{range:!0,pivot:!1,enterprise:!0,icon:oh}},hierarchicalGroup:{treemap:{range:!0,pivot:!0,enterprise:!0,icon:Gi},sunburst:{range:!0,pivot:!0,enterprise:!0,icon:zi}},specializedGroup:{heatmap:{range:!0,pivot:!1,enterprise:!0,icon:Qi},waterfall:{range:!0,pivot:!1,enterprise:!0,icon:Ui}},combinationGroup:{columnLineCombo:{range:!0,pivot:!0,enterprise:!1,icon:$i},areaColumnCombo:{range:!0,pivot:!0,enterprise:!1,icon:Si},customCombo:{range:!0,pivot:!0,enterprise:!1,icon:Yi}},funnelGroup:{funnel:{range:!0,pivot:!1,enterprise:!0,icon:sc},coneFunnel:{range:!0,pivot:!1,enterprise:!0,icon:ac},pyramid:{range:!0,pivot:!1,enterprise:!0,icon:Dh}}},Wi={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"]},qi=class extends gc{constructor(G,D,z,B,Q=Wi){super('
');this.wrappers=new Map,this.chartController=G,this.fills=D,this.strokes=z,this.isCustomTheme=B,this.chartGroups={...Q}}wireBeans(G){this.chartTranslation=G.chartTranslation}postConstruct(){if(!this.chartController.customComboExists()&&this.chartGroups.combinationGroup)this.chartGroups.combinationGroup=this.chartGroups.combinationGroup.filter((J)=>J!=="customCombo");let G=this.getGui(),D=this.chartController.isEnterprise(),z=this.chartController.isPivotChart(),B=!z,Q=Object.keys(this.chartGroups).map((J)=>{let U=J in Q6?Q6[J]:void 0;if(!U)return G6(148,{group:J}),null;let S=(this.chartGroups[J]??[]).map((X)=>{let Y=X in U?U[X]:void 0;if(!Y)return G6(149,{group:J,chartType:X}),null;if(!D&&Y.enterprise)return null;if(B&&Y.range)return Y;if(z&&Y.pivot)return Y;return null}).filter((X)=>X!=null);if(S.length===0)return null;return{label:this.chartTranslation.translate(J),items:S}}).filter((J)=>J!=null);for(let{label:J,items:U}of Q){let Z=this.createBean(new jG({title:J,suppressEnabledCheckbox:!0,enabled:!0,suppressOpenCloseIcons:!0,cssIdentifier:"charts-settings",direction:"horizontal",suppressKeyboardNavigation:!0}));for(let S of U){let{miniChart:X,chartType:Y}=S.icon,W=document.createElement("div");W.classList.add("ag-chart-mini-thumbnail"),W.setAttribute("tabindex","0"),W.setAttribute("role","button");let q=Y,H=()=>{this.chartController.setChartType(q),this.updateSelectedMiniChart()};this.addManagedListeners(W,{click:H,keydown:(_)=>{if(_.key==e5.ENTER||_.key===e5.SPACE)_.preventDefault(),H()}}),this.wrappers.set(q,W),this.createBean(new X(W,this.beans.agChartsExports,this.fills,this.strokes,this.isCustomTheme)),Z.addItem(W)}G.appendChild(Z.getGui())}this.updateSelectedMiniChart()}updateSelectedMiniChart(){let G=this.chartController.getChartType();this.wrappers.forEach((D,z)=>{let B=z===G;D.classList.toggle("ag-selected",B);let Q=this.chartTranslation.translate(hJ(z)),J=B?`${Q}. ${this.chartTranslation.translate("ariaChartSelected")}`:Q;Tc(D,J)})}destroy(){this.wrappers.clear(),super.destroy()}},Hi=class extends Oc{constructor(G){super(`
-
-
-
- -
-
-
- -
-
-
`);this.chartController=G,this.eMiniChartsContainer=oz,this.eNavBar=oz,this.eCardSelector=oz,this.ePrevBtn=oz,this.eNextBtn=oz,this.miniChartsContainers=[],this.cardItems=[],this.activePaletteIndex=0,this.palettes=[],this.themes=[]}postConstruct(){this.resetPalettes();let G=this.gos.get("enableRtl");this.ePrevBtn.insertAdjacentElement("afterbegin",r5(G?"chartsThemeNext":"chartsThemePrevious",this.beans)),this.eNextBtn.insertAdjacentElement("afterbegin",r5(G?"chartsThemePrevious":"chartsThemeNext",this.beans)),this.addManagedElementListeners(this.ePrevBtn,{click:()=>this.setActivePalette(this.getPrev(),"left")}),this.addManagedElementListeners(this.eNextBtn,{click:()=>this.setActivePalette(this.getNext(),"right")});let D=()=>this.resetPalettes(!0);this.addManagedListeners(this.chartController,{chartTypeChanged:D,chartApiUpdate:D}),this.scrollSelectedIntoView()}scrollSelectedIntoView(){setTimeout(()=>{let G=(B)=>{return!B.getGui().classList.contains("ag-hidden")},z=this.miniChartsContainers.find(G).getGui().querySelector(".ag-selected");if(z){let B=z.offsetParent;if(B)this.eMiniChartsContainer.scrollTo(0,B.offsetTop)}},250)}resetPalettes(G){let D=this.chartController.getPalettes(),z=this.gos.get("chartToolPanelsDef")?.settingsPanel?.chartGroupsDef;if(uc(D,this.palettes)&&!G||this.isAnimating)return;this.palettes=D,this.themes=this.chartController.getThemeNames(),this.activePaletteIndex=this.themes.findIndex((Q)=>Q===this.chartController.getChartThemeName()),this.cardItems=[],o5(this.eCardSelector),this.destroyMiniCharts();let{themes:B}=this;this.palettes.forEach((Q,J)=>{let U=this.activePaletteIndex===J,{fills:Z=[],strokes:S=[]}=Q,X=B[J],Y=!iJ(X,this.beans.agChartsExports._Theme),W=this.createBean(new qi(this.chartController,Z,S,Y,z));if(this.miniChartsContainers.push(W),this.eMiniChartsContainer.appendChild(W.getGui()),this.addCardLink(J),U)W.updateSelectedMiniChart();else W.setDisplayed(!1)}),Pc(this.eNavBar,this.palettes.length>1),a5(this.cardItems[this.activePaletteIndex],"ag-selected","ag-not-selected")}addCardLink(G){let D=document.createElement("div");D.classList.add("ag-chart-settings-card-item"),this.addManagedElementListeners(D,{click:()=>{this.setActivePalette(G,G=this.palettes.length)G=0;return G}setActivePalette(G,D){if(this.isAnimating||this.activePaletteIndex===G)return;a5(this.cardItems[G],"ag-selected","ag-not-selected");let z=this.miniChartsContainers[this.activePaletteIndex],B=z.getGui(),Q=this.miniChartsContainers[G],J=Q.getGui();z.updateSelectedMiniChart(),Q.updateSelectedMiniChart();let U=D==="left"?-1:1,Z=J.style.left=`${jc(this.getGui())*U}px`;this.activePaletteIndex=G,this.isAnimating=!0;let S="ag-animating";Q.setDisplayed(!0),z.addCss(S),Q.addCss(S),this.chartController.setChartThemeName(this.themes[G]),window.setTimeout(()=>{B.style.left=`${-parseFloat(Z)}px`,J.style.left="0px"},0),window.setTimeout(()=>{this.isAnimating=!1,z.removeCss(S),Q.removeCss(S),z.setDisplayed(!1)},300)}destroyMiniCharts(){o5(this.eMiniChartsContainer),this.miniChartsContainers=this.destroyBeans(this.miniChartsContainers)}destroy(){this.destroyMiniCharts(),super.destroy()}},_i="data",ki="format",wi=class extends Fy{constructor(G,D){super();this.panels=G,this.chartMenuContext=D,this.tabs=[]}wireBeans(G){this.chartTranslation=G.chartTranslation}postConstruct(){for(let G of this.panels){let D=G.replace("chart","").toLowerCase(),z=this.createPanel(D),B=this.createTab(G,D,z);this.tabs.push(B),this.addDestroyFunc(()=>this.destroyBean(z))}this.tabbedLayout=new YJ({items:this.tabs,cssClass:"ag-chart-tabbed-menu",keepScrollPosition:!0,suppressFocusBodyOnOpen:!0,suppressTrapFocus:!0,enableCloseButton:!0,closeButtonAriaLabel:this.chartTranslation.translate("ariaChartMenuClose"),onCloseClicked:()=>{this.eventSource?.focus({preventScroll:!0}),this.dispatchLocalEvent({type:"closed"})}}),this.createBean(this.tabbedLayout)}createTab(G,D,z){let B=d5({tag:"div",cls:`ag-chart-tab ag-chart-${D}`});this.createBean(z),B.appendChild(z.getGui());let Q=this.chartTranslation.translate(D);return{title:d5({tag:"div",children:Q}),titleLabel:Q,bodyPromise:Ny.resolve(B),getScrollableContainer:()=>{return B.querySelector(".ag-scrollable-container")||B},name:G}}showTab(G){let D=this.tabs[G];this.tabbedLayout.showItem(D)}getGui(){return this.tabbedLayout?.getGui()}showMenu(G,D){if(this.eventSource=G,!D)this.tabbedLayout?.focusHeader(!0)}destroy(){if(this.parentComponent?.isAlive())this.destroyBean(this.parentComponent);super.destroy()}createPanel(G){switch(G){case _i:return new Bx(this.chartMenuContext);case ki:return new vc(this.chartMenuContext);default:return new Hi(this.chartMenuContext.chartController)}}},Ki=class extends Wy{constructor(G,D,z){super('
');this.eChartContainer=G,this.eMenuPanelContainer=D,this.chartMenuContext=z,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:(B)=>this.showMenuList(B)}},this.panels=[],this.menuVisible=!1,this.chartController=z.chartController}wireBeans(G){this.chartMenuSvc=G.chartMenuSvc,this.chartMenuListFactory=G.chartMenuListFactory}postConstruct(){this.chartToolbar=this.createManagedBean(new fy),this.getGui().appendChild(this.chartToolbar.getGui()),this.refreshToolbarAndPanels(),this.addManagedEventListeners({chartCreated:(G)=>{if(G.chartId===this.chartController.getChartId()){if(Boolean(this.gos.get("chartToolPanelsDef")?.defaultToolPanel))this.showMenu({panel:this.defaultPanel,suppressFocus:!0})}}}),this.addManagedListeners(this.chartController,{chartLinkedChanged:this.refreshToolbarAndPanels.bind(this)}),this.refreshMenuClasses(),this.addManagedListeners(this.chartController,{chartApiUpdate:this.refreshToolbarAndPanels.bind(this)})}isVisible(){return this.menuVisible}getExtraPaddingDirections(){return["chartMenu","chartLink","chartUnlink","chartDownload"].some((G)=>this.chartToolbarOptions.includes(G))?["top"]:[]}refreshToolbarAndPanels(){this.initToolbarOptionsAndPanels(),this.updateToolbar()}initToolbarOptionsAndPanels(){let{panels:G,defaultPanel:D}=this.chartMenuSvc.getChartToolPanels(this.chartController);this.panels=G,this.defaultPanel=D,this.chartToolbarOptions=this.chartMenuSvc.getChartToolbarOptions()}updateToolbar(){let G=this.chartToolbarOptions.map((D)=>{let{iconName:z,callback:B}=this.buttons[D];return{buttonName:D,iconName:z,callback:B}});this.chartToolbar.updateParams({buttons:G})}createMenuPanel(G){let D=this.menuPanel=this.createBean(new LJ({height:"100%",closable:!0,hideTitleBar:!0,cssIdentifier:"chart-menu"}));return D.setParentComponent(this),this.eMenuPanelContainer.appendChild(D.getGui()),this.tabbedMenu=this.createBean(new wi(this.panels,this.chartMenuContext)),this.addManagedListeners(this.tabbedMenu,{closed:()=>{this.hideMenu()}}),this.addManagedListeners(D,{destroyed:()=>this.destroyBean(this.tabbedMenu)}),new Yy((z)=>{window.setTimeout(()=>{D.setBodyComponent(this.tabbedMenu),this.tabbedMenu.showTab(G),z(D)},100)})}showContainer(G,D){if(!this.menuPanel)return;this.menuVisible=!0,this.refreshMenuClasses(),this.tabbedMenu.showMenu(G,D)}showMenu(G){let{panel:D,eventSource:z,suppressFocus:B}=G??{};if(this.menuPanel&&!D)this.showContainer(z,B);else{let Q=D||this.defaultPanel,J=this.panels.indexOf(Q);if(J<0)qy(143,{panel:D}),J=this.panels.indexOf(this.defaultPanel);if(this.menuPanel)this.tabbedMenu.showTab(J),this.showContainer(z,B);else this.createMenuPanel(J).then(()=>this.showContainer(z,B))}}hideMenu(){this.menuVisible=!1,this.refreshMenuClasses()}refreshMenuClasses(){this.eChartContainer.classList.toggle("ag-chart-menu-visible",this.menuVisible),this.eChartContainer.classList.toggle("ag-chart-menu-hidden",!this.menuVisible)}showMenuList(G){this.chartMenuListFactory.showMenuList({eventSource:G,showMenu:()=>this.showMenu({eventSource:G}),chartMenuContext:this.chartMenuContext,closeOnElementClick:this.eChartContainer})}destroy(){if(super.destroy(),this.menuPanel?.isAlive())this.destroyBean(this.menuPanel);if(this.tabbedMenu?.isAlive())this.destroyBean(this.tabbedMenu)}},C9=["number","category","time","grouped-category"],Fi=["angle-category","angle-number","radius-category","radius-number"],Ei=[...C9,...Fi],Ii=class extends fi{constructor(G){super();this.chartController=G}getChartThemeOverridesProxy(){return{getValue:(G)=>this.getChartOption(G),setValue:(G,D)=>this.setChartThemeOverrides([{expression:G,value:D}]),setValues:(G)=>this.setChartThemeOverrides(G)}}getAxisThemeOverridesProxy(){return{getValue:(G)=>this.getAxisProperty(G),setValue:(G,D)=>this.setAxisThemeOverrides([{expression:G,value:D}]),setValues:(G)=>this.setAxisThemeOverrides(G)}}getCartesianAxisOptionsProxy(G){return{getValue:(D)=>this.getCartesianAxisProperty(G,D),setValue:(D,z)=>this.setCartesianAxisOptions(G,[{expression:D,value:z}]),setValues:(D)=>this.setCartesianAxisOptions(G,D),clearValue:(D,z)=>this.clearCartesianAxisOptions(G,D,z)}}getCartesianAxisThemeOverridesProxy(G){return{getValue:(D)=>this.getCartesianAxisProperty(G,D),setValue:(D,z)=>this.setCartesianAxisThemeOverrides(G,[{expression:D,value:z}]),setValues:(D)=>this.setCartesianAxisThemeOverrides(G,D)}}getCartesianAxisAppliedThemeOverridesProxy(G){return{getValue:(D)=>this.getCartesianAxisThemeOverride(G,D==="*"?null:D),setValue:(D,z)=>this.setCartesianAxisThemeOverrides(G,[{expression:D==="*"?null:D,value:z}]),setValues:(D)=>this.setCartesianAxisThemeOverrides(G,D)}}getSeriesOptionsProxy(G){return{getValue:(D,z)=>this.getSeriesOption(G(),D,z),setValue:(D,z)=>this.setSeriesOptions(G(),[{expression:D,value:z}]),setValues:(D)=>this.setSeriesOptions(G(),D)}}getPersistedChartThemeOverrides(G,D,z,B){let Q=this.getRetainedChartThemeOverrideKeys(z,B),J=this.getRetainedChartAxisThemeOverrideKeys(null,z,B),U=this.createChartOptions();for(let Z of Q){let S=this.retrieveChartOptionsThemeOverride(G,z,Z);if(S!==void 0)this.assignChartOptionsThemeOverride(U,B,Z,S)}if(D)this.assignPersistedAxisOverrides({existingAxes:D,retainedChartAxisThemeOverrideKeys:J,existingChartOptions:G,targetChartOptions:U,existingChartType:z,targetChartType:B});return U.theme.overrides}assignPersistedAxisOverrides(G){let{existingAxes:D,retainedChartAxisThemeOverrideKeys:z,existingChartOptions:B,targetChartOptions:Q,existingChartType:J,targetChartType:U}=G;for(let{expression:Z,targetAxisTypes:S}of z)for(let X of D.map((Y)=>Y.type)){let Y=this.retrieveChartOptionsThemeOverride(B,J,["axes",X,Z].join("."));if(Y!==void 0)for(let W of S)this.assignChartOptionsThemeOverride(Q,U,["axes",W,Z].join("."),Y)}}getRetainedChartThemeOverrideKeys(G,D){let z=["animation"],B=["zoom","navigator"],Q=((J,U)=>{let Z=[];if(SD(l(J))&&SD(l(U)))Z.push(...B);return Z})(G,D);return[...z,...Q]}getRetainedChartAxisThemeOverrideKeys(G,D,z){if(SD(l(D))&&SD(l(z)))return this.getRetainedCartesianAxisThemeOverrideKeys(G).map((Q)=>({expression:Q,targetAxisTypes:C9}));return[]}getRetainedCartesianAxisThemeOverrideKeys(G){let D=G==="xAxis"?["",".top",".bottom"]:G==="yAxis"?["",".left",".right"]:["",".left",".right",".top",".bottom"],z=["crosshair"],B=[];for(let Q of z)for(let J of D)B.push(`${Q}${J}`);return B}getChartOption(G){return $D(this.getChart(),G,void 0)}setChartThemeOverrides(G){let D=this.getChartType(),z=this.createChartOptions();for(let{expression:B,value:Q}of G)this.assignChartOptionsThemeOverride(z,D,B,Q);this.applyChartOptions(z)}applyChartOptions(G,D){if(Object.keys(G).length===0)return;if(this.updateChart(G),!D?.silent)this.raiseChartOptionsChangedEvent()}awaitChartOptionUpdate(G){this.chartController.getChartProxy().getChart().waitForUpdate().then(()=>G()).catch((z)=>Ni(108,{e:z}))}getAxisProperty(G){return $D(this.getChart().axes?.x,G,void 0)}setAxisThemeOverrides(G){let D=this.getChart(),z=this.getChartType(),B=this.createChartOptions();for(let{expression:Q,value:J}of G){let U=Object.values(D.axes??{}).filter((Z)=>{let S=Q.split("."),X=Z;for(let Y of S){if(!(Y in X))return!1;X=X[Y]}return!0});if(!U)continue;for(let Z of U){if(!this.isValidAxisType(Z))continue;this.assignChartAxisThemeOverride(B,z,Z.type,null,Q,J)}}this.applyChartOptions(B)}getCartesianAxisProperty(G,D){let z=this.getChartAxes(),B=this.getCartesianAxis(z,G);return $D(B,D,void 0)}getCartesianAxisThemeOverride(G,D){let z=this.getChartAxes(),B=this.getCartesianAxis(z,G);if(!B||!this.isValidAxisType(B))return;let Q=this.getChartType(),J=this.getChart().getOptions();return this.retrieveChartAxisThemeOverride(J,Q,B.type,G==="yAxis"?["left","right"]:["bottom","top"],D)}setCartesianAxisThemeOverrides(G,D){let z=this.getChartAxes(),B=this.getCartesianAxis(z,G);if(!B||!this.isValidAxisType(B))return;let Q=this.getChartType(),J=this.createChartOptions();for(let{expression:U,value:Z}of D)this.assignChartAxisThemeOverride(J,Q,B.type,G==="yAxis"?["left","right"]:["bottom","top"],U,Z);this.applyChartOptions(J)}setCartesianAxisOptions(G,D){this.updateCartesianAxisOptions(G,(z)=>{let B=G==="yAxis"?"y":"x";for(let{expression:Q,value:J}of D)this.assignChartOption(z,`axes.${B}.${Q}`,J)})}clearCartesianAxisOptions(G,D,z){this.updateCartesianAxisOptions(G,(B)=>{let Q=G==="yAxis"?"y":"x";this.clearChartOption(B,`axes.${Q}.${D}`,z)})}updateCartesianAxisOptions(G,D){let z=this.getChart().getOptions(),B="axes"in z?z.axes:void 0;if(!z||!B)return;let Q=this.getChartAxes(),J=this.getCartesianAxis(Q,G);if(!J)return;let U=this.createChartOptions();U.axes=B,D(U,J,z),this.applyChartOptions(U)}setCartesianCategoryAxisType(G,D){this.updateCartesianAxisOptions(G,(z,B,Q)=>{let J=this.getChartType();this.assignPersistedAxisOverrides({existingAxes:[B],retainedChartAxisThemeOverrideKeys:this.getRetainedChartAxisThemeOverrideKeys(G,J,J),existingChartOptions:Q,targetChartOptions:z,existingChartType:J,targetChartType:J}),this.assignChartOption(z,"axes.x.type",D),this.chartController.setCategoryAxisType(D)})}getCartesianAxis(G,D){if(G.length<2)return;switch(D){case"xAxis":return G[0].direction==="x"?G[0]:G[1];case"yAxis":return G[1].direction==="y"?G[1]:G[0]}}getSeriesOption(G,D,z){let B=this.getChart().series.find((Q)=>Mi(G,Q));return $D(z?B:B?.properties.toJson(),D,void 0)}setSeriesOptions(G,D){let z=this.createChartOptions();for(let{expression:B,value:Q}of D)this.assignChartOptionsSeriesThemeOverride(z,G,`series.${B}`,Q);this.applyChartOptions(z)}getPairedMode(){return this.chartController.getChartProxy().isPaired()}setPairedMode(G){this.chartController.getChartProxy().setPaired(G)}getChartAxes(){let G=this.getChart();return Object.values(G.axes??{})}retrieveChartAxisThemeOverride(G,D,z,B,Q){if(B)for(let J of B){let U=this.retrieveChartOptionsThemeOverride(G,D,["axes",z,J,...Q?[Q]:[]].join("."));if(U===void 0)continue;return U}else return this.retrieveChartOptionsThemeOverride(G,D,["axes",z,...Q?[Q]:[]].join("."))}assignChartAxisThemeOverride(G,D,z,B,Q,J){if(B)for(let U of B)this.assignChartOptionsThemeOverride(G,D,["axes",z,U,...Q?[Q]:[]].join("."),J);else this.assignChartOptionsThemeOverride(G,D,["axes",z,...Q?[Q]:[]].join("."),J)}isValidAxisType(G){return Ei.includes(G.type)}getChartType(){return this.chartController.getChartType()}getChart(){return this.chartController.getChartProxy().getChart()}updateChart(G){let D=this.chartController.getChartProxy().getChartRef();D.skipAnimations(),D.updateDelta(G)}createChartOptions(){return{theme:{overrides:{}}}}retrieveChartOptionsThemeOverride(G,D,z){let B=this.getChartThemeOverridesSeriesTypeKeys(D);for(let Q of B){let J=this.retrieveChartOptionsSeriesThemeOverride(G,Q,z);if(J===void 0)continue;return J}return}assignChartOptionsThemeOverride(G,D,z,B){let Q=this.getChartThemeOverridesSeriesTypeKeys(D);for(let J of Q)this.assignChartOptionsSeriesThemeOverride(G,J,z,B)}retrieveChartOptionsSeriesThemeOverride(G,D,z){return this.retrieveChartOption(G,["theme","overrides",D,...z?[z]:[]].join("."))}assignChartOptionsSeriesThemeOverride(G,D,z,B){this.assignChartOption(G,["theme","overrides",D,...z?[z]:[]].join("."),B)}getChartThemeOverridesSeriesTypeKeys(G){let D=this.chartController.getChartSeriesTypes(G);if(this.chartController.isComboChart())D.push("common");return D}retrieveChartOption(G,D){return $D(G,D,void 0)}assignChartOption(G,D,z){iP(G,D,z)}clearChartOption(G,D,z){let B=$D(G,D,void 0);if(B)delete B[z]}raiseChartOptionsChangedEvent(){let G=this.chartController.getChartModel();this.eventSvc.dispatchEvent({type:"chartOptionsChanged",chartId:G.chartId,chartType:G.chartType,chartThemeName:this.chartController.getChartThemeName(),chartOptions:G.chartOptions})}};function Mi(G,D){return pP(G)&&D.type===G}var Ai=class extends jT{constructor(G){super(` -
-
-
-
-
-
-
-
-
- `);this.eChart=mz,this.eWrapper=mz,this.eChartContainer=mz,this.eMenuContainer=mz,this.eEmpty=mz,this.params=G}wireBeans(G){this.crossFilterService=G.chartCrossFilterSvc,this.chartTranslation=G.chartTranslation,this.chartMenuSvc=G.chartMenuSvc,this.focusSvc=G.focusSvc,this.popupSvc=G.popupSvc,this.enterpriseChartProxyFactory=G.enterpriseChartProxyFactory,this.environment=G.environment}postConstruct(){let G={...this.params,chartType:S0(this.params.chartType),chartThemeName:this.getThemeName()},D=this.gos.get("enableRtl");this.eWrapper.classList.add(D?"ag-rtl":"ag-ltr");let z=this.createBean(new yg(G));if(this.chartController=this.createManagedBean(new By(z)),this.chartOptionsService=this.createManagedBean(new Ii(this.chartController)),this.validateCustomThemes(),this.createChart(),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 G=void 0;if(this.chartProxy)G=this.chartProxy.destroy({keepChartInstance:!0});let D=(Q,J)=>{let U=this.params.crossFilteringContext;if(U.lastSelectedChartId=J?"":this.chartController.getChartId(),J)this.params.crossFilteringResetCallback();this.crossFilterService.filter(Q,J)},z=this.chartController.getChartType(),B={agChartsExports:this.beans.agChartsExports,chartType:z,chartInstance:G,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??!1,crossFilterCallback:D,parentElement:this.eChart,grouping:this.chartController.isGrouping(),chartThemeToRestore:this.params.chartThemeName,chartOptionsToRestore:this.params.chartOptionsToRestore,chartPaletteToRestore:this.params.chartPaletteToRestore,seriesChartTypes:this.chartController.getSeriesChartTypes(),translate:(Q)=>this.chartTranslation.translate(Q),context:PT(this.gos,{})};if(this.params.chartOptionsToRestore=void 0,this.chartType=z,this.chartProxy=this.createChartProxy(B),!this.chartProxy){h5(138,{chartType:B.chartType});return}this.chartController.setChartProxy(this.chartProxy),this.createMenuContext()}createMenuContext(){if(this.chartMenuContext)return;let G=this.createManagedBean(new uD(this.chartOptionsService.getChartThemeOverridesProxy())),D=this.createManagedBean(new uD(this.chartOptionsService.getAxisThemeOverridesProxy()));this.chartMenuContext={chartController:this.chartController,chartOptionsService:this.chartOptionsService,chartMenuParamsFactory:G,chartAxisMenuParamsFactory:D}}getChartThemeName(){return this.chartController.getChartThemeName()}getChartThemes(){return this.chartController.getThemeNames()}getGridOptionsChartThemeOverrides(){return this.gos.get("chartThemeOverrides")}createChartProxy(G){let{chartType:D}=G;switch(D){case"column":case"bar":case"groupedColumn":case"stackedColumn":case"normalizedColumn":case"groupedBar":case"stackedBar":case"normalizedBar":return new Uy(G);case"pie":case"donut":case"doughnut":return new Xy(G);case"area":case"stackedArea":case"normalizedArea":return new Qy(G);case"line":case"stackedLine":case"normalizedLine":return new Zy(G);case"scatter":case"bubble":return new $y(G);case"columnLineCombo":case"areaColumnCombo":case"customCombo":return new Ly(G)}let z=this.enterpriseChartProxyFactory?.createChartProxy(G);if(!z)throw x5(251,{chartType:D});return z}addDialog(){let G=this.chartTranslation.translate(this.params.pivotChart?"pivotChartTitle":"rangeChartTitle"),{width:D,height:z}=this.getBestDialogSize(),B=this.params.focusDialogOnOpen?()=>setTimeout(()=>yT(this.getGui())):void 0;this.chartDialog=new PB({resizable:!0,movable:!0,maximizable:!0,title:G,width:D,height:z,component:this,centered:!0,closable:!0,afterGuiAttached:B,postProcessPopupParams:{type:"chart"}}),this.createBean(this.chartDialog),this.chartDialog.addEventListener("destroyed",()=>{this.destroy(),this.chartMenuSvc.hideAdvancedSettings();let Q=this.focusSvc.getFocusedCell();setTimeout(()=>{if(this.focusSvc.isAlive())if(Q)this.focusSvc.setFocusedCell({...Q,forceBrowserFocus:!0});else TT(this.beans)})})}getBestDialogSize(){let G=this.popupSvc.getPopupParent(),D=cT(G)*0.75,z=xT(G)*0.75,B=0.553,Q=this.chartProxy.getChart(),J=this.params.insideDialog?850:Q.width,U=this.params.insideDialog?470:Q.height;if(J>D||U>z){if(J=Math.min(J,D),U=Math.round(J*0.553),U>z)U=z,J=Math.min(J,Math.round(U/0.553))}return{width:J,height:U}}addMenu(){if(!this.params.crossFiltering)this.chartMenu=this.createBean(new Ki(this.eChartContainer,this.eMenuContainer,this.chartMenuContext)),this.eChartContainer.appendChild(this.chartMenu.getGui())}update(G){if(G?.chartId){if(!this.chartController.update(G))return}let D=this.chartTypeChanged(G),z=D||this.chartEmpty?((Q)=>{let J=this.chartType,U=Q,Z=this.chartProxy.getChart(),S=Z?.getOptions(),X=Object.values(Z?.axes??{});return this.chartOptionsService.getPersistedChartThemeOverrides(S,X,J,U??J)})(D):void 0;if(D)this.createChart();if(z&&G?.chartThemeOverrides)hT(z,G.chartThemeOverrides);let B=z??G?.chartThemeOverrides;if(this.updateChart(B),G?.chartId)this.chartProxy.getChart().waitForUpdate().then(()=>{this.chartController.raiseChartApiUpdateEvent()})}updateChart(G){let{chartProxy:D}=this,z=this.chartController.getSelectedValueColState(),B=this.chartController.getChartData(),Q=this.handleEmptyChart(B,z.length);if(this.chartEmpty=Q,Q){if(G)this.chartController.updateThemeOverrides(G);return}let J=this.chartController.getChartUpdateParams(G);D.update(J),this.chartProxy.getChart().waitForUpdate().then(()=>{this.chartController.raiseChartUpdatedEvent()})}chartTypeChanged(G){let[D,z]=[this.chartController.getChartType(),G?.chartType],B=z?S0(z):void 0;if(this.chartType!==D)return B??D;if(B&&D!==B)return B;return null}getChartModel(){return this.chartController.getChartModel()}getChartImageDataURL(G){return this.chartProxy.getChartImageDataURL(G)}handleEmptyChart(G,D){let z=this.chartController.isPivotChart()&&!this.chartController.isPivotMode(),B=this.chartController.getChartType(),Q=1;if(this.chartController.isActiveXYChart())Q=B==="bubble"?3:2;else if(VD(l(B)))Q=0;let J=DB!=null))for(let B of Object.keys(z))D[B]=null;return Object.keys(D)}validateCustomThemes(){let G=this.getChartThemes(),D=this.gos.get("customChartThemes");if(D){for(let z of this.getAllKeysInObjects([D]))if(!G.includes(z))h5(139,{customThemeName:z})}}reactivePropertyUpdate(){this.chartController.setChartThemeName(this.getThemeName(),!0);let G=this.getChartId(),D=this.chartController.isCrossFilterChart()?"crossFilter":this.getChartModel().modelType,z=this.gos.get("chartThemeOverrides")||{};this.update({type:`${D}ChartUpdate`,chartId:G,chartThemeOverrides:z})}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(){if(super.destroy(),this.chartProxy)this.chartProxy.destroy();if(this.destroyBean(this.chartMenu),this.chartDialog?.isAlive())this.destroyBean(this.chartDialog);this.onDestroyColorSchemeChangeListener?.();let G=this.getGui();gT(G),iT(G),this.raiseChartDestroyedEvent()}},X0=!1;function Ci(G){let D=G.version;if(G.version==null)G.version=di(G);if(G=QG("23.0.0",G,Vi),G=QG("24.0.0",G,bi),G=QG("25.1.0",G,vi),G=QG("26.0.0",G,Oi),G=QG("26.1.0",G,ui),G=QG("26.2.0",G,ji),G=QG("28.0.0",G,Pi),G=QG("28.2.0",G,gi),G=QG("29.0.0",G,Ti),G=QG("29.1.0",G,V9),G=QG("29.2.0",G,b9),G=QG("30.0.0",G,yi),G=QG("31.0.0",G,xi),G=QG("32.0.0",G,ci),G=QG("33.0.0",G,hi),G=QG("34.0.0",G,ii),G=ni(G),G=QG(j,G,(z)=>z),X0&&D!==G.version)console.log("AG Grid: ChartModel migration complete",{model:G});return G}function Vi(G){return G=UG("chartOptions.legend.item.marker.type","shape",G),G=UG("chartOptions.seriesDefaults.marker.type","shape",G),G=UG("chartOptions.legend.padding","spacing",G),G}function bi(G){G=d("chartOptions.seriesDefaults.marker.minSize",G);let{chartType:D,chartPalette:z,chartOptions:{xAxis:B,yAxis:Q,...J},...U}=G,S=Dg(D)?.map((Y,W)=>({type:Y,...W===0?B:Q}));return{chartType:D,chartThemeName:{borneo:"ag-default",material:"ag-material",bright:"ag-vivid"}[z]??"ag-default",chartOptions:{...J,axes:S,xAxis:B,yAxis:Q},...U}}function vi(G){return G=UG("chartOptions.seriesDefaults.label.minRequiredAngle","minAngle",G),G}function Oi(G){return G=lG("chartOptions.seriesDefaults.highlightStyle",G,({dimOpacity:z,...B})=>({...B,...z!=null?{series:{dimOpacity:z}}:{}})),G=d("chart",G),G=d("chartOptions.seriesDefaults.tooltipClass",G),G=d("chartOptions.seriesDefaults.tooltipTracking",G),G=U6("chartOptions.axes[].label.rotation",0,G),G=U6("chartOptions.axes[].label.rotation",335,G),G}function ui(G){let D=({item:z,series:B,...Q})=>({item:{...Q,...z},...B?{series:B}:{}});return G=lG("chartOptions.seriesDefaults.highlightStyle",G,D),G=lG("chartOptions.series[].highlightStyle",G,D),G}function ji(G){G=_B("chartOptions.seriesDefaults.fill.opacity","chartOptions.seriesDefaults.fillOpacity",G),G=_B("chartOptions.seriesDefaults.stroke.opacity","chartOptions.seriesDefaults.strokeOpacity",G),G=_B("chartOptions.seriesDefaults.stroke.width","chartOptions.seriesDefaults.strokeWidth",G),G=d("chartOptions.seriesDefaults.fill",G),G=d("chartOptions.seriesDefaults.stroke",G),G=d("chartOptions.seriesDefaults.callout.colors",G),G=d("chartOptions.xAxis",G),G=d("chartOptions.yAxis",G);let{chartType:D,chartOptions:{axes:z,series:B,seriesDefaults:Q,...J},...U}=G,Z=S0(D),S=l(Z),X=[S],Y={};if(!t8(S)){let q={top:{},bottom:{},left:{},right:{}},H=z.map(({type:_,...k})=>({[_]:{...q,...k}})).reduce($6,{});for(let _ of o8.filter((k)=>H[k]==null))H[_]={...q};Y.axes=H}let W=X.map((q)=>({[q]:{...Y,series:Q,...J}})).reduce($6,{});return G={...U,chartType:Z,chartOptions:W},G}function Pi(G){return G=d("chartOptions.*.title.padding",G),G=d("chartOptions.*.subtitle.padding",G),G=d("chartOptions.*.axes.*.title.padding",G),G=aJ("chartOptions.*.axes.*.title.enabled",!1,G),G}function gi(G){return G=UG("chartOptions.pie.series.callout","calloutLine",G),G=UG("chartOptions.pie.series.label","calloutLabel",G),G=UG("chartOptions.pie.series.labelKey","sectorLabelKey",G),G=UG("chartOptions.pie.series.labelName","sectorLabelName",G),G=UG("chartOptions.donut.series.callout","calloutLine",G),G=UG("chartOptions.donut.series.label","calloutLabel",G),G=UG("chartOptions.donut.series.labelKey","sectorLabelKey",G),G=UG("chartOptions.donut.series.labelName","sectorLabelName",G),G}function Ti(G){return G=rz("chartOptions.scatter.series.fill","chartOptions.scatter.series.marker.fill",G),G=rz("chartOptions.scatter.series.fillOpacity","chartOptions.scatter.series.marker.fillOpacity",G),G=rz("chartOptions.scatter.series.stroke","chartOptions.scatter.series.marker.stroke",G),G=rz("chartOptions.scatter.series.strokeOpacity","chartOptions.scatter.series.marker.strokeOpacity",G),G=rz("chartOptions.scatter.series.strokeWidth","chartOptions.scatter.series.marker.strokeWidth",G),G=_B("chartOptions.scatter.series.paired","chartOptions.scatter.paired",G),G}function V9(G){return G=d("chartOptions.axes[].tick.count",G),G}function b9(G){return G=lG("chartOptions.*.tooltip",G,({tracking:z,...B})=>{let Q={...B};if(z===!1)Q.position??(Q.position={type:"pointer"}),Q.range??(Q.range="nearest");else if(z===!0)Q.position??(Q.position={type:"node"}),Q.range??(Q.range="nearest");return Q}),G}function yi(G){return G=UG("chartOptions.pie.series.labelKey","sectorLabelKey",G),G=UG("chartOptions.pie.series.labelName","sectorLabelName",G),G=V9(G),G=b9(G),G=d("chartOptions.*.series.flipXY",G),G=v9("chartOptions.common.legend.enabled",!0,G),G=aJ("chartOptions.common.legend.position","right",G),G}function xi(G){let D={"ag-pastel":"ag-sheets","ag-solar":"ag-polychroma"},z=UG("chartOptions.column","bar",G),B=D[z.chartThemeName]||z.chartThemeName;return{...z,chartThemeName:B}}function ci(G){return G=EG("chartOptions.*.autoSize",!0,G,(D,z)=>{if(D[z]===!0);else if(D[z]===!1)D.minHeight=600,D.minWidth=300;delete D[z]}),G}function hi(G){return G=d("chartOptions.*.axes.category.label.format",G),G=d("chartOptions.*.axes.category.crosshair.label.format",G),G=d("chartOptions.*.axes.angle-category.label.format",G),G=d("chartOptions.*.axes.radius-category.label.format",G),G=UG("chartOptions.*.axes.*.label.padding","spacing",G),G=UG("chartOptions.*.navigator.miniChart.label.padding","spacing",G),G=d("chartOptions.*.axes.*.crossLines.label.className",G),G=EG("chartOptions.*.axes.*.crossLines.label.position",!0,G,(D,z)=>{if(typeof D[z]==="string")D[z]=D[z].replace(/([A-Z])/,"-$1").toLowerCase()}),G=d("chartOptions.bullet",G),G=Z6("chartOptions.bar.series.label.placement",G,{inside:"inside-center",outside:"inside-end"}),G=Z6("chartOptions.waterfall.series.item.*.label.placement",G,{inside:"inside-center",start:"outside-start",end:"outside-end"}),G=d("chartOptions.*.navigator.min",G),G=d("chartOptions.*.navigator.max",G),G=d("chartOptions.*.zoom.ratioX",G),G=d("chartOptions.*.zoom.ratioY",G),G=d("chartOptions.*.zoom.rangeX",G),G=d("chartOptions.*.zoom.rangeY",G),G}function ii(G){return EG("chartOptions.series[].highlightStyle",!0,G,(z,B)=>{let Q=z[B];if(Q==null)return;let J={};if(Q.item)J.highlightedItem=Q.item;if(Q.series){let{dimOpacity:U,...Z}=Q.series;if(U!=null)J.unhighlightedSeries={opacity:U};if(Object.keys(Z).length>0)J.highlightedSeries=Z}delete z[B],z.highlight=J}),G}function ni(G){return G=d("chartOptions.*.width",G),G=d("chartOptions.*.height",G),G=aJ("chartOptions.*.axes.category.label.autoRotate",!0,G),G}function di(G){let D=G;if(G.version!=null)return G.version;let z=(X,...Y)=>{return Object.keys(X||{}).some((W)=>Y.includes(W))},B=D.chartOptions,Q=z(B,"seriesDefaults")?B?.seriesDefaults:B?.[Object.keys(B)[0]],J={"27.0.0":z(D,"seriesChartTypes"),"26.2.0":!z(B,"seriesDefaults"),"26.1.0":z(Q?.highlightStyle,"item"),"26.0.0":z(Q?.highlightStyle,"series"),"25.1.0":z(Q?.label,"minAngle"),"25.0.0":z(D,"modelType","aggFunc","unlinkChart","suppressChartRanges")||z(Q,"lineDash","lineDashOffset"),"24.0.0":z(D,"chartThemeName","chart")||z(B,"series"),"23.2.0":z(B,"navigator"),"23.0.0":z(B?.legend?.item?.marker,"shape"),"22.1.0":z(D,"chartPalette","chartType")},U="27.1.0",Z=Object.entries(J).filter(([X,Y])=>Y);if(X0)console.log("AG Grid: ChartModel migration",{heuristicVersionCandidates:Z});let[S=U]=Z[0];if(X0)console.log("AG Grid: ChartModel migration",{heuristicVersion:S});return S}function QG(G,D,z){if(J6(G)>J6(D.version)){if(X0)console.log("AG Grid: ChartModel migration",{migratingTo:G});let B=z(D);if(B.version=G,X0)console.log("AG Grid: ChartModel migration",{migratedTo:G,result:B});return B}return D}function li(G){let D=G.includes("-beta")?G.replace(/-beta.*/,""):G,z=typeof D==="string"?D.split(".").map((B)=>Number(B)):[];if(z.length!==3||z.some((B)=>isNaN(B)))throw Error(Ri(253,{version:D}));return{major:z[0],minor:z[1],patch:z[2]}}function J6(G){let{major:D,minor:z,patch:B}=li(G);return D*1e4+z*100+B}function U6(G,D,z){return EG(G,!0,z,(B,Q)=>{if(B[Q]===D)delete B[Q]})}function aJ(G,D,z){return EG(G,!1,z,(B,Q)=>{if(B[Q]==null)B[Q]=D})}function v9(G,D,z){if(typeof G==="string")G=G.split(".");let B=G[0];if(G.length>1)z[B]=v9(G.slice(1),D,z[B]??{});if(!Object.keys(z).includes(B))z[B]=D;return z}function _B(G,D,z){let B=void 0,Q=!1;if(z=EG(G,!0,z,(J,U)=>{Q=!0,B=J[U],delete J[U]}),!Q)return z;return EG(D,!1,z,(J,U)=>{J[U]=B})}function rz(G,D,z){let B=void 0,Q=!1;if(z=EG(G,!0,z,(J,U)=>{Q=!0,B=J[U],delete J[U]}),!Q)return z;return EG(D,!1,z,(J,U)=>{if(J[U]===void 0)J[U]=B})}function UG(G,D,z){return EG(G,!0,z,(B,Q)=>{B[D]=B[Q],delete B[Q]})}function d(G,D){return EG(G,!0,D,(z,B)=>delete z[B])}function EG(G,D,z,B){let Q=G instanceof Array?G:G.split("."),J=Q.slice(0,Q.length-1),U=Q[Q.length-1];return lG(J,z,(Z)=>{let S=Object.keys(Z).includes(U);if(D&&!S)return Z;let X={...Z};return B(X,U),X})}function lG(G,D,z){let B=G instanceof Array?G:G.split(".");if(D={...D},B.length===0)return z(D);else if(B[0].startsWith("{")){let Q=B[0].substring(1,B[0].lastIndexOf("}")).split(",");for(let J of Q)if(D[J]!=null)D[J]=lG(B.slice(1),D[J],z)}else if(B[0].endsWith("[]")){let Q=B[0].substring(0,G[0].indexOf("["));if(D[Q]instanceof Array)D[Q]=D[Q].map((J)=>lG(B.slice(1),J,z))}else if(B[0]==="*")for(let Q of Object.keys(D))D[Q]=lG(B.slice(1),D[Q],z);else if(D[B[0]]!=null)D[B[0]]=lG(B.slice(1),D[B[0]],z);return D}function Z6(G,D,z){return EG(G,!0,D,(B,Q)=>{if(typeof B[Q]==="string")B[Q]=z[Q]??Q})}var $6=(G,D)=>({...G,...D}),pi=class extends OT{constructor(){super(...arguments);this.beanName="chartSvc",this.activeCharts=new Set,this.activeChartComps=new Set,this.crossFilteringContext={lastSelectedChartId:""},this.isEnterprise=()=>this.agChartsExports.isEnterprise}wireBeans(G){this.visibleCols=G.visibleCols,this.rangeSvc=G.rangeSvc,this.agChartsExports=G.agChartsExports}updateChart(G){if(this.activeChartComps.size===0){zB(124);return}let D=[...this.activeChartComps].find((z)=>z.getChartId()===G.chartId);if(!D){zB(125,{chartId:G.chartId});return}D.update(G)}getChartModels(){let G=[],D=(z)=>{return{...z,version:j}};for(let z of this.activeChartComps)G.push(D(z.getChartModel()));return G}getChartRef(G){let D;for(let z of this.activeCharts)if(z.chartId===G)D=z;return D}getChartComp(G){let D;for(let z of this.activeChartComps)if(z.getChartId()===G)D=z;return D}getChartImageDataURL(G){let D;for(let z of this.activeChartComps)if(z.getChartId()===G.chartId)D=z.getChartImageDataURL(G.fileFormat);return D}downloadChart(G){Array.from(this.activeChartComps).find((z)=>z.getChartId()===G.chartId)?.downloadChart(G.dimensions,G.fileName,G.fileFormat)}openChartToolPanel(G){Array.from(this.activeChartComps).find((z)=>z.getChartId()===G.chartId)?.openChartToolPanel(G.panel)}closeChartToolPanel(G){Array.from(this.activeChartComps).find((z)=>z.getChartId()===G)?.closeChartToolPanel()}createChartFromCurrentRange(G="groupedColumn",D){let z=this.getSelectedRange();return this.createChart({cellRange:z,chartType:G,focusDialogOnOpen:!D})}restoreChart(G,D){if(!G){zB(126);return}if(G.version!==j)G=Ci(G);let z,B,Q,J;if(G.modelType==="pivot")this.gos.updateGridOptions({options:{pivotMode:!0},source:"pivotChart"}),z=this.createCellRange(void 0,!0),B=!0,Q=!0;else z=this.createCellRange(G.cellRange),J=G.chartPalette,Q=G.suppressChartRanges;if(!z)return;return this.createChart({...G,cellRange:z,pivotChart:B,suppressChartRanges:Q,chartContainer:D,chartOptionsToRestore:G.chartOptions,chartPaletteToRestore:J})}createRangeChart(G,D){let z=this.createCellRange(G.cellRange);if(!z)return;return this.createChart({...G,cellRange:z,focusDialogOnOpen:!D})}createPivotChart(G,D){this.gos.updateGridOptions({options:{pivotMode:!0},source:"pivotChart"});let z=this.createCellRange(void 0,!0);if(!z)return;return this.createChart({...G,cellRange:z,pivotChart:!0,suppressChartRanges:!0,focusDialogOnOpen:!D})}createCrossFilterChart(G,D){let z=this.createCellRange(G.cellRange);if(!z)return;let Q=typeof G.suppressChartRanges<"u"&&G.suppressChartRanges!==null?G.suppressChartRanges:!0;return this.createChart({...G,cellRange:z,suppressChartRanges:Q,crossFiltering:!0,crossFilteringSort:G.sort,focusDialogOnOpen:!D})}createChart(G){let D=eT(G,this.agChartsExports.isEnterprise);if(!D)return;G=D===!0?G:D;let{chartType:z,chartContainer:B}=G,Q=this.gos.getCallback("createChartContainer"),J={...G,chartId:this.generateId(),chartType:S0(z),insideDialog:!(B||Q),crossFilteringContext:this.crossFilteringContext,crossFilteringResetCallback:()=>{for(let S of this.activeChartComps)S.crossFilteringReset()}},U=new Ai(J);this.createBean(U);let Z=this.createChartRef(U);if(B)B.appendChild(Z.chartElement);else if(Q)Q(Z);else U.addEventListener("destroyed",()=>{this.activeChartComps.delete(U),this.activeCharts.delete(Z)});return Z}createChartRef(G){let D={destroyChart:()=>{if(this.activeCharts.has(D))this.destroyBean(G),this.activeChartComps.delete(G),this.activeCharts.delete(D)},focusChart:()=>{uT(G.getGui())},chartElement:G.getGui(),chart:G.getUnderlyingChart(),chartId:G.getChartModel().chartId,setMaximized:G.setMaximized.bind(G)};return this.activeCharts.add(D),this.activeChartComps.add(G),D}getSelectedRange(){let G=this.rangeSvc?.getCellRanges();if(!G||G.length===0)return{columns:[]};let D=new Set,z=Number.MAX_VALUE,B=-Number.MAX_VALUE;for(let{startRow:J,endRow:U,columns:Z}of G){if(!(J&&U))continue;for(let q of Z)D.add(q);let{rowIndex:S,rowPinned:X}=J,{rowIndex:Y,rowPinned:W}=U;if(X==="top"){if(W==="top")continue;S=0}if(W==="bottom"){if(X==="bottom")continue;Y=this.beans.pageBounds.getLastRow()}if(S!==void 0)z=Math.min(z,S);if(Y!==void 0)B=Math.max(B,Y)}if(z===Number.MAX_VALUE||B===-Number.MAX_VALUE)return{columns:[]};let Q=Array.from(D);return{columns:Q,startColumn:Q[0],startRow:{rowIndex:z,rowPinned:void 0},endRow:{rowIndex:B,rowPinned:void 0}}}generateId(){return`id-${Math.random().toString(36).substring(2,18)}`}createCellRange(G,D){let z=D?{rowStartIndex:null,rowStartPinned:void 0,rowEndIndex:null,rowEndPinned:void 0,columns:this.visibleCols.allCols.map((Q)=>Q.getColId())}:G,B=z&&this.rangeSvc?.createPartialCellRangeFromRangeParams(z,!0);if(!B)zB(127,{allRange:D});return B}destroy(){for(let G of this.activeCharts)G.destroyChart();super.destroy()}};function mi(G){return G.frameworkOverrides.wrapIncoming(()=>G.chartSvc?.getChartModels())}function ti(G,D){return G.frameworkOverrides.wrapIncoming(()=>G.chartSvc?.getChartRef(D))}function si(G,D){return G.frameworkOverrides.wrapIncoming(()=>G.chartSvc?.getChartImageDataURL(D))}function oi(G,D){return G.frameworkOverrides.wrapIncoming(()=>G.chartSvc?.downloadChart(D))}function ri(G,D){return G.frameworkOverrides.wrapIncoming(()=>G.chartSvc?.openChartToolPanel(D))}function ai(G,D){return G.frameworkOverrides.wrapIncoming(()=>G.chartSvc?.closeChartToolPanel(D.chartId))}function ei(G,D){return G.frameworkOverrides.wrapIncoming(()=>G.chartSvc?.createRangeChart(D,!0))}function Gn(G,D){return G.frameworkOverrides.wrapIncoming(()=>G.chartSvc?.createPivotChart(D,!0))}function Dn(G,D){return G.frameworkOverrides.wrapIncoming(()=>G.chartSvc?.createCrossFilterChart(D,!0))}function zn(G,D){return G.frameworkOverrides.wrapIncoming(()=>G.chartSvc?.updateChart(D))}function Bn(G,D,z){return G.frameworkOverrides.wrapIncoming(()=>G.chartSvc?.restoreChart(D,z))}var Qn=".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)}}",O9=28,u9=6;function JJ(G){return G?.match(/\d+\.\d+\.\d+/)}function Jn({gridMajorVersion:G,chartsMajorVersion:D}){let z=parseInt(G,10),B=parseInt(D,10),Q=z-O9,J=B-u9,U=Q>=0;return Q===J&&U}function Un(G){if(!G||!JJ(G))return;let[D,z]=G.split(".")||[],B=`${D}.${z}.x`,J=parseInt(D,10)-O9+u9;if(J<0)return;let Z=`${J}.${z}.x`;return{gridMajorMinor:B,chartsMajorMinor:Z}}function ZB({type:G,gridVersion:D,chartsVersion:z}){if(!D)return"AG Grid: AG Grid version is incompatible. Please see https://www.ag-grid.com/javascript-data-grid/modules/ for more information.";let Q=Un(D);if(!Q)return"AG Grid: AG Grid version is incompatible. Please see https://www.ag-grid.com/javascript-data-grid/modules/ for more information.";let{gridMajorMinor:J,chartsMajorMinor:U}=Q;if(G==="incompatible")return`AG Grid version ${D} and AG Charts version ${z} is not supported. AG Grid version ${J} should be used with AG Chart ${U}. Please see https://www.ag-grid.com/javascript-data-grid/modules/ for more information.`;else if(G==="invalidCharts")return`AG Grid version ${J} should be used with AG Chart ${U} not ${z}. Please see https://www.ag-grid.com/javascript-data-grid/modules/ for more information.`;return"AG Grid: AG Grid version is incompatible. Please see https://www.ag-grid.com/javascript-data-grid/modules/ for more information."}function Zn({gridVersion:G,chartsVersion:D}){if(!JJ(D))return{isValid:!1,message:ZB({type:"invalidCharts",gridVersion:G,chartsVersion:D})};if(!JJ(G))return{isValid:!1,message:ZB({type:"invalidGrid",gridVersion:G,chartsVersion:D})};let[z,B]=G.split(".")||[],[Q,J,U]=D.split(".")||[],Z=Jn({gridMajorVersion:z,chartsMajorVersion:Q});if(Z&&B===J||U.includes("beta"))return{isValid:!0};else if(!Z||B!==J)return{isValid:!1,message:ZB({type:"incompatible",gridVersion:G,chartsVersion:D})};return{isValid:!1,message:ZB({type:"invalid",gridVersion:G,chartsVersion:D})}}var $n={linked:"linked",unlinked:"unlinked",chartsMenu:"menu-alt",chartsDownload:"save",chartsMenuEdit:"chart",chartsMenuAdvancedSettings:"settings",chartsMenuAdd:"plus",chartsColorPicker:"small-down",chartsThemePrevious:"previous",chartsThemeNext:"next"},Ln={getChartModels:mi,getChartRef:ti,getChartImageDataURL:si,downloadChart:oi,openChartToolPanel:ri,closeChartToolPanel:ai,createRangeChart:ei,createPivotChart:Gn,createCrossFilterChart:Dn,updateChart:zn,restoreChart:Bn},UJ=[Xz,i,gP,PP,TB],L6="IntegratedCharts",Sn={moduleName:"GridCharts",version:j,dependsOn:UJ,validate:()=>{return{isValid:!1,message:`AG Grid: As of v33, the "GridChartsModule" has been deprecated. Please use "IntegratedChartsModule.with(...)" instead. - ${l8(257)}`}}},j9={moduleName:L6,version:j,dependsOn:UJ,validate:()=>{return{isValid:!1,message:l8(257)}},with:(G)=>{if(G.setup(),G.setGridContext?.(!0),G.isEnterprise&&G.setLicenseKey){let D={setLicenseKey:G.setLicenseKey};az.setChartsLicenseManager(D)}return{moduleName:L6,version:j,icons:$n,apiFunctions:Ln,dependsOn:UJ,css:[Qn],validate:()=>{return Zn({gridVersion:j,chartsVersion:G.VERSION})},beans:[yP.bind(null,G),pi,vT,FT,wT,CT,hg,LT]}}},S6=[Xn,nB,yB,cB,z8,B8,lB,W0,FJ,Xz,I7,bJ,VJ,o7,r7,L8,S8,g8,R7,iB,l6,jD,xB,a7,pB,$8,x8,c8,d8,o6],X6="AllEnterprise",Yn={with:(G)=>({moduleName:X6,version:j,dependsOn:[...S6,j9.with(G),T8.with(G)]}),moduleName:X6,version:j,dependsOn:S6};var{h:Wn,watch:eJ,onUnmount:qn}=window;Hn.registerModules([_n,kn,wn,Kn,fn,Nn,Fn,iB,Xz,pB,lB,jD,yB,W0,xB,cB,nB]);var In=(G)=>{let{data:D,options:z,api:B,on:Q,class:J,style:U="height: 100%; width: 100%",dark:Z}=G,S=null,X=null,Y=()=>Z!==void 0?typeof Z==="function"?Z():Z:document.documentElement.getAttribute("data-theme")==="dark"||window.matchMedia("(prefers-color-scheme: dark)").matches,W=()=>Y()?"ag-theme-balham-dark":"ag-theme-balham";return Wn("div",{class:J,style:U,ref:(H)=>{if(X)X(),X=null;if(S&&!S.isDestroyed()){if(S.destroy(),B)B.current=null;S=null}if(!H)return;let _=typeof D==="function"?D():D,k=typeof z==="function"?z():z,w=["onFilterChanged","onModelUpdated","onGridSizeChanged","onFirstDataRendered","onRowValueChanged","onSelectionChanged","onCellClicked","onCellDoubleClicked","onCellValueChanged","onRowClicked","onSortChanged","onContextMenu","onColumnResized","onColumnMoved","onRowDataUpdated","onCellEditingStarted","onCellEditingStopped","onPaginationChanged","onBodyScroll"],K={};w.forEach((I)=>{if(Q?.[I])K[I]=(V)=>Q[I](V)});let f={...k,theme:W(),rowData:_||[],onGridReady:(I)=>{if(S=I.api,B)B.current=S;if(Q?.onGridReady)Q.onGridReady(I);if(k?.autoSizeColumns)I.api.autoSizeAllColumns()},...K};S=En(H,f);let N=eJ(()=>{if(!S||S.isDestroyed())return;let I=typeof D==="function"?D():D;if(Array.isArray(I)){let V=S.getGridOption("rowData");if(I!==V)S.setGridOption("rowData",I)}}),F=eJ(()=>{if(!S||S.isDestroyed())return;Y();let I=W();if(I!==S.getGridOption("theme"))S.setGridOption("theme",I)}),E=eJ(()=>{if(!S||S.isDestroyed()||!z)return;let I=typeof z==="function"?z():z;if(I)Object.entries(I).forEach(([V,A])=>{try{S.setGridOption(V,A)}catch(R){}})});X=()=>{if(N(),F(),E(),S&&!S.isDestroyed()){if(S.destroy(),B)B.current=null;S=null}},qn(()=>{if(X)X(),X=null})}})};if(typeof window<"u")window.Grid=In;export{WzG as themeQuartz,qzG as iconSetQuartzLight,En as createGrid,Hn as ModuleRegistry,In as Grid}; +import{h as tT,watch as $7,onUnmount as rT}from"sigpro";function b(z){if(!z?.length)return;return z[z.length-1]}function Z0(z,J,Q){if(z===J)return!0;if(!z||!J)return z==null&&J==null;let Z=z.length;if(Z!==J.length)return!1;for(let $=0;$=0)z.splice(Q,1)}function O6(z,J){let Q=0,Z=0;for(;Q=0;Z--)z.splice(Q,0,J[Z])}var q0=(z)=>{if(z==null||z==="")return null;return z};function T(z){return z!=null&&z!==""}function n(z){return!T(z)}var i0=(z)=>{return z!=null&&typeof z.toString==="function"?z.toString():null},rz=(z,J)=>{let Q=z?JSON.stringify(z):null,Z=J?JSON.stringify(J):null;return Q===Z},u2=(z,J,Q=!1)=>{if(z==null)return J==null?0:-1;if(J==null)return 1;if(typeof z==="object"&&z.toNumber)z=z.toNumber();if(typeof J==="object"&&J.toNumber)J=J.toNumber();if(!Q||typeof z!=="string"){if(z>J)return 1;if(z{let G=Z?()=>Z.wrapIncoming(q):q;if(J)this.dispatchAsync(G);else G()},X=this.getListeners(Q,J,!1);if((X?.size??0)>0){let q=new Set(X);for(let G of q){if(!X?.has(G))continue;$(()=>G(z))}}let Y=this.getGlobalListeners(J);if(Y.size>0){let q=new Set(Y);for(let G of q)$(()=>G(Q,z))}}getGlobalListeners(z){return z?this.globalAsyncListeners:this.globalSyncListeners}dispatchAsync(z){if(this.asyncFunctionsQueue.push(z),!this.scheduled){let J=()=>{window.setTimeout(this.flushAsyncQueue.bind(this),0)},Q=this.frameworkOverrides;if(Q)Q.wrapIncoming(J);else J();this.scheduled=!0}}flushAsyncQueue(){this.scheduled=!1;let z=this.asyncFunctionsQueue.slice();this.asyncFunctionsQueue=[];for(let J of z)J()}},pq=/[&<>"']/g,iq={"&":"&","<":"<",">":">",'"':""","'":"'"};function P6(z){return z?.toString().toString()??null}function E0(z){return P6(z)?.replace(pq,(J)=>iq[J])??null}function Rz(z){return typeof z==="string"&&z.startsWith("=")&&z.length>1}function dq(z){if(!z||z==null)return null;let J=/([a-z])([A-Z])/g,Q=/([A-Z]+)([A-Z])([a-z])/g;return z.replace(J,"$1 $2").replace(Q,"$1 $2$3").replace(/\./g," ").split(" ").map(($)=>$.substring(0,1).toUpperCase()+($.length>1?$.substring(1,$.length):"")).join(" ")}function J4(z){return z.eRootDiv.getRootNode()}function d(z){return J4(z).activeElement}function Y0(z){let{gos:J,eRootDiv:Q}=z,Z=null,$=J.get("getDocument");if($&&T($))Z=$();else if(Q)Z=Q.ownerDocument;if(Z&&T(Z))return Z;return document}function f1(z){let J=d(z);return J===null||J===Y0(z).body}function XZ(z){return Y0(z).defaultView||window}function m2(z){let J=null,Q=null;try{J=Y0(z).fullscreenElement}catch(Z){}finally{if(!J)J=J4(z);let Z=J.querySelector("body");if(Z)Q=Z;else if(J instanceof ShadowRoot)Q=J;else if(J instanceof Document)Q=J?.documentElement;else Q=J}return Q}function nq(z){return m2(z)?.clientWidth??(window.innerWidth||-1)}function tq(z){return m2(z)?.clientHeight??(window.innerHeight||-1)}function t0(z,J,Q){if(Q==null||typeof Q==="string"&&Q=="")YZ(z,J);else U4(z,J,Q)}function U4(z,J,Q){z.setAttribute(S8(J),Q.toString())}function YZ(z,J){z.removeAttribute(S8(J))}function S8(z){return`aria-${z}`}function H0(z,J){if(J)z.setAttribute("role",J);else z.removeAttribute("role")}function rq(z){let J=z?.direction;if(J==="asc")return"ascending";else if(J==="desc")return"descending";else if(J==="mixed")return"other";return"none"}function A8(z){return Number.parseInt(z.getAttribute("aria-posinset"),10)}function sq(z){return z.getAttribute("aria-label")}function _0(z,J){t0(z,"label",J)}function r1(z,J){t0(z,"labelledby",J)}function c2(z,J){t0(z,"describedby",J)}function R8(z,J){t0(z,"live",J)}function lq(z,J){t0(z,"atomic",J)}function aq(z,J){t0(z,"relevant",J)}function qZ(z,J){t0(z,"invalid",J)}function sz(z,J){t0(z,"level",J)}function j8(z,J){t0(z,"disabled",J)}function lz(z,J){t0(z,"hidden",J)}function R0(z,J){U4(z,"expanded",J)}function O8(z){YZ(z,"expanded")}function T6(z,J){U4(z,"setsize",J)}function v6(z,J){U4(z,"posinset",J)}function oq(z,J){U4(z,"multiselectable",J)}function eq(z,J){U4(z,"rowcount",J)}function jz(z,J){U4(z,"rowindex",J)}function zG(z,J){U4(z,"colcount",J)}function P8(z,J){U4(z,"colindex",J)}function JG(z,J){U4(z,"colspan",J)}function QG(z,J){U4(z,"sort",J)}function ZG(z){YZ(z,"sort")}function az(z,J){t0(z,"selected",J)}function oz(z,J){U4(z,"checked",J===void 0?"mixed":J)}function $G(z,J){t0(z,"controls",J)}function GZ(z,J){$G(z,J.id),r1(J,z.id)}function q7(z,J){t0(z,"owns",J)}function T8(z,J){t0(z,"haspopup",J===!1?null:J)}function HZ(z,J){return J===void 0?z("ariaIndeterminate","indeterminate"):J===!0?z("ariaChecked","checked"):z("ariaUnchecked","unchecked")}function _Z(z,J,Q){let Z=z.parentElement,$=Z&&Z.firstChild;while($){if(J)$.classList.toggle(J,$===z);if(Q)$.classList.toggle(Q,$!==z);$=$.nextSibling}}var XG="[tabindex], input, select, button, textarea, [href]",v8="[disabled], .ag-disabled:not(.ag-button), .ag-disabled *";function H6(z){if(!z)return!1;if(!z.matches("input, select, button, textarea"))return!1;if(!z.matches(v8))return!1;return M0(z)}function w(z,J,Q={}){let{skipAriaHidden:Z}=Q;if(z.classList.toggle("ag-hidden",!J),!Z)lz(z,!J)}function YG(z,J,Q={}){let{skipAriaHidden:Z}=Q;if(z.classList.toggle("ag-invisible",!J),!Z)lz(z,!J)}function F6(z,J){let Z=J?(X)=>X.setAttribute("disabled",""):(X)=>X.removeAttribute("disabled");Z(z);let $=z.querySelectorAll("input")??[];for(let X of $)Z(X)}function p1(z,J,Q){let Z=0;while(z){if(z.classList.contains(J))return!0;if(z=z.parentElement,typeof Q=="number"){if(++Z>Q)break}else if(z===Q)break}return!1}function p2(z){let{height:J,width:Q,borderTopWidth:Z,borderRightWidth:$,borderBottomWidth:X,borderLeftWidth:Y,paddingTop:q,paddingRight:G,paddingBottom:H,paddingLeft:_,marginTop:U,marginRight:W,marginBottom:B,marginLeft:E,boxSizing:K}=window.getComputedStyle(z),F=Number.parseFloat;return{height:F(J||"0"),width:F(Q||"0"),borderTopWidth:F(Z||"0"),borderRightWidth:F($||"0"),borderBottomWidth:F(X||"0"),borderLeftWidth:F(Y||"0"),paddingTop:F(q||"0"),paddingRight:F(G||"0"),paddingBottom:F(H||"0"),paddingLeft:F(_||"0"),marginTop:F(U||"0"),marginRight:F(W||"0"),marginBottom:F(B||"0"),marginLeft:F(E||"0"),boxSizing:K}}function I6(z){let J=p2(z);if(J.boxSizing==="border-box")return J.height-J.paddingTop-J.paddingBottom-J.borderTopWidth-J.borderBottomWidth;return J.height}function s1(z){let J=p2(z);if(J.boxSizing==="border-box")return J.width-J.paddingLeft-J.paddingRight-J.borderLeftWidth-J.borderRightWidth;return J.width}function I8(z){let{height:J,marginBottom:Q,marginTop:Z}=p2(z);return Math.floor(J+Q+Z)}function Oz(z){let{width:J,marginLeft:Q,marginRight:Z}=p2(z);return Math.floor(J+Q+Z)}function C8(z){let J=z.getBoundingClientRect(),{borderTopWidth:Q,borderLeftWidth:Z,borderRightWidth:$,borderBottomWidth:X}=p2(z);return{top:J.top+(Q||0),left:J.left+(Z||0),right:J.right+($||0),bottom:J.bottom+(X||0)}}function Pz(z,J){let Q=z.scrollLeft;if(J)Q=Math.abs(Q);return Q}function Tz(z,J,Q){if(Q)J*=-1;z.scrollLeft=J}function J0(z){while(z?.firstChild)z.firstChild.remove()}function S0(z){if(z?.parentNode)z.remove()}function b8(z){return!!z.offsetParent}function M0(z){if(z.checkVisibility)return z.checkVisibility({checkVisibilityCSS:!0});return!(!b8(z)||window.getComputedStyle(z).visibility!=="visible")}function UZ(z){let J=document.createElement("div");return J.innerHTML=(z||"").trim(),J.firstChild}function y8(z,J,Q){if(Q&&Q.nextSibling===J)return;if(!z.firstChild)z.appendChild(J);else if(Q)if(Q.nextSibling)z.insertBefore(J,Q.nextSibling);else z.appendChild(J);else if(z.firstChild&&z.firstChild!==J)z.prepend(J)}function x8(z,J){for(let Q=0;Q`-${J.toLocaleLowerCase()}`)}function C6(z,J){if(!J)return;for(let Q of Object.keys(J)){let Z=J[Q];if(!Q?.length||Z==null)continue;let $=qG(Q),X=Z.toString(),Y=X.replace(/\s*!important/g,""),q=Y.length!=X.length?"important":void 0;z.style.setProperty($,Y,q)}}function C2(z){return()=>{let J=z();if(!J)return!0;return w8(J)||GG(J)}}function w8(z){return z.clientWidthX?.disconnect()}function W4(z,J){let Q=XZ(z);if(Q.requestAnimationFrame)Q.requestAnimationFrame(J);else if(Q.webkitRequestAnimationFrame)Q.webkitRequestAnimationFrame(J);else Q.setTimeout(J,0)}var N8="data-ref",lJ;function G7(){return lJ??(lJ=document.createTextNode(" ")),lJ.cloneNode()}function F0(z){let{attrs:J,children:Q,cls:Z,ref:$,role:X,tag:Y}=z,q=document.createElement(Y);if(Z)q.className=Z;if($)q.setAttribute(N8,$);if(X)q.setAttribute("role",X);if(J)for(let G of Object.keys(J))q.setAttribute(G,J[G]);if(Q)if(typeof Q==="string")q.textContent=Q;else{let G=!0;for(let H of Q)if(H)if(typeof H==="string")q.appendChild(document.createTextNode(H)),G=!1;else if(typeof H==="function")q.appendChild(H());else{if(G)q.appendChild(G7()),G=!1;q.append(F0(H)),q.appendChild(G7())}}return q}var _G=["touchstart","touchend","touchmove","touchcancel","scroll"],UG=["wheel"],aJ={},OQ=(()=>{let z={select:"input",change:"input",submit:"form",reset:"form",error:"img",load:"img",abort:"img"};return(Q)=>{if(typeof aJ[Q]==="boolean")return aJ[Q];let Z=document.createElement(z[Q]||"div");return Q="on"+Q,aJ[Q]=Q in Z}})();function ez(z,J){if(!J||!z)return!1;return BG(J).indexOf(z)>=0}function WG(z){let J=[],Q=z.target;while(Q)J.push(Q),Q=Q.parentElement;return J}function BG(z){let J=z;if(J.path)return J.path;if(J.composedPath)return J.composedPath();return WG(J)}function EG(z,J,Q){let Z=KG(J),$;if(Z!=null)$={passive:Z};z.addEventListener(J,Q,$)}var KG=(z)=>{let J=_G.includes(z),Q=UG.includes(z);if(J)return!0;if(Q)return!1};function g8(z,J,Q){if(Q===0)return!1;let Z=Math.abs(z.clientX-J.clientX),$=Math.abs(z.clientY-J.clientY);return Math.max(Z,$)<=Q}var R2=(z,J)=>{let Q=z.identifier;for(let Z=0,$=J.length;Z<$;++Z){let X=J[Z];if(X.identifier===Q)return X}return null};function L6(z,J){return z.gos.isElementInThisInstance(J.target)}function FG(z,J,Q){let $=z.getBoundingClientRect().height,X=nq(Q)-2,Y=tq(Q)-2;if(!z.offsetParent)return;let G=C8(z.offsetParent),{clientY:H,clientX:_}=J,U=H-G.top-$/2,W=_-G.left-10,B=Y0(Q),E=B.defaultView||window,K=E.pageYOffset||B.documentElement.scrollTop,F=E.pageXOffset||B.documentElement.scrollLeft;if(X>0&&W+z.clientWidth>X+F)W=X+F-z.clientWidth;if(W<0)W=0;if(Y>0&&U+z.clientHeight>Y+K)U=Y+K-z.clientHeight;if(U<0)U=0;z.style.left=`${W}px`,z.style.top=`${U}px`}var Fz=(z,...J)=>{for(let Q of J){let[Z,$,X,Y]=Q;Z.addEventListener($,X,Y),z.push(Q)}},BZ=(z)=>{if(z){for(let[J,Q,Z,$]of z)J.removeEventListener(Q,Z,$);z.length=0}},k2=(z)=>{if(z.cancelable)z.preventDefault()};function LG(z,J){return J}function h8(z){return z?.getLocaleTextFunc()??LG}function EZ(z,J,Q,Z){let $=J[Q];return z.getLocaleTextFunc()(Q,typeof $==="function"?$(Z):$,Z)}var O0=class{constructor(){this.destroyFunctions=[],this.destroyed=!1,this.__v_skip=!0,this.propertyListenerId=0,this.lastChangeSetIdLookup={},this.isAlive=()=>!this.destroyed}preWireBeans(z){this.beans=z,this.stubContext=z.context,this.eventSvc=z.eventSvc,this.gos=z.gos}destroy(){let{destroyFunctions:z}=this;for(let J=0;Jnull;let Z;if(DG(z))z.__addEventListener(J,Q),Z=()=>{return z.__removeEventListener(J,Q),null};else{let $=MG(z);if(z instanceof HTMLElement)EG(z,J,Q);else if($)z.addListener(J,Q);else z.addEventListener(J,Q);Z=$?()=>{return z.removeListener(J,Q),null}:()=>{return z.removeEventListener(J,Q),null}}return this.destroyFunctions.push(Z),()=>{return Z(),this.destroyFunctions=this.destroyFunctions.filter(($)=>$!==Z),null}}setupPropertyListener(z,J){let{gos:Q}=this;Q.addPropertyEventListener(z,J);let Z=()=>{return Q.removePropertyEventListener(z,J),null};return this.destroyFunctions.push(Z),()=>{return Z(),this.destroyFunctions=this.destroyFunctions.filter(($)=>$!==Z),null}}addManagedPropertyListener(z,J){if(this.destroyed)return()=>null;return this.setupPropertyListener(z,J)}addManagedPropertyListeners(z,J){if(this.destroyed)return;let Q=z.join("-")+this.propertyListenerId++,Z=($)=>{if($.changeSet){if($.changeSet&&$.changeSet.id===this.lastChangeSetIdLookup[Q])return;this.lastChangeSetIdLookup[Q]=$.changeSet.id}let X={type:"propertyChanged",changeSet:$.changeSet,source:$.source};J(X)};for(let $ of z)this.setupPropertyListener($,Z)}getLocaleTextFunc(){return h8(this.beans.localeSvc)}addDestroyFunc(z){if(this.isAlive())this.destroyFunctions.push(z);else z()}createOptionalManagedBean(z,J){return z?this.createManagedBean(z,J):void 0}createManagedBean(z,J){let Q=this.createBean(z,J);return this.addDestroyFunc(this.destroyBean.bind(this,z,J)),Q}createBean(z,J,Q){return(J||this.stubContext).createBean(z,Q)}destroyBean(z,J){return(J||this.stubContext).destroyBean(z)}destroyBeans(z,J){return(J||this.stubContext).destroyBeans(z)}};function DG(z){return z.__addEventListener!==void 0}function MG(z){return z.eventServiceType==="global"}var V=class extends O0{},PQ=new Set,zJ=(z,J)=>{if(!PQ.has(J))PQ.add(J),z()};zJ._set=PQ;var kG={pending:!1,funcs:[]},fG={pending:!1,funcs:[]};function TQ(z,J="setTimeout",Q){let Z=J==="raf"?fG:kG;if(Z.funcs.push(z),Z.pending)return;Z.pending=!0;let $=()=>{let X=Z.funcs.slice();Z.funcs.length=0,Z.pending=!1;for(let Y of X)Y()};if(J==="raf")W4(Q,$);else window.setTimeout($,0)}function p0(z,J,Q){let Z;return function(...$){let X=this;return window.clearTimeout(Z),Z=window.setTimeout(function(){if(z.isAlive())J.apply(X,$)},Q),Z}}function H7(z,J){let Q=0;return function(...Z){let $=this,X=Date.now();if(X-Q{if(X!=null)window.clearInterval(X),X=null};z.addDestroyFunc(q);let G=()=>{let H=Date.now()-$>Z;if(J()||H)Q(),Y=!0,q()};if(G(),!Y)X=window.setInterval(G,10)}var VG=new Set(["__proto__","constructor","prototype"]);function SG(z,J){if(z==null)return;if(Array.isArray(z)){for(let Q=0;Q!VG.has(Z)))J(Q,z[Q])}function K0(z,J,Q=!0,Z=!1){if(!T(J))return;SG(J,($,X)=>{let Y=z[$];if(Y===X)return;if(Z){if(Y==null&&X!=null){if(typeof X==="object"&&X.constructor===Object)Y={},z[$]=Y}}if(_7(X)&&_7(Y)&&!Array.isArray(Y))K0(Y,X,Q,Z);else if(Q||X!==void 0)z[$]=X})}function _7(z){return typeof z==="object"&&z!==null}var FZ=class z{static applyGlobalGridOptions(J){if(!z.gridOptions)return{...J};let Q={};if(K0(Q,z.gridOptions,!0,!0),z.mergeStrategy==="deep")K0(Q,J,!0,!0);else Q={...Q,...J};if(z.gridOptions.context)Q.context=z.gridOptions.context;if(J.context){if(z.mergeStrategy==="deep"&&Q.context)K0(J.context,Q.context,!0,!0);Q.context=J.context}return Q}static applyGlobalGridOption(J,Q){if(z.mergeStrategy==="deep"){let Z=AG(J);if(Z&&typeof Z==="object"&&typeof Q==="object")return z.applyGlobalGridOptions({[J]:Q})[J]}return Q}};FZ.gridOptions=void 0;FZ.mergeStrategy="shallow";var LZ=FZ;function AG(z){return LZ.gridOptions?.[z]}var RG={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},u8="https://www.ag-grid.com";function D6(z,J,...Q){if(z.get("debug"))console.log("AG Grid: "+J,...Q)}function W1(z,...J){zJ(()=>m8(z,...J),z+J?.join(""))}function j2(z,...J){zJ(()=>jG(z,...J),z+J?.join(""))}function jG(z,...J){console.error("AG Grid: "+z,...J)}function m8(z,...J){console.warn("AG Grid: "+z,...J)}var c8=new Set,Iz={},i1={},Lz,p8=!1,i8=!1,OG=!1;function PG(z){let[J,Q]=z.version.split(".")||[],[Z,$]=Lz.split(".")||[];return J===Z&&Q===$}function TG(z){if(!Lz)Lz=z.version;let J=(Z)=>`You are using incompatible versions of AG Grid modules. Major and minor versions should always match across modules. ${Z} Please update all modules to the same version.`;if(!z.version)j2(J(`'${z.moduleName}' is incompatible.`));else if(!PG(z))j2(J(`'${z.moduleName}' is version ${z.version} but the other modules are version ${Lz}.`));let Q=z.validate?.();if(Q&&!Q.isValid)j2(`${Q.message}`)}function M6(z,J,Q=!1){if(!Q)p8=!0;TG(z);let Z=z.rowModels??["all"];c8.add(z);let $;if(J!==void 0){if(i8=!0,i1[J]===void 0)i1[J]={};$=i1[J]}else $=Iz;for(let X of Z){if($[X]===void 0)$[X]={};$[X][z.moduleName]=z}if(z.dependsOn)for(let X of z.dependsOn)M6(X,J,Q)}function vG(z){delete i1[z]}function vQ(z,J,Q){let Z=($)=>!!Iz[$]?.[z]||!!i1[J]?.[$]?.[z];return Z(Q)||Z("all")}function DZ(){return i8}function IG(z,J){let Q=i1[z]??{};return[...Object.values(Iz.all??{}),...Object.values(Q.all??{}),...Object.values(Iz[J]??{}),...Object.values(Q[J]??{})]}function CG(){return new Set(c8)}function d8(z,J){let Q=i1[z]??{};return[...Object.values(Q.all??{}),...Object.values(Q[J]??{})]}function bG(){return p8}function MZ(){return OG}var n8=class{static register(z){M6(z,void 0)}static registerModules(z){for(let J of z)M6(J,void 0)}};var c="35.2.1",U7=2000,W7=100,t8="_version_",r8=null,O2=`${u8}/javascript-data-grid`;function yG(z){r8=z}function xG(z){O2=z}function s8(z,J,Q){return r8?.(z,J)??[hG(z,J,Q)]}function JJ(z,J,Q,Z,$){z(`${Z?"warning":"error"} #${J}`,...s8(J,Q,$))}function wG(z){if(!z)return String(z);let J={};for(let Q of Object.keys(z))if(typeof z[Q]!=="object"&&typeof z[Q]!=="function")J[Q]=z[Q];return JSON.stringify(J)}function NG(z){let J=z;if(z instanceof Error)J=z.toString();else if(typeof z==="object")J=wG(z);return J}function Dz(z){return z===void 0?"undefined":z===null?"null":z}function IQ(z,J){return`${z}?${J.toString()}`}function gG(z,J,Q){let Z=Array.from(J.entries()).sort((X,Y)=>Y[1].length-X[1].length),$=IQ(z,J);for(let[X,Y]of Z){if(X===t8)continue;let q=$.length-Q;if(q<=0)break;let G="...",H=q+G.length,_=Y.length-H>W7?Y.slice(0,Y.length-H)+G:Y.slice(0,W7)+G;J.set(X,_),$=IQ(z,J)}return $}function l8(z,J){let Q=new URLSearchParams;if(Q.append(t8,c),J)for(let X of Object.keys(J))Q.append(X,NG(J[X]));let Z=`${O2}/errors/${z}`,$=IQ(Z,Q);return $.length<=U7?$:gG(Z,Q,U7)}var hG=(z,J,Q)=>{let Z=l8(z,J),$=`${Q?Q+` +`:""}Visit ${Z}`;if(MZ())return $;return`${$}${Q?"":` + Alternatively register the ValidationModule to see the full message in the console.`}`};function R(...z){JJ(W1,z[0],z[1],!0)}function t(...z){JJ(j2,z[0],z[1],!1)}function q6(z,J,Q){JJ(j2,z,J,!1,Q)}function a8(z,J,Q){JJ(W1,z,J,!0,Q)}function uG(z,J){let Q=J[0];return`error #${Q} `+s8(Q,J[1],z).join(" ")}function Y4(...z){return uG(void 0,z)}function o8(z,J){return z.get("rowModelType")===J}function o(z,J){return o8(z,"clientSide")}function V1(z,J){return o8(z,"serverSide")}function A0(z,J){return z.get("domLayout")===J}function t4(z){return Cz(z)!==void 0}function e8(z){return typeof z.get("getRowHeight")==="function"}function mG(z,J){if(J)return!z.get("enableStrictPivotColumnOrder");return z.get("maintainColumnOrder")}function cG({gos:z,formula:J}){let Q=z.get("rowNumbers");return Q||!!J?.active&&Q!==!1}function k6(z,J,Q=!1,Z){let{gos:$,environment:X}=z;if(Z==null)Z=X.getDefaultRowHeight();if(e8($)){if(Q)return{height:Z,estimated:!0};let G={node:J,data:J.data},H=$.getCallback("getRowHeight")(G);if(CQ(H)){if(H===0)R(23);return{height:Math.max(1,H),estimated:!1}}}if(J.detail&&$.get("masterDetail"))return pG($);let Y=$.get("rowHeight");return{height:Y&&CQ(Y)?Y:Z,estimated:!1}}function pG(z){if(z.get("detailRowAutoHeight"))return{height:1,estimated:!1};let J=z.get("detailRowHeight");if(CQ(J))return{height:J,estimated:!1};return{height:300,estimated:!1}}function z9(z){let{environment:J,gos:Q}=z,Z=Q.get("rowHeight");if(!Z||n(Z))return J.getDefaultRowHeight();let $=J.refreshRowHeightVariable();if($!==-1)return $;return R(24),J.getDefaultRowHeight()}function CQ(z){return!isNaN(z)&&typeof z==="number"&&isFinite(z)}function J9(z,J,Q){let Z=J[z.getDomDataKey()];return Z?Z[Q]:void 0}function l1(z,J,Q,Z){let $=z.getDomDataKey(),X=J[$];if(n(X))X={},J[$]=X;X[Q]=Z}function P2(z){if(z.get("ensureDomOrder"))return!1;return z.get("animateRows")}function i2(z){return!(z.get("paginateChildRows")||z.get("groupHideOpenParents")||A0(z,"print"))}function k4(z){return!z.get("autoGroupColumnDef")?.comparator&&!z.get("treeData")}function h4(z){let J=z.get("groupAggFiltering");if(typeof J==="function")return z.getCallback("groupAggFiltering");if(J===!0)return()=>!0;return}function S1(z){return z.get("grandTotalRow")}function QJ(z){let J=z.get("groupTotalRow");if(typeof J==="function")return z.getCallback("groupTotalRow");return()=>J??void 0}function y6(z){if(!!z.get("groupHideOpenParents"))return!0;return z.get("groupDisplayType")==="multipleColumns"}function kZ(z){return y6(z)&&z.get("groupHideColumnsUntilExpanded")&&o(z)}function ZJ(z,J){if(J)return!1;return z.get("groupDisplayType")==="groupRows"}function Q9(z,J,Q){return!!J.group&&!J.footer&&ZJ(z,Q)}function bQ(z){let J=z.getCallback("getRowId");if(J===void 0)return J;return(Q)=>{let Z=J(Q);if(typeof Z!=="string")zJ(()=>R(25,{id:Z}),"getRowIdString"),Z=String(Z);return Z}}function iG(z,J){let Q=z.get("groupHideParentOfSingleChild");if(Q===!0)return!0;if(Q==="leafGroupsOnly"&&J.leafGroup)return!0;if(z.get("groupRemoveSingleChildren"))return!0;if(z.get("groupRemoveLowestSingleChildren")&&J.leafGroup)return!0;return!1}function $J(z,J){let Q=z.get("suppressGroupChangesColumnVisibility");if(Q===!0)return!1;if(J&&Q==="suppressHideOnGroup")return!1;if(!J&&Q==="suppressShowOnUngroup")return!1;let Z=z.get("suppressRowGroupHidesColumns");if(J&&Z===!0)return!1;let $=z.get("suppressMakeColumnVisibleAfterUnGroup");if(!J&&$===!0)return!1;return!0}function B1(z){return z?.checkboxes??!0}function Mz(z){return z?.mode==="multiRow"&&(z.headerCheckbox??!0)}function b2(z){if(typeof z!=="object")return;return z.checkboxLocation??"selectionColumn"}function oJ(z){return z?.hideDisabledCheckboxes??!1}function dG(z){return typeof z.get("rowSelection")!=="string"}function Z9(z){return z.get("cellSelection")!==void 0}function $9(z){let J=z.get("cellSelection");if(J===void 0)return z.get("suppressMultiRangeSelection");return typeof J!=="boolean"?J?.suppressMultiRanges??!1:!1}function d0(z){let J=z.get("cellSelection");return J!==void 0?!!J:z.get("enableRangeSelection")}function XJ(z){let J=z.get("cellSelection");if(J===void 0)return{mode:"fill",setFillValue:z.get("fillOperation"),direction:z.get("fillHandleDirection"),suppressClearOnFillReduction:z.get("suppressClearOnFillReduction")};return typeof J!=="boolean"&&J.handle?.mode==="fill"?J.handle:void 0}function E1(z){let J=z.get("cellSelection")??!1;return(typeof J==="object"&&J.enableColumnSelection)??!1}function X9(z){let J=z.get("rowSelection")??"single";if(typeof J==="string"){let Q=z.get("suppressRowClickSelection"),Z=z.get("suppressRowDeselection");if(Q&&Z)return!1;else if(Q)return"enableDeselection";else if(Z)return"enableSelection";else return!0}return J.mode==="singleRow"||J.mode==="multiRow"?J.enableClickSelection??!1:!1}function nG(z){let J=X9(z);return J===!0||J==="enableSelection"}function tG(z){let J=X9(z);return J===!0||J==="enableDeselection"}function yQ(z){let J=z.get("rowSelection");if(typeof J==="string")return z.get("isRowSelectable");return J?.isRowSelectable}function Cz(z){let J="beanName"in z&&z.beanName==="gos"?z.get("rowSelection"):z.rowSelection;if(typeof J==="string")switch(J){case"multiple":return"multiRow";case"single":return"singleRow";default:return}switch(J?.mode){case"multiRow":case"singleRow":return J.mode;default:return}}function f6(z){return Cz(z)==="multiRow"}function rG(z){let J=z.get("rowSelection");if(typeof J==="string")return z.get("rowMultiSelectWithClick");return J?.enableSelectionWithoutKeys??!1}function bz(z){let J=z.get("rowSelection");if(typeof J==="string"){let Q=z.get("groupSelectsChildren"),Z=z.get("groupSelectsFiltered");if(Q&&Z)return"filteredDescendants";else if(Q)return"descendants";else return"self"}return J?.mode==="multiRow"?J.groupSelects:void 0}function Y9(z,J=!0){let Q=z.get("rowSelection");if(typeof Q!=="object")return J?"all":void 0;return Q.mode==="multiRow"?Q.selectAll:"all"}function sG(z){let J=z.get("rowSelection");if(typeof J==="string")return!1;return J?.mode==="multiRow"?J.ctrlASelectsRows??!1:!1}function V6(z){let J=bz(z);return J==="descendants"||J==="filteredDescendants"}function B7(z){let J=z.get("rowSelection");return typeof J==="object"&&J.masterSelects||"self"}function lG(z){return z.isModuleRegistered("SetFilter")&&!z.get("suppressSetFilterByDefault")}function B0(z){return z.get("columnMenu")==="legacy"}function fZ(z){return!B0(z)}function aG(z){if(!z||z.length<2)return z;return"on"+z[0].toUpperCase()+z.substring(1)}function C(z,J){return z.addCommon(J)}function VZ({gos:z},J){return J.button===2||J.ctrlKey&&z.get("allowContextMenuWithControlKey")}var oG={resizable:!0,sortable:!0},eG=0;function q9(){return eG++}function G4(z){return z instanceof B4}var zH=["asc","desc",null],JH=[{type:"absolute",direction:"asc"},{type:"absolute",direction:"desc"},null],B4=class extends V{constructor(z,J,Q,Z){super();this.colDef=z,this.userProvidedColDef=J,this.colId=Q,this.primary=Z,this.isColumn=!0,this.instanceId=q9(),this.autoHeaderHeight=null,this.sortDef=Z4(),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 R4,this.tooltipEnabled=!1,this.rowGroupActive=!1,this.pivotActive=!1,this.aggregationActive=!1,this.flex=null,this.colIdSanitised=E0(Q)}destroy(){super.destroy(),this.beans.rowSpanSvc?.deregister(this)}getInstanceId(){return this.instanceId}initState(){let{colDef:z,beans:{sortSvc:J,pinnedCols:Q,colFlex:Z}}=this;J?.initCol(this);let $=z.hide;if($!==void 0)this.visible=!$;else this.visible=!z.initialHide;Q?.initCol(this),Z?.initCol(this)}setColDef(z,J,Q){let Z=z.spanRows!==this.colDef.spanRows;if(this.colDef=z,this.userProvidedColDef=J,this.initMinAndMaxWidths(),this.initDotNotation(),this.initTooltip(),Z)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:z,colDef:{field:J,tooltipField:Q}}=this,Z=z.get("suppressFieldDotNotation");this.fieldContainsDots=T(J)&&J.includes(".")&&!Z,this.tooltipFieldContainsDots=T(Q)&&Q.includes(".")&&!Z}initMinAndMaxWidths(){let z=this.colDef;this.minWidth=z.minWidth??this.beans.environment.getDefaultColumnMinWidth(),this.maxWidth=z.maxWidth??Number.MAX_SAFE_INTEGER}initTooltip(){this.beans.tooltipSvc?.initCol(this)}initRowSpan(){if(this.colDef.spanRows)this.beans.rowSpanSvc?.register(this)}addPivotListener(){let z=this.beans.pivotColDefSvc,J=this.colDef.pivotValueColumn;if(!z||!J)return;this.addManagedListeners(J,{colDefChanged:(Q)=>{let Z=z.recreateColDef(this.colDef);this.setColDef(Z,Z,Q.source)}})}resetActualWidth(z){let J=this.calculateColInitialWidth(this.colDef);this.setActualWidth(J,z,!0)}calculateColInitialWidth(z){let J=z.width??z.initialWidth??200;return Math.max(Math.min(J,this.maxWidth),this.minWidth)}isEmptyGroup(){return!1}isRowGroupDisplayed(z){return this.beans.showRowGroupCols?.isRowGroupDisplayed(this,z)??!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,J){this.colEventSvc.addEventListener(z,J)}__removeEventListener(z,J){this.colEventSvc.removeEventListener(z,J)}addEventListener(z,J){this.frameworkEventListenerService=this.beans.frameworkOverrides.createLocalEventListenerWrapper?.(this.frameworkEventListenerService,this.colEventSvc);let Q=this.frameworkEventListenerService?.wrap(z,J)??J;this.colEventSvc.addEventListener(z,Q)}removeEventListener(z,J){let Q=this.frameworkEventListenerService?.unwrap(z,J)??J;this.colEventSvc.removeEventListener(z,Q)}createColumnFunctionCallbackParams(z){return C(this.gos,{node:z,data:z.data,column:this,colDef:this.colDef})}isSuppressNavigable(z){return this.beans.cellNavigation?.isSuppressNavigable(this,z)??!1}isCellEditable(z){return this.beans.editSvc?.isCellEditable({rowNode:z,column:this})??!1}isSuppressFillHandle(){return!!this.colDef.suppressFillHandle}isAutoHeight(){return!!this.colDef.autoHeight}isAutoHeaderHeight(){return!!this.colDef.autoHeaderHeight}isRowDrag(z){return this.isColumnFunc(z,this.colDef.rowDrag)}isDndSource(z){return this.isColumnFunc(z,this.colDef.dndSource)}isCellCheckboxSelection(z){return this.beans.selectionSvc?.isCellCheckboxSelection(this,z)??!1}isSuppressPaste(z){return this.isColumnFunc(z,this.colDef?.suppressPaste??null)}isResizable(){return!!this.getColDefValue("resizable")}getColDefValue(z){return this.colDef[z]??oG[z]}isColumnFunc(z,J){if(typeof J==="boolean")return J;if(typeof J==="function"){let Q=this.createColumnFunctionCallbackParams(z);return J(Q)}return!1}createColumnEvent(z,J){return C(this.gos,{type:z,column:this,columns:[this],source:J})}isMoving(){return this.moving}getSort(){return this.sortDef.direction}getSortDef(){if(!this.sortDef.direction)return null;return this.sortDef}getColDefAllowedSortTypes(){let z=[],{sort:J,initialSort:Q}=this.colDef,Z=J===null?J:j4(J?.type),$=Q===null?Q:j4(Q?.type);if(Z)z.push(Z);if($)z.push($);return z}getSortingOrder(){let z=this.getColDefAllowedSortTypes().includes("absolute")?JH:zH;return(this.colDef.sortingOrder??this.gos.get("sortingOrder")??z).map((J)=>Z4(J))}getAvailableSortTypes(){let z=this.getSortingOrder().reduce((J,Q)=>{if(Q.direction)J.push(Q.type);return J},this.getColDefAllowedSortTypes());return new Set(z)}get wasSortExplicitlyRemoved(){return this._wasSortExplicitlyRemoved}setSortDef(z,J=!1){if(!J)this._wasSortExplicitlyRemoved=!z.direction;this.sortDef=z}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,J){if(this.oldLeft=this.left,this.left!==z)this.left=z,this.dispatchColEvent("leftChanged",J)}isFilterActive(){return this.filterActive}isHovered(){return R(261),!!this.beans.colHover?.isHovered(this)}setFirstRightPinned(z,J){if(this.firstRightPinned!==z)this.firstRightPinned=z,this.dispatchColEvent("firstRightPinnedChanged",J)}setLastLeftPinned(z,J){if(this.lastLeftPinned!==z)this.lastLeftPinned=z,this.dispatchColEvent("lastLeftPinnedChanged",J)}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,J){let Q=z===!0;if(this.visible!==Q)this.visible=Q,this.dispatchColEvent("visibleChanged",J);this.dispatchStateUpdatedEvent("hide")}isVisible(){return this.visible}isSpanHeaderHeight(){return!this.getColDef().suppressSpanHeaderHeight}getFirstRealParent(){let z=this.getOriginalParent();while(z?.isPadding())z=z.getOriginalParent();return z}getColumnGroupPaddingInfo(){let z=this.getParent();if(!z?.isPadding())return{numberOfParents:0,isSpanningTotal:!1};let J=z.getPaddingLevel()+1,Q=!0;while(z){if(!z.isPadding()){Q=!1;break}z=z.getParent()}return{numberOfParents:J,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(z){let J=z!==this.autoHeaderHeight;return this.autoHeaderHeight=z,J}createBaseColDefParams(z){return C(this.gos,{node:z,data:z.data,colDef:this.colDef,column:this})}getColSpan(z){if(n(this.colDef.colSpan))return 1;let J=this.createBaseColDefParams(z),Q=this.colDef.colSpan(J);return Math.max(Q,1)}getRowSpan(z){if(n(this.colDef.rowSpan))return 1;let J=this.createBaseColDefParams(z),Q=this.colDef.rowSpan(J);return Math.max(Q,1)}setActualWidth(z,J,Q=!1){if(z=Math.max(z,this.minWidth),z=Math.min(z,this.maxWidth),this.actualWidth!==z){if(this.actualWidth=z,this.flex!=null&&J!=="flex"&&J!=="gridInitializing")this.flex=null;if(!Q)this.fireColumnWidthChangedEvent(J)}this.dispatchStateUpdatedEvent("width")}fireColumnWidthChangedEvent(z){this.dispatchColEvent("widthChanged",z)}isGreaterThanMax(z){return z>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,J,Q){let Z=this.createColumnEvent(z,J);if(Q)K0(Z,Q);this.colEventSvc.dispatchEvent(Z)}dispatchStateUpdatedEvent(z){this.colEventSvc.dispatchEvent({type:"columnStateUpdated",key:z})}};function Z4(z){if(T2(z))return{direction:z.direction,type:z.type};return{direction:YJ(z),type:j4(z)}}function K1(z){return z==="asc"||z==="desc"||z===null}function SZ(z){return z==="default"||z==="absolute"}function T2(z){if(!z||typeof z!=="object")return!1;let J=z;return SZ(J.type)&&K1(J.direction)}function kz(z,J){if(!z)return J?J.direction===null:!0;if(!J)return z?z.direction===null:!0;return z.type===J.type&&z.direction===J.direction}function YJ(z){return K1(z)?z:null}function j4(z){return SZ(z)?z:"default"}function AZ(z,J,Q){let $=Q?.()??J.sortSvc.getDisplaySortForColumn(z),X=j4($?.type),Y=YJ($?.direction),q=z.getAvailableSortTypes(),G=q.has("default"),H=q.has("absolute");return{isDefaultSortAllowed:G,isAbsoluteSortAllowed:H,isAbsoluteSort:X==="absolute",isDefaultSort:X==="default",isAscending:Y==="asc",isDescending:Y==="desc",direction:Y}}function G0(z){return z instanceof d1}var d1=class extends V{constructor(z,J,Q,Z){super();this.colGroupDef=z,this.groupId=J,this.padding=Q,this.level=Z,this.isColumn=!1,this.expandable=!1,this.instanceId=q9(),this.expandableListenerRemoveCallback=null,this.expanded=!!z?.openByDefault}destroy(){if(this.expandableListenerRemoveCallback)this.reset(null,void 0);super.destroy()}reset(z,J){if(this.colGroupDef=z,this.level=J,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((z)=>z.isVisible());return!1}isPadding(){return this.padding}setExpanded(z){this.expanded=z===void 0?!1:z,this.dispatchLocalEvent({type:"expandedChanged"})}isExpandable(){return this.expandable}isExpanded(){return this.expanded}getGroupId(){return this.groupId}getId(){return this.getGroupId()}setChildren(z){this.children=z}getChildren(){return this.children}getColGroupDef(){return this.colGroupDef}getLeafColumns(){let z=[];return this.addLeafColumns(z),z}forEachLeafColumn(z){if(!this.children)return;for(let J of this.children)if(G4(J))z(J);else if(G0(J))J.forEachLeafColumn(z)}addLeafColumns(z){if(!this.children)return;for(let J of this.children)if(G4(J))z.push(J);else if(G0(J))J.addLeafColumns(z)}getColumnGroupShow(){let z=this.colGroupDef;if(!z)return;return z.columnGroupShow}setupExpandable(){if(this.setExpandable(),this.expandableListenerRemoveCallback)this.expandableListenerRemoveCallback();let z=this.onColumnVisibilityChanged.bind(this);for(let J of this.getLeafColumns())J.__addEventListener("visibleChanged",z);this.expandableListenerRemoveCallback=()=>{for(let J of this.getLeafColumns())J.__removeEventListener("visibleChanged",z);this.expandableListenerRemoveCallback=null}}setExpandable(){if(this.isPadding())return;let z=!1,J=!1,Q=!1,Z=this.findChildrenRemovingPadding();for(let X=0,Y=Z.length;X{for(let Z of Q)if(G0(Z)&&Z.isPadding())J(Z.children);else z.push(Z)};return J(this.children),z}onColumnVisibilityChanged(){this.setExpandable()}},QH={numericColumn:{headerClass:"ag-right-aligned-header",cellClass:"ag-right-aligned-cell"},rightAligned:{headerClass:"ag-right-aligned-header",cellClass:"ag-right-aligned-cell"}};function xQ(z,J,Q){let Z={},$=z.gos;return Object.assign(Z,$.get("defaultColGroupDef")),Object.assign(Z,J),$.validateColDef(Z,Q),Z}var ZH=class{constructor(){this.existingKeys={}}addExistingKeys(z){for(let J=0;J0)R(273,{providedId:z,usedId:$});return this.existingKeys[$]=!0,$}Q++}}},G9=(z,J)=>{if(G0(z))z.setupExpandable();z.originalParent=J};function H9(z,J=null,Q,Z,$){let{existingCols:X,existingGroups:Y}=_9(Z),q=new Map(X.map((K)=>[K.getId(),K])),G=new Map(Y.map((K)=>[K.getId(),K])),H=0,_=(K,F)=>{if(H=Math.max(H,F),E9(K)){if(!z.colGroupSvc)return null;let f=K.groupId,S=G.get(f),A=xQ(z,K,f),O=new d1(A,f,!1,F);if(z.context.createBean(O),S)O.setExpanded(S.isExpanded());return O.setChildren(K.children.map((v)=>_(v,F+1))),O}let L=K.colId,D=q.get(L),M=s4(z,K,D?.getColId()??L);if(!D)D=new B4(M,K,L,Q),z.context.createBean(D);else D.setColDef(M,K,$),B9(z,D,M,$);return z.dataTypeSvc?.addColumnListeners(D),D},U=J?.map((K)=>_(K,0))??[],W=0,B={getUniqueKey:(K,F)=>String(++W)},E=z.colGroupSvc?z.colGroupSvc.balanceColumnTree(U,0,H,B):U;return N4(null,E,G9),{columnTree:E,treeDepth:H}}function RZ(z,J=null,Q,Z,$){let X=new ZH,{existingCols:Y,existingGroups:q,existingColKeys:G}=_9(Z);X.addExistingKeys(G);let H=U9(z,J,0,Q,Y,X,q,$),{colGroupSvc:_}=z,U=_?.findMaxDepth(H,0)??0,W=_?_.balanceColumnTree(H,0,U,X):H;return N4(null,W,G9),{columnTree:W,treeDepth:U}}function _9(z){let J=[],Q=[],Z=[];if(z)N4(null,z,($)=>{if(G0($)){let X=$;Q.push(X)}else{let X=$;Z.push(X.getId()),J.push(X)}});return{existingCols:J,existingGroups:Q,existingColKeys:Z}}function U9(z,J,Q,Z,$,X,Y,q){if(!J)return[];let{colGroupSvc:G}=z,H=Array(J.length);for(let _=0;_0)return;if(Q.width!=null)J.setActualWidth(Q.width,Z);else{let X=J.getActualWidth();J.setActualWidth(X,Z)}}function XH(z,J){if(!J)return;for(let Q=0;Q{for(let $=0;$J+Q.getActualWidth(),0)}function H4(z,J,Q){let Z={};if(!J)return;if(N4(null,J,(X)=>{Z[X.getInstanceId()]=X}),Q)N4(null,Q,(X)=>{Z[X.getInstanceId()]=null});let $=Object.values(Z).filter((X)=>X!=null);z.context.destroyBeans($)}function Q2(z){return z.getId().startsWith(J2)}function m4(z){return(typeof z==="string"?z:("getColId"in z)?z.getColId():z.colId)?.startsWith(K9)??!1}function b0(z){return(typeof z==="string"?z:("getColId"in z)?z.getColId():z.colId)?.startsWith(F9)??!1}function x6(z){return m4(z)||b0(z)}function yz(z){let J=[];if(z instanceof Array)J=z;else if(typeof z==="string")J=z.split(",");return J}function w6(z,J){return Z0(z,J,(Q,Z)=>Q.getColId()===Z.getColId())}function N6(z){z.map={};for(let J of z.list)z.map[J.getId()]=J}function F1(z){return z==="optionsUpdated"?"gridOptionsChanged":z}function g4(z,J){return z===J||z.colId==J||z.getColDef()===J}var GH=(z,J)=>(Q,Z)=>{let $={value1:void 0,value2:void 0},X=!1;if(z){if(z[Q]!==void 0)$.value1=z[Q],X=!0;if(T(Z)&&z[Z]!==void 0)$.value2=z[Z],X=!0}if(!X&&J){if(J[Q]!==void 0)$.value1=J[Q];if(T(Z)&&J[Z]!==void 0)$.value2=J[Z]}return $};function jZ(z,J){let Q={...z,sort:void 0,colId:J},Z=D9(z);if(Z)Q.sort=Z.direction,Q.sortType=Z.type;return Q}function D9(z){let{sort:J,initialSort:Q}=z,Z=T2(J)||K1(J),$=T2(Q)||K1(Q);if(Z)return Z4(J);if($)return Z4(Q);return null}function M9(z,J){return z+"_"+J}function W0(z){return z instanceof S6}var S6=class extends V{constructor(z,J,Q,Z){super();this.providedColumnGroup=z,this.groupId=J,this.partId=Q,this.pinned=Z,this.isColumn=!1,this.displayedChildren=[],this.autoHeaderHeight=null,this.parent=null,this.colIdSanitised=E0(this.getUniqueId())}reset(){this.parent=null,this.children=null,this.displayedChildren=null}getParent(){return this.parent}getUniqueId(){return M9(this.groupId,this.partId)}isEmptyGroup(){return this.displayedChildren.length===0}isMoving(){let z=this.getProvidedColumnGroup().getLeafColumns();if(!z||z.length===0)return!1;return z.every((J)=>J.isMoving())}checkLeft(){for(let z of this.displayedChildren)if(W0(z))z.checkLeft();if(this.displayedChildren.length>0)if(this.gos.get("enableRtl")){let J=b(this.displayedChildren).getLeft();this.setLeft(J)}else{let z=this.displayedChildren[0].getLeft();this.setLeft(z)}else this.setLeft(null)}getLeft(){return this.left}getOldLeft(){return this.oldLeft}setLeft(z){if(this.oldLeft=this.left,this.left!==z)this.left=z,this.dispatchLocalEvent({type:"leftChanged"})}getPinned(){return this.pinned}getGroupId(){return this.groupId}getPartId(){return this.partId}getActualWidth(){let z=0;for(let J of this.displayedChildren??[])z+=J.getActualWidth();return z}isResizable(){if(!this.displayedChildren)return!1;let z=!1;for(let J of this.displayedChildren)if(J.isResizable())z=!0;return z}getMinWidth(){let z=0;for(let J of this.displayedChildren)z+=J.getMinWidth();return z}addChild(z){if(!this.children)this.children=[];this.children.push(z)}getDisplayedChildren(){return this.displayedChildren}getLeafColumns(){let z=[];return this.addLeafColumns(z),z}getDisplayedLeafColumns(){let z=[];return this.addDisplayedLeafColumns(z),z}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(z){this.providedColumnGroup.setExpanded(z)}isAutoHeaderHeight(){return!!this.getColGroupDef()?.autoHeaderHeight}getAutoHeaderHeight(){return this.autoHeaderHeight}setAutoHeaderHeight(z){let J=z!==this.autoHeaderHeight;return this.autoHeaderHeight=z,J}addDisplayedLeafColumns(z){for(let J of this.displayedChildren??[])if(G4(J))z.push(J);else if(W0(J))J.addDisplayedLeafColumns(z)}addLeafColumns(z){for(let J of this.children??[])if(G4(J))z.push(J);else if(W0(J))J.addLeafColumns(z)}getChildren(){return this.children}getColumnGroupShow(){return this.providedColumnGroup.getColumnGroupShow()}getProvidedColumnGroup(){return this.providedColumnGroup}getPaddingLevel(){let z=this.getParent();if(!this.isPadding()||!z?.isPadding())return 0;return 1+z.getPaddingLevel()}calculateDisplayedColumns(){this.displayedChildren=[];let z=this;while(z?.isPadding())z=z.getParent();if(!(z?z.getProvidedColumnGroup().isExpandable():!1)){this.displayedChildren=this.children,this.dispatchLocalEvent({type:"displayedChildrenChanged"});return}for(let Q of this.children??[]){if(W0(Q)&&!Q.displayedChildren?.length)continue;switch(Q.getColumnGroupShow()){case"open":if(z.getProvidedColumnGroup().isExpanded())this.displayedChildren.push(Q);break;case"closed":if(!z.getProvidedColumnGroup().isExpanded())this.displayedChildren.push(Q);break;default:this.displayedChildren.push(Q);break}}this.dispatchLocalEvent({type:"displayedChildrenChanged"})}},k={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"},HH=65,_H=67,UH=86,WH=68,BH=90,EH=89;function k9(z){let{keyCode:J}=z,Q;switch(J){case HH:Q=k.A;break;case _H:Q=k.C;break;case UH:Q=k.V;break;case WH:Q=k.D;break;case BH:Q=k.Z;break;case EH:Q=k.Y;break;default:Q=z.code}return Q}function KH(z,J){return new N((Q)=>{Q(window.setInterval(z,J))})}var N=class z{constructor(J){this.status=0,this.resolution=null,this.waiters=[],J((Q)=>this.onDone(Q),(Q)=>this.onReject(Q))}static all(J){return J.length?new z((Q)=>{let Z=J.length,$=Array(Z);J.forEach((X,Y)=>{X.then((q)=>{if($[Y]=q,Z--,Z===0)Q($)})})}):z.resolve()}static resolve(J=null){return new z((Q)=>Q(J))}then(J){return new z((Q)=>{if(this.status===1)Q(J(this.resolution));else this.waiters.push((Z)=>Q(J(Z)))})}onDone(J){this.status=1,this.resolution=J;for(let Q of this.waiters)Q(J)}onReject(J){}},FH=class extends O0{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,J=!1){let Q={capturePointer:!0,dragSource:z,eElement:z.eElement,dragStartPixels:z.dragStartPixels,onDragStart:(Z)=>this.onDragStart(z,Z),onDragStop:this.onDragStop.bind(this),onDragging:this.onDragging.bind(this),onDragCancel:this.onDragCancel.bind(this),includeTouch:J};this.dragSourceAndParamsList.push(Q),this.beans.dragSvc.addDragSource(Q)}setDragImageCompIcon(z,J=!1){let Q=this.dragImageComp;if(Q&&(J||this.dragImageLastIcon!==z))this.dragImageLastIcon=z,Q.setIcon(z,J)}removeDragSource(z){let{dragSourceAndParamsList:J,beans:Q}=this;for(let Z=0,$=J.length;Z<$;Z++)if(J[Z].dragSource===z){let X=J[Z];Q.dragSvc?.removeDragSource(X),J.splice(Z,1);break}}destroy(){let{dragSourceAndParamsList:z,dropTargets:J,beans:Q}=this,Z=Q.dragSvc;for(let $ of z)Z?.removeDragSource($);z.length=0,J.length=0,this.externalDropZoneCount=0,this.clearDragAndDropProperties(),super.destroy()}nudge(){let z=this.lastMouseEvent;if(z)this.onDragging(z,!0)}onDragStart(z,J){this.lastMouseEvent=J,this.dragSource=z,this.dragItem=z.getDragItem();let Q=z.eElement.getBoundingClientRect();this.dragInitialSourcePointerOffsetX=J.clientX-Q.left,this.dragInitialSourcePointerOffsetY=J.clientY-Q.top,z.onDragStarted?.(),this.createAndUpdateDragImageComp(z)}onDragStop(z){let{dragSource:J,lastDropTarget:Q}=this;if(J?.onDragStopped?.(),Q){let Z=this.dropTargetEvent(Q,z,!1);Q.onDragStop?.(Z)}this.clearDragAndDropProperties()}onDragCancel(){let{dragSource:z,lastDropTarget:J,lastMouseEvent:Q}=this;if(z?.onDragCancelled?.(),J&&Q){let Z=this.dropTargetEvent(J,Q,!1);J.onDragCancel?.(Z)}this.clearDragAndDropProperties()}onDragging(z,J=!1){this.positionDragImageComp(z);let Q=this.findCurrentDropTarget(z),{lastDropTarget:Z,dragSource:$,dragItem:X}=this,Y=!1;if(Q!==Z){if(Y=!0,Z){let q=this.dropTargetEvent(Z,z,J);Z.onDragLeave?.(q)}if(Z!==null&&!Q)this.handleExit($,X);else if(Z===null&&Q)this.handleEnter($,X);if(Q){let q=this.dropTargetEvent(Q,z,J);Q.onDragEnter?.(q)}this.lastDropTarget=Q}else if(Q){let q=this.dropTargetEvent(Q,z,J);if(Q.onDragging?.(q),q?.changed)Y=!0}if(this.lastMouseEvent=z,Y)this.updateDragImageComp()}clearDragAndDropProperties(){this.removeDragImageComp(this.dragImageComp),this.dragImageCompPromise=null,this.dragImageLastIcon=void 0,this.dragImageLastLabel=void 0,this.lastMouseEvent=null,this.lastDraggingEvent=null,this.lastDropTarget=null,this.dragItem=null,this.dragInitialSourcePointerOffsetX=0,this.dragInitialSourcePointerOffsetY=0,this.dragSource=null}getAllContainersFromDropTarget(z){let J=z.getContainer(),Q=z.getSecondaryContainers?.(),Z=Q?.length;if(!Z)return[[J]];let $=Array(Z+1);$[0]=[J];for(let X=0;X{for(let H of G){let{width:_,height:U,left:W,right:B,top:E,bottom:K}=H.getBoundingClientRect();if(_===0||U===0)return!1;let F=q.clientX>=W&&q.clientX=E&&q.clientY0}findExternalZone(z){let J=this.dropTargets;for(let Q=0,Z=J.length;Q0?"down":E<0?"up":null,hDirection:B<0?"left":B>0?"right":null,initialSourcePointerOffsetX:q,initialSourcePointerOffsetY:G,dragSource:Z,fromNudge:Q,dragItem:$,dropZoneTarget:H,dropTarget:X?.dropTarget??null,changed:!!X?.changed});return this.lastDraggingEvent=K,K}positionDragImageComp(z){let J=this.dragImageComp?.getGui();if(J)FG(J,z,this.beans)}removeDragImageComp(z){if(this.dragImageComp===z)this.dragImageComp=null;if(z)z.getGui()?.remove(),this.destroyBean(z)}createAndUpdateDragImageComp(z){let J=this.createDragImageComp(z)??null;this.dragImageCompPromise=J,J?.then((Q)=>{let Z=this.lastMouseEvent;if(J!==this.dragImageCompPromise||!Z||!this.isAlive()){this.destroyBean(Q);return}this.dragImageCompPromise=null,this.dragImageLastIcon=void 0,this.dragImageLastLabel=void 0;let $=this.dragImageComp;if($!==Q)this.dragImageComp=Q,this.removeDragImageComp($);if(Q)this.appendDragImageComp(Q),this.updateDragImageComp(),this.positionDragImageComp(Z)})}appendDragImageComp(z){let J=z.getGui(),Q=J.style;if(Q.position="absolute",Q.zIndex="9999",this.beans.dragSvc?.hasPointerCapture())Q.pointerEvents="none";this.gos.setInstanceDomData(J),this.beans.environment.applyThemeClasses(J),Q.top="20px",Q.left="20px";let Z=m2(this.beans);if(!Z)this.warnNoBody();else Z.appendChild(J)}updateDragImageComp(){let{dragImageComp:z,dragSource:J,lastDropTarget:Q,lastDraggingEvent:Z,dragImageLastLabel:$}=this;if(!z)return;this.setDragImageCompIcon(Q?.getIconName?.(Z)??null);let X=J?.dragItemName;if(typeof X==="function")X=X(Z);if(X||(X=""),$!==X)this.dragImageLastLabel=X,z.setLabel(X)}};function f9(z){return typeof z==="object"&&!!z.component}function LH(z){if(!z)return!1;return z.prototype&&"getGui"in z.prototype}function V9(z,J,Q,Z){let{name:$}=Q,X,Y,q,G,H,_;if(J){let U=J,W=U[$+"Selector"],B=W?W(Z):null,E=(K)=>{if(typeof K==="string")X=K;else if(K!=null&&K!==!0)if(z.isFrameworkComponent(K))q=K;else Y=K};if(B)E(B.component),G=B.params,H=B.popup,_=B.popupPosition;else E(U[$])}return{compName:X,jsComp:Y,fwComp:q,paramsFromSelector:G,popupFromSelector:H,popupPositionFromSelector:_}}var DH=class extends V{constructor(){super(...arguments);this.beanName="userCompFactory"}wireBeans(z){this.agCompUtils=z.agCompUtils,this.registry=z.registry,this.frameworkCompWrapper=z.frameworkCompWrapper,this.gridOptions=z.gridOptions}getCompDetailsFromGridOptions(z,J,Q,Z=!1){return this.getCompDetails(this.gridOptions,z,J,Q,Z)}getCompDetails(z,J,Q,Z,$=!1){let{name:X,cellRenderer:Y}=J,{compName:q,jsComp:G,fwComp:H,paramsFromSelector:_,popupFromSelector:U,popupPositionFromSelector:W}=V9(this.beans.frameworkOverrides,z,J,Z),B,E,K=(M)=>{let f=this.registry.getUserComponent(X,M);if(f)G=!f.componentFromFramework?f.component:void 0,H=f.componentFromFramework?f.component:void 0,B=f.params,E=f.processParams};if(q!=null)K(q);if(G==null&&H==null&&Q!=null)K(Q);if(G&&Y&&!LH(G))G=this.agCompUtils?.adaptFunction(J,G);if(!G&&!H){let{validation:M}=this.beans;if($&&(q!==Q||!Q))if(q){if(!M?.isProvidedUserComp(q))t(50,{compName:q})}else if(Q){if(!M)t(260,{...this.gos.getModuleErrorParams(),propName:X,compName:Q})}else t(216,{name:X});else if(Q&&!M)t(146,{comp:Q});return}let F=this.mergeParams(z,J,Z,_,B,E),L=G==null,D=G??H;return{componentFromFramework:L,componentClass:D,params:F,type:J,popupFromSelector:U,popupPositionFromSelector:W,newAgStackInstance:()=>this.newAgStackInstance(D,L,F,J)}}newAgStackInstance(z,J,Q,Z){let $=!J,X;if($)X=new z;else X=this.frameworkCompWrapper.wrap(z,Z.mandatoryMethods,Z.optionalMethods,Z);this.createBean(X);let Y=X.init?.(Q);if(Y==null)return N.resolve(X);return Y.then(()=>X)}mergeParams(z,J,Q,Z=null,$,X){let Y={...Q,...$},G=z?.[J.name+"Params"];if(typeof G==="function"){let H=G(Q);K0(Y,H)}else if(typeof G==="object")K0(Y,G);return K0(Y,Z),X?X(Y):Y}},MH={name:"dateComponent",mandatoryMethods:["getDate","setDate"],optionalMethods:["afterGuiAttached","setInputPlaceholder","setInputAriaLabel","setDisabled","refresh"]},kH={name:"dragAndDropImageComponent",mandatoryMethods:["setIcon","setLabel"]},fH={name:"headerComponent",optionalMethods:["refresh"]},VH={name:"innerHeaderComponent"},SH={name:"innerHeaderGroupComponent"},AH={name:"headerGroupComponent"},RH={name:"innerRenderer",cellRenderer:!0,optionalMethods:["afterGuiAttached"]},jH={name:"cellRenderer",optionalMethods:["refresh","afterGuiAttached"],cellRenderer:!0};var OH={name:"loadingCellRenderer",cellRenderer:!0},PH={name:"cellEditor",mandatoryMethods:["getValue"],optionalMethods:["isPopup","isCancelBeforeStart","isCancelAfterEnd","getPopupPosition","focusIn","focusOut","afterGuiAttached","refresh"]},TH={name:"tooltipComponent"},OZ={name:"filter",mandatoryMethods:["isFilterActive","doesFilterPass","getModel","setModel"],optionalMethods:["afterGuiAttached","afterGuiDetached","onNewRowsLoaded","getModelAsString","onFloatingFilterChanged","onAnyFilterChanged","refresh"]},vH={name:"floatingFilterComponent",mandatoryMethods:["onParentModelChanged"],optionalMethods:["afterGuiAttached","refresh"]},IH={name:"fullWidthCellRenderer",optionalMethods:["refresh","afterGuiAttached"],cellRenderer:!0},CH={name:"loadingCellRenderer",cellRenderer:!0},bH={name:"groupRowRenderer",optionalMethods:["afterGuiAttached"],cellRenderer:!0},yH={name:"detailCellRenderer",optionalMethods:["refresh"],cellRenderer:!0};function xH(z,J){return z.getCompDetailsFromGridOptions(kH,"agDragAndDropImage",J,!0)}function g6(z,J,Q){return z.getCompDetails(J,RH,void 0,Q)}function wH(z,J,Q){return z.getCompDetails(J,fH,"agColumnHeader",Q)}function NH(z,J,Q){return z.getCompDetails(J,VH,void 0,Q)}function gH(z,J){let Q=J.columnGroup.getColGroupDef();return z.getCompDetails(Q,AH,"agColumnGroupHeader",J)}function hH(z,J,Q){return z.getCompDetails(J,SH,void 0,Q)}function uH(z,J){return z.getCompDetailsFromGridOptions(IH,void 0,J,!0)}function mH(z,J){return z.getCompDetailsFromGridOptions(CH,"agLoadingCellRenderer",J,!0)}function cH(z,J){return z.getCompDetailsFromGridOptions(bH,"agGroupRowRenderer",J,!0)}function pH(z,J){return z.getCompDetailsFromGridOptions(yH,"agDetailCellRenderer",J,!0)}function D1(z,J,Q){return z.getCompDetails(J,jH,void 0,Q)}function E7(z,J,Q){return z.getCompDetails(J,OH,"agSkeletonCellRenderer",Q,!0)}function S9(z,J,Q){return z.getCompDetails(J,PH,"agCellEditor",Q,!0)}function PZ(z,J,Q,Z){let $=J.filter;if(f9($))J={filter:$.component,filterParams:J.filterParams};return z.getCompDetails(J,OZ,Z,Q,!0)}function iH(z,J,Q){return z.getCompDetails(J,MH,"agDateInput",Q,!0)}function dH(z,J){return z.getCompDetails(J.colDef,TH,"agTooltipComponent",J,!0)}function TZ(z,J,Q,Z){return z.getCompDetails(J,vH,Z,Q)}function A9(z,J){return V9(z,J,OZ)}function eJ(z,J,Q){return z.mergeParams(J,OZ,Q)}var E4=((z)=>{return z[z.ToolPanel=0]="ToolPanel",z[z.HeaderCell=1]="HeaderCell",z[z.RowDrag=2]="RowDrag",z[z.ChartPanel=3]="ChartPanel",z[z.AdvancedFilterBuilder=4]="AdvancedFilterBuilder",z})(E4||{}),nH=class extends FH{createEvent(z){return C(this.gos,z)}createDragImageComp(z){let{gos:J,beans:Q}=this;return xH(Q.userCompFactory,C(J,{dragSource:z}))?.newAgStackInstance()}handleEnter(z,J){z?.onGridEnter?.(J)}handleExit(z,J){z?.onGridExit?.(J)}warnNoBody(){R(54)}isDropZoneWithinThisGrid(z){return this.beans.ctrlsSvc.getGridBodyCtrl().eGridBody.contains(z.dropZoneTarget)}registerGridDropTarget(z,J){let Q={getContainer:z,isInterestedIn:(Z)=>Z===1||Z===0,getIconName:()=>"notAllowed"};this.addDropTarget(Q),J.addDestroyFunc(()=>this.removeDropTarget(Q))}};function R9(z){return!!z.operator}var j9="ag-resizer-wrapper",Z1=(z,J)=>({tag:"div",ref:`${z}Resizer`,cls:`ag-resizer ag-resizer-${J}`}),tH={tag:"div",cls:j9,children:[Z1("eTopLeft","topLeft"),Z1("eTop","top"),Z1("eTopRight","topRight"),Z1("eRight","right"),Z1("eBottomRight","bottomRight"),Z1("eBottom","bottom"),Z1("eBottomLeft","bottomLeft"),Z1("eLeft","left")]},vZ=class extends O0{constructor(z,J){super();this.element=z,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,...J}}wireBeans(z){this.popupSvc=z.popupSvc,this.dragSvc=z.dragSvc}center(z){let{clientHeight:J,clientWidth:Q}=this.offsetParent,Z=Q/2-this.getWidth()/2,$=J/2-this.getHeight()/2;this.offsetElement(Z,$,z)}initialisePosition(z){if(this.positioned)return;let{centered:J,forcePopupParentAsOffsetParent:Q,minWidth:Z,width:$,minHeight:X,height:Y,x:q,y:G}=this.config;if(!this.offsetParent)this.setOffsetParent();let H=0,_=0,U=M0(this.element);if(U){let W=this.findBoundaryElement(),B=window.getComputedStyle(W);if(B.minWidth!=null){let E=W.offsetWidth-this.element.offsetWidth;_=Number.parseInt(B.minWidth,10)-E}if(B.minHeight!=null){let E=W.offsetHeight-this.element.offsetHeight;H=Number.parseInt(B.minHeight,10)-E}}if(this.minHeight=X||H,this.minWidth=Z||_,$)this.setWidth($);if(Y)this.setHeight(Y);if(!$||!Y)this.refreshSize();if(J)this.center(z);else if(q||G)this.offsetElement(q,G,z);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,z);else this.setPosition(K,E)}}this.positioned=!!this.offsetParent}isPositioned(){return this.positioned}getPosition(){return this.position}setMovable(z,J){if(!this.config.popup||z===this.movable)return;this.movable=z;let Q=this.moveElementDragListener||{eElement:J,onDragStart:this.onMoveStart.bind(this),onDragging:this.onMove.bind(this),onDragStop:this.onMoveEnd.bind(this)};if(z)this.dragSvc?.addDragSource(Q),this.moveElementDragListener=Q;else this.dragSvc?.removeDragSource(Q),this.moveElementDragListener=void 0}setResizable(z){if(this.clearResizeListeners(),z)this.addResizers();else this.removeResizers();if(typeof z==="boolean"){if(z===!1)return;z={topLeft:z,top:z,topRight:z,right:z,bottomRight:z,bottom:z,bottomLeft:z,left:z}}for(let J of Object.keys(z)){let Q=!!z[J],Z=this.getResizerElement(J),$={dragStartPixels:0,eElement:Z,onDragStart:(X)=>this.onResizeStart(X,J),onDragging:this.onResize.bind(this),onDragStop:(X)=>this.onResizeEnd(X,J)};if(Q||!this.isAlive()&&!Q){if(Q)this.dragSvc?.addDragSource($),this.resizeListeners.push($),Z.style.pointerEvents="all";else Z.style.pointerEvents="none";this.resizable[J]=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:z,width:J}=this.lastSize;if(J!==-1)this.element.style.width=`${J}px`;if(z!==-1)this.element.style.height=`${z}px`}getHeight(){return this.element.offsetHeight}setHeight(z){let{popup:J}=this.config,Q=this.element,Z=!1;if(typeof z==="string"&&z.includes("%"))_6(Q,z),z=I8(Q),Z=!0;else if(z=Math.max(this.minHeight,z),this.positioned){let $=this.getAvailableHeight();if($&&z>$)z=$}if(this.getHeight()===z)return;if(Z)Q.style.maxHeight="unset",Q.style.minHeight="unset";else if(J)_6(Q,z);else Q.style.height=`${z}px`,Q.style.flex="0 0 auto",this.lastSize.height=typeof z==="number"?z:Number.parseFloat(z)}getAvailableHeight(){let{popup:z,forcePopupParentAsOffsetParent:J}=this.config;if(!this.positioned)this.initialisePosition();let{clientHeight:Q}=this.offsetParent;if(!Q)return null;let Z=this.element.getBoundingClientRect(),$=this.offsetParent.getBoundingClientRect(),X=z?this.position.y:Z.top,Y=z?0:$.top,q=0;if(J){let H=this.element.parentElement;if(H){let{bottom:_}=H.getBoundingClientRect();q=_-Z.bottom}}return Q+Y-X-q}getWidth(){return this.element.offsetWidth}setWidth(z){let J=this.element,{popup:Q}=this.config,Z=!1;if(typeof z==="string"&&z.includes("%"))w4(J,z),z=Oz(J),Z=!0;else if(this.positioned){z=Math.max(this.minWidth,z);let{clientWidth:$}=this.offsetParent,X=Q?this.position.x:this.element.getBoundingClientRect().left;if($&&z+X>$)z=$-X}if(this.getWidth()===z)return;if(Z)J.style.maxWidth="unset",J.style.minWidth="unset";else if(this.config.popup)w4(J,z);else J.style.width=`${z}px`,J.style.flex=" unset",this.lastSize.width=typeof z==="number"?z:Number.parseFloat(z)}offsetElement(z=0,J=0,Q){let{forcePopupParentAsOffsetParent:Z}=this.config,$=Z?this.boundaryEl:this.element;if(!$)return;this.popupSvc?.positionPopup({ePopup:$,keepWithinBounds:!0,skipObserver:this.movable||this.isResizable(),updatePosition:()=>({x:z,y:J}),postProcessCallback:Q}),this.setPosition(Number.parseFloat($.style.left),Number.parseFloat($.style.top))}constrainSizeToAvailableHeight(z){if(!this.config.forcePopupParentAsOffsetParent)return;let J=()=>{let Q=this.getAvailableHeight();this.element.style.setProperty("max-height",`${Q}px`)};if(z&&this.popupSvc)this.resizeObserverSubscriber?.(),this.resizeObserverSubscriber=P4(this.beans,this.popupSvc?.getPopupParent(),J);else if(this.element.style.removeProperty("max-height"),this.resizeObserverSubscriber)this.resizeObserverSubscriber(),this.resizeObserverSubscriber=void 0}setPosition(z,J){this.position.x=z,this.position.y=J}updateDragStartPosition(z,J){this.dragStartPosition={x:z,y:J}}calculateMouseMovement(z){let{e:J,isLeft:Q,isTop:Z,anywhereWithin:$,topBuffer:X}=z,Y=J.clientX-this.dragStartPosition.x,q=J.clientY-this.dragStartPosition.y,G=this.shouldSkipX(J,!!Q,!!$,Y)?0:Y,H=this.shouldSkipY(J,!!Z,X,q)?0:q;return{movementX:G,movementY:H}}shouldSkipX(z,J,Q,Z){let $=this.element.getBoundingClientRect(),X=this.offsetParent.getBoundingClientRect(),Y=this.boundaryEl.getBoundingClientRect(),q=this.config.popup?this.position.x:$.left,G=q<=0&&X.left>=z.clientX||X.right<=z.clientX&&X.right<=Y.right;if(G)return!0;if(J)G=Z<0&&z.clientX>q+X.left||Z>0&&z.clientXY.right||Z>0&&z.clientXY.right||Z>0&&z.clientX=z.clientY||X.bottom<=z.clientY&&X.bottom<=Y.bottom;if(G)return!0;if(J)G=Z<0&&z.clientY>q+X.top+Q||Z>0&&z.clientYY.bottom||Z>0&&z.clientY({element:this.element.querySelector(`[data-ref=${J}Resizer]`)});this.resizerMap={topLeft:z("eTopLeft"),top:z("eTop"),topRight:z("eTopRight"),right:z("eRight"),bottomRight:z("eBottomRight"),bottom:z("eBottom"),bottomLeft:z("eBottomLeft"),left:z("eLeft")}}addResizers(){if(this.resizersAdded)return;let z=this.element;if(!z)return;z.appendChild(F0(tH)),this.createResizeMap(),this.resizersAdded=!0}removeResizers(){this.resizerMap=void 0,this.element.querySelector(`.${j9}`)?.remove(),this.resizersAdded=!1}getResizerElement(z){return this.resizerMap[z].element}onResizeStart(z,J){if(this.boundaryEl=this.findBoundaryElement(),!this.positioned)this.initialisePosition();this.currentResizer={isTop:!!J.match(/top/i),isRight:!!J.match(/right/i),isBottom:!!J.match(/bottom/i),isLeft:!!J.match(/left/i)},this.element.classList.add("ag-resizing"),this.resizerMap[J].element.classList.add("ag-active");let{popup:Q,forcePopupParentAsOffsetParent:Z}=this.config;if(!Q&&!Z)this.applySizeToSiblings(this.currentResizer.isBottom||this.currentResizer.isTop);this.isResizing=!0,this.updateDragStartPosition(z.clientX,z.clientY)}getSiblings(){let J=this.element.parentElement;if(!J)return null;return Array.prototype.slice.call(J.children).filter((Q)=>!Q.classList.contains("ag-hidden"))}getMinSizeOfSiblings(){let z=this.getSiblings()||[],J=0,Q=0;for(let Z of z){let $=!!Z.style.flex&&Z.style.flex!=="0 0 auto";if(Z===this.element)continue;let X=this.minHeight||0,Y=this.minWidth||0;if($){let q=window.getComputedStyle(Z);if(q.minHeight)X=Number.parseInt(q.minHeight,10);if(q.minWidth)Y=Number.parseInt(q.minWidth,10)}else X=Z.offsetHeight,Y=Z.offsetWidth;J+=X,Q+=Y}return{height:J,width:Q}}applySizeToSiblings(z){let J=null,Q=this.getSiblings();if(!Q)return;for(let Z=0;Zz)}onResize(z){if(!this.isResizing||!this.currentResizer)return;let{popup:J,forcePopupParentAsOffsetParent:Q}=this.config,{isTop:Z,isRight:$,isBottom:X,isLeft:Y}=this.currentResizer,q=$||Y,G=X||Z,{movementX:H,movementY:_}=this.calculateMouseMovement({e:z,isLeft:Y,isTop:Z}),U=this.position.x,W=this.position.y,B=0,E=0;if(q&&H){let K=Y?-1:1,F=this.getWidth(),L=F+H*K,D=!1;if(Y){if(B=F-L,U+B<=0||L<=this.minWidth)D=!0,B=0}if(!D)this.setWidth(L)}if(G&&_){let K=Z?-1:1,F=this.getHeight(),L=F+_*K,D=!1;if(Z){if(E=F-L,W+E<=0||L<=this.minHeight)D=!0,E=0}else if(!this.config.popup&&!this.config.forcePopupParentAsOffsetParent&&Fthis.element.parentElement.offsetHeight)D=!0;if(!D)this.setHeight(L)}if(this.updateDragStartPosition(z.clientX,z.clientY),(J||Q)&&B||E)this.offsetElement(U+B,W+E)}onResizeEnd(z,J){this.isResizing=!1,this.currentResizer=null,this.boundaryEl=null,this.element.classList.remove("ag-resizing"),this.resizerMap[J].element.classList.remove("ag-active"),this.dispatchLocalEvent({type:"resize"})}refreshSize(){let z=this.element;if(this.config.popup){if(!this.config.width)this.setWidth(z.offsetWidth);if(!this.config.height)this.setHeight(z.offsetHeight)}}onMoveStart(z){if(this.boundaryEl=this.findBoundaryElement(),!this.positioned)this.initialisePosition();this.isMoving=!0,this.element.classList.add("ag-moving"),this.updateDragStartPosition(z.clientX,z.clientY)}onMove(z){if(!this.isMoving)return;let{x:J,y:Q}=this.position,Z;if(this.config.calculateTopBuffer)Z=this.config.calculateTopBuffer();let{movementX:$,movementY:X}=this.calculateMouseMovement({e:z,isTop:!0,anywhereWithin:!0,topBuffer:Z});this.offsetElement(J+$,Q+X),this.updateDragStartPosition(z.clientX,z.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 z=this.element;while(z){if(window.getComputedStyle(z).position!=="static")return z;z=z.parentElement}return this.element}clearResizeListeners(){while(this.resizeListeners.length){let z=this.resizeListeners.pop();this.dragSvc?.removeDragSource(z)}}destroy(){if(super.destroy(),this.moveElementDragListener)this.dragSvc?.removeDragSource(this.moveElementDragListener);this.constrainSizeToAvailableHeight(!1),this.clearResizeListeners(),this.removeResizers()}},h6=class extends vZ{},j=null;function y2(z){return typeof z?.getGui==="function"}var O9=class{constructor(z){this.cssClassStates={},this.getGui=z}toggleCss(z,J){if(!z)return;if(z.includes(" ")){let Z=(z||"").split(" ");if(Z.length>1){for(let $ of Z)this.toggleCss($,J);return}}if(this.cssClassStates[z]!==J&&z.length)this.getGui()?.classList.toggle(z,J),this.cssClassStates[z]=J}},rH=0,x0=class extends O0{constructor(z,J){super();if(this.suppressDataRefValidation=!1,this.displayed=!0,this.visible=!0,this.compId=rH++,this.cssManager=new O9(()=>this.eGui),this.componentSelectors=new Map((J??[]).map((Q)=>[Q.selector,Q])),z)this.setTemplate(z)}preConstruct(){this.wireTemplate(this.getGui()),this.addGlobalCss()}wireTemplate(z,J){if(z&&this.gos)this.applyElementsToComponent(z),this.createChildComponentsFromTags(z,J)}getCompId(){return this.compId}getDataRefAttribute(z){if(z.getAttribute)return z.getAttribute(N8);return null}applyElementsToComponent(z,J,Q,Z=null){if(J===void 0)J=this.getDataRefAttribute(z);if(J){let $=this[J];if($===j)this[J]=Z??z;else{let X=Q?.[J];if(!this.suppressDataRefValidation&&!X)throw Error(`data-ref: ${J} on ${this.constructor.name} with ${$}`)}}}createChildComponentsFromTags(z,J){let Q=[];for(let Z of z.childNodes??[])Q.push(Z);for(let Z of Q){if(!(Z instanceof HTMLElement))continue;let $=this.createComponentFromElement(Z,(X)=>{let Y=X.getGui();if(Y)for(let q of Z.attributes??[])Y.setAttribute(q.name,q.value)},J);if($){if($.addItems&&Z.children.length){this.createChildComponentsFromTags(Z,J);let X=Array.prototype.slice.call(Z.children);$.addItems(X)}this.swapComponentForNode($,z,Z)}else if(Z.childNodes)this.createChildComponentsFromTags(Z,J)}}createComponentFromElement(z,J,Q){let Z=z.nodeName,$=this.getDataRefAttribute(z),X=Z.indexOf("AG-")===0,Y=X?this.componentSelectors.get(Z):null,q=null;if(Y){let G=Q&&$?Q[$]:void 0;q=new Y.component(G),q.setParentComponent(this),this.createBean(q,null,J)}else if(X)throw Error(`selector: ${Z}`);return this.applyElementsToComponent(z,$,Q,q),q}swapComponentForNode(z,J,Q){let Z=z.getGui();J.replaceChild(Z,Q),J.insertBefore(document.createComment(Q.nodeName),Z),this.addDestroyFunc(this.destroyBean.bind(this,z))}activateTabIndex(z,J){let Q=J??this.gos.get("tabIndex");if(!z)z=[];if(!z.length)z.push(this.getGui());for(let Z of z)Z.setAttribute("tabindex",Q.toString())}setTemplate(z,J,Q){let Z;if(typeof z==="string"||z==null)Z=UZ(z);else Z=F0(z);this.setTemplateFromElement(Z,J,Q)}setTemplateFromElement(z,J,Q,Z=!1){if(this.eGui=z,this.suppressDataRefValidation=Z,J)for(let $=0;$this.eGui.removeEventListener(z,J))}addCss(z){this.cssManager.toggleCss(z,!0)}removeCss(z){this.cssManager.toggleCss(z,!1)}toggleCss(z,J){this.cssManager.toggleCss(z,J)}registerCSS(z){if(this.css===K7)this.css=[z],this.addGlobalCss();else this.css||(this.css=[]),this.css.push(z)}addGlobalCss(){if(Array.isArray(this.css)){let z="component-"+Object.getPrototypeOf(this)?.constructor?.name;for(let J of this.css??[])this.beans.environment.addGlobalCSS(J,z)}this.css=K7}},K7=Symbol(),y=class extends x0{},zQ,JQ,QQ,ZQ,wQ,NQ,$Q;function A1(){if(zQ===void 0)zQ=/^((?!chrome|android).)*safari/i.test(navigator.userAgent);return zQ}function a1(){if(JQ===void 0)JQ=/(firefox)/i.test(navigator.userAgent);return JQ}function P9(){if(QQ===void 0)QQ=/(Mac|iPhone|iPod|iPad)/i.test(navigator.platform);return QQ}function n1(){if(ZQ===void 0)ZQ=/iPad|iPhone|iPod/.test(navigator.platform)||navigator.platform==="MacIntel"&&navigator.maxTouchPoints>1;return ZQ}function gQ(z){if(!z)return null;let J=z.tabIndex,Q=z.getAttribute("tabIndex");if(J===-1&&(Q===null||Q===""&&!a1()))return null;return J.toString()}function sH(){if($Q!==void 0)return $Q;if(!document.body)return-1;let z=1e6,J=a1()?6000000:1e9,Q=document.createElement("div");document.body.appendChild(Q);while(!0){let Z=z*2;if(Q.style.height=Z+"px",Z>J||Q.clientHeight!==Z)break;else z=Z}return Q.remove(),$Q=z,z}function IZ(){if(NQ==null)T9();return NQ}function T9(){let z=document.body,J=document.createElement("div");J.style.width=J.style.height="100px",J.style.opacity="0",J.style.overflow="scroll",J.style.msOverflowStyle="scrollbar",J.style.position="absolute",z.appendChild(J);let Q=J.offsetWidth-J.clientWidth;if(Q===0&&J.clientWidth===0)Q=null;if(J.parentNode)J.remove();if(Q!=null)NQ=Q,wQ=Q===0}function v9(){if(wQ==null)T9();return wQ}var hQ=!1,xz=0;function lH(z){if(xz>0)return;z.addEventListener("keydown",wz),z.addEventListener("mousedown",wz)}function aH(z){if(xz>0)return;z.removeEventListener("keydown",wz),z.removeEventListener("mousedown",wz)}function wz(z){let J=hQ,Q=z.type==="keydown";if(Q){if(z.ctrlKey||z.metaKey||z.altKey)return}if(J===Q)return;hQ=Q}function oH(z){let J=Y0(z);return lH(J),xz++,()=>{xz--,aH(J)}}function d2(){return hQ}function A4(z,J,Q=!1){let Z=XG,$=v8;if(J)$+=", "+J;if(Q)$+=', [tabindex="-1"]';let X=Array.prototype.slice.apply(z.querySelectorAll(Z)).filter((G)=>{return M0(G)}),Y=Array.prototype.slice.apply(z.querySelectorAll($));if(!Y.length)return X;return((G,H)=>G.filter((_)=>H.indexOf(_)===-1))(X,Y)}function k0(z,J=!1,Q=!1,Z=!1){let $=A4(z,Z?".ag-tab-guard":null,Q),X=J?b($):$[0];if(X)return X.focus({preventScroll:!0}),!0;return!1}function P0(z,J,Q,Z){let $=A4(J,Q?':not([tabindex="-1"])':null),X=d(z),Y;if(Q)Y=$.findIndex((G)=>G.contains(X));else Y=$.indexOf(X);let q=Y+(Z?-1:1);if(q<0||q>=$.length)return null;return $[q]}function GJ(z,J=5){let Q=0;while(z&&gQ(z)===null&&++Q<=J)z=z.parentElement;if(gQ(z)===null)return null;return z}var CZ="ag-focus-managed",I9=class extends O0{constructor(z,J={isStopPropagation:()=>!1,stopPropagation:()=>{}},Q={}){super();this.eFocusable=z,this.stopPropagationCallbacks=J,this.callbacks=Q,this.callbacks={shouldStopEventPropagation:()=>!1,onTabKeyDown:(Z)=>{if(Z.defaultPrevented)return;let $=P0(this.beans,this.eFocusable,!1,Z.shiftKey);if(!$)return;$.focus(),Z.preventDefault()},...Q}}postConstruct(){let{eFocusable:z,callbacks:{onFocusIn:J,onFocusOut:Q}}=this;if(z.classList.add(CZ),this.addKeyDownListeners(z),J)this.addManagedElementListeners(z,{focusin:J});if(Q)this.addManagedElementListeners(z,{focusout:Q})}addKeyDownListeners(z){this.addManagedElementListeners(z,{keydown:(J)=>{if(J.defaultPrevented||this.stopPropagationCallbacks.isStopPropagation(J))return;let{callbacks:Q}=this;if(Q.shouldStopEventPropagation(J)){this.stopPropagationCallbacks.stopPropagation(J);return}if(J.key===k.TAB)Q.onTabKeyDown(J);else if(Q.handleKeyDown)Q.handleKeyDown(J)}})}},C9="__ag_Grid_Stop_Propagation";function s0(z){z[C9]=!0}function q4(z){return z[C9]===!0}var R1={isStopPropagation:q4,stopPropagation:s0},a4=class extends I9{constructor(z,J){super(z,R1,J)}},eH={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:(z)=>`(${z[0]}, ${z[1]})`,filterSummaryTextQuote:(z)=>`"${z[0]}"`,minDateValidation:(z)=>`Date must be after ${z[0]}`,maxDateValidation:(z)=>`Date must be before ${z[0]}`,strictMinValueValidation:(z)=>`Must be greater than ${z[0]}`,strictMaxValueValidation:(z)=>`Must be less than ${z[0]}`};function f4(z,J,Q){return EZ(z,eH,J,Q)}function bZ(z,J){let{debounceMs:Q}=z;if(n2(z)){if(Q!=null)R(71);return 0}return Q??J}function n2(z){return(z.buttons?.indexOf("apply")??-1)>=0}function b9(z,J,Q,Z){let $=f4(z,Q);if(typeof J==="function"){let X=f4(z,Z);$=J({filterOptionKey:Z,filterOption:X,placeholder:$})}else if(typeof J==="string")$=J;return $}var Z2=class extends y{constructor(z,J){super();this.filterNameKey=z,this.cssIdentifier=J,this.applyActive=!1,this.debouncePending=!1,this.defaultDebounceMs=0}postConstruct(){let z={tag:"div",cls:`ag-filter-body-wrapper ag-${this.cssIdentifier}-body-wrapper`,children:[this.createBodyTemplate()]};this.setTemplate(z,this.getAgComponents()),this.createManagedBean(new a4(this.getFocusableElement(),{handleKeyDown:this.handleKeyDown.bind(this)})),this.positionableFeature=this.createBean(new h6(this.getPositionableElement(),{forcePopupParentAsOffsetParent:!0}))}handleKeyDown(z){}init(z){let J=z;this.setParams(J),this.setModelIntoUi(J.state.model,!0).then(()=>this.updateUiVisibility())}areStatesEqual(z,J){return z===J}refresh(z){let J=z,Q=this.params;this.params=J;let{source:Z,state:$,additionalEventAttributes:X}=J;if(Z==="colDef")this.updateParams(J,Q);let Y=this.state;this.state=$;let q=X?.fromAction;if(q&&q!=="apply"||$.model!==Y.model||!this.areStatesEqual($.state,Y.state))this.setModelIntoUi($.model);return!0}setParams(z){this.params=z,this.state=z.state,this.commonUpdateParams(z)}updateParams(z,J){this.commonUpdateParams(z,J)}commonUpdateParams(z,J){this.applyActive=n2(z),this.setupApplyDebounced()}doesFilterPass(z){R(283);let{getHandler:J,model:Q,column:Z}=this.params;return J().doesFilterPass({...z,model:Q,handlerParams:this.beans.colFilter.getHandlerParams(Z)})}getFilterTitle(){return this.translate(this.filterNameKey)}isFilterActive(){return R(284),this.params.model!=null}setupApplyDebounced(){let z=bZ(this.params,this.defaultDebounceMs),J=p0(this,this.checkApplyDebounce.bind(this),z);this.applyDebounced=()=>{this.debouncePending=!0,J()}}checkApplyDebounce(){if(this.debouncePending)this.debouncePending=!1,this.doApplyModel()}getModel(){return R(285),this.params.model}setModel(z){R(286);let{beans:J,params:Q}=this;return J.colFilter.setModelForColumnLegacy(Q.column,z)}applyModel(z="api"){return this.doApplyModel()}canApply(z){return!0}doApplyModel(z){let{params:J,state:{valid:Q=!0,model:Z}}=this;if(!Q)return!1;let $=!this.areModelsEqual(J.model,Z);if($)J.onAction("apply",z);return $}onNewRowsLoaded(){}onUiChanged(z,J=!1){this.updateUiVisibility();let Q=this.getModelFromUi(),Z={model:Q,state:this.getState(),valid:this.canApply(Q)};this.state=Z;let{params:$,gos:X,eventSvc:Y,applyActive:q}=this;if($.onStateChange(Z),$.onUiChange(this.getUiChangeEventParams()),!X.get("enableFilterHandlers"))Y.dispatchEvent({type:"filterModified",column:$.column,filterInstance:this});if(!Z.valid)return;if(z??(z=q?void 0:"debounce"),z==="immediately")this.doApplyModel({afterFloatingFilter:J,afterDataChange:!1});else if(z==="debounce")this.applyDebounced()}getState(){return}getUiChangeEventParams(){return}afterGuiAttached(z){this.lastContainerType=z?.container,this.refreshFilterResizer(z?.container)}refreshFilterResizer(z){let{positionableFeature:J,gos:Q}=this;if(!J)return;let Z=z==="floatingFilter"||z==="columnFilter";if(Z)J.restoreLastSize(),J.setResizable(Q.get("enableRtl")?{bottom:!0,bottomLeft:!0,left:!0}:{bottom:!0,bottomRight:!0,right:!0});else J.removeSizeFromEl(),J.setResizable(!1);J.constrainSizeToAvailableHeight(Z)}afterGuiDetached(){this.checkApplyDebounce(),this.positionableFeature?.constrainSizeToAvailableHeight(!1)}destroy(){this.positionableFeature=this.destroyBean(this.positionableFeature),super.destroy()}translate(z,J){return f4(this,z,J)}getPositionableElement(){return this.getGui()}areModelsEqual(z,J){if(z===J||z==null&&J==null)return!0;if(z==null||J==null)return!1;return this.areNonNullModelsEqual(z,J)}};var yZ=class extends x0{isPopup(){return!0}setParentComponent(z){z.addCss("ag-has-popup"),super.setParentComponent(z)}destroy(){let z=this.parentComponent;if(z?.isAlive())z.getGui().classList.remove("ag-has-popup");super.destroy()}},z_=class extends yZ{constructor(){super(...arguments);this.errorMessages=null}init(z){this.params=z,this.initialiseEditor(z),this.eEditor.onValueChange(()=>z.validate())}destroy(){this.eEditor.destroy(),this.errorMessages=null,super.destroy()}};function xZ(z){let J=z.rowModel;return J.getType()==="clientSide"?J:void 0}var F7="row-group-",J_="t-",Q_="b-",Z_=0,j1=class{constructor(z){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=Z_++,this.alreadyRendered=!1,this.formulaRowIndex=null,this.hovered=!1,this.__selected=!1,this.beans=z}get groupData(){let z=this._groupData;if(z!==void 0)return z;if(this.footer)return this.sibling?.groupData;return this.beans.groupStage?.loadGroupData(this)??null}set groupData(z){this._groupData=z}get primaryRow(){let z=this.footer&&this.sibling?this.sibling:this,{pinnedSibling:J}=z;if(J&&z.rowPinned){if(z=J,z.footer&&z.sibling)z=z.sibling}return z}get allLeafChildren(){let z=this._leafs;return z===void 0?this.beans.groupStage?.loadLeafs?.(this)??null:z}set allLeafChildren(z){this._leafs=z}get expanded(){let z=this.beans.expansionSvc;return z?z.isExpanded(this):this.level===-1?!0:!!this._expanded}set expanded(z){this._expanded=z}setData(z){this.setDataCommon(z,!1)}updateData(z){this.setDataCommon(z,!0)}setDataCommon(z,J){let{valueCache:Q,eventSvc:Z}=this.beans,$=this.data;this.data=z,Q?.onDataChanged(),this.updateDataOnDetailNode(),this.resetQuickFilterAggregateText();let X=this.createDataChangedEvent(z,$,J);if(this.__localEventService?.dispatchEvent(X),this.sibling){this.sibling.data=z;let q=this.sibling.createDataChangedEvent(z,$,J);this.sibling.__localEventService?.dispatchEvent(q)}Z.dispatchEvent({type:"rowNodeDataChanged",node:this});let Y=this.pinnedSibling;if(Y)Y.data=z,Y.__localEventService?.dispatchEvent(Y.createDataChangedEvent(z,$,J)),Z.dispatchEvent({type:"rowNodeDataChanged",node:Y})}updateDataOnDetailNode(){let z=this.detailNode;if(z)z.data=this.data}createDataChangedEvent(z,J,Q){return{type:"dataChanged",node:this,oldData:J,newData:z,update:Q}}getRowIndexString(){if(this.rowIndex==null)return t(13),null;if(this.rowPinned==="top")return J_+this.rowIndex;if(this.rowPinned==="bottom")return Q_+this.rowIndex;return this.rowIndex.toString()}setDataAndId(z,J){let{selectionSvc:Q}=this.beans,Z=Q?.createDaemonNode?.(this),$=this.data;if(this.data=z,this.updateDataOnDetailNode(),this.setId(J),Q)Q.updateRowSelectable(this),Q.syncInRowNode(this,Z);let X=this.createDataChangedEvent(z,$,!1);this.__localEventService?.dispatchEvent(X)}setId(z){let J=bQ(this.beans.gos);if(J)if(this.data){let Q=this.parent?.getRoute()??[];if(this.id=J({data:this.data,parentKeys:Q.length>0?Q:void 0,level:this.level,rowPinned:this.rowPinned}),this.id.startsWith(F7))t(14,{groupPrefix:F7})}else this.id=void 0;else this.id=z}setRowTop(z){if(this.oldRowTop=this.rowTop,this.rowTop===z)return;this.rowTop=z,this.dispatchRowEvent("topChanged");let J=z!==null;if(this.displayed!==J)this.displayed=J,this.dispatchRowEvent("displayedChanged")}clearRowTopAndRowIndex(){this.oldRowTop=null,this.setRowTop(null),this.setRowIndex(null)}setHovered(z){this.hovered=z}isHovered(){return this.hovered}setRowHeight(z,J=!1){this.rowHeight=z,this.rowHeightEstimated=J,this.dispatchRowEvent("heightChanged")}setExpanded(z,J,Q){this.beans.expansionSvc?.setExpanded(this,z,J,Q)}setDataValue(z,J,Q){let{colModel:Z,valueSvc:$,gos:X,editSvc:Y}=this.beans;if(z==null)return!1;let q=Z.getCol(z)??Z.getColDefCol(z);if(!q)return!1;if(!this.group){let _=q.getColDef();if(_.pivotValueColumn)q=_.pivotValueColumn}let G=$.getValueForDisplay({column:q,node:this,from:"data"}).value;if(X.get("readOnlyEdit")){let{beans:{eventSvc:_},data:U,rowIndex:W,rowPinned:B}=this;return _.dispatchEvent({type:"cellEditRequest",event:null,rowIndex:W,rowPinned:B,column:q,colDef:q.colDef,data:U,node:this,oldValue:G,newValue:J,value:J,source:Q}),!1}if(Q!=="data"&&Y&&!Y.committing){let _=Y.setDataValue({rowNode:this,column:q},J,Q);if(_!=null)return _}let H=$.setValue(this,q,J,Q);if(this.dispatchCellChangedEvent(q,J,G),H)this.pinnedSibling?.dispatchCellChangedEvent(q,J,G);return H}getDataValue(z,J="data"){let{colModel:Q,valueSvc:Z,formula:$}=this.beans;if(z==null)return;let X=Q.getCol(z)??Q.getColDefCol(z);if(!X)return;let Y=J==="data-raw",q=Y||J==="value"?"data":J,G=Z.getValue(X,this,q,Y);if(!Y){if($&&X.isAllowFormula()&&$.isFormula(G))G=$.resolveValue(X,this);if(J!=="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 z=this.group&&!this.footer||!!this.childrenAfterGroup?.length,{rowChildrenSvc:J}=this.beans;if(J)z=J.getHasChildrenValue(this);if(z!==this.__hasChildren)this.__hasChildren=!!z,this.dispatchRowEvent("hasChildrenChanged")}hasChildren(){if(this.__hasChildren==null)this.updateHasChildren();return this.__hasChildren}dispatchCellChangedEvent(z,J,Q){let Z={type:"cellChanged",node:this,column:z,newValue:J,oldValue:Q};this.__localEventService?.dispatchEvent(Z)}resetQuickFilterAggregateText(){this.quickFilterAggregateText=null}isExpandable(){return this.beans.expansionSvc?.isExpandable(this)??!1}isSelected(){if(this.footer)return this.sibling.isSelected();let z=this.rowPinned&&this.pinnedSibling;if(z)return z.isSelected();return this.__selected}depthFirstSearch(z){let J=this.childrenAfterGroup;if(J)for(let Q=0,Z=J.length;Q{let Q=new j1(J);for(let Z of Object.keys(z)){if($_.has(Z))continue;Q[Z]=z[Z]}return Q.oldRowTop=null,Q},x9=(z,J,Q)=>{if(!Q)return;let Z=Q.rowIndex;if(Z==null)return;Z+=J;let $=z.getRowCount();while(Z>=0&&Z<$){let X=z.getRow(Z);if(!X||!X.footer&&!X.detail)return X;Z+=J}return};var X_=500,Y_=550,Yz,q_=(z)=>{if(!Yz)Yz=new WeakSet;else if(Yz.has(z))return!1;return Yz.add(z),!0},c0=class{constructor(z,J=!1){this.eElement=z,this.preventClick=J,this.startListener=null,this.handlers=[],this.eventSvc=void 0,this.touchStart=null,this.lastTapTime=null,this.longPressTimer=0,this.moved=!1}addEventListener(z,J){let Q=this.eventSvc;if(!Q){if(Q===null)return;this.eventSvc=Q=new R4;let Z=this.onTouchStart.bind(this);this.startListener=Z,this.eElement.addEventListener("touchstart",Z,{passive:!0})}Q.addEventListener(z,J)}removeEventListener(z,J){this.eventSvc?.removeEventListener(z,J)}onTouchStart(z){if(this.touchStart||!q_(z))return;let J=z.touches[0];this.touchStart=J;let Q=this.handlers;if(!Q.length){let Z=this.eElement,$=Z.ownerDocument,X=this.onTouchMove.bind(this),Y=this.onTouchEnd.bind(this),q=this.onTouchCancel.bind(this),G={passive:!0},H={passive:!1};Fz(Q,[Z,"touchmove",X,G],[$,"touchcancel",q,G],[$,"touchend",Y,H],[$,"contextmenu",k2,H])}this.clearLongPress(),this.longPressTimer=window.setTimeout(()=>{if(this.longPressTimer=0,this.touchStart===J&&!this.moved)this.moved=!0,this.eventSvc?.dispatchEvent({type:"longTap",touchStart:J,touchEvent:z})},Y_)}onTouchMove(z){let{moved:J,touchStart:Q}=this;if(!J&&Q){let Z=R2(Q,z.touches);if(Z&&!g8(Z,Q,4))this.clearLongPress(),this.moved=!0}}onTouchEnd(z){let J=this.touchStart;if(!J||!R2(J,z.changedTouches))return;if(!this.moved)this.eventSvc?.dispatchEvent({type:"tap",touchStart:J}),this.checkDoubleTap(J);if(this.preventClick)k2(z);this.cancel()}onTouchCancel(z){let J=this.touchStart;if(!J||!R2(J,z.changedTouches))return;this.lastTapTime=null,this.cancel()}checkDoubleTap(z){let J=Date.now(),Q=this.lastTapTime;if(Q){if(J-Q>X_)this.eventSvc?.dispatchEvent({type:"doubleTap",touchStart:z}),J=null}this.lastTapTime=J}cancel(){this.clearLongPress(),BZ(this.handlers),this.touchStart=null}clearLongPress(){window.clearTimeout(this.longPressTimer),this.longPressTimer=0,this.moved=!1}destroy(){let z=this.startListener;if(z)this.startListener=null,this.eElement.removeEventListener("touchstart",z);this.cancel(),this.eElement=null,this.eventSvc=null}},c4=((z)=>{return z[z.VALUE=0]="VALUE",z[z.DIMENSION=1]="DIMENSION",z})(c4||{}),G_=1,H_=class{constructor(z){if(this.beans={},this.createdBeans=[],this.destroyed=!1,this.instanceId=G_++,!z?.beanClasses)return;this.beanDestroyComparator=z.beanDestroyComparator,this.init(z)}init(z){this.id=z.id,this.beans.context=this,this.destroyCallback=z.destroyCallback;for(let J of Object.keys(z.providedBeanInstances))this.beans[J]=z.providedBeanInstances[J];for(let J of z.beanClasses){let Q=new J;if(Q.beanName)this.beans[Q.beanName]=Q;else console.error(`Bean ${J.name} is missing beanName`);this.createdBeans.push(Q)}for(let J of z.derivedBeans??[]){let{beanName:Q,bean:Z}=J(this);this.beans[Q]=Z,this.createdBeans.push(Z)}if(z.beanInitComparator)this.createdBeans.sort(z.beanInitComparator);this.initBeans(this.createdBeans)}getBeanInstances(){return Object.values(this.beans)}createBean(z,J){return this.initBeans([z],J),z}initBeans(z,J){let Q=this.beans;for(let Z of z)Z.preWireBeans?.(Q),Z.wireBeans?.(Q);for(let Z of z)Z.preConstruct?.();if(J)z.forEach(J);for(let Z of z)Z.postConstruct?.()}getBeans(){return this.beans}getBean(z){return this.beans[z]}getId(){return this.id}destroy(){if(this.destroyed)return;this.destroyed=!0;let z=this.getBeanInstances();if(this.beanDestroyComparator)z.sort(this.beanDestroyComparator);this.destroyBeans(z),this.beans={},this.createdBeans=[],this.destroyCallback?.()}destroyBean(z){z?.destroy?.()}destroyBeans(z){if(z)for(let J=0;J[z,J]));function W_(z,J){let Q=(z.beanName?L7[z.beanName]:void 0)??Number.MAX_SAFE_INTEGER,Z=(J.beanName?L7[J.beanName]:void 0)??Number.MAX_SAFE_INTEGER;return Q-Z}function B_(z,J){if(z?.beanName==="gridDestroySvc")return-1;if(J?.beanName==="gridDestroySvc")return 1;return 0}function p4(z){let{rowIndex:J,rowPinned:Q,column:Z}=z;return`${J}.${Q==null?"null":Q}.${Z.getId()}`}function t2(z,J){let Q=z.column===J.column,Z=z.rowPinned===J.rowPinned,$=z.rowIndex===J.rowIndex;return Q&&Z&&$}function U0(z,J){switch(z.rowPinned){case"top":if(J.rowPinned!=="top")return!0;break;case"bottom":if(J.rowPinned!=="bottom")return!1;break;default:if(T(J.rowPinned))return J.rowPinned!=="top";break}return z.rowIndexU.rowNode.rowIndex===J.rowIndex),G=q?X:Y,H=(Q?-1:1)*(q?-1:1),_;for(let U=0;U{if(!Z.defaultPrevented&&!D_(Z)&&Z.key===k.TAB){let $=Z.shiftKey;if(!P0(z,Q,!1,$)){if(_4(z,$))Z.preventDefault()}}}})}function D4(z){return z.gos.get("suppressHeaderFocus")||!!z.overlays?.exclusive}function Nz(z){return z.gos.get("suppressCellFocus")||!!z.overlays?.exclusive}function _4(z,J,Q=!1){let Z=z.ctrlsSvc.get("gridCtrl"),$=Z.focusNextInnerContainer(J);if($===!0)return!0;if($===!1)return $;if(Q||!J&&!Z.isDetailGrid()&&Z.isFocusInsideGridBody())Z.forceFocusOutOfContainer(J);return!1}function F_(z,J){let Q=z.focusSvc,Z=Q.getFocusedCell();if(Z&&J&&t2(Z,J)){let{rowIndex:$,rowPinned:X,column:Y}=J;if(f1(z))Q.setFocusedCell({rowIndex:$,column:Y,rowPinned:X,forceBrowserFocus:!0,preventScrollOnBrowserFocus:!d2()})}}function L_(z,J){let Q=z.getFocusableContainerName();if(Q==="gridBody")return J();return N9(z,()=>A4(z.getGui(),".ag-tab-guard").length>0)?Q:null}function N9(z,J){z.setAllowFocus?.(!0);try{return J()}finally{z.setAllowFocus?.(!1)}}var g9="__ag_Grid_Skip_Focusable_Container";function h9(z){z[g9]=!0}function D_(z){return z[g9]===!0}function u9(z){if(!z.cols)return-1;return z.cols.treeDepth+1}function Q4(z){return z.ctrlsSvc.getHeaderRowContainerCtrl()?.getRowCount()??0}function gZ(z){let J=[],Q=z.ctrlsSvc.getHeaderRowContainerCtrls();for(let Z of Q){if(!Z)continue;let $=Z.getGroupRowCount()||0;for(let X=0;X<$;X++){let Y=Z.getGroupRowCtrlAtIndex(X),q=J[X];if(Y){let G=M_(z,Y);if(q==null||G>q)J[X]=G}}}return J}function M_(z,J){let Z=z.colModel.isPivotMode()?f_(z):c9(z),$=J.getHeaderCellCtrls();for(let X of $){let{column:Y}=X,q=Y.getAutoHeaderHeight();if(q!=null&&q>Z&&Y.isAutoHeaderHeight())Z=q}return Z}function hZ(z){let Q=z.colModel.isPivotMode()?k_(z):HJ(z);return z.colModel.forAllCols((Z)=>{let $=Z.getAutoHeaderHeight();if($!=null&&$>Q&&Z.isAutoHeaderHeight())Q=$}),Q}function HJ(z){return z.gos.get("headerHeight")??z.environment.getDefaultHeaderHeight()}function m9(z){return z.gos.get("floatingFiltersHeight")??HJ(z)}function c9(z){return z.gos.get("groupHeaderHeight")??HJ(z)}function k_(z){return z.gos.get("pivotHeaderHeight")??HJ(z)}function f_(z){return z.gos.get("pivotGroupHeaderHeight")??c9(z)}function V_(z,J){return z.headerRowIndex===J.headerRowIndex&&z.column===J.column}function S_(z){return z?.headerRowIndex!=null}var A_=class extends V{setComp(z,J,Q){this.comp=z,this.eGui=J;let{beans:Z}=this,{headerNavigation:$,touchSvc:X,ctrlsSvc:Y}=Z;if($)this.createManagedBean(new a4(Q,{onTabKeyDown:this.onTabKeyDown.bind(this),handleKeyDown:this.handleKeyDown.bind(this),onFocusOut:this.onFocusOut.bind(this)}));this.addManagedEventListeners({columnPivotModeChanged:this.onPivotModeChanged.bind(this,Z),displayedColumnsChanged:this.onDisplayedColumnsChanged.bind(this,Z)}),this.onPivotModeChanged(Z),this.setupHeaderHeight();let q=this.onHeaderContextMenu.bind(this);this.addManagedElementListeners(this.eGui,{contextmenu:q}),X?.mockHeaderContextMenu(this,q),Y.register("gridHeaderCtrl",this)}setupHeaderHeight(){let z=this.setHeaderHeight.bind(this);z(),this.addManagedPropertyListeners(["headerHeight","pivotHeaderHeight","groupHeaderHeight","pivotGroupHeaderHeight","floatingFiltersHeight"],z),this.addManagedEventListeners({headerRowsChanged:z,columnHeaderHeightChanged:z,columnGroupHeaderHeightChanged:()=>W4(this.beans,()=>z()),stylesChanged:z,advancedFilterEnabledChanged:z})}setHeaderHeight(){let{beans:z}=this,J=0,Q=gZ(z).reduce((Y,q)=>Y+q,0),Z=hZ(z);if(z.filterManager?.hasFloatingFilters())J+=m9(z);J+=Q,J+=Z;let $=z.environment.getHeaderRowBorderWidth(),X=J+$;if(this.headerHeightWithBorder!==X){this.headerHeightWithBorder=X;let Y=`${X}px`;this.comp.setHeightAndMinHeight(Y)}if(this.headerHeight!==J)this.headerHeight=J,this.eventSvc.dispatchEvent({type:"headerHeightChanged"})}onPivotModeChanged(z){let J=z.colModel.isPivotMode();this.comp.toggleCss("ag-pivot-on",J),this.comp.toggleCss("ag-pivot-off",!J)}onDisplayedColumnsChanged(z){let Q=z.visibleCols.allCols.some((Z)=>Z.isSpanHeaderHeight());this.comp.toggleCss("ag-header-allow-overflow",Q)}onTabKeyDown(z){let J=this.gos.get("enableRtl"),Q=z.shiftKey,Z=Q!==J?"LEFT":"RIGHT",{beans:$}=this,{headerNavigation:X,focusSvc:Y}=$;if(X.navigateHorizontally(Z,!0,z)||!Q&&Y.focusOverlay(!1)||_4($,Q,!0))z.preventDefault()}handleKeyDown(z){let J=null,{headerNavigation:Q}=this.beans;switch(z.key){case k.LEFT:J="LEFT";case k.RIGHT:{if(!T(J))J="RIGHT";if(Q.navigateHorizontally(J,!1,z))z.preventDefault();break}case k.UP:J="UP";case k.DOWN:{if(!T(J))J="DOWN";if(Q.navigateVertically(J,z))z.preventDefault();break}default:return}}onFocusOut(z){let{relatedTarget:J}=z,{eGui:Q,beans:Z}=this;if(!J&&Q.contains(d(Z)))return;if(!Q.contains(J))Z.focusSvc.focusedHeader=null}onHeaderContextMenu(z,J,Q){let{menuSvc:Z,ctrlsSvc:$}=this.beans;if(!z&&!Q||!Z?.isHeaderContextMenuEnabled())return;let{target:X}=z??J;if(X===this.eGui||X===$.getHeaderRowContainerCtrl()?.eViewport)Z.showHeaderContextMenu(void 0,z,Q)}},uZ=class extends y{constructor(z,J){super(z);this.ctrl=J}getCtrl(){return this.ctrl}},R_={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"}]},j_=class extends uZ{constructor(z){super(R_,z);this.eResize=j,this.eHeaderCompWrapper=j,this.headerCompVersion=0}postConstruct(){let z=this.getGui(),J=()=>{let Z=this.ctrl.getSelectAllGui();if(Z)this.eResize.insertAdjacentElement("afterend",Z),this.addDestroyFunc(()=>Z.remove())},Q={setWidth:(Z)=>z.style.width=Z,toggleCss:(Z,$)=>this.toggleCss(Z,$),setUserStyles:(Z)=>C6(z,Z),setAriaSort:(Z)=>Z?QG(z,Z):ZG(z),setUserCompDetails:(Z)=>this.setUserCompDetails(Z),getUserCompInstance:()=>this.headerComp,refreshSelectAllGui:J,removeSelectAllGui:()=>this.ctrl.getSelectAllGui()?.remove()};this.ctrl.setComp(Q,this.getGui(),this.eResize,this.eHeaderCompWrapper,void 0),J()}destroy(){this.destroyHeaderComp(),super.destroy()}destroyHeaderComp(){if(this.headerComp)this.headerCompGui?.remove(),this.headerComp=this.destroyBean(this.headerComp),this.headerCompGui=void 0}setUserCompDetails(z){this.headerCompVersion++;let J=this.headerCompVersion;z.newAgStackInstance().then((Q)=>this.afterCompCreated(J,Q))}afterCompCreated(z,J){if(z!=this.headerCompVersion||!this.isAlive()){this.destroyBean(J);return}this.destroyHeaderComp(),this.headerComp=J,this.headerCompGui=J.getGui(),this.eHeaderCompWrapper.appendChild(this.headerCompGui),this.ctrl.setDragSource(this.getGui())}},O_={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"}]},P_=class extends uZ{constructor(z){super(O_,z);this.eResize=j,this.eHeaderCompWrapper=j}postConstruct(){let z=this.getGui(),J=(Z,$)=>$!=null?z.setAttribute(Z,$):z.removeAttribute(Z),Q={toggleCss:(Z,$)=>this.toggleCss(Z,$),setUserStyles:(Z)=>C6(z,Z),setHeaderWrapperHidden:(Z)=>{if(Z)this.eHeaderCompWrapper.style.setProperty("display","none");else this.eHeaderCompWrapper.style.removeProperty("display")},setHeaderWrapperMaxHeight:(Z)=>{if(Z!=null)this.eHeaderCompWrapper.style.setProperty("max-height",`${Z}px`);else this.eHeaderCompWrapper.style.removeProperty("max-height");this.eHeaderCompWrapper.classList.toggle("ag-header-cell-comp-wrapper-limited-height",Z!=null)},setResizableDisplayed:(Z)=>w(this.eResize,Z),setWidth:(Z)=>z.style.width=Z,setAriaExpanded:(Z)=>J("aria-expanded",Z),setUserCompDetails:(Z)=>this.setUserCompDetails(Z),getUserCompInstance:()=>this.headerGroupComp};this.ctrl.setComp(Q,z,this.eResize,this.eHeaderCompWrapper,void 0)}setUserCompDetails(z){z.newAgStackInstance().then((J)=>this.afterHeaderCompCreated(J))}afterHeaderCompCreated(z){let J=()=>this.destroyBean(z);if(!this.isAlive()){J();return}let Q=this.getGui(),Z=z.getGui();this.eHeaderCompWrapper.appendChild(Z),this.addDestroyFunc(J),this.headerGroupComp=z,this.ctrl.setDragSource(Q)}},T_={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 uZ{constructor(z){super(T_,z);this.eFloatingFilterBody=j,this.eButtonWrapper=j,this.eButtonShowMainFilter=j}postConstruct(){let z=this.getGui(),J={toggleCss:(Q,Z)=>this.toggleCss(Q,Z),setUserStyles:(Q)=>C6(z,Q),addOrRemoveBodyCssClass:(Q,Z)=>this.eFloatingFilterBody.classList.toggle(Q,Z),setButtonWrapperDisplayed:(Q)=>w(this.eButtonWrapper,Q),setCompDetails:(Q)=>this.setCompDetails(Q),getFloatingFilterComp:()=>this.compPromise,setWidth:(Q)=>z.style.width=Q,setMenuIcon:(Q)=>this.eButtonShowMainFilter.appendChild(Q)};this.ctrl.setComp(J,z,this.eButtonShowMainFilter,this.eFloatingFilterBody,void 0)}setCompDetails(z){if(!z){this.destroyFloatingFilterComp(),this.compPromise=null;return}this.compPromise=z.newAgStackInstance(),this.compPromise.then((J)=>this.afterCompCreated(J))}destroy(){this.destroyFloatingFilterComp(),super.destroy()}destroyFloatingFilterComp(){this.floatingFilterComp?.getGui().remove(),this.floatingFilterComp=this.destroyBean(this.floatingFilterComp)}afterCompCreated(z){if(!z)return;if(!this.isAlive()){this.destroyBean(z);return}this.destroyFloatingFilterComp(),this.floatingFilterComp=z,this.eFloatingFilterBody.appendChild(z.getGui()),z.afterGuiAttached?.()}},I_=class extends y{constructor(z){super({tag:"div",cls:z.headerRowClass,role:"row"});this.ctrl=z,this.headerComps={}}postConstruct(){this.getGui().setAttribute("tabindex",String(this.gos.get("tabIndex"))),jz(this.getGui(),this.ctrl.getAriaRowIndex());let J={setHeight:(Q)=>this.getGui().style.height=Q,setTop:(Q)=>this.getGui().style.top=Q,setHeaderCtrls:(Q,Z)=>this.setHeaderCtrls(Q,Z),setWidth:(Q)=>this.getGui().style.width=Q,setRowIndex:(Q)=>jz(this.getGui(),Q)};this.ctrl.setComp(J,void 0)}destroy(){this.setHeaderCtrls([],!1),super.destroy()}setHeaderCtrls(z,J){if(!this.isAlive())return;let Q=this.headerComps;this.headerComps={};for(let Z of z){let $=Z.instanceId,X=Q[$];if(delete Q[$],X==null)X=this.createHeaderComp(Z),this.getGui().appendChild(X.getGui());this.headerComps[$]=X}if(Object.values(Q).forEach((Z)=>{Z.getGui().remove(),this.destroyBean(Z)}),J){let Z=Object.values(this.headerComps);Z.sort((X,Y)=>{let q=X.getCtrl().column.getLeft(),G=Y.getCtrl().column.getLeft();return q-G});let $=Z.map((X)=>X.getGui());x8(this.getGui(),$)}}createHeaderComp(z){let J;switch(this.ctrl.type){case"group":J=new P_(z);break;case"filter":J=new v_(z);break;default:J=new j_(z);break}return this.createBean(J),J.setParentComponent(this),J}},mZ=class extends V{constructor(z,J=!1){super();this.callback=z,this.addSpacer=J}postConstruct(){let z=this.setWidth.bind(this);if(this.addManagedPropertyListener("domLayout",z),this.addManagedEventListeners({columnContainerWidthChanged:z,displayedColumnsChanged:z,leftPinnedWidthChanged:z}),this.addSpacer)this.addManagedEventListeners({rightPinnedWidthChanged:z,scrollVisibilityChanged:z,scrollbarWidthChanged:z});this.setWidth()}setWidth(){let z=A0(this.gos,"print"),{visibleCols:J,scrollVisibleSvc:Q}=this.beans,Z=J.bodyWidth,$=J.getColsLeftWidth(),X=J.getDisplayedColumnsRightWidth(),Y;if(z)Y=Z+$+X;else if(Y=Z,this.addSpacer){if((this.gos.get("enableRtl")?$:X)===0&&Q.verticalScrollShowing)Y+=Q.getScrollbarWidth()}this.callback(Y)}};function u6(z,J,Q){if(Q)z.addDestroyFunc(()=>J.destroyBean(Q));return Q??z}var cZ=class extends V{constructor(z,J,Q,Z){super();this.columnOrGroup=z,this.eCell=J,this.colsSpanning=Z,this.columnOrGroup=z,this.ariaEl=J.querySelector("[role=columnheader]")||J,this.beans=Q}setColsSpanning(z){this.colsSpanning=z,this.onLeftChanged()}getColumnOrGroup(){let{beans:z,colsSpanning:J}=this;if(z.gos.get("enableRtl")&&J)return b(J);return this.columnOrGroup}postConstruct(){let z=this.onLeftChanged.bind(this);this.addManagedListeners(this.columnOrGroup,{leftChanged:z}),this.setLeftFirstTime(),this.addManagedEventListeners({displayedColumnsWidthChanged:z}),this.addManagedPropertyListener("domLayout",z)}setLeftFirstTime(){let{gos:z,colAnimation:J}=this.beans,Q=z.get("suppressColumnMoveAnimation"),Z=T(this.columnOrGroup.getOldLeft());if(J?.isActive()&&Z&&!Q)this.animateInLeft();else this.onLeftChanged()}animateInLeft(){let z=this.getColumnOrGroup(),J=this.modifyLeftForPrintLayout(z,z.getOldLeft()),Q=this.modifyLeftForPrintLayout(z,z.getLeft());this.setLeft(J),this.actualLeft=Q,this.beans.colAnimation.executeNextVMTurn(()=>{if(this.actualLeft===Q)this.setLeft(Q)})}onLeftChanged(){let z=this.getColumnOrGroup(),J=z.getLeft();this.actualLeft=this.modifyLeftForPrintLayout(z,J),this.setLeft(this.actualLeft)}modifyLeftForPrintLayout(z,J){let{gos:Q,visibleCols:Z}=this.beans;if(!A0(Q,"print"))return J;if(z.getPinned()==="left")return J;let X=Z.getColsLeftWidth();if(z.getPinned()==="right"){let Y=Z.bodyWidth;return X+Y+J}return X+J}setLeft(z){if(T(z))this.eCell.style.left=`${z}px`;if(W0(this.columnOrGroup)){let J=this.columnOrGroup.getLeafColumns();if(!J.length)return;if(J.length>1)JG(this.ariaEl,J.length)}}},C_="ag-column-first",b_="ag-column-last";function _J(z,J,Q,Z){if(n(z))return[];return i9(z.headerClass,z,J,Q,Z)}function UJ(z,J,Q,Z){if(n(z))return[];return i9(z.toolPanelClass,z,J,Q,Z)}function p9(z,J,Q){z.toggleCss(C_,Q.isColAtEdge(J,"first")),z.toggleCss(b_,Q.isColAtEdge(J,"last"))}function y_(z,J,Q,Z){return C(J,{colDef:z,column:Q,columnGroup:Z})}function i9(z,J,Q,Z,$){if(n(z))return[];let X;if(typeof z==="function"){let Y=y_(J,Q,Z,$);X=z(Y)}else X=z;if(typeof X==="string")return[X];if(Array.isArray(X))return[...X];return[]}var x_=0,d9="headerCtrl",pZ=class extends V{constructor(z,J){super();this.column=z,this.rowCtrl=J,this.resizeToggleTimeout=0,this.resizeMultiplier=1,this.resizeFeature=null,this.lastFocusEvent=null,this.dragSource=null,this.reAttemptToFocus=!1,this.instanceId=z.getUniqueId()+"-"+x_++}postConstruct(){let z=this.refreshTabIndex.bind(this);this.addManagedPropertyListeners(["suppressHeaderFocus"],z),this.addManagedEventListeners({overlayExclusiveChanged:z})}setComp(z,J,Q,Z,$){if(J.setAttribute("col-id",this.column.colIdSanitised),this.wireComp(z,J,Q,Z,$),this.reAttemptToFocus)this.reAttemptToFocus=!1,this.focus(this.lastFocusEvent??void 0)}shouldStopEventPropagation(z){let{headerRowIndex:J,column:Q}=this.beans.focusSvc.focusedHeader,Z=Q.getDefinition(),$=Z?.suppressHeaderKeyboardEvent;if(!T($))return!1;let X=C(this.gos,{colDef:Z,column:Q,headerRowIndex:J,event:z});return!!$(X)}getWrapperHasFocus(){return d(this.beans)===this.eGui}setGui(z,J){this.eGui=z,this.addDomData(J),J.addManagedListeners(this.beans.eventSvc,{displayedColumnsChanged:this.onDisplayedColumnsChanged.bind(this)}),J.addManagedElementListeners(this.eGui,{focus:this.onGuiFocus.bind(this)}),this.onDisplayedColumnsChanged(),this.refreshTabIndex()}refreshHeaderStyles(){let z=this.column.getDefinition();if(!z)return;let{headerStyle:J}=z,Q;if(typeof J==="function"){let Z=this.getHeaderClassParams();Q=J(Z)}else Q=J;if(Q)this.comp.setUserStyles(Q)}onGuiFocus(){this.eventSvc.dispatchEvent({type:"headerFocused",column:this.column})}setupAutoHeight(z){let{wrapperElement:J,checkMeasuringCallback:Q,compBean:Z}=z,{beans:$}=this,X=(U)=>{if(!this.isAlive()||!Z.isAlive())return;let{paddingTop:W,paddingBottom:B,borderBottomWidth:E,borderTopWidth:K}=p2(this.eGui),F=W+B+E+K,D=J.offsetHeight+F;if(U<5){let f=!Y0($)?.contains(J),S=D==0;if(f||S){TQ(()=>X(U+1),"raf",$);return}}this.setColHeaderHeight(this.column,D)},Y=!1,q,G=()=>{let U=this.column.isAutoHeaderHeight();if(U&&!Y)H();if(!U&&Y)_()},H=()=>{Y=!0,this.comp.toggleCss("ag-header-cell-auto-height",!0),X(0),q=P4(this.beans,J,()=>X(0))},_=()=>{if(Y=!1,q)q();this.comp.toggleCss("ag-header-cell-auto-height",!1),q=void 0};if(G(),Z.addDestroyFunc(()=>_()),Z.addManagedListeners(this.column,{widthChanged:()=>Y&&X(0)}),Z.addManagedEventListeners({sortChanged:()=>{if(Y)window.setTimeout(()=>X(0))}}),Q)Q(G)}onDisplayedColumnsChanged(){let{comp:z,column:J,beans:Q,eGui:Z}=this;if(!z||!J||!Z)return;p9(z,J,Q.visibleCols),P8(Z,Q.visibleCols.getAriaColIndex(J))}addResizeAndMoveKeyboardListeners(z){z.addManagedListeners(this.eGui,{keydown:this.onGuiKeyDown.bind(this),keyup:this.onGuiKeyUp.bind(this)})}refreshTabIndex(){let z=D4(this.beans);if(this.eGui)V4(this.eGui,"tabindex",z?null:"-1")}onGuiKeyDown(z){let J=d(this.beans),Q=z.key===k.LEFT||z.key===k.RIGHT;if(this.isResizing)z.preventDefault(),z.stopImmediatePropagation();if(J!==this.eGui||!z.shiftKey&&!z.altKey&&!z.ctrlKey&&!z.metaKey)return;if(this.isResizing||Q)z.preventDefault(),z.stopImmediatePropagation();if((z.ctrlKey||z.metaKey)&&k9(z)===k.C)return this.beans.clipboardSvc?.copyToClipboard();if(!Q)return;let X=z.key===k.LEFT!==this.gos.get("enableRtl")?"left":"right";if(z.altKey){this.isResizing=!0,this.resizeMultiplier+=1;let Y=this.getViewportAdjustedResizeDiff(z);this.resizeHeader(Y,z.shiftKey),this.resizeFeature?.toggleColumnResizing(!0)}else this.moveHeader(X)}moveHeader(z){this.beans.colMoves?.moveHeader(z,this.eGui,this.column,this.rowCtrl.pinned,this)}getViewportAdjustedResizeDiff(z){let J=this.getResizeDiff(z),{pinnedCols:Q}=this.beans;return Q?Q.getHeaderResizeDiff(J,this.column):J}getResizeDiff(z){let{gos:J,column:Q}=this,Z=z.key===k.LEFT!==J.get("enableRtl"),$=Q.getPinned(),X=J.get("enableRtl");if($){if(X!==($==="right"))Z=!Z}return(Z?-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(z){let J=this.getWrapperHasFocus();switch(z.key){case k.PAGE_DOWN:case k.PAGE_UP:case k.PAGE_HOME:case k.PAGE_END:if(J)z.preventDefault()}}addDomData(z){let J=d9,{eGui:Q,gos:Z}=this;l1(Z,Q,J,this),z.addDestroyFunc(()=>l1(Z,Q,J,null))}focus(z){if(!this.isAlive())return!1;let{eGui:J}=this;if(!J)this.reAttemptToFocus=!0;else this.lastFocusEvent=z||null,J.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,J,Q){let Z=z??J,{menuSvc:$,gos:X}=this.beans;if(X.get("preventDefaultOnContextMenu"))Z.preventDefault();if($?.isHeaderContextMenuEnabled(Q))$.showHeaderContextMenu(Q,z,J);this.dispatchColumnMouseEvent("columnHeaderContextMenu",Q)}dispatchColumnMouseEvent(z,J){this.eventSvc.dispatchEvent({type:z,column:J})}setColHeaderHeight(z,J){if(!z.setAutoHeaderHeight(J))return;let{eventSvc:Q}=this;if(z.isColumn)Q.dispatchEvent({type:"columnHeaderHeightChanged",column:z,columns:[z],source:"autosizeColumnHeaderHeight"});else Q.dispatchEvent({type:"columnGroupHeaderHeightChanged",columnGroup:z,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}},w_=class extends pZ{constructor(){super(...arguments);this.refreshFunctions={},this.userHeaderClasses=new Set,this.ariaDescriptionProperties=new Map}wireComp(z,J,Q,Z,$){this.comp=z;let{rowCtrl:X,column:Y,beans:q}=this,{colResize:G,context:H,colHover:_,rangeSvc:U}=q,W=u6(this,H,$);if(this.setGui(J,W),this.updateState(),this.setupWidth(W),this.setupMovingCss(W),this.setupMenuClass(W),this.setupSortableClass(W),this.setupWrapTextClass(),this.refreshSpanHeaderHeight(),this.setupAutoHeight({wrapperElement:Z,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,z,this));else w(Q,!1);_?.createHoverFeature(W,[Y],J),U?.createRangeHighlightFeature(W,Y,z),W.createManagedBean(new cZ(Y,J,q)),W.createManagedBean(new a4(J,{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,J){this.beans.colResize?.resizeHeader(this.column,z,J)}getHeaderClassParams(){let{column:z,beans:J}=this,Q=z.colDef;return C(J.gos,{colDef:Q,column:z,floatingFilter:!1})}setupUserComp(){let z=this.lookupUserCompDetails();if(z)this.setCompDetails(z)}setCompDetails(z){this.userCompDetails=z,this.comp.setUserCompDetails(z)}lookupUserCompDetails(){let z=this.createParams(),J=this.column.getColDef();return wH(this.beans.userCompFactory,J,z)}createParams(){let{menuSvc:z,sortSvc:J,colFilter:Q,gos:Z}=this.beans;return C(Z,{column:this.column,displayName:this.displayName,enableSorting:this.column.isSortable(),enableMenu:this.menuEnabled,enableFilterButton:this.openFilterEnabled&&!!z?.isHeaderFilterButtonEnabled(this.column),enableFilterIcon:!!Q&&(!this.openFilterEnabled||B0(this.gos)),showColumnMenu:(X,Y)=>{z?.showColumnMenu({column:this.column,buttonElement:X,positionBy:"button",onClosedCallback:Y})},showColumnMenuAfterMouseClick:(X,Y)=>{z?.showColumnMenu({column:this.column,mouseEvent:X,positionBy:"mouse",onClosedCallback:Y})},showFilter:(X)=>{z?.showFilterMenu({column:this.column,buttonElement:X,containerType:"columnFilter",positionBy:"button"})},progressSort:(X)=>{J?.progressSort(this.column,!!X,"uiColumnSorted")},setSort:(X,Y)=>{J?.setSortForColumn(this.column,Z4(X),!!Y,"uiColumnSorted")},eGridHeader:this.eGui,setTooltip:(X,Y)=>{Z.assertModuleRegistered("Tooltip",3),this.setupTooltip(X,Y)}})}setupSelectAll(z){let{selectionSvc:J}=this.beans;if(!J)return;this.selectAllFeature=z.createOptionalManagedBean(J.createSelectAllFeature(this.column)),this.selectAllFeature?.setComp(this),z.addManagedPropertyListener("rowSelection",()=>{let Q=J.createSelectAllFeature(this.column);if(Q&&!this.selectAllFeature)this.selectAllFeature=z.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(z){if(super.handleKeyDown(z),z.key===k.SPACE)this.selectAllFeature?.onSpaceKeyDown(z);else if(z.key===k.ENTER)this.onEnterKeyDown(z);else if(z.key===k.DOWN&&z.altKey)this.showMenuOnKeyPress(z,!1)}onEnterKeyDown(z){let{column:J,gos:Q,sortable:Z,beans:$}=this,X=!1;if(z.ctrlKey||z.metaKey)X=this.showMenuOnKeyPress(z,!0);if(!X){if(!z.altKey&&E1(Q))$.rangeSvc?.handleColumnSelection(J,z);else if(Z)$.sortSvc?.progressSort(J,z.shiftKey,"uiColumnSorted")}}showMenuOnKeyPress(z,J){let Q=this.comp.getUserCompInstance();if(!D7(Q))return!1;if(Q.onMenuKeyboardShortcut(J))return z.preventDefault(),!0;return!1}onFocusIn(z){if(!this.eGui.contains(z.relatedTarget))this.focusThis(),this.announceAriaDescription();if(d2())this.setActiveHeader(!0)}onFocusOut(z){if(this.eGui.contains(z.relatedTarget))return;this.setActiveHeader(!1)}setupTooltip(z,J){this.tooltipFeature=this.beans.tooltipSvc?.setupHeaderTooltip(this.tooltipFeature,this,z,J)}setupStylesFromColDef(){this.setRefreshFunction("headerStyles",this.refreshHeaderStyles.bind(this)),this.refreshHeaderStyles()}setupClassesFromColDef(){let z=()=>{let J=this.column.getColDef(),Q=_J(J,this.gos,this.column,null),Z=this.userHeaderClasses;this.userHeaderClasses=new Set(Q);for(let $ of Q)if(Z.has($))Z.delete($);else this.comp.toggleCss($,!0);for(let $ of Z)this.comp.toggleCss($,!1)};this.setRefreshFunction("headerClasses",z),z()}setDragSource(z){if(this.dragSourceElement=z,this.removeDragSource(),!z||!this.draggable)return;this.dragSource=this.beans.colMoves?.setDragSourceForHeader(z,this.column,this.displayName)??null}updateState(){let{menuSvc:z}=this.beans;this.menuEnabled=!!z?.isColumnMenuInHeaderEnabled(this.column),this.openFilterEnabled=!!z?.isFilterMenuInHeaderEnabled(this.column),this.sortable=this.column.isSortable(),this.displayName=this.calculateDisplayName(),this.draggable=this.workOutDraggable()}setRefreshFunction(z,J){this.refreshFunctions[z]=J}refresh(){this.updateState(),this.refreshHeaderComp(),this.refreshAria();for(let z of Object.values(this.refreshFunctions))z()}refreshHeaderComp(){let z=this.lookupUserCompDetails();if(!z)return;if(this.comp.getUserCompInstance()!=null&&this.userCompDetails.componentClass==z.componentClass?this.attemptHeaderCompRefresh(z.params):!1)this.setDragSource(this.dragSourceElement);else this.setCompDetails(z)}attemptHeaderCompRefresh(z){let J=this.comp.getUserCompInstance();if(!J)return!1;if(!J.refresh)return!1;return J.refresh(z)}calculateDisplayName(){return this.beans.colNames.getDisplayNameForColumn(this.column,"header",!0)}checkDisplayName(){if(this.displayName!==this.calculateDisplayName())this.refresh()}workOutDraggable(){let z=this.column.getColDef();return!this.gos.get("suppressMovableColumns")&&!z.suppressMovable&&!z.lockPosition||!!z.enableRowGroup||!!z.enablePivot}setupWidth(z){let J=()=>{let Q=this.column.getActualWidth();this.comp.setWidth(`${Q}px`)};z.addManagedListeners(this.column,{widthChanged:J}),J()}setupMovingCss(z){let J=()=>{this.comp.toggleCss("ag-header-cell-moving",this.column.isMoving())};z.addManagedListeners(this.column,{movingChanged:J}),J()}setupMenuClass(z){let J=()=>{this.comp?.toggleCss("ag-column-menu-visible",this.column.isMenuVisible())};z.addManagedListeners(this.column,{menuVisibleChanged:J}),J()}setupSortableClass(z){let J=()=>{this.comp.toggleCss("ag-header-cell-sortable",!!this.sortable)};J(),this.setRefreshFunction("updateSortable",J),z.addManagedEventListeners({sortChanged:this.refreshAriaSort.bind(this)})}setupFilterClass(z){let J=()=>{let Q=this.column.isFilterActive();this.comp.toggleCss("ag-header-cell-filtered",Q),this.refreshAria()};z.addManagedListeners(this.column,{filterActiveChanged:J}),J()}setupWrapTextClass(){let z=()=>{let J=!!this.column.getColDef().wrapHeaderText;this.comp.toggleCss("ag-header-cell-wrap-text",J)};z(),this.setRefreshFunction("wrapText",z)}onHeaderHighlightChanged(){let z=this.column.getHighlighted(),J=z===0,Q=z===1;this.comp.toggleCss("ag-header-highlight-before",J),this.comp.toggleCss("ag-header-highlight-after",Q)}onDisplayedColumnsChanged(){if(super.onDisplayedColumnsChanged(),!this.isAlive())return;this.onHeaderHeightChanged()}onHeaderHeightChanged(){this.refreshSpanHeaderHeight()}refreshSpanHeaderHeight(){let{eGui:z,column:J,comp:Q,beans:Z}=this,$=gZ(this.beans),X=$.reduce((W,B)=>W+B,0)===0;if(Q.toggleCss("ag-header-parent-hidden",X),!J.isSpanHeaderHeight()){z.style.removeProperty("top"),z.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=hZ(Z);if(Y===0){Q.toggleCss("ag-header-span-total",!1),z.style.setProperty("top","0px"),z.style.setProperty("height",`${G}px`);return}Q.toggleCss("ag-header-span-total",q);let H=(this.column.getFirstRealParent()?.getLevel()??-1)+1,_=$.length-H,U=0;for(let W=0;W<_;W++)U+=$[$.length-1-W];z.style.setProperty("top",`${-U}px`),z.style.setProperty("height",`${G+U}px`)}refreshAriaSort(){let z=null,{beans:J,column:Q,comp:Z,sortable:$}=this;if($){let X=this.getLocaleTextFunc(),Y=J.sortSvc?.getDisplaySortForColumn(Q)??null;Z.setAriaSort(rq(Y)),z=X("ariaSortableColumn","Press ENTER to sort")}else Z.setAriaSort();this.setAriaDescriptionProperty("sort",z)}refreshAriaMenu(){let z=null;if(this.menuEnabled)z=this.getLocaleTextFunc()("ariaMenuColumn","Press ALT DOWN to open column menu");this.setAriaDescriptionProperty("menu",z)}refreshAriaFilterButton(){let z=null,{openFilterEnabled:J,gos:Q}=this;if(J&&!B0(Q))z=this.getLocaleTextFunc()("ariaFilterColumn","Press CTRL ENTER to open filter");this.setAriaDescriptionProperty("filterButton",z)}refreshAriaFiltered(){let z=null;if(this.column.isFilterActive())z=this.getLocaleTextFunc()("ariaColumnFiltered","Column Filtered");this.setAriaDescriptionProperty("filter",z)}refreshAriaCellSelection(){let z=null,{gos:J,column:Q}=this;if(E1(J)&&!b0(Q))z=this.getLocaleTextFunc()("ariaColumnCellSelection","Press Enter to toggle selection for all visible cells in this column");this.setAriaDescriptionProperty("cellSelection",z)}setAriaDescriptionProperty(z,J){let Q=this.ariaDescriptionProperties;if(J!=null)Q.set(z,J);else Q.delete(z)}announceAriaDescription(){let{beans:z,eGui:J,ariaDescriptionProperties:Q}=this;if(!J.contains(d(z)))return;let Z=Array.from(Q.keys()).sort(($,X)=>$==="filter"?-1:X.charCodeAt(0)-$.charCodeAt(0)).map(($)=>Q.get($)).join(". ");z.ariaAnnounce?.announceValue(Z,"columnHeader")}refreshAria(){this.refreshAriaSort(),this.refreshAriaMenu(),this.refreshAriaFilterButton(),this.refreshAriaFiltered(),this.refreshAriaCellSelection()}addColumnHoverListener(z){this.beans.colHover?.addHeaderColumnHoverListener(z,this.comp,this.column)}addActiveHeaderMouseListeners(z){let J=($)=>this.handleMouseOverChange($.type==="mouseenter"),Q=()=>{this.setActiveHeader(!0),this.dispatchColumnMouseEvent("columnHeaderClicked",this.column)},Z=($)=>this.handleContextMenuMouseEvent($,void 0,this.column);z.addManagedListeners(this.eGui,{mouseenter:J,mouseleave:J,click:Q,contextmenu:Z})}handleMouseOverChange(z){this.setActiveHeader(z),this.eventSvc.dispatchEvent({type:z?"columnHeaderMouseOver":"columnHeaderMouseLeave",column:this.column})}setActiveHeader(z){this.comp.toggleCss("ag-header-active",z)}getAnchorElementForMenu(z){let J=this.comp.getUserCompInstance();if(D7(J))return J.getAnchorElementForMenu(z);return this.eGui}destroy(){this.tooltipFeature=this.destroyBean(this.tooltipFeature),super.destroy()}};function D7(z){return typeof z?.getAnchorElementForMenu==="function"&&typeof z.onMenuKeyboardShortcut==="function"}var N_=0,XQ=class extends V{constructor(z,J,Q){super();this.rowIndex=z,this.pinned=J,this.type=Q,this.instanceId=N_++,this.comp=null,this.allCtrls=[];let Z="ag-header-row-column";if(Q==="group")Z="ag-header-row-group";else if(Q==="filter")Z="ag-header-row-filter";this.headerRowClass=`ag-header-row ${Z}`}setRowIndex(z){this.rowIndex=z,this.comp?.setRowIndex(this.getAriaRowIndex()),this.onRowHeightChanged()}postConstruct(){this.isPrintLayout=A0(this.gos,"print"),this.isEnsureDomOrder=this.gos.get("ensureDomOrder")}areCellsRendered(){if(!this.comp)return!1;return this.allCtrls.every((z)=>z.eGui!=null)}setComp(z,J,Q=!0){if(this.comp=z,J=u6(this,this.beans.context,J),Q)this.setRowIndex(this.rowIndex),this.onVirtualColumnsChanged();this.setWidth(),this.addEventListeners(J)}getAriaRowIndex(){return this.rowIndex+1}addEventListeners(z){let J=this.onRowHeightChanged.bind(this),Q=this.onDisplayedColumnsChanged.bind(this);z.addManagedEventListeners({columnResized:this.setWidth.bind(this),displayedColumnsChanged:Q,virtualColumnsChanged:(Z)=>this.onVirtualColumnsChanged(Z.afterScroll),columnGroupHeaderHeightChanged:J,columnHeaderHeightChanged:J,stylesChanged:J,advancedFilterEnabledChanged:J}),z.addManagedPropertyListener("domLayout",Q),z.addManagedPropertyListener("ensureDomOrder",(Z)=>this.isEnsureDomOrder=Z.currentValue),z.addManagedPropertyListeners(["headerHeight","pivotHeaderHeight","groupHeaderHeight","pivotGroupHeaderHeight","floatingFiltersHeight"],J)}onDisplayedColumnsChanged(){this.isPrintLayout=A0(this.gos,"print"),this.onVirtualColumnsChanged(),this.setWidth(),this.onRowHeightChanged()}setWidth(){if(!this.comp)return;let z=this.getWidthForRow();this.comp.setWidth(`${z}px`)}getWidthForRow(){let{visibleCols:z}=this.beans;if(this.isPrintLayout){if(this.pinned!=null)return 0;return z.getContainerWidth("right")+z.getContainerWidth("left")+z.getContainerWidth(null)}return z.getContainerWidth(this.pinned)}onRowHeightChanged(){if(!this.comp)return;let{topOffset:z,rowHeight:J}=this.getTopAndHeight();this.comp.setTop(z+"px"),this.comp.setHeight(J+"px")}getTopAndHeight(){let z=0,J=gZ(this.beans);for(let $=0;${let{focusSvc:$,visibleCols:X}=this.beans;if(!$.isHeaderWrapperFocused(Z))return!1;return X.isVisible(Z.column)};if(z)for(let[Z,$]of z)if(Q($))this.ctrlsById.set(Z,$);else this.destroyBean($);return this.allCtrls=Array.from(this.ctrlsById.values()),this.allCtrls}getHeaderCellCtrls(){return this.allCtrls}recycleAndCreateHeaderCtrls(z,J,Q){if(z.isEmptyGroup())return;let Z=z.getUniqueId(),$;if(Q)$=Q.get(Z),Q.delete(Z);if($&&$.column!=z)this.destroyBean($),$=void 0;if($==null)switch(this.type){case"filter":{$=this.createBean(this.beans.registry.createDynamicBean("headerFilterCellCtrl",!0,z,this));break}case"group":$=this.createBean(this.beans.registry.createDynamicBean("headerGroupCellCtrl",!0,z,this));break;default:$=this.createBean(new w_(z,this));break}J.set(Z,$)}getColumnsInViewport(){if(!this.isPrintLayout)return this.getComponentsToRender();if(this.pinned)return[];let z=[];for(let J of["left",null,"right"])z.push(...this.getComponentsToRender(J));return z}getComponentsToRender(z=this.pinned){if(this.type==="group")return this.beans.colViewport.getHeadersToRender(z,this.rowIndex);return this.beans.colViewport.getColumnHeadersToRender(z)}focusHeader(z,J){let Q=this.allCtrls.find(($)=>$.column==z);if(!Q)return!1;return Q.focus(J)}destroy(){this.allCtrls=this.destroyBeans(this.allCtrls),this.ctrlsById=void 0,this.comp=null,super.destroy()}},g_=class extends V{constructor(z){super();this.pinned=z,this.hidden=!1,this.includeFloatingFilter=!1,this.groupsRowCtrls=[]}setComp(z,J){this.comp=z,this.eViewport=J;let{pinnedCols:Q,ctrlsSvc:Z,colModel:$,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(Z.register(q,this),$.ready)this.refresh()}getAllCtrls(){let z=[...this.groupsRowCtrls];if(this.columnsRowCtrl)z.push(this.columnsRowCtrl);if(this.filtersRowCtrl)z.push(this.filtersRowCtrl);return z}refresh(z=!1){let{focusSvc:J,filterManager:Q,visibleCols:Z}=this.beans,$=0,X=J.getFocusHeaderToUseAfterRefresh(),Y=()=>{let U=Z.headerGroupRowCount;if($=U,!z)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=$++;if(this.hidden){this.columnsRowCtrl=this.destroyBean(this.columnsRowCtrl);return}if(this.columnsRowCtrl==null||!z)this.columnsRowCtrl=this.destroyBean(this.columnsRowCtrl),this.columnsRowCtrl=this.createBean(new XQ(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(!z)U();let W=$++;if(this.filtersRowCtrl){if(this.filtersRowCtrl.rowIndex!==W)this.filtersRowCtrl.setRowIndex(W)}else this.filtersRowCtrl=this.createBean(new XQ(W,this.pinned,"filter"))},H=this.getAllCtrls();Y(),q(),G();let _=this.getAllCtrls();if(this.comp.setCtrls(_),this.restoreFocusOnHeader(J,X),H.length!==_.length)this.beans.eventSvc.dispatchEvent({type:"headerRowsChanged"})}getHeaderCtrlForColumn(z){let J=(Q)=>Q?.getHeaderCellCtrls().find((Z)=>Z.column===z);if(G4(z))return J(this.columnsRowCtrl);if(this.groupsRowCtrls.length===0)return;for(let Q=0;Qthis.comp.setCenterWidth(`${z}px`),!0))}},h_={tag:"div",cls:"ag-pinned-left-header",role:"rowgroup"},u_={tag:"div",cls:"ag-pinned-right-header",role:"rowgroup"},m_={tag:"div",cls:"ag-header-viewport",role:"rowgroup",attrs:{tabindex:"-1"},children:[{tag:"div",ref:"eCenterContainer",cls:"ag-header-container",role:"presentation"}]},YQ=class extends y{constructor(z){super();this.eCenterContainer=j,this.headerRowComps={},this.rowCompsList=[],this.pinned=z}postConstruct(){this.selectAndSetTemplate();let z={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 Z=this.getGui();Z.style.width=Q,Z.style.maxWidth=Q,Z.style.minWidth=Q}};this.createManagedBean(new g_(this.pinned)).setComp(z,this.getGui())}selectAndSetTemplate(){let z=this.pinned=="left",J=this.pinned=="right",Q=z?h_:J?u_:m_;this.setTemplate(Q),this.eRowContainer=this.eCenterContainer!==j?this.eCenterContainer:this.getGui()}destroy(){this.setCtrls([]),super.destroy()}destroyRowComp(z){this.destroyBean(z),z.getGui().remove()}setCtrls(z){let J=this.headerRowComps;this.headerRowComps={},this.rowCompsList=[];let Q,Z=($)=>{let X=$.getGui();if(X.parentElement!=this.eRowContainer)this.eRowContainer.appendChild(X);if(Q)y8(this.eRowContainer,X,Q);Q=X};for(let $ of z){let X=$.instanceId,Y=J[X];delete J[X];let q=Y?Y:this.createBean(new I_($));this.headerRowComps[X]=q,this.rowCompsList.push(q),Z(q)}for(let $ of Object.values(J))this.destroyRowComp($)}},c_={tag:"div",cls:"ag-header",role:"presentation"},p_=class extends y{constructor(){super(c_)}postConstruct(){let z={toggleCss:(Z,$)=>this.toggleCss(Z,$),setHeightAndMinHeight:(Z)=>{this.getGui().style.height=Z,this.getGui().style.minHeight=Z}};this.createManagedBean(new A_).setComp(z,this.getGui(),this.getFocusableElement());let Q=(Z)=>{this.createManagedBean(Z),this.appendChild(Z)};Q(new YQ("left")),Q(new YQ(null)),Q(new YQ("right"))}},i_={selector:"AG-HEADER-ROOT",component:p_},M4={AUTO_HEIGHT:"ag-layout-auto-height",NORMAL:"ag-layout-normal",PRINT:"ag-layout-print"},iZ=class extends V{constructor(z){super();this.view=z}postConstruct(){this.addManagedPropertyListener("domLayout",this.updateLayoutClasses.bind(this)),this.updateLayoutClasses()}updateLayoutClasses(){let z=this.gos.get("domLayout"),J={autoHeight:z==="autoHeight",normal:z==="normal",print:z==="print"},Q=J.autoHeight?M4.AUTO_HEIGHT:J.print?M4.PRINT:M4.NORMAL;this.view.updateLayoutClasses(Q,J)}},n9=class extends y{constructor(z,J){super();this.direction=J,this.eViewport=j,this.eContainer=j,this.hideTimeout=0,this.setTemplate(z)}postConstruct(){this.addManagedEventListeners({scrollVisibilityChanged:this.onScrollVisibilityChanged.bind(this)}),this.onScrollVisibilityChanged(),this.toggleCss("ag-apple-scrollbar",P9()||n1())}destroy(){super.destroy(),window.clearTimeout(this.hideTimeout)}initialiseInvisibleScrollbar(){if(this.invisibleScrollbar!==void 0)return;if(this.invisibleScrollbar=v9(),this.invisibleScrollbar)this.hideAndShowInvisibleScrollAsNeeded(),this.addActiveListenerToggles()}addActiveListenerToggles(){let z=this.getGui(),J=()=>this.toggleCss("ag-scrollbar-active",!0),Q=()=>this.toggleCss("ag-scrollbar-active",!1);this.addManagedListeners(z,{mouseenter:J,mousedown:J,touchstart:J,mouseleave:Q,touchend:Q})}onScrollVisibilityChanged(){if(this.invisibleScrollbar===void 0)this.initialiseInvisibleScrollbar();W4(this.beans,()=>this.setScrollVisible())}hideAndShowInvisibleScrollAsNeeded(){this.addManagedEventListeners({bodyScroll:(z)=>{if(z.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(z){let J=this.eViewport;KZ(this,()=>M0(J),()=>this.setScrollPosition(z),100)}onScrollCallback(z){this.addManagedElementListeners(this.eViewport,{scroll:z})}},d_={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 n9{constructor(){super(d_,"horizontal");this.eLeftSpacer=j,this.eRightSpacer=j,this.setScrollVisibleDebounce=0}wireBeans(z){this.visibleCols=z.visibleCols,this.scrollVisibleSvc=z.scrollVisibleSvc}postConstruct(){super.postConstruct();let z=this.setFakeHScrollSpacerWidths.bind(this);this.addManagedEventListeners({displayedColumnsChanged:z,displayedColumnsWidthChanged:z,pinnedRowDataChanged:this.refreshCompBottom.bind(this)}),this.addManagedPropertyListener("domLayout",z),this.beans.ctrlsSvc.register("fakeHScrollComp",this),this.createManagedBean(new mZ((J)=>this.eContainer.style.width=`${J}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 z=this.beans.pinnedRowModel?.getPinnedBottomTotalHeight()??0;this.getGui().style.bottom=`${z}px`}onScrollVisibilityChanged(){super.onScrollVisibilityChanged(),this.setFakeHScrollSpacerWidths()}setFakeHScrollSpacerWidths(){let z=this.scrollVisibleSvc.verticalScrollShowing,J=this.visibleCols.getDisplayedColumnsRightWidth(),Q=!this.enableRtl&&z,Z=this.scrollVisibleSvc.getScrollbarWidth();if(Q)J+=Z;w4(this.eRightSpacer,J),this.eRightSpacer.classList.toggle("ag-scroller-corner",J<=Z);let $=this.visibleCols.getColsLeftWidth();if(this.enableRtl&&z)$+=Z;w4(this.eLeftSpacer,$),this.eLeftSpacer.classList.toggle("ag-scroller-corner",$<=Z)}setScrollVisible(){let z=this.scrollVisibleSvc.horizontalScrollShowing,J=this.invisibleScrollbar,Q=this.gos.get("suppressHorizontalScroll"),Z=z?this.scrollVisibleSvc.getScrollbarWidth()||0:0,X=!Q?Z===0&&J?16:Z:0,Y=()=>{if(this.setScrollVisibleDebounce=0,this.toggleCss("ag-scrollbar-invisible",J),_6(this.getGui(),X),_6(this.eViewport,X),_6(this.eContainer,X),!X)this.eContainer.style.setProperty("min-height","1px");this.setVisible(z,{skipAriaHidden:!0})};if(window.clearTimeout(this.setScrollVisibleDebounce),!z)Y();else this.setScrollVisibleDebounce=window.setTimeout(Y,100)}getScrollPosition(){return Pz(this.eViewport,this.enableRtl)}setScrollPosition(z){if(!M0(this.eViewport))this.attemptSettingScrollPosition(z);Tz(this.eViewport,z,this.enableRtl)}},t_={selector:"AG-FAKE-HORIZONTAL-SCROLL",component:n_},t9=class extends V{constructor(z,J){super();this.eContainer=z,this.eViewport=J}postConstruct(){this.addManagedEventListeners({rowContainerHeightChanged:this.onHeightChanged.bind(this,this.beans.rowContainerHeight)})}onHeightChanged(z){let J=z.uiContainerHeight,Q=J!=null?`${J}px`:"";if(this.eContainer.style.height=Q,this.eViewport)this.eViewport.style.height=Q}},r_={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"}]}]},s_=class extends n9{constructor(){super(r_,"vertical")}postConstruct(){super.postConstruct(),this.createManagedBean(new t9(this.eContainer));let{ctrlsSvc:z}=this.beans;z.register("fakeVScrollComp",this),this.addManagedEventListeners({rowContainerHeightChanged:this.onRowContainerHeightChanged.bind(this,z)})}setScrollVisible(){let{scrollVisibleSvc:z}=this.beans,J=z.verticalScrollShowing,Q=this.invisibleScrollbar,Z=J?z.getScrollbarWidth()||0:0,$=Z===0&&Q?16:Z;this.toggleCss("ag-scrollbar-invisible",Q),w4(this.getGui(),$),w4(this.eViewport,$),w4(this.eContainer,$),this.setDisplayed(J,{skipAriaHidden:!0})}onRowContainerHeightChanged(z){let Q=z.getGridBodyCtrl().eBodyViewport,Z=this.getScrollPosition(),$=Q.scrollTop;if(Z!=$)this.setScrollPosition($,!0)}getScrollPosition(){return this.eViewport.scrollTop}setScrollPosition(z,J){if(!J&&!M0(this.eViewport))this.attemptSettingScrollPosition(z);this.eViewport.scrollTop=z}},l_={selector:"AG-FAKE-VERTICAL-SCROLL",component:s_};var $1="Viewport",M7="fakeVScrollComp",qQ=["fakeHScrollComp","centerHeader","topCenter","bottomCenter","stickyTopCenter","stickyBottomCenter"],k7=100,GQ=150,a_=class extends V{constructor(z){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=z,this.resetLastHScrollDebounced=p0(this,()=>this.lastScrollSource[1]=null,GQ),this.resetLastVScrollDebounced=p0(this,()=>this.lastScrollSource[0]=null,GQ)}wireBeans(z){this.ctrlsSvc=z.ctrlsSvc,this.animationFrameSvc=z.animationFrameSvc,this.visibleCols=z.visibleCols}destroy(){super.destroy(),this.clearRetryListenerFncs=[],window.clearTimeout(this.scrollTimer)}postConstruct(){this.enableRtl=this.gos.get("enableRtl");let z=this.invalidateVerticalScroll.bind(this),J=this.invalidateHorizontalScroll.bind(this);this.addManagedEventListeners({displayedColumnsWidthChanged:this.onDisplayedColumnsWidthChanged.bind(this),bodyHeightChanged:z,scrollGapChanged:J}),this.addManagedElementListeners(this.eBodyViewport,{scroll:z}),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,$1)});for(let z of qQ){let J=this.ctrlsSvc.get(z);this.registerScrollPartner(J,this.onHScroll.bind(this,z))}}addVerticalScrollListeners(){let z=this.gos.get("debounceVerticalScrollbar"),J=z?p0(this,this.onVScroll.bind(this,$1),k7):this.onVScroll.bind(this,$1),Q=z?p0(this,this.onVScroll.bind(this,M7),k7):this.onVScroll.bind(this,M7);this.addManagedElementListeners(this.eBodyViewport,{scroll:J}),this.registerScrollPartner(this.fakeVScrollComp,Q)}registerScrollPartner(z,J){z.onScrollCallback(J)}onDisplayedColumnsWidthChanged(){if(this.enableRtl)this.horizontallyScrollHeaderCenterAndFloatingCenter()}horizontallyScrollHeaderCenterAndFloatingCenter(z){if(this.centerRowsCtrl==null)return;if(z===void 0)z=this.centerRowsCtrl.getCenterViewportScrollLeft();this.setScrollLeftForAllContainersExceptCurrent(Math.abs(z))}setScrollLeftForAllContainersExceptCurrent(z){for(let J of[...qQ,$1]){if(this.lastScrollSource[1]===J)continue;let Q=this.getViewportForSource(J);Tz(Q,z,this.enableRtl)}}getViewportForSource(z){if(z===$1)return this.centerRowsCtrl.eViewport;return this.ctrlsSvc.get(z).eViewport}isControllingScroll(z,J){if(this.lastScrollSource[J]==null){if(J===0)this.lastScrollSource[0]=z;else this.lastScrollSource[1]=z;return!0}return this.lastScrollSource[J]===z}onHScroll(z){if(!this.isControllingScroll(z,1))return;let J=this.centerRowsCtrl.eViewport,{scrollLeft:Q}=J;if(this.shouldBlockScrollUpdate(1,Q,!0))return;let Z=Pz(this.getViewportForSource(z),this.enableRtl);this.doHorizontalScroll(Z),this.resetLastHScrollDebounced()}onVScroll(z){if(!this.isControllingScroll(z,0))return;let J=z===$1?this.eBodyViewport.scrollTop:this.fakeVScrollComp.getScrollPosition(),Q=J;if(this.shouldBlockScrollUpdate(0,Q,!0))return;if(z===$1)this.fakeVScrollComp.setScrollPosition(Q);else if(this.eBodyViewport.scrollTop=J,Q=this.eBodyViewport.scrollTop,this.invalidateVerticalScroll(),Q!==J)this.fakeVScrollComp.setScrollPosition(Q,!0);let{animationFrameSvc:Z}=this;if(Z?.setScrollTop(Q),this.nextScrollTop=Q,Z?.active)Z.schedule();else this.scrollGridIfNeeded(!0);this.resetLastVScrollDebounced()}doHorizontalScroll(z){let J=this.fakeHScrollComp.getScrollPosition();if(this.scrollLeft===z&&z===J)return;this.scrollLeft=z,this.fireScrollEvent(1),this.horizontallyScrollHeaderCenterAndFloatingCenter(z),this.centerRowsCtrl.onHorizontalViewportChanged(!0)}isScrolling(){return this.isScrollActive}fireScrollEvent(z){let J={type:"bodyScroll",direction:z===1?"horizontal":"vertical",left:this.scrollLeft,top:this.scrollTop};this.isScrollActive=!0,this.eventSvc.dispatchEvent(J),window.clearTimeout(this.scrollTimer),this.scrollTimer=window.setTimeout(()=>{this.scrollTimer=0,this.isScrollActive=!1,this.eventSvc.dispatchEvent({...J,type:"bodyScrollEnd"})},GQ)}shouldBlockScrollUpdate(z,J,Q=!1){if(Q&&!n1())return!1;if(z===0)return this.shouldBlockVerticalScroll(J);return this.shouldBlockHorizontalScroll(J)}shouldBlockVerticalScroll(z){let J=I6(this.eBodyViewport),{scrollHeight:Q}=this.eBodyViewport;return z<0||z+J>Q}shouldBlockHorizontalScroll(z){let J=this.centerRowsCtrl.getCenterWidth(),{scrollWidth:Q}=this.centerRowsCtrl.eViewport;if(this.enableRtl){if(z>0)return!0}else if(z<0)return!0;return Math.abs(z)+J>Q}redrawRowsAfterScroll(){this.fireScrollEvent(0)}checkScrollLeft(){let z=this.scrollLeft,J=!1;for(let Q of qQ)if(this.getViewportForSource(Q).scrollLeft!==z){J=!0;break}if(J)this.onHScroll($1)}scrollGridIfNeeded(z=!1){let J=this.scrollTop!=this.nextScrollTop;if(J){if(this.scrollTop=this.nextScrollTop,z)this.invalidateVerticalScroll();this.redrawRowsAfterScroll()}return J}setHorizontalScrollPosition(z,J=!1){let Z=this.centerRowsCtrl.eViewport.scrollWidth-this.centerRowsCtrl.getCenterWidth();if(!J&&this.shouldBlockScrollUpdate(1,z))if(this.enableRtl)z=z>0?0:Z;else z=Math.min(Math.max(z,0),Z);Tz(this.centerRowsCtrl.eViewport,Math.abs(z),this.enableRtl),this.doHorizontalScroll(z)}setVerticalScrollPosition(z){this.invalidateVerticalScroll(),this.eBodyViewport.scrollTop=z}getVScrollPosition(){if(!this.isVerticalPositionInvalidated){let{lastOffsetHeight:Q,lastScrollTop:Z}=this;return{top:Z,bottom:Z+Q}}this.isVerticalPositionInvalidated=!1;let{scrollTop:z,offsetHeight:J}=this.eBodyViewport;return this.lastScrollTop=z,this.lastOffsetHeight=J,{top:z,bottom:z+J}}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(z){let J=this.centerRowsCtrl.eViewport.scrollLeft;return this.setHorizontalScrollPosition(J+z),this.centerRowsCtrl.eViewport.scrollLeft-J}scrollToTop(){this.setVerticalScrollPosition(0)}ensureNodeVisible(z,J=null){let{rowModel:Q}=this.beans,Z=Q.getRowCount(),$=-1;for(let X=0;X=0)this.ensureIndexVisible($,J)}ensureIndexVisible(z,J,Q=0){if(A0(this.gos,"print"))return;let{rowModel:Z}=this.beans,$=Z.getRowCount();if(typeof z!=="number"||z<0||z>=$){R(88,{index:z});return}this.clearRetryListeners();let{frameworkOverrides:X,pageBounds:Y,rowContainerHeight:q,rowRenderer:G}=this.beans;X.wrapIncoming(()=>{let H=this.ctrlsSvc.getGridBodyCtrl(),_=Z.getRow(z),U,W,B=0;this.invalidateVerticalScroll();do{let{stickyTopHeight:E,stickyBottomHeight:K}=H,F=_.rowTop,L=_.rowHeight,D=Y.getPixelOffset(),M=_.rowTop-D,f=M+_.rowHeight,S=this.getVScrollPosition(),A=q.divStretchOffset,O=S.top+A,v=S.bottom+A,I=v-O,x=q.getScrollPositionForPixel(M),m=q.getScrollPositionForPixel(f-I),g=Math.min((x+m)/2,M),e=O+E>M,r=v-KI)u=x-E;else u=m+K;if(u!==null)this.setVerticalScrollPosition(u),G.redraw({afterScroll:!0});U=F!==_.rowTop||L!==_.rowHeight,W=E!==H.stickyTopHeight||K!==H.stickyBottomHeight,B++}while((U||W)&&B<10);if(this.animationFrameSvc?.flushAllFrames(),Q<10&&(_?.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(),z>=Z.getRowCount())return;this.ensureIndexVisible(z,J,Q+1)}})}})}clearRetryListeners(){for(let z of this.clearRetryListenerFncs)z();this.clearRetryListenerFncs=[]}ensureColumnVisible(z,J="auto"){let{colModel:Q,frameworkOverrides:Z}=this.beans,$=Q.getCol(z);if(!$)return;if($.isPinned())return;if(!this.visibleCols.isColDisplayed($))return;let X=this.getPositionedHorizontalScroll($,J);Z.wrapIncoming(()=>{if(X!==null)this.centerRowsCtrl.setCenterViewportScrollLeft(X);this.centerRowsCtrl.onHorizontalViewportChanged(),this.animationFrameSvc?.flushAllFrames()})}getPositionedHorizontalScroll(z,J){let{columnBeforeStart:Q,columnAfterEnd:Z}=this.isColumnOutsideViewport(z),$=this.centerRowsCtrl.getCenterWidth()$:Q<$,q=X?QZ;return{columnBeforeStart:Y,columnAfterEnd:q}}getColumnBounds(z){let J=this.enableRtl,Q=this.visibleCols.bodyWidth,Z=z.getActualWidth(),$=z.getLeft(),X=J?-1:1,Y=J?Q-$:$,q=Y+Z*X,G=Y+Z/2*X;return{colLeft:Y,colMiddle:G,colRight:q}}getViewportBounds(){let z=this.centerRowsCtrl.getCenterWidth(),J=this.centerRowsCtrl.getCenterViewportScrollLeft(),Q=J,Z=z+J;return{start:Q,end:Z,width:z}}},f7={horizontal:{overflow:(z)=>z.scrollWidth-z.clientWidth,scrollSize:(z)=>z.scrollWidth,clientSize:(z)=>z.clientWidth,opposite:"vertical"},vertical:{overflow:(z)=>z.scrollHeight-z.clientHeight,scrollSize:(z)=>z.scrollHeight,clientSize:(z)=>z.clientHeight,opposite:"horizontal"}};function o_(z,J,Q=IZ()||0,Z,$){return r9(z,J,"horizontal",Q,Z,$)}function e_(z,J,Q=IZ()||0,Z,$){return r9(z,J,"vertical",Q,Z,$)}function r9(z,J,Q,Z,$,X){let Y=f7[Q],q=f7[Y.opposite],G=$?M0($):!0,H=X?M0(X):!0,_=Y.overflow(z);if(_<=0)return!1;if(!J||Z===0)return!0;let U=q.overflow(J);if(U<=0)return!0;if(_<=Z){if(G&&H&&zU({candidateOverflow:U,candidateScrollSize:q.scrollSize(J),candidateClientSize:q.clientSize(J),scrollbarWidth:Z}))return!1;let W=Y.clientSize(z)+Z;return Y.scrollSize(z)<=W}return!0}function zU({candidateOverflow:z,candidateScrollSize:J,candidateClientSize:Q,scrollbarWidth:Z}){if(z<=0||z>Z)return!1;let $=Q+Z;return J>Q&&J<=$}var JU=class extends V{constructor(z){super();this.centerContainerCtrl=z}wireBeans(z){this.scrollVisibleSvc=z.scrollVisibleSvc}postConstruct(){this.beans.ctrlsSvc.whenReady(this,(z)=>{this.gridBodyCtrl=z.gridBodyCtrl,this.listenForResize()}),this.addManagedEventListeners({scrollbarWidthChanged:this.onScrollbarWidthChanged.bind(this)}),this.addManagedPropertyListeners(["alwaysShowHorizontalScroll","alwaysShowVerticalScroll"],()=>{this.checkViewportAndScrolls()})}listenForResize(){let{beans:z,centerContainerCtrl:J,gridBodyCtrl:Q}=this,Z=()=>{W4(z,()=>{this.onCenterViewportResized()})};J.registerViewportResizeListener(Z),Q.registerBodyViewportResizeListener(Z)}onScrollbarWidthChanged(){this.checkViewportAndScrolls()}onCenterViewportResized(){if(this.scrollVisibleSvc.updateScrollGap(),this.centerContainerCtrl.isViewportInTheDOMTree()){let{pinnedCols:z,colFlex:J}=this.beans;z?.keepPinnedColumnsNarrowerThanViewport(),this.checkViewportAndScrolls();let Q=this.centerContainerCtrl.getCenterWidth();if(Q!==this.centerWidth)this.centerWidth=Q,J?.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 z=this.gridBodyCtrl.eBodyViewport,J=I6(z);if(this.bodyHeight!==J)this.bodyHeight=J,this.eventSvc.dispatchEvent({type:"bodyHeightChanged"})}updateScrollVisibleService(){this.updateScrollVisibleServiceImpl(),setTimeout(this.updateScrollVisibleServiceImpl.bind(this),500)}updateScrollVisibleServiceImpl(){if(!this.isAlive())return;let z={horizontalScrollShowing:this.centerContainerCtrl.isHorizontalScrollShowing(),verticalScrollShowing:this.gridBodyCtrl.isVerticalScrollShowing()};this.scrollVisibleSvc.setScrollsVisible(z)}onHorizontalViewportChanged(){let{centerContainerCtrl:z,beans:J}=this,Q=z.getCenterWidth(),Z=z.getViewportScrollLeft();J.colViewport.setScrollPosition(Q,Z)}};function s9(z){if(z.altKey||z.ctrlKey||z.metaKey)return!1;return z.key?.length===1}function fz(z,J,Q,Z){let $=J.getColDef().cellRendererParams?.suppressMouseEventHandling;return l9(z,J,Q,Z,$)}function QU(z,J,Q,Z){let $=J?.suppressMouseEventHandling;return l9(z,void 0,Q,Z,$)}function l9(z,J,Q,Z,$){if(!$)return!1;return $(C(z,{column:J,node:Q,event:Z}))}function a9(z,J,Q){let Z=J;while(Z){let $=J9(z,Z,Q);if($)return $;Z=Z.parentElement}return null}var gz="cellCtrl";function m6(z,J){return a9(z,J,gz)}var hz="renderedRow";function dZ(z,J){return a9(z,J,hz)}function uQ(z,J,Q,Z,$){let X=Z?Z.getColDef().suppressKeyboardEvent:void 0;if(!X)return!1;let Y=C(z,{event:J,editing:$,column:Z,node:Q,data:Q.data,colDef:Z.getColDef()});if(X){if(X(Y))return!0}return!1}function ZU(z){let{pinnedRowModel:J,rowModel:Q,rangeSvc:Z,visibleCols:$}=z;if(!Z||$.allCols.length===0)return;let X=J?.isEmpty("top")??!0,Y=J?.isEmpty("bottom")??!0,q=X?null:"top",G,H;if(Y)G=null,H=Q.getRowCount()-1;else G="bottom",H=J?.getPinnedBottomRowCount()??-1;Z.setCellRange({rowStartIndex:0,rowStartPinned:q,rowEndIndex:H,rowEndPinned:G})}var $U=class extends V{constructor(z){super();this.element=z}postConstruct(){this.addKeyboardListeners(),this.addMouseListeners(),this.beans.touchSvc?.mockRowContextMenu(this),this.editSvc=this.beans.editSvc}addKeyboardListeners(){let J=this.processKeyboardEvent.bind(this,"keydown");this.addManagedElementListeners(this.element,{["keydown"]:J})}addMouseListeners(){let z="mousedown";if(OQ("pointerdown"))z="pointerdown";else if(OQ("touchstart"))z="touchstart";let J=["dblclick","contextmenu","mouseover","mouseout","click",z];for(let Q of J){let Z=this.processMouseEvent.bind(this,Q);this.addManagedElementListeners(this.element,{[Q]:Z})}}processMouseEvent(z,J){if(!L6(this.beans,J)||q4(J))return;let{cellCtrl:Q,rowCtrl:Z}=this.getControlsForEventTarget(J.target);if(z==="contextmenu"){if(Q?.column)Q.dispatchCellContextMenuEvent(J);this.beans.contextMenuSvc?.handleContextMenuMouseEvent(J,void 0,Z,Q)}else{if(Q)Q.onMouseEvent(z,J);if(Z)Z.onMouseEvent(z,J)}}getControlsForEventTarget(z){let{gos:J}=this;return{cellCtrl:m6(J,z),rowCtrl:dZ(J,z)}}processKeyboardEvent(z,J){let{cellCtrl:Q,rowCtrl:Z}=this.getControlsForEventTarget(J.target);if(J.defaultPrevented)return;if(Q)this.processCellKeyboardEvent(Q,z,J);else if(Z?.isFullWidth())this.processFullWidthRowKeyboardEvent(Z,z,J)}processCellKeyboardEvent(z,J,Q){let Z=this.editSvc?.isEditing(z,{withOpenEditor:!0})??!1;if(!uQ(this.gos,Q,z.rowNode,z.column,Z)){if(J==="keydown"){if(!(!Z&&this.beans.navigation?.handlePageScrollingKey(Q)))z.onKeyDown(Q);if(this.doGridOperations(Q,Z),s9(Q))z.processCharacter(Q)}}if(J==="keydown")this.eventSvc.dispatchEvent(z.createEvent(Q,"cellKeyDown"))}processFullWidthRowKeyboardEvent(z,J,Q){let{rowNode:Z}=z,{focusSvc:$,navigation:X}=this.beans,q=$.getFocusedCell()?.column;if(!uQ(this.gos,Q,Z,q,!1)){let H=Q.key;if(J==="keydown")switch(H){case k.PAGE_HOME:case k.PAGE_END:case k.PAGE_UP:case k.PAGE_DOWN:X?.handlePageScrollingKey(Q,!0);break;case k.LEFT:case k.RIGHT:if(!this.gos.get("embedFullWidthRows"))break;case k.UP:case k.DOWN:z.onKeyboardNavigate(Q);break;case k.TAB:z.onTabKeyDown(Q);break;default:}}if(J==="keydown")this.eventSvc.dispatchEvent(z.createRowEvent("cellKeyDown",Q))}doGridOperations(z,J){if(!z.ctrlKey&&!z.metaKey)return;if(J)return;if(!L6(this.beans,z))return;let Q=k9(z),{clipboardSvc:Z,undoRedo:$}=this.beans;if(Q===k.A)return this.onCtrlAndA(z);if(Q===k.C)return this.onCtrlAndC(Z,z);if(Q===k.D)return this.onCtrlAndD(Z,z);if(Q===k.V)return this.onCtrlAndV(Z,z);if(Q===k.X)return this.onCtrlAndX(Z,z);if(Q===k.Y)return this.onCtrlAndY($);if(Q===k.Z)return this.onCtrlAndZ($,z)}onCtrlAndA(z){let{beans:{rowModel:J,rangeSvc:Q,selectionSvc:Z},gos:$}=this;if(Q&&d0($)&&!sG($)&&J.isRowsToRender())ZU(this.beans);else if(Z)Z.selectAllRowNodes({source:"keyboardSelectAll",selectAll:Y9($)});z.preventDefault()}onCtrlAndC(z,J){if(!z||this.gos.get("enableCellTextSelection"))return;let{cellCtrl:Q}=this.getControlsForEventTarget(J.target);if(this.editSvc?.isEditing(Q,{withOpenEditor:!0}))return;J.preventDefault(),z.copyToClipboard()}onCtrlAndX(z,J){if(!z||this.gos.get("enableCellTextSelection")||this.gos.get("suppressCutToClipboard"))return;let{cellCtrl:Q}=this.getControlsForEventTarget(J.target);if(this.editSvc?.isEditing(Q,{withOpenEditor:!0}))return;J.preventDefault(),z.cutToClipboard(void 0,"ui")}onCtrlAndV(z,J){let{cellCtrl:Q}=this.getControlsForEventTarget(J.target);if(this.editSvc?.isEditing(Q,{withOpenEditor:!0}))return;if(z&&!this.gos.get("suppressClipboardPaste"))z.pasteFromClipboard()}onCtrlAndD(z,J){if(z&&!this.gos.get("suppressClipboardPaste"))z.copyRangeDown();J.preventDefault()}onCtrlAndZ(z,J){if(!this.gos.get("undoRedoCellEditing")||!z)return;if(J.preventDefault(),J.shiftKey)z.redo("ui");else z.undo("ui")}onCtrlAndY(z){z?.redo("ui")}},qz=(z)=>z.topRowCtrls,Gz=(z)=>z.getStickyTopRowCtrls(),Hz=(z)=>z.getStickyBottomRowCtrls(),_z=(z)=>z.bottomRowCtrls,Uz=(z)=>z.allRowCtrls,HQ=(z)=>z.getCtrls("top"),_Q=(z)=>z.getCtrls("center"),UQ=(z)=>z.getCtrls("bottom"),XU={center:{type:"center",name:"center-cols",getRowCtrls:Uz,getSpannedRowCtrls:_Q},left:{type:"left",name:"pinned-left-cols",pinnedType:"left",getRowCtrls:Uz,getSpannedRowCtrls:_Q},right:{type:"right",name:"pinned-right-cols",pinnedType:"right",getRowCtrls:Uz,getSpannedRowCtrls:_Q},fullWidth:{type:"fullWidth",name:"full-width",fullWidth:!0,getRowCtrls:Uz},topCenter:{type:"center",name:"floating-top",getRowCtrls:qz,getSpannedRowCtrls:HQ},topLeft:{type:"left",name:"pinned-left-floating",container:"ag-pinned-left-floating-top",pinnedType:"left",getRowCtrls:qz,getSpannedRowCtrls:HQ},topRight:{type:"right",name:"pinned-right-floating",container:"ag-pinned-right-floating-top",pinnedType:"right",getRowCtrls:qz,getSpannedRowCtrls:HQ},topFullWidth:{type:"fullWidth",name:"floating-top-full-width",fullWidth:!0,getRowCtrls:qz},stickyTopCenter:{type:"center",name:"sticky-top",getRowCtrls:Gz},stickyTopLeft:{type:"left",name:"pinned-left-sticky-top",container:"ag-pinned-left-sticky-top",pinnedType:"left",getRowCtrls:Gz},stickyTopRight:{type:"right",name:"pinned-right-sticky-top",container:"ag-pinned-right-sticky-top",pinnedType:"right",getRowCtrls:Gz},stickyTopFullWidth:{type:"fullWidth",name:"sticky-top-full-width",fullWidth:!0,getRowCtrls:Gz},stickyBottomCenter:{type:"center",name:"sticky-bottom",getRowCtrls:Hz},stickyBottomLeft:{type:"left",name:"pinned-left-sticky-bottom",container:"ag-pinned-left-sticky-bottom",pinnedType:"left",getRowCtrls:Hz},stickyBottomRight:{type:"right",name:"pinned-right-sticky-bottom",container:"ag-pinned-right-sticky-bottom",pinnedType:"right",getRowCtrls:Hz},stickyBottomFullWidth:{type:"fullWidth",name:"sticky-bottom-full-width",fullWidth:!0,getRowCtrls:Hz},bottomCenter:{type:"center",name:"floating-bottom",getRowCtrls:_z,getSpannedRowCtrls:UQ},bottomLeft:{type:"left",name:"pinned-left-floating-bottom",container:"ag-pinned-left-floating-bottom",pinnedType:"left",getRowCtrls:_z,getSpannedRowCtrls:UQ},bottomRight:{type:"right",name:"pinned-right-floating-bottom",container:"ag-pinned-right-floating-bottom",pinnedType:"right",getRowCtrls:_z,getSpannedRowCtrls:UQ},bottomFullWidth:{type:"fullWidth",name:"floating-bottom-full-width",fullWidth:!0,getRowCtrls:_z}};function o9(z){return`ag-${c6(z).name}-viewport`}function e9(z){let J=c6(z);return J.container??`ag-${J.name}-container`}function YU(z){return`ag-${c6(z).name}-spanned-cells-container`}function c6(z){return XU[z]}var qU=["topCenter","topLeft","topRight"],GU=["bottomCenter","bottomLeft","bottomRight"],HU=["center","left","right"],_U=["center","left","right","fullWidth"],UU=["stickyTopCenter","stickyBottomCenter","center","topCenter","bottomCenter"],WU=["left","bottomLeft","topLeft","stickyTopLeft","stickyBottomLeft"],BU=["right","bottomRight","topRight","stickyTopRight","stickyBottomRight"],z$=["stickyTopCenter","stickyTopLeft","stickyTopRight"],J$=["stickyBottomCenter","stickyBottomLeft","stickyBottomRight"],EU=[...z$,"stickyTopFullWidth",...J$,"stickyBottomFullWidth"],KU=[...qU,...GU,...HU,...z$,...J$],FU=class extends V{constructor(z){super();this.name=z,this.visible=!0,this.EMPTY_CTRLS=[],this.options=c6(z)}postConstruct(){this.enableRtl=this.gos.get("enableRtl"),this.forContainers(["center"],()=>{this.viewportSizeFeature=this.createManagedBean(new JU(this)),this.addManagedEventListeners({stickyTopOffsetChanged:this.onStickyTopOffsetChanged.bind(this)})})}onStickyTopOffsetChanged(z){this.comp.setOffsetTop(`${z.offset}px`)}registerWithCtrlsService(){if(this.options.fullWidth)return;this.beans.ctrlsSvc.register(this.name,this)}forContainers(z,J){if(z.indexOf(this.name)>=0)J()}setComp(z,J,Q,Z){this.comp=z,this.eContainer=J,this.eSpannedContainer=Q,this.eViewport=Z,this.createManagedBean(new $U(this.eViewport??this.eContainer)),this.addPreventScrollWhileDragging(),this.listenOnDomOrder();let{pinnedCols:$,rangeSvc:X}=this.beans,Y=()=>this.onPinnedWidthChanged();if(this.forContainers(WU,()=>{this.pinnedWidthFeature=this.createOptionalManagedBean($?.createPinnedWidthFeature(!0,this.eContainer,this.eSpannedContainer)),this.addManagedEventListeners({leftPinnedWidthChanged:Y})}),this.forContainers(BU,()=>{this.pinnedWidthFeature=this.createOptionalManagedBean($?.createPinnedWidthFeature(!1,this.eContainer,this.eSpannedContainer)),this.addManagedEventListeners({rightPinnedWidthChanged:Y})}),this.forContainers(_U,()=>this.createManagedBean(new t9(this.eContainer,this.name==="center"?Z:void 0))),X)this.forContainers(KU,()=>this.createManagedBean(X.createDragListenerFeature(this.eContainer)));this.forContainers(UU,()=>this.createManagedBean(new mZ((q)=>this.comp.setContainerWidth(`${q}px`)))),this.visible=this.isContainerVisible(),this.addListeners(),this.registerWithCtrlsService()}onScrollCallback(z){this.addManagedElementListeners(this.eViewport,{scroll:z})}addListeners(){let{spannedRowRenderer:z,gos:J}=this.beans,Q=this.onDisplayedColumnsChanged.bind(this);if(this.addManagedEventListeners({displayedColumnsChanged:Q,displayedColumnsWidthChanged:Q,displayedRowsChanged:(Z)=>this.onDisplayedRowsChanged(Z.afterScroll)}),Q(),this.onDisplayedRowsChanged(),z&&this.options.getSpannedRowCtrls&&J.get("enableCellSpan"))this.addManagedListeners(z,{spannedRowsUpdated:()=>{let Z=this.options.getSpannedRowCtrls(z);if(!Z)return;this.comp.setSpannedRowCtrls(Z,!1)}})}listenOnDomOrder(){if(EU.indexOf(this.name)>=0){this.comp.setDomOrder(!0);return}let J=()=>{let Q=this.gos.get("ensureDomOrder"),Z=A0(this.gos,"print");this.comp.setDomOrder(Q||Z)};this.addManagedPropertyListener("domLayout",J),J()}onDisplayedColumnsChanged(){this.forContainers(["center"],()=>this.onHorizontalViewportChanged())}addPreventScrollWhileDragging(){let{dragSvc:z}=this.beans;if(!z)return;let J=(Q)=>{if(z.dragging){if(Q.cancelable)Q.preventDefault()}};this.eContainer.addEventListener("touchmove",J,{passive:!1}),this.addDestroyFunc(()=>this.eContainer.removeEventListener("touchmove",J))}onHorizontalViewportChanged(z=!1){let J=this.getCenterWidth(),Q=this.getCenterViewportScrollLeft();this.beans.colViewport.setScrollPosition(J,Q,z)}hasHorizontalScrollGap(){return this.eContainer.clientWidth-this.eViewport.clientWidth<0}hasVerticalScrollGap(){return this.eContainer.clientHeight-this.eViewport.clientHeight<0}getCenterWidth(){return s1(this.eViewport)}getCenterViewportScrollLeft(){return Pz(this.eViewport,this.enableRtl)}registerViewportResizeListener(z){let J=P4(this.beans,this.eViewport,z);this.addDestroyFunc(()=>J())}isViewportInTheDOMTree(){return b8(this.eViewport)}getViewportScrollLeft(){return Pz(this.eViewport,this.enableRtl)}isHorizontalScrollShowing(){let{beans:z,gos:J,eViewport:Q}=this,Z=J.get("alwaysShowHorizontalScroll"),{ctrlsSvc:$}=z,X=$.getGridBodyCtrl()?.eBodyViewport,Y=$.get("fakeHScrollComp")?.getGui(),q=$.get("fakeVScrollComp")?.getGui();return Z||o_(Q,X,void 0,Y,q)}setHorizontalScroll(z){this.comp.setHorizontalScroll(z)}getHScrollPosition(){return{left:this.eViewport.scrollLeft,right:this.eViewport.scrollLeft+this.eViewport.offsetWidth}}setCenterViewportScrollLeft(z){Tz(this.eViewport,z,this.enableRtl)}isContainerVisible(){return this.options.pinnedType==null||!!this.pinnedWidthFeature&&this.pinnedWidthFeature.getWidth()>0}onPinnedWidthChanged(){let z=this.isContainerVisible();if(this.visible!=z)this.visible=z,this.onDisplayedRowsChanged()}onDisplayedRowsChanged(z=!1){let J=this.options.getRowCtrls(this.beans.rowRenderer);if(!this.visible||J.length===0){this.comp.setRowCtrls({rowCtrls:this.EMPTY_CTRLS});return}let Q=A0(this.gos,"print"),$=this.gos.get("embedFullWidthRows")||Q,X=J.filter((Y)=>{let q=Y.isFullWidth();return this.options.fullWidth?!$&&q:$||!q});this.comp.setRowCtrls({rowCtrls:X,useFlushSync:z})}},Q$="ag-force-vertical-scroll",LU="ag-selectable",DU="ag-column-moving",MU=class extends V{constructor(){super(...arguments);this.stickyTopHeight=0,this.stickyBottomHeight=0}wireBeans(z){this.ctrlsSvc=z.ctrlsSvc,this.colModel=z.colModel,this.scrollVisibleSvc=z.scrollVisibleSvc,this.pinnedRowModel=z.pinnedRowModel,this.filterManager=z.filterManager,this.rowGroupColsSvc=z.rowGroupColsSvc}setComp(z,J,Q,Z,$,X,Y){this.comp=z,this.eGridBody=J,this.eBodyViewport=Q,this.eTop=Z,this.eBottom=$,this.eStickyTop=X,this.eStickyBottom=Y,this.eCenterColsViewport=Q.querySelector(`.${o9("center")}`),this.eFullWidthContainer=Q.querySelector(`.${e9("fullWidth")}`),this.setCellTextSelection(this.gos.get("enableCellTextSelection")),this.addManagedPropertyListener("enableCellTextSelection",(q)=>this.setCellTextSelection(q.currentValue)),this.createManagedBean(new iZ(this.comp)),this.scrollFeature=this.createManagedBean(new a_(Q)),this.beans.rowDragSvc?.setupRowDrag(Q,this),this.setupRowAnimationCssClass(),this.addEventListeners(),this.addFocusListeners([Z,Q,$,X,Y]),this.setGridRootRole(),this.onGridColumnsChanged(),this.addBodyViewportListener(),this.setFloatingHeights(),this.disableBrowserDragging(),this.addStopEditingWhenGridLosesFocus(),this.updateScrollingClasses(),this.filterManager?.setupAdvFilterHeaderComp(Z),this.ctrlsSvc.register("gridBodyCtrl",this)}addEventListeners(){let z=this.setFloatingHeights.bind(this),J=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:z,pinnedHeightChanged:z,pinnedRowsChanged:z,headerHeightChanged:this.setStickyTopOffsetTop.bind(this),columnRowGroupChanged:J,columnPivotChanged:J,rowResizeStarted:Q,rowResizeEnded:Q}),this.addManagedPropertyListener("treeData",J)}toggleRowResizeStyles(z){let J=z.type==="rowResizeStarted";this.eBodyViewport.classList.toggle("ag-prevent-animation",J)}onGridColumnsChanged(){let z=this.beans.colModel.getCols();this.comp.setColumnCount(z.length)}onScrollVisibilityChanged(){let{scrollVisibleSvc:z}=this,J=z.verticalScrollShowing;this.setVerticalScrollPaddingVisible(J),this.setStickyWidth(J),this.setStickyBottomOffsetBottom();let Q=J?z.getScrollbarWidth()||0:0,Z=v9()?16:0,$=`calc(100% + ${Q+Z}px)`;W4(this.beans,()=>this.comp.setBodyViewportWidth($)),this.updateScrollingClasses()}setGridRootRole(){let{rowGroupColsSvc:z,colModel:J,gos:Q}=this,Z=Q.get("treeData");if(!Z){let $=J.isPivotMode();Z=(!z?0:z.columns.length)>=($?2:1)}this.comp.setGridRootRole(Z?"treegrid":"grid")}addFocusListeners(z){for(let J of z)this.addManagedElementListeners(J,{focusin:(Q)=>{let{target:Z}=Q,$=p1(Z,"ag-root",J);J.classList.toggle("ag-has-focus",!$)},focusout:(Q)=>{let{target:Z,relatedTarget:$}=Q,X=J.contains($),Y=p1($,"ag-root",J);if(p1(Z,"ag-root",J))return;if(!X||Y)J.classList.remove("ag-has-focus")}})}setColumnMovingCss(z){this.comp.setColumnMovingCss(DU,z)}setCellTextSelection(z=!1){this.comp.setCellSelectableCss(LU,z)}updateScrollingClasses(){let{eGridBody:{classList:z},scrollVisibleSvc:J}=this;z.toggle("ag-body-vertical-content-no-gap",!J.verticalScrollGap),z.toggle("ag-body-horizontal-content-no-gap",!J.horizontalScrollGap)}disableBrowserDragging(){this.addManagedElementListeners(this.eGridBody,{dragstart:(z)=>{if(z.target instanceof HTMLImageElement)return z.preventDefault(),!1}})}addStopEditingWhenGridLosesFocus(){this.beans.editSvc?.addStopEditingWhenGridLosesFocus([this.eBodyViewport,this.eBottom,this.eTop,this.eStickyTop,this.eStickyBottom])}updateRowCount(){let z=(this.ctrlsSvc.getHeaderRowContainerCtrl()?.getRowCount()??0)+(this.filterManager?.getHeaderRowCount()??0),{rowModel:J}=this.beans,Q=J.isLastRowIndexKnown()?J.getRowCount():-1,Z=Q===-1?-1:z+Q;this.comp.setRowCount(Z)}registerBodyViewportResizeListener(z){this.comp.registerBodyViewportResizeListener(z)}setVerticalScrollPaddingVisible(z){let J=z?"scroll":"hidden";this.comp.setPinnedTopBottomOverflowY(J)}isVerticalScrollShowing(){let{gos:z,comp:J,ctrlsSvc:Q}=this,Z=z.get("alwaysShowVerticalScroll"),$=Z?Q$:null,X=A0(z,"normal");J.setAlwaysVerticalScrollClass($,Z);let Y=Q.get("center")?.eViewport,q=Q.get("fakeHScrollComp")?.getGui(),G=Q.get("fakeVScrollComp")?.getGui();return Z||X&&e_(this.eBodyViewport,Y,void 0,G,q)}setupRowAnimationCssClass(){let{rowContainerHeight:z,environment:J}=this.beans,Q=J.sizesMeasured,Z=()=>{let $=Q&&P2(this.gos)&&!z.stretching,X=$?"ag-row-animation":"ag-row-no-animation";this.comp.setRowAnimationCssOnBodyViewport(X,$)};Z(),this.addManagedEventListeners({heightScaleChanged:Z}),this.addManagedPropertyListener("animateRows",Z),this.addManagedEventListeners({stylesChanged:()=>{if(!Q&&J.sizesMeasured)Q=!0,Z()}})}addBodyViewportListener(){let{eBodyViewport:z,eStickyTop:J,eStickyBottom:Q,eTop:Z,eBottom:$,beans:{popupSvc:X,touchSvc:Y}}=this,q=this.onBodyViewportContextMenu.bind(this);this.addManagedElementListeners(z,{contextmenu:q}),Y?.mockBodyContextMenu(this,q),this.addManagedElementListeners(z,{wheel:this.onBodyViewportWheel.bind(this,X)});let G=this.onStickyWheel.bind(this);for(let _ of[J,Q,Z,$])this.addManagedElementListeners(_,{wheel:G});let H=this.onHorizontalWheel.bind(this);for(let _ of["left","right","topLeft","topRight","bottomLeft","bottomRight"])this.addManagedElementListeners(this.ctrlsSvc.get(_).eContainer,{wheel:H});this.addFullWidthContainerWheelListener()}addFullWidthContainerWheelListener(){this.addManagedElementListeners(this.eFullWidthContainer,{wheel:(z)=>this.onFullWidthContainerWheel(z)})}onFullWidthContainerWheel(z){let{deltaX:J,deltaY:Q,shiftKey:Z}=z;if((Z||Math.abs(J)>Math.abs(Q))&&L6(this.beans,z))this.scrollGridBodyToMatchEvent(z)}onStickyWheel(z){let{deltaY:J}=z;if(this.scrollVertically(J)>0)z.preventDefault()}onHorizontalWheel(z){let{deltaX:J,deltaY:Q,shiftKey:Z}=z;if(!(Z||Math.abs(J)>Math.abs(Q)))return;this.scrollGridBodyToMatchEvent(z)}scrollGridBodyToMatchEvent(z){let{deltaX:J,deltaY:Q}=z;z.preventDefault(),this.eCenterColsViewport.scrollBy({left:J||Q})}onBodyViewportContextMenu(z,J,Q){if(!z&&!Q)return;if(this.gos.get("preventDefaultOnContextMenu"))(z||Q).preventDefault();let{target:Z}=z||J;if(Z===this.eBodyViewport||Z===this.ctrlsSvc.get("center").eViewport)this.beans.contextMenuSvc?.showContextMenu({mouseEvent:z,touchEvent:Q,value:null,anchorToElement:this.eGridBody,source:"ui"})}onBodyViewportWheel(z,J){if(!this.gos.get("suppressScrollWhenPopupsAreOpen"))return;if(z?.hasAnchoredPopup())J.preventDefault()}scrollVertically(z){let J=this.eBodyViewport.scrollTop;return this.scrollFeature.setVerticalScrollPosition(J+z),this.eBodyViewport.scrollTop-J}setFloatingHeights(){let{pinnedRowModel:z,beans:{environment:J}}=this,Q=z?.getPinnedTopTotalHeight(),Z=z?.getPinnedBottomTotalHeight(),$=J.getPinnedRowBorderWidth(),X=J.getRowBorderWidth(),Y=$-X,q=!Q?0:Y+Q,G=!Z?0:Y+Z;this.comp.setTopHeight(q),this.comp.setBottomHeight(G),this.comp.setTopInvisible(q<=0),this.comp.setBottomInvisible(G<=0),this.setStickyTopOffsetTop(),this.setStickyBottomOffsetBottom()}setStickyTopHeight(z=0){this.comp.setStickyTopHeight(`${z}px`),this.stickyTopHeight=z}setStickyBottomHeight(z=0){this.comp.setStickyBottomHeight(`${z}px`),this.stickyBottomHeight=z}setStickyWidth(z){if(!z)this.comp.setStickyTopWidth("100%"),this.comp.setStickyBottomWidth("100%");else{let J=this.scrollVisibleSvc.getScrollbarWidth();this.comp.setStickyTopWidth(`calc(100% - ${J}px)`),this.comp.setStickyBottomWidth(`calc(100% - ${J}px)`)}}setStickyTopOffsetTop(){let J=this.ctrlsSvc.get("gridHeaderCtrl").headerHeight+(this.filterManager?.getHeaderHeight()??0),Q=this.pinnedRowModel?.getPinnedTopTotalHeight()??0,Z=0;if(J>0)Z+=J;if(Q>0)Z+=Q;if(Z>0)Z+=1;this.comp.setStickyTopTop(`${Z}px`)}setStickyBottomOffsetBottom(){let{pinnedRowModel:z,scrollVisibleSvc:J,comp:Q}=this,Z=z?.getPinnedBottomTotalHeight()??0,X=J.horizontalScrollShowing?J.getScrollbarWidth()||0:0,Y=Z+X;Q.setStickyBottomBottom(`${Y}px`)}};function z0(z){return F0(z)}var kU=class extends y{constructor(z,J,Q,Z,$){super();this.cellCtrl=J,this.rowResizerElement=null,this.rendererVersion=0,this.editorVersion=0,this.beans=z,this.gos=z.gos,this.column=J.column,this.rowNode=J.rowNode,this.eRow=Z;let X=z0({tag:"div",role:J.getCellAriaRole(),attrs:{"comp-id":`${this.getCompId()}`,"col-id":J.column.colIdSanitised}});this.eCell=X;let Y;if(J.isCellSpanning())Y=z0({tag:"div",cls:"ag-spanned-cell-wrapper",role:"presentation"}),Y.appendChild(X),this.setTemplateFromElement(Y);else this.setTemplateFromElement(X);this.cellCssManager=new O9(()=>X),this.forceWrapper=J.isForceWrapper(),this.refreshWrapper(!1);let q={toggleCss:(G,H)=>this.cellCssManager.toggleCss(G,H),setUserStyles:(G)=>C6(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,H)=>this.refreshEditStyles(G,H)};J.setComp(q,X,Y,this.eCellWrapper,Q,$,void 0)}getParentOfValue(){return this.eCellValue??this.eCellWrapper??this.eCell}setRowResizerElement(z){if(this.rowResizerElement)S0(this.rowResizerElement);if(this.rowResizerElement=z,z)this.eCell.appendChild(z)}setRenderDetails(z,J,Q){if(this.cellEditor&&!this.cellEditorPopupWrapper)return;this.firstRender=this.firstRender==null;let $=this.refreshWrapper(!1);if(this.refreshEditStyles(!1),z){if(!(Q||$?!1:this.refreshCellRenderer(z)))this.destroyRenderer(),this.createCellRendererInstance(z)}else this.destroyRenderer(),this.insertValueWithoutCellRenderer(J);if(this.rowDraggingComp?.refreshVisibility(),this.rowResizerElement&&!this.rowResizerElement.parentElement)this.eCell.appendChild(this.rowResizerElement)}setEditDetails(z,J,Q){if(z)this.createCellEditorInstance(z,J,Q);else this.destroyEditor()}removeControls(){let z=this.beans.context;this.checkboxSelectionComp=z.destroyBean(this.checkboxSelectionComp),this.dndSourceComp=z.destroyBean(this.dndSourceComp),this.rowDraggingComp=z.destroyBean(this.rowDraggingComp)}refreshWrapper(z){let J=this.includeRowDrag||this.includeDndSource||this.includeSelection,Q=J||this.forceWrapper,Z=Q&&this.eCellWrapper==null;if(Z)this.eCellWrapper=z0({tag:"div",cls:"ag-cell-wrapper",role:"presentation"}),this.eCell.appendChild(this.eCellWrapper);let $=!Q&&this.eCellWrapper!=null;if($)S0(this.eCellWrapper),this.eCellWrapper=void 0;this.cellCssManager.toggleCss("ag-cell-value",!Q);let X=!z&&Q,Y=X&&this.eCellValue==null;if(Y){let H=this.cellCtrl.getCellValueClass();this.eCellValue=z0({tag:"span",cls:H,role:"presentation"}),this.eCellWrapper.appendChild(this.eCellValue)}let q=!X&&this.eCellValue!=null;if(q)S0(this.eCellValue),this.eCellValue=void 0;let G=Z||$||Y||q;if(G)this.removeControls();if(!z&&J)this.addControls();return G}addControls(){let{cellCtrl:z,eCellWrapper:J,eCellValue:Q,includeRowDrag:Z,includeDndSource:$,includeSelection:X}=this,Y=(q)=>{if(q)J.insertBefore(q.getGui(),Q)};if(Z&&this.rowDraggingComp==null)this.rowDraggingComp=z.createRowDragComp(),Y(this.rowDraggingComp);if($&&this.dndSourceComp==null)this.dndSourceComp=z.createDndSource(),Y(this.dndSourceComp);if(X&&this.checkboxSelectionComp==null)this.checkboxSelectionComp=z.createSelectionCheckbox(),Y(this.checkboxSelectionComp)}createCellEditorInstance(z,J,Q){let Z=this.editorVersion,$=z.newAgStackInstance(),{params:X}=z;if($.then((q)=>this.afterCellEditorCreated(Z,q,X,J,Q)),n(this.cellEditor)&&X.cellStartedEdit)this.cellCtrl.focusCell(!0)}insertValueWithoutCellRenderer(z){let J=this.getParentOfValue();J0(J);let Q=P6(z);if(Q!=null)J.textContent=Q}destroyRenderer(){let{context:z}=this.beans;this.cellRenderer=z.destroyBean(this.cellRenderer),S0(this.cellRendererGui),this.cellRendererGui=null,this.rendererVersion++}destroyEditor(){let{context:z}=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=z.destroyBean(this.cellEditor),this.cellEditorPopupWrapper=z.destroyBean(this.cellEditorPopupWrapper),S0(this.cellEditorGui),this.cellCtrl.disableEditorTooltipFeature(),this.cellEditorGui=null,this.editorVersion++}refreshCellRenderer(z){if(this.cellRenderer?.refresh==null)return!1;if(this.cellRendererClass!==z.componentClass)return!1;let J=this.cellRenderer.refresh(z.params);return J===!0||J===void 0}createCellRendererInstance(z){let J=this.rendererVersion,Q=(X)=>(Y)=>{if(this.rendererVersion!==J||!this.isAlive())return;let G=X.newAgStackInstance(),H=this.afterCellRendererCreated.bind(this,J,X.componentClass);G?.then(H)},{animationFrameSvc:Z}=this.beans,$;if(Z?.active&&this.firstRender)$=(X,Y=!1)=>{Z.createTask(Q(X),this.rowNode.rowIndex,"p2",X.componentFromFramework,Y)};else $=(X)=>Q(X)();if(z.params?.deferRender&&!this.cellCtrl.rowNode.group){let{loadingComp:X,onReady:Y}=this.cellCtrl.getDeferLoadingCellRenderer();if(X)$(X),Y.then(()=>$(z,!0))}else $(z)}afterCellRendererCreated(z,J,Q){if(!this.isAlive()||z!==this.rendererVersion){this.beans.context.destroyBean(Q);return}this.cellRenderer=Q,this.cellRendererClass=J;let $=Q.getGui();if(this.cellRendererGui=$,$!=null){let X=this.getParentOfValue();J0(X),X.appendChild($)}}afterCellEditorCreated(z,J,Q,Z,$){let X=z!==this.editorVersion,{context:Y}=this.beans;if(X){Y.destroyBean(J);return}if(J.isCancelBeforeStart?.()){Y.destroyBean(J),this.cellCtrl.stopEditing(!0);return}if(!J.getGui){R(97,{colId:this.column.getId()}),Y.destroyBean(J);return}this.cellEditor=J,this.cellEditorGui=J.getGui();let G=Z||J.isPopup?.();if(G)this.addPopupCellEditor(Q,$);else this.addInCellEditor();this.refreshEditStyles(!0,G),J.afterGuiAttached?.(),this.cellCtrl.enableEditorTooltipFeature(J),this.cellCtrl.cellEditorAttached()}refreshEditStyles(z,J){let{cellCssManager:Q}=this;Q.toggleCss("ag-cell-inline-editing",z&&!J),Q.toggleCss("ag-cell-popup-editing",z&&!!J),Q.toggleCss("ag-cell-not-inline-editing",!z||!!J)}addInCellEditor(){let{eCell:z}=this;if(z.contains(d(this.beans)))z.focus();if(this.destroyRenderer(),this.refreshWrapper(!0),J0(this.getParentOfValue()),this.cellEditorGui)this.getParentOfValue().appendChild(this.cellEditorGui)}addPopupCellEditor(z,J){let{gos:Q,context:Z,popupSvc:$,editSvc:X}=this.beans;if(Q.get("editType")==="fullRow")R(98);let Y=this.cellEditorPopupWrapper=Z.createBean(X.createPopupEditorWrapper(z)),{cellEditor:q,cellEditorGui:G,eCell:H,rowNode:_,column:U,cellCtrl:W}=this,B=Y.getGui();if(G)B.appendChild(G);let E=Q.get("stopEditingWhenCellsLoseFocus"),K=J!=null?J:q.getPopupPosition?.()??"over",F=Q.get("enableRtl"),L={ePopup:B,additionalParams:{column:U,rowNode:_},type:"popupCellEditor",eventSource:H,position:K,alignSide:F?"right":"left",keepWithinBounds:!0},D=$.positionPopupByComponent.bind($,L),M=$.addPopup({modal:E,eChild:B,closeOnEsc:!0,closedCallback:(f)=>{W.onPopupEditorClosed(f)},anchorToElement:H,positionCallback:D,ariaOwns:H});if(M)this.hideEditorPopup=M.hideFunc}detach(){this.getGui().remove()}destroy(){this.destroyRenderer(),this.destroyEditor(),this.removeControls(),super.destroy()}},fU=class extends y{constructor(z,J,Q){super();this.cellComps=new Map,this.beans=J,this.rowCtrl=z;let Z=z0({tag:"div",role:"row",attrs:{"comp-id":`${this.getCompId()}`}});this.setInitialStyle(Z,Q),this.setTemplateFromElement(Z);let $=Z.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)=>C6(Z,Y),setTop:(Y)=>$.top=Y,setTransform:(Y)=>$.transform=Y,setRowIndex:(Y)=>Z.setAttribute("row-index",Y),setRowId:(Y)=>Z.setAttribute("row-id",Y),setRowBusinessKey:(Y)=>Z.setAttribute("row-business-key",Y),refreshFullWidth:(Y)=>{let q=Y();return this.fullWidthCellRendererParams=q,this.fullWidthCellRenderer?.refresh?.(q)??!1}};z.setComp(X,this.getGui(),Q,void 0),this.addDestroyFunc(()=>{z.unsetComp(Q)})}setInitialStyle(z,J){let Q=this.rowCtrl.getInitialTransform(J);if(Q)z.style.setProperty("transform",Q);else{let Z=this.rowCtrl.getInitialRowTop(J);if(Z)z.style.setProperty("top",Z)}}showFullWidth(z){let J=(Z)=>{if(this.isAlive()){let $=Z.getGui();this.getGui().appendChild($),this.rowCtrl.setupDetailRowAutoHeight($),this.setFullWidthRowComp(Z,z.params)}else this.beans.context.destroyBean(Z)};z.newAgStackInstance().then(J)}setCellCtrls(z){let J=new Map(this.cellComps);for(let Q of z){let Z=Q.instanceId;if(!this.cellComps.has(Z))this.newCellComp(Q);else J.delete(Z)}this.destroyCells(J),this.ensureDomOrder(z)}ensureDomOrder(z){if(!this.domOrder)return;let J=[];for(let Q of z){let Z=this.cellComps.get(Q.instanceId);if(Z)J.push(Z.getGui())}x8(this.getGui(),J)}newCellComp(z){let J=this.beans.editSvc?.isEditing(z,{withOpenEditor:!0})??!1,Q=new kU(this.beans,z,this.rowCtrl.printLayout,this.getGui(),J);this.cellComps.set(z.instanceId,Q),this.getGui().appendChild(Q.getGui())}destroy(){super.destroy(),this.destroyCells(this.cellComps)}setFullWidthRowComp(z,J){this.fullWidthCellRenderer=z,this.fullWidthCellRendererParams=J,this.addDestroyFunc(()=>{this.fullWidthCellRenderer=this.beans.context.destroyBean(this.fullWidthCellRenderer),this.fullWidthCellRendererParams=void 0})}destroyCells(z){for(let J of z.values()){if(!J)continue;let Q=J.cellCtrl.instanceId;if(this.cellComps.get(Q)!==J)continue;J.detach(),J.destroy(),this.cellComps.delete(Q)}}};function VU(z,J,Q){let Z=!!Q.gos.get("enableCellSpan")&&!!J.getSpannedRowCtrls,$={tag:"div",ref:"eContainer",cls:e9(z),role:"rowgroup"};if(J.type==="center"||Z){let X={tag:"div",ref:"eSpannedContainer",cls:`ag-spanning-container ${YU(z)}`,role:"presentation"};return $.role="presentation",{tag:"div",ref:"eViewport",cls:`ag-viewport ${o9(z)}`,role:"rowgroup",children:[$,Z?X:null]}}return $}var SU=class extends y{constructor(z){super();this.eViewport=j,this.eContainer=j,this.eSpannedContainer=j,this.rowCompsNoSpan={},this.rowCompsWithSpan={},this.name=z?.name,this.options=c6(this.name)}postConstruct(){this.setTemplate(VU(this.name,this.options,this.beans));let z={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 Z=`translateY(${Q})`;if(this.eContainer.style.transform=Z,this.eSpannedContainer)this.eSpannedContainer.style.transform=Z}};this.createManagedBean(new FU(this.name)).setComp(z,this.eContainer,this.eSpannedContainer,this.eViewport)}destroy(){this.setRowCtrls([]),this.setRowCtrls([],!0),super.destroy(),this.lastPlacedElement=null}setRowCtrls(z,J){let{beans:Q,options:Z}=this,$=J?this.eSpannedContainer:this.eContainer,X=J?{...this.rowCompsWithSpan}:{...this.rowCompsNoSpan},Y={};if(J)this.rowCompsWithSpan=Y;else this.rowCompsNoSpan=Y;this.lastPlacedElement=null;let q=[];for(let G of z){let H=G.instanceId,_=X[H],U;if(_)U=_,delete X[H];else{if(!G.rowNode.displayed)continue;U=new fU(G,Q,Z.type)}Y[H]=U,q.push([U,!_])}this.removeOldRows(Object.values(X)),this.addRowNodes(q,$)}addRowNodes(z,J){let{domOrder:Q}=this;for(let[Z,$]of z){let X=Z.getGui();if(!Q){if($)J.appendChild(X)}else this.ensureDomOrder(X,J)}}removeOldRows(z){for(let J of z)J.getGui().remove(),J.destroy()}ensureDomOrder(z,J){y8(J,z,this.lastPlacedElement),this.lastPlacedElement=z}},AU={selector:"AG-ROW-CONTAINER",component:SU};function X6(z,J){return J.map((Q)=>{let Z=`e${Q[0].toUpperCase()+Q.substring(1)}RowContainer`;return z[Z]={name:Q},{tag:"ag-row-container",ref:Z,attrs:{name:Q}}})}function RU(z){let J={},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:X6(J,["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:X6(J,["left","center","right","fullWidth"])},{tag:"ag-fake-vertical-scroll"}]},{tag:"div",ref:"eStickyTop",cls:"ag-sticky-top",role:"presentation",children:X6(J,["stickyTopLeft","stickyTopCenter","stickyTopRight","stickyTopFullWidth"])},{tag:"div",ref:"eStickyBottom",cls:"ag-sticky-bottom",role:"presentation",children:X6(J,["stickyBottomLeft","stickyBottomCenter","stickyBottomRight","stickyBottomFullWidth"])},{tag:"div",ref:"eBottom",cls:"ag-floating-bottom",role:"presentation",children:X6(J,["bottomLeft","bottomCenter","bottomRight","bottomFullWidth"])},{tag:"ag-fake-horizontal-scroll"},z?{tag:"ag-overlay-wrapper"}:null]};return{paramsMap:J,elementParams:Q}}var jU=class extends y{constructor(){super(...arguments);this.eGridRoot=j,this.eBodyViewport=j,this.eStickyTop=j,this.eStickyBottom=j,this.eTop=j,this.eBottom=j,this.eBody=j}postConstruct(){let{overlays:z,rangeSvc:J}=this.beans,Q=z?.getOverlayWrapperSelector(),{paramsMap:Z,elementParams:$}=RU(!!Q);this.setTemplate($,[...Q?[Q]:[],t_,l_,i_,AU],Z);let X=(q,G)=>{let H=`${q}px`;G.style.minHeight=H,G.style.height=H},Y={setRowAnimationCssOnBodyViewport:(q,G)=>this.setRowAnimationCssOnBodyViewport(q,G),setColumnCount:(q)=>zG(this.getGui(),q),setRowCount:(q)=>eq(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 H=[this.eBodyViewport.classList,this.eBody.classList];for(let _ of H)_.toggle(M4.AUTO_HEIGHT,G.autoHeight),_.toggle(M4.NORMAL,G.normal),_.toggle(M4.PRINT,G.print);this.toggleCss(M4.AUTO_HEIGHT,G.autoHeight),this.toggleCss(M4.NORMAL,G.normal),this.toggleCss(M4.PRINT,G.print)},setAlwaysVerticalScrollClass:(q,G)=>this.eBodyViewport.classList.toggle(Q$,G),registerBodyViewportResizeListener:(q)=>{let G=P4(this.beans,this.eBodyViewport,q);this.addDestroyFunc(()=>G())},setPinnedTopBottomOverflowY:(q)=>this.eTop.style.overflowY=this.eBottom.style.overflowY=q,setCellSelectableCss:(q,G)=>{for(let H of[this.eTop,this.eBodyViewport,this.eBottom])H.classList.toggle(q,G)},setBodyViewportWidth:(q)=>this.eBodyViewport.style.width=q,setGridRootRole:(q)=>H0(this.eGridRoot,q)};if(this.ctrl=this.createManagedBean(new MU),this.ctrl.setComp(Y,this.getGui(),this.eBodyViewport,this.eTop,this.eBottom,this.eStickyTop,this.eStickyBottom),J&&d0(this.gos)||f6(this.gos))oq(this.getGui(),!0)}setRowAnimationCssOnBodyViewport(z,J){let Q=this.eBodyViewport.classList;Q.toggle("ag-row-animation",J),Q.toggle("ag-row-no-animation",!J)}getFocusableContainerName(){return"gridBody"}},OU={selector:"AG-GRID-BODY",component:jU},U6={TAB_GUARD:"ag-tab-guard",TAB_GUARD_TOP:"ag-tab-guard-top",TAB_GUARD_BOTTOM:"ag-tab-guard-bottom"},PU=class extends O0{constructor(z,J){super();this.stopPropagationCallbacks=J,this.skipTabGuardFocus=!1,this.forcingFocusOut=!1,this.allowFocus=!1;let{comp:Q,eTopGuard:Z,eBottomGuard:$,focusTrapActive:X,forceFocusOutWhenTabGuardsAreEmpty:Y,isFocusableContainer:q,focusInnerElement:G,onFocusIn:H,onFocusOut:_,shouldStopEventPropagation:U,onTabKeyDown:W,handleKeyDown:B,isEmpty:E,eFocusableElement:K}=z;this.comp=Q,this.eTopGuard=Z,this.eBottomGuard=$,this.providedFocusInnerElement=G,this.eFocusableElement=K,this.focusTrapActive=!!X,this.forceFocusOutWhenTabGuardsAreEmpty=!!Y,this.isFocusableContainer=!!q,this.providedFocusIn=H,this.providedFocusOut=_,this.providedShouldStopEventPropagation=U,this.providedOnTabKeyDown=W,this.providedHandleKeyDown=B,this.providedIsEmpty=E}postConstruct(){this.createManagedBean(new I9(this.eFocusableElement,this.stopPropagationCallbacks,{shouldStopEventPropagation:()=>this.shouldStopEventPropagation(),onTabKeyDown:(z)=>this.onTabKeyDown(z),handleKeyDown:(z)=>this.handleKeyDown(z),onFocusIn:(z)=>this.onFocusIn(z),onFocusOut:(z)=>this.onFocusOut(z)})),this.activateTabGuards();for(let z of[this.eTopGuard,this.eBottomGuard])this.addManagedElementListeners(z,{focus:this.onFocus.bind(this)})}handleKeyDown(z){if(this.providedHandleKeyDown)this.providedHandleKeyDown(z)}tabGuardsAreActive(){return!!this.eTopGuard&&this.eTopGuard.hasAttribute("tabIndex")}shouldStopEventPropagation(){if(this.providedShouldStopEventPropagation)return this.providedShouldStopEventPropagation();return!1}activateTabGuards(){if(this.forcingFocusOut)return;let z=this.gos.get("tabIndex");this.comp.setTabIndex(z.toString())}deactivateTabGuards(){this.comp.setTabIndex()}onFocus(z){if(this.isFocusableContainer&&!this.eFocusableElement.contains(z.relatedTarget)){if(!this.allowFocus){this.findNextElementOutsideAndFocus(z.target===this.eBottomGuard);return}}if(this.skipTabGuardFocus){this.skipTabGuardFocus=!1;return}if(this.forceFocusOutWhenTabGuardsAreEmpty){if(this.providedIsEmpty?this.providedIsEmpty():A4(this.eFocusableElement,".ag-tab-guard").length===0){this.findNextElementOutsideAndFocus(z.target===this.eBottomGuard);return}}if(this.isFocusableContainer&&this.eFocusableElement.contains(z.relatedTarget))return;let J=z.target===this.eBottomGuard;if(!(this.providedFocusInnerElement?this.providedFocusInnerElement(J):this.focusInnerElement(J))&&this.forceFocusOutWhenTabGuardsAreEmpty)this.findNextElementOutsideAndFocus(z.target===this.eBottomGuard)}findNextElementOutsideAndFocus(z){let J=Y0(this.beans),Q=A4(J.body,null,!0),Z=Q.indexOf(z?this.eTopGuard:this.eBottomGuard);if(Z===-1)return;let $,X;if(z)$=0,X=Z;else $=Z+1,X=Q.length;let Y=Q.slice($,X),q=this.gos.get("tabIndex");Y.sort((G,H)=>{let _=Number.parseInt(G.getAttribute("tabindex")||"0"),U=Number.parseInt(H.getAttribute("tabindex")||"0");if(U===q)return 1;if(_===q)return-1;if(_===0)return 1;if(U===0)return-1;return _-U}),Y[z?Y.length-1:0]?.focus()}onFocusIn(z){if(this.focusTrapActive||this.forcingFocusOut)return;if(this.providedFocusIn)this.providedFocusIn(z);if(!this.isFocusableContainer)this.deactivateTabGuards()}onFocusOut(z){if(this.focusTrapActive)return;if(this.providedFocusOut)this.providedFocusOut(z);if(!this.eFocusableElement.contains(z.relatedTarget))this.activateTabGuards()}onTabKeyDown(z){if(this.providedOnTabKeyDown){this.providedOnTabKeyDown(z);return}if(this.focusTrapActive)return;if(z.defaultPrevented)return;let J=this.tabGuardsAreActive();if(J)this.deactivateTabGuards();let Q=this.getNextFocusableElement(z.shiftKey);if(J)setTimeout(()=>this.activateTabGuards(),0);if(!Q)return;Q.focus(),z.preventDefault()}focusInnerElement(z=!1){let J=A4(this.eFocusableElement);if(this.tabGuardsAreActive())J.splice(0,1),J.splice(-1,1);if(!J.length)return!1;return J[z?J.length-1:0].focus({preventScroll:!0}),!0}getNextFocusableElement(z){return P0(this.beans,this.eFocusableElement,!1,z)}forceFocusOutOfContainer(z=!1){if(this.forcingFocusOut)return;let J=z?this.eTopGuard:this.eBottomGuard;this.activateTabGuards(),this.skipTabGuardFocus=!0,this.forcingFocusOut=!0,J.focus(),window.setTimeout(()=>{this.forcingFocusOut=!1,this.activateTabGuards()})}isTabGuard(z,J){return z===this.eTopGuard&&!J||z===this.eBottomGuard&&(J??!0)}setAllowFocus(z){this.allowFocus=z}},nZ=class extends O0{constructor(z,J){super();this.comp=z,this.stopPropagationCallbacks=J}initialiseTabGuard(z){this.eTopGuard=this.createTabGuard("top"),this.eBottomGuard=this.createTabGuard("bottom"),this.eFocusableElement=this.comp.getFocusableElement();let{eTopGuard:J,eBottomGuard:Q,eFocusableElement:Z,stopPropagationCallbacks:$}=this,X=[J,Q],Y={setTabIndex:(L)=>{for(let D of X)if(L==null)D.removeAttribute("tabindex");else D.setAttribute("tabindex",L)}};this.addTabGuards(J,Q);let{focusTrapActive:q=!1,onFocusIn:G,onFocusOut:H,focusInnerElement:_,handleKeyDown:U,onTabKeyDown:W,shouldStopEventPropagation:B,isEmpty:E,forceFocusOutWhenTabGuardsAreEmpty:K,isFocusableContainer:F}=z;this.tabGuardCtrl=this.createManagedBean(new PU({comp:Y,focusTrapActive:q,eTopGuard:J,eBottomGuard:Q,eFocusableElement:Z,onFocusIn:G,onFocusOut:H,focusInnerElement:_,handleKeyDown:U,onTabKeyDown:W,shouldStopEventPropagation:B,isEmpty:E,forceFocusOutWhenTabGuardsAreEmpty:K,isFocusableContainer:F},$))}getTabGuardCtrl(){return this.tabGuardCtrl}createTabGuard(z){let J=Y0(this.beans).createElement("div"),Q=z==="top"?U6.TAB_GUARD_TOP:U6.TAB_GUARD_BOTTOM;return J.classList.add(U6.TAB_GUARD,Q),H0(J,"presentation"),J}addTabGuards(z,J){let Q=this.eFocusableElement;Q.prepend(z),Q.append(J)}removeAllChildrenExceptTabGuards(){let z=[this.eTopGuard,this.eBottomGuard];J0(this.comp.getFocusableElement()),this.addTabGuards(...z)}forceFocusOutOfContainer(z=!1){this.tabGuardCtrl.forceFocusOutOfContainer(z)}appendChild(z,J,Q){if(!b6(J))J=J.getGui();let{eBottomGuard:Z}=this;if(Z)Z.before(J);else z(J,Q)}destroy(){let{eTopGuard:z,eBottomGuard:J}=this;S0(z),S0(J),super.destroy()}},o4=class extends x0{initialiseTabGuard(z,J){this.tabGuardFeature=this.createManagedBean(new nZ(this,J)),this.tabGuardFeature.initialiseTabGuard(z)}forceFocusOutOfContainer(z=!1){this.tabGuardFeature.forceFocusOutOfContainer(z)}appendChild(z,J){this.tabGuardFeature.appendChild(super.appendChild.bind(this),z,J)}},tZ=class extends o4{initialiseTabGuard(z){super.initialiseTabGuard(z,R1)}},V7=(z,J)=>{return N9(z,()=>k0(z.getGui(),J,!1,!0))},S7=(z)=>{return z?.getFocusableContainerName()??"external"},TU=(z)=>{if(z==null)return"external";return typeof z==="string"?z:"gridBody"},vU=class extends V{constructor(){super(...arguments);this.additionalFocusableContainers=new Set}setComp(z,J,Q){this.view=z,this.eGridHostDiv=J,this.eGui=Q,this.eGui.setAttribute("grid-id",this.beans.context.getId());let{dragAndDrop:Z,ctrlsSvc:$}=this.beans;Z?.registerGridDropTarget(()=>this.eGui,this),this.createManagedBean(new iZ(this.view)),this.view.setRtlClass(this.gos.get("enableRtl")?"ag-rtl":"ag-ltr");let X=P4(this.beans,this.eGridHostDiv,this.onGridSizeChanged.bind(this));this.addDestroyFunc(()=>X()),$.register("gridCtrl",this)}isDetailGrid(){return GJ(this.getGui())?.getAttribute("row-id")?.startsWith("detail")||!1}getOptionalSelectors(){let z=this.beans;return{paginationSelector:z.pagination?.getPaginationSelector(),gridHeaderDropZonesSelector:z.registry?.getSelector("AG-GRID-HEADER-DROP-ZONES"),sideBarSelector:z.sideBar?.getSelector(),statusBarSelector:z.registry?.getSelector("AG-STATUS-BAR"),watermarkSelector:z.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(z){let{view:J}=this;if(z===!1)J.setCursor(null);else J.setCursor(z===1?"ew-resize":"ns-resize")}disableUserSelect(z){this.view.setUserSelect(z?"none":null)}focusNextInnerContainer(z){let J=this.getFocusableContainers(),{indexWithFocus:Q,nextIndex:Z}=this.getNextFocusableIndex(J,z),$=Q===-1?z?J.length-1:0:Z,{gos:X,beans:{focusSvc:Y,navigation:q}}=this,G=X.getCallback("tabToNextGridContainer");if(G){let H=Y.getDefaultTabToNextGridContainerTarget({backwards:z,focusableContainers:J,nextIndex:$}),_=S7(J[$]),U=H==null&&_==="gridBody"?"gridBody":TU(H),W=G({backwards:z,previousContainer:S7(J[Q]),nextContainer:U,defaultTarget:H});if(W!==void 0){if(typeof W==="boolean")return W;if(typeof W==="string"){if(W==="gridBody")return this.focusGridBodyDefault(z)||void 0;let B=J.find((E)=>E.getFocusableContainerName()===W);if(!B){m8(`tabToNextGridContainer - ${W} container not found`);return}return V7(B,z)?!0:void 0}if(S_(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:z,focusableContainers:J,indexWithFocus:Q,nextIndex:$})||void 0}focusInnerElement(z){let{gos:J,beans:Q,beans:{focusSvc:Z,visibleCols:$}}=this;if(J.getCallback("focusGridInnerElement")?.({fromBottom:!!z}))return!0;let Y=this.getFocusableContainers();if(z){if(this.focusNextInnerContainerDefault({backwards:!0,focusableContainers:Y,indexWithFocus:Y.length,nextIndex:Y.length-1}))return!0;return Z.focusGridView({column:b($.allCols),backwards:!0})}let q=$.allCols;if(J.get("headerHeight")===0||D4(Q)){if(Z.focusGridView({column:q[0],backwards:z}))return!0;for(let G=1;G$.getGui().contains(Q));return{indexWithFocus:Z,nextIndex:Z+(J?-1:1)}}focusGridBodyDefault(z){let{gos:J,beans:Q,beans:{focusSvc:Z,visibleCols:{allCols:$}}}=this;if(z)return Z.focusGridView({column:b($),backwards:!0});if(J.get("headerHeight")===0||D4(Q))return Z.focusGridView({column:$[0]});return Z.focusFirstHeader()}focusNextInnerContainerDefault(z){let{backwards:J,focusableContainers:Q,indexWithFocus:Z}=z,$=J?-1:1;for(let X=z.nextIndex;X>=0&&XX:Zthis.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:""}},J=this.createManagedBean(new vU),Q=J.getOptionalSelectors(),Z=this.createTemplate(Q),$=[OU,...Object.values(Q).filter((X)=>!!X)];this.setTemplate(Z,$),J.setComp(z,this.eGridDiv,this.getGui()),this.insertGridIntoDom(),this.initialiseTabGuard({onTabKeyDown:()=>{return},focusInnerElement:(X)=>J.focusInnerElement(X),forceFocusOutWhenTabGuardsAreEmpty:!0,isEmpty:()=>!J.isFocusable()})}insertGridIntoDom(){let z=this.getGui();this.eGridDiv.appendChild(z),this.addDestroyFunc(()=>{z.remove(),D6(this.gos,"Grid removed from DOM")})}updateLayoutClasses(z,J){let Q=this.rootWrapperBody.classList,{AUTO_HEIGHT:Z,NORMAL:$,PRINT:X}=M4,{autoHeight:Y,normal:q,print:G}=J;Q.toggle(Z,Y),Q.toggle($,q),Q.toggle(X,G),this.toggleCss(Z,Y),this.toggleCss($,q),this.toggleCss(X,G)}createTemplate(z){let J=z.gridHeaderDropZonesSelector?{tag:"ag-grid-header-drop-zones",ref:"gridHeaderDropZones"}:null,Q=z.sideBarSelector?{tag:"ag-side-bar",ref:"sideBar"}:null,Z=z.statusBarSelector?{tag:"ag-status-bar",ref:"statusBar"}:null,$=z.watermarkSelector?{tag:"ag-watermark"}:null,X=z.paginationSelector?{tag:"ag-pagination",ref:"pagination"}:null;return{tag:"div",cls:"ag-root-wrapper",role:"presentation",children:[J,{tag:"div",ref:"rootWrapperBody",cls:"ag-root-wrapper-body",role:"presentation",children:[{tag:"ag-grid-body",ref:"gridBody"},Q]},Z,X,$]}}getFocusableElement(){return this.rootWrapperBody}forceFocusOutOfContainer(z=!1){if(!z&&this.pagination?.isDisplayed()){this.pagination.forceFocusOutOfContainer(z);return}super.forceFocusOutOfContainer(z)}getFocusableContainers(){let z=[...this.gridHeaderDropZones?.getFocusableContainers?.()??[],this.gridBody];for(let J of[this.sideBar,this.statusBar,this.pagination])if(J)z.push(J);return z.filter((J)=>M0(J.getGui()))}},p=(z,J)=>{for(let Q of Object.keys(J))J[Q]=z;return J},A7={dispatchEvent:"CommunityCore",...p("CommunityCore",{destroy:0,getGridId:0,getGridOption:0,isDestroyed:0,setGridOption:0,updateGridOptions:0,isModuleRegistered:0}),...p("GridState",{getState:0,setState:0}),...p("SharedRowSelection",{setNodesSelected:0,selectAll:0,deselectAll:0,selectAllFiltered:0,deselectAllFiltered:0,selectAllOnCurrentPage:0,deselectAllOnCurrentPage:0,getSelectedNodes:0,getSelectedRows:0}),...p("RowApi",{redrawRows:0,setRowNodeExpanded:0,getRowNode:0,addRenderedRowListener:0,getRenderedNodes:0,forEachNode:0,getFirstDisplayedRowIndex:0,getLastDisplayedRowIndex:0,getDisplayedRowAtIndex:0,getDisplayedRowCount:0}),...p("ScrollApi",{getVerticalPixelRange:0,getHorizontalPixelRange:0,ensureColumnVisible:0,ensureIndexVisible:0,ensureNodeVisible:0}),...p("KeyboardNavigation",{getFocusedCell:0,clearFocusedCell:0,setFocusedCell:0,tabToNextCell:0,tabToPreviousCell:0,setFocusedHeader:0}),...p("EventApi",{addEventListener:0,addGlobalListener:0,removeEventListener:0,removeGlobalListener:0}),...p("ValueCache",{expireValueCache:0}),...p("CellApi",{getCellValue:0}),...p("SharedMenu",{showColumnMenu:0,hidePopupMenu:0}),...p("Sort",{onSortChanged:0}),...p("PinnedRow",{getPinnedTopRowCount:0,getPinnedBottomRowCount:0,getPinnedTopRow:0,getPinnedBottomRow:0,forEachPinnedRow:0}),...p("Overlay",{showLoadingOverlay:0,showNoRowsOverlay:0,hideOverlay:0}),...p("RenderApi",{setGridAriaProperty:0,refreshCells:0,refreshHeader:0,isAnimationFrameQueueEmpty:0,flushAllAnimationFrames:0,getSizesForCurrentTheme:0,getCellRendererInstances:0}),...p("HighlightChanges",{flashCells:0}),...p("RowDrag",{addRowDropZone:0,removeRowDropZone:0,getRowDropZoneParams:0,getRowDropPositionIndicator:0,setRowDropPositionIndicator:0}),...p("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}),...p("ColumnAutoSize",{sizeColumnsToFit:0,autoSizeColumns:0,autoSizeAllColumns:0}),...p("ColumnGroup",{setColumnGroupOpened:0,getColumnGroup:0,getProvidedColumnGroup:0,getDisplayNameForColumnGroup:0,getColumnGroupState:0,setColumnGroupState:0,resetColumnGroupState:0,getLeftDisplayedColumnGroups:0,getCenterDisplayedColumnGroups:0,getRightDisplayedColumnGroups:0,getAllDisplayedColumnGroups:0}),...p("ColumnMove",{moveColumnByIndex:0,moveColumns:0}),...p("ColumnResize",{setColumnWidths:0}),...p("ColumnHover",{isColumnHovered:0}),...p("EditCore",{getCellEditorInstances:0,getEditingCells:0,getEditRowValues:0,stopEditing:0,startEditingCell:0,isEditing:0,validateEdit:0}),...p("BatchEdit",{startBatchEdit:0,cancelBatchEdit:0,commitBatchEdit:0,isBatchEditing:0}),...p("UndoRedoEdit",{undoCellEditing:0,redoCellEditing:0,getCurrentUndoSize:0,getCurrentRedoSize:0}),...p("FilterCore",{isAnyFilterPresent:0,onFilterChanged:0}),...p("ColumnFilter",{isColumnFilterPresent:0,getColumnFilterInstance:0,destroyFilter:0,setFilterModel:0,getFilterModel:0,getColumnFilterModel:0,setColumnFilterModel:0,showColumnFilter:0,hideColumnFilter:0,getColumnFilterHandler:0,doFilterAction:0}),...p("QuickFilter",{isQuickFilterPresent:0,getQuickFilter:0,resetQuickFilter:0}),...p("Find",{findGetActiveMatch:0,findGetTotalMatches:0,findGoTo:0,findNext:0,findPrevious:0,findGetNumMatches:0,findGetParts:0,findClearActive:0,findRefresh:0}),...p("Pagination",{paginationIsLastPageFound:0,paginationGetPageSize:0,paginationGetCurrentPage:0,paginationGetTotalPages:0,paginationGetRowCount:0,paginationGoToNextPage:0,paginationGoToPreviousPage:0,paginationGoToFirstPage:0,paginationGoToLastPage:0,paginationGoToPage:0}),...p("CsrmSsrmSharedApi",{expandAll:0,collapseAll:0,resetRowGroupExpansion:0}),...p("SsrmInfiniteSharedApi",{setRowCount:0,getCacheBlockState:0,isLastRowIndexKnown:0}),...p("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}),...p("CsvExport",{getDataAsCsv:0,exportDataAsCsv:0}),...p("InfiniteRowModel",{refreshInfiniteCache:0,purgeInfiniteCache:0,getInfiniteRowCount:0}),...p("AdvancedFilter",{getAdvancedFilterModel:0,setAdvancedFilterModel:0,showAdvancedFilterBuilder:0,hideAdvancedFilterBuilder:0}),...p("IntegratedCharts",{getChartModels:0,getChartRef:0,getChartImageDataURL:0,downloadChart:0,openChartToolPanel:0,closeChartToolPanel:0,createRangeChart:0,createPivotChart:0,createCrossFilterChart:0,updateChart:0,restoreChart:0}),...p("Clipboard",{copyToClipboard:0,cutToClipboard:0,copySelectedRowsToClipboard:0,copySelectedRangeToClipboard:0,copySelectedRangeDown:0,pasteFromClipboard:0}),...p("ExcelExport",{getDataAsExcel:0,exportDataAsExcel:0,getSheetDataForExcel:0,getMultipleSheetsAsExcel:0,exportMultipleSheetsAsExcel:0}),...p("SharedMasterDetail",{addDetailGridInfo:0,removeDetailGridInfo:0,getDetailGridInfo:0,forEachDetailGridInfo:0}),...p("ContextMenu",{showContextMenu:0}),...p("ColumnMenu",{showColumnChooser:0,hideColumnChooser:0}),...p("CellSelection",{getCellRanges:0,addCellRange:0,clearRangeSelection:0,clearCellSelection:0}),...p("SharedRowGrouping",{setRowGroupColumns:0,removeRowGroupColumns:0,addRowGroupColumns:0,getRowGroupColumns:0,moveRowGroupColumn:0}),...p("SharedAggregation",{addAggFuncs:0,clearAggFuncs:0,setColumnAggFunc:0}),...p("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}),...p("ServerSideRowModelApi",{getServerSideSelectionState:0,setServerSideSelectionState:0,applyServerSideTransaction:0,applyServerSideTransactionAsync:0,applyServerSideRowData:0,retryServerSideLoads:0,flushServerSideAsyncTransactions:0,refreshServerSide:0,getServerSideGroupLevelState:0,onRowHeightChanged:0,resetRowHeights:0}),...p("SideBar",{isSideBarVisible:0,setSideBarVisible:0,setSideBarPosition:0,openToolPanel:0,closeToolPanel:0,getOpenedToolPanel:0,refreshToolPanel:0,isToolPanelShowing:0,getToolPanelInstance:0,getSideBar:0}),...p("StatusBar",{getStatusPanel:0}),...p("AiToolkit",{getStructuredSchema:0})},WQ={isDestroyed:()=>!0,destroy(){},preConstruct(){},postConstruct(){},preWireBeans(){},wireBeans(){}},CU=(z,J)=>z.eventSvc.dispatchEvent(J),Z$=class{};Reflect.defineProperty(Z$,"name",{value:"GridApi"});var bU=class extends V{constructor(){super();this.beanName="apiFunctionSvc",this.api=new Z$,this.fns={...WQ,dispatchEvent:CU},this.preDestroyLink="";let{api:z}=this;for(let J of Object.keys(A7))z[J]=this.makeApi(J)[J]}postConstruct(){this.preDestroyLink=this.beans.frameworkOverrides.getDocLink("grid-lifecycle/#grid-pre-destroyed")}addFunction(z,J){let{fns:Q,beans:Z}=this;if(Q!==WQ)Q[z]=Z?.validation?.validateApiFunction(z,J)??J}makeApi(z){return{[z]:(...J)=>{let{beans:Q,fns:{[z]:Z}}=this;return Z?Z(Q,...J):this.apiNotFound(z)}}}apiNotFound(z){let{beans:J,gos:Q,preDestroyLink:Z}=this;if(!J)R(26,{fnName:z,preDestroyLink:Z});else{let $=A7[z];if(Q.assertModuleRegistered($,`api.${z}`))R(27,{fnName:z,module:$})}}destroy(){super.destroy(),this.fns=WQ,this.beans=null}};function yU(z){return z.context.getId()}function xU(z){z.gridDestroySvc.destroy()}function wU(z){return z.gridDestroySvc.destroyCalled}function NU(z,J){return z.gos.get(J)}function gU(z,J,Q){$$(z,{[J]:Q})}function $$(z,J){z.gos.updateGridOptions({options:J})}function hU(z,J){let Q=J.replace(/Module$/,"");return z.gos.isModuleRegistered(Q)}function P1(z,J,Q){let Z=h(z,J,Q);if(Z){let{className:X}=Z;if(typeof X==="string"&&X.includes("ag-icon")||typeof X==="object"&&X["ag-icon"])return Z}let $=z0({tag:"span"});return $.appendChild(Z),$}function h(z,J,Q){let Z=null;if(z==="smallDown")R(262);else if(z==="smallLeft")R(263);else if(z==="smallRight")R(264);let $=Q?.getColDef().icons;if($)Z=$[z];if(J.gos&&!Z){let X=J.gos.get("icons");if(X)Z=X[z]}if(Z){let X;if(typeof Z==="function")X=Z();else if(typeof Z==="string")X=Z;else{R(38,{iconName:z});return}if(typeof X==="string")return UZ(X);if(b6(X))return X;R(133,{iconName:z});return}else{let X=J.registry.getIcon(z);if(!X)J.validation?.validateIcon(z);return z0({tag:"span",cls:`ag-icon ag-icon-${X??z}`,role:"presentation",attrs:{unselectable:"on"}})}}var uU=".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)}",mU={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"}]}]},cU=class extends y{constructor(){super();this.dragSource=null,this.eIcon=j,this.eLabel=j,this.eGhost=j,this.registerCSS(uU)}postConstruct(){let z=(J)=>P1(J,this.beans,null);this.dropIconMap={pinned:z("columnMovePin"),hide:z("columnMoveHide"),move:z("columnMoveMove"),left:z("columnMoveLeft"),right:z("columnMoveRight"),group:z("columnMoveGroup"),aggregate:z("columnMoveValue"),pivot:z("columnMovePivot"),notAllowed:z("dropNotAllowed")}}init(z){this.dragSource=z.dragSource,this.setTemplate(mU),this.beans.environment.applyThemeClasses(this.eGhost)}destroy(){this.dragSource=null,super.destroy()}setIcon(z,J){let{eGhost:Q,eIcon:Z,dragSource:$,dropIconMap:X,gos:Y}=this;J0(Z);let q=null;if(!z)z=$?.getDefaultIconName?$.getDefaultIconName():"notAllowed";if(q=X[z],Q.classList.toggle("ag-dnd-ghost-not-allowed",z==="notAllowed"),Z.classList.toggle("ag-shake-left-to-right",J),q===X.hide&&Y.get("suppressDragLeaveHidesColumns"))return;if(q)Z.appendChild(q)}setLabel(z){this.eLabel.textContent=z}};var X$=(z,J)=>{if(J!=null&&z?.setPointerCapture)try{return z.setPointerCapture(J),z.hasPointerCapture(J)}catch{}return!1},pU=(z,J)=>{if(typeof PointerEvent>"u"||!(J instanceof PointerEvent))return null;let Q=J.pointerId;if(!X$(z,Q))return null;let Z={eElement:z,pointerId:Q,onLost($){dU(Z,$)}};return z.addEventListener("lostpointercapture",Z.onLost),Z},iU=(z)=>{if(!z)return;Y$(z);let{eElement:J,pointerId:Q}=z;if(!J)return;try{J.releasePointerCapture(Q)}catch{}z.eElement=null},Y$=(z)=>{let{eElement:J,onLost:Q}=z;if(J&&Q)J.removeEventListener("lostpointercapture",Q),z.onLost=null},dU=(z,J)=>{Y$(z);let{eElement:Q,pointerId:Z}=z;if(Q&&J.pointerId===Z)X$(Q,Z)},L2,f2,BQ={passive:!0},X1={passive:!1},v4=(z)=>{if(!f2)f2=new WeakSet;else if(f2.has(z))return!1;return f2.add(z),!0},nU=class extends O0{constructor(){super(...arguments);this.beanName="dragSvc",this.dragging=!1,this.drag=null,this.dragSources=[]}get startTarget(){return this.drag?.start.target??null}isPointer(){return!!L2?.has(J4(this.beans))}hasPointerCapture(){let z=this.drag?.pointerCapture;return!!(z&&this.beans.eRootDiv.hasPointerCapture?.(z.pointerId))}destroy(){if(this.drag)this.cancelDrag();let z=this.dragSources;for(let J of z)R7(J);z.length=0,super.destroy()}removeDragSource(z){let J=this.dragSources;for(let Q=0,Z=J.length;Qthis.onPointerDown(z,H),X1],[J,"mousedown",(H)=>this.onMouseDown(z,H)]);let G=this.gos.get("suppressTouch");if(Q&&!G)Fz(Z,[J,"touchstart",(_)=>this.onTouchStart(z,_),X1])}cancelDrag(z){let J=this.drag;if(z??(z=J?.eElement),z)this.eventSvc.dispatchEvent({type:"dragCancelled",target:z});J?.params.onDragCancel?.(),this.destroyDrag()}shouldPreventMouseEvent(z){let J=z.type;return(J==="mousemove"||J==="pointermove")&&z.cancelable&&L6(this.beans,z)&&!H6(KQ(z))}initDrag(z,...J){this.drag=z;let Q=this.beans,Z=(q)=>this.onScroll(q),$=(q)=>this.onKeyDown(q),X=J4(Q),Y=Y0(Q);Fz(z.handlers,[X,"contextmenu",k2],[X,"keydown",$],[Y,"scroll",Z,{capture:!0}],[Y.defaultView||window,"scroll",Z],...J)}destroyDrag(){this.dragging=!1;let z=this.drag;if(z){let J=z.rootEl;if(L2?.get(J)===z)L2.delete(J);this.drag=null,iU(z.pointerCapture),BZ(z.handlers)}}onPointerDown(z,J){if(this.isPointer())return;let Q=this.beans;if(f2?.has(J))return;let Z=J.pointerType;if(Z==="touch"){if(Q.gos.get("suppressTouch")||!z.includeTouch)return;if(z.stopPropagationForTouch)J.stopPropagation();if(H6(KQ(J)))return}if(!J.isPrimary)return;if(Z==="mouse"&&J.button!==0)return;this.destroyDrag();let $=J4(Q),X=z.eElement,Y=J.pointerId,q=new EQ($,z,J,Y);L2??(L2=new WeakMap),L2.set($,q);let G=(W)=>{if(W.pointerId===Y)this.onMouseOrPointerMove(W)},H=(W)=>{if(W.pointerId===Y)this.onMouseOrPointerUp(W)},_=(W)=>{if(W.pointerId===Y&&v4(W))this.cancelDrag()},U=(W)=>this.draggingPreventDefault(W);if(this.initDrag(q,[$,"pointerup",H],[$,"pointercancel",_],[$,"pointermove",G,X1],[$,"touchmove",U,X1],[X,"mousemove",U,X1]),z.dragStartPixels===0)this.onMouseOrPointerMove(J);else v4(J)}onTouchStart(z,J){if(this.gos.get("suppressTouch")||!z.includeTouch)return;if(!v4(J))return;if(H6(KQ(J)))return;if(z.stopPropagationForTouch)J.stopPropagation();if(this.isPointer()){if(this.dragging)k2(J);return}this.destroyDrag();let Z=this.beans,$=J4(Z),X=new EQ($,z,J.touches[0]),Y=(W)=>this.onTouchMove(W),q=(W)=>this.onTouchUp(W),G=(W)=>this.onTouchCancel(W),H=(W)=>this.draggingPreventDefault(W),_=J4(Z),U=J.target??z.eElement;if(this.initDrag(X,[U,"touchmove",Y,BQ],[U,"touchend",q,BQ],[U,"touchcancel",G,BQ],[_,"touchmove",H,X1],[_,"touchend",q,X1],[_,"touchcancel",G,X1]),z.dragStartPixels===0)this.onMove(X.start)}draggingPreventDefault(z){if(this.dragging)k2(z)}onMouseDown(z,J){if(J.button!==0)return;if(f2?.has(J))return;if(this.isPointer())return;let Q=this.beans;this.destroyDrag();let Z=new EQ(J4(Q),z,J),$=(q)=>this.onMouseOrPointerMove(q),X=(q)=>this.onMouseOrPointerUp(q),Y=J4(Q);if(this.initDrag(Z,[Y,"mousemove",$],[Y,"mouseup",X]),z.dragStartPixels===0)this.onMouseOrPointerMove(J);else v4(J)}onScroll(z){if(!v4(z))return;let J=this.drag,Q=J?.lastDrag;if(Q&&this.dragging)J.params?.onDragging?.(Q)}onMouseOrPointerMove(z){if(!v4(z))return;if(A1())Y0(this.beans).getSelection()?.removeAllRanges();if(this.shouldPreventMouseEvent(z))k2(z);this.onMove(z)}onTouchCancel(z){let J=this.drag;if(!J||!v4(z))return;if(!R2(J.start,z.changedTouches))return;this.cancelDrag()}onTouchMove(z){let J=this.drag;if(!J||!v4(z))return;let Q=R2(J.start,z.touches);if(Q)this.onMove(Q),this.draggingPreventDefault(z)}onMove(z){let J=this.drag;if(!J)return;J.lastDrag=z;let Q=J.params;if(!this.dragging){let Z=J.start,X=Q.dragStartPixels??4;if(g8(z,Z,X))return;if(this.dragging=!0,Q.capturePointer)J.pointerCapture=pU(this.beans.eRootDiv,z);if(this.eventSvc.dispatchEvent({type:"dragStarted",target:Q.eElement}),Q.onDragStart?.(Z),this.drag!==J)return;if(Q.onDragging?.(Z),this.drag!==J)return}Q.onDragging?.(z)}onTouchUp(z){let J=this.drag;if(J&&v4(z))this.onUp(R2(J.start,z.changedTouches))}onMouseOrPointerUp(z){if(v4(z))this.onUp(z)}onUp(z){let J=this.drag;if(!J)return;if(!z)z=J.lastDrag;if(z&&this.dragging)this.dragging=!1,J.params.onDragStop?.(z),this.eventSvc.dispatchEvent({type:"dragStopped",target:J.params.eElement});this.destroyDrag()}onKeyDown(z){if(z.key===k.ESCAPE)this.cancelDrag()}},R7=(z)=>{BZ(z.handlers);let J=z.oldTouchAction;if(J!=null){let Q=z.params.eElement.style;if(Q)Q.touchAction=J}},EQ=class{constructor(z,J,Q,Z=null){this.rootEl=z,this.params=J,this.start=Q,this.pointerId=Z,this.handlers=[],this.lastDrag=null,this.pointerCapture=null,this.eElement=J.eElement}},KQ=(z)=>{let J=z.target;return J instanceof Element?J:null},tU=class extends nU{shouldPreventMouseEvent(z){return this.gos.get("enableCellTextSelection")&&super.shouldPreventMouseEvent(z)}},rU=class extends V{constructor(){super(...arguments);this.beanName="horizontalResizeSvc"}addResizeBar(z){let J={dragStartPixels:z.dragStartPixels||0,eElement:z.eResizeBar,onDragStart:this.onDragStart.bind(this,z),onDragStop:this.onDragStop.bind(this,z),onDragging:this.onDragging.bind(this,z),onDragCancel:this.onDragStop.bind(this,z),includeTouch:!0,stopPropagationForTouch:!0},{dragSvc:Q}=this.beans;return Q.addDragSource(J),()=>Q.removeDragSource(J)}onDragStart(z,J){this.dragStartX=J.clientX,this.setResizeIcons();let Q=J instanceof MouseEvent&&J.shiftKey===!0;z.onResizeStart(Q)}setResizeIcons(){let z=this.beans.ctrlsSvc.get("gridCtrl");z.setResizeCursor(1),z.disableUserSelect(!0)}onDragStop(z){z.onResizeEnd(this.resizeAmount),this.resetIcons()}resetIcons(){let z=this.beans.ctrlsSvc.get("gridCtrl");z.setResizeCursor(!1),z.disableUserSelect(!1)}onDragging(z,J){this.resizeAmount=J.clientX-this.dragStartX,z.onResizing(this.resizeAmount)}};var WJ=class{constructor(z){if(this.tickingInterval=null,this.onScrollCallback=null,this.scrollContainer=z.scrollContainer,this.scrollHorizontally=z.scrollAxis.includes("x"),this.scrollVertically=z.scrollAxis.includes("y"),this.scrollByTick=z.scrollByTick??20,z.onScrollCallback)this.onScrollCallback=z.onScrollCallback;if(this.scrollVertically)this.getVerticalPosition=z.getVerticalPosition,this.setVerticalPosition=z.setVerticalPosition;if(this.scrollHorizontally)this.getHorizontalPosition=z.getHorizontalPosition,this.setHorizontalPosition=z.setHorizontalPosition;this.shouldSkipVerticalScroll=z.shouldSkipVerticalScroll||(()=>!1),this.shouldSkipHorizontalScroll=z.shouldSkipHorizontalScroll||(()=>!1)}get scrolling(){return this.tickingInterval!==null}check(z,J=!1){let Q=!this.scrollVertically||J||this.shouldSkipVerticalScroll(),Z=!this.scrollHorizontally||this.shouldSkipHorizontalScroll();if(Q&&Z)return;let $=this.scrollContainer.getBoundingClientRect(),X=this.scrollByTick;if(this.tickLeft=!Z&&z.clientX<$.left+X,this.tickRight=!Z&&z.clientX>$.right-X,this.tickUp=!Q&&z.clientY<$.top+X,this.tickDown=!Q&&z.clientY>$.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 z=this.tickCount>20?200:this.tickCount>10?80:40;if(this.scrollVertically){let J=this.getVerticalPosition();if(this.tickUp)this.setVerticalPosition(J-z);if(this.tickDown)this.setVerticalPosition(J+z)}if(this.scrollHorizontally){let J=this.getHorizontalPosition();if(this.tickLeft)this.setHorizontalPosition(J-z);if(this.tickRight)this.setHorizontalPosition(J+z)}if(this.onScrollCallback)this.onScrollCallback()}ensureCleared(){if(this.tickingInterval)window.clearInterval(this.tickingInterval),this.tickingInterval=null}},v2=class{constructor(){this.reordered=!1,this.removals=[],this.updates=new Set,this.adds=new Set}},$2=(z)=>{let J=z.childrenAfterGroup;while(J?.length){let Q=J[0];if(Q.sourceRowIndex>=0)return Q;J=Q.childrenAfterGroup}},q$=(z,J,Q,Z)=>{if(!J.size||!z)return!1;let $=!1,X=z.length??0,Y=-1;if(Q){if(Y=Q.sourceRowIndex,Q=Y<0?$2(Q):null,Q)Y=Q.sourceRowIndex}if(Y<0||Y>=X)Y=X;else if(!Z)++Y;let q=Y,G=Math.min(Y,X-1);for(let U of J){let W=U.sourceRowIndex;if(WG)G=W}let H=q;for(let U=q;U=Y;--U){let W=z[U];if(J.has(W))continue;if(W.sourceRowIndex!==_)W.sourceRowIndex=_,z[_]=W,$=!0;--_}for(let U of J){if(U.sourceRowIndex!==H)U.sourceRowIndex=H,z[H]=U,$=!0;++H}return $};function rZ(z,J){return m6(z,J.target)?.getFocusedCellPosition()??null}function sZ(z,J){let Q=A0(z.gos,"normal"),Z=J,$,X;if(Z.clientX!=null||Z.clientY!=null)$=Z.clientX,X=Z.clientY;else $=Z.x,X=Z.y;let{pageFirstPixel:Y}=z.pageBounds.getCurrentPagePixelRange();if(X+=Y,Q){let q=z.ctrlsSvc.getScrollFeature(),G=q.getVScrollPosition(),H=q.getHScrollPosition();$+=H.left,X+=G.top}return{x:$,y:X}}var BJ={moduleName:"Drag",version:c,beans:[tU]};var p6={moduleName:"SharedDragAndDrop",version:c,beans:[nH],dependsOn:[BJ],userComponents:{agDragAndDropImage:cU},icons:{columnMovePin:"pin",columnMoveHide:"eye-slash",columnMoveMove:"arrows",columnMoveLeft:"left",columnMoveRight:"right",columnMoveGroup:"group",columnMoveValue:"aggregation",columnMovePivot:"pivot",dropNotAllowed:"not-allowed",rowDrag:"grip"}};var lZ={moduleName:"HorizontalResize",version:c,beans:[rU],dependsOn:[BJ]},sU=":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}}",lU=class extends V{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,(z)=>this.gridBodyCtrl=z.gridBodyCtrl)}isActive(){return this.active&&!this.suppressAnimation}setSuppressAnimation(z){this.suppressAnimation=z}start(){if(this.active)return;let{gos:z}=this;if(z.get("suppressColumnMoveAnimation"))return;if(z.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(z){if(this.activeNext)this.executeNextFuncs.push(z);else z()}executeLaterVMTurn(z){if(this.active)this.executeLaterFuncs.push(z);else z()}ensureAnimationCssClassPresent(){this.animationThreadCount++;let z=this.animationThreadCount,{gridBodyCtrl:J}=this;J.setColumnMovingCss(!0),this.executeLaterFuncs.push(()=>{if(this.animationThreadCount===z)J.setColumnMovingCss(!1)})}flush(z,J){let{executeNextFuncs:Q,executeLaterFuncs:Z}=this;if(Q.length===0&&Z.length===0){z(),J();return}let $=(X)=>{while(X.length){let Y=X.pop();if(Y)Y()}};this.beans.frameworkOverrides.wrapIncoming(()=>{window.setTimeout(()=>{z(),$(Q)},0),window.setTimeout(()=>{J(),$(Z)},200)})}};function aU(z,J,Q){z.colMoves?.moveColumnByIndex(J,Q,"api")}function oU(z,J,Q){z.colMoves?.moveColumns(J,Q,"api")}var eU=class extends V{constructor(z){super();this.pinned=z,this.columnsToAggregate=[],this.columnsToGroup=[],this.columnsToPivot=[]}onDragEnter(z){if(this.clearColumnsList(),this.gos.get("functionsReadOnly"))return;let J=z.dragItem.columns;if(!J)return;for(let Q of J){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(z){this.clearColumnsList()}clearColumnsList(){this.columnsToAggregate.length=0,this.columnsToGroup.length=0,this.columnsToPivot.length=0}onDragging(z){}onDragStop(z){let{valueColsSvc:J,rowGroupColsSvc:Q,pivotColsSvc:Z}=this.beans;if(this.columnsToAggregate.length>0)J?.addColumns(this.columnsToAggregate,"toolPanelDragAndDrop");if(this.columnsToGroup.length>0)Q?.addColumns(this.columnsToGroup,"toolPanelDragAndDrop");if(this.columnsToPivot.length>0)Z?.addColumns(this.columnsToPivot,"toolPanelDragAndDrop")}onDragCancel(){this.clearColumnsList()}};function zW(z,J){if(!J||J.length<=1)return;if(J.filter((Z)=>z.indexOf(Z)<0).length>0)return;J.sort((Z,$)=>{let X=z.indexOf(Z),Y=z.indexOf($);return X-Y})}function JW(z){let J=[...z];for(let Q of z){let Z=null,$=Q.getParent();while($!=null&&$.getDisplayedLeafColumns().length===1)Z=$,$=$.getParent();if(Z!=null){let Y=Z.getColGroupDef()?.marryChildren?Z.getProvidedColumnGroup().getLeafColumns():Z.getLeafColumns();for(let q of Y)if(!J.includes(q))J.push(q)}}return J}function QW(z,J,Q,Z){let $=Z.allCols,X=null,Y=null;for(let q=0;q$.includes(W));if(Y===null)Y=_;else if(!Z0(_,Y))break;let U=$W(H);if(X===null||U=E)return;if(Q&&K<=E)return}let L=QW(B,W,H,_);if(!L)return;let D=L.move;if(D>G.getCols().length-W.length)return;return{columns:W,toIndex:D}}function H$(z){let{columns:J,toIndex:Q}=G$(z)||{},{finished:Z,colMoves:$}=z;if(!J||Q==null)return null;return $.moveColumns(J,Q,"uiColumnMoved",Z),Z?null:{columns:J,toIndex:Q}}function ZW(z,J){let Q=J.getCols(),Z=z.map((G)=>Q.indexOf(G)).sort((G,H)=>G-H),$=Z[0];return b(Z)-$!==Z.length-1?null:$}function $W(z){function J(Z){let $=[],X=Z.getOriginalParent();while(X!=null)$.push(X),X=X.getOriginalParent();return $}let Q=0;for(let Z=0;ZX.length?[$,X]:[X,$];for(let Y of $)if(X.indexOf(Y)===-1)Q++}return Q}function XW(z,J){switch(J){case"left":return z.leftCols;case"right":return z.rightCols;default:return z.centerCols}}function YW(z){let{movingCols:J,draggingRight:Q,xPosition:Z,pinned:$,gos:X,colModel:Y,visibleCols:q}=z;if(X.get("suppressMovableColumns")||J.some((M)=>M.getColDef().suppressMovable))return[];let H=XW(q,$),_=Y.getCols(),U=H.filter((M)=>J.includes(M)),W=H.filter((M)=>!J.includes(M)),B=_.filter((M)=>!J.includes(M)),E=0,K=Z;if(Q){let M=0;for(let f of U)M+=f.getActualWidth();K-=M}if(K>0){for(let M=0;M0){let M=W[E-1];F=B.indexOf(M)+1}else if(F=B.indexOf(W[0]),F===-1)F=0;let L=[F],D=(M,f)=>M-f;if(Q){let M=F+1,f=_.length-1;while(M<=f)L.push(M),M++;L.sort(D)}else{let M=F,f=_.length-1,S=_[M];while(M<=f&&H.indexOf(S)<0)M++,L.push(M),S=_[M];M=F-1;let A=0;while(M>=A)L.push(M),M--;L.sort(D).reverse()}return L}function mQ(z){let{pinned:J,fromKeyboard:Q,gos:Z,ctrlsSvc:$,useHeaderRow:X,skipScrollPadding:Y}=z,q=$.getHeaderRowContainerCtrl(J)?.eViewport,{x:G}=z;if(!q)return 0;if(Q)G-=q.getBoundingClientRect().left;if(Z.get("enableRtl")){if(X)q=q.querySelector(".ag-header-row");G=q.clientWidth-G}if(J==null&&!Y)G+=$.get("center").getCenterViewportScrollLeft();return G}function FQ(z,J){for(let Q of z)Q.moving=J,Q.dispatchColEvent("movingChanged","uiColumnMoved")}var j7=7,cQ=100,Wz=cQ/2,qW=5,GW=100,HW=class extends V{constructor(z){super();this.pinned=z,this.needToMoveLeft=!1,this.needToMoveRight=!1,this.lastMovedInfo=null,this.isCenterContainer=!T(z)}postConstruct(){this.beans.ctrlsSvc.whenReady(this,(z)=>{this.gridBodyCon=z.gridBodyCtrl})}getIconName(){let{pinned:z,lastDraggingEvent:J}=this,{dragItem:Q}=J||{},Z=Q?.columns??[];for(let $ of Z){let X=$.getPinned();if($.getColDef().lockPinned){if(X==z)return"move";continue}let Y=Q?.containerType;if(Y===z||!z)return"move";if(z&&(!X||Y!==z))return"pinned"}return"notAllowed"}onDragEnter(z){let J=z.dragItem,Q=J.columns;if(z.dragSource.type===0)this.setColumnsVisible(Q,!0,"uiColumnDragged");else{let $=J.visibleState,X=(Q||[]).filter((Y)=>$[Y.getId()]&&!Y.isVisible());this.setColumnsVisible(X,!0,"uiColumnDragged")}if(!this.gos.get("suppressMoveWhenColumnDragging"))this.attemptToPinColumns(Q,this.pinned);this.onDragging(z,!0,!0)}onDragging(z=this.lastDraggingEvent,J=!1,Q=!1,Z=!1){let{gos:$,ctrlsSvc:X}=this.beans,Y=$.get("suppressMoveWhenColumnDragging");if(Z&&!Y){this.finishColumnMoving();return}if(this.lastDraggingEvent=z,!z||!Z&&n(z.hDirection))return;let q=mQ({x:z.x,pinned:this.pinned,gos:$,ctrlsSvc:X});if(!J)this.checkCenterForScrolling(q);if(Y)this.handleColumnDragWhileSuppressingMovement(z,J,Q,q,Z);else this.handleColumnDragWhileAllowingMovement(z,J,Q,q,Z)}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,J,Q){if(!z?.length)return;let Z=z.filter(($)=>!$.getColDef().lockVisible);if(!Z.length)return;this.beans.colModel.setColsVisible(Z,J,Q)}finishColumnMoving(){this.clearHighlighted();let z=this.lastMovedInfo;if(!z)return;let{columns:J,toIndex:Q}=z;this.beans.colMoves.moveColumns(J,Q,"uiColumnMoved",!0)}updateDragItemContainerType(){let{lastDraggingEvent:z}=this;if(this.gos.get("suppressMoveWhenColumnDragging")||!z)return;let J=z.dragItem;if(!J)return;J.containerType=this.pinned}handleColumnDragWhileSuppressingMovement(z,J,Q,Z,$){let X=this.getAllMovingColumns(z,!0);if($){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:J,fakeEvent:Q,fromLeft:q})}else{if(!this.beans.dragAndDrop.isDropZoneWithinThisGrid(z))return;this.highlightHoveredColumn(X,Z)}}handleColumnDragWhileAllowingMovement(z,J,Q,Z,$){let X=this.getAllMovingColumns(z),Y=this.normaliseDirection(z.hDirection)==="right",q=z.dragSource.type===1,G=this.getMoveColumnParams({allMovingColumns:X,isFromHeader:q,xPosition:Z,fromLeft:Y,fromEnter:J,fakeEvent:Q}),H=H$({...G,finished:$});if(H)this.lastMovedInfo=H}getAllMovingColumns(z,J=!1){let Q=z.dragSource.getDragItem(),Z=null;if(J){if(Z=Q.columnsInSplit,!Z)Z=Q.columns}else Z=Q.columns;let $=(X)=>X.getColDef().lockPinned?X.getPinned()==this.pinned:!0;if(!Z)return[];return Z.filter($)}getMoveColumnParams(z){let{allMovingColumns:J,isFromHeader:Q,xPosition:Z,fromLeft:$,fromEnter:X,fakeEvent:Y}=z,{gos:q,colModel:G,colMoves:H,visibleCols:_}=this.beans;return{allMovingColumns:J,isFromHeader:Q,fromLeft:$,xPosition:Z,pinned:this.pinned,fromEnter:X,fakeEvent:Y,gos:q,colModel:G,colMoves:H,visibleCols:_}}highlightHoveredColumn(z,J){let{gos:Q,colModel:Z}=this.beans,$=Q.get("enableRtl"),X=Z.getCols().filter((_)=>_.isVisible()&&_.getPinned()===this.pinned),Y=null,q=null,G=null;for(let _ of X){if(q=_.getActualWidth(),Y=this.getNormalisedColumnLeft(_,0,$),Y!=null){let U=Y+q;if(Y<=J&&U>=J){G=_;break}}Y=null,q=null}if(!G){for(let _=X.length-1;_>=0;_--){let U=X[_],W=X[_].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,$),q=G.getActualWidth()}else if(z.indexOf(G)!==-1)G=null;if(G==null||Y==null||q==null){if(this.lastHighlightedColumn?.column!==G)this.clearHighlighted();return}let H;if(J-Yj7;return J&&Q||z.some((Z)=>Z.getPinned()!==this.pinned)}moveColumnsAfterHighlight(z){let{allMovingColumns:J,xPosition:Q,fromEnter:Z,fakeEvent:$,fromLeft:X}=z,Y=this.getMoveColumnParams({allMovingColumns:J,isFromHeader:!0,xPosition:Q,fromLeft:X,fromEnter:Z,fakeEvent:$}),{columns:q,toIndex:G}=G$(Y)||{};if(q&&G!=null)this.lastMovedInfo={columns:q,toIndex:G};this.finishColumnMoving()}clearHighlighted(){let{lastHighlightedColumn:z}=this;if(!z)return;O7(z.column,null),this.lastHighlightedColumn=null}checkCenterForScrolling(z){if(!this.isCenterContainer)return;let J=this.beans.ctrlsSvc.get("center"),Q=J.getCenterViewportScrollLeft(),Z=Q+J.getCenterWidth(),$,X;if(this.gos.get("enableRtl"))$=zZ-Wz;else X=zZ-Wz;if(this.needToMoveRight=$,this.needToMoveLeft=X,X||$)this.ensureIntervalStarted();else this.ensureIntervalCleared()}ensureIntervalStarted(){if(this.movingIntervalId)return;this.intervalCount=0,this.failedMoveAttempts=0,this.movingIntervalId=window.setInterval(this.moveInterval.bind(this),GW),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 z;if(this.intervalCount++,z=10+this.intervalCount*qW,z>cQ)z=cQ;let J=null,Q=this.gridBodyCon.scrollFeature;if(this.needToMoveLeft)J=Q.scrollHorizontally(-z);else if(this.needToMoveRight)J=Q.scrollHorizontally(z);if(J!==0)this.onDragging(this.lastDraggingEvent),this.failedMoveAttempts=0;else{this.failedMoveAttempts++;let{pinnedCols:Z,dragAndDrop:$,gos:X}=this.beans;if(this.failedMoveAttempts<=j7+1||!Z)return;if($.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,J,Q=!1){let Z=(z||[]).filter((Y)=>!Y.getColDef().lockPinned);if(!Z.length)return 0;if(Q)J=this.getPinDirection();let{pinnedCols:$,dragAndDrop:X}=this.beans;if($?.setColsPinned(Z,J,"uiColumnDragged"),Q)X.nudge();return Z.length}destroy(){super.destroy(),this.lastDraggingEvent=null,this.clearHighlighted(),this.lastMovedInfo=null}};function O7(z,J){if(z.highlighted===J)return;z.highlighted=J,z.dispatchColEvent("headerHighlightChanged","uiColumnMoved")}function _W(z){let J=z.length,Q,Z;for(let $=0;${let $,X=Z.gridBodyCtrl.eBodyViewport;switch(Q){case"left":$=[[X,Z.left.eContainer],[Z.bottomLeft.eContainer],[Z.topLeft.eContainer]];break;case"right":$=[[X,Z.right.eContainer],[Z.bottomRight.eContainer],[Z.topRight.eContainer]];break;default:$=[[X,Z.center.eViewport],[Z.bottomCenter.eViewport],[Z.topCenter.eViewport]];break}this.eSecondaryContainers=$}),this.moveColumnFeature=this.createManagedBean(new HW(Q)),this.bodyDropPivotTarget=this.createManagedBean(new eU(Q)),J.addDropTarget(this),this.addDestroyFunc(()=>J.removeDropTarget(this))}isInterestedIn(z){return z===1||z===0&&this.gos.get("allowDragFromColumnsToolPanel")}getSecondaryContainers(){return this.eSecondaryContainers}getContainer(){return this.eContainer}getIconName(){return this.currentDropListener.getIconName()}isDropColumnInPivotMode(z){return this.beans.colModel.isPivotMode()&&z.dragSource.type===0}onDragEnter(z){this.currentDropListener=this.isDropColumnInPivotMode(z)?this.bodyDropPivotTarget:this.moveColumnFeature,this.currentDropListener.onDragEnter(z)}onDragLeave(z){this.currentDropListener.onDragLeave(z)}onDragging(z){this.currentDropListener.onDragging(z)}onDragStop(z){this.currentDropListener.onDragStop(z)}onDragCancel(){this.currentDropListener.onDragCancel()}};function _$(z,J){let Q=[],Z=[],$=[];if(z.forEach((Y)=>{let q=Y.getColDef().lockPosition;if(q==="right")$.push(Y);else if(q==="left"||q===!0)Q.push(Y);else Z.push(Y)}),J.get("enableRtl"))return[...$,...Z,...Q];return[...Q,...Z,...$]}function U$(z,J){let Q=!0;return N4(null,J,(Z)=>{if(!G0(Z))return;let $=Z;if(!$.getColGroupDef()?.marryChildren)return;let q=[];for(let W of $.getLeafColumns()){let B=z.indexOf(W);q.push(B)}let G=Math.max.apply(Math,q),H=Math.min.apply(Math,q),_=G-H,U=$.getLeafColumns().length-1;if(_>U)Q=!1}),Q}var WW=class extends V{constructor(){super(...arguments);this.beanName="colMoves"}moveColumnByIndex(z,J,Q){let Z=this.beans.colModel.getCols();if(!Z)return;let $=Z[z];this.moveColumns([$],J,Q)}moveColumns(z,J,Q,Z=!0){let{colModel:$,colAnimation:X,visibleCols:Y,eventSvc:q}=this.beans,G=$.getCols();if(!G)return;if(J>G.length-z.length){R(30,{toIndex:J});return}X?.start();let H=$.getColsForKeys(z);if(this.doesMovePassRules(H,J))Y7($.getCols(),H,J),Y.refresh(Q),q.dispatchEvent({type:"columnMoved",columns:H,column:H.length===1?H[0]:null,toIndex:J,finished:Z,source:Q});X?.finish()}doesMovePassRules(z,J){let Q=this.getProposedColumnOrder(z,J);return this.doesOrderPassRules(Q)}doesOrderPassRules(z){let{colModel:J,gos:Q}=this.beans;if(!U$(z,J.getColTree()))return!1;if(!(($)=>{let X=(H)=>{if(!H)return 0;return H==="left"||H===!0?-1:1},Y=Q.get("enableRtl"),q=Y?1:-1,G=!0;for(let H of $){let _=X(H.getColDef().lockPosition);if(Y){if(_>q)G=!1}else if(_q?"hide":"notAllowed",getDragItem:G?()=>KW(J,Y.allCols):()=>EW(J),dragItemName:Q,onDragStarted:()=>{q=!Z.get("suppressDragLeaveHidesColumns"),FQ(H,!0)},onDragStopped:()=>FQ(H,!1),onDragCancelled:()=>FQ(H,!1),onGridEnter:(W)=>{if(q){let{columns:B=[],visibleState:E}=W??{},K=G?(L)=>!E||E[L.getColId()]:()=>!0,F=B.filter((L)=>!L.getColDef().lockVisible&&K(L));$.setColsVisible(F,!0,"uiColumnMoved")}},onGridExit:(W)=>{if(q){let B=W?.columns?.filter((E)=>!E.getColDef().lockVisible)||[];$.setColsVisible(B,!1,"uiColumnMoved")}}};return X.addDragSource(U,!0),U}};function BW(z,J){while(z){if(z.getGroupId()===J)return z;z=z.getParent()}return}function EW(z){let J={};return J[z.getId()]=z.isVisible(),{columns:[z],visibleState:J,containerType:z.pinned}}function KW(z,J){let Q=z.getProvidedColumnGroup().getLeafColumns(),Z={};for(let q of Q)Z[q.getId()]=q.isVisible();let $=[];for(let q of J)if(Q.indexOf(q)>=0)$.push(q),X0(Q,q);for(let q of Q)$.push(q);let X=[],Y=z.getLeafColumns();for(let q of $)if(Y.indexOf(q)!==-1)X.push(q);return{columns:$,columnsInSplit:X,visibleState:Z,containerType:X[0]?.pinned}}var i6={moduleName:"ColumnMove",version:c,beans:[WW,lU],apiFunctions:{moveColumnByIndex:aU,moveColumns:oU},dependsOn:[p6],css:[sU]},FW=class extends V{constructor(){super(...arguments);this.beanName="autoWidthCalc"}postConstruct(){this.beans.ctrlsSvc.whenReady(this,(z)=>{this.centerRowContainerCtrl=z.center})}getPreferredWidthForColumn(z,J){let Q=this.getHeaderCellForColumn(z);if(!Q)return-1;let Z=this.beans.rowRenderer.getAllCellsNotSpanningForColumn(z);if(!J)Z.push(Q);return this.getPreferredWidthForElements(Z)}getPreferredWidthForColumnGroup(z){let J=this.getHeaderCellForColumn(z);if(!J)return-1;return this.getPreferredWidthForElements([J])}getPreferredWidthForElements(z,J){let Q=document.createElement("form");Q.style.position="fixed";let Z=this.centerRowContainerCtrl.eContainer;for(let X of z)this.cloneItemIntoDummy(X,Q);Z.appendChild(Q);let $=Math.ceil(Q.getBoundingClientRect().width);return Q.remove(),J=J??this.gos.get("autoSizePadding"),$+J}getHeaderCellForColumn(z){let J=null;for(let Q of this.beans.ctrlsSvc.getHeaderRowContainerCtrls()){let Z=Q.getHtmlElementForColumnHeader(z);if(Z!=null)J=Z}return J}cloneItemIntoDummy(z,J){let Q=z.cloneNode(!0);Q.style.width="",Q.style.position="static",Q.style.left="";let Z=document.createElement("div"),$=Z.classList;if(["ag-header-cell","ag-header-group-cell"].some((q)=>Q.classList.contains(q)))$.add("ag-header","ag-header-row"),Z.style.position="static";else $.add("ag-row");let Y=z.parentElement;while(Y){if(["ag-header-row","ag-row"].some((G)=>Y.classList.contains(G))){for(let G=0;GX.getPinned());z.dispatchEvent({type:"columnPinned",pinned:$!=null?$:null,columns:J,column:Z,source:Q})}function DW(z,J,Q){if(!J.length)return;let Z=J.length===1?J[0]:null,$=B$(J,(X)=>X.isVisible());z.dispatchEvent({type:"columnVisible",visible:$,columns:J,column:Z,source:Q})}function K$(z,J,Q,Z){z.dispatchEvent({type:J,columns:Q,column:Q&&Q.length==1?Q[0]:null,source:Z})}function w2(z,J,Q,Z,$=null){if(J?.length)z.dispatchEvent({type:"columnResized",columns:J,column:J.length===1?J[0]:null,flexColumns:$,finished:Q,source:Z})}var MW=class extends V{constructor(z,J,Q,Z){super();this.comp=z,this.eResize=J,this.pinned=Q,this.columnGroup=Z}postConstruct(){if(!this.columnGroup.isResizable()){this.comp.setResizableDisplayed(!1);return}let{horizontalResizeSvc:z,gos:J,colAutosize:Q}=this.beans,Z=z.addResizeBar({eResizeBar:this.eResize,onResizeStart:this.onResizeStart.bind(this),onResizing:this.onResizing.bind(this,!1),onResizeEnd:this.onResizing.bind(this,!0)});if(this.addDestroyFunc(Z),!J.get("suppressAutoSize")&&Q)this.addDestroyFunc(Q.addColumnGroupResize(this.eResize,this.columnGroup,()=>this.resizeLeafColumnsToFit("uiColumnResized")))}onResizeStart(z){let{columnsToResize:J,resizeStartWidth:Q,resizeRatios:Z,groupAfterColumns:$,groupAfterStartWidth:X,groupAfterRatios:Y}=this.getInitialValues(z);this.resizeCols=J,this.resizeStartWidth=Q,this.resizeRatios=Z,this.resizeTakeFromCols=$,this.resizeTakeFromStartWidth=X,this.resizeTakeFromRatios=Y,this.toggleColumnResizing(!0)}onResizing(z,J,Q="uiColumnResized"){let Z=this.normaliseDragChange(J),$=this.resizeStartWidth+Z;this.resizeColumnsFromLocalValues($,Q,z)}getInitialValues(z){let J=(G)=>G.reduce((H,_)=>H+_.getActualWidth(),0),Q=(G,H)=>G.map((_)=>_.getActualWidth()/H),Z=this.getColumnsToResize(),$=J(Z),X=Q(Z,$),Y={columnsToResize:Z,resizeStartWidth:$,resizeRatios:X},q=null;if(z)q=this.beans.colGroupSvc?.getGroupAtDirection(this.columnGroup,"After")??null;if(q){let G=q.getDisplayedLeafColumns(),H=Y.groupAfterColumns=G.filter((U)=>U.isResizable()),_=Y.groupAfterStartWidth=J(H);Y.groupAfterRatios=Q(H,_)}else Y.groupAfterColumns=void 0,Y.groupAfterStartWidth=void 0,Y.groupAfterRatios=void 0;return Y}resizeLeafColumnsToFit(z){let J=this.beans.autoWidthCalc.getPreferredWidthForColumnGroup(this.columnGroup),Q=this.getInitialValues();if(J>Q.resizeStartWidth)this.resizeColumns(Q,J,z,!0)}resizeColumnsFromLocalValues(z,J,Q=!0){if(!this.resizeCols||!this.resizeRatios)return;let Z={columnsToResize:this.resizeCols,resizeStartWidth:this.resizeStartWidth,resizeRatios:this.resizeRatios,groupAfterColumns:this.resizeTakeFromCols,groupAfterStartWidth:this.resizeTakeFromStartWidth,groupAfterRatios:this.resizeTakeFromRatios};this.resizeColumns(Z,z,J,Q)}resizeColumns(z,J,Q,Z=!0){let{columnsToResize:$,resizeStartWidth:X,resizeRatios:Y,groupAfterColumns:q,groupAfterStartWidth:G,groupAfterRatios:H}=z,_=[];if(_.push({columns:$,ratios:Y,width:J}),q){let U=J-X;_.push({columns:q,ratios:H,width:G-U})}if(this.beans.colResize?.resizeColumnSets({resizeSets:_,finished:Z,source:Q}),Z)this.toggleColumnResizing(!1)}toggleColumnResizing(z){this.comp.toggleCss("ag-column-resizing",z)}getColumnsToResize(){return this.columnGroup.getDisplayedLeafColumns().filter((J)=>J.isResizable())}normaliseDragChange(z){let J=z;if(this.gos.get("enableRtl")){if(this.pinned!=="left")J*=-1}else if(this.pinned==="right")J*=-1;return J}destroy(){super.destroy(),this.resizeCols=void 0,this.resizeRatios=void 0,this.resizeTakeFromCols=void 0,this.resizeTakeFromRatios=void 0}},kW=class extends V{constructor(z,J,Q,Z,$){super();this.pinned=z,this.column=J,this.eResize=Q,this.comp=Z,this.ctrl=$}postConstruct(){let z=[],J,Q,Z=()=>{if(w(this.eResize,J),!J)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(z.push(G),Q&&q)z.push(q.addColumnAutosizeListeners(this.eResize,this.column))},$=()=>{for(let Y of z)Y();z.length=0},X=()=>{let Y=this.column.isResizable(),q=!this.gos.get("suppressAutoSize")&&!this.column.getColDef().suppressAutoSize;if(Y!==J||q!==Q)J=Y,Q=q,$(),Z()};X(),this.addDestroyFunc($),this.ctrl.setRefreshFunction("resize",X)}onResizing(z,J){let{column:Q,lastResizeAmount:Z,resizeStartWidth:$,beans:X}=this,Y=this.normaliseResizeAmount(J),q=$+Y,G=[{key:Q,newWidth:q}],{pinnedCols:H,ctrlsSvc:_,colResize:U}=X;if(this.column.getPinned()){let W=H?.leftWidth??0,B=H?.rightWidth??0,E=s1(_.getGridBodyCtrl().eBodyViewport)-50;if(W+B+(Y-Z)>E)return}if(this.lastResizeAmount=Y,U?.setColumnWidths(G,this.resizeWithShiftKey,z,"uiColumnResized"),z)this.toggleColumnResizing(!1)}onResizeStart(z){this.resizeStartWidth=this.column.getActualWidth(),this.lastResizeAmount=0,this.resizeWithShiftKey=z,this.toggleColumnResizing(!0)}toggleColumnResizing(z){this.column.resizing=z,this.comp.toggleCss("ag-column-resizing",z)}normaliseResizeAmount(z){let J=z,Q=this.pinned!=="left",Z=this.pinned==="right";if(this.gos.get("enableRtl")){if(Q)J*=-1}else if(Z)J*=-1;return J}},fW=class extends V{constructor(){super(...arguments);this.beanName="colResize"}setColumnWidths(z,J,Q,Z){let $=[],{colModel:X,gos:Y,visibleCols:q}=this.beans;for(let G of z){let H=X.getColDefCol(G.key)||X.getCol(G.key);if(!H)continue;if($.push({width:G.newWidth,ratios:[1],columns:[H]}),Y.get("colResizeDefault")==="shift")J=!J;if(J){let U=q.getColAfter(H);if(!U)continue;let W=H.getActualWidth()-G.newWidth,B=U.getActualWidth()+W;$.push({width:B,ratios:[1],columns:[U]})}}if($.length===0)return;this.resizeColumnSets({resizeSets:$,finished:Q,source:Z})}resizeColumnSets(z){let{resizeSets:J,finished:Q,source:Z}=z;if(!(!J||J.every((_)=>VW(_)))){if(Q){let _=J&&J.length>0?J[0].columns:null;w2(this.eventSvc,_,Q,Z)}return}let X=[],Y=[];for(let _ of J){let{width:U,columns:W,ratios:B}=_,E={},K={};for(let D of W)Y.push(D);let F=!0,L=0;while(F){if(L++,L>1000){t(31);break}F=!1;let D=[],M=0,f=U;W.forEach((A,O)=>{if(K[A.getId()])f-=E[A.getId()];else{D.push(A);let I=B[O];M+=I}});let S=1/M;D.forEach((A,O)=>{let v=O===D.length-1,I;if(v)I=f;else I=Math.round(B[O]*U*S),f-=I;let x=A.getMinWidth(),m=A.getMaxWidth();if(I0&&I>m)I=m,K[A.getId()]=!0,F=!0;E[A.getId()]=I})}for(let D of W){let M=E[D.getId()];if(D.getActualWidth()!==M)D.setActualWidth(M,Z),X.push(D)}}let q=X.length>0,G=[];if(q){let{colFlex:_,visibleCols:U,colViewport:W}=this.beans;G=_?.refreshFlexedColumns({resizingCols:Y,skipSetLeft:!0})??[],U.setLeftValues(Z),U.updateBodyWidths(),W.checkViewportColumns()}let H=Y.concat(G);if(q||Q)w2(this.eventSvc,H,Q,Z,G)}resizeHeader(z,J,Q){if(!z.isResizable())return;let Z=z.getActualWidth(),$=z.getMinWidth(),X=z.getMaxWidth(),Y=Math.min(Math.max(Z+J,$),X);this.setColumnWidths([{key:z,newWidth:Y}],Q,!0,"uiColumnResized")}createResizeFeature(z,J,Q,Z,$){return new kW(z,J,Q,Z,$)}createGroupResizeFeature(z,J,Q,Z){return new MW(z,J,Q,Z)}};function VW(z){let{columns:J,width:Q}=z,Z=0,$=0,X=!0;for(let G of J){let H=G.getMinWidth();Z+=H||0;let _=G.getMaxWidth();if(_>0)$+=_;else X=!1}let Y=Q>=Z,q=!X||Q<=$;return Y&&q}var SW={moduleName:"ColumnResize",version:c,beans:[fW],apiFunctions:{setColumnWidths:LW},dependsOn:[lZ,W$]},AW=class extends V{constructor(z,J){super();this.removeChildListenersFuncs=[],this.columnGroup=J,this.comp=z}postConstruct(){this.addListenersToChildrenColumns(),this.addManagedListeners(this.columnGroup,{displayedChildrenChanged:this.onDisplayedChildrenChanged.bind(this)}),this.onWidthChanged(),this.addDestroyFunc(this.removeListenersOnChildrenColumns.bind(this))}addListenersToChildrenColumns(){this.removeListenersOnChildrenColumns();let z=this.onWidthChanged.bind(this);for(let J of this.columnGroup.getLeafColumns())J.__addEventListener("widthChanged",z),J.__addEventListener("visibleChanged",z),this.removeChildListenersFuncs.push(()=>{J.__removeEventListener("widthChanged",z),J.__removeEventListener("visibleChanged",z)})}removeListenersOnChildrenColumns(){for(let z of this.removeChildListenersFuncs)z();this.removeChildListenersFuncs=[]}onDisplayedChildrenChanged(){this.addListenersToChildrenColumns(),this.onWidthChanged()}onWidthChanged(){let z=this.columnGroup.getActualWidth();this.comp.setWidth(`${z}px`),this.comp.toggleCss("ag-hidden",z===0)}},RW=class extends pZ{constructor(){super(...arguments);this.onSuppressColMoveChange=()=>{if(!this.isAlive()||this.isSuppressMoving())this.removeDragSource();else if(!this.dragSource)this.setDragSource(this.eGui)}}wireComp(z,J,Q,Z,$){let{column:X,beans:Y}=this,{context:q,colNames:G,colHover:H,rangeSvc:_,colResize:U}=Y;this.comp=z,$=u6(this,q,$),this.setGui(J,$),this.displayName=G.getDisplayNameForColumnGroup(X,"header"),this.refreshHeaderStyles(),this.addClasses(),this.setupMovingCss($),this.setupExpandable($),this.setupTooltip(),this.refreshAnnouncement(),this.setupAutoHeight({wrapperElement:Z,compBean:$}),this.setupUserComp(),this.addHeaderMouseListeners($,Z),this.addManagedPropertyListener("groupHeaderHeight",this.refreshMaxHeaderHeight.bind(this)),this.refreshMaxHeaderHeight();let W=this.rowCtrl.pinned,B=X.getProvidedColumnGroup().getLeafColumns();if(H?.createHoverFeature($,B,J),_?.createRangeHighlightFeature($,X,z),$.createManagedBean(new cZ(X,J,Y)),$.createManagedBean(new AW(z,X)),U)this.resizeFeature=$.createManagedBean(U.createGroupResizeFeature(z,Q,W,X));else z.setResizableDisplayed(!1);$.createManagedBean(new a4(J,{shouldStopEventPropagation:this.shouldStopEventPropagation.bind(this),onTabKeyDown:()=>{return},handleKeyDown:this.handleKeyDown.bind(this),onFocusIn:this.onFocusIn.bind(this)})),this.addHighlightListeners($,B),this.addManagedEventListeners({cellSelectionChanged:()=>this.refreshAnnouncement()}),$.addManagedPropertyListener("suppressMovableColumns",this.onSuppressColMoveChange),this.addResizeAndMoveKeyboardListeners($),$.addDestroyFunc(()=>this.clearComponent())}getHeaderClassParams(){let{column:z,beans:J}=this,Q=z.getDefinition();return C(J.gos,{colDef:Q,columnGroup:z,floatingFilter:!1})}refreshMaxHeaderHeight(){let{gos:z,comp:J}=this,Q=z.get("groupHeaderHeight");if(Q!=null)if(Q===0)J.setHeaderWrapperHidden(!0);else J.setHeaderWrapperMaxHeight(Q);else J.setHeaderWrapperHidden(!1),J.setHeaderWrapperMaxHeight(null)}addHighlightListeners(z,J){if(!this.beans.gos.get("suppressMoveWhenColumnDragging"))return;for(let Q of J)z.addManagedListeners(Q,{headerHighlightChanged:this.onLeafColumnHighlightChanged.bind(this,Q)})}onLeafColumnHighlightChanged(z){let J=this.column.getDisplayedLeafColumns(),Q=J[0]===z,Z=b(J)===z;if(!Q&&!Z)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"),H=$===1,_=$===0;if(Q)if(G)q=H;else Y=_;if(Z)if(G)Y=_;else q=H}this.comp.toggleCss("ag-header-highlight-before",Y),this.comp.toggleCss("ag-header-highlight-after",q)}resizeHeader(z,J){let{resizeFeature:Q}=this;if(!Q)return;let Z=Q.getInitialValues(J);Q.resizeColumns(Z,Z.resizeStartWidth+z,"uiColumnResized",!0)}resizeLeafColumnsToFit(z){this.resizeFeature?.resizeLeafColumnsToFit(z)}setupUserComp(){let{colGroupSvc:z,userCompFactory:J,gos:Q,enterpriseMenuFactory:Z}=this.beans,$=this.column,X=$.getProvidedColumnGroup(),Y=C(Q,{displayName:this.displayName,columnGroup:$,setExpanded:(G)=>{z.setColumnGroupOpened(X,G,"gridInitializing")},setTooltip:(G,H)=>{Q.assertModuleRegistered("Tooltip",3),this.setupTooltip(G,H)},showColumnMenu:(G,H)=>Z?.showMenuAfterButtonClick(X,G,"columnMenu",H),showColumnMenuAfterMouseClick:(G,H)=>Z?.showMenuAfterMouseEvent(X,G,"columnMenu",H),eGridHeader:this.eGui}),q=gH(J,Y);if(q)this.comp.setUserCompDetails(q)}addHeaderMouseListeners(z,J){let{column:Q,comp:Z,beans:{rangeSvc:$},gos:X}=this,Y=(_)=>this.handleMouseOverChange(_.type==="mouseenter"),q=()=>this.dispatchColumnMouseEvent("columnHeaderClicked",Q.getProvidedColumnGroup()),G=(_)=>this.handleContextMenuMouseEvent(_,void 0,Q.getProvidedColumnGroup());z.addManagedListeners(this.eGui,{mouseenter:Y,mouseleave:Y,click:q,contextmenu:G}),Z.toggleCss("ag-header-group-cell-selectable",E1(X));let H=$?.createHeaderGroupCellMouseListenerFeature(this.column,J);if(H)this.createManagedBean(H)}handleMouseOverChange(z){this.eventSvc.dispatchEvent({type:z?"columnHeaderMouseOver":"columnHeaderMouseLeave",column:this.column.getProvidedColumnGroup()})}setupTooltip(z,J){this.tooltipFeature=this.beans.tooltipSvc?.setupHeaderGroupTooltip(this.tooltipFeature,this,z,J)}setupExpandable(z){let J=this.column.getProvidedColumnGroup();this.refreshExpanded();let Q=this.refreshExpanded.bind(this);z.addManagedListeners(J,{expandedChanged:Q,expandableChanged:Q})}refreshExpanded(){let{column:z}=this;this.expandable=z.isExpandable();let J=z.isExpanded();if(this.expandable)this.comp.setAriaExpanded(J?"true":"false");else this.comp.setAriaExpanded(void 0);this.refreshHeaderStyles()}addClasses(){let{column:z}=this,J=z.getColGroupDef(),Q=_J(J,this.gos,null,z);if(z.isPadding()){if(Q.push("ag-header-group-cell-no-group"),z.getLeafColumns().every(($)=>$.isSpanHeaderHeight()))Q.push("ag-header-span-height")}else if(Q.push("ag-header-group-cell-with-group"),J?.wrapHeaderText)Q.push("ag-header-cell-wrap-text");for(let Z of Q)this.comp.toggleCss(Z,!0)}setupMovingCss(z){let{column:J}=this,Z=J.getProvidedColumnGroup().getLeafColumns(),$=()=>this.comp.toggleCss("ag-header-cell-moving",J.isMoving());for(let X of Z)z.addManagedListeners(X,{movingChanged:$});$()}onFocusIn(z){if(!this.eGui.contains(z.relatedTarget))this.focusThis(),this.announceAriaDescription()}handleKeyDown(z){if(super.handleKeyDown(z),!this.getWrapperHasFocus())return;let{column:Q,expandable:Z,gos:$,beans:X}=this,Y=E1($);if(z.key!=k.ENTER)return;if(Y&&!z.altKey)X.rangeSvc?.handleColumnSelection(Q,z);else if(Z){let q=!Q.isExpanded();X.colGroupSvc.setColumnGroupOpened(Q.getProvidedColumnGroup(),q,"uiColumnExpanded")}}refreshAnnouncement(){let z,{gos:J}=this;if(E1(J))z=this.getLocaleTextFunc()("ariaColumnGroupCellSelection","Press Enter to toggle selection for all visible cells in this column group");this.ariaAnnouncement=z}announceAriaDescription(){let{beans:z,eGui:J,ariaAnnouncement:Q}=this;if(!Q||!J.contains(d(z)))return;z.ariaAnnounce?.announceValue(Q,"columnHeader")}setDragSource(z){if(!this.isAlive()||this.isSuppressMoving())return;if(this.removeDragSource(),!z)return;this.dragSource=this.beans.colMoves?.setDragSourceForHeader(z,this.column,this.displayName)??null}isSuppressMoving(){return this.gos.get("suppressMovableColumns")||this.column.getLeafColumns().some((z)=>z.getColDef().suppressMovable||z.getColDef().lockPosition)}destroy(){this.tooltipFeature=this.destroyBean(this.tooltipFeature),super.destroy()}};function jW(z,J,Q){z.colGroupSvc?.setColumnGroupOpened(J,Q,"api")}function OW(z,J,Q){return z.colGroupSvc?.getColumnGroup(J,Q)??null}function PW(z,J){return z.colGroupSvc?.getProvidedColGroup(J)??null}function TW(z,J,Q){return z.colNames.getDisplayNameForColumnGroup(J,Q)||""}function vW(z){return z.colGroupSvc?.getColumnGroupState()??[]}function IW(z,J){z.colGroupSvc?.setColumnGroupState(J,"api")}function CW(z){z.colGroupSvc?.resetColumnGroupState("api")}function bW(z){return z.visibleCols.treeLeft}function yW(z){return z.visibleCols.treeCenter}function xW(z){return z.visibleCols.treeRight}function wW(z){return z.visibleCols.getAllTrees()}var F$=class{constructor(){this.existingIds={}}getInstanceIdForKey(z){let J=this.existingIds[z],Q;if(typeof J!=="number")Q=0;else Q=J+1;return this.existingIds[z]=Q,Q}};function NW(z,J){for(let Q=0;Q=0)z[Z]=z[z.length-1],z.pop()}}var gW=class extends V{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,J=!1){let{colFlex:Q,colModel:Z,colGroupSvc:$,colViewport:X,selectionColSvc:Y}=this.beans;if(!J)this.buildTrees(Z,$);$?.updateOpenClosedVisibility(),this.leftCols=LQ(this.treeLeft),this.centerCols=LQ(this.treeCenter),this.rightCols=LQ(this.treeRight),Y?.refreshVisibility(this.leftCols,this.centerCols,this.rightCols),this.joinColsAriaOrder(Z),this.joinCols(),this.headerGroupRowCount=this.getHeaderRowCount(),this.setLeftValues(z),this.autoHeightCols=this.allCols.filter((q)=>q.isAutoHeight()),Q?.refreshFlexedColumns(),this.updateBodyWidths(),this.setFirstRightAndLastLeftPinned(Z,this.leftCols,this.rightCols,z),X.checkViewportColumns(!1),this.eventSvc.dispatchEvent({type:"displayedColumnsChanged",source:z})}getHeaderRowCount(){if(!this.gos.get("hidePaddedHeaderRows"))return this.beans.colModel.cols.treeDepth;let z=0;for(let J of this.allCols){let Q=J.getParent();while(Q){if(!Q.isPadding()){let Z=Q.getProvidedColumnGroup().getLevel()+1;if(Z>z)z=Z;break}Q=Q.getParent()}}return z}updateBodyWidths(){let z=n4(this.centerCols),J=n4(this.leftCols),Q=n4(this.rightCols);if(this.isBodyWidthDirty=this.bodyWidth!==z,this.bodyWidth!==z||this.leftWidth!==J||this.rightWidth!==Q)this.bodyWidth=z,this.leftWidth=J,this.rightWidth=Q,this.eventSvc.dispatchEvent({type:"columnContainerWidthChanged"}),this.eventSvc.dispatchEvent({type:"displayedColumnsWidthChanged"})}setLeftValues(z){this.setLeftValuesOfCols(z),this.setLeftValuesOfGroups()}setFirstRightAndLastLeftPinned(z,J,Q,Z){let $,X;if(this.gos.get("enableRtl"))$=J?J[0]:null,X=Q?b(Q):null;else $=J?b(J):null,X=Q?Q[0]:null;for(let Y of z.getCols())Y.setLastLeftPinned(Y===$,Z),Y.setFirstRightPinned(Y===X,Z)}buildTrees(z,J){let Q=z.getColsToShow(),Z=Q.filter((G)=>G.getPinned()=="left"),$=Q.filter((G)=>G.getPinned()=="right"),X=Q.filter((G)=>G.getPinned()!="left"&&G.getPinned()!="right"),Y=new F$,q=(G)=>{return J?J.createColumnGroups(G):G.columns};this.treeLeft=q({columns:Z,idCreator:Y,pinned:"left",oldDisplayedGroups:this.treeLeft}),this.treeRight=q({columns:$,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(z){let J=z.getCols(),Q=[],Z=[],$=[];for(let X of J){let Y=X.getPinned();if(!Y)Z.push(X);else if(Y===!0||Y==="left")Q.push(X);else $.push(X)}this.ariaOrderColumns=Q.concat(Z).concat($)}getAriaColIndex(z){let J;if(W0(z))J=z.getLeafColumns()[0];else J=z;return this.ariaOrderColumns.indexOf(J)+1}setLeftValuesOfGroups(){for(let z of[this.treeLeft,this.treeRight,this.treeCenter])for(let J of z)if(W0(J))J.checkLeft()}setLeftValuesOfCols(z){let{colModel:J}=this.beans;if(!J.getColDefCols())return;let Z=J.getCols().slice(0),$=this.gos.get("enableRtl");for(let X of[this.leftCols,this.rightCols,this.centerCols]){if($){let Y=n4(X);for(let q of X)Y-=q.getActualWidth(),q.setLeft(Y,z)}else{let Y=0;for(let q of X)q.setLeft(Y,z),Y+=q.getActualWidth()}NW(Z,X)}for(let X of Z)X.setLeft(null,z)}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(z){return this.allCols.indexOf(z)>=0}getLeftColsForRow(z){let{leftCols:J,beans:{colModel:Q}}=this;if(!Q.colSpanActive)return J;return this.getColsForRow(z,J)}getRightColsForRow(z){let{rightCols:J,beans:{colModel:Q}}=this;if(!Q.colSpanActive)return J;return this.getColsForRow(z,J)}getColsForRow(z,J,Q,Z){let $=[],X=null;for(let Y=0;Y1){let W=H-1;for(let B=1;B<=W;B++)_.push(J[Y+B]);Y+=W}let U;if(Q){U=!1;for(let W of _)if(Q(W))U=!0}else U=!0;if(U){if($.length===0&&X){if(Z?Z(q):!1)$.push(X)}$.push(q)}X=q}return $}getContainerWidth(z){switch(z){case"left":return this.leftWidth;case"right":return this.rightWidth;default:return this.bodyWidth}}getColBefore(z){let J=this.allCols,Q=J.indexOf(z);if(Q>0)return J[Q-1];return null}isPinningLeft(){return this.leftCols.length>0}isPinningRight(){return this.rightCols.length>0}updateColsAndGroupsMap(){this.colsAndGroupsMap={};let z=(J)=>{this.colsAndGroupsMap[J.getUniqueId()]=J};t1(this.treeCenter,!1,z),t1(this.treeLeft,!1,z),t1(this.treeRight,!1,z)}isVisible(z){return this.colsAndGroupsMap[z.getUniqueId()]===z}getFirstColumn(){let z=this.gos.get("enableRtl"),J=["leftCols","centerCols","rightCols"];if(z)J.reverse();for(let Q=0;Q{if(G4(Q))J.push(Q)}),J}var hW=class extends V{constructor(){super(...arguments);this.beanName="colGroupSvc"}getColumnGroupState(){let z=[],J=this.beans.colModel.getColTree();return N4(null,J,(Q)=>{if(G0(Q))z.push({groupId:Q.getGroupId(),open:Q.isExpanded()})}),z}resetColumnGroupState(z){let J=this.beans.colModel.getColDefColTree();if(!J)return;let Q=[];N4(null,J,(Z)=>{if(G0(Z)){let $=Z.getColGroupDef(),X={groupId:Z.getGroupId(),open:!$?void 0:$.openByDefault};Q.push(X)}}),this.setColumnGroupState(Q,z)}setColumnGroupState(z,J){let{colModel:Q,colAnimation:Z,visibleCols:$,eventSvc:X}=this.beans;if(!Q.getColTree().length)return;Z?.start();let q=[];for(let G of z){let{groupId:H,open:_}=G,U=this.getProvidedColGroup(H);if(!U)continue;if(U.isExpanded()===_)continue;U.setExpanded(_),q.push(U)}if($.refresh(J,!0),q.length)X.dispatchEvent({type:"columnGroupOpened",columnGroup:q.length===1?q[0]:void 0,columnGroups:q});Z?.finish()}setColumnGroupOpened(z,J,Q){let Z;if(G0(z))Z=z.getId();else Z=z||"";this.setColumnGroupState([{groupId:Z,open:J}],Q)}getProvidedColGroup(z){let J=null;return N4(null,this.beans.colModel.getColTree(),(Q)=>{if(G0(Q)){if(Q.getId()===z)J=Q}}),J}getGroupAtDirection(z,J){let Q=z.getProvidedColumnGroup().getLevel()+z.getPaddingLevel(),Z=z.getDisplayedLeafColumns(),$=J==="After"?b(Z):Z[0],X=`getCol${J}`;while(!0){let Y=this.beans.visibleCols[X]($);if(!Y)return null;let q=this.getColGroupAtLevel(Y,Q);if(q!==z)return q}}getColGroupAtLevel(z,J){let Q=z.getParent(),Z,$;while(!0){if(Z=Q.getProvidedColumnGroup().getLevel(),$=Q.getPaddingLevel(),Z+$<=J)break;Q=Q.getParent()}return Q}updateOpenClosedVisibility(){let z=this.beans.visibleCols.getAllTrees();t1(z,!1,(J)=>{if(W0(J))J.calculateDisplayedColumns()})}getColumnGroup(z,J){if(!z)return null;if(W0(z))return z;let Q=this.beans.visibleCols.getAllTrees(),Z=typeof J==="number",$=null;return t1(Q,!1,(X)=>{if(W0(X)){let Y=X,q;if(Z)q=z===Y.getGroupId()&&J===Y.getPartId();else q=z===Y.getGroupId();if(q)$=Y}}),$}createColumnGroups(z){let{columns:J,idCreator:Q,pinned:Z,oldDisplayedGroups:$,isStandaloneStructure:X}=z,Y=this.mapOldGroupsById($),q=[],G=J;while(G.length){let H=G;G=[];let _=0,U=(W)=>{let B=_;_=W;let E=H[B],F=(W0(E)?E.getProvidedColumnGroup():E).getOriginalParent();if(F==null){for(let D=B;DG0(_))){G.setChildren([Y]);continue}else{G.setChildren(z);break}$.push(Y)}}return $}findDepth(z){let J=0,Q=z;while(Q?.[0]&&G0(Q[0]))J++,Q=Q[0].getChildren();return J}findMaxDepth(z,J){let Q=J;for(let Z=0;Z=0;X--){let Y=new d1(null,`FAKE_PATH_${Z.getId()}_${X}`,!0,X);this.createBean(Y),Y.setChildren([$]),$.originalParent=Y,$=Y}if(J===0)Z.originalParent=null;Q.push($)}return Q}findExistingGroup(z,J){if(z.groupId==null)return;for(let Z=0;Z{for(let $ of Z)if(W0($)){let X=$;J[$.getUniqueId()]=X,Q(X.getChildren())}};if(z)Q(z);return J}setupParentsIntoCols(z,J){for(let Q of z??[]){if(Q.parent!==J)this.beans.colViewport.colsWithinViewportHash="";if(Q.parent=J,W0(Q)){let Z=Q;this.setupParentsIntoCols(Z.getChildren(),Z)}}}},aZ={moduleName:"ColumnGroup",version:c,dynamicBeans:{headerGroupCellCtrl:RW},beans:[hW],apiFunctions:{getAllDisplayedColumnGroups:wW,getCenterDisplayedColumnGroups:yW,getColumnGroup:OW,getColumnGroupState:vW,getDisplayNameForColumnGroup:TW,getLeftDisplayedColumnGroups:bW,getProvidedColumnGroup:PW,getRightDisplayedColumnGroups:xW,resetColumnGroupState:CW,setColumnGroupOpened:jW,setColumnGroupState:IW}};function l0(z,J,Q){let{colModel:Z,rowGroupColsSvc:$,pivotColsSvc:X,autoColSvc:Y,selectionColSvc:q,colAnimation:G,visibleCols:H,pivotResultCols:_,environment:U,valueColsSvc:W,eventSvc:B,gos:E}=z,K=Z.getColDefCols()??[],F=q?.getColumns();if(!K.length&&!F?.length)return!1;if(J?.state&&!J.state.forEach)return R(32),!1;let L=(S,A,O,v,I)=>{if(!S)return;let x=GH(A,J.defaultState),m=x("flex").value1,g=x("sort").value1,e=x("sortType").value1,r=K1(g)||SZ(e),u=j4(e),Q0=YJ(g),s=r?{type:u,direction:Q0}:void 0;if(W9(z,S,x("hide").value1,s,x("sortIndex").value1,x("pinned").value1,m,Q),m==null){let T0=x("width").value1;if(T0!=null){let v0=S.getColDef().minWidth??U.getDefaultColumnMinWidth();if(v0!=null&&T0>=v0)S.setActualWidth(T0,Q)}}if(I||!S.isPrimary())return;W?.syncColumnWithState(S,Q,x),$?.syncColumnWithState(S,Q,x,O),X?.syncColumnWithState(S,Q,x,v)},D=(S,A,O)=>{let v=D$(z,Q),I=A.slice(),x={},m={},g=[],e=[],r=[],u=0,Q0=$?.columns.slice()??[],s=X?.columns.slice()??[];for(let V0 of S){let g1=V0.colId;if(g1.startsWith(J2)){g.push(V0),r.push(V0);continue}if(m4(g1)){e.push(V0),r.push(V0);continue}let F2=O(g1);if(!F2)r.push(V0),u+=1;else L(F2,V0,x,m,!1),X0(I,F2)}let T0=(V0)=>L(V0,null,x,m,!1);I.forEach(T0),$?.sortColumns(T7.bind($,x,Q0)),X?.sortColumns(T7.bind(X,m,s)),Z.refreshCols(!1,Q);let v0=(V0,g1,sJ=[])=>{for(let F2 of g1){let X7=V0(F2.colId);X0(sJ,X7),L(X7,F2,null,null,!0)}sJ.forEach(T0)};return v0((V0)=>Y?.getColumn(V0)??null,g,Y?.getColumns()?.slice()),v0((V0)=>q?.getColumn(V0)??null,e,q?.getColumns()?.slice()),uW(J,Z,E),H.refresh(Q),B.dispatchEvent({type:"columnEverythingChanged",source:Q}),v(),{unmatchedAndAutoStates:r,unmatchedCount:u}};G?.start();let{unmatchedAndAutoStates:M,unmatchedCount:f}=D(J.state||[],K,(S)=>Z.getColDefCol(S));if(M.length>0||T(J.defaultState)){let S=_?.getPivotResultCols()?.list??[];f=D(M,S,(A)=>_?.getPivotResultCol(A)??null).unmatchedCount}return G?.finish(),f===0}function L$(z,J){let{colModel:Q,autoColSvc:Z,selectionColSvc:$,eventSvc:X,gos:Y}=z,q=Q.getColDefCols();if(!q?.length)return;let G=Q.getColDefColTree(),H=qJ(G),_=[],U=1000,W=1000,B=(D)=>{let M=M$(D);if(n(M.rowGroupIndex)&&M.rowGroup)M.rowGroupIndex=U++;if(n(M.pivotIndex)&&M.pivot)M.pivotIndex=W++;_.push(M)};Z?.getColumns()?.forEach(B),$?.getColumns()?.forEach(B),H?.forEach(B),l0(z,{state:_},J);let E=Z?.getColumns()??[],L=[...$?.getColumns()??[],...E,...q].map((D)=>({colId:D.colId}));l0(z,{state:L,applyOrder:!0},J),X.dispatchEvent(C(Y,{type:"columnsReset",source:J}))}function D$(z,J){let{rowGroupColsSvc:Q,pivotColsSvc:Z,valueColsSvc:$,colModel:X,sortSvc:Y,eventSvc:q}=z,G={rowGroupColumns:Q?.columns.slice()??[],pivotColumns:Z?.columns.slice()??[],valueColumns:$?.columns.slice()??[]},H=P7(z),_={};for(let U of H)_[U.colId]=U;return()=>{let U=(A,O,v,I)=>{let x=O.map(I),m=v.map(I);if(Z0(x,m))return;let e=new Set(O);for(let u of v)if(!e.delete(u))e.add(u);let r=[...e];q.dispatchEvent({type:A,columns:r,column:r.length===1?r[0]:null,source:J})},W=(A)=>{let O=[];return X.forAllCols((v)=>{let I=_[v.getColId()];if(I&&A(I,v))O.push(v)}),O},B=(A)=>A.getColId();U("columnRowGroupChanged",G.rowGroupColumns,Q?.columns??[],B),U("columnPivotChanged",G.pivotColumns,Z?.columns??[],B);let K=W((A,O)=>{let v=A.aggFunc!=null,I=v!=O.isValueActive(),x=v&&A.aggFunc!=O.getAggFunc();return I||x});if(K.length>0)K$(q,"columnValueChanged",K,J);w2(q,W((A,O)=>A.width!=O.getActualWidth()),!0,J),E$(q,W((A,O)=>A.pinned!=O.getPinned()),J),DW(q,W((A,O)=>A.hide==O.isVisible()),J);let f=W((A,O)=>!kz(O.getSortDef(),{type:j4(A.sortType),direction:YJ(A.sort)})||A.sortIndex!=O.getSortIndex());if(f.length>0)Y?.dispatchSortChangedEvents(J,f);let S=P7(z);cW(H,S,J,X,q)}}function P7(z){let{colModel:J,rowGroupColsSvc:Q,pivotColsSvc:Z}=z,$=J.getColDefCols();if(n($)||!J.isAlive())return[];let X=Q?.columns,Y=Z?.columns,q=[],G=(_)=>{let U=_.isRowGroupActive()&&X?X.indexOf(_):null,W=_.isPivotActive()&&Y?Y.indexOf(_):null,B=_.isValueActive()?_.getAggFunc():null,E=_.getSortIndex()!=null?_.getSortIndex():null;q.push({colId:_.getColId(),width:_.getActualWidth(),hide:!_.isVisible(),pinned:_.getPinned(),sort:_.getSort(),sortType:_.getSortDef()?.type,sortIndex:E,aggFunc:B,rowGroup:_.isRowGroupActive(),rowGroupIndex:U,pivot:_.isPivotActive(),pivotIndex:W,flex:_.getFlex()??null})};J.forAllCols((_)=>G(_));let H=new Map(J.getCols().map((_,U)=>[_.getColId(),U]));return q.sort((_,U)=>{let W=H.has(_.colId)?H.get(_.colId):-1,B=H.has(U.colId)?H.get(U.colId):-1;return W-B}),q}function M$(z){let J=(F,L)=>F!=null?F:L!=null?L:null,Q=z.getColDef(),Z=Z4(J(Q.sort,Q.initialSort)),$=Z.direction,X=Z.type,Y=J(Q.sortIndex,Q.initialSortIndex),q=J(Q.hide,Q.initialHide),G=J(Q.pinned,Q.initialPinned),H=J(Q.width,Q.initialWidth),_=J(Q.flex,Q.initialFlex),U=J(Q.rowGroupIndex,Q.initialRowGroupIndex),W=J(Q.rowGroup,Q.initialRowGroup);if(U==null&&!W)U=null,W=null;let B=J(Q.pivotIndex,Q.initialPivotIndex),E=J(Q.pivot,Q.initialPivot);if(B==null&&!E)B=null,E=null;let K=J(Q.aggFunc,Q.initialAggFunc);return{colId:z.getColId(),sort:$,sortType:X,sortIndex:Y,hide:q,pinned:G,width:H,flex:_,rowGroup:W,rowGroupIndex:U,pivot:E,pivotIndex:B,aggFunc:K}}function uW(z,J,Q){if(!z.applyOrder||!z.state)return;let Z=[];for(let $ of z.state)if($.colId!=null)Z.push($.colId);mW(J.cols,Z,J,Q)}function mW(z,J,Q,Z){if(z==null)return;let $=[],X={};for(let q of J){if(X[q])continue;let G=z.map[q];if(G)$.push(G),X[q]=!0}let Y=0;for(let q of z.list){let G=q.getColId();if(X[G]!=null)continue;if(G.startsWith(J2))$.splice(Y++,0,q);else $.push(q)}if($=_$($,Z),!U$($,Q.getColTree())){R(39);return}z.list=$}function cW(z,J,Q,Z,$){let X={};for(let _ of J)X[_.colId]=_;let Y={};for(let _ of z)if(X[_.colId])Y[_.colId]=!0;let q=z.filter((_)=>Y[_.colId]),G=J.filter((_)=>Y[_.colId]),H=[];if(G.forEach((_,U)=>{let W=q?.[U];if(W&&W.colId!==_.colId){let B=Z.getCol(W.colId);if(B)H.push(B)}}),!H.length)return;$.dispatchEvent({type:"columnMoved",columns:H,column:H.length===1?H[0]:null,finished:!0,source:Q})}var T7=(z,J,Q,Z)=>{let $=z[Q.getId()],X=z[Z.getId()],Y=$!=null,q=X!=null;if(Y&&q)return $-X;if(Y)return-1;if(q)return 1;let G=J.indexOf(Q),H=J.indexOf(Z),_=G>=0,U=H>=0;if(_&&U)return G-H;if(_)return-1;return 1},pW=class extends V{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"],(z)=>this.refreshAll(F1(z.source))),this.addManagedPropertyListeners(["defaultColDef","defaultColGroupDef","columnTypes","suppressFieldDotNotation"],this.recreateColumnDefs.bind(this)),this.addManagedPropertyListener("pivotMode",(z)=>this.setPivotMode(this.gos.get("pivotMode"),F1(z.source)))}createColsFromColDefs(z){let{beans:J}=this,{valueCache:Q,colAutosize:Z,rowGroupColsSvc:$,pivotColsSvc:X,valueColsSvc:Y,visibleCols:q,eventSvc:G,groupHierarchyColSvc:H}=J,_=this.colDefs?D$(J,z):void 0;Q?.expire();let U=this.colDefCols?.list,W=this.colDefCols?.tree,B=RZ(J,this.colDefs,!0,W,z);H4(J,this.colDefCols?.tree,B.columnTree);let{columnTree:E,treeDepth:K}=B,F=qJ(E),L={};for(let D of F)L[D.getId()]=D;if(this.colDefCols={tree:E,treeDepth:K,list:F,map:L},this.createColumnsForService([H],this.colDefCols,z),$?.extractCols(z,U),X?.extractCols(z,U),Y?.extractCols(z,U),this.ready=!0,this.changeEventsDispatching=!0,this.refreshCols(!0,z),this.changeEventsDispatching=!1,q.refresh(z),G.dispatchEvent({type:"columnEverythingChanged",source:z}),_)this.changeEventsDispatching=!0,_(),this.changeEventsDispatching=!1;if(G.dispatchEvent({type:"newColumnsLoaded",source:z}),z==="gridInitializing")Z?.applyAutosizeStrategy()}refreshCols(z,J){if(!this.colDefCols)return;let Q=this.cols?.tree;this.saveColOrder();let{autoColSvc:Z,selectionColSvc:$,rowNumbersSvc:X,quickFilter:Y,pivotResultCols:q,showRowGroupCols:G,rowAutoHeight:H,visibleCols:_,colViewport:U,eventSvc:W,formula:B}=this.beans,E=this.selectCols(q,this.colDefCols);B?.setFormulasActive(E),this.createColumnsForService([Z,$,X],E,J);let K=mG(this.gos,this.showingPivotResult);if(!z||K)this.restoreColOrder(E);if(this.positionLockedCols(E),G?.refresh(),Y?.refreshCols(),this.setColSpanActive(),H?.setAutoHeightActive(E),_.clear(),U.clear(),!Z0(Q,this.cols.tree))W.dispatchEvent({type:"gridColumnsChanged"})}createColumnsForService(z,J,Q){for(let Z of z){if(!Z)continue;Z.createColumns(J,($)=>{this.lastOrder=$(this.lastOrder),this.lastPivotOrder=$(this.lastPivotOrder)},Q),Z.addColumns(J)}}selectCols(z,J){let Q=z?.getPivotResultCols()??null;this.showingPivotResult=Q!=null;let{map:Z,list:$,tree:X,treeDepth:Y}=Q??J;if(this.cols={list:$.slice(),map:{...Z},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:z,showingPivotResult:J,cols:Q}=this,{valueColsSvc:Z,selectionColSvc:$,gos:X}=z,Y=this.isPivotMode()&&!J,q=$?.isSelectionColumnEnabled(),G=cG(z),H=Z?.columns,_=kZ(X);return Q.list.filter((W)=>{let B=Q2(W);if(Y)return H?.includes(W)||B&&(!_||W.isVisible())||q&&m4(W)||G&&b0(W);else return B&&!_||W.isVisible()})}refreshAll(z){if(!this.ready)return;this.refreshCols(!1,z),this.beans.visibleCols.refresh(z)}setColsVisible(z,J=!1,Q){l0(this.beans,{state:z.map((Z)=>({colId:typeof Z==="string"?Z:Z.getColId(),hide:!J}))},Q)}restoreColOrder(z){let J=this.showingPivotResult?this.lastPivotOrder:this.lastOrder;if(!J)return;let Q=J.filter((U)=>z.map[U.getId()]!=null);if(Q.length===0)return;if(Q.length===z.list.length){z.list=Q;return}let Z=(U)=>{let W=U.getOriginalParent();if(!W)return!1;if(W.getChildren().length>1)return!0;return Z(W)};if(!Q.some((U)=>Z(U))){let U=new Set(Q);for(let W of z.list)if(!U.has(W))Q.push(W);z.list=Q;return}let $=new Map;for(let U=0;U!$.has(U));if(X.length===0){z.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 F of B.getChildren()){if(F===W||F===U)continue;if(F instanceof B4){let L=$.get(F);if(L==null)continue;if(E==null||E{let D=$.get(L);if(D==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}z.list=H}positionLockedCols(z){z.list=_$(z.list,this.gos)}saveColOrder(){if(this.showingPivotResult)this.lastPivotOrder=this.cols?.list??null;else this.lastOrder=this.cols?.list??null}getColumnDefs(z){return this.colDefCols&&this.beans.colDefFactory?.getColumnDefs(this.colDefCols.list,this.showingPivotResult,this.lastOrder,this.cols?.list??[],z)}setColSpanActive(){this.colSpanActive=!!this.cols?.list.some((z)=>z.getColDef().colSpan!=null)}isPivotMode(){return this.pivotMode}setPivotMode(z,J){if(z===this.pivotMode)return;if(this.pivotMode=z,!this.ready)return;this.refreshCols(!1,J);let{visibleCols:Q,eventSvc:Z}=this.beans;Q.refresh(J),Z.dispatchEvent({type:"columnPivotModeChanged"})}isPivotActive(){let z=this.beans.pivotColsSvc?.columns;return this.pivotMode&&!!z?.length}recreateColumnDefs(z){if(!this.cols)return;this.beans.autoColSvc?.updateColumns(z);let J=F1(z.source);this.createColsFromColDefs(J)}setColumnDefs(z,J){this.colDefs=z,this.createColsFromColDefs(J)}destroy(){H4(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(z){let{pivotResultCols:J,autoColSvc:Q,selectionColSvc:Z,groupHierarchyColSvc:$}=this.beans;if($6(this.colDefCols?.list,z))return;if($6(Q?.columns?.list,z))return;if($6(Z?.columns?.list,z))return;if($6($?.columns?.list,z))return;if($6(J?.getPivotResultCols()?.list,z))return}getColsForKeys(z){if(!z)return[];return z.map((J)=>this.getCol(J)).filter((J)=>J!=null)}getColDefCol(z){if(!this.colDefCols?.list)return null;return this.getColFromCollection(z,this.colDefCols)}getCol(z){if(z==null)return null;return this.getColFromCollection(z,this.cols)}getColById(z){return this.cols?.map[z]??null}getColFromCollection(z,J){if(J==null)return null;let{map:Q,list:Z}=J;if(typeof z=="string"&&Q[z])return Q[z];for(let q=0;qz(this.getValue())}),this}getWidth(){return this.getGui().clientWidth}setWidth(z){return w4(this.getGui(),z),this}getPreviousValue(){return this.previousValue}getValue(){return this.value}setValue(z,J){if(this.value===z)return this;if(this.previousValue=this.value,this.value=z,!J)this.dispatchLocalEvent({type:"fieldValueChanged"});return this}};function nW(z){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:z,ref:"eInput",cls:"ag-input-field-input"}]}]}}var V2=class extends k${constructor(z,J,Q="text",Z="input"){super(z,z?.template??nW(Z),[],J);this.inputType=Q,this.displayFieldTag=Z,this.eLabel=j,this.eWrapper=j,this.eInput=j}postConstruct(){super.postConstruct(),this.setInputType(this.inputType);let{eLabel:z,eWrapper:J,eInput:Q,className:Z}=this;z.classList.add(`${Z}-label`),J.classList.add(`${Z}-input-wrapper`),Q.classList.add(`${Z}-input`),this.addCss("ag-input-field"),Q.id=Q.id||`ag-${this.getCompId()}-input`;let{inputName:$,inputWidth:X,inputPlaceholder:Y,autoComplete:q,tabIndex:G}=this.config;if($!=null)this.setInputName($);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:(z)=>this.setValue(z.target.value)})}setInputType(z){if(this.displayFieldTag==="input")this.inputType=z,V4(this.eInput,"type",z)}getInputElement(){return this.eInput}getWrapperElement(){return this.eWrapper}setInputWidth(z){return vz(this.eWrapper,z),this}setInputName(z){return this.getInputElement().setAttribute("name",z),this}getFocusableElement(){return this.eInput}setMaxLength(z){let J=this.eInput;return J.maxLength=z,this}setInputPlaceholder(z){return V4(this.eInput,"placeholder",z),this}setInputAriaLabel(z){return _0(this.eInput,z),this.refreshAriaLabelledBy(),this}setDisabled(z){return F6(this.eInput,z),super.setDisabled(z)}setAutoComplete(z){if(z===!0)V4(this.eInput,"autocomplete",null);else{let J=typeof z==="string"?z:"off";V4(this.eInput,"autocomplete",J)}return this}},EJ=class extends V2{constructor(z,J="ag-checkbox",Q="checkbox"){super(z,J,Q);this.labelAlignment="right",this.selected=!1,this.readOnly=!1,this.passive=!1}postConstruct(){super.postConstruct();let{readOnly:z,passive:J,name:Q}=this.config;if(typeof z==="boolean")this.setReadOnly(z);if(typeof J==="boolean")this.setPassive(J);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(z){this.passive=z}isReadOnly(){return this.readOnly}setReadOnly(z){this.eWrapper.classList.toggle("ag-disabled",z),this.eInput.disabled=z,this.readOnly=z}setDisabled(z){return this.eWrapper.classList.toggle("ag-disabled",z),super.setDisabled(z)}toggle(){if(this.eInput.disabled)return;let z=this.isSelected(),J=this.getNextValue();if(this.passive)this.dispatchChange(J,z);else this.setValue(J)}getValue(){return this.isSelected()}setValue(z,J){return this.refreshSelectedClass(z),this.setSelected(z,J),this}setName(z){let J=this.getInputElement();return J.name=z,this}isSelected(){return this.selected}setSelected(z,J){if(this.isSelected()===z)return;this.previousValue=this.isSelected(),z=this.selected=typeof z==="boolean"?z:void 0;let Q=this.eInput;if(Q.checked=z,Q.indeterminate=z===void 0,!J)this.dispatchChange(this.selected,this.previousValue)}dispatchChange(z,J,Q){this.dispatchLocalEvent({type:"fieldValueChanged",selected:z,previousValue:J,event:Q});let Z=this.getInputElement();this.eventSvc.dispatchEvent({type:"checkboxChanged",id:Z.id,name:Z.name,selected:z,previousValue:J})}onCheckboxClick(z){if(this.passive||this.eInput.disabled)return;let J=this.isSelected(),Q=this.selected=z.target.checked;this.refreshSelectedClass(Q),this.dispatchChange(Q,J,z)}refreshSelectedClass(z){let J=this.eWrapper.classList;J.toggle("ag-checked",z===!0),J.toggle("ag-indeterminate",z==null)}},K4={selector:"AG-CHECKBOX",component:EJ},tW=".ag-checkbox-cell{height:100%}",rW={tag:"div",cls:"ag-cell-wrapper ag-checkbox-cell",role:"presentation",children:[{tag:"ag-checkbox",ref:"eCheckbox",role:"presentation"}]},sW=class extends y{constructor(){super(rW,[K4]);this.eCheckbox=j,this.registerCSS(tW)}init(z){this.refresh(z);let{eCheckbox:J,beans:Q}=this,Z=J.getInputElement();Z.setAttribute("tabindex","-1"),R8(Z,"polite"),this.addManagedListeners(Z,{click:($)=>{if(s0($),J.isDisabled())return;let X=J.getValue();this.onCheckboxChanged(X)},dblclick:($)=>{s0($)}}),this.addManagedElementListeners(z.eGridCell,{keydown:($)=>{if($.key===k.SPACE&&!J.isDisabled()){if(z.eGridCell===d(Q))J.toggle();let X=J.getValue();this.onCheckboxChanged(X),$.preventDefault()}}})}refresh(z){return this.params=z,this.updateCheckbox(z),!0}updateCheckbox(z){let J,Q=!0,{value:Z,column:$,node:X}=z;if(X.group&&$)if(typeof Z==="boolean")J=Z;else{let U=$.getColId();if(U.startsWith(J2))J=Z==null||Z===""?void 0:Z==="true";else if(X.aggData&&X.aggData[U]!==void 0)J=Z??void 0;else if(X.sourceRowIndex>=0)J=Z??void 0;else Q=!1}else J=Z??void 0;let{eCheckbox:Y}=this;if(!Q){Y.setDisplayed(!1);return}Y.setValue(J);let q=z.disabled??!$?.isCellEditable(X);Y.setDisabled(q);let G=this.getLocaleTextFunc(),H=HZ(G,J),_=q?H:`${G("ariaToggleCellValue","Press SPACE to toggle cell value")} (${H})`;Y.setInputAriaLabel(_)}onCheckboxChanged(z){let{params:J}=this,{column:Q,node:Z,value:$}=J,{editSvc:X}=this.beans;if(!Q)return;let Y={rowNode:Z,column:Q};X?.dispatchCellEvent(Y,null,"cellEditingStarted",{value:$});let q=Z.setDataValue(Q,z,"ui");if(X?.dispatchCellEvent(Y,null,"cellEditingStopped",{oldValue:$,newValue:z,valueChanged:q}),!q)this.updateCheckbox(J)}},lW={tag:"div",cls:"ag-skeleton-container"},aW=class extends y{constructor(){super(lW)}init(z){let J=`ag-cell-skeleton-renderer-${this.getCompId()}`;if(this.getGui().setAttribute("id",J),this.addDestroyFunc(()=>r1(z.eParentOfValue)),r1(z.eParentOfValue,J),z.deferRender)this.setupLoading(z);else if(z.node.failedLoad)this.setupFailed();else this.setupLoading(z)}setupFailed(){let z=this.getLocaleTextFunc();this.getGui().textContent=z("loadingError","ERR");let J=z("ariaSkeletonCellLoadingFailed","Row failed to load");_0(this.getGui(),J)}setupLoading(z){let J=z0({tag:"div",cls:"ag-skeleton-effect"}),Q=z.node.rowIndex;if(Q!=null){let X=75+25*(Q%2===0?Math.sin(Q):Math.cos(Q));J.style.width=`${X}%`}this.getGui().appendChild(J);let Z=this.getLocaleTextFunc(),$=z.deferRender?Z("ariaDeferSkeletonCellLoading","Cell is loading"):Z("ariaSkeletonCellLoading","Row data is loading");_0(this.getGui(),$)}refresh(z){return!1}},oW={moduleName:"CheckboxCellRenderer",version:c,userComponents:{agCheckboxCellRenderer:sW}},eW={moduleName:"SkeletonCellRenderer",version:c,userComponents:{agSkeletonCellRenderer:aW}};var zB=class extends V{constructor(){super(...arguments);this.beanName="colFlex",this.columnsHidden=!1}refreshFlexedColumns(z={}){let J=z.source??"flex";if(z.viewportWidth!=null)this.flexViewportWidth=z.viewportWidth;let Q=this.flexViewportWidth,{visibleCols:Z,colDelayRenderSvc:$}=this.beans,X=Z.centerCols,Y=-1;if(z.resizingCols){let K=new Set(z.resizingCols);for(let F=X.length-1;F>=0;F--)if(K.has(X[F])){Y=F;break}}let q=!1,G=X.map((K,F)=>{let L=K.getFlex(),D=L!=null&&L>0&&F>Y;return q||(q=D),{col:K,isFlex:D,flex:Math.max(0,L??0),initialSize:K.getActualWidth(),min:K.getMinWidth(),max:K.getMaxWidth(),targetSize:0}});if(q)$?.hideColumns("colFlex"),this.columnsHidden=!0;else if(this.columnsHidden)this.revealColumns($);if(!Q||!q)return[];let H=G.length,_=G.reduce((K,F)=>K+F.flex,0),U=Q,W=(K,F)=>{K.frozenSize=F,K.col.setActualWidth(F,J),U-=F,_-=K.flex,H-=1},B=(K)=>K.frozenSize!=null;for(let K of G)if(!K.isFlex)W(K,K.initialSize);while(H>0){let K=Math.round(_<1?U*_:U),F,L=0,D=0;for(let S of G){if(B(S))continue;F=S,D+=K*(S.flex/_);let A=D-L,O=Math.round(A);S.targetSize=O,L+=O}if(F)F.targetSize+=K-L;let M=0;for(let S of G){if(B(S))continue;let A=S.targetSize,O=Math.min(Math.max(A,S.min),S.max);M+=O-A,S.violationType=O===A?void 0:O0?"min":"max";for(let S of G){if(B(S))continue;if(f==="all"||S.violationType===f)W(S,S.targetSize)}}if(!z.skipSetLeft)Z.setLeftValues(J);if(z.updateBodyWidths)Z.updateBodyWidths();let E=G.filter((K)=>K.isFlex&&!K.violationType).map((K)=>K.col);if(z.fireResizedEvent){let K=G.filter((L)=>L.initialSize!==L.frozenSize).map((L)=>L.col),F=G.filter((L)=>L.flex).map((L)=>L.col);w2(this.eventSvc,K,!0,J,F)}return this.revealColumns($),E}revealColumns(z){if(this.columnsHidden)z?.revealColumns("colFlex"),this.columnsHidden=!1}initCol(z){let{flex:J,initialFlex:Q}=z.colDef;if(J!==void 0)z.flex=J;else if(Q!==void 0)z.flex=Q}setColFlex(z,J){z.flex=J??null,z.dispatchStateUpdatedEvent("flex")}},k1=(z)=>{if(typeof z==="bigint")return z;let J;if(typeof z==="number")J=z;else if(typeof z==="string"){if(J=z.trim(),J==="")return null;if(J.endsWith("n"))J=J.slice(0,-1);if(!/^[+-]?\d+$/.test(J))return null}if(J==null)return null;try{return BigInt(J)}catch{return null}},oZ="T",JB=new RegExp(`[${oZ} ]`),QB=new RegExp(`^\\d{4}-\\d{2}-\\d{2}(${oZ}\\d{2}:\\d{2}:\\d{2}\\D?)?`);function y4(z,J){return z.toString().padStart(J,"0")}function r4(z,J=!0,Q=oZ){if(!z)return null;let Z=[z.getFullYear(),z.getMonth()+1,z.getDate()].map(($)=>y4($,2)).join("-");if(J)Z+=Q+[z.getHours(),z.getMinutes(),z.getSeconds()].map(($)=>y4($,2)).join(":");return Z}function _1(z,J=!0){if(!z)return null;if(J)return[String(z.getFullYear()),String(z.getMonth()+1),y4(z.getDate(),2),y4(z.getHours(),2),`:${y4(z.getMinutes(),2)}`,`:${y4(z.getSeconds(),2)}`];return[z.getFullYear(),z.getMonth()+1,y4(z.getDate(),2)].map(String)}var DQ=(z)=>{if(z>3&&z<21)return"th";switch(z%10){case 1:return"st";case 2:return"nd";case 3:return"rd"}return"th"},A6=["January","February","March","April","May","June","July","August","September","October","November","December"],MQ=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];function ZB(z,J){if(J==null)return r4(z,!1);let Q=y4(z.getFullYear(),4),Z={YYYY:()=>Q.slice(Q.length-4,Q.length),YY:()=>Q.slice(Q.length-2,Q.length),Y:()=>`${z.getFullYear()}`,MMMM:()=>A6[z.getMonth()],MMM:()=>A6[z.getMonth()].slice(0,3),MM:()=>y4(z.getMonth()+1,2),Mo:()=>`${z.getMonth()+1}${DQ(z.getMonth()+1)}`,M:()=>`${z.getMonth()+1}`,Do:()=>`${z.getDate()}${DQ(z.getDate())}`,DD:()=>y4(z.getDate(),2),D:()=>`${z.getDate()}`,dddd:()=>MQ[z.getDay()],ddd:()=>MQ[z.getDay()].slice(0,3),dd:()=>MQ[z.getDay()].slice(0,2),do:()=>`${z.getDay()}${DQ(z.getDay())}`,d:()=>`${z.getDay()}`},$=new RegExp(Object.keys(Z).join("|"),"g");return J.replace($,(X)=>{if(X in Z)return Z[X]();return X})}function Vz(z,J=!1){return!!h0(z,J)}function $B(z){return Vz(z,!0)}function h0(z,J=!1,Q){if(!z)return null;if(!Q&&!QB.test(z))return null;let[Z,$]=z.split(JB);if(!Z)return null;let X=Z.split("-").map((B)=>Number.parseInt(B,10));if(X.filter((B)=>!isNaN(B)).length!==3)return null;let[Y,q,G]=X,H=new Date(Y,q-1,G);if(H.getFullYear()!==Y||H.getMonth()!==q-1||H.getDate()!==G)return null;if(!$&&J)return null;if(!$||$==="00:00:00")return H;let[_,U,W]=$.split(":").map((B)=>Number.parseInt(B,10));if(_>=0&&_<24)H.setHours(_);else if(J)return null;if(U>=0&&U<60)H.setMinutes(U);else if(J)return null;if(W>=0&&W<60)H.setSeconds(W);else if(J)return null;return H}function W6(z,J,Q){if(!J||!z)return;if(!Q)return z[J];let Z=J.split("."),$=z;for(let X=0;Xnull,suppressKeyboardEvent:({node:z,event:J,column:Q})=>J.key===k.SPACE&&Q.isCellEditable(z)}},date({formatValue:z}){return{cellEditor:"agDateCellEditor",keyCreator:z}},dateString({formatValue:z}){return{cellEditor:"agDateStringCellEditor",keyCreator:z}},dateTime(z){return this.date(z)},dateTimeString(z){return this.dateString(z)},object({formatValue:z,colModel:J,colId:Q}){return{cellEditorParams:{useFormatter:!0},comparator:(Z,$)=>{let X=J.getColDefCol(Q),Y=X?.getColDef();if(!X||!Y)return 0;let q=Z==null?"":z({column:X,node:null,value:Z}),G=$==null?"":z({column:X,node:null,value:$});if(q===G)return 0;return q>G?1:-1},keyCreator:z}},text(){return{}}}}wireBeans(z){this.colModel=z.colModel}postConstruct(){this.processDataTypeDefinitions(),this.addManagedPropertyListener("dataTypeDefinitions",(z)=>{this.processDataTypeDefinitions(),this.colModel.recreateColumnDefs(z)})}processDataTypeDefinitions(){let z=this.getDefaultDataTypes(),J={},Q={},Z=(_)=>{return(U)=>{let{column:W,node:B,value:E}=U,K=W.getColDef().valueFormatter;if(K===_.groupSafeValueFormatter)K=_.valueFormatter;return this.beans.valueSvc.formatValue(W,B,E,K)}};for(let _ of Object.keys(z)){let U=z[_],W={...U,groupSafeValueFormatter:C7(U,this.gos)};J[_]=W,Q[_]=Z(W)}let $=this.gos.get("dataTypeDefinitions")??{},X={};for(let _ of Object.keys($)){let U=$[_],W=this.processDataTypeDefinition(U,$,[_],z);if(W){if(J[_]=W,U.dataTypeMatcher)X[_]=U.dataTypeMatcher;Q[_]=Z(W)}}let{valueParser:Y,valueFormatter:q}=z.object,{valueParser:G,valueFormatter:H}=J.object;this.hasObjectValueParser=G!==Y,this.hasObjectValueFormatter=H!==q,this.formatValueFuncs=Q,this.dataTypeDefinitions=J,this.dataTypeMatchers=this.sortKeysInMatchers(X,z)}sortKeysInMatchers(z,J){let Q={...z};for(let Z of XB)delete Q[Z],Q[Z]=z[Z]??J[Z].dataTypeMatcher;return Q}processDataTypeDefinition(z,J,Q,Z){let $,X=z.extendsDataType;if(z.columnTypes)this.isColumnTypeOverrideInDataTypeDefinitions=!0;if(z.extendsDataType===z.baseDataType){let Y=Z[X],q=J[X];if(Y&&q)Y=q;if(!I7(z,Y,X))return;$=v7(Y,z)}else{if(Q.includes(X)){R(44);return}let Y=J[X];if(!I7(z,Y,X))return;let q=this.processDataTypeDefinition(Y,J,[...Q,X],Z);if(!q)return;$=v7(q,z)}return{...$,groupSafeValueFormatter:C7($,this.gos)}}updateColDefAndGetColumnType(z,J,Q){let{cellDataType:Z}=J;if(Z===void 0)Z=z.cellDataType;let{field:$}=J;if(Z==null||Z===!0)Z=this.canInferCellDataType(z,J)?this.inferCellDataType($,Q):!1;if(this.addFormulaCellEditorToColDef(z,J),!Z){z.cellDataType=!1;return}let X=this.dataTypeDefinitions[Z];if(!X){R(47,{cellDataType:Z});return}if(z.cellDataType=Z,X.groupSafeValueFormatter)z.valueFormatter=X.groupSafeValueFormatter;if(X.valueParser)z.valueParser=X.valueParser;if(!X.suppressDefaultProperties)this.setColDefPropertiesForBaseDataType(z,Z,X,Q);return X.columnTypes}addFormulaCellEditorToColDef(z,J){if(!(J.allowFormula??z.allowFormula)||J.cellEditor)return;z.cellEditor="agFormulaCellEditor"}addColumnListeners(z){if(!this.isPendingInference)return;let J=this.columnStateUpdatesPendingInference[z.getColId()];if(!J)return;let Q=(Z)=>{J.add(Z.key)};z.__addEventListener("columnStateUpdated",Q),this.columnStateUpdateListenerDestroyFuncs.push(()=>z.__removeEventListener("columnStateUpdated",Q))}canInferCellDataType(z,J){let{gos:Q}=this;if(!o(Q))return!1;let Z={cellRenderer:!0,valueGetter:!0,valueParser:!0,refData:!0};if(kQ(J,Z))return!1;let $=J.type===null?z.type:J.type;if($){let X=Q.get("columnTypes")??{};if(yz($).some((q)=>{let G=X[q.trim()];return G&&kQ(G,Z)}))return!1}return!kQ(z,Z)}inferCellDataType(z,J){if(!z)return;let Q,Z=this.getInitialData();if(Z){let X=z.includes(".")&&!this.gos.get("suppressFieldDotNotation");Q=W6(Z,z,X)}else this.initWaitForRowData(J);if(Q==null)return;return Object.keys(this.dataTypeMatchers).find((X)=>this.dataTypeMatchers[X](Q))??"object"}getInitialData(){let z=this.gos.get("rowData");if(z?.length)return z[0];else if(this.initialData)return this.initialData;else{let J=this.beans.rowModel.rootNode?._leafs;if(J?.length)return J[0].data}return null}initWaitForRowData(z){if(this.columnStateUpdatesPendingInference[z]=new Set,this.isPendingInference)return;this.isPendingInference=!0;let J=this.isColumnTypeOverrideInDataTypeDefinitions,{colAutosize:Q,eventSvc:Z}=this.beans;if(J&&Q)Q.shouldQueueResizeOperations=!0;let[$]=this.addManagedEventListeners({rowDataUpdateStarted:(X)=>{let{firstRowData:Y}=X;if(!Y)return;if($?.(),this.isPendingInference=!1,this.processColumnsPendingInference(Y,J),this.columnStateUpdatesPendingInference={},J)Q?.processResizeOperations();Z.dispatchEvent({type:"dataTypesInferred"})}})}processColumnsPendingInference(z,J){this.initialData=z;let Q=[];this.destroyColumnStateUpdateListeners();let 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 H=q.getColDef();if(J&&H.type&&H.type!==G.type){let _=WB(q,Y);if(_.rowGroup&&_.rowGroupIndex==null)Z[X]=_;if(_.pivot&&_.pivotIndex==null)$[X]=_;Q.push(_)}}if(J)Q.push(...this.generateColumnStateForRowGroupAndPivotIndexes(Z,$));if(Q.length)l0(this.beans,{state:Q},"cellDataTypeInferred");this.initialData=null}generateColumnStateForRowGroupAndPivotIndexes(z,J){let Q={},{rowGroupColsSvc:Z,pivotColsSvc:$}=this.beans;return Z?.restoreColumnOrder(Q,z),$?.restoreColumnOrder(Q,J),Object.values(Q)}resetColDefIntoCol(z,J){let Q=z.getUserProvidedColDef();if(!Q)return!1;let Z=s4(this.beans,Q,z.getColId());return z.setColDef(Z,Q,J),!0}getDateStringTypeDefinition(z){let{dateString:J}=this.dataTypeDefinitions;if(!z)return J;return this.getDataTypeDefinition(z)??J}getDateParserFunction(z){return this.getDateStringTypeDefinition(z).dateParser}getDateFormatterFunction(z){return this.getDateStringTypeDefinition(z).dateFormatter}getDateIncludesTimeFlag(z){return z==="dateTime"||z==="dateTimeString"}getDataTypeDefinition(z){let J=z.getColDef();if(!J.cellDataType)return;return this.dataTypeDefinitions[J.cellDataType]}getBaseDataType(z){return this.getDataTypeDefinition(z)?.baseDataType}checkType(z,J){if(J==null)return!0;let Q=this.getDataTypeDefinition(z)?.dataTypeMatcher;if(!Q)return!0;if(z.getColDef().allowFormula&&this.beans.formula?.isFormula(J))return!0;return Q(J)}validateColDef(z,J,Q,Z){if(z.cellDataType==="object"){let $=(G)=>{return G?.cellDataType==null||G?.cellDataType===!0},X=$(J)&&$(Q),Y=(G)=>R(48,{property:G,inferred:X,colId:Z}),{object:q}=this.dataTypeDefinitions;if(z.valueFormatter===q.groupSafeValueFormatter&&!this.hasObjectValueFormatter)Y("Formatter");if(z.editable&&z.valueParser===q.valueParser&&!this.hasObjectValueParser)Y("Parser")}}postProcess(z){let J=z.cellDataType;if(!J||typeof J!=="string")return;let{dataTypeDefinitions:Q,beans:Z,formatValueFuncs:$}=this,X=Q[J];if(!X)return;Z.colFilter?.setColDefPropsForDataType(z,X,$[J])}getFormatValue(z){return this.formatValueFuncs[z]}isColPendingInference(z){return this.isPendingInference&&!!this.columnStateUpdatesPendingInference[z]}setColDefPropertiesForBaseDataType(z,J,Q,Z){let $=this.formatValueFuncs[J],X=this.columnDefinitionPropsPerDataType[Q.baseDataType]({colDef:z,cellDataType:J,colModel:this.colModel,dataTypeDefinition:Q,colId:Z,formatValue:$,filterModuleBean:this.beans.filterManager});if(z.cellEditor==="agFormulaCellEditor"&&X.cellEditor!==z.cellEditor)X.cellEditor=z.cellEditor;Object.assign(z,X)}getDateObjectTypeDef(z){let J=this.getLocaleTextFunc(),Q=this.getDateIncludesTimeFlag(z);return{baseDataType:z,valueParser:(Z)=>h0(Z.newValue&&String(Z.newValue)),valueFormatter:(Z)=>{if(Z.value==null)return"";if(!(Z.value instanceof Date)||isNaN(Z.value.getTime()))return J("invalidDate","Invalid Date");return r4(Z.value,Q)??""},dataTypeMatcher:(Z)=>Z instanceof Date}}getDateStringTypeDef(z){let J=this.getDateIncludesTimeFlag(z);return{baseDataType:z,dateParser:(Q)=>h0(Q)??void 0,dateFormatter:(Q)=>r4(Q??null,J)??void 0,valueParser:(Q)=>Vz(String(Q.newValue))?Q.newValue:null,valueFormatter:(Q)=>Vz(String(Q.value))?String(Q.value):"",dataTypeMatcher:(Q)=>typeof Q==="string"&&Vz(Q)}}getDefaultDataTypes(){let z=this.getLocaleTextFunc();return{number:{baseDataType:"number",valueParser:(J)=>J.newValue?.trim?.()===""?null:Number(J.newValue),valueFormatter:(J)=>{if(J.value==null)return"";if(typeof J.value!=="number"||isNaN(J.value))return z("invalidNumber","Invalid Number");return String(J.value)},dataTypeMatcher:(J)=>typeof J==="number"},bigint:{baseDataType:"bigint",valueParser:(J)=>{let{newValue:Q}=J;if(Q==null)return null;if(typeof Q==="string"&&Q.trim()==="")return null;return k1(Q)},valueFormatter:(J)=>{if(J.value==null)return"";if(typeof J.value!=="bigint")return z("invalidBigInt","Invalid BigInt");return String(J.value)},dataTypeMatcher:(J)=>typeof J==="bigint"},text:{baseDataType:"text",valueParser:(J)=>J.newValue===""?null:i0(J.newValue),dataTypeMatcher:(J)=>typeof J==="string"},boolean:{baseDataType:"boolean",valueParser:(J)=>{if(J.newValue==null)return J.newValue;return J.newValue?.trim?.()===""?null:String(J.newValue).toLowerCase()==="true"},valueFormatter:(J)=>J.value==null?"":String(J.value),dataTypeMatcher:(J)=>typeof J==="boolean"},date:this.getDateObjectTypeDef("date"),dateString:this.getDateStringTypeDef("dateString"),dateTime:this.getDateObjectTypeDef("dateTime"),dateTimeString:{...this.getDateStringTypeDef("dateTimeString"),dataTypeMatcher:(J)=>typeof J==="string"&&$B(J)},object:{baseDataType:"object",valueParser:()=>null,valueFormatter:(J)=>i0(J.value)??""}}}destroyColumnStateUpdateListeners(){for(let z of this.columnStateUpdateListenerDestroyFuncs)z();this.columnStateUpdateListenerDestroyFuncs=[]}destroy(){this.dataTypeDefinitions={},this.dataTypeMatchers={},this.formatValueFuncs={},this.columnStateUpdatesPendingInference={},this.destroyColumnStateUpdateListeners(),super.destroy()}};function v7(z,J){let Q={...z,...J};if(z.columnTypes&&J.columnTypes&&J.appendColumnTypes)Q.columnTypes=[...yz(z.columnTypes),...yz(J.columnTypes)];return Q}function I7(z,J,Q){if(!J)return R(45,{parentCellDataType:Q}),!1;if(J.baseDataType!==z.baseDataType)return R(46),!1;return!0}var qB=(z)=>typeof z==="bigint"||typeof z==="number",GB=(z)=>z==="number"||z==="bigint";function C7(z,J){if(!z.valueFormatter)return;return(Q)=>{let{node:Z,colDef:$,column:X,value:Y}=Q;if(Z?.group){let q=($.pivotValueColumn??X).getAggFunc();if(q){if(q==="first"||q==="last")return z.valueFormatter(Q);let{baseDataType:G}=z;if(GB(G)&&q!=="count"){if(qB(Y))return z.valueFormatter(Q);if(Y==null)return;if(typeof Y==="object"){if(typeof Y.toNumber==="function")return z.valueFormatter({...Q,value:Y.toNumber()});if("value"in Y)return z.valueFormatter({...Q,value:Y.value})}}return}}else if(J.get("groupHideOpenParents")&&Q.column.isRowGroupActive()){if(typeof Q.value==="string"&&!z.dataTypeMatcher?.(Q.value))return}return z.valueFormatter(Q)}}function HB(z,J,Q,Z){if(!J[Q])return!1;let $=z[Q];if($===null)return J[Q]=!1,!1;else return Z===void 0?!!$:$===Z}function _B(z,J){if(z==null)return J==null?0:-1;if(J==null)return 1;let Q=k1(z),Z=k1(J);if(Q!=null&&Z!=null){if(Q===Z)return 0;return Q>Z?1:-1}return 0}function UB(z,J){if(z==null)return J==null?0:-1;if(J==null)return 1;let Q=b7(z),Z=b7(J);if(Q!=null&&Z!=null){if(Q===Z)return 0;return Q>Z?1:-1}return 0}function b7(z){let J=k1(z);if(J==null)return null;return J<0n?-J:J}function kQ(z,J){return[["cellRenderer","agSparklineCellRenderer"],["valueGetter",void 0],["valueParser",void 0],["refData",void 0]].some(([Q,Z])=>HB(z,J,Q,Z))}function WB(z,J){let Q=M$(z);for(let Z of J)if(delete Q[Z],Z==="rowGroup")delete Q.rowGroupIndex;else if(Z==="pivot")delete Q.pivotIndex;return Q}var BB={moduleName:"DataType",version:c,beans:[YB],dependsOn:[oW]},EB={moduleName:"ColumnFlex",version:c,beans:[zB]};var KB=class extends V{constructor(){super(...arguments);this.beanName="colNames"}getDisplayNameForColumn(z,J,Q=!1){if(!z)return null;let Z=this.getHeaderName(z.getColDef(),z,null,null,J),{aggColNameSvc:$}=this.beans;if(Q&&$)return $.getHeaderName(z,Z);return Z}getDisplayNameForProvidedColumnGroup(z,J,Q){let Z=J?.getColGroupDef();if(Z)return this.getHeaderName(Z,null,z,J,Q);return null}getDisplayNameForColumnGroup(z,J){return this.getDisplayNameForProvidedColumnGroup(z,z.getProvidedColumnGroup(),J)}getHeaderName(z,J,Q,Z,$){let X=z.headerValueGetter;if(X){let Y=C(this.gos,{colDef:z,column:J,columnGroup:Q,providedColumnGroup:Z,location:$});if(typeof X==="function")return X(Y);else if(typeof X==="string")return this.beans.expressionSvc?.evaluate(X,Y)??null;return""}else if(z.headerName!=null)return z.headerName;else if(z.field)return dq(z.field);return""}},FB=class extends V{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(z){this.visibleCols=z.visibleCols,this.colModel=z.colModel}postConstruct(){this.suppressColumnVirtualisation=this.gos.get("suppressColumnVirtualisation")}getScrollPosition(){return this.scrollPosition}setScrollPosition(z,J,Q=!1){let{visibleCols:Z}=this,$=Z.isBodyWidthDirty;if(z===this.scrollWidth&&J===this.scrollPosition&&!$)return;if(this.scrollWidth=z,this.scrollPosition=J,Z.isBodyWidthDirty=!0,this.gos.get("enableRtl")){let Y=Z.bodyWidth;this.viewportLeft=Y-J-z,this.viewportRight=Y-J}else this.viewportLeft=J,this.viewportRight=z+J;if(this.colModel.ready)this.checkViewportColumns(Q)}getColumnHeadersToRender(z){switch(z){case"left":return this.columnsToRenderLeft;case"right":return this.columnsToRenderRight;default:return this.columnsToRenderCenter}}getHeadersToRender(z,J){let Q;switch(z){case"left":Q=this.rowsOfHeadersToRenderLeft[J];break;case"right":Q=this.rowsOfHeadersToRenderRight[J];break;default:Q=this.rowsOfHeadersToRenderCenter[J];break}return Q??[]}extractViewportColumns(){let z=this.visibleCols.centerCols;if(this.isColumnVirtualisationSuppressed())this.colsWithinViewport=z,this.headerColsWithinViewport=z;else this.colsWithinViewport=z.filter(this.isColumnInRowViewport.bind(this)),this.headerColsWithinViewport=z.filter(this.isColumnInHeaderViewport.bind(this))}isColumnVirtualisationSuppressed(){return this.suppressColumnVirtualisation||this.viewportRight===0}clear(){this.rowsOfHeadersToRenderLeft={},this.rowsOfHeadersToRenderRight={},this.rowsOfHeadersToRenderCenter={},this.colsWithinViewportHash=""}isColumnInHeaderViewport(z){if(z.isAutoHeaderHeight()||LB(z))return!0;return this.isColumnInRowViewport(z)}isColumnInRowViewport(z){if(z.isAutoHeight())return!0;let J=z.getLeft()||0,Q=J+z.getActualWidth(),Z=this.viewportLeft-200,$=this.viewportRight+200,X=J$&&Q>$;return!X&&!Y}getViewportColumns(){let{leftCols:z,rightCols:J}=this.visibleCols;return this.colsWithinViewport.concat(z).concat(J)}getColsWithinViewport(z){if(!this.colModel.colSpanActive)return this.colsWithinViewport;let J=(X)=>{let Y=X.getLeft();return T(Y)&&Y>this.viewportLeft},Q=this.isColumnVirtualisationSuppressed()?void 0:this.isColumnInRowViewport.bind(this),{visibleCols:Z}=this,$=Z.centerCols;return Z.getColsForRow(z,$,Q,J)}checkViewportColumns(z=!1){if(this.extractViewport())this.eventSvc.dispatchEvent({type:"virtualColumnsChanged",afterScroll:z})}calculateHeaderRows(){let{leftCols:z,rightCols:J}=this.visibleCols;this.columnsToRenderLeft=z,this.columnsToRenderRight=J,this.columnsToRenderCenter=this.colsWithinViewport;let Q=(Z)=>{let $=new Set,X={};for(let Y of Z){let q=Y.getParent(),G=Y.isSpanHeaderHeight();while(q){if($.has(q))break;if(G&&q.isPadding()){q=q.getParent();continue}let _=q.getProvidedColumnGroup().getLevel();X[_]??(X[_]=[]),X[_].push(q),$.add(q),q=q.getParent()}}return X};this.rowsOfHeadersToRenderLeft=Q(z),this.rowsOfHeadersToRenderRight=Q(J),this.rowsOfHeadersToRenderCenter=Q(this.headerColsWithinViewport)}extractViewport(){let z=(Z)=>`${Z.getId()}-${Z.getPinned()||"normal"}`;this.extractViewportColumns();let J=this.getViewportColumns().map(z).join("#"),Q=this.colsWithinViewportHash!==J;if(Q)this.colsWithinViewportHash=J,this.calculateHeaderRows();return Q}};function LB(z){while(z){if(z.isAutoHeaderHeight())return!0;z=z.getParent()}return!1}var DB=class extends V{constructor(){super(...arguments);this.beanName="agCompUtils"}adaptFunction(z,J){if(!z.cellRenderer)return null;class Q{refresh(){return!1}getGui(){return this.eGui}init(Z){let $=J(Z),X=typeof $;if(X==="string"||X==="number"||X==="boolean"){this.eGui=UZ(""+$+"");return}if($==null){this.eGui=z0({tag:"span"});return}this.eGui=$}}return Q}},MB={moduleName:"CellRendererFunction",version:c,beans:[DB]},kB=class extends O0{constructor(){super(...arguments);this.beanName="registry"}registerDynamicBeans(z){if(z){this.dynamicBeans??(this.dynamicBeans={});for(let J of Object.keys(z))this.dynamicBeans[J]=z[J]}}createDynamicBean(z,J,...Q){if(!this.dynamicBeans)throw Error(this.getDynamicError(z,!0));let Z=this.dynamicBeans[z];if(Z==null){if(J)throw Error(this.getDynamicError(z,!1));return}return new Z(...Q)}};function fB(z){return typeof z==="object"&&!!z.getComp}var VB=class extends kB{constructor(){super(...arguments);this.agGridDefaults={},this.agGridDefaultOverrides={},this.jsComps={},this.selectors={},this.icons={}}postConstruct(){let z=this.gos.get("components");if(z!=null)for(let J of Object.keys(z))this.jsComps[J]=z[J]}registerModule(z){let{icons:J,userComponents:Q,dynamicBeans:Z,selectors:$}=z;if(Q){let X=(Y,q,G,H)=>{if(this.agGridDefaults[Y]=q,G||H)this.agGridDefaultOverrides[Y]={params:G,processParams:H}};for(let Y of Object.keys(Q)){let q=Q[Y];if(fB(q))q=q.getComp(this.beans);if(typeof q==="object"){let{classImp:G,params:H,processParams:_}=q;X(Y,G,H,_)}else X(Y,q)}}this.registerDynamicBeans(Z);for(let X of $??[])this.selectors[X.selector]=X;if(J)for(let X of Object.keys(J))this.icons[X]=J[X]}getUserComponent(z,J){let Q=(q,G,H,_)=>({componentFromFramework:G,component:q,params:H,processParams:_}),{frameworkOverrides:Z}=this.beans,$=Z.frameworkComponent(J,this.gos.get("components"));if($!=null)return Q($,!0);let X=this.jsComps[J];if(X){let q=Z.isFrameworkComponent(X);return Q(X,q)}let Y=this.agGridDefaults[J];if(Y){let q=this.agGridDefaultOverrides[J];return Q(Y,!1,q?.params,q?.processParams)}return this.beans.validation?.missingUserComponent(z,J,this.agGridDefaults,this.jsComps),null}getSelector(z){return this.selectors[z]}getIcon(z){return this.icons[z]}getDynamicError(z,J){if(J)return Y4(279,{name:z});return this.beans.validation?.missingDynamicBean(z)??Y4(256)}},SB=23,AB=class extends V{constructor(){super(...arguments);this.beanName="ctrlsSvc",this.params={},this.ready=!1,this.readyCallbacks=[]}postConstruct(){this.addEventListener("ready",()=>{if(this.updateReady(),this.ready){for(let z of this.readyCallbacks)z(this.params);this.readyCallbacks.length=0}},this.beans.frameworkOverrides.runWhenReadyAsync?.()??!1)}updateReady(){let z=Object.values(this.params);this.ready=z.length===SB&&z.every((J)=>{return J?.isAlive()??!1})}whenReady(z,J){if(this.ready)J(this.params);else this.readyCallbacks.push(J);z.addDestroyFunc(()=>{let Q=this.readyCallbacks.indexOf(J);if(Q>=0)this.readyCallbacks.splice(Q,1)})}register(z,J){if(this.params[z]=J,this.updateReady(),this.ready)this.dispatchLocalEvent({type:"ready"});J.addDestroyFunc(()=>{this.updateReady()})}get(z){return this.params[z]}getGridBodyCtrl(){return this.params.gridBodyCtrl}getHeaderRowContainerCtrls(){let{leftHeader:z,centerHeader:J,rightHeader:Q}=this.params;return[z,Q,J]}getHeaderRowContainerCtrl(z){let J=this.params;switch(z){case"left":return J.leftHeader;case"right":return J.rightHeader;default:return J.centerHeader}}getScrollFeature(){return this.getGridBodyCtrl().scrollFeature}},RB=':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}',eZ=typeof window!=="object"||!window?.document?.fonts?.forEach,uz=!1,o1=(z,J,Q,Z,$,X,Y=!1)=>{if(eZ||uz)return;let q=z;if(Z)q=`@layer ${CSS.escape(Z).replaceAll("\\.",".")} { ${z} }`;let G=x4.map.get(J);if(!G)G=[],x4.map.set(J,G);if(G.some((W)=>W.injectedCss===q))return;let H=document.createElement("style");if(X)H.setAttribute("nonce",X);H.dataset.agCss=Q,H.dataset.agCssVersion=c,H.textContent=q;let _={rawCss:z,injectedCss:q,el:H,priority:$,isParams:Y},U;for(let W of G){if(W.priority>$)break;U=W}if(U){U.el.after(H);let W=G.indexOf(U);G.splice(W+1,0,_)}else{if(J.nodeName==="STYLE")J.after(H);else J.insertBefore(H,J.querySelector(":not(title, meta)"));G.push(_)}},f$=(z,J,Q,Z)=>{o1(RB,z,"shared",J,0,Q),Z?.forEach(($,X)=>$.forEach((Y)=>o1(Y,z,X,J,0,Q)))},jB=(z,J,Q,Z,$,X)=>{if(eZ||uz)return;let Y=x4.grids.get(z);if(!Y)x4.grids.set(z,{styleContainer:Z,paramsCss:J});else Y.paramsCss=J;if(pQ(Z),J&&Q)o1(J,Z,Q,$,2,X,!0)},OB=(z)=>{let J=x4.grids.get(z)?.styleContainer;if(!J)return;if(x4.grids.delete(z),Array.from(x4.grids.values()).some((Z)=>Z.styleContainer===J))pQ(J);else pQ(J,!0),x4.map.delete(J)},pQ=(z,J=!1)=>{let Q=new Set;for(let $ of x4.grids.values())if($.styleContainer===z)Q.add($.paramsCss);let Z=x4.map.get(z)??[];for(let $=Z.length-1;$>=0;$--)if(J||Z[$].isParams&&!Q.has(Z[$].rawCss))Z[$].el.remove(),Z.splice($,1)},V$=()=>{let z=globalThis.agStyleInjectionVersions??(globalThis.agStyleInjectionVersions=new Map),J=z.get(c);if(!J)J={map:new WeakMap,grids:new Map,paramsId:0},z.set(c,J);return J},x4=V$(),O4=(z)=>{return new S$(z)},G1="$default",PB=0,S$=class{constructor({feature:z,params:J,modeParams:Q={},css:Z,cssImports:$}){this.feature=z,this.css=Z,this.cssImports=$,this.modeParams={[G1]:{...Q[G1]??{},...J??{}},...Q}}use(z,J,Q){let Z=this._inject;if(Z==null){let{css:$}=this;if($){let X=`ag-theme-${this.feature??"part"}-${++PB}`;if(typeof $==="function")$=$();$=`:where(.${X}) { +${$} +} +`;for(let Y of this.cssImports??[])$=`@import url(${JSON.stringify(Y)}); +${$}`;Z={css:$,class:X}}else Z=!1;this._inject=Z}if(Z&&z)o1(Z.css,z,Z.class,J,1,Q);return Z?Z.class:!1}},TB=(z)=>z.replace(/[A-Z]|\d+/g,(J)=>`-${J}`).toLowerCase(),z5=(z)=>`--ag-${TB(z)}`,u4=(z)=>`var(${z5(z)})`,vB=(z,J,Q)=>Math.max(J,Math.min(Q,z)),IB=(z)=>{let J=new Map;return(Q)=>{let Z=Q;if(!J.has(Z))J.set(Z,z(Q));return J.get(Z)}},C4=(z)=>({ref:"accentColor",mix:z}),z4=(z)=>({ref:"foregroundColor",mix:z}),$4=(z)=>({ref:"foregroundColor",mix:z,onto:"backgroundColor"}),CB=(z)=>({ref:"foregroundColor",mix:z,onto:"headerBackgroundColor"}),g0={ref:"backgroundColor"},c1={ref:"foregroundColor"},b4={ref:"accentColor"},mz={backgroundColor:"#fff",foregroundColor:"#181d1f",borderColor:z4(0.15),chromeBackgroundColor:$4(0.02),browserColorScheme:"light"},bB={...mz,textColor:c1,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:C4(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:g0,dragAndDropImageBorder:!0,dragAndDropImageNotAllowedBorder:{color:{ref:"invalidColor",onto:"dragAndDropImageBackgroundColor",mix:0.5}},dragAndDropImageShadow:{ref:"popupShadow"},iconSize:16,iconColor:"inherit",toggleButtonWidth:28,toggleButtonHeight:18,toggleButtonOnBackgroundColor:b4,toggleButtonOffBackgroundColor:$4(0.3),toggleButtonSwitchBackgroundColor:g0,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:g0,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:z4(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:z4(0.2)},menuBackgroundColor:$4(0.03),menuTextColor:$4(0.95),menuShadow:{ref:"popupShadow"},menuSeparatorColor:{ref:"borderColor"}},yB=["colorScheme","color","length","scale","borderStyle","border","shadow","image","fontFamily","fontWeight","duration"],xB=IB((z)=>{return z=z.toLowerCase(),yB.find((J)=>z.endsWith(J.toLowerCase()))??"length"}),KJ=(z)=>{if(typeof z==="object"&&z?.ref)return u4(z.ref);if(typeof z==="string")return z;if(typeof z==="number")return String(z);return!1},J5=(z)=>{if(typeof z==="string")return z;if(typeof z==="object"&&z&&"ref"in z){let J=u4(z.ref);if(z.mix==null)return J;return`color-mix(in srgb, ${z.onto?u4(z.onto):"transparent"}, ${J} ${vB(z.mix*100,0,100)}%)`}return!1},wB=KJ,S2=(z)=>{if(typeof z==="string")return z;if(typeof z==="number")return`${z}px`;if(typeof z==="object"&&z&&"calc"in z)return`calc(${z.calc.replace(/ ?[*/+] ?/g," $& ").replace(/-?\b[a-z][a-z0-9]*\b(?![-(])/gi,(Q)=>Q[0]==="-"?Q:" "+u4(Q)+" ")})`;if(typeof z==="object"&&z&&"ref"in z)return u4(z.ref);return!1},NB=KJ,iQ=(z,J)=>{if(typeof z==="string")return z;if(z===!0)return iQ({},J);if(z===!1)return J==="columnBorder"?iQ({color:"transparent"},J):"none";if(typeof z==="object"&&z&&"ref"in z)return u4(z.ref);return A$(z.style??"solid")+" "+S2(z.width??{ref:"borderWidth"})+" "+J5(z.color??{ref:"borderColor"})},y7=(z)=>{return[S2(z.offsetX??0),S2(z.offsetY??0),S2(z.radius??0),S2(z.spread??0),J5(z.color??{ref:"foregroundColor"}),...z.inset?["inset"]:[]].join(" ")},gB=(z)=>{if(typeof z==="string")return z;if(z===!1)return"none";if(typeof z==="object"&&z&&"ref"in z)return u4(z.ref);if(Array.isArray(z))return z.map(y7).join(", ");return y7(z)},A$=KJ,R$=(z)=>{if(typeof z==="string")return z.includes(",")?z:x7(z);if(typeof z==="object"&&z&&"googleFont"in z)return R$(z.googleFont);if(typeof z==="object"&&z&&"ref"in z)return u4(z.ref);if(Array.isArray(z))return z.map((J)=>{if(typeof J==="object"&&"googleFont"in J)J=J.googleFont;return x7(J)}).join(", ");return!1},x7=(z)=>/^[\w-]+$|\w\(/.test(z)?z:JSON.stringify(z),hB=KJ,j$=(z)=>{if(typeof z==="string")return z;if(typeof z==="object"&&z&&"url"in z)return`url(${JSON.stringify(z.url)})`;if(typeof z==="object"&&z&&"svg"in z)return j$({url:`data:image/svg+xml,${encodeURIComponent(z.svg)}`});if(typeof z==="object"&&z&&"ref"in z)return u4(z.ref);return!1},uB=(z,J,Q)=>{if(typeof z==="string")return z;if(typeof z==="number"){if(z>=10)Q?.warn(104,{value:z,param:J});return`${z}s`}if(typeof z==="object"&&z&&"ref"in z)return u4(z.ref);return!1},mB={color:J5,colorScheme:wB,length:S2,scale:NB,border:iQ,borderStyle:A$,shadow:gB,image:j$,fontFamily:R$,fontWeight:hB,duration:uB},cB=(z,J,Q)=>{let Z=xB(z);return mB[Z](J,z,Q)};var pB=(z,J)=>new O$({themeLogger:z,overridePrefix:J}),O$=class z{constructor(J,Q=[]){this.params=J,this.parts=Q}withPart(J){if(typeof J==="function")J=J();if(!(J instanceof S$))return this.params.themeLogger.preInitErr(259,"Invalid part",{part:J}),this;return new z(this.params,[...this.parts,J])}withoutPart(J){return this.withPart(O4({feature:J}))}withParams(J,Q=G1){return this.withPart(O4({modeParams:{[Q]:J}}))}_startUse({styleContainer:J,cssLayer:Q,nonce:Z,loadThemeGoogleFonts:$,moduleCss:X}){if(eZ)return;if(uz)return;dB(),f$(J,Q,Z,X);let Y=iB(this);if(Y.length>0){for(let q of Y)if($)nB(q,Z)}for(let q of this.parts)q.use(J,Q,Z)}_getCssClass(){if(uz)return"ag-theme-quartz";return this._cssClassCache??(this._cssClassCache=w7(this.parts).map((J)=>J.use(void 0,void 0,void 0)).filter(Boolean).concat(this._getParamsClassName()).join(" "))}_getParamsClassName(){return this._paramsClassName??(this._paramsClassName=`ag-theme-params-${++V$().paramsId}`)}_getModeParams(){let J=this._paramsCache;if(!J){let Q={[G1]:{...bB}};for(let Z of w7(this.parts))for(let $ of Object.keys(Z.modeParams)){let X=Z.modeParams[$];if(X){let Y=Q[$]??(Q[$]={}),q=new Set;for(let G of Object.keys(X)){let H=X[G];if(H!==void 0)Y[G]=H,q.add(G)}if($===G1)for(let G of Object.keys(Q)){let H=Q[G];if(G!==G1)for(let _ of q)delete H[_]}}}this._paramsCache=J=Q}return J}_getParamsCss(){if(!this._paramsCssCache){let J="",Q="",Z=this._getModeParams(),{overridePrefix:$,themeLogger:X}=this.params,Y=$?`--ag-${$}-`:void 0;for(let H of Object.keys(Z)){let _=Z[H];if(H!==G1){let W=`:where([data-ag-theme-mode="${typeof CSS==="object"?CSS.escape(H):H}"]) & { +`;J+=W,Q+=W}for(let U of Object.keys(_).sort()){let W=_[U],B=cB(U,W,X);if(B===!1)X.error(107,{key:U,value:W});else{let E=z5(U),K=Y?E.replace("--ag-",Y):E,F=E.replace("--ag-","--ag-inherited-");J+=` ${E}: var(${F}, ${B}); +`,Q+=` ${F}: var(${K}); +`}}if(H!==G1)J+=`} +`,Q+=`} +`}let q=`:where(.${this._getParamsClassName()})`,G=`${q} { +${J}} +`;G+=`:has(> ${q}):not(${q}) { +${Q}} +`,this._paramsCssCache=G}return this._paramsCssCache}},w7=(z)=>{let J=new Map;for(let Z of z)J.set(Z.feature,Z);let Q=[];for(let Z of z)if(!Z.feature||J.get(Z.feature)===Z)Q.push(Z);return Q},iB=(z)=>{let J=new Set,Q=(X)=>{if(Array.isArray(X))X.forEach(Q);else{let Y=X?.googleFont;if(typeof Y==="string")J.add(Y)}};return Object.values(z._getModeParams()).flatMap((X)=>Object.values(X)).forEach(Q),Array.from(J).sort()},N7=!1,dB=()=>{if(N7)return;N7=!0;for(let z of Array.from(document.head.querySelectorAll('style[data-ag-scope="legacy"]')))z.remove()},nB=async(z,J)=>{let Q=`@import url('https://${tB}/css2?family=${encodeURIComponent(z)}:wght@100;200;300;400;500;600;700;800;900&display=swap'); +`;o1(Q,document.head,`googleFont:${z}`,void 0,0,J)},tB="fonts.googleapis.com",g7={changeKey:"listItemHeight",type:"length",defaultValue:24},rB=class extends O0{constructor(){super(...arguments);this.beanName="environment",this.sizeEls=new Map,this.lastKnownValues=new Map,this.sizesMeasured=!1,this.globalCSS=[]}wireBeans(z){this.eRootDiv=z.eRootDiv}postConstruct(){let{gos:z,eRootDiv:J}=this;z.setInstanceDomData(J);let Q=z.get("themeStyleContainer"),Z=typeof ShadowRoot<"u",$=Z&&J.getRootNode()instanceof ShadowRoot;if(this.eStyleContainer=(typeof Q==="function"?Q():Q)??($?J:document.head),!Q&&!$&&Z)sB(J,this.shadowRootError.bind(this),this.addDestroyFunc.bind(this));this.cssLayer=z.get("themeCssLayer"),this.styleNonce=z.get("styleNonce"),this.addManagedPropertyListener("theme",()=>this.handleThemeChange()),this.handleThemeChange(),this.getSizeEl(g7),this.initVariables(),this.addDestroyFunc(()=>OB(this)),this.mutationObserver=new MutationObserver(()=>{this.fireStylesChangedEvent("theme")}),this.addDestroyFunc(()=>this.mutationObserver.disconnect())}applyThemeClasses(z,J=[]){let{theme:Q}=this,Z=Q?Q._getCssClass():this.applyLegacyThemeClasses();for(let $ of Array.from(z.classList))if($.startsWith("ag-theme-"))z.classList.remove($);if(Z){let $=z.className;z.className=`${$}${$?" ":""}${Z}${J?.length?" "+J.join(" "):""}`}}applyLegacyThemeClasses(){let z="";this.mutationObserver.disconnect();let J=this.eRootDiv;while(J){let Q=!1;for(let Z of Array.from(J.classList))if(Z.startsWith("ag-theme-"))Q=!0,z=z?`${z} ${Z}`:Z;if(Q)this.mutationObserver.observe(J,{attributes:!0,attributeFilter:["class"]});J=J.parentElement}return z}addGlobalCSS(z,J){if(this.theme)o1(z,this.eStyleContainer,J,this.cssLayer,0,this.styleNonce);else this.globalCSS.push([z,J])}getDefaultListItemHeight(){return this.getCSSVariablePixelValue(g7)}getCSSVariablePixelValue(z){let J=this.lastKnownValues.get(z);if(J!=null)return J;let Q=this.measureSizeEl(z);if(Q==="detached"||Q==="no-styles"){if(z.cacheDefault)this.lastKnownValues.set(z,z.defaultValue);return z.defaultValue}return this.lastKnownValues.set(z,Q),Q}measureSizeEl(z){let J=this.getSizeEl(z);if(J.offsetParent==null)return"detached";let Q=J.offsetWidth;if(Q===fQ)return"no-styles";return this.sizesMeasured=!0,Q}getMeasurementContainer(){let z=this.eMeasurementContainer;if(!z)z=this.eMeasurementContainer=F0({tag:"div",cls:"ag-measurement-container"}),this.eRootDiv.appendChild(z);return z}getSizeEl(z){let J=this.sizeEls.get(z);if(J)return J;let Q=this.getMeasurementContainer();J=F0({tag:"div"});let Z=this.setSizeElStyles(J,z);Q.appendChild(J),this.sizeEls.set(z,J);let{type:$,noWarn:X}=z;if($!=="length"&&$!=="border")return J;let Y=this.measureSizeEl(z);if(Y==="no-styles"&&!X)this.varError(Z,z.defaultValue);let q=P4(this.beans,J,()=>{let G=this.measureSizeEl(z);if(G==="detached"||G==="no-styles")return;if(this.lastKnownValues.set(z,G),G!==Y)Y=G,this.fireStylesChangedEvent(z.changeKey)});return this.addDestroyFunc(()=>q()),J}setSizeElStyles(z,J){let{changeKey:Q,type:Z}=J,$=z5(Q);if(Z==="border"){if($.endsWith("-width"))$=$.slice(0,-6);z.className="ag-measurement-element-border",z.style.setProperty("--ag-internal-measurement-border",`var(${$}, solid ${fQ}px)`)}else z.style.width=`var(${$}, ${fQ}px)`;return $}handleThemeChange(){let{gos:z,theme:J}=this,Q=z.get("theme"),Z;if(Q==="legacy")Z=void 0;else{let $=Q??this.getDefaultTheme();if($ instanceof O$)Z=$;else this.themeError($)}if(Z!==J)this.handleNewTheme(Z);this.postProcessThemeChange(Z,Q)}handleNewTheme(z){let{gos:J,eRootDiv:Q,globalCSS:Z}=this,$=this.getAdditionalCss();if(z){f$(this.eStyleContainer,this.cssLayer,this.styleNonce,$);for(let[X,Y]of Z)o1(X,this.eStyleContainer,Y,this.cssLayer,0,this.styleNonce);Z.length=0}this.theme=z,z?._startUse({loadThemeGoogleFonts:J.get("loadThemeGoogleFonts"),styleContainer:this.eStyleContainer,cssLayer:this.cssLayer,nonce:this.styleNonce,moduleCss:$}),jB(this,z?._getParamsCss()??null,z?._getParamsClassName()??null,this.eStyleContainer,this.cssLayer,this.styleNonce),this.applyThemeClasses(Q),this.fireStylesChangedEvent("theme")}fireStylesChangedEvent(z){this.eventSvc.dispatchEvent({type:"stylesChanged",[`${z}Changed`]:!0})}},fQ=15538,sB=(z,J,Q)=>{let Z=60,$=setInterval(()=>{if(typeof ShadowRoot<"u"&&z.getRootNode()instanceof ShadowRoot)J(),clearInterval($);if(z.isConnected||--Z<0)clearInterval($)},1000);Q(()=>clearInterval($))},lB=".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)}}",aB={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:g0,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:b4,rangeSelectionBackgroundColor:C4(0.2),rangeSelectionChartBackgroundColor:"#0058FF1A",rangeSelectionChartCategoryBackgroundColor:"#00FF841A",rangeSelectionHighlightColor:C4(0.5),rangeHeaderHighlightColor:CB(0.08),rowNumbersSelectedColor:C4(0.5),rowHoverColor:C4(0.08),columnHoverColor:C4(0.05),selectedRowBackgroundColor:C4(0.12),modalOverlayBackgroundColor:{ref:"backgroundColor",mix:0.66},dataBackgroundColor:g0,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:z4(0.7),headerColumnResizeHandleHeight:"30%",headerColumnResizeHandleWidth:2,headerColumnResizeHandleColor:{ref:"borderColor"},iconButtonColor:{ref:"iconColor"},iconButtonBackgroundColor:"transparent",iconButtonBackgroundSpread:4,iconButtonBorderRadius:1,iconButtonHoverColor:{ref:"iconButtonColor"},iconButtonHoverBackgroundColor:z4(0.1),iconButtonActiveColor:b4,iconButtonActiveBackgroundColor:C4(0.28),iconButtonActiveIndicatorColor:b4,setFilterIndentSize:{ref:"iconSize"},chartMenuPanelWidth:260,chartMenuLabelColor:z4(0.8),cellEditingBorder:{color:b4},cellEditingShadow:{ref:"cardShadow"},fullRowEditInvalidBackgroundColor:{ref:"invalidColor",onto:"backgroundColor",mix:0.25},columnSelectIndentSize:{ref:"iconSize"},toolPanelSeparatorBorder:!0,columnDropCellBackgroundColor:z4(0.07),columnDropCellTextColor:{ref:"textColor"},columnDropCellDragHandleColor:{ref:"textColor"},columnDropCellBorder:{color:z4(0.13)},selectCellBackgroundColor:z4(0.07),selectCellBorder:{color:z4(0.13)},advancedFilterBuilderButtonBarBorder:!0,advancedFilterBuilderIndentSize:{calc:"spacing * 2 + iconSize"},advancedFilterBuilderJoinPillColor:"#f08e8d",advancedFilterBuilderColumnPillColor:"#a6e194",advancedFilterBuilderOptionPillColor:"#f3c08b",advancedFilterBuilderValuePillColor:"#85c0e4",filterPanelApplyButtonColor:g0,filterPanelApplyButtonBackgroundColor:b4,columnPanelApplyButtonColor:g0,columnPanelApplyButtonBackgroundColor:b4,filterPanelCardSubtleColor:{ref:"textColor",mix:0.7},filterPanelCardSubtleHoverColor:{ref:"textColor"},findMatchColor:c1,findMatchBackgroundColor:"#ffff00",findActiveMatchColor:c1,findActiveMatchBackgroundColor:"#ffa500",filterToolPanelGroupIndent:{ref:"spacing"},rowLoadingSkeletonEffectColor:z4(0.15),statusBarLabelColor:c1,statusBarLabelFontWeight:500,statusBarValueColor:c1,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},oB=".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)}",P$={cellBatchEditBackgroundColor:"rgba(220 181 139 / 16%)",cellBatchEditTextColor:"#422f00",rowBatchEditBackgroundColor:{ref:"cellBatchEditBackgroundColor"},rowBatchEditTextColor:{ref:"cellBatchEditTextColor"}},eB={...P$,cellBatchEditTextColor:"#f3d0b3"},z3=()=>O4({feature:"batchEditStyle",params:P$,css:oB}),J3=z3(),Q3=":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)}",Z3={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 $3=()=>O4({feature:"buttonStyle",params:{...Z3,buttonBackgroundColor:g0,buttonBorder:!0,buttonHoverBackgroundColor:{ref:"rowHoverColor"},buttonActiveBorder:{color:b4}},css:Q3}),X3=$3();var Y3=".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 q3=()=>{return O4({feature:"columnDropStyle",css:Y3})},T$=q3();var G3={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"}}},H3=()=>O4({feature:"formulaStyle",params:G3}),_3=H3(),U3={warn:(...z)=>{R(z[0],z[1])},error:(...z)=>{t(z[0],z[1])},preInitErr:(...z)=>{q6(z[0],z[2],z[1])}},W3=()=>pB(U3).withParams(aB).withPart(X3).withPart(T$).withPart(J3).withPart(_3),B3='.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)}}',E3=()=>O4({feature:"checkboxStyle",params:{checkboxBorderWidth:1,checkboxBorderRadius:{ref:"borderRadius"},checkboxUncheckedBackgroundColor:g0,checkboxUncheckedBorderColor:$4(0.3),checkboxCheckedBackgroundColor:b4,checkboxCheckedBorderColor:{ref:"checkboxCheckedBackgroundColor"},checkboxCheckedShapeImage:{svg:''},checkboxCheckedShapeColor:g0,checkboxIndeterminateBackgroundColor:$4(0.3),checkboxIndeterminateBorderColor:{ref:"checkboxIndeterminateBackgroundColor"},checkboxIndeterminateShapeImage:{svg:''},checkboxIndeterminateShapeColor:g0,radioCheckedShapeImage:{svg:''}},css:B3}),K3=E3();var v$=()=>({...mz,...eB,backgroundColor:"hsl(217, 0%, 17%)",foregroundColor:"#FFF",chromeBackgroundColor:$4(0.05),rowHoverColor:C4(0.15),selectedRowBackgroundColor:C4(0.2),menuBackgroundColor:$4(0.1),browserColorScheme:"dark",popupShadow:"0 0px 20px #000A",cardShadow:"0 1px 4px 1px #000A",advancedFilterBuilderJoinPillColor:"#7a3a37",advancedFilterBuilderColumnPillColor:"#355f2d",advancedFilterBuilderOptionPillColor:"#5a3168",advancedFilterBuilderValuePillColor:"#374c86",filterPanelApplyButtonColor:c1,columnPanelApplyButtonColor:c1,findMatchColor:g0,findActiveMatchColor:g0,checkboxUncheckedBorderColor:$4(0.4),toggleButtonOffBackgroundColor:$4(0.4),rowBatchEditBackgroundColor:$4(0.1),formulaToken1Color:"#4da3e5",formulaToken2Color:"#f55864",formulaToken3Color:"#b688f2",formulaToken4Color:"#24bb4a",formulaToken5Color:"#e772ba",formulaToken6Color:"#f69b5f",formulaToken7Color:"#a3e6ff"});var F3=()=>({...v$(),backgroundColor:"#1f2836"});var L3=()=>O4({feature:"colorScheme",params:mz,modeParams:{light:mz,dark:v$(),"dark-blue":F3()}}),D3=L3();var I$={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:''},C$={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":''},M3=(z={})=>{let J="";for(let Q of[...Object.keys(I$),...Object.keys(C$)]){let Z=k3(Q,z.strokeWidth);J+=`.ag-icon-${Q}::before { mask-image: url('data:image/svg+xml,${encodeURIComponent(Z)}'); } +`}return J},k3=(z,J=1.5)=>{let Q=C$[z];if(Q)return Q;let Z=I$[z];if(!Z)throw Error(`Missing icon data for ${z}`);return``+Z+""},f3=(z={})=>{return O4({feature:"iconSet",css:()=>M3(z)})};var V3=f3();var S3=":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)}}",A3=".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 R3={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 j3=()=>O4({feature:"inputStyle",params:{...R3,inputBackgroundColor:g0,inputBorder:!0,inputBorderRadius:{ref:"borderRadius"},inputPaddingStart:{ref:"spacing"},inputFocusBorder:{color:b4},inputFocusShadow:{ref:"focusShadow"},inputDisabledBackgroundColor:$4(0.06),inputDisabledTextColor:{ref:"textColor",mix:0.5},inputInvalidBorder:{color:{ref:"invalidColor"}},pickerButtonBorder:!0,pickerListBorder:!0},css:()=>S3+A3}),O3=j3();var P3=".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 T3={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 v3=()=>O4({feature:"tabStyle",params:{...T3,tabBarBorder:!0,tabBarBackgroundColor:z4(0.05),tabTextColor:{ref:"textColor",mix:0.7},tabSelectedTextColor:{ref:"textColor"},tabHoverTextColor:{ref:"textColor"},tabSelectedBorderColor:{ref:"borderColor"},tabSelectedBackgroundColor:g0},css:P3}),I3=v3();var C3=()=>({fontFamily:[{googleFont:"IBM Plex Sans"},"-apple-system","BlinkMacSystemFont","Segoe UI","Roboto","Oxygen-Sans","Ubuntu"]}),b3=()=>W3().withPart(K3).withPart(D3).withPart(V3).withPart(I3).withPart(O3).withPart(T$).withParams(C3()),FJ=b3();var T1=(z,J,Q,Z,$)=>({changeKey:z,type:J,defaultValue:Q,noWarn:Z,cacheDefault:$}),y3=T1("cellHorizontalPadding","length",16),x3=T1("indentationLevel","length",0,!0,!0),w3=T1("rowGroupIndentSize","length",0),h7=T1("rowHeight","length",42),u7=T1("headerHeight","length",48),VQ=T1("rowBorderWidth","border",1),m7=T1("pinnedRowBorderWidth","border",1),N3=T1("headerRowBorderWidth","border",1);function g3(z,J){for(let Q of J.sort((Z,$)=>Z.moduleName.localeCompare($.moduleName))){let Z=Q.css;if(Z)z.set(`module-${Q.moduleName}`,Z)}}var h3=class extends rB{initVariables(){this.addManagedPropertyListener("rowHeight",()=>this.refreshRowHeightVariable()),this.getSizeEl(h7),this.getSizeEl(u7),this.getSizeEl(VQ),this.getSizeEl(m7),this.refreshRowBorderWidthVariable()}getPinnedRowBorderWidth(){return this.getCSSVariablePixelValue(m7)}getRowBorderWidth(){return this.getCSSVariablePixelValue(VQ)}getHeaderRowBorderWidth(){return this.getCSSVariablePixelValue(N3)}getDefaultRowHeight(){return this.getCSSVariablePixelValue(h7)}getDefaultHeaderHeight(){return this.getCSSVariablePixelValue(u7)}getDefaultCellHorizontalPadding(){return this.getCSSVariablePixelValue(y3)}getCellPaddingLeft(){let z=this.getDefaultCellHorizontalPadding(),J=this.getCSSVariablePixelValue(x3),Q=this.getCSSVariablePixelValue(w3);return z-1+Q*J}getCellPadding(){let z=this.getDefaultCellHorizontalPadding()-1;return this.getCellPaddingLeft()+z}getDefaultColumnMinWidth(){return Math.min(36,this.getDefaultRowHeight())}refreshRowHeightVariable(){let{eRootDiv:z}=this,J=z.style.getPropertyValue("--ag-line-height").trim(),Q=this.gos.get("rowHeight");if(Q==null||isNaN(Q)||!isFinite(Q)){if(J!==null)z.style.setProperty("--ag-line-height",null);return-1}let Z=`${Q}px`;if(J!=Z)return z.style.setProperty("--ag-line-height",Z),Q;return J!=""?Number.parseFloat(J):-1}fireStylesChangedEvent(z){if(z==="rowBorderWidth")this.refreshRowBorderWidthVariable();super.fireStylesChangedEvent(z)}refreshRowBorderWidthVariable(){let z=this.getCSSVariablePixelValue(VQ);this.eRootDiv.style.setProperty("--ag-internal-row-border-width",`${z}px`)}postProcessThemeChange(z,J){if(z&&getComputedStyle(this.getMeasurementContainer()).getPropertyValue("--ag-legacy-styles-loaded"))if(J)t(106);else t(239)}getAdditionalCss(){let z=new Map;return z.set("core",[lB]),g3(z,Array.from(CG())),z}getDefaultTheme(){return FJ}varError(z,J){R(9,{variable:{cssName:z,defaultValue:J}})}themeError(z){t(240,{theme:z})}shadowRootError(){t(293)}},u3=class extends O0{constructor(){super(...arguments);this.beanName="eventSvc",this.eventServiceType="global",this.globalSvc=new R4}addListener(z,J,Q){this.globalSvc.addEventListener(z,J,Q)}removeListener(z,J,Q){this.globalSvc.removeEventListener(z,J,Q)}addGlobalListener(z,J=!1){this.globalSvc.addGlobalListener(z,J)}removeGlobalListener(z,J=!1){this.globalSvc.removeGlobalListener(z,J)}dispatchEvent(z){this.globalSvc.dispatchEvent(this.gos.addCommon(z))}dispatchEventOnce(z){this.globalSvc.dispatchEventOnce(this.gos.addCommon(z))}},m3=class extends u3{postConstruct(){let{globalListener:z,globalSyncListener:J}=this.beans;if(z)this.addGlobalListener(z,!0);if(J)this.addGlobalListener(J,!1)}};function dQ(z,J,Q){let Z=z.visibleCols.headerGroupRowCount;if(Q>=Z)return{column:J,headerRowIndex:Q};let $=J.getParent();while($&&$.getProvidedColumnGroup().getLevel()>Q)$=$.getParent();let X=J.isSpanHeaderHeight();if(!$||X&&$.isPadding())return{column:J,headerRowIndex:Z};return{column:$,headerRowIndex:$.getProvidedColumnGroup().getLevel()}}var c3=class extends V{constructor(){super(...arguments);this.beanName="headerNavigation",this.currentHeaderRowWithoutSpan=-1}postConstruct(){let z=this.beans;z.ctrlsSvc.whenReady(this,(Q)=>{this.gridBodyCon=Q.gridBodyCtrl});let J=Y0(z);this.addManagedElementListeners(J,{mousedown:()=>{this.currentHeaderRowWithoutSpan=-1}})}getHeaderPositionForColumn(z,J){let Q,{colModel:Z,colGroupSvc:$,ctrlsSvc:X}=this.beans;if(typeof z==="string"){if(Q=Z.getCol(z),!Q)Q=$?.getColumnGroup(z)??null}else Q=z;if(!Q)return null;let q=X.getHeaderRowContainerCtrl()?.getAllCtrls(),G=b(q||[]).type==="filter",H=Q4(this.beans)-1,_=-1,U=Q;while(U)_++,U=U.getParent();let W=_;if(J&&G&&W===H-1)W++;return W===-1?null:{headerRowIndex:W,column:Q}}navigateVertically(z,J){let{focusSvc:Q,visibleCols:Z}=this.beans,{focusedHeader:$}=Q;if(!$)return!1;let{headerRowIndex:X}=$,Y=$.column,q=Q4(this.beans),G=this.getHeaderRowType(X),H=Z.headerGroupRowCount,{headerRowIndex:_,column:U,headerRowIndexWithoutSpan:W}=z==="UP"?p3(G,Y,X):i3(Y,X,H),B=!1;if(_<0)_=0,U=Y,B=!0;if(_>=q)_=-1,this.currentHeaderRowWithoutSpan=-1;else if(W!==void 0)this.currentHeaderRowWithoutSpan=W;if(!B&&!U)return!1;return Q.focusHeaderPosition({headerPosition:{headerRowIndex:_,column:U},allowUserOverride:!0,event:J})}navigateHorizontally(z,J=!1,Q){let{focusSvc:Z,gos:$}=this.beans,X={...Z.focusedHeader},Y,q;if(this.currentHeaderRowWithoutSpan!==-1)X.headerRowIndex=this.currentHeaderRowWithoutSpan;else this.currentHeaderRowWithoutSpan=X.headerRowIndex;if(z==="LEFT"!==$.get("enableRtl"))q="Before",Y=this.findHeader(X,q);else q="After",Y=this.findHeader(X,q);let G=$.getCallback("tabToNextHeader");if(J&&G){let H=Z.focusHeaderPositionFromUserFunc({userFunc:G,headerPosition:Y,direction:q});if(H){let{headerRowIndex:_}=Z.focusedHeader||{};if(_!=null&&_!=X.headerRowIndex)this.currentHeaderRowWithoutSpan=_}return H}if(Y||!J)return Z.focusHeaderPosition({headerPosition:Y,direction:q,fromTab:J,allowUserOverride:!0,event:Q});return this.focusNextHeaderRow(X,q,Q)}focusNextHeaderRow(z,J,Q){let Z=this.beans,$=z.headerRowIndex,X=null,Y,q=Q4(Z),G=this.beans.visibleCols.allCols;if(J==="Before"){if($<=0)return!1;X=b(G),Y=$-1,this.currentHeaderRowWithoutSpan-=1}else if(X=G[0],Y=$+1,this.currentHeaderRowWithoutSpan=q)_=-1;return Z.focusSvc.focusHeaderPosition({headerPosition:{column:H,headerRowIndex:_},direction:J,fromTab:!0,allowUserOverride:!0,event:Q})}scrollToColumn(z,J="After"){if(z.getPinned())return;let Q;if(W0(z)){let Z=z.getDisplayedLeafColumns();Q=J==="Before"?b(Z):Z[0]}else Q=z;this.gridBodyCon.scrollFeature.ensureColumnVisible(Q)}findHeader(z,J){let{colGroupSvc:Q,visibleCols:Z}=this.beans,$=z.column;if($ instanceof S6){let G=$.getDisplayedLeafColumns();$=J==="Before"?G[0]:G[G.length-1]}let X=J==="Before"?Z.getColBefore($):Z.getColAfter($);if(!X)return;let Y=Z.headerGroupRowCount;if(z.headerRowIndex>=Y)return{headerRowIndex:z.headerRowIndex,column:X};let q=Q?.getColGroupAtLevel(X,z.headerRowIndex);if(!q)return{headerRowIndex:X instanceof B4&&X.isSpanHeaderHeight()?Z.headerGroupRowCount:z.headerRowIndex,column:X};if(q.isPadding()&&X.isSpanHeaderHeight())return{headerRowIndex:Z.headerGroupRowCount,column:X};return{headerRowIndex:z.headerRowIndex,column:q??X}}getHeaderRowType(z){let J=this.beans.ctrlsSvc.getHeaderRowContainerCtrl();if(J)return J.getRowType(z)}};function p3(z,J,Q){let Z=Q-1;if(z!=="filter"){let $=J instanceof B4&&J.isSpanHeaderHeight(),X=J.getParent();while(X&&(X.getProvidedColumnGroup().getLevel()>Z||$&&X.isPadding()))X=X.getParent();if(X)if($)return{column:X,headerRowIndex:X.getProvidedColumnGroup().getLevel(),headerRowIndexWithoutSpan:Z};else return{column:X,headerRowIndex:Z,headerRowIndexWithoutSpan:Z}}return{column:J,headerRowIndex:Z,headerRowIndexWithoutSpan:Z}}function i3(z,J,Q){let Z=J+1,$={column:z,headerRowIndex:Z,headerRowIndexWithoutSpan:Z};if(z instanceof S6){if(Z>=Q)return{column:z.getDisplayedLeafColumns()[0],headerRowIndex:Q,headerRowIndexWithoutSpan:Z};let Y=z.getDisplayedChildren()[0];if(Y instanceof S6&&Y.isPadding()){let G=Y.getDisplayedLeafColumns()[0];if(G.isSpanHeaderHeight())Y=G}if($.column=Y,Y instanceof B4&&Y.isSpanHeaderHeight())$.headerRowIndex=Q,$.headerRowIndexWithoutSpan=Z}return $}var d3=class extends V{constructor(){super(...arguments);this.beanName="focusSvc",this.focusFallbackTimeout=null,this.needsFocusRestored=!1}wireBeans(z){this.colModel=z.colModel,this.visibleCols=z.visibleCols,this.rowRenderer=z.rowRenderer,this.navigation=z.navigation,this.filterManager=z.filterManager,this.overlays=z.overlays}postConstruct(){let z=this.clearFocusedCell.bind(this);this.addManagedEventListeners({columnPivotModeChanged:z,newColumnsLoaded:this.onColumnEverythingChanged.bind(this),columnGroupOpened:z,columnRowGroupChanged:z}),this.addDestroyFunc(oH(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 z=this.focusedCell.column,J=this.colModel.getCol(z.getId());if(z!==J)this.clearFocusedCell()}getFocusCellToUseAfterRefresh(){let{gos:z,focusedCell:J}=this;if(z.get("suppressFocusAfterRefresh")||z.get("suppressCellFocus")||!J)return null;if(!this.doesRowOrCellHaveBrowserFocus())return null;return J}getFocusHeaderToUseAfterRefresh(){if(this.gos.get("suppressFocusAfterRefresh")||!this.focusedHeader)return null;if(!this.isDomDataPresentInHierarchy(d(this.beans),d9))return null;return this.focusedHeader}doesRowOrCellHaveBrowserFocus(){let z=d(this.beans);if(this.isDomDataPresentInHierarchy(z,gz,!0))return!0;return this.isDomDataPresentInHierarchy(z,hz,!0)}isDomDataPresentInHierarchy(z,J,Q){let Z=z;while(Z){let $=J9(this.gos,Z,J);if($){if($.destroyed&&Q)return this.attemptToRecoverFocus(),!1;return!0}Z=Z.parentNode}return!1}getFocusedCell(){return this.focusedCell}getFocusEventParams(z){let{rowIndex:J,rowPinned:Q,column:Z}=z,$={rowIndex:J,rowPinned:Q,column:Z,isFullWidthCell:!1},X=this.rowRenderer.getRowByPosition({rowIndex:J,rowPinned:Q});if(X)$.isFullWidthCell=X.isFullWidth();return $}clearFocusedCell(){if(this.focusedCell==null)return;let z=this.getFocusEventParams(this.focusedCell);this.focusedCell=null,this.eventSvc.dispatchEvent({type:"cellFocusCleared",...z})}setFocusedCell(z){this.setFocusRecovered();let{column:J,rowIndex:Q,rowPinned:Z,forceBrowserFocus:$=!1,preventScrollOnBrowserFocus:X=!1,sourceEvent:Y}=z,q=this.colModel.getCol(J);if(!q){this.focusedCell=null;return}this.focusedCell={rowIndex:Q,rowPinned:q0(Z),column:q};let G=this.getFocusEventParams(this.focusedCell);this.eventSvc.dispatchEvent({type:"cellFocused",...G,...this.previousCellFocusParams&&{previousParams:this.previousCellFocusParams},forceBrowserFocus:$,preventScrollOnBrowserFocus:X,sourceEvent:Y}),this.previousCellFocusParams=G}isCellFocused(z){if(this.focusedCell==null)return!1;return t2(z,this.focusedCell)}isHeaderWrapperFocused(z){if(this.focusedHeader==null)return!1;let{column:J,rowCtrl:{rowIndex:Q,pinned:Z}}=z,{column:$,headerRowIndex:X}=this.focusedHeader;return J===$&&Q===X&&Z==$.getPinned()}focusHeaderPosition(z){if(this.setFocusRecovered(),D4(this.beans))return!1;let{direction:J,fromTab:Q,allowUserOverride:Z,event:$,fromCell:X,rowWithoutSpanValue:Y,scroll:q=!0}=z,{headerPosition:G}=z;if(X&&this.filterManager?.isAdvFilterHeaderActive())return this.focusAdvancedFilter(G);if(Z){let H=this.focusedHeader,_=Q4(this.beans);if(Q){let U=this.gos.getCallback("tabToNextHeader");if(U)G=this.getHeaderPositionFromUserFunc({userFunc:U,direction:J,currentPosition:H,headerPosition:G,headerRowCount:_})}else{let U=this.gos.getCallback("navigateToNextHeader");if(U&&$){let W={key:$.key,previousHeaderPosition:H,nextHeaderPosition:G,headerRowCount:_,event:$},B=U(W);G=B===null?H:B}}}if(!G)return!1;return this.focusProvidedHeaderPosition({headerPosition:G,direction:J,event:$,fromCell:X,rowWithoutSpanValue:Y,scroll:q})}focusHeaderPositionFromUserFunc(z){if(D4(this.beans))return!1;let{userFunc:J,headerPosition:Q,direction:Z,event:$}=z,X=this.focusedHeader,Y=Q4(this.beans),q=this.getHeaderPositionFromUserFunc({userFunc:J,direction:Z,currentPosition:X,headerPosition:Q,headerRowCount:Y});return!!q&&this.focusProvidedHeaderPosition({headerPosition:q,direction:Z,event:$})}getHeaderPositionFromUserFunc(z){let{userFunc:J,direction:Q,currentPosition:Z,headerPosition:$,headerRowCount:X}=z,q=J({backwards:Q==="Before",previousHeaderPosition:Z,nextHeaderPosition:$,headerRowCount:X});if(q===!0)return Z;if(q===!1)return null;return q}focusProvidedHeaderPosition(z){let{headerPosition:J,direction:Q,fromCell:Z,rowWithoutSpanValue:$,event:X,scroll:Y=!0}=z,{column:q,headerRowIndex:G}=J,{filterManager:H,ctrlsSvc:_,headerNavigation:U}=this.beans;if(this.focusedHeader&&V_(z.headerPosition,this.focusedHeader))return!1;if(G===-1){if(H?.isAdvFilterHeaderActive())return this.focusAdvancedFilter(J);return this.focusGridView({column:q,event:X})}if(Y)U?.scrollToColumn(q,Q);let B=_.getHeaderRowContainerCtrl(q.getPinned())?.focusHeader(J.headerRowIndex,q,X)||!1;if(U&&B&&($!=null||Z))U.currentHeaderRowWithoutSpan=$??-1;return B}focusFirstHeader(){if(this.overlays?.exclusive&&this.focusOverlay())return!0;let z=this.visibleCols.allCols[0];if(!z)return!1;let J=dQ(this.beans,z,0);return this.focusHeaderPosition({headerPosition:J,rowWithoutSpanValue:0})}focusLastHeader(z){if(this.overlays?.exclusive&&this.focusOverlay(!0))return!0;let J=Q4(this.beans)-1,Q=b(this.visibleCols.allCols);return this.focusHeaderPosition({headerPosition:{headerRowIndex:J,column:Q},rowWithoutSpanValue:-1,event:z})}focusPreviousFromFirstCell(z){if(this.filterManager?.isAdvFilterHeaderActive())return this.focusAdvancedFilter(null);return this.focusLastHeader(z)}isAnyCellFocused(){return!!this.focusedCell}isRowFocused(z,J){if(this.focusedCell==null)return!1;return this.focusedCell.rowIndex===z&&this.focusedCell.rowPinned===q0(J)}focusOverlay(z){let J=this.overlays?.isVisible()&&this.overlays.eWrapper?.getGui();return!!J&&k0(J,z)}getDefaultTabToNextGridContainerTarget(z){let{backwards:J,focusableContainers:Q}=z,Z=J?-1:1,$,X=()=>{if($===void 0)$=this.getGridBodyTabTarget(J);return $};for(let Y=z.nextIndex;Y>=0&&Y{z.executeLaterVMTurn(()=>this.updateScrollVisibleImpl())});else this.updateScrollVisibleImpl()}updateScrollVisibleImpl(){let z=this.ctrlsSvc.get("center");if(!z||this.colAnimation?.isActive())return;let J={horizontalScrollShowing:z.isHorizontalScrollShowing(),verticalScrollShowing:this.verticalScrollShowing};this.setScrollsVisible(J),this.updateScrollGap()}updateScrollGap(){let z=this.ctrlsSvc.get("center"),J=z.hasHorizontalScrollGap(),Q=z.hasVerticalScrollGap();if(this.horizontalScrollGap!==J||this.verticalScrollGap!==Q)this.horizontalScrollGap=J,this.verticalScrollGap=Q,this.eventSvc.dispatchEvent({type:"scrollGapChanged"})}setScrollsVisible(z){if(this.horizontalScrollShowing!==z.horizontalScrollShowing||this.verticalScrollShowing!==z.verticalScrollShowing)this.horizontalScrollShowing=z.horizontalScrollShowing,this.verticalScrollShowing=z.verticalScrollShowing,this.eventSvc.dispatchEvent({type:"scrollVisibilityChanged"})}getScrollbarWidth(){if(this.scrollbarWidth==null){let z=this.gos.get("scrollbarWidth"),Q=typeof z==="number"&&z>=0?z:IZ();if(Q!=null)this.scrollbarWidth=Q,this.eventSvc.dispatchEvent({type:"scrollbarWidthChanged"})}return this.scrollbarWidth}},t3=class extends V{constructor(){super(...arguments);this.beanName="gridDestroySvc",this.destroyCalled=!1}destroy(){if(this.destroyCalled)return;let{stateSvc:z,ctrlsSvc:J,context:Q}=this.beans;this.eventSvc.dispatchEvent({type:"gridPreDestroyed",state:z?.getState()??{}}),this.destroyCalled=!0,J.get("gridCtrl")?.destroyGridUi(),Q.destroy(),super.destroy()}},r3=["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 Sz=new Set(["gridPreDestroyed","fillStart","pasteStart"]),Q5=r3.reduce((z,J)=>{return z[J]=aG(J),z},{}),I2={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 c7(z){return`"${z}"`}var s3=()=>({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."}}),l3={allowFormula:"Formula",aggFunc:"SharedAggregation",autoHeight:"RowAutoHeight",cellClass:"CellStyle",cellClassRules:"CellStyle",cellEditor:({cellEditor:z,editable:J,groupRowEditable:Q})=>{if(!(!!J||!!Q))return null;if(typeof z==="string")return I2[z]??"CustomEditor";return"CustomEditor"},cellRenderer:({cellRenderer:z})=>{if(typeof z!=="string")return null;return I2[z]},cellStyle:"CellStyle",columnChooserParams:"ColumnMenu",contextMenuItems:"ContextMenu",dndSource:"DragAndDrop",dndSourceOnRowDrag:"DragAndDrop",editable:({editable:z,cellEditor:J})=>{if(z&&!J)return"TextEditor";return null},groupRowEditable:({groupRowEditable:z,cellEditor:J})=>{if(!z)return null;return J?"RowGroupingEdit":["RowGroupingEdit","TextEditor"]},groupRowValueSetter:({groupRowValueSetter:z})=>z?"RowGroupingEdit":null,enableCellChangeFlash:"HighlightChanges",enablePivot:"SharedPivot",enableRowGroup:"SharedRowGrouping",enableValue:"SharedAggregation",filter:({filter:z})=>{if(z&&typeof z!=="string"&&typeof z!=="boolean")return"CustomFilter";if(typeof z==="string")return I2[z]??"ColumnFilter";return"ColumnFilter"},floatingFilter:"ColumnFilter",getQuickFilterText:"QuickFilter",headerTooltip:"Tooltip",headerTooltipValueGetter:"Tooltip",mainMenuItems:"ColumnMenu",menuTabs:(z)=>{let J=["columnsMenuTab","generalMenuTab"];if(z.menuTabs?.some((Q)=>J.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"},a3=()=>{return{autoHeight:{supportedRowModels:["clientSide","serverSide"],validate:(J,{paginationAutoPageSize:Q})=>{if(Q)return"colDef.autoHeight is not supported with paginationAutoPageSize.";return null}},allowFormula:{supportedRowModels:["clientSide"]},cellRendererParams:{validate:(J)=>{if((J.rowGroup!=null||J.rowGroupIndex!=null||J.cellRenderer==="agGroupCellRenderer")&&"checkbox"in J.cellRendererParams)return'Since v33.0, `cellRendererParams.checkbox` has been deprecated. Use `rowSelection.checkboxLocation = "autoGroupColumn"` instead.';return null}},flex:{validate:(J,Q)=>{if(Q.autoSizeStrategy)return"colDef.flex is not supported with gridOptions.autoSizeStrategy";return null}},headerCheckboxSelection:{supportedRowModels:["clientSide","serverSide"],validate:(J,{rowSelection:Q})=>Q==="multiple"?null:"headerCheckboxSelection is only supported with rowSelection=multiple"},headerCheckboxSelectionCurrentPageOnly:{supportedRowModels:["clientSide"],validate:(J,{rowSelection:Q})=>Q==="multiple"?null:"headerCheckboxSelectionCurrentPageOnly is only supported with rowSelection=multiple"},headerCheckboxSelectionFilteredOnly:{supportedRowModels:["clientSide"],validate:(J,{rowSelection:Q})=>Q==="multiple"?null:"headerCheckboxSelectionFilteredOnly is only supported with rowSelection=multiple"},headerValueGetter:{validate:(J)=>{let Q=J.headerValueGetter;if(typeof Q==="function"||typeof Q==="string")return null;return"headerValueGetter must be a function or a valid string expression"}},icons:{validate:({icons:J})=>{if(J){if(J.smallDown)return Y4(262);if(J.smallLeft)return Y4(263);if(J.smallRight)return Y4(264)}return null}},sort:{validate:(J)=>{if(T2(J.sort)||K1(J.sort))return null;return`sort must be of type (SortDirection | SortDef), currently it is ${typeof J.sort==="object"?JSON.stringify(J.sort):Dz(J.sort)}`}},initialSort:{validate:(J)=>{if(T2(J.initialSort)||K1(J.initialSort))return null;return`initialSort must be of non-null type (SortDirection | SortDef), currently it is ${typeof J.initialSort==="object"?JSON.stringify(J.initialSort):Dz(J.initialSort)}`}},sortingOrder:{validate:(J)=>{let Q=J.sortingOrder;if(Array.isArray(Q)&&Q.length>0){let Z=Q.filter(($)=>{return!(T2($)||K1($))});if(Z.length>0)return`sortingOrder must be an array of type non-null (SortDirection | SortDef)[], incorrect items are: [${Z.map(($)=>typeof $==="string"||$==null?Dz($):JSON.stringify($)).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:(J)=>{let Q=J.type;if(Q instanceof Array){if(Q.some(($)=>typeof $!=="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:(J,{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:(J,{rowSelection:Q,cellSelection:Z,suppressRowTransform:$,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(Z)return"colDef.spanRows is not supported with cellSelection.";if($)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(J,{groupHierarchyConfig:Q={}},Z){let $=new Set(["year","quarter","month","formattedMonth","day","hour","minute","second"]),X=[];for(let Y of J.groupHierarchy??[]){if(typeof Y==="object"){Z.validation?.validateColDef(Y);continue}if(!$.has(Y)&&!(Y in Q))X.push(c7(Y))}if(X.length>0){let Y=`The following parts of colDef.groupHierarchy are not recognised: ${X.join(", ")}.`,q=`Choose one of ${[...$].map(c7).join(", ")}, or define your own parts in gridOptions.groupHierarchyConfig.`;return`${Y} +${q}`}return null}}}},o3={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},e3=()=>Object.keys(o3),zE=()=>({objectName:"colDef",allProperties:e3(),docsUrl:"column-properties/",deprecations:s3(),validations:a3()}),JE=["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"],QE=["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"],ZE=["sortingOrder","alignedGrids","rowData","columnDefs","excelStyles","pinnedTopRowData","pinnedBottomRowData","chartThemes","rowClass","paginationPageSizeSelector","suppressOverlays"],b$=["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"],$E=["theme","rowSelection"],XE=["cellSelection","sideBar","rowNumbers","suppressGroupChangesColumnVisibility","groupAggFiltering","suppressStickyTotalRow","groupHideParentOfSingleChild","enableRowPinning"],y$=["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"],YE=["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"],qE=()=>[...ZE,...QE,...JE,...b$,...YE,...y$,...XE,...$E];var GE=()=>({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 I4(z,J,Q){if(typeof J==="number"||J==null){if(J==null)return null;return J>=Q?null:`${z}: value should be greater than or equal to ${Q}`}return`${z}: value should be a number`}var HE={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 z={autoSizePadding:{validate({autoSizePadding:Q}){return I4("autoSizePadding",Q,0)}},cacheBlockSize:{supportedRowModels:["serverSide","infinite"],validate({cacheBlockSize:Q}){return I4("cacheBlockSize",Q,1)}},cacheOverflowSize:{validate({cacheOverflowSize:Q}){return I4("cacheOverflowSize",Q,1)}},datasource:{supportedRowModels:["infinite"]},domLayout:{validate:(Q)=>{let Z=Q.domLayout,$=["autoHeight","normal","print"];if(Z&&!$.includes(Z))return`domLayout must be one of [${$.join()}], currently it's ${Z}`;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:Z,pinnedBottomRowData:$}){if(Q&&(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:Z,pinnedTopRowData:$,pinnedBottomRowData:X}){if(Z&&($||X))return"Manual row pinning cannot be used together with pinned row data. Either remove `isRowPinnable`, or remove `pinnedTopRowData` and `pinnedBottomRowData`.";if(!Q&&Z)return"`isRowPinnable` requires `enableRowPinning` to be set.";return null}},isRowPinned:{supportedRowModels:["clientSide"],validate({enableRowPinning:Q,isRowPinned:Z,pinnedTopRowData:$,pinnedBottomRowData:X}){if(Z&&($||X))return"Manual row pinning cannot be used together with pinned row data. Either remove `isRowPinned`, or remove `pinnedTopRowData` and `pinnedBottomRowData`.";if(!Q&&Z)return"`isRowPinned` requires `enableRowPinning` to be set.";return null}},groupDefaultExpanded:{supportedRowModels:["clientSide"]},groupHideColumnsUntilExpanded:{supportedRowModels:["clientSide"],validate({groupHideColumnsUntilExpanded:Q,groupHideOpenParents:Z,groupDisplayType:$}){if(Q&&!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={}},Z,$){for(let X of Object.keys(Q))$.validation?.validateColDef(Q[X]);return null}},icons:{validate:({icons:Q})=>{if(Q){if(Q.smallDown)return Y4(262);if(Q.smallLeft)return Y4(263);if(Q.smallRight)return Y4(264)}return null}},infiniteInitialRowCount:{validate({infiniteInitialRowCount:Q}){return I4("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 I4("keepDetailRowsCount",Q,1)}},paginationPageSize:{validate({paginationPageSize:Q}){return I4("paginationPageSize",Q,1)}},paginationPageSizeSelector:{validate:(Q)=>{let Z=Q.paginationPageSizeSelector;if(typeof Z==="boolean"||Z==null)return null;if(!Z.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 I4("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 Z=Q.rowStyle;if(Z&&typeof Z==="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 I4("serverSideInitialRowCount",Q,1)}},serverSideOnlyRefreshFilteredGroups:{supportedRowModels:["serverSide"]},serverSideSortAllLevels:{supportedRowModels:["serverSide"]},sortingOrder:{validate:(Q)=>{let Z=Q.sortingOrder;if(Array.isArray(Z)&&Z.length>0){let $=Z.filter((X)=>!Z4(X));if($.length>0)return`sortingOrder must be an array of type (SortDirection | SortDef)[], incorrect items are: ${$.map((X)=>typeof X==="string"||X==null?Dz(X):JSON.stringify(X))}]`}else if(!Array.isArray(Z)||!Z.length)return`sortingOrder must be an array with at least one element, currently it's ${Z}`;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 Z=Q.rowModelType??"clientSide";switch(Z){case"clientSide":{let{treeDataChildrenField:$,treeDataParentIdField:X,getDataPath:Y,getRowId:q}=Q;if(!$&&!X&&!Y)return"treeData requires either 'treeDataChildrenField' or 'treeDataParentIdField' or 'getDataPath' in the clientSide row model.";if($){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 $=`treeData requires 'isServerSideGroup' and 'getServerSideGroupKey' in the ${Z} row model.`;return Q.isServerSideGroup&&Q.getServerSideGroupKey?null:$}}return null}},viewportDatasource:{supportedRowModels:["viewport"]},viewportRowModelBufferSize:{validate({viewportRowModelBufferSize:Q}){return I4("viewportRowModelBufferSize",Q,0)}},viewportRowModelPageSize:{validate({viewportRowModelPageSize:Q}){return I4("viewportRowModelPageSize",Q,1)}},rowDragEntireRow:{dependencies:{cellSelection:{required:[void 0]}}},autoGroupColumnDef:{validate({autoGroupColumnDef:Q,showOpenedGroup:Z}){if(Q?.field&&Z)return"autoGroupColumnDef.field and showOpenedGroup are not supported when used together.";if(Q?.valueGetter&&Z)return"autoGroupColumnDef.valueGetter and showOpenedGroup are not supported when used together.";return null}},renderingMode:{validate:(Q)=>{let Z=Q.renderingMode,$=["default","legacy"];if(Z&&!$.includes(Z))return`renderingMode must be one of [${$.join()}], currently it's ${Z}`;return null}},autoSizeStrategy:{validate:({autoSizeStrategy:Q})=>{if(!Q)return null;let Z=["fitCellContents","fitGridWidth","fitProvidedWidth"],$=Q.type;if($!=="fitCellContents"&&$!=="fitGridWidth"&&$!=="fitProvidedWidth")return`Invalid Auto-size strategy. \`autoSizeStrategy\` must be one of ${Z.map((X)=>'"'+X+'"').join(", ")}, currently it's ${$}`;if($==="fitProvidedWidth"&&typeof Q.width!="number")return`When using the 'fitProvidedWidth' auto-size strategy, must provide a numeric \`width\`. You provided ${Q.width}`;return null}}},J={};for(let Q of y$)J[Q]={expectedType:"boolean"};for(let Q of b$)J[Q]={expectedType:"number"};return K0(J,z),J},UE=()=>({objectName:"gridOptions",allProperties:[...qE(),...Object.values(Q5)],propertyExceptions:["api"],docsUrl:"grid-options/",deprecations:GE(),validations:_E()}),WE=0,BE=0,p7="__ag_grid_instance",EE=class extends V{constructor(){super(...arguments);this.beanName="gos",this.domDataKey="__AG_"+Math.random().toString(),this.instanceId=BE++,this.gridReadyFired=!1,this.queueEvents=[],this.propEventSvc=new R4,this.globalEventHandlerFactory=(z)=>{return(J,Q)=>{if(!this.isAlive())return;let Z=Sz.has(J);if(Z&&!z||!Z&&z)return;if(!KE(J))return;let $=(X,Y)=>{let q=Q5[X],G=this.gridOptions[q];if(typeof G==="function")this.beans.frameworkOverrides.wrapOutgoing(()=>G(Y))};if(this.gridReadyFired)$(J,Q);else if(J==="gridReady"){$(J,Q),this.gridReadyFired=!0;for(let X of this.queueEvents)$(X.eventName,X.event);this.queueEvents=[]}else this.queueEvents.push({eventName:J,event:Q})}}}wireBeans(z){this.gridOptions=z.gridOptions,this.validation=z.validation,this.api=z.gridApi,this.gridId=z.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:z})=>{this.updateGridOptions({options:z,force:!0,source:"optionsUpdated"})}})}destroy(){super.destroy(),this.queueEvents=[]}get(z){return this.gridOptions[z]??RG[z]}getCallback(z){return this.mergeGridCommonParams(this.gridOptions[z])}exists(z){return T(this.gridOptions[z])}mergeGridCommonParams(z){if(z)return(Q)=>{return z(this.addCommon(Q))};return z}updateGridOptions({options:z,force:J,source:Q="api"}){let Z={id:WE++,properties:[]},$=[],{gridOptions:X,validation:Y}=this;for(let q of Object.keys(z)){let G=LZ.applyGlobalGridOption(q,z[q]);Y?.warnOnInitialPropertyUpdate(Q,q);let H=J||typeof G==="object"&&Q==="api",_=X[q];if(H||_!==G){X[q]=G;let U={type:q,currentValue:G,previousValue:_,changeSet:Z,source:Q};$.push(U)}}this.validateGridOptions(this.gridOptions),Z.properties=$.map((q)=>q.type);for(let q of $)D6(this,`Updated property ${q.type} from`,q.previousValue," to ",q.currentValue),this.propEventSvc.dispatchEvent(q)}addPropertyEventListener(z,J){this.propEventSvc.addEventListener(z,J)}removePropertyEventListener(z,J){this.propEventSvc.removeEventListener(z,J)}getDomDataKey(){return this.domDataKey}addCommon(z){return z.api=this.api,z.context=this.gridOptionsContext,z}validateOptions(z,J){for(let Q of Object.keys(z)){let Z=z[Q];if(Z==null||Z===!1)continue;let $=J[Q];if(typeof $==="function")$=$(z,this.gridOptions,this.beans);if($)this.assertModuleRegistered($,Q)}}validateGridOptions(z){this.validateOptions(z,HE),this.validation?.processGridOptions(z)}validateColDef(z,J,Q){if(Q||!this.beans.dataTypeSvc?.isColPendingInference(J))this.validateOptions(z,l3),this.validation?.validateColDef(z)}assertModuleRegistered(z,J){let Q=Array.isArray(z)?z.some((Z)=>this.isModuleRegistered(Z)):this.isModuleRegistered(z);if(!Q)t(200,{...this.getModuleErrorParams(),moduleName:z,reasonOrId:J});return Q}getModuleErrorParams(){return{gridId:this.gridId,gridScoped:DZ(),rowModelType:this.get("rowModelType"),isUmd:MZ()}}isModuleRegistered(z){return vQ(z,this.gridId,this.get("rowModelType"))}setInstanceDomData(z){z[p7]=this.instanceId}isElementInThisInstance(z){let J=z;while(J){let Q=J[p7];if(T(Q))return Q===this.instanceId;J=J.parentElement}return!1}};function KE(z){return!!Q5[z]}var FE=class extends V{constructor(z,J){super();this.column=z,this.eGui=J,this.lastMovingChanged=0}postConstruct(){this.addManagedElementListeners(this.eGui,{click:(z)=>z&&this.onClick(z)}),this.addManagedListeners(this.column,{movingChanged:()=>{this.lastMovingChanged=Date.now()}})}onClick(z){let{sortSvc:J,rangeSvc:Q,gos:Z}=this.beans;if(!(E1(Z)?z.altKey:!0))Q?.handleColumnSelection(this.column,z);else if(this.column.isSortable()){let X=this.column.isMoving(),q=Date.now()-this.lastMovingChanged<50;if(!(X||q))J?.progressSortFromEvent(this.column,z)}}};function LE(z,J){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:[z?{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},J?{tag:"ag-sort-indicator",ref:"eSortIndicator"}:null]}]}}var DE=class extends y{constructor(){super(...arguments);this.eFilter=j,this.eFilterButton=j,this.eSortIndicator=j,this.eMenu=j,this.eLabel=j,this.eText=j,this.eColRef=j,this.eSortOrder=j,this.eSortAsc=j,this.eSortDesc=j,this.eSortMixed=j,this.eSortNone=j,this.eSortAbsoluteAsc=j,this.eSortAbsoluteDesc=j,this.isLoadingInnerComponent=!1}refresh(z){let J=this.params;if(this.params=z,this.workOutTemplate(z,!!this.beans?.sortSvc)!=this.currentTemplate||this.workOutShowMenu()!=this.currentShowMenu||z.enableSorting!=this.currentSort||z.column.formulaRef!=this.currentRef||this.currentSuppressMenuHide!=null&&this.shouldSuppressMenuHide()!=this.currentSuppressMenuHide||J.enableFilterButton!=z.enableFilterButton||J.enableFilterIcon!=z.enableFilterIcon)return!1;if(this.innerHeaderComponent){let Q={...z};K0(Q,z.innerHeaderComponentParams),this.innerHeaderComponent.refresh?.(Q)}else this.setDisplayName(z);return!0}workOutTemplate(z,J){let{formula:Q}=this.beans,Z=z.template;if(Z)return Z?.trim?Z.trim():Z;return LE(!!Q?.active,J)}init(z){this.params=z;let{sortSvc:J,touchSvc:Q,rowNumbersSvc:Z,userCompFactory:$}=this.beans,X=J?.getSortIndicatorSelector();if(this.currentTemplate=this.workOutTemplate(z,!!X),this.setTemplate(this.currentTemplate,X?[X]:void 0),this.eLabel)this.mouseListener??(this.mouseListener=this.createManagedBean(new FE(z.column,this.eLabel)));Q?.setupForHeader(this),this.setMenu(),this.setupSort(),this.setupColumnRefIndicator(),Z?.setupForHeader(this),this.setupFilterIcon(),this.setupFilterButton(),this.workOutInnerHeaderComponent($,z),this.setDisplayName(z)}workOutInnerHeaderComponent(z,J){let Q=NH(z,J,J);if(!Q)return;this.isLoadingInnerComponent=!0,Q.newAgStackInstance().then((Z)=>{if(this.isLoadingInnerComponent=!1,!Z)return;if(this.isAlive()){if(this.innerHeaderComponent=Z,this.eText)this.eText.appendChild(Z.getGui())}else this.destroyBean(Z)})}setDisplayName(z){let{displayName:J}=z,Q=this.currentDisplayName;if(this.currentDisplayName=J,!this.eText||Q===J||this.innerHeaderComponent||this.isLoadingInnerComponent)return;this.eText.textContent=P6(J)}addInIcon(z,J,Q){let Z=h(z,this.beans,Q);if(Z)J.appendChild(Z)}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){S0(this.eMenu),this.eMenu=void 0;return}let{gos:z,eMenu:J,params:Q}=this,Z=B0(z);this.addInIcon(Z?"menu":"menuAlt",J,Q.column),J.classList.toggle("ag-header-menu-icon",!Z);let $=this.shouldSuppressMenuHide();this.currentSuppressMenuHide=$,this.addManagedElementListeners(J,{click:()=>this.showColumnMenu(this.eMenu)}),this.toggleMenuAlwaysShow($)}toggleMenuAlwaysShow(z){this.eMenu?.classList.toggle("ag-header-menu-always-show",z)}showColumnMenu(z){let{currentSuppressMenuHide:J,params:Q}=this;if(!J)this.toggleMenuAlwaysShow(!0);Q.showColumnMenu(z,()=>{if(!J)this.toggleMenuAlwaysShow(!1)})}onMenuKeyboardShortcut(z){let{params:J,gos:Q,beans:Z,eMenu:$,eFilterButton:X}=this,Y=J.column,q=B0(Q);if(z&&!q){if(Z.menuSvc?.isFilterMenuInHeaderEnabled(Y))return J.showFilter(X??$??this.getGui()),!0}else if(J.enableMenu)return this.showColumnMenu($??X??this.getGui()),!0;return!1}setupSort(){let{sortSvc:z}=this.beans;if(!z)return;let{enableSorting:J,column:Q}=this.params;if(this.currentSort=J,!this.eSortIndicator){this.eSortIndicator=this.createBean(z.createSortIndicator(!0));let{eSortIndicator:Z,eSortOrder:$,eSortAsc:X,eSortDesc:Y,eSortMixed:q,eSortNone:G,eSortAbsoluteAsc:H,eSortAbsoluteDesc:_}=this;Z.attachCustomElements($,X,Y,q,G,H,_)}if(this.eSortIndicator.setupSort(Q),!this.currentSort)return;z.setupHeader(this,Q)}setupColumnRefIndicator(){let{eColRef:z,beans:{editModelSvc:J},params:Q}=this;if(!z)return;this.currentRef=Q.column.formulaRef,z.textContent=this.currentRef,w(z,!1),this.addManagedEventListeners({cellEditingStarted:()=>{let Z=J?.getEditPositions(),$=!!this.currentRef&&!!Z?.some((X)=>X.column.isAllowFormula());w(z,$)},cellEditingStopped:()=>{w(z,!1)}})}setupFilterIcon(){let{eFilter:z,params:J}=this;if(!z)return;let Q=()=>{let Z=J.column.isFilterActive();w(z,Z,{skipAriaHidden:!0})};this.configureFilter(J.enableFilterIcon,z,Q,"filterActive")}setupFilterButton(){let{eFilterButton:z,params:J}=this;if(!z)return;if(this.configureFilter(J.enableFilterButton,z,this.onFilterChangedButton.bind(this),"filter"))this.addManagedElementListeners(z,{click:()=>J.showFilter(z)});else this.eFilterButton=void 0}configureFilter(z,J,Q,Z){if(!z)return S0(J),!1;let $=this.params.column;return this.addInIcon(Z,J,$),this.addManagedListeners($,{filterChanged:Q}),Q(),!0}onFilterChangedButton(){let z=this.params.column.isFilterActive();this.eFilterButton.classList.toggle("ag-filter-active",z)}getAnchorElementForMenu(z){let{eFilterButton:J,eMenu:Q}=this;if(z)return J??Q??this.getGui();return Q??J??this.getGui()}destroy(){super.destroy(),this.innerHeaderComponent=this.destroyBean(this.innerHeaderComponent),this.mouseListener=this.destroyBean(this.mouseListener)}},ME=class extends V{constructor(z,J){super();this.eLabel=z,this.columnGroup=J,this.isSticky=!1,this.left=null,this.right=null}postConstruct(){let{columnGroup:z,beans:J}=this,{ctrlsSvc:Q}=J;Q.whenReady(this,()=>{let Z=this.refreshPosition.bind(this);if(z.getPinned()==null)this.addManagedEventListeners({bodyScroll:($)=>{if($.direction==="horizontal")this.updateSticky($.left)}});this.addManagedListeners(z,{leftChanged:Z,displayedChildrenChanged:Z}),this.addManagedEventListeners({columnResized:Z}),this.refreshPosition()})}refreshPosition(){let{columnGroup:z,beans:J}=this,Q=z.getLeft(),Z=z.getActualWidth();if(Q==null||Z===0){this.left=null,this.right=null,this.setSticky(!1);return}this.left=Q,this.right=Q+Z;let $=J.colViewport.getScrollPosition();if($!=null)this.updateSticky($)}updateSticky(z){let{beans:J,left:Q,right:Z}=this;if(Q==null||Z==null){this.setSticky(!1);return}let{gos:$,visibleCols:X}=J,q=$.get("enableRtl")?X.bodyWidth-z:z;this.setSticky(Qq)}setSticky(z){let{isSticky:J,eLabel:Q}=this;if(J===z)return;this.isSticky=z,Q.classList.toggle("ag-sticky-label",z)}},kE={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"}]},fE=class extends y{constructor(){super(kE);this.agOpened=j,this.agClosed=j,this.agLabel=j,this.isLoadingInnerComponent=!1}init(z){let{userCompFactory:J,touchSvc:Q}=this.beans;this.params=z,this.checkWarnings(),this.workOutInnerHeaderGroupComponent(J,z),this.setupLabel(z),this.addGroupExpandIcon(z),this.setupExpandIcons(),Q?.setupForHeaderGroup(this)}checkWarnings(){if(this.params.template)R(89)}workOutInnerHeaderGroupComponent(z,J){let Q=hH(z,J,J);if(!Q)return;this.isLoadingInnerComponent=!0,Q.newAgStackInstance().then((Z)=>{if(this.isLoadingInnerComponent=!1,!Z)return;if(this.isAlive())this.innerHeaderGroupComponent=Z,this.agLabel.appendChild(Z.getGui());else this.destroyBean(Z)})}setupExpandIcons(){let{agOpened:z,agClosed:J,params:{columnGroup:Q},beans:{colGroupSvc:Z}}=this;this.addInIcon("columnGroupOpened",z),this.addInIcon("columnGroupClosed",J);let $=(G)=>{if(q4(G))return;let H=!Q.isExpanded();Z.setColumnGroupOpened(Q.getProvidedColumnGroup(),H,"uiColumnExpanded")};this.addTouchAndClickListeners(J,$),this.addTouchAndClickListeners(z,$);let X=(G)=>{s0(G)};this.addManagedElementListeners(J,{dblclick:X}),this.addManagedElementListeners(z,{dblclick:X}),this.addManagedElementListeners(this.getGui(),{dblclick:$}),this.updateIconVisibility();let Y=Q.getProvidedColumnGroup(),q=this.updateIconVisibility.bind(this);this.addManagedListeners(Y,{expandedChanged:q,expandableChanged:q})}addTouchAndClickListeners(z,J){this.beans.touchSvc?.setupForHeaderGroupElement(this,z,J),this.addManagedElementListeners(z,{click:J})}updateIconVisibility(){let{agOpened:z,agClosed:J,params:{columnGroup:Q}}=this;if(Q.isExpandable()){let Z=Q.isExpanded();w(z,Z),w(J,!Z)}else w(z,!1),w(J,!1)}addInIcon(z,J){let Q=h(z,this.beans,null);if(Q)J.appendChild(Q)}addGroupExpandIcon(z){if(!z.columnGroup.isExpandable()){let{agOpened:J,agClosed:Q}=this;w(J,!1),w(Q,!1)}}setupLabel(z){let{displayName:J,columnGroup:Q}=z,{innerHeaderGroupComponent:Z,isLoadingInnerComponent:$}=this,X=Z||$;if(T(J)&&!X)this.agLabel.textContent=P6(J);if(!Q.getColGroupDef()?.suppressStickyLabel)this.createManagedBean(new ME(this.getGui(),Q))}destroy(){if(super.destroy(),this.innerHeaderGroupComponent)this.destroyBean(this.innerHeaderGroupComponent),this.innerHeaderGroupComponent=void 0}},VE={moduleName:"ColumnHeaderComp",version:c,userComponents:{agColumnHeader:DE},icons:{menu:"menu",menuAlt:"menu-alt"}},SE={moduleName:"ColumnGroupHeaderComp",version:c,userComponents:{agColumnGroupHeader:fE},icons:{columnGroupOpened:"expanded",columnGroupClosed:"contracted"}},AE=class extends V{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(z){if(this.scrollGoingDown=z>=this.lastScrollTop,z===0)this.scrollGoingDown=!0;this.lastScrollTop=z}postConstruct(){this.active=!this.gos.get("suppressAnimationFrame"),this.batchFrameworkComps=this.beans.frameworkOverrides.batchFrameworkComps}verify(){if(this.active===!1)R(92)}createTask(z,J,Q,Z,$=!1){this.verify();let X=Q;if(Z&&this.batchFrameworkComps)X="f1";let Y={task:z,index:J,createOrder:++this.taskCount,deferred:$};this.addTaskToList(this[X],Y),this.schedule()}addTaskToList(z,J){z.list.push(J),z.sorted=!1}sortTaskList(z){if(z.sorted)return;let J=this.scrollGoingDown?1:-1;z.list.sort((Q,Z)=>{if(Q.deferred!==Z.deferred)return Q.deferred?-1:1;if(Q.index!==Z.index)return J*(Z.index-Q.index);return Z.createOrder-Q.createOrder}),z.sorted=!0}addDestroyTask(z){this.verify(),this.destroyTasks.push(z),this.schedule()}executeFrame(z){let{p1:J,p2:Q,f1:Z,destroyTasks:$,beans:X}=this,{ctrlsSvc:Y,frameworkOverrides:q}=X,G=J.list,H=Q.list,_=Z.list,U=Date.now(),W=0,B=z<=0,E=Y.getScrollFeature();while(B||W{while(B||W{};else if($.length)F=$.pop();else break;F()}W=Date.now()-U}if(G.length||H.length||_.length||$.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 z=this.executeFrame.bind(this,60);W4(this.beans,z)}isQueueEmpty(){return!this.ticking}},RE={moduleName:"AnimationFrame",version:c,beans:[AE]},jE=class extends V{constructor(){super(...arguments);this.beanName="iconSvc"}createIconNoSpan(z,J){return h(z,this.beans,J?.column)}},OE=(z,J,Q)=>J||z&&Q,PE=class extends V{constructor(){super(...arguments);this.beanName="touchSvc"}mockBodyContextMenu(z,J){this.mockContextMenu(z,z.eBodyViewport,J)}mockHeaderContextMenu(z,J){this.mockContextMenu(z,z.eGui,J)}mockRowContextMenu(z){if(!n1())return;let J=(Q,Z,$)=>{let{rowCtrl:X,cellCtrl:Y}=z.getControlsForEventTarget($?.target??null);if(Y?.column)Y.dispatchCellContextMenuEvent($??null);this.beans.contextMenuSvc?.handleContextMenuMouseEvent(void 0,$,X,Y)};this.mockContextMenu(z,z.element,J)}handleCellDoubleClick(z,J){if((()=>{if(!n1()||OQ("dblclick"))return!1;let Z=Date.now(),$=Z-z.lastIPadMouseClickEvent<200;return z.lastIPadMouseClickEvent=Z,$})())return z.onCellDoubleClicked(J),J.preventDefault(),!0;return!1}setupForHeader(z){let{gos:J,sortSvc:Q,menuSvc:Z}=this.beans;if(J.get("suppressTouch"))return;let{params:$,eMenu:X,eFilterButton:Y}=z,q=new c0(z.getGui(),!0);z.addDestroyFunc(()=>q.destroy());let G=z.shouldSuppressMenuHide(),H=G&&T(X)&&$.enableMenu,_=!!Z?.isHeaderContextMenuEnabled($.column),U=OE($.enableMenu,_,B0(J)),W=q;if(H)W=new c0(X,!0),z.addDestroyFunc(()=>W.destroy());let B=(E)=>$.showColumnMenuAfterMouseClick(E.touchStart);if(H&&$.enableMenu)z.addManagedListeners(W,{tap:B});if(U)z.addManagedListeners(q,{longTap:B});if($.enableSorting){let E=(K)=>{let F=K.touchStart.target;if(G&&(X?.contains(F)||Y?.contains(F)))return;Q?.progressSort($.column,!1,"uiColumnSorted")};z.addManagedListeners(q,{tap:E})}if($.enableFilterButton&&Y){let E=new c0(Y,!0);z.addManagedListeners(E,{tap:()=>$.showFilter(Y)}),z.addDestroyFunc(()=>E.destroy())}}setupForHeaderGroup(z){let J=z.params;if(this.beans.menuSvc?.isHeaderContextMenuEnabled(J.columnGroup.getProvidedColumnGroup())){let Q=new c0(J.eGridHeader,!0),Z=($)=>J.showColumnMenuAfterMouseClick($.touchStart);z.addManagedListeners(Q,{longTap:Z}),z.addDestroyFunc(()=>Q.destroy())}}setupForHeaderGroupElement(z,J,Q){let Z=new c0(J,!0);z.addManagedListeners(Z,{tap:Q}),z.addDestroyFunc(()=>Z.destroy())}mockContextMenu(z,J,Q){if(!n1())return;let Z=new c0(J),$=(X)=>{if(!L6(this.beans,X.touchEvent))return;Q(void 0,X.touchStart,X.touchEvent)};z.addManagedListeners(Z,{longTap:$}),z.addDestroyFunc(()=>Z.destroy())}},TE={moduleName:"Touch",version:c,beans:[PE]},vE=class extends V{constructor(){super(...arguments);this.beanName="cellNavigation"}wireBeans(z){this.rowSpanSvc=z.rowSpanSvc}getNextCellToFocus(z,J,Q=!1){if(Q)return this.getNextCellToFocusWithCtrlPressed(z,J);return this.getNextCellToFocusWithoutCtrlPressed(z,J)}getNextCellToFocusWithCtrlPressed(z,J){let Q=z===k.UP,Z=z===k.DOWN,$=z===k.LEFT,X,Y,{pageBounds:q,gos:G,visibleCols:H,pinnedRowModel:_}=this.beans,{rowPinned:U}=J;if(Q||Z){if(U&&_)if(Q)Y=0;else Y=U==="top"?_.getPinnedTopRowCount()-1:_.getPinnedBottomRowCount()-1;else Y=Q?q.getFirstRow():q.getLastRow();X=J.column}else{let W=G.get("enableRtl");Y=J.rowIndex,X=($!==W?H.allCols:[...H.allCols].reverse()).find((E)=>!b0(E)&&this.isCellGoodToFocusOn({rowIndex:Y,rowPinned:null,column:E}))}return X?{rowIndex:Y,rowPinned:U,column:X}:null}getNextCellToFocusWithoutCtrlPressed(z,J){let Q=J,Z=!1;while(!Z){switch(z){case k.UP:Q=this.getCellAbove(Q);break;case k.DOWN:Q=this.getCellBelow(Q);break;case k.RIGHT:Q=this.gos.get("enableRtl")?this.getCellToLeft(Q):this.getCellToRight(Q);break;case k.LEFT:Q=this.gos.get("enableRtl")?this.getCellToRight(Q):this.getCellToLeft(Q);break;default:Q=null,R(8,{key:z});break}if(Q)Z=this.isCellGoodToFocusOn(Q);else Z=!0}return Q}isCellGoodToFocusOn(z){let J=z.column,Q,{pinnedRowModel:Z,rowModel:$}=this.beans;switch(z.rowPinned){case"top":Q=Z?.getPinnedTopRow(z.rowIndex);break;case"bottom":Q=Z?.getPinnedBottomRow(z.rowIndex);break;default:Q=$.getRow(z.rowIndex);break}if(!Q)return!1;return!this.isSuppressNavigable(J,Q)}getCellToLeft(z){if(!z)return null;let J=this.beans.visibleCols.getColBefore(z.column);if(!J)return null;return{rowIndex:z.rowIndex,column:J,rowPinned:z.rowPinned}}getCellToRight(z){if(!z)return null;let J=this.beans.visibleCols.getColAfter(z.column);if(!J)return null;return{rowIndex:z.rowIndex,column:J,rowPinned:z.rowPinned}}getCellBelow(z){if(!z)return null;let J=this.rowSpanSvc?.getCellEnd(z)??z,Q=L0(this.beans,J,!0);if(Q)return{rowIndex:Q.rowIndex,column:z.column,rowPinned:Q.rowPinned};return null}getCellAbove(z){if(!z)return null;let J=this.rowSpanSvc?.getCellStart(z)??z,Q=n0(this.beans,{rowIndex:J.rowIndex,rowPinned:J.rowPinned},!0);if(Q)return{rowIndex:Q.rowIndex,column:z.column,rowPinned:Q.rowPinned};return null}getNextTabbedCell(z,J){if(J)return this.getNextTabbedCellBackwards(z);return this.getNextTabbedCellForwards(z)}getNextTabbedCellForwards(z){let{visibleCols:J,pagination:Q}=this.beans,Z=J.allCols,$=z.rowIndex,X=z.rowPinned,Y=J.getColAfter(z.column);if(!Y){Y=Z[0];let q=L0(this.beans,z,!0);if(n(q))return null;if(!q.rowPinned&&!(Q?.isRowInPage(q.rowIndex)??!0))return null;$=q?q.rowIndex:null,X=q?q.rowPinned:null}return{rowIndex:$,column:Y,rowPinned:X}}getNextTabbedCellBackwards(z){let{beans:J}=this,{visibleCols:Q,pagination:Z}=J,$=Q.allCols,X=z.rowIndex,Y=z.rowPinned,q=Q.getColBefore(z.column);if(!q){q=b($);let G=n0(J,{rowIndex:z.rowIndex,rowPinned:z.rowPinned},!0);if(n(G))return null;if(!G.rowPinned&&!(Z?.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,J){let{suppressNavigable:Q}=z.colDef;if(typeof Q==="boolean")return Q;if(typeof Q==="function"){let Z=z.createColumnFunctionCallbackParams(J);return Q(Z)}return!1}};function IE(z){return z.focusSvc.getFocusedCell()}function CE(z){return z.focusSvc.clearFocusedCell()}function bE(z,J,Q,Z){z.focusSvc.setFocusedCell({rowIndex:J,column:Q,rowPinned:Z,forceBrowserFocus:!0})}function yE(z,J){return z.navigation?.tabToNextCell(!1,J)??!1}function xE(z,J){return z.navigation?.tabToNextCell(!0,J)??!1}function wE(z,J,Q=!1){let Z=z.headerNavigation?.getHeaderPositionForColumn(J,Q);if(!Z)return;z.focusSvc.focusHeaderPosition({headerPosition:Z})}function l4(z){let J=z;return J?.getFrameworkComponentInstance!=null?J.getFrameworkComponentInstance():z}var NE=class extends V{constructor(){super(...arguments);this.beanName="editModelSvc",this.edits=new Map,this.cellValidations=new x$,this.rowValidations=new w$,this.suspendEdits=!1}suspend(z){this.suspendEdits=z}removeEdits({rowNode:z,column:J}){if(!this.hasEdits({rowNode:z})||!z)return;let Q=this.getEditRow(z);if(J)Q.delete(J);else Q.clear();if(Q.size===0)this.edits.delete(z)}getEditRow(z,J={}){if(this.suspendEdits)return;if(this.edits.size===0)return;let Q=z&&this.edits.get(z);if(Q)return Q;if(J.checkSiblings){let Z=z.pinnedSibling;if(Z)return this.getEditRow(Z)}return}getEditRowDataValue(z,{checkSiblings:J}={}){if(!z||this.edits.size===0)return;let Q=this.getEditRow(z),Z=z.pinnedSibling,$=J&&Z&&this.getEditRow(Z);if(!Q&&!$)return;let X={...z.data},Y=(q,G)=>q.forEach(({editorValue:H,pendingValue:_},U)=>{let W=H===void 0?_:H;if(W!==I0)G[U.getColId()]=W});if(Q)Y(Q,X);if($)Y($,X);return X}getEdit(z={},J){let{rowNode:Q,column:Z}=z,$=this.edits;if(this.suspendEdits||$.size===0||!Q||!Z)return;let X=$.get(Q)?.get(Z);if(X)return X;if(J?.checkSiblings){let Y=Q.pinnedSibling;if(Y)return $.get(Y)?.get(Z)}return}getEditMap(z=!0){if(this.suspendEdits||this.edits.size===0)return new Map;if(!z)return this.edits;let J=new Map;return this.edits.forEach((Q,Z)=>{let $=new Map;Q.forEach(({editorState:X,...Y},q)=>$.set(q,{...Y})),J.set(Z,$)}),J}setEditMap(z){this.edits.clear(),z.forEach((J,Q)=>{let Z=new Map;J.forEach(($,X)=>Z.set(X,{...$})),this.edits.set(Q,Z)})}setEdit(z,J){let Q=this.edits;if(Q.size===0||!Q.has(z.rowNode))Q.set(z.rowNode,new Map);let Z=this.getEdit(z),$={editorState:{isCancelAfterEnd:void 0,isCancelBeforeStart:void 0},...Z,...J};return this.getEditRow(z.rowNode).set(z.column,$),$}clearEditValue(z){let{rowNode:J,column:Q}=z;if(!J)return;let Z=(X)=>{X.editorValue=void 0,X.pendingValue=X.sourceValue,X.state="changed"};if(!Q){this.getEditRow(J)?.forEach(Z);return}let $=this.getEdit(z);if($)Z($)}getState(z){if(this.suspendEdits)return;return this.getEdit(z)?.state}getEditPositions(z){if(this.suspendEdits||(z??this.edits).size===0)return[];let J=[];return(z??this.edits).forEach((Q,Z)=>{for(let $ of Q.keys()){let{editorState:X,...Y}=Q.get($);J.push({rowNode:Z,column:$,...Y})}}),J}hasRowEdits(z,J){if(this.suspendEdits)return!1;if(this.edits.size===0)return!1;return!!this.getEditRow(z,J)}hasEdits(z={},J={}){if(this.suspendEdits)return!1;if(this.edits.size===0)return!1;let{rowNode:Q,column:Z}=z,{withOpenEditor:$}=J;if(Q){let X=this.getEditRow(Q,J);if(!X)return!1;if(Z){if($)return this.getEdit(z)?.state==="editing";return X.has(Z)}if(X.size!==0){if($)return Array.from(X.values()).some(({state:Y})=>Y==="editing");return!0}return!1}if($)return this.getEditPositions().some(({state:X})=>X==="editing");return this.edits.size>0}start(z){let J=this.getEditRow(z.rowNode)??new Map,{rowNode:Q,column:Z}=z;if(Z&&!J.has(Z))J.set(Z,{editorValue:void 0,pendingValue:I0,sourceValue:this.beans.valueSvc.getValue(Z,Q,"data"),state:"editing",editorState:{isCancelAfterEnd:void 0,isCancelBeforeStart:void 0}});this.edits.set(Q,J)}stop(z,J,Q){if(!this.hasEdits(z))return;if(J){let Z=this.getEditRow(z.rowNode)?.get(z.column);if(Z&&(Z.pendingValue===I0||Z.pendingValue===Z.sourceValue))this.removeEdits(z);else if(Z&&Q)Z.editorValue=void 0}else this.removeEdits(z)}clear(){for(let z of this.edits.values())z.clear();this.edits.clear()}getCellValidationModel(){return this.cellValidations}getRowValidationModel(){return this.rowValidations}setCellValidationModel(z){this.cellValidations=z}setRowValidationModel(z){this.rowValidations=z}destroy(){super.destroy(),this.clear()}},x$=class{constructor(){this.cellValidations=new Map}getCellValidation(z){let{rowNode:J,column:Q}=z||{};return this.cellValidations?.get(J)?.get(Q)}hasCellValidation(z){if(!z?.rowNode||!z.column)return this.cellValidations.size>0;return!!this.getCellValidation(z)}setCellValidation(z,J){let{rowNode:Q,column:Z}=z;if(!this.cellValidations.has(Q))this.cellValidations.set(Q,new Map);this.cellValidations.get(Q).set(Z,J)}clearCellValidation(z){let{rowNode:J,column:Q}=z;this.cellValidations.get(J)?.delete(Q)}setCellValidationMap(z){this.cellValidations=z}getCellValidationMap(){return this.cellValidations}clearCellValidationMap(){this.cellValidations.clear()}},w$=class{constructor(){this.rowValidations=new Map}getRowValidation(z){let{rowNode:J}=z||{};return this.rowValidations.get(J)}hasRowValidation(z){if(!z?.rowNode)return this.rowValidations.size>0;return!!this.getRowValidation(z)}setRowValidation({rowNode:z},J){this.rowValidations.set(z,J)}clearRowValidation({rowNode:z}){this.rowValidations.delete(z)}setRowValidationMap(z){this.rowValidations=z}getRowValidationMap(){return this.rowValidations}clearRowValidationMap(){this.rowValidations.clear()}};function cz(z,J={}){let{rowIndex:Q,rowId:Z,rowCtrl:$,rowPinned:X}=J;if($)return $;let{rowModel:Y,rowRenderer:q}=z,{rowNode:G}=J;if(!G){if(Z)G=E_(z,Z,X);else if(Q!=null)G=Y.getRow(Q)}return G?q.getRowCtrlByNode(G):void 0}function l(z,J={}){let{cellCtrl:Q,colId:Z,columnId:$,column:X}=J;if(Q)return Q;let Y=z.colModel.getCol(Z??$??nQ(X)),q=J.rowCtrl??cz(z,J),G=q?.getCellCtrl(Y)??void 0;if(G)return G;let H=J.rowNode??q?.rowNode;if(H)return z.rowRenderer.getCellCtrls([H],[Y])?.[0];return}function i7(z){let{editSvc:J}=z;if(J?.isBatchEditing())U1(z,{persist:!0}),H1(z);else J?.stopEditing(void 0,{source:"api"})}function gE(z,J,Q){let{gos:Z,popupSvc:$}=J;if(!Z.get("stopEditingWhenCellsLoseFocus"))return;let X=(Y)=>{let q=Y.relatedTarget;if(gQ(q)===null){i7(J);return}let G=Q.some((H)=>H.contains(q))&&Z.isElementInThisInstance(q);if(!G)G=!!$&&($.getActivePopups().some((H)=>H.contains(q))||$.isElementWithinCustomPopup(q));if(!G)i7(J)};for(let Y of Q)z.addManagedElementListeners(Y,{focusout:X})}function nQ(z){if(!z)return;if(typeof z==="string")return z;return z.getColId()}var I0=Symbol("unedited"),hE=(z,J={})=>{let Q=z.rowRenderer.getCellCtrls(J.rowNodes,J.columns),Z=Array(Q.length),$=0;for(let X=0,Y=Q.length;X0)J.set(Q,$)}return J}function e1(z,J,Q){let{key:Z,event:$,cellStartedEdit:X,silent:Y}=Q??{},{editModelSvc:q,gos:G,userCompFactory:H}=z,_=l(z,J),U=_?.comp?.getCellEditor(),W=g$(z,J,Z,X&&!Y),B=q?.getEdit(J),E=W.value??B?.sourceValue;if(U){q?.setEdit(J,{editorValue:N2(z,E,!0,J.column),state:"editing"}),U.refresh?.(W);return}let K=J.column.getColDef(),F=S9(H,K,W);if(!F)return;let{popupFromSelector:L,popupPositionFromSelector:D}=F,M=L??!!K.cellEditorPopup,f=D??K.cellEditorPopupPosition;if(h$(F.params,$),!_)return;let{rangeFeature:S,rowCtrl:A,comp:O,onEditorAttachedFuncs:v}=_;q?.setEdit(J,{editorValue:N2(z,E,!0,J.column),state:"editing",editorState:{cellStartedEditing:void 0,cellStoppedEditing:void 0}}),_.editCompDetails=F,v.push(()=>S?.unsetComp()),O?.setEditDetails(F,M,f,G.get("reactiveCustomComponents")),A?.refreshRow({suppressFlash:!0}),cE(z,J,$,E,Y)}function cE(z,J,Q,Z,$){let{editSvc:X,editModelSvc:Y}=z,q=Y?.getEdit(J);if(!$&&q?.state==="editing"&&!q?.editorState?.cellStartedEditing)X?.dispatchCellEvent(J,Q,"cellEditingStarted",{value:Z}),Y?.setEdit(J,{editorState:{cellStartedEditing:!0}})}function N$(z,J,Q){let Z={editorValueExists:!1};if(Z5(z)){if((J.getValidationErrors?.()?.length??0)>0)return Z}if(Q?.isCancelling)return Z;if(Q?.isStopping){let X=J?.isCancelAfterEnd?.();if(X)return{...Z,isCancelAfterEnd:X}}return{editorValue:J.getValue(),editorValueExists:!0}}function g$(z,J,Q,Z){let{valueSvc:$,gos:X,editSvc:Y}=z,q=z.gos.get("enableGroupEdit"),G=l(z,J),H=J.rowNode?.rowIndex??void 0,_=Y?.isBatchEditing(),U=z.colModel.getCol(J.column.getId()),{rowNode:W,column:B}=J,E=G.comp?.getCellEditor(),K=Y?.getCellDataValue(J),F=K===void 0?E?N$(z,E)?.editorValue:void 0:K,L=F===I0?$.getValueForDisplay({column:U,node:W,from:"edit"})?.value:F,D=q?F:L;if(B.isAllowFormula()&&z.formula?.isFormula(D))D=z.formula?.normaliseFormula(D,!0)??D;return C(X,{value:D,eventKey:Q??null,column:B,colDef:B.getColDef(),rowIndex:H,node:W,data:W.data,cellStartedEdit:!!Z,onKeyDown:G?.onKeyDown.bind(G),stopEditing:(M)=>{Y.stopEditing(J,{source:_?"ui":"api",suppressNavigateAfterEdit:M}),R6(z,J,{})},eGridCell:G?.eGui,parseValue:(M)=>$.parseValue(U,W,M,G?.value),formatValue:G?.formatValue.bind(G),validate:()=>{Y?.validateEdit()}})}function G6(z,J){let{editModelSvc:Q}=z;Q?.getEditMap().forEach((Z,$)=>{Z.forEach((X,Y)=>{if(!J&&(X.state==="editing"||X.pendingValue===I0))return;if(!S4(X)&&(X.state!=="editing"||J))Q?.removeEdits({rowNode:$,column:Y})})})}function pE(z,J){let Q=J.comp?.getCellEditor();if(!Q?.refresh)return;let{eventKey:Z,cellStartedEdit:$}=J.editCompDetails.params,{column:X}=J,Y=g$(z,J,Z,$),q=X.getColDef(),G=S9(z.userCompFactory,q,Y);Q.refresh(h$(G.params,Z))}function h$(z,J){if(J instanceof KeyboardEvent&&z.column.getColDef().cellEditor==="agNumberCellEditor")z.suppressPreventDefault=["-","+",".","e"].includes(J?.key??"")||z.suppressPreventDefault;else J?.preventDefault?.();return z}function U1(z,J){for(let Q of z.editModelSvc?.getEditPositions()??[]){let Z=l(z,Q);if(!Z)continue;let $=Z.comp?.getCellEditor();if(!$)continue;let{editorValue:X,editorValueExists:Y,isCancelAfterEnd:q}=N$(z,$,J);if(q){let{cellStartedEditing:G,cellStoppedEditing:H}=z.editModelSvc?.getEdit(Q)?.editorState||{};z.editModelSvc?.setEdit(Q,{editorState:{isCancelAfterEnd:q,cellStartedEditing:G,cellStoppedEditing:H}})}M2(z,Q,X,void 0,!Y,J)}}function M2(z,J,Q,Z,$,X){let{editModelSvc:Y,valueSvc:q}=z;if(!Y)return;let{rowNode:G,column:H}=J;if(!(G&&H))return;let _=Y.getEdit(J);if(_?.sourceValue===void 0){let U=_?N2(z,_.editorValue,!1,H):I0,W={sourceValue:q.getValue(H,G,"data"),pendingValue:U};if(X?.persist)W.state="changed";_=Y.setEdit(J,W)}if(Y.setEdit(J,{editorValue:$?N2(z,_.sourceValue,!0,H):Q}),X?.persist)iE(z,J)}function N2(z,J,Q,Z){let{formula:$}=z;if(Z.isAllowFormula()&&$?.isFormula(J))return $?.normaliseFormula(J,Q)??J;return J}function iE(z,J){let{editModelSvc:Q}=z,Z=Q?.getEdit(J),X={pendingValue:N2(z,Z?.editorValue,!1,J.column)};if(!Z?.editorState?.cellStoppedEditing&&Z?.state!=="editing")X.state="changed";Q?.setEdit(J,X)}function H1(z,J,Q={}){if(!J)J=z.editModelSvc?.getEditPositions();if(J)for(let Z of J)R6(z,Z,Q)}function R6(z,J,Q,Z=l(z,J)){let $=z.editModelSvc,X=$?.getEdit(J),Y;if(X&&X.state!=="editing"&&X.editorState?.cellStoppedEditing)Y=X.state;else Y="changed";if(!Z){if(X)$?.setEdit(J,{state:Y});return}let q=Z.comp,G=q?.getCellEditor();if(q&&!G){if(Z?.refreshCell(),X){$?.setEdit(J,{state:Y});let _=z.gos.get("enableGroupEdit")?d7(X,Q?.cancel):{valueChanged:!1,newValue:void 0,oldValue:X.sourceValue};n7(z,J,_,Q)}return}if(Z5(z)){let _=X&&G?.getValidationErrors?.(),U=$?.getCellValidationModel();if(_?.length)U?.setCellValidation(J,{errorMessages:_});else U?.clearCellValidation(J)}if(X)$?.setEdit(J,{state:Y});q?.setEditDetails(),q?.refreshEditStyles(!1,!1),Z?.refreshCell({force:!0,suppressFlash:!0});let H=$?.getEdit(J);if(H&&H.state!=="editing"){let _=Q?.cancel,U=z.gos.get("enableGroupEdit")?d7(H,_):dE(H,X,_);n7(z,J,U,Q)}}function d7(z,J){let{sourceValue:Q,pendingValue:Z}=z,$;if(!J&&Z!==I0)$=Z;return{valueChanged:!J&&S4(z),newValue:$,oldValue:Q,value:Q}}function dE(z,J,Q){if(Q||z.editorState.isCancelAfterEnd)return{valueChanged:!1,newValue:void 0,oldValue:z.sourceValue};let Z=z.editorValue;if(Z==null||Z===I0)Z=J?.pendingValue;if(Z===I0)Z=void 0;return{valueChanged:S4(z),newValue:Z,oldValue:z.sourceValue}}function n7(z,J,Q,{silent:Z,event:$}={}){let{editSvc:X,editModelSvc:Y}=z,q=Y?.getEdit(J),{editorState:G}=q||{},{isCancelBeforeStart:H,cellStartedEditing:_,cellStoppedEditing:U}=G||{};if(!Z&&!H&&_&&!U)X?.dispatchCellEvent(J,$,"cellEditingStopped",Q),Y?.setEdit(J,{editorState:{cellStoppedEditing:!0}})}function nE(z){if(!z)return!1;for(let J=0,Q=z.length;J0,M=D?F.join(". "):"";if(qZ(L,D),D)Z.announceValue(`${H} ${F}`,"editorValidation");if(L instanceof HTMLInputElement)L.setCustomValidity(M);else L.classList.toggle("invalid",D)}if(F?.length>0)Q.setCellValidation({rowNode:E,column:K},{errorMessages:F});_.add(U.rowCtrl)}if(U1(z,{persist:!1}),X?.setCellValidationModel(Q),q){let U=rE(z);X?.setRowValidationModel(U)}for(let U of _.values()){U.rowEditStyleFeature?.applyRowStyles();for(let W of U.getAllCellCtrls())W.tooltipFeature?.refreshTooltip(!0),W.editorTooltipFeature?.refreshTooltip(!0),W.editStyleFeature?.applyCellStyles?.()}}var rE=(z)=>{let J=new w$,Q=z.gos.get("getFullRowEditValidationErrors"),Z=z.editModelSvc?.getEditMap();if(!Z)return J;for(let $ of Z.keys()){let X=Z.get($);if(!X)continue;let Y=[],{rowIndex:q,rowPinned:G}=$;for(let _ of X.keys()){let U=X.get(_);if(!U)continue;let{editorValue:W,pendingValue:B,sourceValue:E}=U,K=W??(B===I0?void 0:B)??E;Y.push({column:_,colId:_.getColId(),rowIndex:q,rowPinned:G,oldValue:E,newValue:K})}let H=Q?.({editorsState:Y})??[];if(H.length>0)J.setRowValidation({rowNode:$},{errorMessages:H})}return J};function sE(z){L1(z,!0);let J=z.editModelSvc?.getCellValidationModel().getCellValidationMap();if(!J)return null;let Q=[];return J.forEach((Z,$)=>{Z.forEach(({errorMessages:X},Y)=>{Q.push({column:Y,rowIndex:$.rowIndex,rowPinned:$.rowPinned,messages:X??null})})}),Q}function LJ(z){return!!(z.rowPinned&&z.pinnedSibling)}function e0(z,J,Q,Z){let $=J==="top";if(!Q)return e0(z,J,$?z.getPinnedTopRow(0):z.getPinnedBottomRow(0),Z);if(!Z){let G=$?z.getPinnedTopRowCount():z.getPinnedBottomRowCount();return e0(z,J,Q,$?z.getPinnedTopRow(G-1):z.getPinnedBottomRow(G-1))}let X=!1,Y=!1,q=[];return z.forEachPinnedRow(J,(G)=>{if(G===Q&&!X){X=!0,q.push(G);return}if(X&&G===Z){Y=!0,q.push(G);return}if(X&&!Y)q.push(G)}),q}function lE(z,J,Q,{rowNode:Z,column:$},X){return C(z.gos,{type:Q,node:Z,data:Z.data,value:X,column:$,colDef:$.getColDef(),rowPinned:Z.rowPinned,event:J,rowIndex:Z.rowIndex})}function aE(z,J=!1){if(z===k.DELETE)return!0;if(!J&&z===k.BACKSPACE)return P9();return!1}var oE=class extends V{constructor(z,J,Q,Z){super();this.cellCtrl=z,this.rowNode=Q,this.rowCtrl=Z,this.beans=J}init(){this.eGui=this.cellCtrl.eGui}onKeyDown(z){let J=z.key;if(J===k.ENTER&&b0(this.cellCtrl.column)&&this.beans.rowNumbersSvc?.handleKeyDownOnCell(this.cellCtrl.cellPosition,z))return;switch(J){case k.ENTER:this.onEnterKeyDown(z);break;case k.F2:this.onF2KeyDown(z);break;case k.ESCAPE:this.onEscapeKeyDown(z);break;case k.TAB:this.onTabKeyDown(z);break;case k.BACKSPACE:case k.DELETE:this.onBackspaceOrDeleteKeyDown(J,z);break;case k.DOWN:case k.UP:case k.RIGHT:case k.LEFT:this.onNavigationKeyDown(z,J);break}}onNavigationKeyDown(z,J){let{cellCtrl:Q,beans:Z}=this;if(Z.editSvc?.isEditing(Q,{withOpenEditor:!0}))return;if(z.shiftKey&&Q.isRangeSelectionEnabled())this.onShiftRangeSelect(z);else{let $=Q.getFocusedCellPosition();Z.navigation?.navigateToNextCell(z,J,$,!0)}z.preventDefault()}onShiftRangeSelect(z){let{rangeSvc:J,navigation:Q}=this.beans;if(!J)return;let Z=J.extendLatestRangeInDirection(z);if(!Z)return;if(z.key===k.LEFT||z.key===k.RIGHT)Q?.ensureColumnVisible(Z.column);else Q?.ensureRowVisible(Z.rowIndex)}onTabKeyDown(z){this.beans.navigation?.onTabKeyDown(this.cellCtrl,z)}onBackspaceOrDeleteKeyDown(z,J){let{cellCtrl:Q,beans:Z,rowNode:$}=this,{gos:X,rangeSvc:Y,eventSvc:q,editSvc:G}=Z;if(q.dispatchEvent({type:"keyShortcutChangedCellStart"}),aE(z,X.get("enableCellEditingOnBackspace"))&&!G?.isEditing(Q,{withOpenEditor:!0})){if(Y&&d0(X))Y.clearCellRangeCellValues({dispatchWrapperEvents:!0,wrapperEventSource:"deleteKey"});else if(Q.isCellEditable()){let H=Z.valueSvc.getDeleteValue(Q.column,$);$.setDataValue(Q.column,H,"cellClear")}}else if(!G?.isEditing(Q,{withOpenEditor:!0}))Z.editSvc?.startEditing(Q,{startedEdit:!0,event:J});q.dispatchEvent({type:"keyShortcutChangedCellEnd"})}onEnterKeyDown(z){let{cellCtrl:J,beans:Q}=this,{editSvc:Z,navigation:$}=Q,X=Z?.isEditing(J,{withOpenEditor:!0}),Y=J.rowNode,q=Z?.isRowEditing(Y,{withOpenEditor:!0}),G=(H)=>{if(Z?.startEditing(H,{startedEdit:!0,event:z,source:"edit"}))z.preventDefault()};if(X||q){if(this.isCtrlEnter(z)){Z?.applyBulkEdit(J,Q?.rangeSvc?.getCellRanges()||[]);return}if(L1(Q),Z?.checkNavWithValidation(void 0,z)==="block-stop")return;if(Z?.isEditing(J,{withOpenEditor:!0}))Z?.stopEditing(J,{event:z,source:"edit"});else if(q&&!J.isCellEditable())Z?.stopEditing({rowNode:Y},{event:z,source:"edit"});else G(J)}else if(Q.gos.get("enterNavigatesVertically")){let H=z.shiftKey?k.UP:k.DOWN;$?.navigateToNextCell(null,H,J.cellPosition,!1)}else{if(Z?.hasValidationErrors())return;if(Z?.hasValidationErrors(J))Z.revertSingleCellEdit(J,!0);G(J)}}isCtrlEnter(z){return(z.ctrlKey||z.metaKey)&&z.key===k.ENTER}onF2KeyDown(z){let{cellCtrl:J,beans:{editSvc:Q}}=this;if(Q?.isEditing()){if(L1(this.beans),Q?.checkNavWithValidation(void 0,z)==="block-stop")return}Q?.startEditing(J,{startedEdit:!0,event:z})}onEscapeKeyDown(z){let{cellCtrl:J,beans:{editSvc:Q}}=this;if(Q?.checkNavWithValidation(J,z)==="block-stop")Q.revertSingleCellEdit(J);setTimeout(()=>{Q?.stopEditing(J,{event:z,cancel:!0})})}processCharacter(z){let Q=z.target!==this.eGui,{beans:{editSvc:Z},cellCtrl:$}=this;if(Q)return;if(Z?.isEditing($,{withOpenEditor:!0}))return;if(z.key===k.SPACE)this.onSpaceKeyDown(z);else if(Z?.isCellEditable($,"ui")){if(Z?.hasValidationErrors()&&!Z?.hasValidationErrors($))return;if(Z?.startEditing($,{startedEdit:!0,event:z,source:"api",editable:!0}),!$.editCompDetails?.params?.suppressPreventDefault)z.preventDefault()}}onSpaceKeyDown(z){let{gos:J,editSvc:Q}=this.beans,{rowNode:Z}=this.cellCtrl;if(!Q?.isEditing(this.cellCtrl,{withOpenEditor:!0})&&t4(J))this.beans.selectionSvc?.handleSelectionEvent(z,Z,"spaceKey");z.preventDefault()}},eE=class extends V{constructor(z,J,Q){super();this.cellCtrl=z,this.column=Q,this.beans=J}onMouseEvent(z,J){if(q4(J))return;switch(z){case"click":this.onCellClicked(J);break;case"pointerdown":case"mousedown":case"touchstart":this.onMouseDown(J);break;case"dblclick":this.onCellDoubleClicked(J);break;case"mouseout":this.onMouseOut(J);break;case"mouseover":this.onMouseOver(J);break}}onCellClicked(z){if(this.beans.touchSvc?.handleCellDoubleClick(this,z))return;let{eventSvc:J,rangeSvc:Q,editSvc:Z,editModelSvc:$,frameworkOverrides:X,gos:Y}=this.beans,q=z.ctrlKey||z.metaKey,{cellCtrl:G}=this,{column:H,cellPosition:_,rowNode:U}=G,W=fz(Y,H,U,z);if(Q&&q&&!W){if(Q.getCellRangeCount(_)>1)Q.intersectLastRange(!0)}let B=G.createEvent(z,"cellClicked");B.isEventHandlingSuppressed=W,J.dispatchEvent(B);let E=H.getColDef();if(E.onCellClicked)window.setTimeout(()=>{X.wrapOutgoing(()=>{E.onCellClicked(B)})},0);if(W)return;if($?.getState(G)!=="editing"){let K=Z?.isEditing(),F=Z?.isRangeSelectionEnabledWhileEditing(),L=$?.getCellValidationModel().getCellValidationMap().size??0,D=$?.getRowValidationModel().getRowValidationMap().size??0;if(K&&(F||L>0||D>0))return;if(Z?.shouldStartEditing(G,z))Z?.startEditing(G,{event:z});else if(Z?.shouldStopEditing(G,z))if(this.beans.gos.get("editType")==="fullRow")Z?.stopEditing(G,{event:z,source:"edit"});else Z?.stopEditing(void 0,{event:z,source:"edit"})}}onCellDoubleClicked(z){let{column:J,beans:Q,cellCtrl:Z}=this,{eventSvc:$,frameworkOverrides:X,editSvc:Y,editModelSvc:q,gos:G}=Q,H=fz(G,Z.column,Z.rowNode,z),_=J.getColDef(),U=Z.createEvent(z,"cellDoubleClicked");if(U.isEventHandlingSuppressed=H,$.dispatchEvent(U),typeof _.onCellDoubleClicked==="function")window.setTimeout(()=>{X.wrapOutgoing(()=>{_.onCellDoubleClicked(U)})},0);if(H)return;if(Y?.shouldStartEditing(Z,z)&&q?.getState(Z)!=="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(Z,{event:z})}}onMouseDown(z){let{shiftKey:J}=z,Q=z.target,{cellCtrl:Z,beans:$}=this,{eventSvc:X,rangeSvc:Y,rowNumbersSvc:q,focusSvc:G,gos:H,editSvc:_}=$,{column:U,rowNode:W,cellPosition:B}=Z,E=fz(H,U,W,z),K=()=>{let M=Z.createEvent(z,"cellMouseDown");M.isEventHandlingSuppressed=E,X.dispatchEvent(M)};if(E){K();return}if(this.isRightClickInExistingRange(z))return;let F=Y&&!Y.isEmpty(),L=this.containsWidget(Q),D=b0(U);if(q&&D&&!q.handleMouseDownOnCell(B,z))return;if(!J||!F){let M=_?.isEditing(Z),S=H.get("enableCellTextSelection")&&z.defaultPrevented,A=(A1()||S)&&!M&&!H6(Q)&&!L;Z.focusCell(A,z)}if(J&&F&&!G.isCellFocused(B)){z.preventDefault();let M=G.getFocusedCell();if(M){let{column:f,rowIndex:S,rowPinned:A}=M,O=!!_?.isRangeSelectionEnabledWhileEditing?.();if(_?.isEditing(M)&&!O)_?.stopEditing(M);if(!O)G.setFocusedCell({column:f,rowIndex:S,rowPinned:A,forceBrowserFocus:!0,preventScrollOnBrowserFocus:!0,sourceEvent:z})}}if(L)return;Y?.handleCellMouseDown(z,B),K()}isRightClickInExistingRange(z){let{rangeSvc:J}=this.beans;if(J){let Q=J.isCellInAnyRange(this.cellCtrl.cellPosition),Z=VZ(this.beans,z);if(Q&&Z)return!0}return!1}containsWidget(z){return p1(z,"ag-selection-checkbox",3)||p1(z,"ag-drag-handle",3)}onMouseOut(z){if(this.mouseStayingInsideCell(z))return;let{eventSvc:J,colHover:Q}=this.beans;J.dispatchEvent(this.cellCtrl.createEvent(z,"cellMouseOut")),Q?.clearMouseOver()}onMouseOver(z){if(this.mouseStayingInsideCell(z))return;let{eventSvc:J,colHover:Q}=this.beans;J.dispatchEvent(this.cellCtrl.createEvent(z,"cellMouseOver")),Q?.setMouseOver([this.column])}mouseStayingInsideCell(z){if(!z.target||!z.relatedTarget)return!1;let J=this.cellCtrl.eGui,Q=J.contains(z.target),Z=J.contains(z.relatedTarget);return Q&&Z}},zK=class extends V{constructor(z,J){super();this.cellCtrl=z,this.beans=J,this.column=z.column,this.rowNode=z.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 z=this.cellCtrl.getCellSpan();if(!z)this.setupColSpan(),this.setupRowSpan();if(this.onLeftChanged(),this.onWidthChanged(),!z)this._legacyApplyRowSpan();if(z){let J=this.refreshSpanHeight.bind(this,z);J(),this.addManagedListeners(this.beans.eventSvc,{paginationChanged:J,recalculateRowBounds:J,pinnedHeightChanged:J})}}refreshSpanHeight(z){let J=z.getCellHeight();if(J!=null)this.eContent.style.height=`${J}px`}onNewColumnsLoaded(){let z=this.column.getRowSpan(this.rowNode);if(this.rowSpan===z)return;this.rowSpan=z,this._legacyApplyRowSpan(!0)}onDisplayColumnsChanged(){let z=this.getColSpanningList();if(!Z0(this.colsSpanning,z))this.colsSpanning=z,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 z=this.getCellWidth();this.eContent.style.width=`${z}px`}getCellWidth(){if(!this.colsSpanning)return this.column.getActualWidth();return this.colsSpanning.reduce((z,J)=>z+J.getActualWidth(),0)}getColSpanningList(){let{column:z,rowNode:J}=this,Q=z.getColSpan(J),Z=[];if(Q===1)Z.push(z);else{let $=z,X=z.getPinned();for(let Y=0;$&&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(Z,Y),this.refreshFirstAndLastStyles(),this.checkFormulaError(),this.refreshAriaRowIndex(),this.refreshAriaColIndex(),this.positionFeature?.init(),this.customStyleFeature?.setComp(z),this.editStyleFeature?.setComp(z),this.tooltipFeature?.refreshTooltip(),this.keyboardListener?.init(),this.rangeFeature?.setComp(z),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 H of this.onCompAttachedFuncs)H();this.onCompAttachedFuncs=[]}}checkFormulaError(){let z=!!this.beans.formula?.getFormulaError(this.column,this.rowNode);this.eGui.classList.toggle("formula-error",z)}setupAutoHeight(z,J){this.isAutoHeight=this.beans.rowAutoHeight?.setupCellAutoHeight(this,z,J)??!1}getCellAriaRole(){return this.column.getColDef().cellAriaRole??"gridcell"}isCellRenderer(){let z=this.column.getColDef();return z.cellRenderer!=null||z.cellRendererSelector!=null}getValueToDisplay(){return this.valueFormatted??this.value}getDeferLoadingCellRenderer(){let{beans:z,column:J}=this,{userCompFactory:Q,ctrlsSvc:Z,eventSvc:$}=z,X=J.getColDef(),Y=this.createCellRendererParams();Y.deferRender=!0;let q=E7(Q,X,Y);if(Z.getGridBodyCtrl()?.scrollFeature?.isScrolling()){let G,H=new N((U)=>{G=U}),[_]=this.addManagedListeners($,{bodyScrollEnd:()=>{G(),_()}});return{loadingComp:q,onReady:H}}return{loadingComp:q,onReady:N.resolve()}}showValue(z,J){let{beans:Q,column:Z,rowNode:$,rangeFeature:X}=this,{userCompFactory:Y}=Q,q=this.getValueToDisplay(),G,H=$.stub&&$.groupData?.[Z.getId()]==null,_=Z.getColDef();if(H||this.isCellRenderer()){let U=this.createCellRendererParams();if(!H||b0(Z))G=D1(Y,_,U);else G=E7(Y,_,U)}if(!G&&!H&&Q.findSvc?.isMatch($,Z)){let U=this.createCellRendererParams();G=D1(Y,{...Z.getColDef(),cellRenderer:"agFindCellRenderer"},U)}if(this.hasEdit&&this.editSvc.isBatchEditing()&&this.editSvc.isRowEditing($,{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,z),this.customRowDragComp?.refreshVisibility(),!J&&X)W4(Q,()=>X?.refreshRangeStyleAndHandle());this.rowResizeFeature?.refreshRowResizer()}setupControlComps(){let z=this.column.getColDef();this.includeSelection=this.isIncludeControl(this.isCheckboxSelection(z),!0),this.includeRowDrag=this.isIncludeControl(z.rowDrag),this.includeDndSource=this.isIncludeControl(z.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 J=this.column.getColDef().cellRenderer==="agCheckboxCellRenderer",Q="";if(J)Q=" ag-allow-overflow";return`ag-cell-value${Q}`}isIncludeControl(z,J=!1){return(this.rowNode.rowPinned==null||J&&LJ(this.rowNode))&&!!z}isCheckboxSelection(z){let{rowSelection:J,groupDisplayType:Q}=this.beans.gridOptions,Z=b2(J),$=m4(this.column);if(Q==="custom"&&Z!=="selectionColumn"&&$)return!1;return z.checkboxSelection||$&&typeof J==="object"&&B1(J)}refreshShouldDestroy(){let z=this.column.getColDef(),J=this.includeSelection!=this.isIncludeControl(this.isCheckboxSelection(z),!0),Q=this.includeRowDrag!=this.isIncludeControl(z.rowDrag),Z=this.includeDndSource!=this.isIncludeControl(z.dndSource),$=this.isAutoHeight!=this.column.isAutoHeight();return J||Q||Z||$}onPopupEditorClosed(z){let{editSvc:J}=this.beans;if(!J?.isEditing(this,{withOpenEditor:!0}))return;let Q=z instanceof KeyboardEvent,Z=z instanceof MouseEvent,$=Q&&z.key===k.ESCAPE;if(J.stopEditing(this,{source:J.isBatchEditing()?"ui":"api",cancel:$,event:Q||Z?z:void 0}),$)this.focusCell(!0,z)}stopEditing(z=!1){let{editSvc:J}=this.beans;return J?.stopEditing(this,{cancel:z,source:J?.isBatchEditing()?"ui":"api"})??!1}createCellRendererParams(){let{value:z,valueFormatted:J,column:Q,rowNode:Z,comp:$,eGui:X,beans:{valueSvc:Y,gos:q,editSvc:G}}=this;return C(q,{value:z,valueFormatted:J,getValue:()=>Y.getValueForDisplay({column:Q,node:Z,from:"edit"}).value,setValue:(_)=>G?.setDataValue({rowNode:Z,column:Q},_)||Z.setDataValue(Q,_),formatValue:this.formatValue.bind(this),data:Z.data,node:Z,pinned:Q.getPinned(),colDef:Q.getColDef(),column:Q,refreshCell:this.refreshCell.bind(this),eGridCell:X,eParentOfValue:$.getParentOfValue(),registerRowDragger:(_,U,W,B)=>this.registerRowDragger(_,U,B),setTooltip:(_,U)=>{if(q.assertModuleRegistered("Tooltip",3),this.tooltipFeature)this.disableTooltipFeature();this.enableTooltipFeature(_,U),this.tooltipFeature?.refreshTooltip()}})}onCellChanged(z){if(z.column===this.column)this.refreshCell()}refreshOrDestroyCell(z){if(this.refreshShouldDestroy())this.rowCtrl?.recreateCell(this);else this.refreshCell(z);if(this.hasEdit&&this.editCompDetails){let{editSvc:J,comp:Q}=this;if(!Q?.getCellEditor()&&J.isEditing(this,{withOpenEditor:!0}))J.startEditing(this,{startedEdit:!1,source:"api",silent:!0})}}refreshCell(z){let{editStyleFeature:J,customStyleFeature:Q,rowCtrl:{rowEditStyleFeature:Z},beans:{cellFlashSvc:$,filterManager:X},column:Y,comp:q,suppressRefreshCell:G,tooltipFeature:H}=this;if(G)return;let{field:_,valueGetter:U,showRowGroup:W,enableCellChangeFlash:B}=Y.getColDef(),E=_==null&&U==null&&W==null,K=z?.newData??!1,F=E||z&&(z.force||K),L=!!q,D=this.updateAndFormatValue(L),M=F||D;if(!L)return;if(M){this.showValue(!!K,!1);let f=X?.isSuppressFlashingCellsBecauseFiltering();if(!z?.suppressFlash&&!f&&B)$?.flashCell(this);J?.applyCellStyles?.(),Q?.applyUserStyles(),Q?.applyClassesFromColDef(),Z?.applyRowStyles(),this.checkFormulaError()}H?.refreshTooltip(),Q?.applyCellClassRules()}isCellEditable(){return this.column.isCellEditable(this.rowNode)}formatValue(z){return this.callValueFormatter(z)??z}callValueFormatter(z){return this.beans.valueSvc.formatValue(this.column,this.rowNode,z)}updateAndFormatValue(z){let J=this.value,Q=this.valueFormatted,{value:Z,valueFormatted:$}=this.beans.valueSvc.getValueForDisplay({column:this.column,node:this.rowNode,includeValueFormatted:!0,from:"edit"});if(this.value=Z,this.valueFormatted=$,z)return!this.valuesAreEqual(J,this.value)||this.valueFormatted!=Q;return!0}valuesAreEqual(z,J){let Q=this.column.getColDef();return Q.equals?Q.equals(z,J):z===J}addDomData(z){let J=this.eGui;l1(this.beans.gos,J,gz,this),z.addDestroyFunc(()=>l1(this.beans.gos,J,gz,null))}createEvent(z,J){let{rowNode:Q,column:Z,value:$,beans:X}=this;return lE(X,z,J,{rowNode:Q,column:Z},$)}processCharacter(z){this.keyboardListener?.processCharacter(z)}onKeyDown(z){this.keyboardListener?.onKeyDown(z)}onMouseEvent(z,J){this.mouseListener?.onMouseEvent(z,J)}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:z,column:J,beans:Q}=this;p9(z,J,Q.visibleCols)}refreshAriaColIndex(){let z=this.beans.visibleCols.getAriaColIndex(this.column);P8(this.eGui,z)}onWidthChanged(){return this.positionFeature?.onWidthChanged()}getRowPosition(){let{rowIndex:z,rowPinned:J}=this.cellPosition;return{rowIndex:z,rowPinned:J}}updateRangeBordersIfRangeCount(){if(!this.comp)return;this.rangeFeature?.updateRangeBordersIfRangeCount()}onCellSelectionChanged(){if(!this.comp)return;this.rangeFeature?.onCellSelectionChanged()}isRangeSelectionEnabled(){return this.rangeFeature!=null}focusCell(z=!1,J){let Q=this.editSvc?.allowedFocusTargetOnValidation(this);if(Q&&Q!==this)return;this.beans.focusSvc.setFocusedCell({...this.getFocusedCellPosition(),forceBrowserFocus:z,sourceEvent:J})}restoreFocus(z=!1){let{beans:{editSvc:J,focusSvc:Q},comp:Z}=this;if(!Z||J?.isEditing(this)||!this.isCellFocused()||!Q.shouldTakeFocus())return;let $=()=>{if(!this.isAlive())return;let X=Z.getFocusableElement();if(this.isCellFocused())X.focus({preventScroll:!0})};if(z){setTimeout($,0);return}$()}onRowIndexChanged(){this.createCellPosition(),this.refreshAriaRowIndex(),this.onCellFocused(),this.restoreFocus(),this.rangeFeature?.onCellSelectionChanged(),this.rowResizeFeature?.refreshRowResizer()}onSuppressCellFocusChanged(z){let J=this.eGui;if(!J)return;V4(J,"tabindex",z?void 0:-1)}onFirstRightPinnedChanged(){if(!this.comp)return;let z=this.column.isFirstRightPinned();this.comp.toggleCss(XK,z)}onLastLeftPinnedChanged(){if(!this.comp)return;let z=this.column.isLastLeftPinned();this.comp.toggleCss(YK,z)}checkCellFocused(){return this.beans.focusSvc.isCellFocused(this.cellPosition)}isCellFocused(){let z=this.checkCellFocused();return this.hasBeenFocused||(this.hasBeenFocused=z),z}setupFocus(){this.restoreFocus(!0),this.onCellFocused(this.focusEventWhileNotReady??void 0)}onCellFocused(z){let{beans:J}=this;if(Nz(J))return;if(!this.comp){if(z)this.focusEventWhileNotReady=z;return}let Q=this.isCellFocused(),Z=J.editSvc?.isEditing(this)??!1;if(this.comp.toggleCss($K,Q),Q&&(z?.forceBrowserFocus||!this.hasBrowserFocus()&&this.beans.focusSvc.shouldTakeFocus())){let $=this.comp.getFocusableElement();if(Z){let Y=A4($,null,!0);if(Y.length)$=Y[0]}let X=z?z.preventScrollOnBrowserFocus:!0;$.focus({preventScroll:X}),HG(J,$)}if(Q&&this.focusEventWhileNotReady)this.focusEventWhileNotReady=null;if(Q&&z)this.rowCtrl.announceDescription()}createCellPosition(){let{rowIndex:z,rowPinned:J}=this.rowNode;this.cellPosition={rowIndex:z,rowPinned:q0(J),column:this.column}}applyStaticCssClasses(){let{comp:z}=this;z.toggleCss(JK,!0),z.toggleCss(qK,!0);let J=this.column.isAutoHeight()==!0;z.toggleCss(QK,J),z.toggleCss(ZK,!J)}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 z=this.column.getColDef().wrapText==!0;this.comp.toggleCss(GK,z)}dispatchCellContextMenuEvent(z){let J=this.column.getColDef(),Q=this.createEvent(z,"cellContextMenu"),{beans:Z}=this;if(Z.eventSvc.dispatchEvent(Q),J.onCellContextMenu)window.setTimeout(()=>{Z.frameworkOverrides.wrapOutgoing(()=>{J.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 z=this.beans.selectionSvc?.createCheckboxSelectionComponent();if(!z)return;return this.beans.context.createBean(z),z.init({rowNode:this.rowNode,column:this.column}),z}createDndSource(){let z=this.beans.registry.createDynamicBean("dndSourceComp",!1,this.rowNode,this.column,this.eGui);if(z)this.beans.context.createBean(z);return z}registerRowDragger(z,J,Q){if(this.customRowDragComp){this.customRowDragComp.setDragElement(z,J);return}let Z=this.createRowDragComp(z,J,Q);if(Z)this.customRowDragComp=Z,this.addDestroyFunc(()=>{this.beans.context.destroyBean(Z),this.customRowDragComp=null}),Z.refreshVisibility()}createRowDragComp(z,J,Q){let Z=this.beans.rowDragSvc?.createRowDragCompForCell(this.rowNode,this.column,()=>this.value,z,J,Q);if(!Z)return;return this.beans.context.createBean(Z),Z}cellEditorAttached(){for(let z of this.onEditorAttachedFuncs)z();this.onEditorAttachedFuncs=[]}setFocusedCellPosition(z){}getFocusedCellPosition(){return this.cellPosition}refreshAriaRowIndex(){if(!b0(this.column)||!this.eGui)return;let{ariaRowIndex:z}=this.rowCtrl;if(z!=null)jz(this.eGui,z)}getRootElement(){return this.eGui}};function u$(z,J,Q,Z,$,X){if(Q==null&&J==null)return;let Y={},q={},G=(H,_)=>{for(let U of H.split(" ")){if(U.trim()=="")continue;_(U)}};if(Q){let H=Object.keys(Q);for(let _=0;_{if(B)Y[E]=!0;else q[E]=!0})}}if(J&&X)for(let H of Object.keys(J))G(H,(_)=>{if(!Y[_])q[_]=!0});if(X)Object.keys(q).forEach(X);Object.keys(Y).forEach($)}function t7(z){if(z.group)return z.level;let J=z.parent;return J?J.level+1:0}var _K=0,tQ=class extends V{constructor(z,J,Q,Z,$){super();this.rowNode=z,this.useAnimationFrameForCreate=Z,this.printLayout=$,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=J,this.gos=J.gos,this.paginationPage=J.pagination?.getCurrentPage()??0,this.suppressRowTransform=this.gos.get("suppressRowTransform"),this.instanceId=z.id+"-"+_K++,this.rowId=E0(z.id),this.initRowBusinessKey(),this.rowFocused=J.focusSvc.isRowFocused(this.rowNode.rowIndex,this.rowNode.rowPinned),this.rowLevel=t7(this.rowNode),this.setRowType(),this.setAnimateFlags(Q),this.rowStyles=this.processStylesFromGridOptions(),this.rowEditStyleFeature=J.editSvc?.createRowStyleFeature(this),this.addListeners()}initRowBusinessKey(){this.businessKeyForNodeFunc=this.gos.get("getBusinessKeyForNode"),this.updateRowBusinessKey()}updateRowBusinessKey(){if(typeof this.businessKeyForNodeFunc!=="function")return;let z=this.businessKeyForNodeFunc(this.rowNode);this.businessKey=E0(z)}updateGui(z,J){if(z==="left")this.leftGui=J;else if(z==="right")this.rightGui=J;else if(z==="fullWidth")this.fullWidthGui=J;else this.centerGui=J}setComp(z,J,Q,Z){let{context:$,rowRenderer:X}=this.beans;Z=u6(this,$,Z);let Y={rowComp:z,element:J,containerType:Q,compBean:Z};this.allRowGuis.push(Y),this.updateGui(Q,Y),this.initialiseRowComp(Y);let q=this.rowNode,G=this.rowType==="FullWidthLoading"||q.stub,H=!q.data&&this.beans.rowModel.getType()==="infinite";if(!G&&!H&&!q.rowPinned)X.dispatchFirstDataRenderedEvent();this.setupFocus()}unsetComp(z){this.allRowGuis=this.allRowGuis.filter((J)=>J.containerType!==z),this.updateGui(z,void 0)}isCacheable(){return this.rowType==="FullWidthDetail"&&this.gos.get("keepDetailRows")}setCached(z){let J=z?"none":"";for(let Q of this.allRowGuis)Q.element.style.display=J}initialiseRowComp(z){let J=this.gos;if(this.onSuppressCellFocusChanged(this.beans.gos.get("suppressCellFocus")),this.listenOnDomOrder(z),this.onRowHeightChanged(z),this.updateRowIndexes(z),this.setFocusedClasses(z),this.setStylesFromGridOptions(!1,z),t4(J)&&this.rowNode.selectable)this.onRowSelected(z);this.updateColumnLists(!this.useAnimationFrameForCreate);let Q=z.rowComp,Z=this.getInitialRowClasses(z.containerType);for(let $ of Z)Q.toggleCss($,!0);if(this.executeSlideAndFadeAnimations(z),this.rowNode.group)R0(z.element,!!this.rowNode.expanded);if(this.setRowCompRowId(Q),this.setRowCompRowBusinessKey(Q),l1(J,z.element,hz,this),z.compBean.addDestroyFunc(()=>l1(J,z.element,hz,null)),this.useAnimationFrameForCreate)this.beans.animationFrameSvc.createTask(this.addHoverFunctionality.bind(this,z),this.rowNode.rowIndex,"p2",!1);else this.addHoverFunctionality(z);if(this.isFullWidth())this.setupFullWidth(z);if(J.get("rowDragEntireRow"))this.addRowDraggerToRow(z);if(this.useAnimationFrameForCreate)this.beans.animationFrameSvc.addDestroyTask(()=>{if(!this.isAlive())return;z.rowComp.toggleCss("ag-after-created",!0)});this.executeProcessRowPostCreateFunc()}setRowCompRowBusinessKey(z){if(this.businessKey==null)return;z.setRowBusinessKey(this.businessKey)}setRowCompRowId(z){let J=E0(this.rowNode.id);if(this.rowId=J,J==null)return;z.setRowId(J)}executeSlideAndFadeAnimations(z){let{containerType:J}=z;if(this.slideInAnimation[J])TQ(()=>{this.onTopChanged()}),this.slideInAnimation[J]=!1;if(this.fadeInAnimation[J])TQ(()=>{z.rowComp.toggleCss("ag-opacity-zero",!1)}),this.fadeInAnimation[J]=!1}addRowDraggerToRow(z){let J=this.beans.rowDragSvc?.createRowDragCompForRow(this.rowNode,z.element);if(!J)return;let Q=this.createBean(J,this.beans.context);this.rowDragComps.push(Q),z.compBean.addDestroyFunc(()=>{this.rowDragComps=this.rowDragComps.filter((Z)=>Z!==Q),this.rowEditStyleFeature=this.destroyBean(this.rowEditStyleFeature,this.beans.context),this.destroyBean(Q,this.beans.context)})}setupFullWidth(z){let J=this.getPinnedForContainer(z.containerType),Q=this.createFullWidthCompDetails(z.element,J);z.rowComp.showFullWidth(Q)}getFullWidthCellRenderers(){if(this.gos.get("embedFullWidthRows"))return this.allRowGuis.map((z)=>z?.rowComp?.getFullWidthCellRenderer());return[this.fullWidthGui?.rowComp?.getFullWidthCellRenderer()]}executeProcessRowPostCreateFunc(){let z=this.gos.getCallback("processRowPostCreate");if(!z||!this.areAllContainersReady())return;let J={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(J)}areAllContainersReady(){let{leftGui:z,centerGui:J,rightGui:Q,beans:{visibleCols:Z}}=this,$=!!z||!Z.isPinningLeft(),X=!!J,Y=!!Q||!Z.isPinningRight();return $&&X&&Y}isNodeFullWidthCell(){if(this.rowNode.detail)return!0;let z=this.beans.gos.getCallback("isFullWidthRow");return z?z({rowNode:this.rowNode}):!1}setRowType(){let{rowNode:z,gos:J,beans:{colModel:Q}}=this,Z=z.stub&&!J.get("suppressServerSideFullWidthLoadingRow")&&!J.get("groupHideOpenParents"),$=this.isNodeFullWidthCell(),X=J.get("masterDetail")&&z.detail,Y=Q.isPivotMode(),q=Q9(J,z,Y);if(Z)this.rowType="FullWidthLoading";else if(X)this.rowType="FullWidthDetail";else if($)this.rowType="FullWidth";else if(q)this.rowType="FullWidthGroup";else this.rowType="Normal"}updateColumnLists(z=!1,J=!1){if(this.isFullWidth())return;let{animationFrameSvc:Q}=this.beans;if(!Q?.active||z||this.printLayout){this.updateColumnListsImpl(J);return}if(this.updateColumnListsPending)return;Q.createTask(()=>{if(!this.active)return;this.updateColumnListsImpl(!0)},this.rowNode.rowIndex,"p1",!1),this.updateColumnListsPending=!0}getNewCellCtrl(z){if(this.beans.rowSpanSvc?.isCellSpanning(z,this.rowNode))return;return new B6(z,this.rowNode,this.beans,this)}isCorrectCtrlForSpan(z){return!this.beans.rowSpanSvc?.isCellSpanning(z.column,this.rowNode)}createCellCtrls(z,J,Q=null){let Z={list:[],map:{}},$=(H,_,U)=>{if(U!=null)Z.list.splice(U,0,_);else Z.list.push(_);Z.map[H]=_},X=[];for(let H of J){let _=H.getInstanceId(),U=z.map[_];if(U&&!this.isCorrectCtrlForSpan(U))U.destroy(),U=void 0;if(!U)U=this.getNewCellCtrl(H);if(!U)continue;$(_,U)}for(let H of z.list){let _=H.column.getInstanceId();if(Z.map[_]!=null)continue;if(!this.isCellEligibleToBeRemoved(H,Q))X.push([_,H]);else H.destroy()}if(X.length)for(let[H,_]of X){let U=Z.list.findIndex((B)=>B.column.getLeft()>_.column.getLeft()),W=U===-1?void 0:Math.max(U-1,0);$(H,_,W)}let{focusSvc:Y,visibleCols:q}=this.beans,G=Y.getFocusedCell();if(G&&G.column.getPinned()==Q){let H=G.column.getInstanceId();if(!Z.map[H]&&q.allCols.includes(G.column)){let U=this.createFocusedCellCtrl();if(U){let W=Z.list.findIndex((E)=>E.column.getLeft()>U.column.getLeft()),B=W===-1?void 0:Math.max(W-1,0);$(H,U,B)}}}return Z}createFocusedCellCtrl(){let{focusSvc:z,rowSpanSvc:J}=this.beans,Q=z.getFocusedCell();if(!Q)return;let Z=J?.getCellSpan(Q.column,this.rowNode);if(Z){if(Z.firstNode!==this.rowNode||!Z.doesSpanContain(Q))return}else if(!z.isRowFocused(this.rowNode.rowIndex,this.rowNode.rowPinned))return;return this.getNewCellCtrl(Q.column)}updateColumnListsImpl(z){this.updateColumnListsPending=!1,this.createAllCellCtrls(),this.setCellCtrls(z)}setCellCtrls(z){for(let J of this.allRowGuis){let Q=this.getCellCtrlsForContainer(J.containerType);J.rowComp.setCellCtrls(Q,z)}}getCellCtrlsForContainer(z){switch(z){case"left":return this.leftCellCtrls.list;case"right":return this.rightCellCtrls.list;case"fullWidth":return[];case"center":return this.centerCellCtrls.list}}createAllCellCtrls(){let z=this.beans.colViewport,J=this.beans.visibleCols;if(this.printLayout)this.centerCellCtrls=this.createCellCtrls(this.centerCellCtrls,J.allCols),this.leftCellCtrls={list:[],map:{}},this.rightCellCtrls={list:[],map:{}};else{let Q=z.getColsWithinViewport(this.rowNode);this.centerCellCtrls=this.createCellCtrls(this.centerCellCtrls,Q);let Z=J.getLeftColsForRow(this.rowNode);this.leftCellCtrls=this.createCellCtrls(this.leftCellCtrls,Z,"left");let $=J.getRightColsForRow(this.rowNode);this.rightCellCtrls=this.createCellCtrls(this.rightCellCtrls,$,"right")}}isCellEligibleToBeRemoved(z,J){let{column:$}=z;if($.getPinned()!=J)return!0;if(!this.isCorrectCtrlForSpan(z))return!0;let{visibleCols:X,editSvc:Y}=this.beans,q=Y?.isEditing(z),G=z.isCellFocused();if(q||G)return X.allCols.indexOf($)>=0?!1:!0;return!0}getDomOrder(){return this.gos.get("ensureDomOrder")||A0(this.gos,"print")}listenOnDomOrder(z){let J=()=>{z.rowComp.setDomOrder(this.getDomOrder())};z.compBean.addManagedPropertyListeners(["domLayout","ensureDomOrder"],J)}setAnimateFlags(z){if(this.rowNode.sticky||!z)return;let J=T(this.rowNode.oldRowTop),{visibleCols:Q}=this.beans,Z=Q.isPinningLeft(),$=Q.isPinningRight();if(J){let{slideInAnimation:X}=this;if(this.isFullWidth()&&!this.gos.get("embedFullWidthRows")){X.fullWidth=!0;return}X.center=!0,X.left=Z,X.right=$}else{let{fadeInAnimation:X}=this;if(this.isFullWidth()&&!this.gos.get("embedFullWidthRows")){X.fullWidth=!0;return}X.center=!0,X.left=Z,X.right=$}}isFullWidth(){return this.rowType!=="Normal"}refreshFullWidth(){let z=(Y,q)=>{if(!Y)return!0;return Y.rowComp.refreshFullWidth(()=>{return this.createFullWidthCompDetails(Y.element,q).params})},J=z(this.fullWidthGui,null),Q=z(this.centerGui,null),Z=z(this.leftGui,"left"),$=z(this.rightGui,"right");return J&&Q&&Z&&$}addListeners(){let{beans:z,gos:J,rowNode:Q}=this,{expansionSvc:Z,eventSvc:$,context:X,rowSpanSvc:Y}=z;if(this.addManagedListeners(this.rowNode,{heightChanged:()=>this.onRowHeightChanged(),rowSelected:()=>this.onRowSelected(),rowIndexChanged:this.onRowIndexChanged.bind(this),topChanged:this.onTopChanged.bind(this),...Z?.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($,{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(J.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 z of this.getAllCellCtrls())z.onRowIndexChanged()},cellChanged:(z)=>{for(let J of this.getAllCellCtrls())J.onCellChanged(z)}})}onRowPinned(){for(let z of this.allRowGuis)z.rowComp.toggleCss("ag-row-pinned-source",!!this.rowNode.pinnedSibling)}onRowNodeDataChanged(z){this.refreshRow({suppressFlash:!z.update,newData:!z.update})}refreshRow(z){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(z);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 z=this.beans.rowDropHighlightSvc,J=z?.row===this.rowNode?z.position:"none",Q=J==="above",Z=J==="inside",$=J==="below",X=J!=="none",Y=Q||$,q=this.rowNode.uiLevel,G=Y&&q>0,H=G?q.toString():"0";for(let _ of this.allRowGuis){let U=_.rowComp;if(U.toggleCss("ag-row-highlight-above",Q),U.toggleCss("ag-row-highlight-inside",Z),U.toggleCss("ag-row-highlight-below",$),U.toggleCss("ag-row-highlight-indent",G),X)_.element.style.setProperty("--ag-row-highlight-level",H);else _.element.style.removeProperty("--ag-row-highlight-level")}}postProcessRowDragging(){let z=this.rowNode.dragging;for(let J of this.allRowGuis)J.rowComp.toggleCss("ag-row-dragging",z)}onDisplayedColumnsChanged(){this.updateColumnLists(!0),this.beans.rowAutoHeight?.requestCheckAutoHeight()}onVirtualColumnsChanged(){this.updateColumnLists(!1,!0)}getRowPosition(){return{rowPinned:q0(this.rowNode.rowPinned),rowIndex:this.rowNode.rowIndex}}onKeyboardNavigate(z){let J=this.findFullWidthInfoForEvent(z);if(!J)return;let{rowGui:Q,column:Z}=J;if(Q.element!==z.target)return;let Y=this.rowNode,{focusSvc:q,navigation:G}=this.beans,H=q.getFocusedCell(),_={rowIndex:Y.rowIndex,rowPinned:Y.rowPinned,column:H?.column??Z};G?.navigateToNextCell(z,z.key,_,!0),z.preventDefault()}onTabKeyDown(z){if(z.defaultPrevented||q4(z))return;let J=this.allRowGuis.find((q)=>q.element.contains(z.target)),Q=J?J.element:null,Z=Q===z.target,$=d(this.beans),X=!1;if(Q&&$)X=Q.contains($)&&$.classList.contains("ag-cell");let Y=null;if(!Z&&!X)Y=P0(this.beans,Q,!1,z.shiftKey);if(this.isFullWidth()&&Z||!Y)this.beans.navigation?.onTabKeyDown(this,z)}getFullWidthElement(){if(this.fullWidthGui)return this.fullWidthGui.element;return null}getRowYPosition(){let z=this.allRowGuis.find((J)=>M0(J.element))?.element;if(z)return z.getBoundingClientRect().top;return 0}onSuppressCellFocusChanged(z){let J=this.isFullWidth()&&z?void 0:this.gos.get("tabIndex");for(let Q of this.allRowGuis)V4(Q.element,"tabindex",J)}setupFocus(){if(!this.isFullWidth())return;this.restoreFullWidthFocus(!0),this.onFullWidthRowFocused(this.focusEventWhileNotReady??void 0)}restoreFullWidthFocus(z=!1){let{focusSvc:J,editSvc:Q}=this.beans;if(Q?.isEditing(this))return;if(!J.isRowFocused(this.rowNode.rowIndex,this.rowNode.rowPinned)||!J.shouldTakeFocus())return;let Z=this.getFullWidthRowGuiForFocus();if(!Z)return;let $=()=>{if(!this.isAlive())return;if(J.isRowFocused(this.rowNode.rowIndex,this.rowNode.rowPinned))Z.element.focus({preventScroll:!0})};if(z){setTimeout($,0);return}$()}getFullWidthRowGuiForFocus(z){if(this.fullWidthGui)return this.fullWidthGui;let J=this.beans.focusSvc.getFocusedCell(),Q=this.beans.colModel.getCol(z?.column??J?.column);if(!Q)return;let Z=Q?.pinned;if(Z==="right")return this.rightGui;if(Z==="left")return this.leftGui;return this.centerGui}setFullWidthRowFocusedClass(z,J){this.forEachGui(void 0,(Q)=>{Q.element.classList.toggle("ag-full-width-focus",J&&Q===z)})}onFullWidthRowFocused(z){let{focusSvc:J}=this.beans;if(!(this.isFullWidth()&&J.isRowFocused(this.rowNode.rowIndex,this.rowNode.rowPinned))){this.setFullWidthRowFocusedClass(void 0,!1);return}let Z=this.getFullWidthRowGuiForFocus(z);if(!Z){if(z)this.focusEventWhileNotReady=z;this.setFullWidthRowFocusedClass(void 0,!1);return}if(this.setFullWidthRowFocusedClass(Z,!0),this.focusEventWhileNotReady=null,z?.forceBrowserFocus)Z.element.focus({preventScroll:!0})}recreateCell(z){this.centerCellCtrls=this.removeCellCtrl(this.centerCellCtrls,z),this.leftCellCtrls=this.removeCellCtrl(this.leftCellCtrls,z),this.rightCellCtrls=this.removeCellCtrl(this.rightCellCtrls,z),z.destroy(),this.updateColumnLists()}removeCellCtrl(z,J){let Q={list:[],map:{}};for(let Z of z.list){if(Z===J)continue;Q.list.push(Z),Q.map[Z.column.getInstanceId()]=Z}return Q}onMouseEvent(z,J){switch(z){case"dblclick":this.onRowDblClick(J);break;case"click":this.onRowClick(J);break;case"pointerdown":case"touchstart":case"mousedown":this.onRowMouseDown(J);break}}createRowEvent(z,J){let{rowNode:Q}=this;return C(this.gos,{type:z,node:Q,data:Q.data,rowIndex:Q.rowIndex,rowPinned:Q.rowPinned,event:J})}createRowEventWithSource(z,J){let Q=this.createRowEvent(z,J);return Q.source=this,Q}onRowDblClick(z){if(q4(z))return;let J=this.createRowEventWithSource("rowDoubleClicked",z);J.isEventHandlingSuppressed=this.isSuppressMouseEvent(z),this.beans.eventSvc.dispatchEvent(J)}findFullWidthInfoForEvent(z){if(!z)return;let J=this.findFullWidthRowGui(z.target),Q=this.getColumnForFullWidth(J);if(!J||!Q)return;return{rowGui:J,column:Q}}findFullWidthRowGui(z){return this.allRowGuis.find((J)=>J.element.contains(z))}getColumnForFullWidth(z){let{visibleCols:J}=this.beans;switch(z?.containerType){case"center":return J.centerCols[0];case"left":return J.leftCols[0];case"right":return J.rightCols[0];default:return J.allCols[0]}}onRowMouseDown(z){if(this.lastMouseDownOnDragger=p1(z.target,"ag-row-drag",3),!this.isFullWidth()||this.isSuppressMouseEvent(z))return;let{rangeSvc:J,focusSvc:Q}=this.beans;J?.removeAllCellRanges();let Z=this.findFullWidthInfoForEvent(z);if(!Z)return;let{rowGui:$,column:X}=Z,Y=$.element,q=z.target,G=this.rowNode,H=z.defaultPrevented||A1();if(Y&&Y.contains(q)&&H6(q))H=!1;Q.setFocusedCell({rowIndex:G.rowIndex,column:X,rowPinned:G.rowPinned,forceBrowserFocus:H})}isSuppressMouseEvent(z){let{gos:J,rowNode:Q}=this;if(this.isFullWidth()){let $=this.findFullWidthRowGui(z.target);return QU(J,$?.rowComp.getFullWidthCellRendererParams(),Q,z)}let Z=m6(J,z.target);return Z!=null&&fz(J,Z.column,Q,z)}onRowClick(z){if(q4(z)||this.lastMouseDownOnDragger)return;let Q=this.isSuppressMouseEvent(z),{eventSvc:Z,selectionSvc:$}=this.beans,X=this.createRowEventWithSource("rowClicked",z);if(X.isEventHandlingSuppressed=Q,Z.dispatchEvent(X),Q)return;$?.handleSelectionEvent(z,this.rowNode,"rowClicked")}setupDetailRowAutoHeight(z){if(this.rowType!=="FullWidthDetail")return;this.beans.masterDetailSvc?.setupDetailRowAutoHeight(this,z)}createFullWidthCompDetails(z,J){let{gos:Q,rowNode:Z}=this,$=C(Q,{fullWidth:!0,data:Z.data,node:Z,value:Z.key,valueFormatted:Z.key,eGridCell:z,eParentOfValue:z,pinned:J,addRenderedRowListener:this.addEventListener.bind(this),registerRowDragger:(Y,q,G,H)=>this.addFullWidthRowDragging(Y,q,G,H),setTooltip:(Y,q)=>{Q.assertModuleRegistered("Tooltip",3),this.setupFullWidthRowTooltip(Y,q)}}),X=this.beans.userCompFactory;switch(this.rowType){case"FullWidthDetail":return pH(X,$);case"FullWidthGroup":{let{value:Y,valueFormatted:q}=this.beans.valueSvc.getValueForDisplay({node:this.rowNode,includeValueFormatted:!0,from:"edit"});return $.value=Y,$.valueFormatted=q,cH(X,$)}case"FullWidthLoading":return mH(X,$);default:return uH(X,$)}}setupFullWidthRowTooltip(z,J){if(!this.fullWidthGui)return;this.tooltipFeature=this.beans.tooltipSvc?.setupFullWidthRowTooltip(this.tooltipFeature,this,z,J)}addFullWidthRowDragging(z,J,Q="",Z){let{rowDragSvc:$,context:X}=this.beans;if(!$||!this.isFullWidth())return;let Y=$.createRowDragComp(()=>Q,this.rowNode,void 0,z,J,Z);this.createBean(Y,X),this.addDestroyFunc(()=>{this.destroyBean(Y,X)})}onUiLevelChanged(){let z=t7(this.rowNode);if(this.rowLevel!=z){let J="ag-row-level-"+z,Q="ag-row-level-"+this.rowLevel;for(let Z of this.allRowGuis)Z.rowComp.toggleCss(J,!0),Z.rowComp.toggleCss(Q,!1)}this.rowLevel=z}isFirstRowOnPage(){return this.rowNode.rowIndex===this.beans.pageBounds.getFirstRow()}isLastRowOnPage(){return this.rowNode.rowIndex===this.beans.pageBounds.getLastRow()}refreshFirstAndLastRowStyles(){let z=this.isFirstRowOnPage(),J=this.isLastRowOnPage();if(this.firstRowOnPage!==z){this.firstRowOnPage=z;for(let Q of this.allRowGuis)Q.rowComp.toggleCss("ag-row-first",z)}if(this.lastRowOnPage!==J){this.lastRowOnPage=J;for(let Q of this.allRowGuis)Q.rowComp.toggleCss("ag-row-last",J)}}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 z=[];if(this.beans.rowStyleSvc?.processClassesFromGridOptions(z,this.rowNode),!z.length)return;for(let J of z)for(let Q of this.allRowGuis)Q.rowComp.toggleCss(J,!0)}postProcessRowClassRules(){this.beans.rowStyleSvc?.processRowClassRules(this.rowNode,(z)=>{for(let J of this.allRowGuis)J.rowComp.toggleCss(z,!0)},(z)=>{for(let J of this.allRowGuis)J.rowComp.toggleCss(z,!1)})}setStylesFromGridOptions(z,J){if(z)this.rowStyles=this.processStylesFromGridOptions();this.forEachGui(J,(Q)=>Q.rowComp.setUserStyles(this.rowStyles))}getPinnedForContainer(z){if(z==="left"||z==="right")return z;return null}getInitialRowClasses(z){let J=this.getPinnedForContainer(z),Q=this.isFullWidth(),{rowNode:Z,beans:$}=this,X=[];if(X.push("ag-row"),X.push(this.rowFocused?"ag-row-focus":"ag-row-no-focus"),this.fadeInAnimation[z])X.push("ag-opacity-zero");if(X.push(Z.rowIndex%2===0?"ag-row-even":"ag-row-odd"),Z.isRowPinned()){if(X.push("ag-row-pinned"),$.pinnedRowModel?.isManual())X.push("ag-row-pinned-manual")}if(!Z.isRowPinned()&&Z.pinnedSibling)X.push("ag-row-pinned-source");if(Z.isSelected())X.push("ag-row-selected");if(Z.footer)X.push("ag-row-footer");if(X.push("ag-row-level-"+this.rowLevel),Z.stub)X.push("ag-row-loading");if(Q)X.push("ag-full-width-row");if($.expansionSvc?.addExpandedCss(X,Z),Z.dragging)X.push("ag-row-dragging");let{rowStyleSvc:Y}=$;if(Y)Y.processClassesFromGridOptions(X,Z),Y.preProcessRowClassRules(X,Z);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(J==="left")X.push("ag-cell-last-left-pinned");if(J==="right")X.push("ag-cell-first-right-pinned")}return X}processStylesFromGridOptions(){return this.beans.rowStyleSvc?.processStylesFromGridOptions(this.rowNode)??this.emptyStyle}onRowSelected(z){this.beans.selectionSvc?.onRowCtrlSelected(this,(J)=>{if(J===this.centerGui||J===this.fullWidthGui)this.announceDescription()},z)}announceDescription(){this.beans.selectionSvc?.announceAriaRowSelection(this.rowNode)}addHoverFunctionality(z){if(!this.active)return;let{element:J,compBean:Q}=z,{rowNode:Z,beans:$,gos:X}=this;Q.addManagedListeners(J,{pointerenter:(Y)=>{if(Y.pointerType==="mouse")Z.dispatchRowEvent("mouseEnter")},pointerleave:(Y)=>{if(Y.pointerType==="mouse")Z.dispatchRowEvent("mouseLeave")}}),Q.addManagedListeners(Z,{mouseEnter:()=>{if(!$.dragSvc?.dragging&&!X.get("suppressRowHoverHighlight"))J.classList.add("ag-row-hover"),Z.setHovered(!0)},mouseLeave:()=>{this.resetHoveredStatus(J)}})}resetHoveredStatus(z){let J=z?[z]:this.allRowGuis.map((Q)=>Q.element);for(let Q of J)Q.classList.remove("ag-row-hover");this.rowNode.setHovered(!1)}roundRowTopToBounds(z){let J=this.beans.ctrlsSvc.getScrollFeature().getApproximateVScollPosition(),Q=this.applyPaginationOffset(J.top,!0)-100,Z=this.applyPaginationOffset(J.bottom,!0)+100;return Math.min(Math.max(Q,z),Z)}forEachGui(z,J){if(z)J(z);else for(let Q of this.allRowGuis)J(Q)}isRowRendered(){return this.allRowGuis.length>0}onRowHeightChanged(z){if(this.rowNode.rowHeight==null)return;let J=this.rowNode.rowHeight,Q=this.beans.environment.getDefaultRowHeight(),$=e8(this.gos)?k6(this.beans,this.rowNode).height:void 0,X=$?`${Math.min(Q,$)-2}px`:void 0;this.forEachGui(z,(Y)=>{if(Y.element.style.height=`${J}px`,X)Y.element.style.setProperty("--ag-line-height",X)})}destroyFirstPass(z=!1){this.active=!1;let{rowNode:J}=this;if(!z&&P2(this.gos)&&!J.sticky)if(J.rowTop!=null){let $=this.roundRowTopToBounds(J.rowTop);this.setRowTop($)}else for(let $ of this.allRowGuis)$.rowComp.toggleCss("ag-opacity-zero",!0);if(this.fullWidthGui?.element.contains(d(this.beans)))this.beans.focusSvc.attemptToRecoverFocus();J.setHovered(!1);let Q=this.createRowEvent("virtualRowRemoved");this.dispatchLocalEvent(Q),this.beans.eventSvc.dispatchEvent(Q),super.destroy()}destroySecondPass(){this.allRowGuis.length=0;let z=(J)=>{for(let Q of J.list)Q.destroy();return{list:[],map:{}}};this.centerCellCtrls=z(this.centerCellCtrls),this.leftCellCtrls=z(this.leftCellCtrls),this.rightCellCtrls=z(this.rightCellCtrls)}setFocusedClasses(z){this.forEachGui(z,(J)=>{J.rowComp.toggleCss("ag-row-focus",this.rowFocused),J.rowComp.toggleCss("ag-row-no-focus",!this.rowFocused)})}onCellFocusChanged(){let{focusSvc:z}=this.beans,J=z.isRowFocused(this.rowNode.rowIndex,this.rowNode.rowPinned);if(J!==this.rowFocused)this.rowFocused=J,this.setFocusedClasses()}onPaginationChanged(){let z=this.beans.pagination?.getCurrentPage()??0;if(this.paginationPage!==z)this.paginationPage=z,this.onTopChanged();this.refreshFirstAndLastRowStyles()}onTopChanged(){this.setRowTop(this.rowNode.rowTop)}onPaginationPixelOffsetChanged(){this.onTopChanged()}applyPaginationOffset(z,J=!1){if(this.rowNode.isRowPinned()||this.rowNode.sticky)return z;let Q=this.beans.pageBounds.getPixelOffset();return z+Q*(J?1:-1)}setRowTop(z){if(this.printLayout)return;if(T(z)){let J=this.applyPaginationOffset(z),$=`${this.rowNode.isRowPinned()||this.rowNode.sticky?J:this.beans.rowContainerHeight.getRealPixelPosition(J)}px`;this.setRowTopStyle($)}}getInitialRowTop(z){return this.suppressRowTransform?this.getInitialRowTopShared(z):void 0}getInitialTransform(z){return this.suppressRowTransform?void 0:`translateY(${this.getInitialRowTopShared(z)})`}getInitialRowTopShared(z){if(this.printLayout)return"";let J=this.rowNode,Q;if(J.sticky)Q=J.stickyRowTop;else{let Z=this.slideInAnimation[z]?this.roundRowTopToBounds(J.oldRowTop):J.rowTop,$=this.applyPaginationOffset(Z);Q=J.isRowPinned()?$:this.beans.rowContainerHeight.getRealPixelPosition($)}return Q+"px"}setRowTopStyle(z){for(let J of this.allRowGuis)if(this.suppressRowTransform)J.rowComp.setTop(z);else J.rowComp.setTransform(`translateY(${z})`)}getCellCtrl(z,J=!1){let Q=null;for(let Z of this.getAllCellCtrls())if(Z.column==z)Q=Z;if(Q!=null||J)return Q;for(let Z of this.getAllCellCtrls())if(Z?.getColSpanningList().indexOf(z)>=0)Q=Z;return Q}onRowIndexChanged(){if(this.rowNode.rowIndex!=null)this.onCellFocusChanged(),this.updateRowIndexes(),this.postProcessCss()}updateRowIndexes(z){let J=this.rowNode.getRowIndexString();if(J===null)return;let Q=(this.beans.ctrlsSvc.getHeaderRowContainerCtrl()?.getRowCount()??0)+(this.beans.filterManager?.getHeaderRowCount()??0),Z=this.rowNode.rowIndex%2===0,$=this.ariaRowIndex=Q+this.rowNode.rowIndex+1;this.forEachGui(z,(X)=>{X.rowComp.setRowIndex(J),X.rowComp.toggleCss("ag-row-even",Z),X.rowComp.toggleCss("ag-row-odd",!Z),jz(X.element,$)})}},UK=class extends V{constructor(){super();this.beanName="navigation",this.onPageDown=H7(this.onPageDown,100),this.onPageUp=H7(this.onPageUp,100)}postConstruct(){this.beans.ctrlsSvc.whenReady(this,(z)=>{this.gridBodyCon=z.gridBodyCtrl})}handlePageScrollingKey(z,J=!1){let{key:Q,altKey:Z}=z,$=z.ctrlKey||z.metaKey,X=!!this.beans.rangeSvc&&z.shiftKey,Y=rZ(this.gos,z),q=!1;switch(Q){case k.PAGE_HOME:case k.PAGE_END:if(!$&&!Z)this.onHomeOrEndKey(Q),q=!0;break;case k.LEFT:case k.RIGHT:case k.UP:case k.DOWN:if(!Y)return!1;if($&&!Z&&!X)this.onCtrlUpDownLeftRight(Q,Y),q=!0;break;case k.PAGE_DOWN:case k.PAGE_UP:if(!$&&!Z)q=this.handlePageUpDown(Q,Y,J);break}if(q)z.preventDefault();return q}handlePageUpDown(z,J,Q){if(Q)J=this.beans.focusSvc.getFocusedCell();if(!J)return!1;if(z===k.PAGE_UP)this.onPageUp(J);else this.onPageDown(J);return!0}navigateTo({scrollIndex:z,scrollType:J,scrollColumn:Q,focusIndex:Z,focusColumn:$,isAsync:X,rowPinned:Y}){let{scrollFeature:q}=this.gridBodyCon;if(T(Q)&&!Q.isPinned())q.ensureColumnVisible(Q);if(T(z))q.ensureIndexVisible(z,J);if(!X)q.ensureIndexVisible(Z);let{focusSvc:G}=this.beans;G.setFocusedCell({rowIndex:Z,column:$,rowPinned:Y,forceBrowserFocus:!0}),this.setRangeToCellIfSupported({rowIndex:Z,rowPinned:Y,column:$})}onPageDown(z){let J=this.beans,Q=SQ(J),Z=this.getViewportHeight(),{pageBounds:$,rowModel:X,rowAutoHeight:Y}=J,q=$.getPixelOffset(),G=Q.top+Z,H=X.getRowIndexAtPixel(G+q);if(Y?.active)this.navigateToNextPageWithAutoHeight(z,H);else this.navigateToNextPage(z,H)}onPageUp(z){let J=this.beans,Q=SQ(J),{pageBounds:Z,rowModel:$,rowAutoHeight:X}=J,Y=Z.getPixelOffset(),q=Q.top,G=$.getRowIndexAtPixel(q+Y);if(X?.active)this.navigateToNextPageWithAutoHeight(z,G,!0);else this.navigateToNextPage(z,G,!0)}navigateToNextPage(z,J,Q=!1){let{pageBounds:Z,rowModel:$}=this.beans,X=this.getViewportHeight(),Y=Z.getFirstRow(),q=Z.getLastRow(),G=Z.getPixelOffset(),H=$.getRow(z.rowIndex),_=Q?H?.rowHeight-X-G:X-G,U=H?.rowTop+_,W=$.getRowIndexAtPixel(U+G);if(W===z.rowIndex){let E=Q?-1:1;J=W=z.rowIndex+E}let B;if(Q){if(B="bottom",Wq)W=q;if(J>q)J=q}if(this.isRowTallerThanView($.getRow(W)))J=W,B="top";this.navigateTo({scrollIndex:J,scrollType:B,scrollColumn:null,focusIndex:W,focusColumn:z.column})}navigateToNextPageWithAutoHeight(z,J,Q=!1){this.navigateTo({scrollIndex:J,scrollType:Q?"bottom":"top",scrollColumn:null,focusIndex:J,focusColumn:z.column}),setTimeout(()=>{let Z=this.getNextFocusIndexForAutoHeight(z,Q);this.navigateTo({scrollIndex:J,scrollType:Q?"bottom":"top",scrollColumn:null,focusIndex:Z,focusColumn:z.column,isAsync:!0})},50)}getNextFocusIndexForAutoHeight(z,J=!1){let Q=J?-1:1,Z=this.getViewportHeight(),{pageBounds:$,rowModel:X}=this.beans,Y=$.getLastRow(),q=0,G=z.rowIndex;while(G>=0&&G<=Y){let H=X.getRow(G);if(H){let _=H.rowHeight??0;if(q+_>Z)break;q+=_}G+=Q}return Math.max(0,Math.min(G,Y))}getViewportHeight(){let z=this.beans,J=SQ(z),Q=this.beans.scrollVisibleSvc.getScrollbarWidth(),Z=J.bottom-J.top;if(z.ctrlsSvc.get("center").isHorizontalScrollShowing())Z-=Q;return Z}isRowTallerThanView(z){if(!z)return!1;let J=z.rowHeight;if(typeof J!=="number")return!1;return J>this.getViewportHeight()}onCtrlUpDownLeftRight(z,J){let Q=this.beans.cellNavigation.getNextCellToFocus(z,J,!0);if(!Q)return;let Z=this.getNormalisedPosition(Q),{rowIndex:$,rowPinned:X,column:Y}=Z??Q,q=Y;this.navigateTo({scrollIndex:$,scrollType:null,scrollColumn:q,focusIndex:$,focusColumn:q,rowPinned:X})}onHomeOrEndKey(z){let J=z===k.PAGE_HOME,{visibleCols:Q,pageBounds:Z,rowModel:$}=this.beans,X=Q.allCols,Y=J?Z.getFirstRow():Z.getLastRow(),q=$.getRow(Y);if(!q)return;let G=(J?X:[...X].reverse()).find((H)=>!H.isSuppressNavigable(q)&&!b0(H));if(!G)return;this.navigateTo({scrollIndex:Y,scrollType:null,scrollColumn:G,focusIndex:Y,focusColumn:G})}onTabKeyDown(z,J){let Q=J.shiftKey,Z=this.tabToNextCellCommon(z,Q,J),$=this.beans,{ctrlsSvc:X,pageBounds:Y,focusSvc:q,gos:G}=$;if(Z!==!1){if(Z)J.preventDefault();else if(Z===null)X.get("gridCtrl").allowFocusForNextCoreContainer(Q);return}if(Q){let{rowIndex:H,rowPinned:_}=z.getRowPosition();if(_?H===0:H===Y.getFirstRow())if(G.get("headerHeight")===0||D4($))_4($,!0,!0);else J.preventDefault(),q.focusPreviousFromFirstCell(J)}else{if(z instanceof B6)z.focusCell(!0);if(q.focusOverlay(!1)||_4($,Q))J.preventDefault()}}tabToNextCell(z,J){let Q=this.beans,{focusSvc:Z,rowRenderer:$}=Q,X=Z.getFocusedCell();if(!X)return!1;let Y=X4(Q,X);if(!Y){if(Y=$.getRowByPosition(X),!Y?.isFullWidth())return!1}return!!this.tabToNextCellCommon(Y,z,J,"api")}tabToNextCellCommon(z,J,Q,Z="ui"){let{editSvc:$,focusSvc:X}=this.beans,Y=void 0,q=z instanceof B6?z:z.getAllCellCtrls()?.[0];if($?.isEditing())Y=$?.moveToNextCell(q,J,Q,Z);else Y=this.moveToNextCellNotEditing(z,J,Q);if(Y===null)return Y;return Y||!!X.focusedHeader}moveToNextCellNotEditing(z,J,Q){let Z=this.beans.visibleCols.allCols,$;if(z instanceof tQ){if($={...z.getRowPosition(),column:J?Z[0]:b(Z)},this.gos.get("embedFullWidthRows")&&Q){let Y=z.findFullWidthInfoForEvent(Q);if(Y)$.column=Y.column}}else $=z.getFocusedCellPosition();let X=this.findNextCellToFocusOn($,{backwards:J,startEditing:!1});if(X===!1)return null;if(X instanceof B6)X.focusCell(!0);else if(X)return this.tryToFocusFullWidthRow(X,J);return T(X)}findNextCellToFocusOn(z,{backwards:J,startEditing:Q,skipToNextEditableCell:Z}){let $=z,X=this.beans,{cellNavigation:Y,gos:q,focusSvc:G,rowRenderer:H}=X;while(!0){if(z!==$)z=$;if(!J)$=this.getLastCellOfColSpan($);$=Y.getNextTabbedCell($,J);let _=q.getCallback("tabToNextCell");if(T(_)){let E=_({backwards:J,editing:Q,previousCellPosition:z,nextCellPosition:$?$:null});if(E===!0)$=z;else if(E===!1)return!1;else $={rowIndex:E.rowIndex,column:E.column,rowPinned:E.rowPinned}}if(!$)return null;if($.rowIndex<0){let B=Q4(X);return G.focusHeaderPosition({headerPosition:{headerRowIndex:B+$.rowIndex,column:$.column},fromCell:!0}),null}let U=q.get("editType")==="fullRow";if(Q&&(!U||Z)){if(!this.isCellEditable($))continue}this.ensureCellVisible($);let W=X4(X,$);if(!W){let B=H.getRowByPosition($);if(!B||!B.isFullWidth()||Q)continue;return{...B.getRowPosition(),column:$?.column}}if(Y.isSuppressNavigable(W.column,W.rowNode))continue;return W.setFocusedCellPosition($),this.setRangeToCellIfSupported($),W}}isCellEditable(z){let J=this.lookupRowNodeForCell(z);if(J)return z.column.isCellEditable(J);return!1}lookupRowNodeForCell({rowIndex:z,rowPinned:J}){let{pinnedRowModel:Q,rowModel:Z}=this.beans;if(J==="top")return Q?.getPinnedTopRow(z);if(J==="bottom")return Q?.getPinnedBottomRow(z);return Z.getRow(z)}navigateToNextCell(z,J,Q,Z){let $=Q,X=!1,Y=this.beans,{cellNavigation:q,focusSvc:G,gos:H}=Y;while($&&($===Q||!this.isValidNavigateCell($))){if(H.get("enableRtl")){if(J===k.LEFT)$=this.getLastCellOfColSpan($)}else if(J===k.RIGHT)$=this.getLastCellOfColSpan($);$=q.getNextCellToFocus(J,$),X=n($)}if(X&&z&&z.key===k.UP)$={rowIndex:-1,rowPinned:null,column:Q.column};if(Z){let U=H.getCallback("navigateToNextCell");if(T(U)){let B=U({key:J,previousCellPosition:Q,nextCellPosition:$?$:null,event:z});if(T(B))$={rowPinned:B.rowPinned,rowIndex:B.rowIndex,column:B.column};else $=null}}if(!$)return;if($.rowIndex<0){let U=Q4(Y);G.focusHeaderPosition({headerPosition:{headerRowIndex:U+$.rowIndex,column:$.column??Q.column},event:z||void 0,fromCell:!0});return}let _=this.getNormalisedPosition($);if(_)this.focusPosition(_);else this.tryToFocusFullWidthRow($)}getNormalisedPosition(z){if(!!this.beans.spannedRowRenderer?.getCellByPosition(z))return z;this.ensureCellVisible(z);let Q=X4(this.beans,z);if(!Q)return null;return z=Q.getFocusedCellPosition(),this.ensureCellVisible(z),z}tryToFocusFullWidthRow(z,J){let{visibleCols:Q,rowRenderer:Z,focusSvc:$,eventSvc:X}=this.beans,Y=Q.allCols;if(!Z.getRowByPosition(z)?.isFullWidth())return!1;let G=$.getFocusedCell(),H={rowIndex:z.rowIndex,rowPinned:z.rowPinned,column:z.column||(J?b(Y):Y[0])};this.focusPosition(H);let _=J==null?G!=null&&U0(H,G):J;return X.dispatchEvent({type:"fullWidthRowFocused",rowIndex:H.rowIndex,rowPinned:H.rowPinned,column:H.column,isFullWidthCell:!0,fromBelow:_}),!0}focusPosition(z){let{focusSvc:J}=this.beans;J.setFocusedCell({rowIndex:z.rowIndex,column:z.column,rowPinned:z.rowPinned,forceBrowserFocus:!0}),this.setRangeToCellIfSupported(z)}setRangeToCellIfSupported(z){if(b0(z.column))return;this.beans.rangeSvc?.setRangeToCell(z)}isValidNavigateCell(z){return!!f0(this.beans,z)}getLastCellOfColSpan(z){let J=X4(this.beans,z);if(!J)return z;let Q=J.getColSpanningList();if(Q.length===1)return z;return{rowIndex:z.rowIndex,column:b(Q),rowPinned:z.rowPinned}}ensureCellVisible(z){let J=i2(this.gos),Q=this.beans.rowModel.getRow(z.rowIndex),Z=J&&Q?.sticky,{scrollFeature:$}=this.gridBodyCon;if(!Z&&n(z.rowPinned))$.ensureIndexVisible(z.rowIndex);if(!z.column.isPinned())$.ensureColumnVisible(z.column)}ensureColumnVisible(z){let J=this.gridBodyCon.scrollFeature;if(!z.isPinned())J.ensureColumnVisible(z)}ensureRowVisible(z){this.gridBodyCon.scrollFeature.ensureIndexVisible(z)}};function SQ(z){return z.ctrlsSvc.getScrollFeature().getVScrollPosition()}var X2={moduleName:"KeyboardNavigation",version:c,beans:[UK,vE,c3],apiFunctions:{getFocusedCell:IE,clearFocusedCell:CE,setFocusedCell:bE,setFocusedHeader:wE,tabToNextCell:yE,tabToPreviousCell:xE}},WK=class extends V{constructor(){super(...arguments);this.beanName="pageBoundsListener"}postConstruct(){this.addManagedEventListeners({modelUpdated:this.onModelUpdated.bind(this),recalculateRowBounds:this.calculatePages.bind(this)}),this.onModelUpdated()}onModelUpdated(z){this.calculatePages(),this.eventSvc.dispatchEvent({type:"paginationChanged",animate:z?.animate??!1,newData:z?.newData??!1,newPage:z?.newPage??!1,newPageSize:z?.newPageSize??!1,keepRenderedRows:z?.keepRenderedRows??!1})}calculatePages(){let{pageBounds:z,pagination:J,rowModel:Q}=this.beans;if(J)J.calculatePages();else z.calculateBounds(0,Q.getRowCount()-1)}},BK=class extends V{constructor(){super(...arguments);this.beanName="pageBounds",this.pixelOffset=0}getFirstRow(){return this.topRowBounds?.rowIndex??-1}getLastRow(){return this.bottomRowBounds?.rowIndex??-1}getCurrentPageHeight(){let{topRowBounds:z,bottomRowBounds:J}=this;if(!z||!J)return 0;return Math.max(J.rowTop+J.rowHeight-z.rowTop,0)}getCurrentPagePixelRange(){let{topRowBounds:z,bottomRowBounds:J}=this,Q=z?.rowTop??0,Z=J?J.rowTop+J.rowHeight:0;return{pageFirstPixel:Q,pageLastPixel:Z}}calculateBounds(z,J){let{rowModel:Q}=this.beans,Z=Q.getRowBounds(z);if(Z)Z.rowIndex=z;this.topRowBounds=Z;let $=Q.getRowBounds(J);if($)$.rowIndex=J;this.bottomRowBounds=$,this.calculatePixelOffset()}getPixelOffset(){return this.pixelOffset}calculatePixelOffset(){let z=this.topRowBounds?.rowTop??0;if(this.pixelOffset===z)return;this.pixelOffset=z,this.eventSvc.dispatchEvent({type:"paginationPixelOffsetChanged"})}},EK=".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}",KK=class extends V{constructor(z,J){super();this.isLeft=z,this.elements=J,this.getWidth=z?()=>this.beans.pinnedCols.leftWidth:()=>this.beans.pinnedCols.rightWidth}postConstruct(){this.addManagedEventListeners({[`${this.isLeft?"left":"right"}PinnedWidthChanged`]:this.onPinnedWidthChanged.bind(this)})}onPinnedWidthChanged(){let z=this.getWidth(),J=z>0;for(let Q of this.elements)if(Q)w(Q,J),w4(Q,z)}},FK=class extends V{constructor(){super(...arguments);this.beanName="pinnedCols"}postConstruct(){this.beans.ctrlsSvc.whenReady(this,(J)=>{this.gridBodyCtrl=J.gridBodyCtrl});let z=this.checkContainerWidths.bind(this);this.addManagedEventListeners({displayedColumnsChanged:z,displayedColumnsWidthChanged:z}),this.addManagedPropertyListener("domLayout",z)}checkContainerWidths(){let{gos:z,visibleCols:J,eventSvc:Q}=this.beans,Z=A0(z,"print"),$=Z?0:J.getColsLeftWidth(),X=Z?0:J.getDisplayedColumnsRightWidth();if($!=this.leftWidth)this.leftWidth=$,Q.dispatchEvent({type:"leftPinnedWidthChanged"});if(X!=this.rightWidth)this.rightWidth=X,Q.dispatchEvent({type:"rightPinnedWidthChanged"})}keepPinnedColumnsNarrowerThanViewport(){let z=this.gridBodyCtrl.eBodyViewport,J=s1(z);if(J<=50)return;let Q=this.getPinnedColumnsOverflowingViewport(J-50),Z=this.gos.getCallback("processUnpinnedColumns"),{columns:$,hasLockedPinned:X}=Q,Y=$;if(!Y.length&&!X)return;if(Z)Y=Z({columns:Y,viewportWidth:J});if(!Y?.length)return;Y=Y.filter((q)=>!b0(q)),this.setColsPinned(Y,null,"viewportSizeFeature")}createPinnedWidthFeature(z,...J){return new KK(z,J)}setColsPinned(z,J,Q){let{colModel:Z,colAnimation:$,visibleCols:X,gos:Y}=this.beans;if(!Z.cols)return;if(!z?.length)return;if(A0(Y,"print")){R(37);return}$?.start();let q;if(J===!0||J==="left")q="left";else if(J==="right")q="right";else q=null;let G=[];for(let H of z){if(!H)continue;let _=Z.getCol(H);if(!_)continue;if(_.getPinned()!==q)this.setColPinned(_,q),G.push(_)}if(G.length)X.refresh(Q),E$(this.eventSvc,G,Q);$?.finish()}initCol(z){let{pinned:J,initialPinned:Q}=z.colDef;if(J!==void 0)this.setColPinned(z,J);else this.setColPinned(z,Q)}setColPinned(z,J){if(J===!0||J==="left")z.pinned="left";else if(J==="right")z.pinned="right";else z.pinned=null;z.dispatchStateUpdatedEvent("pinned")}setupHeaderPinnedWidth(z){let{scrollVisibleSvc:J}=this.beans;if(z.pinned==null)return;let Q=z.pinned==="left",Z=z.pinned==="right";z.hidden=!0;let $=()=>{let X=Q?this.leftWidth:this.rightWidth;if(X==null)return;let Y=X==0,q=z.hidden!==Y,G=this.gos.get("enableRtl"),H=J.getScrollbarWidth(),U=J.verticalScrollShowing&&(G&&Q||!G&&Z)?X+H:X;if(z.comp.setPinnedContainerWidth(`${U}px`),z.comp.setDisplayed(!Y),q)z.hidden=Y,z.refresh()};z.addManagedEventListeners({leftPinnedWidthChanged:$,rightPinnedWidthChanged:$,scrollVisibilityChanged:$,scrollbarWidthChanged:$})}getHeaderResizeDiff(z,J){if(J.getPinned()){let{leftWidth:Z,rightWidth:$}=this,X=s1(this.beans.ctrlsSvc.getGridBodyCtrl().eBodyViewport)-50;if(Z+$+z>X)if(X>Z+$)z=X-Z-$;else return 0}return z}getPinnedColumnsOverflowingViewport(z){let J=this.rightWidth??0,Q=this.leftWidth??0,Z=J+Q,$=!1;if(Z0){if(G0){let B=Y[H++];if(B.colDef.lockPinned){$=!0;continue}W-=B.getActualWidth(),U.push(B)}}return{columns:U,hasLockedPinned:$}}},LK={moduleName:"PinnedColumn",version:c,beans:[FK],css:[EK]},DK=class extends O0{constructor(){super();this.beanName="ariaAnnounce",this.descriptionContainer=null,this.pendingAnnouncements=new Map,this.lastAnnouncement="",this.updateAnnouncement=p0(this,this.updateAnnouncement.bind(this),200)}postConstruct(){let z=this.beans,J=Y0(z),Q=this.descriptionContainer=J.createElement("div");Q.classList.add("ag-aria-description-container"),R8(Q,"polite"),aq(Q,"additions text"),lq(Q,!0),z.eRootDiv.appendChild(Q)}announceValue(z,J){this.pendingAnnouncements.set(J,z),this.updateAnnouncement()}updateAnnouncement(){if(!this.descriptionContainer)return;let z=Array.from(this.pendingAnnouncements.values()).join(". ");this.pendingAnnouncements.clear(),this.descriptionContainer.textContent="",setTimeout(()=>{this.handleAnnouncementUpdate(z)},50)}handleAnnouncementUpdate(z){if(!this.isAlive()||!this.descriptionContainer)return;let J=z;if(J==null||J.replace(/[ .]/g,"")==""){this.lastAnnouncement="";return}if(this.lastAnnouncement===J)J=`${J}​`;this.lastAnnouncement=J,this.descriptionContainer.textContent=J}destroy(){super.destroy();let{descriptionContainer:z}=this;if(z)J0(z),z.remove();this.descriptionContainer=null,this.pendingAnnouncements.clear()}},MK=class extends DK{},kK={moduleName:"Aria",version:c,beans:[MK]},fK=":where(.ag-delay-render){.ag-cell,.ag-header-cell,.ag-header-group-cell,.ag-row,.ag-spanned-cell-wrapper{visibility:hidden}}",r7="ag-delay-render",VK=class extends V{constructor(){super(...arguments);this.beanName="colDelayRenderSvc",this.hideRequested=!1,this.alreadyRevealed=!1,this.timesRetried=0,this.requesters=new Set}hideColumns(z){if(this.alreadyRevealed||this.requesters.has(z))return;if(this.requesters.add(z),!this.hideRequested)this.beans.ctrlsSvc.whenReady(this,(J)=>{J.gridBodyCtrl.eGridBody.classList.add(r7)}),this.hideRequested=!0}revealColumns(z){if(this.alreadyRevealed||!this.isAlive())return;if(this.requesters.delete(z),this.requesters.size>0)return;let{renderStatus:J,ctrlsSvc:Q}=this.beans;if(J){if(!J.areHeaderCellsRendered()&&this.timesRetried<5){this.timesRetried++,setTimeout(()=>this.revealColumns(z));return}this.timesRetried=0}Q.getGridBodyCtrl().eGridBody.classList.remove(r7),this.alreadyRevealed=!0}},SK={moduleName:"ColumnDelayRender",version:c,beans:[VK],css:[fK]},DJ=class extends y{constructor(){super()}},AK={tag:"div",cls:"ag-overlay-exporting-center",children:[{tag:"span",ref:"eExportingIcon",cls:"ag-loading-icon"},{tag:"span",ref:"eExportingText",cls:"ag-exporting-text"}]},RK=class extends DJ{constructor(){super(...arguments);this.eExportingIcon=j,this.eExportingText=j}init(z){let{beans:J}=this;this.setTemplate(AK);let Q=h("overlayExporting",J,null);if(Q)this.eExportingIcon.appendChild(Q);let Z=z.exporting?.overlayText??this.getLocaleTextFunc()("exportingOoo","Exporting...");this.eExportingText.textContent=Z,J.ariaAnnounce.announceValue(Z,"overlay")}},jK={tag:"div",cls:"ag-overlay-loading-center",children:[{tag:"span",ref:"eLoadingIcon",cls:"ag-loading-icon"},{tag:"span",ref:"eLoadingText",cls:"ag-loading-text"}]},OK=class extends DJ{constructor(){super(...arguments);this.eLoadingIcon=j,this.eLoadingText=j}init(z){let{beans:J,gos:Q}=this,Z=q0(Q.get("overlayLoadingTemplate")?.trim());if(this.setTemplate(Z??jK),!Z){let $=h("overlayLoading",J,null);if($)this.eLoadingIcon.appendChild($);let X=z.loading?.overlayText??this.getLocaleTextFunc()("loadingOoo","Loading...");this.eLoadingText.textContent=X,J.ariaAnnounce.announceValue(X,"overlay")}}},PK={tag:"span",cls:"ag-overlay-no-matching-rows-center"},TK=class extends DJ{init(z){let{beans:J}=this;this.setTemplate(PK);let Q=z.noMatchingRows?.overlayText??this.getLocaleTextFunc()("noMatchingRows","No Matching Rows");this.getGui().textContent=Q,J.ariaAnnounce.announceValue(Q,"overlay")}},vK={tag:"span",cls:"ag-overlay-no-rows-center"},IK=class extends DJ{init(z){let{beans:J,gos:Q}=this,Z=q0(Q.get("overlayNoRowsTemplate")?.trim());if(this.setTemplate(Z??vK),!Z){let $=z.noRows?.overlayText??this.getLocaleTextFunc()("noRowsToShow","No Rows To Show");this.getGui().textContent=$,J.ariaAnnounce.announceValue($,"overlay")}}};function CK(z){z.overlays?.showLoadingOverlay()}function bK(z){z.overlays?.showNoRowsOverlay()}function yK(z){z.overlays?.hideOverlay()}var xK=".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)}",wK={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"}]}]},m$=class extends y{constructor(){super(wK);this.eOverlayWrapper=j,this.activeOverlay=null,this.activePromise=null,this.activeCssClass=null,this.elToFocusAfter=null,this.overlayExclusive=!1,this.oldWrapperPadding=null,this.registerCSS(xK)}handleKeyDown(z){if(z.key!==k.TAB||z.defaultPrevented||q4(z))return;let{beans:J,eOverlayWrapper:Q}=this;if(Q&&P0(J,Q,!1,z.shiftKey))return;let $=!1;if(z.shiftKey)$=J.focusSvc.focusGridView({column:b(J.visibleCols.allCols),backwards:!0,canFocusOverlay:!1});else $=_4(J,!1);if($)z.preventDefault()}updateLayoutClasses(z,J){let Q=this.eOverlayWrapper;if(!Q)return;let Z=Q.classList,{AUTO_HEIGHT:$,NORMAL:X,PRINT:Y}=M4;Z.toggle($,J.autoHeight),Z.toggle(X,J.normal),Z.toggle(Y,J.print)}postConstruct(){this.createManagedBean(new iZ(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(z){let J=this.eOverlayWrapper?.classList;if(!J){this.activeCssClass=null;return}if(this.activeCssClass)J.toggle(this.activeCssClass,!1);this.activeCssClass=z,J.toggle(z,!0)}showOverlay(z,J,Q){if(this.destroyActiveOverlay(),this.elToFocusAfter=null,this.activePromise=z,this.overlayExclusive=Q,!z)return this.refreshWrapperPadding(),N.resolve();if(this.setWrapperTypeClass(J),this.setDisplayed(!0,{skipAriaHidden:!0}),this.refreshWrapperPadding(),Q&&this.isGridFocused()){let Z=d(this.beans);if(Z&&!f1(this.beans))this.elToFocusAfter=Z}return z.then((Z)=>{let $=this.eOverlayWrapper;if(!$){this.destroyBean(Z);return}if(this.activePromise!==z){if(this.activeOverlay!==Z)this.destroyBean(Z),Z=null;return}if(this.activePromise=null,!Z)return;if(this.activeOverlay!==Z)$.appendChild(Z.getGui()),this.activeOverlay=Z;if(Q&&this.isGridFocused())k0($)}),z}refreshWrapperPadding(){if(!this.eOverlayWrapper){this.oldWrapperPadding=null;return}let z=!!this.activeOverlay||!!this.activePromise,J=0;if(z&&!this.overlayExclusive)J=this.beans.ctrlsSvc.get("gridHeaderCtrl")?.headerHeight||0;if(J!==this.oldWrapperPadding)this.oldWrapperPadding=J,this.eOverlayWrapper.style.setProperty("padding-top",`${J}px`)}destroyActiveOverlay(){this.activePromise=null;let z=this.activeOverlay;if(!z){this.overlayExclusive=!1,this.elToFocusAfter=null,this.refreshWrapperPadding();return}let J=this.elToFocusAfter;if(this.elToFocusAfter=null,this.activeOverlay=null,this.overlayExclusive=!1,J&&!this.isGridFocused())J=null;this.destroyBean(z);let Q=this.eOverlayWrapper;if(Q)J0(Q);J?.focus?.({preventScroll:!0}),this.refreshWrapperPadding()}hideOverlay(){this.destroyActiveOverlay(),this.setDisplayed(!1,{skipAriaHidden:!0})}isGridFocused(){let z=d(this.beans);return!!z&&this.beans.eGridDiv.contains(z)}destroy(){this.elToFocusAfter=null,this.destroyActiveOverlay(),this.beans.overlays.setWrapperComp(this,!0),super.destroy(),this.eOverlayWrapper=null}},NK={selector:"AG-OVERLAY-WRAPPER",component:m$},gK=["refresh"],d6=(z)=>({name:z,optionalMethods:gK}),m1={id:"agLoadingOverlay",overlayType:"loading",comp:d6("loadingOverlayComponent"),wrapperCls:"ag-overlay-loading-wrapper",exclusive:!0,compKey:"loadingOverlayComponent",paramsKey:"loadingOverlayComponentParams",isSuppressed:(z)=>{let J=z.get("loading");return J===!1||z.get("suppressLoadingOverlay")===!0&&J!==!0}},A2={id:"agNoRowsOverlay",overlayType:"noRows",comp:d6("noRowsOverlayComponent"),wrapperCls:"ag-overlay-no-rows-wrapper",compKey:"noRowsOverlayComponent",paramsKey:"noRowsOverlayComponentParams",isSuppressed:(z)=>z.get("suppressNoRowsOverlay")},$5={id:"agNoMatchingRowsOverlay",overlayType:"noMatchingRows",comp:d6("noMatchingRowsOverlayComponent"),wrapperCls:"ag-overlay-no-matching-rows-wrapper"},pz={id:"agExportingOverlay",overlayType:"exporting",comp:d6("exportingOverlayComponent"),wrapperCls:"ag-overlay-exporting-wrapper",exclusive:!0},Az={id:"activeOverlay",comp:d6("activeOverlay"),wrapperCls:"ag-overlay-modal-wrapper",exclusive:!0},hK=(z)=>{if(!z)return null;return{agLoadingOverlay:m1,agNoRowsOverlay:A2,agNoMatchingRowsOverlay:$5,agExportingOverlay:pz}[z]??Az},uK=(z)=>{if(!z)return null;return{loading:m1,noRows:A2,noMatchingRows:$5,exporting:pz}[z]},mK=class extends V{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 z=this.gos;this.showInitialOverlay=o(z);let J=()=>{if(this.userForcedNoRows)return;this.updateOverlay(!1)},[Q,Z,$,X]=this.addManagedEventListeners({newColumnsLoaded:J,rowCountReady:()=>{this.disableInitialOverlay(),J(),Z()},rowDataUpdated:J,modelUpdated:J});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,J){if(!this.isAlive())return;if(!J)this.eWrapper=z;else if(this.eWrapper===z)this.eWrapper=void 0;this.updateOverlay(!1)}isVisible(){return!!this.currentDef}showLoadingOverlay(){this.showInitialOverlay=!1;let z=this.gos;if(!this.eWrapper||z.get("activeOverlay"))return;if(this.isDisabled(m1))return;let J=z.get("loading");if(!J&&J!==void 0)return;this.doShowOverlay(m1)}showNoRowsOverlay(){this.showInitialOverlay=!1;let z=this.gos;if(!this.eWrapper||z.get("activeOverlay")||z.get("loading")||this.isDisabled(A2))return;this.userForcedNoRows=!0,this.doShowOverlay(A2)}async showExportOverlay(z){let{gos:J,beans:Q}=this;if(!this.eWrapper||J.get("activeOverlay")||J.get("loading")||this.isDisabled(pz)||this.userForcedNoRows&&this.currentDef===A2){z();return}let Z=this.getDesiredDefWithOverride(pz);if(!Z){z();return}this.exportsInProgress++,this.focusedCell=Q.focusSvc.getFocusedCell(),await this.doShowOverlay(Z),await new Promise((X)=>setTimeout(()=>X()));let $=Date.now();try{z()}finally{let X=Date.now()-$,Y=Math.max(0,300-X),q=()=>{if(this.exportsInProgress--,this.exportsInProgress===0)this.updateOverlay(!1),F_(Q,this.focusedCell),this.focusedCell=null};if(Y>0)setTimeout(()=>q(),Y);else q()}}hideOverlay(){let z=this.gos;this.showInitialOverlay=!1;let J=this.userForcedNoRows;if(this.userForcedNoRows=!1,z.get("loading")){R(99);return}if(z.get("activeOverlay")){R(296);return}if(this.currentDef===$5){R(297);return}if(this.doHideOverlay(),J){if(this.getOverlayDef()!==A2)this.updateOverlay(!1)}}getOverlayWrapperSelector(){return NK}getOverlayWrapperCompClass(){return m$}onPropChange(z){let J=z.has("activeOverlay");if(J||z.has("loading")){if(this.updateOverlay(J))return}let Q=this.currentDef,Z=this.eWrapper?.activeOverlay;if(Z&&Q){let $=z.has("activeOverlayParams");if(Q===Az){if($)Z.refresh?.(this.makeCompParams(!0))}else{let X=Q.paramsKey;if(z.has("overlayComponentParams")||X&&z.has(X))Z.refresh?.(this.makeCompParams(!1,X,Q.overlayType))}}}updateOverlay(z){let J=this.eWrapper;if(!J)return this.currentDef=null,!1;let Q=this.getDesiredDefWithOverride(),Z=this.currentDef,$=Q===Az&&z;if(Q!==Z){if(!Q)return this.disableInitialOverlay(),this.doHideOverlay();return this.doShowOverlay(Q),!0}if($&&Q)return J.hideOverlay(),this.doShowOverlay(Q),!0;if(!Q)this.disableInitialOverlay();return!1}getDesiredDefWithOverride(z){let{gos:J}=this,Q=hK(J.get("activeOverlay"));if(!Q){if(Q=z??this.getOverlayDef(),Q&&this.isDisabled(Q))Q=null}return Q}getOverlayDef(){let{gos:z,beans:J}=this,{rowModel:Q}=J,Z=z.get("loading");if(Z!==void 0){if(this.disableInitialOverlay(),Z)return m1}else if(this.showInitialOverlay){if(!this.isDisabled(m1)&&(!z.get("columnDefs")||!z.get("rowData")))return m1;this.disableInitialOverlay()}else this.disableInitialOverlay();let X=Q.getOverlayType();return uK(X)}disableInitialOverlay(){this.showInitialOverlay=!1,this.newColumnsLoadedCleanup?.(),this.newColumnsLoadedCleanup=null}doShowOverlay(z){let{gos:J,beans:Q}=this,{userCompFactory:Z}=Q;this.currentDef=z;let $=z!==Az,X=!!z.exclusive;this.exclusive=X;let Y;if(z.paramsKey&&J.get(z.paramsKey)||z.compKey&&J.get(z.compKey))Y=z.paramsKey;let q=void 0;if($){if(J.get("overlayComponent")||J.get("overlayComponentSelector"))q=Z.getCompDetailsFromGridOptions({name:"overlayComponent",optionalMethods:["refresh"]},void 0,this.makeCompParams(!1,z.paramsKey,z.overlayType))}q??(q=Z.getCompDetailsFromGridOptions(z.comp,$?z.id:void 0,this.makeCompParams(!$,Y,z.overlayType),!1));let G=q?.newAgStackInstance()??null,H=this.eWrapper?this.eWrapper.showOverlay(G,z.wrapperCls,X):N.resolve();return this.eWrapper?.refreshWrapperPadding(),this.setExclusive(X),H}makeCompParams(z,J,Q){let{gos:Z}=this,$=z?Z.get("activeOverlayParams"):{...Z.get("overlayComponentParams"),...J&&Z.get(J)||null,overlayType:Q};return C(Z,$??{})}doHideOverlay(){let z=!1;if(this.currentDef)this.currentDef=null,z=!0;this.exclusive=!1;let J=this.eWrapper;if(J)J.hideOverlay(),J.refreshWrapperPadding(),this.setExclusive(!1);return z}setExclusive(z){if(this.oldExclusive!==z)this.oldExclusive=z,this.eventSvc.dispatchEvent({type:"overlayExclusiveChanged"})}isDisabled(z){let{gos:J}=this;return z.overlayType&&J.get("suppressOverlays")?.includes(z.overlayType)||z.isSuppressed?.(J)===!0}},cK={moduleName:"Overlay",version:c,userComponents:{agLoadingOverlay:OK,agNoRowsOverlay:IK,agNoMatchingRowsOverlay:TK,agExportingOverlay:RK},apiFunctions:{showLoadingOverlay:CK,showNoRowsOverlay:bK,hideOverlay:yK},icons:{overlayLoading:"loading",overlayExporting:"loading"},beans:[mK]},pK=class extends V{constructor(){super(...arguments);this.beanName="rowContainerHeight",this.scrollY=0,this.uiBodyHeight=0}postConstruct(){this.addManagedEventListeners({bodyHeightChanged:this.updateOffset.bind(this)}),this.maxDivHeight=sH(),D6(this.gos,"RowContainerHeightService - maxDivHeight = "+this.maxDivHeight)}updateOffset(){if(!this.stretching)return;let z=this.beans.ctrlsSvc.getScrollFeature().getVScrollPosition().top,J=this.getUiBodyHeight();if(z!==this.scrollY||J!==this.uiBodyHeight)this.scrollY=z,this.uiBodyHeight=J,this.calculateOffset()}calculateOffset(){this.setUiContainerHeight(this.maxDivHeight),this.pixelsToShave=this.modelHeight-this.uiContainerHeight,this.maxScrollY=this.uiContainerHeight-this.uiBodyHeight;let z=this.scrollY/this.maxScrollY,J=z*this.pixelsToShave;D6(this.gos,`RowContainerHeightService - Div Stretch Offset = ${J} (${this.pixelsToShave} * ${z})`),this.setDivStretchOffset(J)}setUiContainerHeight(z){if(z!==this.uiContainerHeight)this.uiContainerHeight=z,this.eventSvc.dispatchEvent({type:"rowContainerHeightChanged"})}clearOffset(){this.setUiContainerHeight(this.modelHeight),this.pixelsToShave=0,this.setDivStretchOffset(0)}setDivStretchOffset(z){let J=typeof z==="number"?Math.floor(z):null;if(this.divStretchOffset===J)return;this.divStretchOffset=J,this.eventSvc.dispatchEvent({type:"heightScaleChanged"})}setModelHeight(z){if(this.modelHeight=z,this.stretching=z!=null&&this.maxDivHeight>0&&z>this.maxDivHeight,this.stretching)this.calculateOffset();else this.clearOffset()}getRealPixelPosition(z){return z-this.divStretchOffset}getUiBodyHeight(){let z=this.beans.ctrlsSvc.getScrollFeature().getVScrollPosition();return z.bottom-z.top}getScrollPositionForPixel(z){if(this.pixelsToShave<=0)return z;let J=this.modelHeight-this.getUiBodyHeight(),Q=z/J;return this.maxScrollY*Q}},iK=400,dK=class extends V{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 z=()=>{for(let X of this.getAllCellCtrls())X.onCellSelectionChanged()},J=()=>{for(let X of this.getAllCellCtrls())X.updateRangeBordersIfRangeCount()},Q=()=>{this.eventSvc.addListener("cellSelectionChanged",z),this.eventSvc.addListener("columnMoved",J),this.eventSvc.addListener("columnPinned",J),this.eventSvc.addListener("columnVisible",J)},Z=()=>{this.eventSvc.removeListener("cellSelectionChanged",z),this.eventSvc.removeListener("columnMoved",J),this.eventSvc.removeListener("columnPinned",J),this.eventSvc.removeListener("columnVisible",J)};if(this.addDestroyFunc(()=>Z()),this.addManagedPropertyListeners(["enableRangeSelection","cellSelection"],()=>{if(d0(this.gos))Q();else Z()}),d0(this.gos))Q()}}wireBeans(z){this.pageBounds=z.pageBounds,this.colModel=z.colModel,this.pinnedRowModel=z.pinnedRowModel,this.rowModel=z.rowModel,this.focusSvc=z.focusSvc,this.rowContainerHeight=z.rowContainerHeight,this.ctrlsSvc=z.ctrlsSvc,this.editSvc=z.editSvc}postConstruct(){this.ctrlsSvc.whenReady(this,(z)=>{this.gridBodyCtrl=z.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",(Z)=>this.onSuppressCellFocusChanged(Z.currentValue)),this.addManagedPropertyListeners(["groupSuppressBlankHeader","getBusinessKeyForNode","fullWidthCellRenderer","fullWidthCellRendererParams","suppressStickyTotalRow","groupRowRenderer","groupRowRendererParams","loadingCellRenderer","loadingCellRendererParams","detailCellRenderer","detailCellRendererParams","enableRangeSelection","enableCellTextSelection"],()=>this.redrawRows()),this.addManagedPropertyListener("cellSelection",({currentValue:Z,previousValue:$})=>{if(!$&&Z||$&&!Z)this.redrawRows()});let{stickyRowSvc:z,gos:J,showRowGroupCols:Q}=this.beans;if(Q)this.addManagedPropertyListener("showOpenedGroup",()=>{let Z=Q.columns;if(Z.length)this.refreshCells({columns:Z,force:!0})});if(z)this.stickyRowFeature=z.createStickyRowFeature(this,this.createRowCon.bind(this),this.destroyRowCtrls.bind(this));else{let Z=this.gridBodyCtrl;Z.setStickyTopHeight(0),Z.setStickyBottomHeight(0)}this.registerCellEventListeners(),this.initialiseCache(),this.printLayout=A0(J,"print"),this.embedFullWidthRows=this.printLayout||J.get("embedFullWidthRows"),this.redrawAfterModelUpdate()}initialiseCache(){if(this.gos.get("keepDetailRows")){let z=this.getKeepDetailRowsCount(),J=z!=null?z:3;this.cachedRowCtrls=new nK(J)}}getKeepDetailRowsCount(){return this.gos.get("keepDetailRowsCount")}getStickyTopRowCtrls(){return this.stickyRowFeature?.stickyTopRowCtrls??[]}getStickyBottomRowCtrls(){return this.stickyRowFeature?.stickyBottomRowCtrls??[]}updateAllRowCtrls(){let z=Object.values(this.rowCtrlsByRowIndex),J=Object.values(this.zombieRowCtrls),Q=this.cachedRowCtrls?.getEntries()??[];if(J.length>0||Q.length>0)this.allRowCtrls=[...z,...J,...Q];else this.allRowCtrls=z}isCellBeingRendered(z,J){let Q=this.rowCtrlsByRowIndex[z];if(!J||!Q)return!!Q;if(Q.isFullWidth())return!0;return!!this.beans.spannedRowRenderer?.getCellByPosition({rowIndex:z,column:J,rowPinned:null})||!!Q.getCellCtrl(J)||!Q.isRowRendered()}updateCellFocus(z){for(let J of this.getAllCellCtrls())J.onCellFocused(z);for(let J of this.getFullWidthRowCtrls())J.onFullWidthRowFocused(z)}onCellFocusChanged(z){if(z?.rowIndex!=null&&!z.rowPinned){let J=this.beans.colModel.getCol(z.column)??void 0;if(!this.isCellBeingRendered(z.rowIndex,J))this.redraw()}this.updateCellFocus(z)}onSuppressCellFocusChanged(z){for(let J of this.getAllCellCtrls())J.onSuppressCellFocusChanged(z);for(let J of this.getFullWidthRowCtrls())J.onSuppressCellFocusChanged(z)}registerCellEventListeners(){this.addManagedEventListeners({cellFocused:(z)=>this.onCellFocusChanged(z),cellFocusCleared:()=>this.updateCellFocus(),flashCells:(z)=>{let{cellFlashSvc:J}=this.beans;if(J)for(let Q of this.getAllCellCtrls())J.onFlashCells(Q,z)},columnHoverChanged:()=>{for(let z of this.getAllCellCtrls())z.onColumnHover()},displayedColumnsChanged:()=>{for(let z of this.getAllCellCtrls())z.onDisplayedColumnsChanged()},displayedColumnsWidthChanged:()=>{if(this.printLayout)for(let z of this.getAllCellCtrls())z.onLeftChanged()}}),this.setupRangeSelectionListeners(),this.refreshListenersToColumnsForCellComps(),this.addManagedEventListeners({gridColumnsChanged:this.refreshListenersToColumnsForCellComps.bind(this)}),this.addDestroyFunc(this.removeGridColumnListeners.bind(this))}removeGridColumnListeners(){for(let z of this.destroyFuncsForColumnListeners)z();this.destroyFuncsForColumnListeners.length=0}refreshListenersToColumnsForCellComps(){this.removeGridColumnListeners();let z=this.colModel.getCols();for(let J of z){let Q=(G)=>{for(let H of this.getAllCellCtrls())if(H.column===J)G(H)},Z=()=>{Q((G)=>G.onLeftChanged())},$=()=>{Q((G)=>G.onWidthChanged())},X=()=>{Q((G)=>G.onFirstRightPinnedChanged())},Y=()=>{Q((G)=>G.onLastLeftPinnedChanged())},q=()=>{Q((G)=>G.onColDefChanged())};J.__addEventListener("leftChanged",Z),J.__addEventListener("widthChanged",$),J.__addEventListener("firstRightPinnedChanged",X),J.__addEventListener("lastLeftPinnedChanged",Y),J.__addEventListener("colDefChanged",q),this.destroyFuncsForColumnListeners.push(()=>{J.__removeEventListener("leftChanged",Z),J.__removeEventListener("widthChanged",$),J.__removeEventListener("firstRightPinnedChanged",X),J.__removeEventListener("lastLeftPinnedChanged",Y),J.__removeEventListener("colDefChanged",q)})}}onDomLayoutChanged(){let z=A0(this.gos,"print"),J=z||this.gos.get("embedFullWidthRows"),Q=J!==this.embedFullWidthRows||this.printLayout!==z;if(this.printLayout=z,this.embedFullWidthRows=J,Q)this.redrawAfterModelUpdate({domLayoutChanged:!0})}datasourceChanged(){this.firstRenderedRow=0,this.lastRenderedRow=-1;let z=Object.keys(this.rowCtrlsByRowIndex);this.removeRowCtrls(z)}onPageLoaded(z){let J={recycleRows:z.keepRenderedRows,animate:z.animate,newData:z.newData,newPage:z.newPage,onlyBody:!0};this.redrawAfterModelUpdate(J)}getAllCellsNotSpanningForColumn(z){let J=[];for(let Q of this.getAllRowCtrls()){let Z=Q.getCellCtrl(z,!0)?.eGui;if(Z)J.push(Z)}return J}refreshFloatingRowComps(z=!0){this.refreshFloatingRows(this.topRowCtrls,"top",z),this.refreshFloatingRows(this.bottomRowCtrls,"bottom",z)}refreshFloatingRows(z,J,Q){let{pinnedRowModel:Z,beans:$,printLayout:X}=this,Y=Object.fromEntries(z.map((G)=>[G.rowNode.id,G]));Z?.forEachPinnedRow(J,(G,H)=>{let _=z[H];if(_&&Z.getPinnedRowById(_.rowNode.id,J)===void 0)_.destroyFirstPass(),_.destroySecondPass();if(G.id in Y&&Q)z[H]=Y[G.id],delete Y[G.id];else z[H]=new tQ(G,$,!1,!1,X)});let q=(J==="top"?Z?.getPinnedTopRowCount():Z?.getPinnedBottomRowCount())??0;z.length=q}onPinnedRowDataChanged(){let z={recycleRows:!0};this.redrawAfterModelUpdate(z)}onPinnedRowsChanged(){this.redrawAfterModelUpdate({recycleRows:!0})}redrawRow(z,J=!1){if(z.sticky)this.stickyRowFeature?.refreshStickyNode(z);else if(this.cachedRowCtrls?.has(z)){this.cachedRowCtrls.removeRow(z);return}else{let Q=(Z)=>{let $=Z[z.rowIndex];if(!$)return;if($.rowNode!==z)return;$.destroyFirstPass(),$.destroySecondPass(),Z[z.rowIndex]=this.createRowCon(z,!1,!1)};switch(z.rowPinned){case"top":Q(this.topRowCtrls);break;case"bottom":Q(this.bottomRowCtrls);break;default:Q(this.rowCtrlsByRowIndex),this.updateAllRowCtrls()}}if(!J)this.dispatchDisplayedRowsChanged(!1)}redrawRows(z){let{editSvc:J}=this.beans;if(J?.isEditing())if(J.isBatchEditing())J.cleanupEditors();else J.stopEditing(void 0,{source:"api"});if(z!=null){for(let Z of z??[])this.redrawRow(Z,!0);this.dispatchDisplayedRowsChanged(!1);return}this.redrawAfterModelUpdate()}redrawAfterModelUpdate(z={}){this.getLockOnRefresh();let J=this.beans.focusSvc?.getFocusCellToUseAfterRefresh();this.updateContainerHeights(),this.scrollToTopIfNewData(z);let Q=!z.domLayoutChanged&&!!z.recycleRows,Z=z.animate&&P2(this.gos),$=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),this.gridBodyCtrl.updateRowCount(),!z.onlyBody)this.refreshFloatingRowComps(Y.get("enableRowPinning")?Q:void 0);if(this.dispatchDisplayedRowsChanged(),J!=null)this.restoreFocusedCell(J);this.releaseLockOnRefresh()}scrollToTopIfNewData(z){let J=z.newData||z.newPage,Q=this.gos.get("suppressScrollOnNewData");if(J&&!Q)this.gridBodyCtrl.scrollFeature.scrollToTop(),this.stickyRowFeature?.resetOffsets()}updateContainerHeights(z=0){let{rowContainerHeight:J}=this;if(this.printLayout){J.setModelHeight(null);return}let Q=this.pageBounds.getCurrentPageHeight();if(Q===0)Q=1;J.setModelHeight(Q+z)}getLockOnRefresh(){if(this.refreshInProgress)throw Error(Y4(252));this.refreshInProgress=!0,this.beans.frameworkOverrides.getLockOnRefresh?.()}releaseLockOnRefresh(){this.refreshInProgress=!1,this.beans.frameworkOverrides.releaseLockOnRefresh?.()}isRefreshInProgress(){return this.refreshInProgress}restoreFocusedCell(z){if(!z)return;let J=this.beans.focusSvc,Q=this.findPositionToFocus(z);if(!Q){J.focusHeaderPosition({headerPosition:{headerRowIndex:Q4(this.beans)-1,column:z.column}});return}if(z.rowIndex!==Q.rowIndex||z.rowPinned!=Q.rowPinned){J.setFocusedCell({...Q,preventScrollOnBrowserFocus:!0,forceBrowserFocus:!0});return}if(!J.doesRowOrCellHaveBrowserFocus())this.updateCellFocus(C(this.gos,{...Q,forceBrowserFocus:!0,preventScrollOnBrowserFocus:!0,type:"cellFocused"}))}findPositionToFocus(z){let{pagination:J,pageBounds:Q}=this.beans,Z=z;if(Z.rowPinned==null&&J&&Q&&!J.isRowInPage(Z.rowIndex))Z={rowPinned:null,rowIndex:Q.getFirstRow()};while(Z){if(Z.rowPinned==null&&Q){if(Z.rowIndexQ.getLastRow())Z={rowPinned:null,rowIndex:Q.getLastRow()}}let $=this.getRowByPosition(Z);if($?.isAlive())return{...$.getRowPosition(),column:z.column};Z=n0(this.beans,Z)}return null}getAllCellCtrls(){let z=[],J=this.getAllRowCtrls(),Q=J.length;for(let Z=0;Z{let $=Z.rowNode;return l7($,J)})}getCellCtrls(z,J){let Q;if(T(J))Q={},J.forEach(($)=>{let X=this.colModel.getCol($);if(T(X))Q[X.getId()]=!0});let Z=[];for(let $ of this.getRowCtrls(z))for(let X of $.getAllCellCtrls()){let Y=X.column.getId();if(Q&&!Q[Y])continue;Z.push(X)}return Z}destroy(){this.removeAllRowComps(!0),super.destroy()}removeAllRowComps(z=!1){let J=Object.keys(this.rowCtrlsByRowIndex);this.removeRowCtrls(J,z),this.stickyRowFeature?.destroyStickyCtrls()}getRowsToRecycle(){let z=[];for(let Q of Object.keys(this.rowCtrlsByRowIndex))if(this.rowCtrlsByRowIndex[Q].rowNode.id==null)z.push(Q);this.removeRowCtrls(z);let J={};for(let Q of Object.values(this.rowCtrlsByRowIndex)){let Z=Q.rowNode;J[Z.id]=Q}return this.rowCtrlsByRowIndex={},J}removeRowCtrls(z,J=!1){for(let Q of z){let Z=this.rowCtrlsByRowIndex[Q];if(Z)Z.destroyFirstPass(J),Z.destroySecondPass();delete this.rowCtrlsByRowIndex[Q]}}onBodyScroll(z){if(z.direction!=="vertical")return;this.redraw({afterScroll:!0})}redraw(z={}){let{focusSvc:J,animationFrameSvc:Q}=this.beans,{afterScroll:Z}=z,$,X=this.stickyRowFeature;if(X)$=J?.getFocusCellToUseAfterRefresh()||void 0;let Y=this.firstRenderedRow,q=this.lastRenderedRow;this.workOutFirstAndLastRowsToRender();let G=!1;if(X){G=X.checkStickyRows();let _=X.extraTopHeight+X.extraBottomHeight;if(_)this.updateContainerHeights(_)}let H=this.firstRenderedRow!==Y||this.lastRenderedRow!==q;if(Z&&!G&&!H)return;if(this.getLockOnRefresh(),this.recycleRows(null,!1,Z),this.releaseLockOnRefresh(),this.dispatchDisplayedRowsChanged(Z&&!G),$!=null){let _=J?.getFocusCellToUseAfterRefresh();if($!=null&&_==null)Q?.flushAllFrames(),this.restoreFocusedCell($)}}removeRowCompsNotToDraw(z,J){let Q={};for(let X of z)Q[X]=!0;let $=Object.keys(this.rowCtrlsByRowIndex).filter((X)=>!Q[X]);this.removeRowCtrls($,J)}calculateIndexesToDraw(z){let J=[];for(let Y=this.firstRenderedRow;Y<=this.lastRenderedRow;Y++)J.push(Y);let Q=this.beans.pagination,Z=this.beans.focusSvc?.getFocusedCell()?.rowIndex;if(Z!=null&&(Zthis.lastRenderedRow)&&(!Q||Q.isRowInPage(Z))&&Z{let q=Y.rowNode.rowIndex;if(q==null||q===Z)return;if(qthis.lastRenderedRow){if(this.doNotUnVirtualiseRow(Y))J.push(q)}};for(let Y of Object.values(this.rowCtrlsByRowIndex))$(Y);if(z)for(let Y of Object.values(z))$(Y);J.sort((Y,q)=>Y-q);let X=[];for(let Y=0;Y{this.destroyRowCtrls(z,J),this.updateAllRowCtrls(),this.dispatchDisplayedRowsChanged()});else this.destroyRowCtrls(z,J)}this.updateAllRowCtrls()}dispatchDisplayedRowsChanged(z=!1){this.eventSvc.dispatchEvent({type:"displayedRowsChanged",afterScroll:z})}onDisplayedColumnsChanged(){let{visibleCols:z}=this.beans,J=z.isPinningLeft(),Q=z.isPinningRight();if(this.pinningLeft!==J||Q!==this.pinningRight){if(this.pinningLeft=J,this.pinningRight=Q,this.embedFullWidthRows)this.redrawFullWidthEmbeddedRows()}}redrawFullWidthEmbeddedRows(){let z=[];for(let J of this.getFullWidthRowCtrls()){let Q=J.rowNode.rowIndex;z.push(Q.toString())}this.refreshFloatingRowComps(),this.removeRowCtrls(z),this.redraw({afterScroll:!0})}getFullWidthRowCtrls(z){let J=s7(z);return this.getAllRowCtrls().filter((Q)=>{if(!Q.isFullWidth())return!1;let Z=Q.rowNode;if(J!=null&&!l7(Z,J))return!1;return!0})}createOrUpdateRowCtrl(z,J,Q,Z){let $,X=this.rowCtrlsByRowIndex[z];if(!X){if($=this.rowModel.getRow(z),T($)&&T(J)&&J[$.id]&&$.alreadyRendered)X=J[$.id],J[$.id]=null}if(!X){if(!$)$=this.rowModel.getRow(z);if(T($))X=this.createRowCon($,Q,Z);else return}if($)$.alreadyRendered=!0;this.rowCtrlsByRowIndex[z]=X}destroyRowCtrls(z,J){let Q=[];if(z)for(let Z of Object.values(z)){if(!Z)continue;if(this.cachedRowCtrls&&Z.isCacheable()){this.cachedRowCtrls.addRow(Z);continue}if(Z.destroyFirstPass(!J),J){let $=Z.instanceId;this.zombieRowCtrls[$]=Z,Q.push(()=>{Z.destroySecondPass(),delete this.zombieRowCtrls[$]})}else Z.destroySecondPass()}if(J)Q.push(()=>{if(this.isAlive())this.updateAllRowCtrls(),this.dispatchDisplayedRowsChanged()}),window.setTimeout(()=>{for(let Z of Q)Z()},iK)}getRowBuffer(){return this.gos.get("rowBuffer")}getRowBufferInPixels(){let z=this.getRowBuffer(),J=z9(this.beans);return z*J}workOutFirstAndLastRowsToRender(){let{rowContainerHeight:z,pageBounds:J,rowModel:Q}=this;z.updateOffset();let Z,$;if(!Q.isRowsToRender())Z=0,$=-1;else if(this.printLayout)this.beans.environment.refreshRowHeightVariable(),Z=J.getFirstRow(),$=J.getLastRow();else{let _=this.getRowBufferInPixels(),U=this.ctrlsSvc.getScrollFeature(),W=this.gos.get("suppressRowVirtualisation"),B=!1,E,K;do{let f=J.getPixelOffset(),{pageFirstPixel:S,pageLastPixel:A}=J.getCurrentPagePixelRange(),O=z.divStretchOffset,v=U.getVScrollPosition(),I=v.top,x=v.bottom;if(W)E=S+O,K=A+O;else E=Math.max(I+f-_,S)+O,K=Math.min(x+f+_,A)+O;this.firstVisibleVPixel=Math.max(I+f,S)+O,this.lastVisibleVPixel=Math.min(x+f,A)+O,B=this.ensureAllRowsInRangeHaveHeightsCalculated(E,K)}while(B);let F=Q.getRowIndexAtPixel(E),L=Q.getRowIndexAtPixel(K),D=J.getFirstRow(),M=J.getLastRow();if(FM)L=M;Z=F,$=L}let X=A0(this.gos,"normal"),Y=this.gos.get("suppressMaxRenderedRowRestriction"),q=Math.max(this.getRowBuffer(),500);if(X&&!Y){if($-Z>q)$=Z+q}let G=Z!==this.firstRenderedRow,H=$!==this.lastRenderedRow;if(G||H)this.firstRenderedRow=Z,this.lastRenderedRow=$,this.eventSvc.dispatchEvent({type:"viewportChanged",firstRow:Z,lastRow:$})}dispatchFirstDataRenderedEvent(){if(this.dataFirstRenderedFired)return;this.dataFirstRenderedFired=!0,W4(this.beans,()=>{this.beans.eventSvc.dispatchEvent({type:"firstDataRendered",firstRow:this.firstRenderedRow,lastRow:this.lastRenderedRow})})}ensureAllRowsInRangeHaveHeightsCalculated(z,J){let Q=this.pinnedRowModel?.ensureRowHeightsValid(),Z=this.stickyRowFeature?.ensureRowHeightsValid(),{pageBounds:$,rowModel:X}=this,Y=X.ensureRowHeightsValid(z,J,$.getFirstRow(),$.getLastRow());if(Y||Z)this.eventSvc.dispatchEvent({type:"recalculateRowBounds"});if(Z||Y||Q)return this.updateContainerHeights(),!0;return!1}doNotUnVirtualiseRow(z){let Z=z.rowNode,$=this.focusSvc.isRowFocused(Z.rowIndex,Z.rowPinned),X=this.editSvc?.isEditing(z),Y=Z.detail;if(!($||X||Y))return!1;return this.isRowPresent(Z)?!0:!1}isRowPresent(z){if(!this.rowModel.isRowPresent(z))return!1;return this.beans.pagination?.isRowInPage(z.rowIndex)??!0}createRowCon(z,J,Q){let Z=this.cachedRowCtrls?.getRow(z)??null;if(Z)return Z;let $=Q&&!this.printLayout&&!!this.beans.animationFrameSvc?.active;return new tQ(z,this.beans,J,$,this.printLayout)}getRenderedNodes(){let z=Object.values(this.rowCtrlsByRowIndex).map((Z)=>Z.rowNode),J=this.getStickyTopRowCtrls().map((Z)=>Z.rowNode),Q=this.getStickyBottomRowCtrls().map((Z)=>Z.rowNode);return[...J,...z,...Q]}getRowByPosition(z){let J,{rowIndex:Q}=z;switch(z.rowPinned){case"top":J=this.topRowCtrls[Q];break;case"bottom":J=this.bottomRowCtrls[Q];break;default:if(J=this.rowCtrlsByRowIndex[Q],!J){if(J=this.getStickyTopRowCtrls().find((Z)=>Z.rowNode.rowIndex===Q)||null,!J)J=this.getStickyBottomRowCtrls().find((Z)=>Z.rowNode.rowIndex===Q)||null}break}return J}isRangeInRenderedViewport(z,J){if(z==null||J==null)return!1;let Z=z>this.lastRenderedRow;return!(Jthis.maxCount){let J=this.entriesList[0];J.destroyFirstPass(),J.destroySecondPass(),this.removeFromCache(J)}}getRow(z){if(z?.id==null)return null;let J=this.entriesMap[z.id];if(!J)return null;return this.removeFromCache(J),J.setCached(!1),J.rowNode!=z?null:J}has(z){return this.entriesMap[z.id]!=null}removeRow(z){let J=z.id,Q=this.entriesMap[J];delete this.entriesMap[J],X0(this.entriesList,Q)}removeFromCache(z){let J=z.rowNode.id;delete this.entriesMap[J],X0(this.entriesList,z)}getEntries(){return this.entriesList}};function s7(z){if(!z)return;let J={top:{},bottom:{},normal:{}};for(let Q of z){let Z=Q.id;switch(Q.rowPinned){case"top":J.top[Z]=Q;break;case"bottom":J.bottom[Z]=Q;break;default:J.normal[Z]=Q;break}}return J}function l7(z,J){let Q=z.id;switch(z.rowPinned){case"top":return J.top[Q]!=null;case"bottom":return J.bottom[Q]!=null;default:return J.normal[Q]!=null}}var tK=class extends V{constructor(){super(...arguments);this.beanName="rowNodeSorter",this.accentedSort=!1,this.primaryColumnsSortGroups=!1,this.pivotActive=!1}postConstruct(){this.firstLeaf=o(this.gos)?$2:rK,this.addManagedPropertyListeners(["accentedSort","autoGroupColumnDef","treeData"],this.updateOptions.bind(this));let z=this.updatePivotModeState.bind(this);this.addManagedEventListeners({columnPivotModeChanged:z,columnPivotChanged:z}),this.updateOptions(),z()}updateOptions(){this.accentedSort=!!this.gos.get("accentedSort"),this.primaryColumnsSortGroups=k4(this.gos)}updatePivotModeState(){this.pivotActive=this.beans.colModel.isPivotActive()}doFullSortInPlace(z,J){return z.sort((Q,Z)=>this.compareRowNodes(J,Q,Z))}compareRowNodes(z,J,Q){if(J===Q)return 0;let Z=this.accentedSort;for(let $=0,X=z.length;${if(z.data)return z;let J=z.childrenAfterGroup;while(J?.length){let Q=J[0];if(Q.data)return Q;J=Q.childrenAfterGroup}},a7=(z)=>{if(!z)return z;if(typeof z==="bigint")return z<0n?-z:z;let J=Number(z);return isNaN(J)?z:Math.abs(J)};function sK(z){z.sortSvc?.onSortChanged("api")}var h1=(z,J)=>({tag:"span",ref:`eSort${z}`,cls:`ag-sort-indicator-icon ag-sort-${J} ag-hidden`,attrs:{"aria-hidden":"true"}}),lK={tag:"span",cls:"ag-sort-indicator-container",children:[h1("Order","order"),h1("Asc","ascending-icon"),h1("Desc","descending-icon"),h1("Mixed","mixed-icon"),h1("AbsoluteAsc","absolute-ascending-icon"),h1("AbsoluteDesc","absolute-descending-icon"),h1("None","none-icon")]},X5=class extends y{constructor(z){super();if(this.eSortOrder=j,this.eSortAsc=j,this.eSortDesc=j,this.eSortMixed=j,this.eSortNone=j,this.eSortAbsoluteAsc=j,this.eSortAbsoluteDesc=j,!z)this.setTemplate(lK)}attachCustomElements(z,J,Q,Z,$,X,Y){this.eSortOrder=z,this.eSortAsc=J,this.eSortDesc=Q,this.eSortMixed=Z,this.eSortNone=$,this.eSortAbsoluteAsc=X,this.eSortAbsoluteDesc=Y}setupSort(z,J=!1,Q){if(this.column=z,this.suppressOrder=J,this.getSortDefOverride=Q,this.setupMultiSortIndicator(),!z.isSortable()&&!z.getColDef().showRowGroup)return;this.addInIcon("sortAscending",this.eSortAsc,z),this.addInIcon("sortDescending",this.eSortDesc,z),this.addInIcon("sortUnSort",this.eSortNone,z),this.addInIcon("sortAbsoluteAscending",this.eSortAbsoluteAsc,z),this.addInIcon("sortAbsoluteDescending",this.eSortAbsoluteDesc,z);let Z=this.updateIcons.bind(this),$=this.onSortChanged.bind(this);this.addManagedPropertyListener("unSortIcon",Z),this.addManagedEventListeners({newColumnsLoaded:Z,sortChanged:$,columnRowGroupChanged:$}),this.onSortChanged()}addInIcon(z,J,Q){if(J==null)return;let Z=h(z,this.beans,Q);if(Z)J.appendChild(Z)}onSortChanged(){if(this.updateIcons(),!this.suppressOrder)this.updateSortOrder()}updateIcons(){let{eSortAsc:z,eSortDesc:J,eSortAbsoluteAsc:Q,eSortAbsoluteDesc:Z,eSortNone:$,column:X,gos:Y,beans:q}=this,G=AZ(X,q,this.getSortDefOverride),H=G.isDefaultSortAllowed,_=G.isAbsoluteSortAllowed,{isAbsoluteSort:U,isDefaultSort:W,isAscending:B,isDescending:E,direction:K}=G;if(z)w(z,B&&W&&H,{skipAriaHidden:!0});if(J)w(J,E&&W&&H,{skipAriaHidden:!0});if($){let F=!X.getColDef().unSortIcon&&!Y.get("unSortIcon");w($,!F&&!K,{skipAriaHidden:!0})}if(Q)w(Q,B&&U&&_,{skipAriaHidden:!0});if(Z)w(Z,E&&U&&_,{skipAriaHidden:!0})}setupMultiSortIndicator(){let{eSortMixed:z,column:J,gos:Q}=this;this.addInIcon("sortUnSort",z,J);let Z=J.getColDef().showRowGroup;if(k4(Q)&&Z)this.addManagedEventListeners({sortChanged:this.updateMultiSortIndicator.bind(this),columnRowGroupChanged:this.updateMultiSortIndicator.bind(this)}),this.updateMultiSortIndicator()}updateMultiSortIndicator(){let{eSortMixed:z,beans:J,column:Q}=this;if(z){let Z=J.sortSvc.getDisplaySortForColumn(Q)?.direction==="mixed";w(z,Z,{skipAriaHidden:!0})}}updateSortOrder(){let{eSortOrder:z,column:J,beans:{sortSvc:Q}}=this;if(!z)return;let Z=Q.getColumnsWithSortingOrdered(),$=Q.getDisplaySortIndexForColumn(J)??-1,X=Z.some((q)=>Q.getDisplaySortIndexForColumn(q)??!1),Y=$>=0&&X;if(w(z,Y,{skipAriaHidden:!0}),$>=0)z.textContent=($+1).toString();else J0(z)}refresh(){this.onSortChanged()}},aK={selector:"AG-SORT-INDICATOR",component:X5},oK=class extends V{constructor(){super(...arguments);this.beanName="sortSvc"}progressSort(z,J,Q){let Z=this.getNextSortDirection(z);this.setSortForColumn(z,Z,J,Q)}progressSortFromEvent(z,J){let Z=this.gos.get("multiSortKey")==="ctrl"?J.ctrlKey||J.metaKey:J.shiftKey;this.progressSort(z,Z,"uiColumnSorted")}setSortForColumn(z,J,Q,Z){let{gos:$,showRowGroupCols:X}=this.beans,Y=k4($),q=[z];if(Y){if(z.getColDef().showRowGroup){let U=X?.getSourceColumnsForGroupColumn?.(z)?.filter((W)=>W.isSortable());if(U)q=[z,...U]}}for(let _ of q)this.setColSort(_,J,Z);let G=(Q||$.get("alwaysMultiSort"))&&!$.get("suppressMultiSort"),H=[];if(!G){let _=this.clearSortBarTheseColumns(q,Z);H.push(..._)}this.updateSortIndex(z),H.push(...q),this.dispatchSortChangedEvents(Z,H)}updateSortIndex(z){let{gos:J,colModel:Q,showRowGroupCols:Z}=this.beans,$=k4(J),X=Z?.getShowRowGroupCol(z.getId()),Y=$?X||z:z,q=this.getColumnsWithSortingOrdered();Q.forAllCols((_)=>this.setColSortIndex(_,null));let G=q.filter((_)=>{if($&&_.getColDef().showRowGroup)return!1;return _!==Y});(Y.getSortDef()?[...G,Y]:G).forEach((_,U)=>this.setColSortIndex(_,U))}onSortChanged(z,J){this.dispatchSortChangedEvents(z,J)}isSortActive(){let z=!1;return this.beans.colModel.forAllCols((J)=>{if(J.getSortDef())return z=!0,!0}),z}dispatchSortChangedEvents(z,J){let Q={type:"sortChanged",source:z};if(J)Q.columns=J;this.eventSvc.dispatchEvent(Q)}clearSortBarTheseColumns(z,J){let Q=[];return this.beans.colModel.forAllCols((Z)=>{if(!z.includes(Z)){if(Z.getSortDef())Q.push(Z);this.setColSort(Z,void 0,J)}}),Q}getNextSortDirection(z,J){let Q=z.getSortingOrder(),Z=J===void 0?z.getSortDef():Z4(J),X=Q.findIndex((Y)=>kz(Y,Z))+1;if(X>=Q.length)X=0;return Z4(Q[X])}getIndexedSortMap(){let{gos:z,colModel:J,showRowGroupCols:Q,rowGroupColsSvc:Z}=this.beans,$=[];if(J.forAllCols((H)=>{if(H.getSortDef())$.push(H)}),J.isPivotMode()){let H=k4(z);$=$.filter((_)=>{let U=!!_.getAggFunc(),W=!_.isPrimary(),B=H?Q?.getShowRowGroupCol(_.getId()):_.getColDef().showRowGroup;return U||W||B})}let X=Z?.columns.filter((H)=>!!H.getSortDef())??[],Y={};$.forEach((H,_)=>Y[H.getId()]=_),$.sort((H,_)=>{let U=H.getSortIndex(),W=_.getSortIndex();if(U!=null&&W!=null)return U-W;else if(U==null&&W==null){let B=Y[H.getId()],E=Y[_.getId()];return B>E?1:-1}else if(W==null)return-1;else return 1});let q=k4(z)&&!!X.length;if(q)$=[...new Set($.map((H)=>Q?.getShowRowGroupCol(H.getId())??H))];let G=new Map;if($.forEach((H,_)=>G.set(H,_)),q)for(let H of X){let _=Q.getShowRowGroupCol(H.getId());G.set(H,G.get(_))}return G}getColumnsWithSortingOrdered(){return[...this.getIndexedSortMap().entries()].sort(([,z],[,J])=>z-J).map(([z])=>z)}collectSortItems(z=!1){let J=[],Q=this.getColumnsWithSortingOrdered();for(let Z of Q){let $=Z.getSortDef()?.direction;if(!$)continue;let X=j4(Z.getSortDef()?.type),Y={sort:$,type:X};if(z)Y.colId=Z.getId();else Y.column=Z;J.push(Y)}return J}getSortModel(){return this.collectSortItems(!0)}getSortOptions(){return this.collectSortItems()}canColumnDisplayMixedSort(z){let J=k4(this.gos),Q=!!z.getColDef().showRowGroup;return J&&Q}getDisplaySortForColumn(z){let J=this.beans.showRowGroupCols?.getSourceColumnsForGroupColumn(z);if(!this.canColumnDisplayMixedSort(z)||!J?.length)return z.getSortDef();let Z=z.getColDef().field!=null||!!z.getColDef().valueGetter?[z,...J]:J,$=Z[0].getSortDef();if(!Z.every((Y)=>kz(Y.getSortDef(),$)))return{type:j4(z.getSortDef()?.type),direction:"mixed"};return $}getDisplaySortIndexForColumn(z){return this.getIndexedSortMap().get(z)}setupHeader(z,J){let Q=()=>{let{type:Z,direction:$}=Z4(J.getSortDef());if(z.toggleCss("ag-header-cell-sorted-asc",$==="asc"),z.toggleCss("ag-header-cell-sorted-desc",$==="desc"),z.toggleCss("ag-header-cell-sorted-abs-asc",Z==="absolute"&&$==="asc"),z.toggleCss("ag-header-cell-sorted-abs-desc",Z==="absolute"&&$==="desc"),z.toggleCss("ag-header-cell-sorted-none",!$),J.getColDef().showRowGroup){let q=!this.beans.showRowGroupCols?.getSourceColumnsForGroupColumn(J)?.every((G)=>$==G.getSortDef()?.direction);z.toggleCss("ag-header-cell-sorted-mixed",q)}};z.addManagedEventListeners({sortChanged:Q,columnPinned:Q,columnRowGroupChanged:Q,displayedColumnsChanged:Q})}initCol(z){let{sortIndex:J,initialSortIndex:Q}=z.colDef,Z=D9(z.colDef);if(Z)z.setSortDef(Z,!0);if(J!==void 0){if(J!==null)z.sortIndex=J}else if(Q!==null)z.sortIndex=Q}updateColSort(z,J,Q){if(J===void 0)return;this.setColSort(z,Z4(J),Q)}setColSort(z,J,Q){if(!kz(z.getSortDef(),J))z.setSortDef(Z4(J),J===void 0),z.dispatchColEvent("sortChanged",Q);z.dispatchStateUpdatedEvent("sort")}setColSortIndex(z,J){z.sortIndex=J,z.dispatchStateUpdatedEvent("sortIndex")}createSortIndicator(z){return new X5(z)}getSortIndicatorSelector(){return aK}},c$={moduleName:"Sort",version:c,beans:[oK,tK],apiFunctions:{onSortChanged:sK},userComponents:{agSortIndicator:X5},icons:{sortAscending:"asc",sortDescending:"desc",sortUnSort:"none",sortAbsoluteAscending:"aasc",sortAbsoluteDescending:"adesc"}},eK=class extends V{constructor(){super(...arguments);this.beanName="syncSvc",this.waitingForColumns=!1}postConstruct(){this.addManagedPropertyListener("columnDefs",(z)=>this.setColumnDefs(z))}start(){this.beans.ctrlsSvc.whenReady(this,()=>{let z=this.gos.get("columnDefs");if(z)this.setColumnsAndData(z);else this.waitingForColumns=!0;this.gridReady()})}setColumnsAndData(z){let{colModel:J,rowModel:Q}=this.beans;J.setColumnDefs(z??[],"gridInitializing"),Q.start()}gridReady(){let{eventSvc:z,gos:J}=this;z.dispatchEvent({type:"gridReady"}),D6(J,`initialised successfully, enterprise = ${J.isModuleRegistered("EnterpriseCore")}`)}setColumnDefs(z){let J=this.gos.get("columnDefs");if(!J)return;if(this.waitingForColumns){this.waitingForColumns=!1,this.setColumnsAndData(J);return}this.beans.colModel.setColumnDefs(J,F1(z.source))}};var zF="paste",JF=class extends V{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=xZ(this.beans),this.addManagedEventListeners({cellValueChanged:this.onCellValueChanged.bind(this)})}beginDeferred(){this.deferredDepth++}endDeferred(){if(this.deferredDepth===0)return;if(--this.deferredDepth>0)return;let z=this.batchedPath,J=this.batchedNodes;if(this.batchedPath=null,this.batchedNodes=null,z)this.csrm?.doAggregate(z);let{rowRenderer:Q}=this.beans;if(J)for(let Z of J)o7(Q,Z);if(z){let Z=z.getSortedRows();for(let $=0,X=Z.length;${let{sibling:Q,pinnedSibling:Z}=J;z.refreshRowByNode(J),z.refreshRowByNode(Q),z.refreshRowByNode(Z),z.refreshRowByNode(Q?.pinnedSibling),z.refreshRowByNode(Z?.sibling)},QF=class extends V{constructor(){super(...arguments);this.beanName="expressionSvc",this.cache={}}evaluate(z,J){if(typeof z==="string")return this.evaluateExpression(z,J);else t(15,{expression:z})}evaluateExpression(z,J){try{return this.createExpressionFunction(z)(J.value,J.context,J.oldValue,J.newValue,J.value,J.node,J.data,J.colDef,J.rowIndex,J.api,J.getValue,J.column,J.columnGroup)}catch(Q){return t(16,{expression:z,params:J,e:Q}),null}}createExpressionFunction(z){let J=this.cache;if(J[z])return J[z];let Q=this.createFunctionBody(z),Z=Function("x, ctx, oldValue, newValue, value, node, data, colDef, rowIndex, api, getValue, column, columnGroup",Q);return J[z]=Z,Z}createFunctionBody(z){if(z.includes("return"))return z;else return"return "+z+";"}};var ZF={moduleName:"Expression",version:c,beans:[QF]},$F={moduleName:"ChangeDetection",version:c,beans:[JF]};var XF=class extends V{constructor(){super(...arguments);this.beanName="valueSvc",this.initialised=!1,this.isSsrm=!1}wireBeans(z){this.expressionSvc=z.expressionSvc,this.colModel=z.colModel,this.valueCache=z.valueCache,this.dataTypeSvc=z.dataTypeSvc,this.editSvc=z.editSvc,this.formulaDataSvc=z.formulaDataSvc,this.rowGroupColsSvc=z.rowGroupColsSvc}postConstruct(){if(!this.initialised)this.init()}init(){let{gos:z,valueCache:J}=this;this.executeValueGetter=J?this.executeValueGetterWithValueCache.bind(this):this.executeValueGetterWithoutValueCache.bind(this),this.isSsrm=V1(z),this.cellExpressions=z.get("enableCellExpressions"),this.isTreeData=z.get("treeData"),this.initialised=!0;let Q=(Z)=>this.callColumnCellValueChangedHandler(Z);this.eventSvc.addListener("cellValueChanged",Q,!0),this.addDestroyFunc(()=>this.eventSvc.removeListener("cellValueChanged",Q,!0)),this.addManagedPropertyListener("treeData",(Z)=>this.isTreeData=Z.currentValue)}getValueForDisplay(z){let J=this.beans,Q=z.column,Z=z.node,$=J.showRowGroupColValueSvc,X=!Q&&Z.group,Y=Q?.colDef.showRowGroup,q=!this.isTreeData||Z.footer;if($&&q&&(X||Y)){let W=$.getGroupValue(Z,Q,this.displayIgnoresAggData(Z));if(W==null)return{value:null,valueFormatted:null};return{value:W.value,valueFormatted:z.includeValueFormatted?$.formatAndPrefixGroupColValue(W,Q,z.exporting):null}}if(!Q)return{value:Z.key,valueFormatted:null};let G=this.getValue(Q,Z,z.from,this.displayIgnoresAggData(Z)),H=G,_=J.formula;if(Q.isAllowFormula()&&_?.isFormula(G))if(z.useRawFormula)G=_.normaliseFormula(G,!0),H=_.resolveValue(Q,Z);else G=_.resolveValue(Q,Z),H=G;let U=z.includeValueFormatted&&!(z.exporting&&Q.colDef.useValueFormatterForExport===!1);return{value:G,valueFormatted:U?this.formatValue(Q,Z,H):null}}getValue(z,J,Q,Z=!1){if(!this.initialised)this.init();if(!J)return;let $=z.colDef,X=J.group;if(!X){let G=$.pivotValueColumn;if(G)z=G}let Y=this.editSvc?.getPendingEditValue(J,z,Q);if(Y!==void 0)return Y;let q=this.resolveValue(z,J,Z,X);if(q===void 0){if(X){let G=$.showRowGroup;if(typeof G==="string"){let H=this.rowGroupColsSvc?.getColumnIndex(G);if(H!=null&&H>J.level)return null}}return}if(this.cellExpressions&&Rz(q)){let G=q.substring(1);q=this.executeValueGetter(G,J.data,z,J)}return q}displayIgnoresAggData(z){if(!z.group||z.footer||z.level===-1)return!1;if(!z.sibling||this.gos.get("groupSuppressBlankHeader"))return!1;if(z.leafGroup&&this.colModel.isPivotMode())return!1;return!!z.expanded}resolveValue(z,J,Q,Z){let{colDef:$,colId:X}=z,Y=!Z&&this.formulaDataSvc;if(Y&&Y.hasDataSource()&&$.allowFormula===!0){let D=Y.getFormula({column:z,rowNode:J});if(Rz(D))return D}let q=Z&&!Q?J.aggData:void 0,G=this.isTreeData;if(G&&q?.[X]!==void 0)return q[X];let H=J.data,_=$.field,U=$.valueGetter;if(G){if(U)return this.executeValueGetter(U,H,z,J);if(_&&H)return W6(H,_,z.isFieldContainsDots())}let W=J.groupData;if(W&&X in W)return W[X];if(q?.[X]!==void 0)return q[X];let B=$.showRowGroup,E=typeof B!=="string"||!Z,K=this.isSsrm,F=K&&Q&&!!$.aggFunc;if(U&&!F)return E?this.executeValueGetter(U,H,z,J):void 0;if(K&&J.footer&&J.field&&(B===!0||B===J.field))return W6(H,J.field,z.isFieldContainsDots());if(_&&H&&!F)return E?W6(H,_,z.isFieldContainsDots()):void 0;return}parseValue(z,J,Q,Z){let $=z.getColDef();if($.allowFormula&&this.beans.formula?.isFormula(Q))return Q;let X=$.valueParser;if(T(X)){let Y=C(this.gos,{node:J,data:J?.data,oldValue:Z,newValue:Q,colDef:$,column:z});if(typeof X==="function")return X(Y);return this.expressionSvc?.evaluate(X,Y)}return Q}getDeleteValue(z,J){if(T(z.getColDef().valueParser))return this.parseValue(z,J,"",this.getValueForDisplay({column:z,node:J,from:"edit"}).value)??null;return null}formatValue(z,J,Q,Z,$=!0){let{expressionSvc:X}=this.beans,Y=null,q,G=z.getColDef();if(Z)q=Z;else if($)q=G.valueFormatter;if(q){let H=J?J.data:null,_=C(this.gos,{value:Q,node:J,data:H,colDef:G,column:z});if(typeof q==="function")Y=q(_);else Y=X?X.evaluate(q,_):null}else if(G.refData)return G.refData[Q]||"";if(Y==null&&Array.isArray(Q))Y=Q.join(", ");return Y}setValue(z,J,Q,Z){let $=J.getColDef();if(!z.data&&this.canCreateRowNodeData(z,$))z.data={};if(!this.isSetValueSupported(J,z,Q,$))return!1;let X=this.getValue(J,z,"data"),Y=C(this.gos,{node:z,data:z.data,oldValue:X,newValue:Q,colDef:$,column:J}),q=!1;if(z.data){let H=this.handleExternalFormulaChange({column:J,eventSource:Z,newValue:Q,setterParams:Y,rowNode:z});if(H!==null)return H;q=this.computeValueChange({column:J,rowNode:z,newValue:Q,params:Y,rowData:z.data,valueSetter:$.valueSetter,field:$.field})??!0}let G=this.beans.changeDetectionSvc;G?.beginDeferred();try{if(z.group){let H=this.beans.rowGroupingEditValueSvc?.setGroupDataValue(z,J,Q,X,Z,q||Q!==X);if(H!==void 0){if(!q&&!H)return!1;return this.finishValueChange(z,J,Y,Z,Q)}}if(!q)return!1;return this.finishValueChange(z,J,Y,Z)}finally{G?.endDeferred()}}canCreateRowNodeData(z,J){if(!z.group)return!0;if(J.groupRowValueSetter!=null||J.groupRowEditable!=null)return!1;if(J.pivotValueColumn)return!1;return!0}finishValueChange(z,J,Q,Z,$){z.resetQuickFilterAggregateText(),this.valueCache?.onDataChanged();let X=$===void 0?this.getValue(J,z,"data"):$;if(this.dispatchCellValueChangedEvent(z,Q,X,Z),z.pinnedSibling)this.dispatchCellValueChangedEvent(z.pinnedSibling,Q,X,Z);return!0}isSetValueSupported(z,J,Q,Z){let{field:$,valueSetter:X}=Z,Y=this.beans.formula,q=z.isAllowFormula()&&Y?.isFormula(Q),G=!!this.formulaDataSvc?.hasDataSource();if(n($)&&n(X)&&!(G&&q)){if(J.group&&(Z.groupRowValueSetter||Z.groupRowEditable))return!0;return R(17),!1}if(this.dataTypeSvc&&!this.dataTypeSvc.checkType(z,Q))return R(135),!1;return!0}handleExternalFormulaChange(z){let{column:J,rowNode:Q,newValue:Z,eventSource:$,setterParams:X}=z,Y=this.beans.formula,q=this.formulaDataSvc;if(!q?.hasDataSource()||!J.isAllowFormula())return null;let G=Y?.isFormula(Z),H=q.getFormula({column:J,rowNode:Q});if(G){if(H===Z)return!1;q.setFormula({column:J,rowNode:Q,formula:Z});let U=Y?.resolveValue(J,Q),W=J.getColDef();if(T(W.valueSetter)||!n(W.field)){let B={...X,newValue:U};this.computeValueChange({column:J,rowNode:Q,newValue:U,params:B,rowData:Q.data,valueSetter:W.valueSetter,field:W.field})}return this.finishValueChange(Q,J,X,$)}if(H!==void 0)q.setFormula({column:J,rowNode:Q,formula:void 0});return null}computeValueChange(z){let{valueSetter:J,params:Q,rowData:Z,field:$,column:X,newValue:Y}=z;if(T(J)){if(typeof J==="function")return J(Q);return this.expressionSvc?.evaluate(J,Q)}return!!Z&&this.setValueUsingField(Z,$,Y,X.isFieldContainsDots())}dispatchCellValueChangedEvent(z,J,Q,Z){this.eventSvc.dispatchEvent({type:"cellValueChanged",event:null,rowIndex:z.rowIndex,rowPinned:z.rowPinned,column:J.column,colDef:J.colDef,data:z.data,node:z,oldValue:J.oldValue,newValue:Q,newRawValue:J.newValue,value:Q,source:Z})}callColumnCellValueChangedHandler(z){let J=z.colDef.onCellValueChanged;if(typeof J==="function")this.beans.frameworkOverrides.wrapOutgoing(()=>{J(z)})}setValueUsingField(z,J,Q,Z){if(!J)return!1;let $=!1;if(!Z){if($=z[J]===Q,!$)z[J]=Q}else{let X=J.split("."),Y=z;while(X.length>0&&Y){let q=X.shift();if(X.length===0){if($=Y[q]===Q,!$)Y[q]=Q}else Y=Y[q]}}return!$}executeValueGetterWithValueCache(z,J,Q,Z){let $=Q.getColId(),X=this.valueCache.getValue(Z,$);if(X!==void 0)return X;let Y=this.executeValueGetterWithoutValueCache(z,J,Q,Z);return this.valueCache.setValue(Z,$,Y),Y}executeValueGetterWithoutValueCache(z,J,Q,Z){let $=C(this.gos,{data:J,node:Z,column:Q,colDef:Q.getColDef(),getValue:(Y)=>this.getValueCallback(Z,Y)}),X;if(typeof z==="function")X=z($);else X=this.expressionSvc?.evaluate(z,$);return X}getValueCallback(z,J){let Q=this.colModel.getColDefCol(J);if(Q)return this.getValue(Q,z,"data");return null}getKeyForNode(z,J){let Q=this.getValue(z,J,"data"),Z=z.getColDef().keyCreator,$=Q;if(Z){let X=C(this.gos,{value:Q,colDef:z.getColDef(),column:z,node:J,data:J.data});$=Z(X)}if(typeof $==="string"||$==null)return $;if($=String($),$==="[object Object]")R(121);return $}},YF={moduleName:"CommunityCore",version:c,beans:[t3,bU,VB,DH,pK,gW,m3,EE,pW,BK,WK,dK,XF,d3,h3,n3,AB,eK,KB,FB,jE],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:yU,destroy:xU,isDestroyed:wU,getGridOption:NU,setGridOption:gU,updateGridOptions:$$,isModuleRegistered:hU},dependsOn:[BB,i6,SW,c$,VE,aZ,SE,cK,$F,RE,X2,LK,kK,TE,MB,EB,ZF,eW,SK]};function rQ(z){let{inputValue:J,allSuggestions:Q,hideIrrelevant:Z,filterByPercentageOfBestMatch:$}=z,X=(Q??[]).map((G,H)=>({value:G,relevance:qF(J,G),idx:H}));if(X.sort((G,H)=>G.relevance-H.relevance),Z)X=X.filter((G)=>G.relevance0&&$&&$>0){let H=X[0].relevance*$;X=X.filter((_)=>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 qF(z,J){let Q=z.length,Z=J.length;if(Z===0)return Q?Q:0;let $=z.toLocaleLowerCase(),X=J.toLocaleLowerCase(),Y;if(z.length1&&E>1){let L=z[U-2],D=$[U-2],M=J[E-2],f=X[E-2];if(D===f){if(H++,L===M)H++}}if(U<_)H++;G[E]=q[E-1]}Y=q,q=G,G=Y}return q[Z]/(H+1)}var p$={AdvancedFilter:1,AiToolkit:1,AllEnterprise:1,BatchEdit:1,CellSelection:1,Clipboard:1,ColumnMenu:1,ColumnsToolPanel:1,ContextMenu:1,ExcelExport:1,FiltersToolPanel:1,Find:1,GridCharts:1,IntegratedCharts:1,GroupFilter:1,MasterDetail:1,Menu:1,MultiFilter:1,NewFiltersToolPanel:1,Pivot:1,RangeSelection:1,RichSelect:1,RowNumbers:1,RowGrouping:1,RowGroupingEdit:1,RowGroupingPanel:1,ServerSideRowModelApi:1,ServerSideRowModel:1,SetFilter:1,SideBar:1,Sparklines:1,StatusBar:1,TreeData:1,ViewportRowModel:1,Formula:1},AQ=["TextFilter","NumberFilter","BigIntFilter","DateFilter","SetFilter","MultiFilter","GroupFilter","CustomFilter"],GF={EditCore:["TextEditor","NumberEditor","DateEditor","CheckboxEditor","LargeTextEditor","SelectEditor","RichSelect","CustomEditor"],CheckboxCellRenderer:["AllCommunity"],ClientSideRowModelHierarchy:["RowGrouping","Pivot","TreeData"],ColumnFilter:AQ,ColumnGroupHeaderComp:["AllCommunity"],ColumnGroup:["AllCommunity"],ColumnHeaderComp:["AllCommunity"],ColumnMove:["AllCommunity"],ColumnResize:["AllCommunity"],CommunityCore:["AllCommunity"],CsrmSsrmSharedApi:["ClientSideRowModelApi","ServerSideRowModelApi"],RowModelSharedApi:["ClientSideRowModelApi","ServerSideRowModelApi"],EnterpriseCore:["AllEnterprise"],FilterCore:[...AQ,"QuickFilter","ExternalFilter","AdvancedFilter"],GroupCellRenderer:["RowGrouping","Pivot","TreeData","MasterDetail","ServerSideRowModel"],KeyboardNavigation:["AllCommunity"],LoadingCellRenderer:["ServerSideRowModel"],MenuCore:["ColumnMenu","ContextMenu"],MenuItem:["ColumnMenu","ContextMenu","MultiFilter","IntegratedCharts","ColumnsToolPanel"],Overlay:["AllCommunity"],PinnedColumn:["AllCommunity"],SharedAggregation:["RowGrouping","Pivot","TreeData","ServerSideRowModel"],SharedDragAndDrop:["AllCommunity"],SharedMasterDetail:["MasterDetail","ServerSideRowModel"],SharedMenu:[...AQ,"ColumnMenu","ContextMenu"],SharedPivot:["Pivot","ServerSideRowModel"],SharedRowGrouping:["RowGrouping","ServerSideRowModel"],SharedRowSelection:["RowSelection","ServerSideRowModel"],SkeletonCellRenderer:["ServerSideRowModel"],Sort:["AllCommunity"],SsrmInfiniteSharedApi:["InfiniteRowModel","ServerSideRowModelApi"],SharedTreeData:["TreeData","ServerSideRowModel"]},HF={InfiniteRowModel:"infinite",ClientSideRowModelApi:"clientSide",ClientSideRowModel:"clientSide",ServerSideRowModelApi:"serverSide",ServerSideRowModel:"serverSide",ViewportRowModel:"viewport"};function _F(z,J){let Q=[];for(let Z of Array.isArray(z)?z:[z]){let $=GF[Z];if($)for(let X of $){let Y=HF[X];if(!Y||Y===J)Q.push(X)}else Q.push(Z)}return Q}var i$=()=>`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 ]); + `,UF=(z)=>{let J=z.map((Z)=>`import { ${E6(Z)} } from '${p$[Z]?"ag-grid-enterprise":"ag-grid-community"}';`);if(z.some((Z)=>Z==="IntegratedCharts"||Z==="Sparklines"))J.push("import { AgChartsEnterpriseModule } from 'ag-charts-enterprise';");return`import { ModuleRegistry } from 'ag-grid-community'; +${J.join(` +`)} + +ModuleRegistry.registerModules([ ${z.map((Z)=>E6(Z,!0)).join(", ")} ]); + +For more info see: ${O2}/modules/`};function E6(z,J=!1){if(J&&(z==="IntegratedCharts"||z==="Sparklines"))return`${z}Module.with(AgChartsEnterpriseModule)`;return`${z}Module`}function WF(z,J){let Q=J.filter((X)=>X==="IntegratedCharts"||X==="Sparklines"),Z="";if(!globalThis?.agCharts&&Q.length>0)Z=`Unable to use ${z} as either the ag-charts-community or ag-charts-enterprise script needs to be included alongside ag-grid-enterprise. +`;else if(J.some((X)=>p$[X]))Z=Z+`Unable to use ${z} as that requires the ag-grid-enterprise script to be included. +`;return Z}function d$({moduleName:z,rowModelType:J}){return`To use the ${z}Module you must set the gridOption "rowModelType='${J}'"`}var e7=({reasonOrId:z,moduleName:J,gridScoped:Q,gridId:Z,rowModelType:$,additionalText:X,isUmd:Y})=>{let q=_F(J,$),G=typeof z==="string"?z:FF[z];if(Y)return WF(G,q);let H=q.filter((W)=>W==="IntegratedCharts"||W==="Sparklines"),_=H.length>0?`${H.map((W)=>E6(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)=>E6(W)).join(", "):E6(q[0])} is not registered${Q?" for gridId: "+Z:""}. ${_} Check if you have registered the module: +`} +${UF(q)}`+(X?` + +${X}`:"")},z8=(z)=>{return`${z} 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 { ${z} } from 'ag-grid-enterprise'; + +ModuleRegistry.registerModules([${z}.with(AgChartsEnterpriseModule)]); + `},BF=(z)=>`AG Grid: Unable to use the Clipboard API (navigator.clipboard.${z}()). 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.`,EF={1:()=>"`rowData` must be an array",2:({nodeId:z})=>`Duplicate node id '${z}' 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:z})=>`Could not find row id=${z}, data item was not found for this id`,5:({data:z})=>["Could not find data item as object was not found.",z," 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:z})=>`Unknown key for navigation ${z}`,9:({variable:z})=>`No value for ${z?.cssName}. This usually means that the grid has been initialised before styles have been loaded. The default value of ${z?.defaultValue} will be used and updated when styles load.`,10:({eventType:z})=>`As of v33, the '${z}' event is deprecated. Use the global 'modelUpdated' event to determine when row children have changed.`,11:()=>"No gridOptions provided to createGrid",12:({colKey:z})=>["column ",z," 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:z})=>`Row IDs cannot start with ${z}, this is a reserved prefix for AG Grid's row grouping feature.`,15:({expression:z})=>["value should be either a string or a function",z],16:({expression:z,params:J,e:Q})=>["Processing of the expression failed","Expression = ",z,"Params = ",J,"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:z})=>`${z} 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:z})=>["The getRowId callback must return a string. The ID ",z," is being cast to a string."],26:({fnName:z,preDestroyLink:J})=>{return`Grid API function ${z}() 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: ${J}`},27:({fnName:z,module:J})=>`API function '${z}' not registered to module '${J}'`,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:z})=>["tried to insert columns in invalid location, toIndex = ",z,"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:z})=>`the column type '${z}' 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:z})=>"colDef.type '"+z+"' does not correspond to defined gridOptions.columnTypes",37:()=>"Changing the column pinning status is not allowed with domLayout='print'",38:({iconName:z})=>`provided icon '${z}' 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:z,method:J})=>`${z} +${BF(J)}`,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:z})=>`As of v33, icon '${z}' is deprecated. Use the icon CSS name instead.`,44:()=>'Data type definition hierarchies (via the "extendsDataType" property) cannot contain circular references.',45:({parentCellDataType:z})=>`The data type definition ${z} does not exist.`,46:()=>'The "baseDataType" property of a data type definition must match that of its parent.',47:({cellDataType:z})=>`Missing data type definition - "${z}"`,48:({property:z,inferred:J,colId:Q})=>{let Z=J?" (inferred)":"",$=Q?` for column "${Q}"`:"";return`Cell data type is "object"${Z} but no Value ${z} has been provided${$}. Please either provide an object data type definition with a Value ${z}, or set: + - "colDef.value${z}"${J&&z==="Parser"?` + - "colDef.cellDataType = 'object'"`:""}`},49:({methodName:z})=>`Framework component is missing the method ${z}()`,50:({compName:z})=>`Could not find component ${z}, 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:z})=>`setFilterModel() - no column found for colId: ${z}`,63:({colId:z})=>`setFilterModel() - unable to fully apply model, filtering disabled for colId: ${z}`,64:({colId:z})=>`setFilterModel() - unable to fully apply model, unable to create filter for colId: ${z}`,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:z})=>`getGui method from filter returned ${z}; it should be a DOM element.`,70:({newFilter:z})=>`Grid option quickFilterText only supports string inputs, received: ${typeof z}`,71:()=>"debounceMs is ignored when apply button is present",72:({keys:z})=>["ignoring FilterOptionDef as it doesn't contain one of ",z],73:()=>"invalid FilterOptionDef supplied as it doesn't contain a 'displayKey'",74:()=>"no filter options for filter",75:()=>"Unknown button type specified",76:({filterModelType:z})=>['Unexpected type of filter "',z,'", 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:z})=>`DateFilter ${z} 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:z})=>`Invalid row index for ensureIndexVisible: ${z}`,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:z,pageSizeSet:J,pageSizesSet:Q,pageSizeOptions:Z})=>`'paginationPageSize=${z}'${J?"":" (default value)"}, but ${z} is not included in${Q?"":" the default"} paginationPageSizeSelector=[${Z?.join(", ")}].`,95:({paginationPageSizeOption:z,paginationPageSizeSelector:J})=>`Either set '${J}' to an array that includes ${z} or to 'false' to disable the page size selector.`,96:({id:z,data:J})=>["Duplicate ID",z,"found for pinned row with data",J,"When `getRowId` is defined, it must return unique IDs for all pinned rows. Use the `rowPinned` parameter."],97:({colId:z})=>`cellEditor for column ${z} 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:z,componentName:J,agGridDefaults:Q,jsComps:Z})=>{let $=[],X=[...Object.keys(Q??[]).filter((q)=>!["agCellEditor","agGroupRowRenderer","agSortIndicator"].includes(q)),...Object.keys(Z??[]).filter((q)=>!!Z[q])],Y=rQ({inputValue:J,allSuggestions:X,hideIrrelevant:!0,filterByPercentageOfBestMatch:0.8}).values;if($.push(`Could not find '${J}' component. It was configured as "${z}: '${J}'" but it wasn't found in the list of registered components. +`),Y.length>0)$.push(` Did you mean: [${Y.slice(0,3)}]? +`);return $.push("If using a custom component check it has been registered correctly."),$},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:z,param:J})=>`Numeric value ${z} passed to ${J} param will be interpreted as ${z} seconds. If this is intentional use "${z}s" to silence this warning.`,105:({e:z})=>["chart rendering failed",z],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: ${O2}/theming-migration/`,107:({key:z,value:J})=>`Invalid value for theme param ${z} - ${J}`,108:({e:z})=>["chart update failed",z],109:({inputValue:z,allSuggestions:J})=>{let Q=rQ({inputValue:z,allSuggestions:J,hideIrrelevant:!0,filterByPercentageOfBestMatch:0.8}).values;return[`Could not find '${z}' aggregate function. It was configured as "aggFunc: '${z}'" 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:z})=>`Could not find component with name of ${z}. 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:z})=>`Unable to update chart. No active chart found with ID: ${z}.`,126:()=>"unable to restore chart as no chart model is provided",127:({allRange:z})=>`unable to create chart as ${z?"there are no columns in the grid":"no range is selected"}.`,128:({feature:z})=>`${z} is only available if using 'multiRow' selection mode.`,129:({feature:z,rowModel:J})=>`${z} is only available if using 'clientSide' or 'serverSide' rowModelType, you are using ${J}.`,130:()=>'cannot multi select unless selection mode is "multiRow"',132:()=>"Row selection features are not available unless `rowSelection` is enabled.",133:({iconName:z})=>`icon '${z}' function should return back a string or a dom object`,134:({iconName:z})=>`Did not find icon '${z}'`,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:z,currentChartType:J})=>`Unable to update chart as a '${z}' update type is not permitted on a ${J}.`,138:({chartType:z})=>`invalid chart type supplied: ${z}`,139:({customThemeName:z})=>`a custom chart theme with the name ${z} has been supplied but not added to the 'chartThemes' list`,140:({name:z})=>`no stock theme exists with the name '${z}' 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:z})=>`'${z}' is not a valid Chart Tool Panel name`,144:({type:z})=>`Invalid charts data panel group name supplied: '${z}'`,145:({group:z})=>`As of v32, only one charts customize panel group can be expanded at a time. '${z}' will not be expanded.`,146:({comp:z})=>`Unable to instantiate component '${z}' as its module hasn't been loaded. Add 'ValidationModule' to see which module is required.`,147:({group:z})=>`Invalid charts customize panel group name supplied: '${z}'`,148:({group:z})=>`invalid chartGroupsDef config '${z}'`,149:({group:z,chartType:J})=>`invalid chartGroupsDef config '${z}.${J}'`,150:()=>"'seriesChartTypes' are required when the 'customCombo' chart type is specified.",151:({chartType:z})=>`invalid chartType '${z}' supplied in 'seriesChartTypes', converting to 'line' instead.`,152:({colId:z})=>`no 'seriesChartType' found for colId = '${z}', defaulting to 'line'.`,153:({chartDataType:z})=>`unexpected chartDataType value '${z}' supplied, instead use 'category', 'series' or 'excluded'`,154:({colId:z})=>`cross filtering requires a 'agSetColumnFilter' or 'agMultiColumnFilter' to be defined on the column with id: ${z}`,155:({option:z})=>`'${z}' is not a valid Chart Toolbar Option`,156:({panel:z})=>`Invalid panel in chartToolPanelsDef.panels: '${z}'`,157:({unrecognisedGroupIds:z})=>["unable to find group(s) for supplied groupIds:",z],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:z,dataType:J})=>`Unrecognized data type for excel export [${z}.dataType=${J}]`,163:({featureName:z})=>`Excel table export does not work with ${z}. The exported Excel file will not contain any Excel tables. + Please turn off ${z} 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:z})=>["unable to find groups for these supplied groupIds:",z],167:({unrecognisedColIds:z})=>["unable to find columns for these supplied colIds:",z],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:z})=>`invalid cellRendererParams.refreshStrategy = ${z} 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:z})=>`invalid chartGroupsDef config '${z}'`,174:({group:z,chartType:J})=>`invalid chartGroupsDef config '${z}.${J}'`,175:({menuTabName:z,itemsToConsider:J})=>[`Trying to render an invalid menu item '${z}'. Check that your 'menuTabs' contains one of `,J],176:({key:z})=>`unknown menu item type ${z}`,177:()=>"valid values for cellSelection.handle.direction are 'x', 'y' and 'xy'. Default to 'xy'.",178:({colId:z})=>`column ${z} 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:z,childNodeData:J})=>["duplicate group keys for row data, keys should be unique",[z,J]],185:({data:z})=>["getDataPath() should not return an empty path",[z]],186:({rowId:z,rowData:J,duplicateRowsData:Q})=>["duplicate group keys for row data, keys should be unique",z,J,...Q??[]],187:({rowId:z,firstData:J,secondData:Q})=>[`Duplicate node id ${z}. Row IDs are provided via the getRowId() callback. Please modify the getRowId() callback code to provide unique row id values.`,"first instance",J,"second instance",Q],188:(z)=>`getRowId callback must be provided for Server Side Row Model ${z?.feature||"selection"} to work correctly.`,189:({startRow:z})=>`invalid value ${z} for startRow, the value should be >= 0`,190:({rowGroupId:z,data:J})=>["null and undefined values are not allowed for server side row model keys",z?`column = ${z}`:"","data is ",J],194:({method:z})=>`calling gridApi.${z}() is only possible when using rowModelType=\`clientSide\`.`,195:({justCurrentPage:z})=>`selecting just ${z?"current page":"filtered"} only works when gridOptions.rowModelType='clientSide'`,196:({key:z})=>`Provided ids must be of string type. Invalid id provided: ${z}`,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:e7,201:({rowModelType:z})=>`Could not find row model for rowModelType = ${z}`,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:z})=>`Unable to display rows as duplicate row ids (${z}) 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 ${O2}/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:z})=>`unable to lookup Tool Panel as invalid key supplied: ${z}`,215:({key:z,defaultByKey:J})=>`the key ${z} is not a valid key for specifying a tool panel, valid keys are: ${Object.keys(J??{}).join(",")}`,216:({name:z})=>`Missing component for '${z}'`,217:({invalidColIds:z})=>["unable to find grid columns for the supplied colDef(s):",z],218:({property:z,defaultOffset:J})=>`${z} must be a number, the value you provided is not a valid number. Using the default of ${J}px.`,219:({property:z})=>`Property ${z} does not exist on the target object.`,220:({lineDash:z})=>`'${z}' 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:z})=>`unrecognised menu item ${z}`,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:z})=>`Framework component is missing the method ${z}()`,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:z})=>`theme grid option must be a Theming API theme object or the string "legacy", received: ${z}`,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:z})=>`AG Grid: Unable to create chart as an invalid chartType = '${z}' 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:z})=>["Illegal version string: ",z],254:()=>"Cannot create chart: no chart themes available.",255:({point:z})=>`Lone surrogate U+${z?.toString(16).toUpperCase()} is not a scalar value`,256:()=>"Unable to initialise. See validation error, or load ValidationModule if missing.",257:()=>z8("IntegratedChartsModule"),258:()=>z8("SparklinesModule"),259:({part:z})=>`the argument to theme.withPart must be a Theming API part object, received: ${z}`,260:({propName:z,compName:J,gridScoped:Q,gridId:Z,rowModelType:$})=>e7({reasonOrId:`AG Grid '${z}' component: ${J}`,moduleName:I2[J],gridId:Z,gridScoped:Q,rowModelType:$}),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:z})=>`Unable to infer chart data type for column '${z}' if first data entry is null. Please specify "chartDataType", or a "cellDataType" in the column definition. For more information, see ${O2}/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:z,parentId:J})=>`Cycle detected for row with id='${z}' and parent id='${J}'. Resetting the parent for row with id='${z}' and showing it as a root-level node.`,271:({id:z,parentId:J})=>`Parent row not found for row with id='${z}' and parent id='${J}'. Showing row with id='${z}' as a root-level node.`,272:()=>i$(),273:({providedId:z,usedId:J})=>`Provided column id '${z}' was already in use, ensure all column and group ids are unique. Using '${J}' instead.`,274:({prop:z})=>{let J=`Since v33, ${z} has been deprecated.`;switch(z){case"maxComponentCreationTimeMs":J+=" This property is no longer required and so will be removed in a future version.";break;case"setGridApi":J+=" 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":J+=" For multiple versions AgGridReact does not support children.";break}return J},275:d$,276:()=>"Row Numbers Row Resizer cannot be used when Grid Columns have `autoHeight` enabled.",277:({colId:z})=>`'enableFilterHandlers' is set to true, but column '${z}' does not have 'filter.doesFilterPass' or 'filter.handler' set.`,278:({colId:z})=>`Unable to create filter handler for column '${z}'`,279:(z)=>{},280:({colId:z})=>`'name' must be provided for custom filter components for column '${z}`,281:({colId:z})=>`Filter for column '${z}' 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:z})=>`Row Model '${z}' is not supported with Batch Editing`,290:({rowIndex:z,rowPinned:J})=>`Row with index '${z}' and pinned state '${J}' not found`,291:()=>"License Key being set multiple times with different values. This can result in an incorrect license key being used,",292:({colId:z})=>`The Multi Filter for column '${z}' 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:z})=>`colDef.allowFormula is not supported with ${z}. 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 KF(z,J){let Q=EF[z];if(!Q)return[`Missing error text for error id ${z}!`];let Z=Q(J),X=` +See ${l8(z,J)}`;return Array.isArray(Z)?Z.concat(X):[Z,X]}var FF={1:"Charting Aggregation",2:"pivotResultFields",3:"setTooltip"},LF=class{constructor(z="javascript"){this.frameworkName=z,this.renderingEngine="vanilla",this.batchFrameworkComps=!1,this.wrapIncoming=(J)=>J(),this.wrapOutgoing=(J)=>J(),this.baseDocLink=`${u8}/${this.frameworkName}-data-grid`,xG(this.baseDocLink)}frameworkComponent(z){return null}isFrameworkComponent(z){return!1}getDocLink(z){return this.baseDocLink+(z?"/"+z:"")}},J8=new WeakMap,Q8=new WeakMap;function MJ(z,J,Q){if(!J)return t(11),{};let Z=Q,$;if(!Z?.setThemeOnGridDiv){let Y=z0({tag:"div"});Y.style.height="100%",z.appendChild(Y),z=Y,$=()=>z.remove()}return new MF().create(z,J,(Y)=>{let q=new IU(z);Y.createBean(q)},void 0,Q,$)}var DF=1,MF=class{create(z,J,Q,Z,$,X){let Y=LZ.applyGlobalGridOptions(J),q=Y.gridId??String(DF++),G=this.getRegisteredModules($,q,Y.rowModelType),H=this.createBeansList(Y.rowModelType,G,q),_=this.createProvidedBeans(z,Y,$);if(!H)return;let B=new H_({providedBeanInstances:_,beanClasses:H,id:q,beanInitComparator:W_,beanDestroyComparator:B_,derivedBeans:[__],destroyCallback:()=>{Q8.delete(E),J8.delete(z),vG(q),X?.()}});this.registerModuleFeatures(B,G),Q(B),B.getBean("syncSvc").start(),Z?.(B);let E=B.getBean("gridApi");return J8.set(z,E),Q8.set(E,z),E}getRegisteredModules(z,J,Q){return M6(YF,void 0,!0),z?.modules?.forEach((Z)=>M6(Z,J)),IG(J,Z8(Q))}registerModuleFeatures(z,J){let Q=z.getBean("registry"),Z=z.getBean("apiFunctionSvc");for(let $ of J){Q.registerModule($);let X=$.apiFunctions;if(X){let Y=Object.keys(X);for(let q of Y)Z?.addFunction(q,X[q])}}}createProvidedBeans(z,J,Q){let Z=Q?Q.frameworkOverrides:null;if(n(Z))Z=new LF;let $={gridOptions:J,eGridDiv:z,eRootDiv:z,globalListener:Q?Q.globalListener:null,globalSyncListener:Q?Q.globalSyncListener:null,frameworkOverrides:Z,withinStudio:Q?.withinStudio};if(Q?.providedBeanInstances)Object.assign($,Q.providedBeanInstances);return $}createBeansList(z,J,Q){let Z={clientSide:"ClientSideRowModel",infinite:"InfiniteRowModel",serverSide:"ServerSideRowModel",viewport:"ViewportRowModel"},$=Z8(z),X=Z[$];if(!X){q6(201,{rowModelType:$},`Unknown rowModelType ${$}.`);return}if(!bG()){q6(272,void 0,i$());return}if(!z){let q=Object.entries(Z).filter(([G,H])=>vQ(H,Q,G));if(q.length==1){let[G,H]=q[0];if(G!==$){let _={moduleName:H,rowModelType:G};q6(275,_,d$(_));return}}}if(!vQ(X,Q,$)){let q=MZ(),G=`rowModelType = '${$}'`,H=q?`Unable to use ${G} as that requires the ag-grid-enterprise script to be included. +`:`Missing module ${X}Module for rowModelType ${$}.`;q6(200,{reasonOrId:G,moduleName:X,gridScoped:DZ(),gridId:Q,rowModelType:$,isUmd:q},H);return}let Y=new Set;for(let q of J)for(let G of q.beans??[])Y.add(G);return Array.from(Y)}};function Z8(z){return z??"clientSide"}function kF(z,J,Q="auto"){z.frameworkOverrides.wrapIncoming(()=>z.ctrlsSvc.getScrollFeature().ensureColumnVisible(J,Q),"ensureVisible")}function fF(z,J,Q){z.frameworkOverrides.wrapIncoming(()=>z.ctrlsSvc.getScrollFeature().ensureIndexVisible(J,Q),"ensureVisible")}var n$=(z,J)=>{for(let Q=0,Z=z.length;Q{if(Q!=null){let X=Q.getSortedRows();for(let Y=0,q=X.length;Y{let H=q.level+1;for(let _=0,U=G.length;_{if(!U&&U!==void 0){let M=L.sourceRowIndex;U=M<=W,W=M}if(L.data!==D){if(L.updateData(D),!Y.has(L))q.add(L);if(!L.selectable&&L.isSelected())H.push(L)}},K=(L,D,M)=>{for(let f=0,S=D.length;f0;if(F){let L=Q._leafs??(Q._leafs=[]);if(U===void 0)OF(L,G,X);else if(jF(L,G))X.reordered=!0}if(F||B||q.size)z.rowDataUpdated=!0,this.deselect(H)}deleteUnusedNodes(z,{removals:J},Q,Z){let $=this.rootNode._leafs;for(let X=0,Y=$.length;X0}updateRowData(z,J,Q){if(this.dispatchRowDataUpdateStarted(z.add),this.beans.groupStage?.getNestedDataGetter())return R(268),{remove:[],update:[],add:[]};let Z=[],$=bQ(this.gos),X=this.executeRemove($,z,J,Z,Q),Y=this.executeUpdate($,z,J,Z),q=this.executeAdd(z,J);return this.deselect(Z),{remove:X,update:Y,add:q}}executeRemove(z,{remove:J},{adds:Q,updates:Z,removals:$},X,Y){let q=this.rootNode._leafs,G=q?.length,H=J?.length;if(!H||!G)return[];let _=0,U=G,W=0,B=Array(H);for(let E=0;EW)W=F;if(B[_++]=K,!this.destroyNode(K,Y))continue;if(K.isSelected())X.push(K);if(!Q.delete(K))Z.delete(K),$.push(K)}if(B.length=_,_)RF(q,U,W);return B}executeUpdate(z,{update:J},{adds:Q,updates:Z},$){let X=J?.length;if(!X)return[];let Y=Array(X),q=0;for(let G=0;G=G;--U){let B=Z[U];B.sourceRowIndex=W,Z[W--]=B}J.reordered=!0}Z.length=q;let H=Array(Y),_=J.adds;for(let U=0;U=Q||Number.isNaN(J))return Q;J=Math.ceil(J);let Z=this.gos;if(J>0&&Z.get("treeData")&&Z.get("getDataPath"))J=SF(z,J);return J}},SF=(z,J)=>{for(let Q=0,Z=z.length;Q{if(z.group=!0,z.level=-1,z._expanded=!0,z.id="ROOT_NODE_ID",z._leafs?.length!==0)z._leafs=[];let J=[],Q=[],Z=[],$=[];z.childrenAfterGroup=J,z.childrenAfterSort=Q,z.childrenAfterAggFilter=Z,z.childrenAfterFilter=$;let X=z.sibling;if(X)X.childrenAfterGroup=J,X.childrenAfterSort=Q,X.childrenAfterAggFilter=Z,X.childrenAfterFilter=$,X.childrenMapped=z.childrenMapped;return z.updateHasChildren(),z},AF=(z,J)=>{if(z)for(let Q=0,Z=z.length;Q{J=Math.max(0,J);for(let Z=J,$=z.length;Z<$;++Z){let X=z[Z];if(Z<=Q&&X.destroyed)continue;X.sourceRowIndex=J,z[J++]=X}z.length=J},jF=(z,J)=>{let Q=J.size;z.length=Q;let Z=0,$=!1,X=!1;for(let Y of J){let q=Y.sourceRowIndex;if(q===Z)X||(X=$);else{if(q>=0)X=!0;else $=!0;Y.sourceRowIndex=Z,z[Z]=Y}++Z}return X},OF=(z,J,{adds:Q})=>{let Z=z.length,$=J.size;if($>Z)z.length=$;let X=0;for(let Y=0;Y{if(Z.hasChildren())if(z&&!$)Z.childrenAfterFilter=Z.childrenAfterGroup.filter((X)=>{let Y=X.childrenAfterFilter&&X.childrenAfterFilter.length>0,q=X.data&&this.filterManager.doesRowPassFilter({rowNode:X});return Y||q});else Z.childrenAfterFilter=Z.childrenAfterGroup;else Z.childrenAfterFilter=Z.childrenAfterGroup;sQ(Z)};if(this.doingTreeDataFiltering()){let Z=($,X)=>{if($.childrenAfterGroup)for(let Y=0;Y<$.childrenAfterGroup.length;Y++){let q=$.childrenAfterGroup[Y],G=X||this.filterManager.doesRowPassFilter({rowNode:q});if(q.childrenAfterGroup)Z($.childrenAfterGroup[Y],G);else Q(q,G)}Q($,X)};Z(this.beans.rowModel.rootNode,!1)}else{let Z=($)=>Q($,!1);j0(this.beans.rowModel.rootNode,this.beans.rowModel.hierarchical,J,Z)}}softFilter(z,J){let Q=($)=>{if($.childrenAfterFilter=$.childrenAfterGroup,$.hasChildren())for(let X of $.childrenAfterGroup)X.softFiltered=z&&!(X.data&&this.filterManager.doesRowPassFilter({rowNode:X}));sQ($)},Z=this.beans.rowModel;j0(Z.rootNode,Z.hierarchical,J,Q)}doingTreeDataFiltering(){let{gos:z}=this;return!!this.beans.groupStage?.treeData&&!z.get("excludeChildrenWhenTreeDataFiltering")}},TF=4,vF=(z,J,Q,Z,$)=>{let{childrenAfterSort:X,childrenAfterAggFilter:Y}=J;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<=TF)return z.doFullSortInPlace(Y.slice(),$);let G=new Map,{updates:H,adds:_}=Q,U=[];for(let B=0;Bz.compareRowNodes($,B,E)||~G.get(B)-~G.get(E)),W===q)return U;return IF(z,$,U,X,G,q)},IF=(z,J,Q,Z,$,X)=>{let Y=Array(X),q=0,G=Q[q],H,_=-1,U=0,W=0,B=Q.length,E=Z.length;while(!0){if(_<0){if(U>=E)break;if(H=Z[U++],_=$.get(H)??-1,_<0)continue}if((z.compareRowNodes(J,G,H)||~$.get(G)-_)<0){if(Y[W++]=G,++q>=B)break;G=Q[q]}else Y[W++]=H,_=-1}while(q=0)Y[W++]=K}return Y},CF=(z,J,Q)=>{let Z=0;Q.length=J.size;for(let $=0,X=z.length;${let{childrenAfterSort:J,sibling:Q}=z;if(Q)Q.childrenAfterSort=J;if(!J)return;for(let Z=0,$=J.length-1;Z<=$;Z++){let X=J[Z],Y=Z===0,q=Z===$;if(X.firstChild!==Y)X.firstChild=Y,X.dispatchRowEvent("firstChildChanged");if(X.lastChild!==q)X.lastChild=q,X.dispatchRowEvent("lastChildChanged");if(X.childIndex!==Z)X.childIndex=Z,X.dispatchRowEvent("childIndexChanged")}},bF=class extends V{constructor(){super(...arguments);this.beanName="sortStage",this.step="sort",this.refreshProps=["postSortRows","groupDisplayType","accentedSort"]}execute(z,J){let Q=this.beans.sortSvc.getSortOptions(),Z=Q.length>0&&!!J&&this.gos.get("deltaSort"),{gos:$,colModel:X,rowGroupColsSvc:Y,rowNodeSorter:q,rowRenderer:G,showRowGroupCols:H}=this.beans,_=$.get("groupMaintainOrder"),U=X.getCols().some((D)=>D.isRowGroupActive()),W=Y?.columns,B=X.isPivotMode(),E=$.getCallback("postSortRows"),K=!1,F,L=(D)=>{let M=B&&D.leafGroup,f=_&&U&&!D.leafGroup;if(f)F??(F=this.shouldSortContainsGroupCols(Q)),f&&(f=!F);let S=null;if(f){let A=!1;if(W){let O=D.level+1;if(O{let{childrenAfterSort:J,childrenAfterAggFilter:Q}=z,Z=J?.length,$=Q?.length;if(!Z||!$)return null;let X=Array($),Y=new Set;for(let G=0;G<$;++G)Y.add(Q[G]);let q=0;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:z,stagesRefreshProps:J}=this,Q=[z.groupStage,z.filterStage,z.pivotStage,z.aggStage,z.sortStage,z.filterAggStage,z.flattenStage].filter((Z)=>!!Z);this.stages=Q;for(let Z=Q.length-1;Z>=0;--Z){let $=Q[Z];for(let X of $.refreshProps)J.set(X,Z)}this.addManagedPropertyListeners([...J.keys(),"rowData"],(Z)=>{let $=Z.changeSet?.properties;if($)this.onPropChange($)}),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,J,Q,Z){let $,X=!1;do{$=!1;let Y=this.getRowIndexAtPixel(z),q=this.getRowIndexAtPixel(J),G=Math.max(Y,Q),H=Math.min(q,Z);for(let _=G;_<=H;_++){let U=this.getRow(_);if(U.rowHeightEstimated){let W=k6(this.beans,U);U.setRowHeight(W.height),$=!0,X=!0}}if($)this.setRowTopAndRowIndex()}while($);return X}onPropChange(z){let{nodeManager:J,gos:Q,beans:Z}=this,$=Z.groupStage;if(!J)return;let X=new Set(z),Y=$?.onPropChange(X),q;if(X.has("rowData"))q=Q.get("rowData");else if(Y)q=$?.extractData();if(q&&!Array.isArray(q))q=null,R(1);let G={step:"nothing",changedProps:X};if(q){let _=!Y&&!this.isEmpty()&&q.length>0&&Q.exists("getRowId")&&!Q.get("resetRowDataOnUpdate");if(this.refreshingData=!0,_)G.keepRenderedRows=!0,G.animate=!Q.get("suppressAnimationFrame"),G.changedRowNodes=new v2,J.setImmutableRowData(G,q);else G.rowDataUpdated=!0,G.newData=!0,J.setNewRowData(q),this.rowNodesCountReady=!0}let H=G.rowDataUpdated?"group":this.getRefreshedStage(z);if(H)G.step=H,this.refreshModel(G)}getRefreshedStage(z){let{stages:J,stagesRefreshProps:Q}=this;if(!J)return null;let Z=J.length,$=Z;for(let X=0,Y=z.length;X{if(X?.id!=null&&!J.has(X.id))X.clearRowTopAndRowIndex()},Z=(X)=>{Q(X),Q(X.detailNode),Q(X.sibling);let Y=X.childrenAfterGroup;if(!X.hasChildren()||!Y)return;if(z&&X.level!==-1&&!X.expanded)return;for(let q=0,G=Y.length;q{let H=X[G];if(this.gos.get("groupHideOpenParents"))while(H.expanded&&H.childrenAfterSort&&H.childrenAfterSort.length>0)H=H.childrenAfterSort[0];return H.rowIndex},q=J.footerSvc;if(q)return q?.getTopDisplayIndex(Z,z,X,Y);return Y(z)}getTopLevelIndexFromDisplayedIndex(z){let{rootNode:J,rowsToDisplay:Q}=this;if(!J||!Q.length||Q[0]===J)return z;let $=this.getRow(z);if($.footer)$=$.sibling;let X=$.parent;while(X&&X!==J)$=X,X=$.parent;let Y=J.childrenAfterSort?.indexOf($)??-1;return Y>=0?Y:z}getRowBounds(z){let J=this.rowsToDisplay[z];return J?{rowTop:J.rowTop,rowHeight:J.rowHeight}:null}onRowGroupOpened(){this.refreshModel({step:"map",keepRenderedRows:!0,animate:P2(this.gos)})}onFilterChanged({afterDataChange:z,columns:J}){if(!z){let Z=J.length===0||J.some(($)=>$.isPrimary())?"filter":"filter_aggregates";this.refreshModel({step:Z,keepRenderedRows:!0,animate:P2(this.gos)})}}onSortChanged(){this.refreshModel({step:"sort",keepRenderedRows:!0,animate:P2(this.gos)})}getType(){return"clientSide"}onValueChanged(){this.refreshModel({step:this.beans.colModel.isPivotActive()?"pivot":"aggregate"})}isSuppressModelUpdateAfterUpdateTransaction(z){if(!this.gos.get("suppressModelUpdateAfterUpdateTransaction"))return!1;let{changedRowNodes:J,newData:Q,rowDataUpdated:Z}=z;if(!J||Q||!Z)return!1;if(J.removals.length||J.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(z){let{nodeManager:J,eventSvc:Q,started:Z}=this;if(!J)return;let $=!!z.rowDataUpdated;if(Z&&$)Q.dispatchEvent({type:"rowDataUpdated"});if(this.deferRefresh(z)){this.setPendingRefreshFlags(z),this.rowDataUpdatedPending||(this.rowDataUpdatedPending=$);return}if(this.rowDataUpdatedPending)this.rowDataUpdatedPending=!1,z.step="group";this.updateRefreshParams(z);let X=!1;this.refreshingModel=!0;try{this.executeRefresh(z,$),X=!0}finally{if(this.refreshingData=!1,this.refreshingModel=!1,!X)this.setPendingRefreshFlags(z)}this.clearPendingRefreshFlags(),Q.dispatchEvent({type:"modelUpdated",animate:z.animate,keepRenderedRows:z.keepRenderedRows,newData:z.newData,newPage:!1,keepUndoRedoStack:z.keepUndoRedoStack})}executeRefresh(z,J){let{beans:Q,rootNode:Z}=this;if(Q.masterDetailSvc?.refreshModel(z),J&&z.step!=="group")Q.colFilter?.refreshModel();let $=z.changedPath;if($?.addRow(Z),z.step==="group")this.doGrouping(Z,z),$??($=z.changedPath);switch($??($=Q.changedPathFactory?.ensureRowsPath(z,Z)),z.step){case"group":case"filter":this.doFilter($);case"pivot":if(this.doPivot($))$=void 0,z.changedPath=void 0;case"aggregate":this.doAggregate($);case"filter_aggregates":this.doFilterAggregates($);case"sort":this.doSort($,z.changedRowNodes);case"map":this.doRowsToDisplay()}let X=new Set;this.setRowTopAndRowIndex(X),this.clearRowTopAndRowIndex($,X),this.updateRefreshParams(z)}deferRefresh(z){if(this.refreshingModel)return!0;if(this.beans.colModel.changeEventsDispatching)return!0;if(this.isSuppressModelUpdateAfterUpdateTransaction(z)){if(this.started)this.refreshingData=!1;return!0}if(!this.started)return!0;return!1}setPendingRefreshFlags(z){this.pendingNewData||(this.pendingNewData=!!z.newData),this.noKeepRenderedRows||(this.noKeepRenderedRows=!z.keepRenderedRows),this.noKeepUndoRedoStack||(this.noKeepUndoRedoStack=!z.keepUndoRedoStack),this.noAnimate||(this.noAnimate=!z.animate)}clearPendingRefreshFlags(){this.pendingNewData=!1,this.noKeepRenderedRows=!1,this.noKeepUndoRedoStack=!1,this.noAnimate=!1}updateRefreshParams(z){z.newData=this.pendingNewData||!!z.newData,z.keepRenderedRows=!this.noKeepRenderedRows&&!!z.keepRenderedRows,z.keepUndoRedoStack=!this.noKeepUndoRedoStack&&!!z.keepUndoRedoStack,z.animate=!this.noAnimate&&!!z.animate}isEmpty(){return!this.rootNode?._leafs?.length||!this.beans.colModel?.ready}isRowsToRender(){return this.rowsToDisplay.length>0}getOverlayType(){let{beans:z,gos:J}=this;if(this.rootNode?._leafs?.length){if(z.filterManager?.isAnyFilterPresent()&&this.getRowCount()===0)return"noMatchingRows"}else if(this.rowCountReady||(J.get("rowData")?.length??0)==0)return"noRows";return null}getNodesInRangeForSelection(z,J){let Q=!1,Z=!1,$=[],X=V6(this.gos);return this.forEachNodeAfterFilterAndSort((Y)=>{if(Z)return;if(Q){if(Y===J||Y===z){if(Z=!0,X&&Y.group){r$($,Y);return}}}if(!Q){if(Y!==J&&Y!==z)return;if(Q=!0,J===z)Z=!0}if(!Y.group||!X)$.push(Y)}),$}getTopLevelNodes(){return this.rootNode?.childrenAfterGroup??null}getRow(z){return this.rowsToDisplay[z]}getFormulaRow(z){return this.formulaRows[z]}isRowPresent(z){return this.rowsToDisplay.indexOf(z)>=0}getRowIndexAtPixel(z){let J=this.rowsToDisplay,Q=J.length;if(this.isEmpty()||Q===0)return-1;let Z=0,$=Q-1;if(z<=0)return 0;if(J[$].rowTop<=z)return $;let Y=-1,q=-1;while(!0){let G=Math.floor((Z+$)/2),H=J[G];if(this.isRowInPixel(H,z))return G;if(H.rowTopz)$=G-1;if(Y===Z&&q===$)return G;Y=Z,q=$}}isRowInPixel(z,J){let Q=z.rowTop,Z=Q+z.rowHeight;return Q<=J&&Z>J}forEachLeafNode(z){let J=this.rootNode?._leafs;if(J)for(let Q=0,Z=J.length;QQ.childrenAfterAggFilter)}forEachNodeAfterFilterAndSort(z,J=!1){this.depthFirstSearchRowNodes(z,J,(Q)=>Q.childrenAfterSort)}forEachPivotNode(z,J,Q){let{colModel:Z,rowGroupColsSvc:$}=this.beans;if(!Z.isPivotMode())return;if(!$?.columns.length){z(this.rootNode,0);return}let X=Q?"childrenAfterSort":"childrenAfterGroup";this.depthFirstSearchRowNodes(z,J,(Y)=>!Y.leafGroup?Y[X]:null)}depthFirstSearchRowNodes(z,J=!1,Q=(X)=>X.childrenAfterGroup,Z=this.rootNode,$=0){let X=$;if(!Z)return X;let Y=Z===this.rootNode;if(!Y)z(Z,X++);if(Z.hasChildren()&&!Z.footer){let q=Y||this.hierarchical?Q(Z):null;if(q){let G=this.beans.footerSvc;X=G?.addTotalRows(X,Z,z,J,Y,"top")??X;for(let H of q)X=this.depthFirstSearchRowNodes(z,J,Q,H,X);return G?.addTotalRows(X,Z,z,J,Y,"bottom")??X}}return X}doAggregate(z){if(this.rootNode)this.beans.aggStage?.execute(z)}doFilterAggregates(z){let J=this.rootNode,Q=this.beans.filterAggStage;if(Q&&this.hierarchical){Q.execute(z);return}J.childrenAfterAggFilter=J.childrenAfterFilter;let Z=J.sibling;if(Z)Z.childrenAfterAggFilter=J.childrenAfterFilter}doSort(z,J){let Q=this.beans.sortStage;if(Q){Q.execute(z,J);return}j0(this.rootNode,this.hierarchical,z,(Z)=>{Z.childrenAfterSort=Z.childrenAfterAggFilter.slice(0),t$(Z)})}doGrouping(z,J){let Z=this.beans.groupStage?.execute(J);if(Z===void 0){let $=z._leafs;z.childrenAfterGroup=$,z.updateHasChildren();let X=z.sibling;if(X)X.childrenAfterGroup=$}if(Z||J.rowDataUpdated)this.beans.colFilter?.refreshModel();if(!this.rowCountReady&&this.rowNodesCountReady)this.rowCountReady=!0,this.eventSvc.dispatchEventOnce({type:"rowCountReady"})}doFilter(z){let J=this.beans.filterStage;if(J){J.execute(z);return}j0(this.rootNode,this.hierarchical,z,(Q)=>{Q.childrenAfterFilter=Q.childrenAfterGroup,sQ(Q)})}doPivot(z){return this.beans.pivotStage?.execute(z)??!1}getRowNode(z){let J=this.nodeManager?.getRowNode(z);if(typeof J==="object")return J;return this.beans.groupStage?.getNonLeaf(z)}batchUpdateRowData(z,J){if(!this.asyncTransactionsTimer){this.asyncTransactions=[];let Q=this.gos.get("asyncTransactionWaitMillis");this.asyncTransactionsTimer=setTimeout(()=>this.executeBatchUpdateRowData(),Q)}this.asyncTransactions.push({rowDataTransaction:z,callback:J})}flushAsyncTransactions(){let z=this.asyncTransactionsTimer;if(z)clearTimeout(z),this.executeBatchUpdateRowData()}executeBatchUpdateRowData(){let{nodeManager:z,beans:J,eventSvc:Q,asyncTransactions:Z}=this;if(!z)return;J.valueCache?.onDataChanged();let $=[],X=[],Y=new v2,q=!this.gos.get("suppressAnimationFrame");for(let{rowDataTransaction:G,callback:H}of Z??[]){this.rowNodesCountReady=!0,this.refreshingData=!0;let _=z.updateRowData(G,Y,q);if($.push(_),H)X.push(H.bind(null,_))}if(this.commitTransactions(Y,q),X.length>0)setTimeout(()=>{for(let G=0,H=X.length;G0)Q.dispatchEvent({type:"asyncTransactionsFlushed",results:$});this.asyncTransactionsTimer=0,this.asyncTransactions=null}updateRowData(z){let J=this.nodeManager;if(!J)return null;this.beans.valueCache?.onDataChanged(),this.rowNodesCountReady=!0;let Q=new v2,Z=!this.gos.get("suppressAnimationFrame");this.refreshingData=!0;let $=J.updateRowData(z,Q,Z);return this.commitTransactions(Q,Z),$}commitTransactions(z,J){this.refreshModel({step:"group",rowDataUpdated:!0,keepRenderedRows:!0,animate:J,changedRowNodes:z})}doRowsToDisplay(){let{rootNode:z,beans:J}=this;if(J.formula?.active){let $=z?.childrenAfterSort??[];this.formulaRows=$,this.rowsToDisplay=$.filter((X)=>!X.softFiltered);for(let X of this.rowsToDisplay)X.setUiLevel(0);return}let Q=J.flattenStage;if(Q){this.rowsToDisplay=Q.execute();return}let Z=this.rootNode.childrenAfterSort??[];for(let $ of Z)$.setUiLevel(0);this.rowsToDisplay=Z}onRowHeightChanged(){this.refreshModel({step:"map",keepRenderedRows:!0,keepUndoRedoStack:!0})}resetRowHeights(){let z=this.rootNode;if(!z)return;let J=this.resetRowHeightsForAllRowNodes();z.setRowHeight(z.rowHeight,!0);let Q=z.sibling;if(Q?.setRowHeight(Q.rowHeight,!0),J)this.onRowHeightChanged()}resetRowHeightsForAllRowNodes(){let z=!1;return this.forEachNode((J)=>{J.setRowHeight(J.rowHeight,!0);let Q=J.detailNode;Q?.setRowHeight(Q.rowHeight,!0);let Z=J.sibling;Z?.setRowHeight(Z.rowHeight,!0),z=!0}),z}onGridStylesChanges(z){if(z.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()}},r$=(z,J)=>{let Q=J.childrenAfterGroup;if(Q)for(let Z=0,$=Q.length;Z<$;++Z){let X=Q[Z];if(X.data)z.push(X);if(X.group)r$(z,X)}};var s$={moduleName:"ClientSideRowModel",version:c,rowModels:["clientSide"],beans:[xF,bF],dependsOn:[c$]};var wF=":where(.ag-ltr) :where(.ag-animate-autosize){.ag-cell,.ag-header-cell,.ag-header-group-cell{transition:width .2s ease-in-out,left .2s ease-in-out}}:where(.ag-rtl) :where(.ag-animate-autosize){.ag-cell,.ag-header-cell,.ag-header-group-cell{transition:width .2s ease-in-out,right .2s ease-in-out}}";function NF(z,J){if(typeof J==="number")z.colAutosize?.sizeColumnsToFit(J,"api");else z.colAutosize?.sizeColumnsToFitGridBody(J)}function l$({colAutosize:z,visibleCols:J},Q,Z){if(Array.isArray(Q))z?.autoSizeCols({colKeys:Q,skipHeader:Z,source:"api"});else z?.autoSizeCols({...Q,colKeys:Q.colIds??J.allCols,source:"api"})}function gF(z,J){if(J&&typeof J==="object")l$(z,J);else z.colAutosize?.autoSizeAllColumns({source:"api",skipHeader:J})}var hF=class extends V{constructor(){super(...arguments);this.beanName="colAutosize",this.timesDelayed=0,this.shouldQueueResizeOperations=!1,this.resizeOperationQueue=[]}postConstruct(){let{gos:z}=this,J=z.get("autoSizeStrategy");if(J){let Q=!1,Z=J.type;if(Z==="fitGridWidth"||Z==="fitProvidedWidth")Q=!0;else if(Z==="fitCellContents"){this.addManagedEventListeners({firstDataRendered:()=>this.onFirstDataRendered(J)});let $=z.get("rowData");Q=$!=null&&$.length>0&&o(z)}if(Q)this.beans.colDelayRenderSvc?.hideColumns(Z)}}autoSizeCols(z){let{eventSvc:J,visibleCols:Q,colModel:Z}=this.beans;Y6(this.beans,!0),this.innerAutoSizeCols(z).then(($)=>{let X=(_)=>w2(J,Array.from(_),!0,"autosizeColumns");if(!z.scaleUpToFitGridWidth)return Y6(this.beans,!1),X($);let Y=X8(this.beans),q=(_)=>Q.leftCols.some((U)=>g4(U,_)),G=(_)=>Q.rightCols.some((U)=>g4(U,_)),H=z.colKeys.filter((_)=>{return!Z.getCol(_)?.getColDef().suppressAutoSize&&!b0(_)&&!q(_)&&!G(_)});this.sizeColumnsToFit(Y,z.source,!0,{defaultMaxWidth:z.defaultMaxWidth,defaultMinWidth:z.defaultMinWidth,columnLimits:z.columnLimits?.map((_)=>({..._,key:_.colId})),colKeys:H,onlyScaleUp:!0,animate:!1}),Y6(this.beans,!1),X($)})}innerAutoSizeCols(z){return new Promise((J,Q)=>{if(this.shouldQueueResizeOperations)return this.pushResizeOperation(()=>this.innerAutoSizeCols(z).then(J,Q));let{colKeys:Z,skipHeader:$,skipHeaderGroups:X,stopAtGroup:Y,defaultMaxWidth:q,defaultMinWidth:G,columnLimits:H=[],source:_="api"}=z,{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(z).then(J,Q)});return}this.timesDelayed=0;let F=new Set,L=-1,D=Object.fromEntries(H.map(({colId:S,...A})=>[S,A])),M=$??this.gos.get("skipHeaderOnAutoSize"),f=X??M;while(L!==0){L=0;let S=[];for(let A of Z){if(!A||x6(A))continue;let O=B.getCol(A);if(!O||F.has(O)||O.getColDef().suppressAutoSize)continue;let v=E.getPreferredWidthForColumn(O,M);if(v>0){let I=D[O.colId]??{};I.minWidth??(I.minWidth=G),I.maxWidth??(I.maxWidth=q);let x=uF(O,v,I);O.setActualWidth(x,_),F.add(O),L++}S.push(O)}if(S.length)K.refresh(_)}if(!f)this.autoSizeColumnGroupsByColumns(Z,_,Y);J(F)})}autoSizeColumn(z,J,Q){this.autoSizeCols({colKeys:[z],skipHeader:Q,skipHeaderGroups:!0,source:J})}autoSizeColumnGroupsByColumns(z,J,Q){let{colModel:Z,ctrlsSvc:$}=this.beans,X=new Set,Y=Z.getColsForKeys(z);for(let G of Y){let H=G.getParent();while(H&&H!=Q){if(!H.isPadding())X.add(H);H=H.getParent()}}let q;for(let G of X){for(let H of $.getHeaderRowContainerCtrls())if(q=H.getHeaderCtrlForColumn(G),q)break;q?.resizeLeafColumnsToFit(J)}}autoSizeAllColumns(z){if(this.shouldQueueResizeOperations){this.pushResizeOperation(()=>this.autoSizeAllColumns(z));return}this.autoSizeCols({colKeys:this.beans.visibleCols.allCols,...z})}addColumnAutosizeListeners(z,J){let Q=this.gos.get("skipHeaderOnAutoSize"),Z=()=>{this.autoSizeColumn(J,"uiColumnResized",Q)};z.addEventListener("dblclick",Z);let $=new c0(z);return $.addEventListener("doubleTap",Z),()=>{z.removeEventListener("dblclick",Z),$.destroy()}}addColumnGroupResize(z,J,Q){let Z=this.gos.get("skipHeaderOnAutoSize"),$=()=>{let X=[],Y=J.getDisplayedLeafColumns();for(let q of Y)if(!q.getColDef().suppressAutoSize)X.push(q.getColId());if(X.length>0)this.autoSizeCols({colKeys:X,skipHeader:Z,stopAtGroup:J,source:"uiColumnResized"});Q()};return z.addEventListener("dblclick",$),()=>z.removeEventListener("dblclick",$)}sizeColumnsToFitGridBody(z,J){if(!this.isAlive())return;let Q=X8(this.beans);if(Q>0){this.sizeColumnsToFit(Q,"sizeColumnsToFit",!1,z);return}if(J===void 0)window.setTimeout(()=>{this.sizeColumnsToFitGridBody(z,100)},0);else if(J===100)window.setTimeout(()=>{this.sizeColumnsToFitGridBody(z,500)},100);else if(J===500)window.setTimeout(()=>{this.sizeColumnsToFitGridBody(z,-1)},500);else R(29)}sizeColumnsToFit(z,J="sizeColumnsToFit",Q,Z){if(this.shouldQueueResizeOperations){this.pushResizeOperation(()=>this.sizeColumnsToFit(z,J,Q,Z));return}let{beans:$}=this,X=Z?.animate??!0;if(X)Y6($,!0);let Y={};for(let{key:L,...D}of Z?.columnLimits??[])Y[typeof L==="string"?L:L.getColId()]=D;let q=$.visibleCols.allCols;if(z<=0||!q.length)return;let G=n4(q);if(Z?.onlyScaleUp&&G>z)return;if(z===G){if(q.every((D)=>{if(D.colDef.suppressSizeToFit)return!0;let M=Y?.[D.getId()],f=M?.minWidth??Z?.defaultMinWidth,S=M?.maxWidth??Z?.defaultMaxWidth,A=D.getActualWidth();return(f==null||A>=f)&&(S==null||A<=S)}))return}let _=[],U=[];for(let L of q){let D=Z?.colKeys?.some((M)=>g4(L,M))??!0;if(L.getColDef().suppressSizeToFit||!D)U.push(L);else _.push(L)}let W=_.slice(0),B=!1,E=(L)=>{X0(_,L),U.push(L)},K={};for(let L of _){if(Z?.onlyScaleUp)K[L.getColId()]=L.getActualWidth();L.resetActualWidth(J);let D=Y?.[L.getId()],M=D?.minWidth??Z?.defaultMinWidth??-1/0,f=D?.maxWidth??Z?.defaultMaxWidth??1/0,S=L.getActualWidth(),A=Math.max(Math.min(S,f),M);if(A!=S)L.setActualWidth(A,J,!0)}while(!B){B=!0;let L=z-n4(U);if(L<=0)for(let D of _){let M=Y?.[D.getId()]?.minWidth??Z?.defaultMinWidth??D.minWidth;D.setActualWidth(M,J,!0)}else{let D=L/n4(_),M=L;for(let f=_.length-1;f>=0;f--){let S=_[f],A=S.getColId(),O=K[A],v=Y?.[A],I=v?.minWidth??Z?.defaultMinWidth??O,x=v?.maxWidth??Z?.defaultMaxWidth,m=Math.max(I??-1/0,S.getMinWidth()),g=Math.min(x??1/0,S.getMaxWidth()),e=Math.round(S.getActualWidth()*D);if(eg)e=g,E(S),B=!1;else if(f===0)e=M;S.setActualWidth(e,J,!0),M-=e}}}for(let L of W)L.fireColumnWidthChangedEvent(J);let F=$.visibleCols;if(F.setLeftValues(J),F.updateBodyWidths(),Q)return;if(w2(this.eventSvc,W,!0,J),X)Y6($,!1)}applyAutosizeStrategy(){let{gos:z,colDelayRenderSvc:J}=this.beans,Q=z.get("autoSizeStrategy");if(Q?.type!=="fitGridWidth"&&Q?.type!=="fitProvidedWidth")return;setTimeout(()=>{if(!this.isAlive())return;let Z=Q.type;if(Z==="fitGridWidth"){let{columnLimits:$,defaultMinWidth:X,defaultMaxWidth:Y}=Q,q=$?.map(({colId:G,minWidth:H,maxWidth:_})=>({key:G,minWidth:H,maxWidth:_}));this.sizeColumnsToFitGridBody({defaultMinWidth:X,defaultMaxWidth:Y,columnLimits:q})}else if(Z==="fitProvidedWidth")this.sizeColumnsToFit(Q.width,"sizeColumnsToFit");J?.revealColumns(Z)})}onFirstDataRendered({colIds:z,...J}){setTimeout(()=>{if(!this.isAlive())return;let Q="autosizeColumns";if(z)this.autoSizeCols({...J,source:Q,colKeys:z});else this.autoSizeAllColumns({...J,source:Q});this.beans.colDelayRenderSvc?.revealColumns(J.type)})}processResizeOperations(){this.shouldQueueResizeOperations=!1;for(let z of this.resizeOperationQueue)z();this.resizeOperationQueue=[]}pushResizeOperation(z){this.resizeOperationQueue.push(z)}destroy(){this.resizeOperationQueue.length=0,super.destroy()}};function uF(z,J,Q={}){let Z=Q.minWidth??z.getMinWidth();if(J$)J=$;return J}function X8({ctrlsSvc:z,scrollVisibleSvc:J}){let Q=z.getGridBodyCtrl(),$=Q.isVerticalScrollShowing()?J.getScrollbarWidth():0;return s1(Q.eGridBody)-$}var Y8="ag-animate-autosize";function Y6({ctrlsSvc:z,gos:J},Q){if(!J.get("animateColumnResizing")||J.get("enableRtl")||!z.isAlive())return;let Z=z.getGridBodyCtrl().eGridBody.classList;if(Q)Z.add(Y8);else Z.remove(Y8)}var a$={moduleName:"ColumnAutoSize",version:c,beans:[hF],apiFunctions:{sizeColumnsToFit:NF,autoSizeColumns:l$,autoSizeAllColumns:gF},dependsOn:[W$],css:[wF]};var mF=class extends V{constructor(){super(...arguments);this.beanName="gridSerializer"}wireBeans(z){this.visibleCols=z.visibleCols,this.colModel=z.colModel,this.rowModel=z.rowModel,this.pinnedRowModel=z.pinnedRowModel}serialize(z,J={}){let{allColumns:Q,columnKeys:Z,skipRowGroups:$,exportRowNumbers:X}=J,Y=this.getColumnsToExport({allColumns:Q,skipRowGroups:$,columnKeys:Z,exportRowNumbers:X});return[this.prepareSession(Y),this.prependContent(J),this.exportColumnGroups(J,Y),this.exportHeaders(J,Y),this.processPinnedTopRows(J,Y),this.processRows(J,Y),this.processPinnedBottomRows(J,Y),this.appendContent(J)].reduce((q,G)=>G(q),z).parse()}processRow(z,J,Q,Z){let $=J.shouldRowBeSkipped||(()=>!1),Y=J.rowPositions!=null||!!J.onlySelected,q=this.gos.get("groupHideOpenParents")&&!Y,G=this.colModel.isPivotMode()?Z.leafGroup:!Z.group,H=!!Z.footer,_=Z.allChildrenCount===1&&Z.childrenAfterGroup?.length===1&&iG(this.gos,Z);if(!G&&!H&&(J.skipRowGroups||_||q)||J.onlySelected&&!Z.isSelected()||J.skipPinnedTop&&Z.rowPinned==="top"||J.skipPinnedBottom&&Z.rowPinned==="bottom"||Z.stub)return;if(Z.level===-1&&!G&&!H)return;if($(C(this.gos,{node:Z})))return;let B=z.onNewBodyRow(Z);if(Q.forEach((E,K)=>{B.onColumn(E,K,Z)}),J.getCustomContentBelowRow){let E=J.getCustomContentBelowRow(C(this.gos,{node:Z}));if(E)z.addCustomContent(E)}}appendContent(z){return(J)=>{let Q=z.appendContent;if(Q)J.addCustomContent(Q);return J}}prependContent(z){return(J)=>{let Q=z.prependContent;if(Q)J.addCustomContent(Q);return J}}prepareSession(z){return(J)=>{return J.prepare(z),J}}exportColumnGroups(z,J){return(Q)=>{if(!z.skipColumnGroupHeaders){let Z=new F$,{colGroupSvc:$}=this.beans,X=$?$.createColumnGroups({columns:J,idCreator:Z,pinned:null,isStandaloneStructure:!0}):J;this.recursivelyAddHeaderGroups(X,Q,z.processGroupHeaderCallback)}return Q}}exportHeaders(z,J){return(Q)=>{if(!z.skipColumnHeaders){let Z=Q.onNewHeaderRow();J.forEach(($,X)=>{Z.onColumn($,X,void 0)})}return Q}}processPinnedTopRows(z,J){return(Q)=>{let Z=this.processRow.bind(this,Q,z,J);if(z.rowPositions)z.rowPositions.filter(($)=>$.rowPinned==="top").sort(($,X)=>$.rowIndex-X.rowIndex).map(($)=>this.pinnedRowModel?.getPinnedTopRow($.rowIndex)).forEach(Z);else if(!this.pinnedRowModel?.isManual())this.pinnedRowModel?.forEachPinnedRow("top",Z);return Q}}processRows(z,J){return(Q)=>{let Z=this.rowModel,$=o(this.gos,Z),X=V1(this.gos,Z),Y=!$&&z.onlySelected,q=this.processRow.bind(this,Q,z,J),{exportedRows:G="filteredAndSorted"}=z;if(z.rowPositions)z.rowPositions.filter((H)=>H.rowPinned==null).sort((H,_)=>H.rowIndex-_.rowIndex).map((H)=>Z.getRow(H.rowIndex)).forEach(q);else if(this.colModel.isPivotMode())if($)Z.forEachPivotNode(q,!0,G==="filteredAndSorted");else if(X)Z.forEachNodeAfterFilterAndSort(q,!0);else Z.forEachNode(q);else if(z.onlySelectedAllPages||Y){let H=this.beans.selectionSvc?.getSelectedNodes()??[];this.replicateSortedOrder(H),H.forEach(q)}else if(G==="all")Z.forEachNode(q);else if($||X)Z.forEachNodeAfterFilterAndSort(q,!0);else Z.forEachNode(q);return Q}}replicateSortedOrder(z){let{sortSvc:J,rowNodeSorter:Q}=this.beans;if(!J||!Q)return;let Z=J.getSortOptions(),$=(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(Z,X,Y)||(X.rowIndex??-1)-(Y.rowIndex??-1);return $(X.parent,Y.parent)}if(X.level>Y.level)return $(X.parent,Y);return $(X,Y.parent)};z.sort($)}processPinnedBottomRows(z,J){return(Q)=>{let Z=this.processRow.bind(this,Q,z,J);if(z.rowPositions)z.rowPositions.filter(($)=>$.rowPinned==="bottom").sort(($,X)=>$.rowIndex-X.rowIndex).map(($)=>this.pinnedRowModel?.getPinnedBottomRow($.rowIndex)).forEach(Z);else if(!this.pinnedRowModel?.isManual())this.pinnedRowModel?.forEachPinnedRow("bottom",Z);return Q}}getColumnsToExport(z){let{allColumns:J=!1,skipRowGroups:Q=!1,exportRowNumbers:Z=!1,columnKeys:$}=z,{colModel:X,gos:Y,visibleCols:q}=this,G=X.isPivotMode(),H=(W)=>{if(m4(W))return!1;return!b0(W)||Z};if($?.length)return X.getColsForKeys($).filter(H);let _=Y.get("treeData"),U=[];if(J&&!G)U=X.getCols();else U=q.allCols;return U=U.filter((W)=>H(W)&&(Q&&!_?!Q2(W):!0)),U}recursivelyAddHeaderGroups(z,J,Q){let Z=[];for(let $ of z){let X=$;if(!X.getChildren)continue;for(let Y of X.getChildren()??[])Z.push(Y)}if(z.length>0&&W0(z[0]))this.doAddHeaderHeader(J,z,Q);if(Z&&Z.length>0)this.recursivelyAddHeaderGroups(Z,J,Q)}doAddHeaderHeader(z,J,Q){let Z=z.onNewHeaderGroupingRow(),$=0;for(let X of J){let Y=X,q;if(Q)q=Q(C(this.gos,{columnGroup:Y}));else q=this.beans.colNames.getDisplayNameForColumnGroup(Y,"header");let H=(Y.isExpandable()?Y.getLeafColumns():[]).reduce((_,U,W,B)=>{let E=b(_);if(U.getColumnGroupShow()!=="open"){if(E&&E[1]==null)E[1]=W-1}else if(!E||E[1]!=null)E=[W],_.push(E);if(W===B.length-1&&E&&E[1]==null)E[1]=W;return _},[]);Z.onColumn(Y,q||"",$++,Y.getLeafColumns().length-1,H)}}},Y5={moduleName:"SharedExport",version:c,beans:[mF]},q5=class extends V{getFileName(z){let J=this.getDefaultFileExtension();if(!z?.length)z=this.getDefaultFileName();return z.includes(".")?z:`${z}.${J}`}getData(z){return this.beans.gridSerializer.serialize(this.createSerializingSession(z),z)}getDefaultFileName(){return`export.${this.getDefaultFileExtension()}`}};function kJ(z,J){let Q=document.defaultView||window;if(!Q){R(52);return}let Z=document.createElement("a"),$=Q.URL.createObjectURL(J);Z.setAttribute("href",$),Z.setAttribute("download",z),Z.style.display="none",document.body.appendChild(Z),Z.dispatchEvent(new MouseEvent("click",{bubbles:!1,cancelable:!0,view:Q})),Z.remove(),Q.setTimeout(()=>{Q.URL.revokeObjectURL($)},0)}var G5=class{constructor(z){this.valueFrom="data";let{colModel:J,rowGroupColsSvc:Q,colNames:Z,valueSvc:$,gos:X,processCellCallback:Y,processHeaderCallback:q,processGroupHeaderCallback:G,processRowGroupCallback:H,valueFrom:_}=z;if(this.colModel=J,this.rowGroupColsSvc=Q,this.colNames=Z,this.valueSvc=$,this.gos=X,this.processCellCallback=Y,this.processHeaderCallback=q,this.processGroupHeaderCallback=G,this.processRowGroupCallback=H,_)this.valueFrom=_}prepare(z){}extractHeaderValue(z){return this.getHeaderName(this.processHeaderCallback,z)??""}extractRowCellValue(z){let{column:J,node:Q,currentColumnIndex:Z,accumulatedRowIndex:$,type:X,useRawFormula:Y}=z,q=Z===0&&Q9(this.gos,Q,this.colModel.isPivotMode());if(this.processRowGroupCallback&&(this.gos.get("treeData")||Q.group)&&(J.isRowGroupDisplayed(Q.rowGroupColumn?.getColId()??"")||q))return{value:this.processRowGroupCallback(C(this.gos,{column:J,node:Q}))??""};if(this.processCellCallback)return{value:this.processCellCallback(C(this.gos,{accumulatedRowIndex:$,column:J,node:Q,value:this.valueSvc.getValueForDisplay({column:J,node:Q,from:this.valueFrom}).value,type:X,parseValue:(E)=>this.valueSvc.parseValue(J,Q,E,this.valueSvc.getValue(J,Q,this.valueFrom)),formatValue:(E)=>this.valueSvc.formatValue(J,Q,E)??E}))??""};let G=this.gos.get("treeData"),H=this.valueSvc,_=Q.level===-1&&Q.footer,U=J.colDef.showRowGroup===!0&&(Q.group||G);if(!_&&(q||U)){let E="",K=Q;while(K&&K.level!==-1){let{value:F,valueFormatted:L}=H.getValueForDisplay({column:q?void 0:J,node:K,includeValueFormatted:!0,exporting:!0,from:this.valueFrom});E=` -> ${L??F??""}${E}`,K=K.parent}return{value:E,valueFormatted:E}}let{value:W,valueFormatted:B}=H.getValueForDisplay({column:J,node:Q,includeValueFormatted:!0,exporting:!0,useRawFormula:Y,from:this.valueFrom});return{value:W??"",valueFormatted:B}}getHeaderName(z,J){if(z)return z(C(this.gos,{column:J}));return this.colNames.getDisplayNameForColumn(J,"csv",!0)}},q8=`\r +`,cF=class extends G5{constructor(z){super(z);this.config=z,this.isFirstLine=!0,this.result="";let{suppressQuotes:J,columnSeparator:Q}=z;this.suppressQuotes=J,this.columnSeparator=Q}addCustomContent(z){if(!z)return;if(typeof z==="string"){if(!/^\s*\n/.test(z))this.beginNewLine();z=z.replace(/\r?\n/g,q8),this.result+=z}else z.forEach((J)=>{this.beginNewLine(),J.forEach((Q,Z)=>{if(Z!==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,J,Q,Z){if(Q!=0)this.result+=this.columnSeparator;this.result+=this.putInQuotes(J),this.appendEmptyCells(Z)}appendEmptyCells(z){for(let J=1;J<=z;J++)this.result+=this.columnSeparator+this.putInQuotes("")}onNewHeaderRow(){return this.beginNewLine(),{onColumn:this.onNewHeaderRowColumn.bind(this)}}onNewHeaderRowColumn(z,J){if(J!=0)this.result+=this.columnSeparator;this.result+=this.putInQuotes(this.extractHeaderValue(z))}onNewBodyRow(){return this.beginNewLine(),{onColumn:this.onNewBodyRowColumn.bind(this)}}onNewBodyRowColumn(z,J,Q){if(J!=0)this.result+=this.columnSeparator;let Z=this.extractRowCellValue({column:z,node:Q,currentColumnIndex:J,accumulatedRowIndex:J,type:"csv",useRawFormula:!1});this.result+=this.putInQuotes(Z.valueFormatted??Z.value)}putInQuotes(z){if(this.suppressQuotes)return z;if(z===null||z===void 0)return'""';let J;if(typeof z==="string")J=z;else if(typeof z.toString==="function")J=z.toString();else R(53),J="";return'"'+J.replace(/"/g,'""')+'"'}parse(){return this.result}beginNewLine(){if(!this.isFirstLine)this.result+=q8;this.isFirstLine=!1}},pF=class extends q5{constructor(){super(...arguments);this.beanName="csvCreator"}getMergedParams(z){let J=this.gos.get("defaultCsvExportParams");return Object.assign({},J,z)}export(z){if(this.isExportSuppressed()){R(51);return}let J=()=>{let Z=this.getMergedParams(z),$=this.getData(Z),X=new Blob(["\uFEFF",$],{type:"text/plain"}),Y=Z.fileName,q=typeof Y==="function"?Y(C(this.gos,{})):Y;kJ(this.getFileName(q),X)},{overlays:Q}=this.beans;if(Q)Q.showExportOverlay(J);else J()}exportDataAsCsv(z){this.export(z)}getDataAsCsv(z,J=!1){let Q=J?Object.assign({},z):this.getMergedParams(z);return this.getData(Q)}getDefaultFileExtension(){return"csv"}createSerializingSession(z){let{colModel:J,colNames:Q,rowGroupColsSvc:Z,valueSvc:$,gos:X}=this.beans,{processCellCallback:Y,processHeaderCallback:q,processGroupHeaderCallback:G,processRowGroupCallback:H,suppressQuotes:_,columnSeparator:U,valueFrom:W}=z;return new cF({colModel:J,colNames:Q,valueSvc:$,gos:X,processCellCallback:Y||void 0,processHeaderCallback:q||void 0,processGroupHeaderCallback:G||void 0,processRowGroupCallback:H||void 0,suppressQuotes:_||!1,columnSeparator:U||",",rowGroupColsSvc:Z,valueFrom:W})}isExportSuppressed(){return this.gos.get("suppressCsvExport")}};function iF(z,J){return z.csvCreator?.getDataAsCsv(J)}function dF(z,J){z.csvCreator?.exportDataAsCsv(J)}var o$={moduleName:"CsvExport",version:c,beans:[pF],apiFunctions:{getDataAsCsv:iF,exportDataAsCsv:dF},dependsOn:[Y5]},e$=class extends O0{constructor(z,J){super();if(this.ctrl=z,J)this.beans=J}postConstruct(){this.refreshTooltip()}setBrowserTooltip(z,J){let Z=this.ctrl.getGui();if(!Z)return;if(z!=null&&(z!=""||J))Z.setAttribute("title",z);else Z.removeAttribute("title")}updateTooltipText(){let{getTooltipValue:z}=this.ctrl;if(z)this.tooltip=z()}createTooltipFeatureIfNeeded(){if(this.tooltipManager==null){let z=this.beans.registry.createDynamicBean("tooltipStateManager",!0,this.ctrl,()=>this.tooltip);if(z)this.tooltipManager=this.createBean(z,this.beans.context)}}attemptToShowTooltip(){this.tooltipManager?.prepareToShowTooltip()}attemptToHideTooltip(){this.tooltipManager?.hideTooltip()}setTooltipAndRefresh(z){this.tooltip=z,this.refreshTooltip()}refreshTooltip(z){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(z?"":null,z),this.createTooltipFeatureIfNeeded()}destroy(){this.tooltipManager=this.destroyBean(this.tooltipManager,this.beans.context),super.destroy()}},nF=1000,tF=1000,G8=100,H8,Bz=!1,rF=class extends O0{constructor(z,J){super();this.tooltipCtrl=z,this.getTooltipValue=J,this.interactionEnabled=!1,this.isInteractingWithTooltip=!1,this.state=0,this.tooltipInstanceCount=0,this.tooltipMouseTrack=!1}wireBeans(z){this.popupSvc=z.popupSvc}postConstruct(){if(this.gos.get("tooltipInteraction"))this.interactionEnabled=!0;this.tooltipTrigger=this.getTooltipTrigger(),this.tooltipMouseTrack=this.gos.get("tooltipMouseTrack");let z=this.tooltipCtrl.getGui();if(this.tooltipTrigger===0)this.addManagedListeners(z,{mouseenter:this.onMouseEnter.bind(this),mouseleave:this.onMouseLeave.bind(this)});if(this.tooltipTrigger===1)this.addManagedListeners(z,{focusin:this.onFocusIn.bind(this),focusout:this.onFocusOut.bind(this)});if(this.addManagedListeners(z,{mousemove:this.onMouseMove.bind(this)}),!this.interactionEnabled)this.addManagedListeners(z,{mousedown:this.onMouseDown.bind(this),keydown:this.onKeyDown.bind(this)})}getGridOptionsTooltipDelay(z){let J=this.gos.get(z);return Math.max(200,J)}getTooltipDelay(z){return this.tooltipCtrl[`getTooltip${z}DelayOverride`]?.()??this.getGridOptionsTooltipDelay(`tooltip${z}Delay`)}destroy(){this.setToDoNothing(),super.destroy()}getTooltipTrigger(){let z=this.gos.get("tooltipTrigger");if(!z||z==="hover")return 0;return 1}onMouseEnter(z){if(this.interactionEnabled&&this.interactiveTooltipTimeoutId)this.unlockService(),this.startHideTimeout();if(n1())return;if(Bz)this.showTooltipTimeoutId=window.setTimeout(()=>{this.prepareToShowTooltip(z)},G8);else this.prepareToShowTooltip(z)}onMouseMove(z){if(this.lastMouseEvent)this.lastMouseEvent=z;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(z){let J=z.relatedTarget,Q=this.tooltipCtrl.getGui(),Z=this.tooltipComp?.getGui();if(this.isInteractingWithTooltip||Q.contains(J)||this.interactionEnabled&&Z?.contains(J))return;this.setToDoNothing()}onKeyDown(){if(this.isInteractingWithTooltip)this.isInteractingWithTooltip=!1;this.setToDoNothing()}prepareToShowTooltip(z){if(this.state!=0||Bz)return;let J=0;if(z)J=this.isLastTooltipHiddenRecently()?this.getTooltipDelay("SwitchShow"):this.getTooltipDelay("Show");this.lastMouseEvent=z||null,this.showTooltipTimeoutId=window.setTimeout(this.showTooltip.bind(this),J),this.state=1}isLastTooltipHiddenRecently(){return Date.now()-H8this.hideTooltip(!0),...J.getAdditionalParams?.()});this.state=2,this.tooltipInstanceCount++;let Z=this.newTooltipComponentCallback.bind(this,this.tooltipInstanceCount);this.createTooltipComp(Q,Z)}hideTooltip(z){if(!z&&this.isInteractingWithTooltip)return;if(this.tooltipComp)this.destroyTooltipComp(),H8=Date.now();if(this.eventSvc.dispatchEvent({type:"tooltipHide",parentGui:this.tooltipCtrl.getGui()}),z)this.isInteractingWithTooltip=!1;this.setToDoNothing(!0)}newTooltipComponentCallback(z,J){if(this.state!==2||this.tooltipInstanceCount!==z){this.destroyBean(J);return}let Z=J.getGui();if(this.tooltipComp=J,!Z.classList.contains("ag-tooltip"))Z.classList.add("ag-tooltip-custom");if(this.tooltipTrigger===0)Z.classList.add("ag-tooltip-animate");if(this.interactionEnabled)Z.classList.add("ag-tooltip-interactive");let $=this.getLocaleTextFunc(),X=this.popupSvc?.addPopup({eChild:Z,ariaLabel:$("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(Z,{mouseenter:this.onTooltipMouseEnter.bind(this),mouseleave:this.onTooltipMouseLeave.bind(this)}),[this.onDocumentKeyDownCallback]=this.addManagedElementListeners(Y0(this.beans),{keydown:(Y)=>{if(!Z.contains(Y?.target))this.onKeyDown()}}),this.tooltipTrigger===1)[this.tooltipFocusInListener,this.tooltipFocusOutListener]=this.addManagedElementListeners(Z,{focusin:this.onTooltipFocusIn.bind(this),focusout:this.onTooltipFocusOut.bind(this)})}this.eventSvc.dispatchEvent({type:"tooltipShow",tooltipGui:Z,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 z=this.tooltipComp?.getGui(),J=d(this.beans);return!!z&&z.contains(J)}onTooltipFocusOut(z){let J=this.tooltipCtrl.getGui();if(this.isTooltipFocused())return;if(this.isInteractingWithTooltip=!1,J.contains(z.relatedTarget))this.startHideTimeout();else this.hideTooltip()}positionTooltip(){let z={type:"tooltip",ePopup:this.tooltipComp.getGui(),nudgeY:18,skipObserver:this.tooltipMouseTrack};if(this.lastMouseEvent)this.popupSvc?.positionPopupUnderMouseEvent({...z,mouseEvent:this.lastMouseEvent});else this.popupSvc?.positionPopupByComponent({...z,eventSource:this.tooltipCtrl.getGui(),position:"under",keepWithinBounds:!0,nudgeY:5})}destroyTooltipComp(){this.tooltipComp.getGui().classList.add("ag-tooltip-hiding");let z=this.tooltipPopupDestroyFunc,J=this.tooltipComp,Q=this.tooltipTrigger===0?tF:0;window.setTimeout(()=>{z(),this.destroyBean(J)},Q),this.clearTooltipListeners(),this.tooltipPopupDestroyFunc=void 0,this.tooltipComp=void 0}clearTooltipListeners(){for(let z of[this.tooltipMouseEnterListener,this.tooltipMouseLeaveListener,this.tooltipFocusInListener,this.tooltipFocusOutListener])if(z)z();this.tooltipMouseEnterListener=this.tooltipMouseLeaveListener=this.tooltipFocusInListener=this.tooltipFocusOutListener=null}lockService(){Bz=!0,this.interactiveTooltipTimeoutId=window.setTimeout(()=>{this.unlockService(),this.setToDoNothing()},G8)}unlockService(){Bz=!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()}},sF=class extends e${constructor(z,J,Q){super(z,Q);this.highlightTracker=J,this.onHighlight=this.onHighlight.bind(this)}postConstruct(){super.postConstruct(),this.wireHighlightListeners()}wireHighlightListeners(){this.addManagedPropertyListener("tooltipTrigger",({currentValue:z})=>{this.setTooltipMode(z)}),this.setTooltipMode(this.gos.get("tooltipTrigger")),this.highlightTracker.addEventListener("itemHighlighted",this.onHighlight)}onHighlight(z){if(this.tooltipMode!==1)return;if(z.highlighted)this.attemptToShowTooltip();else this.attemptToHideTooltip()}setTooltipMode(z="focus"){this.tooltipMode=z==="focus"?1:0}destroy(){this.highlightTracker.removeEventListener("itemHighlighted",this.onHighlight),super.destroy()}},lF=class extends yZ{constructor(){super({tag:"div",cls:"ag-tooltip"})}init(z){let{value:J}=z,Q=this.getGui();Q.textContent=P6(J);let Z=z.location.replace(/([a-z])([A-Z0-9])/g,"$1-$2").toLowerCase();Q.classList.add(`ag-${Z}-tooltip`)}},aF=".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}}",Ez=0,oF=200,eF=class extends O0{constructor(){super(...arguments);this.beanName="popupSvc",this.popupList=[]}postConstruct(){this.addManagedEventListeners({stylesChanged:this.handleThemeChange.bind(this)})}getPopupParent(){let z=this.gos.get("popupParent");if(z)return z;return this.getDefaultPopupParent()}positionPopupUnderMouseEvent(z){let{ePopup:J,nudgeX:Q,nudgeY:Z,skipObserver:$}=z;this.positionPopup({ePopup:J,nudgeX:Q,nudgeY:Z,keepWithinBounds:!0,skipObserver:$,updatePosition:()=>this.calculatePointerAlign(z.mouseEvent),postProcessCallback:()=>this.callPostProcessPopup(z.additionalParams,z.type,z.ePopup,null,z.mouseEvent)})}calculatePointerAlign(z){let J=this.getParentRect();return{x:z.clientX-J.left,y:z.clientY-J.top}}positionPopupByComponent(z){let{ePopup:J,nudgeX:Q,nudgeY:Z,keepWithinBounds:$,eventSource:X,alignSide:Y="left",position:q="over",type:G}=z,H=X.getBoundingClientRect(),_=this.getParentRect();this.setAlignedTo(X,J);let U=()=>{let W=H.left-_.left;if(Y==="right")W-=J.offsetWidth-H.width;let B;if(q==="over")B=H.top-_.top,this.setAlignedStyles(J,"over");else if(this.setAlignedStyles(J,"under"),this.shouldRenderUnderOrAbove(J,H,_,z.nudgeY||0)==="under")B=H.top-_.top+H.height;else B=H.top-J.offsetHeight-(Z||0)*2-_.top;return{x:W,y:B}};this.positionPopup({ePopup:J,nudgeX:Q,nudgeY:Z,keepWithinBounds:$,updatePosition:U,postProcessCallback:()=>this.callPostProcessPopup(z.additionalParams,G,J,X,null)})}positionPopupForMenu(z){let{eventSource:J,ePopup:Q,event:Z}=z,$=J.getBoundingClientRect(),X=this.getParentRect();this.setAlignedTo(J,Q);let Y=!1,q=()=>{let G=this.keepXYWithinBounds(Q,$.top-X.top,0),H=Q.clientWidth>0?Q.clientWidth:200;if(!Y)Q.style.minWidth=`${H}px`,Y=!0;let U=X.right-X.left-H,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 $.right-X.left-2}function E(){return $.left-X.left-H}};this.positionPopup({ePopup:Q,keepWithinBounds:!0,updatePosition:q,postProcessCallback:()=>this.callPostProcessPopup(z.additionalParams,"subMenu",Q,J,Z instanceof MouseEvent?Z:void 0)})}shouldRenderUnderOrAbove(z,J,Q,Z){let $=Q.bottom-J.bottom,X=J.top-Q.top,Y=z.offsetHeight+Z;if($>Y)return"under";if(X>Y||X>$)return"above";return"under"}setAlignedStyles(z,J){let Q=this.getPopupIndex(z);if(Q===-1)return;let Z=this.popupList[Q],{alignedToElement:$}=Z;if(!$)return;let X=["right","left","over","above","under"];for(let Y of X)$.classList.remove(`ag-has-popup-positioned-${Y}`),z.classList.remove(`ag-popup-positioned-${Y}`);if(!J)return;$.classList.add(`ag-has-popup-positioned-${J}`),z.classList.add(`ag-popup-positioned-${J}`)}setAlignedTo(z,J){let Q=this.getPopupIndex(J);if(Q!==-1){let Z=this.popupList[Q];Z.alignedToElement=z}}positionPopup(z){let{ePopup:J,keepWithinBounds:Q,nudgeX:Z,nudgeY:$,skipObserver:X,updatePosition:Y}=z,q={width:0,height:0},G=(H=!1)=>{let{x:_,y:U}=Y();if(H&&J.clientWidth===q.width&&J.clientHeight===q.height)return;if(q.width=J.clientWidth,q.height=J.clientHeight,Z)_+=Z;if($)U+=$;if(Q)_=this.keepXYWithinBounds(J,_,1),U=this.keepXYWithinBounds(J,U,0);if(J.style.left=`${_}px`,J.style.top=`${U}px`,z.postProcessCallback)z.postProcessCallback()};if(G(),!X){let H=P4(this.beans,J,()=>G(!0));setTimeout(()=>H(),oF)}}getParentRect(){let z=Y0(this.beans),J=this.getPopupParent();if(J===z.body)J=z.documentElement;else if(getComputedStyle(J).position==="static")J=J.offsetParent;return C8(J)}keepXYWithinBounds(z,J,Q){let Z=Q===0,$=Z?"clientHeight":"clientWidth",X=Z?"top":"left",Y=Z?"height":"width",q=Z?"scrollTop":"scrollLeft",G=Y0(this.beans),H=G.documentElement,_=this.getPopupParent(),U=z.getBoundingClientRect(),W=_.getBoundingClientRect(),B=G.documentElement.getBoundingClientRect(),E=_===G.body,K=Math.ceil(U[Y]),L=E?(Z?I8:Oz)(H)+H[q]:_[$];if(E)L-=Math.abs(B[X]-W[X]);let D=L-K;return Math.min(Math.max(J,0),Math.max(D,0))}addPopup(z){let{eChild:J,ariaLabel:Q,ariaOwns:Z,alwaysOnTop:$,positionCallback:X,anchorToElement:Y}=z,q=this.getPopupIndex(J);if(q!==-1)return{hideFunc:this.popupList[q].hideFunc};this.initialisePopupPosition(J);let G=this.createPopupWrapper(J,!!$,Q,Z),H=this.addEventListenersToPopup({...z,wrapperEl:G});if(X)X();return this.addPopupToPopupList(J,G,H,Y),{hideFunc:H}}initialisePopupPosition(z){let Q=this.getPopupParent().getBoundingClientRect();if(!T(z.style.top))z.style.top=`${Q.top*-1}px`;if(!T(z.style.left))z.style.left=`${Q.left*-1}px`}createPopupWrapper(z,J,Q,Z){let $=this.getPopupParent(),{environment:X,gos:Y}=this.beans,q=F0({tag:"div"});if(X.applyThemeClasses(q),q.classList.add("ag-popup"),z.classList.add(Y.get("enableRtl")?"ag-rtl":"ag-ltr","ag-popup-child"),!z.hasAttribute("role"))H0(z,"dialog");if(Q)_0(z,Q);else if(Z)z.id||(z.id=`popup-component-${Ez}`),q7(Z,z.id);if(q.appendChild(z),$.appendChild(q),J)this.setAlwaysOnTop(z,!0);else this.bringPopupToFront(z);return q}addEventListenersToPopup(z){let J=this.beans,Q=Y0(J),{wrapperEl:Z,eChild:$,closedCallback:X,afterGuiAttached:Y,closeOnEsc:q,modal:G,ariaOwns:H}=z,_=!1,U=(K)=>{if(!Z.contains(d(J)))return;if(K.key===k.ESCAPE&&!this.isStopPropagation(K))E({keyboardEvent:K})},W=(K)=>E({mouseEvent:K}),B=(K)=>E({touchEvent:K}),E=(K={})=>{let{mouseEvent:F,touchEvent:L,keyboardEvent:D,forceHide:M}=K;if(!M&&(this.isEventFromCurrentPopup({mouseEvent:F,touchEvent:L},$)||_))return;if(_=!0,Z.remove(),Q.removeEventListener("keydown",U),Q.removeEventListener("mousedown",W),Q.removeEventListener("touchstart",B),Q.removeEventListener("contextmenu",W),this.eventSvc.removeListener("dragStarted",W),X)X(F||L||D);this.removePopupFromPopupList($,H)};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,J,Q,Z){if(this.popupList.push({element:z,wrapper:J,hideFunc:Q,instanceId:Ez,isAnchored:!!Z}),Z)this.setPopupPositionRelatedToElement(z,Z);Ez=Ez+1}getPopupIndex(z){return this.popupList.findIndex((J)=>J.element===z)}setPopupPositionRelatedToElement(z,J){let Q=this.getPopupIndex(z);if(Q===-1)return;let Z=this.popupList[Q];if(Z.stopAnchoringPromise)Z.stopAnchoringPromise.then((X)=>X&&X());if(Z.stopAnchoringPromise=void 0,Z.isAnchored=!1,!J)return;let $=this.keepPopupPositionedRelativeTo({element:J,ePopup:z,hidePopup:Z.hideFunc});return Z.stopAnchoringPromise=$,Z.isAnchored=!0,$}removePopupFromPopupList(z,J){if(this.setAlignedStyles(z,null),this.setPopupPositionRelatedToElement(z,null),J)q7(J,null);this.popupList=this.popupList.filter((Q)=>Q.element!==z)}keepPopupPositionedRelativeTo(z){let J=this.getPopupParent(),Q=J.getBoundingClientRect(),{element:Z,ePopup:$}=z,X=Z.getBoundingClientRect(),Y=(U)=>Number.parseInt(U.substring(0,U.length-1),10),q=(U,W)=>{let B=Q[U]-X[U],E=Y($.style[U]);return{initialDiff:B,lastDiff:B,initial:E,last:E,direction:W}},G=q("top",0),H=q("left",1),_=this.beans.frameworkOverrides;return new N((U)=>{_.wrapIncoming(()=>{KH(()=>{let W=J.getBoundingClientRect(),B=Z.getBoundingClientRect();if(B.top==0&&B.left==0&&B.height==0&&B.width==0){z.hidePopup();return}let K=(F,L)=>{let D=Y($.style[L]);if(F.last!==D)F.initial=D,F.last=D;let M=W[L]-B[L];if(M!=F.lastDiff){let f=this.keepXYWithinBounds($,F.initial+F.initialDiff-M,F.direction);$.style[L]=`${f}px`,F.last=f}F.lastDiff=M};K(G,"top"),K(H,"left")},200).then((W)=>{U(()=>{if(W!=null)window.clearInterval(W)})})},"popupPositioning")})}isEventFromCurrentPopup(z,J){let{mouseEvent:Q,touchEvent:Z}=z,$=Q?Q:Z;if(!$)return!1;let X=this.getPopupIndex(J);if(X===-1)return!1;for(let Y=X;Yz.element)}hasAnchoredPopup(){return this.popupList.some((z)=>z.isAnchored)}isStopPropagation(z){return q4(z)}},Y2={moduleName:"Popup",version:c,beans:[zL]};function g2(z){return z.get("tooltipShowMode")==="whenTruncated"}function r2(z,J){return g2(z)?C2(J):void 0}var JL=(z,J)=>{let Q=z;if(typeof Q.getTranslatedMessage==="function")return Q.getTranslatedMessage(J);return z.message},lQ=(z,J,Q)=>{let{editModelSvc:Z}=z,$=Z?.getCellValidationModel()?.getCellValidation(J)?.errorMessages,X=Z?.getRowValidationModel().getRowValidation(J)?.errorMessages,Y=$||X;return Y?.length?Y.join(Q("tooltipValidationErrorSeparator",". ")):void 0},QL=(z,J)=>{if(!g2(z.gos))return;if(J.isCellRenderer()){let Z=J.column.getColDef();if(!(!!Z.showRowGroup||Z.cellRenderer==="agGroupCellRenderer"))return;return C2(()=>{let X=J.eGui;return X.querySelector(".ag-group-value")||X.querySelector(".ag-cell-value")||X})}return C2(()=>{let Z=J.eGui;return Z.children.length===0?Z:Z.querySelector(".ag-cell-value")})},ZL=(z,J,Q)=>{let{editSvc:Z}=z,{column:$}=J,X=QL(z,J),Y=()=>{if(Z?.isEditing(J))return!1;if(!X)return!0;if(!$.isTooltipEnabled())return!1;return X()};return{shouldDisplayDefault:Y,shouldDisplayColumnTooltip:Y,shouldDisplayCustomTooltip:Q??Y}},$L=({beans:z,ctrl:J,value:Q,displayFunctions:Z,translate:$})=>{let{editSvc:X,formula:Y,gos:q}=z,{column:G,rowNode:H}=J;if(Y?.active&&G.isAllowFormula()){let F=Y.getFormulaError(G,H);if(F)return{value:JL(F,$),location:"cellFormula",shouldDisplay:()=>!!Y?.getFormulaError(G,H)}}if(!X?.isEditing(J)){let F=lQ(z,J,$);if(F)return{value:F,location:"cellEditor",shouldDisplay:()=>!X?.isEditing(J)&&!!lQ(z,J,$)}}let{shouldDisplayCustomTooltip:U,shouldDisplayColumnTooltip:W}=Z;if(Q!=null)return{value:Q,location:"cell",shouldDisplay:U};let B=G.getColDef(),E=H.data;if(B.tooltipField&&T(E))return{value:W6(E,B.tooltipField,G.isTooltipFieldContainsDots()),location:"cell",shouldDisplay:W};let K=B.tooltipValueGetter;if(K)return{value:K(C(q,{location:"cell",colDef:G.getColDef(),column:G,rowIndex:J.cellPosition.rowIndex,node:H,data:H.data,value:J.value,valueFormatted:J.valueFormatted})),location:"cell",shouldDisplay:W};return null},XL=class extends V{constructor(){super(...arguments);this.beanName="tooltipSvc"}setupHeaderTooltip(z,J,Q,Z){if(z)J.destroyBean(z);let $=this.gos,X=g2($),{column:Y,eGui:q}=J,G=Y.getColDef();if(!Z&&X&&!G.headerComponent)Z=C2(()=>q.querySelector(".ag-header-cell-text"));let H="header",_="header",U=this.beans.colNames.getDisplayNameForColumn(Y,_,!0),W=Q??U,B={getGui:()=>q,getLocation:()=>H,getTooltipValue:()=>Q??G?.headerTooltipValueGetter?.(C($,{location:H,colDef:G,column:Y,value:W,valueFormatted:U}))??G?.headerTooltip,shouldDisplayTooltip:Z,getAdditionalParams:()=>({column:Y,colDef:Y.getColDef()})},E=this.createTooltipFeature(B);if(E)E=J.createBean(E),J.setRefreshFunction("tooltip",()=>E.refreshTooltip());return E}setupHeaderGroupTooltip(z,J,Q,Z){if(z)J.destroyBean(z);let $=this.gos,X=g2($),{column:Y,eGui:q}=J,G=Y.getColGroupDef();if(!Z&&X&&!G?.headerGroupComponent)Z=C2(()=>q.querySelector(".ag-header-group-text"));let H="headerGroup",_="header",U=this.beans.colNames.getDisplayNameForColumnGroup(Y,_),W=Q??U,B={getGui:()=>q,getLocation:()=>H,getTooltipValue:()=>Q??G?.headerTooltipValueGetter?.(C($,{location:H,colDef:G,column:Y,value:W,valueFormatted:U}))??G?.headerTooltip,shouldDisplayTooltip:Z,getAdditionalParams:()=>{let K={column:Y};if(G)K.colDef=G;return K}},E=this.createTooltipFeature(B);return E?J.createBean(E):E}enableCellTooltipFeature(z,J,Q){let{beans:Z}=this,{column:$,rowNode:X}=z,Y=ZL(Z,z,Q),q=this.getLocaleTextFunc(),G=null,H=()=>{return G=$L({beans:Z,ctrl:z,value:J,displayFunctions:Y,translate:q}),G},U={getGui:()=>z.eGui,getLocation:()=>G?.location??"cell",getTooltipValue:()=>H()?.value,shouldDisplayTooltip:()=>{let W=G??H();if(!W)return!1;return W.shouldDisplay?W.shouldDisplay():!0},getAdditionalParams:()=>({column:$,colDef:$.getColDef(),rowIndex:z.cellPosition.rowIndex,node:X,data:X.data,valueFormatted:z.valueFormatted})};return this.createTooltipFeature(U,Z)}setupFullWidthRowTooltip(z,J,Q,Z){let $={getGui:()=>J.getFullWidthElement(),getTooltipValue:()=>Q,getLocation:()=>"fullWidthRow",shouldDisplayTooltip:Z},X=this.beans,Y=X.context;if(z)J.destroyBean(z,Y);let q=this.createTooltipFeature($,X);if(!q)return;return J.createBean(q,Y)}setupCellEditorTooltip(z,J){let{beans:Q}=this,{context:Z}=Q,$=J.getValidationElement?.(!0)||!J.isPopup?.()&&z.eGui;if(!$)return;let X={getGui:()=>$,getTooltipValue:()=>lQ(Q,z,this.getLocaleTextFunc()),getLocation:()=>"cellEditor",shouldDisplayTooltip:()=>{let{editModelSvc:q}=Q,G=q?.getRowValidationModel()?.getRowValidationMap(),H=q?.getCellValidationModel()?.getCellValidationMap(),_=!!G&&G.size>0,U=!!H&&H.size>0;return _||U}},Y=this.createTooltipFeature(X,Q);if(!Y)return;return z.createBean(Y,Z)}initCol(z){let{colDef:J}=z;z.tooltipEnabled=T(J.tooltipField)||T(J.tooltipValueGetter)||T(J.tooltipComponent)}createTooltipFeature(z,J){return this.beans.registry.createDynamicBean("tooltipFeature",!1,z,J)}},YL=class extends rF{createTooltipComp(z,J){dH(this.beans.userCompFactory,z)?.newAgStackInstance().then(J)}setEventHandlers(z){[this.onColumnMovedEventCallback]=this.addManagedEventListeners({columnMoved:z})}clearEventHandlers(){this.onColumnMovedEventCallback?.(),this.onColumnMovedEventCallback=void 0}},qL={moduleName:"Tooltip",version:c,beans:[XL],dynamicBeans:{tooltipFeature:e$,highlightTooltipFeature:sF,tooltipStateManager:YL},userComponents:{agTooltipComponent:lF},dependsOn:[Y2],css:[aF]};var GL=".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 s2=class extends V2{constructor(z,J="ag-text-field",Q="text"){super(z,J,Q)}postConstruct(){if(super.postConstruct(),this.config.allowedCharPattern)this.preventDisallowedCharacters()}setValue(z,J){let Q=this.eInput;if(Q.value!==z)Q.value=T(z)?z:"";return super.setValue(z,J)}setStartValue(z){this.setValue(z,!0)}setCustomValidity(z){let J=this.eInput,Q=z.length>0;if(J.setCustomValidity(z),Q)J.reportValidity();qZ(J,Q)}preventDisallowedCharacters(){let z=new RegExp(`[${this.config.allowedCharPattern}]`),J=(Q)=>{if(!s9(Q))return;if(Q.key&&!z.test(Q.key))Q.preventDefault()};this.addManagedListeners(this.eInput,{keydown:J,paste:(Q)=>{if(Q.clipboardData?.getData("text")?.split("").some(($)=>!z.test($)))Q.preventDefault()}})}},e4={selector:"AG-INPUT-TEXT-FIELD",component:s2};var HL=class extends z_{constructor(z){super();this.cellEditorInput=z,this.eEditor=j}initialiseEditor(z){let{cellEditorInput:J}=this;this.setTemplate({tag:"div",cls:"ag-cell-edit-wrapper",children:[J.getTemplate()]},J.getAgComponents());let{eEditor:Q}=this,{cellStartedEdit:Z,eventKey:$,suppressPreventDefault:X}=z;Q.getInputElement().setAttribute("title",""),J.init(Q,z);let Y,q=!0;if(Z){if(this.focusAfterAttached=!0,$===k.BACKSPACE||$===k.DELETE)Y="";else if($&&$.length===1)if(X)q=!1;else Y=$;else if(Y=J.getStartValue(),$!==k.F2)this.highlightAllOnFocus=!0}else this.focusAfterAttached=!1,Y=J.getStartValue();if(q&&Y!=null)Q.setStartValue(Y);this.addGuiEventListener("keydown",(G)=>{let{key:H}=G;if(H===k.PAGE_UP||H===k.PAGE_DOWN)G.preventDefault()})}afterGuiAttached(){let z=this.getLocaleTextFunc(),J=this.eEditor;if(J.setInputAriaLabel(z("ariaInputEditor","Input Editor")),!this.focusAfterAttached)return;if(!A1())J.getFocusableElement().focus();let Q=J.getInputElement();if(this.highlightAllOnFocus)Q.select();else this.cellEditorInput.setCaret?.()}focusIn(){let{eEditor:z}=this,J=z.getFocusableElement(),Q=z.getInputElement();J.focus(),Q.select()}getValue(){return this.cellEditorInput.getValue()}agSetEditValue(z){this.params.value=z;let J=this.cellEditorInput.getStartValue();this.eEditor.setStartValue(J??null)}isPopup(){return!1}getValidationElement(){return this.eEditor.getInputElement()}getValidationErrors(){return this.cellEditorInput.getValidationErrors()}};var zX=class extends s2{constructor(z){super(z,"ag-number-field","number")}postConstruct(){super.postConstruct();let z=this.eInput;this.addManagedListeners(z,{blur:()=>{let X=Number.parseFloat(z.value),Y=isNaN(X)?"":this.normalizeValue(X.toString());if(this.value!==Y)this.setValue(Y)},wheel:this.onWheel.bind(this)}),z.step="any";let{precision:J,min:Q,max:Z,step:$}=this.config;if(typeof J==="number")this.setPrecision(J);if(typeof Q==="number")this.setMin(Q);if(typeof Z==="number")this.setMax(Z);if(typeof $==="number")this.setStep($)}onWheel(z){if(d(this.beans)===this.eInput)z.preventDefault()}normalizeValue(z){if(z==="")return"";if(this.precision!=null)z=this.adjustPrecision(z);return z}adjustPrecision(z,J){let Q=this.precision;if(Q==null)return z;if(J){let $=Number.parseFloat(z).toFixed(Q);return Number.parseFloat($).toString()}let Z=String(z).split(".");if(Z.length>1){if(Z[1].length<=Q)return z;else if(Q>0)return`${Z[0]}.${Z[1].slice(0,Q)}`}return Z[0]}setMin(z){if(this.min===z)return this;return this.min=z,V4(this.eInput,"min",z),this}setMax(z){if(this.max===z)return this;return this.max=z,V4(this.eInput,"max",z),this}setPrecision(z){return this.precision=z,this}setStep(z){if(this.step===z)return this;return this.step=z,V4(this.eInput,"step",z),this}setValue(z,J){return this.setValueOrInputValue((Q)=>super.setValue(Q,J),()=>this,z)}setStartValue(z){return this.setValueOrInputValue((J)=>super.setValue(J,!0),(J)=>{this.eInput.value=J},z)}setValueOrInputValue(z,J,Q){if(T(Q)){let Z=this.isScientificNotation(Q);if(Z&&this.eInput.validity.valid)return z(Q);if(!Z){Q=this.adjustPrecision(Q);let $=this.normalizeValue(Q);Z=Q!=$}if(Z)return J(Q)}return z(Q)}getValue(z=!1){let J=this.eInput;if(!J.validity.valid&&!z)return;let Q=J.value;if(this.isScientificNotation(Q))return this.adjustPrecision(Q,!0);return super.getValue()}isScientificNotation(z){return typeof z==="string"&&z.includes("e")}};var _L=".ag-list-item{align-items:center;display:flex;height:var(--ag-list-item-height);overflow:hidden;text-overflow:ellipsis;white-space:nowrap;&.ag-active-item{background-color:var(--ag-row-hover-color)}}",UL="ag-active-item",WL=(z,J)=>({tag:"div",cls:`ag-list-item ag-${z}-list-item`,attrs:{role:"option"},children:[{tag:"span",cls:`ag-list-item-text ag-${z}-list-item-text`,ref:"eText",children:J}]}),BL=class extends x0{constructor(z,J,Q){super(WL(z,J));this.label=J,this.value=Q,this.eText=j}postConstruct(){this.createTooltip(),this.addEventListeners()}setHighlighted(z){let J=this.getGui();J.classList.toggle(UL,z),az(J,z),this.dispatchLocalEvent({type:"itemHighlighted",highlighted:z})}getHeight(){return this.getGui().clientHeight}setIndex(z,J){let Q=this.getGui();v6(Q,z),T6(Q,J)}createTooltip(){let z={getTooltipValue:()=>this.label,getGui:()=>this.getGui(),getLocation:()=>"UNKNOWN",shouldDisplayTooltip:()=>w8(this.eText)},J=this.createOptionalManagedBean(this.beans.registry.createDynamicBean("highlightTooltipFeature",!1,z,this));if(J)this.tooltipFeature=J}addEventListeners(){let z=this.getParentComponent();if(!z)return;this.addGuiEventListener("mouseover",()=>{z.highlightItem(this)}),this.addGuiEventListener("mousedown",(J)=>{J.preventDefault(),J.stopPropagation(),z.setValue(this.value)})}},EL=class extends x0{constructor(z="default"){super({tag:"div",cls:`ag-list ag-${z}-list`});this.cssIdentifier=z,this.options=[],this.listItems=[],this.highlightedItem=null,this.registerCSS(_L)}postConstruct(){let z=this.getGui();this.addManagedElementListeners(z,{mouseleave:()=>this.clearHighlighted()})}handleKeyDown(z){let J=z.key;switch(J){case k.ENTER:if(!this.highlightedItem)this.setValue(this.getValue());else{let Q=this.listItems.indexOf(this.highlightedItem);this.setValueByIndex(Q)}break;case k.DOWN:case k.UP:z.preventDefault(),this.navigate(J);break;case k.PAGE_DOWN:case k.PAGE_UP:case k.PAGE_HOME:case k.PAGE_END:z.preventDefault(),this.navigateToPage(J);break}}addOptions(z){for(let J of z)this.addOption(J);return this}addOption(z){let{value:J,text:Q}=z,Z=Q??J;return this.options.push({value:J,text:Z}),this.renderOption(J,Z),this.updateIndices(),this}clearOptions(){this.options=[],this.reset(!0);for(let z of this.listItems)z.destroy();J0(this.getGui()),this.listItems=[],this.refreshAriaRole()}updateOptions(z){let J=this.options!==z;if(J)this.clearOptions(),this.addOptions(z);return J}setValue(z,J){if(this.value===z)return this.fireItemSelected(),this;if(z==null)return this.reset(J),this;let Q=this.options.findIndex((Z)=>Z.value===z);if(Q!==-1){let Z=this.options[Q];if(this.value=Z.value,this.displayValue=Z.text,this.highlightItem(this.listItems[Q]),!J)this.fireChangeEvent()}return this}setValueByIndex(z){return this.setValue(this.options[z].value)}getValue(){return this.value}getDisplayValue(){return this.displayValue}refreshHighlighted(){this.clearHighlighted();let z=this.options.findIndex((J)=>J.value===this.value);if(z!==-1)this.highlightItem(this.listItems[z])}highlightItem(z){let J=z.getGui();if(!M0(J))return;this.clearHighlighted(),z.setHighlighted(!0),this.highlightedItem=z;let Q=this.getGui(),{scrollTop:Z,clientHeight:$}=Q,{offsetTop:X,offsetHeight:Y}=J;if(X+Y>Z+$||X{Q.setIndex(Z+1,J)})}fireChangeEvent(){this.dispatchLocalEvent({type:"fieldValueChanged"}),this.fireItemSelected()}fireItemSelected(){this.dispatchLocalEvent({type:"selectedItem"})}},KL=".ag-picker-field-display{flex:1 1 auto}.ag-picker-field{align-items:center;display:flex}.ag-picker-field-icon{border:0;cursor:pointer;display:flex;margin:0;padding:0}.ag-picker-field-wrapper{background-color:var(--ag-picker-button-background-color);border:var(--ag-picker-button-border);border-radius:5px;min-height:max(var(--ag-list-item-height),calc(var(--ag-spacing)*4));overflow:hidden;&:where(.invalid){background-color:var(--ag-input-invalid-background-color);border:var(--ag-input-invalid-border);color:var(--ag-input-invalid-text-color)}}.ag-picker-field-wrapper:where(.ag-picker-has-focus),.ag-picker-field-wrapper:where(:focus-within){background-color:var(--ag-picker-button-focus-background-color);border:var(--ag-picker-button-focus-border);box-shadow:var(--ag-focus-shadow);&:where(.invalid){box-shadow:var(--ag-focus-error-shadow)}}.ag-picker-field-wrapper:disabled{opacity:.5}",FL={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-picker-collapsed",children:[{tag:"div",ref:"eDisplayField",cls:"ag-picker-field-display"},{tag:"div",ref:"eIcon",cls:"ag-picker-field-icon",attrs:{"aria-hidden":"true"}}]}]},LL=class extends k${constructor(z){super(z,z?.template||FL,z?.agComponents||[],z?.className);if(this.isPickerDisplayed=!1,this.skipClick=!1,this.pickerGap=4,this.hideCurrentPicker=null,this.eLabel=j,this.eWrapper=j,this.eDisplayField=j,this.eIcon=j,this.registerCSS(KL),this.ariaRole=z?.ariaRole,this.onPickerFocusIn=this.onPickerFocusIn.bind(this),this.onPickerFocusOut=this.onPickerFocusOut.bind(this),!z)return;let{pickerGap:J,maxPickerHeight:Q,variableWidth:Z,minPickerWidth:$,maxPickerWidth:X}=z;if(J!=null)this.pickerGap=J;if(this.variableWidth=!!Z,Q!=null)this.setPickerMaxHeight(Q);if($!=null)this.setPickerMinWidth($);if(X!=null)this.setPickerMaxWidth(X)}postConstruct(){super.postConstruct(),this.setupAria();let z=`ag-${this.getCompId()}-display`;this.eDisplayField.setAttribute("id",z);let J=this.getAriaElement();this.addManagedElementListeners(J,{keydown:this.onKeyDown.bind(this)}),this.addManagedElementListeners(this.eLabel,{mousedown:this.onLabelOrWrapperMouseDown.bind(this)}),this.addManagedElementListeners(this.eWrapper,{mousedown:this.onLabelOrWrapperMouseDown.bind(this)});let{pickerIcon:Q,inputWidth:Z}=this.config;if(Q){let $=this.beans.iconSvc.createIconNoSpan(Q);if($)this.eIcon.appendChild($)}if(Z!=null)this.setInputWidth(Z)}setupAria(){let z=this.getAriaElement();if(z.setAttribute("tabindex",this.gos.get("tabIndex").toString()),R0(z,!1),this.ariaRole)H0(z,this.ariaRole)}onLabelOrWrapperMouseDown(z){if(z){let J=this.getFocusableElement();if(J!==this.eWrapper&&z?.target===J)return;z.preventDefault(),this.getFocusableElement().focus()}if(this.skipClick){this.skipClick=!1;return}if(this.isDisabled())return;if(this.isPickerDisplayed)this.hidePicker();else this.showPicker()}onKeyDown(z){switch(z.key){case k.UP:case k.DOWN:case k.ENTER:case k.SPACE:z.preventDefault(),this.onLabelOrWrapperMouseDown();break;case k.ESCAPE:if(this.isPickerDisplayed){if(z.preventDefault(),z.stopPropagation(),this.hideCurrentPicker)this.hideCurrentPicker()}break}}showPicker(){if(this.isPickerDisplayed=!0,!this.pickerComponent)this.pickerComponent=this.createPickerComponent();let z=this.pickerComponent.getGui();z.addEventListener("focusin",this.onPickerFocusIn),z.addEventListener("focusout",this.onPickerFocusOut),this.hideCurrentPicker=this.renderAndPositionPicker(),this.toggleExpandedStyles(!0)}renderAndPositionPicker(){let z=this.pickerComponent.getGui();if(!this.gos.get("suppressScrollWhenPopupsAreOpen"))[this.destroyMouseWheelFunc]=this.addManagedEventListeners({bodyScroll:()=>{this.hidePicker()}});let J=this.getLocaleTextFunc(),{config:{pickerAriaLabelKey:Q,pickerAriaLabelValue:Z,modalPicker:$=!0},maxPickerHeight:X,minPickerWidth:Y,maxPickerWidth:q,variableWidth:G,beans:H,eWrapper:_}=this,U={modal:$,eChild:z,closeOnEsc:!0,closedCallback:()=>{let K=f1(H);if(this.beforeHidePicker(),K&&this.isAlive())this.getFocusableElement().focus()},ariaLabel:J(Q,Z),anchorToElement:_};z.style.position="absolute";let W=H.popupSvc,B=W.addPopup(U);if(G){if(Y)z.style.minWidth=Y;if(z.style.width=WZ(Oz(_)),q)z.style.maxWidth=q}else vz(z,q??Oz(_));let E=X??`${I6(W.getPopupParent())}px`;return z.style.setProperty("max-height",E),this.alignPickerToComponent(),B.hideFunc}alignPickerToComponent(){if(!this.pickerComponent)return;let{pickerGap:z,config:{pickerType:J},beans:{popupSvc:Q,gos:Z},eWrapper:$,pickerComponent:X}=this,Y=Z.get("enableRtl")?"right":"left";Q.positionPopupByComponent({type:J,eventSource:$,ePopup:X.getGui(),position:"under",alignSide:Y,keepWithinBounds:!0,nudgeY:z})}beforeHidePicker(){if(this.destroyMouseWheelFunc)this.destroyMouseWheelFunc(),this.destroyMouseWheelFunc=void 0;this.toggleExpandedStyles(!1);let z=this.pickerComponent.getGui();z.removeEventListener("focusin",this.onPickerFocusIn),z.removeEventListener("focusout",this.onPickerFocusOut),this.isPickerDisplayed=!1,this.pickerComponent=void 0,this.hideCurrentPicker=null}toggleExpandedStyles(z){if(!this.isAlive())return;let J=this.getAriaElement();R0(J,z);let Q=this.eWrapper.classList;Q.toggle("ag-picker-expanded",z),Q.toggle("ag-picker-collapsed",!z)}onPickerFocusIn(){this.togglePickerHasFocus(!0)}onPickerFocusOut(z){if(!this.pickerComponent?.getGui().contains(z.relatedTarget))this.togglePickerHasFocus(!1)}togglePickerHasFocus(z){if(!this.pickerComponent)return;this.eWrapper.classList.toggle("ag-picker-has-focus",z)}hidePicker(){if(this.hideCurrentPicker)this.hideCurrentPicker(),this.dispatchLocalEvent({type:"pickerHidden"})}setInputWidth(z){return vz(this.eWrapper,z),this}getFocusableElement(){return this.eWrapper}setPickerGap(z){return this.pickerGap=z,this}setPickerMinWidth(z){if(typeof z==="number")z=`${z}px`;return this.minPickerWidth=z==null?void 0:z,this}setPickerMaxWidth(z){if(typeof z==="number")z=`${z}px`;return this.maxPickerWidth=z==null?void 0:z,this}setPickerMaxHeight(z){if(typeof z==="number")z=`${z}px`;return this.maxPickerHeight=z==null?void 0:z,this}destroy(){this.hidePicker(),super.destroy()}},DL=".ag-select{align-items:center;display:flex;&.ag-disabled{opacity:.5}}.ag-select:where(:not(.ag-cell-editor,.ag-label-align-top)){min-height:var(--ag-list-item-height)}:where(.ag-select){.ag-picker-field-wrapper{cursor:default;padding-left:var(--ag-spacing);padding-right:var(--ag-spacing)}&.ag-disabled .ag-picker-field-wrapper:focus{box-shadow:none}.ag-picker-field-display{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.ag-picker-field-icon{align-items:center;display:flex}}.ag-select-list{background-color:var(--ag-picker-list-background-color);border:var(--ag-picker-list-border);border-radius:var(--ag-border-radius);box-shadow:var(--ag-dropdown-shadow);overflow:hidden auto}.ag-select-list-item{cursor:default;-webkit-user-select:none;-moz-user-select:none;user-select:none}:where(.ag-ltr) .ag-select-list-item{padding-left:var(--ag-spacing)}:where(.ag-rtl) .ag-select-list-item{padding-right:var(--ag-spacing)}.ag-select-list-item-text{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}",ML=class extends LL{constructor(z){super({pickerAriaLabelKey:"ariaLabelSelectField",pickerAriaLabelValue:"Select Field",pickerType:"ag-list",className:"ag-select",pickerIcon:"selectOpen",ariaRole:"combobox",...z});this.registerCSS(DL)}postConstruct(){this.tooltipFeature=this.createOptionalManagedBean(this.beans.registry.createDynamicBean("tooltipFeature",!1,{shouldDisplayTooltip:C2(()=>this.eDisplayField),getGui:()=>this.getGui()})),super.postConstruct(),this.createListComponent(),this.eWrapper.tabIndex=this.gos.get("tabIndex");let{options:z,value:J,placeholder:Q}=this.config;if(z!=null)this.addOptions(z);if(J!=null)this.setValue(J,!0);if(Q&&J==null)this.eDisplayField.textContent=Q;this.addManagedElementListeners(this.eWrapper,{focusout:this.onWrapperFocusOut.bind(this)})}onWrapperFocusOut(z){if(!this.eWrapper.contains(z.relatedTarget))this.hidePicker()}createListComponent(){let z=this.createBean(new EL("select"));this.listComponent=z,z.setParentComponent(this);let J=z.getAriaElement(),Q=`ag-select-list-${z.getCompId()}`;J.setAttribute("id",Q),GZ(this.getAriaElement(),J),z.addManagedElementListeners(z.getGui(),{mousedown:(Z)=>{Z?.preventDefault()}}),z.addManagedListeners(z,{selectedItem:()=>{this.hidePicker(),this.dispatchLocalEvent({type:"selectedItem"})},fieldValueChanged:()=>{if(!this.listComponent)return;this.setValue(this.listComponent.getValue(),!1,!0),this.hidePicker()}})}createPickerComponent(){return this.listComponent}beforeHidePicker(){this.listComponent?.hideItemTooltip(),super.beforeHidePicker()}onKeyDown(z){let{key:J}=z;if(J===k.TAB)this.hidePicker();switch(J){case k.ENTER:case k.UP:case k.DOWN:case k.PAGE_UP:case k.PAGE_DOWN:case k.PAGE_HOME:case k.PAGE_END:if(z.preventDefault(),this.isPickerDisplayed)this.listComponent?.handleKeyDown(z);else super.onKeyDown(z);break;case k.ESCAPE:super.onKeyDown(z);break;case k.SPACE:if(this.isPickerDisplayed)z.preventDefault();else super.onKeyDown(z);break}}showPicker(){let z=this.listComponent;if(!z)return;super.showPicker(),z.refreshHighlighted()}addOptions(z){for(let J of z)this.addOption(J);return this}addOption(z){return this.listComponent.addOption(z),this}clearOptions(){return this.listComponent?.clearOptions(),this.setValue(void 0,!0),this}updateOptions(z){if(this.listComponent?.updateOptions(z))this.setValue(void 0,!0);return this}setValue(z,J,Q){let{listComponent:Z,config:{placeholder:$},eDisplayField:X,tooltipFeature:Y}=this;if(this.value===z||!Z)return this;if(!Q)Z.setValue(z,!0);if(Z.getValue()===this.getValue())return this;let G=Z.getDisplayValue();if(G==null&&$)G=$;return X.textContent=G,Y?.setTooltipAndRefresh(G??null),super.setValue(z,J)}destroy(){this.listComponent=this.destroyBean(this.listComponent),super.destroy()}};var kL={tag:"ag-input-text-field",ref:"eEditor",cls:"ag-cell-editor"},fL=class{constructor(z){this.getLocaleTextFunc=z}getTemplate(){return kL}getAgComponents(){return[e4]}init(z,J){this.eEditor=z,this.params=J;let Q=J.maxLength;if(Q!=null)z.setMaxLength(Q)}getValidationErrors(){let{params:z}=this,{maxLength:J,getValidationErrors:Q}=z,Z=this.getValue(),$=this.getLocaleTextFunc(),X=[];if(J!=null&&typeof Z==="string"&&Z.length>J)X.push($("maxLengthValidation",`Must be ${J} characters or fewer.`,[String(J)]));if(!X.length)X=null;if(Q)return Q({value:Z,cellEditorParams:z,internalErrors:X});return X}getValue(){let{eEditor:z,params:J}=this,Q=z.getValue();if(!T(Q)&&!T(J.value))return J.value;return J.parseValue(Q)}getStartValue(){let z=this.params;return z.useFormatter||z.column.getColDef().refData?z.formatValue(z.value):z.value}setCaret(){if(A1())this.eEditor.getInputElement().focus({preventScroll:!0});let z=this.eEditor,J=z.getValue(),Q=T(J)&&J.length||0;if(Q)z.getInputElement().setSelectionRange(Q,Q)}},_8=class extends HL{constructor(){super(new fL(()=>this.getLocaleTextFunc()))}};function VL(z,J){return z.editModelSvc?.getEditRowDataValue(J,{checkSiblings:!0})}function SL(z){let J=z.editModelSvc?.getEditMap(),Q=[];return J?.forEach((Z,$)=>{let{rowIndex:X,rowPinned:Y}=$;Z.forEach((q,G)=>{let{editorValue:H,pendingValue:_,sourceValue:U,state:W}=q,B=S4(q),E=H??_;if(E===I0)E=void 0;let K={newValue:E,oldValue:U,state:W,column:G,colId:G.getColId(),colKey:G.getColId(),rowIndex:X,rowPinned:Y},F=W==="editing";if(F||!F&&B)Q.push(K)})}),Q}function AL(z,J=!1){let{editSvc:Q}=z;if(Q?.isBatchEditing()){if(J){for(let Z of z.editModelSvc?.getEditPositions()??[])if(Z.state==="editing")Q.revertSingleCellEdit(Z)}else U1(z,{persist:!0});H1(z,void 0,{cancel:J})}else Q?.stopEditing(void 0,{cancel:J,source:"edit",forceStop:!J,forceCancel:J})}function RL(z,J){let Q=l(z,J);return!!z.editSvc?.isEditing(Q)}function jL(z,J){let{key:Q,colKey:Z,rowIndex:$,rowPinned:X}=J,{editSvc:Y,colModel:q}=z,G=q.getCol(Z);if(!G){R(12,{colKey:Z});return}let _=f0(z,{rowIndex:$,rowPinned:X||null,column:G});if(!_){R(290,{rowIndex:$,rowPinned:X});return}if(!Y?.isCellEditable({rowNode:_,column:G},"api"))return;if(X==null)fF(z,$);kF(z,Z),Y?.startEditing({rowNode:_,column:G},{event:Q?new KeyboardEvent("keydown",{key:Q}):void 0,source:"api",editable:!0})}function OL(z){return z.editSvc?.validateEdit()||null}var PL={tag:"div",cls:"ag-popup-editor",attrs:{tabindex:"-1"}},TL=class extends yZ{constructor(z){super(PL);this.params=z}postConstruct(){l1(this.gos,this.getGui(),"popupEditorWrapper",!0),this.addKeyDownListener()}addKeyDownListener(){let z=this.getGui(),J=this.params,Q=(Z)=>{if(!uQ(this.gos,Z,J.node,J.column,!0))J.onKeyDown(Z)};this.addManagedElementListeners(z,{keydown:Q})}};function vL(z,{column:J},Q,Z,$="ui"){if(Q instanceof KeyboardEvent&&(Q.key===k.TAB||Q.key===k.ENTER||Q.key===k.F2||Q.key===k.BACKSPACE&&Z))return!0;if(Q?.shiftKey&&z.rangeSvc?.getCellRanges().length!=0)return!1;let Y=J?.getColDef(),q=IL(z.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($==="api")return!!Z;return!1}function IL(z,J){if(z.get("suppressClickEdit")===!0)return 0;if(z.get("singleClickEdit")===!0)return 1;if(J?.singleClickEdit)return 1;return 2}function RQ(z,J){return z.editModelSvc?.hasEdits(J,{withOpenEditor:!0})??!1}function aQ(z,J){let{column:Q,rowNode:Z}=J,$=Q.getColDef();if(!Z)return RQ(z,J);let X=$.editable;if(Z.group&&$.groupRowEditable!=null){if(z.rowGroupingEditValueSvc?.isGroupCellEditable(Z,Q))return!0;return RQ(z,J)}if(Q.isColumnFunc(Z,X))return!0;return RQ(z,J)}function CL(z,J,Q="ui"){let Z=aQ(z,J);if(Z||Q==="ui")return Z;let{rowNode:$,column:X}=J;for(let Y of z.colModel.getCols())if(Y!==X&&aQ(z,{rowNode:$,column:Y}))return!0;return!1}var iz=(z,J=!1)=>{if(z!==void 0)return S4(z)||J&&z.state==="editing"};function JX(z,J,Q=!1){return iz(z.editModelSvc?.getEdit(J),Q)}var QX=(z,J,Q)=>{if(!z)return;for(let Z=0,$=z.length;Z<$;++Z){let X=z[Z];if(X.data){if(iz(J?.getEdit({rowNode:X,column:Q}))||iz(J?.getEdit({rowNode:X.pinnedSibling,column:Q})))return!0}if(QX(X.childrenAfterGroup,J,Q))return!0}};function ZX(z,J){let{column:Q,rowNode:Z}=J;if(z.gos.get("groupTotalRow")&&!Z?.footer)return!1;return QX(Z?.childrenAfterGroup,z.editModelSvc,Q)}function $X(z,{rowNode:J,column:Q}){if(J=J.pinnedSibling,!J)return;return iz(z.editModelSvc?.getEdit({rowNode:J,column:Q}))}var bL=class extends V{constructor(z,J){super();this.cellCtrl=z,this.beans=J,this.editSvc=J.editSvc,this.editModelSvc=J.editModelSvc}setComp(z){this.cellComp=z,this.applyCellStyles()}applyCellStyles(){let{cellCtrl:z,editSvc:J,beans:Q}=this;if(J?.isBatchEditing()&&J.isEditing()){let $=JX(Q,z)||ZX(Q,z)||$X(Q,z);this.applyBatchingStyle($)}else this.applyBatchingStyle(!1);let Z=!!this.editModelSvc?.getCellValidationModel().hasCellValidation(this.cellCtrl);this.cellComp.toggleCss("ag-cell-editing-error",Z)}applyBatchingStyle(z){this.cellComp.toggleCss("ag-cell-editing",z??!1),this.cellComp.toggleCss("ag-cell-batch-edit",(z&&this.editSvc?.isBatchEditing())??!1)}},yL=class extends V{constructor(z,J){super();this.rowCtrl=z,this.beans=J,this.gos=J.gos,this.editSvc=J.editSvc,this.editModelSvc=J.editModelSvc}applyRowStyles(){let{rowCtrl:z,editModelSvc:J,beans:Q}=this,Z=z.rowNode,$=J?.getEditRow(Z),X=this.editModelSvc?.getRowValidationModel().hasRowValidation({rowNode:Z});if(!$&&Z.pinnedSibling)Z=Z.pinnedSibling,$=J?.getEditRow(Z);if($){let Y=Array.from($.keys()).some((q)=>{let G={rowNode:Z,column:q};return JX(Q,G,!0)||ZX(Q,G)||$X(Q,G)});this.applyStyle(X,Y);return}this.applyStyle(X)}applyStyle(z=!1,J=!1){let Q=!!this.editSvc?.isBatchEditing(),Z=this.gos.get("editType")==="fullRow";this.rowCtrl?.forEachGui(void 0,({rowComp:$})=>{$.toggleCss("ag-row-editing",Z&&J),$.toggleCss("ag-row-batch-edit",Z&&J&&Q),$.toggleCss("ag-row-inline-editing",J),$.toggleCss("ag-row-not-inline-editing",!J),$.toggleCss("ag-row-editing-invalid",Z&&J&&z)})}},xL=({rowModel:z,pinnedRowModel:J,editModelSvc:Q},Z)=>{let $=new Set;z.forEachNode((X)=>Z.has(X)&&$.add(X)),J?.forEachPinnedRow("top",(X)=>Z.has(X)&&$.add(X)),J?.forEachPinnedRow("bottom",(X)=>Z.has(X)&&$.add(X));for(let X of Z)if(!$.has(X))Q.removeEdits({rowNode:X});return $},wL=({editModelSvc:z},J,Q)=>{for(let Z of J)z?.getEditRow(Z)?.forEach(($,X)=>!Q.has(X)&&z.removeEdits({rowNode:Z,column:X}))},NL=(z)=>()=>{let J=new Set(z.colModel.getCols()),Q=z.editModelSvc.getEditMap(!0),Z=new Set(Q.keys());wL(z,xL(z,Z),J)},gL=new Set(["undo","redo","paste","bulk","rangeSvc"]),hL=new Set(["ui","api"]),XX={paste:"api",rangeSvc:"api",fillHandle:"api",cellClear:"api",bulk:"api"},uL=new Set(Object.keys(XX)),mL=new Set(["paste","rangeSvc","cellClear","redo","undo"]),jQ={cancel:!0,source:"api"},cL={cancel:!1,source:"api"},u1={checkSiblings:!0},Y1={force:!0,suppressFlash:!0},pL={force:!0},iL=class extends V{constructor(){super(...arguments);this.beanName="editSvc",this.committing=!1,this.batch=!1,this.batchStartDispatched=!1,this.stopping=!1,this.rangeSelectionWhileEditing=0}postConstruct(){let{beans:z}=this;this.model=z.editModelSvc,this.valueSvc=z.valueSvc,this.rangeSvc=z.rangeSvc,this.addManagedPropertyListener("editType",({currentValue:Z})=>{this.stopEditing(void 0,jQ),this.createStrategy(Z)});let J=NL(z),Q=()=>{let Z=this.model.getCellValidationModel().getCellValidationMap().size>0,$=this.model.getRowValidationModel().getRowValidationMap().size>0;if(Z||$)this.stopEditing(void 0,jQ);else if(this.isEditing())if(this.batch)H1(z,this.model.getEditPositions());else this.stopEditing(void 0,cL);return!1};this.addManagedEventListeners({columnPinned:J,columnVisible:J,columnRowGroupChanged:J,rowExpansionStateChanged:J,pinnedRowsChanged:J,displayedRowsChanged:J,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,jQ)}stopBatchEditing(z){if(!this.batch)return;if(z)this.stopEditing(void 0,z);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(z){let{beans:J,gos:Q,strategy:Z}=this,$=U8(Q,z);if(Z){if(Z.beanName===$)return Z;this.destroyStrategy()}return this.strategy=this.createOptionalManagedBean(J.registry.createDynamicBean($,!0))}destroyStrategy(){if(!this.strategy)return;this.strategy.destroy(),this.strategy=this.destroyBean(this.strategy)}shouldStartEditing(z,J,Q,Z="ui"){let $=vL(this.beans,z,J,Q,Z);if($)this.strategy??(this.strategy=this.createStrategy());return $}shouldStopEditing(z,J,Q="ui"){return this.strategy?.shouldStop(z,J,Q)??null}shouldCancelEditing(z,J,Q="ui"){return this.strategy?.shouldCancel(z,J,Q)??null}validateEdit(){return sE(this.beans)}isEditing(z,J){return this.model.hasEdits(z??void 0,J??u1)}isRowEditing(z,J){return!!z&&this.model.hasRowEdits(z,J)}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,J){let{startedEdit:Q=!0,event:Z=null,source:$="ui",ignoreEventKey:X=!1,silent:Y}=J;if(this.strategy??(this.strategy=this.createStrategy()),!(J.editable??this.isCellEditable(z,"api")))return;let G=l(this.beans,z);if(G&&!G.comp){J.editable=void 0,G.onCompAttachedFuncs.push(()=>this.startEditing(z,J));return}let H=this.shouldStartEditing(z,Z,Q,$);if(H===!1&&$!=="api"){if(this.isEditing(z))this.stopEditing();return}if(!this.batch&&this.shouldStopEditing(z,void 0,$)&&!J.continueEditing)this.stopEditing(void 0,{source:$});if(H)this.ensureBatchStarted();this.strategy.start({position:z,event:Z,source:$,ignoreEventKey:X,startedEdit:Q,silent:Y})}stopEditing(z,J){let Q=this.prepareStopContext(z,J);if(!Q)return!1;this.stopping=!0;let Z=!1,{edits:$}=Q;try{let X=this.processStopRequest(Q);return Z||(Z=X.res),$=X.edits,this.finishStopEditing({...Q,edits:$,params:J,position:z,res:Z}),Z}finally{this.rangeSelectionWhileEditing=0,this.stopping=!1}}prepareStopContext(z,J){let{event:Q=null,cancel:Z=!1,source:$="ui",forceCancel:X=!1,forceStop:Y=!1,commit:q=!1}=J||{};if(uL.has($)&&this.batch){if(z?.rowNode&&z?.column)this.bulkRefreshCell(z);return null}let G=this.committing?XX[$]:$;if(!(this.committing||this.isEditing(z)||this.batch&&this.model.hasEdits(z,u1))||!this.strategy||this.stopping)return null;let _=l(this.beans,z);if(_)_.onEditorAttachedFuncs=[];let U=!Z&&(!!this.shouldStopEditing(z,Q,G)||(this.committing||$==="paste")&&!this.batch)||Y,W=Z&&!!this.shouldCancelEditing(z,Q,G)||X;return{cancel:Z,cellCtrl:_,edits:this.model.getEditMap(!0),event:Q??null,forceCancel:X,forceStop:Y,commit:q,position:z,source:$,treatAsSource:G,willCancel:W,willStop:U}}processStopRequest(z){let{event:J,position:Q,willCancel:Z,willStop:$}=z;if($||Z)return this.handleStopOrCancel(z);if(this.shouldHandleMidBatchKey(J,Q))return{res:!1,edits:this.handleMidBatchKey(J,Q,z)};if(U1(this.beans,{persist:!0}),this.batch)this.strategy?.cleanupEditors(Q);return{res:!1,edits:this.model.getEditMap()}}handleStopOrCancel(z){let{beans:J,model:Q}=this,{cancel:Z,commit:$,edits:X,event:Y,source:q,willCancel:G,willStop:H}=z,_=!this.batch||!G;U1(J,{persist:_,isCancelling:G||Z,isStopping:H});let U=Q.getEditMap(),B=!G&&(!this.batch||$)?this.processEdits(U,q):[];if(Z)this.strategy?.stopCancelled(z.forceCancel);else this.strategy?.stopCommitted(Y,$);this.clearValidationIfNoOpenEditors();for(let E of B)Q.clearEditValue(E);this.bulkRefreshMap(X);for(let E of Q.getEditPositions(U)){let K=l(J,E),F=S4(E);K?.refreshCell({force:!0,suppressFlash:!F})}return{res:H,edits:U}}shouldHandleMidBatchKey(z,J){return z instanceof KeyboardEvent&&this.batch&&!!this.strategy?.midBatchInputsAllowed(J)&&this.isEditing(J,{withOpenEditor:!0})}handleMidBatchKey(z,J,Q){let{beans:Z,model:$}=this,{cellCtrl:X,edits:Y}=Q,{key:q}=z,G=q===k.ENTER,H=q===k.ESCAPE,_=q===k.TAB;if(G||_||H){if(G||_)U1(Z,{persist:!0});else if(H&&X){let{rowNode:U,column:W}=X;if(this.batch&&U&&W){let B={rowNode:U,column:W};H1(Z,[B],{silent:!0}),this.model.stop(B,!0,!0),l(Z,B)?.refreshCell(Y1)}else this.revertSingleCellEdit(X)}if(this.batch)this.strategy?.cleanupEditors();else H1(Z,$.getEditPositions(),{event:z,cancel:H});return z.preventDefault(),this.bulkRefreshMap(Y,{suppressFlash:!0}),$.getEditMap()}return Y}finishStopEditing({cellCtrl:z,edits:J,params:Q,position:Z,res:$,commit:X,forceCancel:Y,willCancel:q,willStop:G}){let H=this.beans;if($&&Z){if(!this.batch||X)this.model.removeEdits(Z)}this.navigateAfterEdit(Q,z?.cellPosition),G6(H),this.clearValidationIfNoOpenEditors();let{rowRenderer:_,formula:U}=H;if(q)_.refreshRows({rowNodes:Array.from(J.keys())});if(this.batch){if(U)U.refreshFormulas(!0);else _.refreshRows({suppressFlash:!0,force:!0});let W=G&&X;if(W||q&&Y)this.dispatchBatchStopped(J,W)}}dispatchBatchStopped(z,J){let Q;if(J){if(Q=mE(z),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,J){if(!z||!J)return;let{event:Q,suppressNavigateAfterEdit:Z}=z;if(!(Q instanceof KeyboardEvent)||Z)return;let{key:X,shiftKey:Y}=Q,q=this.gos.get("enterNavigatesVerticallyAfterEdit");if(X!==k.ENTER||!q)return;let G=Y?k.UP:k.DOWN;this.beans.navigation?.navigateToNextCell(null,G,J,!1)}processEdits(z,J){let Q=Array.from(z.keys()),Z=this.model.getCellValidationModel().getCellValidationMap().size>0||this.model.getRowValidationModel().getRowValidationMap().size>0,$=[],{changeDetectionSvc:X}=this.beans;X?.beginDeferred();try{for(let Y of Q){let q=z.get(Y);for(let G of q.keys()){let H=q.get(G),_={rowNode:Y,column:G};if(S4(H)&&!Z){let U=l(this.beans,_);if(!this.setNodeDataValue(Y,G,H.pendingValue,U,J))$.push(_)}}}}finally{X?.endDeferred()}return $}setNodeDataValue(z,J,Q,Z,$="edit"){let X=hL.has($)?"edit":$;if(Z)Z.suppressRefreshCell=!0;this.committing=!0;try{return z.setDataValue(J,Q,X)}finally{if(this.committing=!1,Z)Z.suppressRefreshCell=!1}}syncEditAfterCommit(z,J){let Q=this.model.getEdit(z);if(Q&&Q.state!=="editing")if(J)this.beans.editModelSvc?.setEdit(z,{sourceValue:Q.pendingValue});else this.model.clearEditValue(z)}setEditMap(z,J){this.strategy??(this.strategy=this.createStrategy()),this.strategy?.setEditMap(z,J),this.bulkRefreshMap(z);let Q=Y1;if(J?.forceRefreshOfEditCellsOnly)Q={...dL(z),...Y1};this.beans.rowRenderer.refreshCells(Q)}dispatchEditValuesChanged({rowNode:z,column:J},Q={}){if(!z||!J||!Q)return;let{pendingValue:Z,sourceValue:$}=Q,{rowIndex:X,rowPinned:Y,data:q}=z;this.beans.eventSvc.dispatchEvent({type:"cellEditValuesChanged",node:z,rowIndex:X,rowPinned:Y,column:J,source:"api",data:q,newValue:Z,oldValue:$,value:Z,colDef:J.getColDef()})}bulkRefreshCell(z,J){if(o(this.gos,this.beans.rowModel))this.refCell(z,this.model.getEdit(z),J)}bulkRefreshMap(z,J){if(o(this.gos,this.beans.rowModel))z.forEach((Q,Z)=>{for(let $ of Q.keys())this.refCell({rowNode:Z,column:$},Q.get($),J)})}refCell({rowNode:z,column:J},Q,Z={}){let{beans:$,gos:X}=this,Y=new Set([z]),q=new Set,G=z.pinnedSibling;if(G)Y.add(G);let H=z.sibling;if(H)q.add(H);let _=z.parent;while(_){if(_.sibling?.footer&&X.get("groupTotalRow"))q.add(_.sibling);else if(!_.parent&&_.sibling&&X.get("grandTotalRow"))q.add(_.sibling);else q.add(_);_=_.parent}for(let U of Y)this.dispatchEditValuesChanged({rowNode:U,column:J},Q);for(let U of Y)l($,{rowNode:U,column:J})?.refreshCell(Z);for(let U of q){let W=l($,{rowNode:U,column:J});if(W){if(W.refreshCell(Z),!Z.force&&this.batch)W.editStyleFeature?.applyCellStyles?.()}}}stopAllEditing(z=!1,J="ui"){if(this.isEditing())this.stopEditing(void 0,{cancel:z,source:J})}isCellEditable(z,J="ui"){let{gos:Q,beans:Z}=this,$=z.rowNode;if($.group&&z.column.getColDef().groupRowEditable==null){if(Q.get("treeData")){if(!$.data&&!Q.get("enableGroupEdit"))return!1}else if(!Q.get("enableGroupEdit"))return!1}let X=U8(Q)==="fullRow"?CL(Z,z,J):aQ(Z,z);if(X)this.strategy??(this.strategy=this.createStrategy());return X}cellEditingInvalidCommitBlocks(){return this.gos.get("invalidEditValueMode")==="block"}checkNavWithValidation(z,J,Q=!0){if(this.hasValidationErrors(z)){let Z=l(this.beans,z);if(this.cellEditingInvalidCommitBlocks()){if(J?.preventDefault?.(),Q){if(Z&&!Z.hasBrowserFocus())Z.focusCell();Z?.comp?.getCellEditor()?.focusIn?.()}return"block-stop"}if(Z)this.revertSingleCellEdit(Z);return"revert-continue"}return"continue"}revertSingleCellEdit(z,J=!1){let Q=l(this.beans,z);if(!Q?.comp?.getCellEditor())return;if(H1(this.beans,[z],{silent:!0}),this.model.clearEditValue(z),e1(this.beans,z,{silent:!0}),L1(this.beans),Q?.refreshCell(Y1),!J)return;Q?.focusCell(),Q?.comp?.getCellEditor()?.focusIn?.()}hasValidationErrors(z){L1(this.beans);let J=l(this.beans,z);if(J)J.refreshCell(Y1),J.rowCtrl.rowEditStyleFeature?.applyRowStyles();let Q=!1;if(z?.rowNode){if(Q||(Q=this.model.getRowValidationModel().hasRowValidation({rowNode:z.rowNode})),z.column)Q||(Q=this.model.getCellValidationModel().hasCellValidation({rowNode:z.rowNode,column:z.column}))}else Q||(Q=this.model.getCellValidationModel().getCellValidationMap().size>0),Q||(Q=this.model.getRowValidationModel().getRowValidationMap().size>0);return Q}moveToNextCell(z,J,Q,Z="ui"){let $,X=this.isEditing(),Y=X&&this.checkNavWithValidation(void 0,Q)==="block-stop";if(z instanceof B6&&X)$=this.strategy?.moveToNextEditingCell(z,J,Q,Z,Y);if($===null)return $;if($=$||!!this.beans.focusSvc.focusedHeader,$===!1&&!Y)this.stopEditing();return $}getPendingEditValue(z,J,Q){if(Q==="data")return;if(Q==="batch"&&!this.batch)return;let Z=this.model.getEdit({rowNode:z,column:J},u1);if(!Z)return;if(this.stopping&&!this.batch&&!Z.editorState?.cellStartedEditing)return;if(Q==="edit"){let X=Z.editorValue;if(X!=null&&X!==I0)return X}let $=Z.pendingValue;if($!==I0)return $;return}getCellDataValue(z){let J=this.model.getEdit(z,u1);if(J){let Q=J.pendingValue;if(Q!==I0)return Q;let Z=J.sourceValue;if(Z!=null)return Z}return this.valueSvc.getValue(z.column,z.rowNode,"data")}addStopEditingWhenGridLosesFocus(z){gE(this,this.beans,z)}createPopupEditorWrapper(z){return new TL(z)}batchResetToSourceValue(z){if(!this.batch)return!1;let J=this.model.getEdit(z);if(!J)return!1;let{pendingValue:Q,sourceValue:Z,state:$}=J;if(Q===Z)return!1;if($==="editing")return!1;return this.dispatchEditValuesChanged(z,{...J,pendingValue:Z}),this.beans.editModelSvc?.removeEdits(z),l(this.beans,z)?.refreshCell(Y1),!0}setDataValue(z,J,Q){try{let Z=this.batch,$=this.isEditing(Z?void 0:z);if((!$||this.committing)&&!Z&&!mL.has(Q))return;if(!$&&!Z&&Q==="paste")return;if(Q==="batch"&&!Z)return;if(Q==="edit"){if($&&this.applyEditorValue(z,J))return!0;if(!Z)return}if(this.strategy??(this.strategy=this.createStrategy()),Q==="batch"||Q==="edit")return this.applyDirectValue(z,J,Q);let X=this.beans,Y;if(Z)Y="ui";else if(this.committing)Y=Q??"api";else Y="api";if(!Q||gL.has(Q))return this.applyDirectValue(z,J,Q);let q=this.applyExistingEdit(z,J,Q,Y);if(q!==void 0)return q;return M2(X,z,J,Q,void 0,{persist:!0}),this.ensureBatchStarted(),this.stopEditing(z,{source:Y,suppressNavigateAfterEdit:!0}),!0}finally{this.committing=!1}}applyExistingEdit(z,J,Q,Z){let $=this.model.getEdit(z);if(!$)return;if($.pendingValue===J)return!1;if($.sourceValue!==J)return M2(this.beans,z,J,Q,void 0,{persist:!0}),this.ensureBatchStarted(),this.stopEditing(z,{source:Z,suppressNavigateAfterEdit:!0}),!0;return this.beans.editModelSvc?.removeEdits(z),this.ensureBatchStarted(),this.dispatchEditValuesChanged(z,{...$,pendingValue:J}),!0}applyEditorValue(z,J){let Q=this.beans,Z=l(Q,z),$=Z?.comp?.getCellEditor();if(!Z||!$)return!1;if(M2(Q,z,J,"edit",void 0,{persist:!0}),Z.editStyleFeature?.applyCellStyles?.(),"agSetEditValue"in $)return $.agSetEditValue(J),!0;if($.refresh&&Z.editCompDetails)return $.refresh({...Z.editCompDetails.params,value:J}),!0;if(Z.hasBrowserFocus())Z.onEditorAttachedFuncs.push(()=>{let Y=l(this.beans,z);Y?.focusCell(!0),Y?.comp?.getCellEditor()?.focusIn?.()});return H1(Q,[z],{silent:!0,cancel:!0}),e1(Q,z,{silent:!0}),L1(Q),l(Q,z)?.refreshCell(Y1),!0}applyDirectValue(z,J,Q){let Z=this.beans;if(this.batch){if(Q==="batch"&&l(Z,z)?.comp?.getCellEditor()){let{editModelSvc:Y,valueSvc:q}=Z,{rowNode:G,column:H}=z;if(Y?.getEdit(z)?.sourceValue===void 0)Y?.setEdit(z,{sourceValue:q.getValue(H,G,"data")});Y?.setEdit(z,{pendingValue:J})}else if(M2(Z,z,J,Q,void 0,{persist:!0}),Q!=="batch")this.cleanupEditors();return G6(Z),this.ensureBatchStarted(),this.bulkRefreshCell(z),!0}M2(Z,z,J,Q,void 0,{persist:!0});let $=l(Z,z),X=this.setNodeDataValue(z.rowNode,z.column,J,$,Q);return this.syncEditAfterCommit(z,X),G6(Z),l(Z,z)?.refreshCell(X?pL:Y1),X}handleColDefChanged(z){pE(this.beans,z)}destroy(){this.model.clear(),this.destroyStrategy(),super.destroy()}prepDetailsDuringBatch(z,J){let{model:Q}=this;if(!this.batch)return;if(!Q.hasRowEdits(z.rowNode,u1))return;let{rowNode:$}=z,{compDetails:X,valueToDisplay:Y}=J;if(X){let{params:q}=X;return q.data=Q.getEditRowDataValue($,u1),{compDetails:X}}return{valueToDisplay:Y}}cleanupEditors(){this.strategy?.cleanupEditors()}dispatchCellEvent(z,J,Q,Z){this.strategy?.dispatchCellEvent(z,J,Q,Z)}dispatchBatchEvent(z,J){this.eventSvc.dispatchEvent(this.createBatchEditEvent(z,J))}createBatchEditEvent(z,J){return C(this.gos,{type:z,...z==="batchEditingStopped"?{changes:this.toEventChangeList(J)}:{}})}toEventChangeList(z){return this.model.getEditPositions(z).map((J)=>({rowIndex:J.rowNode.rowIndex,rowPinned:J.rowNode.rowPinned,columnId:J.column.getColId(),newValue:J.pendingValue,oldValue:J.sourceValue}))}applyBulkEdit({rowNode:z,column:J},Q){if(!Q||Q.length===0)return;let{beans:Z,rangeSvc:$,valueSvc:X}=this,{formula:Y}=Z;U1(Z,{persist:!0});let q=this.model.getEditMap(!0),G=q.get(z)?.get(J)?.pendingValue,H=!1;if(!this.batch)this.eventSvc.dispatchEvent({type:"bulkEditingStarted"}),H=!0;let _=Y?.isFormula(G)??!1;Q.forEach((W)=>{let B=W.columns.some((E)=>E?.isAllowFormula());if($?.forEachRowInRange(W,(E)=>{let K=f0(Z,E);if(K===void 0)return;let F=q.get(K)??new Map,L=G;for(let D of W.columns){if(!D)continue;let M=!!_&&D.isAllowFormula();if(this.isCellEditable({rowNode:K,column:D},"api")){let f=X.getValue(D,K,"data",!0),S=X.parseValue(D,K??null,L,f);if(Number.isNaN(S))S=null;F.set(D,{editorValue:void 0,pendingValue:S,sourceValue:f,state:"changed",editorState:{isCancelAfterEnd:void 0,isCancelBeforeStart:void 0}})}if(M)L=Y?.updateFormulaByOffset({value:L,columnDelta:1})}if(F.size>0)q.set(K,F);if(_&&B)G=Y?.updateFormulaByOffset({value:G,rowDelta:1})}),this.setEditMap(q),this.batch){this.cleanupEditors(),G6(Z),this.ensureBatchStarted();return}this.committing=!0;try{this.stopEditing(void 0,{source:"bulk"})}finally{if(this.committing=!1,H)this.eventSvc.dispatchEvent({type:"bulkEditingStopped",changes:this.toEventChangeList(q)})}});let U=l(Z,{rowNode:z,column:J});if(U)U.focusCell(!0)}createCellStyleFeature(z){return new bL(z,this.beans)}createRowStyleFeature(z){return new yL(z,this.beans)}setEditingCells(z,J){let{beans:Q}=this,{colModel:Z,valueSvc:$}=Q,X=new Map;for(let{colId:Y,column:q,colKey:G,rowIndex:H,rowPinned:_,newValue:U,state:W}of z){let B=Y?Z.getCol(Y):G?Z.getCol(G):q;if(!B)continue;let E=f0(Q,{rowIndex:H,rowPinned:_});if(!E)continue;let K=$.getValue(B,E,"data",!0);if(!J?.forceRefreshOfEditCellsOnly&&!S4({pendingValue:U,sourceValue:K})&&W!=="editing")continue;let F=X.get(E);if(!F)F=new Map,X.set(E,F);if(U===void 0)U=I0;F.set(B,{editorValue:void 0,pendingValue:U,sourceValue:K,state:W??"changed",editorState:{isCancelAfterEnd:void 0,isCancelBeforeStart:void 0}})}this.setEditMap(X,J)}onCellFocused(z){let J=l(this.beans,z);if(!J||!this.isEditing(J,u1))return;let Q=this.model.getEdit(J);if(!Q||!S4(Q))return;let $=this.getLocaleTextFunc()("ariaPendingChange","Pending Change");this.beans.ariaAnnounce?.announceValue($,"pendingChange")}allowedFocusTargetOnValidation(z){return l(this.beans,z)}};function dL(z){return{rowNodes:z?Array.from(z.keys()):void 0,columns:z?[...new Set(Array.from(z.values()).flatMap((J)=>Array.from(J.keys())))]:void 0}}function U8(z,J){return J??z.get("editType")??"singleCell"}var YX=class extends V{postConstruct(){this.model=this.beans.editModelSvc,this.editSvc=this.beans.editSvc,this.addManagedEventListeners({cellFocused:this.onCellFocusChanged?.bind(this),cellFocusCleared:this.onCellFocusChanged?.bind(this)})}clearEdits(z){this.model.clearEditValue(z)}onCellFocusChanged(z){let J,Q=z.previousParams,{editSvc:Z,beans:$}=this,X=z.type==="cellFocused"?z.sourceEvent:null;if(Q)J=l($,Q);let{gos:Y,editModelSvc:q}=$,G=z.type==="cellFocusCleared";if(Z.isEditing(void 0,{withOpenEditor:!0})){let{column:H,rowIndex:_,rowPinned:U}=z,W={column:H,rowNode:f0($,{rowIndex:_,rowPinned:U})},B=Y.get("invalidEditValueMode")==="block";if(B)return;let E=!B,K=!!q?.getCellValidationModel().hasCellValidation(W),F=E&&K;if(!(Q||G?Z.stopEditing(void 0,{cancel:F,source:G&&E?"api":void 0,event:X}):!0))if(Z.isBatchEditing())Z.cleanupEditors();else Z.stopEditing(void 0,{source:"api"})}J?.refreshCell({suppressFlash:!0,force:!0})}stopCancelled(z){let J=this.editSvc.isBatchEditing()&&!z;for(let Q of this.model.getEditPositions())R6(this.beans,Q,{cancel:!0},l(this.beans,Q)),this.model.stop(Q,J,!0);return!0}stopCommitted(z,J){let Q=this.model.getEditPositions(),Z={all:[],pass:[],fail:[]};for(let Y of Q)if(Z.all.push(Y),(this.model.getCellValidationModel().getCellValidation(Y)?.errorMessages?.length??0)>0)Z.fail.push(Y);else Z.pass.push(Y);let $=this.processValidationResults(Z),X=this.editSvc.isBatchEditing()&&!J;for(let Y of $.destroy)R6(this.beans,Y,{event:z},l(this.beans,Y)),this.model.stop(Y,X,!1);for(let Y of $.keep){let q=l(this.beans,Y);if(!this.editSvc.cellEditingInvalidCommitBlocks()&&q)this.editSvc.revertSingleCellEdit(q)}return!0}cleanupEditors({rowNode:z}={},J){U1(this.beans,{persist:!1});let Q=this.model.getEditPositions(),Z=[];if(z){for(let $ of Q)if($.rowNode!==z)Z.push($)}else for(let $ of Q)Z.push($);H1(this.beans,Z),G6(this.beans,J)}setFocusOutOnEditor(z){z.comp?.getCellEditor()?.focusOut?.()}setFocusInOnEditor(z){let J=z.comp,Q=J?.getCellEditor();if(Q?.focusIn)Q.focusIn();else{let Z=this.beans.gos.get("editType")==="fullRow";z.focusCell(Z),z.onEditorAttachedFuncs.push(()=>J?.getCellEditor()?.focusIn?.())}}setupEditors(z){let{event:J,ignoreEventKey:Q=!1,startedEdit:Z,position:$,cells:X=this.model.getEditPositions()}=z,Y=J instanceof KeyboardEvent&&!Q&&J.key||void 0;uE(this.beans,X,$,Y,J,Z)}dispatchCellEvent(z,J,Q,Z){let $=l(this.beans,z);if($)this.eventSvc.dispatchEvent({...$.createEvent(J??null,Q),...Z})}dispatchRowEvent(z,J,Q){if(Q)return;let Z=cz(this.beans,z);if(Z)this.eventSvc.dispatchEvent(Z.createRowEvent(J))}shouldStop(z,J,Q="ui"){let Z=this.editSvc.isBatchEditing();if(Z&&Q==="api")return!0;if(Z&&(Q==="ui"||Q==="edit"))return!1;if(Q==="api")return!0;if(J instanceof KeyboardEvent&&!Z)return J.key===k.ENTER;return null}shouldCancel(z,J,Q="ui"){let Z=this.editSvc.isBatchEditing();if(J instanceof KeyboardEvent&&!Z){if(J.key===k.ESCAPE)return!0}if(Z&&Q==="api")return!0;if(Q==="api")return!0;return!1}setEditMap(z,J){if(!J?.update)this.editSvc.stopEditing(void 0,{cancel:!0,source:"api"});let Q=[];if(z.forEach((Z,$)=>{Z.forEach((X,Y)=>{if(X.state==="editing")Q.push({...X,rowNode:$,column:Y})})}),J?.update)z=new Map([...this.model.getEditMap(),...z]);if(this.model?.setEditMap(z),Q.length>0){let Z=Q.at(-1),$=Z.pendingValue===I0?void 0:Z.pendingValue;this.start({position:Z,event:new KeyboardEvent("keydown",{key:$}),source:"api"});let X=l(this.beans,Z);if(X)this.setFocusInOnEditor(X)}}destroy(){this.cleanupEditors(),super.destroy()}},nL=class extends YX{constructor(){super(...arguments);this.beanName="fullRow",this.startedRows=new Set}shouldStop(z,J,Q="ui"){let{rowNode:Z,beans:$}=this,{rowNode:X}=z||{};if(!cz($,{rowNode:Z}))return!0;let q=super.shouldStop({rowNode:Z},J,Q);if(q!==null)return q;if(!Z)return!1;return X!==Z}midBatchInputsAllowed({rowNode:z}){if(!z)return!1;return this.model.hasEdits({rowNode:z})}clearEdits(z){this.model.clearEditValue(z)}start(z){let{position:J,silent:Q,startedEdit:Z,event:$,ignoreEventKey:X}=z,{rowNode:Y}=J,{beans:q,model:G,startedRows:H}=this;if(this.rowNode!==Y)super.cleanupEditors(J);let _=q.visibleCols.allCols,U=[],W=[];for(let B of _)if(B.isCellEditable(Y))W.push(B);if(W.length==0)return;if(!H.has(Y))this.dispatchRowEvent({rowNode:Y},"rowEditingStarted",Q),H.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:J,startedEdit:Z,event:$,ignoreEventKey:X})}processValidationResults(z){if(z.fail.length>0&&this.editSvc.cellEditingInvalidCommitBlocks())return{destroy:[],keep:z.all};return{destroy:z.all,keep:[]}}stopCancelled(z){let{rowNode:J,model:Q}=this;if(J&&!Q.hasRowEdits(J))return!1;return super.stopCancelled(z),this.cleanupEditors({rowNode:J},!0),this.rowNode=void 0,!0}stopCommitted(z,J){let{rowNode:Q,beans:Z,model:$,editSvc:X}=this;if(Q&&!$.hasRowEdits(Q))return!1;let Y=[];if($.getEditMap().forEach((q,G)=>{if(!q||q.size===0)return;for(let H of q.values())if(S4(H)){Y.push(G);break}}),L1(Z),X.checkNavWithValidation({rowNode:Q})==="block-stop")return!1;if(super.stopCommitted(z,J),J||!X.isBatchEditing())for(let q of Y)this.dispatchRowEvent({rowNode:q},"rowValueChanged");return this.cleanupEditors({rowNode:Q},!0),this.rowNode=void 0,!0}onCellFocusChanged(z){let{rowIndex:J}=z,Q=z.previousParams;if(Q?.rowIndex===J||z.sourceEvent instanceof KeyboardEvent)return;let{beans:Z,gos:$,model:X}=this;if(Z.editSvc?.isRangeSelectionEnabledWhileEditing())return;let Y=l(Z,Q);if($.get("invalidEditValueMode")==="block"&&Y&&(X.getCellValidationModel().getCellValidation(Y)||X.getRowValidationModel().getRowValidation(Y)))return;super.onCellFocusChanged(z)}cleanupEditors(z={},J){super.cleanupEditors(z,J);let{startedRows:Q}=this;for(let Z of Q)this.dispatchRowEvent({rowNode:Z},"rowEditingStopped"),this.destroyEditorsForRow(Z);Q.clear()}destroyEditorsForRow(z){let J=cz(this.beans,{rowNode:z});if(!J)return;let Q={};for(let Z of J.getAllCellCtrls())if(Z.comp?.getCellEditor())R6(this.beans,Z,Q,Z)}moveToNextEditingCell(z,J,Q,Z="ui",$=!1){let{beans:X,model:Y,gos:q,editSvc:G}=this,H=z.cellPosition,_;Y.suspend(!0);try{_=X.navigation?.findNextCellToFocusOn(H,{backwards:J,startEditing:!0,skipToNextEditableCell:!1})}finally{Y.suspend(!1)}if(_===!1)return null;if(_==null)return!1;let U=_.cellPosition,W=z.isCellEditable(),B=_.isCellEditable(),E=U&&H.rowIndex===U.rowIndex&&H.rowPinned===U.rowPinned;if(W)this.setFocusOutOnEditor(z);this.restoreEditors();let K=q.get("suppressStartEditOnTab");if(B&&!$)if(K)_.focusCell(!0,Q);else{if(!_.comp?.getCellEditor())e1(X,_,{event:Q,cellStartedEdit:!0});this.setFocusInOnEditor(_),_.focusCell(!1,Q)}else{if(B&&$)this.setFocusInOnEditor(_);_.focusCell(!0,Q)}if(!E&&!$){if(G?.stopEditing({rowNode:z.rowNode},{event:Q,forceStop:!0}),G?.isRowEditing(z.rowNode,{withOpenEditor:!0}))this.cleanupEditors(_,!0);if(K)_.focusCell(!0,Q);else G.startEditing(_,{startedEdit:!0,event:Q,source:Z,ignoreEventKey:!0,editable:B||void 0})}return z.rowCtrl?.refreshRow({suppressFlash:!0,force:!0}),!0}restoreEditors(){let{beans:z,model:J}=this;J.getEditMap().forEach((Q,Z)=>Q.forEach(({state:$},X)=>{if($!=="editing")return;let Y=l(z,{rowNode:Z,column:X});if(Y&&!Y.comp?.getCellEditor())e1(z,Y,{silent:!0})}))}destroy(){super.destroy(),this.rowNode=void 0,this.startedRows.clear()}},tL=class extends YX{constructor(){super(...arguments);this.beanName="singleCell"}shouldStop(z,J,Q="ui"){let Z=super.shouldStop(z,J,Q);if(Z!==null)return Z;let $=z?.rowNode,X=z?.column,Y=this.rowNode,q=this.column;if((!Y||!q)&&$&&X)return null;if(Y!==$||q!==X)return!0;if(!Y&&!q)return this.model.hasEdits(void 0,{withOpenEditor:!0});return!1}midBatchInputsAllowed(z){return this.model.hasEdits(z)}start(z){let{position:J,startedEdit:Q,event:Z,ignoreEventKey:$}=z;if(this.rowNode!==J.rowNode||this.column!==J.column)super.cleanupEditors();this.rowNode=J.rowNode,this.column=J.column,this.model.start(J),this.setupEditors({cells:[J],position:J,startedEdit:Q,event:Z,ignoreEventKey:$})}dispatchRowEvent(z,J,Q){}processValidationResults(z){if(z.fail.length>0&&this.editSvc.cellEditingInvalidCommitBlocks())return{destroy:[],keep:z.all};return{destroy:z.all,keep:[]}}stopCancelled(z){return super.stopCancelled(z),this.clearPosition()}stopCommitted(z,J){return super.stopCommitted(z,J),this.clearPosition()}clearPosition(){return this.rowNode=void 0,this.column=void 0,!0}onCellFocusChanged(z){let{colModel:J,editSvc:Q}=this.beans,{rowIndex:Z,column:$,rowPinned:X}=z,Y=f0(this.beans,{rowIndex:Z,rowPinned:X}),q=nQ($),G=J.getCol(q),H=z.previousParams;if(H){let _=nQ(H.column);if(H?.rowIndex===Z&&_===q&&H?.rowPinned===X)return}if(z.type=="cellFocused"&&(Q?.isRangeSelectionEnabledWhileEditing()||Q?.isEditing({rowNode:Y,column:G},{withOpenEditor:!0})))return;super.onCellFocusChanged(z)}moveToNextEditingCell(z,J,Q,Z="ui",$=!1){let X=this.beans.focusSvc.getFocusedCell();if(X)z=X4(this.beans,X)??z;let Y=z.cellPosition,q,G=this.beans.gos.get("editType")==="fullRow";if(G)this.model.suspend(!0);if(!$)z.eGui.focus(),this.editSvc?.stopEditing(z,{source:this.editSvc?.isBatchEditing()?"ui":"api",event:Q});try{q=this.beans.navigation?.findNextCellToFocusOn(Y,{backwards:J,startEditing:!0})}finally{if(G)this.model.suspend(!1)}if(q===!1)return null;if(q==null)return!1;let H=q.cellPosition,_=z.isCellEditable(),U=q.isCellEditable(),W=H&&Y.rowIndex===H.rowIndex&&Y.rowPinned===H.rowPinned;if(_&&!$)this.setFocusOutOnEditor(z);let B=this.gos.get("suppressStartEditOnTab"),E=!1;if(!W&&!$)if(super.cleanupEditors(q,!0),B)q.focusCell(!0,Q);else E=!0,this.editSvc.startEditing(q,{startedEdit:!0,event:Q,source:Z,ignoreEventKey:!0,editable:U});if(U&&!$){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});e1(this.beans,q,{event:Q,cellStartedEdit:!0,silent:K})}this.setFocusInOnEditor(q),this.cleanupEditors(q)}}else{if(U&&$)this.setFocusInOnEditor(q);q.focusCell(!0,Q)}return z.rowCtrl?.refreshRow({suppressFlash:!0,force:!0}),!0}destroy(){super.destroy(),this.rowNode=void 0,this.column=void 0}},rL={moduleName:"EditCore",version:c,beans:[NE,iL],apiFunctions:{getEditingCells:SL,getEditRowValues:VL,getCellEditorInstances:hE,startEditingCell:jL,stopEditing:AL,isEditing:RL,validateEdit:OL},dynamicBeans:{singleCell:tL,fullRow:nL},dependsOn:[Y2,qL],css:[GL]};var qX={moduleName:"TextEditor",version:c,userComponents:{agCellEditor:_8,agTextCellEditor:_8},dependsOn:[rL]};var GX={agSetColumnFilter:"agSetColumnFilterHandler",agMultiColumnFilter:"agMultiColumnFilterHandler",agGroupColumnFilter:"agGroupColumnFilterHandler",agNumberColumnFilter:"agNumberColumnFilterHandler",agBigIntColumnFilter:"agBigIntColumnFilterHandler",agDateColumnFilter:"agDateColumnFilterHandler",agTextColumnFilter:"agTextColumnFilterHandler"},sL=new Set(Object.values(GX));function q1(z,J){let Q=z.filterUi;if(!Q)return null;if(Q.created)return Q.promise;if(J)return null;let Z=Q.create(Q.refreshed),$=Q;return $.created=!0,$.promise=Z,Z}function fJ(z,J,Q,Z,$,X,Y){return J.refresh?.({...Q,model:Z,source:X,additionalEventAttributes:Y}),z().then((q)=>{if(q){let{filter:G,filterParams:H}=q;l2(G,H,Z,$,X,Y)}})}function l2(z,J,Q,Z,$,X){z?.refresh?.({...J,model:Q,state:Z,source:$,additionalEventAttributes:X})}function HX(z,J,Q,Z){let $=z();if($?.created)$.promise.then((X)=>{let Y=J();l2(X,$.filterParams,Y,Q()??{model:Y},"ui",Z)})}function dz(z){let J,Q=!1,Z,{action:$,filterParams:X,getFilterUi:Y,getModel:q,getState:G,updateState:H,updateModel:_,processModelToApply:U}=z;switch($){case"apply":{let W=G();if(Z=W?.model??null,U)Z=U(Z);J={state:W?.state,model:Z},Q=!0;break}case"clear":{if(J={model:null},!X?.buttons?.includes("apply"))Q=!0,Z=null;break}case"reset":{J={model:null},Q=!0,Z=null;break}case"cancel":{J={model:q()};break}}if(H(J),Q)_(Z);else HX(Y,q,G,{fromAction:$})}function D0(z,J){return z[J]??null}var lL=class extends pZ{constructor(){super(...arguments);this.iconCreated=!1}wireComp(z,J,Q,Z,$){this.comp=z;let X=u6(this,this.beans.context,$);this.eButtonShowMainFilter=Q,this.eFloatingFilterBody=Z,this.setGui(J,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:z,beans:J}=this,Q=z.colDef;return C(J.gos,{colDef:Q,column:z,floatingFilter:!0})}setupActive(){let z=this.column.getColDef(),J=!!z.filter,Q=!!z.floatingFilter;this.active=J&&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 z=h("filter",this.beans,this.column);if(z)this.iconCreated=!0,this.eButtonShowMainFilter.appendChild(z)}setupFocus(z){z.createManagedBean(new a4(this.eGui,{shouldStopEventPropagation:this.shouldStopEventPropagation.bind(this),onTabKeyDown:this.onTabKeyDown.bind(this),handleKeyDown:this.handleKeyDown.bind(this),onFocusIn:this.onFocusIn.bind(this)}))}setupAria(){let z=this.getLocaleTextFunc();_0(this.eButtonShowMainFilter,z("ariaFilterMenuOpen","Open Filter Menu"))}onTabKeyDown(z){let{beans:J}=this;if(d(J)===this.eGui)return;let $=P0(J,this.eGui,null,z.shiftKey);if($){J.headerNavigation?.scrollToColumn(this.column),z.preventDefault(),$.focus();return}let X=this.findNextColumnWithFloatingFilter(z.shiftKey);if(!X)return;if(J.focusSvc.focusHeaderPosition({headerPosition:{headerRowIndex:this.rowCtrl.rowIndex,column:X},event:z}))z.preventDefault()}findNextColumnWithFloatingFilter(z){let J=this.beans.visibleCols,Q=this.column;do if(Q=z?J.getColBefore(Q):J.getColAfter(Q),!Q)break;while(!Q.getColDef().filter||!Q.getColDef().floatingFilter);return Q}handleKeyDown(z){super.handleKeyDown(z);let J=this.getWrapperHasFocus();switch(z.key){case k.UP:case k.DOWN:case k.LEFT:case k.RIGHT:if(J)return;s0(z);case k.ENTER:if(J){if(k0(this.eGui))z.preventDefault()}break;case k.ESCAPE:if(!J)this.eGui.focus()}}onFocusIn(z){if(this.eGui.contains(z.relatedTarget))return;let Q=!!z.relatedTarget&&!z.relatedTarget.classList.contains("ag-floating-filter"),Z=!!z.relatedTarget&&p1(z.relatedTarget,"ag-floating-filter");if(Q&&Z&&z.target===this.eGui){let $=this.lastFocusEvent,X=!!($&&$.key===k.TAB);if($&&X){let Y=$.shiftKey;k0(this.eGui,Y)}}this.focusThis()}setupHover(z){this.beans.colHover?.addHeaderFilterColumnHoverListener(z,this.comp,this.column,this.eGui)}setupLeft(z){let J=new cZ(this.column,this.eGui,this.beans);z.createManagedBean(J)}setupFilterButton(){this.suppressFilterButton=!this.beans.menuSvc?.isFloatingFilterButtonEnabled(this.column),this.highlightFilterButtonWhenActive=!B0(this.gos)}setupUserComp(){if(!this.active)return;let z=this.beans.colFilter?.getFloatingFilterCompDetails(this.column,()=>this.showParentFilter());if(z)this.setCompDetails(z)}setCompDetails(z){this.userCompDetails=z,this.comp.setCompDetails(z)}showParentFilter(){let z=this.suppressFilterButton?this.eFloatingFilterBody:this.eButtonShowMainFilter;this.beans.menuSvc?.showFilterMenu({column:this.column,buttonElement:z,containerType:"floatingFilter",positionBy:"button"})}setupSyncWithFilter(z){if(!this.active)return;let{beans:{colFilter:J},column:Q,gos:Z}=this,$=(X)=>{if(X?.source==="filterDestroyed"&&(!this.isAlive()||!J?.isAlive()))return;let Y=this.comp.getFloatingFilterComp();if(!Y)return;Y.then((q)=>{if(q){if(Z.get("enableFilterHandlers")){let _=X,U="filter";if(_?.afterFloatingFilter)U="ui";else if(_?.afterDataChange)U="dataChanged";else if(X?.source==="api")U="api";this.updateFloatingFilterParams(this.userCompDetails,U);return}let G=J?.getCurrentFloatingFilterParentModel(Q),H=X?{...X,columns:X.columns??[],source:X.source==="api"?"api":"columnFilter"}:null;q.onParentModelChanged(G,H)}})};if([this.destroySyncListener]=z.addManagedListeners(Q,{filterChanged:$}),J?.isFilterActive(Q))$(null)}setupWidth(z){let J=()=>{let Q=`${this.column.getActualWidth()}px`;this.comp.setWidth(Q)};z.addManagedListeners(this.column,{widthChanged:J}),J()}setupFilterChangedListener(z){if(this.active)[this.destroyFilterChangedListener]=z.addManagedListeners(this.column,{filterChanged:this.updateFilterButton.bind(this)}),this.updateFilterButton()}updateFilterButton(){if(!this.suppressFilterButton&&this.comp){let z=!!this.beans.filterManager?.isFilterAllowed(this.column);if(this.comp.setButtonWrapperDisplayed(z),this.highlightFilterButtonWhenActive&&z)this.eButtonShowMainFilter.classList.toggle("ag-filter-active",this.column.isFilterActive())}}onColDefChanged(z){let J=this.active;this.setupActive();let Q=!J&&this.active;if(J&&!this.active)this.destroySyncListener(),this.destroyFilterChangedListener();let Z=this.beans.colFilter,$=this.active?Z?.getFloatingFilterCompDetails(this.column,()=>this.showParentFilter()):null,X=this.comp.getFloatingFilterComp();if(!X||!$)this.updateCompDetails(z,$,Q);else X.then((Y)=>{if(!Y||Z?.areFilterCompsDifferent(this.userCompDetails??null,$))this.updateCompDetails(z,$,Q);else this.updateFloatingFilterParams($,"colDef")})}updateCompDetails(z,J,Q){if(!this.isAlive())return;if(this.setCompDetails(J),this.setupFilterButton(),this.setupUi(),Q)this.setupSyncWithFilter(z),this.setupFilterChangedListener(z)}updateFloatingFilterParams(z,J){if(!z)return;let Q=z.params;this.comp.getFloatingFilterComp()?.then((Z)=>{if(typeof Z?.refresh==="function"){if(this.gos.get("enableFilterHandlers"))Q={...Q,model:D0(this.beans.colFilter?.model??{},this.column.getColId()),source:J};Z.refresh(Q)}})}addResizeAndMoveKeyboardListeners(){}destroy(){super.destroy(),this.destroySyncListener=null,this.destroyFilterChangedListener=null}};function aL(z,J){let Q=z.colModel.getCol(J);if(!Q){t(12,{colKey:J});return}z.menuSvc?.showColumnMenu({column:Q,positionBy:"auto"})}function oL(z){z.menuSvc?.hidePopupMenu()}var eL=class extends V{constructor(){super(...arguments);this.beanName="menuSvc"}postConstruct(){let{enterpriseMenuFactory:z,filterMenuFactory:J}=this.beans;this.activeMenuFactory=z??J}showColumnMenu(z){this.showColumnMenuCommon(this.activeMenuFactory,z,"columnMenu")}showFilterMenu(z){this.showColumnMenuCommon(W8(this.beans),z,z.containerType,!0)}showHeaderContextMenu(z,J,Q){this.activeMenuFactory?.showMenuAfterContextMenuEvent(z,J,Q)}hidePopupMenu(){this.beans.contextMenuSvc?.hideActiveMenu(),this.activeMenuFactory?.hideActiveMenu()}hideFilterMenu(){W8(this.beans)?.hideActiveMenu()}isColumnMenuInHeaderEnabled(z){let{suppressHeaderMenuButton:J}=z.getColDef();return!J&&!!this.activeMenuFactory?.isMenuEnabled(z)&&(B0(this.gos)||!!this.beans.enterpriseMenuFactory)}isFilterMenuInHeaderEnabled(z){return!z.getColDef().suppressHeaderFilterButton&&!!this.beans.filterManager?.isFilterAllowed(z)}isHeaderContextMenuEnabled(z){return!(z&&G4(z)?z.getColDef():z?.getColGroupDef())?.suppressHeaderContextMenu&&this.gos.get("columnMenu")==="new"}isHeaderMenuButtonAlwaysShowEnabled(){return this.isSuppressMenuHide()}isHeaderMenuButtonEnabled(){let z=!this.isSuppressMenuHide();return!(n1()&&z)}isHeaderFilterButtonEnabled(z){return this.isFilterMenuInHeaderEnabled(z)&&!B0(this.gos)&&!this.isFloatingFilterButtonDisplayed(z)}isFilterMenuItemEnabled(z){return!!this.beans.filterManager?.isFilterAllowed(z)&&!B0(this.gos)&&!this.isFilterMenuInHeaderEnabled(z)&&!this.isFloatingFilterButtonDisplayed(z)}isFloatingFilterButtonEnabled(z){return!z.getColDef().suppressFloatingFilterButton}isFloatingFilterButtonDisplayed(z){return!!z.getColDef().floatingFilter&&this.isFloatingFilterButtonEnabled(z)}isSuppressMenuHide(){let z=this.gos,J=z.get("suppressMenuHide");if(B0(z))return z.exists("suppressMenuHide")?J:!1;return J}showColumnMenuCommon(z,J,Q,Z){let{positionBy:$,onClosedCallback:X}=J,Y=J.column;if($==="button"){let{buttonElement:q}=J;z?.showMenuAfterButtonClick(Y,q,Q,X,Z)}else if($==="mouse"){let{mouseEvent:q}=J;z?.showMenuAfterMouseEvent(Y,q,Q,X,Z)}else if(Y){let q=this.beans,G=q.ctrlsSvc;G.getScrollFeature().ensureColumnVisible(Y,"auto"),W4(q,()=>{let H=G.getHeaderRowContainerCtrl(Y.getPinned())?.getHeaderCtrlForColumn(Y);if(H)z?.showMenuAfterButtonClick(Y,H.getAnchorElementForMenu(Z),Q,X,Z)})}}};function j6(z,J,Q){if(z.menuVisible!==J)z.menuVisible=J,z.dispatchColEvent("menuVisibleChanged",Q)}function W8(z){let{enterpriseMenuFactory:J,filterMenuFactory:Q,gos:Z}=z;return J&&B0(Z)?J:Q}var H5={moduleName:"SharedMenu",version:c,beans:[eL],apiFunctions:{showColumnMenu:aL,hidePopupMenu:oL}},zD=".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 JD(z){let J=z.filterManager;return!!J?.isColumnFilterPresent()||!!J?.isAggregateFilterPresent()}function QD(z,J){return z.filterManager?.getColumnFilterInstance(J)??Promise.resolve(void 0)}function ZD(z,J){let Q=z.colModel.getColDefCol(J);if(Q)return z.colFilter?.destroyFilter(Q,"api")}function $D(z,J){z.frameworkOverrides.wrapIncoming(()=>z.filterManager?.setFilterModel(J))}function XD(z){return z.filterManager?.getFilterModel()??{}}function YD(z,J,Q){let{gos:Z,colModel:$,colFilter:X}=z;if(Q&&!Z.get("enableFilterHandlers"))R(288),Q=!1;let Y=$.getColDefCol(J);return Y?X?.getModelForColumn(Y,Q)??null:null}function qD(z,J,Q){return z.filterManager?.setColumnFilterModel(J,Q)??Promise.resolve()}function GD(z,J){let Q=z.colModel.getCol(J);if(!Q){t(12,{colKey:J});return}z.menuSvc?.showFilterMenu({column:Q,containerType:"columnFilter",positionBy:"auto"})}function HD(z){z.menuSvc?.hideFilterMenu()}function _D(z,J){let Q=z.colModel.getCol(J);if(!Q){t(12,{colKey:J});return}return z.colFilter?.getHandler(Q,!0)}function UD(z,J){let{colModel:Q,colFilter:Z,gos:$}=z;if(!$.get("enableFilterHandlers")){R(287);return}let{colId:X,action:Y}=J;if(X){let q=Q.getColById(X);if(q)Z?.updateModel(q,Y)}else Z?.updateAllModels(Y)}var B8={january:"January",february:"February",march:"March",april:"April",may:"May",june:"June",july:"July",august:"August",september:"September",october:"October",november:"November",december:"December"},E8=["january","february","march","april","may","june","july","august","september","october","november","december"];function WD(z,J){if(z==null)return-1;if(J==null)return 1;return Number.parseFloat(z)-Number.parseFloat(J)}function BD(z,J){if(z==null)return-1;if(J==null)return 1;let Q=k1(z),Z=k1(J);if(Q!=null&&Z!=null){if(Q===Z)return 0;return Q>Z?1:-1}return String(z).localeCompare(String(J))}function K8(z){return z instanceof Date&&!isNaN(z.getTime())}var oQ={number:()=>{return},bigint:()=>{return},boolean:()=>({maxNumConditions:1,debounceMs:0,filterOptions:["empty",{displayKey:"true",displayName:"True",predicate:(z,J)=>J,numberOfInputs:0},{displayKey:"false",displayName:"False",predicate:(z,J)=>J===!1,numberOfInputs:0}]}),date:()=>({isValidDate:K8}),dateString:({dataTypeDefinition:z})=>({comparator:(J,Q)=>{let Z=z.dateParser(Q);if(Q==null||ZJ)return 1;return 0},isValidDate:(J)=>typeof J==="string"&&K8(z.dateParser(J))}),dateTime:(z)=>oQ.date(z),dateTimeString:(z)=>oQ.dateString(z),object:()=>{return},text:()=>{return}},eQ={number:()=>({comparator:WD}),bigint:()=>({comparator:BD}),boolean:({t:z})=>({valueFormatter:(J)=>T(J.value)?z(String(J.value),J.value?"True":"False"):z("blanks","(Blanks)")}),date:({formatValue:z,t:J})=>({valueFormatter:(Q)=>{let Z=z(Q);return T(Z)?Z:J("blanks","(Blanks)")},treeList:!0,treeListFormatter:(Q,Z)=>{if(Q==="NaN")return J("invalidDate","Invalid Date");if(Z===1&&Q!=null){let $=E8[Number(Q)-1];return J($,B8[$])}return Q??J("blanks","(Blanks)")},treeListPathGetter:(Q)=>_1(Q,!1)}),dateString:({formatValue:z,dataTypeDefinition:J,t:Q})=>({valueFormatter:(Z)=>{let $=z(Z);return T($)?$:Q("blanks","(Blanks)")},treeList:!0,treeListPathGetter:(Z)=>_1(J.dateParser(Z??void 0),!1),treeListFormatter:(Z,$)=>{if($===1&&Z!=null){let X=E8[Number(Z)-1];return Q(X,B8[X])}return Z??Q("blanks","(Blanks)")}}),dateTime:(z)=>{let J=eQ.date(z);return J.treeListPathGetter=_1,J},dateTimeString(z){let J=z.dataTypeDefinition.dateParser,Q=eQ.dateString(z);return Q.treeListPathGetter=(Z)=>_1(J(Z??void 0)),Q},object:({formatValue:z,t:J})=>({valueFormatter:(Q)=>{let Z=z(Q);return T(Z)?Z:J("blanks","(Blanks)")}}),text:()=>{return}};function _5(z,J,Q,Z,$,X,Y){let q=J,G=Q,H=z==="agSetColumnFilter";if(!G&&Z.baseDataType==="object"&&!H)G=({column:B,node:E})=>$({column:B,node:E,value:X.valueSvc.getValue(B,E,"data")});let U=(H?eQ:oQ)[Z.baseDataType],W=U({dataTypeDefinition:Z,formatValue:$,t:Y});return q=typeof J==="object"?{...W,...J}:W,{filterParams:q,filterValueGetter:G}}var ED={boolean:"agTextColumnFilter",date:"agDateColumnFilter",dateString:"agDateColumnFilter",dateTime:"agDateColumnFilter",dateTimeString:"agDateColumnFilter",bigint:"agBigIntColumnFilter",number:"agNumberColumnFilter",object:"agTextColumnFilter",text:"agTextColumnFilter"},KD={boolean:"agTextColumnFloatingFilter",date:"agDateColumnFloatingFilter",dateString:"agDateColumnFloatingFilter",dateTime:"agDateColumnFloatingFilter",dateTimeString:"agDateColumnFloatingFilter",bigint:"agBigIntColumnFloatingFilter",number:"agNumberColumnFloatingFilter",object:"agTextColumnFloatingFilter",text:"agTextColumnFloatingFilter"};function U5(z,J=!1){return(J?KD:ED)[z??"text"]}function W5(z,J,Q){if(J==null)return null;let Z=null,{compName:$,jsComp:X,fwComp:Y}=A9(z,J);if($)Z={agSetColumnFilter:"agSetColumnFloatingFilter",agMultiColumnFilter:"agMultiColumnFloatingFilter",agGroupColumnFilter:"agGroupColumnFloatingFilter",agNumberColumnFilter:"agNumberColumnFloatingFilter",agBigIntColumnFilter:"agBigIntColumnFloatingFilter",agDateColumnFilter:"agDateColumnFloatingFilter",agTextColumnFilter:"agTextColumnFloatingFilter"}[$];else if(X==null&&Y==null&&J.filter===!0)Z=Q();return Z}var FD={filterHandler:()=>({doesFilterPass:()=>!0})};function F8(z,J,Q,Z){if(!z.isPrimary())return!0;let X=!Q;if(!z.isValueActive()||!X)return!1;if(J)return!0;return Z}var LD=class extends V{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={...GX},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 z=this.gos,J={...z.get("initialState")?.filter?.filterModel??{}};if(this.initialModel=J,this.model={...J},!z.get("enableFilterHandlers"))delete this.handlerMap.agMultiColumnFilter}refreshModel(){this.onNewRowsLoaded("rowDataUpdated")}setModel(z,J="api",Q){let{colModel:Z,dataTypeSvc:$,filterManager:X}=this.beans;if($?.isPendingInference){this.modelUpdates.push({model:z,source:J});return}let Y=[],q=this.getModel(!0);if(z){let G=new Set(Object.keys(z));this.allColumnFilters.forEach((H,_)=>{let U=z[_];Y.push(this.setModelOnFilterWrapper(H,U)),G.delete(_)}),G.forEach((H)=>{let _=Z.getColDefCol(H)||Z.getCol(H);if(!_){R(62,{colId:H});return}if(!_.isFilterAllowed()){R(63,{colId:H});return}let U=this.getOrCreateFilterWrapper(_,!0);if(!U){R(64,{colId:H});return}Y.push(this.setModelOnFilterWrapper(U,z[H],!0))})}else this.model={},this.allColumnFilters.forEach((G)=>{Y.push(this.setModelOnFilterWrapper(G,null))});N.all(Y).then(()=>{let G=this.getModel(!0),H=[];if(this.allColumnFilters.forEach((_,U)=>{let W=q?q[U]:null,B=G?G[U]:null;if(!rz(W,B))H.push(_.column)}),H.length>0)X?.onFilterChanged({columns:H,source:J});else if(Q)this.updateActive("filterChanged")})}getModel(z){let J={},{allColumnFilters:Q,initialModel:Z,beans:{colModel:$}}=this;if(Q.forEach((X,Y)=>{let q=this.getModelFromFilterWrapper(X);if(T(q))J[Y]=q}),!z)for(let X of Object.keys(Z)){let Y=Z[X];if(T(Y)&&!Q.has(X)&&$.getCol(X)?.isFilterAllowed())J[X]=Y}return J}setState(z,J,Q="api"){if(this.state.clear(),J)for(let Z of Object.keys(J)){let $=J[Z];this.state.set(Z,{model:D0(this.model,Z),state:$})}this.setModel(z,Q,!0)}getState(){let z=this.state;if(!z.size)return;let J={},Q=!1;return z.forEach((Z,$)=>{let X=Z.state;if(X!=null)Q=!0,J[$]=X}),Q?J:void 0}getModelFromFilterWrapper(z){let Q=z.column.getColId();if(z.isHandler)return D0(this.model,Q);let Z=z.filter;if(Z){if(typeof Z.getModel!=="function")return R(66),null;return Z.getModel()}return D0(this.initialModel,Q)}isFilterPresent(){return this.activeColumnFilters.length>0}isAggFilterPresent(){return!!this.activeAggregateFilters.length}disableFilters(){this.initialModel={};let{allColumnFilters:z}=this;if(z.size)return z.forEach((J)=>this.disposeFilterWrapper(J,"advancedFilterEnabled")),!0;return!1}updateActiveFilters(){let z=(G)=>{if(!G)return!1;if(!G.isFilterActive)return R(67),!1;return G.isFilterActive()},{colModel:J,gos:Q}=this.beans,Z=!!h4(Q),$=[],X=[],Y=(G,H,_)=>{if(H)if(F8(G,J.isPivotMode(),J.isPivotActive(),Z))$.push(_);else X.push(_)},q=[];return this.allColumnFilters.forEach((G)=>{let H=G.column,_=H.getColId();if(G.isHandler)q.push(N.resolve().then(()=>{Y(H,this.isHandlerActive(H),{colId:_,isHandler:!0,handler:G.handler,handlerParams:G.handlerParams})}));else{let U=q1(G);if(U)q.push(U.then((W)=>{Y(H,z(W),{colId:_,isHandler:!1,comp:W})}))}}),N.all(q).then(()=>{this.activeAggregateFilters=$,this.activeColumnFilters=X})}updateFilterFlagInColumns(z,J){let Q=[];return this.allColumnFilters.forEach((Z)=>{let $=Z.column;if(Z.isHandler)Q.push(N.resolve().then(()=>{this.setColFilterActive($,this.isHandlerActive($),z,J)}));else{let X=q1(Z);if(X)Q.push(X.then((Y)=>{this.setColFilterActive($,Y.isFilterActive(),z,J)}))}}),this.beans.groupFilter?.updateFilterFlags(z,J),N.all(Q)}doFiltersPass(z,J,Q){let{data:Z,aggData:$}=z,X=Q?this.activeAggregateFilters:this.activeColumnFilters,Y=Q?$:Z,q=this.model;for(let G=0;G{if(this.isAlive())Q?.onFilterChanged(z)};if(J.isRefreshInProgress())setTimeout(Z,0);else Z()}updateBeforeFilterChanged(z={}){let{column:J,additionalEventAttributes:Q}=z,Z=J?.getColId();return this.updateActiveFilters().then(()=>this.updateFilterFlagInColumns("filterChanged",Q).then(()=>{this.allColumnFilters.forEach(($)=>{let{column:X,isHandler:Y}=$;if(Z===X.getColId())return;if(Y)$.handler.onAnyFilterChanged?.();q1($,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(z){let J=[];this.allColumnFilters.forEach((Q)=>{let Z=Q.isHandler;if(Z)Q.handler.onNewRowsLoaded?.();let $=q1(Q,Z);if($)J.push($.then((X)=>{X.onNewRowsLoaded?.()}))}),N.all(J).then(()=>this.updateActive(z,{afterDataChange:!0}))}updateActive(z,J){this.updateFilterFlagInColumns(z,J).then(()=>this.updateActiveFilters())}createGetValue(z,J){let{filterValueSvc:Q,colModel:Z}=this.beans;return($,X)=>{let Y=X?Z.getCol(X):z;return Y?Q.getValue(Y,$,J):void 0}}isFilterActive(z){let J=this.cachedFilter(z);if(J?.isHandler)return this.isHandlerActive(z);let Q=J?.filter;if(Q)return Q.isFilterActive();return D0(this.initialModel,z.getColId())!=null}isHandlerActive(z){let J=T(D0(this.model,z.getColId()));if(J)return J;let Q=this.beans.groupFilter;return Q?.isGroupFilter(z)?Q.isFilterActive(z):!1}getOrCreateFilterUi(z){let J=this.getOrCreateFilterWrapper(z,!0);return J?q1(J):null}getFilterUiForDisplay(z){let J=this.getOrCreateFilterWrapper(z,!0);if(!J)return null;let Q=q1(J);if(!Q)return null;return Q.then((Z)=>({comp:Z,params:J.filterUi.filterParams,isHandler:J.isHandler}))}getHandler(z,J){let Q=this.getOrCreateFilterWrapper(z,J);return Q?.isHandler?Q.handler:void 0}getOrCreateFilterWrapper(z,J){if(!z.isFilterAllowed())return;let Q=this.cachedFilter(z);if(!Q&&J)Q=this.createFilterWrapper(z),this.setColumnFilterWrapper(z,Q);return Q}cachedFilter(z){return this.allColumnFilters.get(z.getColId())}getDefaultFilter(z,J=!1){return this.getDefaultFilterFromDataType(()=>this.beans.dataTypeSvc?.getBaseDataType(z),J)}getDefaultFilterFromDataType(z,J=!1){if(lG(this.gos))return J?"agSetColumnFloatingFilter":"agSetColumnFilter";return U5(z(),J)}getDefaultFloatingFilter(z){return this.getDefaultFilter(z,!0)}createFilterComp(z,J,Q,Z,$,X){let Y=()=>{let H=this.createFilterCompParams(z,$,X),_=Z(H,$);return PZ(this.beans.userCompFactory,J,_,Q)},q=Y();if(!q)return null;return{compDetails:q,createFilterUi:(H)=>{return(H?Y():q).newAgStackInstance()}}}createFilterInstance(z,J,Q,Z){let $=this.beans.selectableFilter;if($?.isSelectable(J))J=$.getFilterDef(z,J);let{handler:X,handlerParams:Y,handlerGenerator:q}=this.createHandler(z,J,Q)??{},G=this.createFilterComp(z,J,Q,Z,!!X,"init");if(!G)return{compDetails:null,createFilterUi:null,handler:X,handlerGenerator:q,handlerParams:Y};let{compDetails:H,createFilterUi:_}=G;if(this.isGlobalButtons){if(!H.params?.buttons?.length)R(281,{colId:z.getColId()})}return{compDetails:H,handler:X,handlerGenerator:q,handlerParams:Y,createFilterUi:_}}createBaseFilterParams(z,J){let{filterManager:Q,rowModel:Z}=this.beans;return C(this.gos,{column:z,colDef:z.getColDef(),getValue:this.createGetValue(z),doesRowPassOtherFilter:J?()=>!0:($)=>Q?.doesRowPassOtherFilters(z.getColId(),$)??!0,rowModel:Z})}createFilterCompParams(z,J,Q,Z){let $=this.filterChangedCallbackFactory(z),X=this.createBaseFilterParams(z,Z);if(X.filterChangedCallback=$,X.filterModifiedCallback=Z?()=>{}:(Y)=>this.filterModified(z,Y),J){let Y=X,q=z.getColId(),G=D0(this.model,q);Y.model=G,Y.state=this.state.get(q)??{model:G},Y.onModelChange=(H,_)=>{this.updateStoredModel(q,H),this.refreshHandlerAndUi(z,H,"ui",!1,_).then(()=>{$({..._,source:"columnFilter"})})},Y.onStateChange=(H)=>{this.updateState(z,H),this.updateOrRefreshFilterUi(z)},Y.onAction=(H,_,U)=>{this.updateModel(z,H,_),this.dispatchLocalEvent({type:"filterAction",column:z,action:H,event:U})},Y.getHandler=()=>this.getHandler(z,!0),Y.onUiChange=(H)=>this.filterUiChanged(z,H),Y.source=Q}return X}createFilterUiForHandler(z,J){return J?{created:!1,create:J,filterParams:z.params,compDetails:z}:null}createFilterUiLegacy(z,J,Q){let Z=J(),$={created:!0,create:J,filterParams:z.params,compDetails:z,promise:Z};return Z.then(Q),$}createFilterWrapper(z){let{compDetails:J,handler:Q,handlerGenerator:Z,handlerParams:$,createFilterUi:X}=this.createFilterInstance(z,z.getColDef(),this.getDefaultFilter(z),(q)=>q),Y=z.getColId();if(Q)return delete this.initialModel[Y],Q.init?.({...$,source:"init",model:D0(this.model,Y)}),{column:z,isHandler:!0,handler:Q,handlerGenerator:Z,handlerParams:$,filterUi:this.createFilterUiForHandler(J,X)};if(X){let q={column:z,filterUi:null,isHandler:!1};return q.filterUi=this.createFilterUiLegacy(J,X,(G)=>{q.filter=G??void 0}),q}return{column:z,filterUi:null,isHandler:!1}}createHandlerFunc(z,J,Q){let{gos:Z,frameworkOverrides:$,registry:X}=this.beans,Y,q=(B)=>{let E=B.filter;if(f9(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=Z.get("enableFilterHandlers"),H=G?q(J):void 0,_=(B)=>()=>this.createBean(X.createDynamicBean(B,!0)),U,W;if(typeof H==="string"){let B=Z.get("filterHandlers")?.[H];if(B!=null)U=B;else if(sL.has(H))U=_(H),W=H}else U=H;if(!U){let B,{compName:E,jsComp:K,fwComp:F}=A9($,J);if(E)B=E;else if(K==null&&F==null&&J.filter===!0)B=Q;if(W=this.handlerMap[B],W)U=_(W)}if(!U){if(!G)return;if(o(Z))R(277,{colId:z.getColId()});return FD}return{filterHandler:U,handlerNameOrCallback:Y??W}}createHandler(z,J,Q){let Z=this.createHandlerFunc(z,J,Q);if(!Z)return;let $=eJ(this.beans.userCompFactory,J,this.createFilterCompParams(z,!0,"init")),{handlerNameOrCallback:X,filterHandler:Y}=Z,{handler:q,handlerParams:G}=this.createHandlerFromFunc(z,Y,$);return{handler:q,handlerParams:G,handlerGenerator:X??Y}}createHandlerFromFunc(z,J,Q){let Z=z.getColDef(),$=J(C(this.gos,{column:z,colDef:Z})),X=this.createHandlerParams(z,Q);return{handler:$,handlerParams:X}}createHandlerParams(z,J){let Q=z.getColDef(),Z=z.getColId(),$=this.filterChangedCallbackFactory(z);return C(this.gos,{colDef:Q,column:z,getValue:this.createGetValue(z),doesRowPassOtherFilter:(X)=>this.beans.filterManager?.doesRowPassOtherFilters(Z,X)??!0,onModelChange:(X,Y)=>{this.updateStoredModel(Z,X),this.refreshHandlerAndUi(z,X,"handler",!1,Y).then(()=>{$({...Y,source:"columnFilter"})})},onModelAsStringChange:()=>{z.dispatchColEvent("filterChanged","filterChanged"),this.dispatchLocalEvent({type:"filterModelAsStringChanged",column:z})},filterParams:J})}onColumnsChanged(){let z=[],{colModel:J,filterManager:Q,groupFilter:Z}=this.beans;this.allColumnFilters.forEach((X,Y)=>{let q;if(X.column.isPrimary())q=J.getColDefCol(Y);else q=J.getCol(Y);if(q&&q===X.column)return;z.push(X.column),this.disposeFilterWrapper(X,"columnChanged"),this.disposeColumnListener(Y)});let $=Z&&z.every((X)=>Z.isGroupFilter(X));if(z.length>0&&!$)Q?.onFilterChanged({columns:z,source:"api"})}isFilterAllowed(z){if(!z.isFilterAllowed())return!1;let Q=this.beans.groupFilter;if(Q?.isGroupFilter(z))return Q.isFilterAllowed(z);return!0}getFloatingFilterCompDetails(z,J){let{userCompFactory:Q,frameworkOverrides:Z,selectableFilter:$,gos:X}=this.beans,Y=(B)=>{this.getOrCreateFilterUi(z)?.then((K)=>{B(l4(K))})},q=z.getColDef(),G=$?.isSelectable(q)?$.getFilterDef(z,q):q,H=W5(Z,G,()=>this.getDefaultFloatingFilter(z))??"agReadOnlyFloatingFilter",_=X.get("enableFilterHandlers"),U=eJ(Q,G,this.createFilterCompParams(z,_,"init",!0)),W=C(X,{column:z,filterParams:U,currentParentModel:()=>this.getCurrentFloatingFilterParentModel(z),parentFilterInstance:Y,showParentFilter:J});if(_){let B=W,E=z.getColId(),K=this.filterChangedCallbackFactory(z);B.onUiChange=(F)=>this.floatingFilterUiChanged(z,F),B.model=D0(this.model,E),B.onModelChange=(F,L)=>{this.updateStoredModel(E,F),this.refreshHandlerAndUi(z,F,"floating",!0,L).then(()=>{K({...L,source:"columnFilter"})})},B.getHandler=()=>this.getHandler(z,!0),B.source="init"}return TZ(Q,q,W,H)}getCurrentFloatingFilterParentModel(z){return this.getModelFromFilterWrapper(this.cachedFilter(z)??{column:z})}destroyFilterUi(z,J,Q,Z){if(z.isHandler){let X=J.getColId();delete this.initialModel[X],this.state.delete(X);let Y=z.filterUi,q=this.createFilterUiForHandler(Q,Z);z.filterUi=q;let G=this.eventSvc;if(Y?.created)Y.promise.then((H)=>{this.destroyBean(H),G.dispatchEvent({type:"filterDestroyed",source:"paramsUpdated",column:J})});else G.dispatchEvent({type:"filterHandlerDestroyed",source:"paramsUpdated",column:J})}else this.destroyFilter(J,"paramsUpdated")}destroyFilter(z,J="api"){let Q=z.getColId(),Z=this.allColumnFilters.get(Q);if(this.disposeColumnListener(Q),delete this.initialModel[Q],Z)this.disposeFilterWrapper(Z,J).then(($)=>{if($&&this.isAlive())this.beans.filterManager?.onFilterChanged({columns:[z],source:"api"})})}disposeColumnListener(z){let J=this.allColumnListeners.get(z);if(J)this.allColumnListeners.delete(z),J()}disposeFilterWrapper(z,J){let Q=!1,{column:Z,isHandler:$,filterUi:X}=z,Y=Z.getColId();if($)Q=this.isHandlerActive(Z),this.destroyBean(z.handler),delete this.model[Y],this.state.delete(Y);let q=()=>{this.setColFilterActive(Z,!1,"filterDestroyed"),this.allColumnFilters.delete(Y),this.eventSvc.dispatchEvent({type:"filterDestroyed",source:J,column:Z})};if(X)if(X.created)return X.promise.then((G)=>{return Q=$?Q:!!G?.isFilterActive(),this.destroyBean(G),q(),Q});else q();return N.resolve(Q)}filterChangedCallbackFactory(z){return(J)=>{this.callOnFilterChangedOutsideRenderCycle({additionalEventAttributes:J,columns:[z],column:z,source:J?.source??"columnFilter"})}}filterParamsChanged(z,J="api"){let Q=this.allColumnFilters.get(z);if(!Q)return;let Z=this.beans,$=Q.column,X=$.getColDef(),Y=$.isFilterAllowed(),q=this.getDefaultFilter($),G=Z.selectableFilter,H=G?.isSelectable(X)?G.getFilterDef($,X):X,_=Y?this.createHandlerFunc($,H,this.getDefaultFilter($)):void 0,U=!!_,W=Q.isHandler;if(W!=U){this.destroyFilter($,"paramsUpdated");return}let{compDetails:B,createFilterUi:E}=(Y?this.createFilterComp($,H,q,(F)=>F,U,"colDef"):null)??{compDetails:null,createFilterUi:null},K=B?.params??eJ(Z.userCompFactory,H,this.createFilterCompParams($,U,"colDef"));if(W){let F=_?.handlerNameOrCallback??_?.filterHandler,L=D0(this.model,z);if(Q.handlerGenerator!=F){let D=Q.handler,{handler:M,handlerParams:f}=this.createHandlerFromFunc($,_.filterHandler,K);if(Q.handler=M,Q.handlerParams=f,Q.handlerGenerator=F,delete this.model[z],M.init?.({...f,source:"init",model:null}),this.destroyBean(D),L!=null)this.beans.filterManager?.onFilterChanged({columns:[$],source:J})}else{let D=this.createHandlerParams($,B?.params);Q.handlerParams=D,Q.handler.refresh?.({...D,source:"colDef",model:L})}}if(this.areFilterCompsDifferent(Q.filterUi?.compDetails??null,B)||!Q.filterUi||!B){this.destroyFilterUi(Q,$,B,E);return}Q.filterUi.filterParams=K,q1(Q,W)?.then((F)=>{if((F?.refresh?F.refresh(K):!0)===!1)this.destroyFilterUi(Q,$,B,E);else this.dispatchLocalEvent({type:"filterParamsChanged",column:$,params:K})})}refreshHandlerAndUi(z,J,Q,Z,$){let X=this.cachedFilter(z);if(!X){if(Z)this.getOrCreateFilterWrapper(z,!0);return N.resolve()}if(!X.isHandler)return N.resolve();let{filterUi:Y,handler:q,handlerParams:G}=X;return fJ(()=>{if(Y){let{created:H,filterParams:_}=Y;if(H)return Y.promise.then((U)=>{return U?{filter:U,filterParams:_}:void 0});else Y.refreshed=!0}return N.resolve(void 0)},q,G,J,this.state.get(z.getColId())??{model:J},Q,$)}setColumnFilterWrapper(z,J){let Q=z.getColId();this.allColumnFilters.set(Q,J),this.allColumnListeners.set(Q,this.addManagedListeners(z,{colDefChanged:()=>this.filterParamsChanged(Q)})[0])}areFilterCompsDifferent(z,J){if(!J||!z)return!0;let{componentClass:Q}=z,{componentClass:Z}=J;return!(Q===Z||Q?.render&&Z?.render&&Q.render===Z.render)}hasFloatingFilters(){return this.beans.colModel.getCols().some((J)=>J.getColDef().floatingFilter)}getFilterInstance(z){let J=this.beans.colModel.getColDefCol(z);if(!J)return Promise.resolve(void 0);let Q=this.getOrCreateFilterUi(J);if(!Q)return Promise.resolve(null);return new Promise((Z)=>{Q.then(($)=>{Z(l4($))})})}processFilterModelUpdateQueue(){this.modelUpdates.forEach(({model:z,source:J})=>this.setModel(z,J)),this.modelUpdates=[],this.columnModelUpdates.forEach(({key:z,model:J,resolve:Q})=>{this.setModelForColumn(z,J).then(()=>Q())}),this.columnModelUpdates=[]}getModelForColumn(z,J){if(J){let{state:Z,model:$}=this,X=z.getColId(),Y=Z.get(X);if(Y)return Y.model??null;return D0($,X)}let Q=this.cachedFilter(z);return Q?this.getModelFromFilterWrapper(Q):null}setModelForColumn(z,J){if(this.beans.dataTypeSvc?.isPendingInference){let Q=()=>{},Z=new Promise(($)=>{Q=$});return this.columnModelUpdates.push({key:z,model:J,resolve:Q}),Z}return new Promise((Q)=>{this.setModelForColumnLegacy(z,J).then((Z)=>Q(Z))})}getStateForColumn(z){return this.state.get(z)??{model:D0(this.model,z)}}setModelForColumnLegacy(z,J){let Q=this.beans.colModel.getColDefCol(z),Z=Q?this.getOrCreateFilterWrapper(Q,!0):null;return Z?this.setModelOnFilterWrapper(Z,J):N.resolve()}setColDefPropsForDataType(z,J,Q){let Z=z.filter,$=Z===!0?this.getDefaultFilterFromDataType(()=>J.baseDataType):Z;if(typeof $!=="string")return;let X,Y,q=this.beans,{filterParams:G,filterValueGetter:H}=z;if($==="agMultiColumnFilter")({filterParams:X,filterValueGetter:Y}=q.multiFilter?.getParamsForDataType(G,H,J,Q)??{});else({filterParams:X,filterValueGetter:Y}=_5($,G,H,J,Q,q,this.getLocaleTextFunc()));if(z.filterParams=X,Y)z.filterValueGetter=Y}setColFilterActive(z,J,Q,Z){if(z.filterActive!==J)z.filterActive=J,z.dispatchColEvent("filterActiveChanged",Q);z.dispatchColEvent("filterChanged",Q,Z)}setModelOnFilterWrapper(z,J,Q){return new N((Z)=>{if(z.isHandler){let X=z.column,Y=X.getColId(),q=this.model[Y];if(this.updateStoredModel(Y,J),Q&&J===q){Z();return}this.refreshHandlerAndUi(X,J,"api").then(()=>Z());return}let $=q1(z);if($){$.then((X)=>{if(typeof X?.setModel!=="function"){R(65),Z();return}(X.setModel(J)||N.resolve()).then(()=>Z())});return}Z()})}updateStoredModel(z,J){if(T(J))this.model[z]=J;else delete this.model[z];let Q=this.state.get(z),Z={model:J,state:Q?.state};this.state.set(z,Z)}filterModified(z,J){this.getOrCreateFilterUi(z)?.then((Q)=>{this.eventSvc.dispatchEvent({type:"filterModified",column:z,filterInstance:Q,...J})})}filterUiChanged(z,J){if(this.gos.get("enableFilterHandlers"))this.eventSvc.dispatchEvent({type:"filterUiChanged",column:z,...J})}floatingFilterUiChanged(z,J){if(this.gos.get("enableFilterHandlers"))this.eventSvc.dispatchEvent({type:"floatingFilterUiChanged",column:z,...J})}updateModel(z,J,Q){let Z=z.getColId(),$=this.cachedFilter(z),X=()=>$?.filterUi;dz({action:J,filterParams:$?.filterUi?.filterParams,getFilterUi:X,getModel:()=>D0(this.model,Z),getState:()=>this.state.get(Z),updateState:(Y)=>this.updateState(z,Y),updateModel:(Y)=>X()?.filterParams?.onModelChange(Y,{...Q,fromAction:J}),processModelToApply:$?.isHandler?$.handler.processModelToApply?.bind($.handler):void 0})}updateAllModels(z,J){let Q=[];if(this.allColumnFilters.forEach((Z,$)=>{let X=this.beans.colModel.getColDefCol($);if(X)dz({action:z,filterParams:Z.filterUi?.filterParams,getFilterUi:()=>Z.filterUi,getModel:()=>D0(this.model,$),getState:()=>this.state.get($),updateState:(Y)=>this.updateState(X,Y),updateModel:(Y)=>{this.updateStoredModel($,Y),this.dispatchLocalEvent({type:"filterAction",column:X,action:z}),Q.push(this.refreshHandlerAndUi(X,Y,"ui"))},processModelToApply:Z?.isHandler?Z.handler.processModelToApply?.bind(Z.handler):void 0})}),Q.length)N.all(Q).then(()=>{this.callOnFilterChangedOutsideRenderCycle({source:"columnFilter",additionalEventAttributes:J,columns:[]})})}updateOrRefreshFilterUi(z){let J=z.getColId();HX(()=>this.cachedFilter(z)?.filterUi,()=>D0(this.model,J),()=>this.state.get(J))}updateState(z,J){this.state.set(z.getColId(),J),this.dispatchLocalEvent({type:"filterStateChanged",column:z,state:J})}canApplyAll(){let{state:z,model:J,activeFilterComps:Q}=this;for(let $ of Q)if($.source==="COLUMN_MENU")return!1;let Z=!1;for(let $ of z.keys()){let X=z.get($);if(X.valid===!1)return!1;if((X.model??null)!==D0(J,$))Z=!0}return Z}hasUnappliedModel(z){let{model:J,state:Q}=this;return(Q.get(z)?.model??null)!==D0(J,z)}setGlobalButtons(z){this.isGlobalButtons=z,this.dispatchLocalEvent({type:"filterGlobalButtons",isGlobal:z})}shouldKeepStateOnDetach(z,J){if(J==="newFiltersToolPanel")return!0;let Q=this.beans.filterPanelSvc;if(Q?.isActive)return!!Q.getState(z.getColId());return!1}onPivotModeChanged(z){let{colModel:J,pivotColsSvc:Q}=this.beans,Z=!!h4(this.gos),$=z.currentValue,X=$?this.activeColumnFilters:this.activeAggregateFilters,Y=$?this.activeAggregateFilters:this.activeColumnFilters,q=[];for(let G of X){let H=J.getColById(G.colId),_=$&&!!Q?.columns.length;if(H&&$===F8(H,$,_,Z))Y.push(G),q.push(G)}O6(X,q)}destroy(){super.destroy(),this.allColumnFilters.forEach((z)=>this.disposeFilterWrapper(z,"gridDestroyed")),this.allColumnListeners.clear(),this.state.clear(),this.activeFilterComps.clear()}};function DD(z){return!!z.filterManager?.isAnyFilterPresent()}function MD(z,J="api"){z.filterManager?.onFilterChanged({source:J})}var kD=class extends V{constructor(){super(...arguments);this.beanName="filterManager",this.advFilterModelUpdateQueue=[]}wireBeans(z){this.quickFilter=z.quickFilter,this.advancedFilter=z.advancedFilter,this.colFilter=z.colFilter}postConstruct(){let z=this.refreshFiltersForAggregations.bind(this),J=this.updateAdvFilterColumns.bind(this);if(this.addManagedEventListeners({columnValueChanged:z,columnPivotChanged:z,columnPivotModeChanged:z,newColumnsLoaded:J,columnVisible:J,advancedFilterEnabledChanged:({enabled:Z})=>this.onAdvFilterEnabledChanged(Z),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 z=this.gos.getCallback("isExternalFilterPresent");return typeof z==="function"&&z({})}doesExternalFilterPass(z){let J=this.gos.get("doesExternalFilterPass");return typeof J==="function"&&J(z)}setFilterState(z,J,Q="api"){if(this.isAdvFilterEnabled())return;this.colFilter?.setState(z,J,Q)}setFilterModel(z,J="api",Q){if(this.isAdvFilterEnabled()){if(!Q)this.warnAdvFilters();return}this.colFilter?.setModel(z,J)}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(z){if(z){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(h4(this.gos)&&this.isAnyFilterPresent())this.onFilterChanged()}onFilterChanged(z={}){let{source:J,additionalEventAttributes:Q,columns:Z=[]}=z;this.externalFilterPresent=this.isExternalFilterPresentCallback(),(this.colFilter?this.colFilter.updateBeforeFilterChanged(z):N.resolve()).then(()=>{let $={source:J,type:"filterChanged",columns:Z};if(Q)K0($,Q);this.eventSvc.dispatchEvent($),this.colFilter?.updateAfterFilterChanged()})}isSuppressFlashingCellsBecauseFiltering(){return!!this.colFilter?.isSuppressFlashingCellsBecauseFiltering()}isQuickFilterPresent(){return!!this.quickFilter?.isFilterPresent()}updateAggFiltering(){this.aggFiltering=!!h4(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,J){return this.doesRowPassFilter({rowNode:J,colIdToSkip:z})}doesRowPassAggregateFilters(z){let{rowNode:J}=z;if(this.alwaysPassFilter?.(J))return!0;if(this.isAggregateQuickFilterPresent()&&!this.quickFilter.doesRowPass(J))return!1;if(this.isAggregateFilterPresent()&&!this.colFilter.doFiltersPass(J,z.colIdToSkip,!0))return!1;return!0}doesRowPassFilter(z){let{rowNode:J}=z;if(this.alwaysPassFilter?.(J))return!0;if(this.isNonAggregateQuickFilterPresent()&&!this.quickFilter.doesRowPass(J))return!1;if(this.externalFilterPresent&&!this.doesExternalFilterPass(J))return!1;if(this.isColumnFilterPresent()&&!this.colFilter.doFiltersPass(J,z.colIdToSkip))return!1;if(this.isAdvFilterPresent()&&!this.advancedFilter.doesFilterPass(J))return!1;return!0}isFilterAllowed(z){if(this.isAdvFilterEnabled())return!1;return!!this.colFilter?.isFilterAllowed(z)}getAdvFilterModel(){return this.isAdvFilterEnabled()?this.advancedFilter.getModel():null}setAdvFilterModel(z,J="api"){if(!this.isAdvFilterEnabled())return;if(this.beans.dataTypeSvc?.isPendingInference){this.advFilterModelUpdateQueue.push(z);return}this.advancedFilter.setModel(z??null),this.onFilterChanged({source:J})}toggleAdvFilterBuilder(z,J){if(!this.isAdvFilterEnabled())return;this.advancedFilter.getCtrl().toggleFilterBuilder({source:J,force:z})}updateAdvFilterColumns(){if(!this.isAdvFilterEnabled())return;if(this.advancedFilter.updateValidity())this.onFilterChanged({source:"advancedFilter"})}hasFloatingFilters(){if(this.isAdvFilterEnabled())return!1;return!!this.colFilter?.hasFloatingFilters()}getColumnFilterInstance(z){if(this.isAdvFilterEnabled())return this.warnAdvFilters(),Promise.resolve(void 0);return this.colFilter?.getFilterInstance(z)??Promise.resolve(void 0)}warnAdvFilters(){R(68)}setupAdvFilterHeaderComp(z){this.advancedFilter?.getCtrl().setupHeaderComp(z)}getHeaderRowCount(){return this.isAdvFilterHeaderActive()?1:0}getHeaderHeight(){return this.isAdvFilterHeaderActive()?this.advancedFilter.getCtrl().getHeaderHeight():0}processFilterModelUpdateQueue(){for(let z of this.advFilterModelUpdateQueue)this.setAdvFilterModel(z);this.advFilterModelUpdateQueue=[]}setColumnFilterModel(z,J){if(this.isAdvFilterEnabled())return this.warnAdvFilters(),Promise.resolve();return this.colFilter?.setModelForColumn(z,J)??Promise.resolve()}};function fD(z){return{tag:"div",cls:z}}var B5=class extends y{constructor(z){let{className:J="ag-filter-apply-panel"}=z??{};super(fD(J));this.listeners=[],this.validationMessage=null,this.className=J}updateButtons(z,J){let Q=this.buttons;if(this.buttons=z,Q===z)return;let Z=this.getGui();J0(Z);let $;this.destroyListeners();let X=document.createDocumentFragment(),Y=this.className,q=({type:H,label:_})=>{let U=(L)=>{this.dispatchLocalEvent({type:H,event:L})};if(!["apply","clear","reset","cancel"].includes(H))R(75);let W=H==="apply",E=z0({tag:"button",attrs:{type:W&&J?"submit":"button"},ref:`${H}FilterButton`,cls:`ag-button ag-standard-button ${Y}-button${W?" "+Y+"-apply-button":""}`,children:_});if(this.activateTabIndex([E]),W)$=E;let K=(L)=>{if(L.key===k.ENTER)L.preventDefault(),U(L)},F=this.listeners;E.addEventListener("click",U),F.push(()=>E.removeEventListener("click",U)),E.addEventListener("keydown",K),F.push(()=>E.removeEventListener("keydown",K)),X.append(E)};for(let H of z)q(H);this.eApply=$;let G=this.validationTooltipFeature;if($&&!G)this.validationTooltipFeature=this.createOptionalManagedBean(this.beans.registry.createDynamicBean("tooltipFeature",!1,{getGui:()=>this.eApply,getLocation:()=>"advancedFilter",getTooltipShowDelayOverride:()=>1000}));else if(!$&&G)this.validationTooltipFeature=this.destroyBean(G);Z.append(X)}getApplyButton(){return this.eApply}updateValidity(z,J=null){let Q=this.eApply;if(!Q)return;F6(Q,!z),this.validationMessage=J,this.validationTooltipFeature?.setTooltipAndRefresh(this.validationMessage)}destroyListeners(){for(let z of this.listeners)z();this.listeners=[]}destroy(){this.destroyListeners(),super.destroy()}};var E5=class extends y{constructor(z,J,Q,Z,$,X){super();this.column=z,this.wrapper=J,this.eventParent=Q,this.updateModel=Z,this.isGlobalButtons=$,this.enableGlobalButtonCheck=X,this.hidePopup=null,this.applyActive=!1}postConstruct(){let{comp:z,params:J}=this.wrapper,Q=J,Z=Q.useForm,$=Z?"form":"div";if(this.setTemplate({tag:$,cls:"ag-filter-wrapper"}),Z)this.addManagedElementListeners(this.getGui(),{submit:(X)=>{X?.preventDefault()},keydown:this.handleKeyDown.bind(this)});this.appendChild(z.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(z){if(z)this.hidePopup=z.hidePopup}resetButtonsPanel(z,J,Q){let{buttons:Z,readOnly:$}=J??{},{buttons:X,readOnly:Y,useForm:q}=z;if(!Q&&$===Y&&rz(Z,X))return;let G=X&&X.length>0&&!z.readOnly&&!this.isGlobalButtons,H=this.eButtons;if(G){let _=X.map((U)=>{let W=`${U}Filter`;return{type:U,label:f4(this,W)}});if(this.applyActive=n2(this.params),!H){H=this.createBean(new B5),this.appendChild(H.getGui());let U=this.column,W=(B)=>({event:E})=>{this.updateModel(U,B,{fromButtons:!0}),this.afterAction(B,E)};H?.addManagedListeners(H,{apply:W("apply"),clear:W("clear"),reset:W("reset"),cancel:W("cancel")}),this.eButtons=H}H.updateButtons(_,q)}else if(this.applyActive=!1,H)S0(H.getGui()),this.eButtons=this.destroyBean(H)}close(z){let J=this.hidePopup;if(!J)return;let Q=z,Z=Q?.key,$;if(Z===k.ENTER||Z===k.SPACE)$={keyboardEvent:Q};J($),this.hidePopup=null}afterAction(z,J){let{params:Q,applyActive:Z}=this,$=Q?.closeOnApply;switch(z){case"apply":{if(J?.preventDefault(),$&&Z)this.close(J);break}case"reset":{if($&&Z)this.close();break}case"cancel":{if($)this.close(J);break}}}handleKeyDown(z){if(!z.defaultPrevented&&z.key===k.ENTER&&this.applyActive)this.updateModel(this.column,"apply",{fromButtons:!0}),this.afterAction("apply",z)}destroy(){this.hidePopup=null,this.eButtons=this.destroyBean(this.eButtons)}},VD=":where(.ag-menu:not(.ag-tabs) .ag-filter)>:not(.ag-filter-wrapper){min-width:180px}",SD={tag:"div",cls:"ag-filter"},K5=class extends y{constructor(z,J,Q){super(SD);this.column=z,this.source=J,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((z)=>z.comp)??null}afterInit(){return this.wrapper?.then(()=>{})??N.resolve()}afterGuiAttached(z){this.afterGuiAttachedParams=z,this.wrapper?.then((J)=>{this.comp?.afterGuiAttached(z),J?.comp?.afterGuiAttached?.(z)})}afterGuiDetached(){this.wrapper?.then((z)=>{z?.comp?.afterGuiDetached?.()})}createFilter(z){let{column:J,source:Q,beans:{colFilter:Z}}=this,$=Z.getFilterUiForDisplay(J)??null;this.wrapper=$,$?.then((X)=>{if(!X)return;let{isHandler:Y,comp:q}=X,G;if(Y){let H=!!this.enableGlobalButtonCheck,_=this.createBean(new E5(J,X,Z,Z.updateModel.bind(Z),H&&Z.isGlobalButtons,H));this.comp=_,G=_.getGui()}else if(this.registerCSS(VD),G=q.getGui(),!T(G))R(69,{guiFromFilter:G});if(this.appendChild(G),z)this.eventSvc.dispatchEvent({type:"filterOpened",column:J,source:Q,eGui:this.getGui()});else q.afterGuiAttached?.(this.afterGuiAttachedParams)})}onFilterDestroyed(z){let{source:J,column:Q}=z;if((J==="api"||J==="paramsUpdated")&&Q.getId()===this.column.getId()&&this.beans.colModel.getColDefCol(this.column))J0(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()}},AD=class extends V{constructor(){super(...arguments);this.beanName="filterMenuFactory"}wireBeans(z){this.popupSvc=z.popupSvc}hideActiveMenu(){this.hidePopup?.()}showMenuAfterMouseEvent(z,J,Q,Z){if(z&&!z.isColumn)return;this.showPopup(z,($)=>{this.popupSvc?.positionPopupUnderMouseEvent({additionalParams:{column:z},type:Q,mouseEvent:J,ePopup:$})},Q,J.target,B0(this.gos),Z)}showMenuAfterButtonClick(z,J,Q,Z){if(z&&!z.isColumn)return;let $=-1,X="left",Y=B0(this.gos);if(!Y&&this.gos.get("enableRtl"))$=1,X="right";let q=Y?void 0:4*$,G=Y?void 0:4;this.showPopup(z,(H)=>{this.popupSvc?.positionPopupByComponent({type:Q,eventSource:J,ePopup:H,nudgeX:q,nudgeY:G,alignSide:X,keepWithinBounds:!0,position:"under",additionalParams:{column:z}})},Q,J,Y,Z)}showPopup(z,J,Q,Z,$,X){let Y=z?this.createBean(new K5(z,"COLUMN_MENU")):void 0;if(this.activeMenu=Y,!Y?.hasFilter()||!z){t(57);return}let q=z0({tag:"div",cls:`ag-menu${!$?" ag-filter-menu":""}`,role:"presentation"});[this.tabListener]=this.addManagedElementListeners(q,{keydown:(K)=>this.trapFocusWithin(K,q)}),q.appendChild(Y?.getGui());let G,H=()=>Y?.afterGuiDetached(),_=fZ(this.gos)?Z??this.beans.ctrlsSvc.getGridBodyCtrl().eGridBody:void 0,U=(K)=>{j6(z,!1,"contextMenu");let F=K instanceof KeyboardEvent;if(this.tabListener)this.tabListener=this.tabListener();if(F&&Z&&M0(Z))GJ(Z)?.focus({preventScroll:!0});H(),this.destroyBean(this.activeMenu),this.dispatchVisibleChangedEvent(!1,Q,z),X?.()},W=this.getLocaleTextFunc(),B=$&&Q!=="columnFilter"?W("ariaLabelColumnMenu","Column Menu"):W("ariaLabelColumnFilter","Column Filter"),E=this.popupSvc?.addPopup({modal:!0,eChild:q,closeOnEsc:!0,closedCallback:U,positionCallback:()=>J(q),anchorToElement:_,ariaLabel:B});if(E)this.hidePopup=G=E.hideFunc;Y.afterInit().then(()=>{J(q),Y.afterGuiAttached({container:Q,hidePopup:G})}),j6(z,!0,"contextMenu"),this.dispatchVisibleChangedEvent(!0,Q,z)}trapFocusWithin(z,J){if(z.key!==k.TAB||z.defaultPrevented||P0(this.beans,J,!1,z.shiftKey))return;z.preventDefault(),k0(J,z.shiftKey)}dispatchVisibleChangedEvent(z,J,Q){this.eventSvc.dispatchEvent({type:"columnMenuVisibleChanged",visible:z,switchingTab:!1,key:J,column:Q??null,columnGroup:null})}isMenuEnabled(z){return z.isFilterAllowed()&&(z.getColDef().menuTabs??["filterMenuTab"]).includes("filterMenuTab")}showMenuAfterContextMenuEvent(){}destroy(){this.destroyBean(this.activeMenu),super.destroy()}},RD=class extends V{constructor(){super(...arguments);this.beanName="filterValueSvc"}getValue(z,J,Q){if(!J)return;let Z=z.getColDef(),{selectableFilter:$,valueSvc:X,formula:Y}=this.beans,q=Q??$?.getFilterValueGetter(z.getColId())??Z.filterValueGetter;if(q)return this.executeFilterValueGetter(q,J.data,z,J,Z);let G=X.getValue(z,J,"data");if(z.isAllowFormula()&&Y?.isFormula(G))return Y.resolveValue(z,J);return G}executeFilterValueGetter(z,J,Q,Z,$){let{expressionSvc:X,valueSvc:Y}=this.beans,q=C(this.gos,{data:J,node:Z,column:Q,colDef:$,getValue:Y.getValueCallback.bind(Y,Z)});if(typeof z==="function")return z(q);return X?.evaluate(z,q)}};var jD=class extends EJ{constructor(z){super(z,"ag-radio-button","radio")}isSelected(){return this.eInput.checked}toggle(){if(this.eInput.disabled)return;if(!this.isSelected())this.setValue(!0)}addInputListeners(){super.addInputListeners(),this.addManagedEventListeners({checkboxChanged:this.onChange.bind(this)})}onChange(z){let J=this.eInput;if(z.selected&&z.name&&J.name&&J.name===z.name&&z.id&&J.id!==z.id)this.setValue(!1,!0)}};var F5=class{constructor(){this.customFilterOptions={}}init(z,J){this.filterOptions=z.filterOptions??J,this.mapCustomOptions(),this.defaultOption=this.getDefaultItem(z.defaultOption)}refresh(z,J){let Q=z.filterOptions??J;if(this.filterOptions!==Q)this.filterOptions=Q,this.customFilterOptions={},this.mapCustomOptions();this.defaultOption=this.getDefaultItem(z.defaultOption)}mapCustomOptions(){let{filterOptions:z}=this;if(!z)return;for(let J of z){if(typeof J==="string")continue;let Q=[["displayKey"],["displayName"],["predicate","test"]],Z=($)=>{if(!$.some((X)=>J[X]!=null))return R(72,{keys:$}),!1;return!0};if(!Q.every(Z)){this.filterOptions=z.filter(($)=>$===J)||[];continue}this.customFilterOptions[J.displayKey]=J}}getDefaultItem(z){let{filterOptions:J}=this;if(z)return z;else if(J.length>=1){let Q=J[0];if(typeof Q==="string")return Q;else if(Q.displayKey)return Q.displayKey;else R(73)}else R(74);return}getCustomOption(z){return this.customFilterOptions[z]}};function K6(z,J,Q){return Q==null?z.splice(J):z.splice(J,Q)}function nz(z){return z==null||typeof z==="string"&&z.trim().length===0}function OD(z){return z==="AND"||z==="OR"?z:"AND"}function PD(z,J,Q){if(z==null)return;let{predicate:Z}=z;if(Z!=null&&!J.some(($)=>$==null))return Z(J,Q)}function TD(z,J){let Q=z.length;if(Q>J)z.splice(J),R(78),Q=J;return Q}var vD=new Set(["empty","notBlank","blank","today","yesterday","tomorrow","thisWeek","lastWeek","nextWeek","thisMonth","lastMonth","nextMonth","thisQuarter","lastQuarter","nextQuarter","thisYear","lastYear","nextYear","yearToDate","last7Days","last30Days","last90Days","last6Months","last12Months","last24Months"]);function z2(z,J){let Q=J.getCustomOption(z);if(Q){let{numberOfInputs:Z}=Q;return Z!=null?Z:1}if(z&&vD.has(z))return 0;else if(z==="inRange")return 2;return 1}var L5=class extends Z2{constructor(z,J,Q){super(z,"simple-filter");this.mapValuesFromModel=J,this.defaultOptions=Q,this.eTypes=[],this.eJoinPanels=[],this.eJoinAnds=[],this.eJoinOrs=[],this.eConditionBodies=[],this.listener=()=>this.onUiChanged(),this.lastUiCompletePosition=null,this.joinOperatorId=0}setParams(z){super.setParams(z);let J=new F5;this.optionsFactory=J,J.init(z,this.defaultOptions),this.commonUpdateSimpleParams(z),this.createOption(),this.createMissingConditionsAndOperators()}updateParams(z,J){this.optionsFactory.refresh(z,this.defaultOptions),super.updateParams(z,J),this.commonUpdateSimpleParams(z)}commonUpdateSimpleParams(z){this.setNumConditions(z),this.defaultJoinOperator=OD(z.defaultJoinOperator),this.filterPlaceholder=z.filterPlaceholder,this.createFilterListOptions(),V4(this.getGui(),"tabindex",this.isReadOnly()?"-1":null)}onFloatingFilterChanged(z,J){this.setTypeFromFloatingFilter(z),this.setValueFromFloatingFilter(J),this.onUiChanged("immediately",!0)}setTypeFromFloatingFilter(z){this.eTypes.forEach((J,Q)=>{let Z=Q===0?z:this.optionsFactory.defaultOption;J.setValue(Z,!0)})}getModelFromUi(){let z=this.getUiCompleteConditions();if(z.length===0)return null;if(this.maxNumConditions>1&&z.length>1)return{filterType:this.filterType,operator:this.getJoinOperator(),conditions:z};return z[0]}getConditionTypes(){return this.eTypes.map((z)=>z.getValue())}getConditionType(z){return this.eTypes[z].getValue()}getJoinOperator(){let{eJoinOrs:z,defaultJoinOperator:J}=this;return z.length===0?J:z[0].getValue()===!0?"OR":"AND"}areNonNullModelsEqual(z,J){let Q=!z.operator,Z=!J.operator;if(!Q&&Z||Q&&!Z)return!1;let X;if(Q){let Y=z,q=J;X=this.areSimpleModelsEqual(Y,q)}else{let Y=z,q=J;X=Y.operator===q.operator&&Z0(Y.conditions,q.conditions,(G,H)=>this.areSimpleModelsEqual(G,H))}return X}setModelIntoUi(z,J){if(z==null)return this.resetUiToDefaults(J),N.resolve();if(z.operator){let Z=z,$=Z.conditions;if($==null)$=[],R(77);let X=TD($,this.maxNumConditions),Y=this.getNumConditions();if(XY)for(let G=Y;GG.setValue(!q,!0)),this.eJoinOrs.forEach((G)=>G.setValue(q,!0)),$.forEach((G,H)=>{this.eTypes[H].setValue(G.type,!0),this.setConditionIntoUi(G,H)})}else{let Z=z;if(this.getNumConditions()>1)this.removeConditionsAndOperators(1);this.eTypes[0].setValue(Z.type,!0),this.setConditionIntoUi(Z,0)}if(this.lastUiCompletePosition=this.getNumConditions()-1,this.createMissingConditionsAndOperators(),this.updateUiVisibility(),!J)this.params.onUiChange(this.getUiChangeEventParams());return N.resolve()}setNumConditions(z){let J=z.maxNumConditions??2;if(J<1)R(79),J=1;this.maxNumConditions=J;let Q=z.numAlwaysVisibleConditions??1;if(Q<1)R(80),Q=1;if(Q>J)R(81),Q=J;this.numAlwaysVisibleConditions=Q}createOption(){let z=this.getGui(),J=this.createManagedBean(new ML);this.eTypes.push(J),J.addCss("ag-filter-select"),z.appendChild(J.getGui());let Q=this.createEValue();this.eConditionBodies.push(Q),z.appendChild(Q),this.putOptionsIntoDropdown(J),this.resetType(J);let Z=this.getNumConditions()-1;this.forEachPositionInput(Z,($)=>this.resetInput($)),this.addChangedListeners(J,Z)}createJoinOperatorPanel(){let z=z0({tag:"div",cls:"ag-filter-condition"});this.eJoinPanels.push(z);let J=this.createJoinOperator(this.eJoinAnds,z,"and"),Q=this.createJoinOperator(this.eJoinOrs,z,"or");this.getGui().appendChild(z);let Z=this.eJoinPanels.length-1,$=this.joinOperatorId++;if(this.resetJoinOperatorAnd(J,Z,$),this.resetJoinOperatorOr(Q,Z,$),!this.isReadOnly())J.onValueChange(this.listener),Q.onValueChange(this.listener)}createJoinOperator(z,J,Q){let Z=this.createManagedBean(new jD);z.push(Z);let $="ag-filter-condition-operator";return Z.addCss($),Z.addCss(`${$}-${Q}`),J.appendChild(Z.getGui()),Z}createFilterListOptions(){this.filterListOptions=this.optionsFactory.filterOptions.map((z)=>typeof z==="string"?this.createBoilerplateListOption(z):this.createCustomListOption(z))}putOptionsIntoDropdown(z){let{filterListOptions:J}=this;for(let Q of J)z.addOption(Q);z.setDisabled(J.length<=1)}createBoilerplateListOption(z){return{value:z,text:this.translate(z)}}createCustomListOption(z){let{displayKey:J}=z,Q=this.optionsFactory.getCustomOption(z.displayKey);return{value:J,text:Q?this.getLocaleTextFunc()(Q.displayKey,Q.displayName):this.translate(J)}}createBodyTemplate(){return null}getAgComponents(){return[]}updateUiVisibility(){let z=this.getJoinOperator();this.updateNumConditions(),this.updateConditionStatusesAndValues(this.lastUiCompletePosition,z)}updateNumConditions(){let z=-1,J=!0;for(let Q=0;Q0)this.removeConditionsAndOperators(Z,$);this.createMissingConditionsAndOperators()}}this.lastUiCompletePosition=z}updateConditionStatusesAndValues(z,J){this.eTypes.forEach((Z,$)=>{let X=this.isConditionDisabled($,z);if(Z.setDisabled(X||this.filterListOptions.length<=1),$===1)F6(this.eJoinPanels[0],X),this.eJoinAnds[0].setDisabled(X),this.eJoinOrs[0].setDisabled(X)}),this.eConditionBodies.forEach((Z,$)=>{w(Z,this.isConditionBodyVisible($))});let Q=(J??this.getJoinOperator())==="OR";for(let Z of this.eJoinAnds)Z.setValue(!Q,!0);for(let Z of this.eJoinOrs)Z.setValue(Q,!0);this.forEachInput((Z,$,X,Y)=>{this.setElementDisplayed(Z,$=this.getNumConditions())return;let{eTypes:Q,eConditionBodies:Z,eJoinPanels:$,eJoinAnds:X,eJoinOrs:Y}=this;this.removeComponents(Q,z,J),this.removeElements(Z,z,J),this.removeEValues(z,J);let q=Math.max(z-1,0);this.removeElements($,q,J),this.removeComponents(X,q,J),this.removeComponents(Y,q,J)}removeElements(z,J,Q){let Z=K6(z,J,Q);for(let $ of Z)S0($)}removeComponents(z,J,Q){let Z=K6(z,J,Q);for(let $ of Z)S0($.getGui()),this.destroyBean($)}afterGuiAttached(z){if(super.afterGuiAttached(z),this.resetPlaceholder(),!z?.suppressFocus){let J;if(!this.isReadOnly()){let Q=this.getInputs(0)[0];if(Q instanceof V2&&this.isConditionBodyVisible(0))J=Q.getInputElement();else J=this.eTypes[0]?.getFocusableElement()}(J??this.getGui()).focus({preventScroll:!0})}}shouldKeepInvalidInputState(){return!1}afterGuiDetached(){super.afterGuiDetached();let z=this.params;if(this.beans.colFilter?.shouldKeepStateOnDetach(z.column)||this.shouldKeepInvalidInputState())return;z.onStateChange({model:z.model});let J=-1,Q=-1,Z=!1,$=this.getJoinOperator();for(let Y=this.getNumConditions()-1;Y>=0;Y--)if(this.isConditionUiComplete(Y)){if(J===-1)J=Y,Q=Y}else{let q=Y>=this.numAlwaysVisibleConditions&&!this.isConditionUiComplete(Y-1),G=Y{if(!(Z instanceof V2))return;let q=$===0&&Y>1?"inRangeStart":$===0?"filterOoo":"inRangeEnd",G=$===0&&Y>1?z("ariaFilterFromValue","Filter from value"):$===0?z("ariaFilterValue","Filter Value"):z("ariaFilterToValue","Filter to Value"),H=Q[X].getValue(),_=b9(this,J,q,H);Z.setInputPlaceholder(_),Z.setInputAriaLabel(G)})}setElementValue(z,J,Q){if(z instanceof V2)z.setValue(J!=null?String(J):null,!0)}setElementDisplayed(z,J){if(y2(z))w(z.getGui(),J)}setElementDisabled(z,J){if(y2(z))F6(z.getGui(),J)}attachElementOnChange(z,J){if(z instanceof V2)z.onValueChange(J)}forEachInput(z){this.getConditionTypes().forEach((J,Q)=>{this.forEachPositionTypeInput(Q,J,z)})}forEachPositionInput(z,J){let Q=this.getConditionType(z);this.forEachPositionTypeInput(z,Q,J)}forEachPositionTypeInput(z,J,Q){let Z=z2(J,this.optionsFactory),$=this.getInputs(z);for(let X=0;X<$.length;X++){let Y=$[X];if(Y!=null)Q(Y,X,z,Z)}}isConditionDisabled(z,J){if(this.isReadOnly())return!0;if(z===0)return!1;return z>J+1}isConditionBodyVisible(z){let J=this.getConditionType(z);return z2(J,this.optionsFactory)>0}isConditionUiComplete(z){if(z>=this.getNumConditions())return!1;if(this.getConditionType(z)==="empty")return!1;if(this.getValues(z).some((Q)=>Q==null))return!1;if(this.positionHasInvalidInputs(z))return!1;return!0}getNumConditions(){return this.eTypes.length}getUiCompleteConditions(){let z=[];for(let J=0;Jthis.resetType(J)),this.eJoinAnds.forEach((J,Q)=>this.resetJoinOperatorAnd(J,Q,this.joinOperatorId+Q)),this.eJoinOrs.forEach((J,Q)=>this.resetJoinOperatorOr(J,Q,this.joinOperatorId+Q)),this.joinOperatorId++,this.forEachInput((J)=>this.resetInput(J)),this.resetPlaceholder(),this.createMissingConditionsAndOperators(),this.lastUiCompletePosition=null,this.updateUiVisibility(),!z)this.params.onUiChange(this.getUiChangeEventParams())}resetType(z){let Q=this.getLocaleTextFunc()("ariaFilteringOperator","Filtering operator");z.setValue(this.optionsFactory.defaultOption,!0).setAriaLabel(Q).setDisabled(this.isReadOnly()||this.filterListOptions.length<=1)}resetJoinOperatorAnd(z,J,Q){this.resetJoinOperator(z,J,this.defaultJoinOperator==="AND",this.translate("andCondition"),Q)}resetJoinOperatorOr(z,J,Q){this.resetJoinOperator(z,J,this.defaultJoinOperator==="OR",this.translate("orCondition"),Q)}resetJoinOperator(z,J,Q,Z,$){this.updateJoinOperatorDisabled(z.setValue(Q,!0).setName(`ag-simple-filter-and-or-${this.getCompId()}-${$}`).setLabel(Z),J)}updateJoinOperatorsDisabled(){let z=(J,Q)=>this.updateJoinOperatorDisabled(J,Q);this.eJoinAnds.forEach(z),this.eJoinOrs.forEach(z)}updateJoinOperatorDisabled(z,J){z.setDisabled(this.isReadOnly()||J>0)}resetInput(z){this.setElementValue(z,null),this.setElementDisabled(z,this.isReadOnly())}setConditionIntoUi(z,J){let Q=this.mapValuesFromModel(z,this.optionsFactory);this.forEachInput((Z,$,X)=>{if(X!==J)return;this.setElementValue(Z,Q[$]!=null?Q[$]:null)})}setValueFromFloatingFilter(z){this.forEachInput((J,Q,Z)=>{this.setElementValue(J,Q===0&&Z===0?z:null,!0)})}addChangedListeners(z,J){if(this.isReadOnly())return;z.onValueChange(this.listener),this.forEachPositionInput(J,(Q)=>{this.attachElementOnChange(Q,this.listener)})}hasInvalidInputs(){return!1}positionHasInvalidInputs(z){return!1}isReadOnly(){return!!this.params.readOnly}};var _X=class extends V{constructor(z,J){super();this.mapValuesFromModel=z,this.defaultOptions=J}init(z){let J=z.filterParams,Q=new F5;this.optionsFactory=Q,Q.init(J,this.defaultOptions),this.filterModelFormatter=this.createManagedBean(new this.FilterModelFormatterClass(Q,J)),this.updateParams(z),this.validateModel(z)}refresh(z){if(z.source==="colDef"){let J=z.filterParams,Q=this.optionsFactory;Q.refresh(J,this.defaultOptions),this.filterModelFormatter.updateParams({optionsFactory:Q,filterParams:J}),this.updateParams(z)}this.validateModel(z)}updateParams(z){this.params=z}doesFilterPass(z){let J=z.model;if(J==null)return!0;let{operator:Q}=J,Z=[];if(Q){let Y=J;Z.push(...Y.conditions??[])}else Z.push(J);let $=Q&&Q==="OR"?"some":"every",X=this.params.getValue(z.node);return Z[$]((Y)=>this.individualConditionPasses(z,Y,X))}getModelAsString(z,J){return this.filterModelFormatter.getModelAsString(z,J)??""}validateModel(z){let{model:J,filterParams:{filterOptions:Q,maxNumConditions:Z}}=z;if(J==null)return;let X=R9(J)?J.conditions:[J],Y=Q?.map((_)=>typeof _==="string"?_:_.displayKey)??this.defaultOptions;if(!(!X||X.every((_)=>Y.find((U)=>U===_.type)!==void 0))){this.params={...z,model:null},z.onModelChange(null);return}let G=!1,H=this.filterType;if(X&&!X.every((_)=>_.filterType===H)||J.filterType!==H)X=X.map((_)=>({..._,filterType:H})),G=!0;if(typeof Z==="number"&&X&&X.length>Z)X=X.slice(0,Z),G=!0;if(G){let _=X.length>1?{...J,filterType:H,conditions:X}:{...X[0],filterType:H};this.params={...z,model:_},z.onModelChange(_)}}individualConditionPasses(z,J,Q){let Z=this.optionsFactory,$=this.mapValuesFromModel(J,Z),X=Z.getCustomOption(J.type),Y=PD(X,$,Q);if(Y!=null)return Y;if(Q==null)return this.evaluateNullValue(J.type);return this.evaluateNonNullValue($,Q,J,z)}},UX=class extends _X{evaluateNullValue(z){let{includeBlanksInEquals:J,includeBlanksInNotEqual:Q,includeBlanksInGreaterThan:Z,includeBlanksInLessThan:$,includeBlanksInRange:X}=this.params.filterParams;switch(z){case"equals":if(J)return!0;break;case"notEqual":if(Q)return!0;break;case"greaterThan":case"greaterThanOrEqual":if(Z)return!0;break;case"lessThan":case"lessThanOrEqual":if($)return!0;break;case"inRange":if(X)return!0;break;case"blank":return!0;case"notBlank":return!1}return!1}evaluateNonNullValue(z,J,Q){let Z=Q.type;if(!this.isValid(J))return Z==="notEqual"||Z==="notBlank";let $=this.comparator(),X=z[0]!=null?$(z[0],J):0;switch(Z){case"equals":return X===0;case"notEqual":return X!==0;case"greaterThan":return X>0;case"greaterThanOrEqual":return X>=0;case"lessThan":return X<0;case"lessThanOrEqual":return X<=0;case"inRange":{let Y=$(z[1],J);return this.params.filterParams.inRangeInclusive?X>=0&&Y<=0:X>0&&Y<0}case"blank":return nz(J);case"notBlank":return!nz(J);default:return R(76,{filterModelType:Z}),!0}}},WX={equals:"Equals",notEqual:"NotEqual",greaterThan:"GreaterThan",greaterThanOrEqual:"GreaterThanOrEqual",lessThan:"LessThan",lessThanOrEqual:"LessThanOrEqual",inRange:"InRange"},ID={contains:"Contains",notContains:"NotContains",equals:"TextEquals",notEqual:"TextNotEqual",startsWith:"StartsWith",endsWith:"EndsWith",inRange:"InRange"},D5=class extends V{constructor(z,J,Q){super();this.optionsFactory=z,this.filterParams=J,this.valueFormatter=Q}getModelAsString(z,J){let Q=this.getLocaleTextFunc(),Z=J==="filterToolPanel";if(!z)return Z?f4(this,"filterSummaryInactive"):null;if(z.operator!=null){let X=z,q=(X.conditions??[]).map((H)=>this.getModelAsString(H,J)),G=X.operator==="AND"?"andCondition":"orCondition";return q.join(` ${f4(this,G)} `)}else if(z.type==="blank"||z.type==="notBlank")return Z?f4(this,z.type==="blank"?"filterSummaryBlank":"filterSummaryNotBlank"):Q(z.type,z.type);else{let X=z,Y=this.optionsFactory.getCustomOption(X.type),{displayKey:q,displayName:G,numberOfInputs:H}=Y||{};if(q&&G&&H===0)return Q(q,G);return this.conditionToString(X,Z,X.type==="inRange"||H===2,q,G)}}updateParams(z){let{optionsFactory:J,filterParams:Q}=z;this.optionsFactory=J,this.filterParams=Q}conditionForToolPanel(z,J,Q,Z,$,X){let Y,q=this.getTypeKey(z);if(q)Y=f4(this,q);if($&&X)Y=this.getLocaleTextFunc()($,X);if(Y!=null)if(J)return`${Y} ${f4(this,"filterSummaryInRangeValues",[Q(),Z()])}`;else return`${Y} ${Q()}`;return null}getTypeKey(z){let J=this.filterTypeKeys[z];return J?`filterSummary${J}`:null}formatValue(z){let J=this.valueFormatter;return J?J(z??null)??"":String(z)}};var BX=class extends V{constructor(z){super();this.params=z,this.eInput=j,this.onValueChanged=()=>{}}setupGui(z){this.eInput=this.createManagedBean(new s2(this.params?.config));let J=this.eInput.getGui();z.appendChild(J);let Q=(Z)=>this.onValueChanged(Z);this.addManagedListeners(J,{input:Q,keydown:Q})}setEditable(z){this.eInput.setDisabled(!z)}getValue(){return this.eInput.getValue()}setValue(z,J){this.eInput.setValue(z,J)}setValueChangedListener(z){this.onValueChanged=z}setParams({ariaLabel:z,autoComplete:J,placeholder:Q}){let{eInput:Z}=this;if(Z.setInputAriaLabel(z),J!==void 0)Z.setAutoComplete(J);Z.toggleCss("ag-floating-filter-search-icon",!!Q),Z.setInputPlaceholder(Q)}};function zZ(z){let J=z?.trim();return J===""?z:J}function EX(z,J){let{filter:Q,filterTo:Z,type:$}=z||{};return[Q||null,Z||null].slice(0,z2($,J))}var KX=class extends y{constructor(){super(...arguments);this.defaultDebounceMs=0}setLastTypeFromModel(z){if(!z){this.lastType=this.optionsFactory.defaultOption;return}let J=z.operator,Q;if(J)Q=z.conditions[0];else Q=z;this.lastType=Q.type}canWeEditAfterModelFromParentFilter(z){if(!z)return this.isTypeEditable(this.lastType);if(z.operator)return!1;let Q=z;return this.isTypeEditable(Q.type)}init(z){this.params=z;let J=this.gos.get("enableFilterHandlers");if(this.reactive=J,this.setParams(z),J){let Q=z;this.onModelUpdated(Q.model)}}setParams(z){let J=new F5;this.optionsFactory=J,J.init(z.filterParams,this.defaultOptions),this.filterModelFormatter=this.createManagedBean(new this.FilterModelFormatterClass(J,z.filterParams)),this.setSimpleParams(z,!1)}setSimpleParams(z,J=!0){let Q=this.optionsFactory.defaultOption;if(!J)this.lastType=Q;this.readOnly=!!z.filterParams.readOnly;let Z=this.isTypeEditable(Q);this.setEditable(Z)}refresh(z){this.params=z;let J=z,Q=this.reactive;if(!Q||J.source==="colDef")this.updateParams(z);if(Q){let{source:Z,model:$}=J;if(Z==="dataChanged"||Z==="ui")return;this.onModelUpdated($)}}updateParams(z){let J=this.optionsFactory;J.refresh(z.filterParams,this.defaultOptions),this.setSimpleParams(z),this.filterModelFormatter.updateParams({optionsFactory:J,filterParams:z.filterParams})}onParentModelChanged(z,J){if(J?.afterFloatingFilter||J?.afterDataChange)return;this.onModelUpdated(z)}isTypeEditable(z){return!!z&&!this.readOnly&&z2(z,this.optionsFactory)===1}getAriaLabel(z){return`${this.beans.colNames.getDisplayNameForColumn(z,"header",!0)} ${this.getLocaleTextFunc()("ariaFilterInput","Filter Input")}`}},CD={tag:"div",ref:"eFloatingFilterInputContainer",cls:"ag-floating-filter-input",role:"presentation"},FX=class extends KX{constructor(){super(...arguments);this.eFloatingFilterInputContainer=j,this.defaultDebounceMs=500}postConstruct(){this.setTemplate(CD)}onModelUpdated(z){this.setLastTypeFromModel(z),this.setEditable(this.canWeEditAfterModelFromParentFilter(z)),this.inputSvc.setValue(this.filterModelFormatter.getModelAsString(z))}setParams(z){this.setupFloatingFilterInputService(z),super.setParams(z),this.setTextInputParams(z)}setupFloatingFilterInputService(z){this.inputSvc=this.createFloatingFilterInputService(z),this.inputSvc.setupGui(this.eFloatingFilterInputContainer)}setTextInputParams(z){let{inputSvc:J,defaultDebounceMs:Q,readOnly:Z}=this,{filterPlaceholder:$,column:X,browserAutoComplete:Y,filterParams:q}=z,G=this.lastType??this.optionsFactory.defaultOption,H=z.filterParams.filterPlaceholder,_=$===!0?b9(this,H,"filterOoo",G):$||void 0;if(J.setParams({ariaLabel:this.getAriaLabel(X),autoComplete:Y??!1,placeholder:_}),this.applyActive=n2(q),!Z){let U=bZ(q,Q);J.setValueChangedListener(p0(this,this.syncUpWithParentFilter.bind(this),U))}}updateParams(z){super.updateParams(z),this.setTextInputParams(z)}recreateFloatingFilterInputService(z){let{inputSvc:J}=this,Q=J.getValue();J0(this.eFloatingFilterInputContainer),this.destroyBean(J),this.setupFloatingFilterInputService(z),J.setValue(Q,!0)}syncUpWithParentFilter(z){let J=z.key===k.ENTER,Q=this.reactive;if(Q)this.params.onUiChange();if(this.applyActive&&!J)return;let{inputSvc:Z,params:$,lastType:X}=this,Y=Z.getValue();if($.filterParams.trimInput)Y=zZ(Y),Z.setValue(Y,!0);if(Q){let q=$,G=q.model,H=this.convertValue(Y),_=H==null?null:{...G??{filterType:this.filterType,type:X??this.optionsFactory.defaultOption},filter:H};q.onModelChange(_,{afterFloatingFilter:!0})}else $.parentFilterInstance((q)=>{q?.onFloatingFilterChanged(X||null,Y||null)})}convertValue(z){return z||null}setEditable(z){this.inputSvc.setEditable(z)}};var L8=".ag-input-field-input",LX=class{constructor(z,J,Q,Z,$,X){this.context=z,this.eParent=$,this.alive=!0,this.debouncedReport=p0({isAlive:()=>this.alive},D8,500),this.timeoutHandle=null,iH(J,Q,Z)?.newAgStackInstance().then((q)=>{if(!this.alive){z.destroyBean(q);return}if(this.dateComp=q,!q)return;$.appendChild(q.getGui()),q?.afterGuiAttached?.();let{tempValue:G,disabled:H}=this;if(G)q.setDate(G);if(H!=null)q.setDisabled?.(H);X?.(this)})}destroy(){this.alive=!1,this.dateComp=this.context.destroyBean(this.dateComp)}getDate(){return this.dateComp?this.dateComp.getDate():this.tempValue}setDate(z){let J=this.dateComp;if(J)J.setDate(z);else this.tempValue=z}setDisabled(z){let J=this.dateComp;if(J)J.setDisabled?.(z);else this.disabled=z}setDisplayed(z){w(this.eParent,z)}setInputPlaceholder(z){this.dateComp?.setInputPlaceholder?.(z)}setInputAriaLabel(z){this.dateComp?.setInputAriaLabel?.(z)}afterGuiAttached(z){this.dateComp?.afterGuiAttached?.(z)}updateParams(z){this.dateComp?.refresh?.(z)}setCustomValidity(z,J=!1){let Q=this.dateComp?.getGui().querySelector(L8);if(Q&&"setCustomValidity"in Q){let Z=z.length>0;if(Q.setCustomValidity(z),Z)if(J)this.timeoutHandle=this.debouncedReport(Q);else D8(Q);else if(this.timeoutHandle)window.clearTimeout(this.timeoutHandle);qZ(Q,Z)}}getValidity(){return this.dateComp?.getGui().querySelector(L8)?.validity}};function D8(z){z.reportValidity()}var M5=["equals","notEqual","lessThan","greaterThan","inRange","blank","notBlank"];function DX(z,J){let{dateFrom:Q,dateTo:Z,type:$}=z||{};return[Q&&h0(Q,void 0,!0)||null,Z&&h0(Z,void 0,!0)||null].slice(0,z2($,J))}var M8=1000,k8=1/0,bD=class extends L5{constructor(){super("dateFilter",DX,M5);this.eConditionPanelsFrom=[],this.eConditionPanelsTo=[],this.dateConditionFromComps=[],this.dateConditionToComps=[],this.minValidYear=M8,this.maxValidYear=k8,this.minValidDate=null,this.maxValidDate=null,this.filterType="date"}afterGuiAttached(z){super.afterGuiAttached(z),this.dateConditionFromComps[0].afterGuiAttached(z),this.refreshInputValidation()}shouldKeepInvalidInputState(){return!a1()&&this.hasInvalidInputs()&&this.getConditionTypes().includes("inRange")}commonUpdateSimpleParams(z){super.commonUpdateSimpleParams(z);let J=(G,H)=>{let _=z[G];if(_!=null)if(!isNaN(_))return _==null?H:Number(_);else R(82,{param:G});return H},Q=J("minValidYear",M8),Z=J("maxValidYear",k8);if(this.minValidYear=Q,this.maxValidYear=Z,Q>Z)R(83);let{minValidDate:$,maxValidDate:X}=z,Y=$ instanceof Date?$:h0($);this.minValidDate=Y;let q=X instanceof Date?X:h0(X);if(this.maxValidDate=q,Y&&q&&Y>q)R(84)}refreshInputValidation(){for(let z=0;z=2?yD(H,_,J):null,W=U?this.translate(U,[String(J?_:H)]):"",B=!a1()&&!Q;if((J?Y:q).setCustomValidity(W,B),(J?q:Y).setCustomValidity("",B),W.length>0)X.ariaAnnounce.announceValue(W,"dateFilter")}createDateCompWrapper(z,J,Q){let{beans:{userCompFactory:Z,context:$,gos:X},params:Y}=this,q=Q==="from",G=new LX($,Z,Y.colDef,C(X,{onDateChanged:()=>{this.refreshInputPairValidation(J,q),this.onUiChanged()},onFocusIn:()=>this.refreshInputPairValidation(J,q),filterParams:Y,location:"filter"}),z);return this.addDestroyFunc(()=>G.destroy()),G}getState(){return{isInvalid:this.hasInvalidInputs()}}areStatesEqual(z,J){return(z?.isInvalid??!1)===(J?.isInvalid??!1)}setElementValue(z,J){if(z.setDate(J),!J)z.setCustomValidity("")}setElementDisplayed(z,J){z.setDisplayed(J)}setElementDisabled(z,J){z.setDisabled(J)}createEValue(){let z=z0({tag:"div",cls:"ag-filter-body"});return this.createFromToElement(z,this.eConditionPanelsFrom,this.dateConditionFromComps,"from"),this.createFromToElement(z,this.eConditionPanelsTo,this.dateConditionToComps,"to"),z}createFromToElement(z,J,Q,Z){let $=z0({tag:"div",cls:`ag-filter-${Z} ag-filter-date-${Z}`});J.push($),z.appendChild($),Q.push(this.createDateCompWrapper($,J.length-1,Z))}removeEValues(z,J){this.removeDateComps(this.dateConditionFromComps,z,J),this.removeDateComps(this.dateConditionToComps,z,J),K6(this.eConditionPanelsFrom,z,J),K6(this.eConditionPanelsTo,z,J)}removeDateComps(z,J,Q){let Z=K6(z,J,Q);for(let $ of Z)$.destroy()}isValidDateValue(z){if(z===null)return!1;let{minValidDate:J,maxValidDate:Q,minValidYear:Z,maxValidYear:$}=this;if(J){if(zQ)return!1}else if(z.getUTCFullYear()>$)return!1;return!0}hasInvalidInputs(){let z=!1;return this.forEachInput((J)=>z||(z=J.getDate()!=null&&!(J.getValidity()?.valid??!0))),z}positionHasInvalidInputs(z){let J=!1;return this.forEachPositionInput(z,(Q)=>J||(J=!(Q.getValidity()?.valid??!0))),J}canApply(z){return!this.hasInvalidInputs()}isConditionUiComplete(z){if(!super.isConditionUiComplete(z))return!1;let J=!0;return this.forEachPositionInput(z,(Q,Z,$,X)=>{if(!J||Z>=X)return;J&&(J=this.isValidDateValue(Q.getDate()))}),J}areSimpleModelsEqual(z,J){return z.dateFrom===J.dateFrom&&z.dateTo===J.dateTo&&z.type===J.type}createCondition(z){let J=this.getConditionType(z),Q={},{params:Z,filterType:$}=this,X=this.getValues(z),Y=Z.useIsoSeparator?"T":" ";if(X.length>0)Q.dateFrom=r4(X[0],!0,Y);if(X.length>1)Q.dateTo=r4(X[1],!0,Y);return{dateFrom:null,dateTo:null,filterType:$,type:J,...Q}}removeConditionsAndOperators(z,J){if(this.hasInvalidInputs())return;return super.removeConditionsAndOperators(z,J)}resetPlaceholder(){let z=this.getLocaleTextFunc(),J=this.translate("dateFormatOoo"),Q=z("ariaFilterValue","Filter Value");this.forEachInput((Z)=>{Z.setInputPlaceholder(J),Z.setInputAriaLabel(Q)})}getInputs(z){let{dateConditionFromComps:J,dateConditionToComps:Q}=this;if(z>=J.length)return[null,null];return[J[z],Q[z]]}getValues(z){let J=[];return this.forEachPositionInput(z,(Q,Z,$,X)=>{if(Z=J))return null;return`${Q?"max":"min"}DateValidation`}var MX=class extends D5{constructor(z,J){super(z,J,(Q)=>{let{dataTypeSvc:Z,valueSvc:$}=this.beans,X=J.column,Y=Z?.getDateFormatterFunction(X),q=Y?Y(Q??void 0):Q;return $.formatValue(X,null,q)});this.filterTypeKeys=WX}conditionToString(z,J,Q,Z,$){let{type:X}=z,Y=h0(z.dateFrom),q=h0(z.dateTo),G=this.filterParams.inRangeFloatingFilterDateFormat,H=J?this.formatValue.bind(this):(W)=>ZB(W,G),_=()=>Y!==null?H(Y):"null",U=()=>q!==null?H(q):"null";if(Y==null&&q==null)return f4(this,X);if(J){let W=this.conditionForToolPanel(X,Q,_,U,Z,$);if(W!=null)return W}if(Q)return`${_()}-${U()}`;if(Y!=null)return H(Y);return`${X}`}};function xD(z,J){let Q=J;if(Qz)return 1;return 0}var wD=class extends UX{constructor(){super(DX,M5);this.filterType="date",this.FilterModelFormatterClass=MX,this.filterTypeToRangeCache=new Map}getOrRefreshRangeCacheItem(z,J){let{filterTypeToRangeCache:Q}=this,Z=Date.now(),$=Q.get(z);if($&&$.expires=0&&$(G,J)<0}return super.evaluateNonNullValue(z,J,Q)}},ND=1,Kz=null,gD=()=>{if(Kz!=null)return Kz;let z,J=typeof navigator>"u"?void 0:navigator.languages?.[0]??navigator.language;if(J&&typeof Intl<"u"&&typeof Intl.Locale==="function")try{z=new Intl.Locale(J).getWeekInfo?.()?.firstDay}catch{z=void 0}return Kz=z==null?ND:z%7,Kz},a0=(z)=>{return z.setHours(0,0,0,0),z},VJ=(z)=>{let J=z.getDay(),Q=gD(),Z=(J-Q+7)%7;return z.setDate(z.getDate()-Z),a0(z)},SJ=(z,J=1)=>{return z.setDate(z.getDate()-J),z},F4=(z)=>{return z.setDate(z.getDate()+1),a0(z)},kX=(z)=>{return VJ(z),z.setDate(z.getDate()+6),F4(z)},AJ=(z)=>{return z.setDate(1),a0(z)},k5=(z)=>{return z.setDate(1),z.setMonth(z.getMonth()+1),a0(z)},f5=(z)=>{let J=Math.floor(z.getMonth()/3);return z.setMonth(J*3),AJ(z)},fX=(z)=>{let J=Math.floor(z.getMonth()/3);return z.setMonth(J*3+2),k5(z)},V5=(z)=>{return z.setMonth(0,1),a0(z)},VX=(z)=>{return z.setMonth(12,0),F4(z)},h2=(z)=>SJ(z),JZ=(z)=>h2(VJ(z)),QZ=(z)=>h2(AJ(z)),ZZ=(z)=>h2(f5(z)),S5=(z,J)=>[a0(z),F4(J)],hD=(z,J)=>S5(h2(z),h2(J)),A5=(z,J)=>[VJ(z),kX(J)],uD=(z,J)=>A5(JZ(z),JZ(J)),R5=(z,J)=>[AJ(z),k5(J)],mD=(z,J)=>R5(QZ(z),QZ(J)),j5=(z,J)=>[f5(z),fX(J)],cD=(z,J)=>j5(ZZ(z),ZZ(J)),O5=(z,J)=>[V5(z),VX(J)],pD=(z,J)=>[V5(z),F4(J)],iD=(z,J)=>[a0(SJ(z,7)),F4(J)],dD=(z,J)=>[a0(SJ(z,30)),F4(J)],nD=(z,J)=>[a0(SJ(z,90)),F4(J)],tD=(z,J)=>{return z.setFullYear(z.getFullYear()-1),z.setMonth(z.getMonth()+6),[a0(z),F4(J)]},rD=(z,J)=>{return z.setFullYear(z.getFullYear()-1),[a0(z),F4(J)]},sD=(z,J)=>{return z.setFullYear(z.getFullYear()-2),[a0(z),F4(J)]},lD=(z,J)=>{return z.setFullYear(z.getFullYear()-1),J.setFullYear(J.getFullYear()-1),O5(z,J)},aD=(z,J)=>{return z.setFullYear(z.getFullYear()+1),J.setFullYear(J.getFullYear()+1),O5(z,J)},oD=(z,J)=>{return z.setMonth(z.getMonth()+3),J.setMonth(J.getMonth()+3),j5(z,J)},eD=(z,J)=>{return z.setMonth(z.getMonth()+1),J.setMonth(J.getMonth()+1),R5(z,J)},zM=(z,J)=>{return z.setDate(z.getDate()+7),J.setDate(J.getDate()+7),A5(z,J)},JM=(z,J)=>{return z.setDate(z.getDate()+1),J.setDate(J.getDate()+1),S5(z,J)},QM={today:S5,yesterday:hD,tomorrow:JM,thisWeek:A5,lastWeek:uD,nextWeek:zM,thisMonth:R5,lastMonth:mD,nextMonth:eD,thisQuarter:j5,lastQuarter:cD,nextQuarter:oD,thisYear:O5,lastYear:lD,nextYear:aD,yearToDate:pD,last7Days:iD,last30Days:dD,last90Days:nD,last6Months:tD,last12Months:rD,last24Months:sD,setStartOfDay:a0,setStartOfWeek:VJ,setStartOfNextDay:F4,setStartOfNextWeek:kX,setStartOfMonth:AJ,setStartOfNextMonth:k5,setStartOfQuarter:f5,setStartOfNextQuarter:fX,setStartOfYear:V5,setStartOfNextYear:VX,setPreviousDay:h2,setPreviousWeek:JZ,setPreviousMonth:QZ,setPreviousQuarter:ZZ},ZM={tag:"div",cls:"ag-floating-filter-input",role:"presentation",children:[{tag:"ag-input-text-field",ref:"eReadOnlyText"},{tag:"div",ref:"eDateWrapper",cls:"ag-date-floating-filter-wrapper"}]},$M=class extends KX{constructor(){super(ZM,[e4]);this.eReadOnlyText=j,this.eDateWrapper=j,this.FilterModelFormatterClass=MX,this.filterType="date",this.defaultOptions=M5}setParams(z){super.setParams(z),this.createDateComponent();let J=this.getLocaleTextFunc();this.eReadOnlyText.setDisabled(!0).setInputAriaLabel(J("ariaDateFilterInput","Date Filter Input"))}updateParams(z){super.updateParams(z),this.dateComp.updateParams(this.getDateComponentParams()),this.updateCompOnModelChange(z.currentParentModel())}updateCompOnModelChange(z){let J=!this.readOnly&&this.canWeEditAfterModelFromParentFilter(z);if(this.setEditable(J),J){let Q=z?h0(z.dateFrom):null;this.dateComp.setDate(Q),this.eReadOnlyText.setValue("")}else this.eReadOnlyText.setValue(this.filterModelFormatter.getModelAsString(z)),this.dateComp.setDate(null)}setEditable(z){w(this.eDateWrapper,z),w(this.eReadOnlyText.getGui(),!z)}onModelUpdated(z){super.setLastTypeFromModel(z),this.updateCompOnModelChange(z)}onDateChanged(){let z=this.dateComp.getDate();if(this.reactive){let J=this.params;J.onUiChange();let Q=J.model,Z=r4(z),$=Z==null?null:{...Q??{filterType:this.filterType,type:this.lastType??this.optionsFactory.defaultOption},dateFrom:Z};J.onModelChange($,{afterFloatingFilter:!0})}else this.params.parentFilterInstance((J)=>{J?.onFloatingFilterChanged(this.lastType||null,z)})}getDateComponentParams(){let{filterParams:z}=this.params,J=bZ(z,this.defaultDebounceMs);return C(this.gos,{onDateChanged:p0(this,this.onDateChanged.bind(this),J),filterParams:z,location:"floatingFilter"})}createDateComponent(){let{beans:{context:z,userCompFactory:J},eDateWrapper:Q,params:{column:Z}}=this;this.dateComp=new LX(z,J,Z.getColDef(),this.getDateComponentParams(),Q,($)=>{$.setInputAriaLabel(this.getAriaLabel(Z))}),this.addDestroyFunc(()=>this.dateComp.destroy())}},XM={tag:"div",cls:"ag-filter-filter",children:[{tag:"ag-input-text-field",ref:"eDateInput",cls:"ag-date-filter"}]},YM=class extends y{constructor(){super(XM,[e4]);this.eDateInput=j,this.isApply=!1,this.applyOnFocusOut=!1}init(z){this.params=z,this.setParams(z);let J=this.eDateInput.getInputElement();this.addManagedListeners(J,{mouseDown:()=>{if(this.eDateInput.isDisabled()||this.usingSafariDatePicker)return;J.focus({preventScroll:!0})},input:this.handleInput.bind(this,!1),change:this.handleInput.bind(this,!0),focusout:this.handleFocusOut.bind(this),focusin:this.handleFocusIn.bind(this)})}handleInput(z){if(this.eDateInput.isDisabled())return;if(this.isApply){if(this.applyOnFocusOut=!z,z)this.params.onDateChanged();return}if(!z)this.params.onDateChanged()}handleFocusOut(){if(this.applyOnFocusOut)this.applyOnFocusOut=!1,this.params.onDateChanged()}handleFocusIn(){this.params.onFocusIn?.()}setParams(z){let J=this.eDateInput.getInputElement(),Q=this.shouldUseBrowserDatePicker(z);this.usingSafariDatePicker=Q&&A1();let{minValidYear:Z,maxValidYear:$,minValidDate:X,maxValidDate:Y,buttons:q,includeTime:G,colDef:H}=z.filterParams||{},_=this.beans.dataTypeSvc,U=G??_?.getDateIncludesTimeFlag?.(H.cellDataType)??!1;if(Q)if(U)J.type="datetime-local",J.step="1";else J.type="date";else J.type="text";let W=f8(X,Z,!0),B=f8(Y,$,!1);if(W&&B&&W.getTime()>B.getTime())R(87);if(W)J.min=r4(W,U);if(B)J.max=r4(B,U);this.isApply=z.location==="floatingFilter"&&!!q?.includes("apply")}refresh(z){this.params=z,this.setParams(z)}getDate(){return h0(this.eDateInput.getValue())}setDate(z){let J=this.params.filterParams.colDef.cellDataType,Q=this.beans.dataTypeSvc?.getDateIncludesTimeFlag(J)??!1;this.eDateInput.setValue(r4(z,Q))}setInputPlaceholder(z){this.eDateInput.setInputPlaceholder(z)}setInputAriaLabel(z){this.eDateInput.setAriaLabel(z)}setDisabled(z){this.eDateInput.setDisabled(z)}afterGuiAttached(z){if(!z?.suppressFocus)this.eDateInput.getInputElement().focus({preventScroll:!0})}shouldUseBrowserDatePicker(z){return z?.filterParams?.browserDatePicker??!0}};function f8(z,J,Q){if(z&&J)R(Q?85:86);if(z instanceof Date)return z;if(z)return h0(z);else if(J)return h0(`${J}-${Q?"01-01":"12-31"}`);return null}var P5=["equals","notEqual","greaterThan","greaterThanOrEqual","lessThan","lessThanOrEqual","inRange","blank","notBlank"];function $Z(z){return z?.allowedCharPattern??null}function tz(z){if(z==null)return null;return isNaN(z)?null:z}function SX(z,J){let{filter:Q,filterTo:Z,type:$}=z||{};return[tz(Q),tz(Z)].slice(0,z2($,J))}var qM=class extends L5{constructor(){super("numberFilter",SX,P5);this.eValuesFrom=[],this.eValuesTo=[],this.filterType="number",this.defaultDebounceMs=500}afterGuiAttached(z){super.afterGuiAttached(z),this.refreshInputValidation()}shouldKeepInvalidInputState(){return!a1()&&this.hasInvalidInputs()&&this.getConditionTypes().includes("inRange")}refreshInputValidation(){for(let z=0;z0)this.beans.ariaAnnounce.announceValue(q,"dateFilter")}getState(){return{isInvalid:this.hasInvalidInputs()}}areStatesEqual(z,J){return(z?.isInvalid??!1)===(J?.isInvalid??!1)}refresh(z){let J=super.refresh(z),{state:Q,additionalEventAttributes:Z}=z,$=this.state,X=Z?.fromAction;if(X&&X!="apply"||Q.model!==$.model||!this.areStatesEqual(Q.state,$.state))this.refreshInputValidation();return J}setElementValue(z,J,Q){let{numberFormatter:Z}=this.params,$=!Q&&Z?Z(J??null):J;if(super.setElementValue(z,$),$===null)z.setCustomValidity("")}createEValue(){let{params:z,eValuesFrom:J,eValuesTo:Q}=this,Z=$Z(z),$=z0({tag:"div",cls:"ag-filter-body",role:"presentation"}),X=this.createFromToElement($,J,"from",Z),Y=this.createFromToElement($,Q,"to",Z),q=(_,U,W)=>()=>this.refreshInputPairValidation(_,U,W),G=q(X,Y,!0);X.onValueChange(G),X.addGuiEventListener("focusin",G);let H=q(X,Y,!1);return Y.onValueChange(H),Y.addGuiEventListener("focusin",H),$}createFromToElement(z,J,Q,Z){let $=this.createManagedBean(Z?new s2({allowedCharPattern:Z}):new zX);return $.addCss(`ag-filter-${Q}`),$.addCss("ag-filter-filter"),J.push($),z.appendChild($.getGui()),$}removeEValues(z,J){let Q=(Z)=>this.removeComponents(Z,z,J);Q(this.eValuesFrom),Q(this.eValuesTo)}getValues(z){let J=[];return this.forEachPositionInput(z,(Q,Z,$,X)=>{if(Z0)Q.filter=Z[0];if(Z.length>1)Q.filterTo=Z[1];return Q}removeConditionsAndOperators(z,J){if(this.hasInvalidInputs())return;return super.removeConditionsAndOperators(z,J)}getInputs(z){let{eValuesFrom:J,eValuesTo:Q}=this;if(z>=J.length)return[null,null];return[J[z],Q[z]]}hasInvalidInputs(){let z=!1;return this.forEachInput((J)=>z||(z=!J.getInputElement().validity.valid)),z}positionHasInvalidInputs(z){let J=!1;return this.forEachPositionInput(z,(Q)=>J||(J=!Q.getInputElement().validity.valid)),J}canApply(z){return!this.hasInvalidInputs()}};function AX(z,J){if(typeof J==="number")return J;let Q=q0(J);if(Q!=null&&Q.trim()==="")Q=null;if(z)return z(Q);return Q==null||Q.trim()==="-"?null:Number.parseFloat(Q)}function V8(z,J){return tz(AX(z,J.getValue(!0)))}function GM(z,J,Q){if(!(z!=null&&J!=null&&z>=J))return null;return`strict${Q?"Max":"Min"}ValueValidation`}var RX=class extends D5{constructor(z,J){super(z,J,J.numberFormatter);this.filterTypeKeys=WX}conditionToString(z,J,Q,Z,$){let{filter:X,filterTo:Y,type:q}=z,G=this.formatValue.bind(this);if(J){let H=this.conditionForToolPanel(q,Q,()=>G(X),()=>G(Y),Z,$);if(H!=null)return H}if(Q)return`${G(X)}-${G(Y)}`;if(X!=null)return G(X);return`${q}`}},HM=class extends UX{constructor(){super(SX,P5);this.filterType="number",this.FilterModelFormatterClass=RX}comparator(){return(z,J)=>{if(z===J)return 0;return z{},this.numberInputActive=!0}setupGui(z){this.eNumberInput=this.createManagedBean(new zX),this.eTextInput=this.createManagedBean(new s2),this.eTextInput.setDisabled(!0);let J=this.eNumberInput.getGui(),Q=this.eTextInput.getGui();z.appendChild(J),z.appendChild(Q),this.setupListeners(J,(Z)=>this.onValueChanged(Z)),this.setupListeners(Q,(Z)=>this.onValueChanged(Z))}setEditable(z){this.numberInputActive=z,this.eNumberInput.setDisplayed(this.numberInputActive),this.eTextInput.setDisplayed(!this.numberInputActive)}setAutoComplete(z){this.eNumberInput.setAutoComplete(z),this.eTextInput.setAutoComplete(z)}getValue(){return this.getActiveInputElement().getValue()}setValue(z,J){this.getActiveInputElement().setValue(z,J)}getActiveInputElement(){return this.numberInputActive?this.eNumberInput:this.eTextInput}setValueChangedListener(z){this.onValueChanged=z}setupListeners(z,J){this.addManagedListeners(z,{input:J,keydown:J})}setParams({ariaLabel:z,autoComplete:J,placeholder:Q}){if(this.setAriaLabel(z),J!==void 0)this.setAutoComplete(J);this.setPlaceholder(this.eNumberInput,Q),this.setPlaceholder(this.eTextInput,Q)}setPlaceholder(z,J){z.toggleCss("ag-floating-filter-search-icon",!!J),z.setInputPlaceholder(J)}setAriaLabel(z){this.eNumberInput.setInputAriaLabel(z),this.eTextInput.setInputAriaLabel(z)}},UM=class extends FX{constructor(){super(...arguments);this.FilterModelFormatterClass=RX,this.filterType="number",this.defaultOptions=P5}updateParams(z){if($Z(z.filterParams)!==this.allowedCharPattern)this.recreateFloatingFilterInputService(z);super.updateParams(z)}createFloatingFilterInputService(z){if(this.allowedCharPattern=$Z(z.filterParams),this.allowedCharPattern)return this.createManagedBean(new BX({config:{allowedCharPattern:this.allowedCharPattern}}));return this.createManagedBean(new _M)}convertValue(z){return z?Number(z):null}},T5=["contains","notContains","equals","notEqual","startsWith","endsWith","blank","notBlank"],WM=class extends L5{constructor(){super("textFilter",EX,T5);this.filterType="text",this.eValuesFrom=[],this.eValuesTo=[],this.defaultDebounceMs=500}createCondition(z){let J=this.getConditionType(z),Q={filterType:this.filterType,type:J},Z=this.getValues(z);if(Z.length>0)Q.filter=Z[0];if(Z.length>1)Q.filterTo=Z[1];return Q}areSimpleModelsEqual(z,J){return z.filter===J.filter&&z.filterTo===J.filterTo&&z.type===J.type}getInputs(z){let{eValuesFrom:J,eValuesTo:Q}=this;if(z>=J.length)return[null,null];return[J[z],Q[z]]}getValues(z){let J=[];return this.forEachPositionInput(z,(Q,Z,$,X)=>{if(Zthis.removeComponents(X,z,J),{eValuesFrom:Z,eValuesTo:$}=this;Q(Z),Q($)}},jX=class extends D5{constructor(){super(...arguments);this.filterTypeKeys=ID}conditionToString(z,J,Q,Z,$){let{filter:X,filterTo:Y,type:q}=z;if(J){let G=(_)=>()=>f4(this,"filterSummaryTextQuote",[_]),H=this.conditionForToolPanel(q,Q,G(X),G(Y),Z,$);if(H!=null)return H}if(Q)return`${X}-${Y}`;if(X!=null)return`${X}`;return`${q}`}},BM=({filterOption:z,value:J,filterText:Q})=>{if(Q==null)return!1;switch(z){case"contains":return J.includes(Q);case"notContains":return!J.includes(Q);case"equals":return J===Q;case"notEqual":return J!=Q;case"startsWith":return J.indexOf(Q)===0;case"endsWith":{let Z=J.lastIndexOf(Q);return Z>=0&&Z===J.length-Q.length}default:return!1}},EM=(z)=>z,KM=(z)=>z==null?null:z.toString().toLowerCase(),FM=class extends _X{constructor(){super(EX,T5);this.filterType="text",this.FilterModelFormatterClass=jX}updateParams(z){super.updateParams(z);let J=z.filterParams;this.matcher=J.textMatcher??BM,this.formatter=J.textFormatter??(J.caseSensitive?EM:KM)}evaluateNullValue(z){return z?["notEqual","notContains","blank"].indexOf(z)>=0:!1}evaluateNonNullValue(z,J,Q,Z){let $=z.map((W)=>this.formatter(W))||[],X=this.formatter(J),{api:Y,colDef:q,column:G,context:H,filterParams:{textFormatter:_}}=this.params;if(Q.type==="blank")return nz(J);else if(Q.type==="notBlank")return!nz(J);let U={api:Y,colDef:q,column:G,context:H,node:Z.node,data:Z.data,filterOption:Q.type,value:X,textFormatter:_};return $.some((W)=>this.matcher({...U,filterText:W}))}processModelToApply(z){if(z&&this.params.filterParams.trimInput){let J=(Q)=>{let Z={...Q},{filter:$,filterTo:X}=Q;if($)Z.filter=zZ($)??null;if(X)Z.filterTo=zZ(X)??null;return Z};if(R9(z))return{...z,conditions:z.conditions.map(J)};return J(z)}return z}},LM=class extends FX{constructor(){super(...arguments);this.FilterModelFormatterClass=jX,this.filterType="text",this.defaultOptions=T5}createFloatingFilterInputService(){return this.createManagedBean(new BX)}};function DM(z){return!!z.quickFilter?.isFilterPresent()}function MM(z){return z.quickFilter?.getText()}function kM(z){z.quickFilter?.resetCache()}var fM=class extends V{constructor(){super(...arguments);this.beanName="quickFilter",this.quickFilter=null,this.quickFilterParts=null}postConstruct(){let z=this.resetCache.bind(this),J=this.gos;this.addManagedEventListeners({columnPivotModeChanged:z,newColumnsLoaded:z,columnRowGroupChanged:z,columnVisible:()=>{if(!J.get("includeHiddenColumnsInQuickFilter"))this.resetCache()}}),this.addManagedPropertyListener("quickFilterText",(Q)=>this.setFilter(Q.currentValue)),this.addManagedPropertyListeners(["includeHiddenColumnsInQuickFilter","applyQuickFilterBeforePivotOrAgg"],()=>this.onColumnConfigChanged()),this.quickFilter=this.parseFilter(J.get("quickFilterText")),this.parser=J.get("quickFilterParser"),this.matcher=J.get("quickFilterMatcher"),this.setFilterParts(),this.addManagedPropertyListeners(["quickFilterMatcher","quickFilterParser"],()=>this.setParserAndMatcher())}refreshCols(){let{autoColSvc:z,colModel:J,gos:Q,pivotResultCols:Z}=this.beans,$=J.isPivotMode(),X=z?.getColumns(),Y=J.getColDefCols(),q=($&&!Q.get("applyQuickFilterBeforePivotOrAgg")?Z?.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(z){let J=this.gos.get("cacheQuickFilter");if(this.matcher)return this.doesRowPassMatcher(J,z);return this.quickFilterParts.every((Q)=>J?this.doesRowPassCache(z,Q):this.doesRowPassNoCache(z,Q))}resetCache(){this.beans.rowModel.forEachNode((z)=>z.quickFilterAggregateText=null)}getText(){return this.gos.get("quickFilterText")}setFilterParts(){let{quickFilter:z,parser:J}=this;if(z)this.quickFilterParts=J?J(z):z.split(" ");else this.quickFilterParts=null}parseFilter(z){if(!T(z))return null;return z.toUpperCase()}setFilter(z){if(z!=null&&typeof z!=="string"){R(70,{newFilter:z});return}let J=this.parseFilter(z);if(this.quickFilter!==J)this.quickFilter=J,this.setFilterParts(),this.dispatchLocalEvent({type:"quickFilterChanged"})}setParserAndMatcher(){let z=this.gos.get("quickFilterParser"),J=this.gos.get("quickFilterMatcher"),Q=z!==this.parser||J!==this.matcher;if(this.parser=z,this.matcher=J,Q)this.setFilterParts(),this.dispatchLocalEvent({type:"quickFilterChanged"})}onColumnConfigChanged(){if(this.refreshCols(),this.resetCache(),this.isFilterPresent())this.dispatchLocalEvent({type:"quickFilterChanged"})}doesRowPassNoCache(z,J){return this.colsToUse.some((Q)=>{let Z=this.getTextForColumn(Q,z);return T(Z)&&Z.includes(J)})}doesRowPassCache(z,J){return this.checkGenerateAggText(z),z.quickFilterAggregateText.includes(J)}doesRowPassMatcher(z,J){let Q;if(z)this.checkGenerateAggText(J),Q=J.quickFilterAggregateText;else Q=this.getAggText(J);let{quickFilterParts:Z,matcher:$}=this;return $(Z,Q)}checkGenerateAggText(z){if(!z.quickFilterAggregateText)z.quickFilterAggregateText=this.getAggText(z)}getTextForColumn(z,J){let Q=this.beans.filterValueSvc.getValue(z,J),Z=z.getColDef();if(Z.getQuickFilterText){let $=C(this.gos,{value:Q,node:J,data:J.data,column:z,colDef:Z});Q=Z.getQuickFilterText($)}return T(Q)?Q.toString().toUpperCase():null}getAggText(z){let J=[];for(let Q of this.colsToUse){let Z=this.getTextForColumn(Q,z);if(T(Z))J.push(Z)}return J.join(` +`)}},VM={moduleName:"ClientSideRowModelFilter",version:c,rowModels:["clientSide"],beans:[PF]},OX={moduleName:"FilterCore",version:c,beans:[kD],apiFunctions:{isAnyFilterPresent:DD,onFilterChanged:MD},css:[zD],dependsOn:[VM]},PX={moduleName:"FilterValue",version:c,beans:[RD]},q2={moduleName:"ColumnFilter",version:c,beans:[LD,AD],dynamicBeans:{headerFilterCellCtrl:lL},icons:{filter:"filter",filterActive:"filter"},apiFunctions:{isColumnFilterPresent:JD,getColumnFilterInstance:QD,destroyFilter:ZD,setFilterModel:$D,getFilterModel:XD,getColumnFilterModel:YD,setColumnFilterModel:qD,showColumnFilter:GD,hideColumnFilter:HD,getColumnFilterHandler:_D,doFilterAction:UD},dependsOn:[OX,Y2,PX,H5]};var TX={moduleName:"TextFilter",version:c,dependsOn:[q2],userComponents:{agTextColumnFilter:{classImp:WM,params:{useForm:!0}},agTextColumnFloatingFilter:LM},dynamicBeans:{agTextColumnFilterHandler:FM}},vX={moduleName:"NumberFilter",version:c,dependsOn:[q2],userComponents:{agNumberColumnFilter:{classImp:qM,params:{useForm:!0}},agNumberColumnFloatingFilter:UM},dynamicBeans:{agNumberColumnFilterHandler:HM}};var IX={moduleName:"DateFilter",version:c,dependsOn:[q2],userComponents:{agDateColumnFilter:{classImp:bD,params:{useForm:!0}},agDateInput:YM,agDateColumnFloatingFilter:$M},dynamicBeans:{agDateColumnFilterHandler:wD}},SM={moduleName:"QuickFilterCore",version:c,rowModels:["clientSide"],beans:[fM],dependsOn:[OX,PX]},CX={moduleName:"QuickFilter",version:c,apiFunctions:{isQuickFilterPresent:DM,getQuickFilter:MM,resetQuickFilter:kM},dependsOn:[SM]};var AM=class extends V{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,J){let Q=this.wrapSvc?.wrap(z,J)??J,Z=!Sz.has(z),$=Z?this.asyncListeners:this.syncListeners;if(!$.has(z))$.set(z,new Set);$.get(z).add(Q),this.eventSvc.addListener(z,Q,Z)}removeListener(z,J){let Q=this.wrapSvc?.unwrap(z,J)??J,$=!!this.asyncListeners.get(z)?.delete(Q);if(!$)this.syncListeners.get(z)?.delete(Q);this.eventSvc.removeListener(z,Q,$)}addGlobalListener(z){let J=this.wrapSvc?.wrapGlobal(z)??z,Q=(X,Y)=>{if(Sz.has(X))J(X,Y)},Z=(X,Y)=>{if(!Sz.has(X))J(X,Y)};this.globalListenerPairs.set(z,{syncListener:Q,asyncListener:Z});let $=this.eventSvc;$.addGlobalListener(Q,!1),$.addGlobalListener(Z,!0)}removeGlobalListener(z){let{eventSvc:J,wrapSvc:Q,globalListenerPairs:Z}=this,$=Q?.unwrapGlobal(z)??z;if(Z.has($)){let{syncListener:Y,asyncListener:q}=Z.get($);J.removeGlobalListener(Y,!1),J.removeGlobalListener(q,!0),Z.delete(z)}else this.syncGlobalListeners.delete($),J.removeGlobalListener($,!1)}destroyEventListeners(z,J){z.forEach((Q,Z)=>{Q.forEach(($)=>this.eventSvc.removeListener(Z,$,J)),Q.clear()}),z.clear()}destroyGlobalListeners(z,J){for(let Q of z)this.eventSvc.removeGlobalListener(Q,J);z.clear()}destroy(){super.destroy(),this.destroyEventListeners(this.syncListeners,!1),this.destroyEventListeners(this.asyncListeners,!0),this.destroyGlobalListeners(this.syncGlobalListeners,!1);let{globalListenerPairs:z,eventSvc:J}=this;z.forEach(({syncListener:Q,asyncListener:Z})=>{J.removeGlobalListener(Q,!1),J.removeGlobalListener(Z,!0)}),z.clear()}};function RM(z,J,Q){z.apiEventSvc?.addListener(J,Q)}function jM(z,J,Q){z.apiEventSvc?.removeListener(J,Q)}function OM(z,J){z.apiEventSvc?.addGlobalListener(J)}function PM(z,J){z.apiEventSvc?.removeGlobalListener(J)}var bX={moduleName:"EventApi",version:c,apiFunctions:{addEventListener:RM,addGlobalListener:OM,removeEventListener:jM,removeGlobalListener:PM},beans:[AM]};function T4(z,J){if(typeof z!=="number")return"";let Q=J(),Z=Q("thousandSeparator",","),$=Q("decimalSeparator",".");return z.toString().replace(".",$).replace(/(\d)(?=(\d{3})+(?!\d))/g,`$1${Z}`)}var TM="↑",vM="↓",IM={tag:"span",children:[{tag:"span",ref:"eDelta",cls:"ag-value-change-delta"},{tag:"span",ref:"eValue",cls:"ag-value-change-value"}]},CM=class extends y{constructor(){super(IM);this.eValue=j,this.eDelta=j,this.refreshCount=0}init(z){this.refresh(z,!0)}showDelta(z,J){let Q=Math.abs(J),Z=z.formatValue(Q),$=T(Z)?Z:Q,X=J>=0,Y=this.eDelta;if(X)Y.textContent=TM+$;else Y.textContent=vM+$;Y.classList.toggle("ag-value-change-delta-up",X),Y.classList.toggle("ag-value-change-delta-down",!X)}setTimerToRemoveDelta(){this.refreshCount++;let z=this.refreshCount;this.beans.frameworkOverrides.wrapIncoming(()=>{window.setTimeout(()=>{if(z===this.refreshCount)this.hideDeltaValue()},2000)})}hideDeltaValue(){this.eValue.classList.remove("ag-value-change-value-highlight"),J0(this.eDelta)}refresh(z,J=!1){let{value:Q,valueFormatted:Z}=z,{eValue:$,lastValue:X,beans:Y}=this;if(Q===X)return!1;if(T(Z))$.textContent=Z;else if(T(Q))$.textContent=Q;else J0($);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 H=q-G;this.showDelta(z,H)}if(X)$.classList.add("ag-value-change-value-highlight");if(!J)this.setTimerToRemoveDelta();return this.lastValue=Q,!0}},bM=".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}",yM={tag:"span",children:[{tag:"span",ref:"eCurrent",cls:"ag-value-slide-current"}]},xM=class extends y{constructor(){super(yM);this.eCurrent=j,this.refreshCount=0,this.registerCSS(bM)}init(z){this.refresh(z,!0)}addSlideAnimation(){this.refreshCount++;let z=this.refreshCount;this.ePrevious?.remove();let{beans:J,eCurrent:Q}=this,Z=z0({tag:"span",cls:"ag-value-slide-previous ag-value-slide-out"});this.ePrevious=Z,Z.textContent=Q.textContent,this.getGui().insertBefore(Z,Q),J.frameworkOverrides.wrapIncoming(()=>{window.setTimeout(()=>{if(z!==this.refreshCount)return;this.ePrevious.classList.add("ag-value-slide-out-end")},50),window.setTimeout(()=>{if(z!==this.refreshCount)return;this.ePrevious?.remove(),this.ePrevious=null},3000)})}refresh(z,J=!1){let Q=z.value;if(n(Q))Q="";if(Q===this.lastValue)return!1;if(this.beans.filterManager?.isSuppressFlashingCellsBecauseFiltering())return!1;if(!J)this.addSlideAnimation();this.lastValue=Q;let Z=this.eCurrent;if(T(z.valueFormatted))Z.textContent=z.valueFormatted;else if(T(z.value))Z.textContent=Q;else J0(Z);return!0}},wM=class extends V{constructor(){super(...arguments);this.beanName="cellFlashSvc",this.nextAnimationTime=null,this.nextAnimationCycle=null,this.animations={highlight:new Map,"data-changed":new Map}}animateCell(z,J,Q=this.beans.gos.get("cellFlashDuration"),Z=this.beans.gos.get("cellFadeDuration")){let $=this.animations[J];$.delete(z);let X=Date.now(),Y=X+Q,q=X+Q+Z,G={phase:"flash",flashEndTime:Y,fadeEndTime:q};$.set(z,G);let H=`ag-cell-${J}`,_=`${H}-animation`,{comp:U,eGui:{style:W}}=z;if(U.toggleCss(H,!0),U.toggleCss(_,!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 z=Date.now(),J=null;for(let Q of Object.keys(this.animations)){let Z=this.animations[Q],$=`ag-cell-${Q}`,X=`${$}-animation`;for(let[Y,q]of Z){if(!Y.isAlive()||!Y.comp){Z.delete(Y);continue}let{phase:G,flashEndTime:H,fadeEndTime:_}=q,U=G==="flash"?H:_;if(!(z+15>=U)){J=Math.min(U,J??1/0);continue}let{comp:B,eGui:{style:E}}=Y;switch(G){case"flash":B.toggleCss($,!1),B.toggleCss(X,!0),E.transition=`background-color ${_-H}ms`,E.transitionDelay=`${H-z}ms`,J=Math.min(_,J??1/0),q.phase="fade";break;case"fade":B.toggleCss($,!1),B.toggleCss(X,!1),E.removeProperty("transition"),E.removeProperty("transition-delay"),Z.delete(Y);break}}}if(J==null)this.nextAnimationTime=null,this.nextAnimationCycle=null;else if(J)this.nextAnimationCycle=setTimeout(this.advanceAnimations.bind(this),J-z),this.nextAnimationTime=J}onFlashCells(z,J){if(!z.comp)return;let Q=p4(z.cellPosition);if(J.cells[Q])this.animateCell(z,"highlight")}flashCell(z,J){this.animateCell(z,"data-changed",J?.flashDuration,J?.fadeDuration)}destroy(){for(let z of Object.keys(this.animations))this.animations[z].clear()}};function NM(z,J={}){let{cellFlashSvc:Q}=z;if(!Q)return;z.frameworkOverrides.wrapIncoming(()=>{for(let Z of z.rowRenderer.getCellCtrls(J.rowNodes,J.columns))Q.flashCell(Z,J)})}var yX={moduleName:"HighlightChanges",version:c,beans:[wM],userComponents:{agAnimateShowChangeCellRenderer:CM,agAnimateSlideCellRenderer:xM},apiFunctions:{flashCells:NM}};var gM=class extends V{constructor(){super(...arguments);this.beanName="selectionColSvc"}postConstruct(){this.addManagedPropertyListener("rowSelection",(z)=>{this.onSelectionOptionsChanged(z.currentValue,z.previousValue,F1(z.source))}),this.addManagedPropertyListener("selectionColumnDef",this.updateColumns.bind(this))}addColumns(z){let J=this.columns;if(J==null)return;z.list=J.list.concat(z.list),z.tree=J.tree.concat(z.tree),N6(z)}createColumns(z,J){let Q=()=>{H4(this.beans,this.columns?.tree),this.columns=null},Z=z.treeDepth,X=(this.columns?.treeDepth??-1)==Z,Y=this.generateSelectionCols();if(w6(Y,this.columns?.list??[])&&X)return;Q();let{colGroupSvc:G}=this.beans,H=G?.findDepth(z.tree)??0,_=G?.balanceTreeForAutoCols(Y,H)??[];this.columns={list:Y,tree:_,treeDepth:H,map:{}},J((W)=>{if(!W)return null;let B=W.filter((E)=>!m4(E));return[...Y,...B]})}updateColumns(z){let J=F1(z.source),{beans:Q}=this;for(let Z of this.columns?.list??[]){let $=this.createSelectionColDef(z.currentValue);Z.setColDef($,null,J),l0(Q,{state:[jZ($,Z.colId)]},J)}}getColumn(z){return this.columns?.list.find((J)=>g4(J,z))??null}getColumns(){return this.columns?.list??null}isSelectionColumnEnabled(){let{gos:z,beans:J}=this,Q=z.get("rowSelection");if(typeof Q!=="object"||!t4(z))return!1;let Z=(J.autoColSvc?.getColumns()?.length??0)>0;if(Q.checkboxLocation==="autoGroupColumn"&&Z)return!1;let $=!!B1(Q),X=Mz(Q);return $||X}createSelectionColDef(z){let{gos:J}=this,Q=z??J.get("selectionColumnDef"),Z=J.get("enableRtl"),{rowSpan:$,spanRows:X,...Y}=Q??{};return{width:50,resizable:!1,suppressHeaderMenuButton:!0,sortable:!1,suppressMovable:!0,lockPosition:Z?"right":"left",comparator(q,G,H,_){let U=H.isSelected(),W=_.isSelected();return U===W?0:U?1:-1},editable:!1,suppressFillHandle:!0,suppressAutoSize:!0,pinned:null,...Y,colId:K9,chartDataType:"excluded"}}generateSelectionCols(){if(!this.isSelectionColumnEnabled())return[];let z=this.createSelectionColDef(),J=z.colId;this.gos.validateColDef(z,J,!0);let Q=new B4(z,null,J,!1);return this.createBean(Q),[Q]}onSelectionOptionsChanged(z,J,Q){let Z=J&&typeof J!=="string"?B1(J):void 0,$=z&&typeof z!=="string"?B1(z):void 0,X=Z!==$,Y=J&&typeof J!=="string"?Mz(J):void 0,q=z&&typeof z!=="string"?Mz(z):void 0,G=Y!==q,H=b2(z),_=b2(J);if(X||G||H!==_)this.beans.colModel.refreshAll(Q)}destroy(){H4(this.beans,this.columns?.tree),super.destroy()}refreshVisibility(z,J,Q){if(!this.columns?.list.length)return;let Z=z.length+J.length+Q.length;if(Z===0)return;let $=this.columns.list[0];if(!$.isVisible())return;let X=()=>{let G;switch($.pinned){case"left":case!0:G=z;break;case"right":G=Q;break;default:G=J}if(G)X0(G,$)};if((this.beans.rowNumbersSvc?.getColumn(F9)?2:1)===Z)X()}},hM=':where(.ag-selection-checkbox) .ag-checkbox-input-wrapper:before{content:"";cursor:pointer;inset:-8px;position:absolute}';function uM(z,J){if(!J.nodes.every((Y)=>{if(Y.rowPinned&&!LJ(Y))return R(59),!1;if(Y.id===void 0)return R(60),!1;return!0}))return;let{nodes:Z,source:$,newValue:X}=J;z.selectionSvc?.setNodesSelected({nodes:Z,source:$??"api",newValue:X})}function mM(z,J,Q="apiSelectAll"){z.selectionSvc?.selectAllRowNodes({source:Q,selectAll:J})}function cM(z,J,Q="apiSelectAll"){z.selectionSvc?.deselectAllRowNodes({source:Q,selectAll:J})}function pM(z,J="apiSelectAllFiltered"){z.selectionSvc?.selectAllRowNodes({source:J,selectAll:"filtered"})}function iM(z,J="apiSelectAllFiltered"){z.selectionSvc?.deselectAllRowNodes({source:J,selectAll:"filtered"})}function dM(z,J="apiSelectAllCurrentPage"){z.selectionSvc?.selectAllRowNodes({source:J,selectAll:"currentPage"})}function nM(z,J="apiSelectAllCurrentPage"){z.selectionSvc?.deselectAllRowNodes({source:J,selectAll:"currentPage"})}function tM(z){return z.selectionSvc?.getSelectedNodes()??[]}function rM(z){return z.selectionSvc?.getSelectedRows()??[]}var sM={tag:"div",cls:"ag-selection-checkbox",role:"presentation",children:[{tag:"ag-checkbox",ref:"eCheckbox",role:"presentation"}]},lM=class extends y{constructor(){super(sM,[K4]);this.eCheckbox=j}postConstruct(){this.eCheckbox.setPassive(!0)}onDataChanged(){this.onSelectionChanged()}onSelectableChanged(){this.showOrHideSelect()}onSelectionChanged(){let z=this.getLocaleTextFunc(),{rowNode:J,eCheckbox:Q}=this,Z=J.isSelected(),$=HZ(z,Z),[X,Y]=J.selectable?["ariaRowToggleSelection","Press Space to toggle row selection"]:["ariaRowSelectionDisabled","Row Selection is disabled for this row"],q=z(X,Y);Q.setValue(Z,!0),Q.setInputAriaLabel(`${q} (${$})`)}init(z){if(this.rowNode=z.rowNode,this.column=z.column,this.overrides=z.overrides,this.onSelectionChanged(),this.addManagedListeners(this.eCheckbox.getWrapperElement(),{dblclick:s0,click:(Z)=>{if(s0(Z),this.eCheckbox.isDisabled())return;this.beans.selectionSvc?.handleSelectionEvent(Z,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:Z,previousValue:$})=>{let X=typeof Z==="object"?oJ(Z):void 0,Y=typeof $==="object"?oJ($):void 0;if(X!==Y)this.onSelectableChanged()}),yQ(this.gos)||typeof this.getIsVisible()==="function"){let Z=this.showOrHideSelect.bind(this);this.addManagedEventListeners({displayedColumnsChanged:Z}),this.addManagedListeners(this.rowNode,{dataChanged:Z,cellChanged:Z}),this.showOrHideSelect()}this.eCheckbox.getInputElement().setAttribute("tabindex","-1")}showOrHideSelect(){let{column:z,rowNode:J,overrides:Q,gos:Z}=this,$=J.selectable,X=this.getIsVisible(),Y=void 0;if(typeof X==="function"){let U=Q?.callbackParams;if(!z)Y=X({...U,node:J,data:J.data});else{let W=z.createColumnFunctionCallbackParams(J);Y=X({...U,...W})}}else Y=X??!1;let q=$&&!Y||!$&&Y,G=$||Y,H=Z.get("rowSelection"),_=H&&typeof H!=="string"?!oJ(H):!!z?.getColDef().showDisabledCheckboxes;if(this.setVisible(G&&(q?_:!0)),this.setDisplayed(G&&(q?_:!0)),G)this.eCheckbox.setDisabled(q);if(Q?.removeHidden)this.setDisplayed(G)}getIsVisible(){let z=this.overrides;if(z)return z.isVisible;let J=this.gos.get("rowSelection");if(J&&typeof J!=="string")return B1(J);return this.column?.getColDef()?.checkboxSelection}},aM=class{constructor(z,J){this.rowModel=z,this.pinnedRowModel=J,this.selectAll=!1,this.rootId=null,this.endId=null,this.cachedRange=[]}reset(){this.rootId=null,this.endId=null,this.cachedRange.length=0}setRoot(z){this.rootId=z.id,this.endId=null,this.cachedRange.length=0}setEndRange(z){this.endId=z.id,this.cachedRange.length=0}getRange(){if(this.cachedRange.length===0){let z=this.getRoot(),J=this.getEnd();if(z==null||J==null)return this.cachedRange;this.cachedRange=this.getNodesInRange(z,J)??[]}return this.cachedRange}isInRange(z){if(this.rootId===null)return!1;return this.getRange().some((J)=>J.id===z.id)}getRoot(z){if(this.rootId)return this.getRowNode(this.rootId);if(z)return this.setRoot(z),z}getEnd(){if(this.endId)return this.getRowNode(this.endId)}getRowNode(z){let J,{rowModel:Q,pinnedRowModel:Z}=this;if(J??(J=Q.getRowNode(z)),Z?.isManual())J??(J=Z.getPinnedRowById(z,"top")),J??(J=Z.getPinnedRowById(z,"bottom"));return J}truncate(z){let J=this.getRange();if(J.length===0)return{keep:[],discard:[]};let Q=J[0].id===this.rootId,Z=J.findIndex(($)=>$.id===z.id);if(Z>-1){let $=J.slice(0,Z),X=J.slice(Z+1);return this.setEndRange(z),Q?{keep:$,discard:X}:{keep:X,discard:$}}else return{keep:J,discard:[]}}extend(z,J=!1){let Q=this.getRoot();if(Q==null){let $=this.getRange().slice();if(J)z.depthFirstSearch((X)=>!X.group&&$.push(X));return $.push(z),this.setRoot(z),{keep:$,discard:[]}}let Z=this.getNodesInRange(Q,z);if(!Z)return this.setRoot(z),{keep:[z],discard:[]};if(Z.find(($)=>$.id===this.endId))return this.setEndRange(z),{keep:this.getRange(),discard:[]};else{let $=this.getRange().slice();return this.setEndRange(z),{keep:this.getRange(),discard:$}}}getNodesInRange(z,J){let{pinnedRowModel:Q,rowModel:Z}=this;if(!Q?.isManual())return Z.getNodesInRangeForSelection(z,J);if(z.rowPinned==="top"&&!J.rowPinned)return e0(Q,"top",z,void 0).concat(Z.getNodesInRangeForSelection(Z.getRow(0),J)??[]);if(z.rowPinned==="bottom"&&!J.rowPinned){let $=e0(Q,"bottom",void 0,z),X=Z.getRowCount(),Y=Z.getRow(X-1);return(Z.getNodesInRangeForSelection(J,Y)??[]).concat($)}if(!z.rowPinned&&!J.rowPinned)return Z.getNodesInRangeForSelection(z,J);if(z.rowPinned==="top"&&J.rowPinned==="top")return e0(Q,"top",z,J);if(z.rowPinned==="bottom"&&J.rowPinned==="top"){let $=e0(Q,"top",J,void 0),X=e0(Q,"bottom",void 0,z),Y=Z.getRow(0),q=Z.getRow(Z.getRowCount()-1);return $.concat(Z.getNodesInRangeForSelection(Y,q)??[]).concat(X)}if(!z.rowPinned&&J.rowPinned==="top")return e0(Q,"top",J,void 0).concat(Z.getNodesInRangeForSelection(Z.getRow(0),z)??[]);if(z.rowPinned==="top"&&J.rowPinned==="bottom"){let $=e0(Q,"top",z,void 0),X=e0(Q,"bottom",void 0,J),Y=Z.getRow(0),q=Z.getRow(Z.getRowCount()-1);return $.concat(Z.getNodesInRangeForSelection(Y,q)??[]).concat(X)}if(z.rowPinned==="bottom"&&J.rowPinned==="bottom")return e0(Q,"bottom",z,J);if(!z.rowPinned&&J.rowPinned==="bottom"){let $=e0(Q,"bottom",void 0,J),X=Z.getRow(Z.getRowCount());return(Z.getNodesInRangeForSelection(z,X)??[]).concat($)}return null}},oM=class extends V{constructor(z){super();this.column=z,this.cbSelectAllVisible=!1,this.processingEventFromCheckbox=!1}onSpaceKeyDown(z){let J=this.cbSelectAll;if(J.isDisplayed()&&!J.getGui().contains(d(this.beans)))z.preventDefault(),J.setValue(!J.getValue())}getCheckboxGui(){return this.cbSelectAll.getGui()}setComp(z){this.headerCellCtrl=z;let J=this.createManagedBean(new EJ);this.cbSelectAll=J,J.addCss("ag-header-select-all"),H0(J.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:Z,previousValue:$})=>{let X=(Y)=>typeof Y==="string"||!Y||Y.mode==="singleRow"?void 0:Y.selectAll;if(X(Z)!==X($))this.showOrHideSelectAll();this.updateStateOfCheckbox()}),this.addManagedListeners(J,{fieldValueChanged:this.onCbSelectAll.bind(this)}),J.getInputElement().setAttribute("tabindex","-1"),this.refreshSelectAllLabel()}onDisplayedColumnsChanged(z){if(!this.isAlive())return;this.showOrHideSelectAll(z.source==="uiColumnMoved")}showOrHideSelectAll(z=!1){let J=this.isCheckboxSelection();if(this.cbSelectAllVisible=J,this.cbSelectAll.setDisplayed(J),J)this.checkRightRowModelType("selectAllCheckbox"),this.checkSelectionType("selectAllCheckbox"),this.updateStateOfCheckbox();this.refreshSelectAllLabel(z)}updateStateOfCheckbox(){if(!this.cbSelectAllVisible||this.processingEventFromCheckbox)return;this.processingEventFromCheckbox=!0;let z=this.getSelectAllMode(),J=this.beans.selectionSvc,Q=this.cbSelectAll,Z=J.getSelectAllState(z);Q.setValue(Z);let $=J.hasNodesToSelect(z);Q.setDisabled(!$),this.refreshSelectAllLabel(),this.processingEventFromCheckbox=!1}refreshSelectAllLabel(z=!1){let J=this.getLocaleTextFunc(),{headerCellCtrl:Q,cbSelectAll:Z,cbSelectAllVisible:$}=this,X=Z.getValue(),Y=HZ(J,X),q=J("ariaRowSelectAll","Press Space to toggle all rows selection");if(Q.setAriaDescriptionProperty("selectAll",$?`${q} (${Y})`:null),Z.setInputAriaLabel(J("ariaHeaderSelection","Column with Header Selection")),!z)Q.announceAriaDescription()}checkSelectionType(z){if(!f6(this.gos))return R(128,{feature:z}),!1;return!0}checkRightRowModelType(z){let{gos:J,rowModel:Q}=this.beans;if(!(o(J)||V1(J)))return R(129,{feature:z,rowModel:Q.getType()}),!1;return!0}onCbSelectAll(){if(this.processingEventFromCheckbox)return;if(!this.cbSelectAllVisible)return;let z=this.cbSelectAll.getValue(),J=this.getSelectAllMode(),Q="uiSelectAll";if(J==="currentPage")Q="uiSelectAllCurrentPage";else if(J==="filtered")Q="uiSelectAllFiltered";let Z={source:Q,selectAll:J},$=this.beans.selectionSvc;if(z)$.selectAllRowNodes(Z);else $.deselectAllRowNodes(Z)}isCheckboxSelection(){let{column:z,gos:J,beans:Q}=this,X=typeof J.get("rowSelection")==="object"?"headerCheckbox":"headerCheckboxSelection";return xX(Q,z)&&this.checkRightRowModelType(X)&&this.checkSelectionType(X)}getSelectAllMode(){let z=Y9(this.gos,!1);if(z)return z;let{headerCheckboxSelectionCurrentPageOnly:J,headerCheckboxSelectionFilteredOnly:Q}=this.column.getColDef();if(J)return"currentPage";if(Q)return"filtered";return"all"}destroy(){super.destroy(),this.cbSelectAll=void 0,this.headerCellCtrl=void 0}};function xX({gos:z,selectionColSvc:J},Q){let Z=z.get("rowSelection"),$=Q.getColDef(),{headerCheckboxSelection:X}=$,Y=!1;if(typeof Z==="object"){let G=m4(Q),H=Q2(Q);if(b2(Z)==="autoGroupColumn"&&H||G&&J?.isSelectionColumnEnabled())Y=Mz(Z)}else if(typeof X==="function")Y=X(C(z,{column:Q,colDef:$}));else Y=!!X;return Y}var eM=class extends V{postConstruct(){let{gos:z,beans:J}=this;this.selectionCtx=new aM(J.rowModel,J.pinnedRowModel),this.addManagedPropertyListeners(["isRowSelectable","rowSelection"],()=>{let Q=yQ(z);if(Q!==this.isRowSelectable)this.isRowSelectable=Q,this.updateSelectable()}),this.isRowSelectable=yQ(z),this.addManagedEventListeners({cellValueChanged:(Q)=>this.updateRowSelectable(Q.node),rowNodeDataChanged:(Q)=>this.updateRowSelectable(Q.node)})}destroy(){super.destroy(),this.selectionCtx.reset()}createCheckboxSelectionComponent(){return new lM}createSelectAllFeature(z){if(xX(this.beans,z))return new oM(z)}isMultiSelect(){return f6(this.gos)}onRowCtrlSelected(z,J,Q){let Z=!!z.rowNode.isSelected();z.forEachGui(Q,($)=>{$.rowComp.toggleCss("ag-row-selected",Z);let X=$.element;if(az(X,Z),X.contains(d(this.beans)))J($)})}announceAriaRowSelection(z){if(this.isRowSelectionBlocked(z))return;let J=z.isSelected(),Q=this.beans.editSvc?.isEditing({rowNode:z});if(!z.selectable||Q)return;let $=this.getLocaleTextFunc()(J?"ariaRowDeselect":"ariaRowSelect",`Press SPACE to ${J?"deselect":"select"} this row`);this.beans.ariaAnnounce?.announceValue($,"rowSelection")}isRowSelectionBlocked(z){return!z.selectable||z.rowPinned&&!LJ(z)||!t4(this.gos)}updateRowSelectable(z,J){let Q=z.rowPinned&&z.pinnedSibling?z.pinnedSibling.selectable:this.isRowSelectable?.(z)??!0;return this.setRowSelectable(z,Q,J),Q}setRowSelectable(z,J,Q){if(z.selectable!==J){if(z.selectable=J,z.dispatchRowEvent("selectableChanged"),Q)return;if(V6(this.gos)){let $=this.calculateSelectedFromChildren(z);this.setNodesSelected({nodes:[z],newValue:$??!1,source:"selectableChanged"});return}if(z.isSelected()&&!z.selectable)this.setNodesSelected({nodes:[z],newValue:!1,source:"selectableChanged"})}}calculateSelectedFromChildren(z){let J=!1,Q=!1;if(!z.childrenAfterGroup?.length)return z.selectable?z.__selected:null;for(let Z=0;Z{let J=V6(z),Q=Cz(z),Z=bz(z)==="filteredDescendants";if(this.masterSelectsDetail=B7(z)==="detail",J!==this.groupSelectsDescendants||Z!==this.groupSelectsFiltered||Q!==this.mode)this.deselectAllRowNodes({source:"api"}),this.groupSelectsDescendants=J,this.groupSelectsFiltered=Z,this.mode=Q}),this.addManagedEventListeners({rowSelected:this.onRowSelected.bind(this)})}destroy(){super.destroy(),this.resetNodes()}handleSelectionEvent(z,J,Q){if(this.isRowSelectionBlocked(J))return 0;let Z=this.inferNodeSelections(J,z.shiftKey,z.metaKey||z.ctrlKey,Q);if(Z==null)return 0;if(this.selectionCtx.selectAll=!1,"select"in Z){if(Z.reset)this.resetNodes();else this.selectRange(Z.deselect,!1,Q);return this.selectRange(Z.select,!0,Q)}else{let $=Z.checkFilteredNodes?NX(Z.node):Z.newValue;return this.setNodesSelected({nodes:[Z.node],newValue:$,clearSelection:Z.clearSelection,keepDescendants:Z.keepDescendants,event:z,source:Q})}}setNodesSelected({newValue:z,clearSelection:J,suppressFinishActions:Q,nodes:Z,event:$,source:X,keepDescendants:Y=!1}){if(Z.length===0)return 0;let{gos:q}=this;if(!t4(q)&&z)return R(132),0;if(Z.length>1&&!this.isMultiSelect())return R(130),0;let G=0;for(let H=0;H0)this.updateGroupsFromChildrenSelections(X),this.dispatchSelectionChanged(X)}return G}selectRange(z,J,Q){let Z=0;if(z.forEach(($)=>{let X=$.primaryRow;if(X.group&&this.groupSelectsDescendants)return;if(this.selectRowNode(X,J,void 0,Q))Z++}),Z>0)this.updateGroupsFromChildrenSelections(Q),this.dispatchSelectionChanged(Q);return Z}selectChildren(z,J,Q){let Z=this.groupSelectsFiltered?z.childrenAfterAggFilter:z.childrenAfterGroup;if(!Z)return 0;return this.setNodesSelected({newValue:J,clearSelection:!1,suppressFinishActions:!0,source:Q,nodes:Z})}getSelectedNodes(){return Array.from(this.selectedNodes.values())}getSelectedRows(){let z=[];return this.selectedNodes.forEach((J)=>J.data&&z.push(J.data)),z}getSelectionCount(){return this.selectedNodes.size}filterFromSelection(z){let J=new Map;this.selectedNodes.forEach((Q,Z)=>{if(z(Q))J.set(Z,Q)}),this.selectedNodes=J}updateGroupsFromChildrenSelections(z,J){if(!this.groupSelectsDescendants)return!1;let{gos:Q,rowModel:Z}=this.beans;if(!o(Q,Z))return!1;let $=Z.rootNode;if(!$)return!1;let X=!1,Y=(q)=>{if(q!==$){let G=this.calculateSelectedFromChildren(q);X=this.selectRowNode(q,G===null?!1:G,void 0,z)||X}};return j0($,this.beans.rowModel.hierarchical,J,Y),X}clearOtherNodes(z,J,Q){let Z=new Map,$=0;return this.selectedNodes.forEach((X)=>{let Y=X.id==z.id;if((J?!Qk(z,X):!0)&&!Y){let G=this.selectedNodes.get(X.id);if($+=this.setNodesSelected({nodes:[G],newValue:!1,clearSelection:!1,suppressFinishActions:!0,source:Q}),this.groupSelectsDescendants&&X.parent)Z.set(X.parent.id,X.parent)}}),Z.forEach((X)=>{let Y=this.calculateSelectedFromChildren(X);this.selectRowNode(X,Y===null?!1:Y,void 0,Q)}),$}onRowSelected(z){let J=z.node;if(this.groupSelectsDescendants&&J.group)return;if(J.isSelected())this.selectedNodes.set(J.id,J);else this.selectedNodes.delete(J.id)}syncInRowNode(z,J){this.syncInOldRowNode(z,J),this.syncInNewRowNode(z)}createDaemonNode(z){if(!z.id)return;let J=new j1(this.beans);return J.id=z.id,J.data=z.data,J.__selected=z.__selected,J.level=z.level,J}syncInOldRowNode(z,J){if(J&&z.id!==J.id){if(this.selectedNodes.get(J.id)==z)this.selectedNodes.set(J.id,J)}}syncInNewRowNode(z){if(this.selectedNodes.has(z.id))z.__selected=!0,this.selectedNodes.set(z.id,z);else z.__selected=!1}reset(z){let J=this.getSelectionCount();if(this.resetNodes(),J)this.dispatchSelectionChanged(z)}resetNodes(){this.selectedNodes.forEach((z)=>{this.selectRowNode(z,!1)}),this.selectedNodes.clear()}getBestCostNodeSelection(){let{gos:z,rowModel:J}=this.beans;if(!o(z,J))return;let Q=J.getTopLevelNodes();if(Q===null)return;let Z=[];function $(X){for(let Y=0,q=X.length;Y{let Y=this.selectRowNode(X.primaryRow,!1,void 0,z);Z||(Z=Y)};if(J==="currentPage"||J==="filtered"){if(!Q){t(102);return}this.getNodesToSelect(J).forEach($)}else this.selectedNodes.forEach($),this.reset(z);if(this.selectionCtx.selectAll=!1,Q&&this.groupSelectsDescendants){let X=this.updateGroupsFromChildrenSelections(z);Z||(Z=X)}if(Z)this.dispatchSelectionChanged(z)}getSelectedCounts(z){let J=0,Q=0;return this.getNodesToSelect(z).forEach((Z)=>{if(this.groupSelectsDescendants&&Z.group)return;if(Z.isSelected())J++;else if(Z.selectable)Q++}),{selectedCount:J,notSelectedCount:Q}}getSelectAllState(z){let{selectedCount:J,notSelectedCount:Q}=this.getSelectedCounts(z);return wX(J,Q)??null}hasNodesToSelect(z){return this.getNodesToSelect(z).filter((J)=>J.selectable).length>0}getNodesToSelect(z){if(!this.canSelectAll())return[];let J=[],Q=($)=>J.push($);if(z==="currentPage")return this.forEachNodeOnPage(($)=>{if(!$.group){Q($);return}if(!$.footer&&!$.expanded){let X=(Y)=>{Q(Y);let q=Y.childrenAfterFilter;if(q)for(let G=0,H=q.length;G{let q=this.selectRowNode(Y.primaryRow,!0,void 0,Z);X||(X=q)}),Q.selectAll=!0,o(J)&&this.groupSelectsDescendants){let Y=this.updateGroupsFromChildrenSelections(Z);X||(X=Y)}if(X)this.dispatchSelectionChanged(Z)}getSelectionState(){return this.isEmpty()?null:Array.from(this.selectedNodes.keys())}setSelectionState(z,J,Q){if(!z)z=[];if(!Array.isArray(z)){t(103);return}let Z=new Set(z),$=[];if(this.beans.rowModel.forEachNode((X)=>{if(Z.has(X.id))$.push(X)}),Q)this.resetNodes();this.setNodesSelected({newValue:!0,nodes:$,source:J})}canSelectAll(){return o(this.beans.gos)}updateSelectable(z){let{gos:J,rowModel:Q}=this.beans;if(!t4(J))return;let Z="selectableChanged",$=o(J)&&this.groupSelectsDescendants,X=[];if($){let Y=Q.rootNode;if(Y)j0(Y,Q.hierarchical,z,(q)=>{let G=!1;for(let H of q.childrenAfterGroup)if(G||(G=H.selectable),!H.group&&!this.updateRowSelectable(H,!0)&&H.isSelected())X.push(H);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:Z});if(!z&&$)this.updateGroupsFromChildrenSelections?.(Z)}updateSelectableAfterGrouping(z){if(this.updateSelectable(z),this.groupSelectsDescendants){if(this.updateGroupsFromChildrenSelections?.("rowGroupChanged",z))this.dispatchSelectionChanged("rowGroupChanged")}}refreshMasterNodeState(z,J){if(!this.masterSelectsDetail)return;let Q=z.detailNode?.detailGridInfo?.api;if(!Q)return;let Z=Jk(Q);if(z.isSelected()!==Z){if(this.selectRowNode(z,Z,J,"masterDetail"))this.dispatchSelectionChanged("masterDetail")}if(!Z)this.detailSelection.set(z.id,new Set(Q.getSelectedNodes().map((X)=>X.id)))}setDetailSelectionState(z,J,Q){if(!this.masterSelectsDetail)return;if(!f6(J)){R(269);return}switch(z.isSelected()){case!0:{Q.selectAll();break}case!1:{Q.deselectAll();break}case void 0:{let Z=this.detailSelection.get(z.id);if(Z){let $=[];for(let X of Z){let Y=Q.getRowNode(X);if(Y)$.push(Y)}Q.setNodesSelected({nodes:$,newValue:!0,source:"masterDetail"})}break}default:break}}dispatchSelectionChanged(z){this.eventSvc.dispatchEvent({type:"selectionChanged",source:z,selectedNodes:this.getSelectedNodes(),serverSideState:null})}};function Jk(z){let J=0,Q=0;return z.forEachNode((Z)=>{if(Z.isSelected())J++;else if(Z.selectable)Q++}),wX(J,Q)}function wX(z,J){if(z===0&&J===0)return!1;if(z>0&&J>0)return;return z>0}function Qk(z,J){let Q=J.parent;while(Q){if(Q===z)return!0;Q=Q.parent}return!1}function NX(z){let J=z.isSelected()===!1,Q=z.childrenAfterFilter?.some(NX)??!1;return J||Q}var Zk={moduleName:"SharedRowSelection",version:c,beans:[gM],css:[hM],apiFunctions:{setNodesSelected:uM,selectAll:mM,deselectAll:cM,selectAllFiltered:pM,deselectAllFiltered:iM,selectAllOnCurrentPage:dM,deselectAllOnCurrentPage:nM,getSelectedNodes:tM,getSelectedRows:rM}},gX={moduleName:"RowSelection",version:c,rowModels:["clientSide","infinite","viewport"],beans:[zk],dependsOn:[Zk]},$k=class extends V{constructor(z,J){super();this.cellCtrl=z,this.staticClasses=[],this.beans=J,this.column=z.column}setComp(z){this.cellComp=z,this.applyUserStyles(),this.applyCellClassRules(),this.applyClassesFromColDef()}applyCellClassRules(){let{column:z,cellComp:J}=this,Q=z.colDef,Z=Q.cellClassRules,$=this.getCellClassParams(z,Q);u$(this.beans.expressionSvc,Z===this.cellClassRules?void 0:this.cellClassRules,Z,$,(X)=>J.toggleCss(X,!0),(X)=>J.toggleCss(X,!1)),this.cellClassRules=Z}applyUserStyles(){let z=this.column,J=z.colDef,Q=J.cellStyle;if(!Q)return;let Z;if(typeof Q==="function"){let $=this.getCellClassParams(z,J);Z=Q($)}else Z=Q;if(Z)this.cellComp.setUserStyles(Z)}applyClassesFromColDef(){let{column:z,cellComp:J}=this,Q=z.colDef,Z=this.getCellClassParams(z,Q);for(let X of this.staticClasses)J.toggleCss(X,!1);let $=this.beans.cellStyles.getStaticCellClasses(Q,Z);this.staticClasses=$;for(let X of $)J.toggleCss(X,!0)}getCellClassParams(z,J){let{value:Q,rowNode:Z}=this.cellCtrl;return C(this.beans.gos,{value:Q,data:Z.data,node:Z,colDef:J,column:z,rowIndex:Z.rowIndex})}},Xk=class extends V{constructor(){super(...arguments);this.beanName="cellStyles"}processAllCellClasses(z,J,Q,Z){u$(this.beans.expressionSvc,void 0,z.cellClassRules,J,Q,Z),this.processStaticCellClasses(z,J,Q)}getStaticCellClasses(z,J){let{cellClass:Q}=z;if(!Q)return[];let Z;if(typeof Q==="function")Z=Q(J);else Z=Q;if(typeof Z==="string")Z=[Z];return Z||[]}createCellCustomStyleFeature(z){return new $k(z,this.beans)}processStaticCellClasses(z,J,Q){this.getStaticCellClasses(z,J).forEach(($)=>{Q($)})}},hX={moduleName:"CellStyle",version:c,beans:[Xk]};var Yk={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},m0="clientSide",y0="serverSide",D2="infinite",qk={onGroupExpandedOrCollapsed:[m0],refreshClientSideRowModel:[m0],isRowDataEmpty:[m0],forEachLeafNode:[m0],forEachNodeAfterFilter:[m0],forEachNodeAfterFilterAndSort:[m0],resetRowHeights:[m0,y0],applyTransaction:[m0],applyTransactionAsync:[m0],flushAsyncTransactions:[m0],getBestCostNodeSelection:[m0],getServerSideSelectionState:[y0],setServerSideSelectionState:[y0],applyServerSideTransaction:[y0],applyServerSideTransactionAsync:[y0],applyServerSideRowData:[y0],retryServerSideLoads:[y0],flushServerSideAsyncTransactions:[y0],refreshServerSide:[y0],getServerSideGroupLevelState:[y0],refreshInfiniteCache:[D2],purgeInfiniteCache:[D2],getInfiniteRowCount:[D2],isLastRowIndexKnown:[D2,y0],expandAll:[m0,y0],collapseAll:[m0,y0],onRowHeightChanged:[m0,y0],setRowCount:[D2,y0],getCacheBlockState:[D2,y0]},Gk={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 Hk(z,J,Q){let Z=Gk[z];if(Z){let{version:X,new:Y,old:q,message:G}=Z,H=q??z;return(..._)=>{let U=Y?`Please use ${Y} instead. `:"";return W1(`Since ${X} api.${H} is deprecated. ${U}${G??""}`),J.apply(J,_)}}let $=qk[z];if($)return(...X)=>{let Y=Q.rowModel.getType();if(!$.includes(Y)){j2(`api.${z} can only be called when gridOptions.rowModelType is ${$.join(" or ")}`);return}return J.apply(J,X)};return J}var _k={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"},Uk={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},Wk={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"},Bk=new Set(["colorPicker","smallUp","checkboxChecked","checkboxIndeterminate","checkboxUnchecked","radioButtonOn","radioButtonOff","smallDown","smallLeft","smallRight"]),Ek=class extends V{constructor(){super(...arguments);this.beanName="validation"}wireBeans(z){this.gridOptions=z.gridOptions,yG(KF)}warnOnInitialPropertyUpdate(z,J){if(z==="api"&&Yk[J])R(22,{key:J})}processGridOptions(z){this.processOptions(z,UE())}validateApiFunction(z,J){return Hk(z,J,this.beans)}missingUserComponent(z,J,Q,Z){let $=I2[J];if($)this.gos.assertModuleRegistered($,`AG Grid '${z}' component: ${J}`);else R(101,{propertyName:z,componentName:J,agGridDefaults:Q,jsComps:Z})}missingDynamicBean(z){let J=_k[z];return J?Y4(200,{...this.gos.getModuleErrorParams(),moduleName:J,reasonOrId:z}):void 0}checkRowEvents(z){if(Fk.has(z))R(10,{eventType:z})}validateIcon(z){if(Bk.has(z))R(43,{iconName:z});if(Uk[z])return;let J=Wk[z];if(J){t(200,{reasonOrId:`icon '${z}'`,moduleName:J,gridScoped:DZ(),gridId:this.beans.context.getId(),rowModelType:this.gos.get("rowModelType"),additionalText:"Alternatively, use the CSS icon name directly."});return}R(134,{iconName:z})}isProvidedUserComp(z){return!!I2[z]}validateColDef(z){this.processOptions(z,zE())}processOptions(z,J){let{validations:Q,deprecations:Z,allProperties:$,propertyExceptions:X,objectName:Y,docsUrl:q}=J;if($&&this.gridOptions.suppressPropertyNamesCheck!==!0)this.checkProperties(z,[...X??[],...Object.keys(Z)],$,Y,q);let G=new Set;if(Object.keys(z).forEach((_)=>{let U=Z[_];if(U){let{message:D,version:M}=U;G.add(`As of v${M}, ${String(_)} is deprecated. ${D??""}`)}let W=z[_];if(W==null||W===!1)return;let B=Q[_];if(!B)return;let{dependencies:E,validate:K,supportedRowModels:F,expectedType:L}=B;if(L){let D=typeof W;if(D!==L){G.add(`${String(_)} should be of type '${L}' but received '${D}' (${W}).`);return}}if(F){let D=this.gridOptions.rowModelType??"clientSide";if(!F.includes(D)){G.add(`${String(_)} is not supported with the '${D}' row model. It is only valid with: ${F.join(", ")}.`);return}}if(E){let D=this.checkForRequiredDependencies(_,E,z);if(D){G.add(D);return}}if(K){let D=K(z,this.gridOptions,this.beans);if(D){G.add(D);return}}}),G.size>0)for(let _ of G)W1(_)}checkForRequiredDependencies(z,J,Q){let $=Object.entries(J).filter(([X,Y])=>{let q=Q[X];return!Y.required.includes(q)});if($.length===0)return null;return $.map(([X,Y])=>`'${String(z)}' 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,J,Q,Z,$){let X=["__ob__","__v_skip","__metadata__"],Y=Kk(Object.getOwnPropertyNames(z),[...X,...J,...Q],Q),q=Object.keys(Y);for(let G of q){let H=Y[G],_=`invalid ${Z} property '${G}' did you mean any of these: ${H.slice(0,8).join(", ")}.`;if(Q.includes("context"))_+=` +If you are trying to annotate ${Z} with application data, use the '${Z}.context' property instead.`;W1(_)}if(q.length>0&&$){let G=this.beans.frameworkOverrides.getDocLink($);W1(`to see all the valid ${Z} properties please check: ${G}`)}}};function Kk(z,J,Q){let Z={},$=z.filter((X)=>!J.some((Y)=>Y===X));if($.length>0)for(let X of $)Z[X]=rQ({inputValue:X,allSuggestions:Q}).values;return Z}var Fk=new Set(["firstChildChanged","lastChildChanged","childIndexChanged"]),uX={moduleName:"Validation",version:c,beans:[Ek]};var a2=class extends V{constructor(){super(...arguments);this.dispatchColumnChangedEvent=K$,this.columns=[],this.columnIndexMap={},this.updateIndexMap=()=>{this.columnIndexMap={},this.columns.forEach((z,J)=>this.columnIndexMap[z.getId()]=J)}}wireBeans(z){this.colModel=z.colModel,this.aggFuncSvc=z.aggFuncSvc,this.visibleCols=z.visibleCols,this.groupHierarchCols=z.groupHierarchyColSvc}sortColumns(z){let{groupHierarchCols:J}=this;this.columns.sort((Q,Z)=>J?.compareVirtualColumns(Q,Z)??z(Q,Z)),this.updateIndexMap()}setColumns(z,J){this.setColList(z,this.columns,this.eventName,!0,!0,this.columnProcessors.set,J)}addColumns(z,J){this.updateColList(z,this.columns,!0,!0,this.columnProcessors.add,this.eventName,J)}removeColumns(z,J){this.updateColList(z,this.columns,!1,!0,this.columnProcessors.remove,this.eventName,J)}getColumnIndex(z){return this.columnIndexMap[z]}setColList(z=[],J,Q,Z,$,X,Y){let q=this.colModel.getCols();if(!q||q.length===0)return;let G=new Map;J.forEach((_,U)=>G.set(_,U)),J.length=0;for(let _ of z){let U=this.colModel.getColDefCol(_);if(U)J.push(U)}J.forEach((_,U)=>{let W=G.get(_);if(W===void 0){G.set(_,0);return}if(Z&&W!==U)return;G.delete(_)}),this.updateIndexMap();let H=this.colModel.getColDefCols();for(let _ of H??[]){let U=J.indexOf(_)>=0;X(_,U,Y)}if($)this.colModel.refreshCols(!1,Y);this.visibleCols.refresh(Y),this.dispatchColumnChangedEvent(this.eventSvc,Q,[...G.keys()],Y)}updateColList(z=[],J,Q,Z,$,X,Y){if(!z||z.length===0)return;let q=!1,G=new Set;for(let _ of z){if(!_)continue;let U=this.colModel.getColDefCol(_);if(!U)continue;if(G.add(U),Q){if(J.indexOf(U)>=0)continue;J.push(U)}else{let W=J.indexOf(U);if(W<0)continue;for(let B=W+1;B=0;else if(F)if(I)A=M;else if(x)A=S!=null&&S>=0;else A=!1;else A=Q.indexOf(K)>=0;if(A)if(F?f!=null||S!=null:f!=null)Z.push(K);else $.push(K)}let U=(K)=>{let F=K.getColDef();return Y(F)??q(F)};Z.sort((K,F)=>U(K)-U(F));let W=[],B=this.groupHierarchCols,E=(K)=>{if(B)B.expandColumnInto(W,K);else W.push(K)};Z.forEach(E);for(let K of Q)if($.indexOf(K)>=0)E(K);for(let K of $)if(W.indexOf(K)<0)E(K);for(let K of Q)if(W.indexOf(K)<0)X(K,!1,z);for(let K of W)if(Q.indexOf(K)<0)X(K,!0,z);return this.columns=W,this.updateIndexMap(),this.columns}restoreColumnOrder(z,J){let Q=this.columns,Z=this.colModel.getColDefCols();if(!Q.length||!Z)return z;let $=Object.keys(J),X=new Set($),Y=new Set($),q=new Set(Q.map((M)=>{let f=M.getColId();return Y.delete(f),f}).concat($)),G=[],H={},_=0;for(let M=0;M{let f=H[M];for(let S=B;S>>32-$,Q)}ff(z,J,Q,Z,$,X,Y){return this.cmn(J&Q|~J&Z,z,J,$,X,Y)}gg(z,J,Q,Z,$,X,Y){return this.cmn(J&Z|Q&~Z,z,J,$,X,Y)}hh(z,J,Q,Z,$,X,Y){return this.cmn(J^Q^Z,z,J,$,X,Y)}ii(z,J,Q,Z,$,X,Y){return this.cmn(Q^(J|~Z),z,J,$,X,Y)}md51(z){let J=z.length,Q=[1732584193,-271733879,-1732584194,271733878],Z;for(Z=64;Z<=z.length;Z+=64)this.md5cycle(Q,this.md5blk(z.substring(Z-64,Z)));z=z.substring(Z-64);let $=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];for(Z=0;Z>2]|=z.charCodeAt(Z)<<(Z%4<<3);if($[Z>>2]|=128<<(Z%4<<3),Z>55){this.md5cycle(Q,$);for(Z=0;Z<16;Z++)$[Z]=0}return $[14]=J*8,this.md5cycle(Q,$),Q}md5blk(z){let J=[];for(let Q=0;Q<64;Q+=4)J[Q>>2]=z.charCodeAt(Q)+(z.charCodeAt(Q+1)<<8)+(z.charCodeAt(Q+2)<<16)+(z.charCodeAt(Q+3)<<24);return J}rhex(z){let J="0123456789abcdef".split(""),Q="",Z=0;for(;Z<4;Z++)Q+=J[z>>Z*8+4&15]+J[z>>Z*8&15];return Q}hex(z){for(let J=0;J>16)+(J>>16)+(Q>>16)<<16|Q&65535}},RJ={"01":"GRID","02":"CHARTS","0102":"BOTH"};var OY=class z{constructor(J){this.watermarkMessage=void 0,this.totalMessageLength=124,this.document=J,this.md5=new Dk,this.md5.init()}validateLicense(){let J=this.getLicenseDetails(z.licenseKey),Q=`AG Grid ${J.currentLicenseType==="BOTH"?"and AG Charts ":""}Enterprise`,Z=J.suppliedLicenseType===void 0?"":`AG ${J.suppliedLicenseType==="BOTH"?"Grid and AG Charts":J.suppliedLicenseType==="GRID"?"Grid":"Charts"} Enterprise`;if(J.missing){if(!this.isWebsiteUrl()||this.isForceWatermark())this.outputMissingLicenseKey(Q)}else if(J.expired){let $=z.getGridReleaseDate(),X=z.formatDate($);this.outputExpiredKey(J.expiry,X,Q,Z)}else if(!J.valid)this.outputInvalidLicenseKey(!!J.incorrectLicenseType,Q,Z);else if(J.isTrial&&J.trialExpired)this.outputExpiredTrialKey(J.expiry,Q,Z)}static extractExpiry(J){let Q=J.substring(J.lastIndexOf("_")+1,J.length);return new Date(parseInt(z.decode(Q),10))}static extractLicenseComponents(J){let Q=J.replace(/[\u200B-\u200D\uFEFF]/g,"");if(Q=Q.replace(/\r?\n|\r/g,""),J.length<=32)return{md5:null,license:J,version:null,isTrial:null};let Z=Q.length-32,$=Q.substring(Z),X=Q.substring(0,Z),[Y,q,G]=z.extractBracketedInformation(Q);return{md5:$,license:X,version:Y,isTrial:q,type:G}}getLicenseDetails(J){let Q=z.chartsLicenseManager?"BOTH":"GRID";if(!J?.length)return{licenseKey:J,valid:!1,missing:!0,currentLicenseType:Q};let Z=z.getGridReleaseDate(),{md5:$,license:X,version:Y,isTrial:q,type:G}=z.extractLicenseComponents(J),H=$===this.md5.md5(X)&&!J.includes("For_Trialing_ag-Grid_Only"),_=void 0,U=void 0,W=null,B=!1,E=void 0;function K(){_=WW,Y){case"legacy":case"2":{if(q)K();break}case"3":if(!G?.length)H=!1;else if(E=G,G!==RJ["01"]&&G!==RJ["0102"]||Q==="BOTH"&&E!=="BOTH")H=!1,B=!0;else if(q)K()}}if(!H)return{licenseKey:J,valid:H,incorrectLicenseType:B,currentLicenseType:Q,suppliedLicenseType:E};return{licenseKey:J,valid:H,expiry:z.formatDate(W),expired:U,version:Y,isTrial:q,trialExpired:_,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:Z=""}=Q;return Z}isForceWatermark(){let Q=(this.document.defaultView||window).location,{pathname:Z}=Q;return Z?Z.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(J){let Q=["January","February","March","April","May","June","July","August","September","October","November","December"],Z=J.getDate(),$=J.getMonth(),X=J.getFullYear();return Z+" "+Q[$]+" "+X}static getGridReleaseDate(){return new Date(parseInt(z.decode(z.RELEASE_INFORMATION),10))}static decode(J){let Z="",$,X,Y,q,G,H,_,U=0,W=J.replace(/[^A-Za-z0-9+/=]/g,"");while(U>4,X=(G&15)<<4|H>>2,Y=(H&3)<<6|_,Z=Z+String.fromCharCode($),H!=64)Z=Z+String.fromCharCode(X);if(_!=64)Z=Z+String.fromCharCode(Y)}return Z=z.utf8_decode(Z),Z}static utf8_decode(J){J=J.replace(/rn/g,"n");let Q="";for(let Z=0;Z127&&$<2048)Q+=String.fromCharCode($>>6|192),Q+=String.fromCharCode($&63|128);else Q+=String.fromCharCode($>>12|224),Q+=String.fromCharCode($>>6&63|128),Q+=String.fromCharCode($&63|128)}return Q}static setChartsLicenseManager(J){this.chartsLicenseManager=J,this.chartsLicenseManager?.setLicenseKey(this.licenseKey,!0)}static setLicenseKey(J){if(T(this.licenseKey)&&this.licenseKey!==J)a8(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=J,this.chartsLicenseManager?.setLicenseKey(J,!0)}static extractBracketedInformation(J){if(!J.includes("["))return["legacy",!1,void 0];let Q=J.match(/\[(.*?)\]/g).map((q)=>q.replace("[","").replace("]",""));if(!Q||Q.length===0)return["legacy",!1,void 0];let Z=Q.filter((q)=>q==="TRIAL").length===1,$=Q.filter((q)=>q.indexOf("v")===0)[0],X=$?$.replace("v",""):"legacy",Y=RJ[Q.filter((q)=>RJ[q])[0]];return[X,Z,Y]}centerPadAndOutput(J){let Q=this.totalMessageLength-J.length}padAndOutput(J,Q="*",Z=""){}outputInvalidLicenseKey(J,Q,Z){}outputExpiredTrialKey(J,Q,Z){}outputMissingLicenseKey(J){}outputExpiredKey(J,Q,Z,$){}};OY.RELEASE_INFORMATION="MTc3NDQyNTc0Nzc3NQ==";var cX=OY,Mk='.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}',kk={tag:"div",cls:"ag-watermark",children:[{tag:"div",ref:"eLicenseTextRef",cls:"ag-watermark-text"}]},fk=class extends y{constructor(){super(kk);this.eLicenseTextRef=j,this.registerCSS(Mk)}wireBeans(z){this.licenseManager=z.licenseManager}postConstruct(){let z=this.shouldDisplayWatermark();if(this.setDisplayed(z),z)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()}},Vk={selector:"AG-WATERMARK",component:fk},pX=class extends V{constructor(){super(...arguments);this.beanName="licenseManager"}postConstruct(){this.validateLicense()}validateLicense(){let z=this.beans;if(z.withinStudio)this.licenseManager={isDisplayWatermark:()=>!1,getWatermarkMessage:()=>""};else{let J=new cX(Y0(z));this.licenseManager=J,J.validateLicense()}}static getLicenseDetails(z){return new cX(null).getLicenseDetails(z)}getWatermarkSelector(){return Vk}isDisplayWatermark(){return this.licenseManager.isDisplayWatermark()}getWatermarkMessage(){return this.licenseManager.getWatermarkMessage()}static setLicenseKey(z){}static setChartsLicenseManager(z){}},Sk=9525,iX={"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},jJ=`\r +`;function dX(z,J,Q){if(!J&&J!==""&&J!==0)return"";let Z=J;if(typeof J==="boolean"){if(Q)Z=Q(J)}return` ${z}="${Z}"`}function Ak(z={}){let Z=["version"];if(!z.version)z.version="1.0";if(z.encoding)Z.push("encoding");if(z.standalone)Z.push("standalone");return``${X}="${z[X]}"`).join(" ")} ?>`}function PY(z,J){let Q="";if(z.properties){if(z.properties.prefixedAttributes)z.properties.prefixedAttributes.forEach(($)=>{for(let X of Object.keys($.map))Q+=dX($.prefix+X,$.map[X],J)});if(z.properties.rawMap)for(let $ of Object.keys(z.properties.rawMap))Q+=dX($,z.properties.rawMap[$],J)}let Z="<"+z.name+Q;if(!z.children&&z.textNode==null)return Z+"/>"+jJ;if(z.textNode!=null)return Z+">"+z.textNode+""+jJ;if(Z+=">"+jJ,z.children)for(let $ of z.children)Z+=PY($,J);return Z+""+jJ}var Rk=(z)=>{return Math.round(z*96/72)},o2=(z)=>{return Math.ceil(z*Sk)},jk=(z)=>{if(z===void 0)return;let Q=["Automatic","Roman","Swiss","Modern","Script","Decorative"].indexOf(z||"Automatic");return Math.max(Q,0)},IJ=(z,J)=>{if(!J)return;let Q;if(typeof J==="number")Q=J;else Q=J({rowIndex:z});return Q},Ok=(z,J)=>{let{colSpan:Q,column:Z}=z.position;if(!z.width)return;if(Q){let $=J.slice(Z-1,Z+Q-1),X=0;for(let Y=0;Y<$.length;Y++){let q=$[Y].getActualWidth();if(z.width{let{rowSpan:Q,row:Z}=z.position;if(!z.height)return;if(Q){let $=0,X=0;for(let Y=Z;Y{let Q=Ak({encoding:"UTF-8",standalone:"yes"}),Z=PY(z);if(J)return Z;return`${Q}${Z}`},K2=(z)=>{let Z=String.fromCharCode,$=Math.floor(z/26),X=z%26;if(!$||z===26)return Z(65+z-1);if(!X)return K2($-1)+"Z";if($<26)return Z(65+$-1)+Z(65+X-1);return K2($)+Z(65+X-1)},Tk=(z)=>{return z.replaceAll(` +`,"_x000a_")},wJ=(z)=>{if(z==null)return null;let J="";for(let Q=0;Q=0&&Z<=31&&Z!==10){let Y=`_x${Z.toString(16).toUpperCase().padStart(4,"0")}_`;J+=Y}else J+=z[Q]}return J},vk=(z)=>{let J=[];for(let Q of z.keys()){let Z=Q.toString(),$={name:"t",textNode:E0(wJ(Z))};if(Z.trim().length!==Z.length)$.properties={rawMap:{"xml:space":"preserve"}};J.push({name:"si",children:[$]})}return J},Ik=class extends G5{constructor(z){super(z);this.mixedStyles={},this.mixedStyleCounter=0,this.rows=[],this.frozenRowCount=0,this.skipFrozenRows=!1,this.frozenColumnCount=0,this.skipFrozenColumns=!1,this.formulaSvc=z.formulaSvc,this.config=Object.assign({},z),this.workbook=z.workbook,this.stylesByIds={};for(let Q of this.config.baseExcelStyles)this.stylesByIds[Q.id]=Q;let J={id:"_quotePrefix",quotePrefix:1};this.stylesByIds[J.id]=J,this.excelStyles=[...this.config.baseExcelStyles,J]}addCustomContent(z){for(let J of z){let Q=this.rows.length+1,Z;if(!this.config.suppressRowOutline&&J.outlineLevel!=null)Z=J.outlineLevel;let $={height:IJ(Q,J.height||this.config.rowHeight),cells:(J.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 H=this.getStyleId(G);if(q)return this.createCell(H,this.getDataTypeForValue(q.value),q.value==null?"":q.value);let _=X.data?.value??"",U=this.getDataTypeForValue(_);if(X.mergeAcross)return this.createMergedCell(H,U,_,X.mergeAcross);return this.createCell(H,U,_)}),outlineLevel:Z};if(J.collapsed!=null)$.collapsed=J.collapsed;if(J.hidden!=null)$.hidden=J.hidden;this.rows.push($)}}onNewHeaderGroupingRow(){let z=[],{freezeRows:J,headerRowHeight:Q}=this.config;if(this.rows.push({cells:z,height:IJ(this.rows.length+1,Q)}),J)this.frozenRowCount++;return{onColumn:(Z,$,X,Y,q)=>{let G=this.config.styleLinker({rowType:"HEADER_GROUPING",rowIndex:1,value:`grouping-${$}`,columnGroup:Z});z.push({...this.createMergedCell(this.getStyleId(G),this.getDataTypeForValue("string"),$,Y),collapsibleRanges:q})}}}onNewHeaderRow(){let{freezeRows:z,headerRowHeight:J}=this.config;if(z)this.frozenRowCount++;return this.onNewRow(this.onNewHeaderColumn,J)}onNewBodyRow(z){let{freezeRows:J,rowHeight:Q}=this.config;if(!this.skipFrozenRows)if(J==="headersAndPinnedRows"&&z?.rowPinned==="top")this.frozenRowCount++;else if(typeof J==="function")if(J(C(this.gos,{node:z})))this.frozenRowCount++;else this.skipFrozenRows=!0;else this.skipFrozenRows=!0;let Z=this.onNewRow(this.onNewBodyColumn,Q);if(z)this.addRowOutlineIfNecessary(z);return Z}prepare(z){super.prepare(z),this.columnsToExport=[...z],this.cols=z.map((J,Q)=>this.convertColumnToExcel(J,Q))}parse(){let z=this.rows.reduce((Q,Z)=>Math.max(Q,Z.cells.length),0);while(this.cols.length{let Z=this.extractHeaderValue(Q),$=this.config.styleLinker({rowType:"HEADER",rowIndex:z,value:Z,column:Q});J.push(this.createCell(this.getStyleId($),this.getDataTypeForValue("string"),Z))}}onNewBodyColumn(z,J){let Q=0,{freezeColumns:Z,rightToLeft:$}=this.config;return(X,Y,q)=>{if(Q>0){Q-=1;return}if(!this.skipFrozenColumns){let F=X.getPinned();if(Z==="pinned"&&F&&(F===!0||F==="left")!==$)this.frozenColumnCount++;else if(typeof Z==="function"&&Z(C(this.gos,{column:X})))this.frozenColumnCount++;else this.skipFrozenColumns=!0}let{value:G,valueFormatted:H}=this.extractRowCellValue({column:X,node:q,currentColumnIndex:Y,accumulatedRowIndex:z,type:"excel",useRawFormula:!0}),_=G,U=typeof _==="bigint"?_.toString():_,W=this.config.styleLinker({rowType:"BODY",rowIndex:z,value:_,column:X,node:q}),B=this.getStyleId(W),E=X.getColSpan(q),K=this.addImage(z,X,U);if(K)J.push(this.createCell(B,this.getDataTypeForValue(K.value),K.value==null?"":K.value));else if(E>1)Q=E-1,J.push(this.createMergedCell(B,this.getDataTypeForValue(_),U,E-1));else{let F=X.isAllowFormula()&&this.formulaSvc?.isFormula(U),L=this.createCell(B,F?"f":this.getDataTypeForValue(_),F?this.formulaSvc?.updateFormulaByOffset({value:U,rowDelta:z-(q.formulaRowIndex+1),useRefFormat:!1}):U,H);J.push(L)}}}onNewRow(z,J){let Q=[];return this.rows.push({cells:Q,height:IJ(this.rows.length+1,J)}),{onColumn:z.bind(this,this.rows.length,Q)()}}addWorksheetToWorkbook(z){let{excelStyles:J,config:Q}=this;if(this.mapSharedStrings(z),this.frozenColumnCount)Q.frozenColumnCount=this.frozenColumnCount;if(this.frozenRowCount)Q.frozenRowCount=this.frozenRowCount;return this.workbook.addWorksheet(J,z,Q)}mapSharedStrings(z){let J;for(let Q of z.table.rows)for(let Z of Q.cells){let $=Z.data;if(!$||$.type!=="s")continue;let X=$.value;if(X==null)continue;if(X===""){J??(J=this.workbook.getStringPosition("").toString()),$.value=J;continue}$.value=this.workbook.getStringPosition(String(X)).toString()}}getDataTypeForValue(z){if(z===void 0)return"empty";let J="s";try{if(this.isNumerical(z))J="n"}catch(Q){}return J}getTypeFromStyle(z,J){if(this.isFormula(J))return"f";if(z?.dataType)switch(z.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:R(162,{id:z.id,dataType:z.dataType})}return null}addImage(z,J,Q){if(!this.config.addImageToCell)return;let Z=this.config.addImageToCell(z,J,Q);if(!Z)return;return this.workbook.addBodyImageToMap(Z.image,z,J,this.columnsToExport,this.config.rowHeight),Z}createCell(z,J,Q,Z){let $=this.getStyleById(z);if(!$?.dataType&&J==="s"&&Z!=null)Q=Z;let X=this.getTypeFromStyle($,Q)||J,{value:Y,escaped:q}=this.getCellValue(X,Q),G=[];if($)G.push(z);if(q)G.push("_quotePrefix");return z=this.getStyleId(G)||void 0,{styleId:z,data:{type:X,value:Y}}}createMergedCell(z,J,Q,Z){let $=Q==null?"":Q;return{styleId:this.getStyleById(z)?z:void 0,data:{type:J,value:J==="s"?String($):Q},mergeAcross:Z}}getCellValue(z,J){let Q=!1;if(J==null||z==="s"&&J==="")return{value:"",escaped:!1};if(z==="s"){if(J=String(J),J[0]==="'")Q=!0,J=J.slice(1)}else if(z==="f")J=this.addXlfnPrefix(J).slice(1);else if(z==="n"){let Z=Number(J);if(isNaN(Z))J="";else if(J!=="")J=Z.toString()}return{value:J,escaped:Q}}addXlfnPrefix(z){if(!z)return z;let J=/(^|[^A-Z0-9._])(CONCAT)(\s*\()/gi;return z.replace(J,(Q,Z,$,X)=>`${Z}_xlfn.${$}${X}`)}getStyleId(z){if(!z?.length)return null;let J=z.filter((Z)=>this.stylesByIds[Z]!=null);if(!J.length)return null;if(J.length===1)return J[0];let Q=J.join("-");if(!this.mixedStyles[Q])this.addNewMixedStyle(J);return this.mixedStyles[Q].excelID}addNewMixedStyle(z){this.mixedStyleCounter+=1;let J=`mixedStyle${this.mixedStyleCounter}`,Q={};for(let $ of z){let X=this.stylesByIds[$];if(X)K0(Q,X,!0,!0)}Q.id=J;let Z=z.join("-");this.mixedStyles[Z]={excelID:J,key:Z,result:Q},this.excelStyles.push(Q),this.stylesByIds[J]=Q}isFormula(z){if(z==null)return!1;let J=String(z);return this.config.autoConvertFormulas&&Rz(J)}isNumerical(z){if(typeof z==="bigint")return!1;return isFinite(z)&&z!==""&&!isNaN(parseFloat(z))}getStyleById(z){if(z==null)return null;return this.stylesByIds[z]||null}},Ck={getTemplate(z){let{name:J,ContentType:Q,Extension:Z,PartName:$}=z;return{name:J,properties:{rawMap:{Extension:Z,PartName:$,ContentType:Q}}}}},bk=Ck,iJ=(z)=>z==="jpg"?"jpeg":z,yk={getTemplate({sheetLen:z,hasCustomProperties:J}){let Q=Array(z).fill(void 0).map((U,W)=>({name:"Override",ContentType:"application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml",PartName:`/xl/worksheets/sheet${W+1}.xml`})),Z=N1.size,$=Q1.size,X={};Q6.forEach((U)=>{X[iJ(U.type)]=!0});let Y=Array(Z).fill(void 0).map((U,W)=>({name:"Override",ContentType:"application/vnd.openxmlformats-officedocument.drawing+xml",PartName:`/xl/drawings/drawing${W+1}.xml`})),q=[];d4.forEach(({name:U})=>{q.push({name:"Override",ContentType:"application/vnd.openxmlformats-officedocument.spreadsheetml.table+xml",PartName:`/xl/tables/${U}.xml`})});let G=J?[{name:"Override",ContentType:"application/vnd.openxmlformats-officedocument.custom-properties+xml",PartName:"/docProps/custom.xml"}]:[],H=Object.keys(X).map((U)=>({name:"Default",ContentType:`image/${U}`,Extension:U}));if($)H.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)=>bk.getTemplate(U));return{name:"Types",properties:{rawMap:{xmlns:"http://schemas.openxmlformats.org/package/2006/content-types"}},children:_}}},xk=yk,wk={getTemplate(z){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:z},{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}]}}},Nk=wk,gk="{D5CDD505-2E9C-101B-9397-08002B2CF9AE}",hk=(z)=>{return Object.keys(z).filter((Q)=>Q&&z[Q]!=null).map((Q,Z)=>({name:"property",properties:{rawMap:{fmtid:gk,pid:(Z+2).toString(),name:E0(Q)??""}},children:[{name:"vt:lpwstr",textNode:E0(wJ(String(z[Q])))??""}]}))},uk={getTemplate(z){return{name:"Properties",properties:{rawMap:{xmlns:"http://schemas.openxmlformats.org/officeDocument/2006/custom-properties","xmlns:vt":"http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes"}},children:hk(z)}}},mk=uk,nX=(z,J)=>({name:`xdr:${z}`,children:[{name:"xdr:col",textNode:J.col.toString()},{name:"xdr:colOff",textNode:J.offsetX.toString()},{name:"xdr:row",textNode:J.row.toString()},{name:"xdr:rowOff",textNode:J.offsetY.toString()}]}),ck=(z)=>{let J=[{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(z.recolor?.toLowerCase()){case"grayscale":case"sepia":case"washout":J.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:J}},pk=(z,J)=>({name:"xdr:nvPicPr",children:[{name:"xdr:cNvPr",properties:{rawMap:{id:J,name:z.id,descr:z.altText!=null?z.altText:void 0}},children:[ck(z)]},{name:"xdr:cNvPicPr",properties:{rawMap:{preferRelativeResize:"0"}},children:[{name:"a:picLocks"}]}]}),tX=(z)=>{if(!z.saturation&&!z.tint)return;let J=[];if(z.saturation)J.push({name:"a:satMod",properties:{rawMap:{val:z.saturation*1000}}});if(z.tint)J.push({name:"a:tint",properties:{rawMap:{val:z.tint*1000}}});return J},ik=(z,J)=>{return{name:"a:duotone",children:[{name:"a:prstClr",properties:{rawMap:{val:z.color}},children:tX(z)},{name:"a:srgbClr",properties:{rawMap:{val:J.color}},children:tX(J)}]}},dk=(z,J)=>{let Q;if(z.transparency){let Z=Math.min(Math.max(z.transparency,0),100);Q=[{name:"a:alphaModFix",properties:{rawMap:{amt:1e5-Math.round(Z*1000)}}}]}if(z.recolor){if(!Q)Q=[];switch(z.recolor.toLocaleLowerCase()){case"grayscale":Q.push({name:"a:grayscl"});break;case"sepia":Q.push(ik({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${J}`,"xmlns:r":"http://schemas.openxmlformats.org/officeDocument/2006/relationships"}},children:Q},{name:"a:stretch",children:[{name:"a:fillRect"}]}]}},nk=(z,J)=>{let Q={name:"a:xfrm",children:[{name:"a:off",properties:{rawMap:{x:0,y:0}}},{name:"a:ext",properties:{rawMap:{cx:J.width,cy:J.height}}}]};if(z.rotation){let X=z.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"}]}]}},tk=(z)=>{z.fitCell=!!z.fitCell||!z.width||!z.height;let{position:J={},fitCell:Q,width:Z=0,height:$=0,totalHeight:X,totalWidth:Y}=z,{offsetX:q=0,offsetY:G=0,row:H=1,rowSpan:_=1,column:U=1,colSpan:W=1}=J;return{from:{row:H-1,col:U-1,offsetX:o2(q),offsetY:o2(G)},to:{row:H-1+(Q?1:_-1),col:U-1+(Q?1:W-1),offsetX:o2(Z+q),offsetY:o2($+G)},height:o2(X||$),width:o2(Y||Z)}},rk=(z,J,Q,Z)=>{return{name:"xdr:pic",children:[pk(z,J+1),dk(z,Q+1),nk(z,Z)]}},sk={getTemplate(z){let{sheetIndex:J}=z,Q=N1.get(J),Z=Z6.get(J),$=Q.map((X,Y)=>{let q=tk(X);return{name:"xdr:twoCellAnchor",properties:{rawMap:{editAs:"absolute"}},children:[nX("from",q.from),nX("to",q.to),rk(X,Y,Z.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:$}}},lk=sk,ak={getTemplate(z){let{Id:J,Type:Q,Target:Z}=z;return{name:"Relationship",properties:{rawMap:{Id:J,Type:Q,Target:Z}}}}},ok=ak,ek={getTemplate(z){let J=z.map((Q)=>ok.getTemplate(Q));return{name:"Relationships",properties:{rawMap:{xmlns:"http://schemas.openxmlformats.org/package/2006/relationships"}},children:J}}},Zz=ek,zf={getTemplate(z){return{name:"sst",properties:{rawMap:{xmlns:"http://schemas.openxmlformats.org/spreadsheetml/2006/main",count:z.size,uniqueCount:z.size}},children:vk(z)}}},Jf=zf,Qf=(z)=>{switch(z){case 1:return"thin";case 2:return"medium";case 3:return"thick";default:return"hair"}},Zf={None:"None",Dot:"Dotted",Dash:"Dashed",Double:"Double",DashDot:"DashDot",DashDotDot:"DashDotDot",SlantDashDot:"SlantDashDot",Continuous:"Continuous"},$f=["Dashed","DashDot","DashDotDot"],Xf={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"},Yf={Automatic:"general",Left:"left",Center:"center",Right:"right",Fill:"fill",Justify:"justify",CenterAcrossSelection:"centerContinuous",Distributed:"distributed",JustifyDistributed:"justify"},qf={Automatic:void 0,Top:"top",Bottom:"bottom",Center:"center",Justify:"justify",Distributed:"distributed",JustifyDistributed:"justify"},Gf=(z)=>{if(!z)return"none";return Xf[z]||z},x1=(z)=>{if(z==null)return z;if(z.charAt(0)==="#")z=z.substring(1);return z.length===6?"FF"+z:z},OJ=(z,J)=>{if(!z)return"thin";let Q=Qf(J);if(z==="Continuous")return Q;let Z=Zf[z];if(Q==="medium"&&$f.some(($)=>$===Z))return`medium${Z}`;return`${Z.charAt(0).toLowerCase()}${Z.substring(1)}`},Hf=(z)=>{return Yf[z]||"general"},_f=(z)=>{return qf[z]||void 0},n6=(z)=>{return{name:"color",properties:{rawMap:{rgb:x1(z||"#000000")}}}},Uf={getTemplate(z){let{left:J,right:Q,top:Z,bottom:$,diagonal:X}=z,Y=J?[n6(J.color)]:void 0,q=Q?[n6(Q.color)]:void 0,G=Z?[n6(Z.color)]:void 0,H=$?[n6($.color)]:void 0,_=X?[n6(X.color)]:void 0;return{name:"border",children:[{name:"left",properties:{rawMap:{style:J?.style}},children:Y},{name:"right",properties:{rawMap:{style:Q?.style}},children:q},{name:"top",properties:{rawMap:{style:Z?.style}},children:G},{name:"bottom",properties:{rawMap:{style:$?.style}},children:H},{name:"diagonal",properties:{rawMap:{style:X?.style}},children:_}]}}},Wf=Uf,Bf={getTemplate(z){return{name:"borders",properties:{rawMap:{count:z.length}},children:z.map((J)=>Wf.getTemplate(J))}}},Ef=Bf,Kf=(z)=>{let Q=["Context","LeftToRight","RightToLeft"].indexOf(z);return Math.max(Q,0)},Ff={getTemplate(z){let{horizontal:J,indent:Q,readingOrder:Z,rotate:$,shrinkToFit:X,vertical:Y,wrapText:q}=z;return{name:"alignment",properties:{rawMap:{horizontal:J&&Hf(J),indent:Q,readingOrder:Z&&Kf(Z),textRotation:$,shrinkToFit:X,vertical:Y&&_f(Y),wrapText:q}}}}},Lf=Ff,Df={getTemplate(z){let J=z.protected===!1?0:1;return{name:"protection",properties:{rawMap:{hidden:z.hideFormula===!0?1:0,locked:J}}}}},Mf=Df,kf={getTemplate(z){let{alignment:J,borderId:Q,fillId:Z,fontId:$,numFmtId:X,protection:Y,quotePrefix:q,xfId:G}=z,H=[];if(J)H.push(Lf.getTemplate(J));if(Y)H.push(Mf.getTemplate(Y));return{name:"xf",properties:{rawMap:{applyAlignment:J?1:void 0,applyProtection:Y?1:void 0,applyBorder:Q?1:void 0,applyFill:Z?1:void 0,borderId:Q,fillId:Z,applyFont:$?1:void 0,fontId:$,applyNumberFormat:X?1:void 0,numFmtId:X,quotePrefix:q?1:void 0,xfId:G}},children:H.length?H:void 0}}},TY=kf,ff={getTemplate(z){return{name:"cellStyleXfs",properties:{rawMap:{count:z.length}},children:z.map((J)=>TY.getTemplate(J))}}},Vf=ff,Sf={getTemplate(z){let{builtinId:J,name:Q,xfId:Z}=z;return{name:"cellStyle",properties:{rawMap:{builtinId:J,name:Q,xfId:Z}}}}},Af=Sf,Rf={getTemplate(z){return{name:"cellStyles",properties:{rawMap:{count:z.length}},children:z.map((J)=>Af.getTemplate(J))}}},jf=Rf,Of={getTemplate(z){return{name:"cellXfs",properties:{rawMap:{count:z.length}},children:z.map((J)=>TY.getTemplate(J))}}},Pf=Of,Tf={getTemplate(z){let{patternType:J,fgTheme:Q,fgTint:Z,fgRgb:$,bgRgb:X,bgIndexed:Y}=z,q={name:"patternFill",properties:{rawMap:{patternType:J}}};if(Q||Z||$)q.children=[{name:"fgColor",properties:{rawMap:{theme:Q,tint:Z,rgb:$}}}];if(Y||X){if(!q.children)q.children=[];q.children.push({name:"bgColor",properties:{rawMap:{indexed:Y,rgb:X}}})}return{name:"fill",children:[q]}}},vf=Tf,If={getTemplate(z){return{name:"fills",properties:{rawMap:{count:z.length}},children:z.map((J)=>vf.getTemplate(J))}}},Cf=If,bf={getTemplate(z){let{size:J,colorTheme:Q,color:Z="FF000000",fontName:$="Calibri",family:X,scheme:Y,italic:q,bold:G,strikeThrough:H,outline:_,shadow:U,underline:W,verticalAlign:B}=z,E=[{name:"sz",properties:{rawMap:{val:J}}},{name:"color",properties:{rawMap:{theme:Q,rgb:Z}}},{name:"name",properties:{rawMap:{val:$}}}];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(H)E.push({name:"strike"});if(_)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}}},yf=bf,xf={getTemplate(z){return{name:"fonts",properties:{rawMap:{count:z.length}},children:z.map((J)=>yf.getTemplate(J))}}},wf=xf;function Nf(z){let J=z.split(/(\[[^\]]*\])/);for(let Q=0;Qhf.getTemplate(J))}}},mf=uf,NJ,e2,s6,l6,a6,vY,gJ,IY,i5,CY=(z,J)=>{if(z.includes("mixedStyle")&&J>1)z+=`_${J}`;return z},bY=()=>{NJ={base:0},e2=[],s6=[{fontName:"Calibri",colorTheme:"1",family:"2",scheme:"minor"}],l6=[{patternType:"none"},{patternType:"gray125"}],a6=[{left:void 0,right:void 0,top:void 0,bottom:void 0,diagonal:void 0}],vY=[{borderId:0,fillId:0,fontId:0,numFmtId:0}],gJ=[{borderId:0,fillId:0,fontId:0,numFmtId:0,xfId:0}],IY=[{builtinId:0,name:"Normal",xfId:0}]},cf=(z)=>{let J=Gf(z.pattern),Q=x1(z.color),Z=x1(z.patternColor),$=l6.findIndex((X)=>{let{patternType:Y,fgRgb:q,bgRgb:G}=X;return!(Y!=J||q!=Q||G!=Z)});if($===-1)$=l6.length,l6.push({patternType:J,fgRgb:Q,bgRgb:Z});return $},pf=(z)=>{if(iX[z])return iX[z];let J=e2.findIndex((Q)=>Q.formatCode===z);if(J===-1)J=e2.length+164,e2.push({formatCode:z,numFmtId:J});else J=e2[J].numFmtId;return J},df=(z)=>{let{borderBottom:J,borderTop:Q,borderLeft:Z,borderRight:$}=z,X,Y,q,G,H,_,U,W;if(Z)q=OJ(Z.lineStyle,Z.weight),U=x1(Z.color);if($)G=OJ($.lineStyle,$.weight),W=x1($.color);if(J)X=OJ(J.lineStyle,J.weight),H=x1(J.color);if(Q)Y=OJ(Q.lineStyle,Q.weight),_=x1(Q.color);let B=a6.findIndex((E)=>{let{left:K,right:F,top:L,bottom:D}=E;if(!K&&(q||U))return!1;if(!F&&(G||W))return!1;if(!L&&(Y||_))return!1;if(!D&&(X||H))return!1;let{style:M,color:f}=K||{},{style:S,color:A}=F||{},{style:O,color:v}=L||{},{style:I,color:x}=D||{};if(M!=q||f!=U)return!1;if(S!=G||A!=W)return!1;if(O!=Y||v!=_)return!1;if(I!=X||x!=H)return!1;return!0});if(B===-1)B=a6.length,a6.push({left:{style:q,color:U},right:{style:G,color:W},top:{style:Y,color:_},bottom:{style:X,color:H},diagonal:{style:void 0,color:void 0}});return B},nf=(z)=>{let{fontName:J="Calibri",color:Q,size:Z,bold:$,italic:X,outline:Y,shadow:q,strikeThrough:G,underline:H,family:_,verticalAlign:U}=z,W=x1(Q),B=jk(_),E=H?H.toLocaleLowerCase():void 0,K=U?U.toLocaleLowerCase():void 0,F=s6.findIndex((L)=>{return!(L.fontName!=J||L.color!=W||L.size!=Z||L.bold!=$||L.italic!=X||L.outline!=Y||L.shadow!=q||L.strikeThrough!=G||L.underline!=E||L.verticalAlign!=K||L.family!=B)});if(F===-1)F=s6.length,s6.push({fontName:J,color:W,size:Z,bold:$,italic:X,outline:Y,shadow:q,strikeThrough:G,underline:E,verticalAlign:K,family:B!=null?B.toString():void 0});return F},tf=(z)=>{let{alignment:J,borders:Q,font:Z,interior:$,numberFormat:X,protection:Y,quotePrefix:q}=z,{id:G}=z,H=0,_=0,U=0,W=0;if(!G)return;if(G=CY(G,i5),NJ[G]!=null)return;if($)H=cf($);if(Q)_=df(Q);if(Z)U=nf(Z);if(X)W=pf(X.format);NJ[G]=gJ.length,gJ.push({alignment:J,borderId:_||0,fillId:H||0,fontId:U||0,numFmtId:W||0,protection:Y,quotePrefix:q,xfId:0})},rf={getTemplate(z){let J=mf.getTemplate(e2),Q=wf.getTemplate(s6.map((G)=>({...G,size:G.size!=null?G.size:z}))),Z=Cf.getTemplate(l6),$=Ef.getTemplate(a6),X=Vf.getTemplate(vY),Y=Pf.getTemplate(gJ),q=jf.getTemplate(IY);return bY(),{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:[J,Q,Z,$,X,Y,q,{name:"tableStyles",properties:{rawMap:{count:0,defaultPivotStyle:"PivotStyleLight16",defaultTableStyle:"TableStyleMedium2"}}}]}}},sf=(z,J)=>{return NJ[CY(z,J)]||0},lf=(z,J)=>{if(i5=J,i5===1)bY();z.forEach(tf)},af=rf,of={getTemplate(z,J){let{name:Q,columns:Z,rowRange:$,displayName:X,showRowStripes:Y,showColumnStripes:q,showFilterButtons:G,highlightFirstColumn:H,highlightLastColumn:_}=z||{},U=!$||$[0]-$[1]===0;if(!z||!Q||!Array.isArray(Z)||!Z.length||U)return{name:"table"};let W=Z.map((D,M)=>({name:"filterColumn",properties:{rawMap:{colId:M.toString(),hiddenButton:G[M]?0:1}}})),B=`A${$[0]}`,E=`${K2(Z.length)}${$[1]}`,K=`${B}:${E}`,F=`${J+1}`,L=J?`${X}_${F}`: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:L,displayName:L,ref:K,totalsRowShown:0,id:F}},children:[{name:"autoFilter",properties:{rawMap:{ref:K}},children:W},{name:"tableColumns",properties:{rawMap:{count:Z.length}},children:Z.map((D,M)=>({name:"tableColumn",properties:{rawMap:{id:(M+1).toString(),name:E0(Tk(D)),dataCellStyle:"Normal"}}}))},{name:"tableStyleInfo",properties:{rawMap:{name:"TableStyleLight1",showFirstColumn:H?1:0,showLastColumn:_?1:0,showRowStripes:Y?1:0,showColumnStripes:q?1:0}}}]}}},ef=of,L4=(z)=>{let[J,Q,Z,$]=z;return{name:`a:${J}`,children:[{name:`a:${Q}`,properties:{rawMap:{val:Z,lastClr:$}}}]}},zV={getTemplate(){return{name:"a:clrScheme",properties:{rawMap:{name:"Office"}},children:[L4(["dk1","sysClr","windowText","000000"]),L4(["lt1","sysClr","window","FFFFFF"]),L4(["dk2","srgbClr","44546A"]),L4(["lt2","srgbClr","E7E6E6"]),L4(["accent1","srgbClr","4472C4"]),L4(["accent2","srgbClr","ED7D31"]),L4(["accent3","srgbClr","A5A5A5"]),L4(["accent4","srgbClr","FFC000"]),L4(["accent5","srgbClr","5B9BD5"]),L4(["accent6","srgbClr","70AD47"]),L4(["hlink","srgbClr","0563C1"]),L4(["folHlink","srgbClr","954F72"])]}}},JV=zV,P=(z)=>{let[J,Q,Z,$]=z;return{name:`a:${J}`,properties:{rawMap:{script:Z,typeface:Q,panose:$}}}},QV={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"])]}]}}},ZV=QV,i4=(z,J,Q)=>({name:`a:${z}`,properties:{rawMap:{val:J}},children:Q}),I5=(z)=>{let[J,Q,Z,$,X,Y]=z,q=[];if(q.push(i4("satMod",Z)),$)q.push(i4("lumMod",$));if(X)q.push(i4("tint",X));if(Y)q.push(i4("shade",Y));return{name:"a:gs",properties:{rawMap:{pos:J}},children:[{name:"a:schemeClr",properties:{rawMap:{val:Q}},children:q}]}},hJ=(z,J)=>({name:"a:solidFill",children:[i4("schemeClr",z,J)]}),d5=(z)=>{let[J,Q,Z,$,X]=z,[Y,q]=X;return{name:"a:gradFill",properties:{rawMap:{rotWithShape:J}},children:[{name:"a:gsLst",children:[I5(Q),I5(Z),I5($)]},{name:"a:lin",properties:{rawMap:{ang:Y,scaled:q}}}]}},C5=(z)=>{let[J,Q,Z,$]=z;return{name:"a:ln",properties:{rawMap:{w:J,cap:Q,cmpd:Z,algn:$}},children:[hJ("phClr"),i4("prstDash","solid"),{name:"a:miter",properties:{rawMap:{lim:"800000"}}}]}},b5=(z)=>{let J=[];if(z){let[Q,Z,$,X,Y]=z;J.push({name:"a:outerShdw",properties:{rawMap:{blurRad:Q,dist:Z,dir:$,algn:X,rotWithShape:Y}},children:[i4("srgbClr","000000",[i4("alpha","63000")])]})}return{name:"a:effectStyle",children:[Object.assign({},{name:"a:effectLst"},J.length?{children:J}:{})]}},$V=()=>({name:"a:fillStyleLst",children:[hJ("phClr"),d5(["1",["0","phClr","105000","110000","67000"],["50000","phClr","103000","105000","73000"],["100000","phClr","109000","105000","81000"],["5400000","0"]]),d5(["1",["0","phClr","103000","102000","94000"],["50000","phClr","110000","100000",void 0,"100000"],["100000","phClr","120000","99000",void 0,"78000"],["5400000","0"]])]}),XV=()=>({name:"a:lnStyleLst",children:[C5(["6350","flat","sng","ctr"]),C5(["12700","flat","sng","ctr"]),C5(["19050","flat","sng","ctr"])]}),YV=()=>({name:"a:effectStyleLst",children:[b5(),b5(),b5(["57150","19050","5400000","ctr","0"])]}),qV=()=>({name:"a:bgFillStyleLst",children:[hJ("phClr"),hJ("phClr",[i4("tint","95000"),i4("satMod","170000")]),d5(["1",["0","phClr","150000","102000","93000","98000"],["50000","phClr","130000","103000","98000","90000"],["100000","phClr","120000",void 0,void 0,"63000"],["5400000","0"]])]}),GV={getTemplate(){return{name:"a:fmtScheme",properties:{rawMap:{name:"Office"}},children:[$V(),XV(),YV(),qV()]}}},HV=GV,_V={getTemplate(){return{name:"a:themeElements",children:[JV.getTemplate(),ZV.getTemplate(),HV.getTemplate()]}}},UV=_V,WV={getTemplate(){return{name:"a:theme",properties:{prefixedAttributes:[{prefix:"xmlns:",map:{a:"http://schemas.openxmlformats.org/drawingml/2006/main"}}],rawMap:{name:"Office Theme"}},children:[UV.getTemplate(),{name:"a:objectDefaults"},{name:"a:extraClrSchemeLst"}]}}},BV=WV,EV=()=>({name:"o:shapelayout",properties:{prefixedAttributes:[{prefix:"v:",map:{ext:"edit"}}]},children:[{name:"o:idmap",properties:{prefixedAttributes:[{prefix:"v:",map:{ext:"edit"}}],rawMap:{data:"1"}}}]}),KV=()=>({name:"v:stroke",properties:{rawMap:{joinstyle:"miter"}}}),FV=(z)=>({name:"v:formulas",children:z.map((J)=>({name:"v:f",properties:{rawMap:{eqn:J}}}))}),LV=()=>({name:"v:path",properties:{prefixedAttributes:[{prefix:"o:",map:{connecttype:"rect",extrusionok:"f"}}],rawMap:{gradientshapeok:"t"}}}),yY=(z)=>{let{aspectratio:J,rotation:Q}=z||{},Z={};if(J)Z.aspectratio="t";if(Q)Z.rotation="t";return{name:"o:lock",properties:{prefixedAttributes:[{prefix:"v:",map:{ext:"edit"}}],rawMap:Z}}};function DV(z,J,Q,Z,$){return(z-J)/(Q-J)*($-Z)+Z}var MV=(z,J)=>{let Q,{recolor:Z,brightness:$,contrast:X,id:Y}=z;if(Z){if(Q={},Z==="Washout"||Z==="Grayscale")Q.gain="19661f",Q.blacklevel="22938f";if(Z==="Black & White"||Z==="Grayscale"){if(Q.grayscale="t",Z==="Black & White")Q.bilevel="t"}}if(!Z||Z==="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($!=null&&$!==50)Q.blacklevel=DV($,0,100,-0.5,0.5).toString()}return{name:"v:imagedata",properties:{prefixedAttributes:[{prefix:"o:",map:{relid:`rId${J}`,title:Y}}],rawMap:Q}}},kV=()=>{let z=["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:[KV(),FV(z),LV(),yY({aspectratio:!0})]}},rX=(z)=>Math.floor((z??0)*0.74999943307122),fV=(z,J)=>{let{width:Q=0,height:Z=0,altText:$}=z,X=rX(Q),Y=rX(Z);return{name:"v:shape",properties:{rawMap:{id:z.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: ${J+1}`,type:"#_x0000_t75",alt:$}},children:[MV(z,J+1),yY({rotation:!0})]}},VV={getTemplate(z){let J=Q1.get(z.sheetIndex)||[],Q=[EV(),kV(),...J.map((Z,$)=>fV(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}}},SV=VV,AV={getTemplate(z,J){let Q=(J+1).toString();return{name:"sheet",properties:{rawMap:{name:z,sheetId:Q,"r:id":`rId${Q}`}}}}},RV=AV,jV={getTemplate(z){return{name:"sheets",children:z.map((J,Q)=>RV.getTemplate(J,Q))}}},OV=jV,PV={getTemplate(z,J){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:J}}}]},OV.getTemplate(z)]}}},TV=PV,vV=(z)=>Math.ceil((z-12)/7+1),IV={getTemplate(z){let{min:J,max:Q,outlineLevel:Z,s:$,width:X,hidden:Y,bestFit:q}=z,G=1,H="0";if(X>1)G=vV(X),H="1";return{name:"col",properties:{rawMap:{min:J,max:Q,outlineLevel:Z!=null?Z:void 0,width:G,style:$,hidden:Y?"1":"0",bestFit:q?"1":"0",customWidth:H}}}}},CV=IV,bV={getTemplate(z){return{name:"mergeCell",properties:{rawMap:{ref:z}}}}},yV=bV,xV=(z)=>{let J=z.charAt(0).toLowerCase();return J==="s"?"inlineStr":J},wV={getTemplate(z,J,Q){let{ref:Z,data:$,styleId:X}=z,{type:Y,value:q}=$||{type:"empty",value:null},G=Y;if(Y==="f")G="str";else if(Y.charAt(0)===Y.charAt(0).toUpperCase())G=xV(Y);let H={name:"c",properties:{rawMap:{r:Z,t:G==="empty"?void 0:G,s:X?sf(X,Q):void 0}}};if(G==="empty")return H;let _;if(G==="str"&&Y==="f")_=[{name:"f",textNode:E0(wJ(q))}];else if(G==="inlineStr")_=[{name:"is",children:[{name:"t",textNode:E0(wJ(q))}]}];else _=[{name:"v",textNode:q}];return Object.assign({},H,{children:_})}},NV=wV,gV=(z,J)=>{let Q=[],Z=0;for(let $=0;$=0;$--){let X=[],Y=z[Q[$].pos];for(let q=1;q<=Y.mergeAcross;q++)X.push({ref:`${K2(Q[$].excelPos+1+q)}${J+1}`,styleId:Y.styleId,data:{type:"empty",value:null}});if(X.length)z.splice(Q[$].pos+1,0,...X)}},hV=(z)=>z.data?.value!==""||z.styleId!==void 0,uV={getTemplate(z,J,Q){let{collapsed:Z,hidden:$,height:X,outlineLevel:Y,cells:q=[]}=z;gV(q,J);let G=q.filter(hV).map((H,_)=>NV.getTemplate(H,_,Q));return{name:"row",properties:{rawMap:{r:J+1,collapsed:Z?"1":"0",hidden:$?"1":"0",ht:X,customHeight:X!=null?"1":"0",spans:"1:1",outlineLevel:Y||void 0}},children:G}}},mV=uV,cV=(z,J,Q)=>{let Z=[],$=[];z.forEach((q,G)=>{let H=q.cells,_=0,U;H.forEach((W,B)=>{let E=B+_+1,K=K2(E),F=G+1;if(W.mergeAcross){_+=W.mergeAcross;let D=K2(B+_+1);Z.push(`${K}${F}:${D}${F}`)}if(!J[E-1])J[E-1]={};let{collapsibleRanges:L}=W;if(L)L.forEach((D)=>{$.push([E+D[0],E+D[1]])});U=J[E-1],U.min=E,U.max=E,W.ref=`${K}${F}`})}),$.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 $.filter((q)=>{let G=q.toString();if(X.get(G))return!1;return X.set(G,!0),!0}).forEach((q)=>{let G=J.find((_)=>_.min==q[0]&&_.max==q[1]),H=Y.get(q[0]);J.push({min:q[0],max:q[1],outlineLevel:Q?void 0:H||1,width:(G||{width:100}).width}),Y.set(q[0],(H||0)+1)}),Z},pV=(z)=>{if(!z||z!=="Portrait"&&z!=="Landscape")return"portrait";return z.toLocaleLowerCase()},iV=(z)=>{if(z==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(z);return Q===-1?1:Q+1},dV=(z)=>{let J={"&[Page]":"&P","&[Pages]":"&N","&[Date]":"&D","&[Time]":"&T","&[Tab]":"&A","&[Path]":"&Z","&[File]":"&F","&[Picture]":"&G"};for(let Q of Object.keys(J))z=z.replace(Q,J[Q]);return z},nV=(z)=>{if(z==="Center")return"C";if(z==="Right")return"R";return"L"},tV=(z,J)=>{if(!J)return z;if(z+="&"",z+=J.fontName||"Calibri",J.bold!==J.italic)z+=J.bold?",Bold":",Italic";else if(J.bold)z+=",Bold Italic";else z+=",Regular";if(z+=""",J.size)z+=`&${J.size}`;if(J.strikeThrough)z+="&S";if(J.underline)z+=`&${J.underline==="Double"?"E":"U"}`;if(J.color)z+=`&K${J.color.replace("#","").toUpperCase()}`;return z},rV=(z,J,Q)=>z.reduce((Z,$,X)=>{let Y=nV($.position),q=tV(`${Z}&${Y}`,$.font),G=["Left","Center","Right"];if(!$.position)$.position=G[X];let{image:H}=$;if($.value==="&[Picture]"&&H){let _=`${Y}${J}${Q}`;xY(H,_)}return`${q}${E0(dV($.value))}`},""),sV=(z)=>{let J=["all","first","even"],Q=[];return J.forEach((Z)=>{let $=z[Z],X=Z==="all"?"odd":Z;if(!$)return;for(let Y of Object.keys($)){let q=$[Y],G=`${Y.charAt(0).toUpperCase()}${Y.slice(1)}`,H=Y[0].toUpperCase();if(q){let _=Z==="all"?"":Z.toUpperCase();Q.push({name:`${X}${G}`,properties:{rawMap:{"xml:space":"preserve"}},textNode:rV(q,H,_)})}}}),Q},lV=(z)=>{return(J)=>{if(z.length)J.children.push({name:"cols",children:z.map((Q)=>CV.getTemplate(Q))});return J}},aV=(z,J)=>{return(Q)=>{if(z.length)Q.children.push({name:"sheetData",children:z.map((Z,$)=>mV.getTemplate(Z,$,J))});return Q}},oV=(z)=>{let J=z.length;if(!J)return"";let Q=Array(J+1);Q[0]=J;for(let $=1;$<=J;$++)Q[$]=z.charCodeAt($-1)&255;let Z=0;for(let $=Q.length-1;$>=0;$--){let X=Q[$],Y=(Z&16384)===0?0:1,q=Z<<1&32767;Z=(Y|q)^X}return(Z^52811).toString(16).toUpperCase().padStart(4,"0")},eV=(z)=>{return(J)=>{if(!z)return J;let Q=typeof z==="boolean"?{}:z,Z={sheet:1},$=Q.password?oV(Q.password):"";if($)Z.password=$;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;Z[Y]=q?0:1}),J.children.push({name:"sheetProtection",properties:{rawMap:Z}}),J}},zS=(z)=>{return(J)=>{if(z.length)J.children.push({name:"mergeCells",properties:{rawMap:{count:z.length}},children:z.map((Q)=>yV.getTemplate(Q))});return J}},JS=(z)=>{return(J)=>{let{top:Q=0.75,right:Z=0.7,bottom:$=0.75,left:X=0.7,header:Y=0.3,footer:q=0.3}=z;return J.children.push({name:"pageMargins",properties:{rawMap:{bottom:$,footer:q,header:Y,left:X,right:Z,top:Q}}}),J}},QS=(z)=>{return(J)=>{if(z)J.children.push({name:"pageSetup",properties:{rawMap:{horizontalDpi:0,verticalDpi:0,orientation:pV(z.orientation),paperSize:iV(z.pageSize)}}});return J}},ZS=(z)=>{return(J)=>{if(!z)return J;let Q=z.first!=null?1:0,Z=z.even!=null?1:0;return J.children.push({name:"headerFooter",properties:{rawMap:{differentFirst:Q,differentOddEven:Z}},children:sV(z)}),J}},$S=(z)=>{return(J)=>{if(z)J.children.push({name:"tableParts",properties:{rawMap:{count:"1"}},children:[{name:"tablePart",properties:{rawMap:{"r:id":`rId${++J.rIdCounter}`}}}]});return J}},XS=(z)=>{return(J)=>{if(N1.get(z)?.length)J.children.push({name:"drawing",properties:{rawMap:{"r:id":`rId${++J.rIdCounter}`}}});return J}},YS=(z)=>{return(J)=>{if(Q1.get(z))J.children.push({name:"legacyDrawingHF",properties:{rawMap:{"r:id":`rId${++J.rIdCounter}`}}});return J}},qS=(z=0,J=0)=>{let Q=z>0||J>0;return Q?[{name:"pane",properties:{rawMap:{state:Q?"frozen":void 0,topLeftCell:Q?`${K2(z+1)}${J+1}`:void 0,xSplit:z===0?void 0:z,ySplit:J===0?void 0:J}}}]:void 0},GS=(z=!1,J,Q)=>{return(Z)=>{return Z.children.push({name:"sheetViews",children:[{name:"sheetView",properties:{rawMap:{rightToLeft:z===!0?"1":"0",workbookViewId:"0"}},children:qS(J,Q)}]}),Z}},HS=()=>{return(z)=>{return z.children.push({name:"sheetPr",children:[{name:"outlinePr",properties:{rawMap:{summaryBelow:0}}}]}),z}},_S=(z)=>{return(J)=>{let Q=z.reduce((Z,$)=>{if($.outlineLevel&&$.outlineLevel>Z)return $.outlineLevel;return Z},0);return J.children.push({name:"sheetFormatPr",properties:{rawMap:{baseColWidth:10,defaultRowHeight:16,outlineLevelRow:Q?Q:void 0}}}),J}},US={getTemplate(z){let{worksheet:J,currentSheet:Q,config:Z}=z,{margins:$={},pageSetup:X,headerFooterConfig:Y,suppressColumnOutline:q,rightToLeft:G,frozenRowCount:H,frozenColumnCount:_,protectSheet:U}=Z,{table:W}=J,{rows:B,columns:E}=W,K=E?.length?cV(B,E,!!q):[],F=d4.get(Q),{children:L}=[HS(),GS(G,_,H),_S(B),lV(E),aV(B,Q+1),eV(U),zS(K),JS($),QS(X),ZS(Y),XS(Q),YS(Q),$S(F)].reduce((D,M)=>M(D),{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:L}}},WS=US,_2=new Map,o0=[],B2=[],E2=new Map,w1=new Map,N1=new Map,Q1=new Map,Q6=new Map,Z6=new Map,d4=new Map,BS="AG-GRID-TABLE",a5="SINGLE_SHEET";function ES(){return a5}function KS(z){a5=z}function FS(z,J,Q){fS(J),lf(z,o0.length);let Z=Object.assign({},Q);if(Q.exportAsExcelTable&&Q.pivotModeActive)R(163,{featureName:"pivot mode"}),Z.exportAsExcelTable=!1;MS(J,Z);let $=hS(J,Z);return uS($),$}function LS(z){return z.replace(/^[^a-zA-Z_]+/,"_").replace(/\s/g,"_").replace(/[^a-zA-Z0-9_]/g,"_")}function DS(z,J){if(d4.has(z)){R(164);return}d4.set(z,J)}function MS(z,J){let{exportAsExcelTable:Q,prependContent:Z,appendContent:$,headerRowCount:X=0}=J;if(!Q)return;let Y=typeof Q==="boolean"?{}:Q,{name:q,showColumnStripes:G,showRowStripes:H,showFilterButton:_,highlightFirstColumn:U,highlightLastColumn:W}=Y,B=LS(q||BS),E=o0.length-1,{table:K}=z,{rows:F,columns:L}=K,D=Z?Z.length:0,M=$?$.length:0,f=F.length,S=L.length,A=[],O=[];for(let v=0;vX.id===z.id))$.push(z)}function kS(z,J,Q,Z,$){let X=o0.length,{row:Y,column:q}=z.position||{},G=z;if(Z){if(J!=null&&Q!=null&&(!Y||!q)){if(!z.position)z.position={};z.position=Object.assign({},z.position,{row:J,column:Z.indexOf(Q)+1})}Ok(G,Z),Pk(G,$)}wY({imageToAdd:G,idx:X});let H=Z6.get(X);if(!H)H=new Map,Z6.set(X,H);let _=N1.get(X);if(!_)N1.set(X,[G]);else _.push(G);if(!H.get(z.id))H.set(z.id,{index:H.size,type:z.imageType})}function wY(z){let{imageToAdd:J,idx:Q}=z,Z=w1.get(J.id);if(Z){let $=Z.find((X)=>X.sheetId===Q);if($)$.image.push(J);else Z.push({sheetId:Q,image:[J]})}else w1.set(J.id,[{sheetId:Q,image:[J]}]),Q6.set(J.id,{type:J.imageType,index:Q6.size})}function fS(z){let J=E0(z.name)||"",Q="";while(o0.indexOf(`${J}${Q}`)!==-1)if(Q==="")Q="_1";else Q=`_${parseInt(Q.slice(1),10)+1}`;z.name=`${J}${Q}`,o0.push(z.name)}function VS(z){if(_2.has(z))return _2.get(z);return _2.set(z,_2.size),_2.size-1}function SS(){_2.clear(),w1.clear(),N1.clear(),Q1.clear(),Q6.clear(),Z6.clear(),d4.clear(),o0=[],B2=[],E2=new Map,a5="SINGLE_SHEET"}function AS(z){return N0(TV.getTemplate(o0,z))}function RS(z){return N0(af.getTemplate(z))}function jS(){return N0(Jf.getTemplate(_2))}function OS(z){return N0(Nk.getTemplate(z))}function PS(z){return N0(mk.getTemplate(z))}function TS(z,J){return N0(xk.getTemplate({sheetLen:z,hasCustomProperties:J}))}function vS(z){let J=[{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)J.push({Id:"rId3",Type:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/custom-properties",Target:"docProps/custom.xml"});let Q=Zz.getTemplate(J);return N0(Q)}function IS(){return N0(BV.getTemplate())}function CS(z,J){return N0(ef.getTemplate(z,J))}function bS(z){let J=Array(z).fill(void 0).map((Z,$)=>({Id:`rId${$+1}`,Type:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet",Target:`worksheets/sheet${$+1}.xml`})),Q=Zz.getTemplate([...J,{Id:`rId${z+1}`,Type:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme",Target:"theme/theme1.xml"},{Id:`rId${z+2}`,Type:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles",Target:"styles.xml"},{Id:`rId${z+3}`,Type:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/sharedStrings",Target:"sharedStrings.xml"}]);return N0(Q)}function yS(z){return N0(lk.getTemplate({sheetIndex:z}))}function xS(z){let J=Z6.get(z)||[],Q=[];for(let[Z,$]of J){let{index:X,type:Y}=$;Q.push({Id:`rId${X+1}`,Type:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/image",Target:`../media/image${Q6.get(Z).index+1}.${iJ(Y)}`})}return N0(Zz.getTemplate(Q))}function wS(z){return N0(SV.getTemplate({sheetIndex:z}),!0)}function NS(z){let J=Q1.get(z)||[],Q=[];for(let Z=0;Z{if(!z.size)return;let Q=new Map;J.forEach((Z,$)=>{if(z.has(Z))Q.set($,z.get(Z))}),z.clear(),Q.forEach((Z,$)=>z.set($,Z))},uS=(z)=>{let J=E2.get(z)??[];J.push(o0.length-1),E2.set(z,J),B2.push(z)},mS=(z)=>{let J=new Map(E2),Q=[];for(let Z of z){let $=J.get(Z);if(!$?.length)return null;let X=$.shift();Q.push(X),J.set(Z,$)}return Q},cS=(z)=>{if(!z.length||B2.length===0)return null;let J=new Set,Q=[];for(let Z of z){let $=B2.findIndex((X,Y)=>!J.has(Y)&&X===Z);if($===-1)return null;J.add($),Q.push($)}return Q},pS=(z)=>{let J=new Map;z.forEach((Q,Z)=>J.set(Q,Z)),o0=z.map((Q)=>o0[Q]),B2=z.map((Q)=>B2[Q]),PJ(N1,z),PJ(Q1,z),PJ(d4,z),PJ(Z6,z),w1.forEach((Q)=>{Q.forEach((Z)=>{let $=J.get(Z.sheetId);if($!=null)Z.sheetId=$})}),E2=new Map,B2.forEach((Q,Z)=>{let $=E2.get(Q)??[];$.push(Z),E2.set(Q,$)})},iS=(z)=>{if(z.length<=1)return;let J=mS(z)??cS(z);if(!J)return;pS(J)},o5=class{getStringPosition(z){return VS(z)}addBodyImageToMap(z,J,Q,Z,$){kS(z,J,Q,Z,$)}addHeaderFooterImageToMap(z,J){xY(z,J)}addWorksheet(z,J,Q){return FS(z,J,Q)}syncOrderWithSheetData(z){iS(z)}reset(){SS()}setFactoryMode(z){KS(z)}getFactoryMode(){return ES()}getSheetNames(){return[...o0]}},dS=async(z)=>{let J=0,Q=[],Z=new WritableStream({write:(Y)=>{Q.push(Y),J+=Y.length}}),$=new ReadableStream({start:(Y)=>{let q=new FileReader;q.onload=(G)=>{if(G.target?.result)Y.enqueue(G.target.result);Y.close()},q.readAsArrayBuffer(z)}}),X=new window.CompressionStream("deflate-raw");return await $.pipeThrough(X).pipeTo(Z),{size:J,content:new Blob(Q)}},nS=async(z)=>{let J=new Blob([z]),{size:Q,content:Z}=await dS(J),$=new Uint8Array(await Z.arrayBuffer());return{size:Q,content:$}},tS=(z)=>{let J=z.getHours();return J<<=6,J=J|z.getMinutes(),J<<=5,J=J|z.getSeconds()/2,J},rS=(z)=>{let J=z.getFullYear()-1980;return J<<=4,J=J|z.getMonth()+1,J<<=5,J=J|z.getDate(),J};function w0(z,J){let Q="";for(let Z=0;Z>>=8;return Q}var sX=(z)=>{if(!z.length)return 0;let J=-1,Q=0,Z=0,$=0;for(let X=0;X>>8^$;return J^-1},lX=(z)=>{if(!z.length)return 0;if(typeof z==="string")return sX(new TextEncoder().encode(z));return sX(z)},sS=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 lS(z){let J=String.fromCharCode;function Q(U){let W=[];if(!U)return[];let B=U.length,E=0,K,F;while(E=55296&&K<=56319&&E=55296&&U<=57343)throw Error(Y4(255,{point:U}))}function $(U,W){return J(U>>W&63|128)}function X(U){if((U&4294967168)==0)return J(U);let W="";if((U&4294965248)==0)W=J(U>>6&31|192);else if((U&4294901760)==0)Z(U),W=J(U>>12&15|224),W+=$(U,6);else if((U&4292870144)==0)W=J(U>>18&7|240),W+=$(U,12),W+=$(U,6);return W+=J(U&63|128),W}let Y=Q(z),q=Y.length,G=-1,H,_="";while(++G{let{content:Y,path:q,created:G}=z,H=tS(G),_=rS(G),U=lX($),W=X!==void 0?X:Z,B=lS(q),E=B!==q,K="";if(E){let M=w0(1,1)+w0(lX(B),4)+B;K="up"+w0(M.length,2)+M}let F="\x14\x00"+(E?"\x00\b":"\x00\x00")+w0(J?8:0,2)+w0(H,2)+w0(_,2)+w0(W?U:0,4)+w0(X??Z,4)+w0(Z,4)+w0(B.length,2)+w0(K.length,2),L="PK\x03\x04"+F+B+K,D="PK\x01\x02\x14\x00"+F+"\x00\x00\x00\x00\x00\x00"+(Y?"\x00\x00\x00\x00":"\x10\x00\x00\x00")+w0(Q,4)+B+K;return{localFileHeader:Uint8Array.from(L,(M)=>M.charCodeAt(0)),centralDirectoryHeader:Uint8Array.from(D,(M)=>M.charCodeAt(0))}},gY=(z)=>{let J;if(typeof z==="string"){let Q=atob(z.split(";base64,")[1]);J=Uint8Array.from(Q,(Z)=>Z.charCodeAt(0))}else J=z;return{size:J.length,content:J}},aS=async(z)=>{let{content:J}=z,{size:Q,content:Z}=!J?{size:0,content:Uint8Array.from([])}:gY(J),$,X,Y=!1;if(z.type==="file"&&Z&&Q>0){let G=await nS(Z);$=G.content,X=G.size,Y=!0}return{rawContent:Z,rawSize:Q,deflatedContent:$,deflatedSize:X,isCompressed:Y}},oS=(z,J)=>{let{content:Q}=z,{content:Z}=!Q?{content:Uint8Array.from([])}:gY(Q);return{...NY(z,!1,J,Z.length,Z,void 0),content:Z,isCompressed:!1}},eS=(z,J,Q)=>{let Z="PK\x05\x06\x00\x00\x00\x00"+w0(z,2)+w0(z,2)+w0(J,4)+w0(Q,4)+"\x00\x00";return Uint8Array.from(Z,($)=>$.charCodeAt(0))},hY=class{constructor(){this.folders=[],this.files=[]}addFolders(z){z.forEach(this.addFolder.bind(this))}addFolder(z){this.folders.push({path:z,created:new Date,isBase64:!1,type:"folder"})}addFile(z,J,Q=!1){this.files.push({path:z,created:new Date,content:Q?J:new TextEncoder().encode(J),isBase64:Q,type:"file"})}async getZipFile(z="application/zip"){let J=await this.buildCompressedFileStream();return this.clearStream(),new Blob([J],{type:z})}getUncompressedZipFile(z="application/zip"){let J=this.buildFileStream();return this.clearStream(),new Blob([J],{type:z})}clearStream(){this.folders=[],this.files=[]}packageFiles(z){let J=0,Q=0;for(let H of z){let{localFileHeader:_,centralDirectoryHeader:U,content:W}=H;J+=_.length+W.length,Q+=U.length}let Z=new Uint8Array(J),$=new Uint8Array(Q),X=0,Y=0;for(let H of z){let{localFileHeader:_,centralDirectoryHeader:U,content:W}=H;Z.set(_,X),X+=_.length,Z.set(W,X),X+=W.length,$.set(U,Y),Y+=U.length}let q=eS(z.length,Q,J),G=new Uint8Array(Z.length+$.length+q.length);return G.set(Z),G.set($,Z.length),G.set(q,Z.length+$.length),G}async buildCompressedFileStream(){let z=[...this.folders,...this.files],J=await Promise.all(z.map(aS)),Q=[],Z=0;for(let $=0;${if(z.addFolders(["_rels/","docProps/","xl/","xl/theme/","xl/_rels/","xl/worksheets/"]),!w1.size)return;z.addFolders(["xl/worksheets/_rels","xl/drawings/","xl/drawings/_rels","xl/media/"]);let J=0;w1.forEach((Q)=>{let Z=Q[0].image[0],{base64:$,imageType:X}=Z;z.addFile(`xl/media/image${++J}.${iJ(X)}`,$,!0)})},JA=(z,J)=>{let Q=0,Z=0;for(let $=0;$0&&N1.has($),q=d4.size>0&&d4.get($),G=w1.size&&Q1.has($);if(!Y&&!q&&!G)continue;let H,_,U;if(Y)QA(z,$,Q),_=Q,Q++;if(G)ZA(z,$,Z),U=Z,Z++;if(q)H=q.name;let W=`xl/worksheets/_rels/sheet${$+1}.xml.rels`;z.addFile(W,gS({tableName:H,drawingIndex:_,vmlDrawingIndex:U}))}},QA=(z,J,Q)=>{let $=`xl/drawings/drawing${Q+1}.xml`,X=`xl/drawings/_rels/drawing${Q+1}.xml.rels`;z.addFile(X,xS(J)),z.addFile($,yS(J))},ZA=(z,J,Q)=>{let $=`xl/drawings/vmlDrawing${Q+1}.vml`,X=`xl/drawings/_rels/vmlDrawing${Q+1}.vml.rels`;z.addFile($,wS(J)),z.addFile(X,NS(J))},$A=(z)=>{let J=d4,Q=Array.from(J.keys());for(let Z=0;Z{let Y=!!X&&Object.keys(X).some((q)=>X[q]!=null);if(z.addFile("xl/workbook.xml",AS($)),z.addFile("xl/styles.xml",RS(J)),z.addFile("xl/sharedStrings.xml",jS()),z.addFile("xl/theme/theme1.xml",IS()),z.addFile("xl/_rels/workbook.xml.rels",bS(Z)),z.addFile("docProps/core.xml",OS(Q)),Y)z.addFile("docProps/custom.xml",PS(X));z.addFile("[Content_Types].xml",TS(Z,Y)),z.addFile("_rels/.rels",vS(Y))},uY=(z,J,Q={},Z)=>{if(!J||J.length===0)return R(159),Z.reset(),!1;Z.syncOrderWithSheetData(J);let{fontSize:$=11,author:X="AG Grid",activeTab:Y=0,customMetadata:q}=Q,G=J.length,H=Math.max(Math.min(Y,G-1),0);return zA(z),$A(z),JA(z,J),XA(z,$,X,G,H,q),Z.reset(),!0},aX=(z,J=new o5)=>{let{data:Q,fontSize:Z,author:$,activeSheetIndex:X,customMetadata:Y}=z,q=z.mimeType||"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",G=new hY;if(!uY(G,Q,{author:$,fontSize:Z,activeTab:X,customMetadata:Y},J))return Promise.resolve(void 0);return G.getZipFile(q)},oX=(z,J=new o5)=>{let{data:Q,fontSize:Z,author:$,activeSheetIndex:X,customMetadata:Y}=z,q=z.mimeType||"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",G=new hY;if(!uY(G,Q,{author:$,fontSize:Z,activeTab:X,customMetadata:Y},J))return;return G.getUncompressedZipFile(q)};var YA=class extends q5{constructor(){super(...arguments);this.beanName="excelCreator",this.workbook=new o5}getMergedParams(z){let J=this.gos.get("defaultExcelExportParams");return Object.assign({},J,z)}export(z){if(this.isExportSuppressed()){R(160);return}let J=()=>{let Z=this.getMergedParams(z),$=this.getData(Z),{fontSize:X,author:Y,mimeType:q,customMetadata:G}=Z,H={data:[$],fontSize:X,author:Y,mimeType:q,customMetadata:G};this.packageCompressedFile(H).then((_)=>{if(_){let{fileName:U}=Z,W=typeof U==="function"?U(C(this.gos,{})):U;kJ(this.getFileName(W),_)}})},{overlays:Q}=this.beans;if(Q)Q.showExportOverlay(J);else J()}exportDataAsExcel(z){this.export(z)}getDataAsExcel(z){let J=this.getMergedParams(z),Q=this.getData(J),{fontSize:Z,author:$,mimeType:X,customMetadata:Y}=J,q={data:[Q],fontSize:Z,author:$,mimeType:X,customMetadata:Y};return this.packageFile(q)}setFactoryMode(z){this.workbook.setFactoryMode(z)}getFactoryMode(){return this.workbook.getFactoryMode()}getSheetDataForExcel(z){let J=this.getMergedParams(z);return this.getData(J)}getMultipleSheetsAsExcel(z){return oX(z,this.workbook)}exportMultipleSheetsAsExcel(z){aX(z,this.workbook).then((J)=>{let{fileName:Q="export.xlsx"}=z;if(J){let Z=typeof Q==="function"?Q():Q;kJ(Z,J)}})}getDefaultFileExtension(){return"xlsx"}createSerializingSession(z){let{colModel:J,colNames:Q,rowGroupColsSvc:Z,valueSvc:$,formula:X,gos:Y}=this.beans,q=Y.get("excelStyles")||[],G=this.createStyleLinker(q),H={...z,colModel:J,colNames:Q,rowGroupColsSvc:Z,valueSvc:$,formulaSvc:X,gos:Y,suppressRowOutline:z.suppressRowOutline||z.skipRowGroups,headerRowHeight:z.headerRowHeight||z.rowHeight,baseExcelStyles:q,rightToLeft:z.rightToLeft??Y.get("enableRtl"),styleLinker:G,headerRowCount:u9(J),pivotModeActive:J.isPivotActive(),workbook:this.workbook};return new Ik(H)}createStyleLinker(z){let J=[],Q=new Set,Z=new Map;z.forEach((Y,q)=>{J.push(Y.id),Q.add(Y.id),Z.set(Y.id,q)});let{gos:$,cellStyles:X}=this.beans;return(Y)=>{let{rowType:q,rowIndex:G,value:H,column:_,columnGroup:U,node:W}=Y,B=q==="HEADER",E=q==="HEADER_GROUPING",K=B?_:U,F=[];if(B||E){if(F.push("header"),E)F.push("headerGroup");if(K)F=F.concat(_J(K.getDefinition(),$,_||null,U||null));return F}let L=["cell"];if(!J.length)return L;let D=_.getDefinition();return X?.processAllCellClasses(D,C($,{value:H,data:W.data,node:W,colDef:D,column:_,rowIndex:G}),(M)=>{if(Q.has(M))L.push(M)}),L.sort((M,f)=>{let S=Z.get(M)??-1,A=Z.get(f)??-1;return S===A?0:Sthis.onFocusIn(z),onFocusOut:(z)=>this.onFocusOut(z),focusInnerElement:(z)=>this.focusInnerElement(z),onTabKeyDown:(z)=>this.onTabKeyDown(z),handleKeyDown:(z)=>this.handleKeyDown(z)},this.stopPropagationCallbacks),this.refreshAriaProperties(),this.addManagedEventListeners({stylesChanged:this.onStylesChanged.bind(this)})}onStylesChanged(z){if(z.listItemHeightChanged)this.rowHeight=this.getItemHeight(),this.refresh()}refreshAriaProperties(){let J=this.getLocaleTextFunc()("ariaDefaultListName",this.listName||"List"),Q=this.eContainer;H0(Q,this.model?.getRowCount()>0?this.ariaRole:"presentation"),_0(Q,J)}addResizeObserver(){let z=()=>W4(this.beans,()=>this.drawVirtualRows()),J=P4(this.beans,this.getGui(),z);this.addDestroyFunc(J)}focusInnerElement(z){return this.focusRow(z?this.model.getRowCount()-1:0),!0}onFocusIn(z){let J=z.target;if(J.classList.contains("ag-virtual-list-item"))this.lastFocusedRowIndex=A8(J)-1}onFocusOut(z){if(!this.getFocusableElement().contains(z.relatedTarget))this.lastFocusedRowIndex=null}handleKeyDown(z){let{key:J,shiftKey:Q}=z;switch(J){case k.UP:case k.DOWN:{let Z=J===k.UP;if(z.preventDefault(),Q)this.moveItem(Z);else this.navigate(Z)}break;case k.PAGE_HOME:case k.PAGE_END:case k.PAGE_UP:case k.PAGE_DOWN:if(this.navigateToPage(J)!==null)z.preventDefault();break}}onTabKeyDown(z){this.stopPropagationCallbacks?.stopPropagation(z),this.forceFocusOutOfContainer(z.shiftKey)}getNextRow(z){if(this.lastFocusedRowIndex==null)return;let J=this.lastFocusedRowIndex+(z?-1:1);if(J<0||J>=this.model.getRowCount())return;return J}moveItem(z){if(!this.moveItemCallback)return;let J=this.getComponentAt(this.lastFocusedRowIndex);if(!J)return;this.moveItemCallback(J,z)}navigate(z){let J=this.getNextRow(z);if(J===void 0)return;this.focusRow(J)}navigateToPage(z,J="focused"){let Q=!1;if(J==="focused")J=this.getLastFocusedRow(),Q=!0;let Z=this.model.getRowCount()-1,$=-1;if(z===k.PAGE_HOME)$=0;else if(z===k.PAGE_END)$=Z;else if(z===k.PAGE_DOWN)$=Math.min(J+this.pageSize,Z);else if(z===k.PAGE_UP)$=Math.max(J-this.pageSize,0);if($===-1)return null;if(Q)this.focusRow($);else this.ensureIndexVisible($);return $}getLastFocusedRow(){return this.lastFocusedRowIndex}focusRow(z){if(this.isScrolling)return;this.isScrolling=!0,this.ensureIndexVisible(z),W4(this.beans,()=>{if(this.isScrolling=!1,!this.isAlive())return;let J=this.renderedRows.get(z);if(J)J.eDiv.focus()})}getComponentAt(z){let J=this.renderedRows.get(z);return J&&J.rowComponent}forEachRenderedRow(z){this.renderedRows.forEach((J,Q)=>z(J.rowComponent,Q))}getItemHeight(){if(!this.isHeightFromTheme)return this.rowHeight;return this.beans.environment.getDefaultListItemHeight()}ensureIndexVisible(z,J=!0){let Q=this.model.getRowCount();if(typeof z!=="number"||z<0||z>=Q)return!1;let Z=z*this.rowHeight,$=Z+this.rowHeight,X=this.getGui(),Y=X.scrollTop,q=X.offsetHeight,G=Y+q,H=J?0:this.rowHeight,_=Y>Z+H,U=G<$-H;if(_)return X.scrollTop=Z,!0;if(U){let W=$-q;return X.scrollTop=W,!0}return!1}setComponentCreator(z){this.componentCreator=z}setComponentUpdater(z){this.componentUpdater=z}getRowHeight(){return this.rowHeight}getScrollTop(){return this.getGui().scrollTop}setRowHeight(z){this.isHeightFromTheme=!1,this.rowHeight=z,this.refresh()}refresh(z){if(this.model==null||!this.isAlive())return;let J=this.model.getRowCount();this.eContainer.style.height=`${J*this.rowHeight}px`,this.refreshAriaProperties(),this.awaitStable(()=>{if(!this.isAlive())return;if(this.canSoftRefresh(z))this.drawVirtualRows(!0);else this.clearVirtualRows(),this.drawVirtualRows()})}awaitStable(z){if(this.awaitStableCallbacks.push(z),this.awaitStableCallbacks.length>1)return;let J=this.model.getRowCount();KZ(this,()=>this.eContainer.clientHeight>=J*this.rowHeight,()=>{if(!this.isAlive())return;let Q=this.awaitStableCallbacks;this.awaitStableCallbacks=[];for(let Z of Q)Z()})}canSoftRefresh(z){return!!(z&&this.renderedRows.size&&typeof this.model.areRowsEqual==="function"&&this.componentUpdater)}clearVirtualRows(){this.renderedRows.forEach((z,J)=>this.removeRow(J))}drawVirtualRows(z){if(!this.isAlive()||!this.model)return;let J=this.getGui(),Q=J.scrollTop,Z=Q+J.offsetHeight;if(Q===Z)this.clearVirtualRows();else{let $=Math.floor(Q/this.rowHeight),X=Math.floor(Z/this.rowHeight);this.pageSize=Math.floor((Z-Q)/this.rowHeight),this.ensureRowsRendered($,X,z)}}ensureRowsRendered(z,J,Q){if(this.renderedRows.forEach((Z,$)=>{if(($J)&&$!==this.lastFocusedRowIndex)this.removeRow($)}),Q)this.refreshRows();for(let Z=z;Z<=J;Z++){if(this.renderedRows.has(Z))continue;if(Z=J.getRowCount())return;let{cssIdentifier:Q,ariaRole:Z,renderedRows:$,eContainer:X}=this,Y=J.getRow(z),q=Z==="tree"?"treeitem":"option",G=F0({tag:"div",cls:`ag-virtual-list-item ag-${Q}-virtual-list-item`,role:q,attrs:{tabindex:"-1"}});T6(G,J.getRowCount()),v6(G,z+1);let H=this.rowHeight;G.style.height=`${H}px`,G.style.top=`${H*z}px`;let _=this.componentCreator(Y,G);if(_.addGuiEventListener("focusin",()=>this.lastFocusedRowIndex=z),G.appendChild(_.getGui()),$.has(z-1))$.get(z-1).eDiv.insertAdjacentElement("afterend",G);else if($.has(z+1))$.get(z+1).eDiv.insertAdjacentElement("beforebegin",G);else X.appendChild(G);$.set(z,{rowComponent:_,eDiv:G,value:Y})}removeRow(z){let J=this.renderedRows.get(z);J.eDiv.remove(),this.destroyBean(J.rowComponent),this.renderedRows.delete(z)}refreshRows(){let z=this.model.getRowCount();this.renderedRows.forEach((J,Q)=>{if(Q>=z)this.removeRow(Q);else{let Z=this.model.getRow(Q);if(this.model.areRowsEqual?.(J.value,Z))this.componentUpdater(Z,J.rowComponent);else this.removeRow(Q)}})}addScrollListener(){this.addGuiEventListener("scroll",()=>this.drawVirtualRows(),{passive:!0})}setModel(z){this.model=z}getAriaElement(){return this.eContainer}destroy(){if(!this.isAlive())return;this.clearVirtualRows(),this.awaitStableCallbacks.length=0,super.destroy()}},_A='.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}',y5="ag-list-item-hovered",UA=class extends O0{constructor(z,J,Q){super();this.comp=z,this.virtualList=J,this.params=Q,this.currentDragValue=null,this.lastHoveredListItem=null}postConstruct(){this.beans.environment.addGlobalCSS(_A,"component-AgVirtualListDragFeature"),this.params.addListeners(this,this.listItemDragStart.bind(this),this.listItemDragEnd.bind(this)),this.createDropTarget(),this.createAutoScrollService()}listItemDragStart(z){this.currentDragValue=this.params.getCurrentDragValue(z),this.moveBlocked=this.params.isMoveBlocked(this.currentDragValue)}listItemDragEnd(){window.setTimeout(()=>{this.currentDragValue=null,this.moveBlocked=!1},10)}createDropTarget(){let z={isInterestedIn:(J)=>J===this.params.dragSourceType,getIconName:()=>this.moveBlocked?"pinned":"move",getContainer:()=>this.comp.getGui(),onDragging:(J)=>this.onDragging(J),onDragStop:()=>this.onDragStop(),onDragLeave:()=>this.onDragLeave(),onDragCancel:()=>this.onDragCancel()};this.beans.dragAndDrop?.addDropTarget(z)}createAutoScrollService(){let z=this.virtualList.getGui();this.autoScrollService=new WJ({scrollContainer:z,scrollAxis:"y",getVerticalPosition:()=>z.scrollTop,setVerticalPosition:(J)=>z.scrollTop=J})}onDragging(z){if(!this.currentDragValue||this.moveBlocked)return;let J=this.getListDragItem(z),Q=this.virtualList.getComponentAt(J.rowIndex);if(!Q)return;let Z=Q.getGui().parentElement;if(this.lastHoveredListItem&&this.lastHoveredListItem.rowIndex===J.rowIndex&&this.lastHoveredListItem.position===J.position)return;this.autoScrollService.check(z.event),this.clearHoveredItems(),this.lastHoveredListItem=J,_Z(Z,y5),_Z(Z,`ag-item-highlight-${J.position}`)}getListDragItem(z){let J=this.virtualList.getGui(),Q=Number.parseFloat(window.getComputedStyle(J).paddingTop),Z=this.virtualList.getRowHeight(),$=this.virtualList.getScrollTop(),X=Math.max(0,(z.y-Q+$)/Z),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 z=this.virtualList.getGui();for(let J of z.querySelectorAll(`.${y5}`))for(let Q of[y5,"ag-item-highlight-top","ag-item-highlight-bottom"])J.classList.remove(Q);this.lastHoveredListItem=null}};var WA=".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 BA(z){return z??(z=z||"default"),{tag:"div",cls:`ag-panel ag-${z}-panel`,attrs:{tabindex:"-1"},children:[{tag:"div",ref:"eTitleBar",cls:`ag-panel-title-bar ag-${z}-panel-title-bar ag-unselectable`,children:[{tag:"span",ref:"eTitle",cls:`ag-panel-title-bar-title ag-${z}-panel-title-bar-title`},{tag:"div",ref:"eTitleBarButtons",cls:`ag-panel-title-bar-buttons ag-${z}-panel-title-bar-buttons`}]},{tag:"div",ref:"eContentWrapper",cls:`ag-panel-content-wrapper ag-${z}-panel-content-wrapper`}]}}var EA=class extends x0{constructor(z){super(BA(z.cssIdentifier));this.config=z,this.closable=!0,this.eContentWrapper=j,this.eTitleBar=j,this.eTitleBarButtons=j,this.eTitle=j,this.registerCSS(WA)}postConstruct(){let{component:z,closable:J,hideTitleBar:Q,title:Z,minWidth:$=250,width:X,minHeight:Y=250,height:q,centered:G,popup:H,x:_,y:U,postProcessPopupParams:W}=this.config,B=this.beans,E=this.createManagedBean(new vZ(this.getGui(),{minWidth:$,width:X,minHeight:Y,height:q,centered:G,x:_,y:U,popup:H,calculateTopBuffer:()=>this.positionableFeature.getHeight()-this.getBodyHeight()}));this.positionableFeature=E;let K=this.getGui();if(z)this.setBodyComponent(z);if(!Q){if(Z)this.setTitle(Z);this.setClosable(J!=null?J:this.closable)}else w(this.eTitleBar,!1);if(this.addManagedElementListeners(this.eTitleBar,{mousedown:(L)=>{if(K.contains(L.relatedTarget)||K.contains(d(B))||this.eTitleBarButtons.contains(L.target)){L.preventDefault();return}let D=this.eContentWrapper.querySelector("button, [href], input, select, textarea, [tabindex]");if(D)D.focus()}}),H&&E.isPositioned())return;if(this.renderComponent)this.renderComponent();let F;if(W){let{type:L,eventSource:D,mouseEvent:M}=W;F=()=>B.popupSvc?.callPostProcessPopup(W,L,K,D,M)}E.initialisePosition(F),this.eContentWrapper.style.height="0"}renderComponent(){let z=this.getGui();z.focus(),this.close=()=>{z.remove(),this.destroy()}}getHeight(){return this.positionableFeature.getHeight()}setHeight(z){this.positionableFeature.setHeight(z)}getWidth(){return this.positionableFeature.getWidth()}setWidth(z){this.positionableFeature.setWidth(z)}setClosable(z){if(z!==this.closable)this.closable=z;if(z){let J=this.closeButtonComp=new x0({tag:"div",cls:"ag-button"});this.createBean(J);let Q=J.getGui(),Z=this.beans.iconSvc.createIconNoSpan("close",this.beans);Z.classList.add("ag-panel-title-bar-button-icon"),Q.appendChild(Z),this.addTitleBarButton(J),J.addManagedElementListeners(Q,{click:this.onBtClose.bind(this)})}else if(this.closeButtonComp)this.closeButtonComp.getGui().remove(),this.closeButtonComp=this.destroyBean(this.closeButtonComp)}setBodyComponent(z){z.setParentComponent(this),this.eContentWrapper.appendChild(z.getGui())}addTitleBarButton(z,J){let Q=this.eTitleBarButtons,Z=Q.children,$=Z.length;if(J==null)J=$;J=Math.max(0,Math.min(J,$)),z.addCss("ag-panel-title-bar-button");let X=z.getGui();if(J===0)Q.prepend(X);else if(J===$)Q.append(X);else Z[J-1].after(X);z.setParentComponent(this)}getBodyHeight(){return I6(this.eContentWrapper)}getBodyWidth(){return s1(this.eContentWrapper)}setTitle(z){this.eTitle.innerText=z}onBtClose(){this.close()}destroy(){if(this.closeButtonComp)this.closeButtonComp=this.destroyBean(this.closeButtonComp);let z=this.getGui();if(z&&M0(z))this.close();super.destroy()}},KA=class extends EA{constructor(z,J){super({...z,popup:!0});this.callbacks=J,this.isMaximizable=!1,this.isMaximized=!1,this.maximizeListeners=[],this.resizeListenerDestroy=null,this.lastPosition={x:0,y:0,width:0,height:0}}wireBeans(z){this.popupSvc=z.popupSvc}postConstruct(){let z=this.getGui(),{movable:J,resizable:Q,maximizable:Z,modal:$}=this.config;if(this.addCss("ag-dialog"),super.postConstruct(),this.tabGuardFeature=this.createManagedBean(new nZ(this,this.callbacks?.stopPropagationCallbacks)),this.tabGuardFeature.initialiseTabGuard({isFocusableContainer:!0,onFocusIn:()=>{this.popupSvc?.bringPopupToFront(z)},onTabKeyDown:(X)=>{if($)return;let Y=X.shiftKey,q=P0(this.beans,z,!1,Y);if(!q||this.tabGuardFeature.getTabGuardCtrl().isTabGuard(q)){if(this.callbacks?.focusNextContainer(this.beans,Y))X.preventDefault()}}}),J)this.setMovable(J);if(Z)this.setMaximizable(Z);if(Q)this.setResizable(Q);if(!this.config.modal)this.callbacks?.configureFocusableContainer(this.beans,this)}setAllowFocus(z){this.tabGuardFeature.getTabGuardCtrl().setAllowFocus(z)}renderComponent(){let z=this.getGui(),{alwaysOnTop:J,modal:Q,title:Z,afterGuiAttached:$}=this.config,X=this.getLocaleTextFunc(),Y=this.popupSvc?.addPopup({modal:Q,eChild:z,closeOnEsc:!0,closedCallback:this.onClosed.bind(this),alwaysOnTop:J,ariaLabel:Z||X("ariaLabelDialog","Dialog"),afterGuiAttached:$});if(Y)this.close=Y.hideFunc}onClosed(z){this.destroy(),this.config.closedCallback?.(z)}setMaximized(z){if(this.isMaximizable&&z!==this.isMaximized)this.toggleMaximize()}toggleMaximize(){let z=this.positionableFeature.getPosition();if(this.isMaximized){let{x:J,y:Q,width:Z,height:$}=this.lastPosition;this.setWidth(Z),this.setHeight($),this.positionableFeature.offsetElement(J,Q)}else this.lastPosition.width=this.getWidth(),this.lastPosition.height=this.getHeight(),this.lastPosition.x=z.x,this.lastPosition.y=z.y,this.positionableFeature.offsetElement(0,0),this.setHeight("100%"),this.setWidth("100%");this.isMaximized=!this.isMaximized,this.refreshMaximizeIcon()}refreshMaximizeIcon(){w(this.maximizeIcon,!this.isMaximized),w(this.minimizeIcon,this.isMaximized)}clearMaximizebleListeners(){if(this.maximizeListeners.length){for(let z of this.maximizeListeners)z();this.maximizeListeners.length=0}if(this.resizeListenerDestroy)this.resizeListenerDestroy(),this.resizeListenerDestroy=null}destroy(){this.maximizeButtonComp=this.destroyBean(this.maximizeButtonComp),this.clearMaximizebleListeners(),super.destroy()}setResizable(z){this.positionableFeature.setResizable(z)}setMovable(z){this.positionableFeature.setMovable(z,this.eTitleBar)}setMaximizable(z){if(!z){if(this.clearMaximizebleListeners(),this.maximizeButtonComp)this.destroyBean(this.maximizeButtonComp),this.maximizeButtonComp=this.maximizeIcon=this.minimizeIcon=void 0;return}let J=this.eTitleBar;if(!J||z===this.isMaximizable)return;this.isMaximizable=z;let Q=this.buildMaximizeAndMinimizeElements();this.refreshMaximizeIcon(),Q.addManagedElementListeners(Q.getGui(),{click:this.toggleMaximize.bind(this)}),this.addTitleBarButton(Q,0),this.maximizeListeners.push(...this.addManagedElementListeners(J,{dblclick:this.toggleMaximize.bind(this)})),[this.resizeListenerDestroy]=this.addManagedListeners(this.positionableFeature,{resize:()=>{this.isMaximized=!1,this.refreshMaximizeIcon()}})}buildMaximizeAndMinimizeElements(){let z=this.maximizeButtonComp=this.createBean(new x0({tag:"div",cls:"ag-dialog-button"})),J=z.getGui(),Q=this.beans.iconSvc;return this.maximizeIcon=Q.createIconNoSpan("maximize"),J.appendChild(this.maximizeIcon),this.maximizeIcon.classList.add("ag-panel-title-bar-button-icon"),this.minimizeIcon=Q.createIconNoSpan("minimize"),J.appendChild(this.minimizeIcon),this.minimizeIcon.classList.add("ag-panel-title-bar-button-icon"),z}};var FA=class extends o4{constructor(z){super();this.setTemplateFromElement(z.getGui(),void 0,void 0,!0)}postConstruct(){this.initialiseTabGuard({onTabKeyDown:(z)=>this.onTabKeyDown(z),handleKeyDown:(z)=>this.handleKeyDown(z)})}handleKeyDown(z){if(z.key===k.ESCAPE)this.closePanel()}onTabKeyDown(z){if(z.defaultPrevented)return;this.closePanel(),z.preventDefault()}closePanel(){let z=this.parentComponent;z.closeSubMenu(),setTimeout(()=>z.getGui().focus(),0)}},n5=class extends O0{constructor(z){super();this.callbacks=z,this.ACTIVATION_DELAY=80,this.isActive=!1,this.subMenuIsOpen=!1,this.subMenuIsOpening=!1,this.suppressRootStyles=!0,this.suppressAria=!0,this.suppressFocus=!0}init(z){let{menuItemDef:J,isAnotherSubMenuOpen:Q,level:Z,childComponent:$,contextParams:X}=z;return this.params=z.menuItemDef,this.level=Z,this.isAnotherSubMenuOpen=Q,this.childComponent=$,this.contextParams=X,this.cssClassPrefix=this.params.menuItemParams?.cssClassPrefix??"ag-menu-option",this.callbacks.getMenuItemComp(this.beans,this.params,{...J,level:Z,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,J){if(!J?.suppressClick)this.addManagedElementListeners(z,{click:(Q)=>this.onItemSelected(Q)});if(!J?.suppressKeyboardSelect)this.addManagedElementListeners(z,{keydown:(Q)=>{if(Q.key===k.ENTER||Q.key===k.SPACE)Q.preventDefault(),this.onItemSelected(Q)}});if(!J?.suppressMouseDown)this.addManagedElementListeners(z,{mousedown:(Q)=>{Q.stopPropagation(),Q.preventDefault()}});if(!J?.suppressMouseOver)this.addManagedElementListeners(z,{mouseenter:()=>this.onMouseEnter(),mouseleave:()=>this.onMouseLeave()})}isDisabled(){return!!this.params.disabled}openSubMenu(z=!1,J){if(this.closeSubMenu(),!this.params.subMenu)return;this.subMenuIsOpening=!0;let Q=z0({tag:"div",cls:"ag-menu",role:"presentation"});this.eSubMenuGui=Q;let Z,$=()=>{this.subMenuIsOpening=!1};if(this.childComponent){let H=this.createBean(new FA(this.childComponent));H.setParentComponent(this);let _=H.getGui(),U="mouseenter",W=()=>this.cancelDeactivate();if(_.addEventListener(U,W),Z=()=>{_.removeEventListener(U,W),this.destroyBean(H)},Q.appendChild(_),this.childComponent.afterGuiAttached)$=()=>{this.childComponent.afterGuiAttached(),this.subMenuIsOpening=!1}}else if(this.params.subMenu){let H=this.createBean(new mY(this.level+1,this.contextParams,this.callbacks));if(H.setParentComponent(this),H.addMenuItems(this.params.subMenu),Q.appendChild(H.getGui()),this.addManagedListeners(H,{closeMenu:(_)=>this.dispatchLocalEvent(_)}),H.addGuiEventListener("mouseenter",()=>this.cancelDeactivate()),Z=()=>this.destroyBean(H),z)$=()=>{H.activateFirstItem(),this.subMenuIsOpening=!1}}let X=this.beans.popupSvc,Y=()=>{let H=this.eGui;X?.positionPopupForMenu({eventSource:H,ePopup:Q,event:J instanceof MouseEvent?J: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:$});this.subMenuIsOpen=!0,this.setAriaExpanded(!0),this.hideSubMenu=()=>{if(G)G.hideFunc();this.subMenuIsOpen=!1,this.setAriaExpanded(!1),Z(),this.menuItemComp.setExpanded?.(!1),this.eSubMenuGui=void 0},this.menuItemComp.setExpanded?.(!0)}setAriaExpanded(z){if(!this.suppressAria)R0(this.eGui,z)}closeSubMenu(){if(!this.hideSubMenu)return;this.hideSubMenu(),this.hideSubMenu=null,this.setAriaExpanded(!1)}isSubMenuOpen(){return this.subMenuIsOpen}isSubMenuOpening(){return this.subMenuIsOpening}activate(z,J){if(this.cancelActivate(),this.params.disabled&&!J)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:!J}));if(z&&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(z){this.parentComponent=z}getSubMenuGui(){return this.eSubMenuGui}onItemSelected(z){if(this.menuItemComp.select?.(),this.params.action)this.beans.frameworkOverrides.wrapOutgoing(()=>this.params.action(this.gos.addCommon({...this.contextParams})));else this.openSubMenu(z&&z.type==="keydown",z);if(this.params.subMenu&&!this.params.action||this.params.suppressCloseOnSelect)return;this.closeMenu(z)}closeMenu(z){let J={type:"closeMenu"};if(z)if(z instanceof MouseEvent)J.mouseEvent=z;else J.keyboardEvent=z;this.dispatchLocalEvent(J)}onItemActivated(){let z={type:"menuItemActivated",menuItem:this};this.dispatchLocalEvent(z)}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(z){let J=this.menuItemComp.getGui(),{cssClassPrefix:Q,params:{cssClasses:Z,disabled:$}}=this,X=this.menuItemComp.getRootElement?.();if(X){if(!z)J.classList.add("ag-menu-option-custom");J=X}if(this.suppressRootStyles=!!z,!this.suppressRootStyles){J.classList.add(Q);for(let Y of Z??[])J.classList.add(Y);if($)J.classList.add(`${Q}-disabled`)}return J}applyAriaProperties(z){let{params:{checked:J,subMenu:Q,subMenuRole:Z,disabled:$}}=this,X=J!=null;if(H0(z,X?"menuitemcheckbox":"menuitem"),Q)T8(z,Z??"menu");if($)j8(z,!0)}configureDefaults(z){if(!this.menuItemComp){setTimeout(()=>this.configureDefaults(z));return}let{suppressRootStyles:J,suppressTooltip:Q,suppressAria:Z,suppressTabIndex:$,suppressFocus:X}=z||{},{params:{tooltip:Y,disabled:q}}=this,G=this.eGui=this.refreshRootElementGui(!!J);if(this.suppressAria=!!Z,!Z)this.applyAriaProperties(G);if(!$)G.setAttribute("tabindex","-1");if(!Q)this.refreshTooltip(Y);if(!q)this.addListeners(G,z);this.suppressFocus=!!X}refreshTooltip(z,J){if(this.tooltip=z,this.tooltipFeature=this.destroyBean(this.tooltipFeature),!z||!this.menuItemComp)return;let Q=this.beans.registry.createDynamicBean("tooltipFeature",!1,{getGui:()=>this.getGui(),getTooltipValue:()=>this.tooltip,getLocation:()=>"menu",shouldDisplayTooltip:J});if(Q)this.tooltipFeature=this.createBean(Q)}destroy(){this.tooltipFeature=this.destroyBean(this.tooltipFeature),this.menuItemComp?.destroy?.(),super.destroy()}},mY=class extends o4{constructor(z=0,J,Q){super({tag:"div",cls:"ag-menu-list",role:"menu"});this.level=z,this.menuActionParams=J,this.callbacks=Q,this.menuItems=[]}postConstruct(){this.initialiseTabGuard({onTabKeyDown:(z)=>this.onTabKeyDown(z),handleKeyDown:(z)=>this.callbacks.preserveRangesWhile(this.beans,()=>this.handleKeyDown(z)),onFocusIn:(z)=>this.handleFocusIn(z),onFocusOut:(z)=>this.handleFocusOut(z)})}onTabKeyDown(z){if(!this.getParentComponent()?.getGui()?.classList.contains("ag-focus-managed"))z.preventDefault();if(z.shiftKey)this.closeIfIsChild(z)}handleKeyDown(z){switch(z.key){case k.UP:case k.RIGHT:case k.DOWN:case k.LEFT:z.preventDefault(),this.handleNavKey(z.key);break;case k.ESCAPE:if(this.closeIfIsChild())this.callbacks.stopPropagationCallbacks.stopPropagation(z);break}}handleFocusIn(z){let J=z.relatedTarget;if(!this.tabGuardFeature.getTabGuardCtrl().isTabGuard(J)&&(this.getGui().contains(J)||this.activeMenuItem?.getSubMenuGui()?.contains(J)))return;if(this.activeMenuItem)this.activeMenuItem.activate();else this.activateFirstItem()}handleFocusOut(z){let J=z.relatedTarget;if(!this.activeMenuItem||this.getGui().contains(J)||this.activeMenuItem.getSubMenuGui()?.contains(J))return;if(!this.activeMenuItem.isSubMenuOpening())this.activeMenuItem.deactivate()}clearActiveItem(){if(this.activeMenuItem)this.activeMenuItem.deactivate(),this.activeMenuItem=null}addMenuItems(z){if(z==null)return;N.all(z.map((J)=>{if(J==="separator")return N.resolve({eGui:this.createSeparator()});else if(typeof J==="string")return this.callbacks.warnNoItem?.(J),N.resolve({eGui:null});else return this.addItem(J)})).then((J)=>{for(let Q of J??[])if(Q?.eGui){if(this.appendChild(Q.eGui),Q.comp)this.menuItems.push(Q.comp)}})}addItem(z){let J=this.createManagedBean(new n5(this.callbacks));return J.init({menuItemDef:z,isAnotherSubMenuOpen:()=>this.menuItems.some((Q)=>Q.isSubMenuOpen()),level:this.level,contextParams:this.menuActionParams}).then(()=>{return J.setParentComponent(this),this.addManagedListeners(J,{closeMenu:(Q)=>{this.dispatchLocalEvent(Q)},menuItemActivated:(Q)=>{if(this.activeMenuItem&&this.activeMenuItem!==Q.menuItem)this.activeMenuItem.deactivate();this.activeMenuItem=Q.menuItem}}),{comp:J,eGui:J.getGui()}})}activateFirstItem(){let z=this.menuItems.filter((J)=>!J.isDisabled())[0];if(!z)return;z.activate()}createSeparator(){let z={tag:"div",cls:"ag-menu-separator-part"};return F0({tag:"div",cls:"ag-menu-separator",attrs:{"aria-hidden":"true"},children:[z,z,z,z]})}handleNavKey(z){switch(z){case k.UP:case k.DOWN:{let Q=this.findNextItem(z===k.UP);if(Q&&Q!==this.activeMenuItem)Q.activate(!1,!0);return}}let J=this.gos.get("enableRtl")?k.RIGHT:k.LEFT;if(z===J)this.closeIfIsChild();else this.openChild()}closeIfIsChild(z){let J=this.getParentComponent();if(J&&J instanceof n5){if(z)z.preventDefault();return J.closeSubMenu(),J.getGui().focus(),!0}return!1}openChild(){if(this.activeMenuItem)this.activeMenuItem.openSubMenu(!0)}findNextItem(z){let J=[...this.menuItems];if(!J.length)return;if(!this.activeMenuItem)return z?b(J):J[0];if(z)J.reverse();let Q,Z=!1;for(let $ of J){if(!Z){if($===this.activeMenuItem)Z=!0;continue}Q=$;break}if(Z&&!Q)return J[0];return Q||this.activeMenuItem}destroy(){this.clearActiveItem(),super.destroy()}};var LA=class extends x0{constructor(z){super({tag:"div"});this.callbacks=z}init(z){this.params=z,this.cssClassPrefix=this.params.cssClassPrefix??"ag-menu-option",this.addAriaAttributes(),this.addIcon(),this.addName(),this.addShortcut(),this.addSubMenu()}configureDefaults(){return!0}addAriaAttributes(){let{checked:z,subMenu:J}=this.params,Q=this.getGui();if(z)oz(Q,z);if(J)R0(Q,!1)}addIcon(){if(this.params.isCompact)return;let z=F0({tag:"span",ref:"eIcon",cls:`${this.getClassName("part")} ${this.getClassName("icon")}`,role:"presentation"}),{checked:J,icon:Q}=this.params;if(J)z.appendChild(this.beans.iconSvc.createIconNoSpan("check"));else if(Q)if(b6(Q))z.appendChild(Q);else if(typeof Q==="string")z.innerHTML=Q;else this.callbacks?.warnNoIcon?.();this.getGui().appendChild(z)}addName(){let z=F0({tag:"span",ref:"eName",cls:`${this.getClassName("part")} ${this.getClassName("text")}`,children:this.params.name||""});this.getGui().appendChild(z)}addShortcut(){if(this.params.isCompact)return;let z=F0({tag:"span",ref:"eShortcut",cls:`${this.getClassName("part")} ${this.getClassName("shortcut")}`,children:this.params.shortcut||""});this.getGui().appendChild(z)}addSubMenu(){let z=F0({tag:"span",ref:"ePopupPointer",cls:`${this.getClassName("part")} ${this.getClassName("popup-pointer")}`}),J=this.getGui();if(this.params.subMenu){let Q=this.gos.get("enableRtl")?"subMenuOpenRtl":"subMenuOpen";z.appendChild(this.beans.iconSvc.createIconNoSpan(Q))}J.appendChild(z)}getClassName(z){return`${this.cssClassPrefix}-${z}`}};function t5(z,J){if(!J)return null;let Q=A4(z),Z=Q.indexOf(J);if(Z===-1)return null;let $=-1;for(let X=Z-1;X>=0;X--)if(Q[X].classList.contains(U6.TAB_GUARD_TOP)){$=X;break}if($<=0)return null;return Q[$-1]}function cY(z,J){if(!J)return!1;let Q=z.querySelectorAll(`.${CZ}`);if(!Q.length)return!1;for(let Z=0;Zthis.activeItem?.tabbedItem?.afterDetachedCallback?.())}setupHeader(){let{enableCloseButton:z,cssClass:J}=this.params,Q=(Z,$)=>{if(Z.classList.add(`ag-tabs-${$}`),J)Z.classList.add(`${J}-${$}`)};if(z)this.setupCloseButton(Q),this.eTabHeader=F0({tag:"div",role:"presentation"}),Q(this.eHeader,"header-wrapper"),this.eHeader.appendChild(this.eTabHeader);else this.eTabHeader=this.eHeader;H0(this.eTabHeader,"tablist"),Q(this.eTabHeader,"header")}setupCloseButton(z){let J=F0({tag:"button"});z(J,"close-button");let Q=this.beans.iconSvc.createIconNoSpan("close");_0(J,this.params.closeButtonAriaLabel),J.appendChild(Q),this.addManagedElementListeners(J,{click:()=>this.params.onCloseClicked?.()});let Z=F0({tag:"div",role:"presentation"});z(Z,"close-button-wrapper"),Z.appendChild(J),this.eHeader.appendChild(Z),this.eCloseButton=J}handleKeyDown(z){switch(z.key){case k.RIGHT:case k.LEFT:{if(!this.eTabHeader.contains(d(this.beans)))return;let J=z.key===k.RIGHT,Q=this.gos.get("enableRtl"),Z=this.items.indexOf(this.activeItem),$=J!==Q?Math.min(Z+1,this.items.length-1):Math.max(Z-1,0);if(Z===$)return;z.preventDefault();let X=this.items[$];this.showItemWrapper(X),X.eHeaderButton.focus();break}case k.UP:case k.DOWN:z.stopPropagation();break}}onTabKeyDown(z){if(z.defaultPrevented)return;let{beans:J,eHeader:Q,eBody:Z,activeItem:$,params:X}=this,{suppressTrapFocus:Y,enableCloseButton:q}=X,G=d(J),H=z.target,_=z.shiftKey;if(Q.contains(G)){if(z.preventDefault(),q&&_&&!this.eCloseButton?.contains(G))this.eCloseButton?.focus();else if(Y&&_)t5(Y0(J).body,H)?.focus();else this.focusBody(z.shiftKey);return}let U=null;if(cY(Z,H)){if(_)U=t5(Z,H);if(!U&&!Y)U=$.eHeaderButton}if(!U&&Z.contains(G)){if(U=P0(J,Z,!1,_),!U){if(Y&&!_)this.forceFocusOutOfContainer(_);else if(q&&!_)z.preventDefault(),this.eCloseButton?.focus();else z.preventDefault(),this.focusHeader();return}}if(U)z.preventDefault(),U.focus()}focusInnerElement(z){if(z)return this.focusBody(!0);else return this.focusHeader(),!0}focusHeader(z){this.activeItem.eHeaderButton.focus({preventScroll:z})}focusBody(z){return k0(this.eBody,z)}setAfterAttachedParams(z){this.afterAttachedParams=z}showFirstItem(){if(this.items.length>0)this.showItemWrapper(this.items[0])}addItem(z){let J=F0({tag:"span",cls:"ag-tab",role:"tab",attrs:{tabindex:"-1"}});J.appendChild(z.title),this.eTabHeader.appendChild(J),_0(J,z.titleLabel);let Q={tabbedItem:z,eHeaderButton:J};this.items.push(Q),J.addEventListener("click",this.showItemWrapper.bind(this,Q))}showItem(z){let J=this.items.find((Q)=>Q.tabbedItem===z);if(J)this.showItemWrapper(J)}showItemWrapper(z){let{tabbedItem:J,eHeaderButton:Q}=z;if(this.params.onItemClicked?.({item:J}),this.activeItem===z){this.params.onActiveItemClicked?.();return}if(this.lastScrollListener)this.lastScrollListener=this.lastScrollListener();if(J0(this.eBody),J.bodyPromise.then((Z)=>{this.eBody.appendChild(Z);let $=!d2();if(!this.params.suppressFocusBodyOnOpen)k0(this.eBody,!1,$);if(J.afterAttachedCallback)J.afterAttachedCallback(this.afterAttachedParams);if(this.params.keepScrollPosition){let X=J.getScrollableContainer?.()||Z;[this.lastScrollListener]=this.addManagedElementListeners(X,{scroll:()=>{this.tabbedItemScrollMap.set(J.name,X.scrollTop)}});let Y=this.tabbedItemScrollMap.get(J.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=z}},kA=".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 fA(z){let J=z.cssIdentifier||"default",Q=z.direction||"vertical";return{tag:"div",cls:`ag-group ag-${J}-group`,role:"presentation",children:[{tag:"div",ref:"eToolbar",cls:`ag-group-toolbar ag-${J}-group-toolbar`,children:[{tag:"ag-checkbox",ref:"cbGroupEnabled"}]},{tag:"div",ref:"eContainer",cls:`ag-group-container ag-group-container-${Q} ag-${J}-group-container`}]}}var VA=class extends x0{constructor(z={}){super(fA(z),[K4]);this.params=z,this.suppressEnabledCheckbox=!0,this.suppressToggleExpandOnEnableChange=!1,this.eToolbar=j,this.cbGroupEnabled=j,this.eContainer=j,this.registerCSS(kA);let{enabled:J,items:Q,suppressEnabledCheckbox:Z,expanded:$,suppressToggleExpandOnEnableChange:X,useToggle:Y}=z;if(this.cssIdentifier=z.cssIdentifier||"default",this.enabled=J!=null?J:!0,this.items=Q||[],this.useToggle=Y??!1,this.alignItems=z.alignItems||"center",this.expanded=$==null?!0:$,Z!=null)this.suppressEnabledCheckbox=Z;if(X!=null)this.suppressToggleExpandOnEnableChange=X}postConstruct(){if(this.setupTitleBar(),this.items.length){let $=this.items;this.items=[],this.addItems($)}let z=this.getLocaleTextFunc();if(this.cbGroupEnabled.setLabel(z("enabled","Enabled")),this.enabled)this.setEnabled(this.enabled,void 0,!0);this.setAlignItems(this.alignItems);let{onEnableChange:J,onExpandedChange:Q,suppressOpenCloseIcons:Z}=this.params;if(this.hideEnabledCheckbox(this.suppressEnabledCheckbox),this.hideOpenCloseIcons(Z??!1),this.refreshChildDisplay(),w(this.eContainer,this.expanded),this.cbGroupEnabled.onValueChange(($)=>{this.setEnabled($,!0,this.suppressToggleExpandOnEnableChange),this.dispatchEnableChangeEvent($)}),J!=null)this.onEnableChange(J);if(Q!=null)this.onExpandedChange(Q)}refreshChildDisplay(){w(this.eToolbar,this.expanded&&!this.suppressEnabledCheckbox),this.eTitleBar?.refreshOnExpand(this.expanded)}isExpanded(){return this.expanded}setAlignItems(z){if(this.alignItems!==z)this.removeCss(`ag-group-item-alignment-${this.alignItems}`);this.alignItems=z;let J=`ag-group-item-alignment-${this.alignItems}`;return this.addCss(J),this}toggleGroupExpand(z,J){if(this.eTitleBar?.isSuppressCollapse()&&!this.useToggle)z=!0,J=!0;else if(z=z!=null?z:!this.expanded,this.expanded===z)return this;if(this.expanded=z,this.refreshChildDisplay(),w(this.eContainer,z),!J)this.dispatchLocalEvent({type:z?"expanded":"collapsed"});return this}addItems(z){for(let J of z)this.addItem(J)}prependItem(z){this.insertItem(z,!0)}addItem(z){this.insertItem(z,!1)}updateItems(z){let J=this.items,Q=0;for(let Z=0;Zz(J.enabled)}),this}onExpandedChange(z){return this.addManagedListeners(this,{expanded:()=>z(!0),collapsed:()=>z(!1)}),this}hideEnabledCheckbox(z){return this.suppressEnabledCheckbox=z,this.refreshChildDisplay(),this.refreshDisabledStyles(),this}hideOpenCloseIcons(z){return this.eTitleBar?.hideOpenCloseIcons(z),this}refreshDisabledStyles(){let z=!this.enabled;this.eContainer.classList.toggle("ag-disabled",z),this.eTitleBar?.refreshDisabledStyles(this.suppressEnabledCheckbox&&z),this.eContainer.classList.toggle("ag-disabled-group-container",z)}setupTitleBar(){let z=this.useToggle?this.createToggleTitleBar():this.createDefaultTitleBar();this.eToolbar.insertAdjacentElement("beforebegin",z.getGui())}createDefaultTitleBar(){let z=this.createManagedBean(new AA(this.params));return this.eTitleBar=z,z.refreshOnExpand(this.expanded),this.addManagedListeners(z,{expandedChanged:(J)=>this.toggleGroupExpand(J.expanded)}),z}createToggleTitleBar(){let z=this.createManagedBean(new v5({value:this.enabled,label:this.params.title,labelAlignment:"left",labelWidth:"flex",onValueChange:(J)=>{this.setEnabled(J,!0),this.dispatchEnableChangeEvent(J)}}));return z.addCss("ag-group-title-bar"),z.addCss(`ag-${this.params.cssIdentifier??"default"}-group-title-bar ag-unselectable`),this.eToggle=z,this.toggleGroupExpand(this.enabled),z}},x5="ag-disabled-group-title-bar";function SA(z){let J=z.cssIdentifier??"default";return{tag:"div",cls:`ag-group-title-bar ag-${J}-group-title-bar ag-unselectable`,role:z.suppressKeyboardNavigation?"presentation":"group",children:[{tag:"span",ref:"eGroupOpenedIcon",cls:`ag-group-title-bar-icon ag-${J}-group-title-bar-icon`,role:"presentation"},{tag:"span",ref:"eGroupClosedIcon",cls:`ag-group-title-bar-icon ag-${J}-group-title-bar-icon`,role:"presentation"},{tag:"span",ref:"eTitle",cls:`ag-group-title ag-${J}-group-title`}]}}var AA=class extends x0{constructor(z={}){super(SA(z));this.suppressOpenCloseIcons=!1,this.suppressKeyboardNavigation=!1,this.eGroupOpenedIcon=j,this.eGroupClosedIcon=j,this.eTitle=j;let{title:J,suppressOpenCloseIcons:Q,suppressKeyboardNavigation:Z}=z;if(!!J&&J.length>0)this.title=J;if(Q!=null)this.suppressOpenCloseIcons=Q;this.suppressKeyboardNavigation=Z??!1}postConstruct(){this.setTitle(this.title),this.hideOpenCloseIcons(this.suppressOpenCloseIcons),this.setupExpandContract()}setupExpandContract(){let z=this.beans.iconSvc;this.eGroupClosedIcon.appendChild(z.createIconNoSpan("accordionClosed")),this.eGroupOpenedIcon.appendChild(z.createIconNoSpan("accordionOpen")),this.addManagedElementListeners(this.getGui(),{click:()=>this.dispatchExpandChanged(),keydown:(J)=>{switch(J.key){case k.ENTER:case k.SPACE:J.preventDefault(),this.dispatchExpandChanged();break;case k.RIGHT:case k.LEFT:J.preventDefault(),this.dispatchExpandChanged(J.key===k.RIGHT);break}}})}refreshOnExpand(z){this.refreshAriaStatus(z),this.refreshOpenCloseIcons(z)}refreshAriaStatus(z){if(!this.suppressOpenCloseIcons)R0(this.getGui(),z)}refreshOpenCloseIcons(z){let J=!this.suppressOpenCloseIcons;w(this.eGroupOpenedIcon,J&&z),w(this.eGroupClosedIcon,J&&!z)}isSuppressCollapse(){return this.suppressOpenCloseIcons}dispatchExpandChanged(z){let J={type:"expandedChanged",expanded:z};this.dispatchLocalEvent(J)}setTitle(z){let J=this.getGui(),Q=!!z&&z.length>0;if(z=Q?z:void 0,this.eTitle.textContent=z??"",w(J,Q),z!==this.title)this.title=z;let Z=J.classList.contains(x5);return this.refreshDisabledStyles(Z),this}addWidget(z){return this.getGui().appendChild(z),this}hideOpenCloseIcons(z){if(this.suppressOpenCloseIcons=z,z)this.dispatchExpandChanged(!0);return this}refreshDisabledStyles(z){let J=this.getGui();if(z)J.classList.add(x5),J.removeAttribute("tabindex"),H0(J,"presentation");else if(J.classList.remove(x5),typeof this.title==="string"&&!this.suppressKeyboardNavigation)this.activateTabIndex([J]),H0(J,"group");else J.removeAttribute("tabindex"),H0(J,"presentation")}};var $0="35.2.0",C0={moduleName:"EnterpriseCore",version:$0,beans:[pX],icons:{accordionOpen:"tree-open",accordionClosed:"tree-closed",accordionIndeterminate:"tree-indeterminate",close:"cross",cancel:"cancel",maximize:"maximize",minimize:"minimize",columnDrag:"grip"},dependsOn:[],setLicenseKey:pX.setLicenseKey};var RA={stopPropagationCallbacks:R1,focusNextContainer:(z,J)=>{return _4(z,J)},configureFocusableContainer:(z,J)=>{let Q=z.ctrlsSvc.get("gridCtrl");Q.addFocusableContainer(J),J.addDestroyFunc(()=>Q.removeFocusableContainer(J))}},jA=class extends KA{constructor(z){super(z,RA)}getFocusableContainerName(){return"dialog"}};var e5=class extends HA{constructor(z){super(R1,z)}};var OA=class extends UA{};function PA(z){return z.sideBar?.comp.isDisplayed()??!1}function TA(z,J){z.sideBar?.comp.setDisplayed(J)}function vA(z,J){z.sideBar?.comp.setSideBarPosition(J)}function IA(z,J,Q){z.sideBar?.comp.openToolPanel(J,"api",Q)}function CA(z){z.sideBar?.comp.close("api")}function bA(z){return z.sideBar?.comp.openedItem()??null}function yA(z){z.sideBar?.comp.refresh()}function xA(z){return z.sideBar?.comp.isToolPanelShowing()??!1}function wA(z,J){let Q=z.sideBar?.comp.getToolPanelInstance(J);return l4(Q)}function NA(z){return z.sideBar?.comp.getDef()}var gA=`.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)}}`,hA={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"}]}]},uA=class extends y{constructor(z){super();this.toolPanelDef=z,this.eToggleButton=j,this.eIconWrapper=j,this.eLabel=j}getToolPanelId(){return this.toolPanelDef.id}postConstruct(){this.setTemplate(hA,[]),this.setLabel(),this.setIcon(),this.addManagedElementListeners(this.eToggleButton,{click:this.onButtonPressed.bind(this)}),this.eToggleButton.setAttribute("id",`ag-${this.getCompId()}-button`)}setLabel(){let z=this.toolPanelDef,J=this.getLocaleTextFunc()(z.labelKey,z.labelDefault);this.eLabel.textContent=J}setIcon(){this.eIconWrapper.insertAdjacentElement("afterbegin",h(this.toolPanelDef.iconKey,this.beans))}onButtonPressed(){this.dispatchLocalEvent({type:"toggleButtonClicked"})}setSelected(z){this.toggleCss("ag-selected",z),R0(this.eToggleButton,z)}},mA={tag:"div",cls:"ag-side-buttons",role:"tablist"},cA=class extends y{constructor(){super(mA);this.buttonComps=[]}postConstruct(){this.addManagedElementListeners(this.getFocusableElement(),{keydown:this.handleKeyDown.bind(this)})}handleKeyDown(z){if(z.key!==k.TAB||!z.shiftKey)return;if(_4(this.beans,!0)){z.preventDefault();return}s0(z)}setActiveButton(z){for(let J of this.buttonComps)J.setSelected(z===J.getToolPanelId())}addButtonComp(z){let J=this.createBean(new uA(z));return this.buttonComps.push(J),this.appendChild(J),J.addEventListener("toggleButtonClicked",()=>{this.dispatchLocalEvent({type:"sideBarButtonClicked",toolPanelId:z.id})}),J}clearButtons(){this.buttonComps=this.destroyBeans(this.buttonComps),J0(this.getGui())}destroy(){this.clearButtons(),super.destroy()}},pA={selector:"AG-SIDE-BAR-BUTTONS",component:cA},pY={id:"columns",labelDefault:"Columns",labelKey:"columns",iconKey:"columnsToolPanel",toolPanel:"agColumnsToolPanel"},iY={id:"filters",labelDefault:"Filters",labelKey:"filters",iconKey:"filtersToolPanel",toolPanel:"agFiltersToolPanel"},iA={id:"filters-new",labelDefault:"Filters",labelKey:"filters",iconKey:"filtersToolPanel",toolPanel:"agNewFiltersToolPanel"},o6={columns:pY,filters:iY,"filters-new":iA};function r5(z){if(!z)return;if(z===!0)return{toolPanels:[pY,iY],defaultToolPanel:"columns"};if(typeof z==="string")return r5([z]);if(Array.isArray(z)){let J=[];for(let Q of z){let Z=o6[Q];if(!Z){R(215,{key:Q,defaultByKey:o6});continue}J.push(Z)}if(J.length===0)return;return{toolPanels:J,defaultToolPanel:J[0].id}}return{toolPanels:dA(z.toolPanels),defaultToolPanel:z.defaultToolPanel,hiddenByDefault:z.hiddenByDefault,position:z.position,hideButtons:z.hideButtons}}function dA(z){let J=[];if(!z)return J;return z.forEach((Q)=>{let Z=nA(Q);if(!Z)return;J.push(Z)}),J}function nA(z){if(typeof z!=="string")return z;if(o6[z])return o6[z];return R(215,{key:z,defaultByKey:o6}),null}var tA=class extends y{constructor(){super({tag:"div",cls:"ag-tool-panel-horizontal-resize"});this.minWidth=100,this.maxWidth=null}postConstruct(){let z=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(z),this.inverted=this.gos.get("enableRtl")}dispatchResizeEvent(z,J,Q){this.eventSvc.dispatchEvent({type:"toolPanelSizeChanged",width:Q,started:z,ended:J})}onResizeStart(){this.startingWidth=this.elementToResize.offsetWidth,this.dispatchResizeEvent(!0,!1,this.startingWidth)}onResizeEnd(z){return this.onResizing(z,!0)}onResizing(z,J=!1){let Q=this.inverted?-1:1,Z=Math.max(this.minWidth,Math.floor(this.startingWidth-z*Q));if(this.maxWidth!=null)Z=Math.min(this.maxWidth,Z);this.elementToResize.style.setProperty("--ag-horizontal-size",`${Z}px`),this.dispatchResizeEvent(!1,J,Z)}};function rA(z,J,Q){return z.getCompDetails(J,sA,void 0,Q,!0)}var sA={name:"toolPanel",optionalMethods:["refresh","getState"]},lA={tag:"div",cls:"ag-tool-panel-wrapper",role:"tabpanel",children:[{tag:"div",cls:"ag-tool-panel-content",ref:"eContent"}]},aA=class extends y{constructor(){super(lA);this.eContent=j,this.animationId=0,this.defParent=null}postConstruct(){let z=this.getGui(),J=this.resizeBar=this.createManagedBean(new tA);z.setAttribute("id",`ag-${this.getCompId()}`),J.elementToResize=z,this.appendChild(J)}getToolPanelId(){return this.toolPanelId}getDefParent(){return this.defParent}setDefParent(z){this.defParent=z}setToolPanelDef(z,J){let{id:Q,minWidth:Z,maxWidth:$,width:X,parent:Y}=z;if(this.toolPanelId=Q,this.defParent=Y??null,X)this.getGui().style.setProperty("--ag-side-bar-panel-width",`${X}px`);let q=rA(this.beans.userCompFactory,z,J);if(q==null)return!1;let G=q.newAgStackInstance();this.params=q.params,G.then(this.setToolPanelComponent.bind(this));let H=this.resizeBar;if(Z!=null)H.minWidth=Z;if($!=null)H.maxWidth=$;return!0}setToolPanelComponent(z){this.toolPanelCompInstance=z;let{eContent:J}=this;J.appendChild(z.getGui()),this.addDestroyFunc(()=>{this.destroyBean(z)})}getToolPanelInstance(){return this.toolPanelCompInstance}setResizerSizerSide(z){let J=this.gos.get("enableRtl"),Q=z==="left",Z=J?Q:!Q;this.resizeBar.inverted=Z}refresh(){this.toolPanelCompInstance?.refresh(this.params)}animateDisplayed(z){if(this.isDisplayed()===z)return;let J=++this.animationId,{eContent:Q}=this,Z=()=>{if(this.animationId===J)$.classList.remove("ag-tool-panel-animating"),Q.style.width="",$.style.width=""},$=this.getGui(),X=$.offsetWidth;this.setDisplayed(z),$.classList.add("ag-tool-panel-animating");let Y=getComputedStyle($).transitionDuration;if(!parseFloat(Y)){Z();return}$.style.transition="none",$.style.width="",Q.style.width=`${Q.offsetWidth}px`,$.style.width=`${X}px`;let q=$.offsetWidth;$.style.transition="",$.style.width=z?"":"0";let G=setTimeout(Z,100);$.addEventListener("transitionstart",()=>clearTimeout(G),{once:!0}),$.addEventListener("transitionend",Z,{once:!0})}},oA={tag:"div",cls:"ag-side-bar ag-unselectable",children:[{tag:"ag-side-bar-buttons",ref:"sideBarButtons"}]},eA=class extends y{constructor(){super(oA,[pA]);this.sideBarButtons=j,this.toolPanelWrappers=[],this.registerCSS(gA)}postConstruct(){this.sideBarButtons.addEventListener("sideBarButtonClicked",this.onToolPanelButtonClicked.bind(this));let{beans:z,gos:J}=this,{sideBar:Q}=J.get("initialState")??{};this.setSideBarDef({sideBarDef:r5(J.get("sideBar")),sideBarState:Q}),this.addManagedPropertyListener("sideBar",()=>this.setState()),z.sideBar.comp=this;let Z=this.getFocusableElement();this.createManagedBean(new a4(Z,{onTabKeyDown:this.onTabKeyDown.bind(this),handleKeyDown:this.handleKeyDown.bind(this)})),O1(z,this,Z),this.addManagedPropertyListener("enableAdvancedFilter",this.onAdvancedFilterChanged.bind(this))}getFocusableContainerName(){return"sideBar"}onTabKeyDown(z){if(z.defaultPrevented)return;let{beans:J,sideBarButtons:Q}=this,Z=this.getGui(),$=Q.getGui(),X=d(J),Y=Z.querySelector(".ag-tool-panel-wrapper:not(.ag-hidden)"),q=z.target,G=z.shiftKey;if(!Y){if(_4(J,G,!0))return z.preventDefault(),!0;return h9(z),!1}if($.contains(X)){if(k0(Y,G))z.preventDefault();return}if(!G)return;let H=null;if(Y.contains(X))H=P0(J,Y,void 0,!0);else if(cY(Y,q))H=t5(Y,q);if(!H)H=$.querySelector(".ag-selected button"),H=M0(H)?H:null;if(H&&H!==z.target)z.preventDefault(),H.focus()}handleKeyDown(z){let J=d(this.beans),Q=this.sideBarButtons;if(!Q.getGui().contains(J))return;let Z=Q.getGui(),$=Array.prototype.slice.call(Z.querySelectorAll(".ag-side-button")),X=$.findIndex((G)=>G.contains(J)),Y=null;switch(z.key){case k.LEFT:case k.UP:Y=Math.max(0,X-1);break;case k.RIGHT:case k.DOWN:Y=Math.min(X+1,$.length-1);break}if(Y===null)return;let q=$[Y].querySelector("button");if(q)q.focus(),z.preventDefault()}onToolPanelButtonClicked(z){let J=z.toolPanelId;if(this.openedItem()===J)this.openToolPanel(void 0,"sideBarButtonClicked");else this.openToolPanel(J,"sideBarButtonClicked")}clearDownUi(){this.sideBarButtons.clearButtons(),this.destroyToolPanelWrappers()}setSideBarDef({sideBarDef:z,sideBarState:J,existingToolPanelWrappers:Q}){if(this.setDisplayed(!1),this.sideBar=z,z)this.sideBarButtons.setDisplayed(!z.hideButtons);if(z?.toolPanels){let Z=z.toolPanels;if(this.createToolPanelsAndSideButtons(Z,J,Q),!this.toolPanelWrappers.length)return;let $=J?J.visible:!z.hiddenByDefault;if(this.setDisplayed($),this.setSideBarPosition(J?J.position:z.position),$)if(J){let{openToolPanel:X}=J;if(X)this.openToolPanel(X,"sideBarInitializing")}else this.openToolPanel(z.defaultToolPanel,"sideBarInitializing")}}getDef(){return this.sideBar}setSideBarPosition(z){if(!z)z="right";this.position=z;let J=z==="left",Q=J?"right":"left";this.toggleCss("ag-side-bar-left",J),this.toggleCss("ag-side-bar-right",!J);for(let Z of this.toolPanelWrappers)Z.setResizerSizerSide(Q);return this.dispatchSideBarUpdated(),this}setDisplayed(z,J){super.setDisplayed(z,J),this.dispatchSideBarUpdated()}getState(){let z={};for(let J of this.toolPanelWrappers)z[J.getToolPanelId()]=J.getToolPanelInstance()?.getState?.();return{visible:this.isDisplayed(),position:this.position,openToolPanel:this.openedItem(),toolPanels:z}}createToolPanelsAndSideButtons(z,J,Q){for(let Z of z)this.createToolPanelAndSideButton(Z,J?.toolPanels?.[Z.id],Q?.[Z.id])}validateDef(z){let{id:J,toolPanel:Q}=z;if(J==null)return R(212),!1;if(eX(Q)){if(this.beans.filterManager?.isAdvFilterEnabled())return R(213),!1}return!0}createToolPanelAndSideButton(z,J,Q){if(!this.validateDef(z)){this.destroyBean(Q);return}let Z;if(Q)Z=Q,Z.setDefParent(z.parent??null);else if(Z=this.createBean(new aA),!Z.setToolPanelDef(z,C(this.gos,{initialState:J,onStateUpdated:()=>this.dispatchSideBarUpdated()})))return;Z.setDisplayed(!1),this.renderToolPanelUnderParent(Z,z.parent),this.toolPanelWrappers.push(Z);let $=this.sideBarButtons.addButtonComp(z);GZ($.eToggleButton,Z.getGui())}refresh(){for(let z of this.toolPanelWrappers)z.refresh()}renderToolPanelUnderParent(z,J){let Q=z.getGui();if(J)this.beans.environment.applyThemeClasses(J,["ag-external","ag-tool-panel-external"]),Q.classList.add(this.gos.get("enableRtl")?"ag-rtl":"ag-ltr");let Z=J??z.getDefParent()??this.getGui();if(Q.parentElement!==Z)Z.appendChild(Q)}getWrapper(z){return this.toolPanelWrappers.find((J)=>J.getToolPanelId()===z)}openToolPanel(z,J="api",Q){let Z=this.openedItem(),X=!!z&&!!Z||J==="sideBarInitializing";for(let G of this.toolPanelWrappers){let H=z===G.getToolPanelId();if(H)this.renderToolPanelUnderParent(G,Q??null);if(X)G.setDisplayed(H);else G.animateDisplayed(H)}let Y=this.openedItem();if(Z!==Y)this.sideBarButtons.setActiveButton(z),this.raiseToolPanelVisibleEvent(z,Z??void 0,J)}getToolPanelInstance(z){let J=this.getWrapper(z);if(!J){R(214,{key:z});return}return J.getToolPanelInstance()}raiseToolPanelVisibleEvent(z,J,Q){let Z=!!z&&!!J,$=this.eventSvc;if(J)$.dispatchEvent({type:"toolPanelVisibleChanged",source:Q,key:J,visible:!1,switchingToolPanel:Z});if(z)$.dispatchEvent({type:"toolPanelVisibleChanged",source:Q,key:z,visible:!0,switchingToolPanel:Z})}close(z="api"){this.openToolPanel(void 0,z)}isToolPanelShowing(){return!!this.openedItem()}openedItem(){let z=null;for(let J of this.toolPanelWrappers)if(J.isDisplayed())z=J.getToolPanelId();return z}setState(z){let J=r5(this.gos.get("sideBar")),Q={};if(J&&this.sideBar)J.toolPanels?.forEach((Z)=>{let{id:$}=Z;if(!$)return;let X=this.sideBar.toolPanels?.find((H)=>H.id===$);if(!X||Z.toolPanel!==X.toolPanel)return;let Y=this.getWrapper($);if(!Y)return;let q=C(this.gos,{...Z.toolPanelParams??{},initialState:z?.toolPanels?.[$],onStateUpdated:()=>this.dispatchSideBarUpdated()});if(Y.getToolPanelInstance()?.refresh(q)!==!0)return;this.toolPanelWrappers=this.toolPanelWrappers.filter((H)=>H!==Y),S0(Y.getGui()),Q[$]=Y});this.clearDownUi(),this.setSideBarDef({sideBarDef:J,sideBarState:z,existingToolPanelWrappers:Q})}dispatchSideBarUpdated(){this.eventSvc.dispatchEvent({type:"sideBarUpdated"})}destroyToolPanelWrappers(){for(let z of this.toolPanelWrappers)S0(z.getGui()),this.destroyBean(z);this.toolPanelWrappers.length=0}onAdvancedFilterChanged(){if(this.sideBar?.toolPanels?.some((J)=>eX(typeof J==="string"?J:J.toolPanel)))this.setState()}destroy(){this.destroyToolPanelWrappers(),super.destroy()}};function eX(z){return z==="agFiltersToolPanel"||z==="agNewFiltersToolPanel"}var zR={selector:"AG-SIDE-BAR",component:eA},JR=class extends V{constructor(){super(...arguments);this.beanName="sideBar"}getSelector(){return zR}},z7={moduleName:"SideBar",version:$0,beans:[JR],apiFunctions:{isSideBarVisible:PA,setSideBarVisible:TA,setSideBarPosition:vA,openToolPanel:IA,closeToolPanel:CA,getOpenedToolPanel:bA,refreshToolPanel:yA,isToolPanelShowing:xA,getToolPanelInstance:wA,getSideBar:NA},dependsOn:[C0,lZ]},QR='.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}',dY=class extends LA{constructor(){super({warnNoIcon:()=>R(227)})}},J7={moduleName:"MenuItem",version:$0,userComponents:{agMenuItem:dY},icons:{check:"tick",subMenuOpen:"small-right",subMenuOpenRtl:"small-left"},css:[QR]},ZR=".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}",$R=300,XR={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"}]},YR=class extends y{constructor(){super(XR,[K4,e4]);this.eExpand=j,this.eSelect=j,this.eFilterTextField=j}postConstruct(){this.createExpandIcons(),this.addManagedListeners(this.eExpand,{click:this.onExpandClicked.bind(this),keydown:(J)=>{if(J.key===k.SPACE)J.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 z=this.getLocaleTextFunc();this.eSelect.setInputAriaLabel(z("ariaColumnSelectAll","Toggle All Columns Visibility")),this.eFilterTextField.setInputAriaLabel(z("ariaFilterColumnsInput","Filter Columns Input")),this.activateTabIndex([this.eExpand])}onFunctionsReadOnlyPropChanged(){let z=this.gos.get("functionsReadOnly");this.eSelect.setReadOnly(z),this.eSelect.toggleCss("ag-column-select-column-readonly",z)}init(z){this.params=z;let J=this.gos.get("functionsReadOnly");if(this.eSelect.setReadOnly(J),this.eSelect.toggleCss("ag-column-select-column-readonly",J),this.beans.colModel.ready)this.showOrHideOptions()}createExpandIcons(){let z=this.beans;this.eExpand.appendChild(this.eExpandChecked=h("columnSelectOpen",z)),this.eExpand.appendChild(this.eExpandUnchecked=h("columnSelectClosed",z)),this.eExpand.appendChild(this.eExpandIndeterminate=h("columnSelectIndeterminate",z)),this.setExpandState(0)}showOrHideOptions(){let z=this.params,J=!z.suppressColumnFilter,Q=!z.suppressColumnSelectAll,Z=!z.suppressColumnExpandAll,$=!!this.beans.colModel.colDefCols?.treeDepth,X=this.getLocaleTextFunc();this.eFilterTextField.setInputPlaceholder(X("searchOoo","Search...")),w(this.eFilterTextField.getGui(),J),w(this.eSelect.getGui(),Q),w(this.eExpand,Z&&$)}onFilterTextChanged(){if(!this.onFilterTextChangedDebounced)this.onFilterTextChangedDebounced=p0(this,()=>{let z=this.eFilterTextField.getValue();this.dispatchLocalEvent({type:"filterChanged",filterText:z})},$R);this.onFilterTextChangedDebounced()}onSelectClicked(){this.dispatchLocalEvent({type:this.selectState?"unselectAll":"selectAll"})}onExpandClicked(){this.dispatchLocalEvent({type:this.expandState===0?"collapseAll":"expandAll"})}setExpandState(z){this.expandState=z,w(this.eExpandChecked,z===0),w(this.eExpandUnchecked,z===1),w(this.eExpandIndeterminate,z===2)}setSelectionState(z){this.selectState=z,this.eSelect.setValue(this.selectState)}},qR={selector:"AG-PRIMARY-COLS-HEADER",component:YR};function J6(z){return!!z&&typeof z.children<"u"}function C1(z){return J6(z)?z.groupId:z.colId}function nY(z,J,Q){let Z=(Y,q)=>{let H=Y.children.map(C1).includes(C1(q)),_=b(Y.children),U=_&&C1(_)!==C1(q);return H&&U};if(!J6(z))return!0;let $=z,X=Q;if(Z($,X))return $.children.push(X),!0;if($.groupId===J){if(!$.children.map(C1).includes(C1(X)))return $.children.push(X),!0}for(let Y=$.children.length-1;Y>=0;Y--)if(nY($.children[Y],J,Q))break;return!1}function tY(z){let J=($,X)=>{return J6($)&&J6(X)&&C1($)===C1(X)},Q=($,X)=>{if(!J6(X))return $;let Y=$,q=X;if(q.children&&q.groupId){if(nY(Y,q.groupId,q.children[0]))return Y}for(let G of q.children)Q(Y,G);return Y},Z=[];for(let $=1;$<=z.length;$++){let X=z[$-1],Y=z[$];if(J(X,Y))z[$]=Q(X,Y);else Z.push(X)}return Z}function GR(z,J){let Q=[],Z=(X,Y)=>{if(J6(X)){let q=X,G=typeof q.groupId<"u"?q.groupId:q.headerName,H=new d1(q,G,!1,Y),_=[];for(let U of q.children){let W=Z(U,Y+1);if(W)_.push(W)}return H.setChildren(_),H}else{let q=X,G=q.colId?q.colId:q.field,H=z.getColDefCol(G);if(!H)Q.push(q);return H}},$=[];for(let X of J){let Y=Z(X,0);if(Y)$.push(Y)}if(Q.length>0)R(217,{invalidColIds:Q});return $}function HR(z,J){let Q=rY(UR(z)),Z=tY(Q);J(Z)}function _R(z,J){let Q=rY(z),Z=tY(Q);J(Z)}function rY(z){let J=(Q,Z)=>{let $;if(G0(Q))if(Q.isPadding())$=Z;else{let Y=Object.assign({},Q.getColGroupDef());Y.groupId=Q.getGroupId(),Y.children=[Z],$=Y}else{let Y=Object.assign({},Q.getColDef());Y.colId=Q.getColId(),$=Y}let X=Q.getOriginalParent();if(X)return J(X,$);else return $};return z.map((Q)=>J(Q,Q.getColDef()))}function UR(z){return z.getCols().filter((J)=>{let Q=J.getColDef();return J.isPrimary()&&!Q.showRowGroup})}var zY=class{constructor(z,J,Q,Z=!1,$){if(this.displayName=z,this.depth=Q,this.group=Z,this.localEventService=new R4,Z)this.columnGroup=J,this._expanded=$,this.children=[];else this.column=J}get expanded(){return!!this._expanded}set expanded(z){if(z===this._expanded)return;this._expanded=z,this.localEventService.dispatchEvent({type:"expandedChanged"})}addEventListener(z,J){this.localEventService.addEventListener(z,J)}removeEventListener(z,J){this.localEventService.removeEventListener(z,J)}};function i(z){return!!z?.buttons?.includes("apply")}function u0(z,J){if(!i(J))return;let Q=z.sideBar?.comp.openedItem();if(!Q)return;z.sideBar?.comp.getToolPanelInstance(Q)?.refreshDeferredUi()}function sY(z,J,Q,Z,$){let X=WR(J);lY(z,X,Q,Z,$)}function lY(z,J,Q,Z,$){if(z.columnStateUpdateStrategy.getPivotMode(i($)))ER(z,J,Q,Z,$);else BR(z,J,Q,Z,$)}function WR(z){let J=[],Q=(Z)=>{for(let $ of Z){if(!$.passesFilter)continue;if($.group)Q($.children);else J.push($.column)}};return Q(z),J}function BR(z,J,Q,Z,$){let X=z.columnStateUpdateStrategy,Y=[];for(let q of J){if(q.getColDef().lockVisible)continue;if(X.isColumnVisibleInToolPanel(i($),q)!==Q)Y.push({colId:q.getId(),hide:!Q})}X.applyColumnState(i($),Y,Z),u0(z,$)}function ER(z,J,Q,Z,$){KR(z,J,Q,Z,$)}function KR(z,J,Q,Z,$){let X=z.columnStateUpdateStrategy,Y=[],H=Q?(_)=>{if(X.isColumnSelectedInPivotModeToolPanel(i($),_))return;if(_.isAllowValue()){let U=typeof _.getAggFunc()==="string"?_.getAggFunc():z.aggFuncSvc?.getDefaultAggFunc(_);Y.push({colId:_.getId(),aggFunc:U})}else if(_.isAllowRowGroup())Y.push({colId:_.getId(),rowGroup:!0});else if(_.isAllowPivot())Y.push({colId:_.getId(),pivot:!0})}:(_)=>{if(X.isColumnSelectedInPivotModeToolPanel(i($),_))Y.push({colId:_.getId(),pivot:!1,rowGroup:!1,aggFunc:null})};J.forEach(H),X.applyColumnState(i($),Y,Z),u0(z,$)}function aY(z,J){let{columns:Q,visibleState:Z,pivotState:$,eventType:X}=J,Y=z.columnStateUpdateStrategy,q=Y.getPivotMode(i(J)),G=Q.map((H)=>{let _=H.getColId();if(q){let U=$?.[_];return{colId:_,pivot:U?.pivot,rowGroup:U?.rowGroup,aggFunc:U?.aggFunc}}else return{colId:_,hide:!Z?.[_]}});Y.applyColumnState(i(J),G,X),u0(z,J)}function FR(z){return{pivot:z.isPivotActive(),rowGroup:z.isRowGroupActive(),aggFunc:z.isValueActive()?z.getAggFunc():void 0}}function oY(z,J,Q){if(!Q)return FR(z);let Z=J.getRowGroupColumns(Q).includes(z),$=J.getPivotColumns(Q).includes(z),X=J.getValueColumns(Q).includes(z);return{pivot:$,rowGroup:Z,aggFunc:X?J.getColumnAggFunc(Q,z):void 0}}var eY=(z,J)=>{if(!J)return[];let Q=z;for(let Z=0,$=J.length;Z<$&&Q;++Z)Q=Q[J[Z]];return Array.isArray(Q)?Q:[]},z6=(z,J,Q)=>{let Z=z.aggData;if(Z===J)return;if(z.aggData=J,z.__localEventService)LR(z,Z,J,Q)},JY=(z,J,Q)=>{z6(z,J,Q);let Z=z.pinnedSibling;if(Z)z6(Z,J,Q);let $=z.sibling;if($){z6($,J,Q);let X=$.pinnedSibling;if(X)z6(X,J,Q)}},LR=(z,J,Q,Z)=>{if(!Q){if(!J)return;let Y=Object.keys(J);for(let q=0,G=Y.length;q{if(!z)return;let Z=z.group;if(Z===Q)return;if(z.group=Q,z.updateHasChildren(),Z&&!Q)z6(z,null,J.colModel),z.setAllChildrenCount(null);J.selectionSvc?.updateRowSelectable(z),z.dispatchRowEvent("groupChanged")},zq=(z,J,Q)=>{QY(z,J,Q),QY(z.pinnedSibling,J,Q)},Jz=(z,J)=>{let{gos:Q,rowGroupColsSvc:Z}=J;if(!Z||!z)return!1;let $=Q.get("groupLockGroupColumns");if(!z.isRowGroupActive()||$===0)return!1;if($===-1)return!0;let X=Z.columns.findIndex((Y)=>Y.getColId()===z.getColId());return $>X},e6=(z,J,Q)=>{let $=z(J,`${J==="groupBy"?"Group by":"Un-Group by"} ${Q}`,[Q]);if($.indexOf(Q)>=0)return $;else return`${$} ${Q}`};function DR(z){let J=J4(z),Q="getSelection"in J?J.getSelection():null,Z=[];for(let $=0;$<(Q?.rangeCount??0);$++){let X=Q?.getRangeAt($);if(X)Z.push(X)}return{selection:Q,ranges:Z}}function MR(z,J){if(!z.gos.get("enableCellTextSelection"))return J();if(!a1()&&!A1())return J();let{selection:Z,ranges:$}=DR(z);J(),Z?.removeAllRanges();for(let X of $)Z?.addRange(X)}var kR={name:"menuItem",optionalMethods:["setActive","select","setExpanded","configureDefaults"]},Jq={getMenuItemComp:(z,J,Q)=>{return z.userCompFactory.getCompDetails(J,kR,"agMenuItem",C(z.gos,Q),!0)?.newAgStackInstance()??N.resolve()},getPostProcessPopupParams:({column:z,node:J})=>({column:z,rowNode:J}),preserveRangesWhile:MR,stopPropagationCallbacks:R1,warnNoItem:(z)=>{R(228,{menuItemOrString:z})}},fR=class extends n5{constructor(){super(Jq)}},Qq=class extends mY{constructor(z,J={column:null,node:null,value:null}){super(z,J,Jq)}},Zq=class extends y{constructor(z,J,Q,Z={}){super({tag:"div",cls:"ag-menu"});this.column=z,this.mouseEventOrTouch=J,this.parentEl=Q,this.params=Z,this.displayName=null}postConstruct(){let{column:z,beans:{colNames:J}}=this;this.initializeProperties(z);let Q;if(G4(z))Q=J.getDisplayNameForColumn(z,"columnToolPanel");else Q=J.getDisplayNameForProvidedColumnGroup(null,z,"columnToolPanel");if(this.displayName=Q,this.buildMenuItemMap(),this.isActive()){let Z=this.mouseEventOrTouch;if("preventDefault"in Z)Z.preventDefault();let $=this.getMappedMenuItems();if($.length===0)return;this.displayContextMenu($)}}initializeProperties(z){let J=this.beans.columnStateUpdateStrategy,Q;if(G0(z))Q=z.getLeafColumns();else Q=[z];this.columns=Q;let Z=J.getPivotMode(i(this.params));this.allowScrollIntoView=!Z&&Q.some(this.isColumnValidForScrollIntoView),this.allowGrouping=Q.some(($)=>$.isPrimary()&&$.isAllowRowGroup()),this.allowValues=Q.some(($)=>$.isPrimary()&&$.isAllowValue()),this.allowPivoting=Z&&Q.some(($)=>$.isPrimary()&&$.isAllowPivot())}buildMenuItemMap(){let z=this.getLocaleTextFunc(),{beans:J,displayName:Q}=this,Z=this.beans.columnStateUpdateStrategy,$=new Map;this.menuItemMap=$;let X=i(this.params),Y=Z.getPivotMode(X),q=new Set(Z.getRowGroupColumns(X).map((B)=>B.getColId())),G=new Set(Z.getValueColumns(X).map((B)=>B.getColId())),H=new Set(Z.getPivotColumns(X).map((B)=>B.getColId()));$.set("scrollIntoView",{allowedFunction:(B)=>!B.isPinned()&&!Y&&this.isColumnValidForScrollIntoView(B),activeFunction:()=>!1,activateLabel:()=>z("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 _=(B)=>B.isPrimary()&&B.isAllowRowGroup()&&!Jz(B,J);$.set("rowGroup",{allowedFunction:_,activeFunction:(B)=>q.has(B.getColId()),activateLabel:()=>e6(z,"groupBy",Q),deactivateLabel:()=>e6(z,"ungroupBy",Q),activateFunction:()=>{let B=this.addColumnsToList(Z.getRowGroupColumns(X),_);Z.setRowGroupColumns(X,B,"toolPanelUi"),u0(this.beans,this.params)},deActivateFunction:()=>{let B=this.removeColumnsFromList(Z.getRowGroupColumns(X),_);Z.setRowGroupColumns(X,B,"toolPanelUi"),u0(this.beans,this.params)},addIcon:"menuAddRowGroup",removeIcon:"menuRemoveRowGroup"});let U=(B)=>B.isPrimary()&&B.isAllowValue();$.set("value",{allowedFunction:U,activeFunction:(B)=>G.has(B.getColId()),activateLabel:()=>z("addToValues",`Add ${Q} to values`,[Q]),deactivateLabel:()=>z("removeFromValues",`Remove ${Q} from values`,[Q]),activateFunction:()=>{let B=this.addColumnsToList(Z.getValueColumns(X),U);Z.setValueColumns(X,B,"toolPanelUi"),u0(this.beans,this.params)},deActivateFunction:()=>{let B=this.removeColumnsFromList(Z.getValueColumns(X),U);Z.setValueColumns(X,B,"toolPanelUi"),u0(this.beans,this.params)},addIcon:"valuePanel",removeIcon:"valuePanel"});let W=(B)=>Y&&B.isPrimary()&&B.isAllowPivot();$.set("pivot",{allowedFunction:W,activeFunction:(B)=>H.has(B.getColId()),activateLabel:()=>z("addToLabels",`Add ${Q} to labels`,[Q]),deactivateLabel:()=>z("removeFromLabels",`Remove ${Q} from labels`,[Q]),activateFunction:()=>{let B=this.addColumnsToList(Z.getPivotColumns(X),W);Z.setPivotColumns(X,B,"toolPanelUi"),u0(this.beans,this.params)},deActivateFunction:()=>{let B=this.removeColumnsFromList(Z.getPivotColumns(X),W);Z.setPivotColumns(X,B,"toolPanelUi"),u0(this.beans,this.params)},addIcon:"pivotPanel",removeIcon:"pivotPanel"})}isColumnValidForScrollIntoView(z){if(!z.isVisible())return!1;let Q=z.getParent();if(!Q)return!0;return Q.getDisplayedChildren()?.includes(z)??!0}addColumnsToList(z,J){return[...z].concat(this.columns.filter((Q)=>J(Q)&&!z.includes(Q)))}removeColumnsFromList(z,J){return z.filter((Q)=>!J(Q)||!this.columns.includes(Q))}displayContextMenu(z){let J=this.getGui(),Q=this.createBean(new Qq),Z=this.getLocaleTextFunc(),$=()=>{};J.appendChild(Q.getGui()),Q.addMenuItems(z),Q.addManagedListeners(Q,{closeMenu:()=>{this.parentEl.focus(),$()}});let X=this.beans.popupSvc,Y=X.addPopup({modal:!0,eChild:J,closeOnEsc:!0,afterGuiAttached:()=>k0(Q.getGui()),ariaLabel:Z("ariaLabelContextMenu","Context Menu"),closedCallback:(q)=>{if(q instanceof KeyboardEvent)this.parentEl.focus();this.destroyBean(Q)}});if(Y)$=Y.hideFunc;X.positionPopupUnderMouseEvent({type:"columnContextMenu",mouseEvent:this.mouseEventOrTouch,ePopup:J})}isActive(){return this.allowScrollIntoView||this.allowGrouping||this.allowValues||this.allowPivoting}getMappedMenuItems(){let z=[],{menuItemMap:J,columns:Q,displayName:Z,beans:$}=this;for(let X of J.values()){let Y=Q.some((G)=>X.allowedFunction(G)&&!X.activeFunction(G)),q=Q.some((G)=>X.allowedFunction(G)&&X.activeFunction(G));if(Y)z.push({name:X.activateLabel(Z),icon:h(X.addIcon,$,null),action:()=>X.activateFunction()});if(q&&X.removeIcon&&X.deactivateLabel)z.push({name:X.deactivateLabel(Z),icon:h(X.removeIcon,$,null),action:()=>X.deActivateFunction?.()})}return z}},VR={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"}]},$q=class extends y{constructor(z,J,Q,Z,$){super();this.modelItem=z,this.allowDragging=J,this.eventType=Q,this.focusWrapper=Z,this.params=$,this.cbSelect=j,this.eLabel=j,this.eGroupOpenedIcon=j,this.eGroupClosedIcon=j,this.eColumnGroupIcons=j,this.processingColumnStateChange=!1;let{columnGroup:X,depth:Y,displayName:q}=z;this.columnGroup=X,this.columnDepth=Y,this.displayName=q}postConstruct(){this.setTemplate(VR,[K4]);let{beans:z,cbSelect:J,eLabel:Q,displayName:Z,columnDepth:$,modelItem:X,focusWrapper:Y,columnGroup:q}=this,{registry:G,gos:H}=z,_=h("columnDrag",z);this.eDragHandle=_,_.classList.add("ag-drag-handle","ag-column-select-column-group-drag-handle");let U=J.getGui(),W=J.getInputElement();U.after(_),W.setAttribute("tabindex","-1"),Q.textContent=Z??"",this.setupExpandContract(),this.addCss("ag-column-select-indent-"+$),this.getGui().style.setProperty("--ag-indentation-level",String($)),this.tooltipFeature=this.createOptionalManagedBean(G.createDynamicBean("tooltipFeature",!1,{getGui:()=>this.focusWrapper,getLocation:()=>"columnToolPanelColumnGroup",shouldDisplayTooltip:r2(H,()=>Q)})),this.addManagedEventListeners({columnPivotModeChanged:this.onColumnStateChanged.bind(this)}),this.addManagedElementListeners(Q,{click:this.onLabelClicked.bind(this)}),this.addManagedListeners(J,{fieldValueChanged:this.onCheckboxChanged.bind(this)}),this.addManagedListeners(X,{expandedChanged:this.onExpandChanged.bind(this)});let B=new c0(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=UJ(q.getColGroupDef(),H,null,q);for(let K of E)this.toggleCss(K,!0)}getColumns(){return this.columnGroup.getLeafColumns()}setupTooltip(){let z=this.columnGroup.getColGroupDef();if(!z)return;let J=()=>this.tooltipFeature?.setTooltipAndRefresh(z.headerTooltip);J(),this.addManagedEventListeners({newColumnsLoaded:J})}handleKeyDown(z){switch(z.key){case k.LEFT:z.preventDefault(),this.modelItem.expanded=!1;break;case k.RIGHT:z.preventDefault(),this.modelItem.expanded=!0;break;case k.SPACE:if(z.preventDefault(),this.isSelectable())this.onSelectAllChanged(!this.isSelected());break}}onContextMenu(z){let{columnGroup:J,gos:Q}=this;if(Q.get("functionsReadOnly"))return;let Z=this.createBean(new Zq(J,z,this.focusWrapper,this.params));this.addDestroyFunc(()=>{if(Z.isAlive())this.destroyBean(Z)})}addVisibilityListenersToAllChildren(){let z=this.onColumnStateChanged.bind(this);for(let J of this.columnGroup.getLeafColumns())this.addManagedListeners(J,{visibleChanged:z,columnValueChanged:z,columnPivotChanged:z,columnRowGroupChanged:z})}setupDragging(){if(!this.allowDragging){w(this.eDragHandle,!1);return}let z=this.beans,{gos:J,eventSvc:Q,dragAndDrop:Z}=z,$=!J.get("suppressDragLeaveHidesColumns"),X={type:E4.ToolPanel,eElement:this.eDragHandle,dragItemName:this.displayName,getDefaultIconName:()=>$?"hide":"notAllowed",getDragItem:()=>this.createDragItem(),onDragStarted:()=>{$=!J.get("suppressDragLeaveHidesColumns"),Q.dispatchEvent({type:"columnPanelItemDragStart",column:this.columnGroup})},onDragStopped:()=>{Q.dispatchEvent({type:"columnPanelItemDragEnd"})},onGridEnter:(Y)=>{if($)aY(z,{columns:this.columnGroup.getLeafColumns(),visibleState:Y?.visibleState,pivotState:Y?.pivotState,eventType:this.eventType,buttons:this.params.buttons})},onGridExit:()=>{if($)this.onChangeCommon(!1)}};Z.addDragSource(X,!0),this.addDestroyFunc(()=>Z.removeDragSource(X))}createDragItem(){let z=this.columnGroup.getLeafColumns(),J={},Q={},Z=this.beans.columnStateUpdateStrategy,$=i(this.params);for(let X of z){let Y=X.getId();J[Y]=X.isVisible(),Q[Y]=oY(X,Z,$)}return{columns:z,visibleState:J,pivotState:Q}}setupExpandContract(){let{beans:z,eGroupClosedIcon:J,eGroupOpenedIcon:Q,eColumnGroupIcons:Z}=this;J.appendChild(P1("columnSelectClosed",z,null)),Q.appendChild(P1("columnSelectOpen",z,null));let $=this.onExpandOrContractClicked.bind(this);this.addManagedElementListeners(J,{click:$}),this.addManagedElementListeners(Q,{click:$});let X=new c0(Z,!0);this.addManagedListeners(X,{tap:$}),this.addDestroyFunc(X.destroy.bind(X))}onLabelClicked(){let z=!this.cbSelect.getValue();this.onChangeCommon(z)}onCheckboxChanged(z){this.onChangeCommon(z.selected)}getVisibleLeafColumns(){let z=[],J=(Q)=>{for(let Z of Q)if(Z.passesFilter)if(Z.group)J(Z.children);else z.push(Z.column)};return J(this.modelItem.children),z}onChangeCommon(z){if(this.refreshAriaLabel(),this.processingColumnStateChange)return;sY(this.beans,this.modelItem.children,z,this.eventType,this.params)}refreshAriaLabel(){let{cbSelect:z,focusWrapper:J,displayName:Q}=this,Z=this.getLocaleTextFunc(),$=Z("ariaColumnGroup","Column Group"),X=z.getValue(),Y=X===void 0?Z("ariaIndeterminate","indeterminate"):X?Z("ariaVisible","visible"):Z("ariaHidden","hidden"),q=Z("ariaToggleVisibility","Press SPACE to toggle visibility");_0(J,`${Q} ${$}`),z.setInputAriaLabel(`${q} (${Y})`),c2(J,z.getInputElement().id)}onColumnStateChanged(){let z=this.workOutSelectedValue(),J=this.workOutReadOnlyValue();this.processingColumnStateChange=!0;let Q=this.cbSelect;Q.setValue(z),Q.setReadOnly(J),this.toggleCss("ag-column-select-column-group-readonly",J),this.processingColumnStateChange=!1}workOutSelectedValue(){let J=this.beans.columnStateUpdateStrategy.getPivotMode(i(this.params)),Q=this.getVisibleLeafColumns(),Z=0,$=0;for(let X of Q)if(J||!X.getColDef().lockVisible)if(this.isColumnChecked(X))Z++;else $++;if(Z>0&&$>0)return;return Z>0}workOutReadOnlyValue(){let z=this.beans.columnStateUpdateStrategy.getPivotMode(i(this.params)),J=0;for(let Q of this.columnGroup.getLeafColumns())if(z){if(Q.isAnyFunctionAllowed())J++}else if(!Q.getColDef().lockVisible)J++;return J===0}isColumnChecked(z){let J=this.beans.columnStateUpdateStrategy;if(J.getPivotMode(i(this.params)))return J.isColumnSelectedInPivotModeToolPanel(i(this.params),z);return J.isColumnVisibleInToolPanel(i(this.params),z)}onExpandOrContractClicked(){let z=this.modelItem,J=z.expanded;z.expanded=!J}onExpandChanged(){this.setOpenClosedIcons(),this.refreshAriaExpanded()}setOpenClosedIcons(){let z=this.modelItem.expanded;w(this.eGroupClosedIcon,!z),w(this.eGroupOpenedIcon,z)}refreshAriaExpanded(){R0(this.focusWrapper,this.modelItem.expanded)}getDisplayName(){return this.displayName}onSelectAllChanged(z){let J=this.cbSelect,Q=J.getValue();if(!J.isReadOnly()&&(z&&!Q||!z&&Q))J.toggle()}isSelected(){return this.cbSelect.getValue()}isSelectable(){return!this.cbSelect.isReadOnly()}setSelected(z){this.cbSelect.setValue(z,!0)}},w5=(z)=>{if(G0(z))return z.getLeafColumns();return z?[z]:[]},SR=(z,J,Q,Z)=>{if(!J||!z)return null;let $=Z.indexOf(J),X=Q?$:$+1,Y=AR(Z,z,X);return X-Y},AR=(z,J,Q)=>{if(!J)return 0;let Z=J[0],$=J.length;if(z.indexOf(Z){let $=i(Z);if(z.get("suppressMovableColumns")||J.columnStateUpdateStrategy.getPivotMode($))return!0;return!!Q.find(({colDef:q})=>!!q.suppressMovable||!!q.lockPosition)},$Y=(z,J,Q,Z)=>{if(!Q)return;let{component:$}=Q,X=null,Y=Q.position==="top";if($ instanceof $q)X=$.getColumns()[0],Y=!0;else if($)X=$.column;if(!X)return;let q=i(Z),G=q?z.columnStateUpdateStrategy.getPrimaryColumns(q):z.colModel.getCols(),H=SR(J,X,Y,G);if(H!=null)z.columnStateUpdateStrategy.moveColumns(q,J,H,"toolPanelUi"),u0(z,Z)},RR=(z)=>{return z.column},jR={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"}]},OR=class extends y{constructor(z,J,Q,Z,$){super();this.modelItem=z,this.allowDragging=J,this.groupsExist=Q,this.focusWrapper=Z,this.params=$,this.eLabel=j,this.cbSelect=j,this.processingColumnStateChange=!1;let{column:X,depth:Y,displayName:q}=z;this.column=X,this.columnDepth=Y,this.displayName=q}postConstruct(){this.setTemplate(jR,[K4]);let{beans:z,cbSelect:J,displayName:Q,eLabel:Z,columnDepth:$,groupsExist:X,column:Y,gos:q,focusWrapper:G}=this,H=h("columnDrag",z);this.eDragHandle=H,H.classList.add("ag-drag-handle","ag-column-select-column-drag-handle");let _=J.getGui(),U=J.getInputElement();if(_.after(H),U.setAttribute("tabindex","-1"),Z.textContent=Q,X)this.addCss("ag-column-select-add-group-indent");this.addCss(`ag-column-select-indent-${$}`),this.getGui().style.setProperty("--ag-indentation-level",String($)),this.tooltipFeature=this.createOptionalManagedBean(z.registry.createDynamicBean("tooltipFeature",!1,{getGui:()=>this.focusWrapper,getLocation:()=>"columnToolPanelColumn",shouldDisplayTooltip:r2(q,()=>Z),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 c0(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(J,{fieldValueChanged:this.onCheckboxChanged.bind(this)}),this.addManagedElementListeners(Z,{click:this.onLabelClicked.bind(this)}),this.onColumnStateChanged(),this.refreshAriaLabel(),this.setupTooltip();let E=UJ(Y.getColDef(),q,Y,null);for(let K of E)this.toggleCss(K,!0)}getColumn(){return this.column}setupTooltip(){let z=()=>this.tooltipFeature?.setTooltipAndRefresh(this.column.getColDef().headerTooltip);z(),this.addManagedEventListeners({newColumnsLoaded:z})}onContextMenu(z){let{column:J,gos:Q}=this;if(Q.get("functionsReadOnly"))return;let Z=this.createBean(new Zq(J,z,this.focusWrapper,this.params));this.addDestroyFunc(()=>{if(Z.isAlive())this.destroyBean(Z)})}handleKeyDown(z){if(z.key===k.SPACE){if(z.preventDefault(),this.isSelectable())this.onSelectAllChanged(!this.isSelected())}}onLabelClicked(){if(this.gos.get("functionsReadOnly"))return;let z=!this.cbSelect.getValue();this.onChangeCommon(z)}onCheckboxChanged(z){this.onChangeCommon(z.selected)}onChangeCommon(z){if(this.cbSelect.isReadOnly())return;if(this.refreshAriaLabel(),this.processingColumnStateChange)return;lY(this.beans,[this.column],z,"toolPanelUi",this.params)}refreshAriaLabel(){let{cbSelect:z,focusWrapper:J,displayName:Q}=this,Z=this.getLocaleTextFunc(),$=Z("ariaColumn","Column"),X=z.getValue()?Z("ariaVisible","visible"):Z("ariaHidden","hidden"),Y=Z("ariaToggleVisibility","Press SPACE to toggle visibility");_0(J,`${Q} ${$}`),this.cbSelect.setInputAriaLabel(`${Y} (${X})`),c2(J,z.getInputElement().id)}setupDragging(){let z=this.eDragHandle;if(!this.allowDragging){w(z,!1);return}let J=this.beans,{gos:Q,eventSvc:Z,dragAndDrop:$}=J;if(i(this.params))z.setAttribute("data-column-tool-panel-deferred","");let X=!Q.get("suppressDragLeaveHidesColumns"),Y={type:E4.ToolPanel,eElement:z,dragItemName:this.displayName,getDefaultIconName:()=>X&&!i(this.params)?"hide":"notAllowed",getDragItem:()=>this.createDragItem(),onDragStarted:()=>{X=!Q.get("suppressDragLeaveHidesColumns"),Z.dispatchEvent({type:"columnPanelItemDragStart",column:this.column})},onDragStopped:()=>{Z.dispatchEvent({type:"columnPanelItemDragEnd"})},onGridEnter:(q)=>{if(X&&!i(this.params))aY(J,{columns:[this.column],visibleState:q?.visibleState,pivotState:q?.pivotState,eventType:"toolPanelUi",buttons:this.params.buttons})},onGridExit:()=>{if(X&&!i(this.params))this.onChangeCommon(!1)}};$.addDragSource(Y,!0),this.addDestroyFunc(()=>$.removeDragSource(Y))}createDragItem(){let z=this.column.getColId(),J={[z]:this.column.isVisible()},Q=this.beans.columnStateUpdateStrategy,Z={[z]:oY(this.column,Q,i(this.params))};return{columns:[this.column],visibleState:J,pivotState:Z}}onColumnStateChanged(){this.processingColumnStateChange=!0;let z=this.beans.columnStateUpdateStrategy,J=z.getPivotMode(i(this.params));if(J){let $=z.isColumnSelectedInPivotModeToolPanel(i(this.params),this.column);this.cbSelect.setValue($)}else this.cbSelect.setValue(z.isColumnVisibleInToolPanel(i(this.params),this.column));let Q=!0,Z=!0;if(J){let $=this.gos.get("functionsReadOnly"),X=!this.column.isAnyFunctionAllowed();Q=!$&&!X,Z=Q}else{let{enableRowGroup:$,enableValue:X,lockPosition:Y,suppressMovable:q,lockVisible:G}=this.column.getColDef(),H=!!$||!!X,_=!!Y||!!q;Q=!G,Z=H||!_}this.cbSelect.setReadOnly(!Q),this.eDragHandle.classList.toggle("ag-column-select-column-readonly",!Z),this.toggleCss("ag-column-select-column-readonly",!Z&&!Q),this.cbSelect.setPassive(!1),this.processingColumnStateChange=!1}getDisplayName(){return this.displayName}onSelectAllChanged(z){let J=this.cbSelect;if(z!==J.getValue()){if(!J.isReadOnly())J.toggle()}}isSelected(){return this.cbSelect.getValue()}isSelectable(){return!this.cbSelect.isReadOnly()}isExpandable(){return!1}setExpanded(z){R(158)}},PR=class{constructor(z){this.items=z}getRowCount(){return this.items.length}getRow(z){return this.items[z]}},TR="ag-column-select-list",vR=class extends y{constructor(){super({tag:"div",cls:TR,role:"presentation"});this.destroyColumnItemFuncs=[],this.hasLoadedInitialState=!1,this.isInitialState=!1,this.skipRefocus=!1}wireBeans(z){this.colModel=z.colModel}destroy(){this.destroyColumnTree(),super.destroy()}destroyColumnTree(){this.allColsTree=[];for(let z of this.destroyColumnItemFuncs)z();this.destroyColumnItemFuncs=[]}init(z,J,Q){this.params=z;let{suppressSyncLayoutWithGrid:Z,contractColumnSelection:$,suppressColumnMove:X}=z;if(this.allowDragging=J,this.eventType=Q,!Z)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=!$;let q=X||Z,G=this.createManagedBean(new e5({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 sz(_,H.depth+1),this.createComponentFromItem(H,_)}),this.colModel.ready)this.onColumnsChanged();if(q)return;this.createItemDragFeature()}createItemDragFeature(){let{gos:z,beans:J,virtualList:Q}=this;this.createManagedBean(new OA(this,Q,{dragSourceType:E4.ToolPanel,addListeners:(Z,$,X)=>{Z.addManagedEventListeners({columnPanelItemDragStart:$,columnPanelItemDragEnd:X})},getCurrentDragValue:(Z)=>RR(Z),isMoveBlocked:(Z)=>ZY(z,J,w5(Z),this.params),getNumRows:(Z)=>Z.getDisplayedColsList().length,moveItem:(Z,$)=>$Y(J,w5(Z),$,this.params)}))}moveItems(z,J){let{gos:Q,beans:Z}=this,{modelItem:$}=z,{group:X,columnGroup:Y,column:q,expanded:G}=$,H=w5(X?Y:q);if(ZY(Q,Z,H,this.params))return;let _=this.displayedColsList.indexOf($),U=J?-1:1,W=0;if(J){let E=z.columnDepth>0?q.getParent()?.getChildren():null;if(E?.length&&q===E[0])W=-1}else if(X)W=G?$.children.length:0;let B=Math.min(Math.max(_+W+U,0),this.displayedColsList.length-1);this.skipRefocus=!0,$Y(Z,H,{rowIndex:B,position:J?"top":"bottom",component:this.virtualList.getComponentAt(B)},this.params),this.focusRowIfAlive(B-W).then(()=>{this.skipRefocus=!1})}createComponentFromItem(z,J){let Q=this.allowDragging;if(z.group){let $=new $q(z,Q,this.eventType,J,this.params);return this.createBean($),$}let Z=new OR(z,Q,this.groupsExist,J,this.params);return this.createBean(Z),Z}onColumnsChanged(){let z=this.params;if(!this.hasLoadedInitialState)this.hasLoadedInitialState=!0,this.isInitialState=!!z.initialState;let J=this.getExpandedStates(),Q=this.colModel.isPivotMode(),Z=i(z),$=Z&&this.beans.columnStateUpdateStrategy.hasDeferredColumnOrder(Z);if((!z.suppressSyncLayoutWithGrid||Z)&&!Q||$)this.buildTreeFromWhatGridIsDisplaying();else this.buildTreeFromProvidedColumnDefs();this.setExpandedStates(J),this.markFilteredColumns(),this.flattenAndFilterModel(),this.isInitialState=!1}getDisplayedColsList(){return this.displayedColsList}getExpandedStates(){let z={};if(this.isInitialState){let{expandedGroupIds:J}=this.params.initialState;for(let Q of J)z[Q]=!0;return z}if(!this.allColsTree)return{};return this.forEachItem((J)=>{if(!J.group)return;let Q=J.columnGroup;if(Q)z[Q.getId()]=J.expanded}),z}setExpandedStates(z){if(!this.allColsTree)return;let{isInitialState:J}=this;this.forEachItem((Q)=>{if(!Q.group)return;let Z=Q.columnGroup;if(Z){let $=z[Z.getId()];if($!=null||J)Q.expanded=!!$}})}buildTreeFromWhatGridIsDisplaying(){let z=i(this.params);if(z&&this.beans.columnStateUpdateStrategy.hasDeferredColumnOrder(z)){let J=this.beans.columnStateUpdateStrategy.getPrimaryColumns(z);if(J.length>0){_R(J,this.setColumnLayout.bind(this));return}}if(this.params.suppressSyncLayoutWithGrid){this.buildTreeFromProvidedColumnDefs();return}HR(this.colModel,this.setColumnLayout.bind(this))}setColumnLayout(z){let J=GR(this.colModel,z);this.buildListModel(J),this.groupsExist=z.some((Q)=>{return Q&&typeof Q.children<"u"}),this.markFilteredColumns(),this.flattenAndFilterModel()}buildTreeFromProvidedColumnDefs(){let z=this.colModel;this.buildListModel(z.getColDefColTree()),this.groupsExist=!!z.colDefCols?.treeDepth}buildListModel(z){let J=this.onColumnExpanded.bind(this),Q=(q)=>{q.addEventListener("expandedChanged",J);let G=q.removeEventListener.bind(q,"expandedChanged",J);this.destroyColumnItemFuncs.push(G)},Z=this.beans.colNames,$=(q,G,H)=>{for(let _ of q)if(G0(_))X(_,G,H);else Y(_,G,H)},X=(q,G,H)=>{if(q.getColGroupDef()?.suppressColumnsToolPanel)return;if(q.isPadding()){$(q.getChildren(),G,H);return}let W=Z.getDisplayNameForProvidedColumnGroup(null,q,"columnToolPanel"),B=new zY(W,q,G,!0,this.expandGroupsByDefault);H.push(B),Q(B),$(q.getChildren(),G+1,B.children)},Y=(q,G,H)=>{if(q.getColDef()?.suppressColumnsToolPanel)return;let U=Z.getDisplayNameForColumn(q,"columnToolPanel");H.push(new zY(U,q,G))};this.destroyColumnTree(),$(z,0,this.allColsTree)}onColumnExpanded(){this.flattenAndFilterModel()}flattenAndFilterModel(){this.displayedColsList=[];let z=(Z)=>{if(!Z.passesFilter)return;if(this.displayedColsList.push(Z),Z.group&&Z.expanded)Z.children.forEach(z)},J=this.virtualList;this.allColsTree.forEach(z),J.setModel(new PR(this.displayedColsList));let Q=null;if(!this.skipRefocus)Q=J.getLastFocusedRow();if(J.refresh(),Q!=null)this.focusRowIfAlive(Q);this.notifyListeners(),this.refreshAriaLabel()}refreshAriaLabel(){let z=this.getLocaleTextFunc(),J=z("ariaColumnPanelList","Column List"),Q=z("columns","Columns"),Z=this.displayedColsList.length;_0(this.virtualList.getAriaElement(),`${J} ${Z} ${Q}`)}focusRowIfAlive(z){if(z===-1)return Promise.resolve();return new Promise((J)=>{window.setTimeout(()=>{if(this.isAlive())this.virtualList.focusRow(z);J()},0)})}forEachItem(z){let J=(Z)=>{for(let $ of Z)if(z($),$.group)J($.children)},Q=this.allColsTree;if(!Q)return;J(Q)}doSetExpandedAll(z){this.forEachItem((J)=>{if(J.group)J.expanded=z})}setGroupsExpanded(z,J){if(!J){this.doSetExpandedAll(z);return}let Q=[];this.forEachItem(($)=>{if(!$.group)return;let X=$.columnGroup.getId();if(J.indexOf(X)>=0)$.expanded=z,Q.push(X)});let Z=J.filter(($)=>!Q.includes($));if(Z.length>0)R(157,{unrecognisedGroupIds:Z})}getExpandState(){let z=0,J=0;if(this.forEachItem((Q)=>{if(!Q.group)return;if(Q.expanded)z++;else J++}),z>0&&J>0)return 2;if(J>0)return 1;return 0}doSetSelectedAll(z){sY(this.beans,this.allColsTree,z,this.eventType,this.params),this.syncVisibleSelectionState(),this.fireSelectionChangedEvent()}syncVisibleSelectionState(){for(let z=0;z{if($.group)return;if(!$.passesFilter)return;let X=$.column,Y=X.getColDef(),q;if(Z){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)z++;else J++}),z>0&&J>0)return;return!(z===0||J>0)}setFilterText(z){this.filterText=T(z)?z.toLowerCase():null,this.markFilteredColumns(),this.flattenAndFilterModel()}markFilteredColumns(){let z=(Q)=>{if(!T(this.filterText))return!0;let Z=Q.displayName;return Z==null||Z.toLowerCase().indexOf(this.filterText)!==-1},J=(Q,Z)=>{let $=!1;if(Q.group){let Y=z(Q);for(let q of Q.children){let G=J(q,Y||Z);if(G)$=G}}let X=Z||$?!0:z(Q);return Q.passesFilter=X,X};for(let Q of this.allColsTree)J(Q,!1)}notifyListeners(){this.fireGroupExpandedEvent(),this.fireSelectionChangedEvent()}fireGroupExpandedEvent(){let z=this.getExpandState();this.dispatchLocalEvent({type:"groupExpanded",state:z})}fireSelectionChangedEvent(){if(!this.allColsTree)return;let z=this.getSelectionState();this.dispatchLocalEvent({type:"selectionChanged",state:z})}getExpandedGroups(){let z=[];if(!this.allColsTree)return z;return this.forEachItem((J)=>{if(J.group&&J.expanded)z.push(J.columnGroup.getId())}),z}},IR={selector:"AG-PRIMARY-COLS-LIST",component:vR},CR={tag:"div",cls:"ag-column-select",children:[{tag:"ag-primary-cols-header",ref:"primaryColsHeaderPanel"},{tag:"ag-primary-cols-list",ref:"primaryColsListPanel"}]},Xq=class extends y{constructor(){super(CR,[qR,IR]);this.primaryColsHeaderPanel=j,this.primaryColsListPanel=j,this.registerCSS(ZR)}init(z,J,Q){let{primaryColsHeaderPanel:Z,primaryColsListPanel:$}=this;Z.init(J);let{suppressColumnFilter:X,suppressColumnSelectAll:Y}=J;if(J.suppressColumnExpandAll&&X&&Y)Z.setDisplayed(!1);this.addManagedListeners($,{groupExpanded:(G)=>{Z.setExpandState(G.state),J.onStateUpdated()},selectionChanged:(G)=>Z.setSelectionState(G.state)}),$.init(J,z,Q),this.addManagedListeners(Z,{expandAll:$.doSetExpandedAll.bind($,!0),collapseAll:$.doSetExpandedAll.bind($,!1),selectAll:$.doSetSelectedAll.bind($,!0),unselectAll:$.doSetSelectedAll.bind($,!1),filterChanged:(G)=>$.setFilterText(G.filterText)}),this.positionableFeature=this.createManagedBean(new h6(this.getGui(),{minHeight:100}))}toggleResizable(z){this.positionableFeature.setResizable(z?{bottom:!0}:!1)}expandGroups(z){this.primaryColsListPanel.setGroupsExpanded(!0,z)}collapseGroups(z){this.primaryColsListPanel.setGroupsExpanded(!1,z)}setColumnLayout(z){this.primaryColsListPanel.setColumnLayout(z)}syncLayoutWithGrid(){this.primaryColsListPanel.onColumnsChanged()}getExpandedGroups(){return this.primaryColsListPanel.getExpandedGroups()}},bR=".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)}",yR="ag-column-panel-deferred",xR=class extends y{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 z=this.captureGridState();if(!this.beans.columnStateUpdateStrategy.hasPendingChanges(this.isDeferModeEnabled)){this.lastKnownGridState=z;return}let J=this.lastKnownGridState&&this.isGridStateEqual(this.lastKnownGridState,z);if(this.lastKnownGridState=z,!J)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(bR)}wireBeans(z){this.colToolPanelFactory=z.colToolPanelFactory}setVisible(z){if(super.setDisplayed(z),z&&!this.initialised)this.init(this.params)}init(z){let Q={...C(this.gos,{suppressColumnMove:!1,suppressColumnSelectAll:!1,suppressColumnFilter:!1,suppressColumnExpandAll:!1,contractColumnSelection:!1,suppressPivotMode:!1,suppressRowGroups:!1,suppressValues:!1,suppressPivots:!1,suppressSyncLayoutWithGrid:!1}),...z};this.params=Q;let{childDestroyFuncs:Z,colToolPanelFactory:$,gos:X}=this,Y=X.isModuleRegistered("SharedPivot"),q=Y||X.isModuleRegistered("SharedRowGrouping");if(this.isDeferModeEnabled=i(Q),this.toggleCss(yR,this.isDeferModeEnabled),!Q.suppressPivotMode&&$&&Y)this.pivotModePanel=$.createPivotModePanel(this,Z,Q,this.onPivotModePanelValueChanged);let G=this.createBean(new Xq);if(this.primaryColsPanel=G,Z.push(()=>this.destroyBean(this.primaryColsPanel)),G.init(!0,Q,"toolPanelUi"),G.addCss("ag-column-panel-column-select"),this.appendChild(G),$){if(!Q.suppressRowGroups&&q)this.rowGroupDropZonePanel=$.createRowGroupPanel(this,Z,Q);if(!Q.suppressValues&&q)this.valuesDropZonePanel=$.createValuesPanel(this,Z,Q);if(!Q.suppressPivots&&Y)this.pivotDropZonePanel=$.createPivotPanel(this,Z,Q);this.setLastVisible();let[H]=this.addManagedEventListeners({columnPivotModeChanged:()=>{this.resetChildrenHeight(),this.setLastVisible()}});Z.push(()=>H())}if(this.isDeferModeEnabled){let H=this.onExternalGridChange;Z.push(...this.addManagedEventListeners({columnEverythingChanged:this.onColumnEverythingChanged,sortChanged:H,columnVisible:H,columnRowGroupChanged:H,columnValueChanged:H,columnPivotChanged:H,columnPivotModeChanged:H,newColumnsLoaded:H,...Q.suppressSyncLayoutWithGrid?{}:{columnMoved:H}}))}if(Q.buttons){if(!Q.buttons.includes("apply"))R(298);if(Q.buttons.length)this.initDeferredButtons(Q.buttons)}this.initialised=!0}initDeferredButtons(z){let J=this.createBean(new B5({className:"ag-column-panel-buttons"}));this.deferredButtonsComp=J,this.childDestroyFuncs.push(()=>{this.deferredButtonsComp=this.destroyBean(this.deferredButtonsComp)});let Q=this.getLocaleTextFunc(),Z=z.map(($)=>({type:$,label:Q($==="apply"?"applyColumnToolPanel":"cancelColumnToolPanel",$==="apply"?"Apply":"Cancel")}));J.updateButtons(Z),J.updateValidity(!1),J.addManagedListeners(J,{apply:this.onDeferredApply,cancel:this.onDeferredCancel}),this.appendChild(J)}resetDeferredState(){this.beans.columnStateUpdateStrategy.reset(this.isDeferModeEnabled),this.deferredButtonsComp?.updateValidity(!1),this.refreshToolPanelLayouts(),this.pivotModePanel?.refreshEditStrategy()}captureGridState(){let{beans:z}=this,J=(Q)=>(Q??[]).map((Z)=>Z.getColId());return{rowGroupColIds:J(z.rowGroupColsSvc?.columns),valueColIds:J(z.valueColsSvc?.columns),pivotColIds:J(z.pivotColsSvc?.columns),pivotMode:z.colModel.isPivotMode(),columnOrder:z.colModel.getCols().map((Q)=>Q.getColId()),visibleColIds:z.colModel.getCols().filter((Q)=>Q.isVisible()).map((Q)=>Q.getColId()),sortState:z.colModel.getCols().filter((Q)=>Q.getSort()).map((Q)=>`${Q.getColId()}:${Q.getSort()}:${Q.getSortIndex()}`),aggFuncState:(z.valueColsSvc?.columns??[]).map((Q)=>Q.getAggFunc()),widthState:z.colModel.getCols().map((Q)=>`${Q.getColId()}:${Q.getActualWidth()}`)}}isGridStateEqual(z,J){return Z0(z.rowGroupColIds,J.rowGroupColIds)&&Z0(z.valueColIds,J.valueColIds)&&Z0(z.pivotColIds,J.pivotColIds)&&z.pivotMode===J.pivotMode&&Z0(z.columnOrder,J.columnOrder)&&Z0(z.visibleColIds,J.visibleColIds)&&Z0(z.sortState,J.sortState)&&Z0(z.aggFuncState,J.aggFuncState)&&Z0(z.widthState,J.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(z){let J=this.colToolPanelFactory;if(!J)return;this.pivotModePanel=J.setPanelVisible(this.pivotModePanel,z,J.createPivotModePanel.bind(J,this,this.childDestroyFuncs,this.params,this.onPivotModePanelValueChanged,!0)),this.setLastVisible()}setRowGroupsSectionVisible(z){let J=this.colToolPanelFactory;if(!J)return;this.rowGroupDropZonePanel=J.setPanelVisible(this.rowGroupDropZonePanel,z,J.createRowGroupPanel.bind(J,this,this.childDestroyFuncs,this.params)),this.setLastVisible()}setValuesSectionVisible(z){let J=this.colToolPanelFactory;if(!J)return;this.valuesDropZonePanel=J.setPanelVisible(this.valuesDropZonePanel,z,J.createValuesPanel.bind(J,this,this.childDestroyFuncs,this.params)),this.setLastVisible()}setPivotSectionVisible(z){let J=this.colToolPanelFactory;if(!J)return;this.pivotDropZonePanel=J.setPanelVisible(this.pivotDropZonePanel,z,J.createPivotPanel.bind(J,this,this.childDestroyFuncs,this.params)),this.pivotDropZonePanel?.setDisplayed(z),this.setLastVisible()}setResizers(){for(let z of[this.primaryColsPanel,this.rowGroupDropZonePanel,this.valuesDropZonePanel,this.pivotDropZonePanel]){if(!z)continue;let J=z.getGui();z.toggleResizable(!J.classList.contains("ag-last-column-drop")&&!J.classList.contains("ag-hidden")&&!J.classList.contains("ag-last-visible-child"))}}setLastVisible(){let z=this.getGui(),J=Array.prototype.slice.call(z.querySelectorAll(".ag-column-drop"));for(let $ of J)$.classList.remove("ag-last-column-drop");let Q=z.querySelectorAll(".ag-column-drop:not(.ag-hidden)"),Z=b(Q);if(Z)Z.classList.add("ag-last-column-drop");this.primaryColsPanel.getGui().classList.toggle("ag-last-visible-child",!Z),this.setResizers()}resetChildrenHeight(){let J=this.getGui().children;for(let Q=0;QX.getGui().getBoundingClientRect()),$=Z.findIndex((X)=>this.horizontal?X.right>Q&&X.leftQ);if($===-1){let X=this.gos.get("enableRtl");if(Z.every((G)=>Q>(this.horizontal?G.right:G.bottom)))return X&&this.horizontal?0:this.childPillComponents.length;if(Z.every((G)=>Q<(this.horizontal?G.left:G.top)))return X&&this.horizontal?this.childPillComponents.length:0;return this.insertIndex}if(this.insertIndex<=$)return $+1;return $}checkDragStartedBySelf(z){if(this.state!=="notDragging")return;this.state="rearrangeItems",this.potentialDndItems=this.getItems(z.dragSource.getDragItem()),this.refreshGui(),this.checkInsertIndex(z),this.refreshGui()}onDragging(z){if(this.checkDragStartedBySelf(z),this.checkInsertIndex(z))this.refreshGui()}handleDragEnterEnd(z){}onDragEnter(z){let J=this.getItems(z.dragSource.getDragItem());this.state="newItemsIn";let Q=J.filter(($)=>this.isItemDroppable($,z)),Z=Q.every(($)=>this.childPillComponents.map((X)=>X.getItem()).indexOf($)!==-1);if(Q.length===0)return;if(this.potentialDndItems=Q,Z){this.state="notDragging";return}this.handleDragEnterEnd(z),this.checkInsertIndex(z),this.refreshGui()}isPotentialDndItems(){return!!this.potentialDndItems?.length}handleDragLeaveEnd(z){}onDragLeave(z){if(this.state==="rearrangeItems"){let J=this.getItems(z.dragSource.getDragItem());this.removeItems(J)}if(this.isPotentialDndItems())this.handleDragLeaveEnd(z),this.potentialDndItems=[],this.refreshGui();this.state="notDragging"}onDragCancel(z){if(this.isPotentialDndItems()){if(this.state==="newItemsIn")this.handleDragLeaveEnd(z);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(z){let J=this.getExistingItems().filter((Q)=>!z.includes(Q));this.updateItems(J),this.refreshGui()}addItems(z){if(!z)return;let J=this.getExistingItems().slice(),Q=z.filter((Z)=>J.indexOf(Z)<0);XY(J,Q,this.insertIndex),this.updateItems(J),this.refreshGui()}addItem(z){this.insertIndex=this.getExistingItems().length,this.addItems([z])}rearrangeItems(z,J){let Q;if(!J)Q=this.getNonGhostItems().slice();else Q=this.getExistingItems().filter((Z)=>z.indexOf(Z)===-1);if(XY(Q,z,this.insertIndex),Z0(Q,this.getExistingItems()))return!1;return this.updateItems(Q),this.refreshGui(),!0}refreshGui(){let z=0;if(!this.horizontal)z=this.ePillDropList.scrollTop;let J=this.resizeEnabled,Q=this.getFocusedItem(),{eGridDiv:Z}=this.beans,$=d2(),X=null;if($)X=P0(this.beans,Z)??P0(this.beans,Z,!1,!0);if(this.toggleResizable(!1),this.destroyGui(),this.addIconAndTitleToGui(),this.addEmptyMessageToGui(),this.addItemsToGui(),z!==0)this.ePillDropList.scrollTop=z;if(J)this.toggleResizable(J);if($)this.restoreFocus(Q,X)}getFocusedItem(){let z=this.getGui(),J=d(this.beans);if(!z.contains(J))return-1;return Array.from(z.querySelectorAll(".ag-column-drop-cell")).indexOf(J)}focusItemAtIndex(z){let J=this.getGui(),Z=Array.from(J.querySelectorAll(".ag-column-drop-cell"))[z];if(!Z)return;Z.focus({preventScroll:!0})}restoreFocus(z,J){let Q=this.getGui(),Z=Array.from(Q.querySelectorAll(".ag-column-drop-cell"));if(z===-1)return;if(Z.length===0)J.focus();let $=Math.min(Z.length-1,z),X=Z[$];if(X)X.focus()}focusList(z){let J=z?this.childPillComponents.length-1:0;this.restoreFocus(J,this.getFocusableElement())}getNonGhostItems(){let z=this.getExistingItems();if(this.isPotentialDndItems())return z.filter((J)=>!this.potentialDndItems.includes(J));return z}addItemsToGui(){let J=this.getNonGhostItems().map((Q)=>this.createItemComponent(Q,!1));if(this.isPotentialDndItems()){let Q=this.potentialDndItems.map((Z)=>this.createItemComponent(Z,!0));if(this.insertIndex>=J.length)J.push(...Q);else J.splice(this.insertIndex,0,...Q)}this.appendChild(this.ePillDropList),J.forEach((Q,Z)=>{if(Z>0)this.addArrow(this.ePillDropList);this.ePillDropList.appendChild(Q.getGui())}),this.addAriaLabelsToComponents()}addAriaLabelsToComponents(){let{childPillComponents:z,ePillDropList:J}=this,Q=z.length;H0(J,Q===0?"presentation":"listbox");for(let Z=0;Zthis.destroyBean(Q)),!J)this.childPillComponents.push(Q);return Q}addIconAndTitleToGui(){let{title:z,icon:J}=this.params;if(!z||!J)return;let Q=z0({tag:"div"});if(lz(Q,!0),this.addElementClasses(Q,"title-bar"),this.addElementClasses(J,"icon"),this.toggleCss("ag-column-drop-empty",this.isExistingItemsEmpty()),Q.appendChild(J),!this.horizontal){let Z=z0({tag:"span"});this.addElementClasses(Z,"title"),Z.textContent=z,Q.appendChild(Z)}this.appendChild(Q)}isExistingItemsEmpty(){return this.getExistingItems().length===0}addEmptyMessageToGui(){let{emptyMessage:z}=this.params;if(!z||!this.isExistingItemsEmpty()||this.isPotentialDndItems())return;let J=z0({tag:"span"});J.textContent=z,this.addElementClasses(J,"empty-message"),this.ePillDropList.appendChild(J)}addArrow(z){if(this.horizontal){let J=this.gos.get("enableRtl"),Q=h(J?"panelDelimiterRtl":"panelDelimiter",this.beans);this.addElementClasses(Q,"cell-separator"),z.appendChild(Q)}}},hR={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"}]},uR=class extends y{constructor(z,J,Q,Z,$){super();this.dragSourceDropTarget=z,this.ghost=J,this.horizontal=Q,this.template=Z,this.agComponents=$,this.eText=j,this.eDragHandle=j,this.eButton=j}postConstruct(){this.setTemplate(this.template??hR,this.agComponents);let z=this.getGui(),{beans:J,eDragHandle:Q,eText:Z,eButton:$}=this;if(this.addElementClasses(z),this.addElementClasses(Q,"drag-handle"),this.addElementClasses(Z,"text"),this.addElementClasses($,"button"),Q.appendChild(h("columnDrag",J)),$.appendChild(h("cancel",J)),this.tooltipFeature=this.createOptionalManagedBean(J.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 z=this.getLocaleTextFunc(),J=[this.getAriaDisplayName()];this.addAdditionalAriaInstructions(J,z),_0(this.getGui(),J.join(". "))}addAdditionalAriaInstructions(z,J){if(this.isRemovable()){let Q=J("ariaDropZoneColumnComponentDescription","Press DELETE to remove");z.push(Q)}}setupTooltip(){let z=()=>this.tooltipFeature?.setTooltipAndRefresh(this.getTooltip());z(),this.addManagedEventListeners({newColumnsLoaded:z})}getDragSourceId(){return}getDefaultIconName(){return"notAllowed"}addDragSource(){let{beans:{dragAndDrop:z},eDragHandle:J}=this,Q=this.createGetDragItem(),Z=this.getDefaultIconName(),$={type:this.getDragSourceType(),sourceId:this.getDragSourceId(),eElement:J,getDefaultIconName:()=>Z,getDragItem:Q,dragItemName:this.getDisplayName()};z?.addDragSource($,!0),this.addDestroyFunc(()=>z?.removeDragSource($))}setupComponents(){if(this.eText.textContent=this.getDisplayValue(),this.setupRemove(),this.ghost)this.addCss("ag-column-drop-cell-ghost")}isRemovable(){return!0}refreshRemove(){w(this.eButton,this.isRemovable())}setupRemove(){this.refreshRemove();let z={type:"columnRemove"};this.addGuiEventListener("keydown",(Q)=>this.onKeyDown(Q)),this.addManagedElementListeners(this.eButton,{click:(Q)=>{this.dispatchLocalEvent(z),Q.stopPropagation()}});let J=new c0(this.eButton);this.addManagedListeners(J,{tap:()=>this.dispatchLocalEvent(z)}),this.addDestroyFunc(J.destroy.bind(J))}onKeyDown(z){if(z.key===k.DELETE){if(this.isRemovable())z.preventDefault(),this.dispatchLocalEvent({type:"columnRemove"})}}getDisplayValue(){return this.getDisplayName()}addElementClasses(z,J){J=J?`-${J}`:"";let Q=this.horizontal?"horizontal":"vertical";z.classList.add(`ag-column-drop-cell${J}`,`ag-column-drop-${Q}-cell${J}`)}destroy(){super.destroy(),this.dragSourceDropTarget=null}},mR=class extends uR{constructor(z,J,Q,Z,$,X){super(J,Q,$);this.column=z,this.dropZonePurpose=Z,this.updateParams=X,this.eSortIndicator=j,this.popupShowing=!1,this.deferApply=i(X)}postConstruct(){let{sortSvc:z,colNames:J}=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"}},z?{tag:"ag-sort-indicator",ref:"eSortIndicator"}:void 0,{tag:"span",ref:"eButton",cls:"ag-column-drop-cell-button",role:"presentation"}]},z)this.agComponents=[z.getSortIndicatorSelector()];if(this.displayName=J.getDisplayNameForColumn(this.column,"columnDrop"),super.postConstruct(),this.deferApply)this.eDragHandle.setAttribute("data-column-tool-panel-deferred","");if(z)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,J){let Q=this.gos.get("rowGroupPanelSuppressSort"),Z=this.gos.get("functionsReadOnly");if(this.isAggregationZone()&&!Z){let $=J("ariaDropZoneColumnValueItemDescription","Press ENTER to change the aggregation type");z.push($)}if(this.isGroupingZone()&&this.column.isSortable()&&!Q){let $=J("ariaDropZoneColumnGroupItemDescription","Press ENTER to sort");z.push($)}super.addAdditionalAriaInstructions(z,J)}isMovable(){return this.isDraggable()}isDraggable(){return this.isReadOnly()}isRemovable(){return this.isReadOnly()}isReadOnly(){return!this.isGroupingAndLocked()&&!this.gos.get("functionsReadOnly")}getAriaDisplayName(){let z=this.getLocaleTextFunc(),{name:J,aggFuncName:Q}=this.getColumnAndAggFuncName(),Z=z("ariaDropZoneColumnComponentAggFuncSeparator"," of "),$={asc:z("ariaDropZoneColumnComponentSortAscending","ascending"),desc:z("ariaDropZoneColumnComponentSortDescending","descending")},X=this.getCurrentSortDirection(this.column),Y=this.gos.get("rowGroupPanelSuppressSort");return[Q&&`${Q}${Z}`,J,this.isGroupingZone()&&!Y&&X&&`, ${$[X]}`].filter((q)=>!!q).join("")}getColumnAndAggFuncName(){let z=this.displayName,J="";if(this.isAggregationZone()){let Q=this.beans.columnStateUpdateStrategy.getColumnAggFunc(this.deferApply,this.column),Z=typeof Q==="string"?Q:"agg";J=this.getLocaleTextFunc()(Z,Z)}return{name:z,aggFuncName:J}}setupSort(){if(!this.column.isSortable()||!this.isGroupingZone())return;let{gos:z,column:J,eSortIndicator:Q}=this;if(!z.get("rowGroupPanelSuppressSort")){Q.setupSort(J,!0,this.getSortDefOverride.bind(this));let Z=($)=>{$.preventDefault(),this.beans.columnStateUpdateStrategy.progressSortFromEvent(this.deferApply,J,$),Q.refresh(),this.setupAria(),u0(this.beans,this.updateParams)};this.addGuiEventListener("click",Z),this.addGuiEventListener("keydown",($)=>{if($.key===k.ENTER&&this.isGroupingZone())Z($)})}}getCurrentSortDirection(z){return this.beans.columnStateUpdateStrategy.getSortDef(this.deferApply,z)?.direction??null}getSortDefOverride(){if(!this.deferApply)return;return this.beans.columnStateUpdateStrategy.getSortDef(this.deferApply,this.column)}getDefaultIconName(){return"hide"}createGetDragItem(){let{column:z}=this;return()=>{let J={};return J[z.getId()]=z.isVisible(),{columns:[z],visibleState:J}}}setupComponents(){if(super.setupComponents(),this.isAggregationZone()&&!this.gos.get("functionsReadOnly"))this.addGuiEventListener("click",this.onShowAggFuncSelection.bind(this))}onKeyDown(z){if(super.onKeyDown(z),z.key===k.ENTER&&this.isAggregationZone()&&!this.gos.get("functionsReadOnly"))z.preventDefault(),this.onShowAggFuncSelection()}getDisplayValue(){let{name:z,aggFuncName:J}=this.getColumnAndAggFuncName();return this.isAggregationZone()?`${J}(${z})`:z}onShowAggFuncSelection(){if(this.popupShowing)return;this.popupShowing=!0;let{aggFuncSvc:z,popupSvc:J}=this.beans,Q=new e5({cssIdentifier:"select-agg-func"}),Z=z.getFuncNames(this.column),$=this.getGui(),X=Q.getGui();Q.setModel({getRow:function(B){return Z[B]},getRowCount:function(){return Z.length}}),this.createBean(Q);let Y=z0({tag:"div",cls:"ag-select-agg-func-popup"});Y.style.top="0px",Y.style.left="0px",Y.appendChild(X),Y.style.width=`${$.clientWidth}px`;let[q]=this.addManagedElementListeners(Y,{focusout:(B)=>{if(!Y.contains(B.relatedTarget)&&_)_.hideFunc()}}),G=(B)=>{if(this.destroyBean(Q),this.popupShowing=!1,B?.key==="Escape")$.focus();if(q)q()},H=this.getLocaleTextFunc(),_=J.addPopup({modal:!0,eChild:Y,closeOnEsc:!0,closedCallback:G,ariaLabel:H("ariaLabelAggregationFunction","Aggregation Function")});if(_)Q.setComponentCreator(this.createAggSelect.bind(this,_.hideFunc));Q.addGuiEventListener("keydown",(B)=>{if(B.key===k.ENTER||B.key===k.SPACE){let E=Q.getLastFocusedRow();if(E==null)return;let K=Q.getComponentAt(E);if(K)K.selectItem()}}),J.positionPopupByComponent({type:"aggFuncSelect",eventSource:$,ePopup:Y,keepWithinBounds:!0,additionalParams:{column:this.column},position:"under"}),Q.refresh();let U=this.beans.columnStateUpdateStrategy.getColumnAggFunc(this.deferApply,this.column),W=Z.findIndex((B)=>B===U);if(W===-1)W=0;Q.focusRow(W)}createAggSelect(z,J){let Q=()=>{if(z(),this.getGui().focus(),this.beans.columnStateUpdateStrategy.setColumnAggFunc(this.deferApply,this.column,J,"toolPanelDragAndDrop"),this.column){let q=this.getGui().querySelector(".ag-column-drop-cell-text");if(q)q.textContent=this.getDisplayValue();this.setupAria()}u0(this.beans,this.updateParams)},Z=this.getLocaleTextFunc(),$=(J||"").toString(),X=Z($,$);return new cR(Q,X)}isGroupingAndLocked(){return this.isGroupingZone()&&Jz(this.column,this.beans)}isAggregationZone(){return this.dropZonePurpose==="aggregation"}isGroupingZone(){return this.dropZonePurpose==="rowGroup"}getDragSourceType(){return E4.ToolPanel}destroy(){super.destroy(),this.column=null}},cR=class extends y{constructor(z,J){super({tag:"div",cls:"ag-select-agg-func-item",children:J});this.selectItem=z,this.addGuiEventListener("click",this.selectItem)}},Q7=class extends gR{constructor(z,J,Q){super(z);this.dropZonePurpose=J,this.updateParams=Q,this.addElementClasses(this.getGui(),this.dropZonePurpose.toLowerCase())}init(z){super.init(z),this.addManagedEventListeners({newColumnsLoaded:this.refreshGui.bind(this)}),this.addManagedPropertyListeners(["functionsReadOnly","rowGroupPanelSuppressSort","groupLockGroupColumns"],this.refreshGui.bind(this))}getItems(z){return z.columns??[]}isInterestedIn(z,J){if(z===E4.HeaderCell)return!0;if(z!==E4.ToolPanel)return!1;if(!this.horizontal)return!0;return!J.hasAttribute("data-column-tool-panel-deferred")}minimumAllowedNewInsertIndex(){let{gos:z,rowGroupColsSvc:J}=this.beans,Q=z.get("groupLockGroupColumns"),Z=J?.columns.length??0;if(Q===-1)return Z;return Math.min(Q,Z)}showOrHideColumnOnExit(z){return this.isRowGroupPanel()&&$J(this.gos,!0)&&!z.fromNudge}handleDragEnterEnd(z){if(this.showOrHideColumnOnExit(z)){let Z=z.dragSource.getDragItem().columns;this.setColumnsVisible(Z,!1,"uiColumnDragged")}}handleDragLeaveEnd(z){if(this.showOrHideColumnOnExit(z)){let Q=z.dragSource.getDragItem();this.setColumnsVisible(Q.columns,!0,"uiColumnDragged")}}setColumnsVisible(z,J,Q){if(!z)return;if(i(this.updateParams))return;let Z=z.filter(($)=>!$.getColDef().lockVisible);this.beans.columnStateUpdateStrategy.setColumnsVisible(!1,Z,J,Q)}isRowGroupPanel(){return this.dropZonePurpose==="rowGroup"}createPillComponent(z,J,Q,Z){return new mR(z,J,Q,this.dropZonePurpose,Z,this.updateParams)}},pR=class extends Q7{constructor(z,J){super(z,"pivot",J)}postConstruct(){let z=this.getLocaleTextFunc(),J=z("pivotColumnsEmptyMessage","Drag here to set column labels"),Q=z("pivots","Column Labels");if(super.init({icon:h("pivotPanel",this.beans,null),emptyMessage:J,title:Q}),this.horizontal)O1(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 z=this.beans.colModel,J=z.isPivotMode();if(this.horizontal)switch(this.gos.get("pivotPanelShow")){case"always":this.setDisplayed(J);break;case"onlyWhenPivoting":{let Q=z.isPivotActive();this.setDisplayed(J&&Q);break}default:this.setDisplayed(!1);break}else this.setDisplayed(this.beans.columnStateUpdateStrategy.getPivotMode(i(this.updateParams)))}isItemDroppable(z,J){if(this.gos.get("functionsReadOnly")||!z.isPrimary())return!1;let Q=this.beans.columnStateUpdateStrategy.getPivotColumns(i(this.updateParams)).includes(z);return z.isAllowPivot()&&(!Q||this.isSourceEventFromTarget(J))}updateItems(z){this.beans.columnStateUpdateStrategy.setPivotColumns(i(this.updateParams),z,"toolPanelUi"),u0(this.beans,this.updateParams)}getIconName(){return this.isPotentialDndItems()?"pivot":"notAllowed"}getExistingItems(){return this.beans.columnStateUpdateStrategy.getPivotColumns(i(this.updateParams))}getFocusableContainerName(){return"pivotToolbar"}},iR=class extends Q7{constructor(z,J){super(z,"rowGroup",J)}postConstruct(){let z=this.getLocaleTextFunc(),J=z("rowGroupColumnsEmptyMessage","Drag here to set row groups"),Q=z("groups","Row Groups");if(super.init({icon:h("rowGroupPanel",this.beans,null),emptyMessage:J,title:Q}),this.horizontal)O1(this.beans,this,this.getGui());this.addManagedEventListeners({columnRowGroupChanged:this.refreshGui.bind(this)})}getAriaLabel(){return this.getLocaleTextFunc()("ariaRowGroupDropZonePanelLabel","Row Groups")}isItemDroppable(z,J){if(this.gos.get("functionsReadOnly")||!z.isPrimary()||z.colDef.showRowGroup)return!1;let Q=this.beans.columnStateUpdateStrategy.getRowGroupColumns(i(this.updateParams)).includes(z);return z.isAllowRowGroup()&&(!Q||this.isSourceEventFromTarget(J))}updateItems(z){this.beans.columnStateUpdateStrategy.setRowGroupColumns(i(this.updateParams),z,"toolPanelUi"),u0(this.beans,this.updateParams)}getIconName(){return this.isPotentialDndItems()?"group":"notAllowed"}getExistingItems(){return this.beans.columnStateUpdateStrategy.getRowGroupColumns(i(this.updateParams))}getFocusableContainerName(){return"rowGroupToolbar"}},dR=class extends Q7{constructor(z,J){super(z,"aggregation",J)}postConstruct(){let z=this.getLocaleTextFunc(),J=z("valueColumnsEmptyMessage","Drag here to aggregate"),Q=z("values","Values");super.init({icon:h("valuePanel",this.beans,null),emptyMessage:J,title:Q}),this.addManagedEventListeners({columnValueChanged:this.refreshGui.bind(this)})}getAriaLabel(){return this.getLocaleTextFunc()("ariaValuesDropZonePanelLabel","Values")}getIconName(){return this.isPotentialDndItems()?"aggregate":"notAllowed"}isItemDroppable(z,J){if(this.gos.get("functionsReadOnly")||!z.isPrimary())return!1;let Q=this.beans.columnStateUpdateStrategy.getValueColumns(i(this.updateParams)).includes(z);return z.isAllowValue()&&(!Q||this.isSourceEventFromTarget(J))}updateItems(z){this.beans.columnStateUpdateStrategy.setValueColumns(i(this.updateParams),z,"toolPanelUi"),u0(this.beans,this.updateParams)}getExistingItems(){return this.beans.columnStateUpdateStrategy.getValueColumns(i(this.updateParams))}},nR={tag:"div",cls:"ag-pivot-mode-panel",children:[{tag:"ag-toggle-button",ref:"cbPivotMode",cls:"ag-pivot-mode-select"}]},tR=class extends y{constructor(z,J){super();this.params=z,this.onPivotModeValueChanged=J,this.cbPivotMode=j}getCurrentPivotMode(){return this.beans.columnStateUpdateStrategy.getPivotMode(i(this.params))}syncFromGrid(){this.cbPivotMode.setValue(this.getCurrentPivotMode())}refreshEditStrategy(){this.syncFromGrid()}postConstruct(){this.setTemplate(nR,[mX]);let z=this.cbPivotMode;z.setValue(this.getCurrentPivotMode());let J=this.getLocaleTextFunc();z.setLabel(J("pivotMode","Pivot Mode"));let Q=()=>{let $=!!z.getValue();this.beans.columnStateUpdateStrategy.setPivotMode(i(this.params),$,"toolPanelUi"),this.onPivotModeValueChanged?.()},Z=()=>{z.setValue(this.getCurrentPivotMode())};this.addManagedListeners(z,{fieldValueChanged:Q}),this.addManagedEventListeners({newColumnsLoaded:Z,columnPivotModeChanged:Z})}},rR=class extends V{constructor(){super(...arguments);this.beanName="colToolPanelFactory"}setPanelVisible(z,J,Q){if(z)z.setDisplayed(J);else if(J)z=Q();return z}createRowGroupPanel(z,J,Q){return this.createPanel(z,J,new iR(!1,Q))}createValuesPanel(z,J,Q){return this.createPanel(z,J,new dR(!1,Q))}createPivotPanel(z,J,Q){return this.createPanel(z,J,new pR(!1,Q))}createPivotModePanel(z,J,Q,Z,$){return this.createPanel(z,J,new tR(Q,Z),$)}createPanel(z,J,Q,Z){if(Q=z.createBean(Q),J.push(()=>z.destroyBean(Q)),Z)z.prependChild(Q);else z.appendChild(Q);return Q}},YY=()=>{},sR=class extends V{constructor(){super(...arguments);this.beanName="columnStateUpdateExecutionStrategy"}applyColumnState(z,J,Q){this.getUpdateStrategy(z).applyColumnState(J,Q)}commit(z){this.getUpdateStrategy(z).commit()}hasPendingChanges(z){return this.getUpdateStrategy(z).hasPendingChanges()}moveColumns(z,J,Q,Z){this.getUpdateStrategy(z).moveColumns(J,Q,Z)}reset(z){this.getUpdateStrategy(z).reset()}setColumnsVisible(z,J,Q,Z){this.getUpdateStrategy(z).setColumnsVisible(J,Q,Z)}isColumnVisibleInToolPanel(z,J){return this.getUpdateStrategy(z).isColumnVisibleInToolPanel(J)}setRowGroupColumns(z,J,Q){this.getUpdateStrategy(z).setRowGroupColumns(J,Q)}getRowGroupColumns(z){return this.getUpdateStrategy(z).getRowGroupColumns()}getPrimaryColumns(z){return this.getUpdateStrategy(z).getPrimaryColumns()}hasDeferredColumnOrder(z){return this.getUpdateStrategy(z).hasDeferredColumnOrder()}setValueColumns(z,J,Q){this.getUpdateStrategy(z).setValueColumns(J,Q)}getValueColumns(z){return this.getUpdateStrategy(z).getValueColumns()}setColumnAggFunc(z,J,Q,Z){this.getUpdateStrategy(z).setColumnAggFunc(J,Q,Z)}getColumnAggFunc(z,J){return this.getUpdateStrategy(z).getColumnAggFunc(J)}setPivotColumns(z,J,Q){this.getUpdateStrategy(z).setPivotColumns(J,Q)}getPivotColumns(z){return this.getUpdateStrategy(z).getPivotColumns()}setPivotMode(z,J,Q){this.getUpdateStrategy(z).setPivotMode(J,Q)}getPivotMode(z){return this.getUpdateStrategy(z).getPivotMode()}isColumnSelectedInPivotModeToolPanel(z,J){return this.getUpdateStrategy(z).isColumnSelectedInPivotModeToolPanel(J)}progressSortFromEvent(z,J,Q){this.getUpdateStrategy(z).progressSortFromEvent(J,Q)}getSortDef(z,J){return this.getUpdateStrategy(z).getSortDef(J)}getUpdateStrategy(z){return z?this.getDeferredUpdateStrategy():this.getSyncUpdateStrategy()}getSyncUpdateStrategy(){return this.syncUpdateStrategy??(this.syncUpdateStrategy=new lR(this.beans))}getDeferredUpdateStrategy(){return this.deferredUpdateStrategy??(this.deferredUpdateStrategy=new aR(this.beans))}},lR=class{constructor(z){this.beans=z,this.lastPivotColIds=[],this.reset=YY,this.commit=YY,this.hasPendingChanges=()=>!1,this.hasDeferredColumnOrder=()=>!1}applyColumnState(z,J){if(z.length===0)return;l0(this.beans,{state:z},J)}moveColumns(z,J,Q){this.beans.colMoves?.moveColumns(z,J,Q),oR(this.beans)}setColumnsVisible(z,J,Q){let Z=z.filter(($)=>!$.getColDef().lockVisible);this.beans.colModel.setColsVisible(Z,J,Q)}setRowGroupColumns(z,J){this.beans.rowGroupColsSvc?.setColumns(z,J)}getRowGroupColumns(){return this.beans.rowGroupColsSvc?.columns??[]}getPrimaryColumns(){return Z7(this.beans)}setValueColumns(z,J){this.beans.valueColsSvc?.setColumns(z,J)}getValueColumns(){return this.beans.valueColsSvc?.columns??[]}setColumnAggFunc(z,J,Q){this.beans.valueColsSvc?.setColumnAggFunc?.(z,J,Q)}getColumnAggFunc(z){return z.getAggFunc()}setPivotColumns(z,J){this.lastPivotColIds=z.map((Q)=>Q.getColId()),this.beans.pivotColsSvc?.setColumns(z,J)}getPivotColumns(){return this.beans.pivotColsSvc?.columns??[]}setPivotMode(z,J){let{colModel:Q,gos:Z,ctrlsSvc:$}=this.beans;if(z===Q.isPivotMode())return;let X=this.beans.pivotColsSvc?.columns.map((Y)=>Y.getColId())??[];if(X.length>0)this.lastPivotColIds=X;if(!z){let Y=this.beans.colModel.getColDefCols()??[];l0(this.beans,{state:Y.map((q)=>({colId:q.getColId(),pivot:!1,pivotIndex:null}))},J)}if(Z.updateGridOptions({options:{pivotMode:z},source:J}),z&&this.lastPivotColIds.length>0)this.beans.pivotColsSvc?.setColumns(this.lastPivotColIds,J);for(let Y of $.getHeaderRowContainerCtrls())Y.refresh()}progressSortFromEvent(z,J){this.beans.sortSvc?.progressSortFromEvent(z,J)}isColumnVisibleInToolPanel(z){return z.isVisible()}isColumnSelectedInPivotModeToolPanel(z){return z.isAnyFunctionActive()}getPivotMode(){return this.beans.colModel.isPivotMode()}getSortDef(z){return z.getSortDef()}},aR=class{constructor(z){this.beans=z,this.state={},this.sequence=0,this.lastPivotColIds=[]}reset(){this.sequence=0,this.state={}}hasPendingChanges(){let{state:z,beans:J}=this,{columnState:Q,columnOrder:Z,rowGroup:$,aggregation:X,pivot:Y,pivotMode:q,sort:G,aggFuncs:H}=z,_=(U)=>(U??[]).map((W)=>W.getColId());if(Q)for(let[U,W]of Q.patches){let B=J.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(Z&&!Z0(Z.colIds,g5(J)))return!0;if($&&!Z0($.colIds,_(J.rowGroupColsSvc?.columns)))return!0;if(X&&!Z0(X.colIds,_(J.valueColsSvc?.columns)))return!0;if(Y&&!Z0(Y.colIds,_(J.pivotColsSvc?.columns)))return!0;if(q&&q.pivotMode!==J.colModel.isPivotMode())return!0;if(G){for(let[U,W]of G.sortDefsByColId){let B=J.colModel.getColDefCol(U);if(!B)continue;if((W?.direction??null)!==(B.getSortDef()?.direction??null))return!0}if(G.baselineCleared){let U=Z7(J);for(let W of U)if(!G.sortDefsByColId.has(W.getColId())&&W.getSortDef()!==null)return!0}}if(H)for(let[U,W]of H.values){let B=J.colModel.getColDefCol(U);if(!B)continue;if(W!==B.getAggFunc())return!0}return!1}commit(){let{beans:z,state:J}=this,Q=[];for(let $ of Object.keys(J)){let X=J[$];if(X)Q.push({type:$,...X})}let Z=Q.sort(($,X)=>$.seq-X.seq);for(let $ of Z)switch($.type){case"columnState":{l0(z,{state:[...$.patches.values()]},$.eventType);break}case"columnOrder":{let X=$.colIds.map((Y)=>z.colModel.getColDefCol(Y)).filter((Y)=>!!Y&&Qz(Y));if(!z.colModel.isPivotMode())for(let Y=0;YQz(U)),_=(H>=0?H:0)+Y;if(G[_]!==q)z.colMoves?.moveColumns([q],_,$.eventType,!0)}Yq(z,X);break}case"rowGroup":{z.rowGroupColsSvc?.setColumns($.colIds,$.eventType);break}case"aggregation":{z.valueColsSvc?.setColumns($.colIds,$.eventType);break}case"pivot":{this.lastPivotColIds=$.colIds,z.pivotColsSvc?.setColumns($.colIds,$.eventType);break}case"pivotMode":{let{colModel:X,ctrlsSvc:Y,gos:q,stateSvc:G}=z;if($.pivotMode!==X.isPivotMode()){let H=z.pivotColsSvc?.columns.map((W)=>W.getColId())??[];if(H.length>0)this.lastPivotColIds=H;let _=G?.getState().pivot?.pivotColIds??H,U=$.pivotMode?this.state.pivot?.colIds??this.lastPivotColIds:_;if(G?.setState({...G.getState(),pivot:{pivotMode:$.pivotMode,pivotColIds:U}},["pivot"]),!$.pivotMode){let W=z.colModel.getColDefCols()??[];l0(z,{state:W.map((B)=>({colId:B.getColId(),pivot:!1,pivotIndex:null}))},$.eventType)}if(q.updateGridOptions({options:{pivotMode:$.pivotMode},source:$.eventType}),$.pivotMode&&U.length>0)z.pivotColsSvc?.setColumns(U,$.eventType);for(let W of Y.getHeaderRowContainerCtrls())W.refresh()}break}case"sort":{let X=[],Y=0;for(let[q,G]of $.sortDefsByColId)X.push({colId:q,sort:G?.direction??null,sortIndex:G?.direction?Y++:null,sortType:G?.type??void 0});l0(z,{state:X,defaultState:$.baselineCleared?{sort:null,sortIndex:null,sortType:void 0}:void 0},$.eventType);break}case"aggFuncs":{for(let[X,Y]of $.values){let q=z.colModel.getColDefCol(X);if(!q)continue;z.valueColsSvc?.setColumnAggFunc?.(q,Y,$.eventType)}break}}this.reset()}applyColumnState(z,J){for(let Z of z)h5(this.state,Z);let Q=CJ(this.state);Q.seq=z1(this.sequence),this.sequence=Q.seq,Q.eventType=J}moveColumns(z,J,Q){let Z=new Set(z.map((G)=>G.getColId())),X=(this.state.columnOrder?.colIds??g5(this.beans)).filter((G)=>!Z.has(G)),Y=z.map((G)=>G.getColId()),q=z1(this.sequence);this.sequence=q,this.state.columnOrder={colIds:[...X.slice(0,J),...Y,...X.slice(J)],eventType:Q,seq:q}}setColumnsVisible(z,J,Q){for(let $ of z){if($.getColDef().lockVisible)continue;h5(this.state,{colId:$.getColId(),hide:!J})}let Z=CJ(this.state);Z.seq=z1(this.sequence),this.sequence=Z.seq,Z.eventType=Q}setRowGroupColumns(z,J){u5(this.state,"rowGroup");let Q=z1(this.sequence);this.sequence=Q,this.state.rowGroup={colIds:z.map((Z)=>Z.getColId()),eventType:J,seq:Q}}setValueColumns(z,J){u5(this.state,"aggFunc");let Q=new Set((this.beans.valueColsSvc?.columns??[]).map((X)=>X.getColId())),Z=qY(this.state);for(let X of z)if(!Q.has(X.getColId())&&!Z.values.has(X.getColId())){let Y=X.getAggFunc(),q=Y!=null?Y:this.beans.aggFuncSvc?.getDefaultAggFunc(X);if(q!=null)Z.values.set(X.getColId(),q)}let $=z1(this.sequence);this.sequence=$,Z.seq=$,Z.eventType=J,this.state.aggregation={colIds:z.map((X)=>X.getColId()),eventType:J,seq:$}}setColumnAggFunc(z,J,Q){h5(this.state,{colId:z.getColId(),aggFunc:J});let Z=CJ(this.state);Z.seq=z1(this.sequence),this.sequence=Z.seq,Z.eventType=Q;let $=qY(this.state);$.seq=Z.seq,$.eventType=Q,$.values.set(z.getColId(),J)}getColumnAggFunc(z){let J=z.getColId();if(this.state.aggFuncs?.values.has(J))return this.state.aggFuncs.values.get(J);return z.getAggFunc()}isColumnVisibleInToolPanel(z){let J=this.state.columnState?.patches.get(z.getColId());if(J?.hide!==void 0)return!J.hide;return z.isVisible()}isColumnSelectedInPivotModeToolPanel(z){let J=z.getColId(),Q=this.state.columnState?.patches.get(J),Z;if(Q?.rowGroup!==void 0)Z=!!Q.rowGroup;else if(this.state.rowGroup)Z=this.state.rowGroup.colIds.includes(J);else Z=z.isRowGroupActive();let $;if(Q?.pivot!==void 0)$=!!Q.pivot;else if(this.state.pivot)$=this.state.pivot.colIds.includes(J);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(J);else X=z.isValueActive();return Z||$||X}setPivotColumns(z,J){u5(this.state,"pivot");let Q=z1(this.sequence);this.sequence=Q,this.state.pivot={colIds:z.map((Z)=>Z.getColId()),eventType:J,seq:Q}}setPivotMode(z,J){let Q=z1(this.sequence);this.sequence=Q,this.state.pivotMode={pivotMode:z,eventType:J,seq:Q}}getRowGroupColumns(){return t6(this.beans,N5(this.state.rowGroup?.colIds,this.beans.rowGroupColsSvc?.columns,this.state.columnState?.patches,(z)=>z.rowGroup==null?void 0:!!z.rowGroup))}getPrimaryColumns(){return t6(this.beans,this.state.columnOrder?.colIds??g5(this.beans))}hasDeferredColumnOrder(){return!!this.state.columnOrder}getValueColumns(){return t6(this.beans,N5(this.state.aggregation?.colIds,this.beans.valueColsSvc?.columns,this.state.columnState?.patches,(z)=>z.aggFunc===void 0?void 0:z.aggFunc!=null))}getPivotColumns(){if(!this.getPivotMode())return[];let z=this.beans.pivotColsSvc?.columns,J=z?.length?z:t6(this.beans,this.lastPivotColIds);return t6(this.beans,N5(this.state.pivot?.colIds,J,this.state.columnState?.patches,(Q)=>Q.pivot==null?void 0:!!Q.pivot))}getPivotMode(){return this.state.pivotMode?.pivotMode??this.beans.colModel.isPivotMode()}getSortDef(z){let J=this.state.sort,Q=z.getColId(),Z=J?.sortDefsByColId;if(Z?.has(Q))return Z.get(Q)??null;if(J?.baselineCleared)return null;return z.getSortDef()}progressSortFromEvent(z,J){let Q=this.state.sort??{sortDefsByColId:new Map,baselineCleared:!1,seq:0,eventType:"toolPanelUi"},{sortSvc:Z}=this.beans,$=z.getColId(),X;if(Q.sortDefsByColId.has($))X=Q.sortDefsByColId.get($);else if(Q.baselineCleared)X=null;else X=z.getSortDef();let Y=Z?.getNextSortDirection(z,X);if(!Y)return;let{gos:q}=this.beans;if(!(((q.get("multiSortKey")==="ctrl"?J.ctrlKey||J.metaKey:J.shiftKey)||q.get("alwaysMultiSort"))&&!q.get("suppressMultiSort")))Q.sortDefsByColId.clear(),Q.baselineCleared=!0;Q.sortDefsByColId.set($,Y.direction?Y:null),Q.seq=z1(this.sequence),this.sequence=Q.seq,this.state.sort=Q}};function t6(z,J){if(!J)return[];return J.map((Q)=>z.colModel.getColDefCol(Q)).filter((Q)=>!!Q)}function N5(z,J,Q,Z){let $=[...z??J?.map((Y)=>Y.getColId())??[]];if(!Q?.size)return $;let X=new Set($);for(let[Y,q]of Q){let G=Z(q);if(G===void 0)continue;if(G){if(!X.has(Y))$.push(Y),X.add(Y);continue}if(!X.has(Y))continue;X.delete(Y);let H=$.indexOf(Y);if(H>=0)$.splice(H,1)}return $}function oR(z){let J=z.colModel.getCols().filter((Q)=>Qz(Q)).map((Q)=>z.colModel.getColDefCol(Q.getColId())).filter((Q)=>!!Q);Yq(z,J)}function Yq(z,J){let Q=eR(z);if(!Q)return;let Z=new Set(J);Q.list=[...J,...Q.list.filter(($)=>Qz($)&&!Z.has($))]}function g5(z){return Z7(z).map((J)=>J.getColId())}function Z7(z){return(z.colModel.getColDefCols()??z.colModel.getCols()).filter((J)=>Qz(J))}function eR(z){let J=z.colModel.colDefCols,Q=J?.list;if(!Array.isArray(Q))return;return J}function Qz(z){if(!z.isPrimary())return!1;return!Q2(z)&&!x6(z)}function z1(z){return z+1}function h5(z,J){let Q=CJ(z),Z=Q.patches.get(J.colId);Q.patches.set(J.colId,Z?{...Z,...J}:J)}function u5(z,J){let Q=z.columnState?.patches;if(!Q?.size)return;for(let[Z,$]of Q){if(!(J in $))continue;let X={...$};if(delete X[J],Object.keys(X).length===1){Q.delete(Z);continue}Q.set(Z,X)}}function CJ(z){let{columnState:J}=z;if(!J)J={patches:new Map,seq:0,eventType:"toolPanelUi"},z.columnState=J;return J}function qY(z){let{aggFuncs:J}=z;if(!J)J={values:new Map,seq:0,eventType:"toolPanelUi"},z.aggFuncs=J;return J}var zj=class extends V{constructor(){super(...arguments);this.beanName="columnStateUpdateStrategy"}applyColumnState(z,J,Q){this.delegate("applyColumnState",z,J,Q)}commit(z){this.delegate("commit",z)}hasPendingChanges(z){return this.delegate("hasPendingChanges",z)}moveColumns(z,J,Q,Z){this.delegate("moveColumns",z,J,Q,Z)}reset(z){this.delegate("reset",z)}setColumnsVisible(z,J,Q,Z){this.delegate("setColumnsVisible",z,J,Q,Z)}isColumnVisibleInToolPanel(z,J){return this.delegate("isColumnVisibleInToolPanel",z,J)}setRowGroupColumns(z,J,Q){this.delegate("setRowGroupColumns",z,J,Q)}getRowGroupColumns(z){return this.delegate("getRowGroupColumns",z)}getPrimaryColumns(z){return this.delegate("getPrimaryColumns",z)}hasDeferredColumnOrder(z){return this.delegate("hasDeferredColumnOrder",z)}setValueColumns(z,J,Q){this.delegate("setValueColumns",z,J,Q)}getValueColumns(z){return this.delegate("getValueColumns",z)}setColumnAggFunc(z,J,Q,Z){this.delegate("setColumnAggFunc",z,J,Q,Z)}getColumnAggFunc(z,J){return this.delegate("getColumnAggFunc",z,J)}setPivotColumns(z,J,Q){this.delegate("setPivotColumns",z,J,Q)}getPivotColumns(z){return this.delegate("getPivotColumns",z)}setPivotMode(z,J,Q){this.delegate("setPivotMode",z,J,Q)}getPivotMode(z){return this.delegate("getPivotMode",z)}isColumnSelectedInPivotModeToolPanel(z,J){return this.delegate("isColumnSelectedInPivotModeToolPanel",z,J)}progressSortFromEvent(z,J,Q){this.delegate("progressSortFromEvent",z,J,Q)}getSortDef(z,J){return this.delegate("getSortDef",z,J)}getUpdateStrategy(){return this.executionStrategy??(this.executionStrategy=this.createManagedBean(new sR))}delegate(z,...J){let Q=this.getUpdateStrategy();return Q[z].bind(Q)(...J)}},Jj={moduleName:"SharedColumnStateUpdateStrategy",version:$0,beans:[zj],dependsOn:[C0]},qq={moduleName:"ColumnsToolPanel",version:$0,beans:[rR],userComponents:{agColumnsToolPanel:xR},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:[C0,Jj,z7,i6,p6,Y2,J7]},Qj=class extends V{constructor(){super(...arguments);this.beanName="chartMenuItemMapper"}getChartItems(z){let J=this.beans,Q=J.chartSvc,Z=z==="pivotChart";if(!Q)return null;let $=this.getLocaleTextFunc.bind(this),X=Z?new Zj(J,Q,$):new $j(J,Q,$),Y=Q.isEnterprise(),q=X.getMenuItem();if(q?.subMenu&&!Y){let H=(_)=>({..._,subMenu:_.subMenu?.filter((U)=>!U._enterprise).map((U)=>H(U))});q=H(q)}let G=this.gos.get("chartToolPanelsDef")?.settingsPanel?.chartGroupsDef;if(G)q=this.filterAndOrderChartMenu(q,G,X.getConfigLookup());return this.cleanInternals(q)}cleanInternals(z){if(!z)return z;let J=(Q)=>{delete Q?._key,delete Q?._enterprise;for(let Z of Q?.subMenu??[])J(Z);return Q};return J(z)}buildLookup(z){let J={},Q=(Z)=>{if(J[Z._key]=Z,Z.subMenu)for(let $ of Z.subMenu)Q($)};return Q(z),J}filterAndOrderChartMenu(z,J,Q){let Z=this.buildLookup(z),$={...z,subMenu:[]};for(let X of Object.keys(J)){let Y=J[X],q=Q[X];if(q===null)continue;if(q==null){R(173,{group:X});continue}let G=Z[q._key];if(G)if(G.subMenu){let H=Y.map((_)=>{let U=q[_];if(U==null){R(174,{group:X,chartType:_});return}return Z[U]}).filter((_)=>_!==void 0);if(H.length>0)G.subMenu=H,$.subMenu?.push(G)}else $.subMenu?.push(G)}if($.subMenu?.length==0)return null;return $}},Zj=class{constructor(z,J,Q){this.beans=z,this.chartSvc=J,this.getLocaleTextFunc=Q}getMenuItem(){let z=this.getLocaleTextFunc(),J=(Q,Z,$,X,Y=!1)=>{return{name:z(Q,Z+"‎"),action:()=>this.chartSvc.createPivotChart({chartType:$}),_key:X,_enterprise:Y}};return{name:z("pivotChart","Pivot Chart"),_key:"pivotChart",subMenu:[{_key:"pivotColumnChart",name:z("columnChart","Column"),subMenu:[J("groupedColumn","Grouped","groupedColumn","pivotGroupedColumn"),J("stackedColumn","Stacked","stackedColumn","pivotStackedColumn"),J("normalizedColumn","100% Stacked","normalizedColumn","pivotNormalizedColumn")]},{_key:"pivotBarChart",name:z("barChart","Bar"),subMenu:[J("groupedBar","Grouped","groupedBar","pivotGroupedBar"),J("stackedBar","Stacked","stackedBar","pivotStackedBar"),J("normalizedBar","100% Stacked","normalizedBar","pivotNormalizedBar")]},{_key:"pivotPieChart",name:z("pieChart","Pie"),subMenu:[J("pie","Pie","pie","pivotPie"),J("donut","Donut","donut","pivotDonut")]},{_key:"pivotLineChart",name:z("lineChart","Line"),subMenu:[J("lineChart","Line","line","pivotLineChart"),J("stackedLine","Stacked","stackedLine","pivotStackedLine"),J("normalizedLine","100% Stacked","normalizedLine","pivotNormalizedLine")]},{_key:"pivotAreaChart",name:z("areaChart","Area"),subMenu:[J("areaChart","Area","area","pivotArea"),J("stackedArea","Stacked","stackedArea","pivotStackedArea"),J("normalizedArea","100% Stacked","normalizedArea","pivotNormalizedArea")]},{_key:"pivotXYChart",name:z("xyChart","X Y (Scatter)"),subMenu:[J("scatter","Scatter","scatter","pivotScatter"),J("bubble","Bubble","bubble","pivotBubble")]},{_key:"pivotStatisticalChart",_enterprise:!1,name:z("statisticalChart","Statistical"),subMenu:[J("histogramChart","Histogram","histogram","pivotHistogram",!1)]},{_key:"pivotHierarchicalChart",_enterprise:!0,name:z("hierarchicalChart","Hierarchical"),subMenu:[J("treemapChart","Treemap","treemap","pivotTreemap",!0),J("sunburstChart","Sunburst","sunburst","pivotSunburst",!0)]},{_key:"pivotFunnel",name:z("funnel","Funnel"),subMenu:[J("funnel","Funnel","funnel","pivotFunnel"),J("coneFunnel","Cone Funnel","coneFunnel","pivotConeFunnel"),J("pyramid","Pyramid","pyramid","pivotPyramid")]},{_key:"pivotCombinationChart",name:z("combinationChart","Combination"),subMenu:[J("columnLineCombo","Column & Line","columnLineCombo","pivotColumnLineCombo"),J("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}}},$j=class{constructor(z,J,Q){this.beans=z,this.chartSvc=J,this.getLocaleTextFunc=Q}getMenuItem(){let z=this.getLocaleTextFunc(),J=(Q,Z,$,X,Y=!1)=>{return{name:z(Q,Z),action:()=>this.chartSvc.createChartFromCurrentRange($),_key:X,_enterprise:Y}};return{name:z("chartRange","Chart Range"),_key:"chartRange",subMenu:[{name:z("columnChart","Column"),subMenu:[J("groupedColumn","Grouped","groupedColumn","rangeGroupedColumn"),J("stackedColumn","Stacked","stackedColumn","rangeStackedColumn"),J("normalizedColumn","100% Stacked","normalizedColumn","rangeNormalizedColumn")],_key:"rangeColumnChart"},{name:z("barChart","Bar"),subMenu:[J("groupedBar","Grouped","groupedBar","rangeGroupedBar"),J("stackedBar","Stacked","stackedBar","rangeStackedBar"),J("normalizedBar","100% Stacked","normalizedBar","rangeNormalizedBar")],_key:"rangeBarChart"},{name:z("pieChart","Pie"),subMenu:[J("pie","Pie","pie","rangePie"),J("donut","Donut","donut","rangeDonut")],_key:"rangePieChart"},{name:z("lineChart","Line"),subMenu:[J("lineChart","Line","line","rangeLineChart"),J("stackedLine","Stacked","stackedLine","rangeStackedLine"),J("normalizedLine","100% Stacked","normalizedLine","rangeNormalizedLine")],_key:"rangeLineChart"},{name:z("areaChart","Area"),subMenu:[J("areaChart","Area","area","rangeArea"),J("stackedArea","Stacked","stackedArea","rangeStackedArea"),J("normalizedArea","100% Stacked","normalizedArea","rangeNormalizedArea")],_key:"rangeAreaChart"},{name:z("xyChart","X Y (Scatter)"),subMenu:[J("scatter","Scatter","scatter","rangeScatter"),J("bubble","Bubble","bubble","rangeBubble")],_key:"rangeXYChart"},{name:z("polarChart","Polar"),subMenu:[J("radarLine","Radar Line","radarLine","rangeRadarLine"),J("radarArea","Radar Area","radarArea","rangeRadarArea"),J("nightingale","Nightingale","nightingale","rangeNightingale"),J("radialColumn","Radial Column","radialColumn","rangeRadialColumn"),J("radialBar","Radial Bar","radialBar","rangeRadialBar")],_key:"rangePolarChart",_enterprise:!0},{name:z("statisticalChart","Statistical"),subMenu:[J("boxPlot","Box Plot","boxPlot","rangeBoxPlot",!0),J("histogramChart","Histogram","histogram","rangeHistogram",!1),J("rangeBar","Range Bar","rangeBar","rangeRangeBar",!0),J("rangeArea","Range Area","rangeArea","rangeRangeArea",!0)],_key:"rangeStatisticalChart",_enterprise:!1},{name:z("hierarchicalChart","Hierarchical"),subMenu:[J("treemap","Treemap","treemap","rangeTreemap"),J("sunburst","Sunburst","sunburst","rangeSunburst")],_key:"rangeHierarchicalChart",_enterprise:!0},{name:z("specializedChart","Specialized"),subMenu:[J("heatmap","Heatmap","heatmap","rangeHeatmap"),J("waterfall","Waterfall","waterfall","rangeWaterfall")],_key:"rangeSpecializedChart",_enterprise:!0},{name:z("funnel","Funnel"),subMenu:[J("funnel","Funnel","funnel","rangeFunnel"),J("coneFunnel","Cone Funnel","coneFunnel","rangeConeFunnel"),J("pyramid","Pyramid","pyramid","rangePyramid")],_key:"rangeFunnel",_enterprise:!0},{name:z("combinationChart","Combination"),subMenu:[J("columnLineCombo","Column & Line","columnLineCombo","rangeColumnLineCombo"),J("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}}}},Xj=class extends V{constructor(){super(...arguments);this.beanName="colChooserFactory"}createColumnSelectPanel(z,J,Q,Z){let $=z.createManagedBean(new Xq),X=Z??J?.getColDef().columnChooserParams??{},{contractColumnSelection:Y,suppressColumnExpandAll:q,suppressColumnFilter:G,suppressColumnSelectAll:H,suppressSyncLayoutWithGrid:_,columnLayout:U}=X;if($.init(!!Q,C(this.gos,{suppressColumnMove:!1,suppressValues:!1,suppressPivots:!1,suppressRowGroups:!1,suppressPivotMode:!1,contractColumnSelection:!!Y,suppressColumnExpandAll:!!q,suppressColumnFilter:!!G,suppressColumnSelectAll:!!H,suppressSyncLayoutWithGrid:!!U||!!_,onStateUpdated:()=>{}}),"columnMenu"),U)$.setColumnLayout(U);return $}showColumnChooser({column:z,chooserParams:J,eventSource:Q,headerPosition:Z}){this.hideActiveColumnChooser();let $=this.createColumnSelectPanel(this,z,!0,J),X=this.getLocaleTextFunc(),Y=this.beans,{visibleCols:q,focusSvc:G,menuUtils:H}=Y,_=q.allCols.indexOf(z),U=z?G.focusedHeader??Z??null:null;this.activeColumnChooserDialog=this.createBean(new jA({title:X("chooseColumns","Choose Columns"),component:$,width:300,height:300,resizable:!0,movable:!0,centered:!0,closable:!0,afterGuiAttached:()=>{P0(Y,$.getGui())?.focus({preventScroll:!0}),this.dispatchVisibleChangedEvent(!0,z)},closedCallback:(W)=>{let B=this.activeColumnChooser.getGui();if(this.destroyBean(this.activeColumnChooser),this.activeColumnChooser=void 0,this.activeColumnChooserDialog=void 0,this.dispatchVisibleChangedEvent(!1,z),z)H.restoreFocusOnClose({column:z,headerPosition:U,columnIndex:_,eventSource:Q},B,W,!0)},postProcessPopupParams:{type:"columnChooser",column:z,eventSource:Q}})),this.activeColumnChooser=$}hideActiveColumnChooser(){this.destroyBean(this.activeColumnChooserDialog)}dispatchVisibleChangedEvent(z,J){this.eventSvc.dispatchEvent({type:"columnMenuVisibleChanged",visible:z,switchingTab:!1,key:"columnChooser",column:J??null})}},Yj={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 qj(z,J){let Q=Yj[J];if(Q)z.assertModuleRegistered(Q,`menu item '${J}'`)}var G2="separator";function Gq(z,J){if(!z)return;for(let Q=z.length-2;Q>=0;Q--){let Z=z[Q]===J,$=z[Q+1]===J;if(Z&&$)z.splice(Q+1,1)}}var Gj={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:(z)=>({type:j4(z.getSortDef()?.type),direction:null})}},Hj=class extends V{constructor(){super(...arguments);this.beanName="menuItemMapper"}mapWithStockItems(z,J,Q,Z,$){if(!z)return[];let X=[],Y=this.getLocaleTextFunc(),{beans:q,gos:G}=this,{pinnedCols:H,colAutosize:_,aggFuncSvc:U,rowGroupColsSvc:W,colNames:B,colModel:E,clipboardSvc:K,expansionSvc:F,focusSvc:L,csvCreator:D,excelCreator:M,menuSvc:f,colChooserFactory:S,sortSvc:A,chartMenuItemMapper:O,valueColsSvc:v,pinnedRowModel:I}=q,x=(m,g,e,r)=>{switch(qj(G,m),m){case"pinSubMenu":return H&&g?{name:Y("pinColumn","Pin Column"),icon:h("menuPin",q,null),subMenu:["clearPinned","pinLeft","pinRight"]}:null;case"pinLeft":return H&&g?{name:Y("pinLeft","Pin Left"),action:()=>H.setColsPinned([g],"left",r),checked:!!g&&g.isPinnedLeft()}:null;case"pinRight":return H&&g?{name:Y("pinRight","Pin Right"),action:()=>H.setColsPinned([g],"right",r),checked:!!g&&g.isPinnedRight()}:null;case"clearPinned":return H&&g?{name:Y("noPin","No Pin"),action:()=>H.setColsPinned([g],null,r),checked:!!g&&!g.isPinned()}:null;case"pinRowSubMenu":{let u=G.get("enableRowPinning"),Q0=[],s=Q?.rowPinned??Q?.pinnedSibling?.rowPinned;if(s)Q0.push("unpinRow");if(u&&u!=="bottom"&&s!="top")Q0.push("pinTop");if(u&&u!=="top"&&s!="bottom")Q0.push("pinBottom");return I?.isManual()?{name:Y("pinRow","Pin Row"),icon:h("rowPin",q,g),subMenu:Q0}:null}case"pinTop":return I?.isManual()?{name:Y("pinTop","Pin to Top"),icon:h("rowPinTop",q,g),action:({node:u,column:Q0})=>u&&I.pinRow(u,"top",Q0)}:null;case"pinBottom":return I?.isManual()?{name:Y("pinBottom","Pin to Bottom"),icon:h("rowPinBottom",q,g),action:({node:u,column:Q0})=>u&&I.pinRow(u,"bottom",Q0)}:null;case"unpinRow":return I?.isManual()?{name:Y("unpinRow","Unpin Row"),icon:h("rowUnpin",q,g),action:({node:u,column:Q0})=>u&&I.pinRow(u,null,Q0)}:null;case"valueAggSubMenu":if(U&&v&&(g?.isPrimary()||g?.getColDef().pivotValueColumn))return{name:Y("valueAggregation","Value Aggregation"),icon:h("menuValue",q,null),subMenu:_j(g,U,v,Y),disabled:G.get("functionsReadOnly")};else return null;case"autoSizeThis":return _?{name:Y("autosizeThisColumn","Autosize This Column"),action:()=>g&&_.autoSizeColumn(g,r,G.get("skipHeaderOnAutoSize"))}:null;case"autoSizeAll":return _?{name:Y("autosizeAllColumns","Autosize All Columns"),action:()=>_.autoSizeAllColumns({source:r,skipHeader:G.get("skipHeaderOnAutoSize")})}:null;case"rowGroup":return W?{name:e6(Y,"groupBy",B.getDisplayNameForColumn(g,"header")),disabled:G.get("functionsReadOnly")||g?.isRowGroupActive()||!g?.getColDef().enableRowGroup,action:()=>W.addColumns([g],r),icon:h("menuAddRowGroup",q,null)}:null;case"rowUnGroup":if(W&&G.isModuleRegistered("SharedRowGrouping")){let u=g?.getColDef().showRowGroup,Q0=G.get("groupLockGroupColumns"),s,T0,v0;if(u===!0)s=Y("ungroupAll","Un-Group All"),T0=G.get("functionsReadOnly")||Q0===-1||Q0>=(W.columns.length??0),v0=()=>W.setColumns(W.columns.slice(0,Q0),r);else if(typeof u==="string"){let V0=E.getColDefCol(u),g1=V0!=null?B.getDisplayNameForColumn(V0,"header"):u;s=e6(Y,"ungroupBy",g1),T0=G.get("functionsReadOnly")||Jz(V0,q),v0=()=>{W.removeColumns([u],r)}}else s=e6(Y,"ungroupBy",B.getDisplayNameForColumn(g,"header")),T0=G.get("functionsReadOnly")||!g?.isRowGroupActive()||!g?.getColDef().enableRowGroup||Jz(g,q),v0=()=>W.removeColumns([g],r);return{name:s,disabled:T0,action:v0,icon:h("menuRemoveRowGroup",q,null)}}else return null;case"resetColumns":return{name:Y("resetColumns","Reset Columns"),action:()=>L$(q,r)};case"expandAll":return F?{name:Y("expandAll","Expand All Row Groups"),action:()=>F.expandAll(!0)}:null;case"contractAll":return F?{name:Y("collapseAll","Collapse All Row Groups"),action:()=>F.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=L.getFocusedCell(),Q0=u?f0(q,u):null,s=Q0?u?.column.isCellEditable(Q0):!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")||!g||!Q||!g.isCellEditable(Q)||g.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")&&D)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 D?{name:Y("csvExport","CSV Export"),icon:h("csvExport",q,null),action:()=>D.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 f&&g?{name:Y("columnFilter","Column Filter"),icon:h("filter",q,null),action:()=>f.showFilterMenu({column:g,buttonElement:e(),containerType:"columnFilter",positionBy:"button"})}:null;case"columnChooser":{let u=L.focusedHeader;return S?{name:Y("columnChooser","Choose Columns"),icon:h("columns",q,null),action:()=>S.showColumnChooser({column:g,eventSource:e(),headerPosition:u})}:null}case"sortUnSort":case"sortAscending":case"sortDescending":case"sortAbsoluteAscending":case"sortAbsoluteDescending":{if(!A||!g)return null;let{fallback:u,getSortDef:Q0}=Gj[m];return{name:Y(m,u),icon:h(m,q,null),action:()=>A.setSortForColumn(g,Q0(g),!1,r)}}default:return R(176,{key:m}),null}};for(let m of z){let g;if(typeof m==="string")g=x(m,J,Z,$);else g={...m};if(!g)continue;let e=g,{subMenu:r}=e;if(r&&r instanceof Array)e.subMenu=this.mapWithStockItems(r,J,Q,Z,$);if(g!=null)X.push(g)}return Gq(X,G2),X}};function _j(z,J,Q,Z){let $;if(z.isPrimary())$=z;else{let Y=z.getColDef().pivotValueColumn;$=T(Y)?Y:void 0}let X=[];if($){let Y=$.isValueActive(),q=J.getFuncNames($);X.push({name:Z("noAggregation","None"),action:()=>{Q.removeColumns([$],"contextMenu"),Q.setColumnAggFunc($,void 0,"contextMenu")},checked:!Y});for(let G of q)X.push({name:Z(G,J.getDefaultFuncLabel(G)),action:()=>{Q.setColumnAggFunc($,G,"contextMenu"),Q.addColumns([$],"contextMenu")},checked:Y&&$.getAggFunc()===G})}return X}var Uj=class extends V{constructor(){super(...arguments);this.beanName="colMenuFactory"}createMenu(z,J,Q,Z){let $=z.createManagedBean(new Qq(0,{column:Q??null,node:null,value:null})),X=this.beans.menuItemMapper.mapWithStockItems(J,Q??null,null,Z,"columnMenu");return $.addMenuItems(X),$}getMenuItems(z=null,J=null){let Q=this.getDefaultMenuOptions(z),Z,$=(z?.getColDef()??J?.getColGroupDef())?.mainMenuItems;if(Array.isArray($))Z=$;else if(typeof $==="function")Z=$(C(this.gos,{column:z,columnGroup:J,defaultItems:Q}));else{let X=this.gos.getCallback("getMainMenuItems");if(X)Z=X({column:z,columnGroup:J,defaultItems:Q});else Z=Q}return Gq(Z,G2),Z}getDefaultMenuOptions(z){let J=[],{beans:Q,gos:Z}=this,{colChooserFactory:$,rowGroupColsSvc:X,colModel:Y,expansionSvc:q,sortSvc:G,menuSvc:H,pinnedCols:_,aggFuncSvc:U,colAutosize:W}=Q,B=B0(Z),E=()=>{if(!B&&$)J.push("columnChooser");J.push("resetColumns")};if(!z)return E(),J;let{colDef:K}=z,F=_&&!K.lockPinned,L=X?.columns.length??0,D=L>0,M=S1(Z),f=Z.get("treeData"),S=z.isPrimary(),A=!S||U&&z.isAllowValue()&&(D||M||f);if(G&&!B&&z.isSortable()){let{isDefaultSortAllowed:O,isAbsoluteSortAllowed:v,isAbsoluteSort:I,isDefaultSort:x,isAscending:m,isDescending:g,direction:e}=AZ(z,Q);if(O&&!(m&&x))J.push("sortAscending");if(O&&!(g&&x))J.push("sortDescending");if(v&&!(m&&I))J.push("sortAbsoluteAscending");if(v&&!(g&&I))J.push("sortAbsoluteDescending");if(e)J.push("sortUnSort");J.push(G2)}if(H?.isFilterMenuItemEnabled(z))J.push("columnFilter"),J.push(G2);if(F)J.push("pinSubMenu");if(A)J.push("valueAggSubMenu");if(F||A)J.push(G2);if(W){if(!K.suppressAutoSize)J.push("autoSizeThis");J.push("autoSizeAll"),J.push(G2)}if(X&&Z.isModuleRegistered("SharedRowGrouping")){let O=J.length;if(K.showRowGroup)J.push("rowUnGroup");else if(z.isAllowRowGroup()&&S)if(z.isRowGroupActive()){if(!Jz(z,Q))J.push("rowUnGroup")}else J.push("rowGroup");if(J.length>O)J.push(G2)}if(E(),q&&(o(Z)||Z.get("ssrmExpandAllAffectsAllRows"))&&(f||L>(Y.isPivotMode()?1:0)))J.push("expandAll"),J.push("contractAll");return J}};var b1="filterMenuTab",y1="generalMenuTab",H2="columnsMenuTab",bJ=[y1,b1,H2],Wj=class extends V{constructor(){super(...arguments);this.beanName="enterpriseMenuFactory"}hideActiveMenu(){this.destroyBean(this.activeMenu)}showMenuAfterMouseEvent(z,J,Q,Z,$){let{column:X,columnGroup:Y}=this.splitColumnOrGroup(z),q=$?"filterMenuTab":void 0;this.showMenu(X,Y,(G)=>{let H=G.getGui();if(this.beans.popupSvc.positionPopupUnderMouseEvent({type:Q,additionalParams:{column:X},mouseEvent:J,ePopup:H}),q)G.showTab?.(q);this.dispatchVisibleChangedEvent(!0,!1,X,Y,q)},Q,q,void 0,J.target,Z)}splitColumnOrGroup(z){let J=z&&G4(z);return{column:J?z:void 0,columnGroup:J?void 0:z}}showMenuAfterButtonClick(z,J,Q,Z,$){let X=-1,Y="left";if(this.gos.get("enableRtl"))X=1,Y="right";let q=$?"filterMenuTab":void 0,G=q?[q]:void 0,H=B0(this.gos),_=(H?9:4)*X,U=H?-23:4,{column:W,columnGroup:B}=this.splitColumnOrGroup(z);this.showMenu(W,B,(E)=>{let K=E.getGui();if(this.beans.popupSvc.positionPopupByComponent({type:Q,additionalParams:{column:W},eventSource:J,ePopup:K,alignSide:Y,nudgeX:_,nudgeY:U,position:"under",keepWithinBounds:!0}),q)E.showTab?.(q);this.dispatchVisibleChangedEvent(!0,!1,W,B,q)},Q,q,G,J,Z)}showMenu(z,J,Q,Z,$,X,Y,q){let G=this.getMenuParams(z,J,X,Y);if(!G)return;let{menu:H,eMenuGui:_,anchorToElement:U,restoreFocusParams:W}=G,B=[],{menuUtils:E,popupSvc:K}=this.beans;B.push((L)=>{let D=H.getGui();if(this.destroyBean(H),z)j6(z,!1,"contextMenu"),E.restoreFocusOnClose(W,D,L);q?.()});let F=this.getLocaleTextFunc();if(K.addPopup({modal:!0,eChild:_,closeOnEsc:!0,closedCallback:(L)=>{for(let D of B)D(L);this.dispatchVisibleChangedEvent(!1,!1,z,J,$)},afterGuiAttached:(L)=>H.afterGuiAttached(Object.assign({},{container:Z},L)),positionCallback:$?()=>Q(H):void 0,ariaLabel:F("ariaLabelColumnMenu","Column Menu")}),!$)H.showTabBasedOnPreviousSelection?.(),Q(H);if(fZ(this.gos)){let L=K.setPopupPositionRelatedToElement(_,U);if(L&&z)this.addStopAnchoring(L,z,B)}if(H.addEventListener("tabSelected",(L)=>{this.dispatchVisibleChangedEvent(!1,!0,z),this.lastSelectedTab=L.key,this.dispatchVisibleChangedEvent(!0,!0,z)}),z)j6(z,!0,"contextMenu");this.activeMenu=H,H.addEventListener("destroyed",()=>{if(this.activeMenu===H)this.activeMenu=null})}addStopAnchoring(z,J,Q){z.then((Z)=>{J.__addEventListener("leftChanged",Z),J.__addEventListener("visibleChanged",Z),Q.push(()=>{J.__removeEventListener("leftChanged",Z),J.__removeEventListener("visibleChanged",Z)})})}getMenuParams(z,J,Q,Z){let{focusSvc:$,visibleCols:X,ctrlsSvc:Y}=this.beans,q={column:z,headerPosition:$.focusedHeader,columnIndex:X.allCols.indexOf(z),eventSource:Z},G=this.createMenu(z,J,q,Q,Z);return G?{menu:G,eMenuGui:G.getGui(),anchorToElement:Z||Y.getGridBodyCtrl().eGridBody,restoreFocusParams:q}:void 0}createMenu(z,J,Q,Z,$){if(B0(this.gos))return this.createBean(new Bj(z,Q,this.lastSelectedTab,Z,$));else{let X=this.beans.colMenuFactory.getMenuItems(z,J);return X.length?this.createBean(new Ej(X,z,Q,$)):void 0}}dispatchVisibleChangedEvent(z,J,Q,Z,$){this.eventSvc.dispatchEvent({type:"columnMenuVisibleChanged",visible:z,switchingTab:J,key:this.lastSelectedTab??$??(B0(this.gos)?y1:"columnMenu"),column:Q??null,columnGroup:Z??null})}isMenuEnabled(z){if(!B0(this.gos))return!0;let J=!this.beans.filterManager?.isFilterAllowed(z),Q=z.getColDef().menuTabs??bJ;return(J&&Q.includes(b1)?Q.length-1:Q.length)>0}showMenuAfterContextMenuEvent(z,J,Q){this.beans.menuUtils.onContextMenu({mouseEvent:J,touchEvent:Q,source:"ui",showMenuCallback:(Z)=>{return this.showMenuAfterMouseEvent(z,Z,"columnMenu"),!0}})}},Bj=class extends V{constructor(z,J,Q,Z,$){super();this.column=z,this.restoreFocusParams=J,this.initialSelection=Q,this.restrictTo=Z,this.sourceElement=$,this.tabFactories={},this.includeChecks={};let{tabFactories:X,includeChecks:Y}=this;X[y1]=this.createMainPanel.bind(this),X[b1]=this.createFilterPanel.bind(this),X[H2]=this.createColumnsPanel.bind(this),Y[y1]=()=>!0,Y[b1]=()=>z?!!this.beans.filterManager?.isFilterAllowed(z):!1,Y[H2]=()=>!0}postConstruct(){let z=this.getTabsToCreate().map((Q)=>this.createTab(Q)),J=new MA({items:z,cssClass:"ag-menu",onActiveItemClicked:this.onHidePopup.bind(this),onItemClicked:this.onTabItemClicked.bind(this)});this.tabbedLayout=this.createBean(J),this.mainMenuList?.setParentComponent(J),this.addDestroyFunc(()=>this.destroyBean(J))}getTabsToCreate(){if(this.restrictTo)return this.restrictTo;return(this.column?.getColDef().menuTabs??bJ).filter((z)=>this.isValidMenuTabItem(z)&&this.isNotSuppressed(z))}isValidMenuTabItem(z){let J=!0,Q=bJ;if(this.restrictTo!=null)J=this.restrictTo.indexOf(z)>-1,Q=this.restrictTo;if(J=J&&bJ.indexOf(z)>-1,!J)R(175,{menuTabName:z,itemsToConsider:Q});return J}isNotSuppressed(z){return this.includeChecks[z]()}createTab(z){return this.tabFactories[z]()}showTabBasedOnPreviousSelection(){this.showTab(this.initialSelection)}showTab(z){let{tabItemColumns:J,tabbedLayout:Q,tabItemFilter:Z,tabItemGeneral:$}=this;if(J&&z===H2)Q.showItem(J);else if(Z&&z===b1)Q.showItem(Z);else if($&&z===y1)Q.showItem($);else Q.showFirstItem()}onTabItemClicked(z){let J=null;switch(z.item){case this.tabItemColumns:J=H2;break;case this.tabItemFilter:J=b1;break;case this.tabItemGeneral:J=y1;break}if(J)this.activateTab(J)}activateTab(z){let J={type:"tabSelected",key:z};this.dispatchLocalEvent(J)}createMainPanel(){let{beans:z,column:J}=this,Q=z.colMenuFactory,Z=Q.createMenu(this,Q.getMenuItems(J),this.column,()=>this.sourceElement??this.getGui());this.mainMenuList=Z,Z.addEventListener("closeMenu",this.onHidePopup.bind(this));let $={title:h("legacyMenu",z,J),titleLabel:y1.replace("MenuTab",""),bodyPromise:N.resolve(Z.getGui()),name:y1};return this.tabItemGeneral=$,$}onHidePopup(z){this.beans.menuUtils.closePopupAndRestoreFocusOnSelect(this.hidePopupFunc,this.restoreFocusParams,z)}createFilterPanel(){let z=this.column?this.createBean(new K5(this.column,"COLUMN_MENU")):null;if(this.filterComp=z,!z?.hasFilter())t(119);let J=(Z)=>z?.afterGuiAttached(Z),Q=()=>z?.afterGuiDetached();return this.tabItemFilter={title:h("filterTab",this.beans,this.column),titleLabel:b1.replace("MenuTab",""),bodyPromise:N.resolve(z?.getGui()),afterAttachedCallback:J,afterDetachedCallback:Q,name:b1},this.tabItemFilter}createColumnsPanel(){let z=z0({tag:"div",cls:"ag-menu-column-select-wrapper"}),{beans:J,column:Q}=this,$=J.colChooserFactory.createColumnSelectPanel(this,Q).getGui();$.classList.add("ag-menu-column-select"),z.appendChild($);let X={title:h("columns",J,Q),titleLabel:H2.replace("MenuTab",""),bodyPromise:N.resolve(z),name:H2};return this.tabItemColumns=X,X}afterGuiAttached(z){let{container:J,hidePopup:Q}=z;if(this.tabbedLayout.setAfterAttachedParams({container:J,hidePopup:Q}),Q)this.hidePopupFunc=Q,this.addDestroyFunc(Q)}getGui(){return this.tabbedLayout.getGui()}destroy(){super.destroy(),this.destroyBean(this.filterComp)}},Ej=class extends y{constructor(z,J,Q,Z){super({tag:"div",ref:"eColumnMenu",cls:"ag-menu ag-column-menu",role:"presentation"});this.menuItems=z,this.column=J,this.restoreFocusParams=Q,this.sourceElement=Z,this.eColumnMenu=j}postConstruct(){let z=this.beans.colMenuFactory.createMenu(this,this.menuItems,this.column,()=>this.sourceElement??this.getGui());this.mainMenuList=z,z.addEventListener("closeMenu",this.onHidePopup.bind(this)),this.eColumnMenu.appendChild(z.getGui())}onHidePopup(z){this.beans.menuUtils.closePopupAndRestoreFocusOnSelect(this.hidePopupFunc,this.restoreFocusParams,z)}afterGuiAttached({hidePopup:z}){if(z)this.hidePopupFunc=z,this.addDestroyFunc(z);k0(this.mainMenuList.getGui())}};function Kj(z,J){z.colChooserFactory?.showColumnChooser({chooserParams:J})}function Fj(z){z.colChooserFactory?.hideActiveColumnChooser()}var Lj=class extends V{constructor(){super(...arguments);this.beanName="menuUtils"}restoreFocusOnClose(z,J,Q,Z){let{eventSource:$}=z,X=Q instanceof KeyboardEvent;if(!Z&&!X||!$)return;let Y=d(this.beans);if(!J.contains(Y)&&!f1(this.beans))return;this.focusHeaderCell(z)}closePopupAndRestoreFocusOnSelect(z,J,Q){let Z;if(Q?.keyboardEvent)Z=Q.keyboardEvent;z(Z&&{keyboardEvent:Z});let $=this.beans,X=$.focusSvc,Y=X.getFocusedCell();if(f1($))if(Y){let{rowIndex:q,rowPinned:G,column:H}=Y;X.setFocusedCell({rowIndex:q,column:H,rowPinned:G,forceBrowserFocus:!0,preventScrollOnBrowserFocus:!0})}else this.focusHeaderCell(J)}onContextMenu(z){let{mouseEvent:J,touchEvent:Q,showMenuCallback:Z,source:$}=z;if(!this.gos.get("allowContextMenuWithControlKey")){if(J&&(J.ctrlKey||J.metaKey))return}if(J)this.blockMiddleClickScrollsIfNeeded(J);if($==="ui"&&this.gos.get("suppressContextMenu"))return;let X=J??Q.touches[0];if(Z(X)){let Y=J??Q;if(Y?.cancelable)Y.preventDefault()}}async focusHeaderCell(z){let{column:J,columnIndex:Q,headerPosition:Z,eventSource:$}=z,{visibleCols:X,headerNavigation:Y,focusSvc:q}=this.beans,G=await X.allCols.some((H)=>H===J);if(!this.isAlive())return;if(J?.isAlive()&&G&&$&&M0($)){let H=GJ($);if(H)Y?.scrollToColumn(J),H.focus()}else if(Z&&Q!==-1){let H=X.allCols,_=H[Q]||b(H);if(_)q.focusHeaderPosition({headerPosition:{headerRowIndex:Z.headerRowIndex,column:_}})}}blockMiddleClickScrollsIfNeeded(z){if(this.gos.get("suppressMiddleClickScrolls")&&z.which===2)z.preventDefault()}},Dj={moduleName:"MenuCore",version:$0,beans:[Hj,Qj,Lj],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:[C0,Y2,H5,J7]},Hq={moduleName:"ColumnMenu",version:$0,beans:[Wj,Uj,Xj],icons:{ensureColumnVisible:"column-arrow",legacyMenu:"menu",filterTab:"filter",columnSelectClosed:"tree-closed",columnSelectOpen:"tree-open",columnSelectIndeterminate:"tree-indeterminate"},apiFunctions:{showColumnChooser:Kj,hideColumnChooser:Fj},dependsOn:[Dj,p6,i6]};var U2="__AG_SELECT_ALL__",W2="__AG_ADD_SELECTION_TO_FILTER__",Mj=class{constructor(z,J,Q,Z){this.valueSvc=z,this.getValueFormatter=J,this.formatter=Q,this.column=Z,this.displayedKeys=[]}updateDisplayedValuesToAllAvailable(z,J,Q){this.displayedKeys=Array.from(Q)}updateDisplayedValuesToMatchMiniFilter(z,J,Q,Z,$){this.displayedKeys=[];let X=this.getValueFormatter();for(let Y of Q)if(Y==null){if($)this.displayedKeys.push(Y)}else{let q=z(Y),G=this.valueSvc.formatValue(this.column,null,q,X,!1),H=this.formatter(G);if(Z(H))this.displayedKeys.push(Y)}}getDisplayedValueCount(){return this.displayedKeys.length}getDisplayedItem(z){return this.displayedKeys[z]}getSelectAllItem(){return U2}getAddSelectionToFilterItem(){return W2}getDisplayedKeys(){return this.displayedKeys}forEachDisplayedKey(z){this.displayedKeys.forEach(z)}someDisplayedKey(z){return this.displayedKeys.some(z)}hasGroups(){return!1}refresh(){}},kj={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"}]},fj={tag:"div",cls:"ag-set-filter-item",children:[{tag:"ag-checkbox",ref:"eCheckbox",cls:"ag-set-filter-item-checkbox"}]},Vj=class extends y{constructor(z){super(z.isGroup?kj:fj,[K4]);this.eCheckbox=j,this.eGroupOpenedIcon=j,this.eGroupClosedIcon=j,this.eGroupIndeterminateIcon=j,this.formattedValue=null,this.focusWrapper=z.focusWrapper,this.value=z.value,this.params=z.params,this.translate=z.translate,this.valueFormatter=z.valueFormatter,this.item=z.item,this.isSelected=z.isSelected,this.isTree=z.isTree,this.depth=z.depth??0,this.isGroup=z.isGroup,this.groupsExist=z.groupsExist,this.isExpanded=z.isExpanded,this.hasIndeterminateExpandState=z.hasIndeterminateExpandState}postConstruct(){if(this.tooltipFeature=this.createOptionalManagedBean(this.beans.registry.createDynamicBean("tooltipFeature",!1,{getGui:()=>this.focusWrapper,getLocation:()=>"setFilterValue",shouldDisplayTooltip:()=>this.shouldDisplayTooltip?.()??!0,getAdditionalParams:()=>{let{colDef:z,column:J}=this.params,Q={colDef:z,column:J,valueFormatted:this.formattedValue??void 0};if(this.isTree)Q.level=this.depth;return Q}})),this.addDestroyFunc(()=>this.destroyCellRendererComponent?.()),this.render(),this.eCheckbox.setLabelEllipsis(!0).setValue(this.isSelected,!0).setDisabled(!!this.params.readOnly).getInputElement().setAttribute("tabindex","-1"),this.refreshVariableAriaLabels(),this.isTree){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");sz(this.getAriaElement(),this.depth+1)}if(this.refreshAriaChecked(),this.params.readOnly)return;this.eCheckbox.onValueChange((z)=>this.onCheckboxChanged(!!z))}getFocusableElement(){return this.focusWrapper}setupExpansion(){let{eGroupClosedIcon:z,eGroupOpenedIcon:J,eGroupIndeterminateIcon:Q,hasIndeterminateExpandState:Z,beans:$}=this;z.appendChild(P1("setFilterGroupClosed",$,null)),J.appendChild(P1("setFilterGroupOpen",$,null));let X=this.onExpandOrContractClicked.bind(this);if(this.addManagedElementListeners(z,{click:X}),this.addManagedElementListeners(J,{click:X}),Z)Q.appendChild(P1("setFilterGroupIndeterminate",$,null)),this.addManagedElementListeners(Q,{click:X});this.setExpandedIcons(),this.refreshAriaExpanded()}onExpandOrContractClicked(){this.setExpanded(!this.isExpanded)}setExpanded(z,J){if(this.isGroup&&z!==this.isExpanded){this.isExpanded=z;let Q={type:"expandedChanged",isExpanded:!!z,item:this.item};if(!J)this.dispatchLocalEvent(Q);this.setExpandedIcons(),this.refreshAriaExpanded()}}setExpandedIcons(){let{isExpanded:z,hasIndeterminateExpandState:J,eGroupClosedIcon:Q,eGroupOpenedIcon:Z,eGroupIndeterminateIcon:$}=this;if(w(Q,J?z===!1:!z),w(Z,z===!0),J)w($,z===void 0)}onCheckboxChanged(z){this.isSelected=z;let J={type:"selectionChanged",isSelected:z,item:this.item};this.dispatchLocalEvent(J),this.refreshVariableAriaLabels(),this.refreshAriaChecked()}toggleSelected(){if(this.params.readOnly)return;this.setSelected(!this.isSelected)}setSelected(z,J){this.isSelected=z,this.eCheckbox.setValue(z,J),this.refreshAriaChecked()}refreshVariableAriaLabels(){if(!this.isTree)return;let z=this.getLocaleTextFunc(),J=this.eCheckbox.getValue(),Q=J===void 0?z("ariaIndeterminate","indeterminate"):J?z("ariaVisible","visible"):z("ariaHidden","hidden"),Z=z("ariaToggleVisibility","Press SPACE to toggle visibility");r1(this.eCheckbox.getInputElement(),void 0),this.eCheckbox.setInputAriaLabel(`${Z} (${Q})`)}setupFixedAriaLabels(z){if(!this.isTree)return;let Q=this.getLocaleTextFunc()("ariaFilterValue","Filter Value"),Z=this.getAriaElement();_0(Z,`${z} ${Q}`),c2(Z,this.eCheckbox.getInputElement().id)}refreshAriaChecked(){let z=this.getAriaElement();oz(z,this.eCheckbox.getValue())}refreshAriaExpanded(){R0(this.getAriaElement(),!!this.isExpanded)}refresh(z,J,Q){if(this.item=z,J!==this.isSelected)this.setSelected(J,!0);this.setExpanded(Q,!0);let{cellRendererComponent:Z,cellRendererParams:$,beans:X,params:Y}=this;if(this.valueFunction){let q=this.valueFunction();if(this.setTooltipAndCellRendererParams(q,q),!Z)this.renderCellWithoutCellRenderer()}if(Z){let q=D1(X.userCompFactory,Y,$);if(!Z.refresh?.(q?.params??$)){let H=Z;this.renderCell(),this.destroyBean(H)}}}render(){let{params:{column:z}}=this,{value:J}=this,Q=null;if(typeof J==="function")this.valueFunction=J,Q=this.valueFunction(),J=Q;else if(this.isTree)Q=i0(J);else Q=this.getFormattedValue(z,J);this.formattedValue=Q,this.setTooltipAndCellRendererParams(J,Q),this.renderCell()}setTooltipAndCellRendererParams(z,J){let Q=this.gos;if(this.params.showTooltips&&(!g2(Q)||!this.params.cellRenderer)){let Z=J!=null?J:i0(z);this.shouldDisplayTooltip=r2(Q,()=>this.eCheckbox.getGui().querySelector(".ag-label")),this.tooltipFeature?.setTooltipAndRefresh(Z)}this.cellRendererParams=C(Q,{value:z,valueFormatted:J,colDef:this.params.colDef,column:this.params.column,setTooltip:(Z,$)=>{Q.assertModuleRegistered("Tooltip",3),this.shouldDisplayTooltip=$,this.tooltipFeature?.setTooltipAndRefresh(Z)}})}getFormattedValue(z,J){return this.beans.valueSvc.formatValue(z,null,J,this.valueFormatter,!1)}renderCell(){let J=D1(this.beans.userCompFactory,this.params,this.cellRendererParams)?.newAgStackInstance();if(J==null){this.renderCellWithoutCellRenderer();return}J.then((Q)=>{if(Q)this.cellRendererComponent=Q,this.eCheckbox.setLabel(Q.getGui()),this.destroyCellRendererComponent=()=>this.destroyBean(Q)})}renderCellWithoutCellRenderer(){let{valueFormatted:z,value:J}=this.cellRendererParams,Q=(z==null?J:z)??this.translate("blanks");if(typeof Q!=="string")R(208),Q="";this.eCheckbox.setLabel(Q),this.setupFixedAriaLabels(Q)}getComponentHolder(){return this.params.column.getColDef()}},Sj={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:(z)=>`is (${z[0]})`,filterSummaryListLong:(z)=>`is (${z[0]}) and ${z[1]} more`};function s5(z,J,Q){let Z=z;if(!Z)return null;if(Z=Z.map(($)=>i0(q0($))),!J&&Q&&Z.some(($)=>$==null)){if(b(Z)==null)return null;return Z.filter(($)=>$!=null)}return Z}function r0(z,J,Q){return EZ(z,Sj,J,Q)}function Aj(z){if(z.excelMode==="windows"){if(!z.buttons)z.buttons=["apply","cancel"];if(z.closeOnApply==null)z.closeOnApply=!0}else if(z.excelMode==="mac"){if(!z.buttons)z.buttons=["reset"];if(z.applyMiniFilterWhileTyping==null)z.applyMiniFilterWhileTyping=!0;if(z.debounceMs==null)z.debounceMs=500}if(z.excelMode&&z.defaultToNothingSelected)z.defaultToNothingSelected=!1,R(207)}function Rj(){return([z,J],[Q,Z])=>{if(J==null)return Z==null?0:-1;else if(Z==null)return 1;for(let $=0;$=Z.length)return 1;let X=u2(J[$],Z[$]);if(X!==0)return X}return 0}}var GY=class{constructor(z,J,Q,Z){this.formatter=z,this.treeListPathGetter=J,this.treeListFormatter=Q,this.treeDataOrGrouping=Z,this.allDisplayedItemsTree=new Map,this.activeDisplayedItemsFlat=[],this.selectAllItem={depth:0,filterPasses:!0,available:!0,treeKey:U2,children:this.allDisplayedItemsTree,expanded:!0,key:U2,parentTreeKeys:[]},this.addSelectionToFilterItem={depth:0,filterPasses:!0,available:!0,treeKey:W2,expanded:!0,key:W2,parentTreeKeys:[]}}updateParams(z,J){this.treeListPathGetter=z,this.treeListFormatter=J}updateDisplayedValuesToAllAvailable(z,J,Q,Z){if(Z==="reload")this.generateItemTree(z,J,Q);else if(Z==="otherFilter")this.updateAvailable(Q),this.updateExpandAll();else if(Z==="miniFilter")this.resetFilter(),this.updateExpandAll();this.flattenItems()}updateDisplayedValuesToMatchMiniFilter(z,J,Q,Z,$,X){if(X==="reload")this.generateItemTree(z,J,Q);else if(X==="otherFilter")this.updateAvailable(Q);this.updateFilter(Z,$),this.updateExpandAll(),this.flattenItems()}generateItemTree(z,J,Q){let Z=new Map;this.allDisplayedItemsTree=Z;let $=!1,X=this.getTreeListPathGetter(z,Q);for(let Y of J){let q=z(Y),G=X(q)??[null],H=G.length;if(H>1)$=!0;let _=Q.has(Y),U=Z,W,B=[];for(let E=0;EZ;let Q=!1;for(let Z of J){let $=z(Z);if($ instanceof Date){Q=!0;break}else if($!=null)break}if(Q)return(Z)=>_1(Z,!1);return R(211),(Z)=>[String(Z)]}flattenItems(){this.activeDisplayedItemsFlat=[];let z=(J)=>{for(let Q of J.values()){if(!Q.filterPasses||!Q.available)continue;if(this.activeDisplayedItemsFlat.push(Q),Q.children&&Q.expanded)z(Q.children)}};z(this.allDisplayedItemsTree)}resetFilter(){let z=(J)=>{let Q=J.children;if(Q)for(let Z of Q.values())z(Z);J.filterPasses=!0};for(let J of this.allDisplayedItemsTree.values())z(J)}updateFilter(z,J){let Q=(Z)=>{if(!Z.available)return!1;if(Z.treeKey==null)return J;return z(this.formatter(this.treeListFormatter?this.treeListFormatter(Z.treeKey,Z.depth,Z.parentTreeKeys):Z.treeKey))};for(let Z of this.allDisplayedItemsTree.values())this.recursiveItemCheck(Z,!1,Q,"filterPasses")}getDisplayedValueCount(){return this.activeDisplayedItemsFlat.length}getDisplayedItem(z){return this.activeDisplayedItemsFlat[z]}getSelectAllItem(){return this.selectAllItem}getAddSelectionToFilterItem(){return this.addSelectionToFilterItem}getDisplayedKeys(){let z=[];return this.forEachDisplayedKey((J)=>z.push(J)),z}forEachDisplayedKey(z){let J=(Q,Z)=>{let $=Q.children;if($){if(!Q.expanded||!Z){for(let X of $.values())if(X.filterPasses)J(X,!1)}}else z(Q.key)};for(let Q of this.activeDisplayedItemsFlat)J(Q,!0)}someDisplayedKey(z){let J=(Q,Z)=>{let $=Q.children;if($){if(!Q.expanded||!Z){for(let X of $.values())if(X.filterPasses&&J(X,!1))return!0;return!1}}else return z(Q.key);return!1};return this.activeDisplayedItemsFlat.some((Q)=>J(Q,!0))}hasGroups(){return this.groupsExist}refresh(){this.updateExpandAll(),this.flattenItems()}updateExpandAll(){let z=(Q,Z,$)=>{for(let X of Q.values()){if(!X.filterPasses||!X.available||!X.children)continue;if(Z=Z||!!X.expanded,$=$||!X.expanded,Z&&$)return;let Y=z(X.children,Z,$);if(Y===void 0)return;else if(Y)Z=!0;else $=!0}return Z&&$?void 0:Z},J=this.getSelectAllItem();J.expanded=z(J.children,!1,!1)}recursiveItemCheck(z,J,Q,Z){let $=!1,X=z.children;if(X)for(let q of X.values()){let G=this.recursiveItemCheck(q,J||Q(z),Q,Z);$=$||G}let Y=J||$||Q(z);return z[Z]=Y,Y}updateAvailable(z){let J=(Q)=>z.has(Q.key);for(let Q of this.allDisplayedItemsTree.values())this.recursiveItemCheck(Q,!1,J,"available")}},_q=class extends Z2{constructor(){super("setFilter","set-filter");this.filterType="set",this.eMiniFilter=j,this.eFilterLoading=j,this.eFilterLoadingIcon=j,this.eSetFilterList=j,this.eFilterNoMatches=j,this.hardRefreshVirtualList=!1,this.miniFilterText=null,this.addCurrentSelectionToFilter=!1,this.selectedKeys=new Set}setParams(z){super.setParams(z);let J=this.updateHandler(z.getHandler()),{column:Q,textFormatter:Z,treeList:$,treeListPathGetter:X,treeListFormatter:Y}=z;if(this.formatter=Z??((q)=>q??null),this.displayValueModel=$?new GY(this.formatter,X,Y,J.isTreeDataOrGrouping()):new Mj(this.beans.valueSvc,()=>this.handler.valueFormatter,this.formatter,Q),J.valueModel.allKeys.then((q)=>{if(!this.isAlive())return;this.updateDisplayedValues("reload",q??[]),this.resetSelectionState(q??[])}),J.valueModel.isLoading())this.setIsLoading(!0);this.initialiseFilterBodyUi()}refresh(z){if(this.params.treeList!==z.treeList)return!1;return this.updateHandler(z.getHandler()),super.refresh(z)}updateParams(z,J){if(super.updateParams(z,J),this.updateMiniFilter(),z.suppressSelectAll!==J.suppressSelectAll)this.createVirtualListModel(z);let{textFormatter:Q,treeListPathGetter:Z,treeListFormatter:$}=z;if(this.formatter=Q??((X)=>X??null),this.displayValueModel instanceof GY)this.displayValueModel.updateParams(Z,$);this.handler.refreshFilterValues(!0)}updateHandler(z){if(this.handler!==z){for(let Q of this.handlerDestroyFuncs??[])Q();this.handlerDestroyFuncs=[...this.addManagedListeners(z,{anyFilterChanged:(Q)=>{z.valueModel.allKeys.then((Z)=>{if(this.isAlive()){if(this.updateDisplayedValues("otherFilter",Z??[]),Q.updated)this.checkAndRefreshVirtualList(),this.showOrHideResults()}})},dataChanged:({hardRefresh:Q})=>{z.valueModel.allKeys.then((Z)=>{if(this.isAlive()){if(this.updateDisplayedValues("reload",Z??[]),this.setSelectedModel(this.state.model?.values??null),Q)this.hardRefreshVirtualList=!0;this.checkAndRefreshVirtualList()}})}}),...this.addManagedListeners(z.valueModel,{loadingStart:()=>this.setIsLoading(!0),loadingEnd:()=>this.setIsLoading(!1)})],this.handler=z}return z}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:r0(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:r0(this,"noMatches")},{tag:"div",ref:"eSetFilterList",cls:"ag-set-filter-list",role:"presentation"}]}}getAgComponents(){return[e4]}handleKeyDown(z){if(super.handleKeyDown(z),z.defaultPrevented)return;let J=()=>{if(!this.eSetFilterList.contains(d(this.beans)))return;let Q=this.virtualList.getLastFocusedRow();if(Q==null)return;let Z=this.virtualList.getComponentAt(Q);if(Z==null)return;z.preventDefault();let{readOnly:$}=this.params;if($)return;return Z};switch(z.key){case k.SPACE:J()?.toggleSelected();break;case k.ENTER:this.handleKeyEnter(z);break;case k.LEFT:J()?.setExpanded(!1);break;case k.RIGHT:J()?.setExpanded(!0);break}}handleKeyEnter(z){z.preventDefault();let{excelMode:J,readOnly:Q}=this.params;if(!J||!!Q)return;if(this.params.onAction("apply",void 0,z),this.params.excelMode==="mac")this.eMiniFilter.getInputElement().select()}setModelAndRefresh(z){return this.setSelectedModel(z).then(()=>{if(this.isAlive())this.checkAndRefreshVirtualList()})}setModelIntoUi(z){this.setMiniFilter(this.params.state.state?.miniFilterValue??null,!0);let J=z==null?null:z.values;return this.setModelAndRefresh(J)}getModelFromUi(){let z=this.getSelectedModel();if(!z)return null;return{values:z,filterType:this.filterType}}areNonNullModelsEqual(z,J){return Z0(z.values,J.values)}setIsLoading(z){if(w(this.eFilterLoading,z),!z)this.hardRefreshVirtualList=!0}initialiseFilterBodyUi(){this.initVirtualList(),this.initMiniFilter(),this.initLoading()}initLoading(){let z=h("setFilterLoading",this.beans,this.params.column);if(z)this.eFilterLoadingIcon.appendChild(z)}initVirtualList(){let z=r0(this,"ariaFilterList"),J=!!this.params.treeList,Q=this.virtualList=this.createBean(new e5({cssIdentifier:"filter",ariaRole:J?"tree":"listbox",listName:z})),Z=this.eSetFilterList;if(J)Z.classList.add("ag-set-filter-tree-list");Z.appendChild(Q.getGui());let{cellHeight:$}=this.params;if($!=null)Q.setRowHeight($);let X=(q,G)=>this.createSetListItem(q,J,G);Q.setComponentCreator(X);let Y=(q,G)=>this.updateSetListItem(q,G);Q.setComponentUpdater(Y),this.createVirtualListModel(this.params)}createVirtualListModel(z){let J;if(z.suppressSelectAll)J=new jj(this.displayValueModel);else J=new Oj(this.displayValueModel,this.showAddCurrentSelectionToFilter.bind(this));if(z.treeList)J=new Pj(J);this.virtualList.setModel(J)}getSelectAllLabel(){let z=this.miniFilterText==null||!this.params.excelMode?"selectAll":"selectAllSearchResults";return r0(this,z)}getAddSelectionToFilterLabel(){return r0(this,"addCurrentSelectionToFilter")}createSetListItem(z,J,Q){let Z=this.displayValueModel.hasGroups(),{isSelected:$,isExpanded:X}=this.isSelectedExpanded(z),{value:Y,depth:q,isGroup:G,hasIndeterminateExpandState:H,selectedListener:_,expandedListener:U}=this.newSetListItemAttributes(z),W={focusWrapper:Q,value:Y,params:this.params,translate:(E)=>r0(this,E),valueFormatter:this.handler.valueFormatter,item:z,isSelected:$,isTree:J,depth:q,groupsExist:Z,isGroup:G,isExpanded:X,hasIndeterminateExpandState:H},B=this.createBean(new Vj(W));if(B.addEventListener("selectionChanged",_),U)B.addEventListener("expandedChanged",U);return B}newSetTreeItemAttributes(z){let J=this.displayValueModel.hasGroups();if(z.key===U2)return{value:()=>this.getSelectAllLabel(),isGroup:J,depth:z.depth,hasIndeterminateExpandState:!0,selectedListener:(Q)=>this.onSelectAll(Q.isSelected),expandedListener:(Q)=>this.onExpandAll(Q.item,Q.isExpanded)};if(z.key===W2)return{value:()=>this.getAddSelectionToFilterLabel(),depth:z.depth,isGroup:!1,hasIndeterminateExpandState:!1,selectedListener:(Q)=>{this.addCurrentSelectionToFilter=Q.isSelected,this.refreshAfterSelection()}};if(z.children)return{value:this.params.treeListFormatter?.(z.treeKey,z.depth,z.parentTreeKeys)??z.treeKey,depth:z.depth,isGroup:!0,selectedListener:(Q)=>this.onGroupItemSelected(Q.item,Q.isSelected),expandedListener:(Q)=>this.onExpandedChanged(Q.item,Q.isExpanded)};return{value:this.params.treeListFormatter?.(z.treeKey,z.depth,z.parentTreeKeys)??z.treeKey,depth:z.depth,selectedListener:(Q)=>this.onItemSelected(Q.item.key,Q.isSelected)}}newSetListItemAttributes(z){if(this.isSetFilterModelTreeItem(z))return this.newSetTreeItemAttributes(z);if(z===U2)return{value:()=>this.getSelectAllLabel(),selectedListener:(J)=>this.onSelectAll(J.isSelected)};if(z===W2)return{value:()=>this.getAddSelectionToFilterLabel(),selectedListener:(J)=>{this.addCurrentSelectionToFilter=J.isSelected,this.refreshAfterSelection()}};return{value:this.handler.valueModel.allValues.get(z)??null,selectedListener:(J)=>this.onItemSelected(J.item,J.isSelected)}}updateSetListItem(z,J){let{isSelected:Q,isExpanded:Z}=this.isSelectedExpanded(z);J.refresh(z,Q,Z)}isSelectedExpanded(z){let J,Q;if(this.isSetFilterModelTreeItem(z))if(Q=z.expanded,z.key===U2)J=this.isSelectAllSelected();else if(z.key===W2)J=this.isAddCurrentSelectionToFilterChecked();else if(z.children)J=this.areAllChildrenSelected(z);else J=this.selectedKeys.has(z.key);else if(z===U2)J=this.isSelectAllSelected();else if(z===W2)J=this.isAddCurrentSelectionToFilterChecked();else J=this.selectedKeys.has(z);return{isSelected:J,isExpanded:Q}}isSetFilterModelTreeItem(z){return z?.treeKey!==void 0}initMiniFilter(){let{eMiniFilter:z}=this;this.updateMiniFilter(),z.onValueChange(()=>this.onMiniFilterInput()),z.setInputAriaLabel(r0(this,"ariaSearchFilterValues")),this.addManagedElementListeners(z.getInputElement(),{keydown:(J)=>this.onMiniFilterKeyDown(J)})}updateMiniFilter(){let{eMiniFilter:z,miniFilterText:J,params:Q}=this;z.setDisplayed(!Q.suppressMiniFilter),z.setValue(J)}afterGuiAttached(z){super.afterGuiAttached(z),this.resetExpansion(),this.refreshVirtualList();let{eMiniFilter:J}=this;if(J.setInputPlaceholder(r0(this,"searchOoo")),!z?.suppressFocus)if(J.isDisplayed())J.getFocusableElement().focus();else this.virtualList.awaitStable(()=>this.virtualList.focusRow(0))}afterGuiDetached(){super.afterGuiDetached();let{column:z,excelMode:J,model:Q,onStateChange:Z}=this.params;if(this.beans.colFilter?.shouldKeepStateOnDetach(z))return;if(J)this.resetMiniFilter();if(J||Q!==this.state.model)Z({model:Q,state:this.getState()}),this.showOrHideResults()}canApply(z){return this.params.excelMode?z==null||z.values.length>0:!0}onNewRowsLoaded(){}setFilterValues(z){R(283),this.handler.setFilterValues(z)}resetFilterValues(){R(283),this.handler.resetFilterValues()}refreshFilterValues(){R(283),this.doRefreshFilterValues()}doRefreshFilterValues(){this.handler.refreshFilterValues()}onAnyFilterChanged(){}onMiniFilterInput(z){if(!this.doSetMiniFilter(this.eMiniFilter.getValue()))return;if(z){this.showOrHideResults();return}let{applyMiniFilterWhileTyping:J,readOnly:Q,excelMode:Z}=this.params,$=!Q&&(J||!!Z),X=J&&!Q?"debounce":void 0;this.updateUiAfterMiniFilterChange($,X)}updateUiAfterMiniFilterChange(z,J){if(z){let{excelMode:Q,readOnly:Z,model:$}=this.params;if(Q&&!Z&&this.miniFilterText==null)this.setModelAndRefresh($?.values??null);else this.selectAllMatchingMiniFilter(!0)}this.checkAndRefreshVirtualList(),this.onUiChanged(z?J:"prevent"),this.showOrHideResults()}showOrHideResults(){let z=this.miniFilterText!=null&&this.displayValueModel.getDisplayedValueCount()<1;w(this.eFilterNoMatches,z),w(this.eSetFilterList,!z)}resetMiniFilter(){this.eMiniFilter.setValue(null,!0),this.doSetMiniFilter(null)}onMiniFilterKeyDown(z){let{excelMode:J,readOnly:Q}=this.params;if(z.key===k.ENTER&&!J&&!Q)this.updateUiAfterMiniFilterChange(!0,"immediately")}focusRowIfAlive(z){if(z==null)return Promise.resolve();return new Promise((J)=>{window.setTimeout(()=>{if(this.isAlive())this.virtualList.focusRow(z);J()},0)})}onSelectAll(z){if(z)this.selectAllMatchingMiniFilter();else this.deselectAllMatchingMiniFilter();this.refreshAfterSelection()}onGroupItemSelected(z,J){let Q=(Z)=>{if(!Z.filterPasses)return;let $=Z.children;if($)for(let X of $.values())Q(X);else this.setKeySelected(Z.key,J)};Q(z),this.refreshAfterSelection()}onItemSelected(z,J){this.setKeySelected(z,J),this.refreshAfterSelection()}onExpandAll(z,J){let Q=(Z)=>{if(Z.filterPasses&&Z.available&&Z.children){for(let $ of Z.children.values())Q($);Z.expanded=J}};Q(z),this.refreshAfterExpansion()}onExpandedChanged(z,J){z.expanded=J,this.refreshAfterExpansion()}refreshAfterExpansion(){let z=this.virtualList.getLastFocusedRow();this.updateDisplayedValues("expansion"),this.checkAndRefreshVirtualList(),this.focusRowIfAlive(z)}refreshAfterSelection(){let z=this.virtualList.getLastFocusedRow();this.checkAndRefreshVirtualList(),this.onUiChanged(),this.focusRowIfAlive(z)}setMiniFilter(z,J){this.eMiniFilter.setValue(z,J),this.onMiniFilterInput(J)}doSetMiniFilter(z){if(z=q0(z),this.miniFilterText===z)return!1;if(z===null)this.addCurrentSelectionToFilter=!1;return this.miniFilterText=z,this.updateDisplayedValues("miniFilter"),!0}getMiniFilter(){return this.miniFilterText}getUiChangeEventParams(){return{miniFilterValue:this.miniFilterText}}getState(){let z=this.miniFilterText;return z?{miniFilterValue:z}:void 0}checkAndRefreshVirtualList(){if(this.virtualList.refresh(!this.hardRefreshVirtualList),this.hardRefreshVirtualList)this.hardRefreshVirtualList=!1}getFilterKeys(){return R(283),this.handler.getFilterKeys()}getFilterValues(){return R(283),this.handler.getFilterValues()}refreshVirtualList(){if(this.params.refreshValuesOnOpen)this.doRefreshFilterValues();else this.checkAndRefreshVirtualList()}isSelectAllSelected(){if(!this.params.defaultToNothingSelected){if(this.hasSelections()&&this.isNothingVisibleSelected())return!1;if(this.isEverythingVisibleSelected())return!0}else{if(this.hasSelections()&&this.isEverythingVisibleSelected())return!0;if(this.isNothingVisibleSelected())return!1}return}areAllChildrenSelected(z){let J=(Q)=>{if(Q.children){let Z=!1,$=!1;for(let X of Q.children.values()){if(!X.filterPasses||!X.available)continue;let Y=J(X);if(Y===void 0)return;if(Y)Z=!0;else $=!0;if(Z&&$)return}return Z}else return this.selectedKeys.has(Q.key)};if(!this.params.defaultToNothingSelected)return J(z);else return this.hasSelections()&&J(z)}resetExpansion(){if(!this.params.treeList)return;let z=this.displayValueModel.getSelectAllItem();if(this.isSetFilterModelTreeItem(z)){let J=(Q)=>{let Z=Q.children;if(Z){for(let $ of Z.values())J($);Q.expanded=!1}};J(z),this.updateDisplayedValues("expansion")}}getModelAsString(z){return this.handler.getModelAsString(z)}getPositionableElement(){return this.eSetFilterList}updateDisplayedValues(z,J){if(z==="expansion"){this.displayValueModel.refresh();return}let Q=this.handler,Z=Q.valueModel;if(this.miniFilterText==null){this.displayValueModel.updateDisplayedValuesToAllAvailable((q)=>Z.allValues.get(q)??null,J,Z.availableKeys,z);return}let $=Q.caseFormat(this.formatter(this.miniFilterText)||""),X=(q)=>q!=null&&Q.caseFormat(q).includes($),Y=!!this.params.excelMode&&X(r0(this,"blanks"));this.displayValueModel.updateDisplayedValuesToMatchMiniFilter((q)=>Z.allValues.get(q)??null,J,Z.availableKeys,X,Y,z)}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()&&T(this.miniFilterText)&&this.miniFilterText.length>0}selectAllMatchingMiniFilter(z=!1){if(this.miniFilterText==null)this.selectedKeys=new Set(this.handler.valueModel.allValues.keys());else{if(z)this.selectedKeys.clear();this.displayValueModel.forEachDisplayedKey((J)=>this.selectedKeys.add(J))}}deselectAllMatchingMiniFilter(){if(this.miniFilterText==null)this.selectedKeys.clear();else this.displayValueModel.forEachDisplayedKey((z)=>this.selectedKeys.delete(z))}setKeySelected(z,J){if(J)this.selectedKeys.add(z);else{if(this.params.excelMode&&this.isEverythingVisibleSelected())this.resetSelectionState(this.displayValueModel.getDisplayedKeys());this.selectedKeys.delete(z)}}isEverythingVisibleSelected(){return!this.displayValueModel.someDisplayedKey((z)=>!this.selectedKeys.has(z))}isNothingVisibleSelected(){return!this.displayValueModel.someDisplayedKey((z)=>this.selectedKeys.has(z))}getSelectedModel(){if(!this.hasSelections())return null;let z=this.isAddCurrentSelectionToFilterChecked()?this.params.model?.values:void 0;if(z?.length){if(this.selectedKeys){let J=new Set([...z,...this.selectedKeys]);return Array.from(J)}return Array.from(z)}return Array.from(this.selectedKeys)}setSelectedModel(z){let J=this.handler,Q=J.valueModel;return Q.allKeys.then((Z)=>{if(z==null)this.resetSelectionState(Z??[]);else{this.selectedKeys.clear();let $=new Map;Q.allValues.forEach((X,Y)=>{$.set(J.caseFormat(Y),Y)}),z.forEach((X)=>{let Y=J.caseFormat(q0(X)),q=$.get(Y);if(q!==void 0)this.selectedKeys.add(q)})}})}resetSelectionState(z){if(this.params.defaultToNothingSelected)this.selectedKeys.clear();else this.selectedKeys=new Set(z)}getFilterHandler(){return this.handler}destroy(){this.virtualList=this.destroyBean(this.virtualList);for(let z of this.handlerDestroyFuncs??[])z();this.handler=void 0,this.displayValueModel=void 0,this.selectedKeys.clear(),super.destroy()}},jj=class{constructor(z){this.model=z}getRowCount(){return this.model.getDisplayedValueCount()}getRow(z){return this.model.getDisplayedItem(z)}areRowsEqual(z,J){return z===J}},Oj=class{constructor(z,J){this.model=z,this.showAddCurrentSelectionToFilter=J}getRowCount(){let J=this.showAddCurrentSelectionToFilter()?2:1;return this.model.getDisplayedValueCount()+J}getRow(z){if(z===0)return this.model.getSelectAllItem();let J=this.showAddCurrentSelectionToFilter(),Q=J?2:1;if(z===1&&J)return this.model.getAddSelectionToFilterItem();return this.model.getDisplayedItem(z-Q)}areRowsEqual(z,J){return z===J}},Pj=class{constructor(z){this.model=z}getRowCount(){return this.model.getRowCount()}getRow(z){return this.model.getRow(z)}areRowsEqual(z,J){if(z==null&&J==null)return!0;return z!=null&&J!=null&&z.treeKey===J.treeKey&&z.depth===J.depth}},Tj=class extends V{constructor(z,J,Q,Z,$){super();this.createKey=z,this.caseFormat=J,this.getValue=Q,this.isTreeDataOrGrouping=Z,this.isTreeData=$}extractUniqueValuesAsync(z,J){return new N((Q)=>{if(this.beans.rowModel.rowCountReady)Q(this.extractUniqueValues(z,J));else{let[Z]=this.addManagedEventListeners({rowCountReady:()=>{Z?.(),Q(this.extractUniqueValues(z,J))}})}})}extractUniqueValues(z,J){let Q=new Map,Z=this.extractExistingFormattedKeys(J),$=new Set,X=this.isTreeData(),Y=this.isTreeDataOrGrouping(),q=this.beans.rowGroupColsSvc?.columns,G=this.gos.get("groupAllowUnbalanced"),H=(_,U)=>{let W=this.caseFormat(_);if(!$.has(W)){$.add(W);let B=_,E=q0(U),K=Z?.get(W);if(K!=null)B=K,E=J.get(K);Q.set(B,E)}};return this.beans.rowModel.forEachLeafNode((_)=>{if(!_.data||!z(_))return;if(Y){this.addValueForTreeDataOrGrouping(_,X,q,H,G);return}let U=this.getValue(_);if(U!=null&&Array.isArray(U)){for(let W of U)H(this.createKey(W,_),W);if(U.length===0)H(null,null)}else H(this.createKey(U,_),U)}),Q}addValueForTreeDataOrGrouping(z,J,Q=[],Z,$){let X;if(J){if(z.childrenAfterGroup?.length)return;X=z.getRoute()??[z.key??z.id]}else X=Q.map((q)=>this.beans.valueSvc.getKeyForNode(q,z)),X.push(this.getValue(z));let Y=s5(X,J,$);Z(this.createKey(Y),Y)}extractExistingFormattedKeys(z){if(!z)return null;let J=new Map;return z.forEach((Q,Z)=>{J.set(this.caseFormat(Z),Z)}),J}},vj=class{constructor(z){this.caseFormat=z,this.keys=null}isNull(){return this.keys==null}isEmpty(){return!this.keys?.size}update(z){let J=new Set;this.keys=J;let Q=z?.values;if(Q){let Z=this.caseFormat;for(let $=0,X=Q.length;${return z[z.PROVIDED_LIST=0]="PROVIDED_LIST",z[z.PROVIDED_CALLBACK=1]="PROVIDED_CALLBACK",z[z.TAKEN_FROM_GRID_VALUES=2]="TAKEN_FROM_GRID_VALUES",z})(Uq||{}),m5=Uq,Ij=class extends V{constructor(z,J,Q,Z,$){super();this.clientSideValuesExtractor=z,this.caseFormat=J,this.createKey=Q,this.isTreeDataOrGrouping=Z,this.params=$,this.allValues=new Map,this.availableKeys=new Set,this.providedValues=null,this.initialised=!1}postConstruct(){let z=this.params,J=z.handlerParams.filterParams.values;if(this.updateParams(z),J==null)this.valuesType=2;else this.valuesType=Array.isArray(J)?0:1,this.providedValues=J;this.updateAllValues()}refresh(z){let J=z.handlerParams;if(J.source!=="colDef")return;let{values:Q,suppressSorting:Z}=J.filterParams,$=this.providedValues,X=this.params.handlerParams.filterParams.suppressSorting;if(this.params=z,this.updateParams(z),this.providedValues=Q??null,this.providedValues!==$||Z!==X){if(!Q||Q.length===0)this.valuesType=2,this.providedValues=null;else this.valuesType=Array.isArray(Q)?0:1;this.updateAllValues()}}updateParams(z){let{handlerParams:{colDef:J,filterParams:{comparator:Q,treeList:Z,treeListPathGetter:$}},usingComplexObjects:X}=z,Y=Q??J.comparator,q=this.isTreeDataOrGrouping(),G;if(q&&!Y)G=Rj();else if(Z&&!$&&!Y)G=([H,_],[U,W])=>u2(_,W);else G=([H,_],[U,W])=>Y(_,W);this.entryComparator=G,this.keyComparator=Y??u2,this.compareByValue=!!(X&&Y||q||Z&&!$)}updateAllValues(){return this.allKeys=new N((z)=>{switch(this.valuesType){case 2:this.getValuesFromRowsAsync().then((J)=>z(this.processAllValues(J)));break;case 0:{z(this.processAllValues(this.uniqueValues(this.validateProvidedValues(this.providedValues))));break}case 1:{this.dispatchLocalEvent({type:"loadingStart"});let J=this.providedValues,{column:Q,colDef:Z}=this.params.handlerParams,$=C(this.gos,{success:(X)=>{this.dispatchLocalEvent({type:"loadingEnd"}),z(this.processAllValues(this.uniqueValues(this.validateProvidedValues(X))))},colDef:Z,column:Q});window.setTimeout(()=>J($),0);break}}}),this.allKeys.then((z)=>{this.updateAvailableKeys(z??[]),this.initialised=!0}),this.allKeys}getAvailableValues(z){return this.sortKeys(this.getValuesFromRows(z))}overrideValues(z){return this.allKeys.then(()=>{this.valuesType=0,this.providedValues=z})}refreshAvailable(){return new N((z)=>{if(this.showAvailableOnly()){this.allKeys.then((J)=>{let Q=J??[];this.updateAvailableKeys(Q),z(!0)});return}z(!1)})}refreshAll(){return new N((z)=>{this.allKeys.then(()=>{this.updateAllValues().then(()=>{z()})})})}isLoading(){return!this.initialised&&this.valuesType===1}isInitialised(){return this.initialised}getValueForFormatter(z){return this.initialised?this.allValues.get(z):z}getAvailableKeys(z){return this.initialised?z.filter((J)=>this.availableKeys.has(J)):z}getParamsForValuesFromRows(z){if(!this.clientSideValuesExtractor){t(113);return}return z&&!this.params.handlerParams.filterParams.caseSensitive?this.allValues:void 0}getValuesFromRows(z){let J=this.getParamsForValuesFromRows(!0);return this.clientSideValuesExtractor?.extractUniqueValues(z,J)??null}getValuesFromRowsAsync(){let z=this.getParamsForValuesFromRows(!1);return this.clientSideValuesExtractor?.extractUniqueValuesAsync(()=>!0,z)??N.resolve(null)}processAllValues(z){let J=this.sortKeys(z);return this.allValues=z??new Map,J}uniqueValues(z){let J=new Map,Q=new Set,{caseFormat:Z,createKey:$}=this;for(let X of z??[]){let Y=q0(X),q=$(Y),G=Z(q);if(!Q.has(G))Q.add(G),J.set(q,Y)}return J}validateProvidedValues(z){if(this.params.usingComplexObjects&&z?.length){let J=z[0];if(J&&typeof J!=="object"&&typeof J!=="function")if(this.createKey(J)==null)R(209);else R(210)}return z}sortKeys(z){let J=z??new Map,Q=this.params.handlerParams.filterParams;if(Q.suppressSorting)return Array.from(J.keys());let Z;if(this.compareByValue)Z=Array.from(J.entries()).sort(this.entryComparator).map(([$])=>$);else Z=Array.from(J.keys()).sort(this.keyComparator);if(Q.excelMode&&J.has(null))Z=Z.filter(($)=>$!=null),Z.push(null);return Z}showAvailableOnly(){return this.valuesType===2}updateAvailableKeys(z){let J=this.showAvailableOnly()?this.getAvailableValues((Q)=>this.params.handlerParams.doesRowPassOtherFilter(Q)):z;this.availableKeys=new Set(J),window.setTimeout(()=>{if(this.isAlive())this.dispatchLocalEvent({type:"availableValuesChanged"})})}},Cj=class extends V{constructor(){super(...arguments);this.filterType="set",this.treeDataTreeList=!1,this.groupingTreeList=!1,this.caseSensitive=!1,this.noValueFormatterSupplied=!1}init(z){this.updateParams(z);let J=this.isTreeDataOrGrouping.bind(this),Q=()=>this.treeDataTreeList,Z=this.createKey,$=this.caseFormat.bind(this),{gos:X,beans:Y}=this,q=o(X,Y.rowModel)?this.createManagedBean(new Tj(Z,$,z.getValue,J,Q)):void 0,G=this.createManagedBean(new Ij(q,$,Z,J,{handlerParams:z,usingComplexObjects:!!(z.filterParams.keyCreator??z.colDef.keyCreator)}));this.addManagedListeners(G,{availableValuesChanged:z.onModelAsStringChange}),this.valueModel=G,this.appliedModel=new vj(this.caseFormat.bind(this)),this.appliedModel.update(z.model),this.validateModel(z),this.addEventListenersForDataChanges()}refresh(z){this.updateParams(z),this.valueModel.refresh({handlerParams:z,usingComplexObjects:!!(z.filterParams.keyCreator??z.colDef.keyCreator)}),this.appliedModel.update(z.model),this.validateModel(z)}updateParams(z){this.params=z;let{colDef:J,filterParams:{caseSensitive:Q,treeList:Z,keyCreator:$,valueFormatter:X}}=z;this.caseSensitive=!!Q;let Y=!!J.showRowGroup;this.treeDataTreeList=this.gos.get("treeData")&&!!Z&&Y,this.groupingTreeList=!!this.beans.rowGroupColsSvc?.columns.length&&!!Z&&Y;let q=$??J.keyCreator;this.createKey=this.generateCreateKey(q,this.isTreeDataOrGrouping()),this.setValueFormatter(X,q,!!Z,!!J.refData)}doesFilterPass(z){let{appliedModel:J,treeDataTreeList:Q,groupingTreeList:Z}=this;if(J.isNull())return!0;if(J.isEmpty())return!1;let{node:$}=z;if(Q)return this.doesFilterPassForTreeData($);if(Z)return this.doesFilterPassForGrouping($);let X=this.params.getValue($);if(X!=null&&Array.isArray(X)){if(X.length===0)return J.has(null);return X.some((Y)=>J.has(this.createKey(Y,$)))}return J.has(this.createKey(X,$))}getFormattedValue(z){let J=this.valueModel.getValueForFormatter(z);if(this.noValueFormatterSupplied&&this.isTreeDataOrGrouping()&&Array.isArray(J))J=b(J);let Q=this.beans.valueSvc.formatValue(this.params.column,null,J,this.valueFormatter,!1);return(Q==null?i0(J):Q)??r0(this,"blanks")}getModelAsString(z,J){let{values:Q}=z??{},Z=J==="filterToolPanel";if(Q==null)return Z?r0(this,"filterSummaryListInactive"):"";let $=this.valueModel.getAvailableKeys(Q),X=$.length,Y=Z?3:10,q=$.slice(0,Y).map((G)=>this.getFormattedValue(G));if(Z){let G=q.join(r0(this,"filterSummaryListSeparator"));if(X>3)return r0(this,"filterSummaryListLong",[G,String(X-3)]);else return r0(this,"filterSummaryListShort",[G])}return`(${X}) ${q.join(",")}${X>10?",...":""}`}onAnyFilterChanged(){window.setTimeout(()=>{if(!this.isAlive())return;this.valueModel.refreshAvailable().then((z)=>{this.dispatchLocalEvent({type:"anyFilterChanged",updated:!!z})})})}onNewRowsLoaded(){this.syncAfterDataChange()}setFilterValues(z){this.valueModel.overrideValues(z).then(()=>{this.refreshFilterValues()})}resetFilterValues(){this.valueModel.valuesType=m5.TAKEN_FROM_GRID_VALUES,this.syncAfterDataChange()}refreshFilterValues(z){if(!this.valueModel.isInitialised())return;this.valueModel.refreshAll().then(()=>{this.dispatchLocalEvent({type:"dataChanged",hardRefresh:!0}),this.validateModel(this.params,void 0,!z)})}getFilterKeys(){return Array.from(this.valueModel.allValues.keys())}getFilterValues(){return Array.from(this.valueModel.allValues.values())}isTreeDataOrGrouping(){return this.treeDataTreeList||this.groupingTreeList}caseFormat(z){if(z==null||typeof z!=="string")return z;return this.caseSensitive?z:z.toUpperCase()}addEventListenersForDataChanges(){this.addManagedPropertyListeners(["groupAllowUnbalanced"],()=>this.syncAfterDataChange());let z=p0(this,this.syncAfterDataChange.bind(this),0);this.addManagedEventListeners({cellValueChanged:(J)=>{if(J.column===this.params.column)z()}})}syncAfterDataChange(){if(!this.isValuesTakenFromGrid())return;this.valueModel.refreshAll().then(()=>{this.dispatchLocalEvent({type:"dataChanged"}),this.validateModel(this.params,{afterDataChange:!0})})}validateModel(z,J,Q){let Z=this.valueModel;Z.allKeys.then(()=>{let $=z.model;if($==null)return;let X=new Map,Y=(B)=>X.set(this.caseFormat(B),B);if(Q)for(let B of Z.availableKeys)Y(B);else Z.allValues.forEach((B,E)=>Y(E));let q=[],G=!1;for(let B of $.values){let E=this.caseFormat(q0(B)),K=X.get(E);if(K!==void 0){if(q.push(K),K!==B)G=!0}else G=!0}let H=q.length,_=z.filterParams;if(H===0&&_.excelMode){z.onModelChange(null,J);return}let W=!_.defaultToNothingSelected&&(this.valueModel.valuesType===m5.TAKEN_FROM_GRID_VALUES||!_.suppressClearModelOnRefreshValues)&&H===X.size;if(G||!$.filterType||W){let B=W?null:{filterType:this.filterType,values:q};z.onModelChange(B,J)}})}isValuesTakenFromGrid(){return this.valueModel.valuesType===m5.TAKEN_FROM_GRID_VALUES}doesFilterPassForTreeData(z){if(z.childrenAfterGroup?.length)return!1;let{gos:J,appliedModel:Q}=this;return Q.has(this.createKey(s5(z.getRoute()??[z.key??z.id],!0,J.get("groupAllowUnbalanced"))))}doesFilterPassForGrouping(z){let{appliedModel:J,params:Q,gos:Z,beans:{rowGroupColsSvc:$,valueSvc:X}}=this,Y=($?.columns??[]).map((q)=>X.getKeyForNode(q,z));return Y.push(Q.getValue(z)),J.has(this.createKey(s5(Y,!1,Z.get("groupAllowUnbalanced"))))}generateCreateKey(z,J){if(J&&!z)return t(250),()=>null;if(z)return(Q,Z=null)=>{let $=this.getKeyCreatorParams(Q,Z);return q0(z($))};return(Q)=>q0(i0(Q))}getKeyCreatorParams(z,J=null){let{colDef:Q,column:Z}=this.params;return C(this.gos,{value:z,colDef:Q,column:Z,node:J,data:J?.data})}setValueFormatter(z,J,Q,Z){let $=z;if(!$){if(J&&!Q){t(249);return}if(this.noValueFormatterSupplied=!0,!Z)$=(X)=>i0(X.value)}this.valueFormatter=$}getCrossFilterModel(z){let{createKey:J,valueModel:Q,params:Z}=this;return z(J,Q.availableKeys,Z.model?.values)}destroy(){this.appliedModel.destroy(),super.destroy(),this.valueModel=void 0}},bj={tag:"div",cls:"ag-floating-filter-input ag-set-floating-filter-input",role:"presentation",children:[{tag:"ag-input-text-field",ref:"eFloatingFilterText"}]},yj=class extends y{constructor(){super(bj,[e4]);this.eFloatingFilterText=j}init(z){this.params=z,this.eFloatingFilterText.setDisabled(!0).addGuiEventListener("click",()=>this.params.showParentFilter()),this.setParams(z)}setParams(z){let J=this.beans.colNames.getDisplayNameForColumn(z.column,"header",!0),Q=this.getLocaleTextFunc();if(this.eFloatingFilterText.setInputAriaLabel(`${J} ${Q("ariaFilterInput","Filter Input")}`),this.gos.get("enableFilterHandlers")){let Z=z;this.updateFloatingFilterText(Z.model)}}refresh(z){this.params=z,this.setParams(z)}onParentModelChanged(z){this.updateFloatingFilterText(z)}parentSetFilterInstance(z){this.params.parentFilterInstance((J)=>{if(!(J instanceof _q)){t(248);return}z(J)})}updateFloatingFilterText(z){if(z==null)this.eFloatingFilterText.setValue("");else if(this.gos.get("enableFilterHandlers"))this.eFloatingFilterText.setValue(this.params.getHandler().getModelAsString?.(z)??"");else this.parentSetFilterInstance((J)=>{this.eFloatingFilterText.setValue(J.getModelAsString(z))})}},Wq={moduleName:"SetFilter",version:$0,userComponents:{agSetColumnFilter:{classImp:_q,params:{useForm:!0},processParams:(z)=>{return Aj(z),z}},agSetColumnFloatingFilter:yj},dynamicBeans:{agSetColumnFilterHandler:Cj},icons:{setFilterGroupClosed:"tree-closed",setFilterGroupOpen:"tree-open",setFilterGroupIndeterminate:"tree-indeterminate",setFilterLoading:"loading"},dependsOn:[C0,q2]},xj=".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 wj(z,J,Q){return z.getCompDetails(J,Nj,void 0,Q,!0)}var Nj={name:"statusPanel",optionalMethods:["refresh"]},gj={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]}},hj={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"}]},uj=class extends y{constructor(){super(hj);this.updateQueued=!1,this.panelsPromise=N.resolve(),this.eStatusBarLeft=j,this.eStatusBarCenter=j,this.eStatusBarRight=j,this.compDestroyFunctions={},this.registerCSS(xj)}wireBeans(z){this.userCompFactory=z.userCompFactory,this.statusBarSvc=z.statusBarSvc}postConstruct(){this.processStatusPanels(new Map),this.addManagedPropertyListeners(["statusBar"],this.handleStatusBarChanged.bind(this)),O1(this.beans,this,this.getGui())}getFocusableContainerName(){return"statusBar"}getValidPanels(){let z=this.gos,J=z.get("statusBar")?.statusPanels;if(!J)return J;return J.filter((Q)=>{let{rowModels:Z,warnArgs:$}=gj[Q.statusPanel]??{};if(!Z)return!0;if(Z.includes(z.get("rowModelType")))return!0;return R(...$),!1})}processStatusPanels(z){let J=this.getValidPanels();if(J){let Q=J.filter((X)=>X.align==="left"),Z=J.filter((X)=>X.align==="center"),$=J.filter((X)=>!X.align||X.align==="right");this.panelsPromise=N.all([this.createAndRenderComponents(Q,this.eStatusBarLeft,z),this.createAndRenderComponents(Z,this.eStatusBarCenter,z),this.createAndRenderComponents($,this.eStatusBarRight,z)])}else this.setDisplayed(!1)}handleStatusBarChanged(){if(this.updateQueued)return;this.updateQueued=!0,this.panelsPromise.then(()=>{this.updateStatusBar(),this.updateQueued=!1})}updateStatusBar(){let z=this.getValidPanels(),J=Array.isArray(z)&&z.length>0;this.setDisplayed(J);let Q=new Map;if(J)for(let Z of z){let $=Z.key??Z.statusPanel,X=this.statusBarSvc.getStatusPanel($);if(X?.refresh){let Y=C(this.gos,{...Z.statusPanelParams??{},key:$});if(X.refresh(Y))Q.set($,X),delete this.compDestroyFunctions[$],S0(X.getGui())}}if(this.resetStatusBar(),J)this.processStatusPanels(Q)}resetStatusBar(){J0(this.eStatusBarLeft),J0(this.eStatusBarCenter),J0(this.eStatusBarRight),this.destroyComponents(),this.statusBarSvc.unregisterAllComponents()}destroy(){this.destroyComponents(),super.destroy()}destroyComponents(){for(let z of Object.values(this.compDestroyFunctions))z();this.compDestroyFunctions={}}createAndRenderComponents(z,J,Q){let Z=[];for(let $ of z){let X=$.key||$.statusPanel,Y=Q.get(X),q;if(Y)q=N.resolve(Y);else{let G=wj(this.userCompFactory,$,C(this.gos,{key:X}));if(G==null)continue;q=G.newAgStackInstance()}Z.push({key:X,promise:q})}return N.all(Z.map(($)=>$.promise)).then(()=>{for(let $ of Z)$.promise.then((X)=>{let Y=()=>{this.destroyBean(X)};if(this.isAlive())this.statusBarSvc.registerStatusPanel($.key,X),J.appendChild(X.getGui()),this.compDestroyFunctions[$.key]=Y;else Y()})})}},mj={selector:"AG-STATUS-BAR",component:uj},cj={tag:"div",cls:"ag-status-name-value",children:[{tag:"span",ref:"eLabel"},": ",{tag:"span",ref:"eValue",cls:"ag-status-name-value-value"}]},pj=BigInt(Number.MIN_SAFE_INTEGER),ij=BigInt(Number.MAX_SAFE_INTEGER),$z=class extends y{constructor(){super(cj);this.eLabel=j,this.eValue=j}setLabel(z,J){this.setDisplayed(!1),this.eLabel.textContent=this.getLocaleTextFunc()(z,J)}setValue(z,J){let Q=null,Z;if(typeof z==="bigint"){if(Z=z,z>=pj&&z<=ij)Q=Number(z)}else Q=z;this.eValue.textContent=this.valueFormatter(C(this.gos,{value:Q,bigintValue:Z,totalRows:J,key:this.key}))}},dj={selector:"AG-NAME-VALUE",component:$z},Bq=(z)=>{let J=0;return z.forEachNodeAfterFilter((Q)=>{if(Q.data)J++}),J},Xz=(z)=>{let J=0;return z.forEachNode((Q)=>{if(Q.data)J++}),J};function nj(z,J){if(typeof z!=="number")return"";return T4(Math.round(z*100)/100,J)}var tj={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"}]},rj=class extends y{constructor(){super(tj,[dj]);this.sumAggregationComp=j,this.countAggregationComp=j,this.minAggregationComp=j,this.maxAggregationComp=j,this.avgAggregationComp=j}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(z){this.refresh(z)}refresh(z){this.params=z;let J=z.valueFormatter??((Z)=>{let{value:$,bigintValue:X}=Z;if(X!=null)return X.toString();return nj($,this.getLocaleTextFunc.bind(this))}),Q=["avg","count","min","max","sum"];for(let Z of Q){let $=this.getAllowedAggregationValueComponent(Z);if($)$.key=Z,$.valueFormatter=J.bind(this)}return this.onCellSelectionChanged(),!0}setAggregationComponentValue(z,J,Q){let Z=this.getAllowedAggregationValueComponent(z),$=Xz(this.beans.rowModel);if(T(Z)&&Z)Z.setValue(J,$),Z.setDisplayed(Q);else this.getAggregationValueComponent(z)?.setDisplayed(!1)}getAllowedAggregationValueComponent(z){let{aggFuncs:J}=this.params;if(!J||J.includes(z))return this.getAggregationValueComponent(z);return null}getAggregationValueComponent(z){let J=`${z}AggregationComp`;return this[J]}onCellSelectionChanged(){let z=this.beans,{rangeSvc:J,valueSvc:Q}=z,Z=J?.getCellRanges(),$=0,X=0n,Y=!1,q=!1,G=0,H=0,_=null,U=null,W=null,B=null,E=(I)=>{if(typeof I==="number"){if($+=I,_===null||I<_)_=I;if(U===null||I>U)U=I;if(!Number.isInteger(I)||!Number.isSafeInteger(I))q=!0;else{let x=BigInt(I);if(X+=x,W===null||xB)B=x}}else{if(Y=!0,X+=I,W===null||IB)B=I;let x=Number(I);if($+=x,_===null||x<_)_=x;if(U===null||x>U)U=x}H++},K={};if(Z?.length&&J)for(let I=0;I{if(m===null)return;let u=p4({rowPinned:m.rowPinned,column:r,rowIndex:m.rowIndex});if(K[u])return;K[u]=!0;let Q0=f0(z,m);if(n(Q0))return;let s=Q.getValue(r,Q0,"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 T0=s.trim();if(T0==="")return;let v0=Number(T0);if(!Number.isFinite(v0))return;if($+v0>=Number.MAX_SAFE_INTEGER||$+v0<=Number.MIN_SAFE_INTEGER||v0>=Number.MAX_SAFE_INTEGER||v0<=Number.MIN_SAFE_INTEGER){if(s=k1(T0),s===null)s=v0}else s=v0}if(typeof s==="number"&&!isNaN(s)||typeof s==="bigint")E(s)}),m=L0(z,m)}}let F=G>1,L=H>1,D=Y&&!q,M;if(D)M=X/BigInt(H);else M=$/H;let f=L?D?X:$:null,S=L?D?W:_:null,A=L?D?B:U:null,O=L?M:null,v=L;this.setAggregationComponentValue("count",G,F),this.setAggregationComponentValue("sum",f,L),this.setAggregationComponentValue("min",S,L),this.setAggregationComponentValue("max",A,L),this.setAggregationComponentValue("avg",O,v)}},sj=class extends $z{postConstruct(){this.setLabel("filteredRows","Filtered"),this.addCss("ag-status-panel"),this.addCss("ag-status-panel-filtered-row-count"),this.setDisplayed(!0);let z=this.onDataChanged.bind(this);this.addManagedEventListeners({modelUpdated:z})}onDataChanged(){let{rowModel:z}=this.beans,J=Xz(z),Q=Bq(z);this.setValue(Q,J),this.setDisplayed(J!==Q)}init(z){this.refresh(z),this.onDataChanged()}updateValueFormatter(z){this.valueFormatter=z??(({value:J})=>T4(J,this.getLocaleTextFunc.bind(this)))}refresh(z){let{key:J,valueFormatter:Q}=z;return this.key=J,this.updateValueFormatter(Q),!0}},lj=class extends $z{postConstruct(){this.setLabel("selectedRows","Selected"),this.addCss("ag-status-panel"),this.addCss("ag-status-panel-selected-row-count");let z=this.onRowSelectionChanged.bind(this);this.addManagedEventListeners({modelUpdated:z,selectionChanged:z})}onRowSelectionChanged(){let{selectionSvc:z,rowModel:J}=this.beans,Q=z?.getSelectionCount()??0,Z=Xz(J);if(this.setValue(Q,Z),Q<0){this.setDisplayed(!0);return}this.setDisplayed(Q>0)}init(z){this.refresh(z),this.onRowSelectionChanged()}updateValueFormatter(z){this.valueFormatter=z??(({value:J})=>{if(J==null||J>=0)return T4(J,this.getLocaleTextFunc.bind(this));return this.getLocaleTextFunc()("statusBarLastRowUnknown","?")})}refresh(z){let{key:J,valueFormatter:Q}=z;return this.key=J,this.updateValueFormatter(Q),!0}},aj=class extends $z{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:z}=this.beans,J=Bq(z),Q=Xz(z);this.setValue(J,Q)}init(z){this.refresh(z),this.onDataChanged()}updateValueFormatter(z){this.valueFormatter=z??(({value:J,totalRows:Q})=>{let Z=this.getLocaleTextFunc.bind(this),$=T4(J,Z),X=T4(Q??J,Z);if(J===Q)return $;let Y=Z();return`${$} ${Y("of","of")} ${X}`})}refresh(z){let{key:J,valueFormatter:Q}=z;return this.key=J,this.updateValueFormatter(Q),!0}},oj=class extends $z{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 z=Xz(this.beans.rowModel);this.setValue(z,z)}init(z){this.refresh(z),this.onDataChanged()}updateValueFormatter(z){this.valueFormatter=z??(({value:J})=>T4(J,this.getLocaleTextFunc.bind(this)))}refresh(z){let{key:J,valueFormatter:Q}=z;return this.key=J,this.updateValueFormatter(Q),!0}};function ej(z,J){let Q=z.statusBarSvc?.getStatusPanel(J);return l4(Q)}var zO=class extends V{constructor(){super();this.beanName="statusBarSvc",this.comps=new Map}registerStatusPanel(z,J){this.comps.set(z,J)}unregisterStatusPanel(z){this.comps.delete(z)}unregisterAllComponents(){this.comps.clear()}getStatusPanel(z){return this.comps.get(z)}destroy(){this.unregisterAllComponents(),super.destroy()}},Eq={moduleName:"StatusBar",version:$0,beans:[zO],userComponents:{agAggregationComponent:rj,agTotalRowCountComponent:oj,agFilteredRowCountComponent:sj,agTotalAndFilteredRowCountComponent:aj,agSelectedRowCountComponent:lj},selectors:[mj],apiFunctions:{getStatusPanel:ej},dependsOn:[C0,X2]};function Kq(z){if(z.excelCreator?.getFactoryMode()==="MULTI_SHEET")return R(161),!1;return!0}function JO(z,J){if(Kq(z))return z.excelCreator?.getDataAsExcel(J);return}function QO(z,J){if(Kq(z))z.excelCreator?.exportDataAsExcel(J)}function ZO(z,J){return z.excelCreator?.setFactoryMode("MULTI_SHEET"),z.excelCreator?.getSheetDataForExcel(J)}function $O(z,J){return z.excelCreator?.getMultipleSheetsAsExcel(J)}function XO(z,J){z.excelCreator?.exportMultipleSheetsAsExcel(J)}var Fq={moduleName:"ExcelExport",version:$0,beans:[YA],apiFunctions:{getDataAsExcel:JO,exportDataAsExcel:QO,getSheetDataForExcel:ZO,getMultipleSheetsAsExcel:$O,exportMultipleSheetsAsExcel:XO},dependsOn:[Y5,C0]};function dJ(z){let{filters:J}=z;return J&&J.length>0?J:[{filter:"agTextColumnFilter"},{filter:"agSetColumnFilter"}]}function uJ(z,J){if(z==null)return;for(let Q=z.length-1;Q>=0;Q--)J(z[Q],Q)}function YO(z,J){if(J.title!=null)return J.title;return z instanceof Z2?z.getFilterTitle():"Filter"}function mJ(z,J,Q,Z){let $=[],X=z?.filterModels;for(let Y=0;YY==null)?null:{filterType:"multi",filterModels:$}}function J1(z,J){return z?.filterModels?.[J]??null}function cJ(z,J,Q,Z){let $=Q.filterValueGetter;return $?z.colFilter.createGetValue(J,$):Z}var Lq=class extends tZ{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:(z)=>this.onFocusIn(z)})}refreshGui(z){if(z===this.lastOpenedInContainer)return N.resolve();return this.tabGuardFeature.removeAllChildrenExceptTabGuards(),this.destroyChildren(),N.all(this.getFilterWrappers().map((J,Q)=>{if(!J)return N.resolve(null);let Z=this.getFilterFromWrapper(J),$=this.getCompFromWrapper(J),X=this.filterDefs[Q],Y=YO(Z,X),q;if(X.display==="subMenu"&&z!=="toolPanel")q=this.insertFilterMenu($,Z,Y).then((G)=>G.getGui());else if(X.display==="subMenu"||X.display==="accordion"){let G=this.insertFilterGroup(Z,$,Y);q=N.resolve(G.getGui())}else q=N.resolve($.getGui());return q})).then((J)=>{J.forEach((Q,Z)=>{if(!Q)return;if(Z>0)this.appendChild(z0({tag:"div",cls:"ag-filter-separator"}));this.appendChild(Q)}),this.filterGuis=J,this.lastOpenedInContainer=z})}destroyChildren(){for(let z of this.guiDestroyFuncs)z();this.guiDestroyFuncs.length=0,this.filterGuis.length=0}insertFilterMenu(z,J,Q){let Z=z.getGui();H0(Z,"dialog");let $=this.createBean(new fR),X={getGui:()=>z.getGui(),afterGuiAttached:(Y)=>{if(z.afterGuiAttached?.(Y),z!==J)J.afterGuiAttached?.(Y)}};return $.init({menuItemDef:{name:Q,subMenu:[],subMenuRole:"dialog",cssClasses:["ag-multi-filter-menu-item"],menuItem:dY,menuItemParams:{cssClassPrefix:"ag-compact-menu-option",isCompact:!0}},level:0,isAnotherSubMenuOpen:()=>!1,childComponent:X,contextParams:{column:null,node:null,value:null}}).then(()=>{$.setParentComponent(this),this.guiDestroyFuncs.push(()=>this.destroyBean($)),this.addManagedListeners($,{menuItemActivated:(q)=>{if(this.lastActivatedMenuItem&&this.lastActivatedMenuItem!==q.menuItem)this.lastActivatedMenuItem.deactivate();this.lastActivatedMenuItem=q.menuItem}});let Y=$.getGui();return $.addManagedElementListeners(Y,{keydown:(q)=>{let{key:G}=q;switch(G){case k.UP:case k.RIGHT:case k.DOWN:case k.LEFT:if(q.preventDefault(),G===k.RIGHT)$.openSubMenu(!0);break}},focusin:()=>$.activate(),focusout:()=>{if(!$.isSubMenuOpen()&&!$.isSubMenuOpening())$.deactivate()}}),$})}insertFilterGroup(z,J,Q){let Z=this.createBean(new VA({title:Q,cssIdentifier:"multi-filter"}));if(this.guiDestroyFuncs.push(()=>this.destroyBean(Z)),Z.addItem(J.getGui()),Z.toggleGroupExpand(!1),z.afterGuiAttached)Z.addManagedListeners(Z,{expanded:()=>z.afterGuiAttached({container:this.lastOpenedInContainer,suppressFocus:!0,hidePopup:this.hidePopup})});return Z}afterGuiAttached(z){let J;if(z)this.hidePopup=z.hidePopup,J=this.refreshGui(z.container);else this.hidePopup=void 0,J=N.resolve();let Q=z?.suppressFocus;J.then(()=>{let{filterDefs:Z,filterGuis:$,beans:X}=this,Y=this.getFilterWrappers(),q=!!Q;if(Z)uJ(Z,(H,_)=>{let U=_===0,W=H.display&&H.display!=="inline",B=Q||!U||W,E={...z??{},suppressFocus:B},K=Y[_],F=K?this.getFilterFromWrapper(K):void 0;if(K){let L=this.getCompFromWrapper(K);if(L!==F)L.afterGuiAttached(E)}if(F){if(this.executeFunctionIfExistsOnFilter(F,"afterGuiAttached",E),U&&!B)q=!0}if(!Q&&U&&W){let L=$[_];if(L){if(!k0(L))L.focus({preventScroll:!0});q=!0}}});let G=d(X);if(!q&&(f1(X)||this.getGui().contains(G)))this.forceFocusOutOfContainer(!0)})}afterGuiDetached(){this.executeFunctionIfExists("afterGuiDetached")}onAnyFilterChanged(){this.executeFunctionIfExists("onAnyFilterChanged",(z)=>this.executeOnWrapper(z,"onAnyFilterChanged"))}onNewRowsLoaded(){this.executeFunctionIfExists("onNewRowsLoaded",(z)=>this.executeOnWrapper(z,"onNewRowsLoaded"))}destroy(){this.destroyChildren(),this.hidePopup=void 0,super.destroy()}executeOnWrapper(z,J){}executeFunctionIfExists(z,J){uJ(this.getFilterWrappers(),(Q)=>{if(Q)J?.(Q),this.executeFunctionIfExistsOnFilter(this.getFilterFromWrapper(Q),z)})}executeFunctionIfExistsOnFilter(z,J,...Q){let Z=z[J];if(typeof Z==="function")Z.apply(z,Q)}onFocusIn(z){let J=this.lastActivatedMenuItem;if(J!=null&&!J.getGui().contains(z.target))J.deactivate(),this.lastActivatedMenuItem=null}},Dq=class extends Lq{constructor(){super(...arguments);this.filterType="multi",this.wrappers=[],this.activeFilterIndices=[],this.afterFiltersReadyFuncs=[]}init(z){this.params=z,this.filterDefs=dJ(z);let J=D0(this.beans.colFilter.model,z.column.getColId()),{filterChangedCallback:Q}=z;this.filterChangedCallback=Q;let Z=this.filterDefs.map(($,X)=>this.createFilter($,X,J));return new N(($)=>{N.all(Z).then((X)=>{this.wrappers=X,this.refreshGui("columnMenu").then(()=>{$()})})}).then(()=>{for(let $ of this.afterFiltersReadyFuncs)$();this.afterFiltersReadyFuncs.length=0})}refresh(z){return this.params=z,!0}isFilterActive(){return this.wrappers.some((z)=>{if(!z)return!1;let{filter:J,handler:Q,model:Z}=z;if(Q)return Z!=null;return J.isFilterActive()})}getLastActiveFilterIndex(){let z=this.activeFilterIndices;return z.length>0?z[z.length-1]:null}doesFilterPass(z,J){return this.wrappers.every((Q,Z)=>{if(!Q||J!=null&&Z===J)return!0;let{handler:$,filter:X,model:Y}=Q;if($)return Y==null||$.doesFilterPass({...z,model:Y,handlerParams:Q.handlerParams});return!X.isFilterActive()||X.doesFilterPass(z)})}getModelFromUi(){return{filterType:this.filterType,filterModels:this.wrappers.map((J)=>{if(!J)return null;let Q=J.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((J)=>{if(!J)return null;let{filter:Q,handler:Z,model:$}=J;if(Z)return $;return Q.isFilterActive()?Q.getModel():null})}}setModel(z){let J=(Z,$)=>{return new N((X)=>{let Y=Z.setModel($);if(Y)Y.then(X);else X()})},Q=[];return this.wrappers.forEach((Z,$)=>{if(!Z)return;let X=J1(z,$),{filter:Y,filterParams:q,handler:G,handlerParams:H,state:_}=Z;if(G){let U={model:X,state:_?.state};Z.state=U,Z.model=X,Q.push(fJ(()=>N.resolve({filter:Y,filterParams:q}),G,H,X,U,"api").then(()=>{this.updateActiveListForHandler($,Z.model)}))}else Q.push(J(Y,X).then(()=>{this.updateActiveListForFilter($,Y)}))}),N.all(Q).then(()=>{})}applyModel(z="api"){let J=!1;for(let Q of this.wrappers)if(Q){let Z=Q.filter;if(Z instanceof Z2)J=Z.applyModel(z)||J}return J}getChildFilterInstance(z){return this.wrappers[z]?.filter}getNumChildFilters(){return this.wrappers.length}destroy(){for(let z of this.wrappers)this.destroyBean(z?.filter),this.destroyBean(z?.handler);this.wrappers.length=0,super.destroy()}getFilterWrappers(){return this.wrappers}getFilterFromWrapper(z){return z.filter}getCompFromWrapper(z){return z.comp}executeOnWrapper(z,J){z.handler?.[J]?.()}createFilter(z,J,Q){let Z=this.params.column,$=null,X,Y=this.beans,q=(B,E)=>{let K=this.wrappers[J];if(!K)return;let F={model:B,state:K.state?.state};K.state=F,K.model=B,fJ(()=>N.resolve({filter:K.filter,filterParams:K.filterParams}),K.handler,K.handlerParams,B,F,"ui").then(()=>{this.onHandlerModelChanged(J,K.model,E)})},{compDetails:G,handler:H,handlerParams:_,createFilterUi:U}=Y.colFilter.createFilterInstance(Z,z,"agTextColumnFilter",(B,E)=>{let K={...B,filterChangedCallback:E?()=>{}:(F)=>{this.executeWhenAllFiltersReady(()=>this.onFilterModelChanged(J,F))},doesRowPassOtherFilter:(F)=>B.doesRowPassOtherFilter(F)&&this.doesFilterPass({node:F,data:F.data},J),getValue:cJ(Y,Z,z,B.getValue)};if(E)$=J1(Q,J),X=this.updateDisplayParams(K,J,$,()=>G,()=>H,q);return K});if(!U)return N.resolve(null);let W;if(H){let{doesRowPassOtherFilter:B,getValue:E}=_;W={..._,onModelChange:q,doesRowPassOtherFilter:(K)=>B(K)&&this.doesFilterPass({node:K,data:K.data},J),getValue:cJ(Y,Z,z,E)},H.init?.({...W,model:$,source:"init"})}return U().then((B)=>{if(!H)return{filter:B,comp:B};let E=G?.params,K=X(B);return{filter:B,comp:K,filterParams:E,handler:H,handlerParams:W,model:$}})}updateDisplayParams(z,J,Q,Z,$,X){let Y=this.params.column,q=new R4;z.model=Q,z.state={model:Q},z.onModelChange=X,z.getHandler=$;let G=(_,U)=>{_.state=U,q.dispatchEvent({type:"filterStateChanged",column:Y,state:U})};z.onStateChange=(_)=>{let U=this.wrappers[J];if(!U)return;G(U,_),l2(U.filter,U.filterParams,U.model??null,_,"ui")};let H=(_,U,W)=>{let B=this.wrappers[J];if(!B)return;let E=()=>B?.model??null;dz({action:U,filterParams:B.filterParams,getFilterUi:()=>{let K=N.resolve(B.filter);return{created:!0,filterParams:B.filterParams,compDetails:Z(),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 z.onAction=(_,U,W)=>{H(Y,_,U),q.dispatchEvent({type:"filterAction",column:Y,action:_,event:W})},(_)=>{let U=Z()?.params;return this.createManagedBean(new E5(Y,{comp:_,params:U,isHandler:!0},q,H,!1))}}executeWhenAllFiltersReady(z){if((this.wrappers?.length??0)>0)z();else this.afterFiltersReadyFuncs.push(z)}updateActiveListForFilter(z,J){this.updateActiveList(z,()=>J?.isFilterActive())}updateActiveListForHandler(z,J){this.updateActiveList(z,()=>J!=null)}updateActiveList(z,J){let Q=this.activeFilterIndices;if(X0(this.activeFilterIndices,z),J())Q.push(z)}onFilterModelChanged(z,J){this.updateActiveListForFilter(z,this.wrappers[z]?.filter),this.filterChanged(z,J)}onHandlerModelChanged(z,J,Q){this.updateActiveListForHandler(z,J),this.filterChanged(z,Q)}filterChanged(z,J){this.filterChangedCallback(J),this.wrappers.forEach((Q,Z)=>{if(z===Z||!Q)return;let{filter:$,handler:X}=Q;if(X?.onAnyFilterChanged?.(),typeof $.onAnyFilterChanged==="function")$.onAnyFilterChanged()})}getModelAsString(z){if(!z?.filterModels?.length)return"";let J=this.getLastActiveFilterIndex()??0;return this.wrappers[J]?.filter?.getModelAsString?.(z.filterModels[J])??""}},qO=class extends V{constructor(){super(...arguments);this.filterType="multi",this.handlerWrappers=[],this.activeFilterIndices=[],this.filterDefs=[]}init(z){this.params=z;let J=dJ(z.filterParams);this.filterDefs=J,J.forEach((Q,Z)=>{let $=this.beans.colFilter.createHandler(z.column,Q,"agTextColumnFilter");if(this.handlerWrappers.push($),!$){R(278,{colId:z.column.getColId()});return}let{handler:X,handlerParams:Y}=$;X.init?.({...this.updateHandlerParams(Y,Z,!0),model:J1(z.model,Z),source:"init"})}),this.resetActiveList(z.model)}refresh(z){this.params=z;let{model:J,source:Q,filterParams:Z}=z,$=Z?.filters;if(this.handlerWrappers.forEach((X,Y)=>{if(X){let q=this.updateHandlerParams(z,Y,!1,$?.[Y].filterParams);X.handlerParams=q,X.handler.refresh?.({...q,model:J1(J,Y),source:Q})}}),z.source!=="floating"&&z.source!=="ui")this.resetActiveList(z.model);if(z.additionalEventAttributes?.fromButtons)this.onAnyFilterChanged()}updateHandlerParams(z,J,Q,Z){let{onModelChange:$,doesRowPassOtherFilter:X,getValue:Y}=z,q={...z,onModelChange:(G,H)=>$(mJ(this.params.model,this.handlerWrappers.length,G,J),H),doesRowPassOtherFilter:(G)=>X(G)&&this.doesFilterPass({node:G,data:G.data,model:this.params.model,handlerParams:q},J),getValue:cJ(this.beans,z.column,this.filterDefs[J],Y),filterParams:this.updateFilterParams(z,Q,Z)};return q}updateFilterParams(z,J,Q){let Z=z.filterParams;if(Q?.buttons&&J)R(292,{colId:z.column.getColId()});let $=Q?{...Z,...Q}:Z;if(!$.buttons)return $;if(Q)return delete $.buttons,$;let{buttons:X,...Y}=$;return Y}doesFilterPass(z,J){let Q=z.model?.filterModels;if(Q==null)return!0;return this.handlerWrappers.every((Z,$)=>{let X=Q[$];if(X==null||J!=null&&$===J)return!0;let Y=Z?.handler;return!Y||Y.doesFilterPass({...z,model:X,handlerParams:Z.handlerParams})})}resetActiveList(z){this.activeFilterIndices=[];let J=z?.filterModels;if(J==null)return;for(let Q=0;Q0?z[z.length-1]:null}getModelAsString(z,J){let Q=J==="filterToolPanel",Z=()=>Q?this.getLocaleTextFunc()("filterSummaryInactive","is (All)"):"";if(!z?.filterModels?.length)return Z();let $=this.getLastActiveFilterIndex()??0;return this.handlerWrappers[$]?.handler.getModelAsString?.(z.filterModels[$],J)??Z()}getHandler(z){return this.handlerWrappers[z]?.handler}onAnyFilterChanged(){uJ(this.handlerWrappers,(z)=>z?.handler?.onAnyFilterChanged?.())}onNewRowsLoaded(){uJ(this.handlerWrappers,(z)=>z?.handler?.onNewRowsLoaded?.())}destroy(){for(let z of this.handlerWrappers)this.destroyBean(z?.handler);this.handlerWrappers.length=0,super.destroy()}},GO=class extends V{constructor(){super(...arguments);this.beanName="multiFilter"}getParamsForDataType(z,J,Q,Z){let $=z?.filters,X=this.beans;if(!$)$=[{filter:U5(Q.baseDataType)},{filter:"agSetColumnFilter"}];let Y=this.getLocaleTextFunc();return $=$.map((q)=>{let{filter:G,filterParams:H,filterValueGetter:_}=q;if(typeof G!=="string")return q;let{filterParams:U,filterValueGetter:W}=_5(G,H,_??J,Q,Z,X,Y);return{...q,filterParams:U,filterValueGetter:W}}),{filterParams:{...z,filters:$}}}},Mq=class extends Lq{constructor(){super(...arguments);this.filterType="multi",this.filters=[],this.filterParams=[],this.validity=[]}init(z){this.params=z;let J=dJ(z).map((Z)=>{if(Z.filterParams?.buttons){R(292,{colId:z.column.getColId()});let $={...Z.filterParams};return delete $.buttons,{...Z,filterParams:$}}return Z});this.filterDefs=J,this.allState=z.state;let Q=this.filterDefs.map((Z,$)=>this.createFilter(Z,$));return new N((Z)=>{N.all(Q).then(($)=>{this.filters=$,this.refreshGui("columnMenu").then(()=>{Z()})})})}refresh(z){let{model:J,state:Q,source:Z}=z;if(Z==="colDef")return!1;this.params=z;let $=this.filterParams;if(Q===this.allState)return!0;this.allState=Q;let X=Q.state;return this.filters.forEach((Y,q)=>{let G=J1(J,q),H={state:X?.[q],model:J1(Q.model,q)};l2(Y,$[q],G,H,Z)}),!0}getLastActiveFilterIndex(){return this.getHandler().getLastActiveFilterIndex?.()??null}getChildFilterInstance(z){return this.filters[z]??void 0}getNumChildFilters(){return this.filters.length}destroy(){for(let z of this.filters)this.destroyBean(z);this.filters.length=0,super.destroy()}getFilterWrappers(){return this.filters}getFilterFromWrapper(z){return z}getCompFromWrapper(z){return z}createFilter(z,J){let Q=this.beans.userCompFactory,Z=this.updateParams(z,this.params,J),$=PZ(Q,z,Z,"agTextColumnFilter");if(!$)return N.resolve(null);return this.filterParams[J]=$.params,$.newAgStackInstance()}updateParams(z,J,Q){let{doesRowPassOtherFilter:Z,model:$,onModelChange:X,state:Y,onStateChange:q,column:G,source:H,onAction:_,onUiChange:U,getValue:W}=J,B=J1($,Q),E=Y?{model:J1(Y.model,Q),state:Y.state?.[Q]}:{model:B},K=()=>{let L=this.getHandler();this.filters.forEach((D,M)=>{if(Q!==M)L.getHandler(M)?.onAnyFilterChanged?.(),D?.onAnyFilterChanged?.()})},F=this.beans.colFilter;return{...F.createBaseFilterParams(G),...z,doesRowPassOtherFilter:(L)=>Z(L)&&this.getHandler().doesFilterPass({node:L,data:L.data,model:this.params.model,handlerParams:F.getHandlerParams(G)},Q),model:B,state:E,onModelChange:(L,D)=>{let{filters:M,params:f}=this,S=mJ(f.model,M.length,L,Q);this.updateActiveList(Q,L),X(S,D),K()},onStateChange:(L)=>this.onStateChange(q,Q,L),getHandler:()=>this.getHandler().getHandler(Q),onAction:(L,D,M)=>{if(n2(J))return;let f=L==="apply"||L==="reset";if(f)this.updateActiveList(Q,J1(this.params.state.model,Q));if(_(L,D,M),f)K()},onUiChange:U,source:H,getValue:cJ(this.beans,G,z,W)}}updateActiveList(z,J){this.getHandler().updateActiveList?.(z,J)}getHandler(){return this.params.getHandler()}onStateChange(z,J,Q){let{model:Z,state:$,valid:X}=Q,Y=this.validity;Y[J]=X;let q=this.allState,G=mJ(q.model,this.filters.length,Z,J),H=Y.every((W)=>W!==!1),_=[...q.state??[]];_[J]=$;let U={state:_,model:G,valid:H};this.allState=U,z(U)}getModelAsString(z){return this.getHandler().getModelAsString?.(z)??""}},HO={tag:"div",cls:"ag-multi-floating-filter ag-floating-filter-input"},_O=class extends y{constructor(){super(HO);this.floatingFilters=[],this.compDetailsList=[]}init(z){this.params=z;let{compDetailsList:J}=this.getCompDetailsList(z);return this.setParams(J)}setParams(z){let J=[];return z.forEach((Q)=>{let Z=Q?.newAgStackInstance();if(Z!=null)this.compDetailsList.push(Q),J.push(Z)}),N.all(J).then((Q)=>{Q.forEach((Z,$)=>{this.floatingFilters.push(Z);let X=Z.getGui();if(this.appendChild(X),$>0)w(X,!1)})})}refresh(z){this.params=z;let{compDetailsList:J,floatingFilterParamsList:Q}=this.getCompDetailsList(z);if(J.length===this.compDetailsList.length&&J.every(($,X)=>!this.beans.colFilter?.areFilterCompsDifferent(this.compDetailsList[X],$))){if(Q.forEach(($,X)=>{this.floatingFilters[X].refresh?.($)}),this.gos.get("enableFilterHandlers")){let $=z;if($.model==null)this.floatingFilters.forEach((X,Y)=>{w(X.getGui(),Y===0)});else{let X=$.getHandler()?.getLastActiveFilterIndex?.();this.floatingFilters.forEach((Y,q)=>{let G=X==null?q===0:q===X;w(Y.getGui(),G)})}}}else J0(this.getGui()),this.destroyBeans(this.floatingFilters),this.floatingFilters=[],this.compDetailsList=[],this.setParams(J)}getCompDetailsList(z){let J=[],Q=[],Z=z.filterParams,$=z.currentParentModel,X=dJ(Z);return X.forEach((Y,q)=>{let G={...z,parentFilterInstance:(_)=>{this.parentMultiFilterInstance((U)=>{let W=U.getChildFilterInstance(q);if(W==null)return;_(W)})},currentParentModel:()=>$()?.filterModels?.[q]??null};if(this.gos.get("enableFilterHandlers")){let _=G;_.model=_.model?.filterModels?.[q]??null;let{onModelChange:U,getHandler:W}=_;_.onModelChange=(B,E)=>U(mJ(this.params.model,X.length,B,q),E),_.getHandler=()=>{return W().getHandler(q)}}K0(G.filterParams,Y.filterParams);let H=this.getCompDetails(Y,G);if(H)J.push(H),Q.push(G)}),{compDetailsList:J,floatingFilterParamsList:Q}}onParentModelChanged(z,J){if(J?.afterFloatingFilter)return;this.parentMultiFilterInstance((Q)=>{if(z==null)this.floatingFilters.forEach((Z,$)=>{Z.onParentModelChanged(null,J),w(Z.getGui(),$===0)});else{let Z=Q.getLastActiveFilterIndex();this.floatingFilters.forEach(($,X)=>{let Y=z.filterModels.length>X?z.filterModels[X]:null;$.onParentModelChanged(Y,J);let q=Z==null?X===0:X===Z;w($.getGui(),q)})}})}destroy(){this.destroyBeans(this.floatingFilters),this.floatingFilters.length=0,super.destroy()}getCompDetails(z,J){let{colFilter:Q,frameworkOverrides:Z,userCompFactory:$}=this.beans,X=W5(Z,z,()=>Q.getDefaultFloatingFilter(this.params.column))??"agReadOnlyFloatingFilter";return TZ($,z,J,X)}parentMultiFilterInstance(z){this.params.parentFilterInstance((J)=>{if(!(J instanceof Dq||J instanceof Mq))t(120);z(J)})}},kq={moduleName:"MultiFilter",version:$0,userComponents:{agMultiColumnFilter:{getComp:(z)=>z.gos.get("enableFilterHandlers")?{classImp:Mq,params:{useForm:!0}}:Dq},agMultiColumnFloatingFilter:_O},beans:[GO],dynamicBeans:{agMultiColumnFilterHandler:qO},dependsOn:[C0,q2,J7]},UO=class extends V{constructor(){super(...arguments);this.beanName="aggColNameSvc"}getHeaderName(z,J){if(this.gos.get("suppressAggFuncInHeader"))return J;let{valueColsSvc:Q,colModel:Z,rowGroupColsSvc:$}=this.beans,X=z.getColDef().pivotValueColumn,Y=T(X),q=null,G;if(Y){let H=Q?.columns??[],_=this.gos.get("removePivotHeaderRowWhenSingleValueColumn")&&H.length===1,U=z.getColDef().pivotTotalColumnIds!==void 0;if(_&&!U)return J;q=X?X.getAggFunc():null,G=!0}else{let H=z.isValueActive(),_=$?.columns.length!==0,U=Z.isPivotMode()||_||this.gos.get("treeData");if(H&&U)q=z.getAggFunc(),G=!0;else G=!1}if(G){let H=typeof q==="string"?q:"func";return`${this.getLocaleTextFunc()(H,H)}(${J})`}return J}},WO={sum:"Sum",first:"First",last:"Last",min:"Min",max:"Max",count:"Count",avg:"Average"},BO=class extends V{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 z=this.aggFuncsMap;z.sum=EO,z.first=KO,z.last=FO,z.min=LO,z.max=DO,z.count=kO,z.avg=VO,this.initialised=!0}isAggFuncPossible(z,J){let Z=this.getFuncNames(z).includes(J),$=T(this.aggFuncsMap[J]);return Z&&$}getDefaultFuncLabel(z){return WO[z]??z}getDefaultAggFunc(z){let J=z.getColDef().defaultAggFunc;if(T(J)&&this.isAggFuncPossible(z,J))return J;if(this.isAggFuncPossible(z,"sum"))return"sum";let Q=this.getFuncNames(z);return Q?.length?Q[0]:null}addAggFuncs(z){if(this.init(),!z)return;for(let J of Object.keys(z))if(z[J])this.aggFuncsMap[J]=z[J]}getAggFunc(z){return this.init(),this.aggFuncsMap[z]}getFuncNames(z){let J=z.getColDef().allowedAggFuncs;return J==null?Object.keys(this.aggFuncsMap).sort():J}clear(){this.aggFuncsMap={}}};function EO(z){let{values:J}=z,Q=null;for(let Z=0;Z0?z.values[0]:null}function FO(z){return z.values.length>0?b(z.values):null}function LO(z){let{values:J}=z,Q=null;for(let Z=0;Z$))Q=$}return Q}function DO(z){let{values:J}=z,Q=null;for(let Z=0;Z0)$=Q/(typeof Q==="number"?Z:BigInt(Z));let X=z.rowNode?.aggData?.[z.column?.getColId()];if(X&&X.count===Z&&X.value===$)return X;let Y=Object.create(fO);return Y.count=Z,Y.value=$,Y}var SO=class extends V{constructor(){super(...arguments);this.beanName="aggChildrenSvc"}getAggregatedChildren(z,J,Q){if(!z?.group)return[];if(z.rowPinned){if(z=z.pinnedSibling,!z)return[]}let Z=this.gos,$=fq(z,J,Z);if(!Q)return $;let X=[];return Vq($,J,Z,X),X}},fq=(z,J,Q)=>{let Z=J?.colDef,$=Z?.pivotKeys;if($){if(z.leafGroup&&$.length&&!Z.pivotTotalColumnIds)return eY(z.childrenMapped,$);return z.childrenAfterFilter??z.childrenAfterGroup??[]}if(h4(Q)||Q.get("suppressAggFilteredOnly"))return z.childrenAfterGroup??[];return z.childrenAfterFilter??z.childrenAfterGroup??[]},Vq=(z,J,Q,Z)=>{for(let $=0,X=z.length;${JY(A,null,f)})}return}this.hadAgg=!0;let{colModel:X,aggFuncSvc:Y}=Q,q=J.get("alwaysAggregateAtRootLevel")||!!S1(J)||X.isPivotMode(),G=!h4(J)&&!J.get("suppressAggFilteredOnly"),H=Q.valueSvc,_=Q.gridApi,U=Q.gridOptions.context,W=$??[],B=W.length,E=z?.kind==="cells"?z:void 0,K,F=Array(B);for(let f=0;f=0)K=E;F[f]={column:S,colId:S.colId,colDef:S.colDef,aggFunc:Sq(S.getAggFunc(),Y,S),colSlot:A}}let L=vO(X,Q.pivotResultCols,Y),D=B>0?Array(B):null,M=Q.rowModel;j0(M.rootNode,M.hierarchical,z,(f)=>{if(f.level===-1&&!q){z6(f,null,X);return}let S;if(Z)S=Z({nodes:f.childrenAfterFilter});else if(!D)S=null;else if(L)S=TO(f,L,H,_,U);else S=PO(f,F,B,D,K,G,H,_,U);JY(f,S,X)})}},PO=(z,J,Q,Z,$,X,Y,q,G)=>{let H=(X?z.childrenAfterFilter:z.childrenAfterGroup)??[],_=H.length,U=z.data,W=Object.create(null),B=$?$.getSlot(z):-1,E=B>=0?z.aggData:void 0,K=0;for(let F=0;F=0&&!$.hasCellBySlot(B,L.colSlot)){if(Z[F]=null,E)W[L.colId]=E[L.colId]}else Z[F]=Array(_),++K}if(K===0)return W;for(let F=0;F<_;++F){let L=H[F],D=L.aggData;if(D)for(let M=0;M{let X=J.length,Y=z.leafGroup,q=z.data,G=z.childrenMapped,H=z.childrenAfterFilter??[],_=Object.create(null),U,W;for(let B=0;B{if(typeof z==="function")return z;if(z==null)return null;let Z=J.getAggFunc(z);if(typeof Z!=="function")return R(109,{inputValue:z.toString(),allSuggestions:J.getFuncNames(Q)}),null;return Z},vO=(z,J,Q)=>{if(!z.isPivotActive())return null;let Z=J?.getAggregationOrderedList();if(!Z||Z.length===0)return null;let $=Z.length,X=Array($),Y=0;for(let q=0;q<$;++q){let G=Z[q],H=G.colDef,_=H.pivotValueColumn;if(!_)continue;X[Y++]={column:_,colId:H.colId,aggFunc:Sq(_.getAggFunc(),Q,_),pivotResultCol:G,pivotKeys:H.pivotKeys,totalColIds:H.pivotTotalColumnIds}}if(Y===0)return null;return X.length=Y,X},IO=class extends V{constructor(){super(...arguments);this.beanName="filterAggStage",this.step="filter_aggregates",this.refreshProps=[],this.setAllChildrenCountTreeData=(z)=>{let J=z.childrenAfterAggFilter,Q=0;if(J){let $=J.length;Q=$;for(let X=0;X<$;++X)Q+=J[X].allChildrenCount??0}let Z=Q===0&&z.level>=0?null:Q;z.setAllChildrenCount(Z),z.pinnedSibling?.setAllChildrenCount(Z)},this.setAllChildrenCountGridGrouping=(z)=>{let J=z.childrenAfterAggFilter,Q=0;for(let Z=0,$=J.length;Z<$;++Z){let X=J[Z];if(X.group)Q+=X.allChildrenCount;else Q++}z.setAllChildrenCount(Q),z.pinnedSibling?.setAllChildrenCount(Q)}}wireBeans(z){this.filterManager=z.filterManager}execute(z){let{rowModel:J,colModel:Q,groupStage:Z}=this.beans,{filterManager:$}=this,X=Q.isPivotMode(),Y=$?.isAggregateFilterPresent()||$?.isAggregateQuickFilterPresent(),q=!!Z?.treeData,G=(E)=>!E.node.group,H=(E)=>E.node.leafGroup,_=h4(this.gos)||(X?H:G),U=q?this.setAllChildrenCountTreeData:this.setAllChildrenCountGridGrouping,W=(E,K=!1)=>{if(E.childrenAfterFilter){if(E.childrenAfterAggFilter=E.childrenAfterFilter,K){let F=E.childrenAfterAggFilter;for(let L=0,D=F.length;L{if(E.childrenAfterAggFilter=E.childrenAfterFilter?.filter((K)=>{if(_({node:K})){if($.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};j0(J.rootNode,J.hierarchical,z,Y?B:W)}};function zz(z,J){if(z.sibling)return;let Q=y9(z,J);Q.footer=!0,Q.setRowTop(null),Q.setRowIndex(null),Q.oldRowTop=null,Q.id="rowGroupFooter_"+z.id,Q.sibling=z,z.sibling=Q}function CO(z){let J=z.sibling;if(!J)return;J._destroy(!1),z.sibling=void 0,J.sibling=void 0}var bO=class extends V{constructor(){super(...arguments);this.beanName="footerSvc"}addTotalRows(z,J,Q,Z,$,X){let Y=z;if($){let H=Z&&S1(this.gos);if(yO(X,H))zz(J,this.beans),Q(J.sibling,Y++);return Y}let q=QJ(this.gos);if((Z&&q({node:J}))===X)zz(J,this.beans),Q(J.sibling,Y++);return Y}getTopDisplayIndex(z,J,Q,Z){let $=J;if(z[0].footer){if(J===0)return 0;$-=1}let X=z[z.length-1],Y=$>=Q.length;if(X.footer&&Y)return X.rowIndex;return Z($)}doesCellShowTotalPrefix(z,J){if(!z.footer||!J?.getColDef().showRowGroup)return!1;if(this.gos.get("treeData"))return!0;if(z.level===-1)return this.beans.showRowGroupCols?.columns[0]===J;return!!z.rowGroupColumn&&J?.isRowGroupDisplayed(z.rowGroupColumn.getId())}applyTotalPrefix(z,J,Q,Z){let $=Z.getColDef().cellRendererParams?.totalValueGetter;if($){let X=C(this.gos,{column:Z,node:Q,value:z,formattedValue:J});if(typeof $==="function")return $(X);if(typeof $==="string")return this.beans.expressionSvc?.evaluate($,X);R(179)}if(Q.level===-1)return this.getLocaleTextFunc()("footerTotal","Total")+" ";return this.getTotalValue(J??z)??""}getTotalValue(z){return this.getLocaleTextFunc()("footerTotal","Total")+" "+(z??"")}};function yO(z,J){switch(J){case"top":case"pinnedTop":return z==="top";case"bottom":case"pinnedBottom":return z==="bottom";default:return!1}}var Aq=class extends a2{constructor(){super(...arguments);this.beanName="valueColsSvc",this.eventName="columnValueChanged",this.columnProcessors={set:(z,J,Q)=>this.setValueActive(J,z,Q),add:(z,J,Q)=>this.setValueActive(!0,z,Q),remove:(z,J,Q)=>this.setValueActive(!1,z,Q)},this.columnExtractors={setFlagFunc:(z,J,Q)=>this.setColValueActive(z,J,Q),getIndexFunc:()=>{return},getInitialIndexFunc:()=>{return},getValueFunc:(z)=>{let J=z.aggFunc;if(J===null||J==="")return null;if(J===void 0)return;return!!J},getInitialValueFunc:(z)=>{return z.initialAggFunc!=null&&z.initialAggFunc!=""}},this.modifyColumnsNoEventsCallbacks={addCol:(z)=>this.columns.push(z),removeCol:(z)=>X0(this.columns,z)}}extractCols(z,J){this.columns=super.extractCols(z,J);for(let Q of this.columns){let Z=Q.getColDef();if(Z.aggFunc!=null&&Z.aggFunc!="")this.setColAggFunc(Q,Z.aggFunc);else if(!Q.getAggFunc())this.setColAggFunc(Q,Z.initialAggFunc)}return this.columns}setColumnAggFunc(z,J,Q){if(!z)return;let Z=this.colModel.getColDefCol(z);if(!Z)return;this.setColAggFunc(Z,J),this.dispatchColumnChangedEvent(this.eventSvc,this.eventName,[Z],Q)}syncColumnWithState(z,J,Q){let Z=Q("aggFunc").value1;if(Z!==void 0)if(typeof Z==="string"){if(this.setColAggFunc(z,Z),!z.isValueActive())this.setColValueActive(z,!0,J),this.modifyColumnsNoEventsCallbacks.addCol(z)}else{if(T(Z))R(33);if(z.isValueActive())this.setColValueActive(z,!1,J),this.modifyColumnsNoEventsCallbacks.removeCol(z)}}setValueActive(z,J,Q){if(z===J.isValueActive())return;if(this.setColValueActive(J,z,Q),z&&!J.getAggFunc()&&this.aggFuncSvc){let Z=this.aggFuncSvc.getDefaultAggFunc(J);this.setColAggFunc(J,Z)}}setColAggFunc(z,J){z.aggFunc=J,z.dispatchStateUpdatedEvent("aggFunc")}setColValueActive(z,J,Q){if(z.aggregationActive!==J)z.aggregationActive=J,z.dispatchColEvent("columnValueChanged",Q)}},Rq={moduleName:"SharedAggregation",version:$0,beans:[BO,UO,bO,Aq],apiFunctions:{addAggFuncs:AO,clearAggFuncs:RO,setColumnAggFunc:jO},dependsOn:[C0]},xO={moduleName:"Aggregation",version:$0,beans:[OO,IO,SO],rowModels:["clientSide"],dependsOn:[Rq]},jq=class extends a2{constructor(){super(...arguments);this.beanName="pivotColsSvc",this.eventName="columnPivotChanged",this.columnProcessors={set:(z,J,Q)=>this.setColPivotActive(z,J,Q),add:(z,J,Q)=>this.setColPivotActive(z,!0,Q),remove:(z,J,Q)=>this.setColPivotActive(z,!1,Q)},this.columnOrdering={enableProp:"pivot",initialEnableProp:"initialPivot",indexProp:"pivotIndex",initialIndexProp:"initialPivotIndex"},this.columnExtractors={setFlagFunc:(z,J,Q)=>this.setColPivotActive(z,J,Q),getIndexFunc:(z)=>z.pivotIndex,getInitialIndexFunc:(z)=>z.initialPivotIndex,getValueFunc:(z)=>z.pivot,getInitialValueFunc:(z)=>z.initialPivot},this.modifyColumnsNoEventsCallbacks={addCol:(z)=>{if(!this.columns.includes(z))this.columns.push(z)},removeCol:(z)=>X0(this.columns,z)}}syncColumnWithState(z,J,Q,Z){let{value1:$,value2:X}=Q("pivot","pivotIndex");if($!==void 0||X!==void 0){if(typeof X==="number"||$){if(!z.isPivotActive())this.setColPivotActive(z,!0,J),this.modifyColumnsNoEventsCallbacks.addCol(z);if(Z&&typeof X==="number")Z[z.getId()]=X}else if(z.isPivotActive())this.setColPivotActive(z,!1,J),this.modifyColumnsNoEventsCallbacks.removeCol(z)}}setColPivotActive(z,J,Q){if(z.pivotActive!==J){if(z.pivotActive=J,J)this.beans.groupHierarchyColSvc?.insertVirtualColumnsForCol(this.columns,z)?.forEach(($)=>this.setColPivotActive($,J,Q));z.dispatchColEvent("columnPivotChanged",Q)}z.dispatchStateUpdatedEvent("pivot")}},wO=class extends a2{constructor(){super(...arguments);this.beanName="rowGroupColsSvc",this.eventName="columnRowGroupChanged",this.columnProcessors={set:(z,J,Q)=>this.setActive(J,z,Q),add:(z,J,Q)=>this.setActive(!0,z,Q),remove:(z,J,Q)=>this.setActive(!1,z,Q)},this.columnOrdering={enableProp:"rowGroup",initialEnableProp:"initialRowGroup",indexProp:"rowGroupIndex",initialIndexProp:"initialRowGroupIndex"},this.columnExtractors={setFlagFunc:(z,J,Q)=>this.setColRowGroupActive(z,J,Q),getIndexFunc:(z)=>z.rowGroupIndex,getInitialIndexFunc:(z)=>z.initialRowGroupIndex,getValueFunc:(z)=>z.rowGroup,getInitialValueFunc:(z)=>z.initialRowGroup},this.modifyColumnsNoEventsCallbacks={addCol:(z)=>{if(!this.columns.includes(z))this.columns.push(z)},removeCol:(z)=>X0(this.columns,z)}}moveColumn(z,J,Q){if(this.columns.length===0)return;let Z=this.columns[z],$=this.columns.slice(z,J);this.columns.splice(z,1),this.columns.splice(J,0,Z),this.updateIndexMap(),this.eventSvc.dispatchEvent({type:this.eventName,columns:$,column:$.length===1?$[0]:null,source:Q})}syncColumnWithState(z,J,Q,Z){let{value1:$,value2:X}=Q("rowGroup","rowGroupIndex");if($!==void 0||X!==void 0){if(typeof X==="number"||$){if(!z.isRowGroupActive())this.setColRowGroupActive(z,!0,J),this.modifyColumnsNoEventsCallbacks.addCol(z);if(Z&&typeof X==="number")Z[z.getId()]=X}else if(z.isRowGroupActive())this.setColRowGroupActive(z,!1,J),this.modifyColumnsNoEventsCallbacks.removeCol(z)}}setActive(z,J,Q){if(z===J.isRowGroupActive())return;this.setColRowGroupActive(J,z,Q);let Z=this.beans.groupHierarchyColSvc?.getColumn(J);if($J(this.gos,z)&&!Z)this.colModel.setColsVisible([J],!z,Q)}setColRowGroupActive(z,J,Q){if(z.rowGroupActive!==J){if(z.rowGroupActive=J,J)this.beans.groupHierarchyColSvc?.insertVirtualColumnsForCol(this.columns,z)?.forEach(($)=>this.setColRowGroupActive($,J,Q));z.dispatchColEvent("columnRowGroupChanged",Q)}z.dispatchStateUpdatedEvent("rowGroup")}},NO=class extends V{constructor(){super(...arguments);this.beanName="autoColSvc"}postConstruct(){this.addManagedPropertyListener("autoGroupColumnDef",this.updateColumns.bind(this)),this.setupGroupHideColumnsUntilExpanded()}setupGroupHideColumnsUntilExpanded(){let z=()=>this.updateGroupColumnVisibility();this.addManagedEventListeners({modelUpdated:z}),this.addManagedPropertyListeners(["groupHideColumnsUntilExpanded","groupDisplayType","groupHideOpenParents"],z)}addColumns(z){let{columns:J}=this;if(J==null)return;z.list=J.list.concat(z.list),z.tree=J.tree.concat(z.tree),N6(z)}createColumns(z,J,Q){let Z=this.beans,{colModel:$,gos:X,rowGroupColsSvc:Y,colGroupSvc:q}=Z,G=$.isPivotMode(),H=ZJ(X,G),_=G?X.get("pivotSuppressAutoColumn"):this.isSuppressAutoCol(),U=Y?.columns,B=!(U&&U.length>0||X.get("treeData"))||_||H,E=()=>{if(this.columns)H4(Z,this.columns.tree),this.columns=null};if(B){E();return}let K=this.generateAutoCols(U),F=w6(K,this.columns?.list||null),L=z.treeDepth,M=(this.columns?this.columns.treeDepth:-1)==L;if(F&&M){let O=new Map(K.map((v)=>[v.getId(),v]));for(let v of this.columns?.list??[]){let I=O.get(v.getId());if(I)v.setColDef(I.getColDef(),null,Q)}return}E();let f=q?.findDepth(z.tree)??0,S=q?.balanceTreeForAutoCols(K,f)??[];this.columns={list:K,tree:S,treeDepth:f,map:{}},J((O)=>{if(!O)return null;let v=O.filter((I)=>!Q2(I));return[...K,...v]})}updateColumns(z){let J=F1(z.source);this.columns?.list.forEach((Q,Z)=>this.updateOneAutoCol(Q,Z,J))}getColumn(z){return this.columns?.list.find((J)=>g4(J,z))??null}getColumns(){return this.columns?.list??null}generateAutoCols(z=[]){let J=[],{gos:Q}=this,Z=Q.get("treeData"),$=y6(Q);if(Z&&$)R(182),$=!1;if($)z.forEach((X,Y)=>{J.push(this.createOneAutoCol(X,Y))});else J.push(this.createOneAutoCol());return J}isSuppressAutoCol(){let z=this.gos;if(z.get("groupDisplayType")==="custom")return!0;return z.get("treeDataDisplayType")==="custom"}createOneAutoCol(z,J){let Q;if(z)Q=`${J2}-${z.getId()}`;else Q=J2;let Z=this.createAutoColDef(Q,z,J);Z.colId=Q;let $=new B4(Z,null,Q,!0);return this.createBean($),$}updateOneAutoCol(z,J,Q){let Z=z.getColDef(),$=typeof Z.showRowGroup=="string"?Z.showRowGroup:void 0,X=this.beans,Y=$!=null?X.colModel.getColDefCol($):void 0,q=z.getId(),G=this.createAutoColDef(q,Y??void 0,J);z.setColDef(G,null,Q),l0(X,{state:[jZ(G,q)]},Q)}createAutoColDef(z,J,Q){let Z=this.createBaseColDef(J),$=this.gos.get("autoGroupColumnDef");if(K0(Z,$),Z=s4(this.beans,Z,z,!0),$?.groupRowEditable==null)Z.groupRowEditable=void 0;if($?.groupRowValueSetter==null)Z.groupRowValueSetter=void 0;if(!this.gos.get("treeData")){if(n(Z.field)&&n(Z.valueGetter)&&n(Z.filterValueGetter)&&Z.filter!=="agGroupColumnFilter")Z.filter=!1}if(Q&&Q>0)Z.headerCheckboxSelection=!1;let X=k4(this.gos),Y=Z.valueGetter||Z.field!=null;if(X&&!Y)Z.sortIndex=void 0,Z.initialSort=void 0;return Z}createBaseColDef(z){let J=this.gos.get("autoGroupColumnDef"),Z={headerName:this.getLocaleTextFunc()("group","Group"),showRowGroup:z?.getColId()??!0};if(!(J&&(J.cellRenderer||J.cellRendererSelector)))Z.cellRenderer="agGroupCellRenderer";if(z)Z.headerName=this.beans.colNames.getDisplayNameForColumn(z,"header")??void 0,Z.headerValueGetter=z.colDef.headerValueGetter;return Z}getDeepestExpandedLevel(z,J){let Q=-1;if(!z)return Q;for(let Z of z){if(!Z.group||!Z.expanded)continue;if(Z.level>Q)Q=Z.level;if(Q>=J)return Q;let $=this.getDeepestExpandedLevel(Z.childrenAfterGroup,J);if($>Q)Q=$;if(Q>=J)return Q}return Q}updateGroupColumnVisibility(){let z=this.columns?.list;if(!z||z.length===0)return;let{gos:J,visibleCols:Q,rowModel:Z}=this.beans,$=kZ(J),X=!1,Y=(G,H)=>{if(H!==G.isVisible())G.setVisible(H,"api"),X=!0},q=()=>{for(let G of z)Y(G,!0)};if(!$)q();else if(z.length>1){let G=z.length-2,H=Z?.rootNode?.childrenAfterGroup,_=this.getDeepestExpandedLevel(H,G);if(_>=G)q();else for(let U=0;U=U)}if(X)Q.refresh("api")}destroy(){H4(this.beans,this.columns?.tree),super.destroy()}},l5=null,HY=(z)=>{let J=l5,Q=new Uint32Array(1<<32-Math.clz32(z|63));if(J)Q.set(J);return l5=Q,Q},gO=(z,J,Q,Z)=>{let $=J-Z,X=Q-1;if($===1){let H=0;while(z[H].level===X)++H;if(H0){let _=z[H];z.copyWithin(1,0,H),z[0]=_}return z}let Y=Array($),q=0,G=0;for(let H=0;H{let Q=z[0].level+1,Z=Q,$=0,X=Q,Y=l5;if(!Y||Q>=Y.length)Y=HY(Q);++Y[Q];for(let U=1;UQ){if(Q=W,Q>=Y.length)Y=HY(Q)}else if(W=0)return Y.fill(0,Z,Q+1),z;let q=Y[Z],G=Y[Q];if(q+G===J)return Y[Z]=0,Y[Q]=0,gO(z,J,Q,G);let H=0;for(let U=Q;U>=Z;--U){let W=Y[U];Y[U]=H,H+=W}let _=Array(J);for(let U=0;U{if(J===2){if(z[0].level16)return hO(z,J);for(let Q=1;Q=0&&z[X].level<$);z[Y]=Z}}return z},uO=class{constructor(){this.kind="cells",this.rows=[],this.unsorted=!1,this.slots=new Map,this.bits=[],this.extraBits=null,this.colCount=0}addRow(z){let J=z;if(J==null)return;let Q=this.slots;if(Q.get(J)!==void 0){while(J!=null&&Q.get(J)>=0)Q.set(J,-1),J=J.parent;return}let Z=this.rows;do Q.set(J,-1),Z.push(J),J=J.parent;while(J!=null&&!Q.has(J));this.unsorted=!0}addCell(z,J){if(J==null){this.addRow(z);return}if(z==null)return;let Q=this.slots,Z=this.bits,$=Q.get(J)??this.ensureCol(J),X=Q.get(z);if(X===void 0)X=this.ensureRow(z);else if(X<0)return;let Y=$<32?Z:this.extraBits[($>>>5)-1],q=1<<($&31),G=Y[X];if((G&q)!==0)return;Y[X]=G|q;let H=z.parent;while(H!=null){let _=Q.get(H);if(_<0)break;let U=Y[_];if((U&q)!==0)break;Y[_]=U|q,H=H.parent}}hasRow(z){return this.slots.has(z)}getSortedRows(){if(!this.unsorted)return this.rows;this.unsorted=!1;let z=Oq(this.rows);return this.rows=z,z}getSlot(z){return this.slots.get(z)??-1}hasCellBySlot(z,J){if(z<0)return!0;if(J<32)return J>=0&&(this.bits[z]&1<>>5)-1][z]&1<<(J&31))!==0}ensureRow(z){let J=this.slots,Q=this.rows,Z=this.bits,$=this.extraBits,X=Z.push(0),Y=X-1;if($!==null)for(let G=0,H=$.length;G=32){let Q=(J>>>5)-1,Z=this.extraBits;if(Z===null)Z=[],this.extraBits=Z;if(Q>=Z.length)Z.push(Array(this.bits.length).fill(0))}return J}},_Y=class{constructor(){this.kind="rows",this.rows=[],this.unsorted=!1,this.rowSet=new Set}addRow(z){let J=z;if(J==null)return;let Q=this.rowSet;if(Q.has(J))return;let Z=this.rows;do Q.add(J),Z.push(J),J=J.parent;while(J!=null&&!Q.has(J));this.unsorted=!0}addCell(z,J){this.addRow(z)}hasRow(z){return this.rowSet.has(z)}getSortedRows(){if(!this.unsorted)return this.rows;this.unsorted=!1;let z=Oq(this.rows);return this.rows=z,z}},mO=class extends V{constructor(){super(...arguments);this.beanName="changedPathFactory"}newPath(z){return z?new uO:new _Y}ensureRowsPath(z){let J=z.changedPath;if(!J&&z.changedRowNodes&&!z.newData){let Q=this.beans.rowModel;if(Q.hierarchical)J=new _Y,z.changedPath=J,J.addRow(Q.rootNode)}return J}},cO=class extends V{addExpandedCss(z,J){if(J.isExpandable())z.push("ag-row-group"),z.push(J.expanded?"ag-row-group-expanded":"ag-row-group-contracted")}getRowExpandedListeners(z){let{rowNode:J}=z,Q=this.updateExpandedCss.bind(this,z,J);return{expandedChanged:Q,hasChildrenChanged:Q}}setExpanded(z,J,Q,Z){if(z.expanded===J)return;z._expanded=J,z.dispatchRowEvent("expandedChanged");let $={...wZ(z,this.gos,"rowGroupOpened"),expanded:J,event:Q||null};this.dispatchExpandedEvent($,Z)}defaultExpanded(z){let Q=this.beans.gos,Z=z.level??0,$=z.group&&Q.get("isGroupOpenByDefault");if(!$){let Y=Q.get("groupDefaultExpanded");return Y===-1||Z{let X=$.rowComp;X.toggleCss("ag-row-group",Q),X.toggleCss("ag-row-group-expanded",Q&&Z),X.toggleCss("ag-row-group-contracted",Q&&!Z),R0($.element,Q&&Z)})}dispatchStateUpdatedEvent(){this.eventSvc.dispatchEvent({type:"rowExpansionStateChanged"})}},pO=class extends cO{constructor(){super(...arguments);this.beanName="expansionSvc",this.events=null,this.dispatchExpandedDebounced=null}destroy(){super.destroy(),this.events=null,this.dispatchExpandedDebounced=null}setExpansionState(z){let J=new Set(z.expandedRowGroupIds);this.beans.rowModel.forEachNode((Q)=>{let Z=Q.id;if(!Z)return;Q._expanded=J.has(Z)}),this.onGroupExpandedOrCollapsed()}getInternalExpansionState(z=!1){let J=[],Q=[];return this.beans.rowModel.forEachNode((Z)=>{let $=Z.id;if(!$)return;if(Z.expanded)J.push($);else if(z&&Z.isExpandable())Q.push($)}),{expandedRowGroupIds:J,collapsedRowGroupIds:Q}}getExpansionState(){return this.getInternalExpansionState()}isExpanded(z){if(z.footer)return!!z._expanded;if(!(z.group||z.master)||z.leafGroup&&this.beans.colModel.isPivotMode())return!1;let J=z._expanded;if(J===null)J=this.defaultExpanded(z)??!1,z._expanded=J;return!!J}resetExpansion(){let{rowModel:z}=this.beans;z.forEachNode((J)=>{if(!J.group&&!J.master)return;J._expanded=null}),this.onGroupExpandedOrCollapsed()}expandAll(z){let{gos:J,rowModel:Q,colModel:Z,eventSvc:$}=this.beans,X=J.get("treeData"),Y=Z.isPivotActive(),q=(H)=>{if(!H)return;for(let _ of H){let U=()=>{_._expanded=z,q(_.childrenAfterGroup)};if(_.master){U();continue}if(X){if(T(_.childrenAfterGroup))U();continue}if(Y){if(!_.leafGroup)U();continue}if(_.group)U()}},G=Q.rootNode;if(G)q(G.childrenAfterGroup);this.onGroupExpandedOrCollapsed(),$.dispatchEvent({type:"expandOrCollapseAll",source:z?"expandAll":"collapseAll"})}onGroupExpandedOrCollapsed(){this.dispatchStateUpdatedEvent(),this.beans.rowModel.reMapRows()}setDetailsExpansionState(z){let J=this.getInternalExpansionState(!0),Q=J.collapsedRowGroupIds.length===0;if(J.expandedRowGroupIds.length===0===Q)return;return Q?z.expandAll():z.collapseAll()}dispatchExpandedEvent(z,J){if((this.events??(this.events=[])).push(z),J){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:z,rowRenderer:J}=this.beans,Q=this.events,Z=Q?.length;if(!Z)return;this.events=null;let $=Array(Z);for(let X=0;Xwindow.setTimeout(z,0);let Q=!1;return()=>{if(!J.active){window.setTimeout(z,0);return}if(Q)return;Q=!0,J.addDestroyTask(()=>{Q=!1,z()})}}};function iO(z){let J=z.get("groupHideParentOfSingleChild");if(!J){if(J=z.get("groupRemoveSingleChildren"),!J&&z.get("groupRemoveLowestSingleChildren"))J="leafGroupsOnly"}return{groupHideParentOfSingleChild:J,isGroupMultiAutoColumn:y6(z),hideOpenParents:z.get("groupHideOpenParents"),grandTotalRow:S1(z),groupTotalRow:QJ(z)}}function dO(z,J,Q){return z.groupHideParentOfSingleChild===!0&&Q&&J.childrenAfterGroup.length===1}function nO(z,J,Q){return z.groupHideParentOfSingleChild==="leafGroupsOnly"&&Q&&J.leafGroup&&J.childrenAfterGroup.length===1}function tO(z,J,Q,Z,$,X){if(Z&&!Q)return!1;if($||X)return!1;if(!z.hideOpenParents)return!0;if(J.master||J.level===-1)return!0;if(!(Z&&J.leafGroup)&&J.expanded)return!1;return!0}var rO=class extends V{constructor(){super(...arguments);this.beanName="flattenStage",this.step="map",this.refreshProps=["groupHideParentOfSingleChild","groupRemoveSingleChildren","groupRemoveLowestSingleChildren","groupTotalRow","masterDetail"]}execute(){let{beans:z,gos:J}=this,Q=[],Z=z.rowModel.rootNode;if(!Z)return Q;let $=z.colModel.isPivotMode(),X=$&&Z.leafGroup&&Z.aggData,Y=X?[Z]:Z.childrenAfterSort,q=iO(J);this.recursivelyAddToRowsToDisplay(q,Y,Q,$,0);let G=Q.length>0,H=q.grandTotalRow;if(!X&&G&&H)if(zz(Z,z),H==="pinnedBottom"||H==="pinnedTop")this.beans.pinnedRowModel?.setGrandTotalPinned(H==="pinnedBottom"?"bottom":"top");else{let U=H==="top";this.addRowNodeToRowsToDisplay(q,Z.sibling,Q,0,U)}return Q}recursivelyAddToRowsToDisplay(z,J,Q,Z,$){if(!J?.length)return;let X=this.beans.masterDetailSvc;for(let Y=0;Ythis.onCsrmCellChange(z),batchEditingStopped:()=>this.flushGroupEdits()})}destroy(){this.stopDragging(!0),super.destroy()}isGroupingDrop(z){if(!z.rowDragManaged||!z.sameGrid)return!1;if(!this.gos.get("refreshAfterGroupEdit"))return!1;return!!this.beans.rowGroupColsSvc?.columns?.length&&!this.beans.colModel.isPivotMode()}initDraggingGroups(z){let J=new Map,Q=(Z)=>{let $=Z.childrenAfterGroup;if($){if(J.has(Z))return;let X=$.slice();J.set(Z,X);for(let Y of X)Q(Y)}};for(let Z of z.rows)if(Z.group)Q(Z);this.draggingGroups=J}canSetParent(z){if(!z.sameGrid)return!1;if(this.beans.groupStage?.treeData)return!0;if(z.rowDragManaged&&!this.gos.get("refreshAfterGroupEdit"))return!1;return!!this.beans.rowGroupColsSvc?.columns?.length}canDropRow(z,J){if(this.beans.groupStage?.treeData)return!lO(z,J.newParent);let{position:Q,target:Z,newParent:$,rootNode:X}=J,Y=z.parent;if(z.group&&(WY(z,Z)||WY(z,$)))return!1;if(Q==="inside")return!0;if($&&$!==Y)return $!==X||Y===X;let q=$??Z?.parent??X;if(q!==Y)return!1;let G=z.group?z.level:Y.level??-1,H=-1;if(Z)H=Z.group?Z.level:Z.parent?.level??-1;else if(q)H=q.level;if(G>=0&&H>=0&&H!==G)return!1;return!0}fixRowsDrop(z,J,Q,Z){let $=!!this.beans.groupStage?.treeData;if(z.treeData=$,!(!!this.beans.rowGroupColsSvc?.columns?.length||this.gos.get("pivotMode"))&&!$)return;if(!this.draggingGroups&&this.isGroupingDrop(z)&&!z.suppressMoveWhenRowDragging)this.initDraggingGroups(z);let Y=z.target,q=null,G=!1,H=z.rootNode,_=this.beans.rowModel,U=this.canStartGroup(Y,$);this.updateDropTarget(z,Q,U);let W=this.beans.pageBounds?.getLastRow?.()??_.getRowCount()-1;if(J){if(!Y||Z>=0.5&&Y.rowIndex===W)q=H;else if(z.moved&&Y&&this.dropGroupThrottled&&this.shouldDropTargetBeParent(z))q=Y;if(!q)q=Y?.parent??H}if(!Q&&Y&&U&&!(Y.group&&Y.expanded))this.startDropGroupDelay(Y);if(q){if(Y&&q===Y&&q!==H){let B=q.expanded?x9(_,1,Y):null;if(B?.parent===q)Y=B,Z=-0.5;else G=!0}if(Y&&!G){let B=Y;while(B&&B!==H&&B!==q)Y=B,B=B.parent}}z.target=Y,z.newParent=q,z.yDelta=Z,z.inside=G}clearNewSameParent(z,J){let Q=z.newParent;if(Q&&(!J||aO(z.rows,Q)))z.newParent=null}updateDropTarget(z,J,Q){let Z=Q?z.target:null;if(this.dropGroupTarget&&this.dropGroupTarget!==Z)this.resetDragGroup();if(!Z?.childrenAfterSort?.length)return;if(J&&this.dropGroupThrottled&&!Z.expanded&&Z.isExpandable?.())Z.setExpanded(!0,void 0,!0);if(this.canDropInTarget(Z,z))this.dropGroupThrottled=!0,this.dropGroupTarget=Z}canDropInTarget(z,J){if(z.expanded)return!0;if(!z.group)return!1;if(J.pointerPos==="inside")return!0;if(J.treeData)return!1;let Q=J.rows,Z=z.level;for(let $=0,X=Q.length;${this.dropGroupTimer=null,this.dropGroupThrottled=!0,this.beans.dragAndDrop?.nudge()},J)}resetDragGroup(){if(this.dropGroupTimer!==null)window.clearTimeout(this.dropGroupTimer),this.dropGroupTimer=null;this.dropGroupTarget=null,this.dropGroupThrottled=!1}stopDragging(z){if(z)this.draggingGroups=null;this.resetDragGroup()}shouldDropTargetBeParent({target:z,rows:J,pointerPos:Q,treeData:Z}){if(!z||Q==="none")return!1;if(Q==="inside")return!0;if(!Z&&z.group&&!z.expanded)return!0;if(Q==="above")return!1;let $=this.beans.rowModel,Y=z.rowIndex+1,q;do q=$.getRow(Y++);while(q?.footer);let G=this.draggingGroups?.get(z)??z.childrenAfterGroup;if(q&&q.parent===z&&G?.length){let H=new Set(J);for(let _=0,U=G.length;_{if(H.has(D))return;if(H.add(D),W??(W=this.newGroupValues(X)),this.setRowGroup(D,W))U.add(D)},E=(D)=>{let M=this.draggingGroups?.get(D)??D.childrenAfterGroup,f=M?.length;if(f)for(let S=0;S=0)B(A);else E(A)}};for(let D of z.rows)if(D.group)E(D);else{let M=D.sourceRowIndex>=0&&!D.destroyed?D:this.csrmFirstLeaf(D);if(M)B(M)}let K=Q==="inside"?"above":Q,F=Q==="inside"?this.findFirstLeafForParent(X,H)??Z:Z,L=!1;if(H.size&&K!=="none")L=q$($._leafs,H,F,K==="above");if(!U.size&&!L)return!1;_.reordered=L;for(let D of H)_.updates.add(D);if(this.csrmRefresh(_),G)G.focusCell();else Y.clearFocusedCell();return!0}canStartGroup(z,J){if(!z||z.level<0||z.footer||z.detail)return!1;if(z.group)return!0;return J}flushGroupEdits(){let z=this.pendingEditRefresh;if(z)this.pendingEditRefresh=null,this.csrmRefresh(z)}csrmRefresh(z){let J=this.beans.rowModel;if(!J.rootNode)return;J.refreshModel({step:"group",keepRenderedRows:!0,animate:!this.gos.get("suppressAnimationFrame"),changedRowNodes:z})}newGroupValues(z){let J=this.beans.rowGroupColsSvc?.columns??[],Q=Array(J.length),Z=-1,$=z;while($&&$.level>=0){let X=J[$.level];if(X){let Y=X.getColId(),q=$.level;if(Q[q]=$.groupData?.[Y]??$.key??void 0,q>Z)Z=q}$=$.parent}return{values:Q,columns:J,maxLevel:Z}}setRowGroup(z,{values:J,columns:Q,maxLevel:Z}){if(Z<0)return!1;let{valueSvc:$,changeDetectionSvc:X}=this.beans,Y=!1;X?.beginDeferred();try{for(let q=0;qZ)continue;let H=J[q],_=$.getValue(G,z,"data");if(_===H||_==null&&H==null)continue;let U=H,W=$.parseValue(G,z,H,_);if(W!==void 0)U=W;if(z.setDataValue(G,U,"rowDrag"))Y=!0}}finally{X?.endDeferred()}return Y}onCsrmCellChange(z){let{column:J,node:Q,source:Z}=z;if(!this.gos.get("refreshAfterGroupEdit"))return;if(Z==="rowDrag")return;if(!J?.isRowGroupActive())return;if(Q.group||!Q.data)return;if(this.beans.editSvc?.isBatchEditing()){let X=this.pendingEditRefresh;if(!X)X=UY(),this.pendingEditRefresh=X;X.updates.add(Q)}else{let X=UY();X.updates.add(Q),this.csrmRefresh(X)}}csrmFirstLeaf(z){if(!z)return null;let J=this.draggingGroups,Q=J?.get(z)??z.childrenAfterGroup;while(Q?.length){let Z=Q[0];if(Z.sourceRowIndex>=0){if(!Z.destroyed)return Z;return this.firstAliveChildLeaf(Z)}Q=J?.get(Z)??Z.childrenAfterGroup}return $2(z)}firstAliveChildLeaf(z){let J=this.draggingGroups?.get(z)??z.childrenAfterGroup;if(J){for(let Q of J)if(Q.sourceRowIndex>=0&&!Q.destroyed)return Q}return null}findFirstLeafForParent(z,J){if(!z)return null;let Q=this.draggingGroups?.get(z)??z?.childrenAfterGroup;if(!Q)return null;for(let Z=0,$=Q.length;Z<$;++Z){let X=Q[Z];if(X.sourceRowIndex>=0&&!J.has(X))return X;let Y=this.findFirstLeafForParent(X,J);if(Y!==null)return Y}return null}},UY=()=>{let z=new v2;return z.reordered=!0,z},WY=(z,J)=>{if(!z||!J)return!1;let Q=J;while(Q){if(Q===z)return!0;Q=Q.parent}return!1},lO=(z,J)=>{if(!J||z.parent===J)return!1;let Q=J,Z=z.id;while(Q){if(Q===z)return!0;if(Z!=null&&Q.id===Z)return!0;Q=Q.parent}return!1},aO=(z,J)=>{for(let Q=0,Z=z.length;Qthis.strategy?.onShowRowGroupColsSetChanged()})}invalidateGroupCols(){this.columnsInvalidated=!0,this.strategy?.invalidateGroupCols?.()}destroy(){this.strategy=this.destroyBean(this.strategy),super.destroy()}getNonLeaf(z){return this.strategy?.nonLeafsById?.get(z)}getNestedDataGetter(){return this.getStrategy()?.nestedDataGetter}onPropChange(z){let J=this.gos,Q=this.strategy?.nestedDataGetter;if(z.has("treeData"))this.gosTreeData=J.get("treeData")&&this.hasTreeData,this.columnsInvalidated=!0;return this.strategy?.onPropChange?.(z),this.getNestedDataGetter()!==Q}extractData(){let z=this.beans.rowModel.rootNode,J=this.nested?z?.childrenAfterGroup:z?._leafs;if(!J)return this.gos.get("rowData")??[];let Q=J.length,Z=Array(Q),$=0;for(let X=0;X{let J=z.sibling;if(!J)return null;let Q=J._leafs;if(Q!==void 0)return Q;return pJ(J)},pJ=(z)=>{let J=z.childrenAfterGroup,Q=J?.length;if(z._leafs=null,!Q)return null;let Z,$=Q===1?J[0]:null;if($?.group&&$.sourceRowIndex<0){if(Z=$._leafs,Z===void 0)Z=pJ($)}else if(z.leafGroup)Z=J;else{Z=[];for(let X=0;X=0)Z.push(Y);if(!Y.group)continue;let q=Y._leafs;if(q===void 0)q=pJ(Y);if(q)for(let G=0,H=q.length;G{let{_leafs:Z,sibling:$}=z;if(z.treeNodeFlags=0,z.childrenAfterGroup=Z,z.childrenMapped=null,z._groupData=void 0,z.aggData=null,$)$.childrenAfterGroup=z.childrenAfterGroup,$.childrenAfterAggFilter=z.childrenAfterAggFilter,$.childrenAfterFilter=z.childrenAfterFilter,$.childrenAfterSort=z.childrenAfterSort,$.childrenMapped=null,$._groupData=void 0,$.aggData=null;for(let X=0,Y=Z.length??0;X{z.key=null,z.treeNodeFlags=0,z.allChildrenCount=null,z.childrenAfterGroup=null,z.childrenAfterAggFilter=null,z.childrenAfterFilter=null,z.childrenAfterSort=null,z.childrenMapped=null,z.level=0,z._groupData=void 0};function EY(z,J,Q){let Z=z,$=Z.level-J.level;if($<=0)return!1;if(!Q.get("groupHideOpenParents"))return!1;for(let Y=0;Y<$;Y++){if(Z.parent?.getFirstChild()!==Z)return!1;Z=Z.parent}return Z===J}var Pq=class extends V{constructor(){super(...arguments);this.indentClass=null}init(z,J,Q,Z,$,X,Y){this.params=Y,this.eGui=J,this.eCheckbox=Q,this.eExpanded=Z,this.eContracted=$,this.comp=z,this.compClass=X;let{node:q,column:G}=Y;if(this.node=q,this.displayedNode=q,this.isEmbeddedRowMismatch())return;if(q.footer){this.initFooterCell();return}if(!G){this.initFullWidthCell();return}this.displayedNode=this.beans.showRowGroupColValueSvc?.getDisplayedNode(q,G)??this.node,this.setupExpand(),this.setupCheckbox(),this.addGroupValue(),this.setupIndent()}initFooterCell(){let{node:z}=this.params;if(this.addGroupValue(),this.setupIndent(),z.level!==-1)this.comp.toggleCss("ag-row-group-leaf-indent",!0)}initFullWidthCell(){let z=()=>{let{rowDragSvc:J}=this.beans;if(!this.params.rowDrag||!J)return;let Q=J.createRowDragComp(()=>this.params.value,this.params.node);this.createManagedBean(Q),this.eGui.insertAdjacentElement("afterbegin",Q.getGui())};this.setupExpand(),z(),this.setupCheckbox(),this.addGroupValue(),this.setupIndent()}getCellAriaRole(){let z=this.params.colDef?.cellAriaRole,J=this.params.column?.getColDef().cellAriaRole;return z||J||"gridcell"}isEmbeddedRowMismatch(){if(!this.params.fullWidth||!this.gos.get("embedFullWidthRows"))return!1;let{visibleCols:z}=this.beans,J=this.params.pinned==="left",Q=this.params.pinned==="right",Z=!J&&!Q;if(this.gos.get("enableRtl")){if(z.isPinningLeft())return!Q;return!Z}if(z.isPinningLeft())return!J;return!Z}addGroupValue(){let{params:{value:z,valueFormatted:J}}=this,Q=this.getInnerCompDetails();this.comp.setInnerRenderer(Q,J??z??null)}setupExpand(){let{colModel:z}=this.beans,{eGridCell:J,suppressDoubleClickExpand:Q}=this.params,Z=(G,H)=>{let _=h(G,this.beans,null);if(_)H.appendChild(_),this.addDestroyFunc(()=>_.remove())};Z("groupExpanded",this.eExpanded),Z("groupContracted",this.eContracted);let $=this.comp,X=()=>{if(!this.isExpandable())return;let H=!!this.displayedNode.expanded;$.setExpandedDisplayed(H),$.setContractedDisplayed(!H),R0(J,H)},Y=()=>{let G=this.isExpandable();$.toggleCss("ag-cell-expandable",G),$.toggleCss("ag-row-group",G);let H=!G&&z.isPivotMode();$.toggleCss("ag-pivot-leaf-group",H);let _=!z.isPivotMode()&&(!this.displayedNode.footer||this.displayedNode.level!==-1);$.toggleCss("ag-row-group-leaf-indent",!G&&_);let U=this.getChildCount(),W=U>0?`(${U})`:"";if($.setChildCount(W),!G)$.setExpandedDisplayed(!1),$.setContractedDisplayed(!1),O8(J);else X()};(()=>{if(!Q&&!this.isGroupCellEditable(this.displayedNode))this.addManagedListeners(J,{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(J,{keydown:this.onKeyDown.bind(this)}),this.addManagedListeners(this.displayedNode,{allChildrenCountChanged:Y,masterChanged:Y,groupChanged:Y,hasChildrenChanged:Y,expandedChanged:X})})(),Y()}getInnerCompDetails(){let{userCompFactory:z,findSvc:J}=this.beans,Q=this.params;if(Q.fullWidth){let G=this.gos.get("groupRowRendererParams"),H=g6(z,G,Q);if(H)return H;if(J?.isMatch(Q.node,null))return g6(z,{...G,innerRenderer:"agFindCellRenderer"},Q);return}let Z=(G)=>G&&G.componentClass==this.compClass,$=g6(z,Q,Q);if($&&!Z($))return $;let{displayedNode:{rowGroupColumn:X}}=this,Y=X?.colDef,q=X&&Q.column?.isRowGroupDisplayed(X.getId());if(Y&&q){let G=D1(z,Y,Q);if(G)if(Z(G)){if(Y?.cellRendererParams?.innerRenderer)return g6(z,Y.cellRendererParams,Q)}else return G}if(J?.isMatch(Q.node,Q.column))return D1(z,{...Y??Q.colDef,cellRenderer:"agFindCellRenderer"},Q)}getChildCount(){let{column:z,suppressCount:J}=this.params;if(J)return 0;let{allChildrenCount:Q,rowGroupColumn:Z}=this.displayedNode;if(!((Q??0)>0&&(!Z||!z||z?.isRowGroupDisplayed(Z.getId()))))return 0;if(this.gos.get("showOpenedGroup")&&this.displayedNode!==this.node&&!EY(this.node,this.displayedNode,this.gos))return 0;return Q??0}isExpandable(){let{node:z,column:J,colDef:Q}=this.params;if(!this.displayedNode.isExpandable())return!1;if(z.rowPinned)return!1;if(!J)return!0;if(z.hasChildren()&&Q){let{showRowGroup:X}=Q;if(!X)return!1;if(X===!0)return!0}if(z===this.displayedNode){if(z.rowGroupColumn){if(J?.isRowGroupDisplayed(z.rowGroupColumn.getId()))return!0}if(z.master)return Q?.showRowGroup===!0||Q?.showRowGroup==null;return!1}return EY(this.node,this.displayedNode,this.gos)}setupIndent(){let{suppressPadding:z,node:J,colDef:Q}=this.params;if(z)return;let Z=()=>{let $=J.uiLevel;if(Q&&Q.showRowGroup!==!0)$=0;let X="ag-row-group-indent-"+$;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($))};this.addManagedListeners(J,{uiLevelChanged:Z.bind(this)}),Z()}setupCheckbox(){let{node:z}=this.params;if(!(!z.footer&&!z.rowPinned&&!z.detail))return;this.addManagedPropertyListener("rowSelection",({currentValue:Q,previousValue:Z})=>{let $=typeof Q==="object"?Q:void 0,X=typeof Z==="object"?Z:void 0;if($?.checkboxLocation!==X?.checkboxLocation)this.destroyCheckbox(),this.addCheckbox()}),this.addCheckbox()}addCheckbox(){let{selectionSvc:z}=this.beans;if(!z||!t4(this.gos))return;let{node:J,column:Q}=this.params,Z=this.gos.get("rowSelection"),$=b2(Z);if($==="selectionColumn")return;if($==="autoGroupColumn"){let H=Q?.getColDef().showRowGroup!=null,_=!Q&&J.group;if(!(H||_))return}let X=typeof Z==="object"?B1(Z):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=z.createCheckboxSelectionComponent();this.cbComp=G,this.createBean(G),G.init({rowNode:J,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(z){let J=this.params.column;return!!J&&(!!J.getColDef().groupRowEditable||this.gos.get("enableGroupEdit"))&&J.isCellEditable(z)}onExpandClicked(z){if(q4(z))return;s0(z),this.onExpandOrContract(z)}onKeyDown(z){if(z.key!==k.ENTER||this.params.suppressEnterExpand)return;if(this.isGroupCellEditable(this.params.node))return;this.onExpandOrContract(z)}onCellDblClicked(z){if(q4(z))return;if(!(ez(this.eExpanded,z)||ez(this.eContracted,z)))this.onExpandOrContract(z)}onExpandOrContract(z){if(!this.isExpandable())return;let J=this.displayedNode,Q=!J.expanded;if(!Q&&J.sticky)this.beans.ctrlsSvc.getScrollFeature().setVerticalScrollPosition(J.rowTop-J.stickyRowTop);J.setExpanded(Q,z)}destroy(){super.destroy(),this.destroyCheckbox()}},JP={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"}]},KY=class extends y{constructor(){super(JP);this.eExpanded=j,this.eContracted=j,this.eCheckbox=j,this.eValue=j,this.eChildCount=j}init(z){let J={setInnerRenderer:(X,Y)=>this.setRenderDetails(X,Y),setChildCount:(X)=>this.eChildCount.textContent=X,toggleCss:(X,Y)=>this.toggleCss(X,Y),setContractedDisplayed:(X)=>w(this.eContracted,X),setExpandedDisplayed:(X)=>w(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 Pq),Z=!z.colDef,$=this.getGui();if(Q.init(J,$,this.eCheckbox,this.eExpanded,this.eContracted,this.constructor,z),Z)H0($,Q.getCellAriaRole())}setRenderDetails(z,J){if(z)z.newAgStackInstance().then((Q)=>{if(!Q)return;let Z=()=>this.destroyBean(Q);if(this.isAlive())this.eValue.appendChild(Q.getGui()),this.addDestroyFunc(Z);else Z()});else this.eValue.innerText=J}destroy(){this.destroyBean(this.innerCellRenderer),super.destroy()}refresh(){return!1}},QP=".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)}",ZP=class extends V{constructor(){super(...arguments);this.beanName="showRowGroupColValueSvc"}getGroupValue(z,J,Q){if(!J){if(!z.group)return null;return{displayedNode:z,value:z.groupValue}}let Z=this.beans.valueSvc,$=J.colDef.showRowGroup;if(!$)return null;if(z.level===-1&&z.footer)return{displayedNode:z,value:null};if(typeof $==="string"){if((this.beans.rowGroupColsSvc?.getColumnIndex($)??-1)>z.level)return null;let q=this.getDisplayedNode(z,J,!0);if(q)return{displayedNode:q,value:Z.getValue(J,q,"data",Q)}}let X=Z.getValue(J,z,"data",Q);if(X==null){let Y=this.getDisplayedNode(z,J);if(Y)return{displayedNode:Y,value:Z.getValue(J,Y,"data",Q)}}return{displayedNode:z,value:X}}formatAndPrefixGroupColValue(z,J,Q=!1){let Z=this.formatGroupColValue(z,J,Q),{value:$,displayedNode:X}=z,Y=this.beans.footerSvc;if(Y?.doesCellShowTotalPrefix(X,J))return Y.applyTotalPrefix($,Z,X,J);if(X.footer&&X.level===-1)return null;return Z}formatGroupColValue(z,J,Q=!1){let Z=this.beans.valueSvc,{displayedNode:$,value:X}=z,Y=$.rowGroupColumn,q=$.group&&!J;if(Y&&(q||J?.isRowGroupDisplayed(Y.colId))){if(Q&&Y.colDef.useValueFormatterForExport===!1)return null;let H=Z.formatValue(Y,$,X);if(H==null&&$.key==="")return this.getLocaleTextFunc()("blanks","(Blanks)");return H}if(!J||$.group)return null;if(Q&&J.colDef.useValueFormatterForExport===!1)return null;return Z.formatValue(J,$,X)}getDisplayedNode(z,J,Q=!1){let Z=this.gos,$=Z.get("groupHideOpenParents"),X=Z.get("showOpenedGroup")&&!Q;if(!$&&!X)return;let Y=J.colDef.showRowGroup;if(Y===!0){if(z.group)return;return z.parent??void 0}let q=z;while(q&&q.rowGroupColumn?.getId()!=Y){let G=q===q.parent?.getFirstChild();if(!X&&!G)return;q=q.parent}if(q===z)return;return q??void 0}},$P=class extends V{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:z,rowGroupColsSvc:J}=this.beans,Q=this.columns,Z=this.colsSet,$=this.colsMap;$.clear();let X=Q.length,Y=0,q=!1,G=z.getCols();for(let H=0,_=G.length;H<_;++H){let U=G[H],B=U.getColDef().showRowGroup;if(typeof B==="string")$.set(B,U);else if(B===!0){let E=J?.columns;if(E)for(let K=0,F=E.length;K=X||!Z.has(U)),Q[Y++]=U}if(q||(q=Y!==X),q){Q.length=Y,Z.clear();for(let H=0;H{this.gridBodyCtrl=z.gridBodyCtrl}),this.resetStickyContainers()}setOffsetTop(z){if(this.extraTopHeight===z)return;this.extraTopHeight=z,this.eventSvc.dispatchEvent({type:"stickyTopOffsetChanged",offset:z})}setOffsetBottom(z){if(this.extraBottomHeight===z)return;this.extraBottomHeight=z}resetOffsets(){this.setOffsetBottom(0),this.setOffsetTop(0)}getLastPixelOfGroup(z){return this.isClientSide?qP(z):YP(z)}getFirstPixelOfGroup(z){if(z.footer)return z.sibling.rowTop+z.sibling.rowHeight-1;if(z.hasChildren())return z.rowTop-1;return 0}updateStickyRows(z){let J=z==="top",Q=0;if(!this.canRowsBeSticky())return this.refreshNodesAndContainerHeight(z,new Set,Q);let Z=new Set,{rowModel:$,rowRenderer:X,pinnedRowModel:Y,pageBounds:q,rowContainerHeight:G}=this.beans,{pageFirstPixel:H,pageLastPixel:_}=q.getCurrentPagePixelRange(),U=J?X.firstVisibleVPixel-this.extraTopHeight:X.lastVisibleVPixel-this.extraTopHeight,W=G.divStretchOffset??0,B=H+W,E=_+W,K=(M)=>{if(Z.add(M),J){let f=this.getLastPixelOfGroup(M),S=U+Q+M.rowHeight;if(fS)M.stickyRowTop=Q-(f-S);else M.stickyRowTop=Q}Q=0,Z.forEach((f)=>{let S=f.stickyRowTop+f.rowHeight;if(Q{if(!M.displayed)return!1;if(M.footer){if(F===!0)return!1;if(F==="grand"&&M.level===-1)return!1;if(F==="group"&&M.level>-1)return!1;let f=M.sibling.rowIndex?M.sibling.rowIndex+1===M.rowIndex:!1;if(z==="bottom"&&f)return!1;if(M.level===-1&&Y?.getGrandTotalPinned())return!1;return!Z.has(M)}if(M.isExpandable()){if(L===!0)return!1;if(z==="bottom")return!1;return!Z.has(M)&&!!M.expanded}return!1};for(let M=0;M<100;M++){let f=U+Q;if(!J)f=U-Q;if(J&&fE)f=E;let S=$.getRowIndexAtPixel(f),A=$.getRow(S);if(A==null)break;let v=this.getStickyAncestors(A).find((x)=>(J?x.rowIndexS)&&D(x));if(v){K(v);continue}if((J?A.rowTopf)&&D(A)){K(A);continue}break}if(!J)Z.forEach((M)=>{M.stickyRowTop=Q-(M.stickyRowTop+M.rowHeight)});return this.refreshNodesAndContainerHeight(z,Z,Q)}areFooterRowsStickySuppressed(){let z=this.gos.get("suppressStickyTotalRow");if(z===!0)return!0;let J=z==="group",Q=z==="grand";if(J&&Q)return!0;if(Q)return"grand";if(J)return"group";return!1}canRowsBeSticky(){let z=i2(this.gos),J=this.areFooterRowsStickySuppressed(),Q=this.gos.get("suppressGroupRowsSticky");return z&&(!J||!Q)}getStickyAncestors(z){let J=[],Q=z.footer?z.sibling:z.parent;while(Q){if(Q.sibling)J.push(Q.sibling);J.push(Q),Q=Q.parent}return J.reverse()}checkStickyRows(){let z=this.updateStickyRows("top"),J=this.updateStickyRows("bottom");return z||J}destroyStickyCtrls(){this.resetStickyContainers()}resetStickyContainers(){this.refreshNodesAndContainerHeight("top",new Set,0),this.refreshNodesAndContainerHeight("bottom",new Set,0)}refreshStickyNode(z){let J=new Set;if(this.stickyTopRowCtrls.some((Q)=>Q.rowNode===z)){for(let Q=0;Q{if(q.has(B))return;B.sticky=!0,G.push(this.createRowCon(B,!1,!1))});let H=!!G.length||Y.length!==$.length;if(Z){if(this.topContainerHeight!==Q)this.topContainerHeight=Q,this.gridBodyCtrl.setStickyTopHeight(Q),H=!0}else if(this.bottomContainerHeight!==Q)this.bottomContainerHeight=Q,this.gridBodyCtrl.setStickyBottomHeight(Q),H=!0;this.destroyRowCtrls(X,!1);let _=[...Y,...G];if(_.sort((B,E)=>E.rowNode.rowIndex-B.rowNode.rowIndex),!Z)_.reverse();for(let B of _)B.setRowTop(B.rowNode.stickyRowTop);let U=this.beans.pageBounds,W=0;if(Z){for(let B of J)if(B.rowIndexthis.topContainerHeight)W=this.topContainerHeight;this.setOffsetTop(W)}else{for(let B of J)if(B.rowIndex>U.getLastRow())W+=B.rowHeight;if(W>this.bottomContainerHeight)W=this.bottomContainerHeight;this.setOffsetBottom(W)}if(!H)return!1;if(Z)this.stickyTopRowCtrls=_;else this.stickyBottomRowCtrls=_;return!0}ensureRowHeightsValid(){let z=!1,J=(Q)=>{let Z=Q.rowNode;if(Z.rowHeightEstimated){let $=k6(this.beans,Z);Z.setRowHeight($.height),z=!0}};return this.stickyTopRowCtrls.forEach(J),this.stickyBottomRowCtrls.forEach(J),z}};function YP(z){if(z.isExpandable()||z.footer){if(z.master&&z.detailNode)return z.detailNode.rowTop+z.detailNode.rowHeight;if(!z.sibling||Math.abs(z.sibling.rowIndex-z.rowIndex)===1){let Q=z.childStore?.getStoreBounds();if(z.footer)Q=z.sibling.childStore?.getStoreBounds();return(Q?.heightPx??0)+(Q?.topPx??0)}if(z.footer)return z.rowTop+z.rowHeight;return z.sibling.rowTop+z.sibling.rowHeight}return Number.MAX_SAFE_INTEGER}function qP(z){if(z.isExpandable()||z.footer){if(z.footer&&z.rowIndex===0)return Number.MAX_SAFE_INTEGER;if(!z.sibling||Math.abs(z.sibling.rowIndex-z.rowIndex)===1){let Z=z.footer?z.sibling:z;while(Z.isExpandable()&&Z.expanded)if(Z.master&&Z.detailNode)Z=Z.detailNode;else if(Z.childrenAfterSort){if(Z.childrenAfterSort.length===0)break;Z=b(Z.childrenAfterSort)}return Z.rowTop+Z.rowHeight}if(z.footer)return z.rowTop+z.rowHeight;return z.sibling.rowTop+z.sibling.rowHeight}return Number.MAX_SAFE_INTEGER}var GP=class extends V{constructor(){super(...arguments);this.beanName="stickyRowSvc"}createStickyRowFeature(z,J,Q){let Z=this.gos;if(i2(Z)&&o(Z)||V1(Z))return z.createManagedBean(new XP(J,Q));return}},Tq={moduleName:"GroupCellRenderer",version:$0,userComponents:{agGroupRowRenderer:KY,agGroupCellRenderer:KY},dynamicBeans:{groupCellRendererCtrl:Pq},icons:{groupContracted:"tree-closed",groupExpanded:"tree-open"},css:[QP],dependsOn:[C0]},HP={moduleName:"GroupColumn",version:$0,beans:[NO,$P,ZP,wO,jq,Aq],dependsOn:[C0,Tq]},vq={moduleName:"ChangedPath",version:$0,beans:[mO],dependsOn:[C0]},nJ={moduleName:"ClientSideRowModelHierarchy",version:$0,rowModels:["clientSide"],beans:[oO,rO,pO],dependsOn:[C0,vq]},Iq={moduleName:"StickyRow",version:$0,beans:[GP]},_P={moduleName:"GroupEdit",version:$0,beans:[sO],dependsOn:[C0,nJ]},UP=({valueSvc:z,dataTypeSvc:J},Q,Z)=>{let $=z.getValue(Q,Z,"data"),X=null;if($ instanceof Date)X=$;else if(typeof $==="string")X=(J?.getDateParserFunction(Q)??h0)($)??null;return X},v1=(z,J,Q,Z)=>($)=>{let X=UP(z,J,$.node),Y=_1(X);if(!Y)return null;return Z?.(Y[Q])??Y[Q]},I1=({colNames:z},J,Q)=>(Z)=>{let $=z.getDisplayNameForColumn(J,Z.location);if($)return`${$} (${Q})`;return""},WP=Object.fromEntries(A6.map((z)=>[z,z.toLowerCase()])),BP=(z)=>{let J=A6[Number.parseInt(z,10)-1]??z,Q=WP[J]??z;return{month:J,localeKey:Q}};function FY(z){return z.groupHierarchy??z.rowGroupingHierarchy}var EP=class extends V{constructor(){super(...arguments);this.beanName="groupHierarchyColSvc",this.columns=null,this.sourceColumnMap=new WeakMap,this.inverseColumnMap=new WeakMap}addColumns(z){let J=this.columns;if(J==null)return;z.list=J.list.filter((Q)=>!z.list.some((Z)=>Z.getColId()===Q.getColId())).concat(z.list),z.tree=J.tree.filter((Q)=>!z.tree.some((Z)=>Z.getId()===Q.getId())).concat(z.tree),N6(z)}createColumns(z){let J=new WeakMap,Q=new WeakMap,Z=this.createGroupHierarchyColumns(z,J,Q);if(w6(Z,this.columns?.list??[]))return;H4(this.beans,this.columns?.tree),this.columns=null;let{colGroupSvc:X}=this.beans,Y=X?.findDepth(z.tree)??0,q=X?.balanceTreeForAutoCols(Z,Y)??[];this.columns={list:Z,tree:q,treeDepth:Y,map:{}},this.sourceColumnMap=J,this.inverseColumnMap=Q}updateColumns(z){}getColumn(z){return this.columns?.list.find((J)=>g4(J,z))??null}getColumns(){return this.columns?.list??null}expandColumnInto(z,J){let Q=this.getVirtualColumnsForColumn(J).concat(J);for(let Z of Q)if(!z.some(($)=>g4($,Z)||$.getColId()===Z.getColId()))z.push(Z)}compareVirtualColumns(z,J){let Q=this.inverseColumnMap.get(z),Z=this.inverseColumnMap.get(J);if(Q&&Q===Z){let $=this.sourceColumnMap.get(Q)??[];return $?.indexOf(z)-$?.indexOf(J)}if(this.sourceColumnMap.get(z)?.includes(J))return 1;if(this.sourceColumnMap.get(J)?.includes(z))return-1;return null}insertVirtualColumnsForCol(z,J){let Q=this.getVirtualColumnsForColumn(J);if(!Q)return[];let Z=z.indexOf(J);if(Z<0)Z=z.length-1;return O6(z,Q),z.splice(Z,0,...Q),Q}getVirtualColumnsForColumn(z){if(this.isGroupHierarchyColsEnabledForCol(z))return this.sourceColumnMap.get(z)??[];return[]}isGroupHierarchyColsEnabled(z){return z.list.some((J)=>this.isGroupHierarchyColsEnabledForCol(J))}isGroupHierarchyColsEnabledForCol(z){let J=z.getColDef();return!!(FY(J)&&(J.rowGroup||J.enableRowGroup||J.rowGroupIndex!=null||J.pivot||J.enablePivot||J.pivotIndex!=null))}createGroupHierarchyColDefs(z){let J=[],Q=z.getColDef(),Z=FY(Q);if(!Z)return J;if(!this.isGroupHierarchyColsEnabledForCol(z))return J;for(let $ of Z){let X=null;if(typeof $==="string")X=this.createColDefForPart($,z,Q);else X=$;if(X)J.push(X)}return J}createGroupHierarchyColumns(z,J,Q){if(!this.isGroupHierarchyColsEnabled(z))return[];let Z=[];for(let $ of z.list)for(let X of this.createGroupHierarchyColDefs($)){let Y=X.colId;this.gos.validateColDef(X,Y,!0);let q=new B4(X,null,Y,!0);this.createBean(q),Z.push(q),KP(J,$,q),Q.set(q,$)}return Z}createColDefForPart(z,J,Q){let{beans:Z,gos:$}=this,X=`${L9}-${J.getColId()}-${z}`,Y={enableRowGroup:Q.enableRowGroup,rowGroup:Q.rowGroup,enablePivot:Q.enablePivot,hide:!0,editable:!1},q=$.get("groupHierarchyConfig")??{};if(z in q){let U={...Y,...q[z]};return U.colId??(U.colId=X),s4(Z,U,U.colId,!0)}let G=s4(Z,{colId:X,...Y},X,!0),H=this.getLocaleTextFunc(),_=(U,W)=>H?.(U,W)??W;switch(z){case"year":return{...G,headerValueGetter:I1(Z,J,_(z,"Year")),valueGetter:v1(Z,J,0)};case"quarter":return{...G,headerValueGetter:I1(Z,J,_(z,"Quarter")),valueGetter:v1(Z,J,1,(U)=>(Math.floor(Number(U)/4)+1).toString())};case"month":return{...G,headerValueGetter:I1(Z,J,_(z,"Month")),valueGetter:v1(Z,J,1)};case"formattedMonth":return{...G,headerValueGetter:I1(Z,J,_("month","Month")),valueGetter:v1(Z,J,1,(U)=>{let W=BP(U);return _(W.localeKey,W.month)})};case"day":return{...G,headerValueGetter:I1(Z,J,_(z,"Day")),valueGetter:v1(Z,J,2)};case"hour":return{...G,headerValueGetter:I1(Z,J,_(z,"Hour")),valueGetter:v1(Z,J,3)};case"minute":return{...G,headerValueGetter:I1(Z,J,_(z,"Minute")),valueGetter:v1(Z,J,4)};case"second":return{...G,headerValueGetter:I1(Z,J,_(z,"Second")),valueGetter:v1(Z,J,5)};default:return null}}};function KP(z,J,Q){let Z=z.get(J);z.set(J,(Z??[]).concat(Q))}var FP={moduleName:"GroupHierarchy",version:$0,beans:[EP],dependsOn:[vq]};var LP=(z,J)=>{if(!z){J.length=0;return}let Q=z.length;J.length=Q;for(let Z=0;Z{let Q=z.length;if(Q!==J?.length)return!0;for(let Z=0;Z0){Q=!0;break}if(!Q)return!1;return z.sort(LY),!0}function LY(z,J){let Q=z.sourceRowIndex,Z=J.sourceRowIndex,$=Q>=0,X=Z>=0,Y=$&&X,q=!$&&!X;if(Y)return Q-Z;if(q)return z.__objectId-J.__objectId;if($)return 1;return-1}var kP=class extends V{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 z=this.nonLeafsById;for(let J of z.values())J._destroy(!1);z.clear()}loadGroupData(z){if(!z.group)return z._groupData=null,null;let J=z.rowGroupColumn,{valueSvc:Q,showRowGroupCols:Z}=this.beans,$={};if(z._groupData=$,!J)return $;let X=$2(z),Y=J.getId();if(!Z)return $;let q=Z.columns;for(let G=0,H=q.length;G{let Z=Q.childrenAfterGroup,$=Z?.length;if(!$)return;let X=Array($),Y=0,q=!1,G;for(let H=0;H<$;++H){let _=Z[H];if(!_.childrenAfterGroup?.length)q||(q=Y!==H),X[Y++]=_;else if(!G&&_.key===""){G=_;let U=$-1;q||(q=H!==U),X[U]=_}}if(q){for(let _=0;_<$;++_){let U=Z[_];if(U.childrenAfterGroup?.length&&U!==G)X[Y++]=U}Q.childrenAfterGroup=X;let H=Q.sibling;if(H)H.childrenAfterGroup=X}})}initRefresh(z){let{rowGroupColsSvc:J,colModel:Q,gos:Z}=this.beans;this.pivotMode=Q.isPivotMode(),this.groupEmpty=this.pivotMode||!Z.get("groupAllowUnbalanced");let $=J?.columns,X=this.groupCols,Y=z.afterColumnsChanged;if(Y||!X||this.checkGroupCols)if(this.checkGroupCols=!1,X&&!DP(X,$)){if(Y)return"skip"}else{z.animate=!1;let q=X[0]?.col.getId()!==$?.[0]?.getId();return LP($,X),q?"refresh":"groupColsChanged"}return"refresh"}handleDeltaUpdate(z,J,{removals:Q,updates:Z,adds:$,reordered:X},Y){let q=new Set;for(let G=0,H=Q.length;G1)}}if($.size)for(let G of $){this.insertOneNode(z,G);let H=G.parent;J?.addRow(H),X||(X=(H?.childrenAfterGroup?.length??0)>1)}if(q.size)DY(q),this.removeEmptyGroups(q,Y);if(X)this.sortChildren(z,J)}sortChildren(z,J){j0(z,!0,void 0,(Q)=>{if(MP(Q.childrenAfterGroup))J?.addRow(Q)})}orderGroups(z){let J=this.gos.getCallback("initialGroupOrderComparator");if(!J)return;let Q=this.beans,Z=Q.gridApi,$=Q.gridOptions.context,X=(q,G)=>J({api:Z,context:$,nodeA:q,nodeB:G}),Y=(q)=>{let G=q.childrenAfterGroup,H=G?.length;if(!H||q.leafGroup)return;if(H>1)G.sort(X);for(let _=0,U=H;_=0;--q){let{col:G}=Y[q],H=Q.getKeyForNode(G,J);if(H==null||H===""){if(!Z)continue;H=""}if(!$?.parent||$.key!==H){X=!0;break}$=$.parent}if(X||(X=!!$?.parent),!X)return!1;return this.removeFromParent(J),this.insertOneNode(z,J),J.setData(J.data),!0}groupShouldBeRemoved(z){let J=this.getChildrenMappedKey(z.key,z.rowGroupColumn),Q=z.parent?.childrenMapped;if(Q?!Q[J]:!0)return!1;return!!z.group&&(z.childrenAfterGroup?.length??0)===0}removeEmptyGroups(z,J){let Q=this.beans.selectionSvc,Z,$=Array.from(z),X=this.nonLeafsById;do{z.clear();for(let Y=0;Y<$.length;++Y){let q=$[Y];while(q){let G=q.parent;if(q.destroyed){$[Y]=G,q=G;continue}if(!G)break;if(!this.groupShouldBeRemoved(q)){q=G;continue}if(z.add(G),this.removeFromParent(q),Q&&q.isSelected())Z??(Z=[]),Z.push(q);$[Y]=G,X.delete(q.id),q._destroy(J),q=G}}DY(z)}while(z.size);if(Z)Q.setNodesSelected({nodes:Z,newValue:!1,source:"rowGroupChanged"})}removeFromParent(z){let J=z.parent;if(J){let Q=this.getChildrenMappedKey(z.key,z.rowGroupColumn),Z=J.childrenMapped;if(Z)delete Z[Q]}return z.setRowTop(null),z.setRowIndex(null),J}addToParent(z,J){let Q=J.childrenMapped??(J.childrenMapped={}),Z=this.getChildrenMappedKey(z.key,z.rowGroupColumn);if(Q[Z]!==z){Q[Z]=z;let $=J.childrenAfterGroup;if(!$){J.childrenAfterGroup=$=[];let X=J.sibling;if(X)X.childrenAfterGroup=J.childrenAfterGroup}$.push(z),zq(J,this.beans,!0),yJ(J)}}shotgunResetEverything(z){let J=this.nonLeafsById;for(let $ of J.values())$.childrenAfterGroup=null,$.childrenMapped=null;z.leafGroup=!this.groupCols?.length,z.childrenAfterGroup=[],z.childrenMapped={},z.updateHasChildren();let Q=z.sibling;if(Q)Q.childrenAfterGroup=z.childrenAfterGroup,Q.childrenMapped=z.childrenMapped;let Z=z._leafs;for(let $=0,X=Z.length;$=q-1,K=this.createGroup(Q,H,U,B,E,J);this.addToParent(K,Q),Q=K}if(!Q.group)R(184,{parentGroupData:Q.data,childNodeData:J.data});J.parent=Q,J.level=Q.level+1,Q.childrenAfterGroup.push(J),Q.updateHasChildren(),yJ(Q)}createGroup(z,J,Q,Z,$,X){let Y=J.col,q=(z.level>=0?z.id+"-":"row-group-")+(Y.getColId()+"-"+Q),G=this.nonLeafsById,H=G.get(q),_=!0;if(H){if(H.childrenAfterGroup!==null)return H._expanded??(H._expanded=null),H;_=!1,yJ(H)}else H=new j1(this.beans),H.group=!0,H.key=Q,H.id=q,H.aggData=null,G.set(q,H);let U=(K)=>{K.childrenAfterGroup=W,K.childrenMapped=B,K.parent=z,K.level=Z,K.rowGroupIndex=Z,K.leafGroup=$},W=[],B={};if(U(H),H.field=J.field??null,H.rowGroupColumn=Y,H.groupValue=this.beans.valueSvc.getValue(Y,X,"data"),H._expanded??(H._expanded=null),_)return H.setAllChildrenCount(0),H.updateHasChildren(),H;let E=H.sibling;if(E)U(E);return H.dispatchRowEvent("hasChildrenChanged"),H}getChildrenMappedKey(z,J){return J?J.getId()+"-"+z:z}onShowRowGroupColsSetChanged(){let{rowModel:z,valueSvc:J}=this.beans;for(let Z of this.nonLeafsById.values()){Z._groupData=void 0;let $=Z.rowGroupColumn,X=$&&$2(Z);Z.groupValue=X&&J.getValue($,X,"data")}let Q=z.rootNode?._leafs;if(Q)for(let Z=0,$=Q.length;Z<$;++Z){let X=Q[Z];X.parent._groupData=void 0}}},DY=(z)=>{for(let J of z){let Q=J?.childrenAfterGroup;if(!Q)continue;let Z=Q.length,$=0;for(let X=0;X{while(z._leafs!==void 0){let J=z.parent;if(!J)break;z._leafs=void 0,z=J}};function fP(z,J){z.rowGroupColsSvc?.setColumns(J,"api")}function VP(z,J){z.rowGroupColsSvc?.removeColumns(J,"api")}function SP(z,J){z.rowGroupColsSvc?.addColumns(J,"api")}function AP(z,J,Q){z.rowGroupColsSvc?.moveColumn?.(J,Q,"api")}function RP(z){return z.rowGroupColsSvc?.columns??[]}var Cq={moduleName:"SharedRowGrouping",version:$0,apiFunctions:{setRowGroupColumns:fP,removeRowGroupColumns:VP,addRowGroupColumns:SP,getRowGroupColumns:RP,moveRowGroupColumn:AP},dependsOn:[C0,Rq,HP,Iq,FP]},jP={moduleName:"RowGrouping",version:$0,dynamicBeans:{groupStrategy:kP},rowModels:["clientSide"],dependsOn:[Cq,xO,nJ,_P]};function OP(z,J){z.clipboardSvc?.copyToClipboard(J)}function PP(z,J){z.clipboardSvc?.cutToClipboard(J)}function TP(z,J){z.clipboardSvc?.copySelectedRowsToClipboard(J)}function vP(z,J){z.clipboardSvc?.copySelectedRangeToClipboard(J)}function IP(z){z.clipboardSvc?.copyRangeDown()}function CP(z){z.clipboardSvc?.pasteFromClipboard()}var TJ="paste",c5="dragCopy",p5="clipboard";function bP(z,J=","){let Q=[],Z=(X)=>X==="\r"||X===` +`,$=!1;if(z==="")return[[""]];for(let X=0,Y=0,q=0;q{if(!Q[X])Q[X]=[];if(!Q[X][Y])Q[X][Y]=""};if(U(),H==='"'){if($)if(_==='"')Q[X][Y]+='"',q++;else $=!1;else if(G===void 0||G===J||Z(G))$=!0}if(!$&&H!=='"'){if(H===J){Y++,U();continue}else if(Z(H)){if(Y=0,X++,U(),H==="\r"&&_===` +`)q++;continue}}Q[X][Y]+=H}return Q}var yP=class extends V{constructor(){super(...arguments);this.beanName="clipboardSvc",this.clientSideRowModel=null,this.gridCtrl=null,this.lastPasteOperationTime=0,this.navigatorApiFailed=!1}postConstruct(){let{gos:z,rowModel:J,ctrlsSvc:Q}=this.beans;if(o(z,J))this.clientSideRowModel=J;Q.whenReady(this,(Z)=>{this.gridCtrl=Z.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((J)=>{R(40,{e:J,method:"readText"}),this.navigatorApiFailed=!0,this.pasteFromClipboardLegacy()});else this.pasteFromClipboardLegacy()}pasteFromClipboardLegacy(){let z=!1,J=(Q)=>{let Z=Date.now();if(Z-this.lastPasteOperationTime<50)z=!0,Q.preventDefault();this.lastPasteOperationTime=Z};this.executeOnTempElement((Q)=>{Q.addEventListener("paste",J),Q.focus({preventScroll:!0})},(Q)=>{let Z=Q.value;if(!z)this.processClipboardData(Z);else this.refocusLastFocusedCell();Q.removeEventListener("paste",J)})}refocusLastFocusedCell(){let{focusSvc:z}=this.beans,J=z.getFocusedCell();if(J)z.setFocusedCell({rowIndex:J.rowIndex,column:J.column,rowPinned:J.rowPinned,forceBrowserFocus:!0})}getClipboardDelimiter(){let z=this.gos.get("clipboardDelimiter");return T(z)?z:"\t"}processClipboardData(z){if(z==null)return;let J=bP(z,this.getClipboardDelimiter()),Q=this.gos.getCallback("processDataFromClipboard");if(Q)J=Q({data:J});if(J==null)return;if(this.gos.get("suppressLastEmptyLineOnPaste"))this.removeLastLineIfBlank(J);let{rangeSvc:Z,editSvc:$}=this.beans,X=(Y,q,G,H)=>{if(Z?.isMoreThanOneCell()&&!this.hasOnlyOneValueToPaste(J))this.pasteIntoActiveRange(J,Y,q,H);else this.pasteStartingFromFocusedCell(J,Y,q,G,H);$?.stopEditing(void 0,{source:TJ})};this.doPasteOperation(X)}doPasteOperation(z){let{eventSvc:Q,focusSvc:Z,rowRenderer:$,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=Z.getFocusedCell();z(H,_,U,G);let W=_.slice();if(G)Y.doAggregate(G),j0(q,Y.hierarchical,G,(B)=>{W.push(B)});$.refreshCells({rowNodes:W}),this.dispatchFlashCells(H),this.fireRowChanged(_),this.refocusLastFocusedCell(),Q.dispatchEvent({type:"pasteEnd",source:"clipboard"})}getPreProcessRangeCallback(z){return(J)=>{let{rangeSvc:Q}=this.beans;if(!Q)return;let{rowDiff:Z,colDiff:$}=this.getAdjustedRangeDimensionForPaste(J,z);if(Z!==0)Q.extendRangeRowCountBy(J,Z);if($!==0)Q.extendRangeColumnCountBy(J,$)}}getAdjustedRangeDimensionForPaste(z,J){let Q=this.beans.rangeSvc,Z=J.length,$=Q.getRangeRowCount(z),X=$>=Z&&$%Z===0,Y=J[0].length,q=z.columns.length,G=q>=Y&&q%Y===0;return{rowDiff:X?0:Z-$,colDiff:G?0:Y-q}}pasteIntoActiveRange(z,J,Q,Z){let $=0,X=0,Y=(q,G,H,_)=>{if(_-$>=z.length){if(_%z.length!==0)return;$+=X,X=0}let W=z[_-$];Q.push(G);let B=this.gos.getCallback("processCellFromClipboard"),E=H.columns,K=E.findIndex(m4);if(K!==-1)E.splice(K,1);for(let F=0;F=W.length)D=F%W.length;let M=this.processCell(G,L,W[D],c5,B,!0);G.setDataValue(L,M,TJ),Z?.addCell(G.parent,L.getId());let{rowIndex:f,rowPinned:S}=q,A=p4({rowIndex:f,column:L,rowPinned:S});J[A]=!0}X++};this.iterateActiveRanges(Y,!1,this.getPreProcessRangeCallback(z))}getDisplayedColumnsStartingAt(z){let J=z,Q=[],{visibleCols:Z}=this.beans;while(J&&x6(J))J=Z.getColAfter(J);while(J!=null)Q.push(J),J=Z.getColAfter(J);return Q}pasteStartingFromFocusedCell(z,J,Q,Z,$){if(!Z)return;let X={rowIndex:Z.rowIndex,rowPinned:Z.rowPinned},Y=this.getDisplayedColumnsStartingAt(Z.column);if(this.isPasteSingleValueIntoRange(z))this.pasteSingleValueIntoRange(z,Q,J,$);else this.pasteMultipleValues(z,X,Q,Y,J,p5,$)}isPasteSingleValueIntoRange(z){let J=this.beans.rangeSvc;return this.hasOnlyOneValueToPaste(z)&&!!J&&!J.isEmpty()}pasteSingleValueIntoRange(z,J,Q,Z){let $=z[0][0],X=(Y,q,G)=>{J.push(q),G.columns.forEach((H)=>this.updateCellValue(q,H,$,Q,p5,Z))};this.iterateActiveRanges(X)}hasOnlyOneValueToPaste(z){return z.length===1&&z[0].length===1}copyRangeDown(){let{rangeSvc:z,gos:J,formula:Q,valueSvc:Z}=this.beans;if(!z||z.isEmpty())return;let $=[],X=(Y,q,G,H)=>{let _=J.getCallback("processCellForClipboard"),U=J.getCallback("processCellFromClipboard"),W=(B,E,K)=>{let{columns:F}=K;if(!$.length)F.forEach((L)=>{let D=this.processCell(E,L,Z.getValue(L,E,"batch"),c5,_,!1,!0);$.push(D)});else q.push(E),F.forEach((L,D)=>{if(!L.isCellEditable(E)||L.isSuppressPaste(E))return;if(L.isAllowFormula()&&Q?.isFormula($[D]))$[D]=Q?.updateFormulaByOffset({value:$[D],rowDelta:1});let f=this.processCell(E,L,$[D],c5,U,!0);E.setDataValue(L,f,TJ),H?.addCell(E.parent,L.getId());let{rowIndex:S,rowPinned:A}=B,O=p4({rowIndex:S,column:L,rowPinned:A});Y[O]=!0})};this.iterateActiveRanges(W,!0)};this.doPasteOperation(X)}removeLastLineIfBlank(z){let J=b(z);if(J&&J.length===1&&J[0]===""){if(z.length===1)return;X0(z,J)}}fireRowChanged(z){if(this.gos.get("editType")!=="fullRow")return;for(let J of z)this.eventSvc.dispatchEvent({type:"rowValueChanged",node:J,data:J.data,rowIndex:J.rowIndex,rowPinned:J.rowPinned})}shouldSkipPasteRow(z,J,Q){if(z.detail||z.footer)return!0;if(Q&&z.group){for(let Z of J)if(Z.isCellEditable(z))return!1;return!0}return!1}pasteMultipleValues(z,J,Q,Z,$,X,Y){let q=J,G=this.beans,{gos:H}=G,_=this.clientSideRowModel!=null&&!H.get("enableGroupEdit")&&!H.get("treeData"),U=()=>{while(q){let W=f0(G,q);if(q=L0(G,{rowPinned:q.rowPinned,rowIndex:q.rowIndex}),W!=null&&!this.shouldSkipPasteRow(W,Z,_))return W}return null};for(let W of z){let B=U();if(!B)continue;W.forEach((E,K)=>this.updateCellValue(B,Z[K],E,$,X,Y)),Q.push(B)}}updateCellValue(z,J,Q,Z,$,X){if(!z||!J?.isCellEditable(z)||J?.isSuppressPaste(z))return;let Y=this.processCell(z,J,Q,$,this.gos.getCallback("processCellFromClipboard"),!0);z.setDataValue(J,Y,TJ);let{rowIndex:q,rowPinned:G}=z,H=p4({rowIndex:q,column:J,rowPinned:G});Z[H]=!0,X?.addCell(z.parent,J.getId())}copyToClipboard(z={}){this.copyOrCutToClipboard(z)}cutToClipboard(z={},J="api"){if(this.gos.get("suppressCutToClipboard"))return;this.eventSvc.dispatchEvent({type:"cutStart",source:J}),this.copyOrCutToClipboard(z,!0),this.eventSvc.dispatchEvent({type:"cutEnd",source:J})}copyOrCutToClipboard(z,J){let{includeHeaders:Q,includeGroupHeaders:Z}=z,{gos:$,focusSvc:X}=this.beans;if(Q==null)Q=$.get("copyHeadersToClipboard");if(Z==null)Z=$.get("copyGroupHeadersToClipboard");let Y={includeHeaders:Q,includeGroupHeaders:Z},q=$.get("rowSelection"),G=$.get("cellSelection"),H=null;if(this.shouldCopyCells(G,q))this.copySelectedRangeToClipboard(Y),H=0;else if(this.shouldCopyRows(q))this.copySelectedRowsToClipboard(Y),H=1;else if(X.isAnyCellFocused())this.copyFocusedCellToClipboard(Y),H=2;if(J&&H!==null)this.clearCellsAfterCopy(H)}shouldCopyCells(z,J){let{rangeSvc:Q,selectionSvc:Z,gos:$}=this.beans;if(!Q||Q.isEmpty())return!1;if(z)return!(typeof J==="object"&&J.copySelectedRows&&!Z?.isEmpty());else{let X=$.get("suppressCopySingleCellRanges");return!(!Q.isMoreThanOneCell()&&X)}}shouldCopyRows(z){let{selectionSvc:J,gos:Q}=this.beans;if(J?.isEmpty()??!0)return!1;if(z&&typeof z!=="string")return z.copySelectedRows??!1;else return!Q.get("suppressCopyRowsToClipboard")}clearCellsAfterCopy(z){let J=this.beans,{rangeSvc:Q,focusSvc:Z,eventSvc:$}=J;if($.dispatchEvent({type:"keyShortcutChangedCellStart"}),z===0)Q.clearCellRangeCellValues({cellEventSource:"clipboardSvc"});else if(z===1)this.clearSelectedRows();else{let X=Z.getFocusedCell();if(X==null)return;let Y=f0(J,X);if(Y)this.clearCellValue(Y,X.column)}$.dispatchEvent({type:"keyShortcutChangedCellEnd"})}clearSelectedRows(){let{selectionSvc:z,visibleCols:J}=this.beans,Q=z?.getSelectedNodes()??[],Z=J.allCols;for(let $ of Q)for(let X of Z)this.clearCellValue($,X)}clearCellValue(z,J){if(!J.isCellEditable(z))return;let Q=this.beans.valueSvc.getDeleteValue(J,z);z.setDataValue(J,Q,"clipboardSvc")}iterateActiveRanges(z,J,Q){let Z=this.beans.rangeSvc;if(!Z||Z.isEmpty())return;let $=Z.getCellRanges(),X=J?[$[0]]:$;for(let Y of X)this.iterateActiveRange({cellRange:Y,rowCallback:z,preProcessRange:Q})}iterateActiveRange(z){let{cellRange:J,preProcessRange:Q,rowCallback:Z}=z,{beans:$}=this,{rangeSvc:X}=$;if(!X)return;if(Q)Q(J);let Y=X.getRangeStartRow(J),q=X.getRangeEndRow(J),G=0,H=!1;while(!H&&Y!=null){let _=f0($,Y);H=a(Y,q),Z(Y,_,J,G++),Y=L0($,Y)}}copySelectedRangeToClipboard(z={}){let J=this.beans.rangeSvc;if(!J||J.isEmpty())return;let Q=J.areAllRangesAbleToMerge(),{data:Z,cellsToFlash:$}=Q?this.buildDataFromMergedRanges(J,z):this.buildDataFromRanges(J,z);this.copyDataToClipboard(Z),this.dispatchFlashCells($)}buildDataFromMergedRanges(z,J){let Q=new Set,Z=z.getCellRanges(),$=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 Z){W.columns.forEach((K)=>Q.add(K));let{rowPositions:B,cellsToFlash:E}=this.getRangeRowPositionsAndCellsToFlash(z,W);for(let K of B){let F=G.has(K.rowIndex);if(!q&&!F)continue;let L=`${K.rowIndex}-${K.rowPinned||"null"}`;if(!$.get(L))$.set(L,!0),X.push(K)}Object.assign(Y,E)}let H=this.beans.visibleCols.allCols,_=Array.from(Q);return _.sort((W,B)=>{let E=H.indexOf(W),K=H.indexOf(B);return E-K}),{data:this.buildExportParams({columns:_,rowPositions:X,includeHeaders:J.includeHeaders,includeGroupHeaders:J.includeGroupHeaders}),cellsToFlash:Y}}buildDataFromRanges(z,J){let Q=z.getCellRanges(),Z=[],$={};for(let X of Q){let{rowPositions:Y,cellsToFlash:q}=this.getRangeRowPositionsAndCellsToFlash(z,X);Object.assign($,q),Z.push(this.buildExportParams({columns:X.columns,rowPositions:Y,includeHeaders:J.includeHeaders,includeGroupHeaders:J.includeGroupHeaders}))}return{data:Z.join(` +`),cellsToFlash:$}}getRangeRowPositionsAndCellsToFlash(z,J){let Q=[],Z={},$=z.getRangeStartRow(J),X=z.getRangeEndRow(J),Y=$;while(Y){Q.push(Y);for(let q of J.columns){let{rowIndex:G,rowPinned:H}=Y,_=p4({rowIndex:G,column:q,rowPinned:H});Z[_]=!0}if(a(Y,X))break;Y=L0(this.beans,Y)}return{rowPositions:Q,cellsToFlash:Z}}getCellsToFlashFromRowNodes(z){let J=this.beans.visibleCols.allCols,Q={};for(let Z=0;Z{let{value:U,valueFormatted:W}=this.beans.valueSvc.getValueForDisplay({column:_,node:H,includeValueFormatted:!0,from:"batch"}),B=W??U??"",E=X.getCallback("processCellForClipboard");if(!E)return B;return E({column:_,node:H,value:B,type:p5,formatValue:(K)=>this.beans.valueSvc.formatValue(_,H,K)??K,parseValue:(K)=>this.beans.valueSvc.parseValue(_,H,K,U)??K})},G={columnKeys:J,rowPositions:Q,skipColumnHeaders:!Z,skipColumnGroupHeaders:!$,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(z){window.setTimeout(()=>{this.eventSvc.dispatchEvent({type:"flashCells",cells:z})},0)}processCell(z,J,Q,Z,$,X,Y){let{valueSvc:q,formula:G}=this.beans;if($)return $({column:J,node:z,value:Q,type:Z,formatValue:(_)=>q.formatValue(J,z??null,_)??_,parseValue:(_)=>q.parseValue(J,z??null,_,q.getValue(J,z,"edit"))});if(X&&J.getColDef().useValueParserForImport!==!1)return q.parseValue(J,z??null,Q,q.getValue(J,z,"edit"));if(Y&&J.getColDef().useValueFormatterForExport!==!1){if(G?.isFormula(Q))return Q;return q.formatValue(J,z??null,Q)??Q}return Q}copyDataToClipboard(z){let J=this.gos.getCallback("sendToClipboard");if(J){J({data:z});return}if(!this.gos.get("suppressClipboardApi")&&navigator.clipboard){navigator.clipboard.writeText(z).catch((Z)=>{R(40,{e:Z,method:"writeText"}),this.copyDataToClipboardLegacy(z)});return}this.copyDataToClipboardLegacy(z)}copyDataToClipboardLegacy(z){this.executeOnTempElement((J)=>{let Q=Y0(this.beans),Z=d(this.beans);if(J.value=z||" ",J.select(),J.focus({preventScroll:!0}),!Q.execCommand("copy"))R(41);if(Z?.focus!=null)Z.focus({preventScroll:!0})})}executeOnTempElement(z,J){if(!this.gridCtrl)return;let Q=Y0(this.beans),Z=Q.createElement("textarea"),$=Z.style;$.width="1px",$.height="1px";let X=Q.documentElement;$.top=X.scrollTop+"px",$.left=X.scrollLeft+"px",$.position="absolute",$.opacity="0",this.gridCtrl.getGui().appendChild(Z);try{z(Z)}catch(q){R(42)}if(J)window.setTimeout(()=>{J(Z),Z.remove()},100);else Z.remove()}},bq={moduleName:"Clipboard",version:$0,beans:[yP],apiFunctions:{copyToClipboard:OP,cutToClipboard:PP,copySelectedRowsToClipboard:TP,copySelectedRangeToClipboard:vP,copySelectedRangeDown:IP,pasteFromClipboard:CP},dependsOn:[C0,o$,X2,yX]};var yq=class extends V{constructor(){super(...arguments);this.loadRowDataVersion=0}wireBeans(z){this.environment=z.environment}init(z,J){if(this.params=J,this.comp=z,J.pinned!=null)return;this.setAutoHeightClasses(),this.setupRefreshStrategy(),this.createDetailGrid(),this.loadRowData(),this.addManagedEventListeners({fullWidthRowFocused:this.onFullWidthRowFocused.bind(this)})}onFullWidthRowFocused(z){let J=this.params,Q={rowIndex:J.node.rowIndex,rowPinned:J.node.rowPinned},Z={rowIndex:z.rowIndex,rowPinned:z.rowPinned};if(!a(Q,Z))return;k0(this.comp.getGui(),z.fromBelow)}setAutoHeightClasses(){let z=this.gos.get("detailRowAutoHeight"),J=z?"ag-details-row-auto-height":"ag-details-row-fixed-height",Q=z?"ag-details-grid-auto-height":"ag-details-grid-fixed-height",Z=this.comp;Z.toggleCss(J,!0),Z.toggleDetailGridCss(Q,!0)}setupRefreshStrategy(){let z=this.params.refreshStrategy;if(z=="everything"||z=="nothing"||z=="rows"){this.refreshStrategy=z;return}if(z!=null)R(170,{providedStrategy:z});this.refreshStrategy="rows"}createDetailGrid(){let{params:z,gos:J}=this;if(n(z.detailGridOptions)){R(171);return}let Q=J.get("theme"),Z=z.detailGridOptions.theme;if(Z&&Z!==Q)R(267);let $={themeStyleContainer:this.environment.eStyleContainer,...z.detailGridOptions,theme:Q};if(J.get("detailRowAutoHeight"))$.domLayout="autoHeight";this.comp.setDetailGrid($)}registerDetailWithMaster(z){let{params:J,beans:{selectionSvc:Q,findSvc:Z,expansionSvc:$}}=this,X=J.node.id,Y=J.api,q={id:X,api:z},G=J.node;if(Y.isDestroyed())return;Y.addDetailGridInfo(X,q),G.detailGridInfo=q;let H=G.parent;Z?.registerDetailGrid(G,z);function _(){if(H)Q?.refreshMasterNodeState(H)}function U({source:B}){if(B==="expandAll")return z.expandAll();if(B==="collapseAll")return z.collapseAll()}function W({node:B,source:E}){if(B!==H||E==="masterDetail"||z.isDestroyed())return;Q?.setDetailSelectionState(H,J.detailGridOptions,z)}z.addEventListener("firstDataRendered",()=>{if(z.isDestroyed()||Y.isDestroyed())return;Q?.setDetailSelectionState(H,J.detailGridOptions,z),z.addEventListener("selectionChanged",_),Y.addEventListener("rowSelected",W);let E=`${"CsrmSsrmSharedApi"}Module`;if(z.isModuleRegistered(E))Y.addEventListener("expandOrCollapseAll",U),$?.setDetailsExpansionState(z)}),this.addManagedListeners(H,{masterChanged:(B)=>{if(!B.node.master)this.onDestroy(q)}}),this.addDestroyFunc(()=>this.onDestroy(q))}onDestroy(z){let{params:J}=this,Q=J.node,Z=J.api;if(Q.detailGridInfo!==z)return;if(!Z.isDestroyed())Z.removeDetailGridInfo(Q.id);Q.detailGridInfo=null}loadRowData(){this.loadRowDataVersion++;let z=this.loadRowDataVersion,J=this.params;if(J.detailGridOptions?.rowModelType==="serverSide"){J.node.detailGridInfo?.api?.refreshServerSide({purge:!0});return}let Q=J.getDetailRowData;if(!Q){R(172);return}let Z=(X)=>{if(this.loadRowDataVersion===z)this.comp.setRowData(X)},$={node:J.node,data:J.node.data,successCallback:Z,context:C(this.gos,{}).context};Q($)}refresh(){switch(this.refreshStrategy){case"nothing":return!0;case"everything":return!1}return this.loadRowData(),!0}},xP=class{constructor(z){this.parentWrapper=z}wrap(z,J,Q,Z){return this.parentWrapper.wrap(z,J,Q,Z)}},wP={tag:"div",cls:"ag-details-row"},NP={tag:"div",cls:"ag-details-row",role:"gridcell",children:[{tag:"div",ref:"eDetailGrid",cls:"ag-details-grid",role:"presentation"}]},gP=class extends y{constructor(){super(...arguments);this.eDetailGrid=j}wireBeans(z){this.context=z.context}init(z){this.params=z,this.selectAndSetTemplate();let J={toggleCss:(Q,Z)=>this.toggleCss(Q,Z),toggleDetailGridCss:(Q,Z)=>this.eDetailGrid.classList.toggle(Q,Z),setDetailGrid:(Q)=>this.setDetailGrid(Q),setRowData:(Q)=>this.setRowData(Q),getGui:()=>this.eDetailGrid};this.ctrl=this.createManagedBean(new yq),this.ctrl.init(J,z)}refresh(){return this.ctrl?.refresh()??!1}selectAndSetTemplate(){let z=this.params;if(z.pinned){this.setTemplate(wP);return}let J=()=>{this.setTemplate(NP)};if(n(z.template))J();else if(typeof z.template==="string")this.setTemplate(z.template,[]);else if(typeof z.template==="function"){let Q=z.template,Z=Q(z);this.setTemplate(Z,[])}else R(168),J();if(this.eDetailGrid==null)R(169)}setDetailGrid(z){if(!this.eDetailGrid)return;let J=this.context.getBean("frameworkCompWrapper"),Q=new xP(J),{frameworkOverrides:Z}=this.beans,$=MJ(this.eDetailGrid,z,{frameworkOverrides:Z,providedBeanInstances:{frameworkCompWrapper:Q},modules:d8(this.params.api.getGridId(),z.rowModelType??"clientSide")});this.detailApi=$,this.ctrl?.registerDetailWithMaster($),this.addDestroyFunc(()=>{$.destroy()})}setRowData(z){this.detailApi?.setGridOption("rowData",z)}};function tJ(z,J){let Q=z.masterDetailSvc?.store;return Q?J(Q):void 0}function hP(z,J,Q){tJ(z,(Z)=>{Z[J]=Q})}function uP(z,J){tJ(z,(Q)=>{delete Q[J]})}function mP(z,J){return tJ(z,(Q)=>Q[J])}function cP(z,J){tJ(z,(Q)=>{let Z=0;Object.values(Q).forEach(($)=>{if($)J($,Z++)})})}var pP=".ag-details-row{width:100%}.ag-details-row-fixed-height{height:100%}.ag-details-grid{width:100%}.ag-details-grid-fixed-height{height:100%}",iP=class extends V{constructor(){super(...arguments);this.beanName="masterDetailSvc",this.store={}}isEnabled(){return this.gos.get("masterDetail")}postConstruct(){let z=this.gos;if(o(z))this.enabled=this.isEnabled();if(V1(z))this.addEventListeners()}addEventListeners(){let z=(Z)=>{this.setMaster(Z.node,!1,!0)},J,Q=()=>{if(J){for(let Z of J)Z();J=void 0}if(this.isEnabled())J=this.addManagedListeners(this.beans.eventSvc,{rowNodeDataChanged:z})};Q(),this.gos.addPropertyEventListener("masterDetail",Q)}refreshModel(z){if(z.changedProps){let J=this.isEnabled();if(this.enabled!==J){this.setMasters(null);return}}if(z.rowDataUpdated)this.setMasters(z.changedRowNodes)}setMaster(z,J,Q){let Z=z.master,$=this.isEnabled(),X=$,Y=this.gos,q=Y.get("isRowMaster"),G=Y.get("treeData");if($)if(J||Q){if(q){let H=z.data;X=!!H&&!!q(H)}}else X=Z;if(!G){if(X&&J||!X&&Z)z._expanded??(z._expanded=null)}if(X!==Z)z.master=X,z.dispatchRowEvent("masterChanged")}setMasters(z){if(this.enabled=this.isEnabled(),z){for(let J of z.updates)this.setMaster(J,!1,!0);for(let J of z.adds)this.setMaster(J,!0,!1)}else{let J=xZ(this.beans)?.rootNode?._leafs;if(J)for(let Q=0,Z=J.length;Q{let Y=J.clientHeight;if(Y!=null&&Y>0){let q=()=>{let{rowModel:G}=this.beans,{rowNode:H}=z;if(H.setRowHeight(Y),o(Q,G)||V1(Q,G))G.onRowHeightChanged()};window.setTimeout(q,0)}},X=P4(Z,J,$);z.addDestroyFunc(X),$()}destroy(){this.store={},super.destroy()}},dP={moduleName:"SharedMasterDetail",version:$0,beans:[iP],userComponents:{agDetailCellRenderer:gP},dynamicBeans:{detailCellRendererCtrl:yq},apiFunctions:{addDetailGridInfo:hP,removeDetailGridInfo:uP,getDetailGridInfo:mP,forEachDetailGridInfo:cP},dependsOn:[C0,Tq,Iq],css:[pP]},xq={moduleName:"MasterDetail",version:$0,dependsOn:[dP,nJ,bX]},wq=class extends y{constructor(){super(...arguments);this.changedCalculatedValues=!1,this.dragging=!1,this.shouldDestroyOnEndDragging=!1}postConstruct(){this.beans.dragSvc.addDragSource({dragStartPixels:0,eElement:this.getGui(),onDragging:(z)=>{let J=!1;if(!this.dragging)J=!0,this.dragging=!0,m2(this.beans).classList?.add(this.getDraggingCssClass());if(this.updateValuesOnMove(z),J){this.changedCalculatedValues=!1;return}if(this.beans.rangeSvc.autoScrollService.check(z),this.changedCalculatedValues)this.onDrag(z),this.changedCalculatedValues=!1},onDragStop:(z)=>{this.dragging=!1,this.onDragEnd(z),this.clearDragProperties()},onDragCancel:()=>{this.dragging=!1,this.onDragCancel(),this.clearDragProperties()}}),this.addManagedEventListeners({cellSelectionChanged:this.updateLocalRangeIfNeeded.bind(this)}),this.addManagedElementListeners(this.getGui(),{pointerdown:MY,mousedown:MY})}getLastCellHovered(){return this.lastCellHovered}getDraggingCssClass(){return`ag-dragging-${this.type===0?"fill":"range"}-handle`}updateValuesOnMove(z){let J=rZ(this.gos,z);if(!J||this.shouldSkipCell(J)||this.lastCellHovered&&t2(J,this.lastCellHovered))return;this.lastCellHovered=J,this.changedCalculatedValues=!0}clearDragProperties(){if(this.clearValues(),this.beans.rangeSvc.autoScrollService.ensureCleared(),m2(this.beans).classList?.remove(this.getDraggingCssClass()),this.shouldDestroyOnEndDragging)this.destroy()}getType(){return this.type}refresh(z,J){let Q=this.cellCtrl,Z=this.getGui(),$=J??b(this.beans.rangeSvc.getCellRanges()),X=$.startRow,Y=$.endRow;if(X&&Y)if(U0(Y,X))this.rangeStartRow=Y,this.rangeEndRow=X;else this.rangeStartRow=X,this.rangeEndRow=Y;if(Q!==z||!M0(Z)){this.cellCtrl=z;let q=z.comp.getParentOfValue();if(q)q.appendChild(Z)}this.cellRange=$}clearValues(){this.lastCellHovered=void 0}destroy(){if(!this.shouldDestroyOnEndDragging&&this.dragging){w(this.getGui(),!1),this.shouldDestroyOnEndDragging=!0;return}this.shouldDestroyOnEndDragging=!1,super.destroy(),this.getGui()?.remove()}updateLocalRangeIfNeeded(z){if(!this.cellRange)return;let{id:J,type:Q}=this.cellRange;if(!J||J!==z.id)return;let Z=this.beans.rangeSvc?.getCellRanges().find(($)=>$.id===J&&$.type===Q);if(Z&&Z!==this.cellRange)this.cellRange=Z}},MY=(z)=>{z.stopPropagation()};function nP(z){let J=z.length,Q=0;if(J<=1)return z;for(let U=0;U1){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 Z=0,$=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(z){return b0(z.column)}onDrag(z){if(!this.initialPosition){let Q=this.cellCtrl;if(!Q)return;this.initialPosition=Q.cellPosition}let J=this.getLastCellHovered();if(J)this.markPathFrom(this.initialPosition,J)}onDragEnd(z){if(this.initialXY=null,!this.markedCells.length)return;let J=this.dragAxis==="x",{cellRange:Q,rangeStartRow:Z,rangeEndRow:$,beans:{rangeSvc:X}}=this,Y=Q.columns.length,q;if(!this.isUp&&!this.isLeft)q=X.createCellRangeFromCellRangeParams({rowStartIndex:Z.rowIndex,rowStartPinned:Z.rowPinned,columnStart:Q.columns[0],rowEndIndex:J?$.rowIndex:this.lastCellMarked.rowIndex,rowEndPinned:J?$.rowPinned:this.lastCellMarked.rowPinned,columnEnd:J?this.lastCellMarked.column:Q.columns[Y-1]});else{let G=J?Z:this.lastCellMarked;q=X.createCellRangeFromCellRangeParams({rowStartIndex:G.rowIndex,rowStartPinned:G.rowPinned,columnStart:J?this.lastCellMarked.column:Q.columns[0],rowEndIndex:$.rowIndex,rowEndPinned:$.rowPinned,columnEnd:Q.columns[Y-1]})}if(q)this.performFill({event:z,initialRange:Q,finalRange:q,shouldUpdateRange:!0})}onDragCancel(){if(this.initialXY=null,!this.markedCells.length)return;this.clearMarkedPath()}performFill({event:z,initialRange:J,finalRange:Q,shouldUpdateRange:Z}){let{eventSvc:$,rangeSvc:X}=this.beans;if($.dispatchEvent({type:"fillStart"}),this.handleValueChanged(J,Q,z),Z)X.setCellRanges([Q]);$.dispatchEvent({type:"fillEnd",initialRange:J,finalRange:Q})}getFillHandleDirection(){let z=XJ(this.gos)?.direction;if(!z)return"xy";if(z!=="x"&&z!=="y"&&z!=="xy")return R(177),"xy";return z}handleValueChanged(z,J,Q){let{beans:Z}=this,{rangeSvc:$,gos:X,valueSvc:Y}=Z,q=$.getRangeEndRow(z),G=$.getRangeStartRow(z),H=$.getRangeEndRow(J),_=$.getRangeStartRow(J),U=this.dragAxis==="y";if(this.isReduce&&!XJ(X)?.suppressClearOnFillReduction){let A=U?z.columns:z.columns.filter((v)=>J.columns.indexOf(v)<0),O=U?L0(Z,H):_;if(O)this.clearCellsInRange(O,q,A);return}let W=[],B=[],E=[],K=[],F=!0,L=0,D=()=>{W.length=0,B.length=0,E.length=0,K.length=0,L=0},M=(A,O)=>{let v=this.isUp?q:G,I=!1;if(U)F=!0,D();while(!I&&v){let x=f0(Z,v);if(!x)break;if(U&&A)f(W,A,x,()=>!a(v,this.isUp?G:q));else if(O){F=!0,D();for(let m of O)f(W,m,x,()=>m!==(this.isLeft?z.columns[0]:b(z.columns)))}I=a(v,this.isUp?_:H),v=this.isUp?n0(this.beans,v):L0(Z,v)}},f=(A,O,v,I)=>{let x,m=!1;if(F)x=Y.getValue(O,v,"edit"),B.push(x),E.push(Y.getValue(O,v,"edit",!0)),K.push(Y.getValueForDisplay({column:O,node:v,from:"edit"}).valueFormatted),F=I();else{let{value:g,fromUserFunction:e,sourceCol:r,sourceRowNode:u}=this.processValues({event:Q,values:A,initialValues:B,initialNonAggregatedValues:E,initialFormattedValues:K,col:O,rowNode:v,idx:L++});if(x=g,O.isCellEditable(v)){let Q0=Y.getValue(O,v,"edit");if(!e){if(r){let s=r.getColDef();if(s.useValueFormatterForExport!==!1&&s.valueFormatter){let T0=Y.getValueForDisplay({column:r,node:u,includeValueFormatted:!0,from:"edit"}).valueFormatted;if(T0!=null)x=T0}}if(O.getColDef().useValueParserForImport!==!1)x=Y.parseValue(O,v,r?x:i0(x),Q0)}if(!e||Q0!==x)v.setDataValue(O,x,"rangeSvc");else m=!0}}if(!m)A.push({value:x,column:O,rowNode:v})},{changeDetectionSvc:S}=this.beans;S?.beginDeferred();try{if(U)z.columns.forEach((A)=>{M(A)});else{let A=this.isLeft?[...J.columns].reverse():J.columns;M(void 0,A)}this.beans.editSvc?.stopEditing(void 0,{source:"fillHandle"})}finally{S?.endDeferred()}}clearCellsInRange(z,J,Q){let Z={startRow:z,endRow:J,columns:Q,startColumn:Q[0]};this.beans.rangeSvc.clearCellRangeCellValues({cellRanges:[Z],restoreSourceInBatch:!0})}processValues(z){let{formula:J,valueSvc:Q}=this.beans,{event:Z,values:$,initialValues:X,initialNonAggregatedValues:Y,initialFormattedValues:q,col:G,rowNode:H,idx:_}=z,U=XJ(this.gos)?.setFillValue,W=this.dragAxis==="y",B;if(W)B=this.isUp?"up":"down";else B=this.isLeft?"left":"right";if(U){let F=C(this.gos,{event:Z,values:$.map(({value:D})=>D),initialValues:X,initialNonAggregatedValues:Y,initialFormattedValues:q,currentIndex:_,currentCellValue:Q.getValue(G,H,"edit"),direction:B,column:G,rowNode:H}),L=U(F);if(L!==!1)return{value:L,fromUserFunction:!0}}let E=(F)=>typeof F==="number"&&Number.isFinite(F)||typeof F==="string"&&/^[+-]?\d+(?:\.\d+)?$/.test(F.trim()),K=$.every(({value:F})=>E(F));if(Z.altKey||!K){let F=String(b($)?.value??"");if(K&&X.length===1){let A=this.isUp||this.isLeft?-1:1;return{value:parseFloat(F)+1*A,fromUserFunction:!1}}let{value:L,column:D,rowNode:M}=$[_%$.length],f,S=D.isAllowFormula()&&J?.isFormula(F);if(S){let A=B==="up"?-1:B==="down"?1:0,O=B==="left"?-1:B==="right"?1:0;f=J.updateFormulaByOffset({value:F,rowDelta:A,columnDelta:O})}else f=L;return{value:f,fromUserFunction:!1,sourceCol:S?void 0:D,sourceRowNode:M}}return{value:b(nP($.map(({value:F})=>Number(F)))),fromUserFunction:!1}}clearValues(){this.clearMarkedPath(),this.clearCellValues(),this.lastCellMarked=void 0,super.clearValues()}clearMarkedPath(){for(let z of this.markedCells){if(!z.isAlive())continue;let{comp:J}=z;J.toggleCss("ag-selection-fill-top",!1),J.toggleCss("ag-selection-fill-right",!1),J.toggleCss("ag-selection-fill-bottom",!1),J.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,J){if(this.clearMarkedPath(),this.clearCellValues(),this.dragAxis==="y"){if(a(J,z))return;let Q=U0(J,z),{rangeStartRow:Z,rangeEndRow:$}=this;if(Q&&(J.rowPinned==Z.rowPinned&&J.rowIndex>=Z.rowIndex||Z.rowPinned!=$.rowPinned&&J.rowPinned==$.rowPinned&&J.rowIndex<=$.rowIndex))this.reduceVertical(z,J),this.isReduce=!0;else this.extendVertical(z,J,Q),this.isReduce=!1}else{let Q=z.column,Z=J.column;if(Q===Z)return;let $=this.beans.visibleCols.allCols,X=$.indexOf(Q),Y=$.indexOf(Z);if(Y<=X&&Y>=$.indexOf(this.cellRange.columns[0]))this.reduceHorizontal(z,J),this.isReduce=!0;else this.extendHorizontal(z,J,Y=4),z.toggleCss(eP,X),az(Z,$>0?!0:void 0),z.toggleCss(zT,this.isSingleCell()),this.updateRangeBorders(),this.refreshRangeStyleAndHandle()}updateRangeBorders(){let z=this.getRangeBorders(),J=this.isSingleCell(),Q=!J&&z.top,Z=!J&&z.right,$=!J&&z.bottom,X=!J&&z.left,Y=this.cellComp;Y.toggleCss(QT,Q),Y.toggleCss(ZT,Z),Y.toggleCss($T,$),Y.toggleCss(XT,X)}isSingleCell(){let{rangeSvc:z}=this;return this.rangeCount===1&&!!z&&!z.isMoreThanOneCell()}getHasChartRange(){let{rangeSvc:z}=this;if(!this.rangeCount||!z)return!1;let J=z.getCellRanges();return J.length>0&&J.every((Q)=>[c4.DIMENSION,c4.VALUE].includes(Q.type))}updateRangeBordersIfRangeCount(){if(this.rangeCount>0)this.updateRangeBorders(),this.refreshRangeStyleAndHandle()}getRangeBorders(){let z=this.beans.gos.get("enableRtl"),J=!1,Q=!1,Z=!1,$=!1,{rangeSvc:X,beans:{visibleCols:Y},cellCtrl:{cellPosition:q}}=this,G=q.column,H=X.getCellRanges().filter((W)=>X.isCellInSpecificRange(q,W));if(!H.length)return{top:J,right:Q,bottom:Z,left:$};let _,U;if(z)_=Y.getColAfter(G),U=Y.getColBefore(G);else _=Y.getColBefore(G),U=Y.getColAfter(G);if(!_)$=!0;if(!U)Q=!0;for(let W=0;W=0;Z--){let $=Q[Z],X=$.colorClass;if(!X)continue;if(z.isCellInSpecificRange(this.cellCtrl.cellPosition,$))return X}return null}refreshHandleColor(z){let J=this.selectionHandle?.getGui?.(),Q=z?.colorClass??null;if(!J){this.handleColorClass=null;return}if(this.handleColorClass&&this.handleColorClass!==Q)J.classList.remove(this.handleColorClass);if(Q)J.classList.add(Q);else if(this.handleColorClass)J.classList.remove(this.handleColorClass);this.handleColorClass=Q??null}getRangeForHandle(){let{gos:z,editSvc:J}=this.beans,Q=this.rangeSvc,Z=Q.getCellRanges(),$=Z.length;if(this.rangeCount<1||$<1)return null;let X=J?.isRangeSelectionEnabledWhileEditing(),Y=X?Z:[b(Z)];for(let q of Y){let{cellPosition:G,column:H}=this.cellCtrl,_=VY(z)&&!H.isSuppressFillHandle(),U=YT(z),B=!J?.isEditing(this.cellCtrl,{withOpenEditor:!0})&&(X||$===1&&(_||U));if(this.hasChartRange)B=q.type===c4.VALUE;if(B&&q.endRow!=null&&Q.isContiguousRange(q)&&Q.isBottomRightCell(q,G))return q}return null}addSelectionHandle(z){let{beans:J}=this,Q=J.editSvc?.isRangeSelectionEnabledWhileEditing(),Z=z.type,X=!Q&&VY(J.gos)&&n(Z)?0:1;if(this.selectionHandle&&this.selectionHandle.getType()!==X)this.selectionHandle=J.context.destroyBean(this.selectionHandle);if(!this.selectionHandle){let Y=J.registry.createDynamicBean(X===0?"fillHandle":"rangeHandle",!1);if(Y)this.selectionHandle=J.context.createBean(Y)}this.selectionHandle?.refresh(this.cellCtrl,z)}destroy(){this.unsetComp()}},GT=class extends V{constructor(z){super();this.eContainer=z}postConstruct(){let{beans:z,gos:J,eContainer:Q}=this,Z=z.rangeSvc,$={eElement:Q,onDragStart:Z.onDragStart.bind(Z),onDragStop:Z.onDragStop.bind(Z),onDragging:Z.onDragging.bind(Z)},X=z.dragSvc,Y=X.addDragSource.bind(X,$),q=X.removeDragSource.bind(X,$);if(this.addManagedPropertyListeners(["enableRangeSelection","cellSelection"],()=>{if(d0(J))Y();else q()}),this.addDestroyFunc(q),d0(J))Y()}},HT=class extends V{constructor(z,J){super();this.column=z,this.eGui=J}postConstruct(){this.addManagedElementListeners(this.eGui,{click:(z)=>z&&this.onClick(z)})}onClick(z){this.beans.rangeSvc?.handleColumnSelection(this.column,z)}},_T=class extends V{constructor(z,J){super();this.column=z,this.comp=J,this.columnMap=new Map,this.isActive=!1,this.resetColumnMap()}postConstruct(){this.addManagedPropertyListener("cellSelection",()=>{this.refreshActive()}),this.refreshActive(),this.setupRangeHeaderHighlight()}resetColumnMap(){this.columnMap.clear();let z;if(this.column.isColumn)z=[this.column];else z=this.column.getDisplayedLeafColumns();for(let J of z)this.columnMap.set(J,!1)}refreshActive(){let{gos:z,rangeSvc:J}=this.beans,Q=z.get("cellSelection");this.isActive=!!(Q&&J&&typeof Q==="object"&&Q.enableHeaderHighlight)}setupRangeHeaderHighlight(){let z=this.onRangeSelectionChanged.bind(this);this.addManagedEventListeners({rangeSelectionChanged:z,columnPinned:z,columnMoved:z,columnGroupOpened:z}),z()}onRangeSelectionChanged(){if(!this.isActive)return;this.resetColumnMap();let z=this.beans.rangeSvc.getCellRanges(),J=!1,Q=!0;for(let Z of z){if(J)break;for(let $ of Z.columns)if(this.columnMap.has($))this.columnMap.set($,!0),J||(J=!0)}for(let Z of Array.from(this.columnMap.values()))if(Z===!1){Q=!1;break}this.comp.toggleCss("ag-header-range-highlight",J&&Q)}destroy(){super.destroy(),this.comp=null,this.column=null}},UT=class extends V{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(z){this.rowModel=z.rowModel,this.dragSvc=z.dragSvc,this.colModel=z.colModel,this.visibleCols=z.visibleCols,this.cellNavigation=z.cellNavigation,this.ctrlsSvc=z.ctrlsSvc}postConstruct(){let z=this.onColumnsChanged.bind(this),J=()=>this.removeAllCellRanges(),Q=this.refreshLastRangeStart.bind(this);this.addManagedEventListeners({newColumnsLoaded:z,columnVisible:z,columnValueChanged:z,columnPivotModeChanged:J,columnRowGroupChanged:J,columnPivotChanged:J,columnGroupOpened:Q,columnMoved:Q,columnPinned:Q}),this.ctrlsSvc.whenReady(this,(Z)=>{let $=Z.gridBodyCtrl;this.autoScrollService=new WJ({scrollContainer:$.eBodyViewport,scrollAxis:"xy",getVerticalPosition:()=>$.scrollFeature.getVScrollPosition().top,setVerticalPosition:(X)=>$.scrollFeature.setVerticalScrollPosition(X),getHorizontalPosition:()=>$.scrollFeature.getHScrollPosition().left,setHorizontalPosition:(X)=>$.scrollFeature.setHorizontalScrollPosition(X),shouldSkipVerticalScroll:()=>!A0(this.gos,"normal"),shouldSkipHorizontalScroll:()=>!$.scrollFeature.isHorizontalScrollShowing()})})}registerRangeSelectionExtension(z){if(this.rangeSelectionExtensions.includes(z))return;this.rangeSelectionExtensions.push(z)}unregisterRangeSelectionExtension(z){X0(this.rangeSelectionExtensions,z)}shouldSuppressRangeSelection(z){return this.rangeSelectionExtensions.some((J)=>J.shouldSuppressRangeSelection?.(z))}shouldSkipColumn(z){return this.rangeSelectionExtensions.some((J)=>J.shouldSkipColumn?.(z))}isAllColumnsSelectionCell(z){return this.rangeSelectionExtensions.some((J)=>J.isAllColumnsSelectionCell?.(z))}isAllColumnsRange(z,J){return this.rangeSelectionExtensions.some((Q)=>Q.isAllColumnsRange?.(z,J))}updateSelectionModeForCell(z){this.setSelectionMode(this.isAllColumnsSelectionCell(z))}onDragStart(z){let J=this.gos,Q=z.target;if(!d0(J)||dZ(J,Q)?.isSuppressMouseEvent(z))return;if(this.shouldSuppressRangeSelection(Q))return;let{shiftKey:Z}=z,$=this.isMultiRange(z),X=Z&&!!this.cellRanges?.length;if(!$&&(!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=z,this.intersectionRange=$&&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(z){let{dragging:J,lastCellHovered:Q,newestRangeStartCell:Z,autoScrollService:$,cellHasChanged:X}=this;if(!J||!z)return;this.updateValuesOnMove(z.target),this.lastMouseEvent=z;let Y=(B)=>Q&&Q.rowPinned===B&&Z.rowPinned===B,q=Y("top")||Y("bottom");if($.check(z,q),!X||!Q)return;let G=Z?.column,H=Q?.column,_=this.calculateColumnsBetween(G,H);if(!_)return;let{rowIndex:U,rowPinned:W}=Q;this.draggingRange.endRow={rowIndex:U,rowPinned:W},this.draggingRange.columns=_,this.dispatchChangedEvent(!1,!1,this.draggingRange.id)}onDragStop(){if(!this.dragging)return;let{id:z}=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,z)}onColumnsChanged(){this.refreshLastRangeStart();let z=this.visibleCols.allCols;for(let Q of this.cellRanges){let Z=Q.columns;if(Q.columns=Q.columns.filter((X)=>X.isVisible()&&z.indexOf(X)!==-1),!Z0(Z,Q.columns))this.dispatchChangedEvent(!1,!0,Q.id)}let J=this.cellRanges.length;if(this.cellRanges=this.cellRanges.filter((Q)=>Q.columns.length>0),J>this.cellRanges.length)this.dispatchChangedEvent(!1,!0)}refreshLastRangeStart(){let z=b(this.cellRanges);if(!z)return;this.refreshRangeStart(z)}isContiguousRange(z){let J=z.columns;if(!J.length)return!1;let Q=this.visibleCols.allCols,Z=J.map(($)=>Q.indexOf($)).sort(($,X)=>$-X);return b(Z)-Z[0]+1===J.length}getRangeStartRow(z){if(z.startRow&&z.endRow)return U0(z.startRow,z.endRow)?z.startRow:z.endRow;return{rowIndex:0,rowPinned:(this.beans.pinnedRowModel?.getPinnedTopRowCount()??0)>0?"top":null}}getRangeEndRow(z){if(z.startRow&&z.endRow)return U0(z.startRow,z.endRow)?z.endRow:z.startRow;let J=this.beans.pinnedRowModel?.getPinnedBottomRowCount()??0;if(J>0)return{rowIndex:J-1,rowPinned:"bottom"};return{rowIndex:this.rowModel.getRowCount()-1,rowPinned:null}}getRangeRowCount(z){let J=this.beans,Q=this.getRangeStartRow(z),Z=this.getRangeEndRow(z),$=NZ(J,Q);return NZ(J,Z)-$+1}handleCellMouseDown(z,J){let Q=z.ctrlKey||z.metaKey;this.handleCellSelectionInput(J,{target:z.target,shiftKey:z.shiftKey,isRightClick:VZ(this.beans,z),isMultiRange:this.isMultiRange(z),isMultiKey:Q,preventDefault:()=>z.preventDefault()})}handleCellKeyboardSelect(z,J){let Q=z.ctrlKey||z.metaKey;this.handleCellSelectionInput(J,{target:z.target,shiftKey:z.shiftKey,isRightClick:!1,isMultiRange:this.isMultiRangeForKeyState(Q),isMultiKey:Q,preventDefault:()=>z.preventDefault()})}handleCellSelectionInput(z,J){let{target:Q,shiftKey:Z,isRightClick:$,isMultiRange:X,isMultiKey:Y,preventDefault:q}=J;if(this.shouldSuppressRangeSelection(Q))return;let G=this.isAllColumnsSelectionCell(z);if(G)q();if(Z)return this.extendLatestRangeToCell(z);if(G&&$)return;this.updateSelectionModeForCell(z);let H=this.calculateColumnsBetween(z.column,z.column);if(!H)return;let _=G?this.findContainingRange({columns:H,startRow:z,endRow:z}):void 0;if(G&&!!_&&X&&Y&&_)this.removeRowFromAllColumnsRange(z,_);else this.setRangeToCell(z,X)}isMultiRange(z){return this.isMultiRangeForKeyState(z.ctrlKey||z.metaKey)}isMultiRangeForKeyState(z){let{editingWithRanges:J,allowMulti:Q}=this.getMultiRangeContext();return J||(Q?z:!1)}getMultiRangeContext(){let{gos:z,editSvc:J}=this.beans,Q=!!J?.isEditing()&&!!J?.isRangeSelectionEnabledWhileEditing(),Z=$9(z)&&!Q;return{editingWithRanges:Q,suppressMultiRanges:Z,allowMulti:!Z}}removeRowFromAllColumnsRange(z,J){let{beans:Q,cellRanges:Z}=this,$=x2(Q),X=M1(Q),Y=this.getRangeStartRow(J),q=this.getRangeEndRow(J);if(!Y&&a($,z))vJ(J,L0(Q,$),"top");else if(!q&&a(X,z))vJ(J,n0(Q,X),"bottom");else if(a(Y,q))X0(Z,J);else if(a(Y,z))vJ(J,L0(Q,z),"top");else if(a(q,z))vJ(J,n0(Q,z),"bottom");else{let G=n0(Q,z),H=L0(Q,z);J.startRow=Y,J.endRow=G??void 0,Z.push({...J,startRow:H??void 0,endRow:q})}this.dispatchChangedEvent(!0,!0)}setRangeToCell(z,J=!1){let{gos:Q}=this;if(!d0(Q))return;this.updateSelectionModeForCell(z);let Z=this.calculateColumnsBetween(z.column,z.column);if(!Z)return;let{suppressMultiRanges:$}=this.getMultiRangeContext();if($||!J||n(this.cellRanges))this.removeAllCellRanges(!0);let X={rowIndex:z.rowIndex,rowPinned:z.rowPinned},Y={startRow:X,endRow:X,columns:Z,startColumn:z.column},q=this.ensureRangeStartColumn(Y);if(!q)return;this.cellRanges.push(Y),this.setNewestRangeStartCell({...z,column:q}),this.onDragStop(),this.dispatchChangedEvent(!0,!0)}getRangeLastColumn(z){let J=z.columns[0],Q=b(z.columns);return this.newestRangeStartCell?.column===J?Q:J}extendRangeRowCountBy(z,J){let{beans:Q}=this,{startRow:Z,endRow:$}=z;if(!Z||!$)return;let X=0,Y,q=U0($,Z);if(q)Y=Z;else Y=$;let G=J>0?L0:n0,H=Math.abs(J);while(XJ.indexOf(Z)).filter((Z)=>Z>-1).sort((Z,$)=>Z-$);return{left:J[Q[0]],right:J[b(Q)]}}extendLatestRangeInDirection(z){if(this.isEmpty()||!this.newestRangeStartCell)return;let J=z.key,Q=z.ctrlKey||z.metaKey,Z=b(this.cellRanges),$=this.newestRangeStartCell,X=Z.endRow.rowIndex,Y=Z.endRow.rowPinned,G={column:this.getRangeLastColumn(Z),rowIndex:X,rowPinned:Y},H=this.cellNavigation.getNextCellToFocus(J,G,Q);if(!H)return;if(this.shouldSkipColumn(H.column))return;return this.setCellRange({rowStartIndex:$.rowIndex,rowStartPinned:$.rowPinned,rowEndIndex:H.rowIndex,rowEndPinned:H.rowPinned,columnStart:$.column,columnEnd:H.column}),H}setCellRange(z){if(!d0(this.gos))return;this.removeAllCellRanges(!0),this.addCellRange(z)}setCellRanges(z){if(Z0(this.cellRanges,z))return;if(!this.verifyCellRanges(this.gos))return;this.setSelectionMode(!1),this.removeAllCellRanges(!0);let J=this.getColumnsFromModel(this.visibleCols.allCols)??[],Q=!1;for(let Z of z){if(Z.columns&&Z.startRow){let $=this.getColumnsFromModel(Z.columns);if(!$||$.length===0)continue;Z.columns=$;let{startRow:X}=Z;this.setNewestRangeStartCell({rowIndex:X.rowIndex,rowPinned:X.rowPinned,column:Z.columns[0]})}if(!Q&&J.length>0&&this.isAllColumnsRange(Z,J))Q=!0;this.cellRanges.push(Z)}this.setSelectionMode(Q),this.dispatchChangedEvent(!1,!0)}clearCellRangeCellValues(z){let{beans:J,eventSvc:Q}=this,{cellEventSource:Z="rangeSvc",dispatchWrapperEvents:$,wrapperEventSource:X="deleteKey",restoreSourceInBatch:Y}=z,{cellRanges:q}=z;if($)Q.dispatchEvent({type:"cellSelectionDeleteStart",source:X}),Q.dispatchEvent({type:"rangeDeleteStart",source:X});if(!q)q=this.cellRanges;let{valueSvc:G,editSvc:H}=J,_=!!H?.isBatchEditing(),{changeDetectionSvc:U}=J;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,Z)})}finally{U?.endDeferred()}if($)Q.dispatchEvent({type:"cellSelectionDeleteEnd",source:X}),Q.dispatchEvent({type:"rangeDeleteEnd",source:X})}createCellRangeFromCellRangeParams(z){return this.createPartialCellRangeFromRangeParams(z,!1)}createPartialCellRangeFromRangeParams(z,J){let{columns:Q,columnStart:Z,columnEnd:$,rowStartIndex:X,rowStartPinned:Y,rowEndIndex:q,rowEndPinned:G}=z,H=this.getColumnsFromParams(Q,Z,$);if(!H||!J&&H.columns.length===0)return;let{columns:_,startsOnTheRight:U}=H,W=SY(X,Y),B=SY(q,G);return{startRow:W,endRow:B,columns:_,startColumn:this.getColumnFromModel(Z)??(U?b(_):_[0])}}addCellRange(z){let J=this.gos;if(!d0(J)||!this.verifyCellRanges(J))return;this.setSelectionMode(!1);let Q=this.createCellRangeFromCellRangeParams(z);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 z=this.cellRanges.length;if(z===0)return!1;if(z>1)return!0;let J=this.cellRanges[0],Q=this.getRangeStartRow(J),Z=this.getRangeEndRow(J);return Q.rowPinned!==Z.rowPinned||Q.rowIndex!==Z.rowIndex||J.columns.length!==1}areAllRangesAbleToMerge(){let z=new Map;if(this.cellRanges.length<=1)return!0;for(let Z of this.cellRanges)this.forEachRowInRange(Z,($)=>{let X=`${$.rowPinned||"normal"}_${$.rowIndex}`,Y=z.get(X),q=Z.columns.map((G)=>G.getId());if(Y){let G=q.filter((H)=>Y.indexOf(H)===-1);Y.push(...G)}else z.set(X,q)});let Q;for(let Z of z.values()){let $=Z.sort().join();if(Q===void 0){Q=$;continue}if(Q!==$)return!1}return!0}removeAllCellRanges(z){if(this.isEmpty())return;if(this.onDragStop(),this.cellRanges.length=0,!z)this.dispatchChangedEvent(!1,!0)}isCellInAnyRange(z){return this.getCellRangeCount(z)>0}isCellInSpecificRange(z,J){let Q=J.columns?.includes(z.column),Z=this.isRowInRange(z,J);return Q&&Z}isColumnInAnyRange(z){let{beans:J}=this,Q=x2(J),Z=M1(J);if(!Q||!Z)return!1;let $=z.isColumn?[z]:z.getDisplayedLeafColumns();return this.findContainingRange({columns:$,startRow:Q,endRow:Z},!0)!=null}findContainingRange({columns:z,startRow:J,endRow:Q},Z=!1){let $=this.cellRanges;for(let X=$.length-1;X>=0;X--){let Y=$[X],q=z.every((H)=>Y.columns.includes(H)),G=!1;if(Z)G=a(Y.startRow,J)&&a(Y.endRow,Q);else{let H=J&&this.isRowInRange(J,Y),_=Q&&this.isRowInRange(Q,Y);G=!!H&&!!_}if(q&&G)return Y}}isBottomRightCell(z,J){let Q=this.visibleCols.allCols,Z=z.columns.map((H)=>Q.indexOf(H)).sort((H,_)=>H-_),{startRow:$,endRow:X}=z,Y=U0($,X)?X:$,q=Q.indexOf(J.column)===b(Z),G=J.rowIndex===Y.rowIndex&&q0(J.rowPinned)===q0(Y.rowPinned);return q&&G}getCellRangeCount(z){return this.cellRanges.filter((J)=>this.isCellInSpecificRange(z,J)).length}isRowInRange(z,J){let Q=this.getRangeStartRow(J),Z=this.getRangeEndRow(J),$=a(z,Q),X=a(z,Z);if($||X)return!0;let Y=!U0(z,Q),q=U0(z,Z);return Y&&q}intersectLastRange(z){let{editingWithRanges:J,suppressMultiRanges:Q}=this.getMultiRangeContext();if(J||Q||z&&this.dragging||this.isEmpty())return;let Z=b(this.cellRanges),$=this.getRangeStartRow(Z),X=this.getRangeEndRow(Z),Y=[];for(let q of this.cellRanges.slice(0,-1)){let G=this.getRangeStartRow(q),H=this.getRangeEndRow(q),_=q.columns,U=_.filter((B)=>Z.columns.indexOf(B)===-1);if(U.length===_.length){Y.push(q);continue}if(U0(X,G)||U0(H,$)){Y.push(q);continue}let W=Y.length;if(U0(G,$)){let B={columns:[..._],startColumn:Z.startColumn,startRow:{...G},endRow:n0(this.beans,$)};Y.push(B)}if(U.length>0){let B={columns:U,startColumn:U.includes(Z.startColumn)?Z.startColumn:U[0],startRow:WT([{...$},{...G}]),endRow:BT([{...X},{...H}])};Y.push(B)}if(U0(X,H))Y.push({columns:[..._],startColumn:Z.startColumn,startRow:L0(this.beans,X),endRow:{...H}});if(Y.length-W===1)Y[Y.length-1].id=q.id}if(this.cellRanges=Y,z)this.dispatchChangedEvent(!1,!0)}createRangeHighlightFeature(z,J,Q){z.createManagedBean(new _T(J,Q))}setSelectionMode(z){this.selectionMode=z?1:0}refreshRangeStart(z){let{columns:J}=z,Q=this.ensureRangeStartColumn(z);if(!Q)return;let Z=(G,H)=>{let _=z.columns.filter((U)=>U!==G);if(G)z.startColumn=G,z.columns=H?[G,..._]:[..._,G];else z.columns=_},{left:$,right:X}=this.getRangeEdgeColumns(z);if(Q===J[0]&&Q!==$){Z($,!0);return}if(Q===b(J)&&Q===X)Z(X,!1)}setNewestRangeStartCell(z){this.newestRangeStartCell=z}getColumnsFromParams(z,J,Q){let Z=!z&&!J&&!Q,$,X=!1;if(Z||z)$=this.getColumnsFromModel(Z?void 0:z);else if(J&&Q){if($=this.calculateColumnsBetween(J,Q),$?.length)X=$[0]!==this.getColumnFromModel(J)}return $?{columns:$,startsOnTheRight:X}:void 0}verifyCellRanges(z){let{suppressMultiRanges:J}=this.getMultiRangeContext(),Q=Z9(z)&&J&&this.cellRanges.length>1;if(Q)R(93);return!Q}forEachRowInRange(z,J){let Q=this.getRangeStartRow(z),Z=this.getRangeEndRow(z),$=Q;while($){if(J($),a($,Z))break;$=L0(this.beans,$)}}forEachEditableCellInRanges(z,J){let{beans:Q}=this;for(let Z of z)this.forEachRowInRange(Z,($)=>{let X=f0(Q,$);if(!X)return;for(let Y=0;Y0,H=J.ctrlKey||J.metaKey,_=!q||H,U=x2(Z),W=M1(Z);if(!U||!W)return;if(J.key===k.ENTER)J.preventDefault();if(J.shiftKey){let E=$.root;if(!E)return;let K=z.isColumn?z:b(z.getLeafColumns()),F=this.findContainingRange({columns:[E],startRow:U,endRow:W},!0);if(!F){X0(X,$.lastCellRange),this.selectColumns(this.calculateColumnsBetween(E,K),U,W);return}this.updateRangeRowBoundary({cellRange:F,boundary:"end",cellPosition:{column:K,...W}});return}if(G&&(Y||!H&&!q))this.removeAllCellRanges(!0);let B=(E,K)=>{let F=this.findContainingRange({columns:E,startRow:U,endRow:W},!0);if(F&&_)this.deselectColumnsFromRange(F,E);else{let L=this.selectColumns(E,U,W);if(L)$.lastCellRange=L}$.root=K};if(z.isColumn)B([z],z);else{let E=z.getDisplayedLeafColumns();B(E,E[0])}}deselectColumnsFromRange(z,J){if(O6(z.columns,J),J.includes(z.startColumn))z.startColumn=z.columns[0];if(z.columns.length===0)X0(this.cellRanges,z);this.dispatchChangedEvent(!0,!0)}selectColumns(z,J,Q){return this.addCellRange({columns:z,columnStart:z[0],columnEnd:b(z),rowStartIndex:J.rowIndex,rowStartPinned:J.rowPinned,rowEndIndex:Q.rowIndex,rowEndPinned:Q.rowPinned})}};function SY(z,J){return z!=null?{rowIndex:z,rowPinned:J}:void 0}function WT(z){let J;for(let Q of z)if(J===void 0||U0(J,Q))J=Q;return J}function BT(z){let J;for(let Q of z)if(J===void 0||U0(Q,J))J=Q;return J}function ET(z,J){let{startRow:Q,endRow:Z}=z,$=U0(Q,Z)?Z:Q,X=J.rowIndex===$.rowIndex&&J.rowPinned===$.rowPinned,Y=z.columns[0],q=b(z.columns),G=z.startColumn===Y?q:Y;return J.column===G&&X}function vJ(z,J,Q){let Z;if(Q==="top")Z=!z.startRow||!z.endRow||U0(z.startRow,z.endRow)?"startRow":"endRow";else Z=!z.startRow||!z.endRow||U0(z.startRow,z.endRow)?"endRow":"startRow";z[Z]=J??void 0}var Nq={moduleName:"CellSelection",version:$0,beans:[UT],dynamicBeans:{fillHandle:rP,rangeHandle:sP},apiFunctions:{getCellRanges:aP,addCellRange:oP,clearRangeSelection:kY,clearCellSelection:kY},dependsOn:[C0,X2,BJ],css:[lP]};function KT(z){return z.colModel.isPivotMode()}function FT(z,J,Q){return z.pivotResultCols?.lookupPivotResultCol(J,Q)??null}function LT(z,J){z.valueColsSvc?.setColumns(J,"api")}function DT(z){return z.valueColsSvc?.columns??[]}function MT(z,J){z.valueColsSvc?.removeColumns(J,"api")}function kT(z,J){z.valueColsSvc?.addColumns(J,"api")}function fT(z,J){z.pivotColsSvc?.setColumns(J,"api")}function VT(z,J){z.pivotColsSvc?.removeColumns(J,"api")}function ST(z,J){z.pivotColsSvc?.addColumns(J,"api")}function AT(z){return z.pivotColsSvc?.columns??[]}function RT(z,J){z.pivotResultCols?.setPivotResultCols(J,"api")}function jT(z){let J=z.pivotResultCols?.getPivotResultCols();return J?J.list:null}var AY="PivotRowTotal_",OT=({headerName:z},{headerName:J})=>{if(z&&!J)return 1;else if(!z&&J)return-1;else if(!z&&!J)return 0;if(zJ)return 1;else return 0},PT=(z)=>(J,Q)=>z(J.headerName,Q.headerName),TT=class extends V{constructor(){super(...arguments);this.beanName="pivotColDefSvc"}wireBeans(z){this.colModel=z.colModel,this.pivotColsSvc=z.pivotColsSvc,this.valueColsSvc=z.valueColsSvc,this.colNames=z.colNames}postConstruct(){let z=()=>this.gos.get("serverSidePivotResultFieldSeparator")??"_";this.fieldSeparator=z(),this.addManagedPropertyListener("serverSidePivotResultFieldSeparator",()=>{this.fieldSeparator=z()});let J=()=>this.gos.get("pivotDefaultExpanded");this.pivotDefaultExpanded=J(),this.addManagedPropertyListener("pivotDefaultExpanded",()=>{this.pivotDefaultExpanded=J()})}createPivotColumnDefs(z){let J=this.createPivotColumnsFromUniqueValues(z);function Q($,X=[]){return $.forEach((Y)=>{if(Y.children!==void 0)Q(Y.children,X);else X.push(Y)}),X}let Z=Q(J);return this.addRowGroupTotals(J,Z),this.addExpandablePivotGroups(J,Z),this.addPivotTotalsToGroups(J,Z),J}createPivotColumnsFromUniqueValues(z){let J=this.pivotColsSvc?.columns??[],Q=J.length;return this.recursivelyBuildGroup(0,z,[],Q,J)}recursivelyBuildGroup(z,J,Q,Z,$){if(z>=Z)return this.buildMeasureCols(Q);let{pivotComparator:X}=$[z].getColDef(),Y=X?PT(X):OT,q=this.valueColsSvc?.columns;if(q?.length===1&&this.gos.get("removePivotHeaderRowWhenSingleValueColumn")&&z===Z-1){let H=[];for(let _ of J.keys()){let U=[...Q,_],W=this.createColDef(q[0],_,U);W.columnGroupShow="open",H.push(W)}return H.sort(Y),H}let G=[];for(let H of J.keys()){let _=this.pivotDefaultExpanded===-1||z{let Z=this.colNames.getDisplayNameForColumn(Q,"header"),$=this.createColDef(Q,Z,z);return $.columnGroupShow="open",$})}addExpandablePivotGroups(z,J){let Q=this.gos.get("suppressExpandablePivotGroups");if(Q||this.gos.get("pivotColumnGroupTotals"))return;let Z=($,X,Y)=>{if("children"in $){let{valueColsSvc:H}=this,{columns:_=[]}=H??{},U=new Map;$.children.forEach((E)=>{Z(E,X,U)});let W=!$.children.some((E)=>E.children),B=W&&_.length===1&&this.gos.get("removePivotHeaderRowWhenSingleValueColumn");for(let E of _){let K=this.colNames.getDisplayNameForColumn(E,"header"),F=this.createColDef(E,K,$.pivotKeys);if(F.pivotTotalColumnIds=U.get(E.getColId()),F.columnGroupShow=!Q?"closed":"open",F.aggFunc=E.getAggFunc(),!W||B)$.children.push(F),X.push(F)}this.merge(Y,U);return}if(!$.pivotValueColumn)return;let q=$.pivotValueColumn.getColId();if(Y.has(q))Y.get(q).push($.colId);else Y.set(q,[$.colId])};z.forEach(($)=>{Z($,J,new Map)})}addPivotTotalsToGroups(z,J){if(!this.gos.get("pivotColumnGroupTotals"))return;let Q=this.gos.get("pivotColumnGroupTotals")==="after",Z=this.valueColsSvc?.columns,$=Z?.map((X)=>X.getAggFunc());if(!$||$.length<1||!this.sameAggFuncs($))return;if(Z){let X=Z[0];z.forEach((Y)=>{this.recursivelyAddPivotTotal(Y,J,X,Q)})}}recursivelyAddPivotTotal(z,J,Q,Z){let $=z;if(!$.children){let Y=z;return Y.colId?[Y.colId]:null}let X=[];if($.children.forEach((Y)=>{let q=this.recursivelyAddPivotTotal(Y,J,Q,Z);if(q)X=X.concat(q)}),$.children.length>1){let q=this.getLocaleTextFunc()("pivotColumnGroupTotals","Total"),G=this.createColDef(Q,q,z.pivotKeys,!0);G.pivotTotalColumnIds=X,G.aggFunc=Q.getAggFunc(),G.columnGroupShow=this.gos.get("suppressExpandablePivotGroups")?"open":void 0;let H=z.children;if(Z)H.push(G);else H.unshift(G);J.push(G)}return X}addRowGroupTotals(z,J){if(!this.gos.get("pivotRowTotals"))return;let Q=this.gos.get("pivotRowTotals")==="after",$=(this.valueColsSvc?.columns??[]).slice();if(!Q)$.reverse();let X=$.length>1||!this.gos.get("removePivotHeaderRowWhenSingleValueColumn");for(let Y=0;Y<$.length;Y++){let q=$[Y],G=this.colNames.getDisplayNameForColumn(q,"header"),H=this.createColDef(q,G,[]),_=[];for(let W=0;WX.data?.[X.colDef.field],$.pivotKeys=Q,$.pivotValueColumn=z,$.filter===!0)$.filter="agNumberColumnFilter";return $}sameAggFuncs(z){if(z.length==1)return!0;for(let J=1;J{let X=[...z.has(Z)?z.get(Z):[],...Q];z.set(Z,X)})}generateColumnGroupId(z){return`pivotGroup_${(this.pivotColsSvc?.columns??[]).map((Q)=>Q.getColId()).join("-")}_${z.join("-")}`}generateColumnId(z,J){return`pivot_${(this.pivotColsSvc?.columns??[]).map((Z)=>Z.getColId()).join("-")}_${z.join("-")}_${J}`}createColDefsFromFields(z){let J=new Map;for(let $=0;${let G=[];for(let[U,W]of Y){let B=Q(`${$}${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=$,E.aggFunc=U.getAggFunc(),E.valueGetter=(K)=>K.data?.[$],E}return{colId:$,headerName:X,valueGetter:(B)=>B.data?.[$]}}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{$.forEach((X)=>{if(T(X.children)){let q=X;if(Q)Q(q);Z(q.children)}else{let q=X;if(J)J(q)}})};if(z)Z(z)}},RY="Exceeded maximum allowed pivot column count.",xJ=(z)=>{let J={};return z.forEach((Q,Z)=>J[Z]=Q instanceof Map?xJ(Q):Q),J},IT=class extends V{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(z){this.valueSvc=z.valueSvc,this.colModel=z.colModel,this.pivotResultCols=z.pivotResultCols,this.rowGroupColsSvc=z.rowGroupColsSvc,this.valueColsSvc=z.valueColsSvc,this.pivotColsSvc=z.pivotColsSvc,this.pivotColDefSvc=z.pivotColDefSvc}execute(z){if(this.colModel.isPivotActive())return this.executePivotOn(z);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(z){let J=this.valueColsSvc?.columns.length??1,Q=this.gos.get("pivotMaxGeneratedColumns");this.maxUniqueValues=Q===-1?-1:Q/J;let Z;try{Z=this.bucketUpRowNodes(z)}catch(L){if(L.message===RY)return this.pivotResultCols.setPivotResultCols([],"rowModelUpdated"),this.eventSvc.dispatchEvent({type:"pivotMaxColumnsExceeded",message:L.message}),this.lastTimeFailed=!0,!1;throw L}let $=this.setUniqueValues(Z),X=this.valueColsSvc?.columns??[],Y=X.map((L)=>`${L.getId()}-${L.getColDef().headerName}`).join("#"),q=X.map((L)=>L.getAggFunc().toString()).join("#"),G=this.aggregationColumnsHashLastTime!==Y,H=this.aggregationFuncsHashLastTime!==q;this.aggregationColumnsHashLastTime=Y,this.aggregationFuncsHashLastTime=q;let _=(this.rowGroupColsSvc?.columns??[]).map((L)=>L.getId()).join("#"),U=_!==this.groupColumnsHashLastTime;this.groupColumnsHashLastTime=_;let W=this.gos.get("pivotRowTotals"),B=this.gos.get("pivotColumnGroupTotals"),E=this.gos.get("suppressExpandablePivotGroups"),K=this.gos.get("removePivotHeaderRowWhenSingleValueColumn"),F=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||$||G||U||H||F){let L=this.pivotColDefSvc.createPivotColumnDefs(this.uniqueValues);return this.pivotResultCols.setPivotResultCols(L,"rowModelUpdated"),this.lastTimeFailed=!1,!0}return this.lastTimeFailed=!1,!1}setUniqueValues(z){if(!rz(xJ(this.uniqueValues),xJ(z)))return this.uniqueValues=z,!0;return!1}bucketUpRowNodes(z){this.currentUniqueCount=0;let J=new Map;j0(this.beans.rowModel.rootNode,this.beans.rowModel.hierarchical,z,(Z)=>{if(Z.leafGroup)Z.childrenMapped=null});let Q=(Z)=>{if(Z.leafGroup)this.bucketRowNode(Z,J);else{let $=Z.childrenAfterFilter;if($)for(let X=0,Y=$.length;Xthis.maxUniqueValues;if(Y&&W)throw Error(RY)}if(!$.has(U))$.set(U,[]);$.get(U).push(_)}if(Q===J.length-1)return $;let q=new Map;for(let G of $.keys())q.set(G,this.bucketChildren($.get(G),J,Q+1,Z.get(G)));return q}},CT={moduleName:"SharedPivot",version:$0,beans:[vT,TT,jq],apiFunctions:{isPivotMode:KT,getPivotResultColumn:FT,setValueColumns:LT,getValueColumns:DT,removeValueColumns:MT,addValueColumns:kT,setPivotColumns:fT,removePivotColumns:VT,addPivotColumns:ST,getPivotColumns:AT,setPivotResultColumns:RT,getPivotResultColumns:jT},dependsOn:[Cq,aZ]},gq={moduleName:"Pivot",version:$0,rowModels:["clientSide"],beans:[IT],dependsOn:[CT,jP,nJ]};var tw=String.fromCodePoint(31,41150,8291);var hq=[{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"}],jY=new Map;for(let z of hq){let J=jY.get(z.symbol)??[];J.push(z),jY.set(z.symbol,J)}var rw=[...new Set(hq.map((z)=>z.symbol))].sort((z,J)=>J.length-z.length);var sw=Symbol("WrappedFunctionMarker");var bT={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"},yT=new Set(["columnLineCombo","areaColumnCombo","customCombo"]);function xT(z){return yT.has(z)}function wT(z){return z==="doughnut"?"donut":z}function NT(z){return bT[z]}var gT=["number","category","grouped-category","log","time"];var lw=gT.reduce((z,J)=>({...z,[J]:{title:{_enabledFromTheme:!0}}}),{});var rJ=(z)=>{return(J)=>{if(J==null)return!0;return z(J)}};var hT=["doughnut"];function uT(z){return!!NT(z)||xT(z)}function mT(z){return hT.includes(z)}var ow=rJ((z)=>{if(uT(z))return!0;if(mT(z)){let J=wT(z);return W1(`The chart type '${z}' has been deprecated. Please use '${J}' instead.`),J}return!1}),ew=rJ((z)=>{return typeof z==="object"}),zN=rJ((z)=>{return typeof z==="object"}),JN=rJ((z)=>{return typeof z==="string"||typeof z==="function"});function uq(z){return z.map((J,Q,Z)=>J.map(($,X)=>Z.slice(0,Q+1).reduce((Y,q)=>Y+q[X],0)))}function mq(z){let J=z.map((Q,Z)=>z.reduce(($,X)=>Math.max($,X[Z]),0));return z.map((Q)=>Q.map((Z,$)=>Z/J[$]*19))}var cq=[[1,3,5],[2,6,4],[5,3,1]];var cT=uq(cq);var QN=mq(cT);var pT=cq;var iT=uq(pT);var ZN=mq(iT);var dT=["number","category","time","grouped-category"],nT=["angle-category","angle-number","radius-category","radius-number"],$N=[...dT,...nT];n8.registerModules([uX,a$,hX,CX,gX,qX,s$,kq,Nq,gq,xq,z7,qq,Hq,Eq,Fq,bq,vX,TX,Wq,IX]);var bh=(z)=>{let{data:J,options:Q,api:Z,on:$,class:X,style:Y="height: 100%; width: 100%",dark:q}=z,G=null,H=null,_=()=>q!==void 0?typeof q==="function"?q():q:document.documentElement.getAttribute("data-theme")==="dark"||window.matchMedia("(prefers-color-scheme: dark)").matches,U=()=>{if(_())return FJ.withParams({headerFontSize:14,headerVerticalPaddingScale:0.4,rowVerticalPaddingScale:0.4,backgroundColor:"#1d1d1d",foregroundColor:"#ffffff",headerBackgroundColor:"#2a2a2a",headerForegroundColor:"#ffffff",oddRowBackgroundColor:"#262626",borderColor:"#404040",browserColorScheme:"dark"});return FJ.withParams({browserColorScheme:"light",headerFontSize:14,headerVerticalPaddingScale:0.4,rowVerticalPaddingScale:0.4})};return tT("div",{class:X,style:Y,ref:(B)=>{if(H)H(),H=null;if(G&&!G.isDestroyed()){if(G.destroy(),Z)Z.current=null;G=null}if(!B)return;let E=typeof J==="function"?J():J,K=typeof Q==="function"?Q():Q,F=["onFilterChanged","onModelUpdated","onGridSizeChanged","onFirstDataRendered","onRowValueChanged","onSelectionChanged","onCellClicked","onCellDoubleClicked","onCellValueChanged","onRowClicked","onSortChanged","onContextMenu","onColumnResized","onColumnMoved","onRowDataUpdated","onCellEditingStarted","onCellEditingStopped","onPaginationChanged","onBodyScroll"],L={};F.forEach((A)=>{if($?.[A])L[A]=(O)=>$[A](O)});let D={...K,theme:U(),rowData:E||[],onGridReady:(A)=>{if(G=A.api,Z)Z.current=G;if($?.onGridReady)$.onGridReady(A);if(K?.autoSizeColumns)A.api.autoSizeAllColumns()},...L};G=MJ(B,D);let M=$7(()=>{if(!G||G.isDestroyed())return;let A=typeof J==="function"?J():J;if(Array.isArray(A)){let O=G.getGridOption("rowData");if(A!==O)G.setGridOption("rowData",A)}}),f=$7(()=>{if(!G||G.isDestroyed())return;_();let A=U(),O=G.getGridOption("theme");if(JSON.stringify(A)!==JSON.stringify(O))G.setGridOption("theme",A)}),S=$7(()=>{if(!G||G.isDestroyed()||!Q)return;let A=typeof Q==="function"?Q():Q;if(A)Object.entries(A).forEach(([O,v])=>{try{G.setGridOption(O,v)}catch(I){}})});H=()=>{if(M(),f(),S(),G&&!G.isDestroyed()){if(G.destroy(),Z)Z.current=null;G=null}},rT(()=>{if(H)H(),H=null})}})};export{bh as Grid}; diff --git a/dist/sigpro-grid.min.js b/dist/sigpro-grid.min.js deleted file mode 100644 index 7a4ec6f..0000000 --- a/dist/sigpro-grid.min.js +++ /dev/null @@ -1,70 +0,0 @@ -(()=>{var{defineProperty:V2,getOwnPropertyNames:S4,getOwnPropertyDescriptor:O4}=Object,P4=Object.prototype.hasOwnProperty;function T4(Q){return this[Q]}var v4=(Q)=>{var z=(_7??=new WeakMap).get(Q),J;if(z)return z;if(z=V2({},"__esModule",{value:!0}),Q&&typeof Q==="object"||typeof Q==="function"){for(var Z of S4(Q))if(!P4.call(z,Z))V2(z,Z,{get:T4.bind(Q,Z),enumerable:!(J=O4(Q,Z))||J.enumerable})}return _7.set(Q,z),z},_7;var I4=(Q)=>Q;function C4(Q,z){this[Q]=I4.bind(null,z)}var b4=(Q,z)=>{for(var J in z)V2(Q,J,{get:z[J],enumerable:!0,configurable:!0,set:C4.bind(z,J)})};var jO={};b4(jO,{themeQuartz:()=>V6,iconSetQuartzLight:()=>g$,createGrid:()=>MJ,ModuleRegistry:()=>N5,Grid:()=>R4});function b(Q){if(!Q?.length)return;return Q[Q.length-1]}function X0(Q,z,J){if(Q===z)return!0;if(!Q||!z)return Q==null&&z==null;let Z=Q.length;if(Z!==z.length)return!1;for(let $=0;$=0)Q.splice(J,1)}function JJ(Q,z){let J=0,Z=0;for(;J=0;Z--)Q.splice(J,0,z[Z])}var RQ=(Q)=>{if(Q==null||Q==="")return null;return Q};function T(Q){return Q!=null&&Q!==""}function n(Q){return!T(Q)}var c1=(Q)=>{return Q!=null&&typeof Q.toString==="function"?Q.toString():null},DZ=(Q,z)=>{let J=Q?JSON.stringify(Q):null,Z=z?JSON.stringify(z):null;return J===Z},y4=(Q,z,J=!1)=>{if(Q==null)return z==null?0:-1;if(z==null)return 1;if(typeof Q==="object"&&Q.toNumber)Q=Q.toNumber();if(typeof z==="object"&&z.toNumber)z=z.toNumber();if(!J||typeof Q!=="string"){if(Q>z)return 1;if(Q{let q=Z?()=>Z.wrapIncoming(G):G;if(z)this.dispatchAsync(q);else q()},X=this.getListeners(J,z,!1);if((X?.size??0)>0){let G=new Set(X);for(let q of G){if(!X?.has(q))continue;$(()=>q(Q))}}let Y=this.getGlobalListeners(z);if(Y.size>0){let G=new Set(Y);for(let q of G)$(()=>q(J,Q))}}getGlobalListeners(Q){return Q?this.globalAsyncListeners:this.globalSyncListeners}dispatchAsync(Q){if(this.asyncFunctionsQueue.push(Q),!this.scheduled){let z=()=>{window.setTimeout(this.flushAsyncQueue.bind(this),0)},J=this.frameworkOverrides;if(J)J.wrapIncoming(z);else z();this.scheduled=!0}}flushAsyncQueue(){this.scheduled=!1;let Q=this.asyncFunctionsQueue.slice();this.asyncFunctionsQueue=[];for(let z of Q)z()}},x4=/[&<>"']/g,w4={"&":"&","<":"<",">":">",'"':""","'":"'"};function ZJ(Q){return Q?.toString().toString()??null}function W0(Q){return ZJ(Q)?.replace(x4,(z)=>w4[z])??null}function oJ(Q){return typeof Q==="string"&&Q.startsWith("=")&&Q.length>1}function N4(Q){if(!Q||Q==null)return null;let z=/([a-z])([A-Z])/g,J=/([A-Z]+)([A-Z])([a-z])/g;return Q.replace(z,"$1 $2").replace(J,"$1 $2$3").replace(/\./g," ").split(" ").map(($)=>$.substring(0,1).toUpperCase()+($.length>1?$.substring(1,$.length):"")).join(" ")}function s0(Q){return Q.eRootDiv.getRootNode()}function d(Q){return s0(Q).activeElement}function Y0(Q){let{gos:z,eRootDiv:J}=Q,Z=null,$=z.get("getDocument");if($&&T($))Z=$();else if(J)Z=J.ownerDocument;if(Z&&T(Z))return Z;return document}function hz(Q){let z=d(Q);return z===null||z===Y0(Q).body}function j5(Q){return Y0(Q).defaultView||window}function D1(Q){let z=null,J=null;try{z=Y0(Q).fullscreenElement}catch(Z){}finally{if(!z)z=s0(Q);let Z=z.querySelector("body");if(Z)J=Z;else if(z instanceof ShadowRoot)J=z;else if(z instanceof Document)J=z?.documentElement;else J=z}return J}function g4(Q){return D1(Q)?.clientWidth??(window.innerWidth||-1)}function h4(Q){return D1(Q)?.clientHeight??(window.innerHeight||-1)}function c0(Q,z,J){if(J==null||typeof J==="string"&&J=="")R5(Q,z);else XQ(Q,z,J)}function XQ(Q,z,J){Q.setAttribute(A8(z),J.toString())}function R5(Q,z){Q.removeAttribute(A8(z))}function A8(Q){return`aria-${Q}`}function H0(Q,z){if(z)Q.setAttribute("role",z);else Q.removeAttribute("role")}function u4(Q){let z=Q?.direction;if(z==="asc")return"ascending";else if(z==="desc")return"descending";else if(z==="mixed")return"other";return"none"}function j8(Q){return Number.parseInt(Q.getAttribute("aria-posinset"),10)}function m4(Q){return Q.getAttribute("aria-label")}function E0(Q,z){c0(Q,"label",z)}function p1(Q,z){c0(Q,"labelledby",z)}function MZ(Q,z){c0(Q,"describedby",z)}function R8(Q,z){c0(Q,"live",z)}function c4(Q,z){c0(Q,"atomic",z)}function p4(Q,z){c0(Q,"relevant",z)}function S8(Q,z){c0(Q,"invalid",z)}function O8(Q,z){c0(Q,"level",z)}function P8(Q,z){c0(Q,"disabled",z)}function kZ(Q,z){c0(Q,"hidden",z)}function w0(Q,z){XQ(Q,"expanded",z)}function T8(Q){R5(Q,"expanded")}function VZ(Q,z){XQ(Q,"setsize",z)}function fZ(Q,z){XQ(Q,"posinset",z)}function i4(Q,z){XQ(Q,"multiselectable",z)}function n4(Q,z){XQ(Q,"rowcount",z)}function eJ(Q,z){XQ(Q,"rowindex",z)}function d4(Q,z){XQ(Q,"colcount",z)}function v8(Q,z){XQ(Q,"colindex",z)}function t4(Q,z){XQ(Q,"colspan",z)}function r4(Q,z){XQ(Q,"sort",z)}function s4(Q){R5(Q,"sort")}function S5(Q,z){c0(Q,"selected",z)}function I8(Q,z){XQ(Q,"checked",z===void 0?"mixed":z)}function l4(Q,z){c0(Q,"controls",z)}function C8(Q,z){l4(Q,z.id),p1(z,Q.id)}function W7(Q,z){c0(Q,"owns",z)}function b8(Q,z){c0(Q,"haspopup",z===!1?null:z)}function O5(Q,z){return z===void 0?Q("ariaIndeterminate","indeterminate"):z===!0?Q("ariaChecked","checked"):Q("ariaUnchecked","unchecked")}function P5(Q,z,J){let Z=Q.parentElement,$=Z&&Z.firstChild;while($){if(z)$.classList.toggle(z,$===Q);if(J)$.classList.toggle(J,$!==Q);$=$.nextSibling}}var a4="[tabindex], input, select, button, textarea, [href]",y8="[disabled], .ag-disabled:not(.ag-button), .ag-disabled *";function w1(Q){if(!Q)return!1;if(!Q.matches("input, select, button, textarea"))return!1;if(!Q.matches(y8))return!1;return f0(Q)}function N(Q,z,J={}){let{skipAriaHidden:Z}=J;if(Q.classList.toggle("ag-hidden",!z),!Z)kZ(Q,!z)}function o4(Q,z,J={}){let{skipAriaHidden:Z}=J;if(Q.classList.toggle("ag-invisible",!z),!Z)kZ(Q,!z)}function T5(Q,z){let Z=z?(X)=>X.setAttribute("disabled",""):(X)=>X.removeAttribute("disabled");Z(Q);let $=Q.querySelectorAll("input")??[];for(let X of $)Z(X)}function vz(Q,z,J){let Z=0;while(Q){if(Q.classList.contains(z))return!0;if(Q=Q.parentElement,typeof J=="number"){if(++Z>J)break}else if(Q===J)break}return!1}function M1(Q){let{height:z,width:J,borderTopWidth:Z,borderRightWidth:$,borderBottomWidth:X,borderLeftWidth:Y,paddingTop:G,paddingRight:q,paddingBottom:H,paddingLeft:_,marginTop:U,marginRight:W,marginBottom:B,marginLeft:E,boxSizing:K}=window.getComputedStyle(Q),L=Number.parseFloat;return{height:L(z||"0"),width:L(J||"0"),borderTopWidth:L(Z||"0"),borderRightWidth:L($||"0"),borderBottomWidth:L(X||"0"),borderLeftWidth:L(Y||"0"),paddingTop:L(G||"0"),paddingRight:L(q||"0"),paddingBottom:L(H||"0"),paddingLeft:L(_||"0"),marginTop:L(U||"0"),marginRight:L(W||"0"),marginBottom:L(B||"0"),marginLeft:L(E||"0"),boxSizing:K}}function AZ(Q){let z=M1(Q);if(z.boxSizing==="border-box")return z.height-z.paddingTop-z.paddingBottom-z.borderTopWidth-z.borderBottomWidth;return z.height}function xz(Q){let z=M1(Q);if(z.boxSizing==="border-box")return z.width-z.paddingLeft-z.paddingRight-z.borderLeftWidth-z.borderRightWidth;return z.width}function x8(Q){let{height:z,marginBottom:J,marginTop:Z}=M1(Q);return Math.floor(z+J+Z)}function w8(Q){let{width:z,marginLeft:J,marginRight:Z}=M1(Q);return Math.floor(z+J+Z)}function N8(Q){let z=Q.getBoundingClientRect(),{borderTopWidth:J,borderLeftWidth:Z,borderRightWidth:$,borderBottomWidth:X}=M1(Q);return{top:z.top+(J||0),left:z.left+(Z||0),right:z.right+($||0),bottom:z.bottom+(X||0)}}function QZ(Q,z){let J=Q.scrollLeft;if(z)J=Math.abs(J);return J}function zZ(Q,z,J){if(J)z*=-1;Q.scrollLeft=z}function z0(Q){while(Q?.firstChild)Q.firstChild.remove()}function T0(Q){if(Q?.parentNode)Q.remove()}function g8(Q){return!!Q.offsetParent}function f0(Q){if(Q.checkVisibility)return Q.checkVisibility({checkVisibilityCSS:!0});return!(!g8(Q)||window.getComputedStyle(Q).visibility!=="visible")}function v5(Q){let z=document.createElement("div");return z.innerHTML=(Q||"").trim(),z.firstChild}function h8(Q,z,J){if(J&&J.nextSibling===z)return;if(!Q.firstChild)Q.appendChild(z);else if(J)if(J.nextSibling)Q.insertBefore(z,J.nextSibling);else Q.appendChild(z);else if(Q.firstChild&&Q.firstChild!==z)Q.prepend(z)}function u8(Q,z){for(let J=0;J`-${z.toLocaleLowerCase()}`)}function $J(Q,z){if(!z)return;for(let J of Object.keys(z)){let Z=z[J];if(!J?.length||Z==null)continue;let $=e4(J),X=Z.toString(),Y=X.replace(/\s*!important/g,""),G=Y.length!=X.length?"important":void 0;Q.style.setProperty($,Y,G)}}function i1(Q){return()=>{let z=Q();if(!z)return!0;return QG(z)||zG(z)}}function QG(Q){return Q.clientWidthX?.disconnect()}function YQ(Q,z){let J=j5(Q);if(J.requestAnimationFrame)J.requestAnimationFrame(z);else if(J.webkitRequestAnimationFrame)J.webkitRequestAnimationFrame(z);else J.setTimeout(z,0)}var p8="data-ref",f2;function B7(){return f2??(f2=document.createTextNode(" ")),f2.cloneNode()}function K0(Q){let{attrs:z,children:J,cls:Z,ref:$,role:X,tag:Y}=Q,G=document.createElement(Y);if(Z)G.className=Z;if($)G.setAttribute(p8,$);if(X)G.setAttribute("role",X);if(z)for(let q of Object.keys(z))G.setAttribute(q,z[q]);if(J)if(typeof J==="string")G.textContent=J;else{let q=!0;for(let H of J)if(H)if(typeof H==="string")G.appendChild(document.createTextNode(H)),q=!1;else if(typeof H==="function")G.appendChild(H());else{if(q)G.appendChild(B7()),q=!1;G.append(K0(H)),G.appendChild(B7())}}return G}var ZG=["touchstart","touchend","touchmove","touchcancel","scroll"],$G=["wheel"],A2={},a2=(()=>{let Q={select:"input",change:"input",submit:"form",reset:"form",error:"img",load:"img",abort:"img"};return(J)=>{if(typeof A2[J]==="boolean")return A2[J];let Z=document.createElement(Q[J]||"div");return J="on"+J,A2[J]=J in Z}})();function jZ(Q,z){if(!z||!Q)return!1;return YG(z).indexOf(Q)>=0}function XG(Q){let z=[],J=Q.target;while(J)z.push(J),J=J.parentElement;return z}function YG(Q){let z=Q;if(z.path)return z.path;if(z.composedPath)return z.composedPath();return XG(z)}function GG(Q,z,J){let Z=qG(z),$;if(Z!=null)$={passive:Z};Q.addEventListener(z,J,$)}var qG=(Q)=>{let z=ZG.includes(Q),J=$G.includes(Q);if(z)return!0;if(J)return!1};function i8(Q,z,J){if(J===0)return!1;let Z=Math.abs(Q.clientX-z.clientX),$=Math.abs(Q.clientY-z.clientY);return Math.max(Z,$)<=J}var G1=(Q,z)=>{let J=Q.identifier;for(let Z=0,$=z.length;Z<$;++Z){let X=z[Z];if(X.identifier===J)return X}return null};function n1(Q,z){return Q.gos.isElementInThisInstance(z.target)}function HG(Q,z,J){let $=Q.getBoundingClientRect().height,X=g4(J)-2,Y=h4(J)-2;if(!Q.offsetParent)return;let q=N8(Q.offsetParent),{clientY:H,clientX:_}=z,U=H-q.top-$/2,W=_-q.left-10,B=Y0(J),E=B.defaultView||window,K=E.pageYOffset||B.documentElement.scrollTop,L=E.pageXOffset||B.documentElement.scrollLeft;if(X>0&&W+Q.clientWidth>X+L)W=X+L-Q.clientWidth;if(W<0)W=0;if(Y>0&&U+Q.clientHeight>Y+K)U=Y+K-Q.clientHeight;if(U<0)U=0;Q.style.left=`${W}px`,Q.style.top=`${U}px`}var pJ=(Q,...z)=>{for(let J of z){let[Z,$,X,Y]=J;Z.addEventListener($,X,Y),Q.push(J)}},I5=(Q)=>{if(Q){for(let[z,J,Z,$]of Q)z.removeEventListener(J,Z,$);Q.length=0}},J1=(Q)=>{if(Q.cancelable)Q.preventDefault()};function _G(Q,z){return z}function n8(Q){return Q?.getLocaleTextFunc()??_G}function UG(Q,z,J,Z){let $=z[J];return Q.getLocaleTextFunc()(J,typeof $==="function"?$(Z):$,Z)}var j0=class{constructor(){this.destroyFunctions=[],this.destroyed=!1,this.__v_skip=!0,this.propertyListenerId=0,this.lastChangeSetIdLookup={},this.isAlive=()=>!this.destroyed}preWireBeans(Q){this.beans=Q,this.stubContext=Q.context,this.eventSvc=Q.eventSvc,this.gos=Q.gos}destroy(){let{destroyFunctions:Q}=this;for(let z=0;znull;let Z;if(WG(Q))Q.__addEventListener(z,J),Z=()=>{return Q.__removeEventListener(z,J),null};else{let $=BG(Q);if(Q instanceof HTMLElement)GG(Q,z,J);else if($)Q.addListener(z,J);else Q.addEventListener(z,J);Z=$?()=>{return Q.removeListener(z,J),null}:()=>{return Q.removeEventListener(z,J),null}}return this.destroyFunctions.push(Z),()=>{return Z(),this.destroyFunctions=this.destroyFunctions.filter(($)=>$!==Z),null}}setupPropertyListener(Q,z){let{gos:J}=this;J.addPropertyEventListener(Q,z);let Z=()=>{return J.removePropertyEventListener(Q,z),null};return this.destroyFunctions.push(Z),()=>{return Z(),this.destroyFunctions=this.destroyFunctions.filter(($)=>$!==Z),null}}addManagedPropertyListener(Q,z){if(this.destroyed)return()=>null;return this.setupPropertyListener(Q,z)}addManagedPropertyListeners(Q,z){if(this.destroyed)return;let J=Q.join("-")+this.propertyListenerId++,Z=($)=>{if($.changeSet){if($.changeSet&&$.changeSet.id===this.lastChangeSetIdLookup[J])return;this.lastChangeSetIdLookup[J]=$.changeSet.id}let X={type:"propertyChanged",changeSet:$.changeSet,source:$.source};z(X)};for(let $ of Q)this.setupPropertyListener($,Z)}getLocaleTextFunc(){return n8(this.beans.localeSvc)}addDestroyFunc(Q){if(this.isAlive())this.destroyFunctions.push(Q);else Q()}createOptionalManagedBean(Q,z){return Q?this.createManagedBean(Q,z):void 0}createManagedBean(Q,z){let J=this.createBean(Q,z);return this.addDestroyFunc(this.destroyBean.bind(this,Q,z)),J}createBean(Q,z,J){return(z||this.stubContext).createBean(Q,J)}destroyBean(Q,z){return(z||this.stubContext).destroyBean(Q)}destroyBeans(Q,z){return(z||this.stubContext).destroyBeans(Q)}};function WG(Q){return Q.__addEventListener!==void 0}function BG(Q){return Q.eventServiceType==="global"}var j=class extends j0{},o2=new Set,RZ=(Q,z)=>{if(!o2.has(z))o2.add(z),Q()};RZ._set=o2;var EG={pending:!1,funcs:[]},KG={pending:!1,funcs:[]};function e2(Q,z="setTimeout",J){let Z=z==="raf"?KG:EG;if(Z.funcs.push(Q),Z.pending)return;Z.pending=!0;let $=()=>{let X=Z.funcs.slice();Z.funcs.length=0,Z.pending=!1;for(let Y of X)Y()};if(z==="raf")YQ(J,$);else window.setTimeout($,0)}function gQ(Q,z,J){let Z;return function(...$){let X=this;return window.clearTimeout(Z),Z=window.setTimeout(function(){if(Q.isAlive())z.apply(X,$)},J),Z}}function E7(Q,z){let J=0;return function(...Z){let $=this,X=Date.now();if(X-J{if(X!=null)window.clearInterval(X),X=null};Q.addDestroyFunc(G);let q=()=>{let H=Date.now()-$>Z;if(z()||H)J(),Y=!0,G()};if(q(),!Y)X=window.setInterval(q,10)}var LG=new Set(["__proto__","constructor","prototype"]);function FG(Q,z){if(Q==null)return;if(Array.isArray(Q)){for(let J=0;J!LG.has(Z)))z(J,Q[J])}function B0(Q,z,J=!0,Z=!1){if(!T(z))return;FG(z,($,X)=>{let Y=Q[$];if(Y===X)return;if(Z){if(Y==null&&X!=null){if(typeof X==="object"&&X.constructor===Object)Y={},Q[$]=Y}}if(K7(X)&&K7(Y)&&!Array.isArray(Y))B0(Y,X,J,Z);else if(J||X!==void 0)Q[$]=X})}function K7(Q){return typeof Q==="object"&&Q!==null}var b5=class Q{static applyGlobalGridOptions(z){if(!Q.gridOptions)return{...z};let J={};if(B0(J,Q.gridOptions,!0,!0),Q.mergeStrategy==="deep")B0(J,z,!0,!0);else J={...J,...z};if(Q.gridOptions.context)J.context=Q.gridOptions.context;if(z.context){if(Q.mergeStrategy==="deep"&&J.context)B0(z.context,J.context,!0,!0);J.context=z.context}return J}static applyGlobalGridOption(z,J){if(Q.mergeStrategy==="deep"){let Z=DG(z);if(Z&&typeof Z==="object"&&typeof J==="object")return Q.applyGlobalGridOptions({[z]:J})[z]}return J}};b5.gridOptions=void 0;b5.mergeStrategy="shallow";var y5=b5;function DG(Q){return y5.gridOptions?.[Q]}var MG={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},d8="https://www.ag-grid.com";function d1(Q,z,...J){if(Q.get("debug"))console.log("AG Grid: "+z,...J)}function zz(Q,...z){RZ(()=>t8(Q,...z),Q+z?.join(""))}function q1(Q,...z){RZ(()=>kG(Q,...z),Q+z?.join(""))}function kG(Q,...z){console.error("AG Grid: "+Q,...z)}function t8(Q,...z){console.warn("AG Grid: "+Q,...z)}var r8=new Set,JZ={},Iz={},iJ,s8=!1,l8=!1,VG=!1;function fG(Q){let[z,J]=Q.version.split(".")||[],[Z,$]=iJ.split(".")||[];return z===Z&&J===$}function AG(Q){if(!iJ)iJ=Q.version;let z=(Z)=>`You are using incompatible versions of AG Grid modules. Major and minor versions should always match across modules. ${Z} Please update all modules to the same version.`;if(!Q.version)q1(z(`'${Q.moduleName}' is incompatible.`));else if(!fG(Q))q1(z(`'${Q.moduleName}' is version ${Q.version} but the other modules are version ${iJ}.`));let J=Q.validate?.();if(J&&!J.isValid)q1(`${J.message}`)}function t1(Q,z,J=!1){if(!J)s8=!0;AG(Q);let Z=Q.rowModels??["all"];r8.add(Q);let $;if(z!==void 0){if(l8=!0,Iz[z]===void 0)Iz[z]={};$=Iz[z]}else $=JZ;for(let X of Z){if($[X]===void 0)$[X]={};$[X][Q.moduleName]=Q}if(Q.dependsOn)for(let X of Q.dependsOn)t1(X,z,J)}function jG(Q){delete Iz[Q]}function Q5(Q,z,J){let Z=($)=>!!JZ[$]?.[Q]||!!Iz[z]?.[$]?.[Q];return Z(J)||Z("all")}function x5(){return l8}function RG(Q,z){let J=Iz[Q]??{};return[...Object.values(JZ.all??{}),...Object.values(J.all??{}),...Object.values(JZ[z]??{}),...Object.values(J[z]??{})]}function SG(){return new Set(r8)}function a8(Q,z){let J=Iz[Q]??{};return[...Object.values(J.all??{}),...Object.values(J[z]??{})]}function OG(){return s8}function w5(){return VG}var N5=class{static register(Q){t1(Q,void 0)}static registerModules(Q){for(let z of Q)t1(z,void 0)}};var p="35.2.1",L7=2000,F7=100,o8="_version_",e8=null,H1=`${d8}/javascript-data-grid`;function PG(Q){e8=Q}function TG(Q){H1=Q}function Q9(Q,z,J){return e8?.(Q,z)??[bG(Q,z,J)]}function SZ(Q,z,J,Z,$){Q(`${Z?"warning":"error"} #${z}`,...Q9(z,J,$))}function vG(Q){if(!Q)return String(Q);let z={};for(let J of Object.keys(Q))if(typeof Q[J]!=="object"&&typeof Q[J]!=="function")z[J]=Q[J];return JSON.stringify(z)}function IG(Q){let z=Q;if(Q instanceof Error)z=Q.toString();else if(typeof Q==="object")z=vG(Q);return z}function nJ(Q){return Q===void 0?"undefined":Q===null?"null":Q}function z5(Q,z){return`${Q}?${z.toString()}`}function CG(Q,z,J){let Z=Array.from(z.entries()).sort((X,Y)=>Y[1].length-X[1].length),$=z5(Q,z);for(let[X,Y]of Z){if(X===o8)continue;let G=$.length-J;if(G<=0)break;let q="...",H=G+q.length,_=Y.length-H>F7?Y.slice(0,Y.length-H)+q:Y.slice(0,F7)+q;z.set(X,_),$=z5(Q,z)}return $}function z9(Q,z){let J=new URLSearchParams;if(J.append(o8,p),z)for(let X of Object.keys(z))J.append(X,IG(z[X]));let Z=`${H1}/errors/${Q}`,$=z5(Z,J);return $.length<=L7?$:CG(Z,J,L7)}var bG=(Q,z,J)=>{let Z=z9(Q,z),$=`${J?J+` -`:""}Visit ${Z}`;if(w5())return $;return`${$}${J?"":` - Alternatively register the ValidationModule to see the full message in the console.`}`};function R(...Q){SZ(zz,Q[0],Q[1],!0)}function e(...Q){SZ(q1,Q[0],Q[1],!1)}function y1(Q,z,J){SZ(q1,Q,z,!1,J)}function J9(Q,z,J){SZ(zz,Q,z,!0,J)}function yG(Q,z){let J=z[0];return`error #${J} `+Q9(J,z[1],Q).join(" ")}function QQ(...Q){return yG(void 0,Q)}function Z9(Q,z){return Q.get("rowModelType")===z}function o(Q,z){return Z9(Q,"clientSide")}function Hz(Q,z){return Z9(Q,"serverSide")}function V0(Q,z){return Q.get("domLayout")===z}function hQ(Q){return ZZ(Q)!==void 0}function $9(Q){return typeof Q.get("getRowHeight")==="function"}function xG(Q,z){if(z)return!Q.get("enableStrictPivotColumnOrder");return Q.get("maintainColumnOrder")}function wG({gos:Q,formula:z}){let J=Q.get("rowNumbers");return J||!!z?.active&&J!==!1}function r1(Q,z,J=!1,Z){let{gos:$,environment:X}=Q;if(Z==null)Z=X.getDefaultRowHeight();if($9($)){if(J)return{height:Z,estimated:!0};let q={node:z,data:z.data},H=$.getCallback("getRowHeight")(q);if(J5(H)){if(H===0)R(23);return{height:Math.max(1,H),estimated:!1}}}if(z.detail&&$.get("masterDetail"))return NG($);let Y=$.get("rowHeight");return{height:Y&&J5(Y)?Y:Z,estimated:!1}}function NG(Q){if(Q.get("detailRowAutoHeight"))return{height:1,estimated:!1};let z=Q.get("detailRowHeight");if(J5(z))return{height:z,estimated:!1};return{height:300,estimated:!1}}function X9(Q){let{environment:z,gos:J}=Q,Z=J.get("rowHeight");if(!Z||n(Z))return z.getDefaultRowHeight();let $=z.refreshRowHeightVariable();if($!==-1)return $;return R(24),z.getDefaultRowHeight()}function J5(Q){return!isNaN(Q)&&typeof Q==="number"&&isFinite(Q)}function Y9(Q,z,J){let Z=z[Q.getDomDataKey()];return Z?Z[J]:void 0}function wz(Q,z,J,Z){let $=Q.getDomDataKey(),X=z[$];if(n(X))X={},z[$]=X;X[J]=Z}function _1(Q){if(Q.get("ensureDomOrder"))return!1;return Q.get("animateRows")}function k1(Q){return!(Q.get("paginateChildRows")||Q.get("groupHideOpenParents")||V0(Q,"print"))}function WQ(Q){return!Q.get("autoGroupColumnDef")?.comparator&&!Q.get("treeData")}function TQ(Q){let z=Q.get("groupAggFiltering");if(typeof z==="function")return Q.getCallback("groupAggFiltering");if(z===!0)return()=>!0;return}function _z(Q){return Q.get("grandTotalRow")}function OZ(Q){let z=Q.get("groupTotalRow");if(typeof z==="function")return Q.getCallback("groupTotalRow");return()=>z??void 0}function YJ(Q){if(!!Q.get("groupHideOpenParents"))return!0;return Q.get("groupDisplayType")==="multipleColumns"}function g5(Q){return YJ(Q)&&Q.get("groupHideColumnsUntilExpanded")&&o(Q)}function PZ(Q,z){if(z)return!1;return Q.get("groupDisplayType")==="groupRows"}function G9(Q,z,J){return!!z.group&&!z.footer&&PZ(Q,J)}function Z5(Q){let z=Q.getCallback("getRowId");if(z===void 0)return z;return(J)=>{let Z=z(J);if(typeof Z!=="string")RZ(()=>R(25,{id:Z}),"getRowIdString"),Z=String(Z);return Z}}function gG(Q,z){let J=Q.get("groupHideParentOfSingleChild");if(J===!0)return!0;if(J==="leafGroupsOnly"&&z.leafGroup)return!0;if(Q.get("groupRemoveSingleChildren"))return!0;if(Q.get("groupRemoveLowestSingleChildren")&&z.leafGroup)return!0;return!1}function TZ(Q,z){let J=Q.get("suppressGroupChangesColumnVisibility");if(J===!0)return!1;if(z&&J==="suppressHideOnGroup")return!1;if(!z&&J==="suppressShowOnUngroup")return!1;let Z=Q.get("suppressRowGroupHidesColumns");if(z&&Z===!0)return!1;let $=Q.get("suppressMakeColumnVisibleAfterUnGroup");if(!z&&$===!0)return!1;return!0}function Jz(Q){return Q?.checkboxes??!0}function dJ(Q){return Q?.mode==="multiRow"&&(Q.headerCheckbox??!0)}function E1(Q){if(typeof Q!=="object")return;return Q.checkboxLocation??"selectionColumn"}function j2(Q){return Q?.hideDisabledCheckboxes??!1}function hG(Q){return typeof Q.get("rowSelection")!=="string"}function q9(Q){return Q.get("cellSelection")!==void 0}function H9(Q){let z=Q.get("cellSelection");if(z===void 0)return Q.get("suppressMultiRangeSelection");return typeof z!=="boolean"?z?.suppressMultiRanges??!1:!1}function u0(Q){let z=Q.get("cellSelection");return z!==void 0?!!z:Q.get("enableRangeSelection")}function vZ(Q){let z=Q.get("cellSelection");if(z===void 0)return{mode:"fill",setFillValue:Q.get("fillOperation"),direction:Q.get("fillHandleDirection"),suppressClearOnFillReduction:Q.get("suppressClearOnFillReduction")};return typeof z!=="boolean"&&z.handle?.mode==="fill"?z.handle:void 0}function Zz(Q){let z=Q.get("cellSelection")??!1;return(typeof z==="object"&&z.enableColumnSelection)??!1}function _9(Q){let z=Q.get("rowSelection")??"single";if(typeof z==="string"){let J=Q.get("suppressRowClickSelection"),Z=Q.get("suppressRowDeselection");if(J&&Z)return!1;else if(J)return"enableDeselection";else if(Z)return"enableSelection";else return!0}return z.mode==="singleRow"||z.mode==="multiRow"?z.enableClickSelection??!1:!1}function uG(Q){let z=_9(Q);return z===!0||z==="enableSelection"}function mG(Q){let z=_9(Q);return z===!0||z==="enableDeselection"}function $5(Q){let z=Q.get("rowSelection");if(typeof z==="string")return Q.get("isRowSelectable");return z?.isRowSelectable}function ZZ(Q){let z="beanName"in Q&&Q.beanName==="gos"?Q.get("rowSelection"):Q.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 s1(Q){return ZZ(Q)==="multiRow"}function cG(Q){let z=Q.get("rowSelection");if(typeof z==="string")return Q.get("rowMultiSelectWithClick");return z?.enableSelectionWithoutKeys??!1}function $Z(Q){let z=Q.get("rowSelection");if(typeof z==="string"){let J=Q.get("groupSelectsChildren"),Z=Q.get("groupSelectsFiltered");if(J&&Z)return"filteredDescendants";else if(J)return"descendants";else return"self"}return z?.mode==="multiRow"?z.groupSelects:void 0}function U9(Q,z=!0){let J=Q.get("rowSelection");if(typeof J!=="object")return z?"all":void 0;return J.mode==="multiRow"?J.selectAll:"all"}function pG(Q){let z=Q.get("rowSelection");if(typeof z==="string")return!1;return z?.mode==="multiRow"?z.ctrlASelectsRows??!1:!1}function l1(Q){let z=$Z(Q);return z==="descendants"||z==="filteredDescendants"}function D7(Q){let z=Q.get("rowSelection");return typeof z==="object"&&z.masterSelects||"self"}function iG(Q){return Q.isModuleRegistered("SetFilter")&&!Q.get("suppressSetFilterByDefault")}function U0(Q){return Q.get("columnMenu")==="legacy"}function h5(Q){return!U0(Q)}function nG(Q){if(!Q||Q.length<2)return Q;return"on"+Q[0].toUpperCase()+Q.substring(1)}function y(Q,z){return Q.addCommon(z)}function u5({gos:Q},z){return z.button===2||z.ctrlKey&&Q.get("allowContextMenuWithControlKey")}var dG={resizable:!0,sortable:!0},tG=0;function W9(){return tG++}function JQ(Q){return Q instanceof GQ}var rG=["asc","desc",null],sG=[{type:"absolute",direction:"asc"},{type:"absolute",direction:"desc"},null],GQ=class extends j{constructor(Q,z,J,Z){super();this.colDef=Q,this.userProvidedColDef=z,this.colId=J,this.primary=Z,this.isColumn=!0,this.instanceId=W9(),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 KQ,this.tooltipEnabled=!1,this.rowGroupActive=!1,this.pivotActive=!1,this.aggregationActive=!1,this.flex=null,this.colIdSanitised=W0(J)}destroy(){super.destroy(),this.beans.rowSpanSvc?.deregister(this)}getInstanceId(){return this.instanceId}initState(){let{colDef:Q,beans:{sortSvc:z,pinnedCols:J,colFlex:Z}}=this;z?.initCol(this);let $=Q.hide;if($!==void 0)this.visible=!$;else this.visible=!Q.initialHide;J?.initCol(this),Z?.initCol(this)}setColDef(Q,z,J){let Z=Q.spanRows!==this.colDef.spanRows;if(this.colDef=Q,this.userProvidedColDef=z,this.initMinAndMaxWidths(),this.initDotNotation(),this.initTooltip(),Z)this.beans.rowSpanSvc?.deregister(this),this.initRowSpan();this.dispatchColEvent("colDefChanged",J)}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:Q,colDef:{field:z,tooltipField:J}}=this,Z=Q.get("suppressFieldDotNotation");this.fieldContainsDots=T(z)&&z.includes(".")&&!Z,this.tooltipFieldContainsDots=T(J)&&J.includes(".")&&!Z}initMinAndMaxWidths(){let Q=this.colDef;this.minWidth=Q.minWidth??this.beans.environment.getDefaultColumnMinWidth(),this.maxWidth=Q.maxWidth??Number.MAX_SAFE_INTEGER}initTooltip(){this.beans.tooltipSvc?.initCol(this)}initRowSpan(){if(this.colDef.spanRows)this.beans.rowSpanSvc?.register(this)}addPivotListener(){let Q=this.beans.pivotColDefSvc,z=this.colDef.pivotValueColumn;if(!Q||!z)return;this.addManagedListeners(z,{colDefChanged:(J)=>{let Z=Q.recreateColDef(this.colDef);this.setColDef(Z,Z,J.source)}})}resetActualWidth(Q){let z=this.calculateColInitialWidth(this.colDef);this.setActualWidth(z,Q,!0)}calculateColInitialWidth(Q){let z=Q.width??Q.initialWidth??200;return Math.max(Math.min(z,this.maxWidth),this.minWidth)}isEmptyGroup(){return!1}isRowGroupDisplayed(Q){return this.beans.showRowGroupCols?.isRowGroupDisplayed(this,Q)??!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(Q,z){this.colEventSvc.addEventListener(Q,z)}__removeEventListener(Q,z){this.colEventSvc.removeEventListener(Q,z)}addEventListener(Q,z){this.frameworkEventListenerService=this.beans.frameworkOverrides.createLocalEventListenerWrapper?.(this.frameworkEventListenerService,this.colEventSvc);let J=this.frameworkEventListenerService?.wrap(Q,z)??z;this.colEventSvc.addEventListener(Q,J)}removeEventListener(Q,z){let J=this.frameworkEventListenerService?.unwrap(Q,z)??z;this.colEventSvc.removeEventListener(Q,J)}createColumnFunctionCallbackParams(Q){return y(this.gos,{node:Q,data:Q.data,column:this,colDef:this.colDef})}isSuppressNavigable(Q){return this.beans.cellNavigation?.isSuppressNavigable(this,Q)??!1}isCellEditable(Q){return this.beans.editSvc?.isCellEditable({rowNode:Q,column:this})??!1}isSuppressFillHandle(){return!!this.colDef.suppressFillHandle}isAutoHeight(){return!!this.colDef.autoHeight}isAutoHeaderHeight(){return!!this.colDef.autoHeaderHeight}isRowDrag(Q){return this.isColumnFunc(Q,this.colDef.rowDrag)}isDndSource(Q){return this.isColumnFunc(Q,this.colDef.dndSource)}isCellCheckboxSelection(Q){return this.beans.selectionSvc?.isCellCheckboxSelection(this,Q)??!1}isSuppressPaste(Q){return this.isColumnFunc(Q,this.colDef?.suppressPaste??null)}isResizable(){return!!this.getColDefValue("resizable")}getColDefValue(Q){return this.colDef[Q]??dG[Q]}isColumnFunc(Q,z){if(typeof z==="boolean")return z;if(typeof z==="function"){let J=this.createColumnFunctionCallbackParams(Q);return z(J)}return!1}createColumnEvent(Q,z){return y(this.gos,{type:Q,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 Q=[],{sort:z,initialSort:J}=this.colDef,Z=z===null?z:LQ(z?.type),$=J===null?J:LQ(J?.type);if(Z)Q.push(Z);if($)Q.push($);return Q}getSortingOrder(){let Q=this.getColDefAllowedSortTypes().includes("absolute")?sG:rG;return(this.colDef.sortingOrder??this.gos.get("sortingOrder")??Q).map((z)=>a0(z))}getAvailableSortTypes(){let Q=this.getSortingOrder().reduce((z,J)=>{if(J.direction)z.push(J.type);return z},this.getColDefAllowedSortTypes());return new Set(Q)}get wasSortExplicitlyRemoved(){return this._wasSortExplicitlyRemoved}setSortDef(Q,z=!1){if(!z)this._wasSortExplicitlyRemoved=!Q.direction;this.sortDef=Q}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(Q,z){if(this.oldLeft=this.left,this.left!==Q)this.left=Q,this.dispatchColEvent("leftChanged",z)}isFilterActive(){return this.filterActive}isHovered(){return R(261),!!this.beans.colHover?.isHovered(this)}setFirstRightPinned(Q,z){if(this.firstRightPinned!==Q)this.firstRightPinned=Q,this.dispatchColEvent("firstRightPinnedChanged",z)}setLastLeftPinned(Q,z){if(this.lastLeftPinned!==Q)this.lastLeftPinned=Q,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(Q,z){let J=Q===!0;if(this.visible!==J)this.visible=J,this.dispatchColEvent("visibleChanged",z);this.dispatchStateUpdatedEvent("hide")}isVisible(){return this.visible}isSpanHeaderHeight(){return!this.getColDef().suppressSpanHeaderHeight}getFirstRealParent(){let Q=this.getOriginalParent();while(Q?.isPadding())Q=Q.getOriginalParent();return Q}getColumnGroupPaddingInfo(){let Q=this.getParent();if(!Q?.isPadding())return{numberOfParents:0,isSpanningTotal:!1};let z=Q.getPaddingLevel()+1,J=!0;while(Q){if(!Q.isPadding()){J=!1;break}Q=Q.getParent()}return{numberOfParents:z,isSpanningTotal:J}}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(Q){let z=Q!==this.autoHeaderHeight;return this.autoHeaderHeight=Q,z}createBaseColDefParams(Q){return y(this.gos,{node:Q,data:Q.data,colDef:this.colDef,column:this})}getColSpan(Q){if(n(this.colDef.colSpan))return 1;let z=this.createBaseColDefParams(Q),J=this.colDef.colSpan(z);return Math.max(J,1)}getRowSpan(Q){if(n(this.colDef.rowSpan))return 1;let z=this.createBaseColDefParams(Q),J=this.colDef.rowSpan(z);return Math.max(J,1)}setActualWidth(Q,z,J=!1){if(Q=Math.max(Q,this.minWidth),Q=Math.min(Q,this.maxWidth),this.actualWidth!==Q){if(this.actualWidth=Q,this.flex!=null&&z!=="flex"&&z!=="gridInitializing")this.flex=null;if(!J)this.fireColumnWidthChangedEvent(z)}this.dispatchStateUpdatedEvent("width")}fireColumnWidthChangedEvent(Q){this.dispatchColEvent("widthChanged",Q)}isGreaterThanMax(Q){return Q>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(Q,z,J){let Z=this.createColumnEvent(Q,z);if(J)B0(Z,J);this.colEventSvc.dispatchEvent(Z)}dispatchStateUpdatedEvent(Q){this.colEventSvc.dispatchEvent({type:"columnStateUpdated",key:Q})}};function a0(Q){if(U1(Q))return{direction:Q.direction,type:Q.type};return{direction:IZ(Q),type:LQ(Q)}}function $z(Q){return Q==="asc"||Q==="desc"||Q===null}function m5(Q){return Q==="default"||Q==="absolute"}function U1(Q){if(!Q||typeof Q!=="object")return!1;let z=Q;return m5(z.type)&&$z(z.direction)}function tJ(Q,z){if(!Q)return z?z.direction===null:!0;if(!z)return Q?Q.direction===null:!0;return Q.type===z.type&&Q.direction===z.direction}function IZ(Q){return $z(Q)?Q:null}function LQ(Q){return m5(Q)?Q:"default"}function c5(Q,z,J){let $=J?.()??z.sortSvc.getDisplaySortForColumn(Q),X=LQ($?.type),Y=IZ($?.direction),G=Q.getAvailableSortTypes(),q=G.has("default"),H=G.has("absolute");return{isDefaultSortAllowed:q,isAbsoluteSortAllowed:H,isAbsoluteSort:X==="absolute",isDefaultSort:X==="default",isAscending:Y==="asc",isDescending:Y==="desc",direction:Y}}function G0(Q){return Q instanceof Cz}var Cz=class extends j{constructor(Q,z,J,Z){super();this.colGroupDef=Q,this.groupId=z,this.padding=J,this.level=Z,this.isColumn=!1,this.expandable=!1,this.instanceId=W9(),this.expandableListenerRemoveCallback=null,this.expanded=!!Q?.openByDefault}destroy(){if(this.expandableListenerRemoveCallback)this.reset(null,void 0);super.destroy()}reset(Q,z){if(this.colGroupDef=Q,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((Q)=>Q.isVisible());return!1}isPadding(){return this.padding}setExpanded(Q){this.expanded=Q===void 0?!1:Q,this.dispatchLocalEvent({type:"expandedChanged"})}isExpandable(){return this.expandable}isExpanded(){return this.expanded}getGroupId(){return this.groupId}getId(){return this.getGroupId()}setChildren(Q){this.children=Q}getChildren(){return this.children}getColGroupDef(){return this.colGroupDef}getLeafColumns(){let Q=[];return this.addLeafColumns(Q),Q}forEachLeafColumn(Q){if(!this.children)return;for(let z of this.children)if(JQ(z))Q(z);else if(G0(z))z.forEachLeafColumn(Q)}addLeafColumns(Q){if(!this.children)return;for(let z of this.children)if(JQ(z))Q.push(z);else if(G0(z))z.addLeafColumns(Q)}getColumnGroupShow(){let Q=this.colGroupDef;if(!Q)return;return Q.columnGroupShow}setupExpandable(){if(this.setExpandable(),this.expandableListenerRemoveCallback)this.expandableListenerRemoveCallback();let Q=this.onColumnVisibilityChanged.bind(this);for(let z of this.getLeafColumns())z.__addEventListener("visibleChanged",Q);this.expandableListenerRemoveCallback=()=>{for(let z of this.getLeafColumns())z.__removeEventListener("visibleChanged",Q);this.expandableListenerRemoveCallback=null}}setExpandable(){if(this.isPadding())return;let Q=!1,z=!1,J=!1,Z=this.findChildrenRemovingPadding();for(let X=0,Y=Z.length;X{for(let Z of J)if(G0(Z)&&Z.isPadding())z(Z.children);else Q.push(Z)};return z(this.children),Q}onColumnVisibilityChanged(){this.setExpandable()}},lG={numericColumn:{headerClass:"ag-right-aligned-header",cellClass:"ag-right-aligned-cell"},rightAligned:{headerClass:"ag-right-aligned-header",cellClass:"ag-right-aligned-cell"}};function X5(Q,z,J){let Z={},$=Q.gos;return Object.assign(Z,$.get("defaultColGroupDef")),Object.assign(Z,z),$.validateColDef(Z,J),Z}var aG=class{constructor(){this.existingKeys={}}addExistingKeys(Q){for(let z=0;z0)R(273,{providedId:Q,usedId:$});return this.existingKeys[$]=!0,$}J++}}},B9=(Q,z)=>{if(G0(Q))Q.setupExpandable();Q.originalParent=z};function E9(Q,z=null,J,Z,$){let{existingCols:X,existingGroups:Y}=K9(Z),G=new Map(X.map((K)=>[K.getId(),K])),q=new Map(Y.map((K)=>[K.getId(),K])),H=0,_=(K,L)=>{if(H=Math.max(H,L),M9(K)){if(!Q.colGroupSvc)return null;let k=K.groupId,f=q.get(k),A=X5(Q,K,k),O=new Cz(A,k,!1,L);if(Q.context.createBean(O),f)O.setExpanded(f.isExpanded());return O.setChildren(K.children.map((v)=>_(v,L+1))),O}let F=K.colId,D=G.get(F),M=uQ(Q,K,D?.getColId()??F);if(!D)D=new GQ(M,K,F,J),Q.context.createBean(D);else D.setColDef(M,K,$),D9(Q,D,M,$);return Q.dataTypeSvc?.addColumnListeners(D),D},U=z?.map((K)=>_(K,0))??[],W=0,B={getUniqueKey:(K,L)=>String(++W)},E=Q.colGroupSvc?Q.colGroupSvc.balanceColumnTree(U,0,H,B):U;return OQ(null,E,B9),{columnTree:E,treeDepth:H}}function p5(Q,z=null,J,Z,$){let X=new aG,{existingCols:Y,existingGroups:G,existingColKeys:q}=K9(Z);X.addExistingKeys(q);let H=L9(Q,z,0,J,Y,X,G,$),{colGroupSvc:_}=Q,U=_?.findMaxDepth(H,0)??0,W=_?_.balanceColumnTree(H,0,U,X):H;return OQ(null,W,B9),{columnTree:W,treeDepth:U}}function K9(Q){let z=[],J=[],Z=[];if(Q)OQ(null,Q,($)=>{if(G0($)){let X=$;J.push(X)}else{let X=$;Z.push(X.getId()),z.push(X)}});return{existingCols:z,existingGroups:J,existingColKeys:Z}}function L9(Q,z,J,Z,$,X,Y,G){if(!z)return[];let{colGroupSvc:q}=Q,H=Array(z.length);for(let _=0;_0)return;if(J.width!=null)z.setActualWidth(J.width,Z);else{let X=z.getActualWidth();z.setActualWidth(X,Z)}}function eG(Q,z){if(!z)return;for(let J=0;J{for(let $=0;$z+J.getActualWidth(),0)}function ZQ(Q,z,J){let Z={};if(!z)return;if(OQ(null,z,(X)=>{Z[X.getInstanceId()]=X}),J)OQ(null,J,(X)=>{Z[X.getInstanceId()]=null});let $=Object.values(Z).filter((X)=>X!=null);Q.context.destroyBeans($)}function mz(Q){return Q.getId().startsWith(uz)}function IQ(Q){return(typeof Q==="string"?Q:("getColId"in Q)?Q.getColId():Q.colId)?.startsWith(k9)??!1}function v0(Q){return(typeof Q==="string"?Q:("getColId"in Q)?Q.getColId():Q.colId)?.startsWith(V9)??!1}function GJ(Q){return IQ(Q)||v0(Q)}function XZ(Q){let z=[];if(Q instanceof Array)z=Q;else if(typeof Q==="string")z=Q.split(",");return z}function qJ(Q,z){return X0(Q,z,(J,Z)=>J.getColId()===Z.getColId())}function HJ(Q){Q.map={};for(let z of Q.list)Q.map[z.getId()]=z}function Xz(Q){return Q==="optionsUpdated"?"gridOptionsChanged":Q}function PQ(Q,z){return Q===z||Q.colId==z||Q.getColDef()===z}var Jq=(Q,z)=>(J,Z)=>{let $={value1:void 0,value2:void 0},X=!1;if(Q){if(Q[J]!==void 0)$.value1=Q[J],X=!0;if(T(Z)&&Q[Z]!==void 0)$.value2=Q[Z],X=!0}if(!X&&z){if(z[J]!==void 0)$.value1=z[J];if(T(Z)&&z[Z]!==void 0)$.value2=z[Z]}return $};function i5(Q,z){let J={...Q,sort:void 0,colId:z},Z=A9(Q);if(Z)J.sort=Z.direction,J.sortType=Z.type;return J}function A9(Q){let{sort:z,initialSort:J}=Q,Z=U1(z)||$z(z),$=U1(J)||$z(J);if(Z)return a0(z);if($)return a0(J);return null}function j9(Q,z){return Q+"_"+z}function _0(Q){return Q instanceof a1}var a1=class extends j{constructor(Q,z,J,Z){super();this.providedColumnGroup=Q,this.groupId=z,this.partId=J,this.pinned=Z,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 j9(this.groupId,this.partId)}isEmptyGroup(){return this.displayedChildren.length===0}isMoving(){let Q=this.getProvidedColumnGroup().getLeafColumns();if(!Q||Q.length===0)return!1;return Q.every((z)=>z.isMoving())}checkLeft(){for(let Q of this.displayedChildren)if(_0(Q))Q.checkLeft();if(this.displayedChildren.length>0)if(this.gos.get("enableRtl")){let z=b(this.displayedChildren).getLeft();this.setLeft(z)}else{let Q=this.displayedChildren[0].getLeft();this.setLeft(Q)}else this.setLeft(null)}getLeft(){return this.left}getOldLeft(){return this.oldLeft}setLeft(Q){if(this.oldLeft=this.left,this.left!==Q)this.left=Q,this.dispatchLocalEvent({type:"leftChanged"})}getPinned(){return this.pinned}getGroupId(){return this.groupId}getPartId(){return this.partId}getActualWidth(){let Q=0;for(let z of this.displayedChildren??[])Q+=z.getActualWidth();return Q}isResizable(){if(!this.displayedChildren)return!1;let Q=!1;for(let z of this.displayedChildren)if(z.isResizable())Q=!0;return Q}getMinWidth(){let Q=0;for(let z of this.displayedChildren)Q+=z.getMinWidth();return Q}addChild(Q){if(!this.children)this.children=[];this.children.push(Q)}getDisplayedChildren(){return this.displayedChildren}getLeafColumns(){let Q=[];return this.addLeafColumns(Q),Q}getDisplayedLeafColumns(){let Q=[];return this.addDisplayedLeafColumns(Q),Q}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(Q){this.providedColumnGroup.setExpanded(Q)}isAutoHeaderHeight(){return!!this.getColGroupDef()?.autoHeaderHeight}getAutoHeaderHeight(){return this.autoHeaderHeight}setAutoHeaderHeight(Q){let z=Q!==this.autoHeaderHeight;return this.autoHeaderHeight=Q,z}addDisplayedLeafColumns(Q){for(let z of this.displayedChildren??[])if(JQ(z))Q.push(z);else if(_0(z))z.addDisplayedLeafColumns(Q)}addLeafColumns(Q){for(let z of this.children??[])if(JQ(z))Q.push(z);else if(_0(z))z.addLeafColumns(Q)}getChildren(){return this.children}getColumnGroupShow(){return this.providedColumnGroup.getColumnGroupShow()}getProvidedColumnGroup(){return this.providedColumnGroup}getPaddingLevel(){let Q=this.getParent();if(!this.isPadding()||!Q?.isPadding())return 0;return 1+Q.getPaddingLevel()}calculateDisplayedColumns(){this.displayedChildren=[];let Q=this;while(Q?.isPadding())Q=Q.getParent();if(!(Q?Q.getProvidedColumnGroup().isExpandable():!1)){this.displayedChildren=this.children,this.dispatchLocalEvent({type:"displayedChildrenChanged"});return}for(let J of this.children??[]){if(_0(J)&&!J.displayedChildren?.length)continue;switch(J.getColumnGroupShow()){case"open":if(Q.getProvidedColumnGroup().isExpanded())this.displayedChildren.push(J);break;case"closed":if(!Q.getProvidedColumnGroup().isExpanded())this.displayedChildren.push(J);break;default:this.displayedChildren.push(J);break}}this.dispatchLocalEvent({type:"displayedChildrenChanged"})}},V={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"},Zq=65,$q=67,Xq=86,Yq=68,Gq=90,qq=89;function R9(Q){let{keyCode:z}=Q,J;switch(z){case Zq:J=V.A;break;case $q:J=V.C;break;case Xq:J=V.V;break;case Yq:J=V.D;break;case Gq:J=V.Z;break;case qq:J=V.Y;break;default:J=Q.code}return J}function Hq(Q,z){return new g((J)=>{J(window.setInterval(Q,z))})}var g=class Q{constructor(z){this.status=0,this.resolution=null,this.waiters=[],z((J)=>this.onDone(J),(J)=>this.onReject(J))}static all(z){return z.length?new Q((J)=>{let Z=z.length,$=Array(Z);z.forEach((X,Y)=>{X.then((G)=>{if($[Y]=G,Z--,Z===0)J($)})})}):Q.resolve()}static resolve(z=null){return new Q((J)=>J(z))}then(z){return new Q((J)=>{if(this.status===1)J(z(this.resolution));else this.waiters.push((Z)=>J(z(Z)))})}onDone(z){this.status=1,this.resolution=z;for(let J of this.waiters)J(z)}onReject(z){}},_q=class extends j0{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(Q,z=!1){let J={capturePointer:!0,dragSource:Q,eElement:Q.eElement,dragStartPixels:Q.dragStartPixels,onDragStart:(Z)=>this.onDragStart(Q,Z),onDragStop:this.onDragStop.bind(this),onDragging:this.onDragging.bind(this),onDragCancel:this.onDragCancel.bind(this),includeTouch:z};this.dragSourceAndParamsList.push(J),this.beans.dragSvc.addDragSource(J)}setDragImageCompIcon(Q,z=!1){let J=this.dragImageComp;if(J&&(z||this.dragImageLastIcon!==Q))this.dragImageLastIcon=Q,J.setIcon(Q,z)}removeDragSource(Q){let{dragSourceAndParamsList:z,beans:J}=this;for(let Z=0,$=z.length;Z<$;Z++)if(z[Z].dragSource===Q){let X=z[Z];J.dragSvc?.removeDragSource(X),z.splice(Z,1);break}}destroy(){let{dragSourceAndParamsList:Q,dropTargets:z,beans:J}=this,Z=J.dragSvc;for(let $ of Q)Z?.removeDragSource($);Q.length=0,z.length=0,this.externalDropZoneCount=0,this.clearDragAndDropProperties(),super.destroy()}nudge(){let Q=this.lastMouseEvent;if(Q)this.onDragging(Q,!0)}onDragStart(Q,z){this.lastMouseEvent=z,this.dragSource=Q,this.dragItem=Q.getDragItem();let J=Q.eElement.getBoundingClientRect();this.dragInitialSourcePointerOffsetX=z.clientX-J.left,this.dragInitialSourcePointerOffsetY=z.clientY-J.top,Q.onDragStarted?.(),this.createAndUpdateDragImageComp(Q)}onDragStop(Q){let{dragSource:z,lastDropTarget:J}=this;if(z?.onDragStopped?.(),J){let Z=this.dropTargetEvent(J,Q,!1);J.onDragStop?.(Z)}this.clearDragAndDropProperties()}onDragCancel(){let{dragSource:Q,lastDropTarget:z,lastMouseEvent:J}=this;if(Q?.onDragCancelled?.(),z&&J){let Z=this.dropTargetEvent(z,J,!1);z.onDragCancel?.(Z)}this.clearDragAndDropProperties()}onDragging(Q,z=!1){this.positionDragImageComp(Q);let J=this.findCurrentDropTarget(Q),{lastDropTarget:Z,dragSource:$,dragItem:X}=this,Y=!1;if(J!==Z){if(Y=!0,Z){let G=this.dropTargetEvent(Z,Q,z);Z.onDragLeave?.(G)}if(Z!==null&&!J)this.handleExit($,X);else if(Z===null&&J)this.handleEnter($,X);if(J){let G=this.dropTargetEvent(J,Q,z);J.onDragEnter?.(G)}this.lastDropTarget=J}else if(J){let G=this.dropTargetEvent(J,Q,z);if(J.onDragging?.(G),G?.changed)Y=!0}if(this.lastMouseEvent=Q,Y)this.updateDragImageComp()}clearDragAndDropProperties(){this.removeDragImageComp(this.dragImageComp),this.dragImageCompPromise=null,this.dragImageLastIcon=void 0,this.dragImageLastLabel=void 0,this.lastMouseEvent=null,this.lastDraggingEvent=null,this.lastDropTarget=null,this.dragItem=null,this.dragInitialSourcePointerOffsetX=0,this.dragInitialSourcePointerOffsetY=0,this.dragSource=null}getAllContainersFromDropTarget(Q){let z=Q.getContainer(),J=Q.getSecondaryContainers?.(),Z=J?.length;if(!Z)return[[z]];let $=Array(Z+1);$[0]=[z];for(let X=0;X{for(let H of q){let{width:_,height:U,left:W,right:B,top:E,bottom:K}=H.getBoundingClientRect();if(_===0||U===0)return!1;let L=G.clientX>=W&&G.clientX=E&&G.clientY0}findExternalZone(Q){let z=this.dropTargets;for(let J=0,Z=z.length;J0?"down":E<0?"up":null,hDirection:B<0?"left":B>0?"right":null,initialSourcePointerOffsetX:G,initialSourcePointerOffsetY:q,dragSource:Z,fromNudge:J,dragItem:$,dropZoneTarget:H,dropTarget:X?.dropTarget??null,changed:!!X?.changed});return this.lastDraggingEvent=K,K}positionDragImageComp(Q){let z=this.dragImageComp?.getGui();if(z)HG(z,Q,this.beans)}removeDragImageComp(Q){if(this.dragImageComp===Q)this.dragImageComp=null;if(Q)Q.getGui()?.remove(),this.destroyBean(Q)}createAndUpdateDragImageComp(Q){let z=this.createDragImageComp(Q)??null;this.dragImageCompPromise=z,z?.then((J)=>{let Z=this.lastMouseEvent;if(z!==this.dragImageCompPromise||!Z||!this.isAlive()){this.destroyBean(J);return}this.dragImageCompPromise=null,this.dragImageLastIcon=void 0,this.dragImageLastLabel=void 0;let $=this.dragImageComp;if($!==J)this.dragImageComp=J,this.removeDragImageComp($);if(J)this.appendDragImageComp(J),this.updateDragImageComp(),this.positionDragImageComp(Z)})}appendDragImageComp(Q){let z=Q.getGui(),J=z.style;if(J.position="absolute",J.zIndex="9999",this.beans.dragSvc?.hasPointerCapture())J.pointerEvents="none";this.gos.setInstanceDomData(z),this.beans.environment.applyThemeClasses(z),J.top="20px",J.left="20px";let Z=D1(this.beans);if(!Z)this.warnNoBody();else Z.appendChild(z)}updateDragImageComp(){let{dragImageComp:Q,dragSource:z,lastDropTarget:J,lastDraggingEvent:Z,dragImageLastLabel:$}=this;if(!Q)return;this.setDragImageCompIcon(J?.getIconName?.(Z)??null);let X=z?.dragItemName;if(typeof X==="function")X=X(Z);if(X||(X=""),$!==X)this.dragImageLastLabel=X,Q.setLabel(X)}};function S9(Q){return typeof Q==="object"&&!!Q.component}function Uq(Q){if(!Q)return!1;return Q.prototype&&"getGui"in Q.prototype}function O9(Q,z,J,Z){let{name:$}=J,X,Y,G,q,H,_;if(z){let U=z,W=U[$+"Selector"],B=W?W(Z):null,E=(K)=>{if(typeof K==="string")X=K;else if(K!=null&&K!==!0)if(Q.isFrameworkComponent(K))G=K;else Y=K};if(B)E(B.component),q=B.params,H=B.popup,_=B.popupPosition;else E(U[$])}return{compName:X,jsComp:Y,fwComp:G,paramsFromSelector:q,popupFromSelector:H,popupPositionFromSelector:_}}var Wq=class extends j{constructor(){super(...arguments);this.beanName="userCompFactory"}wireBeans(Q){this.agCompUtils=Q.agCompUtils,this.registry=Q.registry,this.frameworkCompWrapper=Q.frameworkCompWrapper,this.gridOptions=Q.gridOptions}getCompDetailsFromGridOptions(Q,z,J,Z=!1){return this.getCompDetails(this.gridOptions,Q,z,J,Z)}getCompDetails(Q,z,J,Z,$=!1){let{name:X,cellRenderer:Y}=z,{compName:G,jsComp:q,fwComp:H,paramsFromSelector:_,popupFromSelector:U,popupPositionFromSelector:W}=O9(this.beans.frameworkOverrides,Q,z,Z),B,E,K=(M)=>{let k=this.registry.getUserComponent(X,M);if(k)q=!k.componentFromFramework?k.component:void 0,H=k.componentFromFramework?k.component:void 0,B=k.params,E=k.processParams};if(G!=null)K(G);if(q==null&&H==null&&J!=null)K(J);if(q&&Y&&!Uq(q))q=this.agCompUtils?.adaptFunction(z,q);if(!q&&!H){let{validation:M}=this.beans;if($&&(G!==J||!J))if(G){if(!M?.isProvidedUserComp(G))e(50,{compName:G})}else if(J){if(!M)e(260,{...this.gos.getModuleErrorParams(),propName:X,compName:J})}else e(216,{name:X});else if(J&&!M)e(146,{comp:J});return}let L=this.mergeParams(Q,z,Z,_,B,E),F=q==null,D=q??H;return{componentFromFramework:F,componentClass:D,params:L,type:z,popupFromSelector:U,popupPositionFromSelector:W,newAgStackInstance:()=>this.newAgStackInstance(D,F,L,z)}}newAgStackInstance(Q,z,J,Z){let $=!z,X;if($)X=new Q;else X=this.frameworkCompWrapper.wrap(Q,Z.mandatoryMethods,Z.optionalMethods,Z);this.createBean(X);let Y=X.init?.(J);if(Y==null)return g.resolve(X);return Y.then(()=>X)}mergeParams(Q,z,J,Z=null,$,X){let Y={...J,...$},q=Q?.[z.name+"Params"];if(typeof q==="function"){let H=q(J);B0(Y,H)}else if(typeof q==="object")B0(Y,q);return B0(Y,Z),X?X(Y):Y}};var Bq={name:"dragAndDropImageComponent",mandatoryMethods:["setIcon","setLabel"]},Eq={name:"headerComponent",optionalMethods:["refresh"]},Kq={name:"innerHeaderComponent"},Lq={name:"innerHeaderGroupComponent"},Fq={name:"headerGroupComponent"},Dq={name:"innerRenderer",cellRenderer:!0,optionalMethods:["afterGuiAttached"]},Mq={name:"cellRenderer",optionalMethods:["refresh","afterGuiAttached"],cellRenderer:!0};var kq={name:"loadingCellRenderer",cellRenderer:!0},Vq={name:"cellEditor",mandatoryMethods:["getValue"],optionalMethods:["isPopup","isCancelBeforeStart","isCancelAfterEnd","getPopupPosition","focusIn","focusOut","afterGuiAttached","refresh"]},fq={name:"tooltipComponent"},n5={name:"filter",mandatoryMethods:["isFilterActive","doesFilterPass","getModel","setModel"],optionalMethods:["afterGuiAttached","afterGuiDetached","onNewRowsLoaded","getModelAsString","onFloatingFilterChanged","onAnyFilterChanged","refresh"]},Aq={name:"floatingFilterComponent",mandatoryMethods:["onParentModelChanged"],optionalMethods:["afterGuiAttached","refresh"]},jq={name:"fullWidthCellRenderer",optionalMethods:["refresh","afterGuiAttached"],cellRenderer:!0},Rq={name:"loadingCellRenderer",cellRenderer:!0},Sq={name:"groupRowRenderer",optionalMethods:["afterGuiAttached"],cellRenderer:!0},Oq={name:"detailCellRenderer",optionalMethods:["refresh"],cellRenderer:!0};function Pq(Q,z){return Q.getCompDetailsFromGridOptions(Bq,"agDragAndDropImage",z,!0)}function _J(Q,z,J){return Q.getCompDetails(z,Dq,void 0,J)}function Tq(Q,z,J){return Q.getCompDetails(z,Eq,"agColumnHeader",J)}function vq(Q,z,J){return Q.getCompDetails(z,Kq,void 0,J)}function Iq(Q,z){let J=z.columnGroup.getColGroupDef();return Q.getCompDetails(J,Fq,"agColumnGroupHeader",z)}function Cq(Q,z,J){return Q.getCompDetails(z,Lq,void 0,J)}function bq(Q,z){return Q.getCompDetailsFromGridOptions(jq,void 0,z,!0)}function yq(Q,z){return Q.getCompDetailsFromGridOptions(Rq,"agLoadingCellRenderer",z,!0)}function xq(Q,z){return Q.getCompDetailsFromGridOptions(Sq,"agGroupRowRenderer",z,!0)}function wq(Q,z){return Q.getCompDetailsFromGridOptions(Oq,"agDetailCellRenderer",z,!0)}function o1(Q,z,J){return Q.getCompDetails(z,Mq,void 0,J)}function M7(Q,z,J){return Q.getCompDetails(z,kq,"agSkeletonCellRenderer",J,!0)}function P9(Q,z,J){return Q.getCompDetails(z,Vq,"agCellEditor",J,!0)}function d5(Q,z,J,Z){let $=z.filter;if(S9($))z={filter:$.component,filterParams:z.filterParams};return Q.getCompDetails(z,n5,Z,J,!0)}function Nq(Q,z){return Q.getCompDetails(z.colDef,fq,"agTooltipComponent",z,!0)}function t5(Q,z,J,Z){return Q.getCompDetails(z,Aq,Z,J)}function T9(Q,z){return O9(Q,z,n5)}function R2(Q,z,J){return Q.mergeParams(z,n5,J)}var qQ=((Q)=>{return Q[Q.ToolPanel=0]="ToolPanel",Q[Q.HeaderCell=1]="HeaderCell",Q[Q.RowDrag=2]="RowDrag",Q[Q.ChartPanel=3]="ChartPanel",Q[Q.AdvancedFilterBuilder=4]="AdvancedFilterBuilder",Q})(qQ||{}),gq=class extends _q{createEvent(Q){return y(this.gos,Q)}createDragImageComp(Q){let{gos:z,beans:J}=this;return Pq(J.userCompFactory,y(z,{dragSource:Q}))?.newAgStackInstance()}handleEnter(Q,z){Q?.onGridEnter?.(z)}handleExit(Q,z){Q?.onGridExit?.(z)}warnNoBody(){R(54)}isDropZoneWithinThisGrid(Q){return this.beans.ctrlsSvc.getGridBodyCtrl().eGridBody.contains(Q.dropZoneTarget)}registerGridDropTarget(Q,z){let J={getContainer:Q,isInterestedIn:(Z)=>Z===1||Z===0,getIconName:()=>"notAllowed"};this.addDropTarget(J),z.addDestroyFunc(()=>this.removeDropTarget(J))}};var v9="ag-resizer-wrapper",tQ=(Q,z)=>({tag:"div",ref:`${Q}Resizer`,cls:`ag-resizer ag-resizer-${z}`}),hq={tag:"div",cls:v9,children:[tQ("eTopLeft","topLeft"),tQ("eTop","top"),tQ("eTopRight","topRight"),tQ("eRight","right"),tQ("eBottomRight","bottomRight"),tQ("eBottom","bottom"),tQ("eBottomLeft","bottomLeft"),tQ("eLeft","left")]},r5=class extends j0{constructor(Q,z){super();this.element=Q,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(Q){this.popupSvc=Q.popupSvc,this.dragSvc=Q.dragSvc}center(Q){let{clientHeight:z,clientWidth:J}=this.offsetParent,Z=J/2-this.getWidth()/2,$=z/2-this.getHeight()/2;this.offsetElement(Z,$,Q)}initialisePosition(Q){if(this.positioned)return;let{centered:z,forcePopupParentAsOffsetParent:J,minWidth:Z,width:$,minHeight:X,height:Y,x:G,y:q}=this.config;if(!this.offsetParent)this.setOffsetParent();let H=0,_=0,U=f0(this.element);if(U){let W=this.findBoundaryElement(),B=window.getComputedStyle(W);if(B.minWidth!=null){let E=W.offsetWidth-this.element.offsetWidth;_=Number.parseInt(B.minWidth,10)-E}if(B.minHeight!=null){let E=W.offsetHeight-this.element.offsetHeight;H=Number.parseInt(B.minHeight,10)-E}}if(this.minHeight=X||H,this.minWidth=Z||_,$)this.setWidth($);if(Y)this.setHeight(Y);if(!$||!Y)this.refreshSize();if(z)this.center(Q);else if(G||q)this.offsetElement(G,q,Q);else if(U&&J){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,Q);else this.setPosition(K,E)}}this.positioned=!!this.offsetParent}isPositioned(){return this.positioned}getPosition(){return this.position}setMovable(Q,z){if(!this.config.popup||Q===this.movable)return;this.movable=Q;let J=this.moveElementDragListener||{eElement:z,onDragStart:this.onMoveStart.bind(this),onDragging:this.onMove.bind(this),onDragStop:this.onMoveEnd.bind(this)};if(Q)this.dragSvc?.addDragSource(J),this.moveElementDragListener=J;else this.dragSvc?.removeDragSource(J),this.moveElementDragListener=void 0}setResizable(Q){if(this.clearResizeListeners(),Q)this.addResizers();else this.removeResizers();if(typeof Q==="boolean"){if(Q===!1)return;Q={topLeft:Q,top:Q,topRight:Q,right:Q,bottomRight:Q,bottom:Q,bottomLeft:Q,left:Q}}for(let z of Object.keys(Q)){let J=!!Q[z],Z=this.getResizerElement(z),$={dragStartPixels:0,eElement:Z,onDragStart:(X)=>this.onResizeStart(X,z),onDragging:this.onResize.bind(this),onDragStop:(X)=>this.onResizeEnd(X,z)};if(J||!this.isAlive()&&!J){if(J)this.dragSvc?.addDragSource($),this.resizeListeners.push($),Z.style.pointerEvents="all";else Z.style.pointerEvents="none";this.resizable[z]=J}}}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:Q,width:z}=this.lastSize;if(z!==-1)this.element.style.width=`${z}px`;if(Q!==-1)this.element.style.height=`${Q}px`}getHeight(){return this.element.offsetHeight}setHeight(Q){let{popup:z}=this.config,J=this.element,Z=!1;if(typeof Q==="string"&&Q.includes("%"))N1(J,Q),Q=x8(J),Z=!0;else if(Q=Math.max(this.minHeight,Q),this.positioned){let $=this.getAvailableHeight();if($&&Q>$)Q=$}if(this.getHeight()===Q)return;if(Z)J.style.maxHeight="unset",J.style.minHeight="unset";else if(z)N1(J,Q);else J.style.height=`${Q}px`,J.style.flex="0 0 auto",this.lastSize.height=typeof Q==="number"?Q:Number.parseFloat(Q)}getAvailableHeight(){let{popup:Q,forcePopupParentAsOffsetParent:z}=this.config;if(!this.positioned)this.initialisePosition();let{clientHeight:J}=this.offsetParent;if(!J)return null;let Z=this.element.getBoundingClientRect(),$=this.offsetParent.getBoundingClientRect(),X=Q?this.position.y:Z.top,Y=Q?0:$.top,G=0;if(z){let H=this.element.parentElement;if(H){let{bottom:_}=H.getBoundingClientRect();G=_-Z.bottom}}return J+Y-X-G}getWidth(){return this.element.offsetWidth}setWidth(Q){let z=this.element,{popup:J}=this.config,Z=!1;if(typeof Q==="string"&&Q.includes("%"))SQ(z,Q),Q=w8(z),Z=!0;else if(this.positioned){Q=Math.max(this.minWidth,Q);let{clientWidth:$}=this.offsetParent,X=J?this.position.x:this.element.getBoundingClientRect().left;if($&&Q+X>$)Q=$-X}if(this.getWidth()===Q)return;if(Z)z.style.maxWidth="unset",z.style.minWidth="unset";else if(this.config.popup)SQ(z,Q);else z.style.width=`${Q}px`,z.style.flex=" unset",this.lastSize.width=typeof Q==="number"?Q:Number.parseFloat(Q)}offsetElement(Q=0,z=0,J){let{forcePopupParentAsOffsetParent:Z}=this.config,$=Z?this.boundaryEl:this.element;if(!$)return;this.popupSvc?.positionPopup({ePopup:$,keepWithinBounds:!0,skipObserver:this.movable||this.isResizable(),updatePosition:()=>({x:Q,y:z}),postProcessCallback:J}),this.setPosition(Number.parseFloat($.style.left),Number.parseFloat($.style.top))}constrainSizeToAvailableHeight(Q){if(!this.config.forcePopupParentAsOffsetParent)return;let z=()=>{let J=this.getAvailableHeight();this.element.style.setProperty("max-height",`${J}px`)};if(Q&&this.popupSvc)this.resizeObserverSubscriber?.(),this.resizeObserverSubscriber=DQ(this.beans,this.popupSvc?.getPopupParent(),z);else if(this.element.style.removeProperty("max-height"),this.resizeObserverSubscriber)this.resizeObserverSubscriber(),this.resizeObserverSubscriber=void 0}setPosition(Q,z){this.position.x=Q,this.position.y=z}updateDragStartPosition(Q,z){this.dragStartPosition={x:Q,y:z}}calculateMouseMovement(Q){let{e:z,isLeft:J,isTop:Z,anywhereWithin:$,topBuffer:X}=Q,Y=z.clientX-this.dragStartPosition.x,G=z.clientY-this.dragStartPosition.y,q=this.shouldSkipX(z,!!J,!!$,Y)?0:Y,H=this.shouldSkipY(z,!!Z,X,G)?0:G;return{movementX:q,movementY:H}}shouldSkipX(Q,z,J,Z){let $=this.element.getBoundingClientRect(),X=this.offsetParent.getBoundingClientRect(),Y=this.boundaryEl.getBoundingClientRect(),G=this.config.popup?this.position.x:$.left,q=G<=0&&X.left>=Q.clientX||X.right<=Q.clientX&&X.right<=Y.right;if(q)return!0;if(z)q=Z<0&&Q.clientX>G+X.left||Z>0&&Q.clientXY.right||Z>0&&Q.clientXY.right||Z>0&&Q.clientX=Q.clientY||X.bottom<=Q.clientY&&X.bottom<=Y.bottom;if(q)return!0;if(z)q=Z<0&&Q.clientY>G+X.top+J||Z>0&&Q.clientYY.bottom||Z>0&&Q.clientY({element:this.element.querySelector(`[data-ref=${z}Resizer]`)});this.resizerMap={topLeft:Q("eTopLeft"),top:Q("eTop"),topRight:Q("eTopRight"),right:Q("eRight"),bottomRight:Q("eBottomRight"),bottom:Q("eBottom"),bottomLeft:Q("eBottomLeft"),left:Q("eLeft")}}addResizers(){if(this.resizersAdded)return;let Q=this.element;if(!Q)return;Q.appendChild(K0(hq)),this.createResizeMap(),this.resizersAdded=!0}removeResizers(){this.resizerMap=void 0,this.element.querySelector(`.${v9}`)?.remove(),this.resizersAdded=!1}getResizerElement(Q){return this.resizerMap[Q].element}onResizeStart(Q,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:J,forcePopupParentAsOffsetParent:Z}=this.config;if(!J&&!Z)this.applySizeToSiblings(this.currentResizer.isBottom||this.currentResizer.isTop);this.isResizing=!0,this.updateDragStartPosition(Q.clientX,Q.clientY)}getSiblings(){let z=this.element.parentElement;if(!z)return null;return Array.prototype.slice.call(z.children).filter((J)=>!J.classList.contains("ag-hidden"))}getMinSizeOfSiblings(){let Q=this.getSiblings()||[],z=0,J=0;for(let Z of Q){let $=!!Z.style.flex&&Z.style.flex!=="0 0 auto";if(Z===this.element)continue;let X=this.minHeight||0,Y=this.minWidth||0;if($){let G=window.getComputedStyle(Z);if(G.minHeight)X=Number.parseInt(G.minHeight,10);if(G.minWidth)Y=Number.parseInt(G.minWidth,10)}else X=Z.offsetHeight,Y=Z.offsetWidth;z+=X,J+=Y}return{height:z,width:J}}applySizeToSiblings(Q){let z=null,J=this.getSiblings();if(!J)return;for(let Z=0;ZQ)}onResize(Q){if(!this.isResizing||!this.currentResizer)return;let{popup:z,forcePopupParentAsOffsetParent:J}=this.config,{isTop:Z,isRight:$,isBottom:X,isLeft:Y}=this.currentResizer,G=$||Y,q=X||Z,{movementX:H,movementY:_}=this.calculateMouseMovement({e:Q,isLeft:Y,isTop:Z}),U=this.position.x,W=this.position.y,B=0,E=0;if(G&&H){let K=Y?-1:1,L=this.getWidth(),F=L+H*K,D=!1;if(Y){if(B=L-F,U+B<=0||F<=this.minWidth)D=!0,B=0}if(!D)this.setWidth(F)}if(q&&_){let K=Z?-1:1,L=this.getHeight(),F=L+_*K,D=!1;if(Z){if(E=L-F,W+E<=0||F<=this.minHeight)D=!0,E=0}else if(!this.config.popup&&!this.config.forcePopupParentAsOffsetParent&&Lthis.element.parentElement.offsetHeight)D=!0;if(!D)this.setHeight(F)}if(this.updateDragStartPosition(Q.clientX,Q.clientY),(z||J)&&B||E)this.offsetElement(U+B,W+E)}onResizeEnd(Q,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 Q=this.element;if(this.config.popup){if(!this.config.width)this.setWidth(Q.offsetWidth);if(!this.config.height)this.setHeight(Q.offsetHeight)}}onMoveStart(Q){if(this.boundaryEl=this.findBoundaryElement(),!this.positioned)this.initialisePosition();this.isMoving=!0,this.element.classList.add("ag-moving"),this.updateDragStartPosition(Q.clientX,Q.clientY)}onMove(Q){if(!this.isMoving)return;let{x:z,y:J}=this.position,Z;if(this.config.calculateTopBuffer)Z=this.config.calculateTopBuffer();let{movementX:$,movementY:X}=this.calculateMouseMovement({e:Q,isTop:!0,anywhereWithin:!0,topBuffer:Z});this.offsetElement(z+$,J+X),this.updateDragStartPosition(Q.clientX,Q.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 Q=this.element;while(Q){if(window.getComputedStyle(Q).position!=="static")return Q;Q=Q.parentElement}return this.element}clearResizeListeners(){while(this.resizeListeners.length){let Q=this.resizeListeners.pop();this.dragSvc?.removeDragSource(Q)}}destroy(){if(super.destroy(),this.moveElementDragListener)this.dragSvc?.removeDragSource(this.moveElementDragListener);this.constrainSizeToAvailableHeight(!1),this.clearResizeListeners(),this.removeResizers()}},UJ=class extends r5{},S=null;function bZ(Q){return typeof Q?.getGui==="function"}var I9=class{constructor(Q){this.cssClassStates={},this.getGui=Q}toggleCss(Q,z){if(!Q)return;if(Q.includes(" ")){let Z=(Q||"").split(" ");if(Z.length>1){for(let $ of Z)this.toggleCss($,z);return}}if(this.cssClassStates[Q]!==z&&Q.length)this.getGui()?.classList.toggle(Q,z),this.cssClassStates[Q]=z}},uq=0,p0=class extends j0{constructor(Q,z){super();if(this.suppressDataRefValidation=!1,this.displayed=!0,this.visible=!0,this.compId=uq++,this.cssManager=new I9(()=>this.eGui),this.componentSelectors=new Map((z??[]).map((J)=>[J.selector,J])),Q)this.setTemplate(Q)}preConstruct(){this.wireTemplate(this.getGui()),this.addGlobalCss()}wireTemplate(Q,z){if(Q&&this.gos)this.applyElementsToComponent(Q),this.createChildComponentsFromTags(Q,z)}getCompId(){return this.compId}getDataRefAttribute(Q){if(Q.getAttribute)return Q.getAttribute(p8);return null}applyElementsToComponent(Q,z,J,Z=null){if(z===void 0)z=this.getDataRefAttribute(Q);if(z){let $=this[z];if($===S)this[z]=Z??Q;else{let X=J?.[z];if(!this.suppressDataRefValidation&&!X)throw Error(`data-ref: ${z} on ${this.constructor.name} with ${$}`)}}}createChildComponentsFromTags(Q,z){let J=[];for(let Z of Q.childNodes??[])J.push(Z);for(let Z of J){if(!(Z instanceof HTMLElement))continue;let $=this.createComponentFromElement(Z,(X)=>{let Y=X.getGui();if(Y)for(let G of Z.attributes??[])Y.setAttribute(G.name,G.value)},z);if($){if($.addItems&&Z.children.length){this.createChildComponentsFromTags(Z,z);let X=Array.prototype.slice.call(Z.children);$.addItems(X)}this.swapComponentForNode($,Q,Z)}else if(Z.childNodes)this.createChildComponentsFromTags(Z,z)}}createComponentFromElement(Q,z,J){let Z=Q.nodeName,$=this.getDataRefAttribute(Q),X=Z.indexOf("AG-")===0,Y=X?this.componentSelectors.get(Z):null,G=null;if(Y){let q=J&&$?J[$]:void 0;G=new Y.component(q),G.setParentComponent(this),this.createBean(G,null,z)}else if(X)throw Error(`selector: ${Z}`);return this.applyElementsToComponent(Q,$,J,G),G}swapComponentForNode(Q,z,J){let Z=Q.getGui();z.replaceChild(Z,J),z.insertBefore(document.createComment(J.nodeName),Z),this.addDestroyFunc(this.destroyBean.bind(this,Q))}activateTabIndex(Q,z){let J=z??this.gos.get("tabIndex");if(!Q)Q=[];if(!Q.length)Q.push(this.getGui());for(let Z of Q)Z.setAttribute("tabindex",J.toString())}setTemplate(Q,z,J){let Z;if(typeof Q==="string"||Q==null)Z=v5(Q);else Z=K0(Q);this.setTemplateFromElement(Z,z,J)}setTemplateFromElement(Q,z,J,Z=!1){if(this.eGui=Q,this.suppressDataRefValidation=Z,z)for(let $=0;$this.eGui.removeEventListener(Q,z))}addCss(Q){this.cssManager.toggleCss(Q,!0)}removeCss(Q){this.cssManager.toggleCss(Q,!1)}toggleCss(Q,z){this.cssManager.toggleCss(Q,z)}registerCSS(Q){if(this.css===k7)this.css=[Q],this.addGlobalCss();else this.css||(this.css=[]),this.css.push(Q)}addGlobalCss(){if(Array.isArray(this.css)){let Q="component-"+Object.getPrototypeOf(this)?.constructor?.name;for(let z of this.css??[])this.beans.environment.addGlobalCSS(z,Q)}this.css=k7}},k7=Symbol(),x=class extends p0{},S2,O2,P2,T2,Y5,G5,v2;function cz(){if(S2===void 0)S2=/^((?!chrome|android).)*safari/i.test(navigator.userAgent);return S2}function yZ(){if(O2===void 0)O2=/(firefox)/i.test(navigator.userAgent);return O2}function C9(){if(P2===void 0)P2=/(Mac|iPhone|iPod|iPad)/i.test(navigator.platform);return P2}function bz(){if(T2===void 0)T2=/iPad|iPhone|iPod/.test(navigator.platform)||navigator.platform==="MacIntel"&&navigator.maxTouchPoints>1;return T2}function q5(Q){if(!Q)return null;let z=Q.tabIndex,J=Q.getAttribute("tabIndex");if(z===-1&&(J===null||J===""&&!yZ()))return null;return z.toString()}function mq(){if(v2!==void 0)return v2;if(!document.body)return-1;let Q=1e6,z=yZ()?6000000:1e9,J=document.createElement("div");document.body.appendChild(J);while(!0){let Z=Q*2;if(J.style.height=Z+"px",Z>z||J.clientHeight!==Z)break;else Q=Z}return J.remove(),v2=Q,Q}function s5(){if(G5==null)b9();return G5}function b9(){let Q=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",Q.appendChild(z);let J=z.offsetWidth-z.clientWidth;if(J===0&&z.clientWidth===0)J=null;if(z.parentNode)z.remove();if(J!=null)G5=J,Y5=J===0}function y9(){if(Y5==null)b9();return Y5}var H5=!1,YZ=0;function cq(Q){if(YZ>0)return;Q.addEventListener("keydown",GZ),Q.addEventListener("mousedown",GZ)}function pq(Q){if(YZ>0)return;Q.removeEventListener("keydown",GZ),Q.removeEventListener("mousedown",GZ)}function GZ(Q){let z=H5,J=Q.type==="keydown";if(J){if(Q.ctrlKey||Q.metaKey||Q.altKey)return}if(z===J)return;H5=J}function iq(Q){let z=Y0(Q);return cq(z),YZ++,()=>{YZ--,pq(z)}}function V1(){return H5}function EQ(Q,z,J=!1){let Z=a4,$=y8;if(z)$+=", "+z;if(J)$+=', [tabindex="-1"]';let X=Array.prototype.slice.apply(Q.querySelectorAll(Z)).filter((q)=>{return f0(q)}),Y=Array.prototype.slice.apply(Q.querySelectorAll($));if(!Y.length)return X;return((q,H)=>q.filter((_)=>H.indexOf(_)===-1))(X,Y)}function D0(Q,z=!1,J=!1,Z=!1){let $=EQ(Q,Z?".ag-tab-guard":null,J),X=z?b($):$[0];if(X)return X.focus({preventScroll:!0}),!0;return!1}function R0(Q,z,J,Z){let $=EQ(z,J?':not([tabindex="-1"])':null),X=d(Q),Y;if(J)Y=$.findIndex((q)=>q.contains(X));else Y=$.indexOf(X);let G=Y+(Z?-1:1);if(G<0||G>=$.length)return null;return $[G]}function xZ(Q,z=5){let J=0;while(Q&&q5(Q)===null&&++J<=z)Q=Q.parentElement;if(q5(Q)===null)return null;return Q}var l5="ag-focus-managed",x9=class extends j0{constructor(Q,z={isStopPropagation:()=>!1,stopPropagation:()=>{}},J={}){super();this.eFocusable=Q,this.stopPropagationCallbacks=z,this.callbacks=J,this.callbacks={shouldStopEventPropagation:()=>!1,onTabKeyDown:(Z)=>{if(Z.defaultPrevented)return;let $=R0(this.beans,this.eFocusable,!1,Z.shiftKey);if(!$)return;$.focus(),Z.preventDefault()},...J}}postConstruct(){let{eFocusable:Q,callbacks:{onFocusIn:z,onFocusOut:J}}=this;if(Q.classList.add(l5),this.addKeyDownListeners(Q),z)this.addManagedElementListeners(Q,{focusin:z});if(J)this.addManagedElementListeners(Q,{focusout:J})}addKeyDownListeners(Q){this.addManagedElementListeners(Q,{keydown:(z)=>{if(z.defaultPrevented||this.stopPropagationCallbacks.isStopPropagation(z))return;let{callbacks:J}=this;if(J.shouldStopEventPropagation(z)){this.stopPropagationCallbacks.stopPropagation(z);return}if(z.key===V.TAB)J.onTabKeyDown(z);else if(J.handleKeyDown)J.handleKeyDown(z)}})}},w9="__ag_Grid_Stop_Propagation";function i0(Q){Q[w9]=!0}function zQ(Q){return Q[w9]===!0}var Uz={isStopPropagation:zQ,stopPropagation:i0},cQ=class extends x9{constructor(Q,z){super(Q,Uz,z)}},nq={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:(Q)=>`(${Q[0]}, ${Q[1]})`,filterSummaryTextQuote:(Q)=>`"${Q[0]}"`,minDateValidation:(Q)=>`Date must be after ${Q[0]}`,maxDateValidation:(Q)=>`Date must be before ${Q[0]}`,strictMinValueValidation:(Q)=>`Must be greater than ${Q[0]}`,strictMaxValueValidation:(Q)=>`Must be less than ${Q[0]}`};function N9(Q,z,J){return UG(Q,nq,z,J)}function dq(Q,z){let{debounceMs:J}=Q;if(WJ(Q)){if(J!=null)R(71);return 0}return J??z}function WJ(Q){return(Q.buttons?.indexOf("apply")??-1)>=0}var wZ=class extends x{constructor(Q,z){super();this.filterNameKey=Q,this.cssIdentifier=z,this.applyActive=!1,this.debouncePending=!1,this.defaultDebounceMs=0}postConstruct(){let Q={tag:"div",cls:`ag-filter-body-wrapper ag-${this.cssIdentifier}-body-wrapper`,children:[this.createBodyTemplate()]};this.setTemplate(Q,this.getAgComponents()),this.createManagedBean(new cQ(this.getFocusableElement(),{handleKeyDown:this.handleKeyDown.bind(this)})),this.positionableFeature=this.createBean(new UJ(this.getPositionableElement(),{forcePopupParentAsOffsetParent:!0}))}handleKeyDown(Q){}init(Q){let z=Q;this.setParams(z),this.setModelIntoUi(z.state.model,!0).then(()=>this.updateUiVisibility())}areStatesEqual(Q,z){return Q===z}refresh(Q){let z=Q,J=this.params;this.params=z;let{source:Z,state:$,additionalEventAttributes:X}=z;if(Z==="colDef")this.updateParams(z,J);let Y=this.state;this.state=$;let G=X?.fromAction;if(G&&G!=="apply"||$.model!==Y.model||!this.areStatesEqual($.state,Y.state))this.setModelIntoUi($.model);return!0}setParams(Q){this.params=Q,this.state=Q.state,this.commonUpdateParams(Q)}updateParams(Q,z){this.commonUpdateParams(Q,z)}commonUpdateParams(Q,z){this.applyActive=WJ(Q),this.setupApplyDebounced()}doesFilterPass(Q){R(283);let{getHandler:z,model:J,column:Z}=this.params;return z().doesFilterPass({...Q,model:J,handlerParams:this.beans.colFilter.getHandlerParams(Z)})}getFilterTitle(){return this.translate(this.filterNameKey)}isFilterActive(){return R(284),this.params.model!=null}setupApplyDebounced(){let Q=dq(this.params,this.defaultDebounceMs),z=gQ(this,this.checkApplyDebounce.bind(this),Q);this.applyDebounced=()=>{this.debouncePending=!0,z()}}checkApplyDebounce(){if(this.debouncePending)this.debouncePending=!1,this.doApplyModel()}getModel(){return R(285),this.params.model}setModel(Q){R(286);let{beans:z,params:J}=this;return z.colFilter.setModelForColumnLegacy(J.column,Q)}applyModel(Q="api"){return this.doApplyModel()}canApply(Q){return!0}doApplyModel(Q){let{params:z,state:{valid:J=!0,model:Z}}=this;if(!J)return!1;let $=!this.areModelsEqual(z.model,Z);if($)z.onAction("apply",Q);return $}onNewRowsLoaded(){}onUiChanged(Q,z=!1){this.updateUiVisibility();let J=this.getModelFromUi(),Z={model:J,state:this.getState(),valid:this.canApply(J)};this.state=Z;let{params:$,gos:X,eventSvc:Y,applyActive:G}=this;if($.onStateChange(Z),$.onUiChange(this.getUiChangeEventParams()),!X.get("enableFilterHandlers"))Y.dispatchEvent({type:"filterModified",column:$.column,filterInstance:this});if(!Z.valid)return;if(Q??(Q=G?void 0:"debounce"),Q==="immediately")this.doApplyModel({afterFloatingFilter:z,afterDataChange:!1});else if(Q==="debounce")this.applyDebounced()}getState(){return}getUiChangeEventParams(){return}afterGuiAttached(Q){this.lastContainerType=Q?.container,this.refreshFilterResizer(Q?.container)}refreshFilterResizer(Q){let{positionableFeature:z,gos:J}=this;if(!z)return;let Z=Q==="floatingFilter"||Q==="columnFilter";if(Z)z.restoreLastSize(),z.setResizable(J.get("enableRtl")?{bottom:!0,bottomLeft:!0,left:!0}:{bottom:!0,bottomRight:!0,right:!0});else z.removeSizeFromEl(),z.setResizable(!1);z.constrainSizeToAvailableHeight(Z)}afterGuiDetached(){this.checkApplyDebounce(),this.positionableFeature?.constrainSizeToAvailableHeight(!1)}destroy(){this.positionableFeature=this.destroyBean(this.positionableFeature),super.destroy()}translate(Q,z){return N9(this,Q,z)}getPositionableElement(){return this.getGui()}areModelsEqual(Q,z){if(Q===z||Q==null&&z==null)return!0;if(Q==null||z==null)return!1;return this.areNonNullModelsEqual(Q,z)}};var a5=class extends p0{isPopup(){return!0}setParentComponent(Q){Q.addCss("ag-has-popup"),super.setParentComponent(Q)}destroy(){let Q=this.parentComponent;if(Q?.isAlive())Q.getGui().classList.remove("ag-has-popup");super.destroy()}},tq=class extends a5{constructor(){super(...arguments);this.errorMessages=null}init(Q){this.params=Q,this.initialiseEditor(Q),this.eEditor.onValueChange(()=>Q.validate())}destroy(){this.eEditor.destroy(),this.errorMessages=null,super.destroy()}};function o5(Q){let z=Q.rowModel;return z.getType()==="clientSide"?z:void 0}var V7="row-group-",rq="t-",sq="b-",lq=0,Wz=class{constructor(Q){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=lq++,this.alreadyRendered=!1,this.formulaRowIndex=null,this.hovered=!1,this.__selected=!1,this.beans=Q}get groupData(){let Q=this._groupData;if(Q!==void 0)return Q;if(this.footer)return this.sibling?.groupData;return this.beans.groupStage?.loadGroupData(this)??null}set groupData(Q){this._groupData=Q}get primaryRow(){let Q=this.footer&&this.sibling?this.sibling:this,{pinnedSibling:z}=Q;if(z&&Q.rowPinned){if(Q=z,Q.footer&&Q.sibling)Q=Q.sibling}return Q}get allLeafChildren(){let Q=this._leafs;return Q===void 0?this.beans.groupStage?.loadLeafs?.(this)??null:Q}set allLeafChildren(Q){this._leafs=Q}get expanded(){let Q=this.beans.expansionSvc;return Q?Q.isExpanded(this):this.level===-1?!0:!!this._expanded}set expanded(Q){this._expanded=Q}setData(Q){this.setDataCommon(Q,!1)}updateData(Q){this.setDataCommon(Q,!0)}setDataCommon(Q,z){let{valueCache:J,eventSvc:Z}=this.beans,$=this.data;this.data=Q,J?.onDataChanged(),this.updateDataOnDetailNode(),this.resetQuickFilterAggregateText();let X=this.createDataChangedEvent(Q,$,z);if(this.__localEventService?.dispatchEvent(X),this.sibling){this.sibling.data=Q;let G=this.sibling.createDataChangedEvent(Q,$,z);this.sibling.__localEventService?.dispatchEvent(G)}Z.dispatchEvent({type:"rowNodeDataChanged",node:this});let Y=this.pinnedSibling;if(Y)Y.data=Q,Y.__localEventService?.dispatchEvent(Y.createDataChangedEvent(Q,$,z)),Z.dispatchEvent({type:"rowNodeDataChanged",node:Y})}updateDataOnDetailNode(){let Q=this.detailNode;if(Q)Q.data=this.data}createDataChangedEvent(Q,z,J){return{type:"dataChanged",node:this,oldData:z,newData:Q,update:J}}getRowIndexString(){if(this.rowIndex==null)return e(13),null;if(this.rowPinned==="top")return rq+this.rowIndex;if(this.rowPinned==="bottom")return sq+this.rowIndex;return this.rowIndex.toString()}setDataAndId(Q,z){let{selectionSvc:J}=this.beans,Z=J?.createDaemonNode?.(this),$=this.data;if(this.data=Q,this.updateDataOnDetailNode(),this.setId(z),J)J.updateRowSelectable(this),J.syncInRowNode(this,Z);let X=this.createDataChangedEvent(Q,$,!1);this.__localEventService?.dispatchEvent(X)}setId(Q){let z=Z5(this.beans.gos);if(z)if(this.data){let J=this.parent?.getRoute()??[];if(this.id=z({data:this.data,parentKeys:J.length>0?J:void 0,level:this.level,rowPinned:this.rowPinned}),this.id.startsWith(V7))e(14,{groupPrefix:V7})}else this.id=void 0;else this.id=Q}setRowTop(Q){if(this.oldRowTop=this.rowTop,this.rowTop===Q)return;this.rowTop=Q,this.dispatchRowEvent("topChanged");let z=Q!==null;if(this.displayed!==z)this.displayed=z,this.dispatchRowEvent("displayedChanged")}clearRowTopAndRowIndex(){this.oldRowTop=null,this.setRowTop(null),this.setRowIndex(null)}setHovered(Q){this.hovered=Q}isHovered(){return this.hovered}setRowHeight(Q,z=!1){this.rowHeight=Q,this.rowHeightEstimated=z,this.dispatchRowEvent("heightChanged")}setExpanded(Q,z,J){this.beans.expansionSvc?.setExpanded(this,Q,z,J)}setDataValue(Q,z,J){let{colModel:Z,valueSvc:$,gos:X,editSvc:Y}=this.beans;if(Q==null)return!1;let G=Z.getCol(Q)??Z.getColDefCol(Q);if(!G)return!1;if(!this.group){let _=G.getColDef();if(_.pivotValueColumn)G=_.pivotValueColumn}let q=$.getValueForDisplay({column:G,node:this,from:"data"}).value;if(X.get("readOnlyEdit")){let{beans:{eventSvc:_},data:U,rowIndex:W,rowPinned:B}=this;return _.dispatchEvent({type:"cellEditRequest",event:null,rowIndex:W,rowPinned:B,column:G,colDef:G.colDef,data:U,node:this,oldValue:q,newValue:z,value:z,source:J}),!1}if(J!=="data"&&Y&&!Y.committing){let _=Y.setDataValue({rowNode:this,column:G},z,J);if(_!=null)return _}let H=$.setValue(this,G,z,J);if(this.dispatchCellChangedEvent(G,z,q),H)this.pinnedSibling?.dispatchCellChangedEvent(G,z,q);return H}getDataValue(Q,z="data"){let{colModel:J,valueSvc:Z,formula:$}=this.beans;if(Q==null)return;let X=J.getCol(Q)??J.getColDefCol(Q);if(!X)return;let Y=z==="data-raw",G=Y||z==="value"?"data":z,q=Z.getValue(X,this,G,Y);if(!Y){if($&&X.isAllowFormula()&&$.isFormula(q))q=$.resolveValue(X,this);if(z!=="data"&&X.getAggFunc()&&typeof q==="object"&&q!=null){if(typeof q.toNumber==="function")return q.toNumber();if("value"in q)return q.value}}return q}updateHasChildren(){let Q=this.group&&!this.footer||!!this.childrenAfterGroup?.length,{rowChildrenSvc:z}=this.beans;if(z)Q=z.getHasChildrenValue(this);if(Q!==this.__hasChildren)this.__hasChildren=!!Q,this.dispatchRowEvent("hasChildrenChanged")}hasChildren(){if(this.__hasChildren==null)this.updateHasChildren();return this.__hasChildren}dispatchCellChangedEvent(Q,z,J){let Z={type:"cellChanged",node:this,column:Q,newValue:z,oldValue:J};this.__localEventService?.dispatchEvent(Z)}resetQuickFilterAggregateText(){this.quickFilterAggregateText=null}isExpandable(){return this.beans.expansionSvc?.isExpandable(this)??!1}isSelected(){if(this.footer)return this.sibling.isSelected();let Q=this.rowPinned&&this.pinnedSibling;if(Q)return Q.isSelected();return this.__selected}depthFirstSearch(Q){let z=this.childrenAfterGroup;if(z)for(let J=0,Z=z.length;J{let J=new Wz(z);for(let Z of Object.keys(Q)){if(aq.has(Z))continue;J[Z]=Q[Z]}return J.oldRowTop=null,J},h9=(Q,z,J)=>{if(!J)return;let Z=J.rowIndex;if(Z==null)return;Z+=z;let $=Q.getRowCount();while(Z>=0&&Z<$){let X=Q.getRow(Z);if(!X||!X.footer&&!X.detail)return X;Z+=z}return};var oq=500,eq=550,yJ,QH=(Q)=>{if(!yJ)yJ=new WeakSet;else if(yJ.has(Q))return!1;return yJ.add(Q),!0},h0=class{constructor(Q,z=!1){this.eElement=Q,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(Q,z){let J=this.eventSvc;if(!J){if(J===null)return;this.eventSvc=J=new KQ;let Z=this.onTouchStart.bind(this);this.startListener=Z,this.eElement.addEventListener("touchstart",Z,{passive:!0})}J.addEventListener(Q,z)}removeEventListener(Q,z){this.eventSvc?.removeEventListener(Q,z)}onTouchStart(Q){if(this.touchStart||!QH(Q))return;let z=Q.touches[0];this.touchStart=z;let J=this.handlers;if(!J.length){let Z=this.eElement,$=Z.ownerDocument,X=this.onTouchMove.bind(this),Y=this.onTouchEnd.bind(this),G=this.onTouchCancel.bind(this),q={passive:!0},H={passive:!1};pJ(J,[Z,"touchmove",X,q],[$,"touchcancel",G,q],[$,"touchend",Y,H],[$,"contextmenu",J1,H])}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:Q})},eq)}onTouchMove(Q){let{moved:z,touchStart:J}=this;if(!z&&J){let Z=G1(J,Q.touches);if(Z&&!i8(Z,J,4))this.clearLongPress(),this.moved=!0}}onTouchEnd(Q){let z=this.touchStart;if(!z||!G1(z,Q.changedTouches))return;if(!this.moved)this.eventSvc?.dispatchEvent({type:"tap",touchStart:z}),this.checkDoubleTap(z);if(this.preventClick)J1(Q);this.cancel()}onTouchCancel(Q){let z=this.touchStart;if(!z||!G1(z,Q.changedTouches))return;this.lastTapTime=null,this.cancel()}checkDoubleTap(Q){let z=Date.now(),J=this.lastTapTime;if(J){if(z-J>oq)this.eventSvc?.dispatchEvent({type:"doubleTap",touchStart:Q}),z=null}this.lastTapTime=z}cancel(){this.clearLongPress(),I5(this.handlers),this.touchStart=null}clearLongPress(){window.clearTimeout(this.longPressTimer),this.longPressTimer=0,this.moved=!1}destroy(){let Q=this.startListener;if(Q)this.startListener=null,this.eElement.removeEventListener("touchstart",Q);this.cancel(),this.eElement=null,this.eventSvc=null}},CQ=((Q)=>{return Q[Q.VALUE=0]="VALUE",Q[Q.DIMENSION=1]="DIMENSION",Q})(CQ||{}),zH=1,JH=class{constructor(Q){if(this.beans={},this.createdBeans=[],this.destroyed=!1,this.instanceId=zH++,!Q?.beanClasses)return;this.beanDestroyComparator=Q.beanDestroyComparator,this.init(Q)}init(Q){this.id=Q.id,this.beans.context=this,this.destroyCallback=Q.destroyCallback;for(let z of Object.keys(Q.providedBeanInstances))this.beans[z]=Q.providedBeanInstances[z];for(let z of Q.beanClasses){let J=new z;if(J.beanName)this.beans[J.beanName]=J;else console.error(`Bean ${z.name} is missing beanName`);this.createdBeans.push(J)}for(let z of Q.derivedBeans??[]){let{beanName:J,bean:Z}=z(this);this.beans[J]=Z,this.createdBeans.push(Z)}if(Q.beanInitComparator)this.createdBeans.sort(Q.beanInitComparator);this.initBeans(this.createdBeans)}getBeanInstances(){return Object.values(this.beans)}createBean(Q,z){return this.initBeans([Q],z),Q}initBeans(Q,z){let J=this.beans;for(let Z of Q)Z.preWireBeans?.(J),Z.wireBeans?.(J);for(let Z of Q)Z.preConstruct?.();if(z)Q.forEach(z);for(let Z of Q)Z.postConstruct?.()}getBeans(){return this.beans}getBean(Q){return this.beans[Q]}getId(){return this.id}destroy(){if(this.destroyed)return;this.destroyed=!0;let Q=this.getBeanInstances();if(this.beanDestroyComparator)Q.sort(this.beanDestroyComparator);this.destroyBeans(Q),this.beans={},this.createdBeans=[],this.destroyCallback?.()}destroyBean(Q){Q?.destroy?.()}destroyBeans(Q){if(Q)for(let z=0;z[Q,z]));function XH(Q,z){let J=(Q.beanName?f7[Q.beanName]:void 0)??Number.MAX_SAFE_INTEGER,Z=(z.beanName?f7[z.beanName]:void 0)??Number.MAX_SAFE_INTEGER;return J-Z}function YH(Q,z){if(Q?.beanName==="gridDestroySvc")return-1;if(z?.beanName==="gridDestroySvc")return 1;return 0}function bQ(Q){let{rowIndex:z,rowPinned:J,column:Z}=Q;return`${z}.${J==null?"null":J}.${Z.getId()}`}function f1(Q,z){let J=Q.column===z.column,Z=Q.rowPinned===z.rowPinned,$=Q.rowIndex===z.rowIndex;return J&&Z&&$}function q0(Q,z){switch(Q.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 Q.rowIndexU.rowNode.rowIndex===z.rowIndex),q=G?X:Y,H=(J?-1:1)*(G?-1:1),_;for(let U=0;U{if(!Z.defaultPrevented&&!UH(Z)&&Z.key===V.TAB){let $=Z.shiftKey;if(!R0(Q,J,!1,$)){if($Q(Q,$))Z.preventDefault()}}}})}function _Q(Q){return Q.gos.get("suppressHeaderFocus")||!!Q.overlays?.exclusive}function qZ(Q){return Q.gos.get("suppressCellFocus")||!!Q.overlays?.exclusive}function $Q(Q,z,J=!1){let Z=Q.ctrlsSvc.get("gridCtrl"),$=Z.focusNextInnerContainer(z);if($===!0)return!0;if($===!1)return $;if(J||!z&&!Z.isDetailGrid()&&Z.isFocusInsideGridBody())Z.forceFocusOutOfContainer(z);return!1}function HH(Q,z){let J=Q.focusSvc,Z=J.getFocusedCell();if(Z&&z&&f1(Z,z)){let{rowIndex:$,rowPinned:X,column:Y}=z;if(hz(Q))J.setFocusedCell({rowIndex:$,column:Y,rowPinned:X,forceBrowserFocus:!0,preventScrollOnBrowserFocus:!V1()})}}function _H(Q,z){let J=Q.getFocusableContainerName();if(J==="gridBody")return z();return m9(Q,()=>EQ(Q.getGui(),".ag-tab-guard").length>0)?J:null}function m9(Q,z){Q.setAllowFocus?.(!0);try{return z()}finally{Q.setAllowFocus?.(!1)}}var c9="__ag_Grid_Skip_Focusable_Container";function p9(Q){Q[c9]=!0}function UH(Q){return Q[c9]===!0}function i9(Q){if(!Q.cols)return-1;return Q.cols.treeDepth+1}function l0(Q){return Q.ctrlsSvc.getHeaderRowContainerCtrl()?.getRowCount()??0}function z6(Q){let z=[],J=Q.ctrlsSvc.getHeaderRowContainerCtrls();for(let Z of J){if(!Z)continue;let $=Z.getGroupRowCount()||0;for(let X=0;X<$;X++){let Y=Z.getGroupRowCtrlAtIndex(X),G=z[X];if(Y){let q=WH(Q,Y);if(G==null||q>G)z[X]=q}}}return z}function WH(Q,z){let Z=Q.colModel.isPivotMode()?EH(Q):d9(Q),$=z.getHeaderCellCtrls();for(let X of $){let{column:Y}=X,G=Y.getAutoHeaderHeight();if(G!=null&&G>Z&&Y.isAutoHeaderHeight())Z=G}return Z}function J6(Q){let J=Q.colModel.isPivotMode()?BH(Q):NZ(Q);return Q.colModel.forAllCols((Z)=>{let $=Z.getAutoHeaderHeight();if($!=null&&$>J&&Z.isAutoHeaderHeight())J=$}),J}function NZ(Q){return Q.gos.get("headerHeight")??Q.environment.getDefaultHeaderHeight()}function n9(Q){return Q.gos.get("floatingFiltersHeight")??NZ(Q)}function d9(Q){return Q.gos.get("groupHeaderHeight")??NZ(Q)}function BH(Q){return Q.gos.get("pivotHeaderHeight")??NZ(Q)}function EH(Q){return Q.gos.get("pivotGroupHeaderHeight")??d9(Q)}function KH(Q,z){return Q.headerRowIndex===z.headerRowIndex&&Q.column===z.column}function LH(Q){return Q?.headerRowIndex!=null}var FH=class extends j{setComp(Q,z,J){this.comp=Q,this.eGui=z;let{beans:Z}=this,{headerNavigation:$,touchSvc:X,ctrlsSvc:Y}=Z;if($)this.createManagedBean(new cQ(J,{onTabKeyDown:this.onTabKeyDown.bind(this),handleKeyDown:this.handleKeyDown.bind(this),onFocusOut:this.onFocusOut.bind(this)}));this.addManagedEventListeners({columnPivotModeChanged:this.onPivotModeChanged.bind(this,Z),displayedColumnsChanged:this.onDisplayedColumnsChanged.bind(this,Z)}),this.onPivotModeChanged(Z),this.setupHeaderHeight();let G=this.onHeaderContextMenu.bind(this);this.addManagedElementListeners(this.eGui,{contextmenu:G}),X?.mockHeaderContextMenu(this,G),Y.register("gridHeaderCtrl",this)}setupHeaderHeight(){let Q=this.setHeaderHeight.bind(this);Q(),this.addManagedPropertyListeners(["headerHeight","pivotHeaderHeight","groupHeaderHeight","pivotGroupHeaderHeight","floatingFiltersHeight"],Q),this.addManagedEventListeners({headerRowsChanged:Q,columnHeaderHeightChanged:Q,columnGroupHeaderHeightChanged:()=>YQ(this.beans,()=>Q()),stylesChanged:Q,advancedFilterEnabledChanged:Q})}setHeaderHeight(){let{beans:Q}=this,z=0,J=z6(Q).reduce((Y,G)=>Y+G,0),Z=J6(Q);if(Q.filterManager?.hasFloatingFilters())z+=n9(Q);z+=J,z+=Z;let $=Q.environment.getHeaderRowBorderWidth(),X=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(Q){let z=Q.colModel.isPivotMode();this.comp.toggleCss("ag-pivot-on",z),this.comp.toggleCss("ag-pivot-off",!z)}onDisplayedColumnsChanged(Q){let J=Q.visibleCols.allCols.some((Z)=>Z.isSpanHeaderHeight());this.comp.toggleCss("ag-header-allow-overflow",J)}onTabKeyDown(Q){let z=this.gos.get("enableRtl"),J=Q.shiftKey,Z=J!==z?"LEFT":"RIGHT",{beans:$}=this,{headerNavigation:X,focusSvc:Y}=$;if(X.navigateHorizontally(Z,!0,Q)||!J&&Y.focusOverlay(!1)||$Q($,J,!0))Q.preventDefault()}handleKeyDown(Q){let z=null,{headerNavigation:J}=this.beans;switch(Q.key){case V.LEFT:z="LEFT";case V.RIGHT:{if(!T(z))z="RIGHT";if(J.navigateHorizontally(z,!1,Q))Q.preventDefault();break}case V.UP:z="UP";case V.DOWN:{if(!T(z))z="DOWN";if(J.navigateVertically(z,Q))Q.preventDefault();break}default:return}}onFocusOut(Q){let{relatedTarget:z}=Q,{eGui:J,beans:Z}=this;if(!z&&J.contains(d(Z)))return;if(!J.contains(z))Z.focusSvc.focusedHeader=null}onHeaderContextMenu(Q,z,J){let{menuSvc:Z,ctrlsSvc:$}=this.beans;if(!Q&&!J||!Z?.isHeaderContextMenuEnabled())return;let{target:X}=Q??z;if(X===this.eGui||X===$.getHeaderRowContainerCtrl()?.eViewport)Z.showHeaderContextMenu(void 0,Q,J)}},Z6=class extends x{constructor(Q,z){super(Q);this.ctrl=z}getCtrl(){return this.ctrl}},DH={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"}]},MH=class extends Z6{constructor(Q){super(DH,Q);this.eResize=S,this.eHeaderCompWrapper=S,this.headerCompVersion=0}postConstruct(){let Q=this.getGui(),z=()=>{let Z=this.ctrl.getSelectAllGui();if(Z)this.eResize.insertAdjacentElement("afterend",Z),this.addDestroyFunc(()=>Z.remove())},J={setWidth:(Z)=>Q.style.width=Z,toggleCss:(Z,$)=>this.toggleCss(Z,$),setUserStyles:(Z)=>$J(Q,Z),setAriaSort:(Z)=>Z?r4(Q,Z):s4(Q),setUserCompDetails:(Z)=>this.setUserCompDetails(Z),getUserCompInstance:()=>this.headerComp,refreshSelectAllGui:z,removeSelectAllGui:()=>this.ctrl.getSelectAllGui()?.remove()};this.ctrl.setComp(J,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(Q){this.headerCompVersion++;let z=this.headerCompVersion;Q.newAgStackInstance().then((J)=>this.afterCompCreated(z,J))}afterCompCreated(Q,z){if(Q!=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())}},kH={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"}]},VH=class extends Z6{constructor(Q){super(kH,Q);this.eResize=S,this.eHeaderCompWrapper=S}postConstruct(){let Q=this.getGui(),z=(Z,$)=>$!=null?Q.setAttribute(Z,$):Q.removeAttribute(Z),J={toggleCss:(Z,$)=>this.toggleCss(Z,$),setUserStyles:(Z)=>$J(Q,Z),setHeaderWrapperHidden:(Z)=>{if(Z)this.eHeaderCompWrapper.style.setProperty("display","none");else this.eHeaderCompWrapper.style.removeProperty("display")},setHeaderWrapperMaxHeight:(Z)=>{if(Z!=null)this.eHeaderCompWrapper.style.setProperty("max-height",`${Z}px`);else this.eHeaderCompWrapper.style.removeProperty("max-height");this.eHeaderCompWrapper.classList.toggle("ag-header-cell-comp-wrapper-limited-height",Z!=null)},setResizableDisplayed:(Z)=>N(this.eResize,Z),setWidth:(Z)=>Q.style.width=Z,setAriaExpanded:(Z)=>z("aria-expanded",Z),setUserCompDetails:(Z)=>this.setUserCompDetails(Z),getUserCompInstance:()=>this.headerGroupComp};this.ctrl.setComp(J,Q,this.eResize,this.eHeaderCompWrapper,void 0)}setUserCompDetails(Q){Q.newAgStackInstance().then((z)=>this.afterHeaderCompCreated(z))}afterHeaderCompCreated(Q){let z=()=>this.destroyBean(Q);if(!this.isAlive()){z();return}let J=this.getGui(),Z=Q.getGui();this.eHeaderCompWrapper.appendChild(Z),this.addDestroyFunc(z),this.headerGroupComp=Q,this.ctrl.setDragSource(J)}},fH={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"}}]}]},AH=class extends Z6{constructor(Q){super(fH,Q);this.eFloatingFilterBody=S,this.eButtonWrapper=S,this.eButtonShowMainFilter=S}postConstruct(){let Q=this.getGui(),z={toggleCss:(J,Z)=>this.toggleCss(J,Z),setUserStyles:(J)=>$J(Q,J),addOrRemoveBodyCssClass:(J,Z)=>this.eFloatingFilterBody.classList.toggle(J,Z),setButtonWrapperDisplayed:(J)=>N(this.eButtonWrapper,J),setCompDetails:(J)=>this.setCompDetails(J),getFloatingFilterComp:()=>this.compPromise,setWidth:(J)=>Q.style.width=J,setMenuIcon:(J)=>this.eButtonShowMainFilter.appendChild(J)};this.ctrl.setComp(z,Q,this.eButtonShowMainFilter,this.eFloatingFilterBody,void 0)}setCompDetails(Q){if(!Q){this.destroyFloatingFilterComp(),this.compPromise=null;return}this.compPromise=Q.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(Q){if(!Q)return;if(!this.isAlive()){this.destroyBean(Q);return}this.destroyFloatingFilterComp(),this.floatingFilterComp=Q,this.eFloatingFilterBody.appendChild(Q.getGui()),Q.afterGuiAttached?.()}},jH=class extends x{constructor(Q){super({tag:"div",cls:Q.headerRowClass,role:"row"});this.ctrl=Q,this.headerComps={}}postConstruct(){this.getGui().setAttribute("tabindex",String(this.gos.get("tabIndex"))),eJ(this.getGui(),this.ctrl.getAriaRowIndex());let z={setHeight:(J)=>this.getGui().style.height=J,setTop:(J)=>this.getGui().style.top=J,setHeaderCtrls:(J,Z)=>this.setHeaderCtrls(J,Z),setWidth:(J)=>this.getGui().style.width=J,setRowIndex:(J)=>eJ(this.getGui(),J)};this.ctrl.setComp(z,void 0)}destroy(){this.setHeaderCtrls([],!1),super.destroy()}setHeaderCtrls(Q,z){if(!this.isAlive())return;let J=this.headerComps;this.headerComps={};for(let Z of Q){let $=Z.instanceId,X=J[$];if(delete J[$],X==null)X=this.createHeaderComp(Z),this.getGui().appendChild(X.getGui());this.headerComps[$]=X}if(Object.values(J).forEach((Z)=>{Z.getGui().remove(),this.destroyBean(Z)}),z){let Z=Object.values(this.headerComps);Z.sort((X,Y)=>{let G=X.getCtrl().column.getLeft(),q=Y.getCtrl().column.getLeft();return G-q});let $=Z.map((X)=>X.getGui());u8(this.getGui(),$)}}createHeaderComp(Q){let z;switch(this.ctrl.type){case"group":z=new VH(Q);break;case"filter":z=new AH(Q);break;default:z=new MH(Q);break}return this.createBean(z),z.setParentComponent(this),z}},$6=class extends j{constructor(Q,z=!1){super();this.callback=Q,this.addSpacer=z}postConstruct(){let Q=this.setWidth.bind(this);if(this.addManagedPropertyListener("domLayout",Q),this.addManagedEventListeners({columnContainerWidthChanged:Q,displayedColumnsChanged:Q,leftPinnedWidthChanged:Q}),this.addSpacer)this.addManagedEventListeners({rightPinnedWidthChanged:Q,scrollVisibilityChanged:Q,scrollbarWidthChanged:Q});this.setWidth()}setWidth(){let Q=V0(this.gos,"print"),{visibleCols:z,scrollVisibleSvc:J}=this.beans,Z=z.bodyWidth,$=z.getColsLeftWidth(),X=z.getDisplayedColumnsRightWidth(),Y;if(Q)Y=Z+$+X;else if(Y=Z,this.addSpacer){if((this.gos.get("enableRtl")?$:X)===0&&J.verticalScrollShowing)Y+=J.getScrollbarWidth()}this.callback(Y)}};function BJ(Q,z,J){if(J)Q.addDestroyFunc(()=>z.destroyBean(J));return J??Q}var X6=class extends j{constructor(Q,z,J,Z){super();this.columnOrGroup=Q,this.eCell=z,this.colsSpanning=Z,this.columnOrGroup=Q,this.ariaEl=z.querySelector("[role=columnheader]")||z,this.beans=J}setColsSpanning(Q){this.colsSpanning=Q,this.onLeftChanged()}getColumnOrGroup(){let{beans:Q,colsSpanning:z}=this;if(Q.gos.get("enableRtl")&&z)return b(z);return this.columnOrGroup}postConstruct(){let Q=this.onLeftChanged.bind(this);this.addManagedListeners(this.columnOrGroup,{leftChanged:Q}),this.setLeftFirstTime(),this.addManagedEventListeners({displayedColumnsWidthChanged:Q}),this.addManagedPropertyListener("domLayout",Q)}setLeftFirstTime(){let{gos:Q,colAnimation:z}=this.beans,J=Q.get("suppressColumnMoveAnimation"),Z=T(this.columnOrGroup.getOldLeft());if(z?.isActive()&&Z&&!J)this.animateInLeft();else this.onLeftChanged()}animateInLeft(){let Q=this.getColumnOrGroup(),z=this.modifyLeftForPrintLayout(Q,Q.getOldLeft()),J=this.modifyLeftForPrintLayout(Q,Q.getLeft());this.setLeft(z),this.actualLeft=J,this.beans.colAnimation.executeNextVMTurn(()=>{if(this.actualLeft===J)this.setLeft(J)})}onLeftChanged(){let Q=this.getColumnOrGroup(),z=Q.getLeft();this.actualLeft=this.modifyLeftForPrintLayout(Q,z),this.setLeft(this.actualLeft)}modifyLeftForPrintLayout(Q,z){let{gos:J,visibleCols:Z}=this.beans;if(!V0(J,"print"))return z;if(Q.getPinned()==="left")return z;let X=Z.getColsLeftWidth();if(Q.getPinned()==="right"){let Y=Z.bodyWidth;return X+Y+z}return X+z}setLeft(Q){if(T(Q))this.eCell.style.left=`${Q}px`;if(_0(this.columnOrGroup)){let z=this.columnOrGroup.getLeafColumns();if(!z.length)return;if(z.length>1)t4(this.ariaEl,z.length)}}},RH="ag-column-first",SH="ag-column-last";function gZ(Q,z,J,Z){if(n(Q))return[];return r9(Q.headerClass,Q,z,J,Z)}function hZ(Q,z,J,Z){if(n(Q))return[];return r9(Q.toolPanelClass,Q,z,J,Z)}function t9(Q,z,J){Q.toggleCss(RH,J.isColAtEdge(z,"first")),Q.toggleCss(SH,J.isColAtEdge(z,"last"))}function OH(Q,z,J,Z){return y(z,{colDef:Q,column:J,columnGroup:Z})}function r9(Q,z,J,Z,$){if(n(Q))return[];let X;if(typeof Q==="function"){let Y=OH(z,J,Z,$);X=Q(Y)}else X=Q;if(typeof X==="string")return[X];if(Array.isArray(X))return[...X];return[]}var PH=0,s9="headerCtrl",Y6=class extends j{constructor(Q,z){super();this.column=Q,this.rowCtrl=z,this.resizeToggleTimeout=0,this.resizeMultiplier=1,this.resizeFeature=null,this.lastFocusEvent=null,this.dragSource=null,this.reAttemptToFocus=!1,this.instanceId=Q.getUniqueId()+"-"+PH++}postConstruct(){let Q=this.refreshTabIndex.bind(this);this.addManagedPropertyListeners(["suppressHeaderFocus"],Q),this.addManagedEventListeners({overlayExclusiveChanged:Q})}setComp(Q,z,J,Z,$){if(z.setAttribute("col-id",this.column.colIdSanitised),this.wireComp(Q,z,J,Z,$),this.reAttemptToFocus)this.reAttemptToFocus=!1,this.focus(this.lastFocusEvent??void 0)}shouldStopEventPropagation(Q){let{headerRowIndex:z,column:J}=this.beans.focusSvc.focusedHeader,Z=J.getDefinition(),$=Z?.suppressHeaderKeyboardEvent;if(!T($))return!1;let X=y(this.gos,{colDef:Z,column:J,headerRowIndex:z,event:Q});return!!$(X)}getWrapperHasFocus(){return d(this.beans)===this.eGui}setGui(Q,z){this.eGui=Q,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 Q=this.column.getDefinition();if(!Q)return;let{headerStyle:z}=Q,J;if(typeof z==="function"){let Z=this.getHeaderClassParams();J=z(Z)}else J=z;if(J)this.comp.setUserStyles(J)}onGuiFocus(){this.eventSvc.dispatchEvent({type:"headerFocused",column:this.column})}setupAutoHeight(Q){let{wrapperElement:z,checkMeasuringCallback:J,compBean:Z}=Q,{beans:$}=this,X=(U)=>{if(!this.isAlive()||!Z.isAlive())return;let{paddingTop:W,paddingBottom:B,borderBottomWidth:E,borderTopWidth:K}=M1(this.eGui),L=W+B+E+K,D=z.offsetHeight+L;if(U<5){let k=!Y0($)?.contains(z),f=D==0;if(k||f){e2(()=>X(U+1),"raf",$);return}}this.setColHeaderHeight(this.column,D)},Y=!1,G,q=()=>{let U=this.column.isAutoHeaderHeight();if(U&&!Y)H();if(!U&&Y)_()},H=()=>{Y=!0,this.comp.toggleCss("ag-header-cell-auto-height",!0),X(0),G=DQ(this.beans,z,()=>X(0))},_=()=>{if(Y=!1,G)G();this.comp.toggleCss("ag-header-cell-auto-height",!1),G=void 0};if(q(),Z.addDestroyFunc(()=>_()),Z.addManagedListeners(this.column,{widthChanged:()=>Y&&X(0)}),Z.addManagedEventListeners({sortChanged:()=>{if(Y)window.setTimeout(()=>X(0))}}),J)J(q)}onDisplayedColumnsChanged(){let{comp:Q,column:z,beans:J,eGui:Z}=this;if(!Q||!z||!Z)return;t9(Q,z,J.visibleCols),v8(Z,J.visibleCols.getAriaColIndex(z))}addResizeAndMoveKeyboardListeners(Q){Q.addManagedListeners(this.eGui,{keydown:this.onGuiKeyDown.bind(this),keyup:this.onGuiKeyUp.bind(this)})}refreshTabIndex(){let Q=_Q(this.beans);if(this.eGui)Pz(this.eGui,"tabindex",Q?null:"-1")}onGuiKeyDown(Q){let z=d(this.beans),J=Q.key===V.LEFT||Q.key===V.RIGHT;if(this.isResizing)Q.preventDefault(),Q.stopImmediatePropagation();if(z!==this.eGui||!Q.shiftKey&&!Q.altKey&&!Q.ctrlKey&&!Q.metaKey)return;if(this.isResizing||J)Q.preventDefault(),Q.stopImmediatePropagation();if((Q.ctrlKey||Q.metaKey)&&R9(Q)===V.C)return this.beans.clipboardSvc?.copyToClipboard();if(!J)return;let X=Q.key===V.LEFT!==this.gos.get("enableRtl")?"left":"right";if(Q.altKey){this.isResizing=!0,this.resizeMultiplier+=1;let Y=this.getViewportAdjustedResizeDiff(Q);this.resizeHeader(Y,Q.shiftKey),this.resizeFeature?.toggleColumnResizing(!0)}else this.moveHeader(X)}moveHeader(Q){this.beans.colMoves?.moveHeader(Q,this.eGui,this.column,this.rowCtrl.pinned,this)}getViewportAdjustedResizeDiff(Q){let z=this.getResizeDiff(Q),{pinnedCols:J}=this.beans;return J?J.getHeaderResizeDiff(z,this.column):z}getResizeDiff(Q){let{gos:z,column:J}=this,Z=Q.key===V.LEFT!==z.get("enableRtl"),$=J.getPinned(),X=z.get("enableRtl");if($){if(X!==($==="right"))Z=!Z}return(Z?-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(Q){let z=this.getWrapperHasFocus();switch(Q.key){case V.PAGE_DOWN:case V.PAGE_UP:case V.PAGE_HOME:case V.PAGE_END:if(z)Q.preventDefault()}}addDomData(Q){let z=s9,{eGui:J,gos:Z}=this;wz(Z,J,z,this),Q.addDestroyFunc(()=>wz(Z,J,z,null))}focus(Q){if(!this.isAlive())return!1;let{eGui:z}=this;if(!z)this.reAttemptToFocus=!0;else this.lastFocusEvent=Q||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(Q,z,J){let Z=Q??z,{menuSvc:$,gos:X}=this.beans;if(X.get("preventDefaultOnContextMenu"))Z.preventDefault();if($?.isHeaderContextMenuEnabled(J))$.showHeaderContextMenu(J,Q,z);this.dispatchColumnMouseEvent("columnHeaderContextMenu",J)}dispatchColumnMouseEvent(Q,z){this.eventSvc.dispatchEvent({type:Q,column:z})}setColHeaderHeight(Q,z){if(!Q.setAutoHeaderHeight(z))return;let{eventSvc:J}=this;if(Q.isColumn)J.dispatchEvent({type:"columnHeaderHeightChanged",column:Q,columns:[Q],source:"autosizeColumnHeaderHeight"});else J.dispatchEvent({type:"columnGroupHeaderHeightChanged",columnGroup:Q,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}},TH=class extends Y6{constructor(){super(...arguments);this.refreshFunctions={},this.userHeaderClasses=new Set,this.ariaDescriptionProperties=new Map}wireComp(Q,z,J,Z,$){this.comp=Q;let{rowCtrl:X,column:Y,beans:G}=this,{colResize:q,context:H,colHover:_,rangeSvc:U}=G,W=BJ(this,H,$);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:Z,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(),q)this.resizeFeature=W.createManagedBean(q.createResizeFeature(X.pinned,Y,J,Q,this));else N(J,!1);_?.createHoverFeature(W,[Y],z),U?.createRangeHighlightFeature(W,Y,Q),W.createManagedBean(new X6(Y,z,G)),W.createManagedBean(new cQ(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(Q,z){this.beans.colResize?.resizeHeader(this.column,Q,z)}getHeaderClassParams(){let{column:Q,beans:z}=this,J=Q.colDef;return y(z.gos,{colDef:J,column:Q,floatingFilter:!1})}setupUserComp(){let Q=this.lookupUserCompDetails();if(Q)this.setCompDetails(Q)}setCompDetails(Q){this.userCompDetails=Q,this.comp.setUserCompDetails(Q)}lookupUserCompDetails(){let Q=this.createParams(),z=this.column.getColDef();return Tq(this.beans.userCompFactory,z,Q)}createParams(){let{menuSvc:Q,sortSvc:z,colFilter:J,gos:Z}=this.beans;return y(Z,{column:this.column,displayName:this.displayName,enableSorting:this.column.isSortable(),enableMenu:this.menuEnabled,enableFilterButton:this.openFilterEnabled&&!!Q?.isHeaderFilterButtonEnabled(this.column),enableFilterIcon:!!J&&(!this.openFilterEnabled||U0(this.gos)),showColumnMenu:(X,Y)=>{Q?.showColumnMenu({column:this.column,buttonElement:X,positionBy:"button",onClosedCallback:Y})},showColumnMenuAfterMouseClick:(X,Y)=>{Q?.showColumnMenu({column:this.column,mouseEvent:X,positionBy:"mouse",onClosedCallback:Y})},showFilter:(X)=>{Q?.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)=>{Z.assertModuleRegistered("Tooltip",3),this.setupTooltip(X,Y)}})}setupSelectAll(Q){let{selectionSvc:z}=this.beans;if(!z)return;this.selectAllFeature=Q.createOptionalManagedBean(z.createSelectAllFeature(this.column)),this.selectAllFeature?.setComp(this),Q.addManagedPropertyListener("rowSelection",()=>{let J=z.createSelectAllFeature(this.column);if(J&&!this.selectAllFeature)this.selectAllFeature=Q.createManagedBean(J),this.selectAllFeature?.setComp(this),this.comp.refreshSelectAllGui();else if(this.selectAllFeature&&!J)this.comp.removeSelectAllGui(),this.selectAllFeature=this.destroyBean(this.selectAllFeature)})}getSelectAllGui(){return this.selectAllFeature?.getCheckboxGui()}handleKeyDown(Q){if(super.handleKeyDown(Q),Q.key===V.SPACE)this.selectAllFeature?.onSpaceKeyDown(Q);else if(Q.key===V.ENTER)this.onEnterKeyDown(Q);else if(Q.key===V.DOWN&&Q.altKey)this.showMenuOnKeyPress(Q,!1)}onEnterKeyDown(Q){let{column:z,gos:J,sortable:Z,beans:$}=this,X=!1;if(Q.ctrlKey||Q.metaKey)X=this.showMenuOnKeyPress(Q,!0);if(!X){if(!Q.altKey&&Zz(J))$.rangeSvc?.handleColumnSelection(z,Q);else if(Z)$.sortSvc?.progressSort(z,Q.shiftKey,"uiColumnSorted")}}showMenuOnKeyPress(Q,z){let J=this.comp.getUserCompInstance();if(!A7(J))return!1;if(J.onMenuKeyboardShortcut(z))return Q.preventDefault(),!0;return!1}onFocusIn(Q){if(!this.eGui.contains(Q.relatedTarget))this.focusThis(),this.announceAriaDescription();if(V1())this.setActiveHeader(!0)}onFocusOut(Q){if(this.eGui.contains(Q.relatedTarget))return;this.setActiveHeader(!1)}setupTooltip(Q,z){this.tooltipFeature=this.beans.tooltipSvc?.setupHeaderTooltip(this.tooltipFeature,this,Q,z)}setupStylesFromColDef(){this.setRefreshFunction("headerStyles",this.refreshHeaderStyles.bind(this)),this.refreshHeaderStyles()}setupClassesFromColDef(){let Q=()=>{let z=this.column.getColDef(),J=gZ(z,this.gos,this.column,null),Z=this.userHeaderClasses;this.userHeaderClasses=new Set(J);for(let $ of J)if(Z.has($))Z.delete($);else this.comp.toggleCss($,!0);for(let $ of Z)this.comp.toggleCss($,!1)};this.setRefreshFunction("headerClasses",Q),Q()}setDragSource(Q){if(this.dragSourceElement=Q,this.removeDragSource(),!Q||!this.draggable)return;this.dragSource=this.beans.colMoves?.setDragSourceForHeader(Q,this.column,this.displayName)??null}updateState(){let{menuSvc:Q}=this.beans;this.menuEnabled=!!Q?.isColumnMenuInHeaderEnabled(this.column),this.openFilterEnabled=!!Q?.isFilterMenuInHeaderEnabled(this.column),this.sortable=this.column.isSortable(),this.displayName=this.calculateDisplayName(),this.draggable=this.workOutDraggable()}setRefreshFunction(Q,z){this.refreshFunctions[Q]=z}refresh(){this.updateState(),this.refreshHeaderComp(),this.refreshAria();for(let Q of Object.values(this.refreshFunctions))Q()}refreshHeaderComp(){let Q=this.lookupUserCompDetails();if(!Q)return;if(this.comp.getUserCompInstance()!=null&&this.userCompDetails.componentClass==Q.componentClass?this.attemptHeaderCompRefresh(Q.params):!1)this.setDragSource(this.dragSourceElement);else this.setCompDetails(Q)}attemptHeaderCompRefresh(Q){let z=this.comp.getUserCompInstance();if(!z)return!1;if(!z.refresh)return!1;return z.refresh(Q)}calculateDisplayName(){return this.beans.colNames.getDisplayNameForColumn(this.column,"header",!0)}checkDisplayName(){if(this.displayName!==this.calculateDisplayName())this.refresh()}workOutDraggable(){let Q=this.column.getColDef();return!this.gos.get("suppressMovableColumns")&&!Q.suppressMovable&&!Q.lockPosition||!!Q.enableRowGroup||!!Q.enablePivot}setupWidth(Q){let z=()=>{let J=this.column.getActualWidth();this.comp.setWidth(`${J}px`)};Q.addManagedListeners(this.column,{widthChanged:z}),z()}setupMovingCss(Q){let z=()=>{this.comp.toggleCss("ag-header-cell-moving",this.column.isMoving())};Q.addManagedListeners(this.column,{movingChanged:z}),z()}setupMenuClass(Q){let z=()=>{this.comp?.toggleCss("ag-column-menu-visible",this.column.isMenuVisible())};Q.addManagedListeners(this.column,{menuVisibleChanged:z}),z()}setupSortableClass(Q){let z=()=>{this.comp.toggleCss("ag-header-cell-sortable",!!this.sortable)};z(),this.setRefreshFunction("updateSortable",z),Q.addManagedEventListeners({sortChanged:this.refreshAriaSort.bind(this)})}setupFilterClass(Q){let z=()=>{let J=this.column.isFilterActive();this.comp.toggleCss("ag-header-cell-filtered",J),this.refreshAria()};Q.addManagedListeners(this.column,{filterActiveChanged:z}),z()}setupWrapTextClass(){let Q=()=>{let z=!!this.column.getColDef().wrapHeaderText;this.comp.toggleCss("ag-header-cell-wrap-text",z)};Q(),this.setRefreshFunction("wrapText",Q)}onHeaderHighlightChanged(){let Q=this.column.getHighlighted(),z=Q===0,J=Q===1;this.comp.toggleCss("ag-header-highlight-before",z),this.comp.toggleCss("ag-header-highlight-after",J)}onDisplayedColumnsChanged(){if(super.onDisplayedColumnsChanged(),!this.isAlive())return;this.onHeaderHeightChanged()}onHeaderHeightChanged(){this.refreshSpanHeaderHeight()}refreshSpanHeaderHeight(){let{eGui:Q,column:z,comp:J,beans:Z}=this,$=z6(this.beans),X=$.reduce((W,B)=>W+B,0)===0;if(J.toggleCss("ag-header-parent-hidden",X),!z.isSpanHeaderHeight()){Q.style.removeProperty("top"),Q.style.removeProperty("height"),J.toggleCss("ag-header-span-height",!1),J.toggleCss("ag-header-span-total",!1);return}let{numberOfParents:Y,isSpanningTotal:G}=this.column.getColumnGroupPaddingInfo();J.toggleCss("ag-header-span-height",Y>0);let q=J6(Z);if(Y===0){J.toggleCss("ag-header-span-total",!1),Q.style.setProperty("top","0px"),Q.style.setProperty("height",`${q}px`);return}J.toggleCss("ag-header-span-total",G);let H=(this.column.getFirstRealParent()?.getLevel()??-1)+1,_=$.length-H,U=0;for(let W=0;W<_;W++)U+=$[$.length-1-W];Q.style.setProperty("top",`${-U}px`),Q.style.setProperty("height",`${q+U}px`)}refreshAriaSort(){let Q=null,{beans:z,column:J,comp:Z,sortable:$}=this;if($){let X=this.getLocaleTextFunc(),Y=z.sortSvc?.getDisplaySortForColumn(J)??null;Z.setAriaSort(u4(Y)),Q=X("ariaSortableColumn","Press ENTER to sort")}else Z.setAriaSort();this.setAriaDescriptionProperty("sort",Q)}refreshAriaMenu(){let Q=null;if(this.menuEnabled)Q=this.getLocaleTextFunc()("ariaMenuColumn","Press ALT DOWN to open column menu");this.setAriaDescriptionProperty("menu",Q)}refreshAriaFilterButton(){let Q=null,{openFilterEnabled:z,gos:J}=this;if(z&&!U0(J))Q=this.getLocaleTextFunc()("ariaFilterColumn","Press CTRL ENTER to open filter");this.setAriaDescriptionProperty("filterButton",Q)}refreshAriaFiltered(){let Q=null;if(this.column.isFilterActive())Q=this.getLocaleTextFunc()("ariaColumnFiltered","Column Filtered");this.setAriaDescriptionProperty("filter",Q)}refreshAriaCellSelection(){let Q=null,{gos:z,column:J}=this;if(Zz(z)&&!v0(J))Q=this.getLocaleTextFunc()("ariaColumnCellSelection","Press Enter to toggle selection for all visible cells in this column");this.setAriaDescriptionProperty("cellSelection",Q)}setAriaDescriptionProperty(Q,z){let J=this.ariaDescriptionProperties;if(z!=null)J.set(Q,z);else J.delete(Q)}announceAriaDescription(){let{beans:Q,eGui:z,ariaDescriptionProperties:J}=this;if(!z.contains(d(Q)))return;let Z=Array.from(J.keys()).sort(($,X)=>$==="filter"?-1:X.charCodeAt(0)-$.charCodeAt(0)).map(($)=>J.get($)).join(". ");Q.ariaAnnounce?.announceValue(Z,"columnHeader")}refreshAria(){this.refreshAriaSort(),this.refreshAriaMenu(),this.refreshAriaFilterButton(),this.refreshAriaFiltered(),this.refreshAriaCellSelection()}addColumnHoverListener(Q){this.beans.colHover?.addHeaderColumnHoverListener(Q,this.comp,this.column)}addActiveHeaderMouseListeners(Q){let z=($)=>this.handleMouseOverChange($.type==="mouseenter"),J=()=>{this.setActiveHeader(!0),this.dispatchColumnMouseEvent("columnHeaderClicked",this.column)},Z=($)=>this.handleContextMenuMouseEvent($,void 0,this.column);Q.addManagedListeners(this.eGui,{mouseenter:z,mouseleave:z,click:J,contextmenu:Z})}handleMouseOverChange(Q){this.setActiveHeader(Q),this.eventSvc.dispatchEvent({type:Q?"columnHeaderMouseOver":"columnHeaderMouseLeave",column:this.column})}setActiveHeader(Q){this.comp.toggleCss("ag-header-active",Q)}getAnchorElementForMenu(Q){let z=this.comp.getUserCompInstance();if(A7(z))return z.getAnchorElementForMenu(Q);return this.eGui}destroy(){this.tooltipFeature=this.destroyBean(this.tooltipFeature),super.destroy()}};function A7(Q){return typeof Q?.getAnchorElementForMenu==="function"&&typeof Q.onMenuKeyboardShortcut==="function"}var vH=0,I2=class extends j{constructor(Q,z,J){super();this.rowIndex=Q,this.pinned=z,this.type=J,this.instanceId=vH++,this.comp=null,this.allCtrls=[];let Z="ag-header-row-column";if(J==="group")Z="ag-header-row-group";else if(J==="filter")Z="ag-header-row-filter";this.headerRowClass=`ag-header-row ${Z}`}setRowIndex(Q){this.rowIndex=Q,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((Q)=>Q.eGui!=null)}setComp(Q,z,J=!0){if(this.comp=Q,z=BJ(this,this.beans.context,z),J)this.setRowIndex(this.rowIndex),this.onVirtualColumnsChanged();this.setWidth(),this.addEventListeners(z)}getAriaRowIndex(){return this.rowIndex+1}addEventListeners(Q){let z=this.onRowHeightChanged.bind(this),J=this.onDisplayedColumnsChanged.bind(this);Q.addManagedEventListeners({columnResized:this.setWidth.bind(this),displayedColumnsChanged:J,virtualColumnsChanged:(Z)=>this.onVirtualColumnsChanged(Z.afterScroll),columnGroupHeaderHeightChanged:z,columnHeaderHeightChanged:z,stylesChanged:z,advancedFilterEnabledChanged:z}),Q.addManagedPropertyListener("domLayout",J),Q.addManagedPropertyListener("ensureDomOrder",(Z)=>this.isEnsureDomOrder=Z.currentValue),Q.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 Q=this.getWidthForRow();this.comp.setWidth(`${Q}px`)}getWidthForRow(){let{visibleCols:Q}=this.beans;if(this.isPrintLayout){if(this.pinned!=null)return 0;return Q.getContainerWidth("right")+Q.getContainerWidth("left")+Q.getContainerWidth(null)}return Q.getContainerWidth(this.pinned)}onRowHeightChanged(){if(!this.comp)return;let{topOffset:Q,rowHeight:z}=this.getTopAndHeight();this.comp.setTop(Q+"px"),this.comp.setHeight(z+"px")}getTopAndHeight(){let Q=0,z=z6(this.beans);for(let $=0;${let{focusSvc:$,visibleCols:X}=this.beans;if(!$.isHeaderWrapperFocused(Z))return!1;return X.isVisible(Z.column)};if(Q)for(let[Z,$]of Q)if(J($))this.ctrlsById.set(Z,$);else this.destroyBean($);return this.allCtrls=Array.from(this.ctrlsById.values()),this.allCtrls}getHeaderCellCtrls(){return this.allCtrls}recycleAndCreateHeaderCtrls(Q,z,J){if(Q.isEmptyGroup())return;let Z=Q.getUniqueId(),$;if(J)$=J.get(Z),J.delete(Z);if($&&$.column!=Q)this.destroyBean($),$=void 0;if($==null)switch(this.type){case"filter":{$=this.createBean(this.beans.registry.createDynamicBean("headerFilterCellCtrl",!0,Q,this));break}case"group":$=this.createBean(this.beans.registry.createDynamicBean("headerGroupCellCtrl",!0,Q,this));break;default:$=this.createBean(new TH(Q,this));break}z.set(Z,$)}getColumnsInViewport(){if(!this.isPrintLayout)return this.getComponentsToRender();if(this.pinned)return[];let Q=[];for(let z of["left",null,"right"])Q.push(...this.getComponentsToRender(z));return Q}getComponentsToRender(Q=this.pinned){if(this.type==="group")return this.beans.colViewport.getHeadersToRender(Q,this.rowIndex);return this.beans.colViewport.getColumnHeadersToRender(Q)}focusHeader(Q,z){let J=this.allCtrls.find(($)=>$.column==Q);if(!J)return!1;return J.focus(z)}destroy(){this.allCtrls=this.destroyBeans(this.allCtrls),this.ctrlsById=void 0,this.comp=null,super.destroy()}},IH=class extends j{constructor(Q){super();this.pinned=Q,this.hidden=!1,this.includeFloatingFilter=!1,this.groupsRowCtrls=[]}setComp(Q,z){this.comp=Q,this.eViewport=z;let{pinnedCols:J,ctrlsSvc:Z,colModel:$,colMoves:X}=this.beans;this.setupCenterWidth(),J?.setupHeaderPinnedWidth(this),this.setupDragAndDrop(X,this.eViewport);let Y=this.refresh.bind(this,!0);this.addManagedEventListeners({displayedColumnsChanged:Y,advancedFilterEnabledChanged:Y});let G=`${typeof this.pinned==="string"?this.pinned:"center"}Header`;if(Z.register(G,this),$.ready)this.refresh()}getAllCtrls(){let Q=[...this.groupsRowCtrls];if(this.columnsRowCtrl)Q.push(this.columnsRowCtrl);if(this.filtersRowCtrl)Q.push(this.filtersRowCtrl);return Q}refresh(Q=!1){let{focusSvc:z,filterManager:J,visibleCols:Z}=this.beans,$=0,X=z.getFocusHeaderToUseAfterRefresh(),Y=()=>{let U=Z.headerGroupRowCount;if($=U,!Q)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=$++;if(this.hidden){this.columnsRowCtrl=this.destroyBean(this.columnsRowCtrl);return}if(this.columnsRowCtrl==null||!Q)this.columnsRowCtrl=this.destroyBean(this.columnsRowCtrl),this.columnsRowCtrl=this.createBean(new I2(U,this.pinned,"column"));else if(this.columnsRowCtrl.rowIndex!==U)this.columnsRowCtrl.setRowIndex(U)},q=()=>{this.includeFloatingFilter=!!J?.hasFloatingFilters()&&!this.hidden;let U=()=>{this.filtersRowCtrl=this.destroyBean(this.filtersRowCtrl)};if(!this.includeFloatingFilter){U();return}if(!Q)U();let W=$++;if(this.filtersRowCtrl){if(this.filtersRowCtrl.rowIndex!==W)this.filtersRowCtrl.setRowIndex(W)}else this.filtersRowCtrl=this.createBean(new I2(W,this.pinned,"filter"))},H=this.getAllCtrls();Y(),G(),q();let _=this.getAllCtrls();if(this.comp.setCtrls(_),this.restoreFocusOnHeader(z,X),H.length!==_.length)this.beans.eventSvc.dispatchEvent({type:"headerRowsChanged"})}getHeaderCtrlForColumn(Q){let z=(J)=>J?.getHeaderCellCtrls().find((Z)=>Z.column===Q);if(JQ(Q))return z(this.columnsRowCtrl);if(this.groupsRowCtrls.length===0)return;for(let J=0;Jthis.comp.setCenterWidth(`${Q}px`),!0))}},CH={tag:"div",cls:"ag-pinned-left-header",role:"rowgroup"},bH={tag:"div",cls:"ag-pinned-right-header",role:"rowgroup"},yH={tag:"div",cls:"ag-header-viewport",role:"rowgroup",attrs:{tabindex:"-1"},children:[{tag:"div",ref:"eCenterContainer",cls:"ag-header-container",role:"presentation"}]},C2=class extends x{constructor(Q){super();this.eCenterContainer=S,this.headerRowComps={},this.rowCompsList=[],this.pinned=Q}postConstruct(){this.selectAndSetTemplate();let Q={setDisplayed:(J)=>this.setDisplayed(J),setCtrls:(J)=>this.setCtrls(J),setCenterWidth:(J)=>this.eCenterContainer.style.width=J,setViewportScrollLeft:(J)=>this.getGui().scrollLeft=J,setPinnedContainerWidth:(J)=>{let Z=this.getGui();Z.style.width=J,Z.style.maxWidth=J,Z.style.minWidth=J}};this.createManagedBean(new IH(this.pinned)).setComp(Q,this.getGui())}selectAndSetTemplate(){let Q=this.pinned=="left",z=this.pinned=="right",J=Q?CH:z?bH:yH;this.setTemplate(J),this.eRowContainer=this.eCenterContainer!==S?this.eCenterContainer:this.getGui()}destroy(){this.setCtrls([]),super.destroy()}destroyRowComp(Q){this.destroyBean(Q),Q.getGui().remove()}setCtrls(Q){let z=this.headerRowComps;this.headerRowComps={},this.rowCompsList=[];let J,Z=($)=>{let X=$.getGui();if(X.parentElement!=this.eRowContainer)this.eRowContainer.appendChild(X);if(J)h8(this.eRowContainer,X,J);J=X};for(let $ of Q){let X=$.instanceId,Y=z[X];delete z[X];let G=Y?Y:this.createBean(new jH($));this.headerRowComps[X]=G,this.rowCompsList.push(G),Z(G)}for(let $ of Object.values(z))this.destroyRowComp($)}},xH={tag:"div",cls:"ag-header",role:"presentation"},wH=class extends x{constructor(){super(xH)}postConstruct(){let Q={toggleCss:(Z,$)=>this.toggleCss(Z,$),setHeightAndMinHeight:(Z)=>{this.getGui().style.height=Z,this.getGui().style.minHeight=Z}};this.createManagedBean(new FH).setComp(Q,this.getGui(),this.getFocusableElement());let J=(Z)=>{this.createManagedBean(Z),this.appendChild(Z)};J(new C2("left")),J(new C2(null)),J(new C2("right"))}},NH={selector:"AG-HEADER-ROOT",component:wH},UQ={AUTO_HEIGHT:"ag-layout-auto-height",NORMAL:"ag-layout-normal",PRINT:"ag-layout-print"},G6=class extends j{constructor(Q){super();this.view=Q}postConstruct(){this.addManagedPropertyListener("domLayout",this.updateLayoutClasses.bind(this)),this.updateLayoutClasses()}updateLayoutClasses(){let Q=this.gos.get("domLayout"),z={autoHeight:Q==="autoHeight",normal:Q==="normal",print:Q==="print"},J=z.autoHeight?UQ.AUTO_HEIGHT:z.print?UQ.PRINT:UQ.NORMAL;this.view.updateLayoutClasses(J,z)}},l9=class extends x{constructor(Q,z){super();this.direction=z,this.eViewport=S,this.eContainer=S,this.hideTimeout=0,this.setTemplate(Q)}postConstruct(){this.addManagedEventListeners({scrollVisibilityChanged:this.onScrollVisibilityChanged.bind(this)}),this.onScrollVisibilityChanged(),this.toggleCss("ag-apple-scrollbar",C9()||bz())}destroy(){super.destroy(),window.clearTimeout(this.hideTimeout)}initialiseInvisibleScrollbar(){if(this.invisibleScrollbar!==void 0)return;if(this.invisibleScrollbar=y9(),this.invisibleScrollbar)this.hideAndShowInvisibleScrollAsNeeded(),this.addActiveListenerToggles()}addActiveListenerToggles(){let Q=this.getGui(),z=()=>this.toggleCss("ag-scrollbar-active",!0),J=()=>this.toggleCss("ag-scrollbar-active",!1);this.addManagedListeners(Q,{mouseenter:z,mousedown:z,touchstart:z,mouseleave:J,touchend:J})}onScrollVisibilityChanged(){if(this.invisibleScrollbar===void 0)this.initialiseInvisibleScrollbar();YQ(this.beans,()=>this.setScrollVisible())}hideAndShowInvisibleScrollAsNeeded(){this.addManagedEventListeners({bodyScroll:(Q)=>{if(Q.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(Q){let z=this.eViewport;C5(this,()=>f0(z),()=>this.setScrollPosition(Q),100)}onScrollCallback(Q){this.addManagedElementListeners(this.eViewport,{scroll:Q})}},gH={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"}]},hH=class extends l9{constructor(){super(gH,"horizontal");this.eLeftSpacer=S,this.eRightSpacer=S,this.setScrollVisibleDebounce=0}wireBeans(Q){this.visibleCols=Q.visibleCols,this.scrollVisibleSvc=Q.scrollVisibleSvc}postConstruct(){super.postConstruct();let Q=this.setFakeHScrollSpacerWidths.bind(this);this.addManagedEventListeners({displayedColumnsChanged:Q,displayedColumnsWidthChanged:Q,pinnedRowDataChanged:this.refreshCompBottom.bind(this)}),this.addManagedPropertyListener("domLayout",Q),this.beans.ctrlsSvc.register("fakeHScrollComp",this),this.createManagedBean(new $6((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 Q=this.beans.pinnedRowModel?.getPinnedBottomTotalHeight()??0;this.getGui().style.bottom=`${Q}px`}onScrollVisibilityChanged(){super.onScrollVisibilityChanged(),this.setFakeHScrollSpacerWidths()}setFakeHScrollSpacerWidths(){let Q=this.scrollVisibleSvc.verticalScrollShowing,z=this.visibleCols.getDisplayedColumnsRightWidth(),J=!this.enableRtl&&Q,Z=this.scrollVisibleSvc.getScrollbarWidth();if(J)z+=Z;SQ(this.eRightSpacer,z),this.eRightSpacer.classList.toggle("ag-scroller-corner",z<=Z);let $=this.visibleCols.getColsLeftWidth();if(this.enableRtl&&Q)$+=Z;SQ(this.eLeftSpacer,$),this.eLeftSpacer.classList.toggle("ag-scroller-corner",$<=Z)}setScrollVisible(){let Q=this.scrollVisibleSvc.horizontalScrollShowing,z=this.invisibleScrollbar,J=this.gos.get("suppressHorizontalScroll"),Z=Q?this.scrollVisibleSvc.getScrollbarWidth()||0:0,X=!J?Z===0&&z?16:Z:0,Y=()=>{if(this.setScrollVisibleDebounce=0,this.toggleCss("ag-scrollbar-invisible",z),N1(this.getGui(),X),N1(this.eViewport,X),N1(this.eContainer,X),!X)this.eContainer.style.setProperty("min-height","1px");this.setVisible(Q,{skipAriaHidden:!0})};if(window.clearTimeout(this.setScrollVisibleDebounce),!Q)Y();else this.setScrollVisibleDebounce=window.setTimeout(Y,100)}getScrollPosition(){return QZ(this.eViewport,this.enableRtl)}setScrollPosition(Q){if(!f0(this.eViewport))this.attemptSettingScrollPosition(Q);zZ(this.eViewport,Q,this.enableRtl)}},uH={selector:"AG-FAKE-HORIZONTAL-SCROLL",component:hH},a9=class extends j{constructor(Q,z){super();this.eContainer=Q,this.eViewport=z}postConstruct(){this.addManagedEventListeners({rowContainerHeightChanged:this.onHeightChanged.bind(this,this.beans.rowContainerHeight)})}onHeightChanged(Q){let z=Q.uiContainerHeight,J=z!=null?`${z}px`:"";if(this.eContainer.style.height=J,this.eViewport)this.eViewport.style.height=J}},mH={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"}]}]},cH=class extends l9{constructor(){super(mH,"vertical")}postConstruct(){super.postConstruct(),this.createManagedBean(new a9(this.eContainer));let{ctrlsSvc:Q}=this.beans;Q.register("fakeVScrollComp",this),this.addManagedEventListeners({rowContainerHeightChanged:this.onRowContainerHeightChanged.bind(this,Q)})}setScrollVisible(){let{scrollVisibleSvc:Q}=this.beans,z=Q.verticalScrollShowing,J=this.invisibleScrollbar,Z=z?Q.getScrollbarWidth()||0:0,$=Z===0&&J?16:Z;this.toggleCss("ag-scrollbar-invisible",J),SQ(this.getGui(),$),SQ(this.eViewport,$),SQ(this.eContainer,$),this.setDisplayed(z,{skipAriaHidden:!0})}onRowContainerHeightChanged(Q){let J=Q.getGridBodyCtrl().eBodyViewport,Z=this.getScrollPosition(),$=J.scrollTop;if(Z!=$)this.setScrollPosition($,!0)}getScrollPosition(){return this.eViewport.scrollTop}setScrollPosition(Q,z){if(!z&&!f0(this.eViewport))this.attemptSettingScrollPosition(Q);this.eViewport.scrollTop=Q}},pH={selector:"AG-FAKE-VERTICAL-SCROLL",component:cH};var rQ="Viewport",j7="fakeVScrollComp",b2=["fakeHScrollComp","centerHeader","topCenter","bottomCenter","stickyTopCenter","stickyBottomCenter"],R7=100,y2=150,iH=class extends j{constructor(Q){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=Q,this.resetLastHScrollDebounced=gQ(this,()=>this.lastScrollSource[1]=null,y2),this.resetLastVScrollDebounced=gQ(this,()=>this.lastScrollSource[0]=null,y2)}wireBeans(Q){this.ctrlsSvc=Q.ctrlsSvc,this.animationFrameSvc=Q.animationFrameSvc,this.visibleCols=Q.visibleCols}destroy(){super.destroy(),this.clearRetryListenerFncs=[],window.clearTimeout(this.scrollTimer)}postConstruct(){this.enableRtl=this.gos.get("enableRtl");let Q=this.invalidateVerticalScroll.bind(this),z=this.invalidateHorizontalScroll.bind(this);this.addManagedEventListeners({displayedColumnsWidthChanged:this.onDisplayedColumnsWidthChanged.bind(this),bodyHeightChanged:Q,scrollGapChanged:z}),this.addManagedElementListeners(this.eBodyViewport,{scroll:Q}),this.ctrlsSvc.whenReady(this,(J)=>{this.centerRowsCtrl=J.center,this.fakeVScrollComp=J.fakeVScrollComp,this.fakeHScrollComp=J.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,rQ)});for(let Q of b2){let z=this.ctrlsSvc.get(Q);this.registerScrollPartner(z,this.onHScroll.bind(this,Q))}}addVerticalScrollListeners(){let Q=this.gos.get("debounceVerticalScrollbar"),z=Q?gQ(this,this.onVScroll.bind(this,rQ),R7):this.onVScroll.bind(this,rQ),J=Q?gQ(this,this.onVScroll.bind(this,j7),R7):this.onVScroll.bind(this,j7);this.addManagedElementListeners(this.eBodyViewport,{scroll:z}),this.registerScrollPartner(this.fakeVScrollComp,J)}registerScrollPartner(Q,z){Q.onScrollCallback(z)}onDisplayedColumnsWidthChanged(){if(this.enableRtl)this.horizontallyScrollHeaderCenterAndFloatingCenter()}horizontallyScrollHeaderCenterAndFloatingCenter(Q){if(this.centerRowsCtrl==null)return;if(Q===void 0)Q=this.centerRowsCtrl.getCenterViewportScrollLeft();this.setScrollLeftForAllContainersExceptCurrent(Math.abs(Q))}setScrollLeftForAllContainersExceptCurrent(Q){for(let z of[...b2,rQ]){if(this.lastScrollSource[1]===z)continue;let J=this.getViewportForSource(z);zZ(J,Q,this.enableRtl)}}getViewportForSource(Q){if(Q===rQ)return this.centerRowsCtrl.eViewport;return this.ctrlsSvc.get(Q).eViewport}isControllingScroll(Q,z){if(this.lastScrollSource[z]==null){if(z===0)this.lastScrollSource[0]=Q;else this.lastScrollSource[1]=Q;return!0}return this.lastScrollSource[z]===Q}onHScroll(Q){if(!this.isControllingScroll(Q,1))return;let z=this.centerRowsCtrl.eViewport,{scrollLeft:J}=z;if(this.shouldBlockScrollUpdate(1,J,!0))return;let Z=QZ(this.getViewportForSource(Q),this.enableRtl);this.doHorizontalScroll(Z),this.resetLastHScrollDebounced()}onVScroll(Q){if(!this.isControllingScroll(Q,0))return;let z=Q===rQ?this.eBodyViewport.scrollTop:this.fakeVScrollComp.getScrollPosition(),J=z;if(this.shouldBlockScrollUpdate(0,J,!0))return;if(Q===rQ)this.fakeVScrollComp.setScrollPosition(J);else if(this.eBodyViewport.scrollTop=z,J=this.eBodyViewport.scrollTop,this.invalidateVerticalScroll(),J!==z)this.fakeVScrollComp.setScrollPosition(J,!0);let{animationFrameSvc:Z}=this;if(Z?.setScrollTop(J),this.nextScrollTop=J,Z?.active)Z.schedule();else this.scrollGridIfNeeded(!0);this.resetLastVScrollDebounced()}doHorizontalScroll(Q){let z=this.fakeHScrollComp.getScrollPosition();if(this.scrollLeft===Q&&Q===z)return;this.scrollLeft=Q,this.fireScrollEvent(1),this.horizontallyScrollHeaderCenterAndFloatingCenter(Q),this.centerRowsCtrl.onHorizontalViewportChanged(!0)}isScrolling(){return this.isScrollActive}fireScrollEvent(Q){let z={type:"bodyScroll",direction:Q===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"})},y2)}shouldBlockScrollUpdate(Q,z,J=!1){if(J&&!bz())return!1;if(Q===0)return this.shouldBlockVerticalScroll(z);return this.shouldBlockHorizontalScroll(z)}shouldBlockVerticalScroll(Q){let z=AZ(this.eBodyViewport),{scrollHeight:J}=this.eBodyViewport;return Q<0||Q+z>J}shouldBlockHorizontalScroll(Q){let z=this.centerRowsCtrl.getCenterWidth(),{scrollWidth:J}=this.centerRowsCtrl.eViewport;if(this.enableRtl){if(Q>0)return!0}else if(Q<0)return!0;return Math.abs(Q)+z>J}redrawRowsAfterScroll(){this.fireScrollEvent(0)}checkScrollLeft(){let Q=this.scrollLeft,z=!1;for(let J of b2)if(this.getViewportForSource(J).scrollLeft!==Q){z=!0;break}if(z)this.onHScroll(rQ)}scrollGridIfNeeded(Q=!1){let z=this.scrollTop!=this.nextScrollTop;if(z){if(this.scrollTop=this.nextScrollTop,Q)this.invalidateVerticalScroll();this.redrawRowsAfterScroll()}return z}setHorizontalScrollPosition(Q,z=!1){let Z=this.centerRowsCtrl.eViewport.scrollWidth-this.centerRowsCtrl.getCenterWidth();if(!z&&this.shouldBlockScrollUpdate(1,Q))if(this.enableRtl)Q=Q>0?0:Z;else Q=Math.min(Math.max(Q,0),Z);zZ(this.centerRowsCtrl.eViewport,Math.abs(Q),this.enableRtl),this.doHorizontalScroll(Q)}setVerticalScrollPosition(Q){this.invalidateVerticalScroll(),this.eBodyViewport.scrollTop=Q}getVScrollPosition(){if(!this.isVerticalPositionInvalidated){let{lastOffsetHeight:J,lastScrollTop:Z}=this;return{top:Z,bottom:Z+J}}this.isVerticalPositionInvalidated=!1;let{scrollTop:Q,offsetHeight:z}=this.eBodyViewport;return this.lastScrollTop=Q,this.lastOffsetHeight=z,{top:Q,bottom:Q+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(Q){let z=this.centerRowsCtrl.eViewport.scrollLeft;return this.setHorizontalScrollPosition(z+Q),this.centerRowsCtrl.eViewport.scrollLeft-z}scrollToTop(){this.setVerticalScrollPosition(0)}ensureNodeVisible(Q,z=null){let{rowModel:J}=this.beans,Z=J.getRowCount(),$=-1;for(let X=0;X=0)this.ensureIndexVisible($,z)}ensureIndexVisible(Q,z,J=0){if(V0(this.gos,"print"))return;let{rowModel:Z}=this.beans,$=Z.getRowCount();if(typeof Q!=="number"||Q<0||Q>=$){R(88,{index:Q});return}this.clearRetryListeners();let{frameworkOverrides:X,pageBounds:Y,rowContainerHeight:G,rowRenderer:q}=this.beans;X.wrapIncoming(()=>{let H=this.ctrlsSvc.getGridBodyCtrl(),_=Z.getRow(Q),U,W,B=0;this.invalidateVerticalScroll();do{let{stickyTopHeight:E,stickyBottomHeight:K}=H,L=_.rowTop,F=_.rowHeight,D=Y.getPixelOffset(),M=_.rowTop-D,k=M+_.rowHeight,f=this.getVScrollPosition(),A=G.divStretchOffset,O=f.top+A,v=f.bottom+A,I=v-O,C=G.getScrollPositionForPixel(M),m=G.getScrollPositionForPixel(k-I),w=Math.min((C+m)/2,M),a=O+E>M,t=v-KI)u=C-E;else u=m+K;if(u!==null)this.setVerticalScrollPosition(u),q.redraw({afterScroll:!0});U=L!==_.rowTop||F!==_.rowHeight,W=E!==H.stickyTopHeight||K!==H.stickyBottomHeight,B++}while((U||W)&&B<10);if(this.animationFrameSvc?.flushAllFrames(),J<10&&(_?.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(),Q>=Z.getRowCount())return;this.ensureIndexVisible(Q,z,J+1)}})}})}clearRetryListeners(){for(let Q of this.clearRetryListenerFncs)Q();this.clearRetryListenerFncs=[]}ensureColumnVisible(Q,z="auto"){let{colModel:J,frameworkOverrides:Z}=this.beans,$=J.getCol(Q);if(!$)return;if($.isPinned())return;if(!this.visibleCols.isColDisplayed($))return;let X=this.getPositionedHorizontalScroll($,z);Z.wrapIncoming(()=>{if(X!==null)this.centerRowsCtrl.setCenterViewportScrollLeft(X);this.centerRowsCtrl.onHorizontalViewportChanged(),this.animationFrameSvc?.flushAllFrames()})}getPositionedHorizontalScroll(Q,z){let{columnBeforeStart:J,columnAfterEnd:Z}=this.isColumnOutsideViewport(Q),$=this.centerRowsCtrl.getCenterWidth()$:J<$,G=X?JZ;return{columnBeforeStart:Y,columnAfterEnd:G}}getColumnBounds(Q){let z=this.enableRtl,J=this.visibleCols.bodyWidth,Z=Q.getActualWidth(),$=Q.getLeft(),X=z?-1:1,Y=z?J-$:$,G=Y+Z*X,q=Y+Z/2*X;return{colLeft:Y,colMiddle:q,colRight:G}}getViewportBounds(){let Q=this.centerRowsCtrl.getCenterWidth(),z=this.centerRowsCtrl.getCenterViewportScrollLeft(),J=z,Z=Q+z;return{start:J,end:Z,width:Q}}},S7={horizontal:{overflow:(Q)=>Q.scrollWidth-Q.clientWidth,scrollSize:(Q)=>Q.scrollWidth,clientSize:(Q)=>Q.clientWidth,opposite:"vertical"},vertical:{overflow:(Q)=>Q.scrollHeight-Q.clientHeight,scrollSize:(Q)=>Q.scrollHeight,clientSize:(Q)=>Q.clientHeight,opposite:"horizontal"}};function nH(Q,z,J=s5()||0,Z,$){return o9(Q,z,"horizontal",J,Z,$)}function dH(Q,z,J=s5()||0,Z,$){return o9(Q,z,"vertical",J,Z,$)}function o9(Q,z,J,Z,$,X){let Y=S7[J],G=S7[Y.opposite],q=$?f0($):!0,H=X?f0(X):!0,_=Y.overflow(Q);if(_<=0)return!1;if(!z||Z===0)return!0;let U=G.overflow(z);if(U<=0)return!0;if(_<=Z){if(q&&H&&tH({candidateOverflow:U,candidateScrollSize:G.scrollSize(z),candidateClientSize:G.clientSize(z),scrollbarWidth:Z}))return!1;let W=Y.clientSize(Q)+Z;return Y.scrollSize(Q)<=W}return!0}function tH({candidateOverflow:Q,candidateScrollSize:z,candidateClientSize:J,scrollbarWidth:Z}){if(Q<=0||Q>Z)return!1;let $=J+Z;return z>J&&z<=$}var rH=class extends j{constructor(Q){super();this.centerContainerCtrl=Q}wireBeans(Q){this.scrollVisibleSvc=Q.scrollVisibleSvc}postConstruct(){this.beans.ctrlsSvc.whenReady(this,(Q)=>{this.gridBodyCtrl=Q.gridBodyCtrl,this.listenForResize()}),this.addManagedEventListeners({scrollbarWidthChanged:this.onScrollbarWidthChanged.bind(this)}),this.addManagedPropertyListeners(["alwaysShowHorizontalScroll","alwaysShowVerticalScroll"],()=>{this.checkViewportAndScrolls()})}listenForResize(){let{beans:Q,centerContainerCtrl:z,gridBodyCtrl:J}=this,Z=()=>{YQ(Q,()=>{this.onCenterViewportResized()})};z.registerViewportResizeListener(Z),J.registerBodyViewportResizeListener(Z)}onScrollbarWidthChanged(){this.checkViewportAndScrolls()}onCenterViewportResized(){if(this.scrollVisibleSvc.updateScrollGap(),this.centerContainerCtrl.isViewportInTheDOMTree()){let{pinnedCols:Q,colFlex:z}=this.beans;Q?.keepPinnedColumnsNarrowerThanViewport(),this.checkViewportAndScrolls();let J=this.centerContainerCtrl.getCenterWidth();if(J!==this.centerWidth)this.centerWidth=J,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 Q=this.gridBodyCtrl.eBodyViewport,z=AZ(Q);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 Q={horizontalScrollShowing:this.centerContainerCtrl.isHorizontalScrollShowing(),verticalScrollShowing:this.gridBodyCtrl.isVerticalScrollShowing()};this.scrollVisibleSvc.setScrollsVisible(Q)}onHorizontalViewportChanged(){let{centerContainerCtrl:Q,beans:z}=this,J=Q.getCenterWidth(),Z=Q.getViewportScrollLeft();z.colViewport.setScrollPosition(J,Z)}};function e9(Q){if(Q.altKey||Q.ctrlKey||Q.metaKey)return!1;return Q.key?.length===1}function rJ(Q,z,J,Z){let $=z.getColDef().cellRendererParams?.suppressMouseEventHandling;return Q$(Q,z,J,Z,$)}function sH(Q,z,J,Z){let $=z?.suppressMouseEventHandling;return Q$(Q,void 0,J,Z,$)}function Q$(Q,z,J,Z,$){if(!$)return!1;return $(y(Q,{column:z,node:J,event:Z}))}function z$(Q,z,J){let Z=z;while(Z){let $=Y9(Q,Z,J);if($)return $;Z=Z.parentElement}return null}var HZ="cellCtrl";function EJ(Q,z){return z$(Q,z,HZ)}var _Z="renderedRow";function q6(Q,z){return z$(Q,z,_Z)}function _5(Q,z,J,Z,$){let X=Z?Z.getColDef().suppressKeyboardEvent:void 0;if(!X)return!1;let Y=y(Q,{event:z,editing:$,column:Z,node:J,data:J.data,colDef:Z.getColDef()});if(X){if(X(Y))return!0}return!1}function lH(Q){let{pinnedRowModel:z,rowModel:J,rangeSvc:Z,visibleCols:$}=Q;if(!Z||$.allCols.length===0)return;let X=z?.isEmpty("top")??!0,Y=z?.isEmpty("bottom")??!0,G=X?null:"top",q,H;if(Y)q=null,H=J.getRowCount()-1;else q="bottom",H=z?.getPinnedBottomRowCount()??-1;Z.setCellRange({rowStartIndex:0,rowStartPinned:G,rowEndIndex:H,rowEndPinned:q})}var aH=class extends j{constructor(Q){super();this.element=Q}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 Q="mousedown";if(a2("pointerdown"))Q="pointerdown";else if(a2("touchstart"))Q="touchstart";let z=["dblclick","contextmenu","mouseover","mouseout","click",Q];for(let J of z){let Z=this.processMouseEvent.bind(this,J);this.addManagedElementListeners(this.element,{[J]:Z})}}processMouseEvent(Q,z){if(!n1(this.beans,z)||zQ(z))return;let{cellCtrl:J,rowCtrl:Z}=this.getControlsForEventTarget(z.target);if(Q==="contextmenu"){if(J?.column)J.dispatchCellContextMenuEvent(z);this.beans.contextMenuSvc?.handleContextMenuMouseEvent(z,void 0,Z,J)}else{if(J)J.onMouseEvent(Q,z);if(Z)Z.onMouseEvent(Q,z)}}getControlsForEventTarget(Q){let{gos:z}=this;return{cellCtrl:EJ(z,Q),rowCtrl:q6(z,Q)}}processKeyboardEvent(Q,z){let{cellCtrl:J,rowCtrl:Z}=this.getControlsForEventTarget(z.target);if(z.defaultPrevented)return;if(J)this.processCellKeyboardEvent(J,Q,z);else if(Z?.isFullWidth())this.processFullWidthRowKeyboardEvent(Z,Q,z)}processCellKeyboardEvent(Q,z,J){let Z=this.editSvc?.isEditing(Q,{withOpenEditor:!0})??!1;if(!_5(this.gos,J,Q.rowNode,Q.column,Z)){if(z==="keydown"){if(!(!Z&&this.beans.navigation?.handlePageScrollingKey(J)))Q.onKeyDown(J);if(this.doGridOperations(J,Z),e9(J))Q.processCharacter(J)}}if(z==="keydown")this.eventSvc.dispatchEvent(Q.createEvent(J,"cellKeyDown"))}processFullWidthRowKeyboardEvent(Q,z,J){let{rowNode:Z}=Q,{focusSvc:$,navigation:X}=this.beans,G=$.getFocusedCell()?.column;if(!_5(this.gos,J,Z,G,!1)){let H=J.key;if(z==="keydown")switch(H){case V.PAGE_HOME:case V.PAGE_END:case V.PAGE_UP:case V.PAGE_DOWN:X?.handlePageScrollingKey(J,!0);break;case V.LEFT:case V.RIGHT:if(!this.gos.get("embedFullWidthRows"))break;case V.UP:case V.DOWN:Q.onKeyboardNavigate(J);break;case V.TAB:Q.onTabKeyDown(J);break;default:}}if(z==="keydown")this.eventSvc.dispatchEvent(Q.createRowEvent("cellKeyDown",J))}doGridOperations(Q,z){if(!Q.ctrlKey&&!Q.metaKey)return;if(z)return;if(!n1(this.beans,Q))return;let J=R9(Q),{clipboardSvc:Z,undoRedo:$}=this.beans;if(J===V.A)return this.onCtrlAndA(Q);if(J===V.C)return this.onCtrlAndC(Z,Q);if(J===V.D)return this.onCtrlAndD(Z,Q);if(J===V.V)return this.onCtrlAndV(Z,Q);if(J===V.X)return this.onCtrlAndX(Z,Q);if(J===V.Y)return this.onCtrlAndY($);if(J===V.Z)return this.onCtrlAndZ($,Q)}onCtrlAndA(Q){let{beans:{rowModel:z,rangeSvc:J,selectionSvc:Z},gos:$}=this;if(J&&u0($)&&!pG($)&&z.isRowsToRender())lH(this.beans);else if(Z)Z.selectAllRowNodes({source:"keyboardSelectAll",selectAll:U9($)});Q.preventDefault()}onCtrlAndC(Q,z){if(!Q||this.gos.get("enableCellTextSelection"))return;let{cellCtrl:J}=this.getControlsForEventTarget(z.target);if(this.editSvc?.isEditing(J,{withOpenEditor:!0}))return;z.preventDefault(),Q.copyToClipboard()}onCtrlAndX(Q,z){if(!Q||this.gos.get("enableCellTextSelection")||this.gos.get("suppressCutToClipboard"))return;let{cellCtrl:J}=this.getControlsForEventTarget(z.target);if(this.editSvc?.isEditing(J,{withOpenEditor:!0}))return;z.preventDefault(),Q.cutToClipboard(void 0,"ui")}onCtrlAndV(Q,z){let{cellCtrl:J}=this.getControlsForEventTarget(z.target);if(this.editSvc?.isEditing(J,{withOpenEditor:!0}))return;if(Q&&!this.gos.get("suppressClipboardPaste"))Q.pasteFromClipboard()}onCtrlAndD(Q,z){if(Q&&!this.gos.get("suppressClipboardPaste"))Q.copyRangeDown();z.preventDefault()}onCtrlAndZ(Q,z){if(!this.gos.get("undoRedoCellEditing")||!Q)return;if(z.preventDefault(),z.shiftKey)Q.redo("ui");else Q.undo("ui")}onCtrlAndY(Q){Q?.redo("ui")}},xJ=(Q)=>Q.topRowCtrls,wJ=(Q)=>Q.getStickyTopRowCtrls(),NJ=(Q)=>Q.getStickyBottomRowCtrls(),gJ=(Q)=>Q.bottomRowCtrls,hJ=(Q)=>Q.allRowCtrls,x2=(Q)=>Q.getCtrls("top"),w2=(Q)=>Q.getCtrls("center"),N2=(Q)=>Q.getCtrls("bottom"),oH={center:{type:"center",name:"center-cols",getRowCtrls:hJ,getSpannedRowCtrls:w2},left:{type:"left",name:"pinned-left-cols",pinnedType:"left",getRowCtrls:hJ,getSpannedRowCtrls:w2},right:{type:"right",name:"pinned-right-cols",pinnedType:"right",getRowCtrls:hJ,getSpannedRowCtrls:w2},fullWidth:{type:"fullWidth",name:"full-width",fullWidth:!0,getRowCtrls:hJ},topCenter:{type:"center",name:"floating-top",getRowCtrls:xJ,getSpannedRowCtrls:x2},topLeft:{type:"left",name:"pinned-left-floating",container:"ag-pinned-left-floating-top",pinnedType:"left",getRowCtrls:xJ,getSpannedRowCtrls:x2},topRight:{type:"right",name:"pinned-right-floating",container:"ag-pinned-right-floating-top",pinnedType:"right",getRowCtrls:xJ,getSpannedRowCtrls:x2},topFullWidth:{type:"fullWidth",name:"floating-top-full-width",fullWidth:!0,getRowCtrls:xJ},stickyTopCenter:{type:"center",name:"sticky-top",getRowCtrls:wJ},stickyTopLeft:{type:"left",name:"pinned-left-sticky-top",container:"ag-pinned-left-sticky-top",pinnedType:"left",getRowCtrls:wJ},stickyTopRight:{type:"right",name:"pinned-right-sticky-top",container:"ag-pinned-right-sticky-top",pinnedType:"right",getRowCtrls:wJ},stickyTopFullWidth:{type:"fullWidth",name:"sticky-top-full-width",fullWidth:!0,getRowCtrls:wJ},stickyBottomCenter:{type:"center",name:"sticky-bottom",getRowCtrls:NJ},stickyBottomLeft:{type:"left",name:"pinned-left-sticky-bottom",container:"ag-pinned-left-sticky-bottom",pinnedType:"left",getRowCtrls:NJ},stickyBottomRight:{type:"right",name:"pinned-right-sticky-bottom",container:"ag-pinned-right-sticky-bottom",pinnedType:"right",getRowCtrls:NJ},stickyBottomFullWidth:{type:"fullWidth",name:"sticky-bottom-full-width",fullWidth:!0,getRowCtrls:NJ},bottomCenter:{type:"center",name:"floating-bottom",getRowCtrls:gJ,getSpannedRowCtrls:N2},bottomLeft:{type:"left",name:"pinned-left-floating-bottom",container:"ag-pinned-left-floating-bottom",pinnedType:"left",getRowCtrls:gJ,getSpannedRowCtrls:N2},bottomRight:{type:"right",name:"pinned-right-floating-bottom",container:"ag-pinned-right-floating-bottom",pinnedType:"right",getRowCtrls:gJ,getSpannedRowCtrls:N2},bottomFullWidth:{type:"fullWidth",name:"floating-bottom-full-width",fullWidth:!0,getRowCtrls:gJ}};function J$(Q){return`ag-${KJ(Q).name}-viewport`}function Z$(Q){let z=KJ(Q);return z.container??`ag-${z.name}-container`}function eH(Q){return`ag-${KJ(Q).name}-spanned-cells-container`}function KJ(Q){return oH[Q]}var Q_=["topCenter","topLeft","topRight"],z_=["bottomCenter","bottomLeft","bottomRight"],J_=["center","left","right"],Z_=["center","left","right","fullWidth"],$_=["stickyTopCenter","stickyBottomCenter","center","topCenter","bottomCenter"],X_=["left","bottomLeft","topLeft","stickyTopLeft","stickyBottomLeft"],Y_=["right","bottomRight","topRight","stickyTopRight","stickyBottomRight"],$$=["stickyTopCenter","stickyTopLeft","stickyTopRight"],X$=["stickyBottomCenter","stickyBottomLeft","stickyBottomRight"],G_=[...$$,"stickyTopFullWidth",...X$,"stickyBottomFullWidth"],q_=[...Q_,...z_,...J_,...$$,...X$],H_=class extends j{constructor(Q){super();this.name=Q,this.visible=!0,this.EMPTY_CTRLS=[],this.options=KJ(Q)}postConstruct(){this.enableRtl=this.gos.get("enableRtl"),this.forContainers(["center"],()=>{this.viewportSizeFeature=this.createManagedBean(new rH(this)),this.addManagedEventListeners({stickyTopOffsetChanged:this.onStickyTopOffsetChanged.bind(this)})})}onStickyTopOffsetChanged(Q){this.comp.setOffsetTop(`${Q.offset}px`)}registerWithCtrlsService(){if(this.options.fullWidth)return;this.beans.ctrlsSvc.register(this.name,this)}forContainers(Q,z){if(Q.indexOf(this.name)>=0)z()}setComp(Q,z,J,Z){this.comp=Q,this.eContainer=z,this.eSpannedContainer=J,this.eViewport=Z,this.createManagedBean(new aH(this.eViewport??this.eContainer)),this.addPreventScrollWhileDragging(),this.listenOnDomOrder();let{pinnedCols:$,rangeSvc:X}=this.beans,Y=()=>this.onPinnedWidthChanged();if(this.forContainers(X_,()=>{this.pinnedWidthFeature=this.createOptionalManagedBean($?.createPinnedWidthFeature(!0,this.eContainer,this.eSpannedContainer)),this.addManagedEventListeners({leftPinnedWidthChanged:Y})}),this.forContainers(Y_,()=>{this.pinnedWidthFeature=this.createOptionalManagedBean($?.createPinnedWidthFeature(!1,this.eContainer,this.eSpannedContainer)),this.addManagedEventListeners({rightPinnedWidthChanged:Y})}),this.forContainers(Z_,()=>this.createManagedBean(new a9(this.eContainer,this.name==="center"?Z:void 0))),X)this.forContainers(q_,()=>this.createManagedBean(X.createDragListenerFeature(this.eContainer)));this.forContainers($_,()=>this.createManagedBean(new $6((G)=>this.comp.setContainerWidth(`${G}px`)))),this.visible=this.isContainerVisible(),this.addListeners(),this.registerWithCtrlsService()}onScrollCallback(Q){this.addManagedElementListeners(this.eViewport,{scroll:Q})}addListeners(){let{spannedRowRenderer:Q,gos:z}=this.beans,J=this.onDisplayedColumnsChanged.bind(this);if(this.addManagedEventListeners({displayedColumnsChanged:J,displayedColumnsWidthChanged:J,displayedRowsChanged:(Z)=>this.onDisplayedRowsChanged(Z.afterScroll)}),J(),this.onDisplayedRowsChanged(),Q&&this.options.getSpannedRowCtrls&&z.get("enableCellSpan"))this.addManagedListeners(Q,{spannedRowsUpdated:()=>{let Z=this.options.getSpannedRowCtrls(Q);if(!Z)return;this.comp.setSpannedRowCtrls(Z,!1)}})}listenOnDomOrder(){if(G_.indexOf(this.name)>=0){this.comp.setDomOrder(!0);return}let z=()=>{let J=this.gos.get("ensureDomOrder"),Z=V0(this.gos,"print");this.comp.setDomOrder(J||Z)};this.addManagedPropertyListener("domLayout",z),z()}onDisplayedColumnsChanged(){this.forContainers(["center"],()=>this.onHorizontalViewportChanged())}addPreventScrollWhileDragging(){let{dragSvc:Q}=this.beans;if(!Q)return;let z=(J)=>{if(Q.dragging){if(J.cancelable)J.preventDefault()}};this.eContainer.addEventListener("touchmove",z,{passive:!1}),this.addDestroyFunc(()=>this.eContainer.removeEventListener("touchmove",z))}onHorizontalViewportChanged(Q=!1){let z=this.getCenterWidth(),J=this.getCenterViewportScrollLeft();this.beans.colViewport.setScrollPosition(z,J,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 QZ(this.eViewport,this.enableRtl)}registerViewportResizeListener(Q){let z=DQ(this.beans,this.eViewport,Q);this.addDestroyFunc(()=>z())}isViewportInTheDOMTree(){return g8(this.eViewport)}getViewportScrollLeft(){return QZ(this.eViewport,this.enableRtl)}isHorizontalScrollShowing(){let{beans:Q,gos:z,eViewport:J}=this,Z=z.get("alwaysShowHorizontalScroll"),{ctrlsSvc:$}=Q,X=$.getGridBodyCtrl()?.eBodyViewport,Y=$.get("fakeHScrollComp")?.getGui(),G=$.get("fakeVScrollComp")?.getGui();return Z||nH(J,X,void 0,Y,G)}setHorizontalScroll(Q){this.comp.setHorizontalScroll(Q)}getHScrollPosition(){return{left:this.eViewport.scrollLeft,right:this.eViewport.scrollLeft+this.eViewport.offsetWidth}}setCenterViewportScrollLeft(Q){zZ(this.eViewport,Q,this.enableRtl)}isContainerVisible(){return this.options.pinnedType==null||!!this.pinnedWidthFeature&&this.pinnedWidthFeature.getWidth()>0}onPinnedWidthChanged(){let Q=this.isContainerVisible();if(this.visible!=Q)this.visible=Q,this.onDisplayedRowsChanged()}onDisplayedRowsChanged(Q=!1){let z=this.options.getRowCtrls(this.beans.rowRenderer);if(!this.visible||z.length===0){this.comp.setRowCtrls({rowCtrls:this.EMPTY_CTRLS});return}let J=V0(this.gos,"print"),$=this.gos.get("embedFullWidthRows")||J,X=z.filter((Y)=>{let G=Y.isFullWidth();return this.options.fullWidth?!$&&G:$||!G});this.comp.setRowCtrls({rowCtrls:X,useFlushSync:Q})}},Y$="ag-force-vertical-scroll",__="ag-selectable",U_="ag-column-moving",W_=class extends j{constructor(){super(...arguments);this.stickyTopHeight=0,this.stickyBottomHeight=0}wireBeans(Q){this.ctrlsSvc=Q.ctrlsSvc,this.colModel=Q.colModel,this.scrollVisibleSvc=Q.scrollVisibleSvc,this.pinnedRowModel=Q.pinnedRowModel,this.filterManager=Q.filterManager,this.rowGroupColsSvc=Q.rowGroupColsSvc}setComp(Q,z,J,Z,$,X,Y){this.comp=Q,this.eGridBody=z,this.eBodyViewport=J,this.eTop=Z,this.eBottom=$,this.eStickyTop=X,this.eStickyBottom=Y,this.eCenterColsViewport=J.querySelector(`.${J$("center")}`),this.eFullWidthContainer=J.querySelector(`.${Z$("fullWidth")}`),this.setCellTextSelection(this.gos.get("enableCellTextSelection")),this.addManagedPropertyListener("enableCellTextSelection",(G)=>this.setCellTextSelection(G.currentValue)),this.createManagedBean(new G6(this.comp)),this.scrollFeature=this.createManagedBean(new iH(J)),this.beans.rowDragSvc?.setupRowDrag(J,this),this.setupRowAnimationCssClass(),this.addEventListeners(),this.addFocusListeners([Z,J,$,X,Y]),this.setGridRootRole(),this.onGridColumnsChanged(),this.addBodyViewportListener(),this.setFloatingHeights(),this.disableBrowserDragging(),this.addStopEditingWhenGridLosesFocus(),this.updateScrollingClasses(),this.filterManager?.setupAdvFilterHeaderComp(Z),this.ctrlsSvc.register("gridBodyCtrl",this)}addEventListeners(){let Q=this.setFloatingHeights.bind(this),z=this.setGridRootRole.bind(this),J=this.toggleRowResizeStyles.bind(this);this.addManagedEventListeners({gridColumnsChanged:this.onGridColumnsChanged.bind(this),scrollVisibilityChanged:this.onScrollVisibilityChanged.bind(this),scrollGapChanged:this.updateScrollingClasses.bind(this),pinnedRowDataChanged:Q,pinnedHeightChanged:Q,pinnedRowsChanged:Q,headerHeightChanged:this.setStickyTopOffsetTop.bind(this),columnRowGroupChanged:z,columnPivotChanged:z,rowResizeStarted:J,rowResizeEnded:J}),this.addManagedPropertyListener("treeData",z)}toggleRowResizeStyles(Q){let z=Q.type==="rowResizeStarted";this.eBodyViewport.classList.toggle("ag-prevent-animation",z)}onGridColumnsChanged(){let Q=this.beans.colModel.getCols();this.comp.setColumnCount(Q.length)}onScrollVisibilityChanged(){let{scrollVisibleSvc:Q}=this,z=Q.verticalScrollShowing;this.setVerticalScrollPaddingVisible(z),this.setStickyWidth(z),this.setStickyBottomOffsetBottom();let J=z?Q.getScrollbarWidth()||0:0,Z=y9()?16:0,$=`calc(100% + ${J+Z}px)`;YQ(this.beans,()=>this.comp.setBodyViewportWidth($)),this.updateScrollingClasses()}setGridRootRole(){let{rowGroupColsSvc:Q,colModel:z,gos:J}=this,Z=J.get("treeData");if(!Z){let $=z.isPivotMode();Z=(!Q?0:Q.columns.length)>=($?2:1)}this.comp.setGridRootRole(Z?"treegrid":"grid")}addFocusListeners(Q){for(let z of Q)this.addManagedElementListeners(z,{focusin:(J)=>{let{target:Z}=J,$=vz(Z,"ag-root",z);z.classList.toggle("ag-has-focus",!$)},focusout:(J)=>{let{target:Z,relatedTarget:$}=J,X=z.contains($),Y=vz($,"ag-root",z);if(vz(Z,"ag-root",z))return;if(!X||Y)z.classList.remove("ag-has-focus")}})}setColumnMovingCss(Q){this.comp.setColumnMovingCss(U_,Q)}setCellTextSelection(Q=!1){this.comp.setCellSelectableCss(__,Q)}updateScrollingClasses(){let{eGridBody:{classList:Q},scrollVisibleSvc:z}=this;Q.toggle("ag-body-vertical-content-no-gap",!z.verticalScrollGap),Q.toggle("ag-body-horizontal-content-no-gap",!z.horizontalScrollGap)}disableBrowserDragging(){this.addManagedElementListeners(this.eGridBody,{dragstart:(Q)=>{if(Q.target instanceof HTMLImageElement)return Q.preventDefault(),!1}})}addStopEditingWhenGridLosesFocus(){this.beans.editSvc?.addStopEditingWhenGridLosesFocus([this.eBodyViewport,this.eBottom,this.eTop,this.eStickyTop,this.eStickyBottom])}updateRowCount(){let Q=(this.ctrlsSvc.getHeaderRowContainerCtrl()?.getRowCount()??0)+(this.filterManager?.getHeaderRowCount()??0),{rowModel:z}=this.beans,J=z.isLastRowIndexKnown()?z.getRowCount():-1,Z=J===-1?-1:Q+J;this.comp.setRowCount(Z)}registerBodyViewportResizeListener(Q){this.comp.registerBodyViewportResizeListener(Q)}setVerticalScrollPaddingVisible(Q){let z=Q?"scroll":"hidden";this.comp.setPinnedTopBottomOverflowY(z)}isVerticalScrollShowing(){let{gos:Q,comp:z,ctrlsSvc:J}=this,Z=Q.get("alwaysShowVerticalScroll"),$=Z?Y$:null,X=V0(Q,"normal");z.setAlwaysVerticalScrollClass($,Z);let Y=J.get("center")?.eViewport,G=J.get("fakeHScrollComp")?.getGui(),q=J.get("fakeVScrollComp")?.getGui();return Z||X&&dH(this.eBodyViewport,Y,void 0,q,G)}setupRowAnimationCssClass(){let{rowContainerHeight:Q,environment:z}=this.beans,J=z.sizesMeasured,Z=()=>{let $=J&&_1(this.gos)&&!Q.stretching,X=$?"ag-row-animation":"ag-row-no-animation";this.comp.setRowAnimationCssOnBodyViewport(X,$)};Z(),this.addManagedEventListeners({heightScaleChanged:Z}),this.addManagedPropertyListener("animateRows",Z),this.addManagedEventListeners({stylesChanged:()=>{if(!J&&z.sizesMeasured)J=!0,Z()}})}addBodyViewportListener(){let{eBodyViewport:Q,eStickyTop:z,eStickyBottom:J,eTop:Z,eBottom:$,beans:{popupSvc:X,touchSvc:Y}}=this,G=this.onBodyViewportContextMenu.bind(this);this.addManagedElementListeners(Q,{contextmenu:G}),Y?.mockBodyContextMenu(this,G),this.addManagedElementListeners(Q,{wheel:this.onBodyViewportWheel.bind(this,X)});let q=this.onStickyWheel.bind(this);for(let _ of[z,J,Z,$])this.addManagedElementListeners(_,{wheel:q});let H=this.onHorizontalWheel.bind(this);for(let _ of["left","right","topLeft","topRight","bottomLeft","bottomRight"])this.addManagedElementListeners(this.ctrlsSvc.get(_).eContainer,{wheel:H});this.addFullWidthContainerWheelListener()}addFullWidthContainerWheelListener(){this.addManagedElementListeners(this.eFullWidthContainer,{wheel:(Q)=>this.onFullWidthContainerWheel(Q)})}onFullWidthContainerWheel(Q){let{deltaX:z,deltaY:J,shiftKey:Z}=Q;if((Z||Math.abs(z)>Math.abs(J))&&n1(this.beans,Q))this.scrollGridBodyToMatchEvent(Q)}onStickyWheel(Q){let{deltaY:z}=Q;if(this.scrollVertically(z)>0)Q.preventDefault()}onHorizontalWheel(Q){let{deltaX:z,deltaY:J,shiftKey:Z}=Q;if(!(Z||Math.abs(z)>Math.abs(J)))return;this.scrollGridBodyToMatchEvent(Q)}scrollGridBodyToMatchEvent(Q){let{deltaX:z,deltaY:J}=Q;Q.preventDefault(),this.eCenterColsViewport.scrollBy({left:z||J})}onBodyViewportContextMenu(Q,z,J){if(!Q&&!J)return;if(this.gos.get("preventDefaultOnContextMenu"))(Q||J).preventDefault();let{target:Z}=Q||z;if(Z===this.eBodyViewport||Z===this.ctrlsSvc.get("center").eViewport)this.beans.contextMenuSvc?.showContextMenu({mouseEvent:Q,touchEvent:J,value:null,anchorToElement:this.eGridBody,source:"ui"})}onBodyViewportWheel(Q,z){if(!this.gos.get("suppressScrollWhenPopupsAreOpen"))return;if(Q?.hasAnchoredPopup())z.preventDefault()}scrollVertically(Q){let z=this.eBodyViewport.scrollTop;return this.scrollFeature.setVerticalScrollPosition(z+Q),this.eBodyViewport.scrollTop-z}setFloatingHeights(){let{pinnedRowModel:Q,beans:{environment:z}}=this,J=Q?.getPinnedTopTotalHeight(),Z=Q?.getPinnedBottomTotalHeight(),$=z.getPinnedRowBorderWidth(),X=z.getRowBorderWidth(),Y=$-X,G=!J?0:Y+J,q=!Z?0:Y+Z;this.comp.setTopHeight(G),this.comp.setBottomHeight(q),this.comp.setTopInvisible(G<=0),this.comp.setBottomInvisible(q<=0),this.setStickyTopOffsetTop(),this.setStickyBottomOffsetBottom()}setStickyTopHeight(Q=0){this.comp.setStickyTopHeight(`${Q}px`),this.stickyTopHeight=Q}setStickyBottomHeight(Q=0){this.comp.setStickyBottomHeight(`${Q}px`),this.stickyBottomHeight=Q}setStickyWidth(Q){if(!Q)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),J=this.pinnedRowModel?.getPinnedTopTotalHeight()??0,Z=0;if(z>0)Z+=z;if(J>0)Z+=J;if(Z>0)Z+=1;this.comp.setStickyTopTop(`${Z}px`)}setStickyBottomOffsetBottom(){let{pinnedRowModel:Q,scrollVisibleSvc:z,comp:J}=this,Z=Q?.getPinnedBottomTotalHeight()??0,X=z.horizontalScrollShowing?z.getScrollbarWidth()||0:0,Y=Z+X;J.setStickyBottomBottom(`${Y}px`)}};function Z0(Q){return K0(Q)}var B_=class extends x{constructor(Q,z,J,Z,$){super();this.cellCtrl=z,this.rowResizerElement=null,this.rendererVersion=0,this.editorVersion=0,this.beans=Q,this.gos=Q.gos,this.column=z.column,this.rowNode=z.rowNode,this.eRow=Z;let X=Z0({tag:"div",role:z.getCellAriaRole(),attrs:{"comp-id":`${this.getCompId()}`,"col-id":z.column.colIdSanitised}});this.eCell=X;let Y;if(z.isCellSpanning())Y=Z0({tag:"div",cls:"ag-spanned-cell-wrapper",role:"presentation"}),Y.appendChild(X),this.setTemplateFromElement(Y);else this.setTemplateFromElement(X);this.cellCssManager=new I9(()=>X),this.forceWrapper=z.isForceWrapper(),this.refreshWrapper(!1);let G={toggleCss:(q,H)=>this.cellCssManager.toggleCss(q,H),setUserStyles:(q)=>$J(X,q),getFocusableElement:()=>X,setIncludeSelection:(q)=>this.includeSelection=q,setIncludeRowDrag:(q)=>this.includeRowDrag=q,setIncludeDndSource:(q)=>this.includeDndSource=q,setRowResizerElement:(q)=>this.setRowResizerElement(q),setRenderDetails:(q,H,_)=>this.setRenderDetails(q,H,_),setEditDetails:(q,H,_)=>this.setEditDetails(q,H,_),getCellEditor:()=>this.cellEditor||null,getCellRenderer:()=>this.cellRenderer||null,getParentOfValue:()=>this.getParentOfValue(),refreshEditStyles:(q,H)=>this.refreshEditStyles(q,H)};z.setComp(G,X,Y,this.eCellWrapper,J,$,void 0)}getParentOfValue(){return this.eCellValue??this.eCellWrapper??this.eCell}setRowResizerElement(Q){if(this.rowResizerElement)T0(this.rowResizerElement);if(this.rowResizerElement=Q,Q)this.eCell.appendChild(Q)}setRenderDetails(Q,z,J){if(this.cellEditor&&!this.cellEditorPopupWrapper)return;this.firstRender=this.firstRender==null;let $=this.refreshWrapper(!1);if(this.refreshEditStyles(!1),Q){if(!(J||$?!1:this.refreshCellRenderer(Q)))this.destroyRenderer(),this.createCellRendererInstance(Q)}else this.destroyRenderer(),this.insertValueWithoutCellRenderer(z);if(this.rowDraggingComp?.refreshVisibility(),this.rowResizerElement&&!this.rowResizerElement.parentElement)this.eCell.appendChild(this.rowResizerElement)}setEditDetails(Q,z,J){if(Q)this.createCellEditorInstance(Q,z,J);else this.destroyEditor()}removeControls(){let Q=this.beans.context;this.checkboxSelectionComp=Q.destroyBean(this.checkboxSelectionComp),this.dndSourceComp=Q.destroyBean(this.dndSourceComp),this.rowDraggingComp=Q.destroyBean(this.rowDraggingComp)}refreshWrapper(Q){let z=this.includeRowDrag||this.includeDndSource||this.includeSelection,J=z||this.forceWrapper,Z=J&&this.eCellWrapper==null;if(Z)this.eCellWrapper=Z0({tag:"div",cls:"ag-cell-wrapper",role:"presentation"}),this.eCell.appendChild(this.eCellWrapper);let $=!J&&this.eCellWrapper!=null;if($)T0(this.eCellWrapper),this.eCellWrapper=void 0;this.cellCssManager.toggleCss("ag-cell-value",!J);let X=!Q&&J,Y=X&&this.eCellValue==null;if(Y){let H=this.cellCtrl.getCellValueClass();this.eCellValue=Z0({tag:"span",cls:H,role:"presentation"}),this.eCellWrapper.appendChild(this.eCellValue)}let G=!X&&this.eCellValue!=null;if(G)T0(this.eCellValue),this.eCellValue=void 0;let q=Z||$||Y||G;if(q)this.removeControls();if(!Q&&z)this.addControls();return q}addControls(){let{cellCtrl:Q,eCellWrapper:z,eCellValue:J,includeRowDrag:Z,includeDndSource:$,includeSelection:X}=this,Y=(G)=>{if(G)z.insertBefore(G.getGui(),J)};if(Z&&this.rowDraggingComp==null)this.rowDraggingComp=Q.createRowDragComp(),Y(this.rowDraggingComp);if($&&this.dndSourceComp==null)this.dndSourceComp=Q.createDndSource(),Y(this.dndSourceComp);if(X&&this.checkboxSelectionComp==null)this.checkboxSelectionComp=Q.createSelectionCheckbox(),Y(this.checkboxSelectionComp)}createCellEditorInstance(Q,z,J){let Z=this.editorVersion,$=Q.newAgStackInstance(),{params:X}=Q;if($.then((G)=>this.afterCellEditorCreated(Z,G,X,z,J)),n(this.cellEditor)&&X.cellStartedEdit)this.cellCtrl.focusCell(!0)}insertValueWithoutCellRenderer(Q){let z=this.getParentOfValue();z0(z);let J=ZJ(Q);if(J!=null)z.textContent=J}destroyRenderer(){let{context:Q}=this.beans;this.cellRenderer=Q.destroyBean(this.cellRenderer),T0(this.cellRendererGui),this.cellRendererGui=null,this.rendererVersion++}destroyEditor(){let{context:Q}=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=Q.destroyBean(this.cellEditor),this.cellEditorPopupWrapper=Q.destroyBean(this.cellEditorPopupWrapper),T0(this.cellEditorGui),this.cellCtrl.disableEditorTooltipFeature(),this.cellEditorGui=null,this.editorVersion++}refreshCellRenderer(Q){if(this.cellRenderer?.refresh==null)return!1;if(this.cellRendererClass!==Q.componentClass)return!1;let z=this.cellRenderer.refresh(Q.params);return z===!0||z===void 0}createCellRendererInstance(Q){let z=this.rendererVersion,J=(X)=>(Y)=>{if(this.rendererVersion!==z||!this.isAlive())return;let q=X.newAgStackInstance(),H=this.afterCellRendererCreated.bind(this,z,X.componentClass);q?.then(H)},{animationFrameSvc:Z}=this.beans,$;if(Z?.active&&this.firstRender)$=(X,Y=!1)=>{Z.createTask(J(X),this.rowNode.rowIndex,"p2",X.componentFromFramework,Y)};else $=(X)=>J(X)();if(Q.params?.deferRender&&!this.cellCtrl.rowNode.group){let{loadingComp:X,onReady:Y}=this.cellCtrl.getDeferLoadingCellRenderer();if(X)$(X),Y.then(()=>$(Q,!0))}else $(Q)}afterCellRendererCreated(Q,z,J){if(!this.isAlive()||Q!==this.rendererVersion){this.beans.context.destroyBean(J);return}this.cellRenderer=J,this.cellRendererClass=z;let $=J.getGui();if(this.cellRendererGui=$,$!=null){let X=this.getParentOfValue();z0(X),X.appendChild($)}}afterCellEditorCreated(Q,z,J,Z,$){let X=Q!==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){R(97,{colId:this.column.getId()}),Y.destroyBean(z);return}this.cellEditor=z,this.cellEditorGui=z.getGui();let q=Z||z.isPopup?.();if(q)this.addPopupCellEditor(J,$);else this.addInCellEditor();this.refreshEditStyles(!0,q),z.afterGuiAttached?.(),this.cellCtrl.enableEditorTooltipFeature(z),this.cellCtrl.cellEditorAttached()}refreshEditStyles(Q,z){let{cellCssManager:J}=this;J.toggleCss("ag-cell-inline-editing",Q&&!z),J.toggleCss("ag-cell-popup-editing",Q&&!!z),J.toggleCss("ag-cell-not-inline-editing",!Q||!!z)}addInCellEditor(){let{eCell:Q}=this;if(Q.contains(d(this.beans)))Q.focus();if(this.destroyRenderer(),this.refreshWrapper(!0),z0(this.getParentOfValue()),this.cellEditorGui)this.getParentOfValue().appendChild(this.cellEditorGui)}addPopupCellEditor(Q,z){let{gos:J,context:Z,popupSvc:$,editSvc:X}=this.beans;if(J.get("editType")==="fullRow")R(98);let Y=this.cellEditorPopupWrapper=Z.createBean(X.createPopupEditorWrapper(Q)),{cellEditor:G,cellEditorGui:q,eCell:H,rowNode:_,column:U,cellCtrl:W}=this,B=Y.getGui();if(q)B.appendChild(q);let E=J.get("stopEditingWhenCellsLoseFocus"),K=z!=null?z:G.getPopupPosition?.()??"over",L=J.get("enableRtl"),F={ePopup:B,additionalParams:{column:U,rowNode:_},type:"popupCellEditor",eventSource:H,position:K,alignSide:L?"right":"left",keepWithinBounds:!0},D=$.positionPopupByComponent.bind($,F),M=$.addPopup({modal:E,eChild:B,closeOnEsc:!0,closedCallback:(k)=>{W.onPopupEditorClosed(k)},anchorToElement:H,positionCallback:D,ariaOwns:H});if(M)this.hideEditorPopup=M.hideFunc}detach(){this.getGui().remove()}destroy(){this.destroyRenderer(),this.destroyEditor(),this.removeControls(),super.destroy()}},E_=class extends x{constructor(Q,z,J){super();this.cellComps=new Map,this.beans=z,this.rowCtrl=Q;let Z=Z0({tag:"div",role:"row",attrs:{"comp-id":`${this.getCompId()}`}});this.setInitialStyle(Z,J),this.setTemplateFromElement(Z);let $=Z.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,G)=>this.toggleCss(Y,G),setUserStyles:(Y)=>$J(Z,Y),setTop:(Y)=>$.top=Y,setTransform:(Y)=>$.transform=Y,setRowIndex:(Y)=>Z.setAttribute("row-index",Y),setRowId:(Y)=>Z.setAttribute("row-id",Y),setRowBusinessKey:(Y)=>Z.setAttribute("row-business-key",Y),refreshFullWidth:(Y)=>{let G=Y();return this.fullWidthCellRendererParams=G,this.fullWidthCellRenderer?.refresh?.(G)??!1}};Q.setComp(X,this.getGui(),J,void 0),this.addDestroyFunc(()=>{Q.unsetComp(J)})}setInitialStyle(Q,z){let J=this.rowCtrl.getInitialTransform(z);if(J)Q.style.setProperty("transform",J);else{let Z=this.rowCtrl.getInitialRowTop(z);if(Z)Q.style.setProperty("top",Z)}}showFullWidth(Q){let z=(Z)=>{if(this.isAlive()){let $=Z.getGui();this.getGui().appendChild($),this.rowCtrl.setupDetailRowAutoHeight($),this.setFullWidthRowComp(Z,Q.params)}else this.beans.context.destroyBean(Z)};Q.newAgStackInstance().then(z)}setCellCtrls(Q){let z=new Map(this.cellComps);for(let J of Q){let Z=J.instanceId;if(!this.cellComps.has(Z))this.newCellComp(J);else z.delete(Z)}this.destroyCells(z),this.ensureDomOrder(Q)}ensureDomOrder(Q){if(!this.domOrder)return;let z=[];for(let J of Q){let Z=this.cellComps.get(J.instanceId);if(Z)z.push(Z.getGui())}u8(this.getGui(),z)}newCellComp(Q){let z=this.beans.editSvc?.isEditing(Q,{withOpenEditor:!0})??!1,J=new B_(this.beans,Q,this.rowCtrl.printLayout,this.getGui(),z);this.cellComps.set(Q.instanceId,J),this.getGui().appendChild(J.getGui())}destroy(){super.destroy(),this.destroyCells(this.cellComps)}setFullWidthRowComp(Q,z){this.fullWidthCellRenderer=Q,this.fullWidthCellRendererParams=z,this.addDestroyFunc(()=>{this.fullWidthCellRenderer=this.beans.context.destroyBean(this.fullWidthCellRenderer),this.fullWidthCellRendererParams=void 0})}destroyCells(Q){for(let z of Q.values()){if(!z)continue;let J=z.cellCtrl.instanceId;if(this.cellComps.get(J)!==z)continue;z.detach(),z.destroy(),this.cellComps.delete(J)}}};function K_(Q,z,J){let Z=!!J.gos.get("enableCellSpan")&&!!z.getSpannedRowCtrls,$={tag:"div",ref:"eContainer",cls:Z$(Q),role:"rowgroup"};if(z.type==="center"||Z){let X={tag:"div",ref:"eSpannedContainer",cls:`ag-spanning-container ${eH(Q)}`,role:"presentation"};return $.role="presentation",{tag:"div",ref:"eViewport",cls:`ag-viewport ${J$(Q)}`,role:"rowgroup",children:[$,Z?X:null]}}return $}var L_=class extends x{constructor(Q){super();this.eViewport=S,this.eContainer=S,this.eSpannedContainer=S,this.rowCompsNoSpan={},this.rowCompsWithSpan={},this.name=Q?.name,this.options=KJ(this.name)}postConstruct(){this.setTemplate(K_(this.name,this.options,this.beans));let Q={setHorizontalScroll:(J)=>this.eViewport.scrollLeft=J,setViewportHeight:(J)=>this.eViewport.style.height=J,setRowCtrls:({rowCtrls:J})=>this.setRowCtrls(J),setSpannedRowCtrls:(J)=>this.setRowCtrls(J,!0),setDomOrder:(J)=>{this.domOrder=J},setContainerWidth:(J)=>{if(this.eContainer.style.width=J,this.eSpannedContainer)this.eSpannedContainer.style.width=J},setOffsetTop:(J)=>{let Z=`translateY(${J})`;if(this.eContainer.style.transform=Z,this.eSpannedContainer)this.eSpannedContainer.style.transform=Z}};this.createManagedBean(new H_(this.name)).setComp(Q,this.eContainer,this.eSpannedContainer,this.eViewport)}destroy(){this.setRowCtrls([]),this.setRowCtrls([],!0),super.destroy(),this.lastPlacedElement=null}setRowCtrls(Q,z){let{beans:J,options:Z}=this,$=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 G=[];for(let q of Q){let H=q.instanceId,_=X[H],U;if(_)U=_,delete X[H];else{if(!q.rowNode.displayed)continue;U=new E_(q,J,Z.type)}Y[H]=U,G.push([U,!_])}this.removeOldRows(Object.values(X)),this.addRowNodes(G,$)}addRowNodes(Q,z){let{domOrder:J}=this;for(let[Z,$]of Q){let X=Z.getGui();if(!J){if($)z.appendChild(X)}else this.ensureDomOrder(X,z)}}removeOldRows(Q){for(let z of Q)z.getGui().remove(),z.destroy()}ensureDomOrder(Q,z){h8(z,Q,this.lastPlacedElement),this.lastPlacedElement=Q}},F_={selector:"AG-ROW-CONTAINER",component:L_};function C1(Q,z){return z.map((J)=>{let Z=`e${J[0].toUpperCase()+J.substring(1)}RowContainer`;return Q[Z]={name:J},{tag:"ag-row-container",ref:Z,attrs:{name:J}}})}function D_(Q){let z={},J={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:C1(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:C1(z,["left","center","right","fullWidth"])},{tag:"ag-fake-vertical-scroll"}]},{tag:"div",ref:"eStickyTop",cls:"ag-sticky-top",role:"presentation",children:C1(z,["stickyTopLeft","stickyTopCenter","stickyTopRight","stickyTopFullWidth"])},{tag:"div",ref:"eStickyBottom",cls:"ag-sticky-bottom",role:"presentation",children:C1(z,["stickyBottomLeft","stickyBottomCenter","stickyBottomRight","stickyBottomFullWidth"])},{tag:"div",ref:"eBottom",cls:"ag-floating-bottom",role:"presentation",children:C1(z,["bottomLeft","bottomCenter","bottomRight","bottomFullWidth"])},{tag:"ag-fake-horizontal-scroll"},Q?{tag:"ag-overlay-wrapper"}:null]};return{paramsMap:z,elementParams:J}}var M_=class extends x{constructor(){super(...arguments);this.eGridRoot=S,this.eBodyViewport=S,this.eStickyTop=S,this.eStickyBottom=S,this.eTop=S,this.eBottom=S,this.eBody=S}postConstruct(){let{overlays:Q,rangeSvc:z}=this.beans,J=Q?.getOverlayWrapperSelector(),{paramsMap:Z,elementParams:$}=D_(!!J);this.setTemplate($,[...J?[J]:[],uH,pH,NH,F_],Z);let X=(G,q)=>{let H=`${G}px`;q.style.minHeight=H,q.style.height=H},Y={setRowAnimationCssOnBodyViewport:(G,q)=>this.setRowAnimationCssOnBodyViewport(G,q),setColumnCount:(G)=>d4(this.getGui(),G),setRowCount:(G)=>n4(this.getGui(),G),setTopHeight:(G)=>X(G,this.eTop),setBottomHeight:(G)=>X(G,this.eBottom),setTopInvisible:(G)=>this.eTop.classList.toggle("ag-invisible",G),setBottomInvisible:(G)=>this.eBottom.classList.toggle("ag-invisible",G),setStickyTopHeight:(G)=>this.eStickyTop.style.height=G,setStickyTopTop:(G)=>this.eStickyTop.style.top=G,setStickyTopWidth:(G)=>this.eStickyTop.style.width=G,setStickyBottomHeight:(G)=>{this.eStickyBottom.style.height=G,this.eStickyBottom.classList.toggle("ag-invisible",G==="0px")},setStickyBottomBottom:(G)=>this.eStickyBottom.style.bottom=G,setStickyBottomWidth:(G)=>this.eStickyBottom.style.width=G,setColumnMovingCss:(G,q)=>this.toggleCss(G,q),updateLayoutClasses:(G,q)=>{let H=[this.eBodyViewport.classList,this.eBody.classList];for(let _ of H)_.toggle(UQ.AUTO_HEIGHT,q.autoHeight),_.toggle(UQ.NORMAL,q.normal),_.toggle(UQ.PRINT,q.print);this.toggleCss(UQ.AUTO_HEIGHT,q.autoHeight),this.toggleCss(UQ.NORMAL,q.normal),this.toggleCss(UQ.PRINT,q.print)},setAlwaysVerticalScrollClass:(G,q)=>this.eBodyViewport.classList.toggle(Y$,q),registerBodyViewportResizeListener:(G)=>{let q=DQ(this.beans,this.eBodyViewport,G);this.addDestroyFunc(()=>q())},setPinnedTopBottomOverflowY:(G)=>this.eTop.style.overflowY=this.eBottom.style.overflowY=G,setCellSelectableCss:(G,q)=>{for(let H of[this.eTop,this.eBodyViewport,this.eBottom])H.classList.toggle(G,q)},setBodyViewportWidth:(G)=>this.eBodyViewport.style.width=G,setGridRootRole:(G)=>H0(this.eGridRoot,G)};if(this.ctrl=this.createManagedBean(new W_),this.ctrl.setComp(Y,this.getGui(),this.eBodyViewport,this.eTop,this.eBottom,this.eStickyTop,this.eStickyBottom),z&&u0(this.gos)||s1(this.gos))i4(this.getGui(),!0)}setRowAnimationCssOnBodyViewport(Q,z){let J=this.eBodyViewport.classList;J.toggle("ag-row-animation",z),J.toggle("ag-row-no-animation",!z)}getFocusableContainerName(){return"gridBody"}},k_={selector:"AG-GRID-BODY",component:M_},g1={TAB_GUARD:"ag-tab-guard",TAB_GUARD_TOP:"ag-tab-guard-top",TAB_GUARD_BOTTOM:"ag-tab-guard-bottom"},V_=class extends j0{constructor(Q,z){super();this.stopPropagationCallbacks=z,this.skipTabGuardFocus=!1,this.forcingFocusOut=!1,this.allowFocus=!1;let{comp:J,eTopGuard:Z,eBottomGuard:$,focusTrapActive:X,forceFocusOutWhenTabGuardsAreEmpty:Y,isFocusableContainer:G,focusInnerElement:q,onFocusIn:H,onFocusOut:_,shouldStopEventPropagation:U,onTabKeyDown:W,handleKeyDown:B,isEmpty:E,eFocusableElement:K}=Q;this.comp=J,this.eTopGuard=Z,this.eBottomGuard=$,this.providedFocusInnerElement=q,this.eFocusableElement=K,this.focusTrapActive=!!X,this.forceFocusOutWhenTabGuardsAreEmpty=!!Y,this.isFocusableContainer=!!G,this.providedFocusIn=H,this.providedFocusOut=_,this.providedShouldStopEventPropagation=U,this.providedOnTabKeyDown=W,this.providedHandleKeyDown=B,this.providedIsEmpty=E}postConstruct(){this.createManagedBean(new x9(this.eFocusableElement,this.stopPropagationCallbacks,{shouldStopEventPropagation:()=>this.shouldStopEventPropagation(),onTabKeyDown:(Q)=>this.onTabKeyDown(Q),handleKeyDown:(Q)=>this.handleKeyDown(Q),onFocusIn:(Q)=>this.onFocusIn(Q),onFocusOut:(Q)=>this.onFocusOut(Q)})),this.activateTabGuards();for(let Q of[this.eTopGuard,this.eBottomGuard])this.addManagedElementListeners(Q,{focus:this.onFocus.bind(this)})}handleKeyDown(Q){if(this.providedHandleKeyDown)this.providedHandleKeyDown(Q)}tabGuardsAreActive(){return!!this.eTopGuard&&this.eTopGuard.hasAttribute("tabIndex")}shouldStopEventPropagation(){if(this.providedShouldStopEventPropagation)return this.providedShouldStopEventPropagation();return!1}activateTabGuards(){if(this.forcingFocusOut)return;let Q=this.gos.get("tabIndex");this.comp.setTabIndex(Q.toString())}deactivateTabGuards(){this.comp.setTabIndex()}onFocus(Q){if(this.isFocusableContainer&&!this.eFocusableElement.contains(Q.relatedTarget)){if(!this.allowFocus){this.findNextElementOutsideAndFocus(Q.target===this.eBottomGuard);return}}if(this.skipTabGuardFocus){this.skipTabGuardFocus=!1;return}if(this.forceFocusOutWhenTabGuardsAreEmpty){if(this.providedIsEmpty?this.providedIsEmpty():EQ(this.eFocusableElement,".ag-tab-guard").length===0){this.findNextElementOutsideAndFocus(Q.target===this.eBottomGuard);return}}if(this.isFocusableContainer&&this.eFocusableElement.contains(Q.relatedTarget))return;let z=Q.target===this.eBottomGuard;if(!(this.providedFocusInnerElement?this.providedFocusInnerElement(z):this.focusInnerElement(z))&&this.forceFocusOutWhenTabGuardsAreEmpty)this.findNextElementOutsideAndFocus(Q.target===this.eBottomGuard)}findNextElementOutsideAndFocus(Q){let z=Y0(this.beans),J=EQ(z.body,null,!0),Z=J.indexOf(Q?this.eTopGuard:this.eBottomGuard);if(Z===-1)return;let $,X;if(Q)$=0,X=Z;else $=Z+1,X=J.length;let Y=J.slice($,X),G=this.gos.get("tabIndex");Y.sort((q,H)=>{let _=Number.parseInt(q.getAttribute("tabindex")||"0"),U=Number.parseInt(H.getAttribute("tabindex")||"0");if(U===G)return 1;if(_===G)return-1;if(_===0)return 1;if(U===0)return-1;return _-U}),Y[Q?Y.length-1:0]?.focus()}onFocusIn(Q){if(this.focusTrapActive||this.forcingFocusOut)return;if(this.providedFocusIn)this.providedFocusIn(Q);if(!this.isFocusableContainer)this.deactivateTabGuards()}onFocusOut(Q){if(this.focusTrapActive)return;if(this.providedFocusOut)this.providedFocusOut(Q);if(!this.eFocusableElement.contains(Q.relatedTarget))this.activateTabGuards()}onTabKeyDown(Q){if(this.providedOnTabKeyDown){this.providedOnTabKeyDown(Q);return}if(this.focusTrapActive)return;if(Q.defaultPrevented)return;let z=this.tabGuardsAreActive();if(z)this.deactivateTabGuards();let J=this.getNextFocusableElement(Q.shiftKey);if(z)setTimeout(()=>this.activateTabGuards(),0);if(!J)return;J.focus(),Q.preventDefault()}focusInnerElement(Q=!1){let z=EQ(this.eFocusableElement);if(this.tabGuardsAreActive())z.splice(0,1),z.splice(-1,1);if(!z.length)return!1;return z[Q?z.length-1:0].focus({preventScroll:!0}),!0}getNextFocusableElement(Q){return R0(this.beans,this.eFocusableElement,!1,Q)}forceFocusOutOfContainer(Q=!1){if(this.forcingFocusOut)return;let z=Q?this.eTopGuard:this.eBottomGuard;this.activateTabGuards(),this.skipTabGuardFocus=!0,this.forcingFocusOut=!0,z.focus(),window.setTimeout(()=>{this.forcingFocusOut=!1,this.activateTabGuards()})}isTabGuard(Q,z){return Q===this.eTopGuard&&!z||Q===this.eBottomGuard&&(z??!0)}setAllowFocus(Q){this.allowFocus=Q}},H6=class extends j0{constructor(Q,z){super();this.comp=Q,this.stopPropagationCallbacks=z}initialiseTabGuard(Q){this.eTopGuard=this.createTabGuard("top"),this.eBottomGuard=this.createTabGuard("bottom"),this.eFocusableElement=this.comp.getFocusableElement();let{eTopGuard:z,eBottomGuard:J,eFocusableElement:Z,stopPropagationCallbacks:$}=this,X=[z,J],Y={setTabIndex:(F)=>{for(let D of X)if(F==null)D.removeAttribute("tabindex");else D.setAttribute("tabindex",F)}};this.addTabGuards(z,J);let{focusTrapActive:G=!1,onFocusIn:q,onFocusOut:H,focusInnerElement:_,handleKeyDown:U,onTabKeyDown:W,shouldStopEventPropagation:B,isEmpty:E,forceFocusOutWhenTabGuardsAreEmpty:K,isFocusableContainer:L}=Q;this.tabGuardCtrl=this.createManagedBean(new V_({comp:Y,focusTrapActive:G,eTopGuard:z,eBottomGuard:J,eFocusableElement:Z,onFocusIn:q,onFocusOut:H,focusInnerElement:_,handleKeyDown:U,onTabKeyDown:W,shouldStopEventPropagation:B,isEmpty:E,forceFocusOutWhenTabGuardsAreEmpty:K,isFocusableContainer:L},$))}getTabGuardCtrl(){return this.tabGuardCtrl}createTabGuard(Q){let z=Y0(this.beans).createElement("div"),J=Q==="top"?g1.TAB_GUARD_TOP:g1.TAB_GUARD_BOTTOM;return z.classList.add(g1.TAB_GUARD,J),H0(z,"presentation"),z}addTabGuards(Q,z){let J=this.eFocusableElement;J.prepend(Q),J.append(z)}removeAllChildrenExceptTabGuards(){let Q=[this.eTopGuard,this.eBottomGuard];z0(this.comp.getFocusableElement()),this.addTabGuards(...Q)}forceFocusOutOfContainer(Q=!1){this.tabGuardCtrl.forceFocusOutOfContainer(Q)}appendChild(Q,z,J){if(!XJ(z))z=z.getGui();let{eBottomGuard:Z}=this;if(Z)Z.before(z);else Q(z,J)}destroy(){let{eTopGuard:Q,eBottomGuard:z}=this;T0(Q),T0(z),super.destroy()}},pQ=class extends p0{initialiseTabGuard(Q,z){this.tabGuardFeature=this.createManagedBean(new H6(this,z)),this.tabGuardFeature.initialiseTabGuard(Q)}forceFocusOutOfContainer(Q=!1){this.tabGuardFeature.forceFocusOutOfContainer(Q)}appendChild(Q,z){this.tabGuardFeature.appendChild(super.appendChild.bind(this),Q,z)}},_6=class extends pQ{initialiseTabGuard(Q){super.initialiseTabGuard(Q,Uz)}},O7=(Q,z)=>{return m9(Q,()=>D0(Q.getGui(),z,!1,!0))},P7=(Q)=>{return Q?.getFocusableContainerName()??"external"},f_=(Q)=>{if(Q==null)return"external";return typeof Q==="string"?Q:"gridBody"},A_=class extends j{constructor(){super(...arguments);this.additionalFocusableContainers=new Set}setComp(Q,z,J){this.view=Q,this.eGridHostDiv=z,this.eGui=J,this.eGui.setAttribute("grid-id",this.beans.context.getId());let{dragAndDrop:Z,ctrlsSvc:$}=this.beans;Z?.registerGridDropTarget(()=>this.eGui,this),this.createManagedBean(new G6(this.view)),this.view.setRtlClass(this.gos.get("enableRtl")?"ag-rtl":"ag-ltr");let X=DQ(this.beans,this.eGridHostDiv,this.onGridSizeChanged.bind(this));this.addDestroyFunc(()=>X()),$.register("gridCtrl",this)}isDetailGrid(){return xZ(this.getGui())?.getAttribute("row-id")?.startsWith("detail")||!1}getOptionalSelectors(){let Q=this.beans;return{paginationSelector:Q.pagination?.getPaginationSelector(),gridHeaderDropZonesSelector:Q.registry?.getSelector("AG-GRID-HEADER-DROP-ZONES"),sideBarSelector:Q.sideBar?.getSelector(),statusBarSelector:Q.registry?.getSelector("AG-STATUS-BAR"),watermarkSelector:Q.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(Q){let{view:z}=this;if(Q===!1)z.setCursor(null);else z.setCursor(Q===1?"ew-resize":"ns-resize")}disableUserSelect(Q){this.view.setUserSelect(Q?"none":null)}focusNextInnerContainer(Q){let z=this.getFocusableContainers(),{indexWithFocus:J,nextIndex:Z}=this.getNextFocusableIndex(z,Q),$=J===-1?Q?z.length-1:0:Z,{gos:X,beans:{focusSvc:Y,navigation:G}}=this,q=X.getCallback("tabToNextGridContainer");if(q){let H=Y.getDefaultTabToNextGridContainerTarget({backwards:Q,focusableContainers:z,nextIndex:$}),_=P7(z[$]),U=H==null&&_==="gridBody"?"gridBody":f_(H),W=q({backwards:Q,previousContainer:P7(z[J]),nextContainer:U,defaultTarget:H});if(W!==void 0){if(typeof W==="boolean")return W;if(typeof W==="string"){if(W==="gridBody")return this.focusGridBodyDefault(Q)||void 0;let B=z.find((E)=>E.getFocusableContainerName()===W);if(!B){t8(`tabToNextGridContainer - ${W} container not found`);return}return O7(B,Q)?!0:void 0}if(LH(W))return Y.focusHeaderPosition({headerPosition:W})||void 0;return G?.ensureCellVisible(W),Y.setFocusedCell({...W,forceBrowserFocus:!0}),Y.isCellFocused(W)||void 0}}return this.focusNextInnerContainerDefault({backwards:Q,focusableContainers:z,indexWithFocus:J,nextIndex:$})||void 0}focusInnerElement(Q){let{gos:z,beans:J,beans:{focusSvc:Z,visibleCols:$}}=this;if(z.getCallback("focusGridInnerElement")?.({fromBottom:!!Q}))return!0;let Y=this.getFocusableContainers();if(Q){if(this.focusNextInnerContainerDefault({backwards:!0,focusableContainers:Y,indexWithFocus:Y.length,nextIndex:Y.length-1}))return!0;return Z.focusGridView({column:b($.allCols),backwards:!0})}let G=$.allCols;if(z.get("headerHeight")===0||_Q(J)){if(Z.focusGridView({column:G[0],backwards:Q}))return!0;for(let q=1;q$.getGui().contains(J));return{indexWithFocus:Z,nextIndex:Z+(z?-1:1)}}focusGridBodyDefault(Q){let{gos:z,beans:J,beans:{focusSvc:Z,visibleCols:{allCols:$}}}=this;if(Q)return Z.focusGridView({column:b($),backwards:!0});if(z.get("headerHeight")===0||_Q(J))return Z.focusGridView({column:$[0]});return Z.focusFirstHeader()}focusNextInnerContainerDefault(Q){let{backwards:z,focusableContainers:J,indexWithFocus:Z}=Q,$=z?-1:1;for(let X=Q.nextIndex;X>=0&&XX:Zthis.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 A_),J=z.getOptionalSelectors(),Z=this.createTemplate(J),$=[k_,...Object.values(J).filter((X)=>!!X)];this.setTemplate(Z,$),z.setComp(Q,this.eGridDiv,this.getGui()),this.insertGridIntoDom(),this.initialiseTabGuard({onTabKeyDown:()=>{return},focusInnerElement:(X)=>z.focusInnerElement(X),forceFocusOutWhenTabGuardsAreEmpty:!0,isEmpty:()=>!z.isFocusable()})}insertGridIntoDom(){let Q=this.getGui();this.eGridDiv.appendChild(Q),this.addDestroyFunc(()=>{Q.remove(),d1(this.gos,"Grid removed from DOM")})}updateLayoutClasses(Q,z){let J=this.rootWrapperBody.classList,{AUTO_HEIGHT:Z,NORMAL:$,PRINT:X}=UQ,{autoHeight:Y,normal:G,print:q}=z;J.toggle(Z,Y),J.toggle($,G),J.toggle(X,q),this.toggleCss(Z,Y),this.toggleCss($,G),this.toggleCss(X,q)}createTemplate(Q){let z=Q.gridHeaderDropZonesSelector?{tag:"ag-grid-header-drop-zones",ref:"gridHeaderDropZones"}:null,J=Q.sideBarSelector?{tag:"ag-side-bar",ref:"sideBar"}:null,Z=Q.statusBarSelector?{tag:"ag-status-bar",ref:"statusBar"}:null,$=Q.watermarkSelector?{tag:"ag-watermark"}:null,X=Q.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"},J]},Z,X,$]}}getFocusableElement(){return this.rootWrapperBody}forceFocusOutOfContainer(Q=!1){if(!Q&&this.pagination?.isDisplayed()){this.pagination.forceFocusOutOfContainer(Q);return}super.forceFocusOutOfContainer(Q)}getFocusableContainers(){let Q=[...this.gridHeaderDropZones?.getFocusableContainers?.()??[],this.gridBody];for(let z of[this.sideBar,this.statusBar,this.pagination])if(z)Q.push(z);return Q.filter((z)=>f0(z.getGui()))}},c=(Q,z)=>{for(let J of Object.keys(z))z[J]=Q;return z},T7={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})},g2={isDestroyed:()=>!0,destroy(){},preConstruct(){},postConstruct(){},preWireBeans(){},wireBeans(){}},R_=(Q,z)=>Q.eventSvc.dispatchEvent(z),G$=class{};Reflect.defineProperty(G$,"name",{value:"GridApi"});var S_=class extends j{constructor(){super();this.beanName="apiFunctionSvc",this.api=new G$,this.fns={...g2,dispatchEvent:R_},this.preDestroyLink="";let{api:Q}=this;for(let z of Object.keys(T7))Q[z]=this.makeApi(z)[z]}postConstruct(){this.preDestroyLink=this.beans.frameworkOverrides.getDocLink("grid-lifecycle/#grid-pre-destroyed")}addFunction(Q,z){let{fns:J,beans:Z}=this;if(J!==g2)J[Q]=Z?.validation?.validateApiFunction(Q,z)??z}makeApi(Q){return{[Q]:(...z)=>{let{beans:J,fns:{[Q]:Z}}=this;return Z?Z(J,...z):this.apiNotFound(Q)}}}apiNotFound(Q){let{beans:z,gos:J,preDestroyLink:Z}=this;if(!z)R(26,{fnName:Q,preDestroyLink:Z});else{let $=T7[Q];if(J.assertModuleRegistered($,`api.${Q}`))R(27,{fnName:Q,module:$})}}destroy(){super.destroy(),this.fns=g2,this.beans=null}};function O_(Q){return Q.context.getId()}function P_(Q){Q.gridDestroySvc.destroy()}function T_(Q){return Q.gridDestroySvc.destroyCalled}function v_(Q,z){return Q.gos.get(z)}function I_(Q,z,J){q$(Q,{[z]:J})}function q$(Q,z){Q.gos.updateGridOptions({options:z})}function C_(Q,z){let J=z.replace(/Module$/,"");return Q.gos.isModuleRegistered(J)}function uZ(Q,z,J){let Z=h(Q,z,J);if(Z){let{className:X}=Z;if(typeof X==="string"&&X.includes("ag-icon")||typeof X==="object"&&X["ag-icon"])return Z}let $=Z0({tag:"span"});return $.appendChild(Z),$}function h(Q,z,J){let Z=null;if(Q==="smallDown")R(262);else if(Q==="smallLeft")R(263);else if(Q==="smallRight")R(264);let $=J?.getColDef().icons;if($)Z=$[Q];if(z.gos&&!Z){let X=z.gos.get("icons");if(X)Z=X[Q]}if(Z){let X;if(typeof Z==="function")X=Z();else if(typeof Z==="string")X=Z;else{R(38,{iconName:Q});return}if(typeof X==="string")return v5(X);if(XJ(X))return X;R(133,{iconName:Q});return}else{let X=z.registry.getIcon(Q);if(!X)z.validation?.validateIcon(Q);return Z0({tag:"span",cls:`ag-icon ag-icon-${X??Q}`,role:"presentation",attrs:{unselectable:"on"}})}}var b_=".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)}",y_={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"}]}]},x_=class extends x{constructor(){super();this.dragSource=null,this.eIcon=S,this.eLabel=S,this.eGhost=S,this.registerCSS(b_)}postConstruct(){let Q=(z)=>uZ(z,this.beans,null);this.dropIconMap={pinned:Q("columnMovePin"),hide:Q("columnMoveHide"),move:Q("columnMoveMove"),left:Q("columnMoveLeft"),right:Q("columnMoveRight"),group:Q("columnMoveGroup"),aggregate:Q("columnMoveValue"),pivot:Q("columnMovePivot"),notAllowed:Q("dropNotAllowed")}}init(Q){this.dragSource=Q.dragSource,this.setTemplate(y_),this.beans.environment.applyThemeClasses(this.eGhost)}destroy(){this.dragSource=null,super.destroy()}setIcon(Q,z){let{eGhost:J,eIcon:Z,dragSource:$,dropIconMap:X,gos:Y}=this;z0(Z);let G=null;if(!Q)Q=$?.getDefaultIconName?$.getDefaultIconName():"notAllowed";if(G=X[Q],J.classList.toggle("ag-dnd-ghost-not-allowed",Q==="notAllowed"),Z.classList.toggle("ag-shake-left-to-right",z),G===X.hide&&Y.get("suppressDragLeaveHidesColumns"))return;if(G)Z.appendChild(G)}setLabel(Q){this.eLabel.textContent=Q}};var H$=(Q,z)=>{if(z!=null&&Q?.setPointerCapture)try{return Q.setPointerCapture(z),Q.hasPointerCapture(z)}catch{}return!1},w_=(Q,z)=>{if(typeof PointerEvent>"u"||!(z instanceof PointerEvent))return null;let J=z.pointerId;if(!H$(Q,J))return null;let Z={eElement:Q,pointerId:J,onLost($){g_(Z,$)}};return Q.addEventListener("lostpointercapture",Z.onLost),Z},N_=(Q)=>{if(!Q)return;_$(Q);let{eElement:z,pointerId:J}=Q;if(!z)return;try{z.releasePointerCapture(J)}catch{}Q.eElement=null},_$=(Q)=>{let{eElement:z,onLost:J}=Q;if(z&&J)z.removeEventListener("lostpointercapture",J),Q.onLost=null},g_=(Q,z)=>{_$(Q);let{eElement:J,pointerId:Z}=Q;if(J&&z.pointerId===Z)H$(J,Z)},ez,Z1,h2={passive:!0},sQ={passive:!1},kQ=(Q)=>{if(!Z1)Z1=new WeakSet;else if(Z1.has(Q))return!1;return Z1.add(Q),!0},h_=class extends j0{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(s0(this.beans))}hasPointerCapture(){let Q=this.drag?.pointerCapture;return!!(Q&&this.beans.eRootDiv.hasPointerCapture?.(Q.pointerId))}destroy(){if(this.drag)this.cancelDrag();let Q=this.dragSources;for(let z of Q)v7(z);Q.length=0,super.destroy()}removeDragSource(Q){let z=this.dragSources;for(let J=0,Z=z.length;Jthis.onPointerDown(Q,H),sQ],[z,"mousedown",(H)=>this.onMouseDown(Q,H)]);let q=this.gos.get("suppressTouch");if(J&&!q)pJ(Z,[z,"touchstart",(_)=>this.onTouchStart(Q,_),sQ])}cancelDrag(Q){let z=this.drag;if(Q??(Q=z?.eElement),Q)this.eventSvc.dispatchEvent({type:"dragCancelled",target:Q});z?.params.onDragCancel?.(),this.destroyDrag()}shouldPreventMouseEvent(Q){let z=Q.type;return(z==="mousemove"||z==="pointermove")&&Q.cancelable&&n1(this.beans,Q)&&!w1(m2(Q))}initDrag(Q,...z){this.drag=Q;let J=this.beans,Z=(G)=>this.onScroll(G),$=(G)=>this.onKeyDown(G),X=s0(J),Y=Y0(J);pJ(Q.handlers,[X,"contextmenu",J1],[X,"keydown",$],[Y,"scroll",Z,{capture:!0}],[Y.defaultView||window,"scroll",Z],...z)}destroyDrag(){this.dragging=!1;let Q=this.drag;if(Q){let z=Q.rootEl;if(ez?.get(z)===Q)ez.delete(z);this.drag=null,N_(Q.pointerCapture),I5(Q.handlers)}}onPointerDown(Q,z){if(this.isPointer())return;let J=this.beans;if(Z1?.has(z))return;let Z=z.pointerType;if(Z==="touch"){if(J.gos.get("suppressTouch")||!Q.includeTouch)return;if(Q.stopPropagationForTouch)z.stopPropagation();if(w1(m2(z)))return}if(!z.isPrimary)return;if(Z==="mouse"&&z.button!==0)return;this.destroyDrag();let $=s0(J),X=Q.eElement,Y=z.pointerId,G=new u2($,Q,z,Y);ez??(ez=new WeakMap),ez.set($,G);let q=(W)=>{if(W.pointerId===Y)this.onMouseOrPointerMove(W)},H=(W)=>{if(W.pointerId===Y)this.onMouseOrPointerUp(W)},_=(W)=>{if(W.pointerId===Y&&kQ(W))this.cancelDrag()},U=(W)=>this.draggingPreventDefault(W);if(this.initDrag(G,[$,"pointerup",H],[$,"pointercancel",_],[$,"pointermove",q,sQ],[$,"touchmove",U,sQ],[X,"mousemove",U,sQ]),Q.dragStartPixels===0)this.onMouseOrPointerMove(z);else kQ(z)}onTouchStart(Q,z){if(this.gos.get("suppressTouch")||!Q.includeTouch)return;if(!kQ(z))return;if(w1(m2(z)))return;if(Q.stopPropagationForTouch)z.stopPropagation();if(this.isPointer()){if(this.dragging)J1(z);return}this.destroyDrag();let Z=this.beans,$=s0(Z),X=new u2($,Q,z.touches[0]),Y=(W)=>this.onTouchMove(W),G=(W)=>this.onTouchUp(W),q=(W)=>this.onTouchCancel(W),H=(W)=>this.draggingPreventDefault(W),_=s0(Z),U=z.target??Q.eElement;if(this.initDrag(X,[U,"touchmove",Y,h2],[U,"touchend",G,h2],[U,"touchcancel",q,h2],[_,"touchmove",H,sQ],[_,"touchend",G,sQ],[_,"touchcancel",q,sQ]),Q.dragStartPixels===0)this.onMove(X.start)}draggingPreventDefault(Q){if(this.dragging)J1(Q)}onMouseDown(Q,z){if(z.button!==0)return;if(Z1?.has(z))return;if(this.isPointer())return;let J=this.beans;this.destroyDrag();let Z=new u2(s0(J),Q,z),$=(G)=>this.onMouseOrPointerMove(G),X=(G)=>this.onMouseOrPointerUp(G),Y=s0(J);if(this.initDrag(Z,[Y,"mousemove",$],[Y,"mouseup",X]),Q.dragStartPixels===0)this.onMouseOrPointerMove(z);else kQ(z)}onScroll(Q){if(!kQ(Q))return;let z=this.drag,J=z?.lastDrag;if(J&&this.dragging)z.params?.onDragging?.(J)}onMouseOrPointerMove(Q){if(!kQ(Q))return;if(cz())Y0(this.beans).getSelection()?.removeAllRanges();if(this.shouldPreventMouseEvent(Q))J1(Q);this.onMove(Q)}onTouchCancel(Q){let z=this.drag;if(!z||!kQ(Q))return;if(!G1(z.start,Q.changedTouches))return;this.cancelDrag()}onTouchMove(Q){let z=this.drag;if(!z||!kQ(Q))return;let J=G1(z.start,Q.touches);if(J)this.onMove(J),this.draggingPreventDefault(Q)}onMove(Q){let z=this.drag;if(!z)return;z.lastDrag=Q;let J=z.params;if(!this.dragging){let Z=z.start,X=J.dragStartPixels??4;if(i8(Q,Z,X))return;if(this.dragging=!0,J.capturePointer)z.pointerCapture=w_(this.beans.eRootDiv,Q);if(this.eventSvc.dispatchEvent({type:"dragStarted",target:J.eElement}),J.onDragStart?.(Z),this.drag!==z)return;if(J.onDragging?.(Z),this.drag!==z)return}J.onDragging?.(Q)}onTouchUp(Q){let z=this.drag;if(z&&kQ(Q))this.onUp(G1(z.start,Q.changedTouches))}onMouseOrPointerUp(Q){if(kQ(Q))this.onUp(Q)}onUp(Q){let z=this.drag;if(!z)return;if(!Q)Q=z.lastDrag;if(Q&&this.dragging)this.dragging=!1,z.params.onDragStop?.(Q),this.eventSvc.dispatchEvent({type:"dragStopped",target:z.params.eElement});this.destroyDrag()}onKeyDown(Q){if(Q.key===V.ESCAPE)this.cancelDrag()}},v7=(Q)=>{I5(Q.handlers);let z=Q.oldTouchAction;if(z!=null){let J=Q.params.eElement.style;if(J)J.touchAction=z}},u2=class{constructor(Q,z,J,Z=null){this.rootEl=Q,this.params=z,this.start=J,this.pointerId=Z,this.handlers=[],this.lastDrag=null,this.pointerCapture=null,this.eElement=z.eElement}},m2=(Q)=>{let z=Q.target;return z instanceof Element?z:null},u_=class extends h_{shouldPreventMouseEvent(Q){return this.gos.get("enableCellTextSelection")&&super.shouldPreventMouseEvent(Q)}},m_=class extends j{constructor(){super(...arguments);this.beanName="horizontalResizeSvc"}addResizeBar(Q){let z={dragStartPixels:Q.dragStartPixels||0,eElement:Q.eResizeBar,onDragStart:this.onDragStart.bind(this,Q),onDragStop:this.onDragStop.bind(this,Q),onDragging:this.onDragging.bind(this,Q),onDragCancel:this.onDragStop.bind(this,Q),includeTouch:!0,stopPropagationForTouch:!0},{dragSvc:J}=this.beans;return J.addDragSource(z),()=>J.removeDragSource(z)}onDragStart(Q,z){this.dragStartX=z.clientX,this.setResizeIcons();let J=z instanceof MouseEvent&&z.shiftKey===!0;Q.onResizeStart(J)}setResizeIcons(){let Q=this.beans.ctrlsSvc.get("gridCtrl");Q.setResizeCursor(1),Q.disableUserSelect(!0)}onDragStop(Q){Q.onResizeEnd(this.resizeAmount),this.resetIcons()}resetIcons(){let Q=this.beans.ctrlsSvc.get("gridCtrl");Q.setResizeCursor(!1),Q.disableUserSelect(!1)}onDragging(Q,z){this.resizeAmount=z.clientX-this.dragStartX,Q.onResizing(this.resizeAmount)}};var mZ=class{constructor(Q){if(this.tickingInterval=null,this.onScrollCallback=null,this.scrollContainer=Q.scrollContainer,this.scrollHorizontally=Q.scrollAxis.includes("x"),this.scrollVertically=Q.scrollAxis.includes("y"),this.scrollByTick=Q.scrollByTick??20,Q.onScrollCallback)this.onScrollCallback=Q.onScrollCallback;if(this.scrollVertically)this.getVerticalPosition=Q.getVerticalPosition,this.setVerticalPosition=Q.setVerticalPosition;if(this.scrollHorizontally)this.getHorizontalPosition=Q.getHorizontalPosition,this.setHorizontalPosition=Q.setHorizontalPosition;this.shouldSkipVerticalScroll=Q.shouldSkipVerticalScroll||(()=>!1),this.shouldSkipHorizontalScroll=Q.shouldSkipHorizontalScroll||(()=>!1)}get scrolling(){return this.tickingInterval!==null}check(Q,z=!1){let J=!this.scrollVertically||z||this.shouldSkipVerticalScroll(),Z=!this.scrollHorizontally||this.shouldSkipHorizontalScroll();if(J&&Z)return;let $=this.scrollContainer.getBoundingClientRect(),X=this.scrollByTick;if(this.tickLeft=!Z&&Q.clientX<$.left+X,this.tickRight=!Z&&Q.clientX>$.right-X,this.tickUp=!J&&Q.clientY<$.top+X,this.tickDown=!J&&Q.clientY>$.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 Q=this.tickCount>20?200:this.tickCount>10?80:40;if(this.scrollVertically){let z=this.getVerticalPosition();if(this.tickUp)this.setVerticalPosition(z-Q);if(this.tickDown)this.setVerticalPosition(z+Q)}if(this.scrollHorizontally){let z=this.getHorizontalPosition();if(this.tickLeft)this.setHorizontalPosition(z-Q);if(this.tickRight)this.setHorizontalPosition(z+Q)}if(this.onScrollCallback)this.onScrollCallback()}ensureCleared(){if(this.tickingInterval)window.clearInterval(this.tickingInterval),this.tickingInterval=null}},W1=class{constructor(){this.reordered=!1,this.removals=[],this.updates=new Set,this.adds=new Set}},pz=(Q)=>{let z=Q.childrenAfterGroup;while(z?.length){let J=z[0];if(J.sourceRowIndex>=0)return J;z=J.childrenAfterGroup}},U$=(Q,z,J,Z)=>{if(!z.size||!Q)return!1;let $=!1,X=Q.length??0,Y=-1;if(J){if(Y=J.sourceRowIndex,J=Y<0?pz(J):null,J)Y=J.sourceRowIndex}if(Y<0||Y>=X)Y=X;else if(!Z)++Y;let G=Y,q=Math.min(Y,X-1);for(let U of z){let W=U.sourceRowIndex;if(Wq)q=W}let H=G;for(let U=G;U=Y;--U){let W=Q[U];if(z.has(W))continue;if(W.sourceRowIndex!==_)W.sourceRowIndex=_,Q[_]=W,$=!0;--_}for(let U of z){if(U.sourceRowIndex!==H)U.sourceRowIndex=H,Q[H]=U,$=!0;++H}return $};function U6(Q,z){return EJ(Q,z.target)?.getFocusedCellPosition()??null}function W6(Q,z){let J=V0(Q.gos,"normal"),Z=z,$,X;if(Z.clientX!=null||Z.clientY!=null)$=Z.clientX,X=Z.clientY;else $=Z.x,X=Z.y;let{pageFirstPixel:Y}=Q.pageBounds.getCurrentPagePixelRange();if(X+=Y,J){let G=Q.ctrlsSvc.getScrollFeature(),q=G.getVScrollPosition(),H=G.getHScrollPosition();$+=H.left,X+=q.top}return{x:$,y:X}}var cZ={moduleName:"Drag",version:p,beans:[u_]};var LJ={moduleName:"SharedDragAndDrop",version:p,beans:[gq],dependsOn:[cZ],userComponents:{agDragAndDropImage:x_},icons:{columnMovePin:"pin",columnMoveHide:"eye-slash",columnMoveMove:"arrows",columnMoveLeft:"left",columnMoveRight:"right",columnMoveGroup:"group",columnMoveValue:"aggregation",columnMovePivot:"pivot",dropNotAllowed:"not-allowed",rowDrag:"grip"}};var B6={moduleName:"HorizontalResize",version:p,beans:[m_],dependsOn:[cZ]},c_=":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}}",p_=class extends j{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,(Q)=>this.gridBodyCtrl=Q.gridBodyCtrl)}isActive(){return this.active&&!this.suppressAnimation}setSuppressAnimation(Q){this.suppressAnimation=Q}start(){if(this.active)return;let{gos:Q}=this;if(Q.get("suppressColumnMoveAnimation"))return;if(Q.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(Q){if(this.activeNext)this.executeNextFuncs.push(Q);else Q()}executeLaterVMTurn(Q){if(this.active)this.executeLaterFuncs.push(Q);else Q()}ensureAnimationCssClassPresent(){this.animationThreadCount++;let Q=this.animationThreadCount,{gridBodyCtrl:z}=this;z.setColumnMovingCss(!0),this.executeLaterFuncs.push(()=>{if(this.animationThreadCount===Q)z.setColumnMovingCss(!1)})}flush(Q,z){let{executeNextFuncs:J,executeLaterFuncs:Z}=this;if(J.length===0&&Z.length===0){Q(),z();return}let $=(X)=>{while(X.length){let Y=X.pop();if(Y)Y()}};this.beans.frameworkOverrides.wrapIncoming(()=>{window.setTimeout(()=>{Q(),$(J)},0),window.setTimeout(()=>{z(),$(Z)},200)})}};function i_(Q,z,J){Q.colMoves?.moveColumnByIndex(z,J,"api")}function n_(Q,z,J){Q.colMoves?.moveColumns(z,J,"api")}var d_=class extends j{constructor(Q){super();this.pinned=Q,this.columnsToAggregate=[],this.columnsToGroup=[],this.columnsToPivot=[]}onDragEnter(Q){if(this.clearColumnsList(),this.gos.get("functionsReadOnly"))return;let z=Q.dragItem.columns;if(!z)return;for(let J of z){if(!J.isPrimary())continue;if(J.isAnyFunctionActive())continue;if(J.isAllowValue())this.columnsToAggregate.push(J);else if(J.isAllowRowGroup())this.columnsToGroup.push(J);else if(J.isAllowPivot())this.columnsToPivot.push(J)}}getIconName(){if(this.columnsToAggregate.length+this.columnsToGroup.length+this.columnsToPivot.length>0)return this.pinned?"pinned":"move";return null}onDragLeave(Q){this.clearColumnsList()}clearColumnsList(){this.columnsToAggregate.length=0,this.columnsToGroup.length=0,this.columnsToPivot.length=0}onDragging(Q){}onDragStop(Q){let{valueColsSvc:z,rowGroupColsSvc:J,pivotColsSvc:Z}=this.beans;if(this.columnsToAggregate.length>0)z?.addColumns(this.columnsToAggregate,"toolPanelDragAndDrop");if(this.columnsToGroup.length>0)J?.addColumns(this.columnsToGroup,"toolPanelDragAndDrop");if(this.columnsToPivot.length>0)Z?.addColumns(this.columnsToPivot,"toolPanelDragAndDrop")}onDragCancel(){this.clearColumnsList()}};function t_(Q,z){if(!z||z.length<=1)return;if(z.filter((Z)=>Q.indexOf(Z)<0).length>0)return;z.sort((Z,$)=>{let X=Q.indexOf(Z),Y=Q.indexOf($);return X-Y})}function r_(Q){let z=[...Q];for(let J of Q){let Z=null,$=J.getParent();while($!=null&&$.getDisplayedLeafColumns().length===1)Z=$,$=$.getParent();if(Z!=null){let Y=Z.getColGroupDef()?.marryChildren?Z.getProvidedColumnGroup().getLeafColumns():Z.getLeafColumns();for(let G of Y)if(!z.includes(G))z.push(G)}}return z}function s_(Q,z,J,Z){let $=Z.allCols,X=null,Y=null;for(let G=0;G$.includes(W));if(Y===null)Y=_;else if(!X0(_,Y))break;let U=a_(H);if(X===null||U=E)return;if(J&&K<=E)return}let F=s_(B,W,H,_);if(!F)return;let D=F.move;if(D>q.getCols().length-W.length)return;return{columns:W,toIndex:D}}function B$(Q){let{columns:z,toIndex:J}=W$(Q)||{},{finished:Z,colMoves:$}=Q;if(!z||J==null)return null;return $.moveColumns(z,J,"uiColumnMoved",Z),Z?null:{columns:z,toIndex:J}}function l_(Q,z){let J=z.getCols(),Z=Q.map((q)=>J.indexOf(q)).sort((q,H)=>q-H),$=Z[0];return b(Z)-$!==Z.length-1?null:$}function a_(Q){function z(Z){let $=[],X=Z.getOriginalParent();while(X!=null)$.push(X),X=X.getOriginalParent();return $}let J=0;for(let Z=0;ZX.length?[$,X]:[X,$];for(let Y of $)if(X.indexOf(Y)===-1)J++}return J}function o_(Q,z){switch(z){case"left":return Q.leftCols;case"right":return Q.rightCols;default:return Q.centerCols}}function e_(Q){let{movingCols:z,draggingRight:J,xPosition:Z,pinned:$,gos:X,colModel:Y,visibleCols:G}=Q;if(X.get("suppressMovableColumns")||z.some((M)=>M.getColDef().suppressMovable))return[];let H=o_(G,$),_=Y.getCols(),U=H.filter((M)=>z.includes(M)),W=H.filter((M)=>!z.includes(M)),B=_.filter((M)=>!z.includes(M)),E=0,K=Z;if(J){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 F=[L],D=(M,k)=>M-k;if(J){let M=L+1,k=_.length-1;while(M<=k)F.push(M),M++;F.sort(D)}else{let M=L,k=_.length-1,f=_[M];while(M<=k&&H.indexOf(f)<0)M++,F.push(M),f=_[M];M=L-1;let A=0;while(M>=A)F.push(M),M--;F.sort(D).reverse()}return F}function U5(Q){let{pinned:z,fromKeyboard:J,gos:Z,ctrlsSvc:$,useHeaderRow:X,skipScrollPadding:Y}=Q,G=$.getHeaderRowContainerCtrl(z)?.eViewport,{x:q}=Q;if(!G)return 0;if(J)q-=G.getBoundingClientRect().left;if(Z.get("enableRtl")){if(X)G=G.querySelector(".ag-header-row");q=G.clientWidth-q}if(z==null&&!Y)q+=$.get("center").getCenterViewportScrollLeft();return q}function c2(Q,z){for(let J of Q)J.moving=z,J.dispatchColEvent("movingChanged","uiColumnMoved")}var I7=7,W5=100,uJ=W5/2,QU=5,zU=100,JU=class extends j{constructor(Q){super();this.pinned=Q,this.needToMoveLeft=!1,this.needToMoveRight=!1,this.lastMovedInfo=null,this.isCenterContainer=!T(Q)}postConstruct(){this.beans.ctrlsSvc.whenReady(this,(Q)=>{this.gridBodyCon=Q.gridBodyCtrl})}getIconName(){let{pinned:Q,lastDraggingEvent:z}=this,{dragItem:J}=z||{},Z=J?.columns??[];for(let $ of Z){let X=$.getPinned();if($.getColDef().lockPinned){if(X==Q)return"move";continue}let Y=J?.containerType;if(Y===Q||!Q)return"move";if(Q&&(!X||Y!==Q))return"pinned"}return"notAllowed"}onDragEnter(Q){let z=Q.dragItem,J=z.columns;if(Q.dragSource.type===0)this.setColumnsVisible(J,!0,"uiColumnDragged");else{let $=z.visibleState,X=(J||[]).filter((Y)=>$[Y.getId()]&&!Y.isVisible());this.setColumnsVisible(X,!0,"uiColumnDragged")}if(!this.gos.get("suppressMoveWhenColumnDragging"))this.attemptToPinColumns(J,this.pinned);this.onDragging(Q,!0,!0)}onDragging(Q=this.lastDraggingEvent,z=!1,J=!1,Z=!1){let{gos:$,ctrlsSvc:X}=this.beans,Y=$.get("suppressMoveWhenColumnDragging");if(Z&&!Y){this.finishColumnMoving();return}if(this.lastDraggingEvent=Q,!Q||!Z&&n(Q.hDirection))return;let G=U5({x:Q.x,pinned:this.pinned,gos:$,ctrlsSvc:X});if(!z)this.checkCenterForScrolling(G);if(Y)this.handleColumnDragWhileSuppressingMovement(Q,z,J,G,Z);else this.handleColumnDragWhileAllowingMovement(Q,z,J,G,Z)}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(Q,z,J){if(!Q?.length)return;let Z=Q.filter(($)=>!$.getColDef().lockVisible);if(!Z.length)return;this.beans.colModel.setColsVisible(Z,z,J)}finishColumnMoving(){this.clearHighlighted();let Q=this.lastMovedInfo;if(!Q)return;let{columns:z,toIndex:J}=Q;this.beans.colMoves.moveColumns(z,J,"uiColumnMoved",!0)}updateDragItemContainerType(){let{lastDraggingEvent:Q}=this;if(this.gos.get("suppressMoveWhenColumnDragging")||!Q)return;let z=Q.dragItem;if(!z)return;z.containerType=this.pinned}handleColumnDragWhileSuppressingMovement(Q,z,J,Z,$){let X=this.getAllMovingColumns(Q,!0);if($){let Y=this.isAttemptingToPin(X);if(Y)this.attemptToPinColumns(X,void 0,!0);let{fromLeft:G,xPosition:q}=this.getNormalisedXPositionInfo(X,Y)||{};if(G==null||q==null){this.finishColumnMoving();return}this.moveColumnsAfterHighlight({allMovingColumns:X,xPosition:q,fromEnter:z,fakeEvent:J,fromLeft:G})}else{if(!this.beans.dragAndDrop.isDropZoneWithinThisGrid(Q))return;this.highlightHoveredColumn(X,Z)}}handleColumnDragWhileAllowingMovement(Q,z,J,Z,$){let X=this.getAllMovingColumns(Q),Y=this.normaliseDirection(Q.hDirection)==="right",G=Q.dragSource.type===1,q=this.getMoveColumnParams({allMovingColumns:X,isFromHeader:G,xPosition:Z,fromLeft:Y,fromEnter:z,fakeEvent:J}),H=B$({...q,finished:$});if(H)this.lastMovedInfo=H}getAllMovingColumns(Q,z=!1){let J=Q.dragSource.getDragItem(),Z=null;if(z){if(Z=J.columnsInSplit,!Z)Z=J.columns}else Z=J.columns;let $=(X)=>X.getColDef().lockPinned?X.getPinned()==this.pinned:!0;if(!Z)return[];return Z.filter($)}getMoveColumnParams(Q){let{allMovingColumns:z,isFromHeader:J,xPosition:Z,fromLeft:$,fromEnter:X,fakeEvent:Y}=Q,{gos:G,colModel:q,colMoves:H,visibleCols:_}=this.beans;return{allMovingColumns:z,isFromHeader:J,fromLeft:$,xPosition:Z,pinned:this.pinned,fromEnter:X,fakeEvent:Y,gos:G,colModel:q,colMoves:H,visibleCols:_}}highlightHoveredColumn(Q,z){let{gos:J,colModel:Z}=this.beans,$=J.get("enableRtl"),X=Z.getCols().filter((_)=>_.isVisible()&&_.getPinned()===this.pinned),Y=null,G=null,q=null;for(let _ of X){if(G=_.getActualWidth(),Y=this.getNormalisedColumnLeft(_,0,$),Y!=null){let U=Y+G;if(Y<=z&&U>=z){q=_;break}}Y=null,G=null}if(!q){for(let _=X.length-1;_>=0;_--){let U=X[_],W=X[_].getParent();if(!W){q=U;break}let B=W?.getDisplayedLeafColumns();if(B.length){q=b(B);break}}if(!q)return;Y=this.getNormalisedColumnLeft(q,0,$),G=q.getActualWidth()}else if(Q.indexOf(q)!==-1)q=null;if(q==null||Y==null||G==null){if(this.lastHighlightedColumn?.column!==q)this.clearHighlighted();return}let H;if(z-YI7;return z&&J||Q.some((Z)=>Z.getPinned()!==this.pinned)}moveColumnsAfterHighlight(Q){let{allMovingColumns:z,xPosition:J,fromEnter:Z,fakeEvent:$,fromLeft:X}=Q,Y=this.getMoveColumnParams({allMovingColumns:z,isFromHeader:!0,xPosition:J,fromLeft:X,fromEnter:Z,fakeEvent:$}),{columns:G,toIndex:q}=W$(Y)||{};if(G&&q!=null)this.lastMovedInfo={columns:G,toIndex:q};this.finishColumnMoving()}clearHighlighted(){let{lastHighlightedColumn:Q}=this;if(!Q)return;C7(Q.column,null),this.lastHighlightedColumn=null}checkCenterForScrolling(Q){if(!this.isCenterContainer)return;let z=this.beans.ctrlsSvc.get("center"),J=z.getCenterViewportScrollLeft(),Z=J+z.getCenterWidth(),$,X;if(this.gos.get("enableRtl"))$=QZ-uJ;else X=QZ-uJ;if(this.needToMoveRight=$,this.needToMoveLeft=X,X||$)this.ensureIntervalStarted();else this.ensureIntervalCleared()}ensureIntervalStarted(){if(this.movingIntervalId)return;this.intervalCount=0,this.failedMoveAttempts=0,this.movingIntervalId=window.setInterval(this.moveInterval.bind(this),zU),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 Q;if(this.intervalCount++,Q=10+this.intervalCount*QU,Q>W5)Q=W5;let z=null,J=this.gridBodyCon.scrollFeature;if(this.needToMoveLeft)z=J.scrollHorizontally(-Q);else if(this.needToMoveRight)z=J.scrollHorizontally(Q);if(z!==0)this.onDragging(this.lastDraggingEvent),this.failedMoveAttempts=0;else{this.failedMoveAttempts++;let{pinnedCols:Z,dragAndDrop:$,gos:X}=this.beans;if(this.failedMoveAttempts<=I7+1||!Z)return;if($.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(Q,z,J=!1){let Z=(Q||[]).filter((Y)=>!Y.getColDef().lockPinned);if(!Z.length)return 0;if(J)z=this.getPinDirection();let{pinnedCols:$,dragAndDrop:X}=this.beans;if($?.setColsPinned(Z,z,"uiColumnDragged"),J)X.nudge();return Z.length}destroy(){super.destroy(),this.lastDraggingEvent=null,this.clearHighlighted(),this.lastMovedInfo=null}};function C7(Q,z){if(Q.highlighted===z)return;Q.highlighted=z,Q.dispatchColEvent("headerHighlightChanged","uiColumnMoved")}function ZU(Q){let z=Q.length,J,Z;for(let $=0;${let $,X=Z.gridBodyCtrl.eBodyViewport;switch(J){case"left":$=[[X,Z.left.eContainer],[Z.bottomLeft.eContainer],[Z.topLeft.eContainer]];break;case"right":$=[[X,Z.right.eContainer],[Z.bottomRight.eContainer],[Z.topRight.eContainer]];break;default:$=[[X,Z.center.eViewport],[Z.bottomCenter.eViewport],[Z.topCenter.eViewport]];break}this.eSecondaryContainers=$}),this.moveColumnFeature=this.createManagedBean(new JU(J)),this.bodyDropPivotTarget=this.createManagedBean(new d_(J)),z.addDropTarget(this),this.addDestroyFunc(()=>z.removeDropTarget(this))}isInterestedIn(Q){return Q===1||Q===0&&this.gos.get("allowDragFromColumnsToolPanel")}getSecondaryContainers(){return this.eSecondaryContainers}getContainer(){return this.eContainer}getIconName(){return this.currentDropListener.getIconName()}isDropColumnInPivotMode(Q){return this.beans.colModel.isPivotMode()&&Q.dragSource.type===0}onDragEnter(Q){this.currentDropListener=this.isDropColumnInPivotMode(Q)?this.bodyDropPivotTarget:this.moveColumnFeature,this.currentDropListener.onDragEnter(Q)}onDragLeave(Q){this.currentDropListener.onDragLeave(Q)}onDragging(Q){this.currentDropListener.onDragging(Q)}onDragStop(Q){this.currentDropListener.onDragStop(Q)}onDragCancel(){this.currentDropListener.onDragCancel()}};function E$(Q,z){let J=[],Z=[],$=[];if(Q.forEach((Y)=>{let G=Y.getColDef().lockPosition;if(G==="right")$.push(Y);else if(G==="left"||G===!0)J.push(Y);else Z.push(Y)}),z.get("enableRtl"))return[...$,...Z,...J];return[...J,...Z,...$]}function K$(Q,z){let J=!0;return OQ(null,z,(Z)=>{if(!G0(Z))return;let $=Z;if(!$.getColGroupDef()?.marryChildren)return;let G=[];for(let W of $.getLeafColumns()){let B=Q.indexOf(W);G.push(B)}let q=Math.max.apply(Math,G),H=Math.min.apply(Math,G),_=q-H,U=$.getLeafColumns().length-1;if(_>U)J=!1}),J}var XU=class extends j{constructor(){super(...arguments);this.beanName="colMoves"}moveColumnByIndex(Q,z,J){let Z=this.beans.colModel.getCols();if(!Z)return;let $=Z[Q];this.moveColumns([$],z,J)}moveColumns(Q,z,J,Z=!0){let{colModel:$,colAnimation:X,visibleCols:Y,eventSvc:G}=this.beans,q=$.getCols();if(!q)return;if(z>q.length-Q.length){R(30,{toIndex:z});return}X?.start();let H=$.getColsForKeys(Q);if(this.doesMovePassRules(H,z))U7($.getCols(),H,z),Y.refresh(J),G.dispatchEvent({type:"columnMoved",columns:H,column:H.length===1?H[0]:null,toIndex:z,finished:Z,source:J});X?.finish()}doesMovePassRules(Q,z){let J=this.getProposedColumnOrder(Q,z);return this.doesOrderPassRules(J)}doesOrderPassRules(Q){let{colModel:z,gos:J}=this.beans;if(!K$(Q,z.getColTree()))return!1;if(!(($)=>{let X=(H)=>{if(!H)return 0;return H==="left"||H===!0?-1:1},Y=J.get("enableRtl"),G=Y?1:-1,q=!0;for(let H of $){let _=X(H.getColDef().lockPosition);if(Y){if(_>G)q=!1}else if(_G?"hide":"notAllowed",getDragItem:q?()=>qU(z,Y.allCols):()=>GU(z),dragItemName:J,onDragStarted:()=>{G=!Z.get("suppressDragLeaveHidesColumns"),c2(H,!0)},onDragStopped:()=>c2(H,!1),onDragCancelled:()=>c2(H,!1),onGridEnter:(W)=>{if(G){let{columns:B=[],visibleState:E}=W??{},K=q?(F)=>!E||E[F.getColId()]:()=>!0,L=B.filter((F)=>!F.getColDef().lockVisible&&K(F));$.setColsVisible(L,!0,"uiColumnMoved")}},onGridExit:(W)=>{if(G){let B=W?.columns?.filter((E)=>!E.getColDef().lockVisible)||[];$.setColsVisible(B,!1,"uiColumnMoved")}}};return X.addDragSource(U,!0),U}};function YU(Q,z){while(Q){if(Q.getGroupId()===z)return Q;Q=Q.getParent()}return}function GU(Q){let z={};return z[Q.getId()]=Q.isVisible(),{columns:[Q],visibleState:z,containerType:Q.pinned}}function qU(Q,z){let J=Q.getProvidedColumnGroup().getLeafColumns(),Z={};for(let G of J)Z[G.getId()]=G.isVisible();let $=[];for(let G of z)if(J.indexOf(G)>=0)$.push(G),$0(J,G);for(let G of J)$.push(G);let X=[],Y=Q.getLeafColumns();for(let G of $)if(Y.indexOf(G)!==-1)X.push(G);return{columns:$,columnsInSplit:X,visibleState:Z,containerType:X[0]?.pinned}}var FJ={moduleName:"ColumnMove",version:p,beans:[XU,p_],apiFunctions:{moveColumnByIndex:i_,moveColumns:n_},dependsOn:[LJ],css:[c_]},HU=class extends j{constructor(){super(...arguments);this.beanName="autoWidthCalc"}postConstruct(){this.beans.ctrlsSvc.whenReady(this,(Q)=>{this.centerRowContainerCtrl=Q.center})}getPreferredWidthForColumn(Q,z){let J=this.getHeaderCellForColumn(Q);if(!J)return-1;let Z=this.beans.rowRenderer.getAllCellsNotSpanningForColumn(Q);if(!z)Z.push(J);return this.getPreferredWidthForElements(Z)}getPreferredWidthForColumnGroup(Q){let z=this.getHeaderCellForColumn(Q);if(!z)return-1;return this.getPreferredWidthForElements([z])}getPreferredWidthForElements(Q,z){let J=document.createElement("form");J.style.position="fixed";let Z=this.centerRowContainerCtrl.eContainer;for(let X of Q)this.cloneItemIntoDummy(X,J);Z.appendChild(J);let $=Math.ceil(J.getBoundingClientRect().width);return J.remove(),z=z??this.gos.get("autoSizePadding"),$+z}getHeaderCellForColumn(Q){let z=null;for(let J of this.beans.ctrlsSvc.getHeaderRowContainerCtrls()){let Z=J.getHtmlElementForColumnHeader(Q);if(Z!=null)z=Z}return z}cloneItemIntoDummy(Q,z){let J=Q.cloneNode(!0);J.style.width="",J.style.position="static",J.style.left="";let Z=document.createElement("div"),$=Z.classList;if(["ag-header-cell","ag-header-group-cell"].some((G)=>J.classList.contains(G)))$.add("ag-header","ag-header-row"),Z.style.position="static";else $.add("ag-row");let Y=Q.parentElement;while(Y){if(["ag-header-row","ag-row"].some((q)=>Y.classList.contains(q))){for(let q=0;qX.getPinned());Q.dispatchEvent({type:"columnPinned",pinned:$!=null?$:null,columns:z,column:Z,source:J})}function UU(Q,z,J){if(!z.length)return;let Z=z.length===1?z[0]:null,$=F$(z,(X)=>X.isVisible());Q.dispatchEvent({type:"columnVisible",visible:$,columns:z,column:Z,source:J})}function M$(Q,z,J,Z){Q.dispatchEvent({type:z,columns:J,column:J&&J.length==1?J[0]:null,source:Z})}function L1(Q,z,J,Z,$=null){if(z?.length)Q.dispatchEvent({type:"columnResized",columns:z,column:z.length===1?z[0]:null,flexColumns:$,finished:J,source:Z})}var WU=class extends j{constructor(Q,z,J,Z){super();this.comp=Q,this.eResize=z,this.pinned=J,this.columnGroup=Z}postConstruct(){if(!this.columnGroup.isResizable()){this.comp.setResizableDisplayed(!1);return}let{horizontalResizeSvc:Q,gos:z,colAutosize:J}=this.beans,Z=Q.addResizeBar({eResizeBar:this.eResize,onResizeStart:this.onResizeStart.bind(this),onResizing:this.onResizing.bind(this,!1),onResizeEnd:this.onResizing.bind(this,!0)});if(this.addDestroyFunc(Z),!z.get("suppressAutoSize")&&J)this.addDestroyFunc(J.addColumnGroupResize(this.eResize,this.columnGroup,()=>this.resizeLeafColumnsToFit("uiColumnResized")))}onResizeStart(Q){let{columnsToResize:z,resizeStartWidth:J,resizeRatios:Z,groupAfterColumns:$,groupAfterStartWidth:X,groupAfterRatios:Y}=this.getInitialValues(Q);this.resizeCols=z,this.resizeStartWidth=J,this.resizeRatios=Z,this.resizeTakeFromCols=$,this.resizeTakeFromStartWidth=X,this.resizeTakeFromRatios=Y,this.toggleColumnResizing(!0)}onResizing(Q,z,J="uiColumnResized"){let Z=this.normaliseDragChange(z),$=this.resizeStartWidth+Z;this.resizeColumnsFromLocalValues($,J,Q)}getInitialValues(Q){let z=(q)=>q.reduce((H,_)=>H+_.getActualWidth(),0),J=(q,H)=>q.map((_)=>_.getActualWidth()/H),Z=this.getColumnsToResize(),$=z(Z),X=J(Z,$),Y={columnsToResize:Z,resizeStartWidth:$,resizeRatios:X},G=null;if(Q)G=this.beans.colGroupSvc?.getGroupAtDirection(this.columnGroup,"After")??null;if(G){let q=G.getDisplayedLeafColumns(),H=Y.groupAfterColumns=q.filter((U)=>U.isResizable()),_=Y.groupAfterStartWidth=z(H);Y.groupAfterRatios=J(H,_)}else Y.groupAfterColumns=void 0,Y.groupAfterStartWidth=void 0,Y.groupAfterRatios=void 0;return Y}resizeLeafColumnsToFit(Q){let z=this.beans.autoWidthCalc.getPreferredWidthForColumnGroup(this.columnGroup),J=this.getInitialValues();if(z>J.resizeStartWidth)this.resizeColumns(J,z,Q,!0)}resizeColumnsFromLocalValues(Q,z,J=!0){if(!this.resizeCols||!this.resizeRatios)return;let Z={columnsToResize:this.resizeCols,resizeStartWidth:this.resizeStartWidth,resizeRatios:this.resizeRatios,groupAfterColumns:this.resizeTakeFromCols,groupAfterStartWidth:this.resizeTakeFromStartWidth,groupAfterRatios:this.resizeTakeFromRatios};this.resizeColumns(Z,Q,z,J)}resizeColumns(Q,z,J,Z=!0){let{columnsToResize:$,resizeStartWidth:X,resizeRatios:Y,groupAfterColumns:G,groupAfterStartWidth:q,groupAfterRatios:H}=Q,_=[];if(_.push({columns:$,ratios:Y,width:z}),G){let U=z-X;_.push({columns:G,ratios:H,width:q-U})}if(this.beans.colResize?.resizeColumnSets({resizeSets:_,finished:Z,source:J}),Z)this.toggleColumnResizing(!1)}toggleColumnResizing(Q){this.comp.toggleCss("ag-column-resizing",Q)}getColumnsToResize(){return this.columnGroup.getDisplayedLeafColumns().filter((z)=>z.isResizable())}normaliseDragChange(Q){let z=Q;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}},BU=class extends j{constructor(Q,z,J,Z,$){super();this.pinned=Q,this.column=z,this.eResize=J,this.comp=Z,this.ctrl=$}postConstruct(){let Q=[],z,J,Z=()=>{if(N(this.eResize,z),!z)return;let{horizontalResizeSvc:Y,colAutosize:G}=this.beans,q=Y.addResizeBar({eResizeBar:this.eResize,onResizeStart:this.onResizeStart.bind(this),onResizing:this.onResizing.bind(this,!1),onResizeEnd:this.onResizing.bind(this,!0)});if(Q.push(q),J&&G)Q.push(G.addColumnAutosizeListeners(this.eResize,this.column))},$=()=>{for(let Y of Q)Y();Q.length=0},X=()=>{let Y=this.column.isResizable(),G=!this.gos.get("suppressAutoSize")&&!this.column.getColDef().suppressAutoSize;if(Y!==z||G!==J)z=Y,J=G,$(),Z()};X(),this.addDestroyFunc($),this.ctrl.setRefreshFunction("resize",X)}onResizing(Q,z){let{column:J,lastResizeAmount:Z,resizeStartWidth:$,beans:X}=this,Y=this.normaliseResizeAmount(z),G=$+Y,q=[{key:J,newWidth:G}],{pinnedCols:H,ctrlsSvc:_,colResize:U}=X;if(this.column.getPinned()){let W=H?.leftWidth??0,B=H?.rightWidth??0,E=xz(_.getGridBodyCtrl().eBodyViewport)-50;if(W+B+(Y-Z)>E)return}if(this.lastResizeAmount=Y,U?.setColumnWidths(q,this.resizeWithShiftKey,Q,"uiColumnResized"),Q)this.toggleColumnResizing(!1)}onResizeStart(Q){this.resizeStartWidth=this.column.getActualWidth(),this.lastResizeAmount=0,this.resizeWithShiftKey=Q,this.toggleColumnResizing(!0)}toggleColumnResizing(Q){this.column.resizing=Q,this.comp.toggleCss("ag-column-resizing",Q)}normaliseResizeAmount(Q){let z=Q,J=this.pinned!=="left",Z=this.pinned==="right";if(this.gos.get("enableRtl")){if(J)z*=-1}else if(Z)z*=-1;return z}},EU=class extends j{constructor(){super(...arguments);this.beanName="colResize"}setColumnWidths(Q,z,J,Z){let $=[],{colModel:X,gos:Y,visibleCols:G}=this.beans;for(let q of Q){let H=X.getColDefCol(q.key)||X.getCol(q.key);if(!H)continue;if($.push({width:q.newWidth,ratios:[1],columns:[H]}),Y.get("colResizeDefault")==="shift")z=!z;if(z){let U=G.getColAfter(H);if(!U)continue;let W=H.getActualWidth()-q.newWidth,B=U.getActualWidth()+W;$.push({width:B,ratios:[1],columns:[U]})}}if($.length===0)return;this.resizeColumnSets({resizeSets:$,finished:J,source:Z})}resizeColumnSets(Q){let{resizeSets:z,finished:J,source:Z}=Q;if(!(!z||z.every((_)=>KU(_)))){if(J){let _=z&&z.length>0?z[0].columns:null;L1(this.eventSvc,_,J,Z)}return}let X=[],Y=[];for(let _ of z){let{width:U,columns:W,ratios:B}=_,E={},K={};for(let D of W)Y.push(D);let L=!0,F=0;while(L){if(F++,F>1000){e(31);break}L=!1;let D=[],M=0,k=U;W.forEach((A,O)=>{if(K[A.getId()])k-=E[A.getId()];else{D.push(A);let I=B[O];M+=I}});let f=1/M;D.forEach((A,O)=>{let v=O===D.length-1,I;if(v)I=k;else I=Math.round(B[O]*U*f),k-=I;let C=A.getMinWidth(),m=A.getMaxWidth();if(I0&&I>m)I=m,K[A.getId()]=!0,L=!0;E[A.getId()]=I})}for(let D of W){let M=E[D.getId()];if(D.getActualWidth()!==M)D.setActualWidth(M,Z),X.push(D)}}let G=X.length>0,q=[];if(G){let{colFlex:_,visibleCols:U,colViewport:W}=this.beans;q=_?.refreshFlexedColumns({resizingCols:Y,skipSetLeft:!0})??[],U.setLeftValues(Z),U.updateBodyWidths(),W.checkViewportColumns()}let H=Y.concat(q);if(G||J)L1(this.eventSvc,H,J,Z,q)}resizeHeader(Q,z,J){if(!Q.isResizable())return;let Z=Q.getActualWidth(),$=Q.getMinWidth(),X=Q.getMaxWidth(),Y=Math.min(Math.max(Z+z,$),X);this.setColumnWidths([{key:Q,newWidth:Y}],J,!0,"uiColumnResized")}createResizeFeature(Q,z,J,Z,$){return new BU(Q,z,J,Z,$)}createGroupResizeFeature(Q,z,J,Z){return new WU(Q,z,J,Z)}};function KU(Q){let{columns:z,width:J}=Q,Z=0,$=0,X=!0;for(let q of z){let H=q.getMinWidth();Z+=H||0;let _=q.getMaxWidth();if(_>0)$+=_;else X=!1}let Y=J>=Z,G=!X||J<=$;return Y&&G}var LU={moduleName:"ColumnResize",version:p,beans:[EU],apiFunctions:{setColumnWidths:_U},dependsOn:[B6,L$]},FU=class extends j{constructor(Q,z){super();this.removeChildListenersFuncs=[],this.columnGroup=z,this.comp=Q}postConstruct(){this.addListenersToChildrenColumns(),this.addManagedListeners(this.columnGroup,{displayedChildrenChanged:this.onDisplayedChildrenChanged.bind(this)}),this.onWidthChanged(),this.addDestroyFunc(this.removeListenersOnChildrenColumns.bind(this))}addListenersToChildrenColumns(){this.removeListenersOnChildrenColumns();let Q=this.onWidthChanged.bind(this);for(let z of this.columnGroup.getLeafColumns())z.__addEventListener("widthChanged",Q),z.__addEventListener("visibleChanged",Q),this.removeChildListenersFuncs.push(()=>{z.__removeEventListener("widthChanged",Q),z.__removeEventListener("visibleChanged",Q)})}removeListenersOnChildrenColumns(){for(let Q of this.removeChildListenersFuncs)Q();this.removeChildListenersFuncs=[]}onDisplayedChildrenChanged(){this.addListenersToChildrenColumns(),this.onWidthChanged()}onWidthChanged(){let Q=this.columnGroup.getActualWidth();this.comp.setWidth(`${Q}px`),this.comp.toggleCss("ag-hidden",Q===0)}},DU=class extends Y6{constructor(){super(...arguments);this.onSuppressColMoveChange=()=>{if(!this.isAlive()||this.isSuppressMoving())this.removeDragSource();else if(!this.dragSource)this.setDragSource(this.eGui)}}wireComp(Q,z,J,Z,$){let{column:X,beans:Y}=this,{context:G,colNames:q,colHover:H,rangeSvc:_,colResize:U}=Y;this.comp=Q,$=BJ(this,G,$),this.setGui(z,$),this.displayName=q.getDisplayNameForColumnGroup(X,"header"),this.refreshHeaderStyles(),this.addClasses(),this.setupMovingCss($),this.setupExpandable($),this.setupTooltip(),this.refreshAnnouncement(),this.setupAutoHeight({wrapperElement:Z,compBean:$}),this.setupUserComp(),this.addHeaderMouseListeners($,Z),this.addManagedPropertyListener("groupHeaderHeight",this.refreshMaxHeaderHeight.bind(this)),this.refreshMaxHeaderHeight();let W=this.rowCtrl.pinned,B=X.getProvidedColumnGroup().getLeafColumns();if(H?.createHoverFeature($,B,z),_?.createRangeHighlightFeature($,X,Q),$.createManagedBean(new X6(X,z,Y)),$.createManagedBean(new FU(Q,X)),U)this.resizeFeature=$.createManagedBean(U.createGroupResizeFeature(Q,J,W,X));else Q.setResizableDisplayed(!1);$.createManagedBean(new cQ(z,{shouldStopEventPropagation:this.shouldStopEventPropagation.bind(this),onTabKeyDown:()=>{return},handleKeyDown:this.handleKeyDown.bind(this),onFocusIn:this.onFocusIn.bind(this)})),this.addHighlightListeners($,B),this.addManagedEventListeners({cellSelectionChanged:()=>this.refreshAnnouncement()}),$.addManagedPropertyListener("suppressMovableColumns",this.onSuppressColMoveChange),this.addResizeAndMoveKeyboardListeners($),$.addDestroyFunc(()=>this.clearComponent())}getHeaderClassParams(){let{column:Q,beans:z}=this,J=Q.getDefinition();return y(z.gos,{colDef:J,columnGroup:Q,floatingFilter:!1})}refreshMaxHeaderHeight(){let{gos:Q,comp:z}=this,J=Q.get("groupHeaderHeight");if(J!=null)if(J===0)z.setHeaderWrapperHidden(!0);else z.setHeaderWrapperMaxHeight(J);else z.setHeaderWrapperHidden(!1),z.setHeaderWrapperMaxHeight(null)}addHighlightListeners(Q,z){if(!this.beans.gos.get("suppressMoveWhenColumnDragging"))return;for(let J of z)Q.addManagedListeners(J,{headerHighlightChanged:this.onLeafColumnHighlightChanged.bind(this,J)})}onLeafColumnHighlightChanged(Q){let z=this.column.getDisplayedLeafColumns(),J=z[0]===Q,Z=b(z)===Q;if(!J&&!Z)return;let $=Q.getHighlighted(),X=!!this.rowCtrl.getHeaderCellCtrls().find((q)=>{return q.column.isMoving()}),Y=!1,G=!1;if(X){let q=this.beans.gos.get("enableRtl"),H=$===1,_=$===0;if(J)if(q)G=H;else Y=_;if(Z)if(q)Y=_;else G=H}this.comp.toggleCss("ag-header-highlight-before",Y),this.comp.toggleCss("ag-header-highlight-after",G)}resizeHeader(Q,z){let{resizeFeature:J}=this;if(!J)return;let Z=J.getInitialValues(z);J.resizeColumns(Z,Z.resizeStartWidth+Q,"uiColumnResized",!0)}resizeLeafColumnsToFit(Q){this.resizeFeature?.resizeLeafColumnsToFit(Q)}setupUserComp(){let{colGroupSvc:Q,userCompFactory:z,gos:J,enterpriseMenuFactory:Z}=this.beans,$=this.column,X=$.getProvidedColumnGroup(),Y=y(J,{displayName:this.displayName,columnGroup:$,setExpanded:(q)=>{Q.setColumnGroupOpened(X,q,"gridInitializing")},setTooltip:(q,H)=>{J.assertModuleRegistered("Tooltip",3),this.setupTooltip(q,H)},showColumnMenu:(q,H)=>Z?.showMenuAfterButtonClick(X,q,"columnMenu",H),showColumnMenuAfterMouseClick:(q,H)=>Z?.showMenuAfterMouseEvent(X,q,"columnMenu",H),eGridHeader:this.eGui}),G=Iq(z,Y);if(G)this.comp.setUserCompDetails(G)}addHeaderMouseListeners(Q,z){let{column:J,comp:Z,beans:{rangeSvc:$},gos:X}=this,Y=(_)=>this.handleMouseOverChange(_.type==="mouseenter"),G=()=>this.dispatchColumnMouseEvent("columnHeaderClicked",J.getProvidedColumnGroup()),q=(_)=>this.handleContextMenuMouseEvent(_,void 0,J.getProvidedColumnGroup());Q.addManagedListeners(this.eGui,{mouseenter:Y,mouseleave:Y,click:G,contextmenu:q}),Z.toggleCss("ag-header-group-cell-selectable",Zz(X));let H=$?.createHeaderGroupCellMouseListenerFeature(this.column,z);if(H)this.createManagedBean(H)}handleMouseOverChange(Q){this.eventSvc.dispatchEvent({type:Q?"columnHeaderMouseOver":"columnHeaderMouseLeave",column:this.column.getProvidedColumnGroup()})}setupTooltip(Q,z){this.tooltipFeature=this.beans.tooltipSvc?.setupHeaderGroupTooltip(this.tooltipFeature,this,Q,z)}setupExpandable(Q){let z=this.column.getProvidedColumnGroup();this.refreshExpanded();let J=this.refreshExpanded.bind(this);Q.addManagedListeners(z,{expandedChanged:J,expandableChanged:J})}refreshExpanded(){let{column:Q}=this;this.expandable=Q.isExpandable();let z=Q.isExpanded();if(this.expandable)this.comp.setAriaExpanded(z?"true":"false");else this.comp.setAriaExpanded(void 0);this.refreshHeaderStyles()}addClasses(){let{column:Q}=this,z=Q.getColGroupDef(),J=gZ(z,this.gos,null,Q);if(Q.isPadding()){if(J.push("ag-header-group-cell-no-group"),Q.getLeafColumns().every(($)=>$.isSpanHeaderHeight()))J.push("ag-header-span-height")}else if(J.push("ag-header-group-cell-with-group"),z?.wrapHeaderText)J.push("ag-header-cell-wrap-text");for(let Z of J)this.comp.toggleCss(Z,!0)}setupMovingCss(Q){let{column:z}=this,Z=z.getProvidedColumnGroup().getLeafColumns(),$=()=>this.comp.toggleCss("ag-header-cell-moving",z.isMoving());for(let X of Z)Q.addManagedListeners(X,{movingChanged:$});$()}onFocusIn(Q){if(!this.eGui.contains(Q.relatedTarget))this.focusThis(),this.announceAriaDescription()}handleKeyDown(Q){if(super.handleKeyDown(Q),!this.getWrapperHasFocus())return;let{column:J,expandable:Z,gos:$,beans:X}=this,Y=Zz($);if(Q.key!=V.ENTER)return;if(Y&&!Q.altKey)X.rangeSvc?.handleColumnSelection(J,Q);else if(Z){let G=!J.isExpanded();X.colGroupSvc.setColumnGroupOpened(J.getProvidedColumnGroup(),G,"uiColumnExpanded")}}refreshAnnouncement(){let Q,{gos:z}=this;if(Zz(z))Q=this.getLocaleTextFunc()("ariaColumnGroupCellSelection","Press Enter to toggle selection for all visible cells in this column group");this.ariaAnnouncement=Q}announceAriaDescription(){let{beans:Q,eGui:z,ariaAnnouncement:J}=this;if(!J||!z.contains(d(Q)))return;Q.ariaAnnounce?.announceValue(J,"columnHeader")}setDragSource(Q){if(!this.isAlive()||this.isSuppressMoving())return;if(this.removeDragSource(),!Q)return;this.dragSource=this.beans.colMoves?.setDragSourceForHeader(Q,this.column,this.displayName)??null}isSuppressMoving(){return this.gos.get("suppressMovableColumns")||this.column.getLeafColumns().some((Q)=>Q.getColDef().suppressMovable||Q.getColDef().lockPosition)}destroy(){this.tooltipFeature=this.destroyBean(this.tooltipFeature),super.destroy()}};function MU(Q,z,J){Q.colGroupSvc?.setColumnGroupOpened(z,J,"api")}function kU(Q,z,J){return Q.colGroupSvc?.getColumnGroup(z,J)??null}function VU(Q,z){return Q.colGroupSvc?.getProvidedColGroup(z)??null}function fU(Q,z,J){return Q.colNames.getDisplayNameForColumnGroup(z,J)||""}function AU(Q){return Q.colGroupSvc?.getColumnGroupState()??[]}function jU(Q,z){Q.colGroupSvc?.setColumnGroupState(z,"api")}function RU(Q){Q.colGroupSvc?.resetColumnGroupState("api")}function SU(Q){return Q.visibleCols.treeLeft}function OU(Q){return Q.visibleCols.treeCenter}function PU(Q){return Q.visibleCols.treeRight}function TU(Q){return Q.visibleCols.getAllTrees()}var k$=class{constructor(){this.existingIds={}}getInstanceIdForKey(Q){let z=this.existingIds[Q],J;if(typeof z!=="number")J=0;else J=z+1;return this.existingIds[Q]=J,J}};function vU(Q,z){for(let J=0;J=0)Q[Z]=Q[Q.length-1],Q.pop()}}var IU=class extends j{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(Q,z=!1){let{colFlex:J,colModel:Z,colGroupSvc:$,colViewport:X,selectionColSvc:Y}=this.beans;if(!z)this.buildTrees(Z,$);$?.updateOpenClosedVisibility(),this.leftCols=p2(this.treeLeft),this.centerCols=p2(this.treeCenter),this.rightCols=p2(this.treeRight),Y?.refreshVisibility(this.leftCols,this.centerCols,this.rightCols),this.joinColsAriaOrder(Z),this.joinCols(),this.headerGroupRowCount=this.getHeaderRowCount(),this.setLeftValues(Q),this.autoHeightCols=this.allCols.filter((G)=>G.isAutoHeight()),J?.refreshFlexedColumns(),this.updateBodyWidths(),this.setFirstRightAndLastLeftPinned(Z,this.leftCols,this.rightCols,Q),X.checkViewportColumns(!1),this.eventSvc.dispatchEvent({type:"displayedColumnsChanged",source:Q})}getHeaderRowCount(){if(!this.gos.get("hidePaddedHeaderRows"))return this.beans.colModel.cols.treeDepth;let Q=0;for(let z of this.allCols){let J=z.getParent();while(J){if(!J.isPadding()){let Z=J.getProvidedColumnGroup().getLevel()+1;if(Z>Q)Q=Z;break}J=J.getParent()}}return Q}updateBodyWidths(){let Q=NQ(this.centerCols),z=NQ(this.leftCols),J=NQ(this.rightCols);if(this.isBodyWidthDirty=this.bodyWidth!==Q,this.bodyWidth!==Q||this.leftWidth!==z||this.rightWidth!==J)this.bodyWidth=Q,this.leftWidth=z,this.rightWidth=J,this.eventSvc.dispatchEvent({type:"columnContainerWidthChanged"}),this.eventSvc.dispatchEvent({type:"displayedColumnsWidthChanged"})}setLeftValues(Q){this.setLeftValuesOfCols(Q),this.setLeftValuesOfGroups()}setFirstRightAndLastLeftPinned(Q,z,J,Z){let $,X;if(this.gos.get("enableRtl"))$=z?z[0]:null,X=J?b(J):null;else $=z?b(z):null,X=J?J[0]:null;for(let Y of Q.getCols())Y.setLastLeftPinned(Y===$,Z),Y.setFirstRightPinned(Y===X,Z)}buildTrees(Q,z){let J=Q.getColsToShow(),Z=J.filter((q)=>q.getPinned()=="left"),$=J.filter((q)=>q.getPinned()=="right"),X=J.filter((q)=>q.getPinned()!="left"&&q.getPinned()!="right"),Y=new k$,G=(q)=>{return z?z.createColumnGroups(q):q.columns};this.treeLeft=G({columns:Z,idCreator:Y,pinned:"left",oldDisplayedGroups:this.treeLeft}),this.treeRight=G({columns:$,idCreator:Y,pinned:"right",oldDisplayedGroups:this.treeRight}),this.treeCenter=G({columns:X,idCreator:Y,pinned:null,oldDisplayedGroups:this.treeCenter}),this.updateColsAndGroupsMap()}clear(){this.leftCols=[],this.rightCols=[],this.centerCols=[],this.allCols=[],this.ariaOrderColumns=[]}joinColsAriaOrder(Q){let z=Q.getCols(),J=[],Z=[],$=[];for(let X of z){let Y=X.getPinned();if(!Y)Z.push(X);else if(Y===!0||Y==="left")J.push(X);else $.push(X)}this.ariaOrderColumns=J.concat(Z).concat($)}getAriaColIndex(Q){let z;if(_0(Q))z=Q.getLeafColumns()[0];else z=Q;return this.ariaOrderColumns.indexOf(z)+1}setLeftValuesOfGroups(){for(let Q of[this.treeLeft,this.treeRight,this.treeCenter])for(let z of Q)if(_0(z))z.checkLeft()}setLeftValuesOfCols(Q){let{colModel:z}=this.beans;if(!z.getColDefCols())return;let Z=z.getCols().slice(0),$=this.gos.get("enableRtl");for(let X of[this.leftCols,this.rightCols,this.centerCols]){if($){let Y=NQ(X);for(let G of X)Y-=G.getActualWidth(),G.setLeft(Y,Q)}else{let Y=0;for(let G of X)G.setLeft(Y,Q),Y+=G.getActualWidth()}vU(Z,X)}for(let X of Z)X.setLeft(null,Q)}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(Q){return this.allCols.indexOf(Q)>=0}getLeftColsForRow(Q){let{leftCols:z,beans:{colModel:J}}=this;if(!J.colSpanActive)return z;return this.getColsForRow(Q,z)}getRightColsForRow(Q){let{rightCols:z,beans:{colModel:J}}=this;if(!J.colSpanActive)return z;return this.getColsForRow(Q,z)}getColsForRow(Q,z,J,Z){let $=[],X=null;for(let Y=0;Y1){let W=H-1;for(let B=1;B<=W;B++)_.push(z[Y+B]);Y+=W}let U;if(J){U=!1;for(let W of _)if(J(W))U=!0}else U=!0;if(U){if($.length===0&&X){if(Z?Z(G):!1)$.push(X)}$.push(G)}X=G}return $}getContainerWidth(Q){switch(Q){case"left":return this.leftWidth;case"right":return this.rightWidth;default:return this.bodyWidth}}getColBefore(Q){let z=this.allCols,J=z.indexOf(Q);if(J>0)return z[J-1];return null}isPinningLeft(){return this.leftCols.length>0}isPinningRight(){return this.rightCols.length>0}updateColsAndGroupsMap(){this.colsAndGroupsMap={};let Q=(z)=>{this.colsAndGroupsMap[z.getUniqueId()]=z};yz(this.treeCenter,!1,Q),yz(this.treeLeft,!1,Q),yz(this.treeRight,!1,Q)}isVisible(Q){return this.colsAndGroupsMap[Q.getUniqueId()]===Q}getFirstColumn(){let Q=this.gos.get("enableRtl"),z=["leftCols","centerCols","rightCols"];if(Q)z.reverse();for(let J=0;J{if(JQ(J))z.push(J)}),z}var CU=class extends j{constructor(){super(...arguments);this.beanName="colGroupSvc"}getColumnGroupState(){let Q=[],z=this.beans.colModel.getColTree();return OQ(null,z,(J)=>{if(G0(J))Q.push({groupId:J.getGroupId(),open:J.isExpanded()})}),Q}resetColumnGroupState(Q){let z=this.beans.colModel.getColDefColTree();if(!z)return;let J=[];OQ(null,z,(Z)=>{if(G0(Z)){let $=Z.getColGroupDef(),X={groupId:Z.getGroupId(),open:!$?void 0:$.openByDefault};J.push(X)}}),this.setColumnGroupState(J,Q)}setColumnGroupState(Q,z){let{colModel:J,colAnimation:Z,visibleCols:$,eventSvc:X}=this.beans;if(!J.getColTree().length)return;Z?.start();let G=[];for(let q of Q){let{groupId:H,open:_}=q,U=this.getProvidedColGroup(H);if(!U)continue;if(U.isExpanded()===_)continue;U.setExpanded(_),G.push(U)}if($.refresh(z,!0),G.length)X.dispatchEvent({type:"columnGroupOpened",columnGroup:G.length===1?G[0]:void 0,columnGroups:G});Z?.finish()}setColumnGroupOpened(Q,z,J){let Z;if(G0(Q))Z=Q.getId();else Z=Q||"";this.setColumnGroupState([{groupId:Z,open:z}],J)}getProvidedColGroup(Q){let z=null;return OQ(null,this.beans.colModel.getColTree(),(J)=>{if(G0(J)){if(J.getId()===Q)z=J}}),z}getGroupAtDirection(Q,z){let J=Q.getProvidedColumnGroup().getLevel()+Q.getPaddingLevel(),Z=Q.getDisplayedLeafColumns(),$=z==="After"?b(Z):Z[0],X=`getCol${z}`;while(!0){let Y=this.beans.visibleCols[X]($);if(!Y)return null;let G=this.getColGroupAtLevel(Y,J);if(G!==Q)return G}}getColGroupAtLevel(Q,z){let J=Q.getParent(),Z,$;while(!0){if(Z=J.getProvidedColumnGroup().getLevel(),$=J.getPaddingLevel(),Z+$<=z)break;J=J.getParent()}return J}updateOpenClosedVisibility(){let Q=this.beans.visibleCols.getAllTrees();yz(Q,!1,(z)=>{if(_0(z))z.calculateDisplayedColumns()})}getColumnGroup(Q,z){if(!Q)return null;if(_0(Q))return Q;let J=this.beans.visibleCols.getAllTrees(),Z=typeof z==="number",$=null;return yz(J,!1,(X)=>{if(_0(X)){let Y=X,G;if(Z)G=Q===Y.getGroupId()&&z===Y.getPartId();else G=Q===Y.getGroupId();if(G)$=Y}}),$}createColumnGroups(Q){let{columns:z,idCreator:J,pinned:Z,oldDisplayedGroups:$,isStandaloneStructure:X}=Q,Y=this.mapOldGroupsById($),G=[],q=z;while(q.length){let H=q;q=[];let _=0,U=(W)=>{let B=_;_=W;let E=H[B],L=(_0(E)?E.getProvidedColumnGroup():E).getOriginalParent();if(L==null){for(let D=B;DG0(_))){q.setChildren([Y]);continue}else{q.setChildren(Q);break}$.push(Y)}}return $}findDepth(Q){let z=0,J=Q;while(J?.[0]&&G0(J[0]))z++,J=J[0].getChildren();return z}findMaxDepth(Q,z){let J=z;for(let Z=0;Z=0;X--){let Y=new Cz(null,`FAKE_PATH_${Z.getId()}_${X}`,!0,X);this.createBean(Y),Y.setChildren([$]),$.originalParent=Y,$=Y}if(z===0)Z.originalParent=null;J.push($)}return J}findExistingGroup(Q,z){if(Q.groupId==null)return;for(let Z=0;Z{for(let $ of Z)if(_0($)){let X=$;z[$.getUniqueId()]=X,J(X.getChildren())}};if(Q)J(Q);return z}setupParentsIntoCols(Q,z){for(let J of Q??[]){if(J.parent!==z)this.beans.colViewport.colsWithinViewportHash="";if(J.parent=z,_0(J)){let Z=J;this.setupParentsIntoCols(Z.getChildren(),Z)}}}},E6={moduleName:"ColumnGroup",version:p,dynamicBeans:{headerGroupCellCtrl:DU},beans:[CU],apiFunctions:{getAllDisplayedColumnGroups:TU,getCenterDisplayedColumnGroups:OU,getColumnGroup:kU,getColumnGroupState:AU,getDisplayNameForColumnGroup:fU,getLeftDisplayedColumnGroups:SU,getProvidedColumnGroup:VU,getRightDisplayedColumnGroups:PU,resetColumnGroupState:RU,setColumnGroupOpened:MU,setColumnGroupState:jU}};function n0(Q,z,J){let{colModel:Z,rowGroupColsSvc:$,pivotColsSvc:X,autoColSvc:Y,selectionColSvc:G,colAnimation:q,visibleCols:H,pivotResultCols:_,environment:U,valueColsSvc:W,eventSvc:B,gos:E}=Q,K=Z.getColDefCols()??[],L=G?.getColumns();if(!K.length&&!L?.length)return!1;if(z?.state&&!z.state.forEach)return R(32),!1;let F=(f,A,O,v,I)=>{if(!f)return;let C=Jq(A,z.defaultState),m=C("flex").value1,w=C("sort").value1,a=C("sortType").value1,t=$z(w)||m5(a),u=LQ(a),Q0=IZ(w),r=t?{type:u,direction:Q0}:void 0;if(F9(Q,f,C("hide").value1,r,C("sortIndex").value1,C("pinned").value1,m,J),m==null){let S0=C("width").value1;if(S0!=null){let O0=f.getColDef().minWidth??U.getDefaultColumnMinWidth();if(O0!=null&&S0>=O0)f.setActualWidth(S0,J)}}if(I||!f.isPrimary())return;W?.syncColumnWithState(f,J,C),$?.syncColumnWithState(f,J,C,O),X?.syncColumnWithState(f,J,C,v)},D=(f,A,O)=>{let v=f$(Q,J),I=A.slice(),C={},m={},w=[],a=[],t=[],u=0,Q0=$?.columns.slice()??[],r=X?.columns.slice()??[];for(let k0 of f){let Az=k0.colId;if(Az.startsWith(uz)){w.push(k0),t.push(k0);continue}if(IQ(Az)){a.push(k0),t.push(k0);continue}let oz=O(Az);if(!oz)t.push(k0),u+=1;else F(oz,k0,C,m,!1),$0(I,oz)}let S0=(k0)=>F(k0,null,C,m,!1);I.forEach(S0),$?.sortColumns(y7.bind($,C,Q0)),X?.sortColumns(y7.bind(X,m,r)),Z.refreshCols(!1,J);let O0=(k0,Az,k2=[])=>{for(let oz of Az){let H7=k0(oz.colId);$0(k2,H7),F(H7,oz,null,null,!0)}k2.forEach(S0)};return O0((k0)=>Y?.getColumn(k0)??null,w,Y?.getColumns()?.slice()),O0((k0)=>G?.getColumn(k0)??null,a,G?.getColumns()?.slice()),bU(z,Z,E),H.refresh(J),B.dispatchEvent({type:"columnEverythingChanged",source:J}),v(),{unmatchedAndAutoStates:t,unmatchedCount:u}};q?.start();let{unmatchedAndAutoStates:M,unmatchedCount:k}=D(z.state||[],K,(f)=>Z.getColDefCol(f));if(M.length>0||T(z.defaultState)){let f=_?.getPivotResultCols()?.list??[];k=D(M,f,(A)=>_?.getPivotResultCol(A)??null).unmatchedCount}return q?.finish(),k===0}function V$(Q,z){let{colModel:J,autoColSvc:Z,selectionColSvc:$,eventSvc:X,gos:Y}=Q,G=J.getColDefCols();if(!G?.length)return;let q=J.getColDefColTree(),H=CZ(q),_=[],U=1000,W=1000,B=(D)=>{let M=A$(D);if(n(M.rowGroupIndex)&&M.rowGroup)M.rowGroupIndex=U++;if(n(M.pivotIndex)&&M.pivot)M.pivotIndex=W++;_.push(M)};Z?.getColumns()?.forEach(B),$?.getColumns()?.forEach(B),H?.forEach(B),n0(Q,{state:_},z);let E=Z?.getColumns()??[],F=[...$?.getColumns()??[],...E,...G].map((D)=>({colId:D.colId}));n0(Q,{state:F,applyOrder:!0},z),X.dispatchEvent(y(Y,{type:"columnsReset",source:z}))}function f$(Q,z){let{rowGroupColsSvc:J,pivotColsSvc:Z,valueColsSvc:$,colModel:X,sortSvc:Y,eventSvc:G}=Q,q={rowGroupColumns:J?.columns.slice()??[],pivotColumns:Z?.columns.slice()??[],valueColumns:$?.columns.slice()??[]},H=b7(Q),_={};for(let U of H)_[U.colId]=U;return()=>{let U=(A,O,v,I)=>{let C=O.map(I),m=v.map(I);if(X0(C,m))return;let a=new Set(O);for(let u of v)if(!a.delete(u))a.add(u);let t=[...a];G.dispatchEvent({type:A,columns:t,column:t.length===1?t[0]:null,source:z})},W=(A)=>{let O=[];return X.forAllCols((v)=>{let I=_[v.getColId()];if(I&&A(I,v))O.push(v)}),O},B=(A)=>A.getColId();U("columnRowGroupChanged",q.rowGroupColumns,J?.columns??[],B),U("columnPivotChanged",q.pivotColumns,Z?.columns??[],B);let K=W((A,O)=>{let v=A.aggFunc!=null,I=v!=O.isValueActive(),C=v&&A.aggFunc!=O.getAggFunc();return I||C});if(K.length>0)M$(G,"columnValueChanged",K,z);L1(G,W((A,O)=>A.width!=O.getActualWidth()),!0,z),D$(G,W((A,O)=>A.pinned!=O.getPinned()),z),UU(G,W((A,O)=>A.hide==O.isVisible()),z);let k=W((A,O)=>!tJ(O.getSortDef(),{type:LQ(A.sortType),direction:IZ(A.sort)})||A.sortIndex!=O.getSortIndex());if(k.length>0)Y?.dispatchSortChangedEvents(z,k);let f=b7(Q);xU(H,f,z,X,G)}}function b7(Q){let{colModel:z,rowGroupColsSvc:J,pivotColsSvc:Z}=Q,$=z.getColDefCols();if(n($)||!z.isAlive())return[];let X=J?.columns,Y=Z?.columns,G=[],q=(_)=>{let U=_.isRowGroupActive()&&X?X.indexOf(_):null,W=_.isPivotActive()&&Y?Y.indexOf(_):null,B=_.isValueActive()?_.getAggFunc():null,E=_.getSortIndex()!=null?_.getSortIndex():null;G.push({colId:_.getColId(),width:_.getActualWidth(),hide:!_.isVisible(),pinned:_.getPinned(),sort:_.getSort(),sortType:_.getSortDef()?.type,sortIndex:E,aggFunc:B,rowGroup:_.isRowGroupActive(),rowGroupIndex:U,pivot:_.isPivotActive(),pivotIndex:W,flex:_.getFlex()??null})};z.forAllCols((_)=>q(_));let H=new Map(z.getCols().map((_,U)=>[_.getColId(),U]));return G.sort((_,U)=>{let W=H.has(_.colId)?H.get(_.colId):-1,B=H.has(U.colId)?H.get(U.colId):-1;return W-B}),G}function A$(Q){let z=(L,F)=>L!=null?L:F!=null?F:null,J=Q.getColDef(),Z=a0(z(J.sort,J.initialSort)),$=Z.direction,X=Z.type,Y=z(J.sortIndex,J.initialSortIndex),G=z(J.hide,J.initialHide),q=z(J.pinned,J.initialPinned),H=z(J.width,J.initialWidth),_=z(J.flex,J.initialFlex),U=z(J.rowGroupIndex,J.initialRowGroupIndex),W=z(J.rowGroup,J.initialRowGroup);if(U==null&&!W)U=null,W=null;let B=z(J.pivotIndex,J.initialPivotIndex),E=z(J.pivot,J.initialPivot);if(B==null&&!E)B=null,E=null;let K=z(J.aggFunc,J.initialAggFunc);return{colId:Q.getColId(),sort:$,sortType:X,sortIndex:Y,hide:G,pinned:q,width:H,flex:_,rowGroup:W,rowGroupIndex:U,pivot:E,pivotIndex:B,aggFunc:K}}function bU(Q,z,J){if(!Q.applyOrder||!Q.state)return;let Z=[];for(let $ of Q.state)if($.colId!=null)Z.push($.colId);yU(z.cols,Z,z,J)}function yU(Q,z,J,Z){if(Q==null)return;let $=[],X={};for(let G of z){if(X[G])continue;let q=Q.map[G];if(q)$.push(q),X[G]=!0}let Y=0;for(let G of Q.list){let q=G.getColId();if(X[q]!=null)continue;if(q.startsWith(uz))$.splice(Y++,0,G);else $.push(G)}if($=E$($,Z),!K$($,J.getColTree())){R(39);return}Q.list=$}function xU(Q,z,J,Z,$){let X={};for(let _ of z)X[_.colId]=_;let Y={};for(let _ of Q)if(X[_.colId])Y[_.colId]=!0;let G=Q.filter((_)=>Y[_.colId]),q=z.filter((_)=>Y[_.colId]),H=[];if(q.forEach((_,U)=>{let W=G?.[U];if(W&&W.colId!==_.colId){let B=Z.getCol(W.colId);if(B)H.push(B)}}),!H.length)return;$.dispatchEvent({type:"columnMoved",columns:H,column:H.length===1?H[0]:null,finished:!0,source:J})}var y7=(Q,z,J,Z)=>{let $=Q[J.getId()],X=Q[Z.getId()],Y=$!=null,G=X!=null;if(Y&&G)return $-X;if(Y)return-1;if(G)return 1;let q=z.indexOf(J),H=z.indexOf(Z),_=q>=0,U=H>=0;if(_&&U)return q-H;if(_)return-1;return 1},wU=class extends j{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"],(Q)=>this.refreshAll(Xz(Q.source))),this.addManagedPropertyListeners(["defaultColDef","defaultColGroupDef","columnTypes","suppressFieldDotNotation"],this.recreateColumnDefs.bind(this)),this.addManagedPropertyListener("pivotMode",(Q)=>this.setPivotMode(this.gos.get("pivotMode"),Xz(Q.source)))}createColsFromColDefs(Q){let{beans:z}=this,{valueCache:J,colAutosize:Z,rowGroupColsSvc:$,pivotColsSvc:X,valueColsSvc:Y,visibleCols:G,eventSvc:q,groupHierarchyColSvc:H}=z,_=this.colDefs?f$(z,Q):void 0;J?.expire();let U=this.colDefCols?.list,W=this.colDefCols?.tree,B=p5(z,this.colDefs,!0,W,Q);ZQ(z,this.colDefCols?.tree,B.columnTree);let{columnTree:E,treeDepth:K}=B,L=CZ(E),F={};for(let D of L)F[D.getId()]=D;if(this.colDefCols={tree:E,treeDepth:K,list:L,map:F},this.createColumnsForService([H],this.colDefCols,Q),$?.extractCols(Q,U),X?.extractCols(Q,U),Y?.extractCols(Q,U),this.ready=!0,this.changeEventsDispatching=!0,this.refreshCols(!0,Q),this.changeEventsDispatching=!1,G.refresh(Q),q.dispatchEvent({type:"columnEverythingChanged",source:Q}),_)this.changeEventsDispatching=!0,_(),this.changeEventsDispatching=!1;if(q.dispatchEvent({type:"newColumnsLoaded",source:Q}),Q==="gridInitializing")Z?.applyAutosizeStrategy()}refreshCols(Q,z){if(!this.colDefCols)return;let J=this.cols?.tree;this.saveColOrder();let{autoColSvc:Z,selectionColSvc:$,rowNumbersSvc:X,quickFilter:Y,pivotResultCols:G,showRowGroupCols:q,rowAutoHeight:H,visibleCols:_,colViewport:U,eventSvc:W,formula:B}=this.beans,E=this.selectCols(G,this.colDefCols);B?.setFormulasActive(E),this.createColumnsForService([Z,$,X],E,z);let K=xG(this.gos,this.showingPivotResult);if(!Q||K)this.restoreColOrder(E);if(this.positionLockedCols(E),q?.refresh(),Y?.refreshCols(),this.setColSpanActive(),H?.setAutoHeightActive(E),_.clear(),U.clear(),!X0(J,this.cols.tree))W.dispatchEvent({type:"gridColumnsChanged"})}createColumnsForService(Q,z,J){for(let Z of Q){if(!Z)continue;Z.createColumns(z,($)=>{this.lastOrder=$(this.lastOrder),this.lastPivotOrder=$(this.lastPivotOrder)},J),Z.addColumns(z)}}selectCols(Q,z){let J=Q?.getPivotResultCols()??null;this.showingPivotResult=J!=null;let{map:Z,list:$,tree:X,treeDepth:Y}=J??z;if(this.cols={list:$.slice(),map:{...Z},tree:X.slice(),treeDepth:Y},J){if(!J.list.some((q)=>this.cols?.map[q.getColId()]!==void 0))this.lastPivotOrder=null}return this.cols}getColsToShow(){if(!this.cols)return[];let{beans:Q,showingPivotResult:z,cols:J}=this,{valueColsSvc:Z,selectionColSvc:$,gos:X}=Q,Y=this.isPivotMode()&&!z,G=$?.isSelectionColumnEnabled(),q=wG(Q),H=Z?.columns,_=g5(X);return J.list.filter((W)=>{let B=mz(W);if(Y)return H?.includes(W)||B&&(!_||W.isVisible())||G&&IQ(W)||q&&v0(W);else return B&&!_||W.isVisible()})}refreshAll(Q){if(!this.ready)return;this.refreshCols(!1,Q),this.beans.visibleCols.refresh(Q)}setColsVisible(Q,z=!1,J){n0(this.beans,{state:Q.map((Z)=>({colId:typeof Z==="string"?Z:Z.getColId(),hide:!z}))},J)}restoreColOrder(Q){let z=this.showingPivotResult?this.lastPivotOrder:this.lastOrder;if(!z)return;let J=z.filter((U)=>Q.map[U.getId()]!=null);if(J.length===0)return;if(J.length===Q.list.length){Q.list=J;return}let Z=(U)=>{let W=U.getOriginalParent();if(!W)return!1;if(W.getChildren().length>1)return!0;return Z(W)};if(!J.some((U)=>Z(U))){let U=new Set(J);for(let W of Q.list)if(!U.has(W))J.push(W);Q.list=J;return}let $=new Map;for(let U=0;U!$.has(U));if(X.length===0){Q.list=J;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 GQ){let F=$.get(L);if(F==null)continue;if(E==null||E{let D=$.get(F);if(D==null)return;if(E==null||E=0;U--)H[_--]=G[U];for(let U=J.length-1;U>=0;U--){let W=J[U],B=q.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}Q.list=H}positionLockedCols(Q){Q.list=E$(Q.list,this.gos)}saveColOrder(){if(this.showingPivotResult)this.lastPivotOrder=this.cols?.list??null;else this.lastOrder=this.cols?.list??null}getColumnDefs(Q){return this.colDefCols&&this.beans.colDefFactory?.getColumnDefs(this.colDefCols.list,this.showingPivotResult,this.lastOrder,this.cols?.list??[],Q)}setColSpanActive(){this.colSpanActive=!!this.cols?.list.some((Q)=>Q.getColDef().colSpan!=null)}isPivotMode(){return this.pivotMode}setPivotMode(Q,z){if(Q===this.pivotMode)return;if(this.pivotMode=Q,!this.ready)return;this.refreshCols(!1,z);let{visibleCols:J,eventSvc:Z}=this.beans;J.refresh(z),Z.dispatchEvent({type:"columnPivotModeChanged"})}isPivotActive(){let Q=this.beans.pivotColsSvc?.columns;return this.pivotMode&&!!Q?.length}recreateColumnDefs(Q){if(!this.cols)return;this.beans.autoColSvc?.updateColumns(Q);let z=Xz(Q.source);this.createColsFromColDefs(z)}setColumnDefs(Q,z){this.colDefs=Q,this.createColsFromColDefs(z)}destroy(){ZQ(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(Q){let{pivotResultCols:z,autoColSvc:J,selectionColSvc:Z,groupHierarchyColSvc:$}=this.beans;if(I1(this.colDefCols?.list,Q))return;if(I1(J?.columns?.list,Q))return;if(I1(Z?.columns?.list,Q))return;if(I1($?.columns?.list,Q))return;if(I1(z?.getPivotResultCols()?.list,Q))return}getColsForKeys(Q){if(!Q)return[];return Q.map((z)=>this.getCol(z)).filter((z)=>z!=null)}getColDefCol(Q){if(!this.colDefCols?.list)return null;return this.getColFromCollection(Q,this.colDefCols)}getCol(Q){if(Q==null)return null;return this.getColFromCollection(Q,this.cols)}getColById(Q){return this.cols?.map[Q]??null}getColFromCollection(Q,z){if(z==null)return null;let{map:J,list:Z}=z;if(typeof Q=="string"&&J[Q])return J[Q];for(let G=0;GQ(this.getValue())}),this}getWidth(){return this.getGui().clientWidth}setWidth(Q){return SQ(this.getGui(),Q),this}getPreviousValue(){return this.previousValue}getValue(){return this.value}setValue(Q,z){if(this.value===Q)return this;if(this.previousValue=this.value,this.value=Q,!z)this.dispatchLocalEvent({type:"fieldValueChanged"});return this}};function uU(Q){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:Q,ref:"eInput",cls:"ag-input-field-input"}]}]}}var j$=class extends hU{constructor(Q,z,J="text",Z="input"){super(Q,Q?.template??uU(Z),[],z);this.inputType=J,this.displayFieldTag=Z,this.eLabel=S,this.eWrapper=S,this.eInput=S}postConstruct(){super.postConstruct(),this.setInputType(this.inputType);let{eLabel:Q,eWrapper:z,eInput:J,className:Z}=this;Q.classList.add(`${Z}-label`),z.classList.add(`${Z}-input-wrapper`),J.classList.add(`${Z}-input`),this.addCss("ag-input-field"),J.id=J.id||`ag-${this.getCompId()}-input`;let{inputName:$,inputWidth:X,inputPlaceholder:Y,autoComplete:G,tabIndex:q}=this.config;if($!=null)this.setInputName($);if(X!=null)this.setInputWidth(X);if(Y!=null)this.setInputPlaceholder(Y);if(G!=null)this.setAutoComplete(G);this.addInputListeners(),this.activateTabIndex([J],q)}addInputListeners(){this.addManagedElementListeners(this.eInput,{input:(Q)=>this.setValue(Q.target.value)})}setInputType(Q){if(this.displayFieldTag==="input")this.inputType=Q,Pz(this.eInput,"type",Q)}getInputElement(){return this.eInput}getWrapperElement(){return this.eWrapper}setInputWidth(Q){return m8(this.eWrapper,Q),this}setInputName(Q){return this.getInputElement().setAttribute("name",Q),this}getFocusableElement(){return this.eInput}setMaxLength(Q){let z=this.eInput;return z.maxLength=Q,this}setInputPlaceholder(Q){return Pz(this.eInput,"placeholder",Q),this}setInputAriaLabel(Q){return E0(this.eInput,Q),this.refreshAriaLabelledBy(),this}setDisabled(Q){return T5(this.eInput,Q),super.setDisabled(Q)}setAutoComplete(Q){if(Q===!0)Pz(this.eInput,"autocomplete",null);else{let z=typeof Q==="string"?Q:"off";Pz(this.eInput,"autocomplete",z)}return this}},K6=class extends j${constructor(Q,z="ag-checkbox",J="checkbox"){super(Q,z,J);this.labelAlignment="right",this.selected=!1,this.readOnly=!1,this.passive=!1}postConstruct(){super.postConstruct();let{readOnly:Q,passive:z,name:J}=this.config;if(typeof Q==="boolean")this.setReadOnly(Q);if(typeof z==="boolean")this.setPassive(z);if(J!=null)this.setName(J)}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(Q){this.passive=Q}isReadOnly(){return this.readOnly}setReadOnly(Q){this.eWrapper.classList.toggle("ag-disabled",Q),this.eInput.disabled=Q,this.readOnly=Q}setDisabled(Q){return this.eWrapper.classList.toggle("ag-disabled",Q),super.setDisabled(Q)}toggle(){if(this.eInput.disabled)return;let Q=this.isSelected(),z=this.getNextValue();if(this.passive)this.dispatchChange(z,Q);else this.setValue(z)}getValue(){return this.isSelected()}setValue(Q,z){return this.refreshSelectedClass(Q),this.setSelected(Q,z),this}setName(Q){let z=this.getInputElement();return z.name=Q,this}isSelected(){return this.selected}setSelected(Q,z){if(this.isSelected()===Q)return;this.previousValue=this.isSelected(),Q=this.selected=typeof Q==="boolean"?Q:void 0;let J=this.eInput;if(J.checked=Q,J.indeterminate=Q===void 0,!z)this.dispatchChange(this.selected,this.previousValue)}dispatchChange(Q,z,J){this.dispatchLocalEvent({type:"fieldValueChanged",selected:Q,previousValue:z,event:J});let Z=this.getInputElement();this.eventSvc.dispatchEvent({type:"checkboxChanged",id:Z.id,name:Z.name,selected:Q,previousValue:z})}onCheckboxClick(Q){if(this.passive||this.eInput.disabled)return;let z=this.isSelected(),J=this.selected=Q.target.checked;this.refreshSelectedClass(J),this.dispatchChange(J,z,Q)}refreshSelectedClass(Q){let z=this.eWrapper.classList;z.toggle("ag-checked",Q===!0),z.toggle("ag-indeterminate",Q==null)}},yQ={selector:"AG-CHECKBOX",component:K6},mU=".ag-checkbox-cell{height:100%}",cU={tag:"div",cls:"ag-cell-wrapper ag-checkbox-cell",role:"presentation",children:[{tag:"ag-checkbox",ref:"eCheckbox",role:"presentation"}]},pU=class extends x{constructor(){super(cU,[yQ]);this.eCheckbox=S,this.registerCSS(mU)}init(Q){this.refresh(Q);let{eCheckbox:z,beans:J}=this,Z=z.getInputElement();Z.setAttribute("tabindex","-1"),R8(Z,"polite"),this.addManagedListeners(Z,{click:($)=>{if(i0($),z.isDisabled())return;let X=z.getValue();this.onCheckboxChanged(X)},dblclick:($)=>{i0($)}}),this.addManagedElementListeners(Q.eGridCell,{keydown:($)=>{if($.key===V.SPACE&&!z.isDisabled()){if(Q.eGridCell===d(J))z.toggle();let X=z.getValue();this.onCheckboxChanged(X),$.preventDefault()}}})}refresh(Q){return this.params=Q,this.updateCheckbox(Q),!0}updateCheckbox(Q){let z,J=!0,{value:Z,column:$,node:X}=Q;if(X.group&&$)if(typeof Z==="boolean")z=Z;else{let U=$.getColId();if(U.startsWith(uz))z=Z==null||Z===""?void 0:Z==="true";else if(X.aggData&&X.aggData[U]!==void 0)z=Z??void 0;else if(X.sourceRowIndex>=0)z=Z??void 0;else J=!1}else z=Z??void 0;let{eCheckbox:Y}=this;if(!J){Y.setDisplayed(!1);return}Y.setValue(z);let G=Q.disabled??!$?.isCellEditable(X);Y.setDisabled(G);let q=this.getLocaleTextFunc(),H=O5(q,z),_=G?H:`${q("ariaToggleCellValue","Press SPACE to toggle cell value")} (${H})`;Y.setInputAriaLabel(_)}onCheckboxChanged(Q){let{params:z}=this,{column:J,node:Z,value:$}=z,{editSvc:X}=this.beans;if(!J)return;let Y={rowNode:Z,column:J};X?.dispatchCellEvent(Y,null,"cellEditingStarted",{value:$});let G=Z.setDataValue(J,Q,"ui");if(X?.dispatchCellEvent(Y,null,"cellEditingStopped",{oldValue:$,newValue:Q,valueChanged:G}),!G)this.updateCheckbox(z)}},iU={tag:"div",cls:"ag-skeleton-container"},nU=class extends x{constructor(){super(iU)}init(Q){let z=`ag-cell-skeleton-renderer-${this.getCompId()}`;if(this.getGui().setAttribute("id",z),this.addDestroyFunc(()=>p1(Q.eParentOfValue)),p1(Q.eParentOfValue,z),Q.deferRender)this.setupLoading(Q);else if(Q.node.failedLoad)this.setupFailed();else this.setupLoading(Q)}setupFailed(){let Q=this.getLocaleTextFunc();this.getGui().textContent=Q("loadingError","ERR");let z=Q("ariaSkeletonCellLoadingFailed","Row failed to load");E0(this.getGui(),z)}setupLoading(Q){let z=Z0({tag:"div",cls:"ag-skeleton-effect"}),J=Q.node.rowIndex;if(J!=null){let X=75+25*(J%2===0?Math.sin(J):Math.cos(J));z.style.width=`${X}%`}this.getGui().appendChild(z);let Z=this.getLocaleTextFunc(),$=Q.deferRender?Z("ariaDeferSkeletonCellLoading","Cell is loading"):Z("ariaSkeletonCellLoading","Row data is loading");E0(this.getGui(),$)}refresh(Q){return!1}},dU={moduleName:"CheckboxCellRenderer",version:p,userComponents:{agCheckboxCellRenderer:pU}},tU={moduleName:"SkeletonCellRenderer",version:p,userComponents:{agSkeletonCellRenderer:nU}};var rU=class extends j{constructor(){super(...arguments);this.beanName="colFlex",this.columnsHidden=!1}refreshFlexedColumns(Q={}){let z=Q.source??"flex";if(Q.viewportWidth!=null)this.flexViewportWidth=Q.viewportWidth;let J=this.flexViewportWidth,{visibleCols:Z,colDelayRenderSvc:$}=this.beans,X=Z.centerCols,Y=-1;if(Q.resizingCols){let K=new Set(Q.resizingCols);for(let L=X.length-1;L>=0;L--)if(K.has(X[L])){Y=L;break}}let G=!1,q=X.map((K,L)=>{let F=K.getFlex(),D=F!=null&&F>0&&L>Y;return G||(G=D),{col:K,isFlex:D,flex:Math.max(0,F??0),initialSize:K.getActualWidth(),min:K.getMinWidth(),max:K.getMaxWidth(),targetSize:0}});if(G)$?.hideColumns("colFlex"),this.columnsHidden=!0;else if(this.columnsHidden)this.revealColumns($);if(!J||!G)return[];let H=q.length,_=q.reduce((K,L)=>K+L.flex,0),U=J,W=(K,L)=>{K.frozenSize=L,K.col.setActualWidth(L,z),U-=L,_-=K.flex,H-=1},B=(K)=>K.frozenSize!=null;for(let K of q)if(!K.isFlex)W(K,K.initialSize);while(H>0){let K=Math.round(_<1?U*_:U),L,F=0,D=0;for(let f of q){if(B(f))continue;L=f,D+=K*(f.flex/_);let A=D-F,O=Math.round(A);f.targetSize=O,F+=O}if(L)L.targetSize+=K-F;let M=0;for(let f of q){if(B(f))continue;let A=f.targetSize,O=Math.min(Math.max(A,f.min),f.max);M+=O-A,f.violationType=O===A?void 0:O0?"min":"max";for(let f of q){if(B(f))continue;if(k==="all"||f.violationType===k)W(f,f.targetSize)}}if(!Q.skipSetLeft)Z.setLeftValues(z);if(Q.updateBodyWidths)Z.updateBodyWidths();let E=q.filter((K)=>K.isFlex&&!K.violationType).map((K)=>K.col);if(Q.fireResizedEvent){let K=q.filter((F)=>F.initialSize!==F.frozenSize).map((F)=>F.col),L=q.filter((F)=>F.flex).map((F)=>F.col);L1(this.eventSvc,K,!0,z,L)}return this.revealColumns($),E}revealColumns(Q){if(this.columnsHidden)Q?.revealColumns("colFlex"),this.columnsHidden=!1}initCol(Q){let{flex:z,initialFlex:J}=Q.colDef;if(z!==void 0)Q.flex=z;else if(J!==void 0)Q.flex=J}setColFlex(Q,z){Q.flex=z??null,Q.dispatchStateUpdatedEvent("flex")}},qz=(Q)=>{if(typeof Q==="bigint")return Q;let z;if(typeof Q==="number")z=Q;else if(typeof Q==="string"){if(z=Q.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}},L6="T",sU=new RegExp(`[${L6} ]`),lU=new RegExp(`^\\d{4}-\\d{2}-\\d{2}(${L6}\\d{2}:\\d{2}:\\d{2}\\D?)?`);function Sz(Q,z){return Q.toString().padStart(z,"0")}function x7(Q,z=!0,J=L6){if(!Q)return null;let Z=[Q.getFullYear(),Q.getMonth()+1,Q.getDate()].map(($)=>Sz($,2)).join("-");if(z)Z+=J+[Q.getHours(),Q.getMinutes(),Q.getSeconds()].map(($)=>Sz($,2)).join(":");return Z}function $1(Q,z=!0){if(!Q)return null;if(z)return[String(Q.getFullYear()),String(Q.getMonth()+1),Sz(Q.getDate(),2),Sz(Q.getHours(),2),`:${Sz(Q.getMinutes(),2)}`,`:${Sz(Q.getSeconds(),2)}`];return[Q.getFullYear(),Q.getMonth()+1,Sz(Q.getDate(),2)].map(String)}var F6=["January","February","March","April","May","June","July","August","September","October","November","December"];function sJ(Q,z=!1){return!!e1(Q,z)}function aU(Q){return sJ(Q,!0)}function e1(Q,z=!1,J){if(!Q)return null;if(!J&&!lU.test(Q))return null;let[Z,$]=Q.split(sU);if(!Z)return null;let X=Z.split("-").map((B)=>Number.parseInt(B,10));if(X.filter((B)=>!isNaN(B)).length!==3)return null;let[Y,G,q]=X,H=new Date(Y,G-1,q);if(H.getFullYear()!==Y||H.getMonth()!==G-1||H.getDate()!==q)return null;if(!$&&z)return null;if(!$||$==="00:00:00")return H;let[_,U,W]=$.split(":").map((B)=>Number.parseInt(B,10));if(_>=0&&_<24)H.setHours(_);else if(z)return null;if(U>=0&&U<60)H.setMinutes(U);else if(z)return null;if(W>=0&&W<60)H.setSeconds(W);else if(z)return null;return H}function h1(Q,z,J){if(!z||!Q)return;if(!J)return Q[z];let Z=z.split("."),$=Q;for(let X=0;Xnull,suppressKeyboardEvent:({node:Q,event:z,column:J})=>z.key===V.SPACE&&J.isCellEditable(Q)}},date({formatValue:Q}){return{cellEditor:"agDateCellEditor",keyCreator:Q}},dateString({formatValue:Q}){return{cellEditor:"agDateStringCellEditor",keyCreator:Q}},dateTime(Q){return this.date(Q)},dateTimeString(Q){return this.dateString(Q)},object({formatValue:Q,colModel:z,colId:J}){return{cellEditorParams:{useFormatter:!0},comparator:(Z,$)=>{let X=z.getColDefCol(J),Y=X?.getColDef();if(!X||!Y)return 0;let G=Z==null?"":Q({column:X,node:null,value:Z}),q=$==null?"":Q({column:X,node:null,value:$});if(G===q)return 0;return G>q?1:-1},keyCreator:Q}},text(){return{}}}}wireBeans(Q){this.colModel=Q.colModel}postConstruct(){this.processDataTypeDefinitions(),this.addManagedPropertyListener("dataTypeDefinitions",(Q)=>{this.processDataTypeDefinitions(),this.colModel.recreateColumnDefs(Q)})}processDataTypeDefinitions(){let Q=this.getDefaultDataTypes(),z={},J={},Z=(_)=>{return(U)=>{let{column:W,node:B,value:E}=U,K=W.getColDef().valueFormatter;if(K===_.groupSafeValueFormatter)K=_.valueFormatter;return this.beans.valueSvc.formatValue(W,B,E,K)}};for(let _ of Object.keys(Q)){let U=Q[_],W={...U,groupSafeValueFormatter:g7(U,this.gos)};z[_]=W,J[_]=Z(W)}let $=this.gos.get("dataTypeDefinitions")??{},X={};for(let _ of Object.keys($)){let U=$[_],W=this.processDataTypeDefinition(U,$,[_],Q);if(W){if(z[_]=W,U.dataTypeMatcher)X[_]=U.dataTypeMatcher;J[_]=Z(W)}}let{valueParser:Y,valueFormatter:G}=Q.object,{valueParser:q,valueFormatter:H}=z.object;this.hasObjectValueParser=q!==Y,this.hasObjectValueFormatter=H!==G,this.formatValueFuncs=J,this.dataTypeDefinitions=z,this.dataTypeMatchers=this.sortKeysInMatchers(X,Q)}sortKeysInMatchers(Q,z){let J={...Q};for(let Z of oU)delete J[Z],J[Z]=Q[Z]??z[Z].dataTypeMatcher;return J}processDataTypeDefinition(Q,z,J,Z){let $,X=Q.extendsDataType;if(Q.columnTypes)this.isColumnTypeOverrideInDataTypeDefinitions=!0;if(Q.extendsDataType===Q.baseDataType){let Y=Z[X],G=z[X];if(Y&&G)Y=G;if(!N7(Q,Y,X))return;$=w7(Y,Q)}else{if(J.includes(X)){R(44);return}let Y=z[X];if(!N7(Q,Y,X))return;let G=this.processDataTypeDefinition(Y,z,[...J,X],Z);if(!G)return;$=w7(G,Q)}return{...$,groupSafeValueFormatter:g7($,this.gos)}}updateColDefAndGetColumnType(Q,z,J){let{cellDataType:Z}=z;if(Z===void 0)Z=Q.cellDataType;let{field:$}=z;if(Z==null||Z===!0)Z=this.canInferCellDataType(Q,z)?this.inferCellDataType($,J):!1;if(this.addFormulaCellEditorToColDef(Q,z),!Z){Q.cellDataType=!1;return}let X=this.dataTypeDefinitions[Z];if(!X){R(47,{cellDataType:Z});return}if(Q.cellDataType=Z,X.groupSafeValueFormatter)Q.valueFormatter=X.groupSafeValueFormatter;if(X.valueParser)Q.valueParser=X.valueParser;if(!X.suppressDefaultProperties)this.setColDefPropertiesForBaseDataType(Q,Z,X,J);return X.columnTypes}addFormulaCellEditorToColDef(Q,z){if(!(z.allowFormula??Q.allowFormula)||z.cellEditor)return;Q.cellEditor="agFormulaCellEditor"}addColumnListeners(Q){if(!this.isPendingInference)return;let z=this.columnStateUpdatesPendingInference[Q.getColId()];if(!z)return;let J=(Z)=>{z.add(Z.key)};Q.__addEventListener("columnStateUpdated",J),this.columnStateUpdateListenerDestroyFuncs.push(()=>Q.__removeEventListener("columnStateUpdated",J))}canInferCellDataType(Q,z){let{gos:J}=this;if(!o(J))return!1;let Z={cellRenderer:!0,valueGetter:!0,valueParser:!0,refData:!0};if(i2(z,Z))return!1;let $=z.type===null?Q.type:z.type;if($){let X=J.get("columnTypes")??{};if(XZ($).some((G)=>{let q=X[G.trim()];return q&&i2(q,Z)}))return!1}return!i2(Q,Z)}inferCellDataType(Q,z){if(!Q)return;let J,Z=this.getInitialData();if(Z){let X=Q.includes(".")&&!this.gos.get("suppressFieldDotNotation");J=h1(Z,Q,X)}else this.initWaitForRowData(z);if(J==null)return;return Object.keys(this.dataTypeMatchers).find((X)=>this.dataTypeMatchers[X](J))??"object"}getInitialData(){let Q=this.gos.get("rowData");if(Q?.length)return Q[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(Q){if(this.columnStateUpdatesPendingInference[Q]=new Set,this.isPendingInference)return;this.isPendingInference=!0;let z=this.isColumnTypeOverrideInDataTypeDefinitions,{colAutosize:J,eventSvc:Z}=this.beans;if(z&&J)J.shouldQueueResizeOperations=!0;let[$]=this.addManagedEventListeners({rowDataUpdateStarted:(X)=>{let{firstRowData:Y}=X;if(!Y)return;if($?.(),this.isPendingInference=!1,this.processColumnsPendingInference(Y,z),this.columnStateUpdatesPendingInference={},z)J?.processResizeOperations();Z.dispatchEvent({type:"dataTypesInferred"})}})}processColumnsPendingInference(Q,z){this.initialData=Q;let J=[];this.destroyColumnStateUpdateListeners();let Z={},$={};for(let X of Object.keys(this.columnStateUpdatesPendingInference)){let Y=this.columnStateUpdatesPendingInference[X],G=this.colModel.getCol(X);if(!G)continue;let q=G.getColDef();if(!this.resetColDefIntoCol(G,"cellDataTypeInferred"))continue;let H=G.getColDef();if(z&&H.type&&H.type!==q.type){let _=XW(G,Y);if(_.rowGroup&&_.rowGroupIndex==null)Z[X]=_;if(_.pivot&&_.pivotIndex==null)$[X]=_;J.push(_)}}if(z)J.push(...this.generateColumnStateForRowGroupAndPivotIndexes(Z,$));if(J.length)n0(this.beans,{state:J},"cellDataTypeInferred");this.initialData=null}generateColumnStateForRowGroupAndPivotIndexes(Q,z){let J={},{rowGroupColsSvc:Z,pivotColsSvc:$}=this.beans;return Z?.restoreColumnOrder(J,Q),$?.restoreColumnOrder(J,z),Object.values(J)}resetColDefIntoCol(Q,z){let J=Q.getUserProvidedColDef();if(!J)return!1;let Z=uQ(this.beans,J,Q.getColId());return Q.setColDef(Z,J,z),!0}getDateStringTypeDefinition(Q){let{dateString:z}=this.dataTypeDefinitions;if(!Q)return z;return this.getDataTypeDefinition(Q)??z}getDateParserFunction(Q){return this.getDateStringTypeDefinition(Q).dateParser}getDateFormatterFunction(Q){return this.getDateStringTypeDefinition(Q).dateFormatter}getDateIncludesTimeFlag(Q){return Q==="dateTime"||Q==="dateTimeString"}getDataTypeDefinition(Q){let z=Q.getColDef();if(!z.cellDataType)return;return this.dataTypeDefinitions[z.cellDataType]}getBaseDataType(Q){return this.getDataTypeDefinition(Q)?.baseDataType}checkType(Q,z){if(z==null)return!0;let J=this.getDataTypeDefinition(Q)?.dataTypeMatcher;if(!J)return!0;if(Q.getColDef().allowFormula&&this.beans.formula?.isFormula(z))return!0;return J(z)}validateColDef(Q,z,J,Z){if(Q.cellDataType==="object"){let $=(q)=>{return q?.cellDataType==null||q?.cellDataType===!0},X=$(z)&&$(J),Y=(q)=>R(48,{property:q,inferred:X,colId:Z}),{object:G}=this.dataTypeDefinitions;if(Q.valueFormatter===G.groupSafeValueFormatter&&!this.hasObjectValueFormatter)Y("Formatter");if(Q.editable&&Q.valueParser===G.valueParser&&!this.hasObjectValueParser)Y("Parser")}}postProcess(Q){let z=Q.cellDataType;if(!z||typeof z!=="string")return;let{dataTypeDefinitions:J,beans:Z,formatValueFuncs:$}=this,X=J[z];if(!X)return;Z.colFilter?.setColDefPropsForDataType(Q,X,$[z])}getFormatValue(Q){return this.formatValueFuncs[Q]}isColPendingInference(Q){return this.isPendingInference&&!!this.columnStateUpdatesPendingInference[Q]}setColDefPropertiesForBaseDataType(Q,z,J,Z){let $=this.formatValueFuncs[z],X=this.columnDefinitionPropsPerDataType[J.baseDataType]({colDef:Q,cellDataType:z,colModel:this.colModel,dataTypeDefinition:J,colId:Z,formatValue:$,filterModuleBean:this.beans.filterManager});if(Q.cellEditor==="agFormulaCellEditor"&&X.cellEditor!==Q.cellEditor)X.cellEditor=Q.cellEditor;Object.assign(Q,X)}getDateObjectTypeDef(Q){let z=this.getLocaleTextFunc(),J=this.getDateIncludesTimeFlag(Q);return{baseDataType:Q,valueParser:(Z)=>e1(Z.newValue&&String(Z.newValue)),valueFormatter:(Z)=>{if(Z.value==null)return"";if(!(Z.value instanceof Date)||isNaN(Z.value.getTime()))return z("invalidDate","Invalid Date");return x7(Z.value,J)??""},dataTypeMatcher:(Z)=>Z instanceof Date}}getDateStringTypeDef(Q){let z=this.getDateIncludesTimeFlag(Q);return{baseDataType:Q,dateParser:(J)=>e1(J)??void 0,dateFormatter:(J)=>x7(J??null,z)??void 0,valueParser:(J)=>sJ(String(J.newValue))?J.newValue:null,valueFormatter:(J)=>sJ(String(J.value))?String(J.value):"",dataTypeMatcher:(J)=>typeof J==="string"&&sJ(J)}}getDefaultDataTypes(){let Q=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 Q("invalidNumber","Invalid Number");return String(z.value)},dataTypeMatcher:(z)=>typeof z==="number"},bigint:{baseDataType:"bigint",valueParser:(z)=>{let{newValue:J}=z;if(J==null)return null;if(typeof J==="string"&&J.trim()==="")return null;return qz(J)},valueFormatter:(z)=>{if(z.value==null)return"";if(typeof z.value!=="bigint")return Q("invalidBigInt","Invalid BigInt");return String(z.value)},dataTypeMatcher:(z)=>typeof z==="bigint"},text:{baseDataType:"text",valueParser:(z)=>z.newValue===""?null:c1(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"&&aU(z)},object:{baseDataType:"object",valueParser:()=>null,valueFormatter:(z)=>c1(z.value)??""}}}destroyColumnStateUpdateListeners(){for(let Q of this.columnStateUpdateListenerDestroyFuncs)Q();this.columnStateUpdateListenerDestroyFuncs=[]}destroy(){this.dataTypeDefinitions={},this.dataTypeMatchers={},this.formatValueFuncs={},this.columnStateUpdatesPendingInference={},this.destroyColumnStateUpdateListeners(),super.destroy()}};function w7(Q,z){let J={...Q,...z};if(Q.columnTypes&&z.columnTypes&&z.appendColumnTypes)J.columnTypes=[...XZ(Q.columnTypes),...XZ(z.columnTypes)];return J}function N7(Q,z,J){if(!z)return R(45,{parentCellDataType:J}),!1;if(z.baseDataType!==Q.baseDataType)return R(46),!1;return!0}var QW=(Q)=>typeof Q==="bigint"||typeof Q==="number",zW=(Q)=>Q==="number"||Q==="bigint";function g7(Q,z){if(!Q.valueFormatter)return;return(J)=>{let{node:Z,colDef:$,column:X,value:Y}=J;if(Z?.group){let G=($.pivotValueColumn??X).getAggFunc();if(G){if(G==="first"||G==="last")return Q.valueFormatter(J);let{baseDataType:q}=Q;if(zW(q)&&G!=="count"){if(QW(Y))return Q.valueFormatter(J);if(Y==null)return;if(typeof Y==="object"){if(typeof Y.toNumber==="function")return Q.valueFormatter({...J,value:Y.toNumber()});if("value"in Y)return Q.valueFormatter({...J,value:Y.value})}}return}}else if(z.get("groupHideOpenParents")&&J.column.isRowGroupActive()){if(typeof J.value==="string"&&!Q.dataTypeMatcher?.(J.value))return}return Q.valueFormatter(J)}}function JW(Q,z,J,Z){if(!z[J])return!1;let $=Q[J];if($===null)return z[J]=!1,!1;else return Z===void 0?!!$:$===Z}function ZW(Q,z){if(Q==null)return z==null?0:-1;if(z==null)return 1;let J=qz(Q),Z=qz(z);if(J!=null&&Z!=null){if(J===Z)return 0;return J>Z?1:-1}return 0}function $W(Q,z){if(Q==null)return z==null?0:-1;if(z==null)return 1;let J=h7(Q),Z=h7(z);if(J!=null&&Z!=null){if(J===Z)return 0;return J>Z?1:-1}return 0}function h7(Q){let z=qz(Q);if(z==null)return null;return z<0n?-z:z}function i2(Q,z){return[["cellRenderer","agSparklineCellRenderer"],["valueGetter",void 0],["valueParser",void 0],["refData",void 0]].some(([J,Z])=>JW(Q,z,J,Z))}function XW(Q,z){let J=A$(Q);for(let Z of z)if(delete J[Z],Z==="rowGroup")delete J.rowGroupIndex;else if(Z==="pivot")delete J.pivotIndex;return J}var YW={moduleName:"DataType",version:p,beans:[eU],dependsOn:[dU]},GW={moduleName:"ColumnFlex",version:p,beans:[rU]};var qW=class extends j{constructor(){super(...arguments);this.beanName="colNames"}getDisplayNameForColumn(Q,z,J=!1){if(!Q)return null;let Z=this.getHeaderName(Q.getColDef(),Q,null,null,z),{aggColNameSvc:$}=this.beans;if(J&&$)return $.getHeaderName(Q,Z);return Z}getDisplayNameForProvidedColumnGroup(Q,z,J){let Z=z?.getColGroupDef();if(Z)return this.getHeaderName(Z,null,Q,z,J);return null}getDisplayNameForColumnGroup(Q,z){return this.getDisplayNameForProvidedColumnGroup(Q,Q.getProvidedColumnGroup(),z)}getHeaderName(Q,z,J,Z,$){let X=Q.headerValueGetter;if(X){let Y=y(this.gos,{colDef:Q,column:z,columnGroup:J,providedColumnGroup:Z,location:$});if(typeof X==="function")return X(Y);else if(typeof X==="string")return this.beans.expressionSvc?.evaluate(X,Y)??null;return""}else if(Q.headerName!=null)return Q.headerName;else if(Q.field)return N4(Q.field);return""}},HW=class extends j{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(Q){this.visibleCols=Q.visibleCols,this.colModel=Q.colModel}postConstruct(){this.suppressColumnVirtualisation=this.gos.get("suppressColumnVirtualisation")}getScrollPosition(){return this.scrollPosition}setScrollPosition(Q,z,J=!1){let{visibleCols:Z}=this,$=Z.isBodyWidthDirty;if(Q===this.scrollWidth&&z===this.scrollPosition&&!$)return;if(this.scrollWidth=Q,this.scrollPosition=z,Z.isBodyWidthDirty=!0,this.gos.get("enableRtl")){let Y=Z.bodyWidth;this.viewportLeft=Y-z-Q,this.viewportRight=Y-z}else this.viewportLeft=z,this.viewportRight=Q+z;if(this.colModel.ready)this.checkViewportColumns(J)}getColumnHeadersToRender(Q){switch(Q){case"left":return this.columnsToRenderLeft;case"right":return this.columnsToRenderRight;default:return this.columnsToRenderCenter}}getHeadersToRender(Q,z){let J;switch(Q){case"left":J=this.rowsOfHeadersToRenderLeft[z];break;case"right":J=this.rowsOfHeadersToRenderRight[z];break;default:J=this.rowsOfHeadersToRenderCenter[z];break}return J??[]}extractViewportColumns(){let Q=this.visibleCols.centerCols;if(this.isColumnVirtualisationSuppressed())this.colsWithinViewport=Q,this.headerColsWithinViewport=Q;else this.colsWithinViewport=Q.filter(this.isColumnInRowViewport.bind(this)),this.headerColsWithinViewport=Q.filter(this.isColumnInHeaderViewport.bind(this))}isColumnVirtualisationSuppressed(){return this.suppressColumnVirtualisation||this.viewportRight===0}clear(){this.rowsOfHeadersToRenderLeft={},this.rowsOfHeadersToRenderRight={},this.rowsOfHeadersToRenderCenter={},this.colsWithinViewportHash=""}isColumnInHeaderViewport(Q){if(Q.isAutoHeaderHeight()||_W(Q))return!0;return this.isColumnInRowViewport(Q)}isColumnInRowViewport(Q){if(Q.isAutoHeight())return!0;let z=Q.getLeft()||0,J=z+Q.getActualWidth(),Z=this.viewportLeft-200,$=this.viewportRight+200,X=z$&&J>$;return!X&&!Y}getViewportColumns(){let{leftCols:Q,rightCols:z}=this.visibleCols;return this.colsWithinViewport.concat(Q).concat(z)}getColsWithinViewport(Q){if(!this.colModel.colSpanActive)return this.colsWithinViewport;let z=(X)=>{let Y=X.getLeft();return T(Y)&&Y>this.viewportLeft},J=this.isColumnVirtualisationSuppressed()?void 0:this.isColumnInRowViewport.bind(this),{visibleCols:Z}=this,$=Z.centerCols;return Z.getColsForRow(Q,$,J,z)}checkViewportColumns(Q=!1){if(this.extractViewport())this.eventSvc.dispatchEvent({type:"virtualColumnsChanged",afterScroll:Q})}calculateHeaderRows(){let{leftCols:Q,rightCols:z}=this.visibleCols;this.columnsToRenderLeft=Q,this.columnsToRenderRight=z,this.columnsToRenderCenter=this.colsWithinViewport;let J=(Z)=>{let $=new Set,X={};for(let Y of Z){let G=Y.getParent(),q=Y.isSpanHeaderHeight();while(G){if($.has(G))break;if(q&&G.isPadding()){G=G.getParent();continue}let _=G.getProvidedColumnGroup().getLevel();X[_]??(X[_]=[]),X[_].push(G),$.add(G),G=G.getParent()}}return X};this.rowsOfHeadersToRenderLeft=J(Q),this.rowsOfHeadersToRenderRight=J(z),this.rowsOfHeadersToRenderCenter=J(this.headerColsWithinViewport)}extractViewport(){let Q=(Z)=>`${Z.getId()}-${Z.getPinned()||"normal"}`;this.extractViewportColumns();let z=this.getViewportColumns().map(Q).join("#"),J=this.colsWithinViewportHash!==z;if(J)this.colsWithinViewportHash=z,this.calculateHeaderRows();return J}};function _W(Q){while(Q){if(Q.isAutoHeaderHeight())return!0;Q=Q.getParent()}return!1}var UW=class extends j{constructor(){super(...arguments);this.beanName="agCompUtils"}adaptFunction(Q,z){if(!Q.cellRenderer)return null;class J{refresh(){return!1}getGui(){return this.eGui}init(Z){let $=z(Z),X=typeof $;if(X==="string"||X==="number"||X==="boolean"){this.eGui=v5(""+$+"");return}if($==null){this.eGui=Z0({tag:"span"});return}this.eGui=$}}return J}},WW={moduleName:"CellRendererFunction",version:p,beans:[UW]},BW=class extends j0{constructor(){super(...arguments);this.beanName="registry"}registerDynamicBeans(Q){if(Q){this.dynamicBeans??(this.dynamicBeans={});for(let z of Object.keys(Q))this.dynamicBeans[z]=Q[z]}}createDynamicBean(Q,z,...J){if(!this.dynamicBeans)throw Error(this.getDynamicError(Q,!0));let Z=this.dynamicBeans[Q];if(Z==null){if(z)throw Error(this.getDynamicError(Q,!1));return}return new Z(...J)}};function EW(Q){return typeof Q==="object"&&!!Q.getComp}var KW=class extends BW{constructor(){super(...arguments);this.agGridDefaults={},this.agGridDefaultOverrides={},this.jsComps={},this.selectors={},this.icons={}}postConstruct(){let Q=this.gos.get("components");if(Q!=null)for(let z of Object.keys(Q))this.jsComps[z]=Q[z]}registerModule(Q){let{icons:z,userComponents:J,dynamicBeans:Z,selectors:$}=Q;if(J){let X=(Y,G,q,H)=>{if(this.agGridDefaults[Y]=G,q||H)this.agGridDefaultOverrides[Y]={params:q,processParams:H}};for(let Y of Object.keys(J)){let G=J[Y];if(EW(G))G=G.getComp(this.beans);if(typeof G==="object"){let{classImp:q,params:H,processParams:_}=G;X(Y,q,H,_)}else X(Y,G)}}this.registerDynamicBeans(Z);for(let X of $??[])this.selectors[X.selector]=X;if(z)for(let X of Object.keys(z))this.icons[X]=z[X]}getUserComponent(Q,z){let J=(G,q,H,_)=>({componentFromFramework:q,component:G,params:H,processParams:_}),{frameworkOverrides:Z}=this.beans,$=Z.frameworkComponent(z,this.gos.get("components"));if($!=null)return J($,!0);let X=this.jsComps[z];if(X){let G=Z.isFrameworkComponent(X);return J(X,G)}let Y=this.agGridDefaults[z];if(Y){let G=this.agGridDefaultOverrides[z];return J(Y,!1,G?.params,G?.processParams)}return this.beans.validation?.missingUserComponent(Q,z,this.agGridDefaults,this.jsComps),null}getSelector(Q){return this.selectors[Q]}getIcon(Q){return this.icons[Q]}getDynamicError(Q,z){if(z)return QQ(279,{name:Q});return this.beans.validation?.missingDynamicBean(Q)??QQ(256)}},LW=23,FW=class extends j{constructor(){super(...arguments);this.beanName="ctrlsSvc",this.params={},this.ready=!1,this.readyCallbacks=[]}postConstruct(){this.addEventListener("ready",()=>{if(this.updateReady(),this.ready){for(let Q of this.readyCallbacks)Q(this.params);this.readyCallbacks.length=0}},this.beans.frameworkOverrides.runWhenReadyAsync?.()??!1)}updateReady(){let Q=Object.values(this.params);this.ready=Q.length===LW&&Q.every((z)=>{return z?.isAlive()??!1})}whenReady(Q,z){if(this.ready)z(this.params);else this.readyCallbacks.push(z);Q.addDestroyFunc(()=>{let J=this.readyCallbacks.indexOf(z);if(J>=0)this.readyCallbacks.splice(J,1)})}register(Q,z){if(this.params[Q]=z,this.updateReady(),this.ready)this.dispatchLocalEvent({type:"ready"});z.addDestroyFunc(()=>{this.updateReady()})}get(Q){return this.params[Q]}getGridBodyCtrl(){return this.params.gridBodyCtrl}getHeaderRowContainerCtrls(){let{leftHeader:Q,centerHeader:z,rightHeader:J}=this.params;return[Q,J,z]}getHeaderRowContainerCtrl(Q){let z=this.params;switch(Q){case"left":return z.leftHeader;case"right":return z.rightHeader;default:return z.centerHeader}}getScrollFeature(){return this.getGridBodyCtrl().scrollFeature}},DW=':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}',D6=typeof window!=="object"||!window?.document?.fonts?.forEach,UZ=!1,Nz=(Q,z,J,Z,$,X,Y=!1)=>{if(D6||UZ)return;let G=Q;if(Z)G=`@layer ${CSS.escape(Z).replaceAll("\\.",".")} { ${Q} }`;let q=jQ.map.get(z);if(!q)q=[],jQ.map.set(z,q);if(q.some((W)=>W.injectedCss===G))return;let H=document.createElement("style");if(X)H.setAttribute("nonce",X);H.dataset.agCss=J,H.dataset.agCssVersion=p,H.textContent=G;let _={rawCss:Q,injectedCss:G,el:H,priority:$,isParams:Y},U;for(let W of q){if(W.priority>$)break;U=W}if(U){U.el.after(H);let W=q.indexOf(U);q.splice(W+1,0,_)}else{if(z.nodeName==="STYLE")z.after(H);else z.insertBefore(H,z.querySelector(":not(title, meta)"));q.push(_)}},R$=(Q,z,J,Z)=>{Nz(DW,Q,"shared",z,0,J),Z?.forEach(($,X)=>$.forEach((Y)=>Nz(Y,Q,X,z,0,J)))},MW=(Q,z,J,Z,$,X)=>{if(D6||UZ)return;let Y=jQ.grids.get(Q);if(!Y)jQ.grids.set(Q,{styleContainer:Z,paramsCss:z});else Y.paramsCss=z;if(B5(Z),z&&J)Nz(z,Z,J,$,2,X,!0)},kW=(Q)=>{let z=jQ.grids.get(Q)?.styleContainer;if(!z)return;if(jQ.grids.delete(Q),Array.from(jQ.grids.values()).some((Z)=>Z.styleContainer===z))B5(z);else B5(z,!0),jQ.map.delete(z)},B5=(Q,z=!1)=>{let J=new Set;for(let $ of jQ.grids.values())if($.styleContainer===Q)J.add($.paramsCss);let Z=jQ.map.get(Q)??[];for(let $=Z.length-1;$>=0;$--)if(z||Z[$].isParams&&!J.has(Z[$].rawCss))Z[$].el.remove(),Z.splice($,1)},S$=()=>{let Q=globalThis.agStyleInjectionVersions??(globalThis.agStyleInjectionVersions=new Map),z=Q.get(p);if(!z)z={map:new WeakMap,grids:new Map,paramsId:0},Q.set(p,z);return z},jQ=S$(),FQ=(Q)=>{return new O$(Q)},oQ="$default",VW=0,O$=class{constructor({feature:Q,params:z,modeParams:J={},css:Z,cssImports:$}){this.feature=Q,this.css=Z,this.cssImports=$,this.modeParams={[oQ]:{...J[oQ]??{},...z??{}},...J}}use(Q,z,J){let Z=this._inject;if(Z==null){let{css:$}=this;if($){let X=`ag-theme-${this.feature??"part"}-${++VW}`;if(typeof $==="function")$=$();$=`:where(.${X}) { -${$} -} -`;for(let Y of this.cssImports??[])$=`@import url(${JSON.stringify(Y)}); -${$}`;Z={css:$,class:X}}else Z=!1;this._inject=Z}if(Z&&Q)Nz(Z.css,Q,Z.class,z,1,J);return Z?Z.class:!1}},fW=(Q)=>Q.replace(/[A-Z]|\d+/g,(z)=>`-${z}`).toLowerCase(),M6=(Q)=>`--ag-${fW(Q)}`,vQ=(Q)=>`var(${M6(Q)})`,AW=(Q,z,J)=>Math.max(z,Math.min(J,Q)),jW=(Q)=>{let z=new Map;return(J)=>{let Z=J;if(!z.has(Z))z.set(Z,Q(J));return z.get(Z)}},fQ=(Q)=>({ref:"accentColor",mix:Q}),r0=(Q)=>({ref:"foregroundColor",mix:Q}),o0=(Q)=>({ref:"foregroundColor",mix:Q,onto:"backgroundColor"}),RW=(Q)=>({ref:"foregroundColor",mix:Q,onto:"headerBackgroundColor"}),x0={ref:"backgroundColor"},Tz={ref:"foregroundColor"},AQ={ref:"accentColor"},WZ={backgroundColor:"#fff",foregroundColor:"#181d1f",borderColor:r0(0.15),chromeBackgroundColor:o0(0.02),browserColorScheme:"light"},SW={...WZ,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:fQ(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:AQ,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:r0(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:r0(0.2)},menuBackgroundColor:o0(0.03),menuTextColor:o0(0.95),menuShadow:{ref:"popupShadow"},menuSeparatorColor:{ref:"borderColor"}},OW=["colorScheme","color","length","scale","borderStyle","border","shadow","image","fontFamily","fontWeight","duration"],PW=jW((Q)=>{return Q=Q.toLowerCase(),OW.find((z)=>Q.endsWith(z.toLowerCase()))??"length"}),pZ=(Q)=>{if(typeof Q==="object"&&Q?.ref)return vQ(Q.ref);if(typeof Q==="string")return Q;if(typeof Q==="number")return String(Q);return!1},k6=(Q)=>{if(typeof Q==="string")return Q;if(typeof Q==="object"&&Q&&"ref"in Q){let z=vQ(Q.ref);if(Q.mix==null)return z;return`color-mix(in srgb, ${Q.onto?vQ(Q.onto):"transparent"}, ${z} ${AW(Q.mix*100,0,100)}%)`}return!1},TW=pZ,X1=(Q)=>{if(typeof Q==="string")return Q;if(typeof Q==="number")return`${Q}px`;if(typeof Q==="object"&&Q&&"calc"in Q)return`calc(${Q.calc.replace(/ ?[*/+] ?/g," $& ").replace(/-?\b[a-z][a-z0-9]*\b(?![-(])/gi,(J)=>J[0]==="-"?J:" "+vQ(J)+" ")})`;if(typeof Q==="object"&&Q&&"ref"in Q)return vQ(Q.ref);return!1},vW=pZ,E5=(Q,z)=>{if(typeof Q==="string")return Q;if(Q===!0)return E5({},z);if(Q===!1)return z==="columnBorder"?E5({color:"transparent"},z):"none";if(typeof Q==="object"&&Q&&"ref"in Q)return vQ(Q.ref);return P$(Q.style??"solid")+" "+X1(Q.width??{ref:"borderWidth"})+" "+k6(Q.color??{ref:"borderColor"})},u7=(Q)=>{return[X1(Q.offsetX??0),X1(Q.offsetY??0),X1(Q.radius??0),X1(Q.spread??0),k6(Q.color??{ref:"foregroundColor"}),...Q.inset?["inset"]:[]].join(" ")},IW=(Q)=>{if(typeof Q==="string")return Q;if(Q===!1)return"none";if(typeof Q==="object"&&Q&&"ref"in Q)return vQ(Q.ref);if(Array.isArray(Q))return Q.map(u7).join(", ");return u7(Q)},P$=pZ,T$=(Q)=>{if(typeof Q==="string")return Q.includes(",")?Q:m7(Q);if(typeof Q==="object"&&Q&&"googleFont"in Q)return T$(Q.googleFont);if(typeof Q==="object"&&Q&&"ref"in Q)return vQ(Q.ref);if(Array.isArray(Q))return Q.map((z)=>{if(typeof z==="object"&&"googleFont"in z)z=z.googleFont;return m7(z)}).join(", ");return!1},m7=(Q)=>/^[\w-]+$|\w\(/.test(Q)?Q:JSON.stringify(Q),CW=pZ,v$=(Q)=>{if(typeof Q==="string")return Q;if(typeof Q==="object"&&Q&&"url"in Q)return`url(${JSON.stringify(Q.url)})`;if(typeof Q==="object"&&Q&&"svg"in Q)return v$({url:`data:image/svg+xml,${encodeURIComponent(Q.svg)}`});if(typeof Q==="object"&&Q&&"ref"in Q)return vQ(Q.ref);return!1},bW=(Q,z,J)=>{if(typeof Q==="string")return Q;if(typeof Q==="number"){if(Q>=10)J?.warn(104,{value:Q,param:z});return`${Q}s`}if(typeof Q==="object"&&Q&&"ref"in Q)return vQ(Q.ref);return!1},yW={color:k6,colorScheme:TW,length:X1,scale:vW,border:E5,borderStyle:P$,shadow:IW,image:v$,fontFamily:T$,fontWeight:CW,duration:bW},xW=(Q,z,J)=>{let Z=PW(Q);return yW[Z](z,Q,J)};var wW=(Q,z)=>new I$({themeLogger:Q,overridePrefix:z}),I$=class Q{constructor(z,J=[]){this.params=z,this.parts=J}withPart(z){if(typeof z==="function")z=z();if(!(z instanceof O$))return this.params.themeLogger.preInitErr(259,"Invalid part",{part:z}),this;return new Q(this.params,[...this.parts,z])}withoutPart(z){return this.withPart(FQ({feature:z}))}withParams(z,J=oQ){return this.withPart(FQ({modeParams:{[J]:z}}))}_startUse({styleContainer:z,cssLayer:J,nonce:Z,loadThemeGoogleFonts:$,moduleCss:X}){if(D6)return;if(UZ)return;gW(),R$(z,J,Z,X);let Y=NW(this);if(Y.length>0){for(let G of Y)if($)hW(G,Z)}for(let G of this.parts)G.use(z,J,Z)}_getCssClass(){if(UZ)return"ag-theme-quartz";return this._cssClassCache??(this._cssClassCache=c7(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-${++S$().paramsId}`)}_getModeParams(){let z=this._paramsCache;if(!z){let J={[oQ]:{...SW}};for(let Z of c7(this.parts))for(let $ of Object.keys(Z.modeParams)){let X=Z.modeParams[$];if(X){let Y=J[$]??(J[$]={}),G=new Set;for(let q of Object.keys(X)){let H=X[q];if(H!==void 0)Y[q]=H,G.add(q)}if($===oQ)for(let q of Object.keys(J)){let H=J[q];if(q!==oQ)for(let _ of G)delete H[_]}}}this._paramsCache=z=J}return z}_getParamsCss(){if(!this._paramsCssCache){let z="",J="",Z=this._getModeParams(),{overridePrefix:$,themeLogger:X}=this.params,Y=$?`--ag-${$}-`:void 0;for(let H of Object.keys(Z)){let _=Z[H];if(H!==oQ){let W=`:where([data-ag-theme-mode="${typeof CSS==="object"?CSS.escape(H):H}"]) & { -`;z+=W,J+=W}for(let U of Object.keys(_).sort()){let W=_[U],B=xW(U,W,X);if(B===!1)X.error(107,{key:U,value:W});else{let E=M6(U),K=Y?E.replace("--ag-",Y):E,L=E.replace("--ag-","--ag-inherited-");z+=` ${E}: var(${L}, ${B}); -`,J+=` ${L}: var(${K}); -`}}if(H!==oQ)z+=`} -`,J+=`} -`}let G=`:where(.${this._getParamsClassName()})`,q=`${G} { -${z}} -`;q+=`:has(> ${G}):not(${G}) { -${J}} -`,this._paramsCssCache=q}return this._paramsCssCache}},c7=(Q)=>{let z=new Map;for(let Z of Q)z.set(Z.feature,Z);let J=[];for(let Z of Q)if(!Z.feature||z.get(Z.feature)===Z)J.push(Z);return J},NW=(Q)=>{let z=new Set,J=(X)=>{if(Array.isArray(X))X.forEach(J);else{let Y=X?.googleFont;if(typeof Y==="string")z.add(Y)}};return Object.values(Q._getModeParams()).flatMap((X)=>Object.values(X)).forEach(J),Array.from(z).sort()},p7=!1,gW=()=>{if(p7)return;p7=!0;for(let Q of Array.from(document.head.querySelectorAll('style[data-ag-scope="legacy"]')))Q.remove()},hW=async(Q,z)=>{let J=`@import url('https://${uW}/css2?family=${encodeURIComponent(Q)}:wght@100;200;300;400;500;600;700;800;900&display=swap'); -`;Nz(J,document.head,`googleFont:${Q}`,void 0,0,z)},uW="fonts.googleapis.com",i7={changeKey:"listItemHeight",type:"length",defaultValue:24},mW=class extends j0{constructor(){super(...arguments);this.beanName="environment",this.sizeEls=new Map,this.lastKnownValues=new Map,this.sizesMeasured=!1,this.globalCSS=[]}wireBeans(Q){this.eRootDiv=Q.eRootDiv}postConstruct(){let{gos:Q,eRootDiv:z}=this;Q.setInstanceDomData(z);let J=Q.get("themeStyleContainer"),Z=typeof ShadowRoot<"u",$=Z&&z.getRootNode()instanceof ShadowRoot;if(this.eStyleContainer=(typeof J==="function"?J():J)??($?z:document.head),!J&&!$&&Z)cW(z,this.shadowRootError.bind(this),this.addDestroyFunc.bind(this));this.cssLayer=Q.get("themeCssLayer"),this.styleNonce=Q.get("styleNonce"),this.addManagedPropertyListener("theme",()=>this.handleThemeChange()),this.handleThemeChange(),this.getSizeEl(i7),this.initVariables(),this.addDestroyFunc(()=>kW(this)),this.mutationObserver=new MutationObserver(()=>{this.fireStylesChangedEvent("theme")}),this.addDestroyFunc(()=>this.mutationObserver.disconnect())}applyThemeClasses(Q,z=[]){let{theme:J}=this,Z=J?J._getCssClass():this.applyLegacyThemeClasses();for(let $ of Array.from(Q.classList))if($.startsWith("ag-theme-"))Q.classList.remove($);if(Z){let $=Q.className;Q.className=`${$}${$?" ":""}${Z}${z?.length?" "+z.join(" "):""}`}}applyLegacyThemeClasses(){let Q="";this.mutationObserver.disconnect();let z=this.eRootDiv;while(z){let J=!1;for(let Z of Array.from(z.classList))if(Z.startsWith("ag-theme-"))J=!0,Q=Q?`${Q} ${Z}`:Z;if(J)this.mutationObserver.observe(z,{attributes:!0,attributeFilter:["class"]});z=z.parentElement}return Q}addGlobalCSS(Q,z){if(this.theme)Nz(Q,this.eStyleContainer,z,this.cssLayer,0,this.styleNonce);else this.globalCSS.push([Q,z])}getDefaultListItemHeight(){return this.getCSSVariablePixelValue(i7)}getCSSVariablePixelValue(Q){let z=this.lastKnownValues.get(Q);if(z!=null)return z;let J=this.measureSizeEl(Q);if(J==="detached"||J==="no-styles"){if(Q.cacheDefault)this.lastKnownValues.set(Q,Q.defaultValue);return Q.defaultValue}return this.lastKnownValues.set(Q,J),J}measureSizeEl(Q){let z=this.getSizeEl(Q);if(z.offsetParent==null)return"detached";let J=z.offsetWidth;if(J===n2)return"no-styles";return this.sizesMeasured=!0,J}getMeasurementContainer(){let Q=this.eMeasurementContainer;if(!Q)Q=this.eMeasurementContainer=K0({tag:"div",cls:"ag-measurement-container"}),this.eRootDiv.appendChild(Q);return Q}getSizeEl(Q){let z=this.sizeEls.get(Q);if(z)return z;let J=this.getMeasurementContainer();z=K0({tag:"div"});let Z=this.setSizeElStyles(z,Q);J.appendChild(z),this.sizeEls.set(Q,z);let{type:$,noWarn:X}=Q;if($!=="length"&&$!=="border")return z;let Y=this.measureSizeEl(Q);if(Y==="no-styles"&&!X)this.varError(Z,Q.defaultValue);let G=DQ(this.beans,z,()=>{let q=this.measureSizeEl(Q);if(q==="detached"||q==="no-styles")return;if(this.lastKnownValues.set(Q,q),q!==Y)Y=q,this.fireStylesChangedEvent(Q.changeKey)});return this.addDestroyFunc(()=>G()),z}setSizeElStyles(Q,z){let{changeKey:J,type:Z}=z,$=M6(J);if(Z==="border"){if($.endsWith("-width"))$=$.slice(0,-6);Q.className="ag-measurement-element-border",Q.style.setProperty("--ag-internal-measurement-border",`var(${$}, solid ${n2}px)`)}else Q.style.width=`var(${$}, ${n2}px)`;return $}handleThemeChange(){let{gos:Q,theme:z}=this,J=Q.get("theme"),Z;if(J==="legacy")Z=void 0;else{let $=J??this.getDefaultTheme();if($ instanceof I$)Z=$;else this.themeError($)}if(Z!==z)this.handleNewTheme(Z);this.postProcessThemeChange(Z,J)}handleNewTheme(Q){let{gos:z,eRootDiv:J,globalCSS:Z}=this,$=this.getAdditionalCss();if(Q){R$(this.eStyleContainer,this.cssLayer,this.styleNonce,$);for(let[X,Y]of Z)Nz(X,this.eStyleContainer,Y,this.cssLayer,0,this.styleNonce);Z.length=0}this.theme=Q,Q?._startUse({loadThemeGoogleFonts:z.get("loadThemeGoogleFonts"),styleContainer:this.eStyleContainer,cssLayer:this.cssLayer,nonce:this.styleNonce,moduleCss:$}),MW(this,Q?._getParamsCss()??null,Q?._getParamsClassName()??null,this.eStyleContainer,this.cssLayer,this.styleNonce),this.applyThemeClasses(J),this.fireStylesChangedEvent("theme")}fireStylesChangedEvent(Q){this.eventSvc.dispatchEvent({type:"stylesChanged",[`${Q}Changed`]:!0})}},n2=15538,cW=(Q,z,J)=>{let Z=60,$=setInterval(()=>{if(typeof ShadowRoot<"u"&&Q.getRootNode()instanceof ShadowRoot)z(),clearInterval($);if(Q.isConnected||--Z<0)clearInterval($)},1000);J(()=>clearInterval($))},pW=".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:AQ,rangeSelectionBackgroundColor:fQ(0.2),rangeSelectionChartBackgroundColor:"#0058FF1A",rangeSelectionChartCategoryBackgroundColor:"#00FF841A",rangeSelectionHighlightColor:fQ(0.5),rangeHeaderHighlightColor:RW(0.08),rowNumbersSelectedColor:fQ(0.5),rowHoverColor:fQ(0.08),columnHoverColor:fQ(0.05),selectedRowBackgroundColor:fQ(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:r0(0.7),headerColumnResizeHandleHeight:"30%",headerColumnResizeHandleWidth:2,headerColumnResizeHandleColor:{ref:"borderColor"},iconButtonColor:{ref:"iconColor"},iconButtonBackgroundColor:"transparent",iconButtonBackgroundSpread:4,iconButtonBorderRadius:1,iconButtonHoverColor:{ref:"iconButtonColor"},iconButtonHoverBackgroundColor:r0(0.1),iconButtonActiveColor:AQ,iconButtonActiveBackgroundColor:fQ(0.28),iconButtonActiveIndicatorColor:AQ,setFilterIndentSize:{ref:"iconSize"},chartMenuPanelWidth:260,chartMenuLabelColor:r0(0.8),cellEditingBorder:{color:AQ},cellEditingShadow:{ref:"cardShadow"},fullRowEditInvalidBackgroundColor:{ref:"invalidColor",onto:"backgroundColor",mix:0.25},columnSelectIndentSize:{ref:"iconSize"},toolPanelSeparatorBorder:!0,columnDropCellBackgroundColor:r0(0.07),columnDropCellTextColor:{ref:"textColor"},columnDropCellDragHandleColor:{ref:"textColor"},columnDropCellBorder:{color:r0(0.13)},selectCellBackgroundColor:r0(0.07),selectCellBorder:{color:r0(0.13)},advancedFilterBuilderButtonBarBorder:!0,advancedFilterBuilderIndentSize:{calc:"spacing * 2 + iconSize"},advancedFilterBuilderJoinPillColor:"#f08e8d",advancedFilterBuilderColumnPillColor:"#a6e194",advancedFilterBuilderOptionPillColor:"#f3c08b",advancedFilterBuilderValuePillColor:"#85c0e4",filterPanelApplyButtonColor:x0,filterPanelApplyButtonBackgroundColor:AQ,columnPanelApplyButtonColor:x0,columnPanelApplyButtonBackgroundColor:AQ,filterPanelCardSubtleColor:{ref:"textColor",mix:0.7},filterPanelCardSubtleHoverColor:{ref:"textColor"},findMatchColor:Tz,findMatchBackgroundColor:"#ffff00",findActiveMatchColor:Tz,findActiveMatchBackgroundColor:"#ffa500",filterToolPanelGroupIndent:{ref:"spacing"},rowLoadingSkeletonEffectColor:r0(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},nW=".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)}",C$={cellBatchEditBackgroundColor:"rgba(220 181 139 / 16%)",cellBatchEditTextColor:"#422f00",rowBatchEditBackgroundColor:{ref:"cellBatchEditBackgroundColor"},rowBatchEditTextColor:{ref:"cellBatchEditTextColor"}},dW={...C$,cellBatchEditTextColor:"#f3d0b3"},tW=()=>FQ({feature:"batchEditStyle",params:C$,css:nW}),rW=tW(),sW=":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)}",lW={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 aW=()=>FQ({feature:"buttonStyle",params:{...lW,buttonBackgroundColor:x0,buttonBorder:!0,buttonHoverBackgroundColor:{ref:"rowHoverColor"},buttonActiveBorder:{color:AQ}},css:sW}),oW=aW();var eW=".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 QB=()=>{return FQ({feature:"columnDropStyle",css:eW})},b$=QB();var zB={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"}}},JB=()=>FQ({feature:"formulaStyle",params:zB}),ZB=JB(),$B={warn:(...Q)=>{R(Q[0],Q[1])},error:(...Q)=>{e(Q[0],Q[1])},preInitErr:(...Q)=>{y1(Q[0],Q[2],Q[1])}},XB=()=>wW($B).withParams(iW).withPart(oW).withPart(b$).withPart(rW).withPart(ZB),YB='.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)}}',GB=()=>FQ({feature:"checkboxStyle",params:{checkboxBorderWidth:1,checkboxBorderRadius:{ref:"borderRadius"},checkboxUncheckedBackgroundColor:x0,checkboxUncheckedBorderColor:o0(0.3),checkboxCheckedBackgroundColor:AQ,checkboxCheckedBorderColor:{ref:"checkboxCheckedBackgroundColor"},checkboxCheckedShapeImage:{svg:''},checkboxCheckedShapeColor:x0,checkboxIndeterminateBackgroundColor:o0(0.3),checkboxIndeterminateBorderColor:{ref:"checkboxIndeterminateBackgroundColor"},checkboxIndeterminateShapeImage:{svg:''},checkboxIndeterminateShapeColor:x0,radioCheckedShapeImage:{svg:''}},css:YB}),qB=GB();var y$=()=>({...WZ,...dW,backgroundColor:"hsl(217, 0%, 17%)",foregroundColor:"#FFF",chromeBackgroundColor:o0(0.05),rowHoverColor:fQ(0.15),selectedRowBackgroundColor:fQ(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 HB=()=>({...y$(),backgroundColor:"#1f2836"});var _B=()=>FQ({feature:"colorScheme",params:WZ,modeParams:{light:WZ,dark:y$(),"dark-blue":HB()}}),UB=_B();var x$={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:''},w$={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":''},WB=(Q={})=>{let z="";for(let J of[...Object.keys(x$),...Object.keys(w$)]){let Z=BB(J,Q.strokeWidth);z+=`.ag-icon-${J}::before { mask-image: url('data:image/svg+xml,${encodeURIComponent(Z)}'); } -`}return z},BB=(Q,z=1.5)=>{let J=w$[Q];if(J)return J;let Z=x$[Q];if(!Z)throw Error(`Missing icon data for ${Q}`);return``+Z+""},N$=(Q={})=>{return FQ({feature:"iconSet",css:()=>WB(Q)})},g$=N$({strokeWidth:1}),EB=N$();var KB=":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)}}",LB=".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 FB={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 DB=()=>FQ({feature:"inputStyle",params:{...FB,inputBackgroundColor:x0,inputBorder:!0,inputBorderRadius:{ref:"borderRadius"},inputPaddingStart:{ref:"spacing"},inputFocusBorder:{color:AQ},inputFocusShadow:{ref:"focusShadow"},inputDisabledBackgroundColor:o0(0.06),inputDisabledTextColor:{ref:"textColor",mix:0.5},inputInvalidBorder:{color:{ref:"invalidColor"}},pickerButtonBorder:!0,pickerListBorder:!0},css:()=>KB+LB}),MB=DB();var kB=".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 VB={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 fB=()=>FQ({feature:"tabStyle",params:{...VB,tabBarBorder:!0,tabBarBackgroundColor:r0(0.05),tabTextColor:{ref:"textColor",mix:0.7},tabSelectedTextColor:{ref:"textColor"},tabHoverTextColor:{ref:"textColor"},tabSelectedBorderColor:{ref:"borderColor"},tabSelectedBackgroundColor:x0},css:kB}),AB=fB();var jB=()=>({fontFamily:[{googleFont:"IBM Plex Sans"},"-apple-system","BlinkMacSystemFont","Segoe UI","Roboto","Oxygen-Sans","Ubuntu"]}),RB=()=>XB().withPart(qB).withPart(UB).withPart(EB).withPart(AB).withPart(MB).withPart(b$).withParams(jB()),V6=RB();var Ez=(Q,z,J,Z,$)=>({changeKey:Q,type:z,defaultValue:J,noWarn:Z,cacheDefault:$}),SB=Ez("cellHorizontalPadding","length",16),OB=Ez("indentationLevel","length",0,!0,!0),PB=Ez("rowGroupIndentSize","length",0),n7=Ez("rowHeight","length",42),d7=Ez("headerHeight","length",48),d2=Ez("rowBorderWidth","border",1),t7=Ez("pinnedRowBorderWidth","border",1),TB=Ez("headerRowBorderWidth","border",1);function vB(Q,z){for(let J of z.sort((Z,$)=>Z.moduleName.localeCompare($.moduleName))){let Z=J.css;if(Z)Q.set(`module-${J.moduleName}`,Z)}}var IB=class extends mW{initVariables(){this.addManagedPropertyListener("rowHeight",()=>this.refreshRowHeightVariable()),this.getSizeEl(n7),this.getSizeEl(d7),this.getSizeEl(d2),this.getSizeEl(t7),this.refreshRowBorderWidthVariable()}getPinnedRowBorderWidth(){return this.getCSSVariablePixelValue(t7)}getRowBorderWidth(){return this.getCSSVariablePixelValue(d2)}getHeaderRowBorderWidth(){return this.getCSSVariablePixelValue(TB)}getDefaultRowHeight(){return this.getCSSVariablePixelValue(n7)}getDefaultHeaderHeight(){return this.getCSSVariablePixelValue(d7)}getDefaultCellHorizontalPadding(){return this.getCSSVariablePixelValue(SB)}getCellPaddingLeft(){let Q=this.getDefaultCellHorizontalPadding(),z=this.getCSSVariablePixelValue(OB),J=this.getCSSVariablePixelValue(PB);return Q-1+J*z}getCellPadding(){let Q=this.getDefaultCellHorizontalPadding()-1;return this.getCellPaddingLeft()+Q}getDefaultColumnMinWidth(){return Math.min(36,this.getDefaultRowHeight())}refreshRowHeightVariable(){let{eRootDiv:Q}=this,z=Q.style.getPropertyValue("--ag-line-height").trim(),J=this.gos.get("rowHeight");if(J==null||isNaN(J)||!isFinite(J)){if(z!==null)Q.style.setProperty("--ag-line-height",null);return-1}let Z=`${J}px`;if(z!=Z)return Q.style.setProperty("--ag-line-height",Z),J;return z!=""?Number.parseFloat(z):-1}fireStylesChangedEvent(Q){if(Q==="rowBorderWidth")this.refreshRowBorderWidthVariable();super.fireStylesChangedEvent(Q)}refreshRowBorderWidthVariable(){let Q=this.getCSSVariablePixelValue(d2);this.eRootDiv.style.setProperty("--ag-internal-row-border-width",`${Q}px`)}postProcessThemeChange(Q,z){if(Q&&getComputedStyle(this.getMeasurementContainer()).getPropertyValue("--ag-legacy-styles-loaded"))if(z)e(106);else e(239)}getAdditionalCss(){let Q=new Map;return Q.set("core",[pW]),vB(Q,Array.from(SG())),Q}getDefaultTheme(){return V6}varError(Q,z){R(9,{variable:{cssName:Q,defaultValue:z}})}themeError(Q){e(240,{theme:Q})}shadowRootError(){e(293)}},CB=class extends j0{constructor(){super(...arguments);this.beanName="eventSvc",this.eventServiceType="global",this.globalSvc=new KQ}addListener(Q,z,J){this.globalSvc.addEventListener(Q,z,J)}removeListener(Q,z,J){this.globalSvc.removeEventListener(Q,z,J)}addGlobalListener(Q,z=!1){this.globalSvc.addGlobalListener(Q,z)}removeGlobalListener(Q,z=!1){this.globalSvc.removeGlobalListener(Q,z)}dispatchEvent(Q){this.globalSvc.dispatchEvent(this.gos.addCommon(Q))}dispatchEventOnce(Q){this.globalSvc.dispatchEventOnce(this.gos.addCommon(Q))}},bB=class extends CB{postConstruct(){let{globalListener:Q,globalSyncListener:z}=this.beans;if(Q)this.addGlobalListener(Q,!0);if(z)this.addGlobalListener(z,!1)}};function K5(Q,z,J){let Z=Q.visibleCols.headerGroupRowCount;if(J>=Z)return{column:z,headerRowIndex:J};let $=z.getParent();while($&&$.getProvidedColumnGroup().getLevel()>J)$=$.getParent();let X=z.isSpanHeaderHeight();if(!$||X&&$.isPadding())return{column:z,headerRowIndex:Z};return{column:$,headerRowIndex:$.getProvidedColumnGroup().getLevel()}}var yB=class extends j{constructor(){super(...arguments);this.beanName="headerNavigation",this.currentHeaderRowWithoutSpan=-1}postConstruct(){let Q=this.beans;Q.ctrlsSvc.whenReady(this,(J)=>{this.gridBodyCon=J.gridBodyCtrl});let z=Y0(Q);this.addManagedElementListeners(z,{mousedown:()=>{this.currentHeaderRowWithoutSpan=-1}})}getHeaderPositionForColumn(Q,z){let J,{colModel:Z,colGroupSvc:$,ctrlsSvc:X}=this.beans;if(typeof Q==="string"){if(J=Z.getCol(Q),!J)J=$?.getColumnGroup(Q)??null}else J=Q;if(!J)return null;let G=X.getHeaderRowContainerCtrl()?.getAllCtrls(),q=b(G||[]).type==="filter",H=l0(this.beans)-1,_=-1,U=J;while(U)_++,U=U.getParent();let W=_;if(z&&q&&W===H-1)W++;return W===-1?null:{headerRowIndex:W,column:J}}navigateVertically(Q,z){let{focusSvc:J,visibleCols:Z}=this.beans,{focusedHeader:$}=J;if(!$)return!1;let{headerRowIndex:X}=$,Y=$.column,G=l0(this.beans),q=this.getHeaderRowType(X),H=Z.headerGroupRowCount,{headerRowIndex:_,column:U,headerRowIndexWithoutSpan:W}=Q==="UP"?xB(q,Y,X):wB(Y,X,H),B=!1;if(_<0)_=0,U=Y,B=!0;if(_>=G)_=-1,this.currentHeaderRowWithoutSpan=-1;else if(W!==void 0)this.currentHeaderRowWithoutSpan=W;if(!B&&!U)return!1;return J.focusHeaderPosition({headerPosition:{headerRowIndex:_,column:U},allowUserOverride:!0,event:z})}navigateHorizontally(Q,z=!1,J){let{focusSvc:Z,gos:$}=this.beans,X={...Z.focusedHeader},Y,G;if(this.currentHeaderRowWithoutSpan!==-1)X.headerRowIndex=this.currentHeaderRowWithoutSpan;else this.currentHeaderRowWithoutSpan=X.headerRowIndex;if(Q==="LEFT"!==$.get("enableRtl"))G="Before",Y=this.findHeader(X,G);else G="After",Y=this.findHeader(X,G);let q=$.getCallback("tabToNextHeader");if(z&&q){let H=Z.focusHeaderPositionFromUserFunc({userFunc:q,headerPosition:Y,direction:G});if(H){let{headerRowIndex:_}=Z.focusedHeader||{};if(_!=null&&_!=X.headerRowIndex)this.currentHeaderRowWithoutSpan=_}return H}if(Y||!z)return Z.focusHeaderPosition({headerPosition:Y,direction:G,fromTab:z,allowUserOverride:!0,event:J});return this.focusNextHeaderRow(X,G,J)}focusNextHeaderRow(Q,z,J){let Z=this.beans,$=Q.headerRowIndex,X=null,Y,G=l0(Z),q=this.beans.visibleCols.allCols;if(z==="Before"){if($<=0)return!1;X=b(q),Y=$-1,this.currentHeaderRowWithoutSpan-=1}else if(X=q[0],Y=$+1,this.currentHeaderRowWithoutSpan=G)_=-1;return Z.focusSvc.focusHeaderPosition({headerPosition:{column:H,headerRowIndex:_},direction:z,fromTab:!0,allowUserOverride:!0,event:J})}scrollToColumn(Q,z="After"){if(Q.getPinned())return;let J;if(_0(Q)){let Z=Q.getDisplayedLeafColumns();J=z==="Before"?b(Z):Z[0]}else J=Q;this.gridBodyCon.scrollFeature.ensureColumnVisible(J)}findHeader(Q,z){let{colGroupSvc:J,visibleCols:Z}=this.beans,$=Q.column;if($ instanceof a1){let q=$.getDisplayedLeafColumns();$=z==="Before"?q[0]:q[q.length-1]}let X=z==="Before"?Z.getColBefore($):Z.getColAfter($);if(!X)return;let Y=Z.headerGroupRowCount;if(Q.headerRowIndex>=Y)return{headerRowIndex:Q.headerRowIndex,column:X};let G=J?.getColGroupAtLevel(X,Q.headerRowIndex);if(!G)return{headerRowIndex:X instanceof GQ&&X.isSpanHeaderHeight()?Z.headerGroupRowCount:Q.headerRowIndex,column:X};if(G.isPadding()&&X.isSpanHeaderHeight())return{headerRowIndex:Z.headerGroupRowCount,column:X};return{headerRowIndex:Q.headerRowIndex,column:G??X}}getHeaderRowType(Q){let z=this.beans.ctrlsSvc.getHeaderRowContainerCtrl();if(z)return z.getRowType(Q)}};function xB(Q,z,J){let Z=J-1;if(Q!=="filter"){let $=z instanceof GQ&&z.isSpanHeaderHeight(),X=z.getParent();while(X&&(X.getProvidedColumnGroup().getLevel()>Z||$&&X.isPadding()))X=X.getParent();if(X)if($)return{column:X,headerRowIndex:X.getProvidedColumnGroup().getLevel(),headerRowIndexWithoutSpan:Z};else return{column:X,headerRowIndex:Z,headerRowIndexWithoutSpan:Z}}return{column:z,headerRowIndex:Z,headerRowIndexWithoutSpan:Z}}function wB(Q,z,J){let Z=z+1,$={column:Q,headerRowIndex:Z,headerRowIndexWithoutSpan:Z};if(Q instanceof a1){if(Z>=J)return{column:Q.getDisplayedLeafColumns()[0],headerRowIndex:J,headerRowIndexWithoutSpan:Z};let Y=Q.getDisplayedChildren()[0];if(Y instanceof a1&&Y.isPadding()){let q=Y.getDisplayedLeafColumns()[0];if(q.isSpanHeaderHeight())Y=q}if($.column=Y,Y instanceof GQ&&Y.isSpanHeaderHeight())$.headerRowIndex=J,$.headerRowIndexWithoutSpan=Z}return $}var NB=class extends j{constructor(){super(...arguments);this.beanName="focusSvc",this.focusFallbackTimeout=null,this.needsFocusRestored=!1}wireBeans(Q){this.colModel=Q.colModel,this.visibleCols=Q.visibleCols,this.rowRenderer=Q.rowRenderer,this.navigation=Q.navigation,this.filterManager=Q.filterManager,this.overlays=Q.overlays}postConstruct(){let Q=this.clearFocusedCell.bind(this);this.addManagedEventListeners({columnPivotModeChanged:Q,newColumnsLoaded:this.onColumnEverythingChanged.bind(this),columnGroupOpened:Q,columnRowGroupChanged:Q}),this.addDestroyFunc(iq(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 Q=this.focusedCell.column,z=this.colModel.getCol(Q.getId());if(Q!==z)this.clearFocusedCell()}getFocusCellToUseAfterRefresh(){let{gos:Q,focusedCell:z}=this;if(Q.get("suppressFocusAfterRefresh")||Q.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),s9))return null;return this.focusedHeader}doesRowOrCellHaveBrowserFocus(){let Q=d(this.beans);if(this.isDomDataPresentInHierarchy(Q,HZ,!0))return!0;return this.isDomDataPresentInHierarchy(Q,_Z,!0)}isDomDataPresentInHierarchy(Q,z,J){let Z=Q;while(Z){let $=Y9(this.gos,Z,z);if($){if($.destroyed&&J)return this.attemptToRecoverFocus(),!1;return!0}Z=Z.parentNode}return!1}getFocusedCell(){return this.focusedCell}getFocusEventParams(Q){let{rowIndex:z,rowPinned:J,column:Z}=Q,$={rowIndex:z,rowPinned:J,column:Z,isFullWidthCell:!1},X=this.rowRenderer.getRowByPosition({rowIndex:z,rowPinned:J});if(X)$.isFullWidthCell=X.isFullWidth();return $}clearFocusedCell(){if(this.focusedCell==null)return;let Q=this.getFocusEventParams(this.focusedCell);this.focusedCell=null,this.eventSvc.dispatchEvent({type:"cellFocusCleared",...Q})}setFocusedCell(Q){this.setFocusRecovered();let{column:z,rowIndex:J,rowPinned:Z,forceBrowserFocus:$=!1,preventScrollOnBrowserFocus:X=!1,sourceEvent:Y}=Q,G=this.colModel.getCol(z);if(!G){this.focusedCell=null;return}this.focusedCell={rowIndex:J,rowPinned:RQ(Z),column:G};let q=this.getFocusEventParams(this.focusedCell);this.eventSvc.dispatchEvent({type:"cellFocused",...q,...this.previousCellFocusParams&&{previousParams:this.previousCellFocusParams},forceBrowserFocus:$,preventScrollOnBrowserFocus:X,sourceEvent:Y}),this.previousCellFocusParams=q}isCellFocused(Q){if(this.focusedCell==null)return!1;return f1(Q,this.focusedCell)}isHeaderWrapperFocused(Q){if(this.focusedHeader==null)return!1;let{column:z,rowCtrl:{rowIndex:J,pinned:Z}}=Q,{column:$,headerRowIndex:X}=this.focusedHeader;return z===$&&J===X&&Z==$.getPinned()}focusHeaderPosition(Q){if(this.setFocusRecovered(),_Q(this.beans))return!1;let{direction:z,fromTab:J,allowUserOverride:Z,event:$,fromCell:X,rowWithoutSpanValue:Y,scroll:G=!0}=Q,{headerPosition:q}=Q;if(X&&this.filterManager?.isAdvFilterHeaderActive())return this.focusAdvancedFilter(q);if(Z){let H=this.focusedHeader,_=l0(this.beans);if(J){let U=this.gos.getCallback("tabToNextHeader");if(U)q=this.getHeaderPositionFromUserFunc({userFunc:U,direction:z,currentPosition:H,headerPosition:q,headerRowCount:_})}else{let U=this.gos.getCallback("navigateToNextHeader");if(U&&$){let W={key:$.key,previousHeaderPosition:H,nextHeaderPosition:q,headerRowCount:_,event:$},B=U(W);q=B===null?H:B}}}if(!q)return!1;return this.focusProvidedHeaderPosition({headerPosition:q,direction:z,event:$,fromCell:X,rowWithoutSpanValue:Y,scroll:G})}focusHeaderPositionFromUserFunc(Q){if(_Q(this.beans))return!1;let{userFunc:z,headerPosition:J,direction:Z,event:$}=Q,X=this.focusedHeader,Y=l0(this.beans),G=this.getHeaderPositionFromUserFunc({userFunc:z,direction:Z,currentPosition:X,headerPosition:J,headerRowCount:Y});return!!G&&this.focusProvidedHeaderPosition({headerPosition:G,direction:Z,event:$})}getHeaderPositionFromUserFunc(Q){let{userFunc:z,direction:J,currentPosition:Z,headerPosition:$,headerRowCount:X}=Q,G=z({backwards:J==="Before",previousHeaderPosition:Z,nextHeaderPosition:$,headerRowCount:X});if(G===!0)return Z;if(G===!1)return null;return G}focusProvidedHeaderPosition(Q){let{headerPosition:z,direction:J,fromCell:Z,rowWithoutSpanValue:$,event:X,scroll:Y=!0}=Q,{column:G,headerRowIndex:q}=z,{filterManager:H,ctrlsSvc:_,headerNavigation:U}=this.beans;if(this.focusedHeader&&KH(Q.headerPosition,this.focusedHeader))return!1;if(q===-1){if(H?.isAdvFilterHeaderActive())return this.focusAdvancedFilter(z);return this.focusGridView({column:G,event:X})}if(Y)U?.scrollToColumn(G,J);let B=_.getHeaderRowContainerCtrl(G.getPinned())?.focusHeader(z.headerRowIndex,G,X)||!1;if(U&&B&&($!=null||Z))U.currentHeaderRowWithoutSpan=$??-1;return B}focusFirstHeader(){if(this.overlays?.exclusive&&this.focusOverlay())return!0;let Q=this.visibleCols.allCols[0];if(!Q)return!1;let z=K5(this.beans,Q,0);return this.focusHeaderPosition({headerPosition:z,rowWithoutSpanValue:0})}focusLastHeader(Q){if(this.overlays?.exclusive&&this.focusOverlay(!0))return!0;let z=l0(this.beans)-1,J=b(this.visibleCols.allCols);return this.focusHeaderPosition({headerPosition:{headerRowIndex:z,column:J},rowWithoutSpanValue:-1,event:Q})}focusPreviousFromFirstCell(Q){if(this.filterManager?.isAdvFilterHeaderActive())return this.focusAdvancedFilter(null);return this.focusLastHeader(Q)}isAnyCellFocused(){return!!this.focusedCell}isRowFocused(Q,z){if(this.focusedCell==null)return!1;return this.focusedCell.rowIndex===Q&&this.focusedCell.rowPinned===RQ(z)}focusOverlay(Q){let z=this.overlays?.isVisible()&&this.overlays.eWrapper?.getGui();return!!z&&D0(z,Q)}getDefaultTabToNextGridContainerTarget(Q){let{backwards:z,focusableContainers:J}=Q,Z=z?-1:1,$,X=()=>{if($===void 0)$=this.getGridBodyTabTarget(z);return $};for(let Y=Q.nextIndex;Y>=0&&Y{Q.executeLaterVMTurn(()=>this.updateScrollVisibleImpl())});else this.updateScrollVisibleImpl()}updateScrollVisibleImpl(){let Q=this.ctrlsSvc.get("center");if(!Q||this.colAnimation?.isActive())return;let z={horizontalScrollShowing:Q.isHorizontalScrollShowing(),verticalScrollShowing:this.verticalScrollShowing};this.setScrollsVisible(z),this.updateScrollGap()}updateScrollGap(){let Q=this.ctrlsSvc.get("center"),z=Q.hasHorizontalScrollGap(),J=Q.hasVerticalScrollGap();if(this.horizontalScrollGap!==z||this.verticalScrollGap!==J)this.horizontalScrollGap=z,this.verticalScrollGap=J,this.eventSvc.dispatchEvent({type:"scrollGapChanged"})}setScrollsVisible(Q){if(this.horizontalScrollShowing!==Q.horizontalScrollShowing||this.verticalScrollShowing!==Q.verticalScrollShowing)this.horizontalScrollShowing=Q.horizontalScrollShowing,this.verticalScrollShowing=Q.verticalScrollShowing,this.eventSvc.dispatchEvent({type:"scrollVisibilityChanged"})}getScrollbarWidth(){if(this.scrollbarWidth==null){let Q=this.gos.get("scrollbarWidth"),J=typeof Q==="number"&&Q>=0?Q:s5();if(J!=null)this.scrollbarWidth=J,this.eventSvc.dispatchEvent({type:"scrollbarWidthChanged"})}return this.scrollbarWidth}},hB=class extends j{constructor(){super(...arguments);this.beanName="gridDestroySvc",this.destroyCalled=!1}destroy(){if(this.destroyCalled)return;let{stateSvc:Q,ctrlsSvc:z,context:J}=this.beans;this.eventSvc.dispatchEvent({type:"gridPreDestroyed",state:Q?.getState()??{}}),this.destroyCalled=!0,z.get("gridCtrl")?.destroyGridUi(),J.destroy(),super.destroy()}},uB=["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 lJ=new Set(["gridPreDestroyed","fillStart","pasteStart"]),f6=uB.reduce((Q,z)=>{return Q[z]=nG(z),Q},{}),B1={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 r7(Q){return`"${Q}"`}var mB=()=>({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."}}),cB={allowFormula:"Formula",aggFunc:"SharedAggregation",autoHeight:"RowAutoHeight",cellClass:"CellStyle",cellClassRules:"CellStyle",cellEditor:({cellEditor:Q,editable:z,groupRowEditable:J})=>{if(!(!!z||!!J))return null;if(typeof Q==="string")return B1[Q]??"CustomEditor";return"CustomEditor"},cellRenderer:({cellRenderer:Q})=>{if(typeof Q!=="string")return null;return B1[Q]},cellStyle:"CellStyle",columnChooserParams:"ColumnMenu",contextMenuItems:"ContextMenu",dndSource:"DragAndDrop",dndSourceOnRowDrag:"DragAndDrop",editable:({editable:Q,cellEditor:z})=>{if(Q&&!z)return"TextEditor";return null},groupRowEditable:({groupRowEditable:Q,cellEditor:z})=>{if(!Q)return null;return z?"RowGroupingEdit":["RowGroupingEdit","TextEditor"]},groupRowValueSetter:({groupRowValueSetter:Q})=>Q?"RowGroupingEdit":null,enableCellChangeFlash:"HighlightChanges",enablePivot:"SharedPivot",enableRowGroup:"SharedRowGrouping",enableValue:"SharedAggregation",filter:({filter:Q})=>{if(Q&&typeof Q!=="string"&&typeof Q!=="boolean")return"CustomFilter";if(typeof Q==="string")return B1[Q]??"ColumnFilter";return"ColumnFilter"},floatingFilter:"ColumnFilter",getQuickFilterText:"QuickFilter",headerTooltip:"Tooltip",headerTooltipValueGetter:"Tooltip",mainMenuItems:"ColumnMenu",menuTabs:(Q)=>{let z=["columnsMenuTab","generalMenuTab"];if(Q.menuTabs?.some((J)=>z.includes(J)))return"ColumnMenu";return null},pivot:"SharedPivot",pivotIndex:"SharedPivot",rowDrag:"RowDrag",rowGroup:"SharedRowGrouping",rowGroupIndex:"SharedRowGrouping",tooltipField:"Tooltip",tooltipValueGetter:"Tooltip",tooltipComponentSelector:"Tooltip",spanRows:"CellSpan",groupHierarchy:"SharedRowGrouping"},pB=()=>{return{autoHeight:{supportedRowModels:["clientSide","serverSide"],validate:(z,{paginationAutoPageSize:J})=>{if(J)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,J)=>{if(J.autoSizeStrategy)return"colDef.flex is not supported with gridOptions.autoSizeStrategy";return null}},headerCheckboxSelection:{supportedRowModels:["clientSide","serverSide"],validate:(z,{rowSelection:J})=>J==="multiple"?null:"headerCheckboxSelection is only supported with rowSelection=multiple"},headerCheckboxSelectionCurrentPageOnly:{supportedRowModels:["clientSide"],validate:(z,{rowSelection:J})=>J==="multiple"?null:"headerCheckboxSelectionCurrentPageOnly is only supported with rowSelection=multiple"},headerCheckboxSelectionFilteredOnly:{supportedRowModels:["clientSide"],validate:(z,{rowSelection:J})=>J==="multiple"?null:"headerCheckboxSelectionFilteredOnly is only supported with rowSelection=multiple"},headerValueGetter:{validate:(z)=>{let J=z.headerValueGetter;if(typeof J==="function"||typeof J==="string")return null;return"headerValueGetter must be a function or a valid string expression"}},icons:{validate:({icons:z})=>{if(z){if(z.smallDown)return QQ(262);if(z.smallLeft)return QQ(263);if(z.smallRight)return QQ(264)}return null}},sort:{validate:(z)=>{if(U1(z.sort)||$z(z.sort))return null;return`sort must be of type (SortDirection | SortDef), currently it is ${typeof z.sort==="object"?JSON.stringify(z.sort):nJ(z.sort)}`}},initialSort:{validate:(z)=>{if(U1(z.initialSort)||$z(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):nJ(z.initialSort)}`}},sortingOrder:{validate:(z)=>{let J=z.sortingOrder;if(Array.isArray(J)&&J.length>0){let Z=J.filter(($)=>{return!(U1($)||$z($))});if(Z.length>0)return`sortingOrder must be an array of type non-null (SortDirection | SortDef)[], incorrect items are: [${Z.map(($)=>typeof $==="string"||$==null?nJ($):JSON.stringify($)).join(", ")}]`}else if(!Array.isArray(J)||!J.length)return`sortingOrder must be an array with at least one element, currently it is [${J}]`;return null}},type:{validate:(z)=>{let J=z.type;if(J instanceof Array){if(J.some(($)=>typeof $!=="string"))return"if colDef.type is supplied an array it should be of type 'string[]'";return null}if(typeof J==="string")return null;return"colDef.type should be of type 'string' | 'string[]'"}},rowSpan:{validate:(z,{suppressRowTransform:J})=>{if(!J)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:J,cellSelection:Z,suppressRowTransform:$,enableCellSpan:X,rowDragEntireRow:Y,enableCellTextSelection:G})=>{if(typeof J==="object"){if(J?.mode==="singleRow"&&J?.enableClickSelection)return"colDef.spanRows is not supported with rowSelection.clickSelection"}if(Z)return"colDef.spanRows is not supported with cellSelection.";if($)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(G)return"colDef.spanRows is not supported with enableCellTextSelection.";return null}},groupHierarchy:{validate(z,{groupHierarchyConfig:J={}},Z){let $=new Set(["year","quarter","month","formattedMonth","day","hour","minute","second"]),X=[];for(let Y of z.groupHierarchy??[]){if(typeof Y==="object"){Z.validation?.validateColDef(Y);continue}if(!$.has(Y)&&!(Y in J))X.push(r7(Y))}if(X.length>0){let Y=`The following parts of colDef.groupHierarchy are not recognised: ${X.join(", ")}.`,G=`Choose one of ${[...$].map(r7).join(", ")}, or define your own parts in gridOptions.groupHierarchyConfig.`;return`${Y} -${G}`}return null}}}},iB={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},nB=()=>Object.keys(iB),dB=()=>({objectName:"colDef",allProperties:nB(),docsUrl:"column-properties/",deprecations:mB(),validations:pB()}),tB=["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"],rB=["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"],sB=["sortingOrder","alignedGrids","rowData","columnDefs","excelStyles","pinnedTopRowData","pinnedBottomRowData","chartThemes","rowClass","paginationPageSizeSelector","suppressOverlays"],h$=["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"],lB=["theme","rowSelection"],aB=["cellSelection","sideBar","rowNumbers","suppressGroupChangesColumnVisibility","groupAggFiltering","suppressStickyTotalRow","groupHideParentOfSingleChild","enableRowPinning"],u$=["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"],oB=["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"],eB=()=>[...sB,...rB,...tB,...h$,...oB,...u$,...aB,...lB];var Q3=()=>({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 VQ(Q,z,J){if(typeof z==="number"||z==null){if(z==null)return null;return z>=J?null:`${Q}: value should be greater than or equal to ${J}`}return`${Q}: value should be a number`}var z3={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"},J3=()=>{let Q={autoSizePadding:{validate({autoSizePadding:J}){return VQ("autoSizePadding",J,0)}},cacheBlockSize:{supportedRowModels:["serverSide","infinite"],validate({cacheBlockSize:J}){return VQ("cacheBlockSize",J,1)}},cacheOverflowSize:{validate({cacheOverflowSize:J}){return VQ("cacheOverflowSize",J,1)}},datasource:{supportedRowModels:["infinite"]},domLayout:{validate:(J)=>{let Z=J.domLayout,$=["autoHeight","normal","print"];if(Z&&!$.includes(Z))return`domLayout must be one of [${$.join()}], currently it's ${Z}`;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:J,pinnedTopRowData:Z,pinnedBottomRowData:$}){if(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:J,isRowPinnable:Z,pinnedTopRowData:$,pinnedBottomRowData:X}){if(Z&&($||X))return"Manual row pinning cannot be used together with pinned row data. Either remove `isRowPinnable`, or remove `pinnedTopRowData` and `pinnedBottomRowData`.";if(!J&&Z)return"`isRowPinnable` requires `enableRowPinning` to be set.";return null}},isRowPinned:{supportedRowModels:["clientSide"],validate({enableRowPinning:J,isRowPinned:Z,pinnedTopRowData:$,pinnedBottomRowData:X}){if(Z&&($||X))return"Manual row pinning cannot be used together with pinned row data. Either remove `isRowPinned`, or remove `pinnedTopRowData` and `pinnedBottomRowData`.";if(!J&&Z)return"`isRowPinned` requires `enableRowPinning` to be set.";return null}},groupDefaultExpanded:{supportedRowModels:["clientSide"]},groupHideColumnsUntilExpanded:{supportedRowModels:["clientSide"],validate({groupHideColumnsUntilExpanded:J,groupHideOpenParents:Z,groupDisplayType:$}){if(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:J={}},Z,$){for(let X of Object.keys(J))$.validation?.validateColDef(J[X]);return null}},icons:{validate:({icons:J})=>{if(J){if(J.smallDown)return QQ(262);if(J.smallLeft)return QQ(263);if(J.smallRight)return QQ(264)}return null}},infiniteInitialRowCount:{validate({infiniteInitialRowCount:J}){return VQ("infiniteInitialRowCount",J,1)}},initialGroupOrderComparator:{supportedRowModels:["clientSide"]},ssrmExpandAllAffectsAllRows:{validate:(J)=>{if(typeof J.ssrmExpandAllAffectsAllRows==="boolean"){if(J.rowModelType!=="serverSide")return"'ssrmExpandAllAffectsAllRows' is only supported with the Server Side Row Model.";if(J.ssrmExpandAllAffectsAllRows&&typeof J.getRowId!=="function")return"'getRowId' callback must be provided for Server Side Row Model grouping to work correctly."}return null}},keepDetailRowsCount:{validate({keepDetailRowsCount:J}){return VQ("keepDetailRowsCount",J,1)}},paginationPageSize:{validate({paginationPageSize:J}){return VQ("paginationPageSize",J,1)}},paginationPageSizeSelector:{validate:(J)=>{let Z=J.paginationPageSizeSelector;if(typeof Z==="boolean"||Z==null)return null;if(!Z.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:J}){return VQ("rowBuffer",J,0)}},rowClass:{validate:(J)=>{if(typeof J.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:J}){if(J&&typeof J==="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(J&&typeof J!=="object")return"Expected `RowSelectionOptions` object for the `rowSelection` property.";if(J&&J.mode!=="multiRow"&&J.mode!=="singleRow")return`Selection mode "${J.mode}" is invalid. Use one of 'singleRow' or 'multiRow'.`;return null}},rowStyle:{validate:(J)=>{let Z=J.rowStyle;if(Z&&typeof Z==="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:J}){return VQ("serverSideInitialRowCount",J,1)}},serverSideOnlyRefreshFilteredGroups:{supportedRowModels:["serverSide"]},serverSideSortAllLevels:{supportedRowModels:["serverSide"]},sortingOrder:{validate:(J)=>{let Z=J.sortingOrder;if(Array.isArray(Z)&&Z.length>0){let $=Z.filter((X)=>!a0(X));if($.length>0)return`sortingOrder must be an array of type (SortDirection | SortDef)[], incorrect items are: ${$.map((X)=>typeof X==="string"||X==null?nJ(X):JSON.stringify(X))}]`}else if(!Array.isArray(Z)||!Z.length)return`sortingOrder must be an array with at least one element, currently it's ${Z}`;return null}},tooltipHideDelay:{validate:(J)=>{if(J.tooltipHideDelay&&J.tooltipHideDelay<0)return"tooltipHideDelay should not be lower than 0";return null}},tooltipShowDelay:{validate:(J)=>{if(J.tooltipShowDelay&&J.tooltipShowDelay<0)return"tooltipShowDelay should not be lower than 0";return null}},tooltipSwitchShowDelay:{validate:(J)=>{if(J.tooltipSwitchShowDelay&&J.tooltipSwitchShowDelay<0)return"tooltipSwitchShowDelay should not be lower than 0";return null}},treeData:{supportedRowModels:["clientSide","serverSide"],validate:(J)=>{let Z=J.rowModelType??"clientSide";switch(Z){case"clientSide":{let{treeDataChildrenField:$,treeDataParentIdField:X,getDataPath:Y,getRowId:G}=J;if(!$&&!X&&!Y)return"treeData requires either 'treeDataChildrenField' or 'treeDataParentIdField' or 'getDataPath' in the clientSide row model.";if($){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(!G)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 $=`treeData requires 'isServerSideGroup' and 'getServerSideGroupKey' in the ${Z} row model.`;return J.isServerSideGroup&&J.getServerSideGroupKey?null:$}}return null}},viewportDatasource:{supportedRowModels:["viewport"]},viewportRowModelBufferSize:{validate({viewportRowModelBufferSize:J}){return VQ("viewportRowModelBufferSize",J,0)}},viewportRowModelPageSize:{validate({viewportRowModelPageSize:J}){return VQ("viewportRowModelPageSize",J,1)}},rowDragEntireRow:{dependencies:{cellSelection:{required:[void 0]}}},autoGroupColumnDef:{validate({autoGroupColumnDef:J,showOpenedGroup:Z}){if(J?.field&&Z)return"autoGroupColumnDef.field and showOpenedGroup are not supported when used together.";if(J?.valueGetter&&Z)return"autoGroupColumnDef.valueGetter and showOpenedGroup are not supported when used together.";return null}},renderingMode:{validate:(J)=>{let Z=J.renderingMode,$=["default","legacy"];if(Z&&!$.includes(Z))return`renderingMode must be one of [${$.join()}], currently it's ${Z}`;return null}},autoSizeStrategy:{validate:({autoSizeStrategy:J})=>{if(!J)return null;let Z=["fitCellContents","fitGridWidth","fitProvidedWidth"],$=J.type;if($!=="fitCellContents"&&$!=="fitGridWidth"&&$!=="fitProvidedWidth")return`Invalid Auto-size strategy. \`autoSizeStrategy\` must be one of ${Z.map((X)=>'"'+X+'"').join(", ")}, currently it's ${$}`;if($==="fitProvidedWidth"&&typeof J.width!="number")return`When using the 'fitProvidedWidth' auto-size strategy, must provide a numeric \`width\`. You provided ${J.width}`;return null}}},z={};for(let J of u$)z[J]={expectedType:"boolean"};for(let J of h$)z[J]={expectedType:"number"};return B0(z,Q),z},Z3=()=>({objectName:"gridOptions",allProperties:[...eB(),...Object.values(f6)],propertyExceptions:["api"],docsUrl:"grid-options/",deprecations:Q3(),validations:J3()}),$3=0,X3=0,s7="__ag_grid_instance",Y3=class extends j{constructor(){super(...arguments);this.beanName="gos",this.domDataKey="__AG_"+Math.random().toString(),this.instanceId=X3++,this.gridReadyFired=!1,this.queueEvents=[],this.propEventSvc=new KQ,this.globalEventHandlerFactory=(Q)=>{return(z,J)=>{if(!this.isAlive())return;let Z=lJ.has(z);if(Z&&!Q||!Z&&Q)return;if(!G3(z))return;let $=(X,Y)=>{let G=f6[X],q=this.gridOptions[G];if(typeof q==="function")this.beans.frameworkOverrides.wrapOutgoing(()=>q(Y))};if(this.gridReadyFired)$(z,J);else if(z==="gridReady"){$(z,J),this.gridReadyFired=!0;for(let X of this.queueEvents)$(X.eventName,X.event);this.queueEvents=[]}else this.queueEvents.push({eventName:z,event:J})}}}wireBeans(Q){this.gridOptions=Q.gridOptions,this.validation=Q.validation,this.api=Q.gridApi,this.gridId=Q.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:Q})=>{this.updateGridOptions({options:Q,force:!0,source:"optionsUpdated"})}})}destroy(){super.destroy(),this.queueEvents=[]}get(Q){return this.gridOptions[Q]??MG[Q]}getCallback(Q){return this.mergeGridCommonParams(this.gridOptions[Q])}exists(Q){return T(this.gridOptions[Q])}mergeGridCommonParams(Q){if(Q)return(J)=>{return Q(this.addCommon(J))};return Q}updateGridOptions({options:Q,force:z,source:J="api"}){let Z={id:$3++,properties:[]},$=[],{gridOptions:X,validation:Y}=this;for(let G of Object.keys(Q)){let q=y5.applyGlobalGridOption(G,Q[G]);Y?.warnOnInitialPropertyUpdate(J,G);let H=z||typeof q==="object"&&J==="api",_=X[G];if(H||_!==q){X[G]=q;let U={type:G,currentValue:q,previousValue:_,changeSet:Z,source:J};$.push(U)}}this.validateGridOptions(this.gridOptions),Z.properties=$.map((G)=>G.type);for(let G of $)d1(this,`Updated property ${G.type} from`,G.previousValue," to ",G.currentValue),this.propEventSvc.dispatchEvent(G)}addPropertyEventListener(Q,z){this.propEventSvc.addEventListener(Q,z)}removePropertyEventListener(Q,z){this.propEventSvc.removeEventListener(Q,z)}getDomDataKey(){return this.domDataKey}addCommon(Q){return Q.api=this.api,Q.context=this.gridOptionsContext,Q}validateOptions(Q,z){for(let J of Object.keys(Q)){let Z=Q[J];if(Z==null||Z===!1)continue;let $=z[J];if(typeof $==="function")$=$(Q,this.gridOptions,this.beans);if($)this.assertModuleRegistered($,J)}}validateGridOptions(Q){this.validateOptions(Q,z3),this.validation?.processGridOptions(Q)}validateColDef(Q,z,J){if(J||!this.beans.dataTypeSvc?.isColPendingInference(z))this.validateOptions(Q,cB),this.validation?.validateColDef(Q)}assertModuleRegistered(Q,z){let J=Array.isArray(Q)?Q.some((Z)=>this.isModuleRegistered(Z)):this.isModuleRegistered(Q);if(!J)e(200,{...this.getModuleErrorParams(),moduleName:Q,reasonOrId:z});return J}getModuleErrorParams(){return{gridId:this.gridId,gridScoped:x5(),rowModelType:this.get("rowModelType"),isUmd:w5()}}isModuleRegistered(Q){return Q5(Q,this.gridId,this.get("rowModelType"))}setInstanceDomData(Q){Q[s7]=this.instanceId}isElementInThisInstance(Q){let z=Q;while(z){let J=z[s7];if(T(J))return J===this.instanceId;z=z.parentElement}return!1}};function G3(Q){return!!f6[Q]}var q3=class extends j{constructor(Q,z){super();this.column=Q,this.eGui=z,this.lastMovingChanged=0}postConstruct(){this.addManagedElementListeners(this.eGui,{click:(Q)=>Q&&this.onClick(Q)}),this.addManagedListeners(this.column,{movingChanged:()=>{this.lastMovingChanged=Date.now()}})}onClick(Q){let{sortSvc:z,rangeSvc:J,gos:Z}=this.beans;if(!(Zz(Z)?Q.altKey:!0))J?.handleColumnSelection(this.column,Q);else if(this.column.isSortable()){let X=this.column.isMoving(),G=Date.now()-this.lastMovingChanged<50;if(!(X||G))z?.progressSortFromEvent(this.column,Q)}}};function H3(Q,z){let J={"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:J},{tag:"span",ref:"eFilterButton",cls:"ag-header-icon ag-header-cell-filter-button",attrs:J},{tag:"div",ref:"eLabel",cls:"ag-header-cell-label",role:"presentation",children:[Q?{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:J},z?{tag:"ag-sort-indicator",ref:"eSortIndicator"}:null]}]}}var _3=class extends x{constructor(){super(...arguments);this.eFilter=S,this.eFilterButton=S,this.eSortIndicator=S,this.eMenu=S,this.eLabel=S,this.eText=S,this.eColRef=S,this.eSortOrder=S,this.eSortAsc=S,this.eSortDesc=S,this.eSortMixed=S,this.eSortNone=S,this.eSortAbsoluteAsc=S,this.eSortAbsoluteDesc=S,this.isLoadingInnerComponent=!1}refresh(Q){let z=this.params;if(this.params=Q,this.workOutTemplate(Q,!!this.beans?.sortSvc)!=this.currentTemplate||this.workOutShowMenu()!=this.currentShowMenu||Q.enableSorting!=this.currentSort||Q.column.formulaRef!=this.currentRef||this.currentSuppressMenuHide!=null&&this.shouldSuppressMenuHide()!=this.currentSuppressMenuHide||z.enableFilterButton!=Q.enableFilterButton||z.enableFilterIcon!=Q.enableFilterIcon)return!1;if(this.innerHeaderComponent){let J={...Q};B0(J,Q.innerHeaderComponentParams),this.innerHeaderComponent.refresh?.(J)}else this.setDisplayName(Q);return!0}workOutTemplate(Q,z){let{formula:J}=this.beans,Z=Q.template;if(Z)return Z?.trim?Z.trim():Z;return H3(!!J?.active,z)}init(Q){this.params=Q;let{sortSvc:z,touchSvc:J,rowNumbersSvc:Z,userCompFactory:$}=this.beans,X=z?.getSortIndicatorSelector();if(this.currentTemplate=this.workOutTemplate(Q,!!X),this.setTemplate(this.currentTemplate,X?[X]:void 0),this.eLabel)this.mouseListener??(this.mouseListener=this.createManagedBean(new q3(Q.column,this.eLabel)));J?.setupForHeader(this),this.setMenu(),this.setupSort(),this.setupColumnRefIndicator(),Z?.setupForHeader(this),this.setupFilterIcon(),this.setupFilterButton(),this.workOutInnerHeaderComponent($,Q),this.setDisplayName(Q)}workOutInnerHeaderComponent(Q,z){let J=vq(Q,z,z);if(!J)return;this.isLoadingInnerComponent=!0,J.newAgStackInstance().then((Z)=>{if(this.isLoadingInnerComponent=!1,!Z)return;if(this.isAlive()){if(this.innerHeaderComponent=Z,this.eText)this.eText.appendChild(Z.getGui())}else this.destroyBean(Z)})}setDisplayName(Q){let{displayName:z}=Q,J=this.currentDisplayName;if(this.currentDisplayName=z,!this.eText||J===z||this.innerHeaderComponent||this.isLoadingInnerComponent)return;this.eText.textContent=ZJ(z)}addInIcon(Q,z,J){let Z=h(Q,this.beans,J);if(Z)z.appendChild(Z)}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:Q,eMenu:z,params:J}=this,Z=U0(Q);this.addInIcon(Z?"menu":"menuAlt",z,J.column),z.classList.toggle("ag-header-menu-icon",!Z);let $=this.shouldSuppressMenuHide();this.currentSuppressMenuHide=$,this.addManagedElementListeners(z,{click:()=>this.showColumnMenu(this.eMenu)}),this.toggleMenuAlwaysShow($)}toggleMenuAlwaysShow(Q){this.eMenu?.classList.toggle("ag-header-menu-always-show",Q)}showColumnMenu(Q){let{currentSuppressMenuHide:z,params:J}=this;if(!z)this.toggleMenuAlwaysShow(!0);J.showColumnMenu(Q,()=>{if(!z)this.toggleMenuAlwaysShow(!1)})}onMenuKeyboardShortcut(Q){let{params:z,gos:J,beans:Z,eMenu:$,eFilterButton:X}=this,Y=z.column,G=U0(J);if(Q&&!G){if(Z.menuSvc?.isFilterMenuInHeaderEnabled(Y))return z.showFilter(X??$??this.getGui()),!0}else if(z.enableMenu)return this.showColumnMenu($??X??this.getGui()),!0;return!1}setupSort(){let{sortSvc:Q}=this.beans;if(!Q)return;let{enableSorting:z,column:J}=this.params;if(this.currentSort=z,!this.eSortIndicator){this.eSortIndicator=this.createBean(Q.createSortIndicator(!0));let{eSortIndicator:Z,eSortOrder:$,eSortAsc:X,eSortDesc:Y,eSortMixed:G,eSortNone:q,eSortAbsoluteAsc:H,eSortAbsoluteDesc:_}=this;Z.attachCustomElements($,X,Y,G,q,H,_)}if(this.eSortIndicator.setupSort(J),!this.currentSort)return;Q.setupHeader(this,J)}setupColumnRefIndicator(){let{eColRef:Q,beans:{editModelSvc:z},params:J}=this;if(!Q)return;this.currentRef=J.column.formulaRef,Q.textContent=this.currentRef,N(Q,!1),this.addManagedEventListeners({cellEditingStarted:()=>{let Z=z?.getEditPositions(),$=!!this.currentRef&&!!Z?.some((X)=>X.column.isAllowFormula());N(Q,$)},cellEditingStopped:()=>{N(Q,!1)}})}setupFilterIcon(){let{eFilter:Q,params:z}=this;if(!Q)return;let J=()=>{let Z=z.column.isFilterActive();N(Q,Z,{skipAriaHidden:!0})};this.configureFilter(z.enableFilterIcon,Q,J,"filterActive")}setupFilterButton(){let{eFilterButton:Q,params:z}=this;if(!Q)return;if(this.configureFilter(z.enableFilterButton,Q,this.onFilterChangedButton.bind(this),"filter"))this.addManagedElementListeners(Q,{click:()=>z.showFilter(Q)});else this.eFilterButton=void 0}configureFilter(Q,z,J,Z){if(!Q)return T0(z),!1;let $=this.params.column;return this.addInIcon(Z,z,$),this.addManagedListeners($,{filterChanged:J}),J(),!0}onFilterChangedButton(){let Q=this.params.column.isFilterActive();this.eFilterButton.classList.toggle("ag-filter-active",Q)}getAnchorElementForMenu(Q){let{eFilterButton:z,eMenu:J}=this;if(Q)return z??J??this.getGui();return J??z??this.getGui()}destroy(){super.destroy(),this.innerHeaderComponent=this.destroyBean(this.innerHeaderComponent),this.mouseListener=this.destroyBean(this.mouseListener)}},U3=class extends j{constructor(Q,z){super();this.eLabel=Q,this.columnGroup=z,this.isSticky=!1,this.left=null,this.right=null}postConstruct(){let{columnGroup:Q,beans:z}=this,{ctrlsSvc:J}=z;J.whenReady(this,()=>{let Z=this.refreshPosition.bind(this);if(Q.getPinned()==null)this.addManagedEventListeners({bodyScroll:($)=>{if($.direction==="horizontal")this.updateSticky($.left)}});this.addManagedListeners(Q,{leftChanged:Z,displayedChildrenChanged:Z}),this.addManagedEventListeners({columnResized:Z}),this.refreshPosition()})}refreshPosition(){let{columnGroup:Q,beans:z}=this,J=Q.getLeft(),Z=Q.getActualWidth();if(J==null||Z===0){this.left=null,this.right=null,this.setSticky(!1);return}this.left=J,this.right=J+Z;let $=z.colViewport.getScrollPosition();if($!=null)this.updateSticky($)}updateSticky(Q){let{beans:z,left:J,right:Z}=this;if(J==null||Z==null){this.setSticky(!1);return}let{gos:$,visibleCols:X}=z,G=$.get("enableRtl")?X.bodyWidth-Q:Q;this.setSticky(JG)}setSticky(Q){let{isSticky:z,eLabel:J}=this;if(z===Q)return;this.isSticky=Q,J.classList.toggle("ag-sticky-label",Q)}},W3={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"}]},B3=class extends x{constructor(){super(W3);this.agOpened=S,this.agClosed=S,this.agLabel=S,this.isLoadingInnerComponent=!1}init(Q){let{userCompFactory:z,touchSvc:J}=this.beans;this.params=Q,this.checkWarnings(),this.workOutInnerHeaderGroupComponent(z,Q),this.setupLabel(Q),this.addGroupExpandIcon(Q),this.setupExpandIcons(),J?.setupForHeaderGroup(this)}checkWarnings(){if(this.params.template)R(89)}workOutInnerHeaderGroupComponent(Q,z){let J=Cq(Q,z,z);if(!J)return;this.isLoadingInnerComponent=!0,J.newAgStackInstance().then((Z)=>{if(this.isLoadingInnerComponent=!1,!Z)return;if(this.isAlive())this.innerHeaderGroupComponent=Z,this.agLabel.appendChild(Z.getGui());else this.destroyBean(Z)})}setupExpandIcons(){let{agOpened:Q,agClosed:z,params:{columnGroup:J},beans:{colGroupSvc:Z}}=this;this.addInIcon("columnGroupOpened",Q),this.addInIcon("columnGroupClosed",z);let $=(q)=>{if(zQ(q))return;let H=!J.isExpanded();Z.setColumnGroupOpened(J.getProvidedColumnGroup(),H,"uiColumnExpanded")};this.addTouchAndClickListeners(z,$),this.addTouchAndClickListeners(Q,$);let X=(q)=>{i0(q)};this.addManagedElementListeners(z,{dblclick:X}),this.addManagedElementListeners(Q,{dblclick:X}),this.addManagedElementListeners(this.getGui(),{dblclick:$}),this.updateIconVisibility();let Y=J.getProvidedColumnGroup(),G=this.updateIconVisibility.bind(this);this.addManagedListeners(Y,{expandedChanged:G,expandableChanged:G})}addTouchAndClickListeners(Q,z){this.beans.touchSvc?.setupForHeaderGroupElement(this,Q,z),this.addManagedElementListeners(Q,{click:z})}updateIconVisibility(){let{agOpened:Q,agClosed:z,params:{columnGroup:J}}=this;if(J.isExpandable()){let Z=J.isExpanded();N(Q,Z),N(z,!Z)}else N(Q,!1),N(z,!1)}addInIcon(Q,z){let J=h(Q,this.beans,null);if(J)z.appendChild(J)}addGroupExpandIcon(Q){if(!Q.columnGroup.isExpandable()){let{agOpened:z,agClosed:J}=this;N(z,!1),N(J,!1)}}setupLabel(Q){let{displayName:z,columnGroup:J}=Q,{innerHeaderGroupComponent:Z,isLoadingInnerComponent:$}=this,X=Z||$;if(T(z)&&!X)this.agLabel.textContent=ZJ(z);if(!J.getColGroupDef()?.suppressStickyLabel)this.createManagedBean(new U3(this.getGui(),J))}destroy(){if(super.destroy(),this.innerHeaderGroupComponent)this.destroyBean(this.innerHeaderGroupComponent),this.innerHeaderGroupComponent=void 0}},E3={moduleName:"ColumnHeaderComp",version:p,userComponents:{agColumnHeader:_3},icons:{menu:"menu",menuAlt:"menu-alt"}},K3={moduleName:"ColumnGroupHeaderComp",version:p,userComponents:{agColumnGroupHeader:B3},icons:{columnGroupOpened:"expanded",columnGroupClosed:"contracted"}},L3=class extends j{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(Q){if(this.scrollGoingDown=Q>=this.lastScrollTop,Q===0)this.scrollGoingDown=!0;this.lastScrollTop=Q}postConstruct(){this.active=!this.gos.get("suppressAnimationFrame"),this.batchFrameworkComps=this.beans.frameworkOverrides.batchFrameworkComps}verify(){if(this.active===!1)R(92)}createTask(Q,z,J,Z,$=!1){this.verify();let X=J;if(Z&&this.batchFrameworkComps)X="f1";let Y={task:Q,index:z,createOrder:++this.taskCount,deferred:$};this.addTaskToList(this[X],Y),this.schedule()}addTaskToList(Q,z){Q.list.push(z),Q.sorted=!1}sortTaskList(Q){if(Q.sorted)return;let z=this.scrollGoingDown?1:-1;Q.list.sort((J,Z)=>{if(J.deferred!==Z.deferred)return J.deferred?-1:1;if(J.index!==Z.index)return z*(Z.index-J.index);return Z.createOrder-J.createOrder}),Q.sorted=!0}addDestroyTask(Q){this.verify(),this.destroyTasks.push(Q),this.schedule()}executeFrame(Q){let{p1:z,p2:J,f1:Z,destroyTasks:$,beans:X}=this,{ctrlsSvc:Y,frameworkOverrides:G}=X,q=z.list,H=J.list,_=Z.list,U=Date.now(),W=0,B=Q<=0,E=Y.getScrollFeature();while(B||W{while(B||W{};else if($.length)L=$.pop();else break;L()}W=Date.now()-U}if(q.length||H.length||_.length||$.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 Q=this.executeFrame.bind(this,60);YQ(this.beans,Q)}isQueueEmpty(){return!this.ticking}},F3={moduleName:"AnimationFrame",version:p,beans:[L3]},D3=class extends j{constructor(){super(...arguments);this.beanName="iconSvc"}createIconNoSpan(Q,z){return h(Q,this.beans,z?.column)}},M3=(Q,z,J)=>z||Q&&J,k3=class extends j{constructor(){super(...arguments);this.beanName="touchSvc"}mockBodyContextMenu(Q,z){this.mockContextMenu(Q,Q.eBodyViewport,z)}mockHeaderContextMenu(Q,z){this.mockContextMenu(Q,Q.eGui,z)}mockRowContextMenu(Q){if(!bz())return;let z=(J,Z,$)=>{let{rowCtrl:X,cellCtrl:Y}=Q.getControlsForEventTarget($?.target??null);if(Y?.column)Y.dispatchCellContextMenuEvent($??null);this.beans.contextMenuSvc?.handleContextMenuMouseEvent(void 0,$,X,Y)};this.mockContextMenu(Q,Q.element,z)}handleCellDoubleClick(Q,z){if((()=>{if(!bz()||a2("dblclick"))return!1;let Z=Date.now(),$=Z-Q.lastIPadMouseClickEvent<200;return Q.lastIPadMouseClickEvent=Z,$})())return Q.onCellDoubleClicked(z),z.preventDefault(),!0;return!1}setupForHeader(Q){let{gos:z,sortSvc:J,menuSvc:Z}=this.beans;if(z.get("suppressTouch"))return;let{params:$,eMenu:X,eFilterButton:Y}=Q,G=new h0(Q.getGui(),!0);Q.addDestroyFunc(()=>G.destroy());let q=Q.shouldSuppressMenuHide(),H=q&&T(X)&&$.enableMenu,_=!!Z?.isHeaderContextMenuEnabled($.column),U=M3($.enableMenu,_,U0(z)),W=G;if(H)W=new h0(X,!0),Q.addDestroyFunc(()=>W.destroy());let B=(E)=>$.showColumnMenuAfterMouseClick(E.touchStart);if(H&&$.enableMenu)Q.addManagedListeners(W,{tap:B});if(U)Q.addManagedListeners(G,{longTap:B});if($.enableSorting){let E=(K)=>{let L=K.touchStart.target;if(q&&(X?.contains(L)||Y?.contains(L)))return;J?.progressSort($.column,!1,"uiColumnSorted")};Q.addManagedListeners(G,{tap:E})}if($.enableFilterButton&&Y){let E=new h0(Y,!0);Q.addManagedListeners(E,{tap:()=>$.showFilter(Y)}),Q.addDestroyFunc(()=>E.destroy())}}setupForHeaderGroup(Q){let z=Q.params;if(this.beans.menuSvc?.isHeaderContextMenuEnabled(z.columnGroup.getProvidedColumnGroup())){let J=new h0(z.eGridHeader,!0),Z=($)=>z.showColumnMenuAfterMouseClick($.touchStart);Q.addManagedListeners(J,{longTap:Z}),Q.addDestroyFunc(()=>J.destroy())}}setupForHeaderGroupElement(Q,z,J){let Z=new h0(z,!0);Q.addManagedListeners(Z,{tap:J}),Q.addDestroyFunc(()=>Z.destroy())}mockContextMenu(Q,z,J){if(!bz())return;let Z=new h0(z),$=(X)=>{if(!n1(this.beans,X.touchEvent))return;J(void 0,X.touchStart,X.touchEvent)};Q.addManagedListeners(Z,{longTap:$}),Q.addDestroyFunc(()=>Z.destroy())}},V3={moduleName:"Touch",version:p,beans:[k3]},f3=class extends j{constructor(){super(...arguments);this.beanName="cellNavigation"}wireBeans(Q){this.rowSpanSvc=Q.rowSpanSvc}getNextCellToFocus(Q,z,J=!1){if(J)return this.getNextCellToFocusWithCtrlPressed(Q,z);return this.getNextCellToFocusWithoutCtrlPressed(Q,z)}getNextCellToFocusWithCtrlPressed(Q,z){let J=Q===V.UP,Z=Q===V.DOWN,$=Q===V.LEFT,X,Y,{pageBounds:G,gos:q,visibleCols:H,pinnedRowModel:_}=this.beans,{rowPinned:U}=z;if(J||Z){if(U&&_)if(J)Y=0;else Y=U==="top"?_.getPinnedTopRowCount()-1:_.getPinnedBottomRowCount()-1;else Y=J?G.getFirstRow():G.getLastRow();X=z.column}else{let W=q.get("enableRtl");Y=z.rowIndex,X=($!==W?H.allCols:[...H.allCols].reverse()).find((E)=>!v0(E)&&this.isCellGoodToFocusOn({rowIndex:Y,rowPinned:null,column:E}))}return X?{rowIndex:Y,rowPinned:U,column:X}:null}getNextCellToFocusWithoutCtrlPressed(Q,z){let J=z,Z=!1;while(!Z){switch(Q){case V.UP:J=this.getCellAbove(J);break;case V.DOWN:J=this.getCellBelow(J);break;case V.RIGHT:J=this.gos.get("enableRtl")?this.getCellToLeft(J):this.getCellToRight(J);break;case V.LEFT:J=this.gos.get("enableRtl")?this.getCellToRight(J):this.getCellToLeft(J);break;default:J=null,R(8,{key:Q});break}if(J)Z=this.isCellGoodToFocusOn(J);else Z=!0}return J}isCellGoodToFocusOn(Q){let z=Q.column,J,{pinnedRowModel:Z,rowModel:$}=this.beans;switch(Q.rowPinned){case"top":J=Z?.getPinnedTopRow(Q.rowIndex);break;case"bottom":J=Z?.getPinnedBottomRow(Q.rowIndex);break;default:J=$.getRow(Q.rowIndex);break}if(!J)return!1;return!this.isSuppressNavigable(z,J)}getCellToLeft(Q){if(!Q)return null;let z=this.beans.visibleCols.getColBefore(Q.column);if(!z)return null;return{rowIndex:Q.rowIndex,column:z,rowPinned:Q.rowPinned}}getCellToRight(Q){if(!Q)return null;let z=this.beans.visibleCols.getColAfter(Q.column);if(!z)return null;return{rowIndex:Q.rowIndex,column:z,rowPinned:Q.rowPinned}}getCellBelow(Q){if(!Q)return null;let z=this.rowSpanSvc?.getCellEnd(Q)??Q,J=L0(this.beans,z,!0);if(J)return{rowIndex:J.rowIndex,column:Q.column,rowPinned:J.rowPinned};return null}getCellAbove(Q){if(!Q)return null;let z=this.rowSpanSvc?.getCellStart(Q)??Q,J=m0(this.beans,{rowIndex:z.rowIndex,rowPinned:z.rowPinned},!0);if(J)return{rowIndex:J.rowIndex,column:Q.column,rowPinned:J.rowPinned};return null}getNextTabbedCell(Q,z){if(z)return this.getNextTabbedCellBackwards(Q);return this.getNextTabbedCellForwards(Q)}getNextTabbedCellForwards(Q){let{visibleCols:z,pagination:J}=this.beans,Z=z.allCols,$=Q.rowIndex,X=Q.rowPinned,Y=z.getColAfter(Q.column);if(!Y){Y=Z[0];let G=L0(this.beans,Q,!0);if(n(G))return null;if(!G.rowPinned&&!(J?.isRowInPage(G.rowIndex)??!0))return null;$=G?G.rowIndex:null,X=G?G.rowPinned:null}return{rowIndex:$,column:Y,rowPinned:X}}getNextTabbedCellBackwards(Q){let{beans:z}=this,{visibleCols:J,pagination:Z}=z,$=J.allCols,X=Q.rowIndex,Y=Q.rowPinned,G=J.getColBefore(Q.column);if(!G){G=b($);let q=m0(z,{rowIndex:Q.rowIndex,rowPinned:Q.rowPinned},!0);if(n(q))return null;if(!q.rowPinned&&!(Z?.isRowInPage(q.rowIndex)??!0))return null;X=q?q.rowIndex:null,Y=q?q.rowPinned:null}return{rowIndex:X,column:G,rowPinned:Y}}isSuppressNavigable(Q,z){let{suppressNavigable:J}=Q.colDef;if(typeof J==="boolean")return J;if(typeof J==="function"){let Z=Q.createColumnFunctionCallbackParams(z);return J(Z)}return!1}};function A3(Q){return Q.focusSvc.getFocusedCell()}function j3(Q){return Q.focusSvc.clearFocusedCell()}function R3(Q,z,J,Z){Q.focusSvc.setFocusedCell({rowIndex:z,column:J,rowPinned:Z,forceBrowserFocus:!0})}function S3(Q,z){return Q.navigation?.tabToNextCell(!1,z)??!1}function O3(Q,z){return Q.navigation?.tabToNextCell(!0,z)??!1}function P3(Q,z,J=!1){let Z=Q.headerNavigation?.getHeaderPositionForColumn(z,J);if(!Z)return;Q.focusSvc.focusHeaderPosition({headerPosition:Z})}function mQ(Q){let z=Q;return z?.getFrameworkComponentInstance!=null?z.getFrameworkComponentInstance():Q}var T3=class extends j{constructor(){super(...arguments);this.beanName="editModelSvc",this.edits=new Map,this.cellValidations=new m$,this.rowValidations=new c$,this.suspendEdits=!1}suspend(Q){this.suspendEdits=Q}removeEdits({rowNode:Q,column:z}){if(!this.hasEdits({rowNode:Q})||!Q)return;let J=this.getEditRow(Q);if(z)J.delete(z);else J.clear();if(J.size===0)this.edits.delete(Q)}getEditRow(Q,z={}){if(this.suspendEdits)return;if(this.edits.size===0)return;let J=Q&&this.edits.get(Q);if(J)return J;if(z.checkSiblings){let Z=Q.pinnedSibling;if(Z)return this.getEditRow(Z)}return}getEditRowDataValue(Q,{checkSiblings:z}={}){if(!Q||this.edits.size===0)return;let J=this.getEditRow(Q),Z=Q.pinnedSibling,$=z&&Z&&this.getEditRow(Z);if(!J&&!$)return;let X={...Q.data},Y=(G,q)=>G.forEach(({editorValue:H,pendingValue:_},U)=>{let W=H===void 0?_:H;if(W!==P0)q[U.getColId()]=W});if(J)Y(J,X);if($)Y($,X);return X}getEdit(Q={},z){let{rowNode:J,column:Z}=Q,$=this.edits;if(this.suspendEdits||$.size===0||!J||!Z)return;let X=$.get(J)?.get(Z);if(X)return X;if(z?.checkSiblings){let Y=J.pinnedSibling;if(Y)return $.get(Y)?.get(Z)}return}getEditMap(Q=!0){if(this.suspendEdits||this.edits.size===0)return new Map;if(!Q)return this.edits;let z=new Map;return this.edits.forEach((J,Z)=>{let $=new Map;J.forEach(({editorState:X,...Y},G)=>$.set(G,{...Y})),z.set(Z,$)}),z}setEditMap(Q){this.edits.clear(),Q.forEach((z,J)=>{let Z=new Map;z.forEach(($,X)=>Z.set(X,{...$})),this.edits.set(J,Z)})}setEdit(Q,z){let J=this.edits;if(J.size===0||!J.has(Q.rowNode))J.set(Q.rowNode,new Map);let Z=this.getEdit(Q),$={editorState:{isCancelAfterEnd:void 0,isCancelBeforeStart:void 0},...Z,...z};return this.getEditRow(Q.rowNode).set(Q.column,$),$}clearEditValue(Q){let{rowNode:z,column:J}=Q;if(!z)return;let Z=(X)=>{X.editorValue=void 0,X.pendingValue=X.sourceValue,X.state="changed"};if(!J){this.getEditRow(z)?.forEach(Z);return}let $=this.getEdit(Q);if($)Z($)}getState(Q){if(this.suspendEdits)return;return this.getEdit(Q)?.state}getEditPositions(Q){if(this.suspendEdits||(Q??this.edits).size===0)return[];let z=[];return(Q??this.edits).forEach((J,Z)=>{for(let $ of J.keys()){let{editorState:X,...Y}=J.get($);z.push({rowNode:Z,column:$,...Y})}}),z}hasRowEdits(Q,z){if(this.suspendEdits)return!1;if(this.edits.size===0)return!1;return!!this.getEditRow(Q,z)}hasEdits(Q={},z={}){if(this.suspendEdits)return!1;if(this.edits.size===0)return!1;let{rowNode:J,column:Z}=Q,{withOpenEditor:$}=z;if(J){let X=this.getEditRow(J,z);if(!X)return!1;if(Z){if($)return this.getEdit(Q)?.state==="editing";return X.has(Z)}if(X.size!==0){if($)return Array.from(X.values()).some(({state:Y})=>Y==="editing");return!0}return!1}if($)return this.getEditPositions().some(({state:X})=>X==="editing");return this.edits.size>0}start(Q){let z=this.getEditRow(Q.rowNode)??new Map,{rowNode:J,column:Z}=Q;if(Z&&!z.has(Z))z.set(Z,{editorValue:void 0,pendingValue:P0,sourceValue:this.beans.valueSvc.getValue(Z,J,"data"),state:"editing",editorState:{isCancelAfterEnd:void 0,isCancelBeforeStart:void 0}});this.edits.set(J,z)}stop(Q,z,J){if(!this.hasEdits(Q))return;if(z){let Z=this.getEditRow(Q.rowNode)?.get(Q.column);if(Z&&(Z.pendingValue===P0||Z.pendingValue===Z.sourceValue))this.removeEdits(Q);else if(Z&&J)Z.editorValue=void 0}else this.removeEdits(Q)}clear(){for(let Q of this.edits.values())Q.clear();this.edits.clear()}getCellValidationModel(){return this.cellValidations}getRowValidationModel(){return this.rowValidations}setCellValidationModel(Q){this.cellValidations=Q}setRowValidationModel(Q){this.rowValidations=Q}destroy(){super.destroy(),this.clear()}},m$=class{constructor(){this.cellValidations=new Map}getCellValidation(Q){let{rowNode:z,column:J}=Q||{};return this.cellValidations?.get(z)?.get(J)}hasCellValidation(Q){if(!Q?.rowNode||!Q.column)return this.cellValidations.size>0;return!!this.getCellValidation(Q)}setCellValidation(Q,z){let{rowNode:J,column:Z}=Q;if(!this.cellValidations.has(J))this.cellValidations.set(J,new Map);this.cellValidations.get(J).set(Z,z)}clearCellValidation(Q){let{rowNode:z,column:J}=Q;this.cellValidations.get(z)?.delete(J)}setCellValidationMap(Q){this.cellValidations=Q}getCellValidationMap(){return this.cellValidations}clearCellValidationMap(){this.cellValidations.clear()}},c$=class{constructor(){this.rowValidations=new Map}getRowValidation(Q){let{rowNode:z}=Q||{};return this.rowValidations.get(z)}hasRowValidation(Q){if(!Q?.rowNode)return this.rowValidations.size>0;return!!this.getRowValidation(Q)}setRowValidation({rowNode:Q},z){this.rowValidations.set(Q,z)}clearRowValidation({rowNode:Q}){this.rowValidations.delete(Q)}setRowValidationMap(Q){this.rowValidations=Q}getRowValidationMap(){return this.rowValidations}clearRowValidationMap(){this.rowValidations.clear()}};function BZ(Q,z={}){let{rowIndex:J,rowId:Z,rowCtrl:$,rowPinned:X}=z;if($)return $;let{rowModel:Y,rowRenderer:G}=Q,{rowNode:q}=z;if(!q){if(Z)q=GH(Q,Z,X);else if(J!=null)q=Y.getRow(J)}return q?G.getRowCtrlByNode(q):void 0}function s(Q,z={}){let{cellCtrl:J,colId:Z,columnId:$,column:X}=z;if(J)return J;let Y=Q.colModel.getCol(Z??$??L5(X)),G=z.rowCtrl??BZ(Q,z),q=G?.getCellCtrl(Y)??void 0;if(q)return q;let H=z.rowNode??G?.rowNode;if(H)return Q.rowRenderer.getCellCtrls([H],[Y])?.[0];return}function l7(Q){let{editSvc:z}=Q;if(z?.isBatchEditing())Qz(Q,{persist:!0}),eQ(Q);else z?.stopEditing(void 0,{source:"api"})}function v3(Q,z,J){let{gos:Z,popupSvc:$}=z;if(!Z.get("stopEditingWhenCellsLoseFocus"))return;let X=(Y)=>{let G=Y.relatedTarget;if(q5(G)===null){l7(z);return}let q=J.some((H)=>H.contains(G))&&Z.isElementInThisInstance(G);if(!q)q=!!$&&($.getActivePopups().some((H)=>H.contains(G))||$.isElementWithinCustomPopup(G));if(!q)l7(z)};for(let Y of J)Q.addManagedElementListeners(Y,{focusout:X})}function L5(Q){if(!Q)return;if(typeof Q==="string")return Q;return Q.getColId()}var P0=Symbol("unedited"),I3=(Q,z={})=>{let J=Q.rowRenderer.getCellCtrls(z.rowNodes,z.columns),Z=Array(J.length),$=0;for(let X=0,Y=J.length;X0)z.set(J,$)}return z}function gz(Q,z,J){let{key:Z,event:$,cellStartedEdit:X,silent:Y}=J??{},{editModelSvc:G,gos:q,userCompFactory:H}=Q,_=s(Q,z),U=_?.comp?.getCellEditor(),W=i$(Q,z,Z,X&&!Y),B=G?.getEdit(z),E=W.value??B?.sourceValue;if(U){G?.setEdit(z,{editorValue:F1(Q,E,!0,z.column),state:"editing"}),U.refresh?.(W);return}let K=z.column.getColDef(),L=P9(H,K,W);if(!L)return;let{popupFromSelector:F,popupPositionFromSelector:D}=L,M=F??!!K.cellEditorPopup,k=D??K.cellEditorPopupPosition;if(n$(L.params,$),!_)return;let{rangeFeature:f,rowCtrl:A,comp:O,onEditorAttachedFuncs:v}=_;G?.setEdit(z,{editorValue:F1(Q,E,!0,z.column),state:"editing",editorState:{cellStartedEditing:void 0,cellStoppedEditing:void 0}}),_.editCompDetails=L,v.push(()=>f?.unsetComp()),O?.setEditDetails(L,M,k,q.get("reactiveCustomComponents")),A?.refreshRow({suppressFlash:!0}),y3(Q,z,$,E,Y)}function y3(Q,z,J,Z,$){let{editSvc:X,editModelSvc:Y}=Q,G=Y?.getEdit(z);if(!$&&G?.state==="editing"&&!G?.editorState?.cellStartedEditing)X?.dispatchCellEvent(z,J,"cellEditingStarted",{value:Z}),Y?.setEdit(z,{editorState:{cellStartedEditing:!0}})}function p$(Q,z,J){let Z={editorValueExists:!1};if(A6(Q)){if((z.getValidationErrors?.()?.length??0)>0)return Z}if(J?.isCancelling)return Z;if(J?.isStopping){let X=z?.isCancelAfterEnd?.();if(X)return{...Z,isCancelAfterEnd:X}}return{editorValue:z.getValue(),editorValueExists:!0}}function i$(Q,z,J,Z){let{valueSvc:$,gos:X,editSvc:Y}=Q,G=Q.gos.get("enableGroupEdit"),q=s(Q,z),H=z.rowNode?.rowIndex??void 0,_=Y?.isBatchEditing(),U=Q.colModel.getCol(z.column.getId()),{rowNode:W,column:B}=z,E=q.comp?.getCellEditor(),K=Y?.getCellDataValue(z),L=K===void 0?E?p$(Q,E)?.editorValue:void 0:K,F=L===P0?$.getValueForDisplay({column:U,node:W,from:"edit"})?.value:L,D=G?L:F;if(B.isAllowFormula()&&Q.formula?.isFormula(D))D=Q.formula?.normaliseFormula(D,!0)??D;return y(X,{value:D,eventKey:J??null,column:B,colDef:B.getColDef(),rowIndex:H,node:W,data:W.data,cellStartedEdit:!!Z,onKeyDown:q?.onKeyDown.bind(q),stopEditing:(M)=>{Y.stopEditing(z,{source:_?"ui":"api",suppressNavigateAfterEdit:M}),QJ(Q,z,{})},eGridCell:q?.eGui,parseValue:(M)=>$.parseValue(U,W,M,q?.value),formatValue:q?.formatValue.bind(q),validate:()=>{Y?.validateEdit()}})}function x1(Q,z){let{editModelSvc:J}=Q;J?.getEditMap().forEach((Z,$)=>{Z.forEach((X,Y)=>{if(!z&&(X.state==="editing"||X.pendingValue===P0))return;if(!BQ(X)&&(X.state!=="editing"||z))J?.removeEdits({rowNode:$,column:Y})})})}function x3(Q,z){let J=z.comp?.getCellEditor();if(!J?.refresh)return;let{eventKey:Z,cellStartedEdit:$}=z.editCompDetails.params,{column:X}=z,Y=i$(Q,z,Z,$),G=X.getColDef(),q=P9(Q.userCompFactory,G,Y);J.refresh(n$(q.params,Z))}function n$(Q,z){if(z instanceof KeyboardEvent&&Q.column.getColDef().cellEditor==="agNumberCellEditor")Q.suppressPreventDefault=["-","+",".","e"].includes(z?.key??"")||Q.suppressPreventDefault;else z?.preventDefault?.();return Q}function Qz(Q,z){for(let J of Q.editModelSvc?.getEditPositions()??[]){let Z=s(Q,J);if(!Z)continue;let $=Z.comp?.getCellEditor();if(!$)continue;let{editorValue:X,editorValueExists:Y,isCancelAfterEnd:G}=p$(Q,$,z);if(G){let{cellStartedEditing:q,cellStoppedEditing:H}=Q.editModelSvc?.getEdit(J)?.editorState||{};Q.editModelSvc?.setEdit(J,{editorState:{isCancelAfterEnd:G,cellStartedEditing:q,cellStoppedEditing:H}})}z1(Q,J,X,void 0,!Y,z)}}function z1(Q,z,J,Z,$,X){let{editModelSvc:Y,valueSvc:G}=Q;if(!Y)return;let{rowNode:q,column:H}=z;if(!(q&&H))return;let _=Y.getEdit(z);if(_?.sourceValue===void 0){let U=_?F1(Q,_.editorValue,!1,H):P0,W={sourceValue:G.getValue(H,q,"data"),pendingValue:U};if(X?.persist)W.state="changed";_=Y.setEdit(z,W)}if(Y.setEdit(z,{editorValue:$?F1(Q,_.sourceValue,!0,H):J}),X?.persist)w3(Q,z)}function F1(Q,z,J,Z){let{formula:$}=Q;if(Z.isAllowFormula()&&$?.isFormula(z))return $?.normaliseFormula(z,J)??z;return z}function w3(Q,z){let{editModelSvc:J}=Q,Z=J?.getEdit(z),X={pendingValue:F1(Q,Z?.editorValue,!1,z.column)};if(!Z?.editorState?.cellStoppedEditing&&Z?.state!=="editing")X.state="changed";J?.setEdit(z,X)}function eQ(Q,z,J={}){if(!z)z=Q.editModelSvc?.getEditPositions();if(z)for(let Z of z)QJ(Q,Z,J)}function QJ(Q,z,J,Z=s(Q,z)){let $=Q.editModelSvc,X=$?.getEdit(z),Y;if(X&&X.state!=="editing"&&X.editorState?.cellStoppedEditing)Y=X.state;else Y="changed";if(!Z){if(X)$?.setEdit(z,{state:Y});return}let G=Z.comp,q=G?.getCellEditor();if(G&&!q){if(Z?.refreshCell(),X){$?.setEdit(z,{state:Y});let _=Q.gos.get("enableGroupEdit")?a7(X,J?.cancel):{valueChanged:!1,newValue:void 0,oldValue:X.sourceValue};o7(Q,z,_,J)}return}if(A6(Q)){let _=X&&q?.getValidationErrors?.(),U=$?.getCellValidationModel();if(_?.length)U?.setCellValidation(z,{errorMessages:_});else U?.clearCellValidation(z)}if(X)$?.setEdit(z,{state:Y});G?.setEditDetails(),G?.refreshEditStyles(!1,!1),Z?.refreshCell({force:!0,suppressFlash:!0});let H=$?.getEdit(z);if(H&&H.state!=="editing"){let _=J?.cancel,U=Q.gos.get("enableGroupEdit")?a7(H,_):N3(H,X,_);o7(Q,z,U,J)}}function a7(Q,z){let{sourceValue:J,pendingValue:Z}=Q,$;if(!z&&Z!==P0)$=Z;return{valueChanged:!z&&BQ(Q),newValue:$,oldValue:J,value:J}}function N3(Q,z,J){if(J||Q.editorState.isCancelAfterEnd)return{valueChanged:!1,newValue:void 0,oldValue:Q.sourceValue};let Z=Q.editorValue;if(Z==null||Z===P0)Z=z?.pendingValue;if(Z===P0)Z=void 0;return{valueChanged:BQ(Q),newValue:Z,oldValue:Q.sourceValue}}function o7(Q,z,J,{silent:Z,event:$}={}){let{editSvc:X,editModelSvc:Y}=Q,G=Y?.getEdit(z),{editorState:q}=G||{},{isCancelBeforeStart:H,cellStartedEditing:_,cellStoppedEditing:U}=q||{};if(!Z&&!H&&_&&!U)X?.dispatchCellEvent(z,$,"cellEditingStopped",J),Y?.setEdit(z,{editorState:{cellStoppedEditing:!0}})}function g3(Q){if(!Q)return!1;for(let z=0,J=Q.length;z0,M=D?L.join(". "):"";if(S8(F,D),D)Z.announceValue(`${H} ${L}`,"editorValidation");if(F instanceof HTMLInputElement)F.setCustomValidity(M);else F.classList.toggle("invalid",D)}if(L?.length>0)J.setCellValidation({rowNode:E,column:K},{errorMessages:L});_.add(U.rowCtrl)}if(Qz(Q,{persist:!1}),X?.setCellValidationModel(J),G){let U=u3(Q);X?.setRowValidationModel(U)}for(let U of _.values()){U.rowEditStyleFeature?.applyRowStyles();for(let W of U.getAllCellCtrls())W.tooltipFeature?.refreshTooltip(!0),W.editorTooltipFeature?.refreshTooltip(!0),W.editStyleFeature?.applyCellStyles?.()}}var u3=(Q)=>{let z=new c$,J=Q.gos.get("getFullRowEditValidationErrors"),Z=Q.editModelSvc?.getEditMap();if(!Z)return z;for(let $ of Z.keys()){let X=Z.get($);if(!X)continue;let Y=[],{rowIndex:G,rowPinned:q}=$;for(let _ of X.keys()){let U=X.get(_);if(!U)continue;let{editorValue:W,pendingValue:B,sourceValue:E}=U,K=W??(B===P0?void 0:B)??E;Y.push({column:_,colId:_.getColId(),rowIndex:G,rowPinned:q,oldValue:E,newValue:K})}let H=J?.({editorsState:Y})??[];if(H.length>0)z.setRowValidation({rowNode:$},{errorMessages:H})}return z};function m3(Q){Yz(Q,!0);let z=Q.editModelSvc?.getCellValidationModel().getCellValidationMap();if(!z)return null;let J=[];return z.forEach((Z,$)=>{Z.forEach(({errorMessages:X},Y)=>{J.push({column:Y,rowIndex:$.rowIndex,rowPinned:$.rowPinned,messages:X??null})})}),J}function iZ(Q){return!!(Q.rowPinned&&Q.pinnedSibling)}function t0(Q,z,J,Z){let $=z==="top";if(!J)return t0(Q,z,$?Q.getPinnedTopRow(0):Q.getPinnedBottomRow(0),Z);if(!Z){let q=$?Q.getPinnedTopRowCount():Q.getPinnedBottomRowCount();return t0(Q,z,J,$?Q.getPinnedTopRow(q-1):Q.getPinnedBottomRow(q-1))}let X=!1,Y=!1,G=[];return Q.forEachPinnedRow(z,(q)=>{if(q===J&&!X){X=!0,G.push(q);return}if(X&&q===Z){Y=!0,G.push(q);return}if(X&&!Y)G.push(q)}),G}function c3(Q,z,J,{rowNode:Z,column:$},X){return y(Q.gos,{type:J,node:Z,data:Z.data,value:X,column:$,colDef:$.getColDef(),rowPinned:Z.rowPinned,event:z,rowIndex:Z.rowIndex})}function p3(Q,z=!1){if(Q===V.DELETE)return!0;if(!z&&Q===V.BACKSPACE)return C9();return!1}var i3=class extends j{constructor(Q,z,J,Z){super();this.cellCtrl=Q,this.rowNode=J,this.rowCtrl=Z,this.beans=z}init(){this.eGui=this.cellCtrl.eGui}onKeyDown(Q){let z=Q.key;if(z===V.ENTER&&v0(this.cellCtrl.column)&&this.beans.rowNumbersSvc?.handleKeyDownOnCell(this.cellCtrl.cellPosition,Q))return;switch(z){case V.ENTER:this.onEnterKeyDown(Q);break;case V.F2:this.onF2KeyDown(Q);break;case V.ESCAPE:this.onEscapeKeyDown(Q);break;case V.TAB:this.onTabKeyDown(Q);break;case V.BACKSPACE:case V.DELETE:this.onBackspaceOrDeleteKeyDown(z,Q);break;case V.DOWN:case V.UP:case V.RIGHT:case V.LEFT:this.onNavigationKeyDown(Q,z);break}}onNavigationKeyDown(Q,z){let{cellCtrl:J,beans:Z}=this;if(Z.editSvc?.isEditing(J,{withOpenEditor:!0}))return;if(Q.shiftKey&&J.isRangeSelectionEnabled())this.onShiftRangeSelect(Q);else{let $=J.getFocusedCellPosition();Z.navigation?.navigateToNextCell(Q,z,$,!0)}Q.preventDefault()}onShiftRangeSelect(Q){let{rangeSvc:z,navigation:J}=this.beans;if(!z)return;let Z=z.extendLatestRangeInDirection(Q);if(!Z)return;if(Q.key===V.LEFT||Q.key===V.RIGHT)J?.ensureColumnVisible(Z.column);else J?.ensureRowVisible(Z.rowIndex)}onTabKeyDown(Q){this.beans.navigation?.onTabKeyDown(this.cellCtrl,Q)}onBackspaceOrDeleteKeyDown(Q,z){let{cellCtrl:J,beans:Z,rowNode:$}=this,{gos:X,rangeSvc:Y,eventSvc:G,editSvc:q}=Z;if(G.dispatchEvent({type:"keyShortcutChangedCellStart"}),p3(Q,X.get("enableCellEditingOnBackspace"))&&!q?.isEditing(J,{withOpenEditor:!0})){if(Y&&u0(X))Y.clearCellRangeCellValues({dispatchWrapperEvents:!0,wrapperEventSource:"deleteKey"});else if(J.isCellEditable()){let H=Z.valueSvc.getDeleteValue(J.column,$);$.setDataValue(J.column,H,"cellClear")}}else if(!q?.isEditing(J,{withOpenEditor:!0}))Z.editSvc?.startEditing(J,{startedEdit:!0,event:z});G.dispatchEvent({type:"keyShortcutChangedCellEnd"})}onEnterKeyDown(Q){let{cellCtrl:z,beans:J}=this,{editSvc:Z,navigation:$}=J,X=Z?.isEditing(z,{withOpenEditor:!0}),Y=z.rowNode,G=Z?.isRowEditing(Y,{withOpenEditor:!0}),q=(H)=>{if(Z?.startEditing(H,{startedEdit:!0,event:Q,source:"edit"}))Q.preventDefault()};if(X||G){if(this.isCtrlEnter(Q)){Z?.applyBulkEdit(z,J?.rangeSvc?.getCellRanges()||[]);return}if(Yz(J),Z?.checkNavWithValidation(void 0,Q)==="block-stop")return;if(Z?.isEditing(z,{withOpenEditor:!0}))Z?.stopEditing(z,{event:Q,source:"edit"});else if(G&&!z.isCellEditable())Z?.stopEditing({rowNode:Y},{event:Q,source:"edit"});else q(z)}else if(J.gos.get("enterNavigatesVertically")){let H=Q.shiftKey?V.UP:V.DOWN;$?.navigateToNextCell(null,H,z.cellPosition,!1)}else{if(Z?.hasValidationErrors())return;if(Z?.hasValidationErrors(z))Z.revertSingleCellEdit(z,!0);q(z)}}isCtrlEnter(Q){return(Q.ctrlKey||Q.metaKey)&&Q.key===V.ENTER}onF2KeyDown(Q){let{cellCtrl:z,beans:{editSvc:J}}=this;if(J?.isEditing()){if(Yz(this.beans),J?.checkNavWithValidation(void 0,Q)==="block-stop")return}J?.startEditing(z,{startedEdit:!0,event:Q})}onEscapeKeyDown(Q){let{cellCtrl:z,beans:{editSvc:J}}=this;if(J?.checkNavWithValidation(z,Q)==="block-stop")J.revertSingleCellEdit(z);setTimeout(()=>{J?.stopEditing(z,{event:Q,cancel:!0})})}processCharacter(Q){let J=Q.target!==this.eGui,{beans:{editSvc:Z},cellCtrl:$}=this;if(J)return;if(Z?.isEditing($,{withOpenEditor:!0}))return;if(Q.key===V.SPACE)this.onSpaceKeyDown(Q);else if(Z?.isCellEditable($,"ui")){if(Z?.hasValidationErrors()&&!Z?.hasValidationErrors($))return;if(Z?.startEditing($,{startedEdit:!0,event:Q,source:"api",editable:!0}),!$.editCompDetails?.params?.suppressPreventDefault)Q.preventDefault()}}onSpaceKeyDown(Q){let{gos:z,editSvc:J}=this.beans,{rowNode:Z}=this.cellCtrl;if(!J?.isEditing(this.cellCtrl,{withOpenEditor:!0})&&hQ(z))this.beans.selectionSvc?.handleSelectionEvent(Q,Z,"spaceKey");Q.preventDefault()}},n3=class extends j{constructor(Q,z,J){super();this.cellCtrl=Q,this.column=J,this.beans=z}onMouseEvent(Q,z){if(zQ(z))return;switch(Q){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(Q){if(this.beans.touchSvc?.handleCellDoubleClick(this,Q))return;let{eventSvc:z,rangeSvc:J,editSvc:Z,editModelSvc:$,frameworkOverrides:X,gos:Y}=this.beans,G=Q.ctrlKey||Q.metaKey,{cellCtrl:q}=this,{column:H,cellPosition:_,rowNode:U}=q,W=rJ(Y,H,U,Q);if(J&&G&&!W){if(J.getCellRangeCount(_)>1)J.intersectLastRange(!0)}let B=q.createEvent(Q,"cellClicked");B.isEventHandlingSuppressed=W,z.dispatchEvent(B);let E=H.getColDef();if(E.onCellClicked)window.setTimeout(()=>{X.wrapOutgoing(()=>{E.onCellClicked(B)})},0);if(W)return;if($?.getState(q)!=="editing"){let K=Z?.isEditing(),L=Z?.isRangeSelectionEnabledWhileEditing(),F=$?.getCellValidationModel().getCellValidationMap().size??0,D=$?.getRowValidationModel().getRowValidationMap().size??0;if(K&&(L||F>0||D>0))return;if(Z?.shouldStartEditing(q,Q))Z?.startEditing(q,{event:Q});else if(Z?.shouldStopEditing(q,Q))if(this.beans.gos.get("editType")==="fullRow")Z?.stopEditing(q,{event:Q,source:"edit"});else Z?.stopEditing(void 0,{event:Q,source:"edit"})}}onCellDoubleClicked(Q){let{column:z,beans:J,cellCtrl:Z}=this,{eventSvc:$,frameworkOverrides:X,editSvc:Y,editModelSvc:G,gos:q}=J,H=rJ(q,Z.column,Z.rowNode,Q),_=z.getColDef(),U=Z.createEvent(Q,"cellDoubleClicked");if(U.isEventHandlingSuppressed=H,$.dispatchEvent(U),typeof _.onCellDoubleClicked==="function")window.setTimeout(()=>{X.wrapOutgoing(()=>{_.onCellDoubleClicked(U)})},0);if(H)return;if(Y?.shouldStartEditing(Z,Q)&&G?.getState(Z)!=="editing"){let W=Y?.isEditing(),B=Y?.isRangeSelectionEnabledWhileEditing(),E=G?.getCellValidationModel().getCellValidationMap().size??0,K=G?.getRowValidationModel().getRowValidationMap().size??0;if(W&&(B||E>0||K>0))return;Y?.startEditing(Z,{event:Q})}}onMouseDown(Q){let{shiftKey:z}=Q,J=Q.target,{cellCtrl:Z,beans:$}=this,{eventSvc:X,rangeSvc:Y,rowNumbersSvc:G,focusSvc:q,gos:H,editSvc:_}=$,{column:U,rowNode:W,cellPosition:B}=Z,E=rJ(H,U,W,Q),K=()=>{let M=Z.createEvent(Q,"cellMouseDown");M.isEventHandlingSuppressed=E,X.dispatchEvent(M)};if(E){K();return}if(this.isRightClickInExistingRange(Q))return;let L=Y&&!Y.isEmpty(),F=this.containsWidget(J),D=v0(U);if(G&&D&&!G.handleMouseDownOnCell(B,Q))return;if(!z||!L){let M=_?.isEditing(Z),f=H.get("enableCellTextSelection")&&Q.defaultPrevented,A=(cz()||f)&&!M&&!w1(J)&&!F;Z.focusCell(A,Q)}if(z&&L&&!q.isCellFocused(B)){Q.preventDefault();let M=q.getFocusedCell();if(M){let{column:k,rowIndex:f,rowPinned:A}=M,O=!!_?.isRangeSelectionEnabledWhileEditing?.();if(_?.isEditing(M)&&!O)_?.stopEditing(M);if(!O)q.setFocusedCell({column:k,rowIndex:f,rowPinned:A,forceBrowserFocus:!0,preventScrollOnBrowserFocus:!0,sourceEvent:Q})}}if(F)return;Y?.handleCellMouseDown(Q,B),K()}isRightClickInExistingRange(Q){let{rangeSvc:z}=this.beans;if(z){let J=z.isCellInAnyRange(this.cellCtrl.cellPosition),Z=u5(this.beans,Q);if(J&&Z)return!0}return!1}containsWidget(Q){return vz(Q,"ag-selection-checkbox",3)||vz(Q,"ag-drag-handle",3)}onMouseOut(Q){if(this.mouseStayingInsideCell(Q))return;let{eventSvc:z,colHover:J}=this.beans;z.dispatchEvent(this.cellCtrl.createEvent(Q,"cellMouseOut")),J?.clearMouseOver()}onMouseOver(Q){if(this.mouseStayingInsideCell(Q))return;let{eventSvc:z,colHover:J}=this.beans;z.dispatchEvent(this.cellCtrl.createEvent(Q,"cellMouseOver")),J?.setMouseOver([this.column])}mouseStayingInsideCell(Q){if(!Q.target||!Q.relatedTarget)return!1;let z=this.cellCtrl.eGui,J=z.contains(Q.target),Z=z.contains(Q.relatedTarget);return J&&Z}},d3=class extends j{constructor(Q,z){super();this.cellCtrl=Q,this.beans=z,this.column=Q.column,this.rowNode=Q.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 Q=this.cellCtrl.getCellSpan();if(!Q)this.setupColSpan(),this.setupRowSpan();if(this.onLeftChanged(),this.onWidthChanged(),!Q)this._legacyApplyRowSpan();if(Q){let z=this.refreshSpanHeight.bind(this,Q);z(),this.addManagedListeners(this.beans.eventSvc,{paginationChanged:z,recalculateRowBounds:z,pinnedHeightChanged:z})}}refreshSpanHeight(Q){let z=Q.getCellHeight();if(z!=null)this.eContent.style.height=`${z}px`}onNewColumnsLoaded(){let Q=this.column.getRowSpan(this.rowNode);if(this.rowSpan===Q)return;this.rowSpan=Q,this._legacyApplyRowSpan(!0)}onDisplayColumnsChanged(){let Q=this.getColSpanningList();if(!X0(this.colsSpanning,Q))this.colsSpanning=Q,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 Q=this.getCellWidth();this.eContent.style.width=`${Q}px`}getCellWidth(){if(!this.colsSpanning)return this.column.getActualWidth();return this.colsSpanning.reduce((Q,z)=>Q+z.getActualWidth(),0)}getColSpanningList(){let{column:Q,rowNode:z}=this,J=Q.getColSpan(z),Z=[];if(J===1)Z.push(Q);else{let $=Q,X=Q.getPinned();for(let Y=0;$&&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(Z,Y),this.refreshFirstAndLastStyles(),this.checkFormulaError(),this.refreshAriaRowIndex(),this.refreshAriaColIndex(),this.positionFeature?.init(),this.customStyleFeature?.setComp(Q),this.editStyleFeature?.setComp(Q),this.tooltipFeature?.refreshTooltip(),this.keyboardListener?.init(),this.rangeFeature?.setComp(Q),this.rowResizeFeature?.refreshRowResizer();let G=X?this.isCellEditable():void 0,q=!G&&this.hasEdit&&this.editSvc?.isEditing(this,{withOpenEditor:!0});if(G||q)this.editSvc?.startEditing(this,{startedEdit:!1,source:"api",silent:!0,continueEditing:!0,editable:G});else this.showValue(!1,!0);if(this.onCompAttachedFuncs.length){for(let H of this.onCompAttachedFuncs)H();this.onCompAttachedFuncs=[]}}checkFormulaError(){let Q=!!this.beans.formula?.getFormulaError(this.column,this.rowNode);this.eGui.classList.toggle("formula-error",Q)}setupAutoHeight(Q,z){this.isAutoHeight=this.beans.rowAutoHeight?.setupCellAutoHeight(this,Q,z)??!1}getCellAriaRole(){return this.column.getColDef().cellAriaRole??"gridcell"}isCellRenderer(){let Q=this.column.getColDef();return Q.cellRenderer!=null||Q.cellRendererSelector!=null}getValueToDisplay(){return this.valueFormatted??this.value}getDeferLoadingCellRenderer(){let{beans:Q,column:z}=this,{userCompFactory:J,ctrlsSvc:Z,eventSvc:$}=Q,X=z.getColDef(),Y=this.createCellRendererParams();Y.deferRender=!0;let G=M7(J,X,Y);if(Z.getGridBodyCtrl()?.scrollFeature?.isScrolling()){let q,H=new g((U)=>{q=U}),[_]=this.addManagedListeners($,{bodyScrollEnd:()=>{q(),_()}});return{loadingComp:G,onReady:H}}return{loadingComp:G,onReady:g.resolve()}}showValue(Q,z){let{beans:J,column:Z,rowNode:$,rangeFeature:X}=this,{userCompFactory:Y}=J,G=this.getValueToDisplay(),q,H=$.stub&&$.groupData?.[Z.getId()]==null,_=Z.getColDef();if(H||this.isCellRenderer()){let U=this.createCellRendererParams();if(!H||v0(Z))q=o1(Y,_,U);else q=M7(Y,_,U)}if(!q&&!H&&J.findSvc?.isMatch($,Z)){let U=this.createCellRendererParams();q=o1(Y,{...Z.getColDef(),cellRenderer:"agFindCellRenderer"},U)}if(this.hasEdit&&this.editSvc.isBatchEditing()&&this.editSvc.isRowEditing($,{checkSiblings:!0})){let U=this.editSvc.prepDetailsDuringBatch(this,{compDetails:q,valueToDisplay:G});if(U){if(U.compDetails)q=U.compDetails;else if(U.valueToDisplay)G=U.valueToDisplay}}if(this.comp.setRenderDetails(q,G,Q),this.customRowDragComp?.refreshVisibility(),!z&&X)YQ(J,()=>X?.refreshRangeStyleAndHandle());this.rowResizeFeature?.refreshRowResizer()}setupControlComps(){let Q=this.column.getColDef();this.includeSelection=this.isIncludeControl(this.isCheckboxSelection(Q),!0),this.includeRowDrag=this.isIncludeControl(Q.rowDrag),this.includeDndSource=this.isIncludeControl(Q.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",J="";if(z)J=" ag-allow-overflow";return`ag-cell-value${J}`}isIncludeControl(Q,z=!1){return(this.rowNode.rowPinned==null||z&&iZ(this.rowNode))&&!!Q}isCheckboxSelection(Q){let{rowSelection:z,groupDisplayType:J}=this.beans.gridOptions,Z=E1(z),$=IQ(this.column);if(J==="custom"&&Z!=="selectionColumn"&&$)return!1;return Q.checkboxSelection||$&&typeof z==="object"&&Jz(z)}refreshShouldDestroy(){let Q=this.column.getColDef(),z=this.includeSelection!=this.isIncludeControl(this.isCheckboxSelection(Q),!0),J=this.includeRowDrag!=this.isIncludeControl(Q.rowDrag),Z=this.includeDndSource!=this.isIncludeControl(Q.dndSource),$=this.isAutoHeight!=this.column.isAutoHeight();return z||J||Z||$}onPopupEditorClosed(Q){let{editSvc:z}=this.beans;if(!z?.isEditing(this,{withOpenEditor:!0}))return;let J=Q instanceof KeyboardEvent,Z=Q instanceof MouseEvent,$=J&&Q.key===V.ESCAPE;if(z.stopEditing(this,{source:z.isBatchEditing()?"ui":"api",cancel:$,event:J||Z?Q:void 0}),$)this.focusCell(!0,Q)}stopEditing(Q=!1){let{editSvc:z}=this.beans;return z?.stopEditing(this,{cancel:Q,source:z?.isBatchEditing()?"ui":"api"})??!1}createCellRendererParams(){let{value:Q,valueFormatted:z,column:J,rowNode:Z,comp:$,eGui:X,beans:{valueSvc:Y,gos:G,editSvc:q}}=this;return y(G,{value:Q,valueFormatted:z,getValue:()=>Y.getValueForDisplay({column:J,node:Z,from:"edit"}).value,setValue:(_)=>q?.setDataValue({rowNode:Z,column:J},_)||Z.setDataValue(J,_),formatValue:this.formatValue.bind(this),data:Z.data,node:Z,pinned:J.getPinned(),colDef:J.getColDef(),column:J,refreshCell:this.refreshCell.bind(this),eGridCell:X,eParentOfValue:$.getParentOfValue(),registerRowDragger:(_,U,W,B)=>this.registerRowDragger(_,U,B),setTooltip:(_,U)=>{if(G.assertModuleRegistered("Tooltip",3),this.tooltipFeature)this.disableTooltipFeature();this.enableTooltipFeature(_,U),this.tooltipFeature?.refreshTooltip()}})}onCellChanged(Q){if(Q.column===this.column)this.refreshCell()}refreshOrDestroyCell(Q){if(this.refreshShouldDestroy())this.rowCtrl?.recreateCell(this);else this.refreshCell(Q);if(this.hasEdit&&this.editCompDetails){let{editSvc:z,comp:J}=this;if(!J?.getCellEditor()&&z.isEditing(this,{withOpenEditor:!0}))z.startEditing(this,{startedEdit:!1,source:"api",silent:!0})}}refreshCell(Q){let{editStyleFeature:z,customStyleFeature:J,rowCtrl:{rowEditStyleFeature:Z},beans:{cellFlashSvc:$,filterManager:X},column:Y,comp:G,suppressRefreshCell:q,tooltipFeature:H}=this;if(q)return;let{field:_,valueGetter:U,showRowGroup:W,enableCellChangeFlash:B}=Y.getColDef(),E=_==null&&U==null&&W==null,K=Q?.newData??!1,L=E||Q&&(Q.force||K),F=!!G,D=this.updateAndFormatValue(F),M=L||D;if(!F)return;if(M){this.showValue(!!K,!1);let k=X?.isSuppressFlashingCellsBecauseFiltering();if(!Q?.suppressFlash&&!k&&B)$?.flashCell(this);z?.applyCellStyles?.(),J?.applyUserStyles(),J?.applyClassesFromColDef(),Z?.applyRowStyles(),this.checkFormulaError()}H?.refreshTooltip(),J?.applyCellClassRules()}isCellEditable(){return this.column.isCellEditable(this.rowNode)}formatValue(Q){return this.callValueFormatter(Q)??Q}callValueFormatter(Q){return this.beans.valueSvc.formatValue(this.column,this.rowNode,Q)}updateAndFormatValue(Q){let z=this.value,J=this.valueFormatted,{value:Z,valueFormatted:$}=this.beans.valueSvc.getValueForDisplay({column:this.column,node:this.rowNode,includeValueFormatted:!0,from:"edit"});if(this.value=Z,this.valueFormatted=$,Q)return!this.valuesAreEqual(z,this.value)||this.valueFormatted!=J;return!0}valuesAreEqual(Q,z){let J=this.column.getColDef();return J.equals?J.equals(Q,z):Q===z}addDomData(Q){let z=this.eGui;wz(this.beans.gos,z,HZ,this),Q.addDestroyFunc(()=>wz(this.beans.gos,z,HZ,null))}createEvent(Q,z){let{rowNode:J,column:Z,value:$,beans:X}=this;return c3(X,Q,z,{rowNode:J,column:Z},$)}processCharacter(Q){this.keyboardListener?.processCharacter(Q)}onKeyDown(Q){this.keyboardListener?.onKeyDown(Q)}onMouseEvent(Q,z){this.mouseListener?.onMouseEvent(Q,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:Q,column:z,beans:J}=this;t9(Q,z,J.visibleCols)}refreshAriaColIndex(){let Q=this.beans.visibleCols.getAriaColIndex(this.column);v8(this.eGui,Q)}onWidthChanged(){return this.positionFeature?.onWidthChanged()}getRowPosition(){let{rowIndex:Q,rowPinned:z}=this.cellPosition;return{rowIndex:Q,rowPinned:z}}updateRangeBordersIfRangeCount(){if(!this.comp)return;this.rangeFeature?.updateRangeBordersIfRangeCount()}onCellSelectionChanged(){if(!this.comp)return;this.rangeFeature?.onCellSelectionChanged()}isRangeSelectionEnabled(){return this.rangeFeature!=null}focusCell(Q=!1,z){let J=this.editSvc?.allowedFocusTargetOnValidation(this);if(J&&J!==this)return;this.beans.focusSvc.setFocusedCell({...this.getFocusedCellPosition(),forceBrowserFocus:Q,sourceEvent:z})}restoreFocus(Q=!1){let{beans:{editSvc:z,focusSvc:J},comp:Z}=this;if(!Z||z?.isEditing(this)||!this.isCellFocused()||!J.shouldTakeFocus())return;let $=()=>{if(!this.isAlive())return;let X=Z.getFocusableElement();if(this.isCellFocused())X.focus({preventScroll:!0})};if(Q){setTimeout($,0);return}$()}onRowIndexChanged(){this.createCellPosition(),this.refreshAriaRowIndex(),this.onCellFocused(),this.restoreFocus(),this.rangeFeature?.onCellSelectionChanged(),this.rowResizeFeature?.refreshRowResizer()}onSuppressCellFocusChanged(Q){let z=this.eGui;if(!z)return;Pz(z,"tabindex",Q?void 0:-1)}onFirstRightPinnedChanged(){if(!this.comp)return;let Q=this.column.isFirstRightPinned();this.comp.toggleCss(a3,Q)}onLastLeftPinnedChanged(){if(!this.comp)return;let Q=this.column.isLastLeftPinned();this.comp.toggleCss(o3,Q)}checkCellFocused(){return this.beans.focusSvc.isCellFocused(this.cellPosition)}isCellFocused(){let Q=this.checkCellFocused();return this.hasBeenFocused||(this.hasBeenFocused=Q),Q}setupFocus(){this.restoreFocus(!0),this.onCellFocused(this.focusEventWhileNotReady??void 0)}onCellFocused(Q){let{beans:z}=this;if(qZ(z))return;if(!this.comp){if(Q)this.focusEventWhileNotReady=Q;return}let J=this.isCellFocused(),Z=z.editSvc?.isEditing(this)??!1;if(this.comp.toggleCss(l3,J),J&&(Q?.forceBrowserFocus||!this.hasBrowserFocus()&&this.beans.focusSvc.shouldTakeFocus())){let $=this.comp.getFocusableElement();if(Z){let Y=EQ($,null,!0);if(Y.length)$=Y[0]}let X=Q?Q.preventScrollOnBrowserFocus:!0;$.focus({preventScroll:X}),JG(z,$)}if(J&&this.focusEventWhileNotReady)this.focusEventWhileNotReady=null;if(J&&Q)this.rowCtrl.announceDescription()}createCellPosition(){let{rowIndex:Q,rowPinned:z}=this.rowNode;this.cellPosition={rowIndex:Q,rowPinned:RQ(z),column:this.column}}applyStaticCssClasses(){let{comp:Q}=this;Q.toggleCss(t3,!0),Q.toggleCss(e3,!0);let z=this.column.isAutoHeight()==!0;Q.toggleCss(r3,z),Q.toggleCss(s3,!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 Q=this.column.getColDef().wrapText==!0;this.comp.toggleCss(QE,Q)}dispatchCellContextMenuEvent(Q){let z=this.column.getColDef(),J=this.createEvent(Q,"cellContextMenu"),{beans:Z}=this;if(Z.eventSvc.dispatchEvent(J),z.onCellContextMenu)window.setTimeout(()=>{Z.frameworkOverrides.wrapOutgoing(()=>{z.onCellContextMenu(J)})},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 Q=this.beans.selectionSvc?.createCheckboxSelectionComponent();if(!Q)return;return this.beans.context.createBean(Q),Q.init({rowNode:this.rowNode,column:this.column}),Q}createDndSource(){let Q=this.beans.registry.createDynamicBean("dndSourceComp",!1,this.rowNode,this.column,this.eGui);if(Q)this.beans.context.createBean(Q);return Q}registerRowDragger(Q,z,J){if(this.customRowDragComp){this.customRowDragComp.setDragElement(Q,z);return}let Z=this.createRowDragComp(Q,z,J);if(Z)this.customRowDragComp=Z,this.addDestroyFunc(()=>{this.beans.context.destroyBean(Z),this.customRowDragComp=null}),Z.refreshVisibility()}createRowDragComp(Q,z,J){let Z=this.beans.rowDragSvc?.createRowDragCompForCell(this.rowNode,this.column,()=>this.value,Q,z,J);if(!Z)return;return this.beans.context.createBean(Z),Z}cellEditorAttached(){for(let Q of this.onEditorAttachedFuncs)Q();this.onEditorAttachedFuncs=[]}setFocusedCellPosition(Q){}getFocusedCellPosition(){return this.cellPosition}refreshAriaRowIndex(){if(!v0(this.column)||!this.eGui)return;let{ariaRowIndex:Q}=this.rowCtrl;if(Q!=null)eJ(this.eGui,Q)}getRootElement(){return this.eGui}};function d$(Q,z,J,Z,$,X){if(J==null&&z==null)return;let Y={},G={},q=(H,_)=>{for(let U of H.split(" ")){if(U.trim()=="")continue;_(U)}};if(J){let H=Object.keys(J);for(let _=0;_{if(B)Y[E]=!0;else G[E]=!0})}}if(z&&X)for(let H of Object.keys(z))q(H,(_)=>{if(!Y[_])G[_]=!0});if(X)Object.keys(G).forEach(X);Object.keys(Y).forEach($)}function e7(Q){if(Q.group)return Q.level;let z=Q.parent;return z?z.level+1:0}var JE=0,F5=class extends j{constructor(Q,z,J,Z,$){super();this.rowNode=Q,this.useAnimationFrameForCreate=Z,this.printLayout=$,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=Q.id+"-"+JE++,this.rowId=W0(Q.id),this.initRowBusinessKey(),this.rowFocused=z.focusSvc.isRowFocused(this.rowNode.rowIndex,this.rowNode.rowPinned),this.rowLevel=e7(this.rowNode),this.setRowType(),this.setAnimateFlags(J),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 Q=this.businessKeyForNodeFunc(this.rowNode);this.businessKey=W0(Q)}updateGui(Q,z){if(Q==="left")this.leftGui=z;else if(Q==="right")this.rightGui=z;else if(Q==="fullWidth")this.fullWidthGui=z;else this.centerGui=z}setComp(Q,z,J,Z){let{context:$,rowRenderer:X}=this.beans;Z=BJ(this,$,Z);let Y={rowComp:Q,element:z,containerType:J,compBean:Z};this.allRowGuis.push(Y),this.updateGui(J,Y),this.initialiseRowComp(Y);let G=this.rowNode,q=this.rowType==="FullWidthLoading"||G.stub,H=!G.data&&this.beans.rowModel.getType()==="infinite";if(!q&&!H&&!G.rowPinned)X.dispatchFirstDataRenderedEvent();this.setupFocus()}unsetComp(Q){this.allRowGuis=this.allRowGuis.filter((z)=>z.containerType!==Q),this.updateGui(Q,void 0)}isCacheable(){return this.rowType==="FullWidthDetail"&&this.gos.get("keepDetailRows")}setCached(Q){let z=Q?"none":"";for(let J of this.allRowGuis)J.element.style.display=z}initialiseRowComp(Q){let z=this.gos;if(this.onSuppressCellFocusChanged(this.beans.gos.get("suppressCellFocus")),this.listenOnDomOrder(Q),this.onRowHeightChanged(Q),this.updateRowIndexes(Q),this.setFocusedClasses(Q),this.setStylesFromGridOptions(!1,Q),hQ(z)&&this.rowNode.selectable)this.onRowSelected(Q);this.updateColumnLists(!this.useAnimationFrameForCreate);let J=Q.rowComp,Z=this.getInitialRowClasses(Q.containerType);for(let $ of Z)J.toggleCss($,!0);if(this.executeSlideAndFadeAnimations(Q),this.rowNode.group)w0(Q.element,!!this.rowNode.expanded);if(this.setRowCompRowId(J),this.setRowCompRowBusinessKey(J),wz(z,Q.element,_Z,this),Q.compBean.addDestroyFunc(()=>wz(z,Q.element,_Z,null)),this.useAnimationFrameForCreate)this.beans.animationFrameSvc.createTask(this.addHoverFunctionality.bind(this,Q),this.rowNode.rowIndex,"p2",!1);else this.addHoverFunctionality(Q);if(this.isFullWidth())this.setupFullWidth(Q);if(z.get("rowDragEntireRow"))this.addRowDraggerToRow(Q);if(this.useAnimationFrameForCreate)this.beans.animationFrameSvc.addDestroyTask(()=>{if(!this.isAlive())return;Q.rowComp.toggleCss("ag-after-created",!0)});this.executeProcessRowPostCreateFunc()}setRowCompRowBusinessKey(Q){if(this.businessKey==null)return;Q.setRowBusinessKey(this.businessKey)}setRowCompRowId(Q){let z=W0(this.rowNode.id);if(this.rowId=z,z==null)return;Q.setRowId(z)}executeSlideAndFadeAnimations(Q){let{containerType:z}=Q;if(this.slideInAnimation[z])e2(()=>{this.onTopChanged()}),this.slideInAnimation[z]=!1;if(this.fadeInAnimation[z])e2(()=>{Q.rowComp.toggleCss("ag-opacity-zero",!1)}),this.fadeInAnimation[z]=!1}addRowDraggerToRow(Q){let z=this.beans.rowDragSvc?.createRowDragCompForRow(this.rowNode,Q.element);if(!z)return;let J=this.createBean(z,this.beans.context);this.rowDragComps.push(J),Q.compBean.addDestroyFunc(()=>{this.rowDragComps=this.rowDragComps.filter((Z)=>Z!==J),this.rowEditStyleFeature=this.destroyBean(this.rowEditStyleFeature,this.beans.context),this.destroyBean(J,this.beans.context)})}setupFullWidth(Q){let z=this.getPinnedForContainer(Q.containerType),J=this.createFullWidthCompDetails(Q.element,z);Q.rowComp.showFullWidth(J)}getFullWidthCellRenderers(){if(this.gos.get("embedFullWidthRows"))return this.allRowGuis.map((Q)=>Q?.rowComp?.getFullWidthCellRenderer());return[this.fullWidthGui?.rowComp?.getFullWidthCellRenderer()]}executeProcessRowPostCreateFunc(){let Q=this.gos.getCallback("processRowPostCreate");if(!Q||!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)};Q(z)}areAllContainersReady(){let{leftGui:Q,centerGui:z,rightGui:J,beans:{visibleCols:Z}}=this,$=!!Q||!Z.isPinningLeft(),X=!!z,Y=!!J||!Z.isPinningRight();return $&&X&&Y}isNodeFullWidthCell(){if(this.rowNode.detail)return!0;let Q=this.beans.gos.getCallback("isFullWidthRow");return Q?Q({rowNode:this.rowNode}):!1}setRowType(){let{rowNode:Q,gos:z,beans:{colModel:J}}=this,Z=Q.stub&&!z.get("suppressServerSideFullWidthLoadingRow")&&!z.get("groupHideOpenParents"),$=this.isNodeFullWidthCell(),X=z.get("masterDetail")&&Q.detail,Y=J.isPivotMode(),G=G9(z,Q,Y);if(Z)this.rowType="FullWidthLoading";else if(X)this.rowType="FullWidthDetail";else if($)this.rowType="FullWidth";else if(G)this.rowType="FullWidthGroup";else this.rowType="Normal"}updateColumnLists(Q=!1,z=!1){if(this.isFullWidth())return;let{animationFrameSvc:J}=this.beans;if(!J?.active||Q||this.printLayout){this.updateColumnListsImpl(z);return}if(this.updateColumnListsPending)return;J.createTask(()=>{if(!this.active)return;this.updateColumnListsImpl(!0)},this.rowNode.rowIndex,"p1",!1),this.updateColumnListsPending=!0}getNewCellCtrl(Q){if(this.beans.rowSpanSvc?.isCellSpanning(Q,this.rowNode))return;return new u1(Q,this.rowNode,this.beans,this)}isCorrectCtrlForSpan(Q){return!this.beans.rowSpanSvc?.isCellSpanning(Q.column,this.rowNode)}createCellCtrls(Q,z,J=null){let Z={list:[],map:{}},$=(H,_,U)=>{if(U!=null)Z.list.splice(U,0,_);else Z.list.push(_);Z.map[H]=_},X=[];for(let H of z){let _=H.getInstanceId(),U=Q.map[_];if(U&&!this.isCorrectCtrlForSpan(U))U.destroy(),U=void 0;if(!U)U=this.getNewCellCtrl(H);if(!U)continue;$(_,U)}for(let H of Q.list){let _=H.column.getInstanceId();if(Z.map[_]!=null)continue;if(!this.isCellEligibleToBeRemoved(H,J))X.push([_,H]);else H.destroy()}if(X.length)for(let[H,_]of X){let U=Z.list.findIndex((B)=>B.column.getLeft()>_.column.getLeft()),W=U===-1?void 0:Math.max(U-1,0);$(H,_,W)}let{focusSvc:Y,visibleCols:G}=this.beans,q=Y.getFocusedCell();if(q&&q.column.getPinned()==J){let H=q.column.getInstanceId();if(!Z.map[H]&&G.allCols.includes(q.column)){let U=this.createFocusedCellCtrl();if(U){let W=Z.list.findIndex((E)=>E.column.getLeft()>U.column.getLeft()),B=W===-1?void 0:Math.max(W-1,0);$(H,U,B)}}}return Z}createFocusedCellCtrl(){let{focusSvc:Q,rowSpanSvc:z}=this.beans,J=Q.getFocusedCell();if(!J)return;let Z=z?.getCellSpan(J.column,this.rowNode);if(Z){if(Z.firstNode!==this.rowNode||!Z.doesSpanContain(J))return}else if(!Q.isRowFocused(this.rowNode.rowIndex,this.rowNode.rowPinned))return;return this.getNewCellCtrl(J.column)}updateColumnListsImpl(Q){this.updateColumnListsPending=!1,this.createAllCellCtrls(),this.setCellCtrls(Q)}setCellCtrls(Q){for(let z of this.allRowGuis){let J=this.getCellCtrlsForContainer(z.containerType);z.rowComp.setCellCtrls(J,Q)}}getCellCtrlsForContainer(Q){switch(Q){case"left":return this.leftCellCtrls.list;case"right":return this.rightCellCtrls.list;case"fullWidth":return[];case"center":return this.centerCellCtrls.list}}createAllCellCtrls(){let Q=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 J=Q.getColsWithinViewport(this.rowNode);this.centerCellCtrls=this.createCellCtrls(this.centerCellCtrls,J);let Z=z.getLeftColsForRow(this.rowNode);this.leftCellCtrls=this.createCellCtrls(this.leftCellCtrls,Z,"left");let $=z.getRightColsForRow(this.rowNode);this.rightCellCtrls=this.createCellCtrls(this.rightCellCtrls,$,"right")}}isCellEligibleToBeRemoved(Q,z){let{column:$}=Q;if($.getPinned()!=z)return!0;if(!this.isCorrectCtrlForSpan(Q))return!0;let{visibleCols:X,editSvc:Y}=this.beans,G=Y?.isEditing(Q),q=Q.isCellFocused();if(G||q)return X.allCols.indexOf($)>=0?!1:!0;return!0}getDomOrder(){return this.gos.get("ensureDomOrder")||V0(this.gos,"print")}listenOnDomOrder(Q){let z=()=>{Q.rowComp.setDomOrder(this.getDomOrder())};Q.compBean.addManagedPropertyListeners(["domLayout","ensureDomOrder"],z)}setAnimateFlags(Q){if(this.rowNode.sticky||!Q)return;let z=T(this.rowNode.oldRowTop),{visibleCols:J}=this.beans,Z=J.isPinningLeft(),$=J.isPinningRight();if(z){let{slideInAnimation:X}=this;if(this.isFullWidth()&&!this.gos.get("embedFullWidthRows")){X.fullWidth=!0;return}X.center=!0,X.left=Z,X.right=$}else{let{fadeInAnimation:X}=this;if(this.isFullWidth()&&!this.gos.get("embedFullWidthRows")){X.fullWidth=!0;return}X.center=!0,X.left=Z,X.right=$}}isFullWidth(){return this.rowType!=="Normal"}refreshFullWidth(){let Q=(Y,G)=>{if(!Y)return!0;return Y.rowComp.refreshFullWidth(()=>{return this.createFullWidthCompDetails(Y.element,G).params})},z=Q(this.fullWidthGui,null),J=Q(this.centerGui,null),Z=Q(this.leftGui,"left"),$=Q(this.rightGui,"right");return z&&J&&Z&&$}addListeners(){let{beans:Q,gos:z,rowNode:J}=this,{expansionSvc:Z,eventSvc:$,context:X,rowSpanSvc:Y}=Q;if(this.addManagedListeners(this.rowNode,{heightChanged:()=>this.onRowHeightChanged(),rowSelected:()=>this.onRowSelected(),rowIndexChanged:this.onRowIndexChanged.bind(this),topChanged:this.onTopChanged.bind(this),...Z?.getRowExpandedListeners(this)??{}}),J.detail)this.addManagedListeners(J.parent,{dataChanged:this.onRowNodeDataChanged.bind(this)});if(this.addManagedListeners(J,{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($,{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:G})=>{if(G&&!J.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 q of this.allRowGuis)this.addRowDraggerToRow(q);return}this.rowDragComps=this.destroyBeans(this.rowDragComps,X)}),this.addListenersForCellComps()}addListenersForCellComps(){this.addManagedListeners(this.rowNode,{rowIndexChanged:()=>{for(let Q of this.getAllCellCtrls())Q.onRowIndexChanged()},cellChanged:(Q)=>{for(let z of this.getAllCellCtrls())z.onCellChanged(Q)}})}onRowPinned(){for(let Q of this.allRowGuis)Q.rowComp.toggleCss("ag-row-pinned-source",!!this.rowNode.pinnedSibling)}onRowNodeDataChanged(Q){this.refreshRow({suppressFlash:!Q.update,newData:!Q.update})}refreshRow(Q){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 J of this.getAllCellCtrls())J.refreshCell(Q);for(let J of this.allRowGuis)this.setRowCompRowId(J.rowComp),this.updateRowBusinessKey(),this.setRowCompRowBusinessKey(J.rowComp);this.onRowSelected(),this.postProcessCss()}postProcessCss(){this.setStylesFromGridOptions(!0),this.postProcessClassesFromGridOptions(),this.postProcessRowClassRules(),this.rowEditStyleFeature?.applyRowStyles(),this.postProcessRowDragging()}onRowNodeHighlightChanged(){let Q=this.beans.rowDropHighlightSvc,z=Q?.row===this.rowNode?Q.position:"none",J=z==="above",Z=z==="inside",$=z==="below",X=z!=="none",Y=J||$,G=this.rowNode.uiLevel,q=Y&&G>0,H=q?G.toString():"0";for(let _ of this.allRowGuis){let U=_.rowComp;if(U.toggleCss("ag-row-highlight-above",J),U.toggleCss("ag-row-highlight-inside",Z),U.toggleCss("ag-row-highlight-below",$),U.toggleCss("ag-row-highlight-indent",q),X)_.element.style.setProperty("--ag-row-highlight-level",H);else _.element.style.removeProperty("--ag-row-highlight-level")}}postProcessRowDragging(){let Q=this.rowNode.dragging;for(let z of this.allRowGuis)z.rowComp.toggleCss("ag-row-dragging",Q)}onDisplayedColumnsChanged(){this.updateColumnLists(!0),this.beans.rowAutoHeight?.requestCheckAutoHeight()}onVirtualColumnsChanged(){this.updateColumnLists(!1,!0)}getRowPosition(){return{rowPinned:RQ(this.rowNode.rowPinned),rowIndex:this.rowNode.rowIndex}}onKeyboardNavigate(Q){let z=this.findFullWidthInfoForEvent(Q);if(!z)return;let{rowGui:J,column:Z}=z;if(J.element!==Q.target)return;let Y=this.rowNode,{focusSvc:G,navigation:q}=this.beans,H=G.getFocusedCell(),_={rowIndex:Y.rowIndex,rowPinned:Y.rowPinned,column:H?.column??Z};q?.navigateToNextCell(Q,Q.key,_,!0),Q.preventDefault()}onTabKeyDown(Q){if(Q.defaultPrevented||zQ(Q))return;let z=this.allRowGuis.find((G)=>G.element.contains(Q.target)),J=z?z.element:null,Z=J===Q.target,$=d(this.beans),X=!1;if(J&&$)X=J.contains($)&&$.classList.contains("ag-cell");let Y=null;if(!Z&&!X)Y=R0(this.beans,J,!1,Q.shiftKey);if(this.isFullWidth()&&Z||!Y)this.beans.navigation?.onTabKeyDown(this,Q)}getFullWidthElement(){if(this.fullWidthGui)return this.fullWidthGui.element;return null}getRowYPosition(){let Q=this.allRowGuis.find((z)=>f0(z.element))?.element;if(Q)return Q.getBoundingClientRect().top;return 0}onSuppressCellFocusChanged(Q){let z=this.isFullWidth()&&Q?void 0:this.gos.get("tabIndex");for(let J of this.allRowGuis)Pz(J.element,"tabindex",z)}setupFocus(){if(!this.isFullWidth())return;this.restoreFullWidthFocus(!0),this.onFullWidthRowFocused(this.focusEventWhileNotReady??void 0)}restoreFullWidthFocus(Q=!1){let{focusSvc:z,editSvc:J}=this.beans;if(J?.isEditing(this))return;if(!z.isRowFocused(this.rowNode.rowIndex,this.rowNode.rowPinned)||!z.shouldTakeFocus())return;let Z=this.getFullWidthRowGuiForFocus();if(!Z)return;let $=()=>{if(!this.isAlive())return;if(z.isRowFocused(this.rowNode.rowIndex,this.rowNode.rowPinned))Z.element.focus({preventScroll:!0})};if(Q){setTimeout($,0);return}$()}getFullWidthRowGuiForFocus(Q){if(this.fullWidthGui)return this.fullWidthGui;let z=this.beans.focusSvc.getFocusedCell(),J=this.beans.colModel.getCol(Q?.column??z?.column);if(!J)return;let Z=J?.pinned;if(Z==="right")return this.rightGui;if(Z==="left")return this.leftGui;return this.centerGui}setFullWidthRowFocusedClass(Q,z){this.forEachGui(void 0,(J)=>{J.element.classList.toggle("ag-full-width-focus",z&&J===Q)})}onFullWidthRowFocused(Q){let{focusSvc:z}=this.beans;if(!(this.isFullWidth()&&z.isRowFocused(this.rowNode.rowIndex,this.rowNode.rowPinned))){this.setFullWidthRowFocusedClass(void 0,!1);return}let Z=this.getFullWidthRowGuiForFocus(Q);if(!Z){if(Q)this.focusEventWhileNotReady=Q;this.setFullWidthRowFocusedClass(void 0,!1);return}if(this.setFullWidthRowFocusedClass(Z,!0),this.focusEventWhileNotReady=null,Q?.forceBrowserFocus)Z.element.focus({preventScroll:!0})}recreateCell(Q){this.centerCellCtrls=this.removeCellCtrl(this.centerCellCtrls,Q),this.leftCellCtrls=this.removeCellCtrl(this.leftCellCtrls,Q),this.rightCellCtrls=this.removeCellCtrl(this.rightCellCtrls,Q),Q.destroy(),this.updateColumnLists()}removeCellCtrl(Q,z){let J={list:[],map:{}};for(let Z of Q.list){if(Z===z)continue;J.list.push(Z),J.map[Z.column.getInstanceId()]=Z}return J}onMouseEvent(Q,z){switch(Q){case"dblclick":this.onRowDblClick(z);break;case"click":this.onRowClick(z);break;case"pointerdown":case"touchstart":case"mousedown":this.onRowMouseDown(z);break}}createRowEvent(Q,z){let{rowNode:J}=this;return y(this.gos,{type:Q,node:J,data:J.data,rowIndex:J.rowIndex,rowPinned:J.rowPinned,event:z})}createRowEventWithSource(Q,z){let J=this.createRowEvent(Q,z);return J.source=this,J}onRowDblClick(Q){if(zQ(Q))return;let z=this.createRowEventWithSource("rowDoubleClicked",Q);z.isEventHandlingSuppressed=this.isSuppressMouseEvent(Q),this.beans.eventSvc.dispatchEvent(z)}findFullWidthInfoForEvent(Q){if(!Q)return;let z=this.findFullWidthRowGui(Q.target),J=this.getColumnForFullWidth(z);if(!z||!J)return;return{rowGui:z,column:J}}findFullWidthRowGui(Q){return this.allRowGuis.find((z)=>z.element.contains(Q))}getColumnForFullWidth(Q){let{visibleCols:z}=this.beans;switch(Q?.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(Q){if(this.lastMouseDownOnDragger=vz(Q.target,"ag-row-drag",3),!this.isFullWidth()||this.isSuppressMouseEvent(Q))return;let{rangeSvc:z,focusSvc:J}=this.beans;z?.removeAllCellRanges();let Z=this.findFullWidthInfoForEvent(Q);if(!Z)return;let{rowGui:$,column:X}=Z,Y=$.element,G=Q.target,q=this.rowNode,H=Q.defaultPrevented||cz();if(Y&&Y.contains(G)&&w1(G))H=!1;J.setFocusedCell({rowIndex:q.rowIndex,column:X,rowPinned:q.rowPinned,forceBrowserFocus:H})}isSuppressMouseEvent(Q){let{gos:z,rowNode:J}=this;if(this.isFullWidth()){let $=this.findFullWidthRowGui(Q.target);return sH(z,$?.rowComp.getFullWidthCellRendererParams(),J,Q)}let Z=EJ(z,Q.target);return Z!=null&&rJ(z,Z.column,J,Q)}onRowClick(Q){if(zQ(Q)||this.lastMouseDownOnDragger)return;let J=this.isSuppressMouseEvent(Q),{eventSvc:Z,selectionSvc:$}=this.beans,X=this.createRowEventWithSource("rowClicked",Q);if(X.isEventHandlingSuppressed=J,Z.dispatchEvent(X),J)return;$?.handleSelectionEvent(Q,this.rowNode,"rowClicked")}setupDetailRowAutoHeight(Q){if(this.rowType!=="FullWidthDetail")return;this.beans.masterDetailSvc?.setupDetailRowAutoHeight(this,Q)}createFullWidthCompDetails(Q,z){let{gos:J,rowNode:Z}=this,$=y(J,{fullWidth:!0,data:Z.data,node:Z,value:Z.key,valueFormatted:Z.key,eGridCell:Q,eParentOfValue:Q,pinned:z,addRenderedRowListener:this.addEventListener.bind(this),registerRowDragger:(Y,G,q,H)=>this.addFullWidthRowDragging(Y,G,q,H),setTooltip:(Y,G)=>{J.assertModuleRegistered("Tooltip",3),this.setupFullWidthRowTooltip(Y,G)}}),X=this.beans.userCompFactory;switch(this.rowType){case"FullWidthDetail":return wq(X,$);case"FullWidthGroup":{let{value:Y,valueFormatted:G}=this.beans.valueSvc.getValueForDisplay({node:this.rowNode,includeValueFormatted:!0,from:"edit"});return $.value=Y,$.valueFormatted=G,xq(X,$)}case"FullWidthLoading":return yq(X,$);default:return bq(X,$)}}setupFullWidthRowTooltip(Q,z){if(!this.fullWidthGui)return;this.tooltipFeature=this.beans.tooltipSvc?.setupFullWidthRowTooltip(this.tooltipFeature,this,Q,z)}addFullWidthRowDragging(Q,z,J="",Z){let{rowDragSvc:$,context:X}=this.beans;if(!$||!this.isFullWidth())return;let Y=$.createRowDragComp(()=>J,this.rowNode,void 0,Q,z,Z);this.createBean(Y,X),this.addDestroyFunc(()=>{this.destroyBean(Y,X)})}onUiLevelChanged(){let Q=e7(this.rowNode);if(this.rowLevel!=Q){let z="ag-row-level-"+Q,J="ag-row-level-"+this.rowLevel;for(let Z of this.allRowGuis)Z.rowComp.toggleCss(z,!0),Z.rowComp.toggleCss(J,!1)}this.rowLevel=Q}isFirstRowOnPage(){return this.rowNode.rowIndex===this.beans.pageBounds.getFirstRow()}isLastRowOnPage(){return this.rowNode.rowIndex===this.beans.pageBounds.getLastRow()}refreshFirstAndLastRowStyles(){let Q=this.isFirstRowOnPage(),z=this.isLastRowOnPage();if(this.firstRowOnPage!==Q){this.firstRowOnPage=Q;for(let J of this.allRowGuis)J.rowComp.toggleCss("ag-row-first",Q)}if(this.lastRowOnPage!==z){this.lastRowOnPage=z;for(let J of this.allRowGuis)J.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 Q=[];if(this.beans.rowStyleSvc?.processClassesFromGridOptions(Q,this.rowNode),!Q.length)return;for(let z of Q)for(let J of this.allRowGuis)J.rowComp.toggleCss(z,!0)}postProcessRowClassRules(){this.beans.rowStyleSvc?.processRowClassRules(this.rowNode,(Q)=>{for(let z of this.allRowGuis)z.rowComp.toggleCss(Q,!0)},(Q)=>{for(let z of this.allRowGuis)z.rowComp.toggleCss(Q,!1)})}setStylesFromGridOptions(Q,z){if(Q)this.rowStyles=this.processStylesFromGridOptions();this.forEachGui(z,(J)=>J.rowComp.setUserStyles(this.rowStyles))}getPinnedForContainer(Q){if(Q==="left"||Q==="right")return Q;return null}getInitialRowClasses(Q){let z=this.getPinnedForContainer(Q),J=this.isFullWidth(),{rowNode:Z,beans:$}=this,X=[];if(X.push("ag-row"),X.push(this.rowFocused?"ag-row-focus":"ag-row-no-focus"),this.fadeInAnimation[Q])X.push("ag-opacity-zero");if(X.push(Z.rowIndex%2===0?"ag-row-even":"ag-row-odd"),Z.isRowPinned()){if(X.push("ag-row-pinned"),$.pinnedRowModel?.isManual())X.push("ag-row-pinned-manual")}if(!Z.isRowPinned()&&Z.pinnedSibling)X.push("ag-row-pinned-source");if(Z.isSelected())X.push("ag-row-selected");if(Z.footer)X.push("ag-row-footer");if(X.push("ag-row-level-"+this.rowLevel),Z.stub)X.push("ag-row-loading");if(J)X.push("ag-full-width-row");if($.expansionSvc?.addExpandedCss(X,Z),Z.dragging)X.push("ag-row-dragging");let{rowStyleSvc:Y}=$;if(Y)Y.processClassesFromGridOptions(X,Z),Y.preProcessRowClassRules(X,Z);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(J){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(Q){this.beans.selectionSvc?.onRowCtrlSelected(this,(z)=>{if(z===this.centerGui||z===this.fullWidthGui)this.announceDescription()},Q)}announceDescription(){this.beans.selectionSvc?.announceAriaRowSelection(this.rowNode)}addHoverFunctionality(Q){if(!this.active)return;let{element:z,compBean:J}=Q,{rowNode:Z,beans:$,gos:X}=this;J.addManagedListeners(z,{pointerenter:(Y)=>{if(Y.pointerType==="mouse")Z.dispatchRowEvent("mouseEnter")},pointerleave:(Y)=>{if(Y.pointerType==="mouse")Z.dispatchRowEvent("mouseLeave")}}),J.addManagedListeners(Z,{mouseEnter:()=>{if(!$.dragSvc?.dragging&&!X.get("suppressRowHoverHighlight"))z.classList.add("ag-row-hover"),Z.setHovered(!0)},mouseLeave:()=>{this.resetHoveredStatus(z)}})}resetHoveredStatus(Q){let z=Q?[Q]:this.allRowGuis.map((J)=>J.element);for(let J of z)J.classList.remove("ag-row-hover");this.rowNode.setHovered(!1)}roundRowTopToBounds(Q){let z=this.beans.ctrlsSvc.getScrollFeature().getApproximateVScollPosition(),J=this.applyPaginationOffset(z.top,!0)-100,Z=this.applyPaginationOffset(z.bottom,!0)+100;return Math.min(Math.max(J,Q),Z)}forEachGui(Q,z){if(Q)z(Q);else for(let J of this.allRowGuis)z(J)}isRowRendered(){return this.allRowGuis.length>0}onRowHeightChanged(Q){if(this.rowNode.rowHeight==null)return;let z=this.rowNode.rowHeight,J=this.beans.environment.getDefaultRowHeight(),$=$9(this.gos)?r1(this.beans,this.rowNode).height:void 0,X=$?`${Math.min(J,$)-2}px`:void 0;this.forEachGui(Q,(Y)=>{if(Y.element.style.height=`${z}px`,X)Y.element.style.setProperty("--ag-line-height",X)})}destroyFirstPass(Q=!1){this.active=!1;let{rowNode:z}=this;if(!Q&&_1(this.gos)&&!z.sticky)if(z.rowTop!=null){let $=this.roundRowTopToBounds(z.rowTop);this.setRowTop($)}else for(let $ of this.allRowGuis)$.rowComp.toggleCss("ag-opacity-zero",!0);if(this.fullWidthGui?.element.contains(d(this.beans)))this.beans.focusSvc.attemptToRecoverFocus();z.setHovered(!1);let J=this.createRowEvent("virtualRowRemoved");this.dispatchLocalEvent(J),this.beans.eventSvc.dispatchEvent(J),super.destroy()}destroySecondPass(){this.allRowGuis.length=0;let Q=(z)=>{for(let J of z.list)J.destroy();return{list:[],map:{}}};this.centerCellCtrls=Q(this.centerCellCtrls),this.leftCellCtrls=Q(this.leftCellCtrls),this.rightCellCtrls=Q(this.rightCellCtrls)}setFocusedClasses(Q){this.forEachGui(Q,(z)=>{z.rowComp.toggleCss("ag-row-focus",this.rowFocused),z.rowComp.toggleCss("ag-row-no-focus",!this.rowFocused)})}onCellFocusChanged(){let{focusSvc:Q}=this.beans,z=Q.isRowFocused(this.rowNode.rowIndex,this.rowNode.rowPinned);if(z!==this.rowFocused)this.rowFocused=z,this.setFocusedClasses()}onPaginationChanged(){let Q=this.beans.pagination?.getCurrentPage()??0;if(this.paginationPage!==Q)this.paginationPage=Q,this.onTopChanged();this.refreshFirstAndLastRowStyles()}onTopChanged(){this.setRowTop(this.rowNode.rowTop)}onPaginationPixelOffsetChanged(){this.onTopChanged()}applyPaginationOffset(Q,z=!1){if(this.rowNode.isRowPinned()||this.rowNode.sticky)return Q;let J=this.beans.pageBounds.getPixelOffset();return Q+J*(z?1:-1)}setRowTop(Q){if(this.printLayout)return;if(T(Q)){let z=this.applyPaginationOffset(Q),$=`${this.rowNode.isRowPinned()||this.rowNode.sticky?z:this.beans.rowContainerHeight.getRealPixelPosition(z)}px`;this.setRowTopStyle($)}}getInitialRowTop(Q){return this.suppressRowTransform?this.getInitialRowTopShared(Q):void 0}getInitialTransform(Q){return this.suppressRowTransform?void 0:`translateY(${this.getInitialRowTopShared(Q)})`}getInitialRowTopShared(Q){if(this.printLayout)return"";let z=this.rowNode,J;if(z.sticky)J=z.stickyRowTop;else{let Z=this.slideInAnimation[Q]?this.roundRowTopToBounds(z.oldRowTop):z.rowTop,$=this.applyPaginationOffset(Z);J=z.isRowPinned()?$:this.beans.rowContainerHeight.getRealPixelPosition($)}return J+"px"}setRowTopStyle(Q){for(let z of this.allRowGuis)if(this.suppressRowTransform)z.rowComp.setTop(Q);else z.rowComp.setTransform(`translateY(${Q})`)}getCellCtrl(Q,z=!1){let J=null;for(let Z of this.getAllCellCtrls())if(Z.column==Q)J=Z;if(J!=null||z)return J;for(let Z of this.getAllCellCtrls())if(Z?.getColSpanningList().indexOf(Q)>=0)J=Z;return J}onRowIndexChanged(){if(this.rowNode.rowIndex!=null)this.onCellFocusChanged(),this.updateRowIndexes(),this.postProcessCss()}updateRowIndexes(Q){let z=this.rowNode.getRowIndexString();if(z===null)return;let J=(this.beans.ctrlsSvc.getHeaderRowContainerCtrl()?.getRowCount()??0)+(this.beans.filterManager?.getHeaderRowCount()??0),Z=this.rowNode.rowIndex%2===0,$=this.ariaRowIndex=J+this.rowNode.rowIndex+1;this.forEachGui(Q,(X)=>{X.rowComp.setRowIndex(z),X.rowComp.toggleCss("ag-row-even",Z),X.rowComp.toggleCss("ag-row-odd",!Z),eJ(X.element,$)})}},ZE=class extends j{constructor(){super();this.beanName="navigation",this.onPageDown=E7(this.onPageDown,100),this.onPageUp=E7(this.onPageUp,100)}postConstruct(){this.beans.ctrlsSvc.whenReady(this,(Q)=>{this.gridBodyCon=Q.gridBodyCtrl})}handlePageScrollingKey(Q,z=!1){let{key:J,altKey:Z}=Q,$=Q.ctrlKey||Q.metaKey,X=!!this.beans.rangeSvc&&Q.shiftKey,Y=U6(this.gos,Q),G=!1;switch(J){case V.PAGE_HOME:case V.PAGE_END:if(!$&&!Z)this.onHomeOrEndKey(J),G=!0;break;case V.LEFT:case V.RIGHT:case V.UP:case V.DOWN:if(!Y)return!1;if($&&!Z&&!X)this.onCtrlUpDownLeftRight(J,Y),G=!0;break;case V.PAGE_DOWN:case V.PAGE_UP:if(!$&&!Z)G=this.handlePageUpDown(J,Y,z);break}if(G)Q.preventDefault();return G}handlePageUpDown(Q,z,J){if(J)z=this.beans.focusSvc.getFocusedCell();if(!z)return!1;if(Q===V.PAGE_UP)this.onPageUp(z);else this.onPageDown(z);return!0}navigateTo({scrollIndex:Q,scrollType:z,scrollColumn:J,focusIndex:Z,focusColumn:$,isAsync:X,rowPinned:Y}){let{scrollFeature:G}=this.gridBodyCon;if(T(J)&&!J.isPinned())G.ensureColumnVisible(J);if(T(Q))G.ensureIndexVisible(Q,z);if(!X)G.ensureIndexVisible(Z);let{focusSvc:q}=this.beans;q.setFocusedCell({rowIndex:Z,column:$,rowPinned:Y,forceBrowserFocus:!0}),this.setRangeToCellIfSupported({rowIndex:Z,rowPinned:Y,column:$})}onPageDown(Q){let z=this.beans,J=t2(z),Z=this.getViewportHeight(),{pageBounds:$,rowModel:X,rowAutoHeight:Y}=z,G=$.getPixelOffset(),q=J.top+Z,H=X.getRowIndexAtPixel(q+G);if(Y?.active)this.navigateToNextPageWithAutoHeight(Q,H);else this.navigateToNextPage(Q,H)}onPageUp(Q){let z=this.beans,J=t2(z),{pageBounds:Z,rowModel:$,rowAutoHeight:X}=z,Y=Z.getPixelOffset(),G=J.top,q=$.getRowIndexAtPixel(G+Y);if(X?.active)this.navigateToNextPageWithAutoHeight(Q,q,!0);else this.navigateToNextPage(Q,q,!0)}navigateToNextPage(Q,z,J=!1){let{pageBounds:Z,rowModel:$}=this.beans,X=this.getViewportHeight(),Y=Z.getFirstRow(),G=Z.getLastRow(),q=Z.getPixelOffset(),H=$.getRow(Q.rowIndex),_=J?H?.rowHeight-X-q:X-q,U=H?.rowTop+_,W=$.getRowIndexAtPixel(U+q);if(W===Q.rowIndex){let E=J?-1:1;z=W=Q.rowIndex+E}let B;if(J){if(B="bottom",WG)W=G;if(z>G)z=G}if(this.isRowTallerThanView($.getRow(W)))z=W,B="top";this.navigateTo({scrollIndex:z,scrollType:B,scrollColumn:null,focusIndex:W,focusColumn:Q.column})}navigateToNextPageWithAutoHeight(Q,z,J=!1){this.navigateTo({scrollIndex:z,scrollType:J?"bottom":"top",scrollColumn:null,focusIndex:z,focusColumn:Q.column}),setTimeout(()=>{let Z=this.getNextFocusIndexForAutoHeight(Q,J);this.navigateTo({scrollIndex:z,scrollType:J?"bottom":"top",scrollColumn:null,focusIndex:Z,focusColumn:Q.column,isAsync:!0})},50)}getNextFocusIndexForAutoHeight(Q,z=!1){let J=z?-1:1,Z=this.getViewportHeight(),{pageBounds:$,rowModel:X}=this.beans,Y=$.getLastRow(),G=0,q=Q.rowIndex;while(q>=0&&q<=Y){let H=X.getRow(q);if(H){let _=H.rowHeight??0;if(G+_>Z)break;G+=_}q+=J}return Math.max(0,Math.min(q,Y))}getViewportHeight(){let Q=this.beans,z=t2(Q),J=this.beans.scrollVisibleSvc.getScrollbarWidth(),Z=z.bottom-z.top;if(Q.ctrlsSvc.get("center").isHorizontalScrollShowing())Z-=J;return Z}isRowTallerThanView(Q){if(!Q)return!1;let z=Q.rowHeight;if(typeof z!=="number")return!1;return z>this.getViewportHeight()}onCtrlUpDownLeftRight(Q,z){let J=this.beans.cellNavigation.getNextCellToFocus(Q,z,!0);if(!J)return;let Z=this.getNormalisedPosition(J),{rowIndex:$,rowPinned:X,column:Y}=Z??J,G=Y;this.navigateTo({scrollIndex:$,scrollType:null,scrollColumn:G,focusIndex:$,focusColumn:G,rowPinned:X})}onHomeOrEndKey(Q){let z=Q===V.PAGE_HOME,{visibleCols:J,pageBounds:Z,rowModel:$}=this.beans,X=J.allCols,Y=z?Z.getFirstRow():Z.getLastRow(),G=$.getRow(Y);if(!G)return;let q=(z?X:[...X].reverse()).find((H)=>!H.isSuppressNavigable(G)&&!v0(H));if(!q)return;this.navigateTo({scrollIndex:Y,scrollType:null,scrollColumn:q,focusIndex:Y,focusColumn:q})}onTabKeyDown(Q,z){let J=z.shiftKey,Z=this.tabToNextCellCommon(Q,J,z),$=this.beans,{ctrlsSvc:X,pageBounds:Y,focusSvc:G,gos:q}=$;if(Z!==!1){if(Z)z.preventDefault();else if(Z===null)X.get("gridCtrl").allowFocusForNextCoreContainer(J);return}if(J){let{rowIndex:H,rowPinned:_}=Q.getRowPosition();if(_?H===0:H===Y.getFirstRow())if(q.get("headerHeight")===0||_Q($))$Q($,!0,!0);else z.preventDefault(),G.focusPreviousFromFirstCell(z)}else{if(Q instanceof u1)Q.focusCell(!0);if(G.focusOverlay(!1)||$Q($,J))z.preventDefault()}}tabToNextCell(Q,z){let J=this.beans,{focusSvc:Z,rowRenderer:$}=J,X=Z.getFocusedCell();if(!X)return!1;let Y=e0(J,X);if(!Y){if(Y=$.getRowByPosition(X),!Y?.isFullWidth())return!1}return!!this.tabToNextCellCommon(Y,Q,z,"api")}tabToNextCellCommon(Q,z,J,Z="ui"){let{editSvc:$,focusSvc:X}=this.beans,Y=void 0,G=Q instanceof u1?Q:Q.getAllCellCtrls()?.[0];if($?.isEditing())Y=$?.moveToNextCell(G,z,J,Z);else Y=this.moveToNextCellNotEditing(Q,z,J);if(Y===null)return Y;return Y||!!X.focusedHeader}moveToNextCellNotEditing(Q,z,J){let Z=this.beans.visibleCols.allCols,$;if(Q instanceof F5){if($={...Q.getRowPosition(),column:z?Z[0]:b(Z)},this.gos.get("embedFullWidthRows")&&J){let Y=Q.findFullWidthInfoForEvent(J);if(Y)$.column=Y.column}}else $=Q.getFocusedCellPosition();let X=this.findNextCellToFocusOn($,{backwards:z,startEditing:!1});if(X===!1)return null;if(X instanceof u1)X.focusCell(!0);else if(X)return this.tryToFocusFullWidthRow(X,z);return T(X)}findNextCellToFocusOn(Q,{backwards:z,startEditing:J,skipToNextEditableCell:Z}){let $=Q,X=this.beans,{cellNavigation:Y,gos:G,focusSvc:q,rowRenderer:H}=X;while(!0){if(Q!==$)Q=$;if(!z)$=this.getLastCellOfColSpan($);$=Y.getNextTabbedCell($,z);let _=G.getCallback("tabToNextCell");if(T(_)){let E=_({backwards:z,editing:J,previousCellPosition:Q,nextCellPosition:$?$:null});if(E===!0)$=Q;else if(E===!1)return!1;else $={rowIndex:E.rowIndex,column:E.column,rowPinned:E.rowPinned}}if(!$)return null;if($.rowIndex<0){let B=l0(X);return q.focusHeaderPosition({headerPosition:{headerRowIndex:B+$.rowIndex,column:$.column},fromCell:!0}),null}let U=G.get("editType")==="fullRow";if(J&&(!U||Z)){if(!this.isCellEditable($))continue}this.ensureCellVisible($);let W=e0(X,$);if(!W){let B=H.getRowByPosition($);if(!B||!B.isFullWidth()||J)continue;return{...B.getRowPosition(),column:$?.column}}if(Y.isSuppressNavigable(W.column,W.rowNode))continue;return W.setFocusedCellPosition($),this.setRangeToCellIfSupported($),W}}isCellEditable(Q){let z=this.lookupRowNodeForCell(Q);if(z)return Q.column.isCellEditable(z);return!1}lookupRowNodeForCell({rowIndex:Q,rowPinned:z}){let{pinnedRowModel:J,rowModel:Z}=this.beans;if(z==="top")return J?.getPinnedTopRow(Q);if(z==="bottom")return J?.getPinnedBottomRow(Q);return Z.getRow(Q)}navigateToNextCell(Q,z,J,Z){let $=J,X=!1,Y=this.beans,{cellNavigation:G,focusSvc:q,gos:H}=Y;while($&&($===J||!this.isValidNavigateCell($))){if(H.get("enableRtl")){if(z===V.LEFT)$=this.getLastCellOfColSpan($)}else if(z===V.RIGHT)$=this.getLastCellOfColSpan($);$=G.getNextCellToFocus(z,$),X=n($)}if(X&&Q&&Q.key===V.UP)$={rowIndex:-1,rowPinned:null,column:J.column};if(Z){let U=H.getCallback("navigateToNextCell");if(T(U)){let B=U({key:z,previousCellPosition:J,nextCellPosition:$?$:null,event:Q});if(T(B))$={rowPinned:B.rowPinned,rowIndex:B.rowIndex,column:B.column};else $=null}}if(!$)return;if($.rowIndex<0){let U=l0(Y);q.focusHeaderPosition({headerPosition:{headerRowIndex:U+$.rowIndex,column:$.column??J.column},event:Q||void 0,fromCell:!0});return}let _=this.getNormalisedPosition($);if(_)this.focusPosition(_);else this.tryToFocusFullWidthRow($)}getNormalisedPosition(Q){if(!!this.beans.spannedRowRenderer?.getCellByPosition(Q))return Q;this.ensureCellVisible(Q);let J=e0(this.beans,Q);if(!J)return null;return Q=J.getFocusedCellPosition(),this.ensureCellVisible(Q),Q}tryToFocusFullWidthRow(Q,z){let{visibleCols:J,rowRenderer:Z,focusSvc:$,eventSvc:X}=this.beans,Y=J.allCols;if(!Z.getRowByPosition(Q)?.isFullWidth())return!1;let q=$.getFocusedCell(),H={rowIndex:Q.rowIndex,rowPinned:Q.rowPinned,column:Q.column||(z?b(Y):Y[0])};this.focusPosition(H);let _=z==null?q!=null&&q0(H,q):z;return X.dispatchEvent({type:"fullWidthRowFocused",rowIndex:H.rowIndex,rowPinned:H.rowPinned,column:H.column,isFullWidthCell:!0,fromBelow:_}),!0}focusPosition(Q){let{focusSvc:z}=this.beans;z.setFocusedCell({rowIndex:Q.rowIndex,column:Q.column,rowPinned:Q.rowPinned,forceBrowserFocus:!0}),this.setRangeToCellIfSupported(Q)}setRangeToCellIfSupported(Q){if(v0(Q.column))return;this.beans.rangeSvc?.setRangeToCell(Q)}isValidNavigateCell(Q){return!!M0(this.beans,Q)}getLastCellOfColSpan(Q){let z=e0(this.beans,Q);if(!z)return Q;let J=z.getColSpanningList();if(J.length===1)return Q;return{rowIndex:Q.rowIndex,column:b(J),rowPinned:Q.rowPinned}}ensureCellVisible(Q){let z=k1(this.gos),J=this.beans.rowModel.getRow(Q.rowIndex),Z=z&&J?.sticky,{scrollFeature:$}=this.gridBodyCon;if(!Z&&n(Q.rowPinned))$.ensureIndexVisible(Q.rowIndex);if(!Q.column.isPinned())$.ensureColumnVisible(Q.column)}ensureColumnVisible(Q){let z=this.gridBodyCon.scrollFeature;if(!Q.isPinned())z.ensureColumnVisible(Q)}ensureRowVisible(Q){this.gridBodyCon.scrollFeature.ensureIndexVisible(Q)}};function t2(Q){return Q.ctrlsSvc.getScrollFeature().getVScrollPosition()}var iz={moduleName:"KeyboardNavigation",version:p,beans:[ZE,f3,yB],apiFunctions:{getFocusedCell:A3,clearFocusedCell:j3,setFocusedCell:R3,setFocusedHeader:P3,tabToNextCell:S3,tabToPreviousCell:O3}},$E=class extends j{constructor(){super(...arguments);this.beanName="pageBoundsListener"}postConstruct(){this.addManagedEventListeners({modelUpdated:this.onModelUpdated.bind(this),recalculateRowBounds:this.calculatePages.bind(this)}),this.onModelUpdated()}onModelUpdated(Q){this.calculatePages(),this.eventSvc.dispatchEvent({type:"paginationChanged",animate:Q?.animate??!1,newData:Q?.newData??!1,newPage:Q?.newPage??!1,newPageSize:Q?.newPageSize??!1,keepRenderedRows:Q?.keepRenderedRows??!1})}calculatePages(){let{pageBounds:Q,pagination:z,rowModel:J}=this.beans;if(z)z.calculatePages();else Q.calculateBounds(0,J.getRowCount()-1)}},XE=class extends j{constructor(){super(...arguments);this.beanName="pageBounds",this.pixelOffset=0}getFirstRow(){return this.topRowBounds?.rowIndex??-1}getLastRow(){return this.bottomRowBounds?.rowIndex??-1}getCurrentPageHeight(){let{topRowBounds:Q,bottomRowBounds:z}=this;if(!Q||!z)return 0;return Math.max(z.rowTop+z.rowHeight-Q.rowTop,0)}getCurrentPagePixelRange(){let{topRowBounds:Q,bottomRowBounds:z}=this,J=Q?.rowTop??0,Z=z?z.rowTop+z.rowHeight:0;return{pageFirstPixel:J,pageLastPixel:Z}}calculateBounds(Q,z){let{rowModel:J}=this.beans,Z=J.getRowBounds(Q);if(Z)Z.rowIndex=Q;this.topRowBounds=Z;let $=J.getRowBounds(z);if($)$.rowIndex=z;this.bottomRowBounds=$,this.calculatePixelOffset()}getPixelOffset(){return this.pixelOffset}calculatePixelOffset(){let Q=this.topRowBounds?.rowTop??0;if(this.pixelOffset===Q)return;this.pixelOffset=Q,this.eventSvc.dispatchEvent({type:"paginationPixelOffsetChanged"})}},YE=".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}",GE=class extends j{constructor(Q,z){super();this.isLeft=Q,this.elements=z,this.getWidth=Q?()=>this.beans.pinnedCols.leftWidth:()=>this.beans.pinnedCols.rightWidth}postConstruct(){this.addManagedEventListeners({[`${this.isLeft?"left":"right"}PinnedWidthChanged`]:this.onPinnedWidthChanged.bind(this)})}onPinnedWidthChanged(){let Q=this.getWidth(),z=Q>0;for(let J of this.elements)if(J)N(J,z),SQ(J,Q)}},qE=class extends j{constructor(){super(...arguments);this.beanName="pinnedCols"}postConstruct(){this.beans.ctrlsSvc.whenReady(this,(z)=>{this.gridBodyCtrl=z.gridBodyCtrl});let Q=this.checkContainerWidths.bind(this);this.addManagedEventListeners({displayedColumnsChanged:Q,displayedColumnsWidthChanged:Q}),this.addManagedPropertyListener("domLayout",Q)}checkContainerWidths(){let{gos:Q,visibleCols:z,eventSvc:J}=this.beans,Z=V0(Q,"print"),$=Z?0:z.getColsLeftWidth(),X=Z?0:z.getDisplayedColumnsRightWidth();if($!=this.leftWidth)this.leftWidth=$,J.dispatchEvent({type:"leftPinnedWidthChanged"});if(X!=this.rightWidth)this.rightWidth=X,J.dispatchEvent({type:"rightPinnedWidthChanged"})}keepPinnedColumnsNarrowerThanViewport(){let Q=this.gridBodyCtrl.eBodyViewport,z=xz(Q);if(z<=50)return;let J=this.getPinnedColumnsOverflowingViewport(z-50),Z=this.gos.getCallback("processUnpinnedColumns"),{columns:$,hasLockedPinned:X}=J,Y=$;if(!Y.length&&!X)return;if(Z)Y=Z({columns:Y,viewportWidth:z});if(!Y?.length)return;Y=Y.filter((G)=>!v0(G)),this.setColsPinned(Y,null,"viewportSizeFeature")}createPinnedWidthFeature(Q,...z){return new GE(Q,z)}setColsPinned(Q,z,J){let{colModel:Z,colAnimation:$,visibleCols:X,gos:Y}=this.beans;if(!Z.cols)return;if(!Q?.length)return;if(V0(Y,"print")){R(37);return}$?.start();let G;if(z===!0||z==="left")G="left";else if(z==="right")G="right";else G=null;let q=[];for(let H of Q){if(!H)continue;let _=Z.getCol(H);if(!_)continue;if(_.getPinned()!==G)this.setColPinned(_,G),q.push(_)}if(q.length)X.refresh(J),D$(this.eventSvc,q,J);$?.finish()}initCol(Q){let{pinned:z,initialPinned:J}=Q.colDef;if(z!==void 0)this.setColPinned(Q,z);else this.setColPinned(Q,J)}setColPinned(Q,z){if(z===!0||z==="left")Q.pinned="left";else if(z==="right")Q.pinned="right";else Q.pinned=null;Q.dispatchStateUpdatedEvent("pinned")}setupHeaderPinnedWidth(Q){let{scrollVisibleSvc:z}=this.beans;if(Q.pinned==null)return;let J=Q.pinned==="left",Z=Q.pinned==="right";Q.hidden=!0;let $=()=>{let X=J?this.leftWidth:this.rightWidth;if(X==null)return;let Y=X==0,G=Q.hidden!==Y,q=this.gos.get("enableRtl"),H=z.getScrollbarWidth(),U=z.verticalScrollShowing&&(q&&J||!q&&Z)?X+H:X;if(Q.comp.setPinnedContainerWidth(`${U}px`),Q.comp.setDisplayed(!Y),G)Q.hidden=Y,Q.refresh()};Q.addManagedEventListeners({leftPinnedWidthChanged:$,rightPinnedWidthChanged:$,scrollVisibilityChanged:$,scrollbarWidthChanged:$})}getHeaderResizeDiff(Q,z){if(z.getPinned()){let{leftWidth:Z,rightWidth:$}=this,X=xz(this.beans.ctrlsSvc.getGridBodyCtrl().eBodyViewport)-50;if(Z+$+Q>X)if(X>Z+$)Q=X-Z-$;else return 0}return Q}getPinnedColumnsOverflowingViewport(Q){let z=this.rightWidth??0,J=this.leftWidth??0,Z=z+J,$=!1;if(Z0){if(q0){let B=Y[H++];if(B.colDef.lockPinned){$=!0;continue}W-=B.getActualWidth(),U.push(B)}}return{columns:U,hasLockedPinned:$}}},HE={moduleName:"PinnedColumn",version:p,beans:[qE],css:[YE]},_E=class extends j0{constructor(){super();this.beanName="ariaAnnounce",this.descriptionContainer=null,this.pendingAnnouncements=new Map,this.lastAnnouncement="",this.updateAnnouncement=gQ(this,this.updateAnnouncement.bind(this),200)}postConstruct(){let Q=this.beans,z=Y0(Q),J=this.descriptionContainer=z.createElement("div");J.classList.add("ag-aria-description-container"),R8(J,"polite"),p4(J,"additions text"),c4(J,!0),Q.eRootDiv.appendChild(J)}announceValue(Q,z){this.pendingAnnouncements.set(z,Q),this.updateAnnouncement()}updateAnnouncement(){if(!this.descriptionContainer)return;let Q=Array.from(this.pendingAnnouncements.values()).join(". ");this.pendingAnnouncements.clear(),this.descriptionContainer.textContent="",setTimeout(()=>{this.handleAnnouncementUpdate(Q)},50)}handleAnnouncementUpdate(Q){if(!this.isAlive()||!this.descriptionContainer)return;let z=Q;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:Q}=this;if(Q)z0(Q),Q.remove();this.descriptionContainer=null,this.pendingAnnouncements.clear()}},UE=class extends _E{},WE={moduleName:"Aria",version:p,beans:[UE]},BE=":where(.ag-delay-render){.ag-cell,.ag-header-cell,.ag-header-group-cell,.ag-row,.ag-spanned-cell-wrapper{visibility:hidden}}",Q8="ag-delay-render",EE=class extends j{constructor(){super(...arguments);this.beanName="colDelayRenderSvc",this.hideRequested=!1,this.alreadyRevealed=!1,this.timesRetried=0,this.requesters=new Set}hideColumns(Q){if(this.alreadyRevealed||this.requesters.has(Q))return;if(this.requesters.add(Q),!this.hideRequested)this.beans.ctrlsSvc.whenReady(this,(z)=>{z.gridBodyCtrl.eGridBody.classList.add(Q8)}),this.hideRequested=!0}revealColumns(Q){if(this.alreadyRevealed||!this.isAlive())return;if(this.requesters.delete(Q),this.requesters.size>0)return;let{renderStatus:z,ctrlsSvc:J}=this.beans;if(z){if(!z.areHeaderCellsRendered()&&this.timesRetried<5){this.timesRetried++,setTimeout(()=>this.revealColumns(Q));return}this.timesRetried=0}J.getGridBodyCtrl().eGridBody.classList.remove(Q8),this.alreadyRevealed=!0}},KE={moduleName:"ColumnDelayRender",version:p,beans:[EE],css:[BE]},nZ=class extends x{constructor(){super()}},LE={tag:"div",cls:"ag-overlay-exporting-center",children:[{tag:"span",ref:"eExportingIcon",cls:"ag-loading-icon"},{tag:"span",ref:"eExportingText",cls:"ag-exporting-text"}]},FE=class extends nZ{constructor(){super(...arguments);this.eExportingIcon=S,this.eExportingText=S}init(Q){let{beans:z}=this;this.setTemplate(LE);let J=h("overlayExporting",z,null);if(J)this.eExportingIcon.appendChild(J);let Z=Q.exporting?.overlayText??this.getLocaleTextFunc()("exportingOoo","Exporting...");this.eExportingText.textContent=Z,z.ariaAnnounce.announceValue(Z,"overlay")}},DE={tag:"div",cls:"ag-overlay-loading-center",children:[{tag:"span",ref:"eLoadingIcon",cls:"ag-loading-icon"},{tag:"span",ref:"eLoadingText",cls:"ag-loading-text"}]},ME=class extends nZ{constructor(){super(...arguments);this.eLoadingIcon=S,this.eLoadingText=S}init(Q){let{beans:z,gos:J}=this,Z=RQ(J.get("overlayLoadingTemplate")?.trim());if(this.setTemplate(Z??DE),!Z){let $=h("overlayLoading",z,null);if($)this.eLoadingIcon.appendChild($);let X=Q.loading?.overlayText??this.getLocaleTextFunc()("loadingOoo","Loading...");this.eLoadingText.textContent=X,z.ariaAnnounce.announceValue(X,"overlay")}}},kE={tag:"span",cls:"ag-overlay-no-matching-rows-center"},VE=class extends nZ{init(Q){let{beans:z}=this;this.setTemplate(kE);let J=Q.noMatchingRows?.overlayText??this.getLocaleTextFunc()("noMatchingRows","No Matching Rows");this.getGui().textContent=J,z.ariaAnnounce.announceValue(J,"overlay")}},fE={tag:"span",cls:"ag-overlay-no-rows-center"},AE=class extends nZ{init(Q){let{beans:z,gos:J}=this,Z=RQ(J.get("overlayNoRowsTemplate")?.trim());if(this.setTemplate(Z??fE),!Z){let $=Q.noRows?.overlayText??this.getLocaleTextFunc()("noRowsToShow","No Rows To Show");this.getGui().textContent=$,z.ariaAnnounce.announceValue($,"overlay")}}};function jE(Q){Q.overlays?.showLoadingOverlay()}function RE(Q){Q.overlays?.showNoRowsOverlay()}function SE(Q){Q.overlays?.hideOverlay()}var OE=".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)}",PE={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"}]}]},t$=class extends x{constructor(){super(PE);this.eOverlayWrapper=S,this.activeOverlay=null,this.activePromise=null,this.activeCssClass=null,this.elToFocusAfter=null,this.overlayExclusive=!1,this.oldWrapperPadding=null,this.registerCSS(OE)}handleKeyDown(Q){if(Q.key!==V.TAB||Q.defaultPrevented||zQ(Q))return;let{beans:z,eOverlayWrapper:J}=this;if(J&&R0(z,J,!1,Q.shiftKey))return;let $=!1;if(Q.shiftKey)$=z.focusSvc.focusGridView({column:b(z.visibleCols.allCols),backwards:!0,canFocusOverlay:!1});else $=$Q(z,!1);if($)Q.preventDefault()}updateLayoutClasses(Q,z){let J=this.eOverlayWrapper;if(!J)return;let Z=J.classList,{AUTO_HEIGHT:$,NORMAL:X,PRINT:Y}=UQ;Z.toggle($,z.autoHeight),Z.toggle(X,z.normal),Z.toggle(Y,z.print)}postConstruct(){this.createManagedBean(new G6(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(Q){let z=this.eOverlayWrapper?.classList;if(!z){this.activeCssClass=null;return}if(this.activeCssClass)z.toggle(this.activeCssClass,!1);this.activeCssClass=Q,z.toggle(Q,!0)}showOverlay(Q,z,J){if(this.destroyActiveOverlay(),this.elToFocusAfter=null,this.activePromise=Q,this.overlayExclusive=J,!Q)return this.refreshWrapperPadding(),g.resolve();if(this.setWrapperTypeClass(z),this.setDisplayed(!0,{skipAriaHidden:!0}),this.refreshWrapperPadding(),J&&this.isGridFocused()){let Z=d(this.beans);if(Z&&!hz(this.beans))this.elToFocusAfter=Z}return Q.then((Z)=>{let $=this.eOverlayWrapper;if(!$){this.destroyBean(Z);return}if(this.activePromise!==Q){if(this.activeOverlay!==Z)this.destroyBean(Z),Z=null;return}if(this.activePromise=null,!Z)return;if(this.activeOverlay!==Z)$.appendChild(Z.getGui()),this.activeOverlay=Z;if(J&&this.isGridFocused())D0($)}),Q}refreshWrapperPadding(){if(!this.eOverlayWrapper){this.oldWrapperPadding=null;return}let Q=!!this.activeOverlay||!!this.activePromise,z=0;if(Q&&!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 Q=this.activeOverlay;if(!Q){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(Q);let J=this.eOverlayWrapper;if(J)z0(J);z?.focus?.({preventScroll:!0}),this.refreshWrapperPadding()}hideOverlay(){this.destroyActiveOverlay(),this.setDisplayed(!1,{skipAriaHidden:!0})}isGridFocused(){let Q=d(this.beans);return!!Q&&this.beans.eGridDiv.contains(Q)}destroy(){this.elToFocusAfter=null,this.destroyActiveOverlay(),this.beans.overlays.setWrapperComp(this,!0),super.destroy(),this.eOverlayWrapper=null}},TE={selector:"AG-OVERLAY-WRAPPER",component:t$},vE=["refresh"],DJ=(Q)=>({name:Q,optionalMethods:vE}),Oz={id:"agLoadingOverlay",overlayType:"loading",comp:DJ("loadingOverlayComponent"),wrapperCls:"ag-overlay-loading-wrapper",exclusive:!0,compKey:"loadingOverlayComponent",paramsKey:"loadingOverlayComponentParams",isSuppressed:(Q)=>{let z=Q.get("loading");return z===!1||Q.get("suppressLoadingOverlay")===!0&&z!==!0}},Y1={id:"agNoRowsOverlay",overlayType:"noRows",comp:DJ("noRowsOverlayComponent"),wrapperCls:"ag-overlay-no-rows-wrapper",compKey:"noRowsOverlayComponent",paramsKey:"noRowsOverlayComponentParams",isSuppressed:(Q)=>Q.get("suppressNoRowsOverlay")},j6={id:"agNoMatchingRowsOverlay",overlayType:"noMatchingRows",comp:DJ("noMatchingRowsOverlayComponent"),wrapperCls:"ag-overlay-no-matching-rows-wrapper"},EZ={id:"agExportingOverlay",overlayType:"exporting",comp:DJ("exportingOverlayComponent"),wrapperCls:"ag-overlay-exporting-wrapper",exclusive:!0},aJ={id:"activeOverlay",comp:DJ("activeOverlay"),wrapperCls:"ag-overlay-modal-wrapper",exclusive:!0},IE=(Q)=>{if(!Q)return null;return{agLoadingOverlay:Oz,agNoRowsOverlay:Y1,agNoMatchingRowsOverlay:j6,agExportingOverlay:EZ}[Q]??aJ},CE=(Q)=>{if(!Q)return null;return{loading:Oz,noRows:Y1,noMatchingRows:j6,exporting:EZ}[Q]},bE=class extends j{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 Q=this.gos;this.showInitialOverlay=o(Q);let z=()=>{if(this.userForcedNoRows)return;this.updateOverlay(!1)},[J,Z,$,X]=this.addManagedEventListeners({newColumnsLoaded:z,rowCountReady:()=>{this.disableInitialOverlay(),z(),Z()},rowDataUpdated:z,modelUpdated:z});this.newColumnsLoadedCleanup=J,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(Q,z){if(!this.isAlive())return;if(!z)this.eWrapper=Q;else if(this.eWrapper===Q)this.eWrapper=void 0;this.updateOverlay(!1)}isVisible(){return!!this.currentDef}showLoadingOverlay(){this.showInitialOverlay=!1;let Q=this.gos;if(!this.eWrapper||Q.get("activeOverlay"))return;if(this.isDisabled(Oz))return;let z=Q.get("loading");if(!z&&z!==void 0)return;this.doShowOverlay(Oz)}showNoRowsOverlay(){this.showInitialOverlay=!1;let Q=this.gos;if(!this.eWrapper||Q.get("activeOverlay")||Q.get("loading")||this.isDisabled(Y1))return;this.userForcedNoRows=!0,this.doShowOverlay(Y1)}async showExportOverlay(Q){let{gos:z,beans:J}=this;if(!this.eWrapper||z.get("activeOverlay")||z.get("loading")||this.isDisabled(EZ)||this.userForcedNoRows&&this.currentDef===Y1){Q();return}let Z=this.getDesiredDefWithOverride(EZ);if(!Z){Q();return}this.exportsInProgress++,this.focusedCell=J.focusSvc.getFocusedCell(),await this.doShowOverlay(Z),await new Promise((X)=>setTimeout(()=>X()));let $=Date.now();try{Q()}finally{let X=Date.now()-$,Y=Math.max(0,300-X),G=()=>{if(this.exportsInProgress--,this.exportsInProgress===0)this.updateOverlay(!1),HH(J,this.focusedCell),this.focusedCell=null};if(Y>0)setTimeout(()=>G(),Y);else G()}}hideOverlay(){let Q=this.gos;this.showInitialOverlay=!1;let z=this.userForcedNoRows;if(this.userForcedNoRows=!1,Q.get("loading")){R(99);return}if(Q.get("activeOverlay")){R(296);return}if(this.currentDef===j6){R(297);return}if(this.doHideOverlay(),z){if(this.getOverlayDef()!==Y1)this.updateOverlay(!1)}}getOverlayWrapperSelector(){return TE}getOverlayWrapperCompClass(){return t$}onPropChange(Q){let z=Q.has("activeOverlay");if(z||Q.has("loading")){if(this.updateOverlay(z))return}let J=this.currentDef,Z=this.eWrapper?.activeOverlay;if(Z&&J){let $=Q.has("activeOverlayParams");if(J===aJ){if($)Z.refresh?.(this.makeCompParams(!0))}else{let X=J.paramsKey;if(Q.has("overlayComponentParams")||X&&Q.has(X))Z.refresh?.(this.makeCompParams(!1,X,J.overlayType))}}}updateOverlay(Q){let z=this.eWrapper;if(!z)return this.currentDef=null,!1;let J=this.getDesiredDefWithOverride(),Z=this.currentDef,$=J===aJ&&Q;if(J!==Z){if(!J)return this.disableInitialOverlay(),this.doHideOverlay();return this.doShowOverlay(J),!0}if($&&J)return z.hideOverlay(),this.doShowOverlay(J),!0;if(!J)this.disableInitialOverlay();return!1}getDesiredDefWithOverride(Q){let{gos:z}=this,J=IE(z.get("activeOverlay"));if(!J){if(J=Q??this.getOverlayDef(),J&&this.isDisabled(J))J=null}return J}getOverlayDef(){let{gos:Q,beans:z}=this,{rowModel:J}=z,Z=Q.get("loading");if(Z!==void 0){if(this.disableInitialOverlay(),Z)return Oz}else if(this.showInitialOverlay){if(!this.isDisabled(Oz)&&(!Q.get("columnDefs")||!Q.get("rowData")))return Oz;this.disableInitialOverlay()}else this.disableInitialOverlay();let X=J.getOverlayType();return CE(X)}disableInitialOverlay(){this.showInitialOverlay=!1,this.newColumnsLoadedCleanup?.(),this.newColumnsLoadedCleanup=null}doShowOverlay(Q){let{gos:z,beans:J}=this,{userCompFactory:Z}=J;this.currentDef=Q;let $=Q!==aJ,X=!!Q.exclusive;this.exclusive=X;let Y;if(Q.paramsKey&&z.get(Q.paramsKey)||Q.compKey&&z.get(Q.compKey))Y=Q.paramsKey;let G=void 0;if($){if(z.get("overlayComponent")||z.get("overlayComponentSelector"))G=Z.getCompDetailsFromGridOptions({name:"overlayComponent",optionalMethods:["refresh"]},void 0,this.makeCompParams(!1,Q.paramsKey,Q.overlayType))}G??(G=Z.getCompDetailsFromGridOptions(Q.comp,$?Q.id:void 0,this.makeCompParams(!$,Y,Q.overlayType),!1));let q=G?.newAgStackInstance()??null,H=this.eWrapper?this.eWrapper.showOverlay(q,Q.wrapperCls,X):g.resolve();return this.eWrapper?.refreshWrapperPadding(),this.setExclusive(X),H}makeCompParams(Q,z,J){let{gos:Z}=this,$=Q?Z.get("activeOverlayParams"):{...Z.get("overlayComponentParams"),...z&&Z.get(z)||null,overlayType:J};return y(Z,$??{})}doHideOverlay(){let Q=!1;if(this.currentDef)this.currentDef=null,Q=!0;this.exclusive=!1;let z=this.eWrapper;if(z)z.hideOverlay(),z.refreshWrapperPadding(),this.setExclusive(!1);return Q}setExclusive(Q){if(this.oldExclusive!==Q)this.oldExclusive=Q,this.eventSvc.dispatchEvent({type:"overlayExclusiveChanged"})}isDisabled(Q){let{gos:z}=this;return Q.overlayType&&z.get("suppressOverlays")?.includes(Q.overlayType)||Q.isSuppressed?.(z)===!0}},yE={moduleName:"Overlay",version:p,userComponents:{agLoadingOverlay:ME,agNoRowsOverlay:AE,agNoMatchingRowsOverlay:VE,agExportingOverlay:FE},apiFunctions:{showLoadingOverlay:jE,showNoRowsOverlay:RE,hideOverlay:SE},icons:{overlayLoading:"loading",overlayExporting:"loading"},beans:[bE]},xE=class extends j{constructor(){super(...arguments);this.beanName="rowContainerHeight",this.scrollY=0,this.uiBodyHeight=0}postConstruct(){this.addManagedEventListeners({bodyHeightChanged:this.updateOffset.bind(this)}),this.maxDivHeight=mq(),d1(this.gos,"RowContainerHeightService - maxDivHeight = "+this.maxDivHeight)}updateOffset(){if(!this.stretching)return;let Q=this.beans.ctrlsSvc.getScrollFeature().getVScrollPosition().top,z=this.getUiBodyHeight();if(Q!==this.scrollY||z!==this.uiBodyHeight)this.scrollY=Q,this.uiBodyHeight=z,this.calculateOffset()}calculateOffset(){this.setUiContainerHeight(this.maxDivHeight),this.pixelsToShave=this.modelHeight-this.uiContainerHeight,this.maxScrollY=this.uiContainerHeight-this.uiBodyHeight;let Q=this.scrollY/this.maxScrollY,z=Q*this.pixelsToShave;d1(this.gos,`RowContainerHeightService - Div Stretch Offset = ${z} (${this.pixelsToShave} * ${Q})`),this.setDivStretchOffset(z)}setUiContainerHeight(Q){if(Q!==this.uiContainerHeight)this.uiContainerHeight=Q,this.eventSvc.dispatchEvent({type:"rowContainerHeightChanged"})}clearOffset(){this.setUiContainerHeight(this.modelHeight),this.pixelsToShave=0,this.setDivStretchOffset(0)}setDivStretchOffset(Q){let z=typeof Q==="number"?Math.floor(Q):null;if(this.divStretchOffset===z)return;this.divStretchOffset=z,this.eventSvc.dispatchEvent({type:"heightScaleChanged"})}setModelHeight(Q){if(this.modelHeight=Q,this.stretching=Q!=null&&this.maxDivHeight>0&&Q>this.maxDivHeight,this.stretching)this.calculateOffset();else this.clearOffset()}getRealPixelPosition(Q){return Q-this.divStretchOffset}getUiBodyHeight(){let Q=this.beans.ctrlsSvc.getScrollFeature().getVScrollPosition();return Q.bottom-Q.top}getScrollPositionForPixel(Q){if(this.pixelsToShave<=0)return Q;let z=this.modelHeight-this.getUiBodyHeight(),J=Q/z;return this.maxScrollY*J}},wE=400,NE=class extends j{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 Q=()=>{for(let X of this.getAllCellCtrls())X.onCellSelectionChanged()},z=()=>{for(let X of this.getAllCellCtrls())X.updateRangeBordersIfRangeCount()},J=()=>{this.eventSvc.addListener("cellSelectionChanged",Q),this.eventSvc.addListener("columnMoved",z),this.eventSvc.addListener("columnPinned",z),this.eventSvc.addListener("columnVisible",z)},Z=()=>{this.eventSvc.removeListener("cellSelectionChanged",Q),this.eventSvc.removeListener("columnMoved",z),this.eventSvc.removeListener("columnPinned",z),this.eventSvc.removeListener("columnVisible",z)};if(this.addDestroyFunc(()=>Z()),this.addManagedPropertyListeners(["enableRangeSelection","cellSelection"],()=>{if(u0(this.gos))J();else Z()}),u0(this.gos))J()}}wireBeans(Q){this.pageBounds=Q.pageBounds,this.colModel=Q.colModel,this.pinnedRowModel=Q.pinnedRowModel,this.rowModel=Q.rowModel,this.focusSvc=Q.focusSvc,this.rowContainerHeight=Q.rowContainerHeight,this.ctrlsSvc=Q.ctrlsSvc,this.editSvc=Q.editSvc}postConstruct(){this.ctrlsSvc.whenReady(this,(Q)=>{this.gridBodyCtrl=Q.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",(Z)=>this.onSuppressCellFocusChanged(Z.currentValue)),this.addManagedPropertyListeners(["groupSuppressBlankHeader","getBusinessKeyForNode","fullWidthCellRenderer","fullWidthCellRendererParams","suppressStickyTotalRow","groupRowRenderer","groupRowRendererParams","loadingCellRenderer","loadingCellRendererParams","detailCellRenderer","detailCellRendererParams","enableRangeSelection","enableCellTextSelection"],()=>this.redrawRows()),this.addManagedPropertyListener("cellSelection",({currentValue:Z,previousValue:$})=>{if(!$&&Z||$&&!Z)this.redrawRows()});let{stickyRowSvc:Q,gos:z,showRowGroupCols:J}=this.beans;if(J)this.addManagedPropertyListener("showOpenedGroup",()=>{let Z=J.columns;if(Z.length)this.refreshCells({columns:Z,force:!0})});if(Q)this.stickyRowFeature=Q.createStickyRowFeature(this,this.createRowCon.bind(this),this.destroyRowCtrls.bind(this));else{let Z=this.gridBodyCtrl;Z.setStickyTopHeight(0),Z.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 Q=this.getKeepDetailRowsCount(),z=Q!=null?Q:3;this.cachedRowCtrls=new gE(z)}}getKeepDetailRowsCount(){return this.gos.get("keepDetailRowsCount")}getStickyTopRowCtrls(){return this.stickyRowFeature?.stickyTopRowCtrls??[]}getStickyBottomRowCtrls(){return this.stickyRowFeature?.stickyBottomRowCtrls??[]}updateAllRowCtrls(){let Q=Object.values(this.rowCtrlsByRowIndex),z=Object.values(this.zombieRowCtrls),J=this.cachedRowCtrls?.getEntries()??[];if(z.length>0||J.length>0)this.allRowCtrls=[...Q,...z,...J];else this.allRowCtrls=Q}isCellBeingRendered(Q,z){let J=this.rowCtrlsByRowIndex[Q];if(!z||!J)return!!J;if(J.isFullWidth())return!0;return!!this.beans.spannedRowRenderer?.getCellByPosition({rowIndex:Q,column:z,rowPinned:null})||!!J.getCellCtrl(z)||!J.isRowRendered()}updateCellFocus(Q){for(let z of this.getAllCellCtrls())z.onCellFocused(Q);for(let z of this.getFullWidthRowCtrls())z.onFullWidthRowFocused(Q)}onCellFocusChanged(Q){if(Q?.rowIndex!=null&&!Q.rowPinned){let z=this.beans.colModel.getCol(Q.column)??void 0;if(!this.isCellBeingRendered(Q.rowIndex,z))this.redraw()}this.updateCellFocus(Q)}onSuppressCellFocusChanged(Q){for(let z of this.getAllCellCtrls())z.onSuppressCellFocusChanged(Q);for(let z of this.getFullWidthRowCtrls())z.onSuppressCellFocusChanged(Q)}registerCellEventListeners(){this.addManagedEventListeners({cellFocused:(Q)=>this.onCellFocusChanged(Q),cellFocusCleared:()=>this.updateCellFocus(),flashCells:(Q)=>{let{cellFlashSvc:z}=this.beans;if(z)for(let J of this.getAllCellCtrls())z.onFlashCells(J,Q)},columnHoverChanged:()=>{for(let Q of this.getAllCellCtrls())Q.onColumnHover()},displayedColumnsChanged:()=>{for(let Q of this.getAllCellCtrls())Q.onDisplayedColumnsChanged()},displayedColumnsWidthChanged:()=>{if(this.printLayout)for(let Q of this.getAllCellCtrls())Q.onLeftChanged()}}),this.setupRangeSelectionListeners(),this.refreshListenersToColumnsForCellComps(),this.addManagedEventListeners({gridColumnsChanged:this.refreshListenersToColumnsForCellComps.bind(this)}),this.addDestroyFunc(this.removeGridColumnListeners.bind(this))}removeGridColumnListeners(){for(let Q of this.destroyFuncsForColumnListeners)Q();this.destroyFuncsForColumnListeners.length=0}refreshListenersToColumnsForCellComps(){this.removeGridColumnListeners();let Q=this.colModel.getCols();for(let z of Q){let J=(q)=>{for(let H of this.getAllCellCtrls())if(H.column===z)q(H)},Z=()=>{J((q)=>q.onLeftChanged())},$=()=>{J((q)=>q.onWidthChanged())},X=()=>{J((q)=>q.onFirstRightPinnedChanged())},Y=()=>{J((q)=>q.onLastLeftPinnedChanged())},G=()=>{J((q)=>q.onColDefChanged())};z.__addEventListener("leftChanged",Z),z.__addEventListener("widthChanged",$),z.__addEventListener("firstRightPinnedChanged",X),z.__addEventListener("lastLeftPinnedChanged",Y),z.__addEventListener("colDefChanged",G),this.destroyFuncsForColumnListeners.push(()=>{z.__removeEventListener("leftChanged",Z),z.__removeEventListener("widthChanged",$),z.__removeEventListener("firstRightPinnedChanged",X),z.__removeEventListener("lastLeftPinnedChanged",Y),z.__removeEventListener("colDefChanged",G)})}}onDomLayoutChanged(){let Q=V0(this.gos,"print"),z=Q||this.gos.get("embedFullWidthRows"),J=z!==this.embedFullWidthRows||this.printLayout!==Q;if(this.printLayout=Q,this.embedFullWidthRows=z,J)this.redrawAfterModelUpdate({domLayoutChanged:!0})}datasourceChanged(){this.firstRenderedRow=0,this.lastRenderedRow=-1;let Q=Object.keys(this.rowCtrlsByRowIndex);this.removeRowCtrls(Q)}onPageLoaded(Q){let z={recycleRows:Q.keepRenderedRows,animate:Q.animate,newData:Q.newData,newPage:Q.newPage,onlyBody:!0};this.redrawAfterModelUpdate(z)}getAllCellsNotSpanningForColumn(Q){let z=[];for(let J of this.getAllRowCtrls()){let Z=J.getCellCtrl(Q,!0)?.eGui;if(Z)z.push(Z)}return z}refreshFloatingRowComps(Q=!0){this.refreshFloatingRows(this.topRowCtrls,"top",Q),this.refreshFloatingRows(this.bottomRowCtrls,"bottom",Q)}refreshFloatingRows(Q,z,J){let{pinnedRowModel:Z,beans:$,printLayout:X}=this,Y=Object.fromEntries(Q.map((q)=>[q.rowNode.id,q]));Z?.forEachPinnedRow(z,(q,H)=>{let _=Q[H];if(_&&Z.getPinnedRowById(_.rowNode.id,z)===void 0)_.destroyFirstPass(),_.destroySecondPass();if(q.id in Y&&J)Q[H]=Y[q.id],delete Y[q.id];else Q[H]=new F5(q,$,!1,!1,X)});let G=(z==="top"?Z?.getPinnedTopRowCount():Z?.getPinnedBottomRowCount())??0;Q.length=G}onPinnedRowDataChanged(){let Q={recycleRows:!0};this.redrawAfterModelUpdate(Q)}onPinnedRowsChanged(){this.redrawAfterModelUpdate({recycleRows:!0})}redrawRow(Q,z=!1){if(Q.sticky)this.stickyRowFeature?.refreshStickyNode(Q);else if(this.cachedRowCtrls?.has(Q)){this.cachedRowCtrls.removeRow(Q);return}else{let J=(Z)=>{let $=Z[Q.rowIndex];if(!$)return;if($.rowNode!==Q)return;$.destroyFirstPass(),$.destroySecondPass(),Z[Q.rowIndex]=this.createRowCon(Q,!1,!1)};switch(Q.rowPinned){case"top":J(this.topRowCtrls);break;case"bottom":J(this.bottomRowCtrls);break;default:J(this.rowCtrlsByRowIndex),this.updateAllRowCtrls()}}if(!z)this.dispatchDisplayedRowsChanged(!1)}redrawRows(Q){let{editSvc:z}=this.beans;if(z?.isEditing())if(z.isBatchEditing())z.cleanupEditors();else z.stopEditing(void 0,{source:"api"});if(Q!=null){for(let Z of Q??[])this.redrawRow(Z,!0);this.dispatchDisplayedRowsChanged(!1);return}this.redrawAfterModelUpdate()}redrawAfterModelUpdate(Q={}){this.getLockOnRefresh();let z=this.beans.focusSvc?.getFocusCellToUseAfterRefresh();this.updateContainerHeights(),this.scrollToTopIfNewData(Q);let J=!Q.domLayoutChanged&&!!Q.recycleRows,Z=Q.animate&&_1(this.gos),$=J?this.getRowsToRecycle():null;if(!J)this.removeAllRowComps();this.workOutFirstAndLastRowsToRender();let{stickyRowFeature:X,gos:Y}=this;if(X){X.checkStickyRows();let G=X.extraTopHeight+X.extraBottomHeight;if(G)this.updateContainerHeights(G)}if(this.recycleRows($,Z),this.gridBodyCtrl.updateRowCount(),!Q.onlyBody)this.refreshFloatingRowComps(Y.get("enableRowPinning")?J:void 0);if(this.dispatchDisplayedRowsChanged(),z!=null)this.restoreFocusedCell(z);this.releaseLockOnRefresh()}scrollToTopIfNewData(Q){let z=Q.newData||Q.newPage,J=this.gos.get("suppressScrollOnNewData");if(z&&!J)this.gridBodyCtrl.scrollFeature.scrollToTop(),this.stickyRowFeature?.resetOffsets()}updateContainerHeights(Q=0){let{rowContainerHeight:z}=this;if(this.printLayout){z.setModelHeight(null);return}let J=this.pageBounds.getCurrentPageHeight();if(J===0)J=1;z.setModelHeight(J+Q)}getLockOnRefresh(){if(this.refreshInProgress)throw Error(QQ(252));this.refreshInProgress=!0,this.beans.frameworkOverrides.getLockOnRefresh?.()}releaseLockOnRefresh(){this.refreshInProgress=!1,this.beans.frameworkOverrides.releaseLockOnRefresh?.()}isRefreshInProgress(){return this.refreshInProgress}restoreFocusedCell(Q){if(!Q)return;let z=this.beans.focusSvc,J=this.findPositionToFocus(Q);if(!J){z.focusHeaderPosition({headerPosition:{headerRowIndex:l0(this.beans)-1,column:Q.column}});return}if(Q.rowIndex!==J.rowIndex||Q.rowPinned!=J.rowPinned){z.setFocusedCell({...J,preventScrollOnBrowserFocus:!0,forceBrowserFocus:!0});return}if(!z.doesRowOrCellHaveBrowserFocus())this.updateCellFocus(y(this.gos,{...J,forceBrowserFocus:!0,preventScrollOnBrowserFocus:!0,type:"cellFocused"}))}findPositionToFocus(Q){let{pagination:z,pageBounds:J}=this.beans,Z=Q;if(Z.rowPinned==null&&z&&J&&!z.isRowInPage(Z.rowIndex))Z={rowPinned:null,rowIndex:J.getFirstRow()};while(Z){if(Z.rowPinned==null&&J){if(Z.rowIndexJ.getLastRow())Z={rowPinned:null,rowIndex:J.getLastRow()}}let $=this.getRowByPosition(Z);if($?.isAlive())return{...$.getRowPosition(),column:Q.column};Z=m0(this.beans,Z)}return null}getAllCellCtrls(){let Q=[],z=this.getAllRowCtrls(),J=z.length;for(let Z=0;Z{let $=Z.rowNode;return J8($,z)})}getCellCtrls(Q,z){let J;if(T(z))J={},z.forEach(($)=>{let X=this.colModel.getCol($);if(T(X))J[X.getId()]=!0});let Z=[];for(let $ of this.getRowCtrls(Q))for(let X of $.getAllCellCtrls()){let Y=X.column.getId();if(J&&!J[Y])continue;Z.push(X)}return Z}destroy(){this.removeAllRowComps(!0),super.destroy()}removeAllRowComps(Q=!1){let z=Object.keys(this.rowCtrlsByRowIndex);this.removeRowCtrls(z,Q),this.stickyRowFeature?.destroyStickyCtrls()}getRowsToRecycle(){let Q=[];for(let J of Object.keys(this.rowCtrlsByRowIndex))if(this.rowCtrlsByRowIndex[J].rowNode.id==null)Q.push(J);this.removeRowCtrls(Q);let z={};for(let J of Object.values(this.rowCtrlsByRowIndex)){let Z=J.rowNode;z[Z.id]=J}return this.rowCtrlsByRowIndex={},z}removeRowCtrls(Q,z=!1){for(let J of Q){let Z=this.rowCtrlsByRowIndex[J];if(Z)Z.destroyFirstPass(z),Z.destroySecondPass();delete this.rowCtrlsByRowIndex[J]}}onBodyScroll(Q){if(Q.direction!=="vertical")return;this.redraw({afterScroll:!0})}redraw(Q={}){let{focusSvc:z,animationFrameSvc:J}=this.beans,{afterScroll:Z}=Q,$,X=this.stickyRowFeature;if(X)$=z?.getFocusCellToUseAfterRefresh()||void 0;let Y=this.firstRenderedRow,G=this.lastRenderedRow;this.workOutFirstAndLastRowsToRender();let q=!1;if(X){q=X.checkStickyRows();let _=X.extraTopHeight+X.extraBottomHeight;if(_)this.updateContainerHeights(_)}let H=this.firstRenderedRow!==Y||this.lastRenderedRow!==G;if(Z&&!q&&!H)return;if(this.getLockOnRefresh(),this.recycleRows(null,!1,Z),this.releaseLockOnRefresh(),this.dispatchDisplayedRowsChanged(Z&&!q),$!=null){let _=z?.getFocusCellToUseAfterRefresh();if($!=null&&_==null)J?.flushAllFrames(),this.restoreFocusedCell($)}}removeRowCompsNotToDraw(Q,z){let J={};for(let X of Q)J[X]=!0;let $=Object.keys(this.rowCtrlsByRowIndex).filter((X)=>!J[X]);this.removeRowCtrls($,z)}calculateIndexesToDraw(Q){let z=[];for(let Y=this.firstRenderedRow;Y<=this.lastRenderedRow;Y++)z.push(Y);let J=this.beans.pagination,Z=this.beans.focusSvc?.getFocusedCell()?.rowIndex;if(Z!=null&&(Zthis.lastRenderedRow)&&(!J||J.isRowInPage(Z))&&Z{let G=Y.rowNode.rowIndex;if(G==null||G===Z)return;if(Gthis.lastRenderedRow){if(this.doNotUnVirtualiseRow(Y))z.push(G)}};for(let Y of Object.values(this.rowCtrlsByRowIndex))$(Y);if(Q)for(let Y of Object.values(Q))$(Y);z.sort((Y,G)=>Y-G);let X=[];for(let Y=0;Y{this.destroyRowCtrls(Q,z),this.updateAllRowCtrls(),this.dispatchDisplayedRowsChanged()});else this.destroyRowCtrls(Q,z)}this.updateAllRowCtrls()}dispatchDisplayedRowsChanged(Q=!1){this.eventSvc.dispatchEvent({type:"displayedRowsChanged",afterScroll:Q})}onDisplayedColumnsChanged(){let{visibleCols:Q}=this.beans,z=Q.isPinningLeft(),J=Q.isPinningRight();if(this.pinningLeft!==z||J!==this.pinningRight){if(this.pinningLeft=z,this.pinningRight=J,this.embedFullWidthRows)this.redrawFullWidthEmbeddedRows()}}redrawFullWidthEmbeddedRows(){let Q=[];for(let z of this.getFullWidthRowCtrls()){let J=z.rowNode.rowIndex;Q.push(J.toString())}this.refreshFloatingRowComps(),this.removeRowCtrls(Q),this.redraw({afterScroll:!0})}getFullWidthRowCtrls(Q){let z=z8(Q);return this.getAllRowCtrls().filter((J)=>{if(!J.isFullWidth())return!1;let Z=J.rowNode;if(z!=null&&!J8(Z,z))return!1;return!0})}createOrUpdateRowCtrl(Q,z,J,Z){let $,X=this.rowCtrlsByRowIndex[Q];if(!X){if($=this.rowModel.getRow(Q),T($)&&T(z)&&z[$.id]&&$.alreadyRendered)X=z[$.id],z[$.id]=null}if(!X){if(!$)$=this.rowModel.getRow(Q);if(T($))X=this.createRowCon($,J,Z);else return}if($)$.alreadyRendered=!0;this.rowCtrlsByRowIndex[Q]=X}destroyRowCtrls(Q,z){let J=[];if(Q)for(let Z of Object.values(Q)){if(!Z)continue;if(this.cachedRowCtrls&&Z.isCacheable()){this.cachedRowCtrls.addRow(Z);continue}if(Z.destroyFirstPass(!z),z){let $=Z.instanceId;this.zombieRowCtrls[$]=Z,J.push(()=>{Z.destroySecondPass(),delete this.zombieRowCtrls[$]})}else Z.destroySecondPass()}if(z)J.push(()=>{if(this.isAlive())this.updateAllRowCtrls(),this.dispatchDisplayedRowsChanged()}),window.setTimeout(()=>{for(let Z of J)Z()},wE)}getRowBuffer(){return this.gos.get("rowBuffer")}getRowBufferInPixels(){let Q=this.getRowBuffer(),z=X9(this.beans);return Q*z}workOutFirstAndLastRowsToRender(){let{rowContainerHeight:Q,pageBounds:z,rowModel:J}=this;Q.updateOffset();let Z,$;if(!J.isRowsToRender())Z=0,$=-1;else if(this.printLayout)this.beans.environment.refreshRowHeightVariable(),Z=z.getFirstRow(),$=z.getLastRow();else{let _=this.getRowBufferInPixels(),U=this.ctrlsSvc.getScrollFeature(),W=this.gos.get("suppressRowVirtualisation"),B=!1,E,K;do{let k=z.getPixelOffset(),{pageFirstPixel:f,pageLastPixel:A}=z.getCurrentPagePixelRange(),O=Q.divStretchOffset,v=U.getVScrollPosition(),I=v.top,C=v.bottom;if(W)E=f+O,K=A+O;else E=Math.max(I+k-_,f)+O,K=Math.min(C+k+_,A)+O;this.firstVisibleVPixel=Math.max(I+k,f)+O,this.lastVisibleVPixel=Math.min(C+k,A)+O,B=this.ensureAllRowsInRangeHaveHeightsCalculated(E,K)}while(B);let L=J.getRowIndexAtPixel(E),F=J.getRowIndexAtPixel(K),D=z.getFirstRow(),M=z.getLastRow();if(LM)F=M;Z=L,$=F}let X=V0(this.gos,"normal"),Y=this.gos.get("suppressMaxRenderedRowRestriction"),G=Math.max(this.getRowBuffer(),500);if(X&&!Y){if($-Z>G)$=Z+G}let q=Z!==this.firstRenderedRow,H=$!==this.lastRenderedRow;if(q||H)this.firstRenderedRow=Z,this.lastRenderedRow=$,this.eventSvc.dispatchEvent({type:"viewportChanged",firstRow:Z,lastRow:$})}dispatchFirstDataRenderedEvent(){if(this.dataFirstRenderedFired)return;this.dataFirstRenderedFired=!0,YQ(this.beans,()=>{this.beans.eventSvc.dispatchEvent({type:"firstDataRendered",firstRow:this.firstRenderedRow,lastRow:this.lastRenderedRow})})}ensureAllRowsInRangeHaveHeightsCalculated(Q,z){let J=this.pinnedRowModel?.ensureRowHeightsValid(),Z=this.stickyRowFeature?.ensureRowHeightsValid(),{pageBounds:$,rowModel:X}=this,Y=X.ensureRowHeightsValid(Q,z,$.getFirstRow(),$.getLastRow());if(Y||Z)this.eventSvc.dispatchEvent({type:"recalculateRowBounds"});if(Z||Y||J)return this.updateContainerHeights(),!0;return!1}doNotUnVirtualiseRow(Q){let Z=Q.rowNode,$=this.focusSvc.isRowFocused(Z.rowIndex,Z.rowPinned),X=this.editSvc?.isEditing(Q),Y=Z.detail;if(!($||X||Y))return!1;return this.isRowPresent(Z)?!0:!1}isRowPresent(Q){if(!this.rowModel.isRowPresent(Q))return!1;return this.beans.pagination?.isRowInPage(Q.rowIndex)??!0}createRowCon(Q,z,J){let Z=this.cachedRowCtrls?.getRow(Q)??null;if(Z)return Z;let $=J&&!this.printLayout&&!!this.beans.animationFrameSvc?.active;return new F5(Q,this.beans,z,$,this.printLayout)}getRenderedNodes(){let Q=Object.values(this.rowCtrlsByRowIndex).map((Z)=>Z.rowNode),z=this.getStickyTopRowCtrls().map((Z)=>Z.rowNode),J=this.getStickyBottomRowCtrls().map((Z)=>Z.rowNode);return[...z,...Q,...J]}getRowByPosition(Q){let z,{rowIndex:J}=Q;switch(Q.rowPinned){case"top":z=this.topRowCtrls[J];break;case"bottom":z=this.bottomRowCtrls[J];break;default:if(z=this.rowCtrlsByRowIndex[J],!z){if(z=this.getStickyTopRowCtrls().find((Z)=>Z.rowNode.rowIndex===J)||null,!z)z=this.getStickyBottomRowCtrls().find((Z)=>Z.rowNode.rowIndex===J)||null}break}return z}isRangeInRenderedViewport(Q,z){if(Q==null||z==null)return!1;let Z=Q>this.lastRenderedRow;return!(zthis.maxCount){let z=this.entriesList[0];z.destroyFirstPass(),z.destroySecondPass(),this.removeFromCache(z)}}getRow(Q){if(Q?.id==null)return null;let z=this.entriesMap[Q.id];if(!z)return null;return this.removeFromCache(z),z.setCached(!1),z.rowNode!=Q?null:z}has(Q){return this.entriesMap[Q.id]!=null}removeRow(Q){let z=Q.id,J=this.entriesMap[z];delete this.entriesMap[z],$0(this.entriesList,J)}removeFromCache(Q){let z=Q.rowNode.id;delete this.entriesMap[z],$0(this.entriesList,Q)}getEntries(){return this.entriesList}};function z8(Q){if(!Q)return;let z={top:{},bottom:{},normal:{}};for(let J of Q){let Z=J.id;switch(J.rowPinned){case"top":z.top[Z]=J;break;case"bottom":z.bottom[Z]=J;break;default:z.normal[Z]=J;break}}return z}function J8(Q,z){let J=Q.id;switch(Q.rowPinned){case"top":return z.top[J]!=null;case"bottom":return z.bottom[J]!=null;default:return z.normal[J]!=null}}var hE=class extends j{constructor(){super(...arguments);this.beanName="rowNodeSorter",this.accentedSort=!1,this.primaryColumnsSortGroups=!1,this.pivotActive=!1}postConstruct(){this.firstLeaf=o(this.gos)?pz:uE,this.addManagedPropertyListeners(["accentedSort","autoGroupColumnDef","treeData"],this.updateOptions.bind(this));let Q=this.updatePivotModeState.bind(this);this.addManagedEventListeners({columnPivotModeChanged:Q,columnPivotChanged:Q}),this.updateOptions(),Q()}updateOptions(){this.accentedSort=!!this.gos.get("accentedSort"),this.primaryColumnsSortGroups=WQ(this.gos)}updatePivotModeState(){this.pivotActive=this.beans.colModel.isPivotActive()}doFullSortInPlace(Q,z){return Q.sort((J,Z)=>this.compareRowNodes(z,J,Z))}compareRowNodes(Q,z,J){if(z===J)return 0;let Z=this.accentedSort;for(let $=0,X=Q.length;${if(Q.data)return Q;let z=Q.childrenAfterGroup;while(z?.length){let J=z[0];if(J.data)return J;z=J.childrenAfterGroup}},Z8=(Q)=>{if(!Q)return Q;if(typeof Q==="bigint")return Q<0n?-Q:Q;let z=Number(Q);return isNaN(z)?Q:Math.abs(z)};function mE(Q){Q.sortSvc?.onSortChanged("api")}var jz=(Q,z)=>({tag:"span",ref:`eSort${Q}`,cls:`ag-sort-indicator-icon ag-sort-${z} ag-hidden`,attrs:{"aria-hidden":"true"}}),cE={tag:"span",cls:"ag-sort-indicator-container",children:[jz("Order","order"),jz("Asc","ascending-icon"),jz("Desc","descending-icon"),jz("Mixed","mixed-icon"),jz("AbsoluteAsc","absolute-ascending-icon"),jz("AbsoluteDesc","absolute-descending-icon"),jz("None","none-icon")]},R6=class extends x{constructor(Q){super();if(this.eSortOrder=S,this.eSortAsc=S,this.eSortDesc=S,this.eSortMixed=S,this.eSortNone=S,this.eSortAbsoluteAsc=S,this.eSortAbsoluteDesc=S,!Q)this.setTemplate(cE)}attachCustomElements(Q,z,J,Z,$,X,Y){this.eSortOrder=Q,this.eSortAsc=z,this.eSortDesc=J,this.eSortMixed=Z,this.eSortNone=$,this.eSortAbsoluteAsc=X,this.eSortAbsoluteDesc=Y}setupSort(Q,z=!1,J){if(this.column=Q,this.suppressOrder=z,this.getSortDefOverride=J,this.setupMultiSortIndicator(),!Q.isSortable()&&!Q.getColDef().showRowGroup)return;this.addInIcon("sortAscending",this.eSortAsc,Q),this.addInIcon("sortDescending",this.eSortDesc,Q),this.addInIcon("sortUnSort",this.eSortNone,Q),this.addInIcon("sortAbsoluteAscending",this.eSortAbsoluteAsc,Q),this.addInIcon("sortAbsoluteDescending",this.eSortAbsoluteDesc,Q);let Z=this.updateIcons.bind(this),$=this.onSortChanged.bind(this);this.addManagedPropertyListener("unSortIcon",Z),this.addManagedEventListeners({newColumnsLoaded:Z,sortChanged:$,columnRowGroupChanged:$}),this.onSortChanged()}addInIcon(Q,z,J){if(z==null)return;let Z=h(Q,this.beans,J);if(Z)z.appendChild(Z)}onSortChanged(){if(this.updateIcons(),!this.suppressOrder)this.updateSortOrder()}updateIcons(){let{eSortAsc:Q,eSortDesc:z,eSortAbsoluteAsc:J,eSortAbsoluteDesc:Z,eSortNone:$,column:X,gos:Y,beans:G}=this,q=c5(X,G,this.getSortDefOverride),H=q.isDefaultSortAllowed,_=q.isAbsoluteSortAllowed,{isAbsoluteSort:U,isDefaultSort:W,isAscending:B,isDescending:E,direction:K}=q;if(Q)N(Q,B&&W&&H,{skipAriaHidden:!0});if(z)N(z,E&&W&&H,{skipAriaHidden:!0});if($){let L=!X.getColDef().unSortIcon&&!Y.get("unSortIcon");N($,!L&&!K,{skipAriaHidden:!0})}if(J)N(J,B&&U&&_,{skipAriaHidden:!0});if(Z)N(Z,E&&U&&_,{skipAriaHidden:!0})}setupMultiSortIndicator(){let{eSortMixed:Q,column:z,gos:J}=this;this.addInIcon("sortUnSort",Q,z);let Z=z.getColDef().showRowGroup;if(WQ(J)&&Z)this.addManagedEventListeners({sortChanged:this.updateMultiSortIndicator.bind(this),columnRowGroupChanged:this.updateMultiSortIndicator.bind(this)}),this.updateMultiSortIndicator()}updateMultiSortIndicator(){let{eSortMixed:Q,beans:z,column:J}=this;if(Q){let Z=z.sortSvc.getDisplaySortForColumn(J)?.direction==="mixed";N(Q,Z,{skipAriaHidden:!0})}}updateSortOrder(){let{eSortOrder:Q,column:z,beans:{sortSvc:J}}=this;if(!Q)return;let Z=J.getColumnsWithSortingOrdered(),$=J.getDisplaySortIndexForColumn(z)??-1,X=Z.some((G)=>J.getDisplaySortIndexForColumn(G)??!1),Y=$>=0&&X;if(N(Q,Y,{skipAriaHidden:!0}),$>=0)Q.textContent=($+1).toString();else z0(Q)}refresh(){this.onSortChanged()}},pE={selector:"AG-SORT-INDICATOR",component:R6},iE=class extends j{constructor(){super(...arguments);this.beanName="sortSvc"}progressSort(Q,z,J){let Z=this.getNextSortDirection(Q);this.setSortForColumn(Q,Z,z,J)}progressSortFromEvent(Q,z){let Z=this.gos.get("multiSortKey")==="ctrl"?z.ctrlKey||z.metaKey:z.shiftKey;this.progressSort(Q,Z,"uiColumnSorted")}setSortForColumn(Q,z,J,Z){let{gos:$,showRowGroupCols:X}=this.beans,Y=WQ($),G=[Q];if(Y){if(Q.getColDef().showRowGroup){let U=X?.getSourceColumnsForGroupColumn?.(Q)?.filter((W)=>W.isSortable());if(U)G=[Q,...U]}}for(let _ of G)this.setColSort(_,z,Z);let q=(J||$.get("alwaysMultiSort"))&&!$.get("suppressMultiSort"),H=[];if(!q){let _=this.clearSortBarTheseColumns(G,Z);H.push(..._)}this.updateSortIndex(Q),H.push(...G),this.dispatchSortChangedEvents(Z,H)}updateSortIndex(Q){let{gos:z,colModel:J,showRowGroupCols:Z}=this.beans,$=WQ(z),X=Z?.getShowRowGroupCol(Q.getId()),Y=$?X||Q:Q,G=this.getColumnsWithSortingOrdered();J.forAllCols((_)=>this.setColSortIndex(_,null));let q=G.filter((_)=>{if($&&_.getColDef().showRowGroup)return!1;return _!==Y});(Y.getSortDef()?[...q,Y]:q).forEach((_,U)=>this.setColSortIndex(_,U))}onSortChanged(Q,z){this.dispatchSortChangedEvents(Q,z)}isSortActive(){let Q=!1;return this.beans.colModel.forAllCols((z)=>{if(z.getSortDef())return Q=!0,!0}),Q}dispatchSortChangedEvents(Q,z){let J={type:"sortChanged",source:Q};if(z)J.columns=z;this.eventSvc.dispatchEvent(J)}clearSortBarTheseColumns(Q,z){let J=[];return this.beans.colModel.forAllCols((Z)=>{if(!Q.includes(Z)){if(Z.getSortDef())J.push(Z);this.setColSort(Z,void 0,z)}}),J}getNextSortDirection(Q,z){let J=Q.getSortingOrder(),Z=z===void 0?Q.getSortDef():a0(z),X=J.findIndex((Y)=>tJ(Y,Z))+1;if(X>=J.length)X=0;return a0(J[X])}getIndexedSortMap(){let{gos:Q,colModel:z,showRowGroupCols:J,rowGroupColsSvc:Z}=this.beans,$=[];if(z.forAllCols((H)=>{if(H.getSortDef())$.push(H)}),z.isPivotMode()){let H=WQ(Q);$=$.filter((_)=>{let U=!!_.getAggFunc(),W=!_.isPrimary(),B=H?J?.getShowRowGroupCol(_.getId()):_.getColDef().showRowGroup;return U||W||B})}let X=Z?.columns.filter((H)=>!!H.getSortDef())??[],Y={};$.forEach((H,_)=>Y[H.getId()]=_),$.sort((H,_)=>{let U=H.getSortIndex(),W=_.getSortIndex();if(U!=null&&W!=null)return U-W;else if(U==null&&W==null){let B=Y[H.getId()],E=Y[_.getId()];return B>E?1:-1}else if(W==null)return-1;else return 1});let G=WQ(Q)&&!!X.length;if(G)$=[...new Set($.map((H)=>J?.getShowRowGroupCol(H.getId())??H))];let q=new Map;if($.forEach((H,_)=>q.set(H,_)),G)for(let H of X){let _=J.getShowRowGroupCol(H.getId());q.set(H,q.get(_))}return q}getColumnsWithSortingOrdered(){return[...this.getIndexedSortMap().entries()].sort(([,Q],[,z])=>Q-z).map(([Q])=>Q)}collectSortItems(Q=!1){let z=[],J=this.getColumnsWithSortingOrdered();for(let Z of J){let $=Z.getSortDef()?.direction;if(!$)continue;let X=LQ(Z.getSortDef()?.type),Y={sort:$,type:X};if(Q)Y.colId=Z.getId();else Y.column=Z;z.push(Y)}return z}getSortModel(){return this.collectSortItems(!0)}getSortOptions(){return this.collectSortItems()}canColumnDisplayMixedSort(Q){let z=WQ(this.gos),J=!!Q.getColDef().showRowGroup;return z&&J}getDisplaySortForColumn(Q){let z=this.beans.showRowGroupCols?.getSourceColumnsForGroupColumn(Q);if(!this.canColumnDisplayMixedSort(Q)||!z?.length)return Q.getSortDef();let Z=Q.getColDef().field!=null||!!Q.getColDef().valueGetter?[Q,...z]:z,$=Z[0].getSortDef();if(!Z.every((Y)=>tJ(Y.getSortDef(),$)))return{type:LQ(Q.getSortDef()?.type),direction:"mixed"};return $}getDisplaySortIndexForColumn(Q){return this.getIndexedSortMap().get(Q)}setupHeader(Q,z){let J=()=>{let{type:Z,direction:$}=a0(z.getSortDef());if(Q.toggleCss("ag-header-cell-sorted-asc",$==="asc"),Q.toggleCss("ag-header-cell-sorted-desc",$==="desc"),Q.toggleCss("ag-header-cell-sorted-abs-asc",Z==="absolute"&&$==="asc"),Q.toggleCss("ag-header-cell-sorted-abs-desc",Z==="absolute"&&$==="desc"),Q.toggleCss("ag-header-cell-sorted-none",!$),z.getColDef().showRowGroup){let G=!this.beans.showRowGroupCols?.getSourceColumnsForGroupColumn(z)?.every((q)=>$==q.getSortDef()?.direction);Q.toggleCss("ag-header-cell-sorted-mixed",G)}};Q.addManagedEventListeners({sortChanged:J,columnPinned:J,columnRowGroupChanged:J,displayedColumnsChanged:J})}initCol(Q){let{sortIndex:z,initialSortIndex:J}=Q.colDef,Z=A9(Q.colDef);if(Z)Q.setSortDef(Z,!0);if(z!==void 0){if(z!==null)Q.sortIndex=z}else if(J!==null)Q.sortIndex=J}updateColSort(Q,z,J){if(z===void 0)return;this.setColSort(Q,a0(z),J)}setColSort(Q,z,J){if(!tJ(Q.getSortDef(),z))Q.setSortDef(a0(z),z===void 0),Q.dispatchColEvent("sortChanged",J);Q.dispatchStateUpdatedEvent("sort")}setColSortIndex(Q,z){Q.sortIndex=z,Q.dispatchStateUpdatedEvent("sortIndex")}createSortIndicator(Q){return new R6(Q)}getSortIndicatorSelector(){return pE}},r$={moduleName:"Sort",version:p,beans:[iE,hE],apiFunctions:{onSortChanged:mE},userComponents:{agSortIndicator:R6},icons:{sortAscending:"asc",sortDescending:"desc",sortUnSort:"none",sortAbsoluteAscending:"aasc",sortAbsoluteDescending:"adesc"}},nE=class extends j{constructor(){super(...arguments);this.beanName="syncSvc",this.waitingForColumns=!1}postConstruct(){this.addManagedPropertyListener("columnDefs",(Q)=>this.setColumnDefs(Q))}start(){this.beans.ctrlsSvc.whenReady(this,()=>{let Q=this.gos.get("columnDefs");if(Q)this.setColumnsAndData(Q);else this.waitingForColumns=!0;this.gridReady()})}setColumnsAndData(Q){let{colModel:z,rowModel:J}=this.beans;z.setColumnDefs(Q??[],"gridInitializing"),J.start()}gridReady(){let{eventSvc:Q,gos:z}=this;Q.dispatchEvent({type:"gridReady"}),d1(z,`initialised successfully, enterprise = ${z.isModuleRegistered("EnterpriseCore")}`)}setColumnDefs(Q){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(Q.source))}};var dE="paste",tE=class extends j{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=o5(this.beans),this.addManagedEventListeners({cellValueChanged:this.onCellValueChanged.bind(this)})}beginDeferred(){this.deferredDepth++}endDeferred(){if(this.deferredDepth===0)return;if(--this.deferredDepth>0)return;let Q=this.batchedPath,z=this.batchedNodes;if(this.batchedPath=null,this.batchedNodes=null,Q)this.csrm?.doAggregate(Q);let{rowRenderer:J}=this.beans;if(z)for(let Z of z)$8(J,Z);if(Q){let Z=Q.getSortedRows();for(let $=0,X=Z.length;${let{sibling:J,pinnedSibling:Z}=z;Q.refreshRowByNode(z),Q.refreshRowByNode(J),Q.refreshRowByNode(Z),Q.refreshRowByNode(J?.pinnedSibling),Q.refreshRowByNode(Z?.sibling)},rE=class extends j{constructor(){super(...arguments);this.beanName="expressionSvc",this.cache={}}evaluate(Q,z){if(typeof Q==="string")return this.evaluateExpression(Q,z);else e(15,{expression:Q})}evaluateExpression(Q,z){try{return this.createExpressionFunction(Q)(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(J){return e(16,{expression:Q,params:z,e:J}),null}}createExpressionFunction(Q){let z=this.cache;if(z[Q])return z[Q];let J=this.createFunctionBody(Q),Z=Function("x, ctx, oldValue, newValue, value, node, data, colDef, rowIndex, api, getValue, column, columnGroup",J);return z[Q]=Z,Z}createFunctionBody(Q){if(Q.includes("return"))return Q;else return"return "+Q+";"}};var sE={moduleName:"Expression",version:p,beans:[rE]},lE={moduleName:"ChangeDetection",version:p,beans:[tE]};var aE=class extends j{constructor(){super(...arguments);this.beanName="valueSvc",this.initialised=!1,this.isSsrm=!1}wireBeans(Q){this.expressionSvc=Q.expressionSvc,this.colModel=Q.colModel,this.valueCache=Q.valueCache,this.dataTypeSvc=Q.dataTypeSvc,this.editSvc=Q.editSvc,this.formulaDataSvc=Q.formulaDataSvc,this.rowGroupColsSvc=Q.rowGroupColsSvc}postConstruct(){if(!this.initialised)this.init()}init(){let{gos:Q,valueCache:z}=this;this.executeValueGetter=z?this.executeValueGetterWithValueCache.bind(this):this.executeValueGetterWithoutValueCache.bind(this),this.isSsrm=Hz(Q),this.cellExpressions=Q.get("enableCellExpressions"),this.isTreeData=Q.get("treeData"),this.initialised=!0;let J=(Z)=>this.callColumnCellValueChangedHandler(Z);this.eventSvc.addListener("cellValueChanged",J,!0),this.addDestroyFunc(()=>this.eventSvc.removeListener("cellValueChanged",J,!0)),this.addManagedPropertyListener("treeData",(Z)=>this.isTreeData=Z.currentValue)}getValueForDisplay(Q){let z=this.beans,J=Q.column,Z=Q.node,$=z.showRowGroupColValueSvc,X=!J&&Z.group,Y=J?.colDef.showRowGroup,G=!this.isTreeData||Z.footer;if($&&G&&(X||Y)){let W=$.getGroupValue(Z,J,this.displayIgnoresAggData(Z));if(W==null)return{value:null,valueFormatted:null};return{value:W.value,valueFormatted:Q.includeValueFormatted?$.formatAndPrefixGroupColValue(W,J,Q.exporting):null}}if(!J)return{value:Z.key,valueFormatted:null};let q=this.getValue(J,Z,Q.from,this.displayIgnoresAggData(Z)),H=q,_=z.formula;if(J.isAllowFormula()&&_?.isFormula(q))if(Q.useRawFormula)q=_.normaliseFormula(q,!0),H=_.resolveValue(J,Z);else q=_.resolveValue(J,Z),H=q;let U=Q.includeValueFormatted&&!(Q.exporting&&J.colDef.useValueFormatterForExport===!1);return{value:q,valueFormatted:U?this.formatValue(J,Z,H):null}}getValue(Q,z,J,Z=!1){if(!this.initialised)this.init();if(!z)return;let $=Q.colDef,X=z.group;if(!X){let q=$.pivotValueColumn;if(q)Q=q}let Y=this.editSvc?.getPendingEditValue(z,Q,J);if(Y!==void 0)return Y;let G=this.resolveValue(Q,z,Z,X);if(G===void 0){if(X){let q=$.showRowGroup;if(typeof q==="string"){let H=this.rowGroupColsSvc?.getColumnIndex(q);if(H!=null&&H>z.level)return null}}return}if(this.cellExpressions&&oJ(G)){let q=G.substring(1);G=this.executeValueGetter(q,z.data,Q,z)}return G}displayIgnoresAggData(Q){if(!Q.group||Q.footer||Q.level===-1)return!1;if(!Q.sibling||this.gos.get("groupSuppressBlankHeader"))return!1;if(Q.leafGroup&&this.colModel.isPivotMode())return!1;return!!Q.expanded}resolveValue(Q,z,J,Z){let{colDef:$,colId:X}=Q,Y=!Z&&this.formulaDataSvc;if(Y&&Y.hasDataSource()&&$.allowFormula===!0){let D=Y.getFormula({column:Q,rowNode:z});if(oJ(D))return D}let G=Z&&!J?z.aggData:void 0,q=this.isTreeData;if(q&&G?.[X]!==void 0)return G[X];let H=z.data,_=$.field,U=$.valueGetter;if(q){if(U)return this.executeValueGetter(U,H,Q,z);if(_&&H)return h1(H,_,Q.isFieldContainsDots())}let W=z.groupData;if(W&&X in W)return W[X];if(G?.[X]!==void 0)return G[X];let B=$.showRowGroup,E=typeof B!=="string"||!Z,K=this.isSsrm,L=K&&J&&!!$.aggFunc;if(U&&!L)return E?this.executeValueGetter(U,H,Q,z):void 0;if(K&&z.footer&&z.field&&(B===!0||B===z.field))return h1(H,z.field,Q.isFieldContainsDots());if(_&&H&&!L)return E?h1(H,_,Q.isFieldContainsDots()):void 0;return}parseValue(Q,z,J,Z){let $=Q.getColDef();if($.allowFormula&&this.beans.formula?.isFormula(J))return J;let X=$.valueParser;if(T(X)){let Y=y(this.gos,{node:z,data:z?.data,oldValue:Z,newValue:J,colDef:$,column:Q});if(typeof X==="function")return X(Y);return this.expressionSvc?.evaluate(X,Y)}return J}getDeleteValue(Q,z){if(T(Q.getColDef().valueParser))return this.parseValue(Q,z,"",this.getValueForDisplay({column:Q,node:z,from:"edit"}).value)??null;return null}formatValue(Q,z,J,Z,$=!0){let{expressionSvc:X}=this.beans,Y=null,G,q=Q.getColDef();if(Z)G=Z;else if($)G=q.valueFormatter;if(G){let H=z?z.data:null,_=y(this.gos,{value:J,node:z,data:H,colDef:q,column:Q});if(typeof G==="function")Y=G(_);else Y=X?X.evaluate(G,_):null}else if(q.refData)return q.refData[J]||"";if(Y==null&&Array.isArray(J))Y=J.join(", ");return Y}setValue(Q,z,J,Z){let $=z.getColDef();if(!Q.data&&this.canCreateRowNodeData(Q,$))Q.data={};if(!this.isSetValueSupported(z,Q,J,$))return!1;let X=this.getValue(z,Q,"data"),Y=y(this.gos,{node:Q,data:Q.data,oldValue:X,newValue:J,colDef:$,column:z}),G=!1;if(Q.data){let H=this.handleExternalFormulaChange({column:z,eventSource:Z,newValue:J,setterParams:Y,rowNode:Q});if(H!==null)return H;G=this.computeValueChange({column:z,rowNode:Q,newValue:J,params:Y,rowData:Q.data,valueSetter:$.valueSetter,field:$.field})??!0}let q=this.beans.changeDetectionSvc;q?.beginDeferred();try{if(Q.group){let H=this.beans.rowGroupingEditValueSvc?.setGroupDataValue(Q,z,J,X,Z,G||J!==X);if(H!==void 0){if(!G&&!H)return!1;return this.finishValueChange(Q,z,Y,Z,J)}}if(!G)return!1;return this.finishValueChange(Q,z,Y,Z)}finally{q?.endDeferred()}}canCreateRowNodeData(Q,z){if(!Q.group)return!0;if(z.groupRowValueSetter!=null||z.groupRowEditable!=null)return!1;if(z.pivotValueColumn)return!1;return!0}finishValueChange(Q,z,J,Z,$){Q.resetQuickFilterAggregateText(),this.valueCache?.onDataChanged();let X=$===void 0?this.getValue(z,Q,"data"):$;if(this.dispatchCellValueChangedEvent(Q,J,X,Z),Q.pinnedSibling)this.dispatchCellValueChangedEvent(Q.pinnedSibling,J,X,Z);return!0}isSetValueSupported(Q,z,J,Z){let{field:$,valueSetter:X}=Z,Y=this.beans.formula,G=Q.isAllowFormula()&&Y?.isFormula(J),q=!!this.formulaDataSvc?.hasDataSource();if(n($)&&n(X)&&!(q&&G)){if(z.group&&(Z.groupRowValueSetter||Z.groupRowEditable))return!0;return R(17),!1}if(this.dataTypeSvc&&!this.dataTypeSvc.checkType(Q,J))return R(135),!1;return!0}handleExternalFormulaChange(Q){let{column:z,rowNode:J,newValue:Z,eventSource:$,setterParams:X}=Q,Y=this.beans.formula,G=this.formulaDataSvc;if(!G?.hasDataSource()||!z.isAllowFormula())return null;let q=Y?.isFormula(Z),H=G.getFormula({column:z,rowNode:J});if(q){if(H===Z)return!1;G.setFormula({column:z,rowNode:J,formula:Z});let U=Y?.resolveValue(z,J),W=z.getColDef();if(T(W.valueSetter)||!n(W.field)){let B={...X,newValue:U};this.computeValueChange({column:z,rowNode:J,newValue:U,params:B,rowData:J.data,valueSetter:W.valueSetter,field:W.field})}return this.finishValueChange(J,z,X,$)}if(H!==void 0)G.setFormula({column:z,rowNode:J,formula:void 0});return null}computeValueChange(Q){let{valueSetter:z,params:J,rowData:Z,field:$,column:X,newValue:Y}=Q;if(T(z)){if(typeof z==="function")return z(J);return this.expressionSvc?.evaluate(z,J)}return!!Z&&this.setValueUsingField(Z,$,Y,X.isFieldContainsDots())}dispatchCellValueChangedEvent(Q,z,J,Z){this.eventSvc.dispatchEvent({type:"cellValueChanged",event:null,rowIndex:Q.rowIndex,rowPinned:Q.rowPinned,column:z.column,colDef:z.colDef,data:Q.data,node:Q,oldValue:z.oldValue,newValue:J,newRawValue:z.newValue,value:J,source:Z})}callColumnCellValueChangedHandler(Q){let z=Q.colDef.onCellValueChanged;if(typeof z==="function")this.beans.frameworkOverrides.wrapOutgoing(()=>{z(Q)})}setValueUsingField(Q,z,J,Z){if(!z)return!1;let $=!1;if(!Z){if($=Q[z]===J,!$)Q[z]=J}else{let X=z.split("."),Y=Q;while(X.length>0&&Y){let G=X.shift();if(X.length===0){if($=Y[G]===J,!$)Y[G]=J}else Y=Y[G]}}return!$}executeValueGetterWithValueCache(Q,z,J,Z){let $=J.getColId(),X=this.valueCache.getValue(Z,$);if(X!==void 0)return X;let Y=this.executeValueGetterWithoutValueCache(Q,z,J,Z);return this.valueCache.setValue(Z,$,Y),Y}executeValueGetterWithoutValueCache(Q,z,J,Z){let $=y(this.gos,{data:z,node:Z,column:J,colDef:J.getColDef(),getValue:(Y)=>this.getValueCallback(Z,Y)}),X;if(typeof Q==="function")X=Q($);else X=this.expressionSvc?.evaluate(Q,$);return X}getValueCallback(Q,z){let J=this.colModel.getColDefCol(z);if(J)return this.getValue(J,Q,"data");return null}getKeyForNode(Q,z){let J=this.getValue(Q,z,"data"),Z=Q.getColDef().keyCreator,$=J;if(Z){let X=y(this.gos,{value:J,colDef:Q.getColDef(),column:Q,node:z,data:z.data});$=Z(X)}if(typeof $==="string"||$==null)return $;if($=String($),$==="[object Object]")R(121);return $}},oE={moduleName:"CommunityCore",version:p,beans:[hB,S_,KW,Wq,xE,IU,bB,Y3,wU,XE,$E,NE,aE,NB,IB,gB,FW,nE,qW,HW,D3],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:O_,destroy:P_,isDestroyed:T_,getGridOption:v_,setGridOption:I_,updateGridOptions:q$,isModuleRegistered:C_},dependsOn:[YW,FJ,LU,r$,E3,E6,K3,yE,lE,F3,iz,HE,WE,V3,WW,GW,sE,tU,KE]};function D5(Q){let{inputValue:z,allSuggestions:J,hideIrrelevant:Z,filterByPercentageOfBestMatch:$}=Q,X=(J??[]).map((q,H)=>({value:q,relevance:eE(z,q),idx:H}));if(X.sort((q,H)=>q.relevance-H.relevance),Z)X=X.filter((q)=>q.relevance0&&$&&$>0){let H=X[0].relevance*$;X=X.filter((_)=>H-_.relevance<0)}let Y=[],G=[];for(let q of X)Y.push(q.value),G.push(q.idx);return{values:Y,indices:G}}function eE(Q,z){let J=Q.length,Z=z.length;if(Z===0)return J?J:0;let $=Q.toLocaleLowerCase(),X=z.toLocaleLowerCase(),Y;if(Q.length1&&E>1){let F=Q[U-2],D=$[U-2],M=z[E-2],k=X[E-2];if(D===k){if(H++,F===M)H++}}if(U<_)H++;q[E]=G[E-1]}Y=G,G=q,q=Y}return G[Z]/(H+1)}var s$={AdvancedFilter:1,AiToolkit:1,AllEnterprise:1,BatchEdit:1,CellSelection:1,Clipboard:1,ColumnMenu:1,ColumnsToolPanel:1,ContextMenu:1,ExcelExport:1,FiltersToolPanel:1,Find:1,GridCharts:1,IntegratedCharts:1,GroupFilter:1,MasterDetail:1,Menu:1,MultiFilter:1,NewFiltersToolPanel:1,Pivot:1,RangeSelection:1,RichSelect:1,RowNumbers:1,RowGrouping:1,RowGroupingEdit:1,RowGroupingPanel:1,ServerSideRowModelApi:1,ServerSideRowModel:1,SetFilter:1,SideBar:1,Sparklines:1,StatusBar:1,TreeData:1,ViewportRowModel:1,Formula:1},r2=["TextFilter","NumberFilter","BigIntFilter","DateFilter","SetFilter","MultiFilter","GroupFilter","CustomFilter"],QK={EditCore:["TextEditor","NumberEditor","DateEditor","CheckboxEditor","LargeTextEditor","SelectEditor","RichSelect","CustomEditor"],CheckboxCellRenderer:["AllCommunity"],ClientSideRowModelHierarchy:["RowGrouping","Pivot","TreeData"],ColumnFilter:r2,ColumnGroupHeaderComp:["AllCommunity"],ColumnGroup:["AllCommunity"],ColumnHeaderComp:["AllCommunity"],ColumnMove:["AllCommunity"],ColumnResize:["AllCommunity"],CommunityCore:["AllCommunity"],CsrmSsrmSharedApi:["ClientSideRowModelApi","ServerSideRowModelApi"],RowModelSharedApi:["ClientSideRowModelApi","ServerSideRowModelApi"],EnterpriseCore:["AllEnterprise"],FilterCore:[...r2,"QuickFilter","ExternalFilter","AdvancedFilter"],GroupCellRenderer:["RowGrouping","Pivot","TreeData","MasterDetail","ServerSideRowModel"],KeyboardNavigation:["AllCommunity"],LoadingCellRenderer:["ServerSideRowModel"],MenuCore:["ColumnMenu","ContextMenu"],MenuItem:["ColumnMenu","ContextMenu","MultiFilter","IntegratedCharts","ColumnsToolPanel"],Overlay:["AllCommunity"],PinnedColumn:["AllCommunity"],SharedAggregation:["RowGrouping","Pivot","TreeData","ServerSideRowModel"],SharedDragAndDrop:["AllCommunity"],SharedMasterDetail:["MasterDetail","ServerSideRowModel"],SharedMenu:[...r2,"ColumnMenu","ContextMenu"],SharedPivot:["Pivot","ServerSideRowModel"],SharedRowGrouping:["RowGrouping","ServerSideRowModel"],SharedRowSelection:["RowSelection","ServerSideRowModel"],SkeletonCellRenderer:["ServerSideRowModel"],Sort:["AllCommunity"],SsrmInfiniteSharedApi:["InfiniteRowModel","ServerSideRowModelApi"],SharedTreeData:["TreeData","ServerSideRowModel"]},zK={InfiniteRowModel:"infinite",ClientSideRowModelApi:"clientSide",ClientSideRowModel:"clientSide",ServerSideRowModelApi:"serverSide",ServerSideRowModel:"serverSide",ViewportRowModel:"viewport"};function JK(Q,z){let J=[];for(let Z of Array.isArray(Q)?Q:[Q]){let $=QK[Z];if($)for(let X of $){let Y=zK[X];if(!Y||Y===z)J.push(X)}else J.push(Z)}return J}var l$=()=>`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=(Q)=>{let z=Q.map((Z)=>`import { ${m1(Z)} } from '${s$[Z]?"ag-grid-enterprise":"ag-grid-community"}';`);if(Q.some((Z)=>Z==="IntegratedCharts"||Z==="Sparklines"))z.push("import { AgChartsEnterpriseModule } from 'ag-charts-enterprise';");return`import { ModuleRegistry } from 'ag-grid-community'; -${z.join(` -`)} - -ModuleRegistry.registerModules([ ${Q.map((Z)=>m1(Z,!0)).join(", ")} ]); - -For more info see: ${H1}/modules/`};function m1(Q,z=!1){if(z&&(Q==="IntegratedCharts"||Q==="Sparklines"))return`${Q}Module.with(AgChartsEnterpriseModule)`;return`${Q}Module`}function $K(Q,z){let J=z.filter((X)=>X==="IntegratedCharts"||X==="Sparklines"),Z="";if(!globalThis?.agCharts&&J.length>0)Z=`Unable to use ${Q} as either the ag-charts-community or ag-charts-enterprise script needs to be included alongside ag-grid-enterprise. -`;else if(z.some((X)=>s$[X]))Z=Z+`Unable to use ${Q} as that requires the ag-grid-enterprise script to be included. -`;return Z}function a$({moduleName:Q,rowModelType:z}){return`To use the ${Q}Module you must set the gridOption "rowModelType='${z}'"`}var X8=({reasonOrId:Q,moduleName:z,gridScoped:J,gridId:Z,rowModelType:$,additionalText:X,isUmd:Y})=>{let G=JK(z,$),q=typeof Q==="string"?Q:qK[Q];if(Y)return $K(q,G);let H=G.filter((W)=>W==="IntegratedCharts"||W==="Sparklines"),_=H.length>0?`${H.map((W)=>m1(W)).join()} must be initialised with an AG Charts module. One of 'AgChartsCommunityModule' / 'AgChartsEnterpriseModule'.`:"";return`${`Unable to use ${q} as ${G.length>1?"one of "+G.map((W)=>m1(W)).join(", "):m1(G[0])} is not registered${J?" for gridId: "+Z:""}. ${_} Check if you have registered the module: -`} -${ZK(G)}`+(X?` - -${X}`:"")},Y8=(Q)=>{return`${Q} 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 { ${Q} } from 'ag-grid-enterprise'; - -ModuleRegistry.registerModules([${Q}.with(AgChartsEnterpriseModule)]); - `},XK=(Q)=>`AG Grid: Unable to use the Clipboard API (navigator.clipboard.${Q}()). 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.`,YK={1:()=>"`rowData` must be an array",2:({nodeId:Q})=>`Duplicate node id '${Q}' 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:Q})=>`Could not find row id=${Q}, data item was not found for this id`,5:({data:Q})=>["Could not find data item as object was not found.",Q," 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:Q})=>`Unknown key for navigation ${Q}`,9:({variable:Q})=>`No value for ${Q?.cssName}. This usually means that the grid has been initialised before styles have been loaded. The default value of ${Q?.defaultValue} will be used and updated when styles load.`,10:({eventType:Q})=>`As of v33, the '${Q}' event is deprecated. Use the global 'modelUpdated' event to determine when row children have changed.`,11:()=>"No gridOptions provided to createGrid",12:({colKey:Q})=>["column ",Q," 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:Q})=>`Row IDs cannot start with ${Q}, this is a reserved prefix for AG Grid's row grouping feature.`,15:({expression:Q})=>["value should be either a string or a function",Q],16:({expression:Q,params:z,e:J})=>["Processing of the expression failed","Expression = ",Q,"Params = ",z,"Exception = ",J],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:Q})=>`${Q} 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:Q})=>["The getRowId callback must return a string. The ID ",Q," is being cast to a string."],26:({fnName:Q,preDestroyLink:z})=>{return`Grid API function ${Q}() 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:Q,module:z})=>`API function '${Q}' 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:Q})=>["tried to insert columns in invalid location, toIndex = ",Q,"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:Q})=>`the column type '${Q}' 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:Q})=>"colDef.type '"+Q+"' does not correspond to defined gridOptions.columnTypes",37:()=>"Changing the column pinning status is not allowed with domLayout='print'",38:({iconName:Q})=>`provided icon '${Q}' 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:Q,method:z})=>`${Q} -${XK(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:Q})=>`As of v33, icon '${Q}' is deprecated. Use the icon CSS name instead.`,44:()=>'Data type definition hierarchies (via the "extendsDataType" property) cannot contain circular references.',45:({parentCellDataType:Q})=>`The data type definition ${Q} does not exist.`,46:()=>'The "baseDataType" property of a data type definition must match that of its parent.',47:({cellDataType:Q})=>`Missing data type definition - "${Q}"`,48:({property:Q,inferred:z,colId:J})=>{let Z=z?" (inferred)":"",$=J?` for column "${J}"`:"";return`Cell data type is "object"${Z} but no Value ${Q} has been provided${$}. Please either provide an object data type definition with a Value ${Q}, or set: - - "colDef.value${Q}"${z&&Q==="Parser"?` - - "colDef.cellDataType = 'object'"`:""}`},49:({methodName:Q})=>`Framework component is missing the method ${Q}()`,50:({compName:Q})=>`Could not find component ${Q}, 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:Q})=>`setFilterModel() - no column found for colId: ${Q}`,63:({colId:Q})=>`setFilterModel() - unable to fully apply model, filtering disabled for colId: ${Q}`,64:({colId:Q})=>`setFilterModel() - unable to fully apply model, unable to create filter for colId: ${Q}`,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:Q})=>`getGui method from filter returned ${Q}; it should be a DOM element.`,70:({newFilter:Q})=>`Grid option quickFilterText only supports string inputs, received: ${typeof Q}`,71:()=>"debounceMs is ignored when apply button is present",72:({keys:Q})=>["ignoring FilterOptionDef as it doesn't contain one of ",Q],73:()=>"invalid FilterOptionDef supplied as it doesn't contain a 'displayKey'",74:()=>"no filter options for filter",75:()=>"Unknown button type specified",76:({filterModelType:Q})=>['Unexpected type of filter "',Q,'", 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:Q})=>`DateFilter ${Q} 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:Q})=>`Invalid row index for ensureIndexVisible: ${Q}`,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:Q,pageSizeSet:z,pageSizesSet:J,pageSizeOptions:Z})=>`'paginationPageSize=${Q}'${z?"":" (default value)"}, but ${Q} is not included in${J?"":" the default"} paginationPageSizeSelector=[${Z?.join(", ")}].`,95:({paginationPageSizeOption:Q,paginationPageSizeSelector:z})=>`Either set '${z}' to an array that includes ${Q} or to 'false' to disable the page size selector.`,96:({id:Q,data:z})=>["Duplicate ID",Q,"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:Q})=>`cellEditor for column ${Q} 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:Q,componentName:z,agGridDefaults:J,jsComps:Z})=>{let $=[],X=[...Object.keys(J??[]).filter((G)=>!["agCellEditor","agGroupRowRenderer","agSortIndicator"].includes(G)),...Object.keys(Z??[]).filter((G)=>!!Z[G])],Y=D5({inputValue:z,allSuggestions:X,hideIrrelevant:!0,filterByPercentageOfBestMatch:0.8}).values;if($.push(`Could not find '${z}' component. It was configured as "${Q}: '${z}'" but it wasn't found in the list of registered components. -`),Y.length>0)$.push(` Did you mean: [${Y.slice(0,3)}]? -`);return $.push("If using a custom component check it has been registered correctly."),$},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:Q,param:z})=>`Numeric value ${Q} passed to ${z} param will be interpreted as ${Q} seconds. If this is intentional use "${Q}s" to silence this warning.`,105:({e:Q})=>["chart rendering failed",Q],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: ${H1}/theming-migration/`,107:({key:Q,value:z})=>`Invalid value for theme param ${Q} - ${z}`,108:({e:Q})=>["chart update failed",Q],109:({inputValue:Q,allSuggestions:z})=>{let J=D5({inputValue:Q,allSuggestions:z,hideIrrelevant:!0,filterByPercentageOfBestMatch:0.8}).values;return[`Could not find '${Q}' aggregate function. It was configured as "aggFunc: '${Q}'" but it wasn't found in the list of registered aggregations.`,J.length>0?` Did you mean: [${J.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:Q})=>`Could not find component with name of ${Q}. 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:Q})=>`Unable to update chart. No active chart found with ID: ${Q}.`,126:()=>"unable to restore chart as no chart model is provided",127:({allRange:Q})=>`unable to create chart as ${Q?"there are no columns in the grid":"no range is selected"}.`,128:({feature:Q})=>`${Q} is only available if using 'multiRow' selection mode.`,129:({feature:Q,rowModel:z})=>`${Q} 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:Q})=>`icon '${Q}' function should return back a string or a dom object`,134:({iconName:Q})=>`Did not find icon '${Q}'`,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:Q,currentChartType:z})=>`Unable to update chart as a '${Q}' update type is not permitted on a ${z}.`,138:({chartType:Q})=>`invalid chart type supplied: ${Q}`,139:({customThemeName:Q})=>`a custom chart theme with the name ${Q} has been supplied but not added to the 'chartThemes' list`,140:({name:Q})=>`no stock theme exists with the name '${Q}' 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:Q})=>`'${Q}' is not a valid Chart Tool Panel name`,144:({type:Q})=>`Invalid charts data panel group name supplied: '${Q}'`,145:({group:Q})=>`As of v32, only one charts customize panel group can be expanded at a time. '${Q}' will not be expanded.`,146:({comp:Q})=>`Unable to instantiate component '${Q}' as its module hasn't been loaded. Add 'ValidationModule' to see which module is required.`,147:({group:Q})=>`Invalid charts customize panel group name supplied: '${Q}'`,148:({group:Q})=>`invalid chartGroupsDef config '${Q}'`,149:({group:Q,chartType:z})=>`invalid chartGroupsDef config '${Q}.${z}'`,150:()=>"'seriesChartTypes' are required when the 'customCombo' chart type is specified.",151:({chartType:Q})=>`invalid chartType '${Q}' supplied in 'seriesChartTypes', converting to 'line' instead.`,152:({colId:Q})=>`no 'seriesChartType' found for colId = '${Q}', defaulting to 'line'.`,153:({chartDataType:Q})=>`unexpected chartDataType value '${Q}' supplied, instead use 'category', 'series' or 'excluded'`,154:({colId:Q})=>`cross filtering requires a 'agSetColumnFilter' or 'agMultiColumnFilter' to be defined on the column with id: ${Q}`,155:({option:Q})=>`'${Q}' is not a valid Chart Toolbar Option`,156:({panel:Q})=>`Invalid panel in chartToolPanelsDef.panels: '${Q}'`,157:({unrecognisedGroupIds:Q})=>["unable to find group(s) for supplied groupIds:",Q],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:Q,dataType:z})=>`Unrecognized data type for excel export [${Q}.dataType=${z}]`,163:({featureName:Q})=>`Excel table export does not work with ${Q}. The exported Excel file will not contain any Excel tables. - Please turn off ${Q} 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:Q})=>["unable to find groups for these supplied groupIds:",Q],167:({unrecognisedColIds:Q})=>["unable to find columns for these supplied colIds:",Q],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:Q})=>`invalid cellRendererParams.refreshStrategy = ${Q} 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:Q})=>`invalid chartGroupsDef config '${Q}'`,174:({group:Q,chartType:z})=>`invalid chartGroupsDef config '${Q}.${z}'`,175:({menuTabName:Q,itemsToConsider:z})=>[`Trying to render an invalid menu item '${Q}'. Check that your 'menuTabs' contains one of `,z],176:({key:Q})=>`unknown menu item type ${Q}`,177:()=>"valid values for cellSelection.handle.direction are 'x', 'y' and 'xy'. Default to 'xy'.",178:({colId:Q})=>`column ${Q} 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:Q,childNodeData:z})=>["duplicate group keys for row data, keys should be unique",[Q,z]],185:({data:Q})=>["getDataPath() should not return an empty path",[Q]],186:({rowId:Q,rowData:z,duplicateRowsData:J})=>["duplicate group keys for row data, keys should be unique",Q,z,...J??[]],187:({rowId:Q,firstData:z,secondData:J})=>[`Duplicate node id ${Q}. 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",J],188:(Q)=>`getRowId callback must be provided for Server Side Row Model ${Q?.feature||"selection"} to work correctly.`,189:({startRow:Q})=>`invalid value ${Q} for startRow, the value should be >= 0`,190:({rowGroupId:Q,data:z})=>["null and undefined values are not allowed for server side row model keys",Q?`column = ${Q}`:"","data is ",z],194:({method:Q})=>`calling gridApi.${Q}() is only possible when using rowModelType=\`clientSide\`.`,195:({justCurrentPage:Q})=>`selecting just ${Q?"current page":"filtered"} only works when gridOptions.rowModelType='clientSide'`,196:({key:Q})=>`Provided ids must be of string type. Invalid id provided: ${Q}`,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:X8,201:({rowModelType:Q})=>`Could not find row model for rowModelType = ${Q}`,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:Q})=>`Unable to display rows as duplicate row ids (${Q}) 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 ${H1}/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:Q})=>`unable to lookup Tool Panel as invalid key supplied: ${Q}`,215:({key:Q,defaultByKey:z})=>`the key ${Q} is not a valid key for specifying a tool panel, valid keys are: ${Object.keys(z??{}).join(",")}`,216:({name:Q})=>`Missing component for '${Q}'`,217:({invalidColIds:Q})=>["unable to find grid columns for the supplied colDef(s):",Q],218:({property:Q,defaultOffset:z})=>`${Q} must be a number, the value you provided is not a valid number. Using the default of ${z}px.`,219:({property:Q})=>`Property ${Q} does not exist on the target object.`,220:({lineDash:Q})=>`'${Q}' 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:Q})=>`unrecognised menu item ${Q}`,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:Q})=>`Framework component is missing the method ${Q}()`,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:Q})=>`theme grid option must be a Theming API theme object or the string "legacy", received: ${Q}`,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:Q})=>`AG Grid: Unable to create chart as an invalid chartType = '${Q}' 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:Q})=>["Illegal version string: ",Q],254:()=>"Cannot create chart: no chart themes available.",255:({point:Q})=>`Lone surrogate U+${Q?.toString(16).toUpperCase()} is not a scalar value`,256:()=>"Unable to initialise. See validation error, or load ValidationModule if missing.",257:()=>Y8("IntegratedChartsModule"),258:()=>Y8("SparklinesModule"),259:({part:Q})=>`the argument to theme.withPart must be a Theming API part object, received: ${Q}`,260:({propName:Q,compName:z,gridScoped:J,gridId:Z,rowModelType:$})=>X8({reasonOrId:`AG Grid '${Q}' component: ${z}`,moduleName:B1[z],gridId:Z,gridScoped:J,rowModelType:$}),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:Q})=>`Unable to infer chart data type for column '${Q}' if first data entry is null. Please specify "chartDataType", or a "cellDataType" in the column definition. For more information, see ${H1}/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:Q,parentId:z})=>`Cycle detected for row with id='${Q}' and parent id='${z}'. Resetting the parent for row with id='${Q}' and showing it as a root-level node.`,271:({id:Q,parentId:z})=>`Parent row not found for row with id='${Q}' and parent id='${z}'. Showing row with id='${Q}' as a root-level node.`,272:()=>l$(),273:({providedId:Q,usedId:z})=>`Provided column id '${Q}' was already in use, ensure all column and group ids are unique. Using '${z}' instead.`,274:({prop:Q})=>{let z=`Since v33, ${Q} has been deprecated.`;switch(Q){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:a$,276:()=>"Row Numbers Row Resizer cannot be used when Grid Columns have `autoHeight` enabled.",277:({colId:Q})=>`'enableFilterHandlers' is set to true, but column '${Q}' does not have 'filter.doesFilterPass' or 'filter.handler' set.`,278:({colId:Q})=>`Unable to create filter handler for column '${Q}'`,279:(Q)=>{},280:({colId:Q})=>`'name' must be provided for custom filter components for column '${Q}`,281:({colId:Q})=>`Filter for column '${Q}' 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:Q})=>`Row Model '${Q}' is not supported with Batch Editing`,290:({rowIndex:Q,rowPinned:z})=>`Row with index '${Q}' 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:Q})=>`The Multi Filter for column '${Q}' 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:Q})=>`colDef.allowFormula is not supported with ${Q}. 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 GK(Q,z){let J=YK[Q];if(!J)return[`Missing error text for error id ${Q}!`];let Z=J(z),X=` -See ${z9(Q,z)}`;return Array.isArray(Z)?Z.concat(X):[Z,X]}var qK={1:"Charting Aggregation",2:"pivotResultFields",3:"setTooltip"},HK=class{constructor(Q="javascript"){this.frameworkName=Q,this.renderingEngine="vanilla",this.batchFrameworkComps=!1,this.wrapIncoming=(z)=>z(),this.wrapOutgoing=(z)=>z(),this.baseDocLink=`${d8}/${this.frameworkName}-data-grid`,TG(this.baseDocLink)}frameworkComponent(Q){return null}isFrameworkComponent(Q){return!1}getDocLink(Q){return this.baseDocLink+(Q?"/"+Q:"")}},G8=new WeakMap,q8=new WeakMap;function MJ(Q,z,J){if(!z)return e(11),{};let Z=J,$;if(!Z?.setThemeOnGridDiv){let Y=Z0({tag:"div"});Y.style.height="100%",Q.appendChild(Y),Q=Y,$=()=>Q.remove()}return new UK().create(Q,z,(Y)=>{let G=new j_(Q);Y.createBean(G)},void 0,J,$)}var _K=1,UK=class{create(Q,z,J,Z,$,X){let Y=y5.applyGlobalGridOptions(z),G=Y.gridId??String(_K++),q=this.getRegisteredModules($,G,Y.rowModelType),H=this.createBeansList(Y.rowModelType,q,G),_=this.createProvidedBeans(Q,Y,$);if(!H)return;let B=new JH({providedBeanInstances:_,beanClasses:H,id:G,beanInitComparator:XH,beanDestroyComparator:YH,derivedBeans:[ZH],destroyCallback:()=>{q8.delete(E),G8.delete(Q),jG(G),X?.()}});this.registerModuleFeatures(B,q),J(B),B.getBean("syncSvc").start(),Z?.(B);let E=B.getBean("gridApi");return G8.set(Q,E),q8.set(E,Q),E}getRegisteredModules(Q,z,J){return t1(oE,void 0,!0),Q?.modules?.forEach((Z)=>t1(Z,z)),RG(z,H8(J))}registerModuleFeatures(Q,z){let J=Q.getBean("registry"),Z=Q.getBean("apiFunctionSvc");for(let $ of z){J.registerModule($);let X=$.apiFunctions;if(X){let Y=Object.keys(X);for(let G of Y)Z?.addFunction(G,X[G])}}}createProvidedBeans(Q,z,J){let Z=J?J.frameworkOverrides:null;if(n(Z))Z=new HK;let $={gridOptions:z,eGridDiv:Q,eRootDiv:Q,globalListener:J?J.globalListener:null,globalSyncListener:J?J.globalSyncListener:null,frameworkOverrides:Z,withinStudio:J?.withinStudio};if(J?.providedBeanInstances)Object.assign($,J.providedBeanInstances);return $}createBeansList(Q,z,J){let Z={clientSide:"ClientSideRowModel",infinite:"InfiniteRowModel",serverSide:"ServerSideRowModel",viewport:"ViewportRowModel"},$=H8(Q),X=Z[$];if(!X){y1(201,{rowModelType:$},`Unknown rowModelType ${$}.`);return}if(!OG()){y1(272,void 0,l$());return}if(!Q){let G=Object.entries(Z).filter(([q,H])=>Q5(H,J,q));if(G.length==1){let[q,H]=G[0];if(q!==$){let _={moduleName:H,rowModelType:q};y1(275,_,a$(_));return}}}if(!Q5(X,J,$)){let G=w5(),q=`rowModelType = '${$}'`,H=G?`Unable to use ${q} as that requires the ag-grid-enterprise script to be included. -`:`Missing module ${X}Module for rowModelType ${$}.`;y1(200,{reasonOrId:q,moduleName:X,gridScoped:x5(),gridId:J,rowModelType:$,isUmd:G},H);return}let Y=new Set;for(let G of z)for(let q of G.beans??[])Y.add(q);return Array.from(Y)}};function H8(Q){return Q??"clientSide"}function WK(Q,z,J="auto"){Q.frameworkOverrides.wrapIncoming(()=>Q.ctrlsSvc.getScrollFeature().ensureColumnVisible(z,J),"ensureVisible")}function BK(Q,z,J){Q.frameworkOverrides.wrapIncoming(()=>Q.ctrlsSvc.getScrollFeature().ensureIndexVisible(z,J),"ensureVisible")}var o$=(Q,z)=>{for(let J=0,Z=Q.length;J{if(J!=null){let X=J.getSortedRows();for(let Y=0,G=X.length;Y{let H=G.level+1;for(let _=0,U=q.length;_{if(!U&&U!==void 0){let M=F.sourceRowIndex;U=M<=W,W=M}if(F.data!==D){if(F.updateData(D),!Y.has(F))G.add(F);if(!F.selectable&&F.isSelected())H.push(F)}},K=(F,D,M)=>{for(let k=0,f=D.length;k0;if(L){let F=J._leafs??(J._leafs=[]);if(U===void 0)MK(F,q,X);else if(DK(F,q))X.reordered=!0}if(L||B||G.size)Q.rowDataUpdated=!0,this.deselect(H)}deleteUnusedNodes(Q,{removals:z},J,Z){let $=this.rootNode._leafs;for(let X=0,Y=$.length;X0}updateRowData(Q,z,J){if(this.dispatchRowDataUpdateStarted(Q.add),this.beans.groupStage?.getNestedDataGetter())return R(268),{remove:[],update:[],add:[]};let Z=[],$=Z5(this.gos),X=this.executeRemove($,Q,z,Z,J),Y=this.executeUpdate($,Q,z,Z),G=this.executeAdd(Q,z);return this.deselect(Z),{remove:X,update:Y,add:G}}executeRemove(Q,{remove:z},{adds:J,updates:Z,removals:$},X,Y){let G=this.rootNode._leafs,q=G?.length,H=z?.length;if(!H||!q)return[];let _=0,U=q,W=0,B=Array(H);for(let E=0;EW)W=L;if(B[_++]=K,!this.destroyNode(K,Y))continue;if(K.isSelected())X.push(K);if(!J.delete(K))Z.delete(K),$.push(K)}if(B.length=_,_)FK(G,U,W);return B}executeUpdate(Q,{update:z},{adds:J,updates:Z},$){let X=z?.length;if(!X)return[];let Y=Array(X),G=0;for(let q=0;q=q;--U){let B=Z[U];B.sourceRowIndex=W,Z[W--]=B}z.reordered=!0}Z.length=G;let H=Array(Y),_=z.adds;for(let U=0;U=J||Number.isNaN(z))return J;z=Math.ceil(z);let Z=this.gos;if(z>0&&Z.get("treeData")&&Z.get("getDataPath"))z=KK(Q,z);return z}},KK=(Q,z)=>{for(let J=0,Z=Q.length;J{if(Q.group=!0,Q.level=-1,Q._expanded=!0,Q.id="ROOT_NODE_ID",Q._leafs?.length!==0)Q._leafs=[];let z=[],J=[],Z=[],$=[];Q.childrenAfterGroup=z,Q.childrenAfterSort=J,Q.childrenAfterAggFilter=Z,Q.childrenAfterFilter=$;let X=Q.sibling;if(X)X.childrenAfterGroup=z,X.childrenAfterSort=J,X.childrenAfterAggFilter=Z,X.childrenAfterFilter=$,X.childrenMapped=Q.childrenMapped;return Q.updateHasChildren(),Q},LK=(Q,z)=>{if(Q)for(let J=0,Z=Q.length;J{z=Math.max(0,z);for(let Z=z,$=Q.length;Z<$;++Z){let X=Q[Z];if(Z<=J&&X.destroyed)continue;X.sourceRowIndex=z,Q[z++]=X}Q.length=z},DK=(Q,z)=>{let J=z.size;Q.length=J;let Z=0,$=!1,X=!1;for(let Y of z){let G=Y.sourceRowIndex;if(G===Z)X||(X=$);else{if(G>=0)X=!0;else $=!0;Y.sourceRowIndex=Z,Q[Z]=Y}++Z}return X},MK=(Q,z,{adds:J})=>{let Z=Q.length,$=z.size;if($>Z)Q.length=$;let X=0;for(let Y=0;Y{if(Z.hasChildren())if(Q&&!$)Z.childrenAfterFilter=Z.childrenAfterGroup.filter((X)=>{let Y=X.childrenAfterFilter&&X.childrenAfterFilter.length>0,G=X.data&&this.filterManager.doesRowPassFilter({rowNode:X});return Y||G});else Z.childrenAfterFilter=Z.childrenAfterGroup;else Z.childrenAfterFilter=Z.childrenAfterGroup;M5(Z)};if(this.doingTreeDataFiltering()){let Z=($,X)=>{if($.childrenAfterGroup)for(let Y=0;Y<$.childrenAfterGroup.length;Y++){let G=$.childrenAfterGroup[Y],q=X||this.filterManager.doesRowPassFilter({rowNode:G});if(G.childrenAfterGroup)Z($.childrenAfterGroup[Y],q);else J(G,q)}J($,X)};Z(this.beans.rowModel.rootNode,!1)}else{let Z=($)=>J($,!1);A0(this.beans.rowModel.rootNode,this.beans.rowModel.hierarchical,z,Z)}}softFilter(Q,z){let J=($)=>{if($.childrenAfterFilter=$.childrenAfterGroup,$.hasChildren())for(let X of $.childrenAfterGroup)X.softFiltered=Q&&!(X.data&&this.filterManager.doesRowPassFilter({rowNode:X}));M5($)},Z=this.beans.rowModel;A0(Z.rootNode,Z.hierarchical,z,J)}doingTreeDataFiltering(){let{gos:Q}=this;return!!this.beans.groupStage?.treeData&&!Q.get("excludeChildrenWhenTreeDataFiltering")}},VK=4,fK=(Q,z,J,Z,$)=>{let{childrenAfterSort:X,childrenAfterAggFilter:Y}=z;if(!Y)return X&&X.length>0?X:[];let G=Y.length;if(G<=1){if(X?.length===G&&(G===0||X[0]===Y[0]))return X;return Y.slice()}if(!X||G<=VK)return Q.doFullSortInPlace(Y.slice(),$);let q=new Map,{updates:H,adds:_}=J,U=[];for(let B=0;BQ.compareRowNodes($,B,E)||~q.get(B)-~q.get(E)),W===G)return U;return AK(Q,$,U,X,q,G)},AK=(Q,z,J,Z,$,X)=>{let Y=Array(X),G=0,q=J[G],H,_=-1,U=0,W=0,B=J.length,E=Z.length;while(!0){if(_<0){if(U>=E)break;if(H=Z[U++],_=$.get(H)??-1,_<0)continue}if((Q.compareRowNodes(z,q,H)||~$.get(q)-_)<0){if(Y[W++]=q,++G>=B)break;q=J[G]}else Y[W++]=H,_=-1}while(G=0)Y[W++]=K}return Y},jK=(Q,z,J)=>{let Z=0;J.length=z.size;for(let $=0,X=Q.length;${let{childrenAfterSort:z,sibling:J}=Q;if(J)J.childrenAfterSort=z;if(!z)return;for(let Z=0,$=z.length-1;Z<=$;Z++){let X=z[Z],Y=Z===0,G=Z===$;if(X.firstChild!==Y)X.firstChild=Y,X.dispatchRowEvent("firstChildChanged");if(X.lastChild!==G)X.lastChild=G,X.dispatchRowEvent("lastChildChanged");if(X.childIndex!==Z)X.childIndex=Z,X.dispatchRowEvent("childIndexChanged")}},RK=class extends j{constructor(){super(...arguments);this.beanName="sortStage",this.step="sort",this.refreshProps=["postSortRows","groupDisplayType","accentedSort"]}execute(Q,z){let J=this.beans.sortSvc.getSortOptions(),Z=J.length>0&&!!z&&this.gos.get("deltaSort"),{gos:$,colModel:X,rowGroupColsSvc:Y,rowNodeSorter:G,rowRenderer:q,showRowGroupCols:H}=this.beans,_=$.get("groupMaintainOrder"),U=X.getCols().some((D)=>D.isRowGroupActive()),W=Y?.columns,B=X.isPivotMode(),E=$.getCallback("postSortRows"),K=!1,L,F=(D)=>{let M=B&&D.leafGroup,k=_&&U&&!D.leafGroup;if(k)L??(L=this.shouldSortContainsGroupCols(J)),k&&(k=!L);let f=null;if(k){let A=!1;if(W){let O=D.level+1;if(O{let{childrenAfterSort:z,childrenAfterAggFilter:J}=Q,Z=z?.length,$=J?.length;if(!Z||!$)return null;let X=Array($),Y=new Set;for(let q=0;q<$;++q)Y.add(J[q]);let G=0;for(let q=0;q{this.beans.groupStage?.invalidateGroupCols(),this.refreshModel({step:"group",afterColumnsChanged:!0,keepRenderedRows:!0,animate:!this.gos.get("suppressAnimationFrame")})};this.addManagedEventListeners({newColumnsLoaded:J,columnRowGroupChanged:J,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:Q,stagesRefreshProps:z}=this,J=[Q.groupStage,Q.filterStage,Q.pivotStage,Q.aggStage,Q.sortStage,Q.filterAggStage,Q.flattenStage].filter((Z)=>!!Z);this.stages=J;for(let Z=J.length-1;Z>=0;--Z){let $=J[Z];for(let X of $.refreshProps)z.set(X,Z)}this.addManagedPropertyListeners([...z.keys(),"rowData"],(Z)=>{let $=Z.changeSet?.properties;if($)this.onPropChange($)}),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(Q,z,J,Z){let $,X=!1;do{$=!1;let Y=this.getRowIndexAtPixel(Q),G=this.getRowIndexAtPixel(z),q=Math.max(Y,J),H=Math.min(G,Z);for(let _=q;_<=H;_++){let U=this.getRow(_);if(U.rowHeightEstimated){let W=r1(this.beans,U);U.setRowHeight(W.height),$=!0,X=!0}}if($)this.setRowTopAndRowIndex()}while($);return X}onPropChange(Q){let{nodeManager:z,gos:J,beans:Z}=this,$=Z.groupStage;if(!z)return;let X=new Set(Q),Y=$?.onPropChange(X),G;if(X.has("rowData"))G=J.get("rowData");else if(Y)G=$?.extractData();if(G&&!Array.isArray(G))G=null,R(1);let q={step:"nothing",changedProps:X};if(G){let _=!Y&&!this.isEmpty()&&G.length>0&&J.exists("getRowId")&&!J.get("resetRowDataOnUpdate");if(this.refreshingData=!0,_)q.keepRenderedRows=!0,q.animate=!J.get("suppressAnimationFrame"),q.changedRowNodes=new W1,z.setImmutableRowData(q,G);else q.rowDataUpdated=!0,q.newData=!0,z.setNewRowData(G),this.rowNodesCountReady=!0}let H=q.rowDataUpdated?"group":this.getRefreshedStage(Q);if(H)q.step=H,this.refreshModel(q)}getRefreshedStage(Q){let{stages:z,stagesRefreshProps:J}=this;if(!z)return null;let Z=z.length,$=Z;for(let X=0,Y=Q.length;X{if(X?.id!=null&&!z.has(X.id))X.clearRowTopAndRowIndex()},Z=(X)=>{J(X),J(X.detailNode),J(X.sibling);let Y=X.childrenAfterGroup;if(!X.hasChildren()||!Y)return;if(Q&&X.level!==-1&&!X.expanded)return;for(let G=0,q=Y.length;G{let H=X[q];if(this.gos.get("groupHideOpenParents"))while(H.expanded&&H.childrenAfterSort&&H.childrenAfterSort.length>0)H=H.childrenAfterSort[0];return H.rowIndex},G=z.footerSvc;if(G)return G?.getTopDisplayIndex(Z,Q,X,Y);return Y(Q)}getTopLevelIndexFromDisplayedIndex(Q){let{rootNode:z,rowsToDisplay:J}=this;if(!z||!J.length||J[0]===z)return Q;let $=this.getRow(Q);if($.footer)$=$.sibling;let X=$.parent;while(X&&X!==z)$=X,X=$.parent;let Y=z.childrenAfterSort?.indexOf($)??-1;return Y>=0?Y:Q}getRowBounds(Q){let z=this.rowsToDisplay[Q];return z?{rowTop:z.rowTop,rowHeight:z.rowHeight}:null}onRowGroupOpened(){this.refreshModel({step:"map",keepRenderedRows:!0,animate:_1(this.gos)})}onFilterChanged({afterDataChange:Q,columns:z}){if(!Q){let Z=z.length===0||z.some(($)=>$.isPrimary())?"filter":"filter_aggregates";this.refreshModel({step:Z,keepRenderedRows:!0,animate:_1(this.gos)})}}onSortChanged(){this.refreshModel({step:"sort",keepRenderedRows:!0,animate:_1(this.gos)})}getType(){return"clientSide"}onValueChanged(){this.refreshModel({step:this.beans.colModel.isPivotActive()?"pivot":"aggregate"})}isSuppressModelUpdateAfterUpdateTransaction(Q){if(!this.gos.get("suppressModelUpdateAfterUpdateTransaction"))return!1;let{changedRowNodes:z,newData:J,rowDataUpdated:Z}=Q;if(!z||J||!Z)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(Q){let{nodeManager:z,eventSvc:J,started:Z}=this;if(!z)return;let $=!!Q.rowDataUpdated;if(Z&&$)J.dispatchEvent({type:"rowDataUpdated"});if(this.deferRefresh(Q)){this.setPendingRefreshFlags(Q),this.rowDataUpdatedPending||(this.rowDataUpdatedPending=$);return}if(this.rowDataUpdatedPending)this.rowDataUpdatedPending=!1,Q.step="group";this.updateRefreshParams(Q);let X=!1;this.refreshingModel=!0;try{this.executeRefresh(Q,$),X=!0}finally{if(this.refreshingData=!1,this.refreshingModel=!1,!X)this.setPendingRefreshFlags(Q)}this.clearPendingRefreshFlags(),J.dispatchEvent({type:"modelUpdated",animate:Q.animate,keepRenderedRows:Q.keepRenderedRows,newData:Q.newData,newPage:!1,keepUndoRedoStack:Q.keepUndoRedoStack})}executeRefresh(Q,z){let{beans:J,rootNode:Z}=this;if(J.masterDetailSvc?.refreshModel(Q),z&&Q.step!=="group")J.colFilter?.refreshModel();let $=Q.changedPath;if($?.addRow(Z),Q.step==="group")this.doGrouping(Z,Q),$??($=Q.changedPath);switch($??($=J.changedPathFactory?.ensureRowsPath(Q,Z)),Q.step){case"group":case"filter":this.doFilter($);case"pivot":if(this.doPivot($))$=void 0,Q.changedPath=void 0;case"aggregate":this.doAggregate($);case"filter_aggregates":this.doFilterAggregates($);case"sort":this.doSort($,Q.changedRowNodes);case"map":this.doRowsToDisplay()}let X=new Set;this.setRowTopAndRowIndex(X),this.clearRowTopAndRowIndex($,X),this.updateRefreshParams(Q)}deferRefresh(Q){if(this.refreshingModel)return!0;if(this.beans.colModel.changeEventsDispatching)return!0;if(this.isSuppressModelUpdateAfterUpdateTransaction(Q)){if(this.started)this.refreshingData=!1;return!0}if(!this.started)return!0;return!1}setPendingRefreshFlags(Q){this.pendingNewData||(this.pendingNewData=!!Q.newData),this.noKeepRenderedRows||(this.noKeepRenderedRows=!Q.keepRenderedRows),this.noKeepUndoRedoStack||(this.noKeepUndoRedoStack=!Q.keepUndoRedoStack),this.noAnimate||(this.noAnimate=!Q.animate)}clearPendingRefreshFlags(){this.pendingNewData=!1,this.noKeepRenderedRows=!1,this.noKeepUndoRedoStack=!1,this.noAnimate=!1}updateRefreshParams(Q){Q.newData=this.pendingNewData||!!Q.newData,Q.keepRenderedRows=!this.noKeepRenderedRows&&!!Q.keepRenderedRows,Q.keepUndoRedoStack=!this.noKeepUndoRedoStack&&!!Q.keepUndoRedoStack,Q.animate=!this.noAnimate&&!!Q.animate}isEmpty(){return!this.rootNode?._leafs?.length||!this.beans.colModel?.ready}isRowsToRender(){return this.rowsToDisplay.length>0}getOverlayType(){let{beans:Q,gos:z}=this;if(this.rootNode?._leafs?.length){if(Q.filterManager?.isAnyFilterPresent()&&this.getRowCount()===0)return"noMatchingRows"}else if(this.rowCountReady||(z.get("rowData")?.length??0)==0)return"noRows";return null}getNodesInRangeForSelection(Q,z){let J=!1,Z=!1,$=[],X=l1(this.gos);return this.forEachNodeAfterFilterAndSort((Y)=>{if(Z)return;if(J){if(Y===z||Y===Q){if(Z=!0,X&&Y.group){QX($,Y);return}}}if(!J){if(Y!==z&&Y!==Q)return;if(J=!0,z===Q)Z=!0}if(!Y.group||!X)$.push(Y)}),$}getTopLevelNodes(){return this.rootNode?.childrenAfterGroup??null}getRow(Q){return this.rowsToDisplay[Q]}getFormulaRow(Q){return this.formulaRows[Q]}isRowPresent(Q){return this.rowsToDisplay.indexOf(Q)>=0}getRowIndexAtPixel(Q){let z=this.rowsToDisplay,J=z.length;if(this.isEmpty()||J===0)return-1;let Z=0,$=J-1;if(Q<=0)return 0;if(z[$].rowTop<=Q)return $;let Y=-1,G=-1;while(!0){let q=Math.floor((Z+$)/2),H=z[q];if(this.isRowInPixel(H,Q))return q;if(H.rowTopQ)$=q-1;if(Y===Z&&G===$)return q;Y=Z,G=$}}isRowInPixel(Q,z){let J=Q.rowTop,Z=J+Q.rowHeight;return J<=z&&Z>z}forEachLeafNode(Q){let z=this.rootNode?._leafs;if(z)for(let J=0,Z=z.length;JJ.childrenAfterAggFilter)}forEachNodeAfterFilterAndSort(Q,z=!1){this.depthFirstSearchRowNodes(Q,z,(J)=>J.childrenAfterSort)}forEachPivotNode(Q,z,J){let{colModel:Z,rowGroupColsSvc:$}=this.beans;if(!Z.isPivotMode())return;if(!$?.columns.length){Q(this.rootNode,0);return}let X=J?"childrenAfterSort":"childrenAfterGroup";this.depthFirstSearchRowNodes(Q,z,(Y)=>!Y.leafGroup?Y[X]:null)}depthFirstSearchRowNodes(Q,z=!1,J=(X)=>X.childrenAfterGroup,Z=this.rootNode,$=0){let X=$;if(!Z)return X;let Y=Z===this.rootNode;if(!Y)Q(Z,X++);if(Z.hasChildren()&&!Z.footer){let G=Y||this.hierarchical?J(Z):null;if(G){let q=this.beans.footerSvc;X=q?.addTotalRows(X,Z,Q,z,Y,"top")??X;for(let H of G)X=this.depthFirstSearchRowNodes(Q,z,J,H,X);return q?.addTotalRows(X,Z,Q,z,Y,"bottom")??X}}return X}doAggregate(Q){if(this.rootNode)this.beans.aggStage?.execute(Q)}doFilterAggregates(Q){let z=this.rootNode,J=this.beans.filterAggStage;if(J&&this.hierarchical){J.execute(Q);return}z.childrenAfterAggFilter=z.childrenAfterFilter;let Z=z.sibling;if(Z)Z.childrenAfterAggFilter=z.childrenAfterFilter}doSort(Q,z){let J=this.beans.sortStage;if(J){J.execute(Q,z);return}A0(this.rootNode,this.hierarchical,Q,(Z)=>{Z.childrenAfterSort=Z.childrenAfterAggFilter.slice(0),e$(Z)})}doGrouping(Q,z){let Z=this.beans.groupStage?.execute(z);if(Z===void 0){let $=Q._leafs;Q.childrenAfterGroup=$,Q.updateHasChildren();let X=Q.sibling;if(X)X.childrenAfterGroup=$}if(Z||z.rowDataUpdated)this.beans.colFilter?.refreshModel();if(!this.rowCountReady&&this.rowNodesCountReady)this.rowCountReady=!0,this.eventSvc.dispatchEventOnce({type:"rowCountReady"})}doFilter(Q){let z=this.beans.filterStage;if(z){z.execute(Q);return}A0(this.rootNode,this.hierarchical,Q,(J)=>{J.childrenAfterFilter=J.childrenAfterGroup,M5(J)})}doPivot(Q){return this.beans.pivotStage?.execute(Q)??!1}getRowNode(Q){let z=this.nodeManager?.getRowNode(Q);if(typeof z==="object")return z;return this.beans.groupStage?.getNonLeaf(Q)}batchUpdateRowData(Q,z){if(!this.asyncTransactionsTimer){this.asyncTransactions=[];let J=this.gos.get("asyncTransactionWaitMillis");this.asyncTransactionsTimer=setTimeout(()=>this.executeBatchUpdateRowData(),J)}this.asyncTransactions.push({rowDataTransaction:Q,callback:z})}flushAsyncTransactions(){let Q=this.asyncTransactionsTimer;if(Q)clearTimeout(Q),this.executeBatchUpdateRowData()}executeBatchUpdateRowData(){let{nodeManager:Q,beans:z,eventSvc:J,asyncTransactions:Z}=this;if(!Q)return;z.valueCache?.onDataChanged();let $=[],X=[],Y=new W1,G=!this.gos.get("suppressAnimationFrame");for(let{rowDataTransaction:q,callback:H}of Z??[]){this.rowNodesCountReady=!0,this.refreshingData=!0;let _=Q.updateRowData(q,Y,G);if($.push(_),H)X.push(H.bind(null,_))}if(this.commitTransactions(Y,G),X.length>0)setTimeout(()=>{for(let q=0,H=X.length;q0)J.dispatchEvent({type:"asyncTransactionsFlushed",results:$});this.asyncTransactionsTimer=0,this.asyncTransactions=null}updateRowData(Q){let z=this.nodeManager;if(!z)return null;this.beans.valueCache?.onDataChanged(),this.rowNodesCountReady=!0;let J=new W1,Z=!this.gos.get("suppressAnimationFrame");this.refreshingData=!0;let $=z.updateRowData(Q,J,Z);return this.commitTransactions(J,Z),$}commitTransactions(Q,z){this.refreshModel({step:"group",rowDataUpdated:!0,keepRenderedRows:!0,animate:z,changedRowNodes:Q})}doRowsToDisplay(){let{rootNode:Q,beans:z}=this;if(z.formula?.active){let $=Q?.childrenAfterSort??[];this.formulaRows=$,this.rowsToDisplay=$.filter((X)=>!X.softFiltered);for(let X of this.rowsToDisplay)X.setUiLevel(0);return}let J=z.flattenStage;if(J){this.rowsToDisplay=J.execute();return}let Z=this.rootNode.childrenAfterSort??[];for(let $ of Z)$.setUiLevel(0);this.rowsToDisplay=Z}onRowHeightChanged(){this.refreshModel({step:"map",keepRenderedRows:!0,keepUndoRedoStack:!0})}resetRowHeights(){let Q=this.rootNode;if(!Q)return;let z=this.resetRowHeightsForAllRowNodes();Q.setRowHeight(Q.rowHeight,!0);let J=Q.sibling;if(J?.setRowHeight(J.rowHeight,!0),z)this.onRowHeightChanged()}resetRowHeightsForAllRowNodes(){let Q=!1;return this.forEachNode((z)=>{z.setRowHeight(z.rowHeight,!0);let J=z.detailNode;J?.setRowHeight(J.rowHeight,!0);let Z=z.sibling;Z?.setRowHeight(Z.rowHeight,!0),Q=!0}),Q}onGridStylesChanges(Q){if(Q.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()}},QX=(Q,z)=>{let J=z.childrenAfterGroup;if(J)for(let Z=0,$=J.length;Z<$;++Z){let X=J[Z];if(X.data)Q.push(X);if(X.group)QX(Q,X)}};var zX={moduleName:"ClientSideRowModel",version:p,rowModels:["clientSide"],beans:[OK,RK],dependsOn:[r$]};var PK=":where(.ag-ltr) :where(.ag-animate-autosize){.ag-cell,.ag-header-cell,.ag-header-group-cell{transition:width .2s ease-in-out,left .2s ease-in-out}}:where(.ag-rtl) :where(.ag-animate-autosize){.ag-cell,.ag-header-cell,.ag-header-group-cell{transition:width .2s ease-in-out,right .2s ease-in-out}}";function TK(Q,z){if(typeof z==="number")Q.colAutosize?.sizeColumnsToFit(z,"api");else Q.colAutosize?.sizeColumnsToFitGridBody(z)}function JX({colAutosize:Q,visibleCols:z},J,Z){if(Array.isArray(J))Q?.autoSizeCols({colKeys:J,skipHeader:Z,source:"api"});else Q?.autoSizeCols({...J,colKeys:J.colIds??z.allCols,source:"api"})}function vK(Q,z){if(z&&typeof z==="object")JX(Q,z);else Q.colAutosize?.autoSizeAllColumns({source:"api",skipHeader:z})}var IK=class extends j{constructor(){super(...arguments);this.beanName="colAutosize",this.timesDelayed=0,this.shouldQueueResizeOperations=!1,this.resizeOperationQueue=[]}postConstruct(){let{gos:Q}=this,z=Q.get("autoSizeStrategy");if(z){let J=!1,Z=z.type;if(Z==="fitGridWidth"||Z==="fitProvidedWidth")J=!0;else if(Z==="fitCellContents"){this.addManagedEventListeners({firstDataRendered:()=>this.onFirstDataRendered(z)});let $=Q.get("rowData");J=$!=null&&$.length>0&&o(Q)}if(J)this.beans.colDelayRenderSvc?.hideColumns(Z)}}autoSizeCols(Q){let{eventSvc:z,visibleCols:J,colModel:Z}=this.beans;b1(this.beans,!0),this.innerAutoSizeCols(Q).then(($)=>{let X=(_)=>L1(z,Array.from(_),!0,"autosizeColumns");if(!Q.scaleUpToFitGridWidth)return b1(this.beans,!1),X($);let Y=U8(this.beans),G=(_)=>J.leftCols.some((U)=>PQ(U,_)),q=(_)=>J.rightCols.some((U)=>PQ(U,_)),H=Q.colKeys.filter((_)=>{return!Z.getCol(_)?.getColDef().suppressAutoSize&&!v0(_)&&!G(_)&&!q(_)});this.sizeColumnsToFit(Y,Q.source,!0,{defaultMaxWidth:Q.defaultMaxWidth,defaultMinWidth:Q.defaultMinWidth,columnLimits:Q.columnLimits?.map((_)=>({..._,key:_.colId})),colKeys:H,onlyScaleUp:!0,animate:!1}),b1(this.beans,!1),X($)})}innerAutoSizeCols(Q){return new Promise((z,J)=>{if(this.shouldQueueResizeOperations)return this.pushResizeOperation(()=>this.innerAutoSizeCols(Q).then(z,J));let{colKeys:Z,skipHeader:$,skipHeaderGroups:X,stopAtGroup:Y,defaultMaxWidth:G,defaultMinWidth:q,columnLimits:H=[],source:_="api"}=Q,{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(Q).then(z,J)});return}this.timesDelayed=0;let L=new Set,F=-1,D=Object.fromEntries(H.map(({colId:f,...A})=>[f,A])),M=$??this.gos.get("skipHeaderOnAutoSize"),k=X??M;while(F!==0){F=0;let f=[];for(let A of Z){if(!A||GJ(A))continue;let O=B.getCol(A);if(!O||L.has(O)||O.getColDef().suppressAutoSize)continue;let v=E.getPreferredWidthForColumn(O,M);if(v>0){let I=D[O.colId]??{};I.minWidth??(I.minWidth=q),I.maxWidth??(I.maxWidth=G);let C=CK(O,v,I);O.setActualWidth(C,_),L.add(O),F++}f.push(O)}if(f.length)K.refresh(_)}if(!k)this.autoSizeColumnGroupsByColumns(Z,_,Y);z(L)})}autoSizeColumn(Q,z,J){this.autoSizeCols({colKeys:[Q],skipHeader:J,skipHeaderGroups:!0,source:z})}autoSizeColumnGroupsByColumns(Q,z,J){let{colModel:Z,ctrlsSvc:$}=this.beans,X=new Set,Y=Z.getColsForKeys(Q);for(let q of Y){let H=q.getParent();while(H&&H!=J){if(!H.isPadding())X.add(H);H=H.getParent()}}let G;for(let q of X){for(let H of $.getHeaderRowContainerCtrls())if(G=H.getHeaderCtrlForColumn(q),G)break;G?.resizeLeafColumnsToFit(z)}}autoSizeAllColumns(Q){if(this.shouldQueueResizeOperations){this.pushResizeOperation(()=>this.autoSizeAllColumns(Q));return}this.autoSizeCols({colKeys:this.beans.visibleCols.allCols,...Q})}addColumnAutosizeListeners(Q,z){let J=this.gos.get("skipHeaderOnAutoSize"),Z=()=>{this.autoSizeColumn(z,"uiColumnResized",J)};Q.addEventListener("dblclick",Z);let $=new h0(Q);return $.addEventListener("doubleTap",Z),()=>{Q.removeEventListener("dblclick",Z),$.destroy()}}addColumnGroupResize(Q,z,J){let Z=this.gos.get("skipHeaderOnAutoSize"),$=()=>{let X=[],Y=z.getDisplayedLeafColumns();for(let G of Y)if(!G.getColDef().suppressAutoSize)X.push(G.getColId());if(X.length>0)this.autoSizeCols({colKeys:X,skipHeader:Z,stopAtGroup:z,source:"uiColumnResized"});J()};return Q.addEventListener("dblclick",$),()=>Q.removeEventListener("dblclick",$)}sizeColumnsToFitGridBody(Q,z){if(!this.isAlive())return;let J=U8(this.beans);if(J>0){this.sizeColumnsToFit(J,"sizeColumnsToFit",!1,Q);return}if(z===void 0)window.setTimeout(()=>{this.sizeColumnsToFitGridBody(Q,100)},0);else if(z===100)window.setTimeout(()=>{this.sizeColumnsToFitGridBody(Q,500)},100);else if(z===500)window.setTimeout(()=>{this.sizeColumnsToFitGridBody(Q,-1)},500);else R(29)}sizeColumnsToFit(Q,z="sizeColumnsToFit",J,Z){if(this.shouldQueueResizeOperations){this.pushResizeOperation(()=>this.sizeColumnsToFit(Q,z,J,Z));return}let{beans:$}=this,X=Z?.animate??!0;if(X)b1($,!0);let Y={};for(let{key:F,...D}of Z?.columnLimits??[])Y[typeof F==="string"?F:F.getColId()]=D;let G=$.visibleCols.allCols;if(Q<=0||!G.length)return;let q=NQ(G);if(Z?.onlyScaleUp&&q>Q)return;if(Q===q){if(G.every((D)=>{if(D.colDef.suppressSizeToFit)return!0;let M=Y?.[D.getId()],k=M?.minWidth??Z?.defaultMinWidth,f=M?.maxWidth??Z?.defaultMaxWidth,A=D.getActualWidth();return(k==null||A>=k)&&(f==null||A<=f)}))return}let _=[],U=[];for(let F of G){let D=Z?.colKeys?.some((M)=>PQ(F,M))??!0;if(F.getColDef().suppressSizeToFit||!D)U.push(F);else _.push(F)}let W=_.slice(0),B=!1,E=(F)=>{$0(_,F),U.push(F)},K={};for(let F of _){if(Z?.onlyScaleUp)K[F.getColId()]=F.getActualWidth();F.resetActualWidth(z);let D=Y?.[F.getId()],M=D?.minWidth??Z?.defaultMinWidth??-1/0,k=D?.maxWidth??Z?.defaultMaxWidth??1/0,f=F.getActualWidth(),A=Math.max(Math.min(f,k),M);if(A!=f)F.setActualWidth(A,z,!0)}while(!B){B=!0;let F=Q-NQ(U);if(F<=0)for(let D of _){let M=Y?.[D.getId()]?.minWidth??Z?.defaultMinWidth??D.minWidth;D.setActualWidth(M,z,!0)}else{let D=F/NQ(_),M=F;for(let k=_.length-1;k>=0;k--){let f=_[k],A=f.getColId(),O=K[A],v=Y?.[A],I=v?.minWidth??Z?.defaultMinWidth??O,C=v?.maxWidth??Z?.defaultMaxWidth,m=Math.max(I??-1/0,f.getMinWidth()),w=Math.min(C??1/0,f.getMaxWidth()),a=Math.round(f.getActualWidth()*D);if(aw)a=w,E(f),B=!1;else if(k===0)a=M;f.setActualWidth(a,z,!0),M-=a}}}for(let F of W)F.fireColumnWidthChangedEvent(z);let L=$.visibleCols;if(L.setLeftValues(z),L.updateBodyWidths(),J)return;if(L1(this.eventSvc,W,!0,z),X)b1($,!1)}applyAutosizeStrategy(){let{gos:Q,colDelayRenderSvc:z}=this.beans,J=Q.get("autoSizeStrategy");if(J?.type!=="fitGridWidth"&&J?.type!=="fitProvidedWidth")return;setTimeout(()=>{if(!this.isAlive())return;let Z=J.type;if(Z==="fitGridWidth"){let{columnLimits:$,defaultMinWidth:X,defaultMaxWidth:Y}=J,G=$?.map(({colId:q,minWidth:H,maxWidth:_})=>({key:q,minWidth:H,maxWidth:_}));this.sizeColumnsToFitGridBody({defaultMinWidth:X,defaultMaxWidth:Y,columnLimits:G})}else if(Z==="fitProvidedWidth")this.sizeColumnsToFit(J.width,"sizeColumnsToFit");z?.revealColumns(Z)})}onFirstDataRendered({colIds:Q,...z}){setTimeout(()=>{if(!this.isAlive())return;let J="autosizeColumns";if(Q)this.autoSizeCols({...z,source:J,colKeys:Q});else this.autoSizeAllColumns({...z,source:J});this.beans.colDelayRenderSvc?.revealColumns(z.type)})}processResizeOperations(){this.shouldQueueResizeOperations=!1;for(let Q of this.resizeOperationQueue)Q();this.resizeOperationQueue=[]}pushResizeOperation(Q){this.resizeOperationQueue.push(Q)}destroy(){this.resizeOperationQueue.length=0,super.destroy()}};function CK(Q,z,J={}){let Z=J.minWidth??Q.getMinWidth();if(z$)z=$;return z}function U8({ctrlsSvc:Q,scrollVisibleSvc:z}){let J=Q.getGridBodyCtrl(),$=J.isVerticalScrollShowing()?z.getScrollbarWidth():0;return xz(J.eGridBody)-$}var W8="ag-animate-autosize";function b1({ctrlsSvc:Q,gos:z},J){if(!z.get("animateColumnResizing")||z.get("enableRtl")||!Q.isAlive())return;let Z=Q.getGridBodyCtrl().eGridBody.classList;if(J)Z.add(W8);else Z.remove(W8)}var ZX={moduleName:"ColumnAutoSize",version:p,beans:[IK],apiFunctions:{sizeColumnsToFit:TK,autoSizeColumns:JX,autoSizeAllColumns:vK},dependsOn:[L$],css:[PK]};var bK=class extends j{constructor(){super(...arguments);this.beanName="gridSerializer"}wireBeans(Q){this.visibleCols=Q.visibleCols,this.colModel=Q.colModel,this.rowModel=Q.rowModel,this.pinnedRowModel=Q.pinnedRowModel}serialize(Q,z={}){let{allColumns:J,columnKeys:Z,skipRowGroups:$,exportRowNumbers:X}=z,Y=this.getColumnsToExport({allColumns:J,skipRowGroups:$,columnKeys:Z,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((G,q)=>q(G),Q).parse()}processRow(Q,z,J,Z){let $=z.shouldRowBeSkipped||(()=>!1),Y=z.rowPositions!=null||!!z.onlySelected,G=this.gos.get("groupHideOpenParents")&&!Y,q=this.colModel.isPivotMode()?Z.leafGroup:!Z.group,H=!!Z.footer,_=Z.allChildrenCount===1&&Z.childrenAfterGroup?.length===1&&gG(this.gos,Z);if(!q&&!H&&(z.skipRowGroups||_||G)||z.onlySelected&&!Z.isSelected()||z.skipPinnedTop&&Z.rowPinned==="top"||z.skipPinnedBottom&&Z.rowPinned==="bottom"||Z.stub)return;if(Z.level===-1&&!q&&!H)return;if($(y(this.gos,{node:Z})))return;let B=Q.onNewBodyRow(Z);if(J.forEach((E,K)=>{B.onColumn(E,K,Z)}),z.getCustomContentBelowRow){let E=z.getCustomContentBelowRow(y(this.gos,{node:Z}));if(E)Q.addCustomContent(E)}}appendContent(Q){return(z)=>{let J=Q.appendContent;if(J)z.addCustomContent(J);return z}}prependContent(Q){return(z)=>{let J=Q.prependContent;if(J)z.addCustomContent(J);return z}}prepareSession(Q){return(z)=>{return z.prepare(Q),z}}exportColumnGroups(Q,z){return(J)=>{if(!Q.skipColumnGroupHeaders){let Z=new k$,{colGroupSvc:$}=this.beans,X=$?$.createColumnGroups({columns:z,idCreator:Z,pinned:null,isStandaloneStructure:!0}):z;this.recursivelyAddHeaderGroups(X,J,Q.processGroupHeaderCallback)}return J}}exportHeaders(Q,z){return(J)=>{if(!Q.skipColumnHeaders){let Z=J.onNewHeaderRow();z.forEach(($,X)=>{Z.onColumn($,X,void 0)})}return J}}processPinnedTopRows(Q,z){return(J)=>{let Z=this.processRow.bind(this,J,Q,z);if(Q.rowPositions)Q.rowPositions.filter(($)=>$.rowPinned==="top").sort(($,X)=>$.rowIndex-X.rowIndex).map(($)=>this.pinnedRowModel?.getPinnedTopRow($.rowIndex)).forEach(Z);else if(!this.pinnedRowModel?.isManual())this.pinnedRowModel?.forEachPinnedRow("top",Z);return J}}processRows(Q,z){return(J)=>{let Z=this.rowModel,$=o(this.gos,Z),X=Hz(this.gos,Z),Y=!$&&Q.onlySelected,G=this.processRow.bind(this,J,Q,z),{exportedRows:q="filteredAndSorted"}=Q;if(Q.rowPositions)Q.rowPositions.filter((H)=>H.rowPinned==null).sort((H,_)=>H.rowIndex-_.rowIndex).map((H)=>Z.getRow(H.rowIndex)).forEach(G);else if(this.colModel.isPivotMode())if($)Z.forEachPivotNode(G,!0,q==="filteredAndSorted");else if(X)Z.forEachNodeAfterFilterAndSort(G,!0);else Z.forEachNode(G);else if(Q.onlySelectedAllPages||Y){let H=this.beans.selectionSvc?.getSelectedNodes()??[];this.replicateSortedOrder(H),H.forEach(G)}else if(q==="all")Z.forEachNode(G);else if($||X)Z.forEachNodeAfterFilterAndSort(G,!0);else Z.forEachNode(G);return J}}replicateSortedOrder(Q){let{sortSvc:z,rowNodeSorter:J}=this.beans;if(!z||!J)return;let Z=z.getSortOptions(),$=(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 J.compareRowNodes(Z,X,Y)||(X.rowIndex??-1)-(Y.rowIndex??-1);return $(X.parent,Y.parent)}if(X.level>Y.level)return $(X.parent,Y);return $(X,Y.parent)};Q.sort($)}processPinnedBottomRows(Q,z){return(J)=>{let Z=this.processRow.bind(this,J,Q,z);if(Q.rowPositions)Q.rowPositions.filter(($)=>$.rowPinned==="bottom").sort(($,X)=>$.rowIndex-X.rowIndex).map(($)=>this.pinnedRowModel?.getPinnedBottomRow($.rowIndex)).forEach(Z);else if(!this.pinnedRowModel?.isManual())this.pinnedRowModel?.forEachPinnedRow("bottom",Z);return J}}getColumnsToExport(Q){let{allColumns:z=!1,skipRowGroups:J=!1,exportRowNumbers:Z=!1,columnKeys:$}=Q,{colModel:X,gos:Y,visibleCols:G}=this,q=X.isPivotMode(),H=(W)=>{if(IQ(W))return!1;return!v0(W)||Z};if($?.length)return X.getColsForKeys($).filter(H);let _=Y.get("treeData"),U=[];if(z&&!q)U=X.getCols();else U=G.allCols;return U=U.filter((W)=>H(W)&&(J&&!_?!mz(W):!0)),U}recursivelyAddHeaderGroups(Q,z,J){let Z=[];for(let $ of Q){let X=$;if(!X.getChildren)continue;for(let Y of X.getChildren()??[])Z.push(Y)}if(Q.length>0&&_0(Q[0]))this.doAddHeaderHeader(z,Q,J);if(Z&&Z.length>0)this.recursivelyAddHeaderGroups(Z,z,J)}doAddHeaderHeader(Q,z,J){let Z=Q.onNewHeaderGroupingRow(),$=0;for(let X of z){let Y=X,G;if(J)G=J(y(this.gos,{columnGroup:Y}));else G=this.beans.colNames.getDisplayNameForColumnGroup(Y,"header");let H=(Y.isExpandable()?Y.getLeafColumns():[]).reduce((_,U,W,B)=>{let E=b(_);if(U.getColumnGroupShow()!=="open"){if(E&&E[1]==null)E[1]=W-1}else if(!E||E[1]!=null)E=[W],_.push(E);if(W===B.length-1&&E&&E[1]==null)E[1]=W;return _},[]);Z.onColumn(Y,G||"",$++,Y.getLeafColumns().length-1,H)}}},S6={moduleName:"SharedExport",version:p,beans:[bK]},O6=class extends j{getFileName(Q){let z=this.getDefaultFileExtension();if(!Q?.length)Q=this.getDefaultFileName();return Q.includes(".")?Q:`${Q}.${z}`}getData(Q){return this.beans.gridSerializer.serialize(this.createSerializingSession(Q),Q)}getDefaultFileName(){return`export.${this.getDefaultFileExtension()}`}};function dZ(Q,z){let J=document.defaultView||window;if(!J){R(52);return}let Z=document.createElement("a"),$=J.URL.createObjectURL(z);Z.setAttribute("href",$),Z.setAttribute("download",Q),Z.style.display="none",document.body.appendChild(Z),Z.dispatchEvent(new MouseEvent("click",{bubbles:!1,cancelable:!0,view:J})),Z.remove(),J.setTimeout(()=>{J.URL.revokeObjectURL($)},0)}var P6=class{constructor(Q){this.valueFrom="data";let{colModel:z,rowGroupColsSvc:J,colNames:Z,valueSvc:$,gos:X,processCellCallback:Y,processHeaderCallback:G,processGroupHeaderCallback:q,processRowGroupCallback:H,valueFrom:_}=Q;if(this.colModel=z,this.rowGroupColsSvc=J,this.colNames=Z,this.valueSvc=$,this.gos=X,this.processCellCallback=Y,this.processHeaderCallback=G,this.processGroupHeaderCallback=q,this.processRowGroupCallback=H,_)this.valueFrom=_}prepare(Q){}extractHeaderValue(Q){return this.getHeaderName(this.processHeaderCallback,Q)??""}extractRowCellValue(Q){let{column:z,node:J,currentColumnIndex:Z,accumulatedRowIndex:$,type:X,useRawFormula:Y}=Q,G=Z===0&&G9(this.gos,J,this.colModel.isPivotMode());if(this.processRowGroupCallback&&(this.gos.get("treeData")||J.group)&&(z.isRowGroupDisplayed(J.rowGroupColumn?.getColId()??"")||G))return{value:this.processRowGroupCallback(y(this.gos,{column:z,node:J}))??""};if(this.processCellCallback)return{value:this.processCellCallback(y(this.gos,{accumulatedRowIndex:$,column:z,node:J,value:this.valueSvc.getValueForDisplay({column:z,node:J,from:this.valueFrom}).value,type:X,parseValue:(E)=>this.valueSvc.parseValue(z,J,E,this.valueSvc.getValue(z,J,this.valueFrom)),formatValue:(E)=>this.valueSvc.formatValue(z,J,E)??E}))??""};let q=this.gos.get("treeData"),H=this.valueSvc,_=J.level===-1&&J.footer,U=z.colDef.showRowGroup===!0&&(J.group||q);if(!_&&(G||U)){let E="",K=J;while(K&&K.level!==-1){let{value:L,valueFormatted:F}=H.getValueForDisplay({column:G?void 0:z,node:K,includeValueFormatted:!0,exporting:!0,from:this.valueFrom});E=` -> ${F??L??""}${E}`,K=K.parent}return{value:E,valueFormatted:E}}let{value:W,valueFormatted:B}=H.getValueForDisplay({column:z,node:J,includeValueFormatted:!0,exporting:!0,useRawFormula:Y,from:this.valueFrom});return{value:W??"",valueFormatted:B}}getHeaderName(Q,z){if(Q)return Q(y(this.gos,{column:z}));return this.colNames.getDisplayNameForColumn(z,"csv",!0)}},B8=`\r -`,yK=class extends P6{constructor(Q){super(Q);this.config=Q,this.isFirstLine=!0,this.result="";let{suppressQuotes:z,columnSeparator:J}=Q;this.suppressQuotes=z,this.columnSeparator=J}addCustomContent(Q){if(!Q)return;if(typeof Q==="string"){if(!/^\s*\n/.test(Q))this.beginNewLine();Q=Q.replace(/\r?\n/g,B8),this.result+=Q}else Q.forEach((z)=>{this.beginNewLine(),z.forEach((J,Z)=>{if(Z!==0)this.result+=this.columnSeparator;if(this.result+=this.putInQuotes(J.data.value||""),J.mergeAcross)this.appendEmptyCells(J.mergeAcross)})})}onNewHeaderGroupingRow(){return this.beginNewLine(),{onColumn:this.onNewHeaderGroupingRowColumn.bind(this)}}onNewHeaderGroupingRowColumn(Q,z,J,Z){if(J!=0)this.result+=this.columnSeparator;this.result+=this.putInQuotes(z),this.appendEmptyCells(Z)}appendEmptyCells(Q){for(let z=1;z<=Q;z++)this.result+=this.columnSeparator+this.putInQuotes("")}onNewHeaderRow(){return this.beginNewLine(),{onColumn:this.onNewHeaderRowColumn.bind(this)}}onNewHeaderRowColumn(Q,z){if(z!=0)this.result+=this.columnSeparator;this.result+=this.putInQuotes(this.extractHeaderValue(Q))}onNewBodyRow(){return this.beginNewLine(),{onColumn:this.onNewBodyRowColumn.bind(this)}}onNewBodyRowColumn(Q,z,J){if(z!=0)this.result+=this.columnSeparator;let Z=this.extractRowCellValue({column:Q,node:J,currentColumnIndex:z,accumulatedRowIndex:z,type:"csv",useRawFormula:!1});this.result+=this.putInQuotes(Z.valueFormatted??Z.value)}putInQuotes(Q){if(this.suppressQuotes)return Q;if(Q===null||Q===void 0)return'""';let z;if(typeof Q==="string")z=Q;else if(typeof Q.toString==="function")z=Q.toString();else R(53),z="";return'"'+z.replace(/"/g,'""')+'"'}parse(){return this.result}beginNewLine(){if(!this.isFirstLine)this.result+=B8;this.isFirstLine=!1}},xK=class extends O6{constructor(){super(...arguments);this.beanName="csvCreator"}getMergedParams(Q){let z=this.gos.get("defaultCsvExportParams");return Object.assign({},z,Q)}export(Q){if(this.isExportSuppressed()){R(51);return}let z=()=>{let Z=this.getMergedParams(Q),$=this.getData(Z),X=new Blob(["\uFEFF",$],{type:"text/plain"}),Y=Z.fileName,G=typeof Y==="function"?Y(y(this.gos,{})):Y;dZ(this.getFileName(G),X)},{overlays:J}=this.beans;if(J)J.showExportOverlay(z);else z()}exportDataAsCsv(Q){this.export(Q)}getDataAsCsv(Q,z=!1){let J=z?Object.assign({},Q):this.getMergedParams(Q);return this.getData(J)}getDefaultFileExtension(){return"csv"}createSerializingSession(Q){let{colModel:z,colNames:J,rowGroupColsSvc:Z,valueSvc:$,gos:X}=this.beans,{processCellCallback:Y,processHeaderCallback:G,processGroupHeaderCallback:q,processRowGroupCallback:H,suppressQuotes:_,columnSeparator:U,valueFrom:W}=Q;return new yK({colModel:z,colNames:J,valueSvc:$,gos:X,processCellCallback:Y||void 0,processHeaderCallback:G||void 0,processGroupHeaderCallback:q||void 0,processRowGroupCallback:H||void 0,suppressQuotes:_||!1,columnSeparator:U||",",rowGroupColsSvc:Z,valueFrom:W})}isExportSuppressed(){return this.gos.get("suppressCsvExport")}};function wK(Q,z){return Q.csvCreator?.getDataAsCsv(z)}function NK(Q,z){Q.csvCreator?.exportDataAsCsv(z)}var $X={moduleName:"CsvExport",version:p,beans:[xK],apiFunctions:{getDataAsCsv:wK,exportDataAsCsv:NK},dependsOn:[S6]},XX=class extends j0{constructor(Q,z){super();if(this.ctrl=Q,z)this.beans=z}postConstruct(){this.refreshTooltip()}setBrowserTooltip(Q,z){let Z=this.ctrl.getGui();if(!Z)return;if(Q!=null&&(Q!=""||z))Z.setAttribute("title",Q);else Z.removeAttribute("title")}updateTooltipText(){let{getTooltipValue:Q}=this.ctrl;if(Q)this.tooltip=Q()}createTooltipFeatureIfNeeded(){if(this.tooltipManager==null){let Q=this.beans.registry.createDynamicBean("tooltipStateManager",!0,this.ctrl,()=>this.tooltip);if(Q)this.tooltipManager=this.createBean(Q,this.beans.context)}}attemptToShowTooltip(){this.tooltipManager?.prepareToShowTooltip()}attemptToHideTooltip(){this.tooltipManager?.hideTooltip()}setTooltipAndRefresh(Q){this.tooltip=Q,this.refreshTooltip()}refreshTooltip(Q){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(Q?"":null,Q),this.createTooltipFeatureIfNeeded()}destroy(){this.tooltipManager=this.destroyBean(this.tooltipManager,this.beans.context),super.destroy()}},gK=1000,hK=1000,E8=100,K8,mJ=!1,uK=class extends j0{constructor(Q,z){super();this.tooltipCtrl=Q,this.getTooltipValue=z,this.interactionEnabled=!1,this.isInteractingWithTooltip=!1,this.state=0,this.tooltipInstanceCount=0,this.tooltipMouseTrack=!1}wireBeans(Q){this.popupSvc=Q.popupSvc}postConstruct(){if(this.gos.get("tooltipInteraction"))this.interactionEnabled=!0;this.tooltipTrigger=this.getTooltipTrigger(),this.tooltipMouseTrack=this.gos.get("tooltipMouseTrack");let Q=this.tooltipCtrl.getGui();if(this.tooltipTrigger===0)this.addManagedListeners(Q,{mouseenter:this.onMouseEnter.bind(this),mouseleave:this.onMouseLeave.bind(this)});if(this.tooltipTrigger===1)this.addManagedListeners(Q,{focusin:this.onFocusIn.bind(this),focusout:this.onFocusOut.bind(this)});if(this.addManagedListeners(Q,{mousemove:this.onMouseMove.bind(this)}),!this.interactionEnabled)this.addManagedListeners(Q,{mousedown:this.onMouseDown.bind(this),keydown:this.onKeyDown.bind(this)})}getGridOptionsTooltipDelay(Q){let z=this.gos.get(Q);return Math.max(200,z)}getTooltipDelay(Q){return this.tooltipCtrl[`getTooltip${Q}DelayOverride`]?.()??this.getGridOptionsTooltipDelay(`tooltip${Q}Delay`)}destroy(){this.setToDoNothing(),super.destroy()}getTooltipTrigger(){let Q=this.gos.get("tooltipTrigger");if(!Q||Q==="hover")return 0;return 1}onMouseEnter(Q){if(this.interactionEnabled&&this.interactiveTooltipTimeoutId)this.unlockService(),this.startHideTimeout();if(bz())return;if(mJ)this.showTooltipTimeoutId=window.setTimeout(()=>{this.prepareToShowTooltip(Q)},E8);else this.prepareToShowTooltip(Q)}onMouseMove(Q){if(this.lastMouseEvent)this.lastMouseEvent=Q;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(Q){let z=Q.relatedTarget,J=this.tooltipCtrl.getGui(),Z=this.tooltipComp?.getGui();if(this.isInteractingWithTooltip||J.contains(z)||this.interactionEnabled&&Z?.contains(z))return;this.setToDoNothing()}onKeyDown(){if(this.isInteractingWithTooltip)this.isInteractingWithTooltip=!1;this.setToDoNothing()}prepareToShowTooltip(Q){if(this.state!=0||mJ)return;let z=0;if(Q)z=this.isLastTooltipHiddenRecently()?this.getTooltipDelay("SwitchShow"):this.getTooltipDelay("Show");this.lastMouseEvent=Q||null,this.showTooltipTimeoutId=window.setTimeout(this.showTooltip.bind(this),z),this.state=1}isLastTooltipHiddenRecently(){return Date.now()-K8this.hideTooltip(!0),...z.getAdditionalParams?.()});this.state=2,this.tooltipInstanceCount++;let Z=this.newTooltipComponentCallback.bind(this,this.tooltipInstanceCount);this.createTooltipComp(J,Z)}hideTooltip(Q){if(!Q&&this.isInteractingWithTooltip)return;if(this.tooltipComp)this.destroyTooltipComp(),K8=Date.now();if(this.eventSvc.dispatchEvent({type:"tooltipHide",parentGui:this.tooltipCtrl.getGui()}),Q)this.isInteractingWithTooltip=!1;this.setToDoNothing(!0)}newTooltipComponentCallback(Q,z){if(this.state!==2||this.tooltipInstanceCount!==Q){this.destroyBean(z);return}let Z=z.getGui();if(this.tooltipComp=z,!Z.classList.contains("ag-tooltip"))Z.classList.add("ag-tooltip-custom");if(this.tooltipTrigger===0)Z.classList.add("ag-tooltip-animate");if(this.interactionEnabled)Z.classList.add("ag-tooltip-interactive");let $=this.getLocaleTextFunc(),X=this.popupSvc?.addPopup({eChild:Z,ariaLabel:$("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(Z,{mouseenter:this.onTooltipMouseEnter.bind(this),mouseleave:this.onTooltipMouseLeave.bind(this)}),[this.onDocumentKeyDownCallback]=this.addManagedElementListeners(Y0(this.beans),{keydown:(Y)=>{if(!Z.contains(Y?.target))this.onKeyDown()}}),this.tooltipTrigger===1)[this.tooltipFocusInListener,this.tooltipFocusOutListener]=this.addManagedElementListeners(Z,{focusin:this.onTooltipFocusIn.bind(this),focusout:this.onTooltipFocusOut.bind(this)})}this.eventSvc.dispatchEvent({type:"tooltipShow",tooltipGui:Z,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 Q=this.tooltipComp?.getGui(),z=d(this.beans);return!!Q&&Q.contains(z)}onTooltipFocusOut(Q){let z=this.tooltipCtrl.getGui();if(this.isTooltipFocused())return;if(this.isInteractingWithTooltip=!1,z.contains(Q.relatedTarget))this.startHideTimeout();else this.hideTooltip()}positionTooltip(){let Q={type:"tooltip",ePopup:this.tooltipComp.getGui(),nudgeY:18,skipObserver:this.tooltipMouseTrack};if(this.lastMouseEvent)this.popupSvc?.positionPopupUnderMouseEvent({...Q,mouseEvent:this.lastMouseEvent});else this.popupSvc?.positionPopupByComponent({...Q,eventSource:this.tooltipCtrl.getGui(),position:"under",keepWithinBounds:!0,nudgeY:5})}destroyTooltipComp(){this.tooltipComp.getGui().classList.add("ag-tooltip-hiding");let Q=this.tooltipPopupDestroyFunc,z=this.tooltipComp,J=this.tooltipTrigger===0?hK:0;window.setTimeout(()=>{Q(),this.destroyBean(z)},J),this.clearTooltipListeners(),this.tooltipPopupDestroyFunc=void 0,this.tooltipComp=void 0}clearTooltipListeners(){for(let Q of[this.tooltipMouseEnterListener,this.tooltipMouseLeaveListener,this.tooltipFocusInListener,this.tooltipFocusOutListener])if(Q)Q();this.tooltipMouseEnterListener=this.tooltipMouseLeaveListener=this.tooltipFocusInListener=this.tooltipFocusOutListener=null}lockService(){mJ=!0,this.interactiveTooltipTimeoutId=window.setTimeout(()=>{this.unlockService(),this.setToDoNothing()},E8)}unlockService(){mJ=!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()}},mK=class extends XX{constructor(Q,z,J){super(Q,J);this.highlightTracker=z,this.onHighlight=this.onHighlight.bind(this)}postConstruct(){super.postConstruct(),this.wireHighlightListeners()}wireHighlightListeners(){this.addManagedPropertyListener("tooltipTrigger",({currentValue:Q})=>{this.setTooltipMode(Q)}),this.setTooltipMode(this.gos.get("tooltipTrigger")),this.highlightTracker.addEventListener("itemHighlighted",this.onHighlight)}onHighlight(Q){if(this.tooltipMode!==1)return;if(Q.highlighted)this.attemptToShowTooltip();else this.attemptToHideTooltip()}setTooltipMode(Q="focus"){this.tooltipMode=Q==="focus"?1:0}destroy(){this.highlightTracker.removeEventListener("itemHighlighted",this.onHighlight),super.destroy()}},cK=class extends a5{constructor(){super({tag:"div",cls:"ag-tooltip"})}init(Q){let{value:z}=Q,J=this.getGui();J.textContent=ZJ(z);let Z=Q.location.replace(/([a-z])([A-Z0-9])/g,"$1-$2").toLowerCase();J.classList.add(`ag-${Z}-tooltip`)}},pK=".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}}",cJ=0,iK=200,nK=class extends j0{constructor(){super(...arguments);this.beanName="popupSvc",this.popupList=[]}postConstruct(){this.addManagedEventListeners({stylesChanged:this.handleThemeChange.bind(this)})}getPopupParent(){let Q=this.gos.get("popupParent");if(Q)return Q;return this.getDefaultPopupParent()}positionPopupUnderMouseEvent(Q){let{ePopup:z,nudgeX:J,nudgeY:Z,skipObserver:$}=Q;this.positionPopup({ePopup:z,nudgeX:J,nudgeY:Z,keepWithinBounds:!0,skipObserver:$,updatePosition:()=>this.calculatePointerAlign(Q.mouseEvent),postProcessCallback:()=>this.callPostProcessPopup(Q.additionalParams,Q.type,Q.ePopup,null,Q.mouseEvent)})}calculatePointerAlign(Q){let z=this.getParentRect();return{x:Q.clientX-z.left,y:Q.clientY-z.top}}positionPopupByComponent(Q){let{ePopup:z,nudgeX:J,nudgeY:Z,keepWithinBounds:$,eventSource:X,alignSide:Y="left",position:G="over",type:q}=Q,H=X.getBoundingClientRect(),_=this.getParentRect();this.setAlignedTo(X,z);let U=()=>{let W=H.left-_.left;if(Y==="right")W-=z.offsetWidth-H.width;let B;if(G==="over")B=H.top-_.top,this.setAlignedStyles(z,"over");else if(this.setAlignedStyles(z,"under"),this.shouldRenderUnderOrAbove(z,H,_,Q.nudgeY||0)==="under")B=H.top-_.top+H.height;else B=H.top-z.offsetHeight-(Z||0)*2-_.top;return{x:W,y:B}};this.positionPopup({ePopup:z,nudgeX:J,nudgeY:Z,keepWithinBounds:$,updatePosition:U,postProcessCallback:()=>this.callPostProcessPopup(Q.additionalParams,q,z,X,null)})}positionPopupForMenu(Q){let{eventSource:z,ePopup:J,event:Z}=Q,$=z.getBoundingClientRect(),X=this.getParentRect();this.setAlignedTo(z,J);let Y=!1,G=()=>{let q=this.keepXYWithinBounds(J,$.top-X.top,0),H=J.clientWidth>0?J.clientWidth:200;if(!Y)J.style.minWidth=`${H}px`,Y=!0;let U=X.right-X.left-H,W;if(this.gos.get("enableRtl")){if(W=E(),W<0)W=B(),this.setAlignedStyles(J,"left");if(W>U)W=0,this.setAlignedStyles(J,"right")}else{if(W=B(),W>U)W=E(),this.setAlignedStyles(J,"right");if(W<0)W=0,this.setAlignedStyles(J,"left")}return{x:W,y:q};function B(){return $.right-X.left-2}function E(){return $.left-X.left-H}};this.positionPopup({ePopup:J,keepWithinBounds:!0,updatePosition:G,postProcessCallback:()=>this.callPostProcessPopup(Q.additionalParams,"subMenu",J,z,Z instanceof MouseEvent?Z:void 0)})}shouldRenderUnderOrAbove(Q,z,J,Z){let $=J.bottom-z.bottom,X=z.top-J.top,Y=Q.offsetHeight+Z;if($>Y)return"under";if(X>Y||X>$)return"above";return"under"}setAlignedStyles(Q,z){let J=this.getPopupIndex(Q);if(J===-1)return;let Z=this.popupList[J],{alignedToElement:$}=Z;if(!$)return;let X=["right","left","over","above","under"];for(let Y of X)$.classList.remove(`ag-has-popup-positioned-${Y}`),Q.classList.remove(`ag-popup-positioned-${Y}`);if(!z)return;$.classList.add(`ag-has-popup-positioned-${z}`),Q.classList.add(`ag-popup-positioned-${z}`)}setAlignedTo(Q,z){let J=this.getPopupIndex(z);if(J!==-1){let Z=this.popupList[J];Z.alignedToElement=Q}}positionPopup(Q){let{ePopup:z,keepWithinBounds:J,nudgeX:Z,nudgeY:$,skipObserver:X,updatePosition:Y}=Q,G={width:0,height:0},q=(H=!1)=>{let{x:_,y:U}=Y();if(H&&z.clientWidth===G.width&&z.clientHeight===G.height)return;if(G.width=z.clientWidth,G.height=z.clientHeight,Z)_+=Z;if($)U+=$;if(J)_=this.keepXYWithinBounds(z,_,1),U=this.keepXYWithinBounds(z,U,0);if(z.style.left=`${_}px`,z.style.top=`${U}px`,Q.postProcessCallback)Q.postProcessCallback()};if(q(),!X){let H=DQ(this.beans,z,()=>q(!0));setTimeout(()=>H(),iK)}}getParentRect(){let Q=Y0(this.beans),z=this.getPopupParent();if(z===Q.body)z=Q.documentElement;else if(getComputedStyle(z).position==="static")z=z.offsetParent;return N8(z)}keepXYWithinBounds(Q,z,J){let Z=J===0,$=Z?"clientHeight":"clientWidth",X=Z?"top":"left",Y=Z?"height":"width",G=Z?"scrollTop":"scrollLeft",q=Y0(this.beans),H=q.documentElement,_=this.getPopupParent(),U=Q.getBoundingClientRect(),W=_.getBoundingClientRect(),B=q.documentElement.getBoundingClientRect(),E=_===q.body,K=Math.ceil(U[Y]),F=E?(Z?x8:w8)(H)+H[G]:_[$];if(E)F-=Math.abs(B[X]-W[X]);let D=F-K;return Math.min(Math.max(z,0),Math.max(D,0))}addPopup(Q){let{eChild:z,ariaLabel:J,ariaOwns:Z,alwaysOnTop:$,positionCallback:X,anchorToElement:Y}=Q,G=this.getPopupIndex(z);if(G!==-1)return{hideFunc:this.popupList[G].hideFunc};this.initialisePopupPosition(z);let q=this.createPopupWrapper(z,!!$,J,Z),H=this.addEventListenersToPopup({...Q,wrapperEl:q});if(X)X();return this.addPopupToPopupList(z,q,H,Y),{hideFunc:H}}initialisePopupPosition(Q){let J=this.getPopupParent().getBoundingClientRect();if(!T(Q.style.top))Q.style.top=`${J.top*-1}px`;if(!T(Q.style.left))Q.style.left=`${J.left*-1}px`}createPopupWrapper(Q,z,J,Z){let $=this.getPopupParent(),{environment:X,gos:Y}=this.beans,G=K0({tag:"div"});if(X.applyThemeClasses(G),G.classList.add("ag-popup"),Q.classList.add(Y.get("enableRtl")?"ag-rtl":"ag-ltr","ag-popup-child"),!Q.hasAttribute("role"))H0(Q,"dialog");if(J)E0(Q,J);else if(Z)Q.id||(Q.id=`popup-component-${cJ}`),W7(Z,Q.id);if(G.appendChild(Q),$.appendChild(G),z)this.setAlwaysOnTop(Q,!0);else this.bringPopupToFront(Q);return G}addEventListenersToPopup(Q){let z=this.beans,J=Y0(z),{wrapperEl:Z,eChild:$,closedCallback:X,afterGuiAttached:Y,closeOnEsc:G,modal:q,ariaOwns:H}=Q,_=!1,U=(K)=>{if(!Z.contains(d(z)))return;if(K.key===V.ESCAPE&&!this.isStopPropagation(K))E({keyboardEvent:K})},W=(K)=>E({mouseEvent:K}),B=(K)=>E({touchEvent:K}),E=(K={})=>{let{mouseEvent:L,touchEvent:F,keyboardEvent:D,forceHide:M}=K;if(!M&&(this.isEventFromCurrentPopup({mouseEvent:L,touchEvent:F},$)||_))return;if(_=!0,Z.remove(),J.removeEventListener("keydown",U),J.removeEventListener("mousedown",W),J.removeEventListener("touchstart",B),J.removeEventListener("contextmenu",W),this.eventSvc.removeListener("dragStarted",W),X)X(L||F||D);this.removePopupFromPopupList($,H)};if(Y)Y({hidePopup:E});return window.setTimeout(()=>{if(G)J.addEventListener("keydown",U);if(q)J.addEventListener("mousedown",W),this.eventSvc.addListener("dragStarted",W),J.addEventListener("touchstart",B),J.addEventListener("contextmenu",W)},0),E}addPopupToPopupList(Q,z,J,Z){if(this.popupList.push({element:Q,wrapper:z,hideFunc:J,instanceId:cJ,isAnchored:!!Z}),Z)this.setPopupPositionRelatedToElement(Q,Z);cJ=cJ+1}getPopupIndex(Q){return this.popupList.findIndex((z)=>z.element===Q)}setPopupPositionRelatedToElement(Q,z){let J=this.getPopupIndex(Q);if(J===-1)return;let Z=this.popupList[J];if(Z.stopAnchoringPromise)Z.stopAnchoringPromise.then((X)=>X&&X());if(Z.stopAnchoringPromise=void 0,Z.isAnchored=!1,!z)return;let $=this.keepPopupPositionedRelativeTo({element:z,ePopup:Q,hidePopup:Z.hideFunc});return Z.stopAnchoringPromise=$,Z.isAnchored=!0,$}removePopupFromPopupList(Q,z){if(this.setAlignedStyles(Q,null),this.setPopupPositionRelatedToElement(Q,null),z)W7(z,null);this.popupList=this.popupList.filter((J)=>J.element!==Q)}keepPopupPositionedRelativeTo(Q){let z=this.getPopupParent(),J=z.getBoundingClientRect(),{element:Z,ePopup:$}=Q,X=Z.getBoundingClientRect(),Y=(U)=>Number.parseInt(U.substring(0,U.length-1),10),G=(U,W)=>{let B=J[U]-X[U],E=Y($.style[U]);return{initialDiff:B,lastDiff:B,initial:E,last:E,direction:W}},q=G("top",0),H=G("left",1),_=this.beans.frameworkOverrides;return new g((U)=>{_.wrapIncoming(()=>{Hq(()=>{let W=z.getBoundingClientRect(),B=Z.getBoundingClientRect();if(B.top==0&&B.left==0&&B.height==0&&B.width==0){Q.hidePopup();return}let K=(L,F)=>{let D=Y($.style[F]);if(L.last!==D)L.initial=D,L.last=D;let M=W[F]-B[F];if(M!=L.lastDiff){let k=this.keepXYWithinBounds($,L.initial+L.initialDiff-M,L.direction);$.style[F]=`${k}px`,L.last=k}L.lastDiff=M};K(q,"top"),K(H,"left")},200).then((W)=>{U(()=>{if(W!=null)window.clearInterval(W)})})},"popupPositioning")})}isEventFromCurrentPopup(Q,z){let{mouseEvent:J,touchEvent:Z}=Q,$=J?J:Z;if(!$)return!1;let X=this.getPopupIndex(z);if(X===-1)return!1;for(let Y=X;YQ.element)}hasAnchoredPopup(){return this.popupList.some((Q)=>Q.isAnchored)}isStopPropagation(Q){return zQ(Q)}},nz={moduleName:"Popup",version:p,beans:[dK]};function KZ(Q){return Q.get("tooltipShowMode")==="whenTruncated"}function tZ(Q,z){return KZ(Q)?i1(z):void 0}var tK=(Q,z)=>{let J=Q;if(typeof J.getTranslatedMessage==="function")return J.getTranslatedMessage(z);return Q.message},k5=(Q,z,J)=>{let{editModelSvc:Z}=Q,$=Z?.getCellValidationModel()?.getCellValidation(z)?.errorMessages,X=Z?.getRowValidationModel().getRowValidation(z)?.errorMessages,Y=$||X;return Y?.length?Y.join(J("tooltipValidationErrorSeparator",". ")):void 0},rK=(Q,z)=>{if(!KZ(Q.gos))return;if(z.isCellRenderer()){let Z=z.column.getColDef();if(!(!!Z.showRowGroup||Z.cellRenderer==="agGroupCellRenderer"))return;return i1(()=>{let X=z.eGui;return X.querySelector(".ag-group-value")||X.querySelector(".ag-cell-value")||X})}return i1(()=>{let Z=z.eGui;return Z.children.length===0?Z:Z.querySelector(".ag-cell-value")})},sK=(Q,z,J)=>{let{editSvc:Z}=Q,{column:$}=z,X=rK(Q,z),Y=()=>{if(Z?.isEditing(z))return!1;if(!X)return!0;if(!$.isTooltipEnabled())return!1;return X()};return{shouldDisplayDefault:Y,shouldDisplayColumnTooltip:Y,shouldDisplayCustomTooltip:J??Y}},lK=({beans:Q,ctrl:z,value:J,displayFunctions:Z,translate:$})=>{let{editSvc:X,formula:Y,gos:G}=Q,{column:q,rowNode:H}=z;if(Y?.active&&q.isAllowFormula()){let L=Y.getFormulaError(q,H);if(L)return{value:tK(L,$),location:"cellFormula",shouldDisplay:()=>!!Y?.getFormulaError(q,H)}}if(!X?.isEditing(z)){let L=k5(Q,z,$);if(L)return{value:L,location:"cellEditor",shouldDisplay:()=>!X?.isEditing(z)&&!!k5(Q,z,$)}}let{shouldDisplayCustomTooltip:U,shouldDisplayColumnTooltip:W}=Z;if(J!=null)return{value:J,location:"cell",shouldDisplay:U};let B=q.getColDef(),E=H.data;if(B.tooltipField&&T(E))return{value:h1(E,B.tooltipField,q.isTooltipFieldContainsDots()),location:"cell",shouldDisplay:W};let K=B.tooltipValueGetter;if(K)return{value:K(y(G,{location:"cell",colDef:q.getColDef(),column:q,rowIndex:z.cellPosition.rowIndex,node:H,data:H.data,value:z.value,valueFormatted:z.valueFormatted})),location:"cell",shouldDisplay:W};return null},aK=class extends j{constructor(){super(...arguments);this.beanName="tooltipSvc"}setupHeaderTooltip(Q,z,J,Z){if(Q)z.destroyBean(Q);let $=this.gos,X=KZ($),{column:Y,eGui:G}=z,q=Y.getColDef();if(!Z&&X&&!q.headerComponent)Z=i1(()=>G.querySelector(".ag-header-cell-text"));let H="header",_="header",U=this.beans.colNames.getDisplayNameForColumn(Y,_,!0),W=J??U,B={getGui:()=>G,getLocation:()=>H,getTooltipValue:()=>J??q?.headerTooltipValueGetter?.(y($,{location:H,colDef:q,column:Y,value:W,valueFormatted:U}))??q?.headerTooltip,shouldDisplayTooltip:Z,getAdditionalParams:()=>({column:Y,colDef:Y.getColDef()})},E=this.createTooltipFeature(B);if(E)E=z.createBean(E),z.setRefreshFunction("tooltip",()=>E.refreshTooltip());return E}setupHeaderGroupTooltip(Q,z,J,Z){if(Q)z.destroyBean(Q);let $=this.gos,X=KZ($),{column:Y,eGui:G}=z,q=Y.getColGroupDef();if(!Z&&X&&!q?.headerGroupComponent)Z=i1(()=>G.querySelector(".ag-header-group-text"));let H="headerGroup",_="header",U=this.beans.colNames.getDisplayNameForColumnGroup(Y,_),W=J??U,B={getGui:()=>G,getLocation:()=>H,getTooltipValue:()=>J??q?.headerTooltipValueGetter?.(y($,{location:H,colDef:q,column:Y,value:W,valueFormatted:U}))??q?.headerTooltip,shouldDisplayTooltip:Z,getAdditionalParams:()=>{let K={column:Y};if(q)K.colDef=q;return K}},E=this.createTooltipFeature(B);return E?z.createBean(E):E}enableCellTooltipFeature(Q,z,J){let{beans:Z}=this,{column:$,rowNode:X}=Q,Y=sK(Z,Q,J),G=this.getLocaleTextFunc(),q=null,H=()=>{return q=lK({beans:Z,ctrl:Q,value:z,displayFunctions:Y,translate:G}),q},U={getGui:()=>Q.eGui,getLocation:()=>q?.location??"cell",getTooltipValue:()=>H()?.value,shouldDisplayTooltip:()=>{let W=q??H();if(!W)return!1;return W.shouldDisplay?W.shouldDisplay():!0},getAdditionalParams:()=>({column:$,colDef:$.getColDef(),rowIndex:Q.cellPosition.rowIndex,node:X,data:X.data,valueFormatted:Q.valueFormatted})};return this.createTooltipFeature(U,Z)}setupFullWidthRowTooltip(Q,z,J,Z){let $={getGui:()=>z.getFullWidthElement(),getTooltipValue:()=>J,getLocation:()=>"fullWidthRow",shouldDisplayTooltip:Z},X=this.beans,Y=X.context;if(Q)z.destroyBean(Q,Y);let G=this.createTooltipFeature($,X);if(!G)return;return z.createBean(G,Y)}setupCellEditorTooltip(Q,z){let{beans:J}=this,{context:Z}=J,$=z.getValidationElement?.(!0)||!z.isPopup?.()&&Q.eGui;if(!$)return;let X={getGui:()=>$,getTooltipValue:()=>k5(J,Q,this.getLocaleTextFunc()),getLocation:()=>"cellEditor",shouldDisplayTooltip:()=>{let{editModelSvc:G}=J,q=G?.getRowValidationModel()?.getRowValidationMap(),H=G?.getCellValidationModel()?.getCellValidationMap(),_=!!q&&q.size>0,U=!!H&&H.size>0;return _||U}},Y=this.createTooltipFeature(X,J);if(!Y)return;return Q.createBean(Y,Z)}initCol(Q){let{colDef:z}=Q;Q.tooltipEnabled=T(z.tooltipField)||T(z.tooltipValueGetter)||T(z.tooltipComponent)}createTooltipFeature(Q,z){return this.beans.registry.createDynamicBean("tooltipFeature",!1,Q,z)}},oK=class extends uK{createTooltipComp(Q,z){Nq(this.beans.userCompFactory,Q)?.newAgStackInstance().then(z)}setEventHandlers(Q){[this.onColumnMovedEventCallback]=this.addManagedEventListeners({columnMoved:Q})}clearEventHandlers(){this.onColumnMovedEventCallback?.(),this.onColumnMovedEventCallback=void 0}},eK={moduleName:"Tooltip",version:p,beans:[aK],dynamicBeans:{tooltipFeature:XX,highlightTooltipFeature:mK,tooltipStateManager:oK},userComponents:{agTooltipComponent:cK},dependsOn:[nz],css:[pK]};var QL=".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 zL=class extends j${constructor(Q,z="ag-text-field",J="text"){super(Q,z,J)}postConstruct(){if(super.postConstruct(),this.config.allowedCharPattern)this.preventDisallowedCharacters()}setValue(Q,z){let J=this.eInput;if(J.value!==Q)J.value=T(Q)?Q:"";return super.setValue(Q,z)}setStartValue(Q){this.setValue(Q,!0)}setCustomValidity(Q){let z=this.eInput,J=Q.length>0;if(z.setCustomValidity(Q),J)z.reportValidity();S8(z,J)}preventDisallowedCharacters(){let Q=new RegExp(`[${this.config.allowedCharPattern}]`),z=(J)=>{if(!e9(J))return;if(J.key&&!Q.test(J.key))J.preventDefault()};this.addManagedListeners(this.eInput,{keydown:z,paste:(J)=>{if(J.clipboardData?.getData("text")?.split("").some(($)=>!Q.test($)))J.preventDefault()}})}},T6={selector:"AG-INPUT-TEXT-FIELD",component:zL};var JL=class extends tq{constructor(Q){super();this.cellEditorInput=Q,this.eEditor=S}initialiseEditor(Q){let{cellEditorInput:z}=this;this.setTemplate({tag:"div",cls:"ag-cell-edit-wrapper",children:[z.getTemplate()]},z.getAgComponents());let{eEditor:J}=this,{cellStartedEdit:Z,eventKey:$,suppressPreventDefault:X}=Q;J.getInputElement().setAttribute("title",""),z.init(J,Q);let Y,G=!0;if(Z){if(this.focusAfterAttached=!0,$===V.BACKSPACE||$===V.DELETE)Y="";else if($&&$.length===1)if(X)G=!1;else Y=$;else if(Y=z.getStartValue(),$!==V.F2)this.highlightAllOnFocus=!0}else this.focusAfterAttached=!1,Y=z.getStartValue();if(G&&Y!=null)J.setStartValue(Y);this.addGuiEventListener("keydown",(q)=>{let{key:H}=q;if(H===V.PAGE_UP||H===V.PAGE_DOWN)q.preventDefault()})}afterGuiAttached(){let Q=this.getLocaleTextFunc(),z=this.eEditor;if(z.setInputAriaLabel(Q("ariaInputEditor","Input Editor")),!this.focusAfterAttached)return;if(!cz())z.getFocusableElement().focus();let J=z.getInputElement();if(this.highlightAllOnFocus)J.select();else this.cellEditorInput.setCaret?.()}focusIn(){let{eEditor:Q}=this,z=Q.getFocusableElement(),J=Q.getInputElement();z.focus(),J.select()}getValue(){return this.cellEditorInput.getValue()}agSetEditValue(Q){this.params.value=Q;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"},$L=class{constructor(Q){this.getLocaleTextFunc=Q}getTemplate(){return ZL}getAgComponents(){return[T6]}init(Q,z){this.eEditor=Q,this.params=z;let J=z.maxLength;if(J!=null)Q.setMaxLength(J)}getValidationErrors(){let{params:Q}=this,{maxLength:z,getValidationErrors:J}=Q,Z=this.getValue(),$=this.getLocaleTextFunc(),X=[];if(z!=null&&typeof Z==="string"&&Z.length>z)X.push($("maxLengthValidation",`Must be ${z} characters or fewer.`,[String(z)]));if(!X.length)X=null;if(J)return J({value:Z,cellEditorParams:Q,internalErrors:X});return X}getValue(){let{eEditor:Q,params:z}=this,J=Q.getValue();if(!T(J)&&!T(z.value))return z.value;return z.parseValue(J)}getStartValue(){let Q=this.params;return Q.useFormatter||Q.column.getColDef().refData?Q.formatValue(Q.value):Q.value}setCaret(){if(cz())this.eEditor.getInputElement().focus({preventScroll:!0});let Q=this.eEditor,z=Q.getValue(),J=T(z)&&z.length||0;if(J)Q.getInputElement().setSelectionRange(J,J)}},L8=class extends JL{constructor(){super(new $L(()=>this.getLocaleTextFunc()))}};function XL(Q,z){return Q.editModelSvc?.getEditRowDataValue(z,{checkSiblings:!0})}function YL(Q){let z=Q.editModelSvc?.getEditMap(),J=[];return z?.forEach((Z,$)=>{let{rowIndex:X,rowPinned:Y}=$;Z.forEach((G,q)=>{let{editorValue:H,pendingValue:_,sourceValue:U,state:W}=G,B=BQ(G),E=H??_;if(E===P0)E=void 0;let K={newValue:E,oldValue:U,state:W,column:q,colId:q.getColId(),colKey:q.getColId(),rowIndex:X,rowPinned:Y},L=W==="editing";if(L||!L&&B)J.push(K)})}),J}function GL(Q,z=!1){let{editSvc:J}=Q;if(J?.isBatchEditing()){if(z){for(let Z of Q.editModelSvc?.getEditPositions()??[])if(Z.state==="editing")J.revertSingleCellEdit(Z)}else Qz(Q,{persist:!0});eQ(Q,void 0,{cancel:z})}else J?.stopEditing(void 0,{cancel:z,source:"edit",forceStop:!z,forceCancel:z})}function qL(Q,z){let J=s(Q,z);return!!Q.editSvc?.isEditing(J)}function HL(Q,z){let{key:J,colKey:Z,rowIndex:$,rowPinned:X}=z,{editSvc:Y,colModel:G}=Q,q=G.getCol(Z);if(!q){R(12,{colKey:Z});return}let _=M0(Q,{rowIndex:$,rowPinned:X||null,column:q});if(!_){R(290,{rowIndex:$,rowPinned:X});return}if(!Y?.isCellEditable({rowNode:_,column:q},"api"))return;if(X==null)BK(Q,$);WK(Q,Z),Y?.startEditing({rowNode:_,column:q},{event:J?new KeyboardEvent("keydown",{key:J}):void 0,source:"api",editable:!0})}function _L(Q){return Q.editSvc?.validateEdit()||null}var UL={tag:"div",cls:"ag-popup-editor",attrs:{tabindex:"-1"}},WL=class extends a5{constructor(Q){super(UL);this.params=Q}postConstruct(){wz(this.gos,this.getGui(),"popupEditorWrapper",!0),this.addKeyDownListener()}addKeyDownListener(){let Q=this.getGui(),z=this.params,J=(Z)=>{if(!_5(this.gos,Z,z.node,z.column,!0))z.onKeyDown(Z)};this.addManagedElementListeners(Q,{keydown:J})}};function BL(Q,{column:z},J,Z,$="ui"){if(J instanceof KeyboardEvent&&(J.key===V.TAB||J.key===V.ENTER||J.key===V.F2||J.key===V.BACKSPACE&&Z))return!0;if(J?.shiftKey&&Q.rangeSvc?.getCellRanges().length!=0)return!1;let Y=z?.getColDef(),G=EL(Q.gos,Y),q=J?.type;if(q==="click"&&J?.detail===1&&G===1)return!0;if(q==="dblclick"&&J?.detail===2&&G===2)return!0;if($==="api")return!!Z;return!1}function EL(Q,z){if(Q.get("suppressClickEdit")===!0)return 0;if(Q.get("singleClickEdit")===!0)return 1;if(z?.singleClickEdit)return 1;return 2}function s2(Q,z){return Q.editModelSvc?.hasEdits(z,{withOpenEditor:!0})??!1}function V5(Q,z){let{column:J,rowNode:Z}=z,$=J.getColDef();if(!Z)return s2(Q,z);let X=$.editable;if(Z.group&&$.groupRowEditable!=null){if(Q.rowGroupingEditValueSvc?.isGroupCellEditable(Z,J))return!0;return s2(Q,z)}if(J.isColumnFunc(Z,X))return!0;return s2(Q,z)}function KL(Q,z,J="ui"){let Z=V5(Q,z);if(Z||J==="ui")return Z;let{rowNode:$,column:X}=z;for(let Y of Q.colModel.getCols())if(Y!==X&&V5(Q,{rowNode:$,column:Y}))return!0;return!1}var LZ=(Q,z=!1)=>{if(Q!==void 0)return BQ(Q)||z&&Q.state==="editing"};function YX(Q,z,J=!1){return LZ(Q.editModelSvc?.getEdit(z),J)}var GX=(Q,z,J)=>{if(!Q)return;for(let Z=0,$=Q.length;Z<$;++Z){let X=Q[Z];if(X.data){if(LZ(z?.getEdit({rowNode:X,column:J}))||LZ(z?.getEdit({rowNode:X.pinnedSibling,column:J})))return!0}if(GX(X.childrenAfterGroup,z,J))return!0}};function qX(Q,z){let{column:J,rowNode:Z}=z;if(Q.gos.get("groupTotalRow")&&!Z?.footer)return!1;return GX(Z?.childrenAfterGroup,Q.editModelSvc,J)}function HX(Q,{rowNode:z,column:J}){if(z=z.pinnedSibling,!z)return;return LZ(Q.editModelSvc?.getEdit({rowNode:z,column:J}))}var LL=class extends j{constructor(Q,z){super();this.cellCtrl=Q,this.beans=z,this.editSvc=z.editSvc,this.editModelSvc=z.editModelSvc}setComp(Q){this.cellComp=Q,this.applyCellStyles()}applyCellStyles(){let{cellCtrl:Q,editSvc:z,beans:J}=this;if(z?.isBatchEditing()&&z.isEditing()){let $=YX(J,Q)||qX(J,Q)||HX(J,Q);this.applyBatchingStyle($)}else this.applyBatchingStyle(!1);let Z=!!this.editModelSvc?.getCellValidationModel().hasCellValidation(this.cellCtrl);this.cellComp.toggleCss("ag-cell-editing-error",Z)}applyBatchingStyle(Q){this.cellComp.toggleCss("ag-cell-editing",Q??!1),this.cellComp.toggleCss("ag-cell-batch-edit",(Q&&this.editSvc?.isBatchEditing())??!1)}},FL=class extends j{constructor(Q,z){super();this.rowCtrl=Q,this.beans=z,this.gos=z.gos,this.editSvc=z.editSvc,this.editModelSvc=z.editModelSvc}applyRowStyles(){let{rowCtrl:Q,editModelSvc:z,beans:J}=this,Z=Q.rowNode,$=z?.getEditRow(Z),X=this.editModelSvc?.getRowValidationModel().hasRowValidation({rowNode:Z});if(!$&&Z.pinnedSibling)Z=Z.pinnedSibling,$=z?.getEditRow(Z);if($){let Y=Array.from($.keys()).some((G)=>{let q={rowNode:Z,column:G};return YX(J,q,!0)||qX(J,q)||HX(J,q)});this.applyStyle(X,Y);return}this.applyStyle(X)}applyStyle(Q=!1,z=!1){let J=!!this.editSvc?.isBatchEditing(),Z=this.gos.get("editType")==="fullRow";this.rowCtrl?.forEachGui(void 0,({rowComp:$})=>{$.toggleCss("ag-row-editing",Z&&z),$.toggleCss("ag-row-batch-edit",Z&&z&&J),$.toggleCss("ag-row-inline-editing",z),$.toggleCss("ag-row-not-inline-editing",!z),$.toggleCss("ag-row-editing-invalid",Z&&z&&Q)})}},DL=({rowModel:Q,pinnedRowModel:z,editModelSvc:J},Z)=>{let $=new Set;Q.forEachNode((X)=>Z.has(X)&&$.add(X)),z?.forEachPinnedRow("top",(X)=>Z.has(X)&&$.add(X)),z?.forEachPinnedRow("bottom",(X)=>Z.has(X)&&$.add(X));for(let X of Z)if(!$.has(X))J.removeEdits({rowNode:X});return $},ML=({editModelSvc:Q},z,J)=>{for(let Z of z)Q?.getEditRow(Z)?.forEach(($,X)=>!J.has(X)&&Q.removeEdits({rowNode:Z,column:X}))},kL=(Q)=>()=>{let z=new Set(Q.colModel.getCols()),J=Q.editModelSvc.getEditMap(!0),Z=new Set(J.keys());ML(Q,DL(Q,Z),z)},VL=new Set(["undo","redo","paste","bulk","rangeSvc"]),fL=new Set(["ui","api"]),_X={paste:"api",rangeSvc:"api",fillHandle:"api",cellClear:"api",bulk:"api"},AL=new Set(Object.keys(_X)),jL=new Set(["paste","rangeSvc","cellClear","redo","undo"]),l2={cancel:!0,source:"api"},RL={cancel:!1,source:"api"},Rz={checkSiblings:!0},lQ={force:!0,suppressFlash:!0},SL={force:!0},OL=class extends j{constructor(){super(...arguments);this.beanName="editSvc",this.committing=!1,this.batch=!1,this.batchStartDispatched=!1,this.stopping=!1,this.rangeSelectionWhileEditing=0}postConstruct(){let{beans:Q}=this;this.model=Q.editModelSvc,this.valueSvc=Q.valueSvc,this.rangeSvc=Q.rangeSvc,this.addManagedPropertyListener("editType",({currentValue:Z})=>{this.stopEditing(void 0,l2),this.createStrategy(Z)});let z=kL(Q),J=()=>{let Z=this.model.getCellValidationModel().getCellValidationMap().size>0,$=this.model.getRowValidationModel().getRowValidationMap().size>0;if(Z||$)this.stopEditing(void 0,l2);else if(this.isEditing())if(this.batch)eQ(Q,this.model.getEditPositions());else this.stopEditing(void 0,RL);return!1};this.addManagedEventListeners({columnPinned:z,columnVisible:z,columnRowGroupChanged:z,rowExpansionStateChanged:z,pinnedRowsChanged:z,displayedRowsChanged:z,sortChanged:J,filterChanged:J,cellFocused:this.onCellFocused.bind(this)})}isBatchEditing(){return this.batch}startBatchEditing(){if(this.batch)return;this.batch=!0,this.batchStartDispatched=!1,this.stopEditing(void 0,l2)}stopBatchEditing(Q){if(!this.batch)return;if(Q)this.stopEditing(void 0,Q);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(Q){let{beans:z,gos:J,strategy:Z}=this,$=F8(J,Q);if(Z){if(Z.beanName===$)return Z;this.destroyStrategy()}return this.strategy=this.createOptionalManagedBean(z.registry.createDynamicBean($,!0))}destroyStrategy(){if(!this.strategy)return;this.strategy.destroy(),this.strategy=this.destroyBean(this.strategy)}shouldStartEditing(Q,z,J,Z="ui"){let $=BL(this.beans,Q,z,J,Z);if($)this.strategy??(this.strategy=this.createStrategy());return $}shouldStopEditing(Q,z,J="ui"){return this.strategy?.shouldStop(Q,z,J)??null}shouldCancelEditing(Q,z,J="ui"){return this.strategy?.shouldCancel(Q,z,J)??null}validateEdit(){return m3(this.beans)}isEditing(Q,z){return this.model.hasEdits(Q??void 0,z??Rz)}isRowEditing(Q,z){return!!Q&&this.model.hasRowEdits(Q,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(Q,z){let{startedEdit:J=!0,event:Z=null,source:$="ui",ignoreEventKey:X=!1,silent:Y}=z;if(this.strategy??(this.strategy=this.createStrategy()),!(z.editable??this.isCellEditable(Q,"api")))return;let q=s(this.beans,Q);if(q&&!q.comp){z.editable=void 0,q.onCompAttachedFuncs.push(()=>this.startEditing(Q,z));return}let H=this.shouldStartEditing(Q,Z,J,$);if(H===!1&&$!=="api"){if(this.isEditing(Q))this.stopEditing();return}if(!this.batch&&this.shouldStopEditing(Q,void 0,$)&&!z.continueEditing)this.stopEditing(void 0,{source:$});if(H)this.ensureBatchStarted();this.strategy.start({position:Q,event:Z,source:$,ignoreEventKey:X,startedEdit:J,silent:Y})}stopEditing(Q,z){let J=this.prepareStopContext(Q,z);if(!J)return!1;this.stopping=!0;let Z=!1,{edits:$}=J;try{let X=this.processStopRequest(J);return Z||(Z=X.res),$=X.edits,this.finishStopEditing({...J,edits:$,params:z,position:Q,res:Z}),Z}finally{this.rangeSelectionWhileEditing=0,this.stopping=!1}}prepareStopContext(Q,z){let{event:J=null,cancel:Z=!1,source:$="ui",forceCancel:X=!1,forceStop:Y=!1,commit:G=!1}=z||{};if(AL.has($)&&this.batch){if(Q?.rowNode&&Q?.column)this.bulkRefreshCell(Q);return null}let q=this.committing?_X[$]:$;if(!(this.committing||this.isEditing(Q)||this.batch&&this.model.hasEdits(Q,Rz))||!this.strategy||this.stopping)return null;let _=s(this.beans,Q);if(_)_.onEditorAttachedFuncs=[];let U=!Z&&(!!this.shouldStopEditing(Q,J,q)||(this.committing||$==="paste")&&!this.batch)||Y,W=Z&&!!this.shouldCancelEditing(Q,J,q)||X;return{cancel:Z,cellCtrl:_,edits:this.model.getEditMap(!0),event:J??null,forceCancel:X,forceStop:Y,commit:G,position:Q,source:$,treatAsSource:q,willCancel:W,willStop:U}}processStopRequest(Q){let{event:z,position:J,willCancel:Z,willStop:$}=Q;if($||Z)return this.handleStopOrCancel(Q);if(this.shouldHandleMidBatchKey(z,J))return{res:!1,edits:this.handleMidBatchKey(z,J,Q)};if(Qz(this.beans,{persist:!0}),this.batch)this.strategy?.cleanupEditors(J);return{res:!1,edits:this.model.getEditMap()}}handleStopOrCancel(Q){let{beans:z,model:J}=this,{cancel:Z,commit:$,edits:X,event:Y,source:G,willCancel:q,willStop:H}=Q,_=!this.batch||!q;Qz(z,{persist:_,isCancelling:q||Z,isStopping:H});let U=J.getEditMap(),B=!q&&(!this.batch||$)?this.processEdits(U,G):[];if(Z)this.strategy?.stopCancelled(Q.forceCancel);else this.strategy?.stopCommitted(Y,$);this.clearValidationIfNoOpenEditors();for(let E of B)J.clearEditValue(E);this.bulkRefreshMap(X);for(let E of J.getEditPositions(U)){let K=s(z,E),L=BQ(E);K?.refreshCell({force:!0,suppressFlash:!L})}return{res:H,edits:U}}shouldHandleMidBatchKey(Q,z){return Q instanceof KeyboardEvent&&this.batch&&!!this.strategy?.midBatchInputsAllowed(z)&&this.isEditing(z,{withOpenEditor:!0})}handleMidBatchKey(Q,z,J){let{beans:Z,model:$}=this,{cellCtrl:X,edits:Y}=J,{key:G}=Q,q=G===V.ENTER,H=G===V.ESCAPE,_=G===V.TAB;if(q||_||H){if(q||_)Qz(Z,{persist:!0});else if(H&&X){let{rowNode:U,column:W}=X;if(this.batch&&U&&W){let B={rowNode:U,column:W};eQ(Z,[B],{silent:!0}),this.model.stop(B,!0,!0),s(Z,B)?.refreshCell(lQ)}else this.revertSingleCellEdit(X)}if(this.batch)this.strategy?.cleanupEditors();else eQ(Z,$.getEditPositions(),{event:Q,cancel:H});return Q.preventDefault(),this.bulkRefreshMap(Y,{suppressFlash:!0}),$.getEditMap()}return Y}finishStopEditing({cellCtrl:Q,edits:z,params:J,position:Z,res:$,commit:X,forceCancel:Y,willCancel:G,willStop:q}){let H=this.beans;if($&&Z){if(!this.batch||X)this.model.removeEdits(Z)}this.navigateAfterEdit(J,Q?.cellPosition),x1(H),this.clearValidationIfNoOpenEditors();let{rowRenderer:_,formula:U}=H;if(G)_.refreshRows({rowNodes:Array.from(z.keys())});if(this.batch){if(U)U.refreshFormulas(!0);else _.refreshRows({suppressFlash:!0,force:!0});let W=q&&X;if(W||G&&Y)this.dispatchBatchStopped(z,W)}}dispatchBatchStopped(Q,z){let J;if(z){if(J=b3(Q),J.size>0)this.ensureBatchStarted()}if(this.batchStartDispatched)this.batchStartDispatched=!1,this.dispatchBatchEvent("batchEditingStopped",J??new Map)}clearValidationIfNoOpenEditors(){if(!this.model.hasEdits(void 0,{withOpenEditor:!0}))this.model.getCellValidationModel().clearCellValidationMap(),this.model.getRowValidationModel().clearRowValidationMap()}navigateAfterEdit(Q,z){if(!Q||!z)return;let{event:J,suppressNavigateAfterEdit:Z}=Q;if(!(J instanceof KeyboardEvent)||Z)return;let{key:X,shiftKey:Y}=J,G=this.gos.get("enterNavigatesVerticallyAfterEdit");if(X!==V.ENTER||!G)return;let q=Y?V.UP:V.DOWN;this.beans.navigation?.navigateToNextCell(null,q,z,!1)}processEdits(Q,z){let J=Array.from(Q.keys()),Z=this.model.getCellValidationModel().getCellValidationMap().size>0||this.model.getRowValidationModel().getRowValidationMap().size>0,$=[],{changeDetectionSvc:X}=this.beans;X?.beginDeferred();try{for(let Y of J){let G=Q.get(Y);for(let q of G.keys()){let H=G.get(q),_={rowNode:Y,column:q};if(BQ(H)&&!Z){let U=s(this.beans,_);if(!this.setNodeDataValue(Y,q,H.pendingValue,U,z))$.push(_)}}}}finally{X?.endDeferred()}return $}setNodeDataValue(Q,z,J,Z,$="edit"){let X=fL.has($)?"edit":$;if(Z)Z.suppressRefreshCell=!0;this.committing=!0;try{return Q.setDataValue(z,J,X)}finally{if(this.committing=!1,Z)Z.suppressRefreshCell=!1}}syncEditAfterCommit(Q,z){let J=this.model.getEdit(Q);if(J&&J.state!=="editing")if(z)this.beans.editModelSvc?.setEdit(Q,{sourceValue:J.pendingValue});else this.model.clearEditValue(Q)}setEditMap(Q,z){this.strategy??(this.strategy=this.createStrategy()),this.strategy?.setEditMap(Q,z),this.bulkRefreshMap(Q);let J=lQ;if(z?.forceRefreshOfEditCellsOnly)J={...PL(Q),...lQ};this.beans.rowRenderer.refreshCells(J)}dispatchEditValuesChanged({rowNode:Q,column:z},J={}){if(!Q||!z||!J)return;let{pendingValue:Z,sourceValue:$}=J,{rowIndex:X,rowPinned:Y,data:G}=Q;this.beans.eventSvc.dispatchEvent({type:"cellEditValuesChanged",node:Q,rowIndex:X,rowPinned:Y,column:z,source:"api",data:G,newValue:Z,oldValue:$,value:Z,colDef:z.getColDef()})}bulkRefreshCell(Q,z){if(o(this.gos,this.beans.rowModel))this.refCell(Q,this.model.getEdit(Q),z)}bulkRefreshMap(Q,z){if(o(this.gos,this.beans.rowModel))Q.forEach((J,Z)=>{for(let $ of J.keys())this.refCell({rowNode:Z,column:$},J.get($),z)})}refCell({rowNode:Q,column:z},J,Z={}){let{beans:$,gos:X}=this,Y=new Set([Q]),G=new Set,q=Q.pinnedSibling;if(q)Y.add(q);let H=Q.sibling;if(H)G.add(H);let _=Q.parent;while(_){if(_.sibling?.footer&&X.get("groupTotalRow"))G.add(_.sibling);else if(!_.parent&&_.sibling&&X.get("grandTotalRow"))G.add(_.sibling);else G.add(_);_=_.parent}for(let U of Y)this.dispatchEditValuesChanged({rowNode:U,column:z},J);for(let U of Y)s($,{rowNode:U,column:z})?.refreshCell(Z);for(let U of G){let W=s($,{rowNode:U,column:z});if(W){if(W.refreshCell(Z),!Z.force&&this.batch)W.editStyleFeature?.applyCellStyles?.()}}}stopAllEditing(Q=!1,z="ui"){if(this.isEditing())this.stopEditing(void 0,{cancel:Q,source:z})}isCellEditable(Q,z="ui"){let{gos:J,beans:Z}=this,$=Q.rowNode;if($.group&&Q.column.getColDef().groupRowEditable==null){if(J.get("treeData")){if(!$.data&&!J.get("enableGroupEdit"))return!1}else if(!J.get("enableGroupEdit"))return!1}let X=F8(J)==="fullRow"?KL(Z,Q,z):V5(Z,Q);if(X)this.strategy??(this.strategy=this.createStrategy());return X}cellEditingInvalidCommitBlocks(){return this.gos.get("invalidEditValueMode")==="block"}checkNavWithValidation(Q,z,J=!0){if(this.hasValidationErrors(Q)){let Z=s(this.beans,Q);if(this.cellEditingInvalidCommitBlocks()){if(z?.preventDefault?.(),J){if(Z&&!Z.hasBrowserFocus())Z.focusCell();Z?.comp?.getCellEditor()?.focusIn?.()}return"block-stop"}if(Z)this.revertSingleCellEdit(Z);return"revert-continue"}return"continue"}revertSingleCellEdit(Q,z=!1){let J=s(this.beans,Q);if(!J?.comp?.getCellEditor())return;if(eQ(this.beans,[Q],{silent:!0}),this.model.clearEditValue(Q),gz(this.beans,Q,{silent:!0}),Yz(this.beans),J?.refreshCell(lQ),!z)return;J?.focusCell(),J?.comp?.getCellEditor()?.focusIn?.()}hasValidationErrors(Q){Yz(this.beans);let z=s(this.beans,Q);if(z)z.refreshCell(lQ),z.rowCtrl.rowEditStyleFeature?.applyRowStyles();let J=!1;if(Q?.rowNode){if(J||(J=this.model.getRowValidationModel().hasRowValidation({rowNode:Q.rowNode})),Q.column)J||(J=this.model.getCellValidationModel().hasCellValidation({rowNode:Q.rowNode,column:Q.column}))}else J||(J=this.model.getCellValidationModel().getCellValidationMap().size>0),J||(J=this.model.getRowValidationModel().getRowValidationMap().size>0);return J}moveToNextCell(Q,z,J,Z="ui"){let $,X=this.isEditing(),Y=X&&this.checkNavWithValidation(void 0,J)==="block-stop";if(Q instanceof u1&&X)$=this.strategy?.moveToNextEditingCell(Q,z,J,Z,Y);if($===null)return $;if($=$||!!this.beans.focusSvc.focusedHeader,$===!1&&!Y)this.stopEditing();return $}getPendingEditValue(Q,z,J){if(J==="data")return;if(J==="batch"&&!this.batch)return;let Z=this.model.getEdit({rowNode:Q,column:z},Rz);if(!Z)return;if(this.stopping&&!this.batch&&!Z.editorState?.cellStartedEditing)return;if(J==="edit"){let X=Z.editorValue;if(X!=null&&X!==P0)return X}let $=Z.pendingValue;if($!==P0)return $;return}getCellDataValue(Q){let z=this.model.getEdit(Q,Rz);if(z){let J=z.pendingValue;if(J!==P0)return J;let Z=z.sourceValue;if(Z!=null)return Z}return this.valueSvc.getValue(Q.column,Q.rowNode,"data")}addStopEditingWhenGridLosesFocus(Q){v3(this,this.beans,Q)}createPopupEditorWrapper(Q){return new WL(Q)}batchResetToSourceValue(Q){if(!this.batch)return!1;let z=this.model.getEdit(Q);if(!z)return!1;let{pendingValue:J,sourceValue:Z,state:$}=z;if(J===Z)return!1;if($==="editing")return!1;return this.dispatchEditValuesChanged(Q,{...z,pendingValue:Z}),this.beans.editModelSvc?.removeEdits(Q),s(this.beans,Q)?.refreshCell(lQ),!0}setDataValue(Q,z,J){try{let Z=this.batch,$=this.isEditing(Z?void 0:Q);if((!$||this.committing)&&!Z&&!jL.has(J))return;if(!$&&!Z&&J==="paste")return;if(J==="batch"&&!Z)return;if(J==="edit"){if($&&this.applyEditorValue(Q,z))return!0;if(!Z)return}if(this.strategy??(this.strategy=this.createStrategy()),J==="batch"||J==="edit")return this.applyDirectValue(Q,z,J);let X=this.beans,Y;if(Z)Y="ui";else if(this.committing)Y=J??"api";else Y="api";if(!J||VL.has(J))return this.applyDirectValue(Q,z,J);let G=this.applyExistingEdit(Q,z,J,Y);if(G!==void 0)return G;return z1(X,Q,z,J,void 0,{persist:!0}),this.ensureBatchStarted(),this.stopEditing(Q,{source:Y,suppressNavigateAfterEdit:!0}),!0}finally{this.committing=!1}}applyExistingEdit(Q,z,J,Z){let $=this.model.getEdit(Q);if(!$)return;if($.pendingValue===z)return!1;if($.sourceValue!==z)return z1(this.beans,Q,z,J,void 0,{persist:!0}),this.ensureBatchStarted(),this.stopEditing(Q,{source:Z,suppressNavigateAfterEdit:!0}),!0;return this.beans.editModelSvc?.removeEdits(Q),this.ensureBatchStarted(),this.dispatchEditValuesChanged(Q,{...$,pendingValue:z}),!0}applyEditorValue(Q,z){let J=this.beans,Z=s(J,Q),$=Z?.comp?.getCellEditor();if(!Z||!$)return!1;if(z1(J,Q,z,"edit",void 0,{persist:!0}),Z.editStyleFeature?.applyCellStyles?.(),"agSetEditValue"in $)return $.agSetEditValue(z),!0;if($.refresh&&Z.editCompDetails)return $.refresh({...Z.editCompDetails.params,value:z}),!0;if(Z.hasBrowserFocus())Z.onEditorAttachedFuncs.push(()=>{let Y=s(this.beans,Q);Y?.focusCell(!0),Y?.comp?.getCellEditor()?.focusIn?.()});return eQ(J,[Q],{silent:!0,cancel:!0}),gz(J,Q,{silent:!0}),Yz(J),s(J,Q)?.refreshCell(lQ),!0}applyDirectValue(Q,z,J){let Z=this.beans;if(this.batch){if(J==="batch"&&s(Z,Q)?.comp?.getCellEditor()){let{editModelSvc:Y,valueSvc:G}=Z,{rowNode:q,column:H}=Q;if(Y?.getEdit(Q)?.sourceValue===void 0)Y?.setEdit(Q,{sourceValue:G.getValue(H,q,"data")});Y?.setEdit(Q,{pendingValue:z})}else if(z1(Z,Q,z,J,void 0,{persist:!0}),J!=="batch")this.cleanupEditors();return x1(Z),this.ensureBatchStarted(),this.bulkRefreshCell(Q),!0}z1(Z,Q,z,J,void 0,{persist:!0});let $=s(Z,Q),X=this.setNodeDataValue(Q.rowNode,Q.column,z,$,J);return this.syncEditAfterCommit(Q,X),x1(Z),s(Z,Q)?.refreshCell(X?SL:lQ),X}handleColDefChanged(Q){x3(this.beans,Q)}destroy(){this.model.clear(),this.destroyStrategy(),super.destroy()}prepDetailsDuringBatch(Q,z){let{model:J}=this;if(!this.batch)return;if(!J.hasRowEdits(Q.rowNode,Rz))return;let{rowNode:$}=Q,{compDetails:X,valueToDisplay:Y}=z;if(X){let{params:G}=X;return G.data=J.getEditRowDataValue($,Rz),{compDetails:X}}return{valueToDisplay:Y}}cleanupEditors(){this.strategy?.cleanupEditors()}dispatchCellEvent(Q,z,J,Z){this.strategy?.dispatchCellEvent(Q,z,J,Z)}dispatchBatchEvent(Q,z){this.eventSvc.dispatchEvent(this.createBatchEditEvent(Q,z))}createBatchEditEvent(Q,z){return y(this.gos,{type:Q,...Q==="batchEditingStopped"?{changes:this.toEventChangeList(z)}:{}})}toEventChangeList(Q){return this.model.getEditPositions(Q).map((z)=>({rowIndex:z.rowNode.rowIndex,rowPinned:z.rowNode.rowPinned,columnId:z.column.getColId(),newValue:z.pendingValue,oldValue:z.sourceValue}))}applyBulkEdit({rowNode:Q,column:z},J){if(!J||J.length===0)return;let{beans:Z,rangeSvc:$,valueSvc:X}=this,{formula:Y}=Z;Qz(Z,{persist:!0});let G=this.model.getEditMap(!0),q=G.get(Q)?.get(z)?.pendingValue,H=!1;if(!this.batch)this.eventSvc.dispatchEvent({type:"bulkEditingStarted"}),H=!0;let _=Y?.isFormula(q)??!1;J.forEach((W)=>{let B=W.columns.some((E)=>E?.isAllowFormula());if($?.forEachRowInRange(W,(E)=>{let K=M0(Z,E);if(K===void 0)return;let L=G.get(K)??new Map,F=q;for(let D of W.columns){if(!D)continue;let M=!!_&&D.isAllowFormula();if(this.isCellEditable({rowNode:K,column:D},"api")){let k=X.getValue(D,K,"data",!0),f=X.parseValue(D,K??null,F,k);if(Number.isNaN(f))f=null;L.set(D,{editorValue:void 0,pendingValue:f,sourceValue:k,state:"changed",editorState:{isCancelAfterEnd:void 0,isCancelBeforeStart:void 0}})}if(M)F=Y?.updateFormulaByOffset({value:F,columnDelta:1})}if(L.size>0)G.set(K,L);if(_&&B)q=Y?.updateFormulaByOffset({value:q,rowDelta:1})}),this.setEditMap(G),this.batch){this.cleanupEditors(),x1(Z),this.ensureBatchStarted();return}this.committing=!0;try{this.stopEditing(void 0,{source:"bulk"})}finally{if(this.committing=!1,H)this.eventSvc.dispatchEvent({type:"bulkEditingStopped",changes:this.toEventChangeList(G)})}});let U=s(Z,{rowNode:Q,column:z});if(U)U.focusCell(!0)}createCellStyleFeature(Q){return new LL(Q,this.beans)}createRowStyleFeature(Q){return new FL(Q,this.beans)}setEditingCells(Q,z){let{beans:J}=this,{colModel:Z,valueSvc:$}=J,X=new Map;for(let{colId:Y,column:G,colKey:q,rowIndex:H,rowPinned:_,newValue:U,state:W}of Q){let B=Y?Z.getCol(Y):q?Z.getCol(q):G;if(!B)continue;let E=M0(J,{rowIndex:H,rowPinned:_});if(!E)continue;let K=$.getValue(B,E,"data",!0);if(!z?.forceRefreshOfEditCellsOnly&&!BQ({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(Q){let z=s(this.beans,Q);if(!z||!this.isEditing(z,Rz))return;let J=this.model.getEdit(z);if(!J||!BQ(J))return;let $=this.getLocaleTextFunc()("ariaPendingChange","Pending Change");this.beans.ariaAnnounce?.announceValue($,"pendingChange")}allowedFocusTargetOnValidation(Q){return s(this.beans,Q)}};function PL(Q){return{rowNodes:Q?Array.from(Q.keys()):void 0,columns:Q?[...new Set(Array.from(Q.values()).flatMap((z)=>Array.from(z.keys())))]:void 0}}function F8(Q,z){return z??Q.get("editType")??"singleCell"}var UX=class extends j{postConstruct(){this.model=this.beans.editModelSvc,this.editSvc=this.beans.editSvc,this.addManagedEventListeners({cellFocused:this.onCellFocusChanged?.bind(this),cellFocusCleared:this.onCellFocusChanged?.bind(this)})}clearEdits(Q){this.model.clearEditValue(Q)}onCellFocusChanged(Q){let z,J=Q.previousParams,{editSvc:Z,beans:$}=this,X=Q.type==="cellFocused"?Q.sourceEvent:null;if(J)z=s($,J);let{gos:Y,editModelSvc:G}=$,q=Q.type==="cellFocusCleared";if(Z.isEditing(void 0,{withOpenEditor:!0})){let{column:H,rowIndex:_,rowPinned:U}=Q,W={column:H,rowNode:M0($,{rowIndex:_,rowPinned:U})},B=Y.get("invalidEditValueMode")==="block";if(B)return;let E=!B,K=!!G?.getCellValidationModel().hasCellValidation(W),L=E&&K;if(!(J||q?Z.stopEditing(void 0,{cancel:L,source:q&&E?"api":void 0,event:X}):!0))if(Z.isBatchEditing())Z.cleanupEditors();else Z.stopEditing(void 0,{source:"api"})}z?.refreshCell({suppressFlash:!0,force:!0})}stopCancelled(Q){let z=this.editSvc.isBatchEditing()&&!Q;for(let J of this.model.getEditPositions())QJ(this.beans,J,{cancel:!0},s(this.beans,J)),this.model.stop(J,z,!0);return!0}stopCommitted(Q,z){let J=this.model.getEditPositions(),Z={all:[],pass:[],fail:[]};for(let Y of J)if(Z.all.push(Y),(this.model.getCellValidationModel().getCellValidation(Y)?.errorMessages?.length??0)>0)Z.fail.push(Y);else Z.pass.push(Y);let $=this.processValidationResults(Z),X=this.editSvc.isBatchEditing()&&!z;for(let Y of $.destroy)QJ(this.beans,Y,{event:Q},s(this.beans,Y)),this.model.stop(Y,X,!1);for(let Y of $.keep){let G=s(this.beans,Y);if(!this.editSvc.cellEditingInvalidCommitBlocks()&&G)this.editSvc.revertSingleCellEdit(G)}return!0}cleanupEditors({rowNode:Q}={},z){Qz(this.beans,{persist:!1});let J=this.model.getEditPositions(),Z=[];if(Q){for(let $ of J)if($.rowNode!==Q)Z.push($)}else for(let $ of J)Z.push($);eQ(this.beans,Z),x1(this.beans,z)}setFocusOutOnEditor(Q){Q.comp?.getCellEditor()?.focusOut?.()}setFocusInOnEditor(Q){let z=Q.comp,J=z?.getCellEditor();if(J?.focusIn)J.focusIn();else{let Z=this.beans.gos.get("editType")==="fullRow";Q.focusCell(Z),Q.onEditorAttachedFuncs.push(()=>z?.getCellEditor()?.focusIn?.())}}setupEditors(Q){let{event:z,ignoreEventKey:J=!1,startedEdit:Z,position:$,cells:X=this.model.getEditPositions()}=Q,Y=z instanceof KeyboardEvent&&!J&&z.key||void 0;C3(this.beans,X,$,Y,z,Z)}dispatchCellEvent(Q,z,J,Z){let $=s(this.beans,Q);if($)this.eventSvc.dispatchEvent({...$.createEvent(z??null,J),...Z})}dispatchRowEvent(Q,z,J){if(J)return;let Z=BZ(this.beans,Q);if(Z)this.eventSvc.dispatchEvent(Z.createRowEvent(z))}shouldStop(Q,z,J="ui"){let Z=this.editSvc.isBatchEditing();if(Z&&J==="api")return!0;if(Z&&(J==="ui"||J==="edit"))return!1;if(J==="api")return!0;if(z instanceof KeyboardEvent&&!Z)return z.key===V.ENTER;return null}shouldCancel(Q,z,J="ui"){let Z=this.editSvc.isBatchEditing();if(z instanceof KeyboardEvent&&!Z){if(z.key===V.ESCAPE)return!0}if(Z&&J==="api")return!0;if(J==="api")return!0;return!1}setEditMap(Q,z){if(!z?.update)this.editSvc.stopEditing(void 0,{cancel:!0,source:"api"});let J=[];if(Q.forEach((Z,$)=>{Z.forEach((X,Y)=>{if(X.state==="editing")J.push({...X,rowNode:$,column:Y})})}),z?.update)Q=new Map([...this.model.getEditMap(),...Q]);if(this.model?.setEditMap(Q),J.length>0){let Z=J.at(-1),$=Z.pendingValue===P0?void 0:Z.pendingValue;this.start({position:Z,event:new KeyboardEvent("keydown",{key:$}),source:"api"});let X=s(this.beans,Z);if(X)this.setFocusInOnEditor(X)}}destroy(){this.cleanupEditors(),super.destroy()}},TL=class extends UX{constructor(){super(...arguments);this.beanName="fullRow",this.startedRows=new Set}shouldStop(Q,z,J="ui"){let{rowNode:Z,beans:$}=this,{rowNode:X}=Q||{};if(!BZ($,{rowNode:Z}))return!0;let G=super.shouldStop({rowNode:Z},z,J);if(G!==null)return G;if(!Z)return!1;return X!==Z}midBatchInputsAllowed({rowNode:Q}){if(!Q)return!1;return this.model.hasEdits({rowNode:Q})}clearEdits(Q){this.model.clearEditValue(Q)}start(Q){let{position:z,silent:J,startedEdit:Z,event:$,ignoreEventKey:X}=Q,{rowNode:Y}=z,{beans:G,model:q,startedRows:H}=this;if(this.rowNode!==Y)super.cleanupEditors(z);let _=G.visibleCols.allCols,U=[],W=[];for(let B of _)if(B.isCellEditable(Y))W.push(B);if(W.length==0)return;if(!H.has(Y))this.dispatchRowEvent({rowNode:Y},"rowEditingStarted",J),H.add(Y);for(let B of W){let E={rowNode:Y,column:B};U.push(E),q.start(E)}this.rowNode=Y,this.setupEditors({cells:U,position:z,startedEdit:Z,event:$,ignoreEventKey:X})}processValidationResults(Q){if(Q.fail.length>0&&this.editSvc.cellEditingInvalidCommitBlocks())return{destroy:[],keep:Q.all};return{destroy:Q.all,keep:[]}}stopCancelled(Q){let{rowNode:z,model:J}=this;if(z&&!J.hasRowEdits(z))return!1;return super.stopCancelled(Q),this.cleanupEditors({rowNode:z},!0),this.rowNode=void 0,!0}stopCommitted(Q,z){let{rowNode:J,beans:Z,model:$,editSvc:X}=this;if(J&&!$.hasRowEdits(J))return!1;let Y=[];if($.getEditMap().forEach((G,q)=>{if(!G||G.size===0)return;for(let H of G.values())if(BQ(H)){Y.push(q);break}}),Yz(Z),X.checkNavWithValidation({rowNode:J})==="block-stop")return!1;if(super.stopCommitted(Q,z),z||!X.isBatchEditing())for(let G of Y)this.dispatchRowEvent({rowNode:G},"rowValueChanged");return this.cleanupEditors({rowNode:J},!0),this.rowNode=void 0,!0}onCellFocusChanged(Q){let{rowIndex:z}=Q,J=Q.previousParams;if(J?.rowIndex===z||Q.sourceEvent instanceof KeyboardEvent)return;let{beans:Z,gos:$,model:X}=this;if(Z.editSvc?.isRangeSelectionEnabledWhileEditing())return;let Y=s(Z,J);if($.get("invalidEditValueMode")==="block"&&Y&&(X.getCellValidationModel().getCellValidation(Y)||X.getRowValidationModel().getRowValidation(Y)))return;super.onCellFocusChanged(Q)}cleanupEditors(Q={},z){super.cleanupEditors(Q,z);let{startedRows:J}=this;for(let Z of J)this.dispatchRowEvent({rowNode:Z},"rowEditingStopped"),this.destroyEditorsForRow(Z);J.clear()}destroyEditorsForRow(Q){let z=BZ(this.beans,{rowNode:Q});if(!z)return;let J={};for(let Z of z.getAllCellCtrls())if(Z.comp?.getCellEditor())QJ(this.beans,Z,J,Z)}moveToNextEditingCell(Q,z,J,Z="ui",$=!1){let{beans:X,model:Y,gos:G,editSvc:q}=this,H=Q.cellPosition,_;Y.suspend(!0);try{_=X.navigation?.findNextCellToFocusOn(H,{backwards:z,startEditing:!0,skipToNextEditableCell:!1})}finally{Y.suspend(!1)}if(_===!1)return null;if(_==null)return!1;let U=_.cellPosition,W=Q.isCellEditable(),B=_.isCellEditable(),E=U&&H.rowIndex===U.rowIndex&&H.rowPinned===U.rowPinned;if(W)this.setFocusOutOnEditor(Q);this.restoreEditors();let K=G.get("suppressStartEditOnTab");if(B&&!$)if(K)_.focusCell(!0,J);else{if(!_.comp?.getCellEditor())gz(X,_,{event:J,cellStartedEdit:!0});this.setFocusInOnEditor(_),_.focusCell(!1,J)}else{if(B&&$)this.setFocusInOnEditor(_);_.focusCell(!0,J)}if(!E&&!$){if(q?.stopEditing({rowNode:Q.rowNode},{event:J,forceStop:!0}),q?.isRowEditing(Q.rowNode,{withOpenEditor:!0}))this.cleanupEditors(_,!0);if(K)_.focusCell(!0,J);else q.startEditing(_,{startedEdit:!0,event:J,source:Z,ignoreEventKey:!0,editable:B||void 0})}return Q.rowCtrl?.refreshRow({suppressFlash:!0,force:!0}),!0}restoreEditors(){let{beans:Q,model:z}=this;z.getEditMap().forEach((J,Z)=>J.forEach(({state:$},X)=>{if($!=="editing")return;let Y=s(Q,{rowNode:Z,column:X});if(Y&&!Y.comp?.getCellEditor())gz(Q,Y,{silent:!0})}))}destroy(){super.destroy(),this.rowNode=void 0,this.startedRows.clear()}},vL=class extends UX{constructor(){super(...arguments);this.beanName="singleCell"}shouldStop(Q,z,J="ui"){let Z=super.shouldStop(Q,z,J);if(Z!==null)return Z;let $=Q?.rowNode,X=Q?.column,Y=this.rowNode,G=this.column;if((!Y||!G)&&$&&X)return null;if(Y!==$||G!==X)return!0;if(!Y&&!G)return this.model.hasEdits(void 0,{withOpenEditor:!0});return!1}midBatchInputsAllowed(Q){return this.model.hasEdits(Q)}start(Q){let{position:z,startedEdit:J,event:Z,ignoreEventKey:$}=Q;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:J,event:Z,ignoreEventKey:$})}dispatchRowEvent(Q,z,J){}processValidationResults(Q){if(Q.fail.length>0&&this.editSvc.cellEditingInvalidCommitBlocks())return{destroy:[],keep:Q.all};return{destroy:Q.all,keep:[]}}stopCancelled(Q){return super.stopCancelled(Q),this.clearPosition()}stopCommitted(Q,z){return super.stopCommitted(Q,z),this.clearPosition()}clearPosition(){return this.rowNode=void 0,this.column=void 0,!0}onCellFocusChanged(Q){let{colModel:z,editSvc:J}=this.beans,{rowIndex:Z,column:$,rowPinned:X}=Q,Y=M0(this.beans,{rowIndex:Z,rowPinned:X}),G=L5($),q=z.getCol(G),H=Q.previousParams;if(H){let _=L5(H.column);if(H?.rowIndex===Z&&_===G&&H?.rowPinned===X)return}if(Q.type=="cellFocused"&&(J?.isRangeSelectionEnabledWhileEditing()||J?.isEditing({rowNode:Y,column:q},{withOpenEditor:!0})))return;super.onCellFocusChanged(Q)}moveToNextEditingCell(Q,z,J,Z="ui",$=!1){let X=this.beans.focusSvc.getFocusedCell();if(X)Q=e0(this.beans,X)??Q;let Y=Q.cellPosition,G,q=this.beans.gos.get("editType")==="fullRow";if(q)this.model.suspend(!0);if(!$)Q.eGui.focus(),this.editSvc?.stopEditing(Q,{source:this.editSvc?.isBatchEditing()?"ui":"api",event:J});try{G=this.beans.navigation?.findNextCellToFocusOn(Y,{backwards:z,startEditing:!0})}finally{if(q)this.model.suspend(!1)}if(G===!1)return null;if(G==null)return!1;let H=G.cellPosition,_=Q.isCellEditable(),U=G.isCellEditable(),W=H&&Y.rowIndex===H.rowIndex&&Y.rowPinned===H.rowPinned;if(_&&!$)this.setFocusOutOnEditor(Q);let B=this.gos.get("suppressStartEditOnTab"),E=!1;if(!W&&!$)if(super.cleanupEditors(G,!0),B)G.focusCell(!0,J);else E=!0,this.editSvc.startEditing(G,{startedEdit:!0,event:J,source:Z,ignoreEventKey:!0,editable:U});if(U&&!$){if(G.focusCell(!1,J),B)G.focusCell(!0,J);else if(!G.comp?.getCellEditor()){if(!E){let K=this.editSvc?.isEditing(G,{withOpenEditor:!0});gz(this.beans,G,{event:J,cellStartedEdit:!0,silent:K})}this.setFocusInOnEditor(G),this.cleanupEditors(G)}}else{if(U&&$)this.setFocusInOnEditor(G);G.focusCell(!0,J)}return Q.rowCtrl?.refreshRow({suppressFlash:!0,force:!0}),!0}destroy(){super.destroy(),this.rowNode=void 0,this.column=void 0}},IL={moduleName:"EditCore",version:p,beans:[T3,OL],apiFunctions:{getEditingCells:YL,getEditRowValues:XL,getCellEditorInstances:I3,startEditingCell:HL,stopEditing:GL,isEditing:qL,validateEdit:_L},dynamicBeans:{singleCell:vL,fullRow:TL},dependsOn:[nz,eK],css:[QL]};var WX={moduleName:"TextEditor",version:p,userComponents:{agCellEditor:L8,agTextCellEditor:L8},dependsOn:[IL]};var BX={agSetColumnFilter:"agSetColumnFilterHandler",agMultiColumnFilter:"agMultiColumnFilterHandler",agGroupColumnFilter:"agGroupColumnFilterHandler",agNumberColumnFilter:"agNumberColumnFilterHandler",agBigIntColumnFilter:"agBigIntColumnFilterHandler",agDateColumnFilter:"agDateColumnFilterHandler",agTextColumnFilter:"agTextColumnFilterHandler"},CL=new Set(Object.values(BX));function aQ(Q,z){let J=Q.filterUi;if(!J)return null;if(J.created)return J.promise;if(z)return null;let Z=J.create(J.refreshed),$=J;return $.created=!0,$.promise=Z,Z}function rZ(Q,z,J,Z,$,X,Y){return z.refresh?.({...J,model:Z,source:X,additionalEventAttributes:Y}),Q().then((G)=>{if(G){let{filter:q,filterParams:H}=G;A1(q,H,Z,$,X,Y)}})}function A1(Q,z,J,Z,$,X){Q?.refresh?.({...z,model:J,state:Z,source:$,additionalEventAttributes:X})}function EX(Q,z,J,Z){let $=Q();if($?.created)$.promise.then((X)=>{let Y=z();A1(X,$.filterParams,Y,J()??{model:Y},"ui",Z)})}function FZ(Q){let z,J=!1,Z,{action:$,filterParams:X,getFilterUi:Y,getModel:G,getState:q,updateState:H,updateModel:_,processModelToApply:U}=Q;switch($){case"apply":{let W=q();if(Z=W?.model??null,U)Z=U(Z);z={state:W?.state,model:Z},J=!0;break}case"clear":{if(z={model:null},!X?.buttons?.includes("apply"))J=!0,Z=null;break}case"reset":{z={model:null},J=!0,Z=null;break}case"cancel":{z={model:G()};break}}if(H(z),J)_(Z);else EX(Y,G,q,{fromAction:$})}function F0(Q,z){return Q[z]??null}var bL=class extends Y6{constructor(){super(...arguments);this.iconCreated=!1}wireComp(Q,z,J,Z,$){this.comp=Q;let X=BJ(this,this.beans.context,$);this.eButtonShowMainFilter=J,this.eFloatingFilterBody=Z,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:G})=>{if(G===this.column)Y()}}),X.addDestroyFunc(()=>{this.eButtonShowMainFilter=null,this.eFloatingFilterBody=null,this.userCompDetails=null,this.clearComponent()})}resizeHeader(){}moveHeader(){}getHeaderClassParams(){let{column:Q,beans:z}=this,J=Q.colDef;return y(z.gos,{colDef:J,column:Q,floatingFilter:!0})}setupActive(){let Q=this.column.getColDef(),z=!!Q.filter,J=!!Q.floatingFilter;this.active=z&&J}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 Q=h("filter",this.beans,this.column);if(Q)this.iconCreated=!0,this.eButtonShowMainFilter.appendChild(Q)}setupFocus(Q){Q.createManagedBean(new cQ(this.eGui,{shouldStopEventPropagation:this.shouldStopEventPropagation.bind(this),onTabKeyDown:this.onTabKeyDown.bind(this),handleKeyDown:this.handleKeyDown.bind(this),onFocusIn:this.onFocusIn.bind(this)}))}setupAria(){let Q=this.getLocaleTextFunc();E0(this.eButtonShowMainFilter,Q("ariaFilterMenuOpen","Open Filter Menu"))}onTabKeyDown(Q){let{beans:z}=this;if(d(z)===this.eGui)return;let $=R0(z,this.eGui,null,Q.shiftKey);if($){z.headerNavigation?.scrollToColumn(this.column),Q.preventDefault(),$.focus();return}let X=this.findNextColumnWithFloatingFilter(Q.shiftKey);if(!X)return;if(z.focusSvc.focusHeaderPosition({headerPosition:{headerRowIndex:this.rowCtrl.rowIndex,column:X},event:Q}))Q.preventDefault()}findNextColumnWithFloatingFilter(Q){let z=this.beans.visibleCols,J=this.column;do if(J=Q?z.getColBefore(J):z.getColAfter(J),!J)break;while(!J.getColDef().filter||!J.getColDef().floatingFilter);return J}handleKeyDown(Q){super.handleKeyDown(Q);let z=this.getWrapperHasFocus();switch(Q.key){case V.UP:case V.DOWN:case V.LEFT:case V.RIGHT:if(z)return;i0(Q);case V.ENTER:if(z){if(D0(this.eGui))Q.preventDefault()}break;case V.ESCAPE:if(!z)this.eGui.focus()}}onFocusIn(Q){if(this.eGui.contains(Q.relatedTarget))return;let J=!!Q.relatedTarget&&!Q.relatedTarget.classList.contains("ag-floating-filter"),Z=!!Q.relatedTarget&&vz(Q.relatedTarget,"ag-floating-filter");if(J&&Z&&Q.target===this.eGui){let $=this.lastFocusEvent,X=!!($&&$.key===V.TAB);if($&&X){let Y=$.shiftKey;D0(this.eGui,Y)}}this.focusThis()}setupHover(Q){this.beans.colHover?.addHeaderFilterColumnHoverListener(Q,this.comp,this.column,this.eGui)}setupLeft(Q){let z=new X6(this.column,this.eGui,this.beans);Q.createManagedBean(z)}setupFilterButton(){this.suppressFilterButton=!this.beans.menuSvc?.isFloatingFilterButtonEnabled(this.column),this.highlightFilterButtonWhenActive=!U0(this.gos)}setupUserComp(){if(!this.active)return;let Q=this.beans.colFilter?.getFloatingFilterCompDetails(this.column,()=>this.showParentFilter());if(Q)this.setCompDetails(Q)}setCompDetails(Q){this.userCompDetails=Q,this.comp.setCompDetails(Q)}showParentFilter(){let Q=this.suppressFilterButton?this.eFloatingFilterBody:this.eButtonShowMainFilter;this.beans.menuSvc?.showFilterMenu({column:this.column,buttonElement:Q,containerType:"floatingFilter",positionBy:"button"})}setupSyncWithFilter(Q){if(!this.active)return;let{beans:{colFilter:z},column:J,gos:Z}=this,$=(X)=>{if(X?.source==="filterDestroyed"&&(!this.isAlive()||!z?.isAlive()))return;let Y=this.comp.getFloatingFilterComp();if(!Y)return;Y.then((G)=>{if(G){if(Z.get("enableFilterHandlers")){let _=X,U="filter";if(_?.afterFloatingFilter)U="ui";else if(_?.afterDataChange)U="dataChanged";else if(X?.source==="api")U="api";this.updateFloatingFilterParams(this.userCompDetails,U);return}let q=z?.getCurrentFloatingFilterParentModel(J),H=X?{...X,columns:X.columns??[],source:X.source==="api"?"api":"columnFilter"}:null;G.onParentModelChanged(q,H)}})};if([this.destroySyncListener]=Q.addManagedListeners(J,{filterChanged:$}),z?.isFilterActive(J))$(null)}setupWidth(Q){let z=()=>{let J=`${this.column.getActualWidth()}px`;this.comp.setWidth(J)};Q.addManagedListeners(this.column,{widthChanged:z}),z()}setupFilterChangedListener(Q){if(this.active)[this.destroyFilterChangedListener]=Q.addManagedListeners(this.column,{filterChanged:this.updateFilterButton.bind(this)}),this.updateFilterButton()}updateFilterButton(){if(!this.suppressFilterButton&&this.comp){let Q=!!this.beans.filterManager?.isFilterAllowed(this.column);if(this.comp.setButtonWrapperDisplayed(Q),this.highlightFilterButtonWhenActive&&Q)this.eButtonShowMainFilter.classList.toggle("ag-filter-active",this.column.isFilterActive())}}onColDefChanged(Q){let z=this.active;this.setupActive();let J=!z&&this.active;if(z&&!this.active)this.destroySyncListener(),this.destroyFilterChangedListener();let Z=this.beans.colFilter,$=this.active?Z?.getFloatingFilterCompDetails(this.column,()=>this.showParentFilter()):null,X=this.comp.getFloatingFilterComp();if(!X||!$)this.updateCompDetails(Q,$,J);else X.then((Y)=>{if(!Y||Z?.areFilterCompsDifferent(this.userCompDetails??null,$))this.updateCompDetails(Q,$,J);else this.updateFloatingFilterParams($,"colDef")})}updateCompDetails(Q,z,J){if(!this.isAlive())return;if(this.setCompDetails(z),this.setupFilterButton(),this.setupUi(),J)this.setupSyncWithFilter(Q),this.setupFilterChangedListener(Q)}updateFloatingFilterParams(Q,z){if(!Q)return;let J=Q.params;this.comp.getFloatingFilterComp()?.then((Z)=>{if(typeof Z?.refresh==="function"){if(this.gos.get("enableFilterHandlers"))J={...J,model:F0(this.beans.colFilter?.model??{},this.column.getColId()),source:z};Z.refresh(J)}})}addResizeAndMoveKeyboardListeners(){}destroy(){super.destroy(),this.destroySyncListener=null,this.destroyFilterChangedListener=null}};function yL(Q,z){let J=Q.colModel.getCol(z);if(!J){e(12,{colKey:z});return}Q.menuSvc?.showColumnMenu({column:J,positionBy:"auto"})}function xL(Q){Q.menuSvc?.hidePopupMenu()}var wL=class extends j{constructor(){super(...arguments);this.beanName="menuSvc"}postConstruct(){let{enterpriseMenuFactory:Q,filterMenuFactory:z}=this.beans;this.activeMenuFactory=Q??z}showColumnMenu(Q){this.showColumnMenuCommon(this.activeMenuFactory,Q,"columnMenu")}showFilterMenu(Q){this.showColumnMenuCommon(D8(this.beans),Q,Q.containerType,!0)}showHeaderContextMenu(Q,z,J){this.activeMenuFactory?.showMenuAfterContextMenuEvent(Q,z,J)}hidePopupMenu(){this.beans.contextMenuSvc?.hideActiveMenu(),this.activeMenuFactory?.hideActiveMenu()}hideFilterMenu(){D8(this.beans)?.hideActiveMenu()}isColumnMenuInHeaderEnabled(Q){let{suppressHeaderMenuButton:z}=Q.getColDef();return!z&&!!this.activeMenuFactory?.isMenuEnabled(Q)&&(U0(this.gos)||!!this.beans.enterpriseMenuFactory)}isFilterMenuInHeaderEnabled(Q){return!Q.getColDef().suppressHeaderFilterButton&&!!this.beans.filterManager?.isFilterAllowed(Q)}isHeaderContextMenuEnabled(Q){return!(Q&&JQ(Q)?Q.getColDef():Q?.getColGroupDef())?.suppressHeaderContextMenu&&this.gos.get("columnMenu")==="new"}isHeaderMenuButtonAlwaysShowEnabled(){return this.isSuppressMenuHide()}isHeaderMenuButtonEnabled(){let Q=!this.isSuppressMenuHide();return!(bz()&&Q)}isHeaderFilterButtonEnabled(Q){return this.isFilterMenuInHeaderEnabled(Q)&&!U0(this.gos)&&!this.isFloatingFilterButtonDisplayed(Q)}isFilterMenuItemEnabled(Q){return!!this.beans.filterManager?.isFilterAllowed(Q)&&!U0(this.gos)&&!this.isFilterMenuInHeaderEnabled(Q)&&!this.isFloatingFilterButtonDisplayed(Q)}isFloatingFilterButtonEnabled(Q){return!Q.getColDef().suppressFloatingFilterButton}isFloatingFilterButtonDisplayed(Q){return!!Q.getColDef().floatingFilter&&this.isFloatingFilterButtonEnabled(Q)}isSuppressMenuHide(){let Q=this.gos,z=Q.get("suppressMenuHide");if(U0(Q))return Q.exists("suppressMenuHide")?z:!1;return z}showColumnMenuCommon(Q,z,J,Z){let{positionBy:$,onClosedCallback:X}=z,Y=z.column;if($==="button"){let{buttonElement:G}=z;Q?.showMenuAfterButtonClick(Y,G,J,X,Z)}else if($==="mouse"){let{mouseEvent:G}=z;Q?.showMenuAfterMouseEvent(Y,G,J,X,Z)}else if(Y){let G=this.beans,q=G.ctrlsSvc;q.getScrollFeature().ensureColumnVisible(Y,"auto"),YQ(G,()=>{let H=q.getHeaderRowContainerCtrl(Y.getPinned())?.getHeaderCtrlForColumn(Y);if(H)Q?.showMenuAfterButtonClick(Y,H.getAnchorElementForMenu(Z),J,X,Z)})}}};function zJ(Q,z,J){if(Q.menuVisible!==z)Q.menuVisible=z,Q.dispatchColEvent("menuVisibleChanged",J)}function D8(Q){let{enterpriseMenuFactory:z,filterMenuFactory:J,gos:Z}=Q;return z&&U0(Z)?z:J}var v6={moduleName:"SharedMenu",version:p,beans:[wL],apiFunctions:{showColumnMenu:yL,hidePopupMenu:xL}},NL=".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 gL(Q){let z=Q.filterManager;return!!z?.isColumnFilterPresent()||!!z?.isAggregateFilterPresent()}function hL(Q,z){return Q.filterManager?.getColumnFilterInstance(z)??Promise.resolve(void 0)}function uL(Q,z){let J=Q.colModel.getColDefCol(z);if(J)return Q.colFilter?.destroyFilter(J,"api")}function mL(Q,z){Q.frameworkOverrides.wrapIncoming(()=>Q.filterManager?.setFilterModel(z))}function cL(Q){return Q.filterManager?.getFilterModel()??{}}function pL(Q,z,J){let{gos:Z,colModel:$,colFilter:X}=Q;if(J&&!Z.get("enableFilterHandlers"))R(288),J=!1;let Y=$.getColDefCol(z);return Y?X?.getModelForColumn(Y,J)??null:null}function iL(Q,z,J){return Q.filterManager?.setColumnFilterModel(z,J)??Promise.resolve()}function nL(Q,z){let J=Q.colModel.getCol(z);if(!J){e(12,{colKey:z});return}Q.menuSvc?.showFilterMenu({column:J,containerType:"columnFilter",positionBy:"auto"})}function dL(Q){Q.menuSvc?.hideFilterMenu()}function tL(Q,z){let J=Q.colModel.getCol(z);if(!J){e(12,{colKey:z});return}return Q.colFilter?.getHandler(J,!0)}function rL(Q,z){let{colModel:J,colFilter:Z,gos:$}=Q;if(!$.get("enableFilterHandlers")){R(287);return}let{colId:X,action:Y}=z;if(X){let G=J.getColById(X);if(G)Z?.updateModel(G,Y)}else Z?.updateAllModels(Y)}var M8={january:"January",february:"February",march:"March",april:"April",may:"May",june:"June",july:"July",august:"August",september:"September",october:"October",november:"November",december:"December"},k8=["january","february","march","april","may","june","july","august","september","october","november","december"];function sL(Q,z){if(Q==null)return-1;if(z==null)return 1;return Number.parseFloat(Q)-Number.parseFloat(z)}function lL(Q,z){if(Q==null)return-1;if(z==null)return 1;let J=qz(Q),Z=qz(z);if(J!=null&&Z!=null){if(J===Z)return 0;return J>Z?1:-1}return String(Q).localeCompare(String(z))}function V8(Q){return Q instanceof Date&&!isNaN(Q.getTime())}var f5={number:()=>{return},bigint:()=>{return},boolean:()=>({maxNumConditions:1,debounceMs:0,filterOptions:["empty",{displayKey:"true",displayName:"True",predicate:(Q,z)=>z,numberOfInputs:0},{displayKey:"false",displayName:"False",predicate:(Q,z)=>z===!1,numberOfInputs:0}]}),date:()=>({isValidDate:V8}),dateString:({dataTypeDefinition:Q})=>({comparator:(z,J)=>{let Z=Q.dateParser(J);if(J==null||Zz)return 1;return 0},isValidDate:(z)=>typeof z==="string"&&V8(Q.dateParser(z))}),dateTime:(Q)=>f5.date(Q),dateTimeString:(Q)=>f5.dateString(Q),object:()=>{return},text:()=>{return}},A5={number:()=>({comparator:sL}),bigint:()=>({comparator:lL}),boolean:({t:Q})=>({valueFormatter:(z)=>T(z.value)?Q(String(z.value),z.value?"True":"False"):Q("blanks","(Blanks)")}),date:({formatValue:Q,t:z})=>({valueFormatter:(J)=>{let Z=Q(J);return T(Z)?Z:z("blanks","(Blanks)")},treeList:!0,treeListFormatter:(J,Z)=>{if(J==="NaN")return z("invalidDate","Invalid Date");if(Z===1&&J!=null){let $=k8[Number(J)-1];return z($,M8[$])}return J??z("blanks","(Blanks)")},treeListPathGetter:(J)=>$1(J,!1)}),dateString:({formatValue:Q,dataTypeDefinition:z,t:J})=>({valueFormatter:(Z)=>{let $=Q(Z);return T($)?$:J("blanks","(Blanks)")},treeList:!0,treeListPathGetter:(Z)=>$1(z.dateParser(Z??void 0),!1),treeListFormatter:(Z,$)=>{if($===1&&Z!=null){let X=k8[Number(Z)-1];return J(X,M8[X])}return Z??J("blanks","(Blanks)")}}),dateTime:(Q)=>{let z=A5.date(Q);return z.treeListPathGetter=$1,z},dateTimeString(Q){let z=Q.dataTypeDefinition.dateParser,J=A5.dateString(Q);return J.treeListPathGetter=(Z)=>$1(z(Z??void 0)),J},object:({formatValue:Q,t:z})=>({valueFormatter:(J)=>{let Z=Q(J);return T(Z)?Z:z("blanks","(Blanks)")}}),text:()=>{return}};function I6(Q,z,J,Z,$,X,Y){let G=z,q=J,H=Q==="agSetColumnFilter";if(!q&&Z.baseDataType==="object"&&!H)q=({column:B,node:E})=>$({column:B,node:E,value:X.valueSvc.getValue(B,E,"data")});let U=(H?A5:f5)[Z.baseDataType],W=U({dataTypeDefinition:Z,formatValue:$,t:Y});return G=typeof z==="object"?{...W,...z}:W,{filterParams:G,filterValueGetter:q}}var aL={boolean:"agTextColumnFilter",date:"agDateColumnFilter",dateString:"agDateColumnFilter",dateTime:"agDateColumnFilter",dateTimeString:"agDateColumnFilter",bigint:"agBigIntColumnFilter",number:"agNumberColumnFilter",object:"agTextColumnFilter",text:"agTextColumnFilter"},oL={boolean:"agTextColumnFloatingFilter",date:"agDateColumnFloatingFilter",dateString:"agDateColumnFloatingFilter",dateTime:"agDateColumnFloatingFilter",dateTimeString:"agDateColumnFloatingFilter",bigint:"agBigIntColumnFloatingFilter",number:"agNumberColumnFloatingFilter",object:"agTextColumnFloatingFilter",text:"agTextColumnFloatingFilter"};function C6(Q,z=!1){return(z?oL:aL)[Q??"text"]}function b6(Q,z,J){if(z==null)return null;let Z=null,{compName:$,jsComp:X,fwComp:Y}=T9(Q,z);if($)Z={agSetColumnFilter:"agSetColumnFloatingFilter",agMultiColumnFilter:"agMultiColumnFloatingFilter",agGroupColumnFilter:"agGroupColumnFloatingFilter",agNumberColumnFilter:"agNumberColumnFloatingFilter",agBigIntColumnFilter:"agBigIntColumnFloatingFilter",agDateColumnFilter:"agDateColumnFloatingFilter",agTextColumnFilter:"agTextColumnFloatingFilter"}[$];else if(X==null&&Y==null&&z.filter===!0)Z=J();return Z}var eL={filterHandler:()=>({doesFilterPass:()=>!0})};function f8(Q,z,J,Z){if(!Q.isPrimary())return!0;let X=!J;if(!Q.isValueActive()||!X)return!1;if(z)return!0;return Z}var QF=class extends j{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={...BX},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 Q=this.gos,z={...Q.get("initialState")?.filter?.filterModel??{}};if(this.initialModel=z,this.model={...z},!Q.get("enableFilterHandlers"))delete this.handlerMap.agMultiColumnFilter}refreshModel(){this.onNewRowsLoaded("rowDataUpdated")}setModel(Q,z="api",J){let{colModel:Z,dataTypeSvc:$,filterManager:X}=this.beans;if($?.isPendingInference){this.modelUpdates.push({model:Q,source:z});return}let Y=[],G=this.getModel(!0);if(Q){let q=new Set(Object.keys(Q));this.allColumnFilters.forEach((H,_)=>{let U=Q[_];Y.push(this.setModelOnFilterWrapper(H,U)),q.delete(_)}),q.forEach((H)=>{let _=Z.getColDefCol(H)||Z.getCol(H);if(!_){R(62,{colId:H});return}if(!_.isFilterAllowed()){R(63,{colId:H});return}let U=this.getOrCreateFilterWrapper(_,!0);if(!U){R(64,{colId:H});return}Y.push(this.setModelOnFilterWrapper(U,Q[H],!0))})}else this.model={},this.allColumnFilters.forEach((q)=>{Y.push(this.setModelOnFilterWrapper(q,null))});g.all(Y).then(()=>{let q=this.getModel(!0),H=[];if(this.allColumnFilters.forEach((_,U)=>{let W=G?G[U]:null,B=q?q[U]:null;if(!DZ(W,B))H.push(_.column)}),H.length>0)X?.onFilterChanged({columns:H,source:z});else if(J)this.updateActive("filterChanged")})}getModel(Q){let z={},{allColumnFilters:J,initialModel:Z,beans:{colModel:$}}=this;if(J.forEach((X,Y)=>{let G=this.getModelFromFilterWrapper(X);if(T(G))z[Y]=G}),!Q)for(let X of Object.keys(Z)){let Y=Z[X];if(T(Y)&&!J.has(X)&&$.getCol(X)?.isFilterAllowed())z[X]=Y}return z}setState(Q,z,J="api"){if(this.state.clear(),z)for(let Z of Object.keys(z)){let $=z[Z];this.state.set(Z,{model:F0(this.model,Z),state:$})}this.setModel(Q,J,!0)}getState(){let Q=this.state;if(!Q.size)return;let z={},J=!1;return Q.forEach((Z,$)=>{let X=Z.state;if(X!=null)J=!0,z[$]=X}),J?z:void 0}getModelFromFilterWrapper(Q){let J=Q.column.getColId();if(Q.isHandler)return F0(this.model,J);let Z=Q.filter;if(Z){if(typeof Z.getModel!=="function")return R(66),null;return Z.getModel()}return F0(this.initialModel,J)}isFilterPresent(){return this.activeColumnFilters.length>0}isAggFilterPresent(){return!!this.activeAggregateFilters.length}disableFilters(){this.initialModel={};let{allColumnFilters:Q}=this;if(Q.size)return Q.forEach((z)=>this.disposeFilterWrapper(z,"advancedFilterEnabled")),!0;return!1}updateActiveFilters(){let Q=(q)=>{if(!q)return!1;if(!q.isFilterActive)return R(67),!1;return q.isFilterActive()},{colModel:z,gos:J}=this.beans,Z=!!TQ(J),$=[],X=[],Y=(q,H,_)=>{if(H)if(f8(q,z.isPivotMode(),z.isPivotActive(),Z))$.push(_);else X.push(_)},G=[];return this.allColumnFilters.forEach((q)=>{let H=q.column,_=H.getColId();if(q.isHandler)G.push(g.resolve().then(()=>{Y(H,this.isHandlerActive(H),{colId:_,isHandler:!0,handler:q.handler,handlerParams:q.handlerParams})}));else{let U=aQ(q);if(U)G.push(U.then((W)=>{Y(H,Q(W),{colId:_,isHandler:!1,comp:W})}))}}),g.all(G).then(()=>{this.activeAggregateFilters=$,this.activeColumnFilters=X})}updateFilterFlagInColumns(Q,z){let J=[];return this.allColumnFilters.forEach((Z)=>{let $=Z.column;if(Z.isHandler)J.push(g.resolve().then(()=>{this.setColFilterActive($,this.isHandlerActive($),Q,z)}));else{let X=aQ(Z);if(X)J.push(X.then((Y)=>{this.setColFilterActive($,Y.isFilterActive(),Q,z)}))}}),this.beans.groupFilter?.updateFilterFlags(Q,z),g.all(J)}doFiltersPass(Q,z,J){let{data:Z,aggData:$}=Q,X=J?this.activeAggregateFilters:this.activeColumnFilters,Y=J?$:Z,G=this.model;for(let q=0;q{if(this.isAlive())J?.onFilterChanged(Q)};if(z.isRefreshInProgress())setTimeout(Z,0);else Z()}updateBeforeFilterChanged(Q={}){let{column:z,additionalEventAttributes:J}=Q,Z=z?.getColId();return this.updateActiveFilters().then(()=>this.updateFilterFlagInColumns("filterChanged",J).then(()=>{this.allColumnFilters.forEach(($)=>{let{column:X,isHandler:Y}=$;if(Z===X.getColId())return;if(Y)$.handler.onAnyFilterChanged?.();aQ($,Y)?.then((G)=>{if(typeof G?.onAnyFilterChanged==="function")G.onAnyFilterChanged()})}),this.processingFilterChange=!0}))}updateAfterFilterChanged(){this.processingFilterChange=!1}isSuppressFlashingCellsBecauseFiltering(){return!(this.gos.get("allowShowChangeAfterFilter")??!1)&&this.processingFilterChange}onNewRowsLoaded(Q){let z=[];this.allColumnFilters.forEach((J)=>{let Z=J.isHandler;if(Z)J.handler.onNewRowsLoaded?.();let $=aQ(J,Z);if($)z.push($.then((X)=>{X.onNewRowsLoaded?.()}))}),g.all(z).then(()=>this.updateActive(Q,{afterDataChange:!0}))}updateActive(Q,z){this.updateFilterFlagInColumns(Q,z).then(()=>this.updateActiveFilters())}createGetValue(Q,z){let{filterValueSvc:J,colModel:Z}=this.beans;return($,X)=>{let Y=X?Z.getCol(X):Q;return Y?J.getValue(Y,$,z):void 0}}isFilterActive(Q){let z=this.cachedFilter(Q);if(z?.isHandler)return this.isHandlerActive(Q);let J=z?.filter;if(J)return J.isFilterActive();return F0(this.initialModel,Q.getColId())!=null}isHandlerActive(Q){let z=T(F0(this.model,Q.getColId()));if(z)return z;let J=this.beans.groupFilter;return J?.isGroupFilter(Q)?J.isFilterActive(Q):!1}getOrCreateFilterUi(Q){let z=this.getOrCreateFilterWrapper(Q,!0);return z?aQ(z):null}getFilterUiForDisplay(Q){let z=this.getOrCreateFilterWrapper(Q,!0);if(!z)return null;let J=aQ(z);if(!J)return null;return J.then((Z)=>({comp:Z,params:z.filterUi.filterParams,isHandler:z.isHandler}))}getHandler(Q,z){let J=this.getOrCreateFilterWrapper(Q,z);return J?.isHandler?J.handler:void 0}getOrCreateFilterWrapper(Q,z){if(!Q.isFilterAllowed())return;let J=this.cachedFilter(Q);if(!J&&z)J=this.createFilterWrapper(Q),this.setColumnFilterWrapper(Q,J);return J}cachedFilter(Q){return this.allColumnFilters.get(Q.getColId())}getDefaultFilter(Q,z=!1){return this.getDefaultFilterFromDataType(()=>this.beans.dataTypeSvc?.getBaseDataType(Q),z)}getDefaultFilterFromDataType(Q,z=!1){if(iG(this.gos))return z?"agSetColumnFloatingFilter":"agSetColumnFilter";return C6(Q(),z)}getDefaultFloatingFilter(Q){return this.getDefaultFilter(Q,!0)}createFilterComp(Q,z,J,Z,$,X){let Y=()=>{let H=this.createFilterCompParams(Q,$,X),_=Z(H,$);return d5(this.beans.userCompFactory,z,_,J)},G=Y();if(!G)return null;return{compDetails:G,createFilterUi:(H)=>{return(H?Y():G).newAgStackInstance()}}}createFilterInstance(Q,z,J,Z){let $=this.beans.selectableFilter;if($?.isSelectable(z))z=$.getFilterDef(Q,z);let{handler:X,handlerParams:Y,handlerGenerator:G}=this.createHandler(Q,z,J)??{},q=this.createFilterComp(Q,z,J,Z,!!X,"init");if(!q)return{compDetails:null,createFilterUi:null,handler:X,handlerGenerator:G,handlerParams:Y};let{compDetails:H,createFilterUi:_}=q;if(this.isGlobalButtons){if(!H.params?.buttons?.length)R(281,{colId:Q.getColId()})}return{compDetails:H,handler:X,handlerGenerator:G,handlerParams:Y,createFilterUi:_}}createBaseFilterParams(Q,z){let{filterManager:J,rowModel:Z}=this.beans;return y(this.gos,{column:Q,colDef:Q.getColDef(),getValue:this.createGetValue(Q),doesRowPassOtherFilter:z?()=>!0:($)=>J?.doesRowPassOtherFilters(Q.getColId(),$)??!0,rowModel:Z})}createFilterCompParams(Q,z,J,Z){let $=this.filterChangedCallbackFactory(Q),X=this.createBaseFilterParams(Q,Z);if(X.filterChangedCallback=$,X.filterModifiedCallback=Z?()=>{}:(Y)=>this.filterModified(Q,Y),z){let Y=X,G=Q.getColId(),q=F0(this.model,G);Y.model=q,Y.state=this.state.get(G)??{model:q},Y.onModelChange=(H,_)=>{this.updateStoredModel(G,H),this.refreshHandlerAndUi(Q,H,"ui",!1,_).then(()=>{$({..._,source:"columnFilter"})})},Y.onStateChange=(H)=>{this.updateState(Q,H),this.updateOrRefreshFilterUi(Q)},Y.onAction=(H,_,U)=>{this.updateModel(Q,H,_),this.dispatchLocalEvent({type:"filterAction",column:Q,action:H,event:U})},Y.getHandler=()=>this.getHandler(Q,!0),Y.onUiChange=(H)=>this.filterUiChanged(Q,H),Y.source=J}return X}createFilterUiForHandler(Q,z){return z?{created:!1,create:z,filterParams:Q.params,compDetails:Q}:null}createFilterUiLegacy(Q,z,J){let Z=z(),$={created:!0,create:z,filterParams:Q.params,compDetails:Q,promise:Z};return Z.then(J),$}createFilterWrapper(Q){let{compDetails:z,handler:J,handlerGenerator:Z,handlerParams:$,createFilterUi:X}=this.createFilterInstance(Q,Q.getColDef(),this.getDefaultFilter(Q),(G)=>G),Y=Q.getColId();if(J)return delete this.initialModel[Y],J.init?.({...$,source:"init",model:F0(this.model,Y)}),{column:Q,isHandler:!0,handler:J,handlerGenerator:Z,handlerParams:$,filterUi:this.createFilterUiForHandler(z,X)};if(X){let G={column:Q,filterUi:null,isHandler:!1};return G.filterUi=this.createFilterUiLegacy(z,X,(q)=>{G.filter=q??void 0}),G}return{column:Q,filterUi:null,isHandler:!1}}createHandlerFunc(Q,z,J){let{gos:Z,frameworkOverrides:$,registry:X}=this.beans,Y,G=(B)=>{let E=B.filter;if(S9(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},q=Z.get("enableFilterHandlers"),H=q?G(z):void 0,_=(B)=>()=>this.createBean(X.createDynamicBean(B,!0)),U,W;if(typeof H==="string"){let B=Z.get("filterHandlers")?.[H];if(B!=null)U=B;else if(CL.has(H))U=_(H),W=H}else U=H;if(!U){let B,{compName:E,jsComp:K,fwComp:L}=T9($,z);if(E)B=E;else if(K==null&&L==null&&z.filter===!0)B=J;if(W=this.handlerMap[B],W)U=_(W)}if(!U){if(!q)return;if(o(Z))R(277,{colId:Q.getColId()});return eL}return{filterHandler:U,handlerNameOrCallback:Y??W}}createHandler(Q,z,J){let Z=this.createHandlerFunc(Q,z,J);if(!Z)return;let $=R2(this.beans.userCompFactory,z,this.createFilterCompParams(Q,!0,"init")),{handlerNameOrCallback:X,filterHandler:Y}=Z,{handler:G,handlerParams:q}=this.createHandlerFromFunc(Q,Y,$);return{handler:G,handlerParams:q,handlerGenerator:X??Y}}createHandlerFromFunc(Q,z,J){let Z=Q.getColDef(),$=z(y(this.gos,{column:Q,colDef:Z})),X=this.createHandlerParams(Q,J);return{handler:$,handlerParams:X}}createHandlerParams(Q,z){let J=Q.getColDef(),Z=Q.getColId(),$=this.filterChangedCallbackFactory(Q);return y(this.gos,{colDef:J,column:Q,getValue:this.createGetValue(Q),doesRowPassOtherFilter:(X)=>this.beans.filterManager?.doesRowPassOtherFilters(Z,X)??!0,onModelChange:(X,Y)=>{this.updateStoredModel(Z,X),this.refreshHandlerAndUi(Q,X,"handler",!1,Y).then(()=>{$({...Y,source:"columnFilter"})})},onModelAsStringChange:()=>{Q.dispatchColEvent("filterChanged","filterChanged"),this.dispatchLocalEvent({type:"filterModelAsStringChanged",column:Q})},filterParams:z})}onColumnsChanged(){let Q=[],{colModel:z,filterManager:J,groupFilter:Z}=this.beans;this.allColumnFilters.forEach((X,Y)=>{let G;if(X.column.isPrimary())G=z.getColDefCol(Y);else G=z.getCol(Y);if(G&&G===X.column)return;Q.push(X.column),this.disposeFilterWrapper(X,"columnChanged"),this.disposeColumnListener(Y)});let $=Z&&Q.every((X)=>Z.isGroupFilter(X));if(Q.length>0&&!$)J?.onFilterChanged({columns:Q,source:"api"})}isFilterAllowed(Q){if(!Q.isFilterAllowed())return!1;let J=this.beans.groupFilter;if(J?.isGroupFilter(Q))return J.isFilterAllowed(Q);return!0}getFloatingFilterCompDetails(Q,z){let{userCompFactory:J,frameworkOverrides:Z,selectableFilter:$,gos:X}=this.beans,Y=(B)=>{this.getOrCreateFilterUi(Q)?.then((K)=>{B(mQ(K))})},G=Q.getColDef(),q=$?.isSelectable(G)?$.getFilterDef(Q,G):G,H=b6(Z,q,()=>this.getDefaultFloatingFilter(Q))??"agReadOnlyFloatingFilter",_=X.get("enableFilterHandlers"),U=R2(J,q,this.createFilterCompParams(Q,_,"init",!0)),W=y(X,{column:Q,filterParams:U,currentParentModel:()=>this.getCurrentFloatingFilterParentModel(Q),parentFilterInstance:Y,showParentFilter:z});if(_){let B=W,E=Q.getColId(),K=this.filterChangedCallbackFactory(Q);B.onUiChange=(L)=>this.floatingFilterUiChanged(Q,L),B.model=F0(this.model,E),B.onModelChange=(L,F)=>{this.updateStoredModel(E,L),this.refreshHandlerAndUi(Q,L,"floating",!0,F).then(()=>{K({...F,source:"columnFilter"})})},B.getHandler=()=>this.getHandler(Q,!0),B.source="init"}return t5(J,G,W,H)}getCurrentFloatingFilterParentModel(Q){return this.getModelFromFilterWrapper(this.cachedFilter(Q)??{column:Q})}destroyFilterUi(Q,z,J,Z){if(Q.isHandler){let X=z.getColId();delete this.initialModel[X],this.state.delete(X);let Y=Q.filterUi,G=this.createFilterUiForHandler(J,Z);Q.filterUi=G;let q=this.eventSvc;if(Y?.created)Y.promise.then((H)=>{this.destroyBean(H),q.dispatchEvent({type:"filterDestroyed",source:"paramsUpdated",column:z})});else q.dispatchEvent({type:"filterHandlerDestroyed",source:"paramsUpdated",column:z})}else this.destroyFilter(z,"paramsUpdated")}destroyFilter(Q,z="api"){let J=Q.getColId(),Z=this.allColumnFilters.get(J);if(this.disposeColumnListener(J),delete this.initialModel[J],Z)this.disposeFilterWrapper(Z,z).then(($)=>{if($&&this.isAlive())this.beans.filterManager?.onFilterChanged({columns:[Q],source:"api"})})}disposeColumnListener(Q){let z=this.allColumnListeners.get(Q);if(z)this.allColumnListeners.delete(Q),z()}disposeFilterWrapper(Q,z){let J=!1,{column:Z,isHandler:$,filterUi:X}=Q,Y=Z.getColId();if($)J=this.isHandlerActive(Z),this.destroyBean(Q.handler),delete this.model[Y],this.state.delete(Y);let G=()=>{this.setColFilterActive(Z,!1,"filterDestroyed"),this.allColumnFilters.delete(Y),this.eventSvc.dispatchEvent({type:"filterDestroyed",source:z,column:Z})};if(X)if(X.created)return X.promise.then((q)=>{return J=$?J:!!q?.isFilterActive(),this.destroyBean(q),G(),J});else G();return g.resolve(J)}filterChangedCallbackFactory(Q){return(z)=>{this.callOnFilterChangedOutsideRenderCycle({additionalEventAttributes:z,columns:[Q],column:Q,source:z?.source??"columnFilter"})}}filterParamsChanged(Q,z="api"){let J=this.allColumnFilters.get(Q);if(!J)return;let Z=this.beans,$=J.column,X=$.getColDef(),Y=$.isFilterAllowed(),G=this.getDefaultFilter($),q=Z.selectableFilter,H=q?.isSelectable(X)?q.getFilterDef($,X):X,_=Y?this.createHandlerFunc($,H,this.getDefaultFilter($)):void 0,U=!!_,W=J.isHandler;if(W!=U){this.destroyFilter($,"paramsUpdated");return}let{compDetails:B,createFilterUi:E}=(Y?this.createFilterComp($,H,G,(L)=>L,U,"colDef"):null)??{compDetails:null,createFilterUi:null},K=B?.params??R2(Z.userCompFactory,H,this.createFilterCompParams($,U,"colDef"));if(W){let L=_?.handlerNameOrCallback??_?.filterHandler,F=F0(this.model,Q);if(J.handlerGenerator!=L){let D=J.handler,{handler:M,handlerParams:k}=this.createHandlerFromFunc($,_.filterHandler,K);if(J.handler=M,J.handlerParams=k,J.handlerGenerator=L,delete this.model[Q],M.init?.({...k,source:"init",model:null}),this.destroyBean(D),F!=null)this.beans.filterManager?.onFilterChanged({columns:[$],source:z})}else{let D=this.createHandlerParams($,B?.params);J.handlerParams=D,J.handler.refresh?.({...D,source:"colDef",model:F})}}if(this.areFilterCompsDifferent(J.filterUi?.compDetails??null,B)||!J.filterUi||!B){this.destroyFilterUi(J,$,B,E);return}J.filterUi.filterParams=K,aQ(J,W)?.then((L)=>{if((L?.refresh?L.refresh(K):!0)===!1)this.destroyFilterUi(J,$,B,E);else this.dispatchLocalEvent({type:"filterParamsChanged",column:$,params:K})})}refreshHandlerAndUi(Q,z,J,Z,$){let X=this.cachedFilter(Q);if(!X){if(Z)this.getOrCreateFilterWrapper(Q,!0);return g.resolve()}if(!X.isHandler)return g.resolve();let{filterUi:Y,handler:G,handlerParams:q}=X;return rZ(()=>{if(Y){let{created:H,filterParams:_}=Y;if(H)return Y.promise.then((U)=>{return U?{filter:U,filterParams:_}:void 0});else Y.refreshed=!0}return g.resolve(void 0)},G,q,z,this.state.get(Q.getColId())??{model:z},J,$)}setColumnFilterWrapper(Q,z){let J=Q.getColId();this.allColumnFilters.set(J,z),this.allColumnListeners.set(J,this.addManagedListeners(Q,{colDefChanged:()=>this.filterParamsChanged(J)})[0])}areFilterCompsDifferent(Q,z){if(!z||!Q)return!0;let{componentClass:J}=Q,{componentClass:Z}=z;return!(J===Z||J?.render&&Z?.render&&J.render===Z.render)}hasFloatingFilters(){return this.beans.colModel.getCols().some((z)=>z.getColDef().floatingFilter)}getFilterInstance(Q){let z=this.beans.colModel.getColDefCol(Q);if(!z)return Promise.resolve(void 0);let J=this.getOrCreateFilterUi(z);if(!J)return Promise.resolve(null);return new Promise((Z)=>{J.then(($)=>{Z(mQ($))})})}processFilterModelUpdateQueue(){this.modelUpdates.forEach(({model:Q,source:z})=>this.setModel(Q,z)),this.modelUpdates=[],this.columnModelUpdates.forEach(({key:Q,model:z,resolve:J})=>{this.setModelForColumn(Q,z).then(()=>J())}),this.columnModelUpdates=[]}getModelForColumn(Q,z){if(z){let{state:Z,model:$}=this,X=Q.getColId(),Y=Z.get(X);if(Y)return Y.model??null;return F0($,X)}let J=this.cachedFilter(Q);return J?this.getModelFromFilterWrapper(J):null}setModelForColumn(Q,z){if(this.beans.dataTypeSvc?.isPendingInference){let J=()=>{},Z=new Promise(($)=>{J=$});return this.columnModelUpdates.push({key:Q,model:z,resolve:J}),Z}return new Promise((J)=>{this.setModelForColumnLegacy(Q,z).then((Z)=>J(Z))})}getStateForColumn(Q){return this.state.get(Q)??{model:F0(this.model,Q)}}setModelForColumnLegacy(Q,z){let J=this.beans.colModel.getColDefCol(Q),Z=J?this.getOrCreateFilterWrapper(J,!0):null;return Z?this.setModelOnFilterWrapper(Z,z):g.resolve()}setColDefPropsForDataType(Q,z,J){let Z=Q.filter,$=Z===!0?this.getDefaultFilterFromDataType(()=>z.baseDataType):Z;if(typeof $!=="string")return;let X,Y,G=this.beans,{filterParams:q,filterValueGetter:H}=Q;if($==="agMultiColumnFilter")({filterParams:X,filterValueGetter:Y}=G.multiFilter?.getParamsForDataType(q,H,z,J)??{});else({filterParams:X,filterValueGetter:Y}=I6($,q,H,z,J,G,this.getLocaleTextFunc()));if(Q.filterParams=X,Y)Q.filterValueGetter=Y}setColFilterActive(Q,z,J,Z){if(Q.filterActive!==z)Q.filterActive=z,Q.dispatchColEvent("filterActiveChanged",J);Q.dispatchColEvent("filterChanged",J,Z)}setModelOnFilterWrapper(Q,z,J){return new g((Z)=>{if(Q.isHandler){let X=Q.column,Y=X.getColId(),G=this.model[Y];if(this.updateStoredModel(Y,z),J&&z===G){Z();return}this.refreshHandlerAndUi(X,z,"api").then(()=>Z());return}let $=aQ(Q);if($){$.then((X)=>{if(typeof X?.setModel!=="function"){R(65),Z();return}(X.setModel(z)||g.resolve()).then(()=>Z())});return}Z()})}updateStoredModel(Q,z){if(T(z))this.model[Q]=z;else delete this.model[Q];let J=this.state.get(Q),Z={model:z,state:J?.state};this.state.set(Q,Z)}filterModified(Q,z){this.getOrCreateFilterUi(Q)?.then((J)=>{this.eventSvc.dispatchEvent({type:"filterModified",column:Q,filterInstance:J,...z})})}filterUiChanged(Q,z){if(this.gos.get("enableFilterHandlers"))this.eventSvc.dispatchEvent({type:"filterUiChanged",column:Q,...z})}floatingFilterUiChanged(Q,z){if(this.gos.get("enableFilterHandlers"))this.eventSvc.dispatchEvent({type:"floatingFilterUiChanged",column:Q,...z})}updateModel(Q,z,J){let Z=Q.getColId(),$=this.cachedFilter(Q),X=()=>$?.filterUi;FZ({action:z,filterParams:$?.filterUi?.filterParams,getFilterUi:X,getModel:()=>F0(this.model,Z),getState:()=>this.state.get(Z),updateState:(Y)=>this.updateState(Q,Y),updateModel:(Y)=>X()?.filterParams?.onModelChange(Y,{...J,fromAction:z}),processModelToApply:$?.isHandler?$.handler.processModelToApply?.bind($.handler):void 0})}updateAllModels(Q,z){let J=[];if(this.allColumnFilters.forEach((Z,$)=>{let X=this.beans.colModel.getColDefCol($);if(X)FZ({action:Q,filterParams:Z.filterUi?.filterParams,getFilterUi:()=>Z.filterUi,getModel:()=>F0(this.model,$),getState:()=>this.state.get($),updateState:(Y)=>this.updateState(X,Y),updateModel:(Y)=>{this.updateStoredModel($,Y),this.dispatchLocalEvent({type:"filterAction",column:X,action:Q}),J.push(this.refreshHandlerAndUi(X,Y,"ui"))},processModelToApply:Z?.isHandler?Z.handler.processModelToApply?.bind(Z.handler):void 0})}),J.length)g.all(J).then(()=>{this.callOnFilterChangedOutsideRenderCycle({source:"columnFilter",additionalEventAttributes:z,columns:[]})})}updateOrRefreshFilterUi(Q){let z=Q.getColId();EX(()=>this.cachedFilter(Q)?.filterUi,()=>F0(this.model,z),()=>this.state.get(z))}updateState(Q,z){this.state.set(Q.getColId(),z),this.dispatchLocalEvent({type:"filterStateChanged",column:Q,state:z})}canApplyAll(){let{state:Q,model:z,activeFilterComps:J}=this;for(let $ of J)if($.source==="COLUMN_MENU")return!1;let Z=!1;for(let $ of Q.keys()){let X=Q.get($);if(X.valid===!1)return!1;if((X.model??null)!==F0(z,$))Z=!0}return Z}hasUnappliedModel(Q){let{model:z,state:J}=this;return(J.get(Q)?.model??null)!==F0(z,Q)}setGlobalButtons(Q){this.isGlobalButtons=Q,this.dispatchLocalEvent({type:"filterGlobalButtons",isGlobal:Q})}shouldKeepStateOnDetach(Q,z){if(z==="newFiltersToolPanel")return!0;let J=this.beans.filterPanelSvc;if(J?.isActive)return!!J.getState(Q.getColId());return!1}onPivotModeChanged(Q){let{colModel:z,pivotColsSvc:J}=this.beans,Z=!!TQ(this.gos),$=Q.currentValue,X=$?this.activeColumnFilters:this.activeAggregateFilters,Y=$?this.activeAggregateFilters:this.activeColumnFilters,G=[];for(let q of X){let H=z.getColById(q.colId),_=$&&!!J?.columns.length;if(H&&$===f8(H,$,_,Z))Y.push(q),G.push(q)}JJ(X,G)}destroy(){super.destroy(),this.allColumnFilters.forEach((Q)=>this.disposeFilterWrapper(Q,"gridDestroyed")),this.allColumnListeners.clear(),this.state.clear(),this.activeFilterComps.clear()}};function zF(Q){return!!Q.filterManager?.isAnyFilterPresent()}function JF(Q,z="api"){Q.filterManager?.onFilterChanged({source:z})}var ZF=class extends j{constructor(){super(...arguments);this.beanName="filterManager",this.advFilterModelUpdateQueue=[]}wireBeans(Q){this.quickFilter=Q.quickFilter,this.advancedFilter=Q.advancedFilter,this.colFilter=Q.colFilter}postConstruct(){let Q=this.refreshFiltersForAggregations.bind(this),z=this.updateAdvFilterColumns.bind(this);if(this.addManagedEventListeners({columnValueChanged:Q,columnPivotChanged:Q,columnPivotModeChanged:Q,newColumnsLoaded:z,columnVisible:z,advancedFilterEnabledChanged:({enabled:Z})=>this.onAdvFilterEnabledChanged(Z),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:J}=this;this.alwaysPassFilter=J.get("alwaysPassFilter"),this.addManagedPropertyListener("alwaysPassFilter",()=>{this.alwaysPassFilter=J.get("alwaysPassFilter"),this.onFilterChanged({source:"api"})})}isExternalFilterPresentCallback(){let Q=this.gos.getCallback("isExternalFilterPresent");return typeof Q==="function"&&Q({})}doesExternalFilterPass(Q){let z=this.gos.get("doesExternalFilterPass");return typeof z==="function"&&z(Q)}setFilterState(Q,z,J="api"){if(this.isAdvFilterEnabled())return;this.colFilter?.setState(Q,z,J)}setFilterModel(Q,z="api",J){if(this.isAdvFilterEnabled()){if(!J)this.warnAdvFilters();return}this.colFilter?.setModel(Q,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(Q){if(Q){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(TQ(this.gos)&&this.isAnyFilterPresent())this.onFilterChanged()}onFilterChanged(Q={}){let{source:z,additionalEventAttributes:J,columns:Z=[]}=Q;this.externalFilterPresent=this.isExternalFilterPresentCallback(),(this.colFilter?this.colFilter.updateBeforeFilterChanged(Q):g.resolve()).then(()=>{let $={source:z,type:"filterChanged",columns:Z};if(J)B0($,J);this.eventSvc.dispatchEvent($),this.colFilter?.updateAfterFilterChanged()})}isSuppressFlashingCellsBecauseFiltering(){return!!this.colFilter?.isSuppressFlashingCellsBecauseFiltering()}isQuickFilterPresent(){return!!this.quickFilter?.isFilterPresent()}updateAggFiltering(){this.aggFiltering=!!TQ(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(Q,z){return this.doesRowPassFilter({rowNode:z,colIdToSkip:Q})}doesRowPassAggregateFilters(Q){let{rowNode:z}=Q;if(this.alwaysPassFilter?.(z))return!0;if(this.isAggregateQuickFilterPresent()&&!this.quickFilter.doesRowPass(z))return!1;if(this.isAggregateFilterPresent()&&!this.colFilter.doFiltersPass(z,Q.colIdToSkip,!0))return!1;return!0}doesRowPassFilter(Q){let{rowNode:z}=Q;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,Q.colIdToSkip))return!1;if(this.isAdvFilterPresent()&&!this.advancedFilter.doesFilterPass(z))return!1;return!0}isFilterAllowed(Q){if(this.isAdvFilterEnabled())return!1;return!!this.colFilter?.isFilterAllowed(Q)}getAdvFilterModel(){return this.isAdvFilterEnabled()?this.advancedFilter.getModel():null}setAdvFilterModel(Q,z="api"){if(!this.isAdvFilterEnabled())return;if(this.beans.dataTypeSvc?.isPendingInference){this.advFilterModelUpdateQueue.push(Q);return}this.advancedFilter.setModel(Q??null),this.onFilterChanged({source:z})}toggleAdvFilterBuilder(Q,z){if(!this.isAdvFilterEnabled())return;this.advancedFilter.getCtrl().toggleFilterBuilder({source:z,force:Q})}updateAdvFilterColumns(){if(!this.isAdvFilterEnabled())return;if(this.advancedFilter.updateValidity())this.onFilterChanged({source:"advancedFilter"})}hasFloatingFilters(){if(this.isAdvFilterEnabled())return!1;return!!this.colFilter?.hasFloatingFilters()}getColumnFilterInstance(Q){if(this.isAdvFilterEnabled())return this.warnAdvFilters(),Promise.resolve(void 0);return this.colFilter?.getFilterInstance(Q)??Promise.resolve(void 0)}warnAdvFilters(){R(68)}setupAdvFilterHeaderComp(Q){this.advancedFilter?.getCtrl().setupHeaderComp(Q)}getHeaderRowCount(){return this.isAdvFilterHeaderActive()?1:0}getHeaderHeight(){return this.isAdvFilterHeaderActive()?this.advancedFilter.getCtrl().getHeaderHeight():0}processFilterModelUpdateQueue(){for(let Q of this.advFilterModelUpdateQueue)this.setAdvFilterModel(Q);this.advFilterModelUpdateQueue=[]}setColumnFilterModel(Q,z){if(this.isAdvFilterEnabled())return this.warnAdvFilters(),Promise.resolve();return this.colFilter?.setModelForColumn(Q,z)??Promise.resolve()}};function $F(Q){return{tag:"div",cls:Q}}var y6=class extends x{constructor(Q){let{className:z="ag-filter-apply-panel"}=Q??{};super($F(z));this.listeners=[],this.validationMessage=null,this.className=z}updateButtons(Q,z){let J=this.buttons;if(this.buttons=Q,J===Q)return;let Z=this.getGui();z0(Z);let $;this.destroyListeners();let X=document.createDocumentFragment(),Y=this.className,G=({type:H,label:_})=>{let U=(F)=>{this.dispatchLocalEvent({type:H,event:F})};if(!["apply","clear","reset","cancel"].includes(H))R(75);let W=H==="apply",E=Z0({tag:"button",attrs:{type:W&&z?"submit":"button"},ref:`${H}FilterButton`,cls:`ag-button ag-standard-button ${Y}-button${W?" "+Y+"-apply-button":""}`,children:_});if(this.activateTabIndex([E]),W)$=E;let K=(F)=>{if(F.key===V.ENTER)F.preventDefault(),U(F)},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 H of Q)G(H);this.eApply=$;let q=this.validationTooltipFeature;if($&&!q)this.validationTooltipFeature=this.createOptionalManagedBean(this.beans.registry.createDynamicBean("tooltipFeature",!1,{getGui:()=>this.eApply,getLocation:()=>"advancedFilter",getTooltipShowDelayOverride:()=>1000}));else if(!$&&q)this.validationTooltipFeature=this.destroyBean(q);Z.append(X)}getApplyButton(){return this.eApply}updateValidity(Q,z=null){let J=this.eApply;if(!J)return;T5(J,!Q),this.validationMessage=z,this.validationTooltipFeature?.setTooltipAndRefresh(this.validationMessage)}destroyListeners(){for(let Q of this.listeners)Q();this.listeners=[]}destroy(){this.destroyListeners(),super.destroy()}};var x6=class extends x{constructor(Q,z,J,Z,$,X){super();this.column=Q,this.wrapper=z,this.eventParent=J,this.updateModel=Z,this.isGlobalButtons=$,this.enableGlobalButtonCheck=X,this.hidePopup=null,this.applyActive=!1}postConstruct(){let{comp:Q,params:z}=this.wrapper,J=z,Z=J.useForm,$=Z?"form":"div";if(this.setTemplate({tag:$,cls:"ag-filter-wrapper"}),Z)this.addManagedElementListeners(this.getGui(),{submit:(X)=>{X?.preventDefault()},keydown:this.handleKeyDown.bind(this)});this.appendChild(Q.getGui()),this.params=J,this.resetButtonsPanel(J),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:G})=>{if(X===this.column)this.afterAction(Y,G)},...this.enableGlobalButtonCheck?{filterGlobalButtons:({isGlobal:X})=>{if(X!==this.isGlobalButtons){this.isGlobalButtons=X;let Y=this.params;this.resetButtonsPanel(Y,Y,!0)}}}:void 0})}afterGuiAttached(Q){if(Q)this.hidePopup=Q.hidePopup}resetButtonsPanel(Q,z,J){let{buttons:Z,readOnly:$}=z??{},{buttons:X,readOnly:Y,useForm:G}=Q;if(!J&&$===Y&&DZ(Z,X))return;let q=X&&X.length>0&&!Q.readOnly&&!this.isGlobalButtons,H=this.eButtons;if(q){let _=X.map((U)=>{let W=`${U}Filter`;return{type:U,label:N9(this,W)}});if(this.applyActive=WJ(this.params),!H){H=this.createBean(new y6),this.appendChild(H.getGui());let U=this.column,W=(B)=>({event:E})=>{this.updateModel(U,B,{fromButtons:!0}),this.afterAction(B,E)};H?.addManagedListeners(H,{apply:W("apply"),clear:W("clear"),reset:W("reset"),cancel:W("cancel")}),this.eButtons=H}H.updateButtons(_,G)}else if(this.applyActive=!1,H)T0(H.getGui()),this.eButtons=this.destroyBean(H)}close(Q){let z=this.hidePopup;if(!z)return;let J=Q,Z=J?.key,$;if(Z===V.ENTER||Z===V.SPACE)$={keyboardEvent:J};z($),this.hidePopup=null}afterAction(Q,z){let{params:J,applyActive:Z}=this,$=J?.closeOnApply;switch(Q){case"apply":{if(z?.preventDefault(),$&&Z)this.close(z);break}case"reset":{if($&&Z)this.close();break}case"cancel":{if($)this.close(z);break}}}handleKeyDown(Q){if(!Q.defaultPrevented&&Q.key===V.ENTER&&this.applyActive)this.updateModel(this.column,"apply",{fromButtons:!0}),this.afterAction("apply",Q)}destroy(){this.hidePopup=null,this.eButtons=this.destroyBean(this.eButtons)}},XF=":where(.ag-menu:not(.ag-tabs) .ag-filter)>:not(.ag-filter-wrapper){min-width:180px}",YF={tag:"div",cls:"ag-filter"},w6=class extends x{constructor(Q,z,J){super(YF);this.column=Q,this.source=z,this.enableGlobalButtonCheck=J,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((Q)=>Q.comp)??null}afterInit(){return this.wrapper?.then(()=>{})??g.resolve()}afterGuiAttached(Q){this.afterGuiAttachedParams=Q,this.wrapper?.then((z)=>{this.comp?.afterGuiAttached(Q),z?.comp?.afterGuiAttached?.(Q)})}afterGuiDetached(){this.wrapper?.then((Q)=>{Q?.comp?.afterGuiDetached?.()})}createFilter(Q){let{column:z,source:J,beans:{colFilter:Z}}=this,$=Z.getFilterUiForDisplay(z)??null;this.wrapper=$,$?.then((X)=>{if(!X)return;let{isHandler:Y,comp:G}=X,q;if(Y){let H=!!this.enableGlobalButtonCheck,_=this.createBean(new x6(z,X,Z,Z.updateModel.bind(Z),H&&Z.isGlobalButtons,H));this.comp=_,q=_.getGui()}else if(this.registerCSS(XF),q=G.getGui(),!T(q))R(69,{guiFromFilter:q});if(this.appendChild(q),Q)this.eventSvc.dispatchEvent({type:"filterOpened",column:z,source:J,eGui:this.getGui()});else G.afterGuiAttached?.(this.afterGuiAttachedParams)})}onFilterDestroyed(Q){let{source:z,column:J}=Q;if((z==="api"||z==="paramsUpdated")&&J.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()}},GF=class extends j{constructor(){super(...arguments);this.beanName="filterMenuFactory"}wireBeans(Q){this.popupSvc=Q.popupSvc}hideActiveMenu(){this.hidePopup?.()}showMenuAfterMouseEvent(Q,z,J,Z){if(Q&&!Q.isColumn)return;this.showPopup(Q,($)=>{this.popupSvc?.positionPopupUnderMouseEvent({additionalParams:{column:Q},type:J,mouseEvent:z,ePopup:$})},J,z.target,U0(this.gos),Z)}showMenuAfterButtonClick(Q,z,J,Z){if(Q&&!Q.isColumn)return;let $=-1,X="left",Y=U0(this.gos);if(!Y&&this.gos.get("enableRtl"))$=1,X="right";let G=Y?void 0:4*$,q=Y?void 0:4;this.showPopup(Q,(H)=>{this.popupSvc?.positionPopupByComponent({type:J,eventSource:z,ePopup:H,nudgeX:G,nudgeY:q,alignSide:X,keepWithinBounds:!0,position:"under",additionalParams:{column:Q}})},J,z,Y,Z)}showPopup(Q,z,J,Z,$,X){let Y=Q?this.createBean(new w6(Q,"COLUMN_MENU")):void 0;if(this.activeMenu=Y,!Y?.hasFilter()||!Q){e(57);return}let G=Z0({tag:"div",cls:`ag-menu${!$?" ag-filter-menu":""}`,role:"presentation"});[this.tabListener]=this.addManagedElementListeners(G,{keydown:(K)=>this.trapFocusWithin(K,G)}),G.appendChild(Y?.getGui());let q,H=()=>Y?.afterGuiDetached(),_=h5(this.gos)?Z??this.beans.ctrlsSvc.getGridBodyCtrl().eGridBody:void 0,U=(K)=>{zJ(Q,!1,"contextMenu");let L=K instanceof KeyboardEvent;if(this.tabListener)this.tabListener=this.tabListener();if(L&&Z&&f0(Z))xZ(Z)?.focus({preventScroll:!0});H(),this.destroyBean(this.activeMenu),this.dispatchVisibleChangedEvent(!1,J,Q),X?.()},W=this.getLocaleTextFunc(),B=$&&J!=="columnFilter"?W("ariaLabelColumnMenu","Column Menu"):W("ariaLabelColumnFilter","Column Filter"),E=this.popupSvc?.addPopup({modal:!0,eChild:G,closeOnEsc:!0,closedCallback:U,positionCallback:()=>z(G),anchorToElement:_,ariaLabel:B});if(E)this.hidePopup=q=E.hideFunc;Y.afterInit().then(()=>{z(G),Y.afterGuiAttached({container:J,hidePopup:q})}),zJ(Q,!0,"contextMenu"),this.dispatchVisibleChangedEvent(!0,J,Q)}trapFocusWithin(Q,z){if(Q.key!==V.TAB||Q.defaultPrevented||R0(this.beans,z,!1,Q.shiftKey))return;Q.preventDefault(),D0(z,Q.shiftKey)}dispatchVisibleChangedEvent(Q,z,J){this.eventSvc.dispatchEvent({type:"columnMenuVisibleChanged",visible:Q,switchingTab:!1,key:z,column:J??null,columnGroup:null})}isMenuEnabled(Q){return Q.isFilterAllowed()&&(Q.getColDef().menuTabs??["filterMenuTab"]).includes("filterMenuTab")}showMenuAfterContextMenuEvent(){}destroy(){this.destroyBean(this.activeMenu),super.destroy()}},qF=class extends j{constructor(){super(...arguments);this.beanName="filterValueSvc"}getValue(Q,z,J){if(!z)return;let Z=Q.getColDef(),{selectableFilter:$,valueSvc:X,formula:Y}=this.beans,G=J??$?.getFilterValueGetter(Q.getColId())??Z.filterValueGetter;if(G)return this.executeFilterValueGetter(G,z.data,Q,z,Z);let q=X.getValue(Q,z,"data");if(Q.isAllowFormula()&&Y?.isFormula(q))return Y.resolveValue(Q,z);return q}executeFilterValueGetter(Q,z,J,Z,$){let{expressionSvc:X,valueSvc:Y}=this.beans,G=y(this.gos,{data:z,node:Z,column:J,colDef:$,getValue:Y.getValueCallback.bind(Y,Z)});if(typeof Q==="function")return Q(G);return X?.evaluate(Q,G)}};function HF(Q){return!!Q.quickFilter?.isFilterPresent()}function _F(Q){return Q.quickFilter?.getText()}function UF(Q){Q.quickFilter?.resetCache()}var WF=class extends j{constructor(){super(...arguments);this.beanName="quickFilter",this.quickFilter=null,this.quickFilterParts=null}postConstruct(){let Q=this.resetCache.bind(this),z=this.gos;this.addManagedEventListeners({columnPivotModeChanged:Q,newColumnsLoaded:Q,columnRowGroupChanged:Q,columnVisible:()=>{if(!z.get("includeHiddenColumnsInQuickFilter"))this.resetCache()}}),this.addManagedPropertyListener("quickFilterText",(J)=>this.setFilter(J.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:Q,colModel:z,gos:J,pivotResultCols:Z}=this.beans,$=z.isPivotMode(),X=Q?.getColumns(),Y=z.getColDefCols(),G=($&&!J.get("applyQuickFilterBeforePivotOrAgg")?Z?.getPivotResultCols()?.list:Y)??[];if(X)G=G.concat(X);this.colsToUse=J.get("includeHiddenColumnsInQuickFilter")?G:G.filter((q)=>q.isVisible()||q.isRowGroupActive())}isFilterPresent(){return this.quickFilter!==null}doesRowPass(Q){let z=this.gos.get("cacheQuickFilter");if(this.matcher)return this.doesRowPassMatcher(z,Q);return this.quickFilterParts.every((J)=>z?this.doesRowPassCache(Q,J):this.doesRowPassNoCache(Q,J))}resetCache(){this.beans.rowModel.forEachNode((Q)=>Q.quickFilterAggregateText=null)}getText(){return this.gos.get("quickFilterText")}setFilterParts(){let{quickFilter:Q,parser:z}=this;if(Q)this.quickFilterParts=z?z(Q):Q.split(" ");else this.quickFilterParts=null}parseFilter(Q){if(!T(Q))return null;return Q.toUpperCase()}setFilter(Q){if(Q!=null&&typeof Q!=="string"){R(70,{newFilter:Q});return}let z=this.parseFilter(Q);if(this.quickFilter!==z)this.quickFilter=z,this.setFilterParts(),this.dispatchLocalEvent({type:"quickFilterChanged"})}setParserAndMatcher(){let Q=this.gos.get("quickFilterParser"),z=this.gos.get("quickFilterMatcher"),J=Q!==this.parser||z!==this.matcher;if(this.parser=Q,this.matcher=z,J)this.setFilterParts(),this.dispatchLocalEvent({type:"quickFilterChanged"})}onColumnConfigChanged(){if(this.refreshCols(),this.resetCache(),this.isFilterPresent())this.dispatchLocalEvent({type:"quickFilterChanged"})}doesRowPassNoCache(Q,z){return this.colsToUse.some((J)=>{let Z=this.getTextForColumn(J,Q);return T(Z)&&Z.includes(z)})}doesRowPassCache(Q,z){return this.checkGenerateAggText(Q),Q.quickFilterAggregateText.includes(z)}doesRowPassMatcher(Q,z){let J;if(Q)this.checkGenerateAggText(z),J=z.quickFilterAggregateText;else J=this.getAggText(z);let{quickFilterParts:Z,matcher:$}=this;return $(Z,J)}checkGenerateAggText(Q){if(!Q.quickFilterAggregateText)Q.quickFilterAggregateText=this.getAggText(Q)}getTextForColumn(Q,z){let J=this.beans.filterValueSvc.getValue(Q,z),Z=Q.getColDef();if(Z.getQuickFilterText){let $=y(this.gos,{value:J,node:z,data:z.data,column:Q,colDef:Z});J=Z.getQuickFilterText($)}return T(J)?J.toString().toUpperCase():null}getAggText(Q){let z=[];for(let J of this.colsToUse){let Z=this.getTextForColumn(J,Q);if(T(Z))z.push(Z)}return z.join(` -`)}},BF={moduleName:"ClientSideRowModelFilter",version:p,rowModels:["clientSide"],beans:[kK]},KX={moduleName:"FilterCore",version:p,beans:[ZF],apiFunctions:{isAnyFilterPresent:zF,onFilterChanged:JF},css:[NL],dependsOn:[BF]},LX={moduleName:"FilterValue",version:p,beans:[qF]},FX={moduleName:"ColumnFilter",version:p,beans:[QF,GF],dynamicBeans:{headerFilterCellCtrl:bL},icons:{filter:"filter",filterActive:"filter"},apiFunctions:{isColumnFilterPresent:gL,getColumnFilterInstance:hL,destroyFilter:uL,setFilterModel:mL,getFilterModel:cL,getColumnFilterModel:pL,setColumnFilterModel:iL,showColumnFilter:nL,hideColumnFilter:dL,getColumnFilterHandler:tL,doFilterAction:rL},dependsOn:[KX,nz,LX,v6]};var EF={moduleName:"QuickFilterCore",version:p,rowModels:["clientSide"],beans:[WF],dependsOn:[KX,LX]},DX={moduleName:"QuickFilter",version:p,apiFunctions:{isQuickFilterPresent:HF,getQuickFilter:_F,resetQuickFilter:UF},dependsOn:[EF]};var KF=class extends j{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(Q,z){let J=this.wrapSvc?.wrap(Q,z)??z,Z=!lJ.has(Q),$=Z?this.asyncListeners:this.syncListeners;if(!$.has(Q))$.set(Q,new Set);$.get(Q).add(J),this.eventSvc.addListener(Q,J,Z)}removeListener(Q,z){let J=this.wrapSvc?.unwrap(Q,z)??z,$=!!this.asyncListeners.get(Q)?.delete(J);if(!$)this.syncListeners.get(Q)?.delete(J);this.eventSvc.removeListener(Q,J,$)}addGlobalListener(Q){let z=this.wrapSvc?.wrapGlobal(Q)??Q,J=(X,Y)=>{if(lJ.has(X))z(X,Y)},Z=(X,Y)=>{if(!lJ.has(X))z(X,Y)};this.globalListenerPairs.set(Q,{syncListener:J,asyncListener:Z});let $=this.eventSvc;$.addGlobalListener(J,!1),$.addGlobalListener(Z,!0)}removeGlobalListener(Q){let{eventSvc:z,wrapSvc:J,globalListenerPairs:Z}=this,$=J?.unwrapGlobal(Q)??Q;if(Z.has($)){let{syncListener:Y,asyncListener:G}=Z.get($);z.removeGlobalListener(Y,!1),z.removeGlobalListener(G,!0),Z.delete(Q)}else this.syncGlobalListeners.delete($),z.removeGlobalListener($,!1)}destroyEventListeners(Q,z){Q.forEach((J,Z)=>{J.forEach(($)=>this.eventSvc.removeListener(Z,$,z)),J.clear()}),Q.clear()}destroyGlobalListeners(Q,z){for(let J of Q)this.eventSvc.removeGlobalListener(J,z);Q.clear()}destroy(){super.destroy(),this.destroyEventListeners(this.syncListeners,!1),this.destroyEventListeners(this.asyncListeners,!0),this.destroyGlobalListeners(this.syncGlobalListeners,!1);let{globalListenerPairs:Q,eventSvc:z}=this;Q.forEach(({syncListener:J,asyncListener:Z})=>{z.removeGlobalListener(J,!1),z.removeGlobalListener(Z,!0)}),Q.clear()}};function LF(Q,z,J){Q.apiEventSvc?.addListener(z,J)}function FF(Q,z,J){Q.apiEventSvc?.removeListener(z,J)}function DF(Q,z){Q.apiEventSvc?.addGlobalListener(z)}function MF(Q,z){Q.apiEventSvc?.removeGlobalListener(z)}var MX={moduleName:"EventApi",version:p,apiFunctions:{addEventListener:LF,addGlobalListener:DF,removeEventListener:FF,removeGlobalListener:MF},beans:[KF]};function MQ(Q,z){if(typeof Q!=="number")return"";let J=z(),Z=J("thousandSeparator",","),$=J("decimalSeparator",".");return Q.toString().replace(".",$).replace(/(\d)(?=(\d{3})+(?!\d))/g,`$1${Z}`)}var kF="↑",VF="↓",fF={tag:"span",children:[{tag:"span",ref:"eDelta",cls:"ag-value-change-delta"},{tag:"span",ref:"eValue",cls:"ag-value-change-value"}]},AF=class extends x{constructor(){super(fF);this.eValue=S,this.eDelta=S,this.refreshCount=0}init(Q){this.refresh(Q,!0)}showDelta(Q,z){let J=Math.abs(z),Z=Q.formatValue(J),$=T(Z)?Z:J,X=z>=0,Y=this.eDelta;if(X)Y.textContent=kF+$;else Y.textContent=VF+$;Y.classList.toggle("ag-value-change-delta-up",X),Y.classList.toggle("ag-value-change-delta-down",!X)}setTimerToRemoveDelta(){this.refreshCount++;let Q=this.refreshCount;this.beans.frameworkOverrides.wrapIncoming(()=>{window.setTimeout(()=>{if(Q===this.refreshCount)this.hideDeltaValue()},2000)})}hideDeltaValue(){this.eValue.classList.remove("ag-value-change-value-highlight"),z0(this.eDelta)}refresh(Q,z=!1){let{value:J,valueFormatted:Z}=Q,{eValue:$,lastValue:X,beans:Y}=this;if(J===X)return!1;if(T(Z))$.textContent=Z;else if(T(J))$.textContent=J;else z0($);if(Y.filterManager?.isSuppressFlashingCellsBecauseFiltering())return!1;let G=J&&typeof J==="object"&&"toNumber"in J?J.toNumber():J,q=X&&typeof X==="object"&&"toNumber"in X?X.toNumber():X;if(G===q)return!1;if(typeof G==="number"&&typeof q==="number"){let H=G-q;this.showDelta(Q,H)}if(X)$.classList.add("ag-value-change-value-highlight");if(!z)this.setTimerToRemoveDelta();return this.lastValue=J,!0}},jF=".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}",RF={tag:"span",children:[{tag:"span",ref:"eCurrent",cls:"ag-value-slide-current"}]},SF=class extends x{constructor(){super(RF);this.eCurrent=S,this.refreshCount=0,this.registerCSS(jF)}init(Q){this.refresh(Q,!0)}addSlideAnimation(){this.refreshCount++;let Q=this.refreshCount;this.ePrevious?.remove();let{beans:z,eCurrent:J}=this,Z=Z0({tag:"span",cls:"ag-value-slide-previous ag-value-slide-out"});this.ePrevious=Z,Z.textContent=J.textContent,this.getGui().insertBefore(Z,J),z.frameworkOverrides.wrapIncoming(()=>{window.setTimeout(()=>{if(Q!==this.refreshCount)return;this.ePrevious.classList.add("ag-value-slide-out-end")},50),window.setTimeout(()=>{if(Q!==this.refreshCount)return;this.ePrevious?.remove(),this.ePrevious=null},3000)})}refresh(Q,z=!1){let J=Q.value;if(n(J))J="";if(J===this.lastValue)return!1;if(this.beans.filterManager?.isSuppressFlashingCellsBecauseFiltering())return!1;if(!z)this.addSlideAnimation();this.lastValue=J;let Z=this.eCurrent;if(T(Q.valueFormatted))Z.textContent=Q.valueFormatted;else if(T(Q.value))Z.textContent=J;else z0(Z);return!0}},OF=class extends j{constructor(){super(...arguments);this.beanName="cellFlashSvc",this.nextAnimationTime=null,this.nextAnimationCycle=null,this.animations={highlight:new Map,"data-changed":new Map}}animateCell(Q,z,J=this.beans.gos.get("cellFlashDuration"),Z=this.beans.gos.get("cellFadeDuration")){let $=this.animations[z];$.delete(Q);let X=Date.now(),Y=X+J,G=X+J+Z,q={phase:"flash",flashEndTime:Y,fadeEndTime:G};$.set(Q,q);let H=`ag-cell-${z}`,_=`${H}-animation`,{comp:U,eGui:{style:W}}=Q;if(U.toggleCss(H,!0),U.toggleCss(_,!1),W.removeProperty("transition"),W.removeProperty("transition-delay"),this.nextAnimationTime&&Y+15{this.nextAnimationCycle=setTimeout(this.advanceAnimations.bind(this),J)}),this.nextAnimationTime=Y}advanceAnimations(){let Q=Date.now(),z=null;for(let J of Object.keys(this.animations)){let Z=this.animations[J],$=`ag-cell-${J}`,X=`${$}-animation`;for(let[Y,G]of Z){if(!Y.isAlive()||!Y.comp){Z.delete(Y);continue}let{phase:q,flashEndTime:H,fadeEndTime:_}=G,U=q==="flash"?H:_;if(!(Q+15>=U)){z=Math.min(U,z??1/0);continue}let{comp:B,eGui:{style:E}}=Y;switch(q){case"flash":B.toggleCss($,!1),B.toggleCss(X,!0),E.transition=`background-color ${_-H}ms`,E.transitionDelay=`${H-Q}ms`,z=Math.min(_,z??1/0),G.phase="fade";break;case"fade":B.toggleCss($,!1),B.toggleCss(X,!1),E.removeProperty("transition"),E.removeProperty("transition-delay"),Z.delete(Y);break}}}if(z==null)this.nextAnimationTime=null,this.nextAnimationCycle=null;else if(z)this.nextAnimationCycle=setTimeout(this.advanceAnimations.bind(this),z-Q),this.nextAnimationTime=z}onFlashCells(Q,z){if(!Q.comp)return;let J=bQ(Q.cellPosition);if(z.cells[J])this.animateCell(Q,"highlight")}flashCell(Q,z){this.animateCell(Q,"data-changed",z?.flashDuration,z?.fadeDuration)}destroy(){for(let Q of Object.keys(this.animations))this.animations[Q].clear()}};function PF(Q,z={}){let{cellFlashSvc:J}=Q;if(!J)return;Q.frameworkOverrides.wrapIncoming(()=>{for(let Z of Q.rowRenderer.getCellCtrls(z.rowNodes,z.columns))J.flashCell(Z,z)})}var kX={moduleName:"HighlightChanges",version:p,beans:[OF],userComponents:{agAnimateShowChangeCellRenderer:AF,agAnimateSlideCellRenderer:SF},apiFunctions:{flashCells:PF}};var TF=class extends j{constructor(){super(...arguments);this.beanName="selectionColSvc"}postConstruct(){this.addManagedPropertyListener("rowSelection",(Q)=>{this.onSelectionOptionsChanged(Q.currentValue,Q.previousValue,Xz(Q.source))}),this.addManagedPropertyListener("selectionColumnDef",this.updateColumns.bind(this))}addColumns(Q){let z=this.columns;if(z==null)return;Q.list=z.list.concat(Q.list),Q.tree=z.tree.concat(Q.tree),HJ(Q)}createColumns(Q,z){let J=()=>{ZQ(this.beans,this.columns?.tree),this.columns=null},Z=Q.treeDepth,X=(this.columns?.treeDepth??-1)==Z,Y=this.generateSelectionCols();if(qJ(Y,this.columns?.list??[])&&X)return;J();let{colGroupSvc:q}=this.beans,H=q?.findDepth(Q.tree)??0,_=q?.balanceTreeForAutoCols(Y,H)??[];this.columns={list:Y,tree:_,treeDepth:H,map:{}},z((W)=>{if(!W)return null;let B=W.filter((E)=>!IQ(E));return[...Y,...B]})}updateColumns(Q){let z=Xz(Q.source),{beans:J}=this;for(let Z of this.columns?.list??[]){let $=this.createSelectionColDef(Q.currentValue);Z.setColDef($,null,z),n0(J,{state:[i5($,Z.colId)]},z)}}getColumn(Q){return this.columns?.list.find((z)=>PQ(z,Q))??null}getColumns(){return this.columns?.list??null}isSelectionColumnEnabled(){let{gos:Q,beans:z}=this,J=Q.get("rowSelection");if(typeof J!=="object"||!hQ(Q))return!1;let Z=(z.autoColSvc?.getColumns()?.length??0)>0;if(J.checkboxLocation==="autoGroupColumn"&&Z)return!1;let $=!!Jz(J),X=dJ(J);return $||X}createSelectionColDef(Q){let{gos:z}=this,J=Q??z.get("selectionColumnDef"),Z=z.get("enableRtl"),{rowSpan:$,spanRows:X,...Y}=J??{};return{width:50,resizable:!1,suppressHeaderMenuButton:!0,sortable:!1,suppressMovable:!0,lockPosition:Z?"right":"left",comparator(G,q,H,_){let U=H.isSelected(),W=_.isSelected();return U===W?0:U?1:-1},editable:!1,suppressFillHandle:!0,suppressAutoSize:!0,pinned:null,...Y,colId:k9,chartDataType:"excluded"}}generateSelectionCols(){if(!this.isSelectionColumnEnabled())return[];let Q=this.createSelectionColDef(),z=Q.colId;this.gos.validateColDef(Q,z,!0);let J=new GQ(Q,null,z,!1);return this.createBean(J),[J]}onSelectionOptionsChanged(Q,z,J){let Z=z&&typeof z!=="string"?Jz(z):void 0,$=Q&&typeof Q!=="string"?Jz(Q):void 0,X=Z!==$,Y=z&&typeof z!=="string"?dJ(z):void 0,G=Q&&typeof Q!=="string"?dJ(Q):void 0,q=Y!==G,H=E1(Q),_=E1(z);if(X||q||H!==_)this.beans.colModel.refreshAll(J)}destroy(){ZQ(this.beans,this.columns?.tree),super.destroy()}refreshVisibility(Q,z,J){if(!this.columns?.list.length)return;let Z=Q.length+z.length+J.length;if(Z===0)return;let $=this.columns.list[0];if(!$.isVisible())return;let X=()=>{let q;switch($.pinned){case"left":case!0:q=Q;break;case"right":q=J;break;default:q=z}if(q)$0(q,$)};if((this.beans.rowNumbersSvc?.getColumn(V9)?2:1)===Z)X()}},vF=':where(.ag-selection-checkbox) .ag-checkbox-input-wrapper:before{content:"";cursor:pointer;inset:-8px;position:absolute}';function IF(Q,z){if(!z.nodes.every((Y)=>{if(Y.rowPinned&&!iZ(Y))return R(59),!1;if(Y.id===void 0)return R(60),!1;return!0}))return;let{nodes:Z,source:$,newValue:X}=z;Q.selectionSvc?.setNodesSelected({nodes:Z,source:$??"api",newValue:X})}function CF(Q,z,J="apiSelectAll"){Q.selectionSvc?.selectAllRowNodes({source:J,selectAll:z})}function bF(Q,z,J="apiSelectAll"){Q.selectionSvc?.deselectAllRowNodes({source:J,selectAll:z})}function yF(Q,z="apiSelectAllFiltered"){Q.selectionSvc?.selectAllRowNodes({source:z,selectAll:"filtered"})}function xF(Q,z="apiSelectAllFiltered"){Q.selectionSvc?.deselectAllRowNodes({source:z,selectAll:"filtered"})}function wF(Q,z="apiSelectAllCurrentPage"){Q.selectionSvc?.selectAllRowNodes({source:z,selectAll:"currentPage"})}function NF(Q,z="apiSelectAllCurrentPage"){Q.selectionSvc?.deselectAllRowNodes({source:z,selectAll:"currentPage"})}function gF(Q){return Q.selectionSvc?.getSelectedNodes()??[]}function hF(Q){return Q.selectionSvc?.getSelectedRows()??[]}var uF={tag:"div",cls:"ag-selection-checkbox",role:"presentation",children:[{tag:"ag-checkbox",ref:"eCheckbox",role:"presentation"}]},mF=class extends x{constructor(){super(uF,[yQ]);this.eCheckbox=S}postConstruct(){this.eCheckbox.setPassive(!0)}onDataChanged(){this.onSelectionChanged()}onSelectableChanged(){this.showOrHideSelect()}onSelectionChanged(){let Q=this.getLocaleTextFunc(),{rowNode:z,eCheckbox:J}=this,Z=z.isSelected(),$=O5(Q,Z),[X,Y]=z.selectable?["ariaRowToggleSelection","Press Space to toggle row selection"]:["ariaRowSelectionDisabled","Row Selection is disabled for this row"],G=Q(X,Y);J.setValue(Z,!0),J.setInputAriaLabel(`${G} (${$})`)}init(Q){if(this.rowNode=Q.rowNode,this.column=Q.column,this.overrides=Q.overrides,this.onSelectionChanged(),this.addManagedListeners(this.eCheckbox.getWrapperElement(),{dblclick:i0,click:(Z)=>{if(i0(Z),this.eCheckbox.isDisabled())return;this.beans.selectionSvc?.handleSelectionEvent(Z,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:Z,previousValue:$})=>{let X=typeof Z==="object"?j2(Z):void 0,Y=typeof $==="object"?j2($):void 0;if(X!==Y)this.onSelectableChanged()}),$5(this.gos)||typeof this.getIsVisible()==="function"){let Z=this.showOrHideSelect.bind(this);this.addManagedEventListeners({displayedColumnsChanged:Z}),this.addManagedListeners(this.rowNode,{dataChanged:Z,cellChanged:Z}),this.showOrHideSelect()}this.eCheckbox.getInputElement().setAttribute("tabindex","-1")}showOrHideSelect(){let{column:Q,rowNode:z,overrides:J,gos:Z}=this,$=z.selectable,X=this.getIsVisible(),Y=void 0;if(typeof X==="function"){let U=J?.callbackParams;if(!Q)Y=X({...U,node:z,data:z.data});else{let W=Q.createColumnFunctionCallbackParams(z);Y=X({...U,...W})}}else Y=X??!1;let G=$&&!Y||!$&&Y,q=$||Y,H=Z.get("rowSelection"),_=H&&typeof H!=="string"?!j2(H):!!Q?.getColDef().showDisabledCheckboxes;if(this.setVisible(q&&(G?_:!0)),this.setDisplayed(q&&(G?_:!0)),q)this.eCheckbox.setDisabled(G);if(J?.removeHidden)this.setDisplayed(q)}getIsVisible(){let Q=this.overrides;if(Q)return Q.isVisible;let z=this.gos.get("rowSelection");if(z&&typeof z!=="string")return Jz(z);return this.column?.getColDef()?.checkboxSelection}},cF=class{constructor(Q,z){this.rowModel=Q,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(Q){this.rootId=Q.id,this.endId=null,this.cachedRange.length=0}setEndRange(Q){this.endId=Q.id,this.cachedRange.length=0}getRange(){if(this.cachedRange.length===0){let Q=this.getRoot(),z=this.getEnd();if(Q==null||z==null)return this.cachedRange;this.cachedRange=this.getNodesInRange(Q,z)??[]}return this.cachedRange}isInRange(Q){if(this.rootId===null)return!1;return this.getRange().some((z)=>z.id===Q.id)}getRoot(Q){if(this.rootId)return this.getRowNode(this.rootId);if(Q)return this.setRoot(Q),Q}getEnd(){if(this.endId)return this.getRowNode(this.endId)}getRowNode(Q){let z,{rowModel:J,pinnedRowModel:Z}=this;if(z??(z=J.getRowNode(Q)),Z?.isManual())z??(z=Z.getPinnedRowById(Q,"top")),z??(z=Z.getPinnedRowById(Q,"bottom"));return z}truncate(Q){let z=this.getRange();if(z.length===0)return{keep:[],discard:[]};let J=z[0].id===this.rootId,Z=z.findIndex(($)=>$.id===Q.id);if(Z>-1){let $=z.slice(0,Z),X=z.slice(Z+1);return this.setEndRange(Q),J?{keep:$,discard:X}:{keep:X,discard:$}}else return{keep:z,discard:[]}}extend(Q,z=!1){let J=this.getRoot();if(J==null){let $=this.getRange().slice();if(z)Q.depthFirstSearch((X)=>!X.group&&$.push(X));return $.push(Q),this.setRoot(Q),{keep:$,discard:[]}}let Z=this.getNodesInRange(J,Q);if(!Z)return this.setRoot(Q),{keep:[Q],discard:[]};if(Z.find(($)=>$.id===this.endId))return this.setEndRange(Q),{keep:this.getRange(),discard:[]};else{let $=this.getRange().slice();return this.setEndRange(Q),{keep:this.getRange(),discard:$}}}getNodesInRange(Q,z){let{pinnedRowModel:J,rowModel:Z}=this;if(!J?.isManual())return Z.getNodesInRangeForSelection(Q,z);if(Q.rowPinned==="top"&&!z.rowPinned)return t0(J,"top",Q,void 0).concat(Z.getNodesInRangeForSelection(Z.getRow(0),z)??[]);if(Q.rowPinned==="bottom"&&!z.rowPinned){let $=t0(J,"bottom",void 0,Q),X=Z.getRowCount(),Y=Z.getRow(X-1);return(Z.getNodesInRangeForSelection(z,Y)??[]).concat($)}if(!Q.rowPinned&&!z.rowPinned)return Z.getNodesInRangeForSelection(Q,z);if(Q.rowPinned==="top"&&z.rowPinned==="top")return t0(J,"top",Q,z);if(Q.rowPinned==="bottom"&&z.rowPinned==="top"){let $=t0(J,"top",z,void 0),X=t0(J,"bottom",void 0,Q),Y=Z.getRow(0),G=Z.getRow(Z.getRowCount()-1);return $.concat(Z.getNodesInRangeForSelection(Y,G)??[]).concat(X)}if(!Q.rowPinned&&z.rowPinned==="top")return t0(J,"top",z,void 0).concat(Z.getNodesInRangeForSelection(Z.getRow(0),Q)??[]);if(Q.rowPinned==="top"&&z.rowPinned==="bottom"){let $=t0(J,"top",Q,void 0),X=t0(J,"bottom",void 0,z),Y=Z.getRow(0),G=Z.getRow(Z.getRowCount()-1);return $.concat(Z.getNodesInRangeForSelection(Y,G)??[]).concat(X)}if(Q.rowPinned==="bottom"&&z.rowPinned==="bottom")return t0(J,"bottom",Q,z);if(!Q.rowPinned&&z.rowPinned==="bottom"){let $=t0(J,"bottom",void 0,z),X=Z.getRow(Z.getRowCount());return(Z.getNodesInRangeForSelection(Q,X)??[]).concat($)}return null}},pF=class extends j{constructor(Q){super();this.column=Q,this.cbSelectAllVisible=!1,this.processingEventFromCheckbox=!1}onSpaceKeyDown(Q){let z=this.cbSelectAll;if(z.isDisplayed()&&!z.getGui().contains(d(this.beans)))Q.preventDefault(),z.setValue(!z.getValue())}getCheckboxGui(){return this.cbSelectAll.getGui()}setComp(Q){this.headerCellCtrl=Q;let z=this.createManagedBean(new K6);this.cbSelectAll=z,z.addCss("ag-header-select-all"),H0(z.getGui(),"presentation"),this.showOrHideSelectAll();let J=this.updateStateOfCheckbox.bind(this);this.addManagedEventListeners({newColumnsLoaded:()=>this.showOrHideSelectAll(),displayedColumnsChanged:this.onDisplayedColumnsChanged.bind(this),selectionChanged:J,paginationChanged:J,modelUpdated:J}),this.addManagedPropertyListener("rowSelection",({currentValue:Z,previousValue:$})=>{let X=(Y)=>typeof Y==="string"||!Y||Y.mode==="singleRow"?void 0:Y.selectAll;if(X(Z)!==X($))this.showOrHideSelectAll();this.updateStateOfCheckbox()}),this.addManagedListeners(z,{fieldValueChanged:this.onCbSelectAll.bind(this)}),z.getInputElement().setAttribute("tabindex","-1"),this.refreshSelectAllLabel()}onDisplayedColumnsChanged(Q){if(!this.isAlive())return;this.showOrHideSelectAll(Q.source==="uiColumnMoved")}showOrHideSelectAll(Q=!1){let z=this.isCheckboxSelection();if(this.cbSelectAllVisible=z,this.cbSelectAll.setDisplayed(z),z)this.checkRightRowModelType("selectAllCheckbox"),this.checkSelectionType("selectAllCheckbox"),this.updateStateOfCheckbox();this.refreshSelectAllLabel(Q)}updateStateOfCheckbox(){if(!this.cbSelectAllVisible||this.processingEventFromCheckbox)return;this.processingEventFromCheckbox=!0;let Q=this.getSelectAllMode(),z=this.beans.selectionSvc,J=this.cbSelectAll,Z=z.getSelectAllState(Q);J.setValue(Z);let $=z.hasNodesToSelect(Q);J.setDisabled(!$),this.refreshSelectAllLabel(),this.processingEventFromCheckbox=!1}refreshSelectAllLabel(Q=!1){let z=this.getLocaleTextFunc(),{headerCellCtrl:J,cbSelectAll:Z,cbSelectAllVisible:$}=this,X=Z.getValue(),Y=O5(z,X),G=z("ariaRowSelectAll","Press Space to toggle all rows selection");if(J.setAriaDescriptionProperty("selectAll",$?`${G} (${Y})`:null),Z.setInputAriaLabel(z("ariaHeaderSelection","Column with Header Selection")),!Q)J.announceAriaDescription()}checkSelectionType(Q){if(!s1(this.gos))return R(128,{feature:Q}),!1;return!0}checkRightRowModelType(Q){let{gos:z,rowModel:J}=this.beans;if(!(o(z)||Hz(z)))return R(129,{feature:Q,rowModel:J.getType()}),!1;return!0}onCbSelectAll(){if(this.processingEventFromCheckbox)return;if(!this.cbSelectAllVisible)return;let Q=this.cbSelectAll.getValue(),z=this.getSelectAllMode(),J="uiSelectAll";if(z==="currentPage")J="uiSelectAllCurrentPage";else if(z==="filtered")J="uiSelectAllFiltered";let Z={source:J,selectAll:z},$=this.beans.selectionSvc;if(Q)$.selectAllRowNodes(Z);else $.deselectAllRowNodes(Z)}isCheckboxSelection(){let{column:Q,gos:z,beans:J}=this,X=typeof z.get("rowSelection")==="object"?"headerCheckbox":"headerCheckboxSelection";return VX(J,Q)&&this.checkRightRowModelType(X)&&this.checkSelectionType(X)}getSelectAllMode(){let Q=U9(this.gos,!1);if(Q)return Q;let{headerCheckboxSelectionCurrentPageOnly:z,headerCheckboxSelectionFilteredOnly:J}=this.column.getColDef();if(z)return"currentPage";if(J)return"filtered";return"all"}destroy(){super.destroy(),this.cbSelectAll=void 0,this.headerCellCtrl=void 0}};function VX({gos:Q,selectionColSvc:z},J){let Z=Q.get("rowSelection"),$=J.getColDef(),{headerCheckboxSelection:X}=$,Y=!1;if(typeof Z==="object"){let q=IQ(J),H=mz(J);if(E1(Z)==="autoGroupColumn"&&H||q&&z?.isSelectionColumnEnabled())Y=dJ(Z)}else if(typeof X==="function")Y=X(y(Q,{column:J,colDef:$}));else Y=!!X;return Y}var iF=class extends j{postConstruct(){let{gos:Q,beans:z}=this;this.selectionCtx=new cF(z.rowModel,z.pinnedRowModel),this.addManagedPropertyListeners(["isRowSelectable","rowSelection"],()=>{let J=$5(Q);if(J!==this.isRowSelectable)this.isRowSelectable=J,this.updateSelectable()}),this.isRowSelectable=$5(Q),this.addManagedEventListeners({cellValueChanged:(J)=>this.updateRowSelectable(J.node),rowNodeDataChanged:(J)=>this.updateRowSelectable(J.node)})}destroy(){super.destroy(),this.selectionCtx.reset()}createCheckboxSelectionComponent(){return new mF}createSelectAllFeature(Q){if(VX(this.beans,Q))return new pF(Q)}isMultiSelect(){return s1(this.gos)}onRowCtrlSelected(Q,z,J){let Z=!!Q.rowNode.isSelected();Q.forEachGui(J,($)=>{$.rowComp.toggleCss("ag-row-selected",Z);let X=$.element;if(S5(X,Z),X.contains(d(this.beans)))z($)})}announceAriaRowSelection(Q){if(this.isRowSelectionBlocked(Q))return;let z=Q.isSelected(),J=this.beans.editSvc?.isEditing({rowNode:Q});if(!Q.selectable||J)return;let $=this.getLocaleTextFunc()(z?"ariaRowDeselect":"ariaRowSelect",`Press SPACE to ${z?"deselect":"select"} this row`);this.beans.ariaAnnounce?.announceValue($,"rowSelection")}isRowSelectionBlocked(Q){return!Q.selectable||Q.rowPinned&&!iZ(Q)||!hQ(this.gos)}updateRowSelectable(Q,z){let J=Q.rowPinned&&Q.pinnedSibling?Q.pinnedSibling.selectable:this.isRowSelectable?.(Q)??!0;return this.setRowSelectable(Q,J,z),J}setRowSelectable(Q,z,J){if(Q.selectable!==z){if(Q.selectable=z,Q.dispatchRowEvent("selectableChanged"),J)return;if(l1(this.gos)){let $=this.calculateSelectedFromChildren(Q);this.setNodesSelected({nodes:[Q],newValue:$??!1,source:"selectableChanged"});return}if(Q.isSelected()&&!Q.selectable)this.setNodesSelected({nodes:[Q],newValue:!1,source:"selectableChanged"})}}calculateSelectedFromChildren(Q){let z=!1,J=!1;if(!Q.childrenAfterGroup?.length)return Q.selectable?Q.__selected:null;for(let Z=0;Z{let z=l1(Q),J=ZZ(Q),Z=$Z(Q)==="filteredDescendants";if(this.masterSelectsDetail=D7(Q)==="detail",z!==this.groupSelectsDescendants||Z!==this.groupSelectsFiltered||J!==this.mode)this.deselectAllRowNodes({source:"api"}),this.groupSelectsDescendants=z,this.groupSelectsFiltered=Z,this.mode=J}),this.addManagedEventListeners({rowSelected:this.onRowSelected.bind(this)})}destroy(){super.destroy(),this.resetNodes()}handleSelectionEvent(Q,z,J){if(this.isRowSelectionBlocked(z))return 0;let Z=this.inferNodeSelections(z,Q.shiftKey,Q.metaKey||Q.ctrlKey,J);if(Z==null)return 0;if(this.selectionCtx.selectAll=!1,"select"in Z){if(Z.reset)this.resetNodes();else this.selectRange(Z.deselect,!1,J);return this.selectRange(Z.select,!0,J)}else{let $=Z.checkFilteredNodes?AX(Z.node):Z.newValue;return this.setNodesSelected({nodes:[Z.node],newValue:$,clearSelection:Z.clearSelection,keepDescendants:Z.keepDescendants,event:Q,source:J})}}setNodesSelected({newValue:Q,clearSelection:z,suppressFinishActions:J,nodes:Z,event:$,source:X,keepDescendants:Y=!1}){if(Z.length===0)return 0;let{gos:G}=this;if(!hQ(G)&&Q)return R(132),0;if(Z.length>1&&!this.isMultiSelect())return R(130),0;let q=0;for(let H=0;H0)this.updateGroupsFromChildrenSelections(X),this.dispatchSelectionChanged(X)}return q}selectRange(Q,z,J){let Z=0;if(Q.forEach(($)=>{let X=$.primaryRow;if(X.group&&this.groupSelectsDescendants)return;if(this.selectRowNode(X,z,void 0,J))Z++}),Z>0)this.updateGroupsFromChildrenSelections(J),this.dispatchSelectionChanged(J);return Z}selectChildren(Q,z,J){let Z=this.groupSelectsFiltered?Q.childrenAfterAggFilter:Q.childrenAfterGroup;if(!Z)return 0;return this.setNodesSelected({newValue:z,clearSelection:!1,suppressFinishActions:!0,source:J,nodes:Z})}getSelectedNodes(){return Array.from(this.selectedNodes.values())}getSelectedRows(){let Q=[];return this.selectedNodes.forEach((z)=>z.data&&Q.push(z.data)),Q}getSelectionCount(){return this.selectedNodes.size}filterFromSelection(Q){let z=new Map;this.selectedNodes.forEach((J,Z)=>{if(Q(J))z.set(Z,J)}),this.selectedNodes=z}updateGroupsFromChildrenSelections(Q,z){if(!this.groupSelectsDescendants)return!1;let{gos:J,rowModel:Z}=this.beans;if(!o(J,Z))return!1;let $=Z.rootNode;if(!$)return!1;let X=!1,Y=(G)=>{if(G!==$){let q=this.calculateSelectedFromChildren(G);X=this.selectRowNode(G,q===null?!1:q,void 0,Q)||X}};return A0($,this.beans.rowModel.hierarchical,z,Y),X}clearOtherNodes(Q,z,J){let Z=new Map,$=0;return this.selectedNodes.forEach((X)=>{let Y=X.id==Q.id;if((z?!tF(Q,X):!0)&&!Y){let q=this.selectedNodes.get(X.id);if($+=this.setNodesSelected({nodes:[q],newValue:!1,clearSelection:!1,suppressFinishActions:!0,source:J}),this.groupSelectsDescendants&&X.parent)Z.set(X.parent.id,X.parent)}}),Z.forEach((X)=>{let Y=this.calculateSelectedFromChildren(X);this.selectRowNode(X,Y===null?!1:Y,void 0,J)}),$}onRowSelected(Q){let z=Q.node;if(this.groupSelectsDescendants&&z.group)return;if(z.isSelected())this.selectedNodes.set(z.id,z);else this.selectedNodes.delete(z.id)}syncInRowNode(Q,z){this.syncInOldRowNode(Q,z),this.syncInNewRowNode(Q)}createDaemonNode(Q){if(!Q.id)return;let z=new Wz(this.beans);return z.id=Q.id,z.data=Q.data,z.__selected=Q.__selected,z.level=Q.level,z}syncInOldRowNode(Q,z){if(z&&Q.id!==z.id){if(this.selectedNodes.get(z.id)==Q)this.selectedNodes.set(z.id,z)}}syncInNewRowNode(Q){if(this.selectedNodes.has(Q.id))Q.__selected=!0,this.selectedNodes.set(Q.id,Q);else Q.__selected=!1}reset(Q){let z=this.getSelectionCount();if(this.resetNodes(),z)this.dispatchSelectionChanged(Q)}resetNodes(){this.selectedNodes.forEach((Q)=>{this.selectRowNode(Q,!1)}),this.selectedNodes.clear()}getBestCostNodeSelection(){let{gos:Q,rowModel:z}=this.beans;if(!o(Q,z))return;let J=z.getTopLevelNodes();if(J===null)return;let Z=[];function $(X){for(let Y=0,G=X.length;Y{let Y=this.selectRowNode(X.primaryRow,!1,void 0,Q);Z||(Z=Y)};if(z==="currentPage"||z==="filtered"){if(!J){e(102);return}this.getNodesToSelect(z).forEach($)}else this.selectedNodes.forEach($),this.reset(Q);if(this.selectionCtx.selectAll=!1,J&&this.groupSelectsDescendants){let X=this.updateGroupsFromChildrenSelections(Q);Z||(Z=X)}if(Z)this.dispatchSelectionChanged(Q)}getSelectedCounts(Q){let z=0,J=0;return this.getNodesToSelect(Q).forEach((Z)=>{if(this.groupSelectsDescendants&&Z.group)return;if(Z.isSelected())z++;else if(Z.selectable)J++}),{selectedCount:z,notSelectedCount:J}}getSelectAllState(Q){let{selectedCount:z,notSelectedCount:J}=this.getSelectedCounts(Q);return fX(z,J)??null}hasNodesToSelect(Q){return this.getNodesToSelect(Q).filter((z)=>z.selectable).length>0}getNodesToSelect(Q){if(!this.canSelectAll())return[];let z=[],J=($)=>z.push($);if(Q==="currentPage")return this.forEachNodeOnPage(($)=>{if(!$.group){J($);return}if(!$.footer&&!$.expanded){let X=(Y)=>{J(Y);let G=Y.childrenAfterFilter;if(G)for(let q=0,H=G.length;q{let G=this.selectRowNode(Y.primaryRow,!0,void 0,Z);X||(X=G)}),J.selectAll=!0,o(z)&&this.groupSelectsDescendants){let Y=this.updateGroupsFromChildrenSelections(Z);X||(X=Y)}if(X)this.dispatchSelectionChanged(Z)}getSelectionState(){return this.isEmpty()?null:Array.from(this.selectedNodes.keys())}setSelectionState(Q,z,J){if(!Q)Q=[];if(!Array.isArray(Q)){e(103);return}let Z=new Set(Q),$=[];if(this.beans.rowModel.forEachNode((X)=>{if(Z.has(X.id))$.push(X)}),J)this.resetNodes();this.setNodesSelected({newValue:!0,nodes:$,source:z})}canSelectAll(){return o(this.beans.gos)}updateSelectable(Q){let{gos:z,rowModel:J}=this.beans;if(!hQ(z))return;let Z="selectableChanged",$=o(z)&&this.groupSelectsDescendants,X=[];if($){let Y=J.rootNode;if(Y)A0(Y,J.hierarchical,Q,(G)=>{let q=!1;for(let H of G.childrenAfterGroup)if(q||(q=H.selectable),!H.group&&!this.updateRowSelectable(H,!0)&&H.isSelected())X.push(H);this.setRowSelectable(G,q,!0)})}else J.forEachNode((Y)=>{if(!this.updateRowSelectable(Y,!0)&&Y.isSelected())X.push(Y)});if(X.length)this.setNodesSelected({nodes:X,newValue:!1,source:Z});if(!Q&&$)this.updateGroupsFromChildrenSelections?.(Z)}updateSelectableAfterGrouping(Q){if(this.updateSelectable(Q),this.groupSelectsDescendants){if(this.updateGroupsFromChildrenSelections?.("rowGroupChanged",Q))this.dispatchSelectionChanged("rowGroupChanged")}}refreshMasterNodeState(Q,z){if(!this.masterSelectsDetail)return;let J=Q.detailNode?.detailGridInfo?.api;if(!J)return;let Z=dF(J);if(Q.isSelected()!==Z){if(this.selectRowNode(Q,Z,z,"masterDetail"))this.dispatchSelectionChanged("masterDetail")}if(!Z)this.detailSelection.set(Q.id,new Set(J.getSelectedNodes().map((X)=>X.id)))}setDetailSelectionState(Q,z,J){if(!this.masterSelectsDetail)return;if(!s1(z)){R(269);return}switch(Q.isSelected()){case!0:{J.selectAll();break}case!1:{J.deselectAll();break}case void 0:{let Z=this.detailSelection.get(Q.id);if(Z){let $=[];for(let X of Z){let Y=J.getRowNode(X);if(Y)$.push(Y)}J.setNodesSelected({nodes:$,newValue:!0,source:"masterDetail"})}break}default:break}}dispatchSelectionChanged(Q){this.eventSvc.dispatchEvent({type:"selectionChanged",source:Q,selectedNodes:this.getSelectedNodes(),serverSideState:null})}};function dF(Q){let z=0,J=0;return Q.forEachNode((Z)=>{if(Z.isSelected())z++;else if(Z.selectable)J++}),fX(z,J)}function fX(Q,z){if(Q===0&&z===0)return!1;if(Q>0&&z>0)return;return Q>0}function tF(Q,z){let J=z.parent;while(J){if(J===Q)return!0;J=J.parent}return!1}function AX(Q){let z=Q.isSelected()===!1,J=Q.childrenAfterFilter?.some(AX)??!1;return z||J}var rF={moduleName:"SharedRowSelection",version:p,beans:[TF],css:[vF],apiFunctions:{setNodesSelected:IF,selectAll:CF,deselectAll:bF,selectAllFiltered:yF,deselectAllFiltered:xF,selectAllOnCurrentPage:wF,deselectAllOnCurrentPage:NF,getSelectedNodes:gF,getSelectedRows:hF}},jX={moduleName:"RowSelection",version:p,rowModels:["clientSide","infinite","viewport"],beans:[nF],dependsOn:[rF]},sF=class extends j{constructor(Q,z){super();this.cellCtrl=Q,this.staticClasses=[],this.beans=z,this.column=Q.column}setComp(Q){this.cellComp=Q,this.applyUserStyles(),this.applyCellClassRules(),this.applyClassesFromColDef()}applyCellClassRules(){let{column:Q,cellComp:z}=this,J=Q.colDef,Z=J.cellClassRules,$=this.getCellClassParams(Q,J);d$(this.beans.expressionSvc,Z===this.cellClassRules?void 0:this.cellClassRules,Z,$,(X)=>z.toggleCss(X,!0),(X)=>z.toggleCss(X,!1)),this.cellClassRules=Z}applyUserStyles(){let Q=this.column,z=Q.colDef,J=z.cellStyle;if(!J)return;let Z;if(typeof J==="function"){let $=this.getCellClassParams(Q,z);Z=J($)}else Z=J;if(Z)this.cellComp.setUserStyles(Z)}applyClassesFromColDef(){let{column:Q,cellComp:z}=this,J=Q.colDef,Z=this.getCellClassParams(Q,J);for(let X of this.staticClasses)z.toggleCss(X,!1);let $=this.beans.cellStyles.getStaticCellClasses(J,Z);this.staticClasses=$;for(let X of $)z.toggleCss(X,!0)}getCellClassParams(Q,z){let{value:J,rowNode:Z}=this.cellCtrl;return y(this.beans.gos,{value:J,data:Z.data,node:Z,colDef:z,column:Q,rowIndex:Z.rowIndex})}},lF=class extends j{constructor(){super(...arguments);this.beanName="cellStyles"}processAllCellClasses(Q,z,J,Z){d$(this.beans.expressionSvc,void 0,Q.cellClassRules,z,J,Z),this.processStaticCellClasses(Q,z,J)}getStaticCellClasses(Q,z){let{cellClass:J}=Q;if(!J)return[];let Z;if(typeof J==="function")Z=J(z);else Z=J;if(typeof Z==="string")Z=[Z];return Z||[]}createCellCustomStyleFeature(Q){return new sF(Q,this.beans)}processStaticCellClasses(Q,z,J){this.getStaticCellClasses(Q,z).forEach(($)=>{J($)})}},RX={moduleName:"CellStyle",version:p,beans:[lF]};var aF={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",Q1="infinite",oF={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:[Q1],purgeInfiniteCache:[Q1],getInfiniteRowCount:[Q1],isLastRowIndexKnown:[Q1,C0],expandAll:[g0,C0],collapseAll:[g0,C0],onRowHeightChanged:[g0,C0],setRowCount:[Q1,C0],getCacheBlockState:[Q1,C0]},eF={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 QD(Q,z,J){let Z=eF[Q];if(Z){let{version:X,new:Y,old:G,message:q}=Z,H=G??Q;return(..._)=>{let U=Y?`Please use ${Y} instead. `:"";return zz(`Since ${X} api.${H} is deprecated. ${U}${q??""}`),z.apply(z,_)}}let $=oF[Q];if($)return(...X)=>{let Y=J.rowModel.getType();if(!$.includes(Y)){q1(`api.${Q} can only be called when gridOptions.rowModelType is ${$.join(" or ")}`);return}return z.apply(z,X)};return z}var zD={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"},JD={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},ZD={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"},$D=new Set(["colorPicker","smallUp","checkboxChecked","checkboxIndeterminate","checkboxUnchecked","radioButtonOn","radioButtonOff","smallDown","smallLeft","smallRight"]),XD=class extends j{constructor(){super(...arguments);this.beanName="validation"}wireBeans(Q){this.gridOptions=Q.gridOptions,PG(GK)}warnOnInitialPropertyUpdate(Q,z){if(Q==="api"&&aF[z])R(22,{key:z})}processGridOptions(Q){this.processOptions(Q,Z3())}validateApiFunction(Q,z){return QD(Q,z,this.beans)}missingUserComponent(Q,z,J,Z){let $=B1[z];if($)this.gos.assertModuleRegistered($,`AG Grid '${Q}' component: ${z}`);else R(101,{propertyName:Q,componentName:z,agGridDefaults:J,jsComps:Z})}missingDynamicBean(Q){let z=zD[Q];return z?QQ(200,{...this.gos.getModuleErrorParams(),moduleName:z,reasonOrId:Q}):void 0}checkRowEvents(Q){if(GD.has(Q))R(10,{eventType:Q})}validateIcon(Q){if($D.has(Q))R(43,{iconName:Q});if(JD[Q])return;let z=ZD[Q];if(z){e(200,{reasonOrId:`icon '${Q}'`,moduleName:z,gridScoped:x5(),gridId:this.beans.context.getId(),rowModelType:this.gos.get("rowModelType"),additionalText:"Alternatively, use the CSS icon name directly."});return}R(134,{iconName:Q})}isProvidedUserComp(Q){return!!B1[Q]}validateColDef(Q){this.processOptions(Q,dB())}processOptions(Q,z){let{validations:J,deprecations:Z,allProperties:$,propertyExceptions:X,objectName:Y,docsUrl:G}=z;if($&&this.gridOptions.suppressPropertyNamesCheck!==!0)this.checkProperties(Q,[...X??[],...Object.keys(Z)],$,Y,G);let q=new Set;if(Object.keys(Q).forEach((_)=>{let U=Z[_];if(U){let{message:D,version:M}=U;q.add(`As of v${M}, ${String(_)} is deprecated. ${D??""}`)}let W=Q[_];if(W==null||W===!1)return;let B=J[_];if(!B)return;let{dependencies:E,validate:K,supportedRowModels:L,expectedType:F}=B;if(F){let D=typeof W;if(D!==F){q.add(`${String(_)} should be of type '${F}' but received '${D}' (${W}).`);return}}if(L){let D=this.gridOptions.rowModelType??"clientSide";if(!L.includes(D)){q.add(`${String(_)} is not supported with the '${D}' row model. It is only valid with: ${L.join(", ")}.`);return}}if(E){let D=this.checkForRequiredDependencies(_,E,Q);if(D){q.add(D);return}}if(K){let D=K(Q,this.gridOptions,this.beans);if(D){q.add(D);return}}}),q.size>0)for(let _ of q)zz(_)}checkForRequiredDependencies(Q,z,J){let $=Object.entries(z).filter(([X,Y])=>{let G=J[X];return!Y.required.includes(G)});if($.length===0)return null;return $.map(([X,Y])=>`'${String(Q)}' requires '${X}' to be one of [${Y.required.map((G)=>{if(G===null)return"null";else if(G===void 0)return"undefined";return G}).join(", ")}]. ${Y.reason??""}`).join(` - `)}checkProperties(Q,z,J,Z,$){let X=["__ob__","__v_skip","__metadata__"],Y=YD(Object.getOwnPropertyNames(Q),[...X,...z,...J],J),G=Object.keys(Y);for(let q of G){let H=Y[q],_=`invalid ${Z} property '${q}' did you mean any of these: ${H.slice(0,8).join(", ")}.`;if(J.includes("context"))_+=` -If you are trying to annotate ${Z} with application data, use the '${Z}.context' property instead.`;zz(_)}if(G.length>0&&$){let q=this.beans.frameworkOverrides.getDocLink($);zz(`to see all the valid ${Z} properties please check: ${q}`)}}};function YD(Q,z,J){let Z={},$=Q.filter((X)=>!z.some((Y)=>Y===X));if($.length>0)for(let X of $)Z[X]=D5({inputValue:X,allSuggestions:J}).values;return Z}var GD=new Set(["firstChildChanged","lastChildChanged","childIndexChanged"]),SX={moduleName:"Validation",version:p,beans:[XD]};var j1=class extends j{constructor(){super(...arguments);this.dispatchColumnChangedEvent=M$,this.columns=[],this.columnIndexMap={},this.updateIndexMap=()=>{this.columnIndexMap={},this.columns.forEach((Q,z)=>this.columnIndexMap[Q.getId()]=z)}}wireBeans(Q){this.colModel=Q.colModel,this.aggFuncSvc=Q.aggFuncSvc,this.visibleCols=Q.visibleCols,this.groupHierarchCols=Q.groupHierarchyColSvc}sortColumns(Q){let{groupHierarchCols:z}=this;this.columns.sort((J,Z)=>z?.compareVirtualColumns(J,Z)??Q(J,Z)),this.updateIndexMap()}setColumns(Q,z){this.setColList(Q,this.columns,this.eventName,!0,!0,this.columnProcessors.set,z)}addColumns(Q,z){this.updateColList(Q,this.columns,!0,!0,this.columnProcessors.add,this.eventName,z)}removeColumns(Q,z){this.updateColList(Q,this.columns,!1,!0,this.columnProcessors.remove,this.eventName,z)}getColumnIndex(Q){return this.columnIndexMap[Q]}setColList(Q=[],z,J,Z,$,X,Y){let G=this.colModel.getCols();if(!G||G.length===0)return;let q=new Map;z.forEach((_,U)=>q.set(_,U)),z.length=0;for(let _ of Q){let U=this.colModel.getColDefCol(_);if(U)z.push(U)}z.forEach((_,U)=>{let W=q.get(_);if(W===void 0){q.set(_,0);return}if(Z&&W!==U)return;q.delete(_)}),this.updateIndexMap();let H=this.colModel.getColDefCols();for(let _ of H??[]){let U=z.indexOf(_)>=0;X(_,U,Y)}if($)this.colModel.refreshCols(!1,Y);this.visibleCols.refresh(Y),this.dispatchColumnChangedEvent(this.eventSvc,J,[...q.keys()],Y)}updateColList(Q=[],z,J,Z,$,X,Y){if(!Q||Q.length===0)return;let G=!1,q=new Set;for(let _ of Q){if(!_)continue;let U=this.colModel.getColDefCol(_);if(!U)continue;if(q.add(U),J){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(I)A=M;else if(C)A=f!=null&&f>=0;else A=!1;else A=J.indexOf(K)>=0;if(A)if(L?k!=null||f!=null:k!=null)Z.push(K);else $.push(K)}let U=(K)=>{let L=K.getColDef();return Y(L)??G(L)};Z.sort((K,L)=>U(K)-U(L));let W=[],B=this.groupHierarchCols,E=(K)=>{if(B)B.expandColumnInto(W,K);else W.push(K)};Z.forEach(E);for(let K of J)if($.indexOf(K)>=0)E(K);for(let K of $)if(W.indexOf(K)<0)E(K);for(let K of J)if(W.indexOf(K)<0)X(K,!1,Q);for(let K of W)if(J.indexOf(K)<0)X(K,!0,Q);return this.columns=W,this.updateIndexMap(),this.columns}restoreColumnOrder(Q,z){let J=this.columns,Z=this.colModel.getColDefCols();if(!J.length||!Z)return Q;let $=Object.keys(z),X=new Set($),Y=new Set($),G=new Set(J.map((M)=>{let k=M.getColId();return Y.delete(k),k}).concat($)),q=[],H={},_=0;for(let M=0;M{let k=H[M];for(let f=B;f>>32-$,J)}ff(Q,z,J,Z,$,X,Y){return this.cmn(z&J|~z&Z,Q,z,$,X,Y)}gg(Q,z,J,Z,$,X,Y){return this.cmn(z&Z|J&~Z,Q,z,$,X,Y)}hh(Q,z,J,Z,$,X,Y){return this.cmn(z^J^Z,Q,z,$,X,Y)}ii(Q,z,J,Z,$,X,Y){return this.cmn(J^(z|~Z),Q,z,$,X,Y)}md51(Q){let z=Q.length,J=[1732584193,-271733879,-1732584194,271733878],Z;for(Z=64;Z<=Q.length;Z+=64)this.md5cycle(J,this.md5blk(Q.substring(Z-64,Z)));Q=Q.substring(Z-64);let $=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];for(Z=0;Z>2]|=Q.charCodeAt(Z)<<(Z%4<<3);if($[Z>>2]|=128<<(Z%4<<3),Z>55){this.md5cycle(J,$);for(Z=0;Z<16;Z++)$[Z]=0}return $[14]=z*8,this.md5cycle(J,$),J}md5blk(Q){let z=[];for(let J=0;J<64;J+=4)z[J>>2]=Q.charCodeAt(J)+(Q.charCodeAt(J+1)<<8)+(Q.charCodeAt(J+2)<<16)+(Q.charCodeAt(J+3)<<24);return z}rhex(Q){let z="0123456789abcdef".split(""),J="",Z=0;for(;Z<4;Z++)J+=z[Q>>Z*8+4&15]+z[Q>>Z*8&15];return J}hex(Q){for(let z=0;z>16)+(z>>16)+(J>>16)<<16|J&65535}},sZ={"01":"GRID","02":"CHARTS","0102":"BOTH"};var UY=class Q{constructor(z){this.watermarkMessage=void 0,this.totalMessageLength=124,this.document=z,this.md5=new HD,this.md5.init()}validateLicense(){let z=this.getLicenseDetails(Q.licenseKey),J=`AG Grid ${z.currentLicenseType==="BOTH"?"and AG Charts ":""}Enterprise`,Z=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(J)}else if(z.expired){let $=Q.getGridReleaseDate(),X=Q.formatDate($);this.outputExpiredKey(z.expiry,X,J,Z)}else if(!z.valid)this.outputInvalidLicenseKey(!!z.incorrectLicenseType,J,Z);else if(z.isTrial&&z.trialExpired)this.outputExpiredTrialKey(z.expiry,J,Z)}static extractExpiry(z){let J=z.substring(z.lastIndexOf("_")+1,z.length);return new Date(parseInt(Q.decode(J),10))}static extractLicenseComponents(z){let J=z.replace(/[\u200B-\u200D\uFEFF]/g,"");if(J=J.replace(/\r?\n|\r/g,""),z.length<=32)return{md5:null,license:z,version:null,isTrial:null};let Z=J.length-32,$=J.substring(Z),X=J.substring(0,Z),[Y,G,q]=Q.extractBracketedInformation(J);return{md5:$,license:X,version:Y,isTrial:G,type:q}}getLicenseDetails(z){let J=Q.chartsLicenseManager?"BOTH":"GRID";if(!z?.length)return{licenseKey:z,valid:!1,missing:!0,currentLicenseType:J};let Z=Q.getGridReleaseDate(),{md5:$,license:X,version:Y,isTrial:G,type:q}=Q.extractLicenseComponents(z),H=$===this.md5.md5(X)&&!z.includes("For_Trialing_ag-Grid_Only"),_=void 0,U=void 0,W=null,B=!1,E=void 0;function K(){_=WW,Y){case"legacy":case"2":{if(G)K();break}case"3":if(!q?.length)H=!1;else if(E=q,q!==sZ["01"]&&q!==sZ["0102"]||J==="BOTH"&&E!=="BOTH")H=!1,B=!0;else if(G)K()}}if(!H)return{licenseKey:z,valid:H,incorrectLicenseType:B,currentLicenseType:J,suppliedLicenseType:E};return{licenseKey:z,valid:H,expiry:Q.formatDate(W),expired:U,version:Y,isTrial:G,trialExpired:_,incorrectLicenseType:B,currentLicenseType:J,suppliedLicenseType:E}}isDisplayWatermark(){return this.isForceWatermark()||!this.isLocalhost()&&!this.isWebsiteUrl()&&!!this.watermarkMessage?.length}getWatermarkMessage(){return this.watermarkMessage||""}getHostname(){let J=(this.document.defaultView||window).location,{hostname:Z=""}=J;return Z}isForceWatermark(){let J=(this.document.defaultView||window).location,{pathname:Z}=J;return Z?Z.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 J=["January","February","March","April","May","June","July","August","September","October","November","December"],Z=z.getDate(),$=z.getMonth(),X=z.getFullYear();return Z+" "+J[$]+" "+X}static getGridReleaseDate(){return new Date(parseInt(Q.decode(Q.RELEASE_INFORMATION),10))}static decode(z){let Z="",$,X,Y,G,q,H,_,U=0,W=z.replace(/[^A-Za-z0-9+/=]/g,"");while(U>4,X=(q&15)<<4|H>>2,Y=(H&3)<<6|_,Z=Z+String.fromCharCode($),H!=64)Z=Z+String.fromCharCode(X);if(_!=64)Z=Z+String.fromCharCode(Y)}return Z=Q.utf8_decode(Z),Z}static utf8_decode(z){z=z.replace(/rn/g,"n");let J="";for(let Z=0;Z127&&$<2048)J+=String.fromCharCode($>>6|192),J+=String.fromCharCode($&63|128);else J+=String.fromCharCode($>>12|224),J+=String.fromCharCode($>>6&63|128),J+=String.fromCharCode($&63|128)}return J}static setChartsLicenseManager(z){this.chartsLicenseManager=z,this.chartsLicenseManager?.setLicenseKey(this.licenseKey,!0)}static setLicenseKey(z){if(T(this.licenseKey)&&this.licenseKey!==z)J9(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 J=z.match(/\[(.*?)\]/g).map((G)=>G.replace("[","").replace("]",""));if(!J||J.length===0)return["legacy",!1,void 0];let Z=J.filter((G)=>G==="TRIAL").length===1,$=J.filter((G)=>G.indexOf("v")===0)[0],X=$?$.replace("v",""):"legacy",Y=sZ[J.filter((G)=>sZ[G])[0]];return[X,Z,Y]}centerPadAndOutput(z){let J=this.totalMessageLength-z.length}padAndOutput(z,J="*",Z=""){}outputInvalidLicenseKey(z,J,Z){}outputExpiredTrialKey(z,J,Z){}outputMissingLicenseKey(z){}outputExpiredKey(z,J,Z,$){}};UY.RELEASE_INFORMATION="MTc3NDQyNTc0Nzc3NQ==";var lZ=UY,_D='.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}',UD={tag:"div",cls:"ag-watermark",children:[{tag:"div",ref:"eLicenseTextRef",cls:"ag-watermark-text"}]},WD=class extends x{constructor(){super(UD);this.eLicenseTextRef=S,this.registerCSS(_D)}wireBeans(Q){this.licenseManager=Q.licenseManager}postConstruct(){let Q=this.shouldDisplayWatermark();if(this.setDisplayed(Q),Q)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()}},BD={selector:"AG-WATERMARK",component:WD},PX=class extends j{constructor(){super(...arguments);this.beanName="licenseManager"}postConstruct(){this.validateLicense()}validateLicense(){let Q=this.beans;if(Q.withinStudio)this.licenseManager={isDisplayWatermark:()=>!1,getWatermarkMessage:()=>""};else{let z=new lZ(Y0(Q));this.licenseManager=z,z.validateLicense()}}static getLicenseDetails(Q){return new lZ(null).getLicenseDetails(Q)}getWatermarkSelector(){return BD}isDisplayWatermark(){return this.licenseManager.isDisplayWatermark()}getWatermarkMessage(){return this.licenseManager.getWatermarkMessage()}static setLicenseKey(Q){lZ.setLicenseKey(Q)}static setChartsLicenseManager(Q){lZ.setChartsLicenseManager(Q)}},ED=9525,TX={"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},aZ=`\r -`;function vX(Q,z,J){if(!z&&z!==""&&z!==0)return"";let Z=z;if(typeof z==="boolean"){if(J)Z=J(z)}return` ${Q}="${Z}"`}function KD(Q={}){let Z=["version"];if(!Q.version)Q.version="1.0";if(Q.encoding)Z.push("encoding");if(Q.standalone)Z.push("standalone");return``${X}="${Q[X]}"`).join(" ")} ?>`}function WY(Q,z){let J="";if(Q.properties){if(Q.properties.prefixedAttributes)Q.properties.prefixedAttributes.forEach(($)=>{for(let X of Object.keys($.map))J+=vX($.prefix+X,$.map[X],z)});if(Q.properties.rawMap)for(let $ of Object.keys(Q.properties.rawMap))J+=vX($,Q.properties.rawMap[$],z)}let Z="<"+Q.name+J;if(!Q.children&&Q.textNode==null)return Z+"/>"+aZ;if(Q.textNode!=null)return Z+">"+Q.textNode+""+aZ;if(Z+=">"+aZ,Q.children)for(let $ of Q.children)Z+=WY($,z);return Z+""+aZ}var LD=(Q)=>{return Math.round(Q*96/72)},R1=(Q)=>{return Math.ceil(Q*ED)},FD=(Q)=>{if(Q===void 0)return;let J=["Automatic","Roman","Swiss","Modern","Script","Decorative"].indexOf(Q||"Automatic");return Math.max(J,0)},J2=(Q,z)=>{if(!z)return;let J;if(typeof z==="number")J=z;else J=z({rowIndex:Q});return J},DD=(Q,z)=>{let{colSpan:J,column:Z}=Q.position;if(!Q.width)return;if(J){let $=z.slice(Z-1,Z+J-1),X=0;for(let Y=0;Y<$.length;Y++){let G=$[Y].getActualWidth();if(Q.width{let{rowSpan:J,row:Z}=Q.position;if(!Q.height)return;if(J){let $=0,X=0;for(let Y=Z;Y{let J=KD({encoding:"UTF-8",standalone:"yes"}),Z=WY(Q);if(z)return Z;return`${J}${Z}`},az=(Q)=>{let Z=String.fromCharCode,$=Math.floor(Q/26),X=Q%26;if(!$||Q===26)return Z(65+Q-1);if(!X)return az($-1)+"Z";if($<26)return Z(65+$-1)+Z(65+X-1);return az($)+Z(65+X-1)},kD=(Q)=>{return Q.replaceAll(` -`,"_x000a_")},G2=(Q)=>{if(Q==null)return null;let z="";for(let J=0;J=0&&Z<=31&&Z!==10){let Y=`_x${Z.toString(16).toUpperCase().padStart(4,"0")}_`;z+=Y}else z+=Q[J]}return z},VD=(Q)=>{let z=[];for(let J of Q.keys()){let Z=J.toString(),$={name:"t",textNode:W0(G2(Z))};if(Z.trim().length!==Z.length)$.properties={rawMap:{"xml:space":"preserve"}};z.push({name:"si",children:[$]})}return z},fD=class extends P6{constructor(Q){super(Q);this.mixedStyles={},this.mixedStyleCounter=0,this.rows=[],this.frozenRowCount=0,this.skipFrozenRows=!1,this.frozenColumnCount=0,this.skipFrozenColumns=!1,this.formulaSvc=Q.formulaSvc,this.config=Object.assign({},Q),this.workbook=Q.workbook,this.stylesByIds={};for(let J of this.config.baseExcelStyles)this.stylesByIds[J.id]=J;let z={id:"_quotePrefix",quotePrefix:1};this.stylesByIds[z.id]=z,this.excelStyles=[...this.config.baseExcelStyles,z]}addCustomContent(Q){for(let z of Q){let J=this.rows.length+1,Z;if(!this.config.suppressRowOutline&&z.outlineLevel!=null)Z=z.outlineLevel;let $={height:J2(J,z.height||this.config.rowHeight),cells:(z.cells||[]).map((X,Y)=>{let G=this.addImage(J,this.columnsToExport[Y],X.data?.value),q=null;if(X.styleId)q=typeof X.styleId==="string"?[X.styleId]:X.styleId;let H=this.getStyleId(q);if(G)return this.createCell(H,this.getDataTypeForValue(G.value),G.value==null?"":G.value);let _=X.data?.value??"",U=this.getDataTypeForValue(_);if(X.mergeAcross)return this.createMergedCell(H,U,_,X.mergeAcross);return this.createCell(H,U,_)}),outlineLevel:Z};if(z.collapsed!=null)$.collapsed=z.collapsed;if(z.hidden!=null)$.hidden=z.hidden;this.rows.push($)}}onNewHeaderGroupingRow(){let Q=[],{freezeRows:z,headerRowHeight:J}=this.config;if(this.rows.push({cells:Q,height:J2(this.rows.length+1,J)}),z)this.frozenRowCount++;return{onColumn:(Z,$,X,Y,G)=>{let q=this.config.styleLinker({rowType:"HEADER_GROUPING",rowIndex:1,value:`grouping-${$}`,columnGroup:Z});Q.push({...this.createMergedCell(this.getStyleId(q),this.getDataTypeForValue("string"),$,Y),collapsibleRanges:G})}}}onNewHeaderRow(){let{freezeRows:Q,headerRowHeight:z}=this.config;if(Q)this.frozenRowCount++;return this.onNewRow(this.onNewHeaderColumn,z)}onNewBodyRow(Q){let{freezeRows:z,rowHeight:J}=this.config;if(!this.skipFrozenRows)if(z==="headersAndPinnedRows"&&Q?.rowPinned==="top")this.frozenRowCount++;else if(typeof z==="function")if(z(y(this.gos,{node:Q})))this.frozenRowCount++;else this.skipFrozenRows=!0;else this.skipFrozenRows=!0;let Z=this.onNewRow(this.onNewBodyColumn,J);if(Q)this.addRowOutlineIfNecessary(Q);return Z}prepare(Q){super.prepare(Q),this.columnsToExport=[...Q],this.cols=Q.map((z,J)=>this.convertColumnToExcel(z,J))}parse(){let Q=this.rows.reduce((J,Z)=>Math.max(J,Z.cells.length),0);while(this.cols.length{let Z=this.extractHeaderValue(J),$=this.config.styleLinker({rowType:"HEADER",rowIndex:Q,value:Z,column:J});z.push(this.createCell(this.getStyleId($),this.getDataTypeForValue("string"),Z))}}onNewBodyColumn(Q,z){let J=0,{freezeColumns:Z,rightToLeft:$}=this.config;return(X,Y,G)=>{if(J>0){J-=1;return}if(!this.skipFrozenColumns){let L=X.getPinned();if(Z==="pinned"&&L&&(L===!0||L==="left")!==$)this.frozenColumnCount++;else if(typeof Z==="function"&&Z(y(this.gos,{column:X})))this.frozenColumnCount++;else this.skipFrozenColumns=!0}let{value:q,valueFormatted:H}=this.extractRowCellValue({column:X,node:G,currentColumnIndex:Y,accumulatedRowIndex:Q,type:"excel",useRawFormula:!0}),_=q,U=typeof _==="bigint"?_.toString():_,W=this.config.styleLinker({rowType:"BODY",rowIndex:Q,value:_,column:X,node:G}),B=this.getStyleId(W),E=X.getColSpan(G),K=this.addImage(Q,X,U);if(K)z.push(this.createCell(B,this.getDataTypeForValue(K.value),K.value==null?"":K.value));else if(E>1)J=E-1,z.push(this.createMergedCell(B,this.getDataTypeForValue(_),U,E-1));else{let L=X.isAllowFormula()&&this.formulaSvc?.isFormula(U),F=this.createCell(B,L?"f":this.getDataTypeForValue(_),L?this.formulaSvc?.updateFormulaByOffset({value:U,rowDelta:Q-(G.formulaRowIndex+1),useRefFormat:!1}):U,H);z.push(F)}}}onNewRow(Q,z){let J=[];return this.rows.push({cells:J,height:J2(this.rows.length+1,z)}),{onColumn:Q.bind(this,this.rows.length,J)()}}addWorksheetToWorkbook(Q){let{excelStyles:z,config:J}=this;if(this.mapSharedStrings(Q),this.frozenColumnCount)J.frozenColumnCount=this.frozenColumnCount;if(this.frozenRowCount)J.frozenRowCount=this.frozenRowCount;return this.workbook.addWorksheet(z,Q,J)}mapSharedStrings(Q){let z;for(let J of Q.table.rows)for(let Z of J.cells){let $=Z.data;if(!$||$.type!=="s")continue;let X=$.value;if(X==null)continue;if(X===""){z??(z=this.workbook.getStringPosition("").toString()),$.value=z;continue}$.value=this.workbook.getStringPosition(String(X)).toString()}}getDataTypeForValue(Q){if(Q===void 0)return"empty";let z="s";try{if(this.isNumerical(Q))z="n"}catch(J){}return z}getTypeFromStyle(Q,z){if(this.isFormula(z))return"f";if(Q?.dataType)switch(Q.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:R(162,{id:Q.id,dataType:Q.dataType})}return null}addImage(Q,z,J){if(!this.config.addImageToCell)return;let Z=this.config.addImageToCell(Q,z,J);if(!Z)return;return this.workbook.addBodyImageToMap(Z.image,Q,z,this.columnsToExport,this.config.rowHeight),Z}createCell(Q,z,J,Z){let $=this.getStyleById(Q);if(!$?.dataType&&z==="s"&&Z!=null)J=Z;let X=this.getTypeFromStyle($,J)||z,{value:Y,escaped:G}=this.getCellValue(X,J),q=[];if($)q.push(Q);if(G)q.push("_quotePrefix");return Q=this.getStyleId(q)||void 0,{styleId:Q,data:{type:X,value:Y}}}createMergedCell(Q,z,J,Z){let $=J==null?"":J;return{styleId:this.getStyleById(Q)?Q:void 0,data:{type:z,value:z==="s"?String($):J},mergeAcross:Z}}getCellValue(Q,z){let J=!1;if(z==null||Q==="s"&&z==="")return{value:"",escaped:!1};if(Q==="s"){if(z=String(z),z[0]==="'")J=!0,z=z.slice(1)}else if(Q==="f")z=this.addXlfnPrefix(z).slice(1);else if(Q==="n"){let Z=Number(z);if(isNaN(Z))z="";else if(z!=="")z=Z.toString()}return{value:z,escaped:J}}addXlfnPrefix(Q){if(!Q)return Q;let z=/(^|[^A-Z0-9._])(CONCAT)(\s*\()/gi;return Q.replace(z,(J,Z,$,X)=>`${Z}_xlfn.${$}${X}`)}getStyleId(Q){if(!Q?.length)return null;let z=Q.filter((Z)=>this.stylesByIds[Z]!=null);if(!z.length)return null;if(z.length===1)return z[0];let J=z.join("-");if(!this.mixedStyles[J])this.addNewMixedStyle(z);return this.mixedStyles[J].excelID}addNewMixedStyle(Q){this.mixedStyleCounter+=1;let z=`mixedStyle${this.mixedStyleCounter}`,J={};for(let $ of Q){let X=this.stylesByIds[$];if(X)B0(J,X,!0,!0)}J.id=z;let Z=Q.join("-");this.mixedStyles[Z]={excelID:z,key:Z,result:J},this.excelStyles.push(J),this.stylesByIds[z]=J}isFormula(Q){if(Q==null)return!1;let z=String(Q);return this.config.autoConvertFormulas&&oJ(z)}isNumerical(Q){if(typeof Q==="bigint")return!1;return isFinite(Q)&&Q!==""&&!isNaN(parseFloat(Q))}getStyleById(Q){if(Q==null)return null;return this.stylesByIds[Q]||null}},AD={getTemplate(Q){let{name:z,ContentType:J,Extension:Z,PartName:$}=Q;return{name:z,properties:{rawMap:{Extension:Z,PartName:$,ContentType:J}}}}},jD=AD,K2=(Q)=>Q==="jpg"?"jpeg":Q,RD={getTemplate({sheetLen:Q,hasCustomProperties:z}){let J=Array(Q).fill(void 0).map((U,W)=>({name:"Override",ContentType:"application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml",PartName:`/xl/worksheets/sheet${W+1}.xml`})),Z=fz.size,$=dQ.size,X={};T1.forEach((U)=>{X[K2(U.type)]=!0});let Y=Array(Z).fill(void 0).map((U,W)=>({name:"Override",ContentType:"application/vnd.openxmlformats-officedocument.drawing+xml",PartName:`/xl/drawings/drawing${W+1}.xml`})),G=[];wQ.forEach(({name:U})=>{G.push({name:"Override",ContentType:"application/vnd.openxmlformats-officedocument.spreadsheetml.table+xml",PartName:`/xl/tables/${U}.xml`})});let q=z?[{name:"Override",ContentType:"application/vnd.openxmlformats-officedocument.custom-properties+xml",PartName:"/docProps/custom.xml"}]:[],H=Object.keys(X).map((U)=>({name:"Default",ContentType:`image/${U}`,Extension:U}));if($)H.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"},...J,{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,...G,{name:"Override",ContentType:"application/vnd.openxmlformats-package.core-properties+xml",PartName:"/docProps/core.xml"},...q].map((U)=>jD.getTemplate(U));return{name:"Types",properties:{rawMap:{xmlns:"http://schemas.openxmlformats.org/package/2006/content-types"}},children:_}}},SD=RD,OD={getTemplate(Q){let J=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:Q},{name:"dc:title",textNode:"Workbook"},{name:"dcterms:created",properties:{rawMap:{"xsi:type":"dcterms:W3CDTF"}},textNode:J},{name:"dcterms:modified",properties:{rawMap:{"xsi:type":"dcterms:W3CDTF"}},textNode:J}]}}},PD=OD,TD="{D5CDD505-2E9C-101B-9397-08002B2CF9AE}",vD=(Q)=>{return Object.keys(Q).filter((J)=>J&&Q[J]!=null).map((J,Z)=>({name:"property",properties:{rawMap:{fmtid:TD,pid:(Z+2).toString(),name:W0(J)??""}},children:[{name:"vt:lpwstr",textNode:W0(G2(String(Q[J])))??""}]}))},ID={getTemplate(Q){return{name:"Properties",properties:{rawMap:{xmlns:"http://schemas.openxmlformats.org/officeDocument/2006/custom-properties","xmlns:vt":"http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes"}},children:vD(Q)}}},CD=ID,IX=(Q,z)=>({name:`xdr:${Q}`,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()}]}),bD=(Q)=>{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(Q.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}},yD=(Q,z)=>({name:"xdr:nvPicPr",children:[{name:"xdr:cNvPr",properties:{rawMap:{id:z,name:Q.id,descr:Q.altText!=null?Q.altText:void 0}},children:[bD(Q)]},{name:"xdr:cNvPicPr",properties:{rawMap:{preferRelativeResize:"0"}},children:[{name:"a:picLocks"}]}]}),CX=(Q)=>{if(!Q.saturation&&!Q.tint)return;let z=[];if(Q.saturation)z.push({name:"a:satMod",properties:{rawMap:{val:Q.saturation*1000}}});if(Q.tint)z.push({name:"a:tint",properties:{rawMap:{val:Q.tint*1000}}});return z},xD=(Q,z)=>{return{name:"a:duotone",children:[{name:"a:prstClr",properties:{rawMap:{val:Q.color}},children:CX(Q)},{name:"a:srgbClr",properties:{rawMap:{val:z.color}},children:CX(z)}]}},wD=(Q,z)=>{let J;if(Q.transparency){let Z=Math.min(Math.max(Q.transparency,0),100);J=[{name:"a:alphaModFix",properties:{rawMap:{amt:1e5-Math.round(Z*1000)}}}]}if(Q.recolor){if(!J)J=[];switch(Q.recolor.toLocaleLowerCase()){case"grayscale":J.push({name:"a:grayscl"});break;case"sepia":J.push(xD({color:"black"},{color:"D9C3A5",tint:50,saturation:180}));break;case"washout":J.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:J},{name:"a:stretch",children:[{name:"a:fillRect"}]}]}},ND=(Q,z)=>{let J={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(Q.rotation){let X=Q.rotation;J.properties={rawMap:{rot:Math.min(Math.max(X,0),360)*60000}}}return{name:"xdr:spPr",children:[J,{name:"a:prstGeom",properties:{rawMap:{prst:"rect"}},children:[{name:"a:avLst"}]}]}},gD=(Q)=>{Q.fitCell=!!Q.fitCell||!Q.width||!Q.height;let{position:z={},fitCell:J,width:Z=0,height:$=0,totalHeight:X,totalWidth:Y}=Q,{offsetX:G=0,offsetY:q=0,row:H=1,rowSpan:_=1,column:U=1,colSpan:W=1}=z;return{from:{row:H-1,col:U-1,offsetX:R1(G),offsetY:R1(q)},to:{row:H-1+(J?1:_-1),col:U-1+(J?1:W-1),offsetX:R1(Z+G),offsetY:R1($+q)},height:R1(X||$),width:R1(Y||Z)}},hD=(Q,z,J,Z)=>{return{name:"xdr:pic",children:[yD(Q,z+1),wD(Q,J+1),ND(Q,Z)]}},uD={getTemplate(Q){let{sheetIndex:z}=Q,J=fz.get(z),Z=v1.get(z),$=J.map((X,Y)=>{let G=gD(X);return{name:"xdr:twoCellAnchor",properties:{rawMap:{editAs:"absolute"}},children:[IX("from",G.from),IX("to",G.to),hD(X,Y,Z.get(X.id).index,G),{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:$}}},mD=uD,cD={getTemplate(Q){let{Id:z,Type:J,Target:Z}=Q;return{name:"Relationship",properties:{rawMap:{Id:z,Type:J,Target:Z}}}}},pD=cD,iD={getTemplate(Q){let z=Q.map((J)=>pD.getTemplate(J));return{name:"Relationships",properties:{rawMap:{xmlns:"http://schemas.openxmlformats.org/package/2006/relationships"}},children:z}}},IJ=iD,nD={getTemplate(Q){return{name:"sst",properties:{rawMap:{xmlns:"http://schemas.openxmlformats.org/spreadsheetml/2006/main",count:Q.size,uniqueCount:Q.size}},children:VD(Q)}}},dD=nD,tD=(Q)=>{switch(Q){case 1:return"thin";case 2:return"medium";case 3:return"thick";default:return"hair"}},rD={None:"None",Dot:"Dotted",Dash:"Dashed",Double:"Double",DashDot:"DashDot",DashDotDot:"DashDotDot",SlantDashDot:"SlantDashDot",Continuous:"Continuous"},sD=["Dashed","DashDot","DashDotDot"],lD={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"},aD={Automatic:"general",Left:"left",Center:"center",Right:"right",Fill:"fill",Justify:"justify",CenterAcrossSelection:"centerContinuous",Distributed:"distributed",JustifyDistributed:"justify"},oD={Automatic:void 0,Top:"top",Bottom:"bottom",Center:"center",Justify:"justify",Distributed:"distributed",JustifyDistributed:"justify"},eD=(Q)=>{if(!Q)return"none";return lD[Q]||Q},kz=(Q)=>{if(Q==null)return Q;if(Q.charAt(0)==="#")Q=Q.substring(1);return Q.length===6?"FF"+Q:Q},oZ=(Q,z)=>{if(!Q)return"thin";let J=tD(z);if(Q==="Continuous")return J;let Z=rD[Q];if(J==="medium"&&sD.some(($)=>$===Z))return`medium${Z}`;return`${Z.charAt(0).toLowerCase()}${Z.substring(1)}`},QM=(Q)=>{return aD[Q]||"general"},zM=(Q)=>{return oD[Q]||void 0},kJ=(Q)=>{return{name:"color",properties:{rawMap:{rgb:kz(Q||"#000000")}}}},JM={getTemplate(Q){let{left:z,right:J,top:Z,bottom:$,diagonal:X}=Q,Y=z?[kJ(z.color)]:void 0,G=J?[kJ(J.color)]:void 0,q=Z?[kJ(Z.color)]:void 0,H=$?[kJ($.color)]:void 0,_=X?[kJ(X.color)]:void 0;return{name:"border",children:[{name:"left",properties:{rawMap:{style:z?.style}},children:Y},{name:"right",properties:{rawMap:{style:J?.style}},children:G},{name:"top",properties:{rawMap:{style:Z?.style}},children:q},{name:"bottom",properties:{rawMap:{style:$?.style}},children:H},{name:"diagonal",properties:{rawMap:{style:X?.style}},children:_}]}}},ZM=JM,$M={getTemplate(Q){return{name:"borders",properties:{rawMap:{count:Q.length}},children:Q.map((z)=>ZM.getTemplate(z))}}},XM=$M,YM=(Q)=>{let J=["Context","LeftToRight","RightToLeft"].indexOf(Q);return Math.max(J,0)},GM={getTemplate(Q){let{horizontal:z,indent:J,readingOrder:Z,rotate:$,shrinkToFit:X,vertical:Y,wrapText:G}=Q;return{name:"alignment",properties:{rawMap:{horizontal:z&&QM(z),indent:J,readingOrder:Z&&YM(Z),textRotation:$,shrinkToFit:X,vertical:Y&&zM(Y),wrapText:G}}}}},qM=GM,HM={getTemplate(Q){let z=Q.protected===!1?0:1;return{name:"protection",properties:{rawMap:{hidden:Q.hideFormula===!0?1:0,locked:z}}}}},_M=HM,UM={getTemplate(Q){let{alignment:z,borderId:J,fillId:Z,fontId:$,numFmtId:X,protection:Y,quotePrefix:G,xfId:q}=Q,H=[];if(z)H.push(qM.getTemplate(z));if(Y)H.push(_M.getTemplate(Y));return{name:"xf",properties:{rawMap:{applyAlignment:z?1:void 0,applyProtection:Y?1:void 0,applyBorder:J?1:void 0,applyFill:Z?1:void 0,borderId:J,fillId:Z,applyFont:$?1:void 0,fontId:$,applyNumberFormat:X?1:void 0,numFmtId:X,quotePrefix:G?1:void 0,xfId:q}},children:H.length?H:void 0}}},BY=UM,WM={getTemplate(Q){return{name:"cellStyleXfs",properties:{rawMap:{count:Q.length}},children:Q.map((z)=>BY.getTemplate(z))}}},BM=WM,EM={getTemplate(Q){let{builtinId:z,name:J,xfId:Z}=Q;return{name:"cellStyle",properties:{rawMap:{builtinId:z,name:J,xfId:Z}}}}},KM=EM,LM={getTemplate(Q){return{name:"cellStyles",properties:{rawMap:{count:Q.length}},children:Q.map((z)=>KM.getTemplate(z))}}},FM=LM,DM={getTemplate(Q){return{name:"cellXfs",properties:{rawMap:{count:Q.length}},children:Q.map((z)=>BY.getTemplate(z))}}},MM=DM,kM={getTemplate(Q){let{patternType:z,fgTheme:J,fgTint:Z,fgRgb:$,bgRgb:X,bgIndexed:Y}=Q,G={name:"patternFill",properties:{rawMap:{patternType:z}}};if(J||Z||$)G.children=[{name:"fgColor",properties:{rawMap:{theme:J,tint:Z,rgb:$}}}];if(Y||X){if(!G.children)G.children=[];G.children.push({name:"bgColor",properties:{rawMap:{indexed:Y,rgb:X}}})}return{name:"fill",children:[G]}}},VM=kM,fM={getTemplate(Q){return{name:"fills",properties:{rawMap:{count:Q.length}},children:Q.map((z)=>VM.getTemplate(z))}}},AM=fM,jM={getTemplate(Q){let{size:z,colorTheme:J,color:Z="FF000000",fontName:$="Calibri",family:X,scheme:Y,italic:G,bold:q,strikeThrough:H,outline:_,shadow:U,underline:W,verticalAlign:B}=Q,E=[{name:"sz",properties:{rawMap:{val:z}}},{name:"color",properties:{rawMap:{theme:J,rgb:Z}}},{name:"name",properties:{rawMap:{val:$}}}];if(X)E.push({name:"family",properties:{rawMap:{val:X}}});if(Y)E.push({name:"scheme",properties:{rawMap:{val:Y}}});if(G)E.push({name:"i"});if(q)E.push({name:"b"});if(H)E.push({name:"strike"});if(_)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}}},RM=jM,SM={getTemplate(Q){return{name:"fonts",properties:{rawMap:{count:Q.length}},children:Q.map((z)=>RM.getTemplate(z))}}},OM=SM;function PM(Q){let z=Q.split(/(\[[^\]]*\])/);for(let J=0;JvM.getTemplate(z))}}},CM=IM,q2,S1,AJ,jJ,RJ,EY,H2,KY,l6,LY=(Q,z)=>{if(Q.includes("mixedStyle")&&z>1)Q+=`_${z}`;return Q},FY=()=>{q2={base:0},S1=[],AJ=[{fontName:"Calibri",colorTheme:"1",family:"2",scheme:"minor"}],jJ=[{patternType:"none"},{patternType:"gray125"}],RJ=[{left:void 0,right:void 0,top:void 0,bottom:void 0,diagonal:void 0}],EY=[{borderId:0,fillId:0,fontId:0,numFmtId:0}],H2=[{borderId:0,fillId:0,fontId:0,numFmtId:0,xfId:0}],KY=[{builtinId:0,name:"Normal",xfId:0}]},bM=(Q)=>{let z=eD(Q.pattern),J=kz(Q.color),Z=kz(Q.patternColor),$=jJ.findIndex((X)=>{let{patternType:Y,fgRgb:G,bgRgb:q}=X;return!(Y!=z||G!=J||q!=Z)});if($===-1)$=jJ.length,jJ.push({patternType:z,fgRgb:J,bgRgb:Z});return $},yM=(Q)=>{if(TX[Q])return TX[Q];let z=S1.findIndex((J)=>J.formatCode===Q);if(z===-1)z=S1.length+164,S1.push({formatCode:Q,numFmtId:z});else z=S1[z].numFmtId;return z},xM=(Q)=>{let{borderBottom:z,borderTop:J,borderLeft:Z,borderRight:$}=Q,X,Y,G,q,H,_,U,W;if(Z)G=oZ(Z.lineStyle,Z.weight),U=kz(Z.color);if($)q=oZ($.lineStyle,$.weight),W=kz($.color);if(z)X=oZ(z.lineStyle,z.weight),H=kz(z.color);if(J)Y=oZ(J.lineStyle,J.weight),_=kz(J.color);let B=RJ.findIndex((E)=>{let{left:K,right:L,top:F,bottom:D}=E;if(!K&&(G||U))return!1;if(!L&&(q||W))return!1;if(!F&&(Y||_))return!1;if(!D&&(X||H))return!1;let{style:M,color:k}=K||{},{style:f,color:A}=L||{},{style:O,color:v}=F||{},{style:I,color:C}=D||{};if(M!=G||k!=U)return!1;if(f!=q||A!=W)return!1;if(O!=Y||v!=_)return!1;if(I!=X||C!=H)return!1;return!0});if(B===-1)B=RJ.length,RJ.push({left:{style:G,color:U},right:{style:q,color:W},top:{style:Y,color:_},bottom:{style:X,color:H},diagonal:{style:void 0,color:void 0}});return B},wM=(Q)=>{let{fontName:z="Calibri",color:J,size:Z,bold:$,italic:X,outline:Y,shadow:G,strikeThrough:q,underline:H,family:_,verticalAlign:U}=Q,W=kz(J),B=FD(_),E=H?H.toLocaleLowerCase():void 0,K=U?U.toLocaleLowerCase():void 0,L=AJ.findIndex((F)=>{return!(F.fontName!=z||F.color!=W||F.size!=Z||F.bold!=$||F.italic!=X||F.outline!=Y||F.shadow!=G||F.strikeThrough!=q||F.underline!=E||F.verticalAlign!=K||F.family!=B)});if(L===-1)L=AJ.length,AJ.push({fontName:z,color:W,size:Z,bold:$,italic:X,outline:Y,shadow:G,strikeThrough:q,underline:E,verticalAlign:K,family:B!=null?B.toString():void 0});return L},NM=(Q)=>{let{alignment:z,borders:J,font:Z,interior:$,numberFormat:X,protection:Y,quotePrefix:G}=Q,{id:q}=Q,H=0,_=0,U=0,W=0;if(!q)return;if(q=LY(q,l6),q2[q]!=null)return;if($)H=bM($);if(J)_=xM(J);if(Z)U=wM(Z);if(X)W=yM(X.format);q2[q]=H2.length,H2.push({alignment:z,borderId:_||0,fillId:H||0,fontId:U||0,numFmtId:W||0,protection:Y,quotePrefix:G,xfId:0})},gM={getTemplate(Q){let z=CM.getTemplate(S1),J=OM.getTemplate(AJ.map((q)=>({...q,size:q.size!=null?q.size:Q}))),Z=AM.getTemplate(jJ),$=XM.getTemplate(RJ),X=BM.getTemplate(EY),Y=MM.getTemplate(H2),G=FM.getTemplate(KY);return FY(),{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,J,Z,$,X,Y,G,{name:"tableStyles",properties:{rawMap:{count:0,defaultPivotStyle:"PivotStyleLight16",defaultTableStyle:"TableStyleMedium2"}}}]}}},hM=(Q,z)=>{return q2[LY(Q,z)]||0},uM=(Q,z)=>{if(l6=z,l6===1)FY();Q.forEach(NM)},mM=gM,cM={getTemplate(Q,z){let{name:J,columns:Z,rowRange:$,displayName:X,showRowStripes:Y,showColumnStripes:G,showFilterButtons:q,highlightFirstColumn:H,highlightLastColumn:_}=Q||{},U=!$||$[0]-$[1]===0;if(!Q||!J||!Array.isArray(Z)||!Z.length||U)return{name:"table"};let W=Z.map((D,M)=>({name:"filterColumn",properties:{rawMap:{colId:M.toString(),hiddenButton:q[M]?0:1}}})),B=`A${$[0]}`,E=`${az(Z.length)}${$[1]}`,K=`${B}:${E}`,L=`${z+1}`,F=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:F,displayName:F,ref:K,totalsRowShown:0,id:L}},children:[{name:"autoFilter",properties:{rawMap:{ref:K}},children:W},{name:"tableColumns",properties:{rawMap:{count:Z.length}},children:Z.map((D,M)=>({name:"tableColumn",properties:{rawMap:{id:(M+1).toString(),name:W0(kD(D)),dataCellStyle:"Normal"}}}))},{name:"tableStyleInfo",properties:{rawMap:{name:"TableStyleLight1",showFirstColumn:H?1:0,showLastColumn:_?1:0,showRowStripes:Y?1:0,showColumnStripes:G?1:0}}}]}}},pM=cM,HQ=(Q)=>{let[z,J,Z,$]=Q;return{name:`a:${z}`,children:[{name:`a:${J}`,properties:{rawMap:{val:Z,lastClr:$}}}]}},iM={getTemplate(){return{name:"a:clrScheme",properties:{rawMap:{name:"Office"}},children:[HQ(["dk1","sysClr","windowText","000000"]),HQ(["lt1","sysClr","window","FFFFFF"]),HQ(["dk2","srgbClr","44546A"]),HQ(["lt2","srgbClr","E7E6E6"]),HQ(["accent1","srgbClr","4472C4"]),HQ(["accent2","srgbClr","ED7D31"]),HQ(["accent3","srgbClr","A5A5A5"]),HQ(["accent4","srgbClr","FFC000"]),HQ(["accent5","srgbClr","5B9BD5"]),HQ(["accent6","srgbClr","70AD47"]),HQ(["hlink","srgbClr","0563C1"]),HQ(["folHlink","srgbClr","954F72"])]}}},nM=iM,P=(Q)=>{let[z,J,Z,$]=Q;return{name:`a:${z}`,properties:{rawMap:{script:Z,typeface:J,panose:$}}}},dM={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"])]}]}}},tM=dM,xQ=(Q,z,J)=>({name:`a:${Q}`,properties:{rawMap:{val:z}},children:J}),g6=(Q)=>{let[z,J,Z,$,X,Y]=Q,G=[];if(G.push(xQ("satMod",Z)),$)G.push(xQ("lumMod",$));if(X)G.push(xQ("tint",X));if(Y)G.push(xQ("shade",Y));return{name:"a:gs",properties:{rawMap:{pos:z}},children:[{name:"a:schemeClr",properties:{rawMap:{val:J}},children:G}]}},_2=(Q,z)=>({name:"a:solidFill",children:[xQ("schemeClr",Q,z)]}),a6=(Q)=>{let[z,J,Z,$,X]=Q,[Y,G]=X;return{name:"a:gradFill",properties:{rawMap:{rotWithShape:z}},children:[{name:"a:gsLst",children:[g6(J),g6(Z),g6($)]},{name:"a:lin",properties:{rawMap:{ang:Y,scaled:G}}}]}},h6=(Q)=>{let[z,J,Z,$]=Q;return{name:"a:ln",properties:{rawMap:{w:z,cap:J,cmpd:Z,algn:$}},children:[_2("phClr"),xQ("prstDash","solid"),{name:"a:miter",properties:{rawMap:{lim:"800000"}}}]}},u6=(Q)=>{let z=[];if(Q){let[J,Z,$,X,Y]=Q;z.push({name:"a:outerShdw",properties:{rawMap:{blurRad:J,dist:Z,dir:$,algn:X,rotWithShape:Y}},children:[xQ("srgbClr","000000",[xQ("alpha","63000")])]})}return{name:"a:effectStyle",children:[Object.assign({},{name:"a:effectLst"},z.length?{children:z}:{})]}},rM=()=>({name:"a:fillStyleLst",children:[_2("phClr"),a6(["1",["0","phClr","105000","110000","67000"],["50000","phClr","103000","105000","73000"],["100000","phClr","109000","105000","81000"],["5400000","0"]]),a6(["1",["0","phClr","103000","102000","94000"],["50000","phClr","110000","100000",void 0,"100000"],["100000","phClr","120000","99000",void 0,"78000"],["5400000","0"]])]}),sM=()=>({name:"a:lnStyleLst",children:[h6(["6350","flat","sng","ctr"]),h6(["12700","flat","sng","ctr"]),h6(["19050","flat","sng","ctr"])]}),lM=()=>({name:"a:effectStyleLst",children:[u6(),u6(),u6(["57150","19050","5400000","ctr","0"])]}),aM=()=>({name:"a:bgFillStyleLst",children:[_2("phClr"),_2("phClr",[xQ("tint","95000"),xQ("satMod","170000")]),a6(["1",["0","phClr","150000","102000","93000","98000"],["50000","phClr","130000","103000","98000","90000"],["100000","phClr","120000",void 0,void 0,"63000"],["5400000","0"]])]}),oM={getTemplate(){return{name:"a:fmtScheme",properties:{rawMap:{name:"Office"}},children:[rM(),sM(),lM(),aM()]}}},eM=oM,Qk={getTemplate(){return{name:"a:themeElements",children:[nM.getTemplate(),tM.getTemplate(),eM.getTemplate()]}}},zk=Qk,Jk={getTemplate(){return{name:"a:theme",properties:{prefixedAttributes:[{prefix:"xmlns:",map:{a:"http://schemas.openxmlformats.org/drawingml/2006/main"}}],rawMap:{name:"Office Theme"}},children:[zk.getTemplate(),{name:"a:objectDefaults"},{name:"a:extraClrSchemeLst"}]}}},Zk=Jk,$k=()=>({name:"o:shapelayout",properties:{prefixedAttributes:[{prefix:"v:",map:{ext:"edit"}}]},children:[{name:"o:idmap",properties:{prefixedAttributes:[{prefix:"v:",map:{ext:"edit"}}],rawMap:{data:"1"}}}]}),Xk=()=>({name:"v:stroke",properties:{rawMap:{joinstyle:"miter"}}}),Yk=(Q)=>({name:"v:formulas",children:Q.map((z)=>({name:"v:f",properties:{rawMap:{eqn:z}}}))}),Gk=()=>({name:"v:path",properties:{prefixedAttributes:[{prefix:"o:",map:{connecttype:"rect",extrusionok:"f"}}],rawMap:{gradientshapeok:"t"}}}),DY=(Q)=>{let{aspectratio:z,rotation:J}=Q||{},Z={};if(z)Z.aspectratio="t";if(J)Z.rotation="t";return{name:"o:lock",properties:{prefixedAttributes:[{prefix:"v:",map:{ext:"edit"}}],rawMap:Z}}};function qk(Q,z,J,Z,$){return(Q-z)/(J-z)*($-Z)+Z}var Hk=(Q,z)=>{let J,{recolor:Z,brightness:$,contrast:X,id:Y}=Q;if(Z){if(J={},Z==="Washout"||Z==="Grayscale")J.gain="19661f",J.blacklevel="22938f";if(Z==="Black & White"||Z==="Grayscale"){if(J.grayscale="t",Z==="Black & White")J.bilevel="t"}}if(!Z||Z==="Grayscale"){if(!J)J={};if(X!=null&&X!==50){let G="1";if(X>=0){if(X<50)G=String(X/50);else if(X<100)G=String(50/(100-X));else if(X===100)G="2147483647f"}J.gain=G}if($!=null&&$!==50)J.blacklevel=qk($,0,100,-0.5,0.5).toString()}return{name:"v:imagedata",properties:{prefixedAttributes:[{prefix:"o:",map:{relid:`rId${z}`,title:Y}}],rawMap:J}}},_k=()=>{let Q=["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:[Xk(),Yk(Q),Gk(),DY({aspectratio:!0})]}},bX=(Q)=>Math.floor((Q??0)*0.74999943307122),Uk=(Q,z)=>{let{width:J=0,height:Z=0,altText:$}=Q,X=bX(J),Y=bX(Z);return{name:"v:shape",properties:{rawMap:{id:Q.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:$}},children:[Hk(Q,z+1),DY({rotation:!0})]}},Wk={getTemplate(Q){let z=dQ.get(Q.sheetIndex)||[],J=[$k(),_k(),...z.map((Z,$)=>Uk(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:J}}},Bk=Wk,Ek={getTemplate(Q,z){let J=(z+1).toString();return{name:"sheet",properties:{rawMap:{name:Q,sheetId:J,"r:id":`rId${J}`}}}}},Kk=Ek,Lk={getTemplate(Q){return{name:"sheets",children:Q.map((z,J)=>Kk.getTemplate(z,J))}}},Fk=Lk,Dk={getTemplate(Q,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}}}]},Fk.getTemplate(Q)]}}},Mk=Dk,kk=(Q)=>Math.ceil((Q-12)/7+1),Vk={getTemplate(Q){let{min:z,max:J,outlineLevel:Z,s:$,width:X,hidden:Y,bestFit:G}=Q,q=1,H="0";if(X>1)q=kk(X),H="1";return{name:"col",properties:{rawMap:{min:z,max:J,outlineLevel:Z!=null?Z:void 0,width:q,style:$,hidden:Y?"1":"0",bestFit:G?"1":"0",customWidth:H}}}}},fk=Vk,Ak={getTemplate(Q){return{name:"mergeCell",properties:{rawMap:{ref:Q}}}}},jk=Ak,Rk=(Q)=>{let z=Q.charAt(0).toLowerCase();return z==="s"?"inlineStr":z},Sk={getTemplate(Q,z,J){let{ref:Z,data:$,styleId:X}=Q,{type:Y,value:G}=$||{type:"empty",value:null},q=Y;if(Y==="f")q="str";else if(Y.charAt(0)===Y.charAt(0).toUpperCase())q=Rk(Y);let H={name:"c",properties:{rawMap:{r:Z,t:q==="empty"?void 0:q,s:X?hM(X,J):void 0}}};if(q==="empty")return H;let _;if(q==="str"&&Y==="f")_=[{name:"f",textNode:W0(G2(G))}];else if(q==="inlineStr")_=[{name:"is",children:[{name:"t",textNode:W0(G2(G))}]}];else _=[{name:"v",textNode:G}];return Object.assign({},H,{children:_})}},Ok=Sk,Pk=(Q,z)=>{let J=[],Z=0;for(let $=0;$=0;$--){let X=[],Y=Q[J[$].pos];for(let G=1;G<=Y.mergeAcross;G++)X.push({ref:`${az(J[$].excelPos+1+G)}${z+1}`,styleId:Y.styleId,data:{type:"empty",value:null}});if(X.length)Q.splice(J[$].pos+1,0,...X)}},Tk=(Q)=>Q.data?.value!==""||Q.styleId!==void 0,vk={getTemplate(Q,z,J){let{collapsed:Z,hidden:$,height:X,outlineLevel:Y,cells:G=[]}=Q;Pk(G,z);let q=G.filter(Tk).map((H,_)=>Ok.getTemplate(H,_,J));return{name:"row",properties:{rawMap:{r:z+1,collapsed:Z?"1":"0",hidden:$?"1":"0",ht:X,customHeight:X!=null?"1":"0",spans:"1:1",outlineLevel:Y||void 0}},children:q}}},Ik=vk,Ck=(Q,z,J)=>{let Z=[],$=[];Q.forEach((G,q)=>{let H=G.cells,_=0,U;H.forEach((W,B)=>{let E=B+_+1,K=az(E),L=q+1;if(W.mergeAcross){_+=W.mergeAcross;let D=az(B+_+1);Z.push(`${K}${L}:${D}${L}`)}if(!z[E-1])z[E-1]={};let{collapsibleRanges:F}=W;if(F)F.forEach((D)=>{$.push([E+D[0],E+D[1]])});U=z[E-1],U.min=E,U.max=E,W.ref=`${K}${L}`})}),$.sort((G,q)=>{if(G[0]!==q[0])return G[0]-q[0];return q[1]-G[1]});let X=new Map,Y=new Map;return $.filter((G)=>{let q=G.toString();if(X.get(q))return!1;return X.set(q,!0),!0}).forEach((G)=>{let q=z.find((_)=>_.min==G[0]&&_.max==G[1]),H=Y.get(G[0]);z.push({min:G[0],max:G[1],outlineLevel:J?void 0:H||1,width:(q||{width:100}).width}),Y.set(G[0],(H||0)+1)}),Z},bk=(Q)=>{if(!Q||Q!=="Portrait"&&Q!=="Landscape")return"portrait";return Q.toLocaleLowerCase()},yk=(Q)=>{if(Q==null)return 1;let J=["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(Q);return J===-1?1:J+1},xk=(Q)=>{let z={"&[Page]":"&P","&[Pages]":"&N","&[Date]":"&D","&[Time]":"&T","&[Tab]":"&A","&[Path]":"&Z","&[File]":"&F","&[Picture]":"&G"};for(let J of Object.keys(z))Q=Q.replace(J,z[J]);return Q},wk=(Q)=>{if(Q==="Center")return"C";if(Q==="Right")return"R";return"L"},Nk=(Q,z)=>{if(!z)return Q;if(Q+="&"",Q+=z.fontName||"Calibri",z.bold!==z.italic)Q+=z.bold?",Bold":",Italic";else if(z.bold)Q+=",Bold Italic";else Q+=",Regular";if(Q+=""",z.size)Q+=`&${z.size}`;if(z.strikeThrough)Q+="&S";if(z.underline)Q+=`&${z.underline==="Double"?"E":"U"}`;if(z.color)Q+=`&K${z.color.replace("#","").toUpperCase()}`;return Q},gk=(Q,z,J)=>Q.reduce((Z,$,X)=>{let Y=wk($.position),G=Nk(`${Z}&${Y}`,$.font),q=["Left","Center","Right"];if(!$.position)$.position=q[X];let{image:H}=$;if($.value==="&[Picture]"&&H){let _=`${Y}${z}${J}`;MY(H,_)}return`${G}${W0(xk($.value))}`},""),hk=(Q)=>{let z=["all","first","even"],J=[];return z.forEach((Z)=>{let $=Q[Z],X=Z==="all"?"odd":Z;if(!$)return;for(let Y of Object.keys($)){let G=$[Y],q=`${Y.charAt(0).toUpperCase()}${Y.slice(1)}`,H=Y[0].toUpperCase();if(G){let _=Z==="all"?"":Z.toUpperCase();J.push({name:`${X}${q}`,properties:{rawMap:{"xml:space":"preserve"}},textNode:gk(G,H,_)})}}}),J},uk=(Q)=>{return(z)=>{if(Q.length)z.children.push({name:"cols",children:Q.map((J)=>fk.getTemplate(J))});return z}},mk=(Q,z)=>{return(J)=>{if(Q.length)J.children.push({name:"sheetData",children:Q.map((Z,$)=>Ik.getTemplate(Z,$,z))});return J}},ck=(Q)=>{let z=Q.length;if(!z)return"";let J=Array(z+1);J[0]=z;for(let $=1;$<=z;$++)J[$]=Q.charCodeAt($-1)&255;let Z=0;for(let $=J.length-1;$>=0;$--){let X=J[$],Y=(Z&16384)===0?0:1,G=Z<<1&32767;Z=(Y|G)^X}return(Z^52811).toString(16).toUpperCase().padStart(4,"0")},pk=(Q)=>{return(z)=>{if(!Q)return z;let J=typeof Q==="boolean"?{}:Q,Z={sheet:1},$=J.password?ck(J.password):"";if($)Z.password=$;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 G=J[Y];if(G==null||G===X[Y])return;Z[Y]=G?0:1}),z.children.push({name:"sheetProtection",properties:{rawMap:Z}}),z}},ik=(Q)=>{return(z)=>{if(Q.length)z.children.push({name:"mergeCells",properties:{rawMap:{count:Q.length}},children:Q.map((J)=>jk.getTemplate(J))});return z}},nk=(Q)=>{return(z)=>{let{top:J=0.75,right:Z=0.7,bottom:$=0.75,left:X=0.7,header:Y=0.3,footer:G=0.3}=Q;return z.children.push({name:"pageMargins",properties:{rawMap:{bottom:$,footer:G,header:Y,left:X,right:Z,top:J}}}),z}},dk=(Q)=>{return(z)=>{if(Q)z.children.push({name:"pageSetup",properties:{rawMap:{horizontalDpi:0,verticalDpi:0,orientation:bk(Q.orientation),paperSize:yk(Q.pageSize)}}});return z}},tk=(Q)=>{return(z)=>{if(!Q)return z;let J=Q.first!=null?1:0,Z=Q.even!=null?1:0;return z.children.push({name:"headerFooter",properties:{rawMap:{differentFirst:J,differentOddEven:Z}},children:hk(Q)}),z}},rk=(Q)=>{return(z)=>{if(Q)z.children.push({name:"tableParts",properties:{rawMap:{count:"1"}},children:[{name:"tablePart",properties:{rawMap:{"r:id":`rId${++z.rIdCounter}`}}}]});return z}},sk=(Q)=>{return(z)=>{if(fz.get(Q)?.length)z.children.push({name:"drawing",properties:{rawMap:{"r:id":`rId${++z.rIdCounter}`}}});return z}},lk=(Q)=>{return(z)=>{if(dQ.get(Q))z.children.push({name:"legacyDrawingHF",properties:{rawMap:{"r:id":`rId${++z.rIdCounter}`}}});return z}},ak=(Q=0,z=0)=>{let J=Q>0||z>0;return J?[{name:"pane",properties:{rawMap:{state:J?"frozen":void 0,topLeftCell:J?`${az(Q+1)}${z+1}`:void 0,xSplit:Q===0?void 0:Q,ySplit:z===0?void 0:z}}}]:void 0},ok=(Q=!1,z,J)=>{return(Z)=>{return Z.children.push({name:"sheetViews",children:[{name:"sheetView",properties:{rawMap:{rightToLeft:Q===!0?"1":"0",workbookViewId:"0"}},children:ak(z,J)}]}),Z}},ek=()=>{return(Q)=>{return Q.children.push({name:"sheetPr",children:[{name:"outlinePr",properties:{rawMap:{summaryBelow:0}}}]}),Q}},QV=(Q)=>{return(z)=>{let J=Q.reduce((Z,$)=>{if($.outlineLevel&&$.outlineLevel>Z)return $.outlineLevel;return Z},0);return z.children.push({name:"sheetFormatPr",properties:{rawMap:{baseColWidth:10,defaultRowHeight:16,outlineLevelRow:J?J:void 0}}}),z}},zV={getTemplate(Q){let{worksheet:z,currentSheet:J,config:Z}=Q,{margins:$={},pageSetup:X,headerFooterConfig:Y,suppressColumnOutline:G,rightToLeft:q,frozenRowCount:H,frozenColumnCount:_,protectSheet:U}=Z,{table:W}=z,{rows:B,columns:E}=W,K=E?.length?Ck(B,E,!!G):[],L=wQ.get(J),{children:F}=[ek(),ok(q,_,H),QV(B),uk(E),mk(B,J+1),pk(U),ik(K),nk($),dk(X),tk(Y),sk(J),lk(J),rk(L)].reduce((D,M)=>M(D),{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:F}}},JV=zV,rz=new Map,d0=[],sz=[],lz=new Map,Vz=new Map,fz=new Map,dQ=new Map,T1=new Map,v1=new Map,wQ=new Map,ZV="AG-GRID-TABLE",J7="SINGLE_SHEET";function $V(){return J7}function XV(Q){J7=Q}function YV(Q,z,J){UV(z),uM(Q,d0.length);let Z=Object.assign({},J);if(J.exportAsExcelTable&&J.pivotModeActive)R(163,{featureName:"pivot mode"}),Z.exportAsExcelTable=!1;HV(z,Z);let $=TV(z,Z);return vV($),$}function GV(Q){return Q.replace(/^[^a-zA-Z_]+/,"_").replace(/\s/g,"_").replace(/[^a-zA-Z0-9_]/g,"_")}function qV(Q,z){if(wQ.has(Q)){R(164);return}wQ.set(Q,z)}function HV(Q,z){let{exportAsExcelTable:J,prependContent:Z,appendContent:$,headerRowCount:X=0}=z;if(!J)return;let Y=typeof J==="boolean"?{}:J,{name:G,showColumnStripes:q,showRowStripes:H,showFilterButton:_,highlightFirstColumn:U,highlightLastColumn:W}=Y,B=GV(G||ZV),E=d0.length-1,{table:K}=Q,{rows:L,columns:F}=K,D=Z?Z.length:0,M=$?$.length:0,k=L.length,f=F.length,A=[],O=[];for(let v=0;vX.id===Q.id))$.push(Q)}function _V(Q,z,J,Z,$){let X=d0.length,{row:Y,column:G}=Q.position||{},q=Q;if(Z){if(z!=null&&J!=null&&(!Y||!G)){if(!Q.position)Q.position={};Q.position=Object.assign({},Q.position,{row:z,column:Z.indexOf(J)+1})}DD(q,Z),MD(q,$)}kY({imageToAdd:q,idx:X});let H=v1.get(X);if(!H)H=new Map,v1.set(X,H);let _=fz.get(X);if(!_)fz.set(X,[q]);else _.push(q);if(!H.get(Q.id))H.set(Q.id,{index:H.size,type:Q.imageType})}function kY(Q){let{imageToAdd:z,idx:J}=Q,Z=Vz.get(z.id);if(Z){let $=Z.find((X)=>X.sheetId===J);if($)$.image.push(z);else Z.push({sheetId:J,image:[z]})}else Vz.set(z.id,[{sheetId:J,image:[z]}]),T1.set(z.id,{type:z.imageType,index:T1.size})}function UV(Q){let z=W0(Q.name)||"",J="";while(d0.indexOf(`${z}${J}`)!==-1)if(J==="")J="_1";else J=`_${parseInt(J.slice(1),10)+1}`;Q.name=`${z}${J}`,d0.push(Q.name)}function WV(Q){if(rz.has(Q))return rz.get(Q);return rz.set(Q,rz.size),rz.size-1}function BV(){rz.clear(),Vz.clear(),fz.clear(),dQ.clear(),T1.clear(),v1.clear(),wQ.clear(),d0=[],sz=[],lz=new Map,J7="SINGLE_SHEET"}function EV(Q){return y0(Mk.getTemplate(d0,Q))}function KV(Q){return y0(mM.getTemplate(Q))}function LV(){return y0(dD.getTemplate(rz))}function FV(Q){return y0(PD.getTemplate(Q))}function DV(Q){return y0(CD.getTemplate(Q))}function MV(Q,z){return y0(SD.getTemplate({sheetLen:Q,hasCustomProperties:z}))}function kV(Q){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(Q)z.push({Id:"rId3",Type:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/custom-properties",Target:"docProps/custom.xml"});let J=IJ.getTemplate(z);return y0(J)}function VV(){return y0(Zk.getTemplate())}function fV(Q,z){return y0(pM.getTemplate(Q,z))}function AV(Q){let z=Array(Q).fill(void 0).map((Z,$)=>({Id:`rId${$+1}`,Type:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet",Target:`worksheets/sheet${$+1}.xml`})),J=IJ.getTemplate([...z,{Id:`rId${Q+1}`,Type:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme",Target:"theme/theme1.xml"},{Id:`rId${Q+2}`,Type:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles",Target:"styles.xml"},{Id:`rId${Q+3}`,Type:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/sharedStrings",Target:"sharedStrings.xml"}]);return y0(J)}function jV(Q){return y0(mD.getTemplate({sheetIndex:Q}))}function RV(Q){let z=v1.get(Q)||[],J=[];for(let[Z,$]of z){let{index:X,type:Y}=$;J.push({Id:`rId${X+1}`,Type:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/image",Target:`../media/image${T1.get(Z).index+1}.${K2(Y)}`})}return y0(IJ.getTemplate(J))}function SV(Q){return y0(Bk.getTemplate({sheetIndex:Q}),!0)}function OV(Q){let z=dQ.get(Q)||[],J=[];for(let Z=0;Z{if(!Q.size)return;let J=new Map;z.forEach((Z,$)=>{if(Q.has(Z))J.set($,Q.get(Z))}),Q.clear(),J.forEach((Z,$)=>Q.set($,Z))},vV=(Q)=>{let z=lz.get(Q)??[];z.push(d0.length-1),lz.set(Q,z),sz.push(Q)},IV=(Q)=>{let z=new Map(lz),J=[];for(let Z of Q){let $=z.get(Z);if(!$?.length)return null;let X=$.shift();J.push(X),z.set(Z,$)}return J},CV=(Q)=>{if(!Q.length||sz.length===0)return null;let z=new Set,J=[];for(let Z of Q){let $=sz.findIndex((X,Y)=>!z.has(Y)&&X===Z);if($===-1)return null;z.add($),J.push($)}return J},bV=(Q)=>{let z=new Map;Q.forEach((J,Z)=>z.set(J,Z)),d0=Q.map((J)=>d0[J]),sz=Q.map((J)=>sz[J]),eZ(fz,Q),eZ(dQ,Q),eZ(wQ,Q),eZ(v1,Q),Vz.forEach((J)=>{J.forEach((Z)=>{let $=z.get(Z.sheetId);if($!=null)Z.sheetId=$})}),lz=new Map,sz.forEach((J,Z)=>{let $=lz.get(J)??[];$.push(Z),lz.set(J,$)})},yV=(Q)=>{if(Q.length<=1)return;let z=IV(Q)??CV(Q);if(!z)return;bV(z)},Z7=class{getStringPosition(Q){return WV(Q)}addBodyImageToMap(Q,z,J,Z,$){_V(Q,z,J,Z,$)}addHeaderFooterImageToMap(Q,z){MY(Q,z)}addWorksheet(Q,z,J){return YV(Q,z,J)}syncOrderWithSheetData(Q){yV(Q)}reset(){BV()}setFactoryMode(Q){XV(Q)}getFactoryMode(){return $V()}getSheetNames(){return[...d0]}},xV=async(Q)=>{let z=0,J=[],Z=new WritableStream({write:(Y)=>{J.push(Y),z+=Y.length}}),$=new ReadableStream({start:(Y)=>{let G=new FileReader;G.onload=(q)=>{if(q.target?.result)Y.enqueue(q.target.result);Y.close()},G.readAsArrayBuffer(Q)}}),X=new window.CompressionStream("deflate-raw");return await $.pipeThrough(X).pipeTo(Z),{size:z,content:new Blob(J)}},wV=async(Q)=>{let z=new Blob([Q]),{size:J,content:Z}=await xV(z),$=new Uint8Array(await Z.arrayBuffer());return{size:J,content:$}},NV=(Q)=>{let z=Q.getHours();return z<<=6,z=z|Q.getMinutes(),z<<=5,z=z|Q.getSeconds()/2,z},gV=(Q)=>{let z=Q.getFullYear()-1980;return z<<=4,z=z|Q.getMonth()+1,z<<=5,z=z|Q.getDate(),z};function b0(Q,z){let J="";for(let Z=0;Z>>=8;return J}var yX=(Q)=>{if(!Q.length)return 0;let z=-1,J=0,Z=0,$=0;for(let X=0;X>>8^$;return z^-1},xX=(Q)=>{if(!Q.length)return 0;if(typeof Q==="string")return yX(new TextEncoder().encode(Q));return yX(Q)},hV=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 uV(Q){let z=String.fromCharCode;function J(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(QQ(255,{point:U}))}function $(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)Z(U),W=z(U>>12&15|224),W+=$(U,6);else if((U&4292870144)==0)W=z(U>>18&7|240),W+=$(U,12),W+=$(U,6);return W+=z(U&63|128),W}let Y=J(Q),G=Y.length,q=-1,H,_="";while(++q{let{content:Y,path:G,created:q}=Q,H=NV(q),_=gV(q),U=xX($),W=X!==void 0?X:Z,B=uV(G),E=B!==G,K="";if(E){let M=b0(1,1)+b0(xX(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(H,2)+b0(_,2)+b0(W?U:0,4)+b0(X??Z,4)+b0(Z,4)+b0(B.length,2)+b0(K.length,2),F="PK\x03\x04"+L+B+K,D="PK\x01\x02\x14\x00"+L+"\x00\x00\x00\x00\x00\x00"+(Y?"\x00\x00\x00\x00":"\x10\x00\x00\x00")+b0(J,4)+B+K;return{localFileHeader:Uint8Array.from(F,(M)=>M.charCodeAt(0)),centralDirectoryHeader:Uint8Array.from(D,(M)=>M.charCodeAt(0))}},fY=(Q)=>{let z;if(typeof Q==="string"){let J=atob(Q.split(";base64,")[1]);z=Uint8Array.from(J,(Z)=>Z.charCodeAt(0))}else z=Q;return{size:z.length,content:z}},mV=async(Q)=>{let{content:z}=Q,{size:J,content:Z}=!z?{size:0,content:Uint8Array.from([])}:fY(z),$,X,Y=!1;if(Q.type==="file"&&Z&&J>0){let q=await wV(Z);$=q.content,X=q.size,Y=!0}return{rawContent:Z,rawSize:J,deflatedContent:$,deflatedSize:X,isCompressed:Y}},cV=(Q,z)=>{let{content:J}=Q,{content:Z}=!J?{content:Uint8Array.from([])}:fY(J);return{...VY(Q,!1,z,Z.length,Z,void 0),content:Z,isCompressed:!1}},pV=(Q,z,J)=>{let Z="PK\x05\x06\x00\x00\x00\x00"+b0(Q,2)+b0(Q,2)+b0(z,4)+b0(J,4)+"\x00\x00";return Uint8Array.from(Z,($)=>$.charCodeAt(0))},AY=class{constructor(){this.folders=[],this.files=[]}addFolders(Q){Q.forEach(this.addFolder.bind(this))}addFolder(Q){this.folders.push({path:Q,created:new Date,isBase64:!1,type:"folder"})}addFile(Q,z,J=!1){this.files.push({path:Q,created:new Date,content:J?z:new TextEncoder().encode(z),isBase64:J,type:"file"})}async getZipFile(Q="application/zip"){let z=await this.buildCompressedFileStream();return this.clearStream(),new Blob([z],{type:Q})}getUncompressedZipFile(Q="application/zip"){let z=this.buildFileStream();return this.clearStream(),new Blob([z],{type:Q})}clearStream(){this.folders=[],this.files=[]}packageFiles(Q){let z=0,J=0;for(let H of Q){let{localFileHeader:_,centralDirectoryHeader:U,content:W}=H;z+=_.length+W.length,J+=U.length}let Z=new Uint8Array(z),$=new Uint8Array(J),X=0,Y=0;for(let H of Q){let{localFileHeader:_,centralDirectoryHeader:U,content:W}=H;Z.set(_,X),X+=_.length,Z.set(W,X),X+=W.length,$.set(U,Y),Y+=U.length}let G=pV(Q.length,J,z),q=new Uint8Array(Z.length+$.length+G.length);return q.set(Z),q.set($,Z.length),q.set(G,Z.length+$.length),q}async buildCompressedFileStream(){let Q=[...this.folders,...this.files],z=await Promise.all(Q.map(mV)),J=[],Z=0;for(let $=0;${if(Q.addFolders(["_rels/","docProps/","xl/","xl/theme/","xl/_rels/","xl/worksheets/"]),!Vz.size)return;Q.addFolders(["xl/worksheets/_rels","xl/drawings/","xl/drawings/_rels","xl/media/"]);let z=0;Vz.forEach((J)=>{let Z=J[0].image[0],{base64:$,imageType:X}=Z;Q.addFile(`xl/media/image${++z}.${K2(X)}`,$,!0)})},nV=(Q,z)=>{let J=0,Z=0;for(let $=0;$0&&fz.has($),G=wQ.size>0&&wQ.get($),q=Vz.size&&dQ.has($);if(!Y&&!G&&!q)continue;let H,_,U;if(Y)dV(Q,$,J),_=J,J++;if(q)tV(Q,$,Z),U=Z,Z++;if(G)H=G.name;let W=`xl/worksheets/_rels/sheet${$+1}.xml.rels`;Q.addFile(W,PV({tableName:H,drawingIndex:_,vmlDrawingIndex:U}))}},dV=(Q,z,J)=>{let $=`xl/drawings/drawing${J+1}.xml`,X=`xl/drawings/_rels/drawing${J+1}.xml.rels`;Q.addFile(X,RV(z)),Q.addFile($,jV(z))},tV=(Q,z,J)=>{let $=`xl/drawings/vmlDrawing${J+1}.vml`,X=`xl/drawings/_rels/vmlDrawing${J+1}.vml.rels`;Q.addFile($,SV(z)),Q.addFile(X,OV(z))},rV=(Q)=>{let z=wQ,J=Array.from(z.keys());for(let Z=0;Z{let Y=!!X&&Object.keys(X).some((G)=>X[G]!=null);if(Q.addFile("xl/workbook.xml",EV($)),Q.addFile("xl/styles.xml",KV(z)),Q.addFile("xl/sharedStrings.xml",LV()),Q.addFile("xl/theme/theme1.xml",VV()),Q.addFile("xl/_rels/workbook.xml.rels",AV(Z)),Q.addFile("docProps/core.xml",FV(J)),Y)Q.addFile("docProps/custom.xml",DV(X));Q.addFile("[Content_Types].xml",MV(Z,Y)),Q.addFile("_rels/.rels",kV(Y))},jY=(Q,z,J={},Z)=>{if(!z||z.length===0)return R(159),Z.reset(),!1;Z.syncOrderWithSheetData(z);let{fontSize:$=11,author:X="AG Grid",activeTab:Y=0,customMetadata:G}=J,q=z.length,H=Math.max(Math.min(Y,q-1),0);return iV(Q),rV(Q),nV(Q,z),sV(Q,$,X,q,H,G),Z.reset(),!0},wX=(Q,z=new Z7)=>{let{data:J,fontSize:Z,author:$,activeSheetIndex:X,customMetadata:Y}=Q,G=Q.mimeType||"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",q=new AY;if(!jY(q,J,{author:$,fontSize:Z,activeTab:X,customMetadata:Y},z))return Promise.resolve(void 0);return q.getZipFile(G)},NX=(Q,z=new Z7)=>{let{data:J,fontSize:Z,author:$,activeSheetIndex:X,customMetadata:Y}=Q,G=Q.mimeType||"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",q=new AY;if(!jY(q,J,{author:$,fontSize:Z,activeTab:X,customMetadata:Y},z))return;return q.getUncompressedZipFile(G)};var lV=class extends O6{constructor(){super(...arguments);this.beanName="excelCreator",this.workbook=new Z7}getMergedParams(Q){let z=this.gos.get("defaultExcelExportParams");return Object.assign({},z,Q)}export(Q){if(this.isExportSuppressed()){R(160);return}let z=()=>{let Z=this.getMergedParams(Q),$=this.getData(Z),{fontSize:X,author:Y,mimeType:G,customMetadata:q}=Z,H={data:[$],fontSize:X,author:Y,mimeType:G,customMetadata:q};this.packageCompressedFile(H).then((_)=>{if(_){let{fileName:U}=Z,W=typeof U==="function"?U(y(this.gos,{})):U;dZ(this.getFileName(W),_)}})},{overlays:J}=this.beans;if(J)J.showExportOverlay(z);else z()}exportDataAsExcel(Q){this.export(Q)}getDataAsExcel(Q){let z=this.getMergedParams(Q),J=this.getData(z),{fontSize:Z,author:$,mimeType:X,customMetadata:Y}=z,G={data:[J],fontSize:Z,author:$,mimeType:X,customMetadata:Y};return this.packageFile(G)}setFactoryMode(Q){this.workbook.setFactoryMode(Q)}getFactoryMode(){return this.workbook.getFactoryMode()}getSheetDataForExcel(Q){let z=this.getMergedParams(Q);return this.getData(z)}getMultipleSheetsAsExcel(Q){return NX(Q,this.workbook)}exportMultipleSheetsAsExcel(Q){wX(Q,this.workbook).then((z)=>{let{fileName:J="export.xlsx"}=Q;if(z){let Z=typeof J==="function"?J():J;dZ(Z,z)}})}getDefaultFileExtension(){return"xlsx"}createSerializingSession(Q){let{colModel:z,colNames:J,rowGroupColsSvc:Z,valueSvc:$,formula:X,gos:Y}=this.beans,G=Y.get("excelStyles")||[],q=this.createStyleLinker(G),H={...Q,colModel:z,colNames:J,rowGroupColsSvc:Z,valueSvc:$,formulaSvc:X,gos:Y,suppressRowOutline:Q.suppressRowOutline||Q.skipRowGroups,headerRowHeight:Q.headerRowHeight||Q.rowHeight,baseExcelStyles:G,rightToLeft:Q.rightToLeft??Y.get("enableRtl"),styleLinker:q,headerRowCount:i9(z),pivotModeActive:z.isPivotActive(),workbook:this.workbook};return new fD(H)}createStyleLinker(Q){let z=[],J=new Set,Z=new Map;Q.forEach((Y,G)=>{z.push(Y.id),J.add(Y.id),Z.set(Y.id,G)});let{gos:$,cellStyles:X}=this.beans;return(Y)=>{let{rowType:G,rowIndex:q,value:H,column:_,columnGroup:U,node:W}=Y,B=G==="HEADER",E=G==="HEADER_GROUPING",K=B?_:U,L=[];if(B||E){if(L.push("header"),E)L.push("headerGroup");if(K)L=L.concat(gZ(K.getDefinition(),$,_||null,U||null));return L}let F=["cell"];if(!z.length)return F;let D=_.getDefinition();return X?.processAllCellClasses(D,y($,{value:H,data:W.data,node:W,colDef:D,column:_,rowIndex:q}),(M)=>{if(J.has(M))F.push(M)}),F.sort((M,k)=>{let f=Z.get(M)??-1,A=Z.get(k)??-1;return f===A?0:fthis.onFocusIn(Q),onFocusOut:(Q)=>this.onFocusOut(Q),focusInnerElement:(Q)=>this.focusInnerElement(Q),onTabKeyDown:(Q)=>this.onTabKeyDown(Q),handleKeyDown:(Q)=>this.handleKeyDown(Q)},this.stopPropagationCallbacks),this.refreshAriaProperties(),this.addManagedEventListeners({stylesChanged:this.onStylesChanged.bind(this)})}onStylesChanged(Q){if(Q.listItemHeightChanged)this.rowHeight=this.getItemHeight(),this.refresh()}refreshAriaProperties(){let z=this.getLocaleTextFunc()("ariaDefaultListName",this.listName||"List"),J=this.eContainer;H0(J,this.model?.getRowCount()>0?this.ariaRole:"presentation"),E0(J,z)}addResizeObserver(){let Q=()=>YQ(this.beans,()=>this.drawVirtualRows()),z=DQ(this.beans,this.getGui(),Q);this.addDestroyFunc(z)}focusInnerElement(Q){return this.focusRow(Q?this.model.getRowCount()-1:0),!0}onFocusIn(Q){let z=Q.target;if(z.classList.contains("ag-virtual-list-item"))this.lastFocusedRowIndex=j8(z)-1}onFocusOut(Q){if(!this.getFocusableElement().contains(Q.relatedTarget))this.lastFocusedRowIndex=null}handleKeyDown(Q){let{key:z,shiftKey:J}=Q;switch(z){case V.UP:case V.DOWN:{let Z=z===V.UP;if(Q.preventDefault(),J)this.moveItem(Z);else this.navigate(Z)}break;case V.PAGE_HOME:case V.PAGE_END:case V.PAGE_UP:case V.PAGE_DOWN:if(this.navigateToPage(z)!==null)Q.preventDefault();break}}onTabKeyDown(Q){this.stopPropagationCallbacks?.stopPropagation(Q),this.forceFocusOutOfContainer(Q.shiftKey)}getNextRow(Q){if(this.lastFocusedRowIndex==null)return;let z=this.lastFocusedRowIndex+(Q?-1:1);if(z<0||z>=this.model.getRowCount())return;return z}moveItem(Q){if(!this.moveItemCallback)return;let z=this.getComponentAt(this.lastFocusedRowIndex);if(!z)return;this.moveItemCallback(z,Q)}navigate(Q){let z=this.getNextRow(Q);if(z===void 0)return;this.focusRow(z)}navigateToPage(Q,z="focused"){let J=!1;if(z==="focused")z=this.getLastFocusedRow(),J=!0;let Z=this.model.getRowCount()-1,$=-1;if(Q===V.PAGE_HOME)$=0;else if(Q===V.PAGE_END)$=Z;else if(Q===V.PAGE_DOWN)$=Math.min(z+this.pageSize,Z);else if(Q===V.PAGE_UP)$=Math.max(z-this.pageSize,0);if($===-1)return null;if(J)this.focusRow($);else this.ensureIndexVisible($);return $}getLastFocusedRow(){return this.lastFocusedRowIndex}focusRow(Q){if(this.isScrolling)return;this.isScrolling=!0,this.ensureIndexVisible(Q),YQ(this.beans,()=>{if(this.isScrolling=!1,!this.isAlive())return;let z=this.renderedRows.get(Q);if(z)z.eDiv.focus()})}getComponentAt(Q){let z=this.renderedRows.get(Q);return z&&z.rowComponent}forEachRenderedRow(Q){this.renderedRows.forEach((z,J)=>Q(z.rowComponent,J))}getItemHeight(){if(!this.isHeightFromTheme)return this.rowHeight;return this.beans.environment.getDefaultListItemHeight()}ensureIndexVisible(Q,z=!0){let J=this.model.getRowCount();if(typeof Q!=="number"||Q<0||Q>=J)return!1;let Z=Q*this.rowHeight,$=Z+this.rowHeight,X=this.getGui(),Y=X.scrollTop,G=X.offsetHeight,q=Y+G,H=z?0:this.rowHeight,_=Y>Z+H,U=q<$-H;if(_)return X.scrollTop=Z,!0;if(U){let W=$-G;return X.scrollTop=W,!0}return!1}setComponentCreator(Q){this.componentCreator=Q}setComponentUpdater(Q){this.componentUpdater=Q}getRowHeight(){return this.rowHeight}getScrollTop(){return this.getGui().scrollTop}setRowHeight(Q){this.isHeightFromTheme=!1,this.rowHeight=Q,this.refresh()}refresh(Q){if(this.model==null||!this.isAlive())return;let z=this.model.getRowCount();this.eContainer.style.height=`${z*this.rowHeight}px`,this.refreshAriaProperties(),this.awaitStable(()=>{if(!this.isAlive())return;if(this.canSoftRefresh(Q))this.drawVirtualRows(!0);else this.clearVirtualRows(),this.drawVirtualRows()})}awaitStable(Q){if(this.awaitStableCallbacks.push(Q),this.awaitStableCallbacks.length>1)return;let z=this.model.getRowCount();C5(this,()=>this.eContainer.clientHeight>=z*this.rowHeight,()=>{if(!this.isAlive())return;let J=this.awaitStableCallbacks;this.awaitStableCallbacks=[];for(let Z of J)Z()})}canSoftRefresh(Q){return!!(Q&&this.renderedRows.size&&typeof this.model.areRowsEqual==="function"&&this.componentUpdater)}clearVirtualRows(){this.renderedRows.forEach((Q,z)=>this.removeRow(z))}drawVirtualRows(Q){if(!this.isAlive()||!this.model)return;let z=this.getGui(),J=z.scrollTop,Z=J+z.offsetHeight;if(J===Z)this.clearVirtualRows();else{let $=Math.floor(J/this.rowHeight),X=Math.floor(Z/this.rowHeight);this.pageSize=Math.floor((Z-J)/this.rowHeight),this.ensureRowsRendered($,X,Q)}}ensureRowsRendered(Q,z,J){if(this.renderedRows.forEach((Z,$)=>{if(($z)&&$!==this.lastFocusedRowIndex)this.removeRow($)}),J)this.refreshRows();for(let Z=Q;Z<=z;Z++){if(this.renderedRows.has(Z))continue;if(Z=z.getRowCount())return;let{cssIdentifier:J,ariaRole:Z,renderedRows:$,eContainer:X}=this,Y=z.getRow(Q),G=Z==="tree"?"treeitem":"option",q=K0({tag:"div",cls:`ag-virtual-list-item ag-${J}-virtual-list-item`,role:G,attrs:{tabindex:"-1"}});VZ(q,z.getRowCount()),fZ(q,Q+1);let H=this.rowHeight;q.style.height=`${H}px`,q.style.top=`${H*Q}px`;let _=this.componentCreator(Y,q);if(_.addGuiEventListener("focusin",()=>this.lastFocusedRowIndex=Q),q.appendChild(_.getGui()),$.has(Q-1))$.get(Q-1).eDiv.insertAdjacentElement("afterend",q);else if($.has(Q+1))$.get(Q+1).eDiv.insertAdjacentElement("beforebegin",q);else X.appendChild(q);$.set(Q,{rowComponent:_,eDiv:q,value:Y})}removeRow(Q){let z=this.renderedRows.get(Q);z.eDiv.remove(),this.destroyBean(z.rowComponent),this.renderedRows.delete(Q)}refreshRows(){let Q=this.model.getRowCount();this.renderedRows.forEach((z,J)=>{if(J>=Q)this.removeRow(J);else{let Z=this.model.getRow(J);if(this.model.areRowsEqual?.(z.value,Z))this.componentUpdater(Z,z.rowComponent);else this.removeRow(J)}})}addScrollListener(){this.addGuiEventListener("scroll",()=>this.drawVirtualRows(),{passive:!0})}setModel(Q){this.model=Q}getAriaElement(){return this.eContainer}destroy(){if(!this.isAlive())return;this.clearVirtualRows(),this.awaitStableCallbacks.length=0,super.destroy()}},Qf='.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}',m6="ag-list-item-hovered",zf=class extends j0{constructor(Q,z,J){super();this.comp=Q,this.virtualList=z,this.params=J,this.currentDragValue=null,this.lastHoveredListItem=null}postConstruct(){this.beans.environment.addGlobalCSS(Qf,"component-AgVirtualListDragFeature"),this.params.addListeners(this,this.listItemDragStart.bind(this),this.listItemDragEnd.bind(this)),this.createDropTarget(),this.createAutoScrollService()}listItemDragStart(Q){this.currentDragValue=this.params.getCurrentDragValue(Q),this.moveBlocked=this.params.isMoveBlocked(this.currentDragValue)}listItemDragEnd(){window.setTimeout(()=>{this.currentDragValue=null,this.moveBlocked=!1},10)}createDropTarget(){let Q={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(Q)}createAutoScrollService(){let Q=this.virtualList.getGui();this.autoScrollService=new mZ({scrollContainer:Q,scrollAxis:"y",getVerticalPosition:()=>Q.scrollTop,setVerticalPosition:(z)=>Q.scrollTop=z})}onDragging(Q){if(!this.currentDragValue||this.moveBlocked)return;let z=this.getListDragItem(Q),J=this.virtualList.getComponentAt(z.rowIndex);if(!J)return;let Z=J.getGui().parentElement;if(this.lastHoveredListItem&&this.lastHoveredListItem.rowIndex===z.rowIndex&&this.lastHoveredListItem.position===z.position)return;this.autoScrollService.check(Q.event),this.clearHoveredItems(),this.lastHoveredListItem=z,P5(Z,m6),P5(Z,`ag-item-highlight-${z.position}`)}getListDragItem(Q){let z=this.virtualList.getGui(),J=Number.parseFloat(window.getComputedStyle(z).paddingTop),Z=this.virtualList.getRowHeight(),$=this.virtualList.getScrollTop(),X=Math.max(0,(Q.y-J+$)/Z),Y=this.params.getNumRows(this.comp)-1,G=Math.min(Y,X)|0;return{rowIndex:G,position:Math.round(X)>X||X>Y?"bottom":"top",component:this.virtualList.getComponentAt(G)}}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 Q=this.virtualList.getGui();for(let z of Q.querySelectorAll(`.${m6}`))for(let J of[m6,"ag-item-highlight-top","ag-item-highlight-bottom"])z.classList.remove(J);this.lastHoveredListItem=null}};var Jf=".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 Zf(Q){return Q??(Q=Q||"default"),{tag:"div",cls:`ag-panel ag-${Q}-panel`,attrs:{tabindex:"-1"},children:[{tag:"div",ref:"eTitleBar",cls:`ag-panel-title-bar ag-${Q}-panel-title-bar ag-unselectable`,children:[{tag:"span",ref:"eTitle",cls:`ag-panel-title-bar-title ag-${Q}-panel-title-bar-title`},{tag:"div",ref:"eTitleBarButtons",cls:`ag-panel-title-bar-buttons ag-${Q}-panel-title-bar-buttons`}]},{tag:"div",ref:"eContentWrapper",cls:`ag-panel-content-wrapper ag-${Q}-panel-content-wrapper`}]}}var $f=class extends p0{constructor(Q){super(Zf(Q.cssIdentifier));this.config=Q,this.closable=!0,this.eContentWrapper=S,this.eTitleBar=S,this.eTitleBarButtons=S,this.eTitle=S,this.registerCSS(Jf)}postConstruct(){let{component:Q,closable:z,hideTitleBar:J,title:Z,minWidth:$=250,width:X,minHeight:Y=250,height:G,centered:q,popup:H,x:_,y:U,postProcessPopupParams:W}=this.config,B=this.beans,E=this.createManagedBean(new r5(this.getGui(),{minWidth:$,width:X,minHeight:Y,height:G,centered:q,x:_,y:U,popup:H,calculateTopBuffer:()=>this.positionableFeature.getHeight()-this.getBodyHeight()}));this.positionableFeature=E;let K=this.getGui();if(Q)this.setBodyComponent(Q);if(!J){if(Z)this.setTitle(Z);this.setClosable(z!=null?z:this.closable)}else N(this.eTitleBar,!1);if(this.addManagedElementListeners(this.eTitleBar,{mousedown:(F)=>{if(K.contains(F.relatedTarget)||K.contains(d(B))||this.eTitleBarButtons.contains(F.target)){F.preventDefault();return}let D=this.eContentWrapper.querySelector("button, [href], input, select, textarea, [tabindex]");if(D)D.focus()}}),H&&E.isPositioned())return;if(this.renderComponent)this.renderComponent();let L;if(W){let{type:F,eventSource:D,mouseEvent:M}=W;L=()=>B.popupSvc?.callPostProcessPopup(W,F,K,D,M)}E.initialisePosition(L),this.eContentWrapper.style.height="0"}renderComponent(){let Q=this.getGui();Q.focus(),this.close=()=>{Q.remove(),this.destroy()}}getHeight(){return this.positionableFeature.getHeight()}setHeight(Q){this.positionableFeature.setHeight(Q)}getWidth(){return this.positionableFeature.getWidth()}setWidth(Q){this.positionableFeature.setWidth(Q)}setClosable(Q){if(Q!==this.closable)this.closable=Q;if(Q){let z=this.closeButtonComp=new p0({tag:"div",cls:"ag-button"});this.createBean(z);let J=z.getGui(),Z=this.beans.iconSvc.createIconNoSpan("close",this.beans);Z.classList.add("ag-panel-title-bar-button-icon"),J.appendChild(Z),this.addTitleBarButton(z),z.addManagedElementListeners(J,{click:this.onBtClose.bind(this)})}else if(this.closeButtonComp)this.closeButtonComp.getGui().remove(),this.closeButtonComp=this.destroyBean(this.closeButtonComp)}setBodyComponent(Q){Q.setParentComponent(this),this.eContentWrapper.appendChild(Q.getGui())}addTitleBarButton(Q,z){let J=this.eTitleBarButtons,Z=J.children,$=Z.length;if(z==null)z=$;z=Math.max(0,Math.min(z,$)),Q.addCss("ag-panel-title-bar-button");let X=Q.getGui();if(z===0)J.prepend(X);else if(z===$)J.append(X);else Z[z-1].after(X);Q.setParentComponent(this)}getBodyHeight(){return AZ(this.eContentWrapper)}getBodyWidth(){return xz(this.eContentWrapper)}setTitle(Q){this.eTitle.innerText=Q}onBtClose(){this.close()}destroy(){if(this.closeButtonComp)this.closeButtonComp=this.destroyBean(this.closeButtonComp);let Q=this.getGui();if(Q&&f0(Q))this.close();super.destroy()}},Xf=class extends $f{constructor(Q,z){super({...Q,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(Q){this.popupSvc=Q.popupSvc}postConstruct(){let Q=this.getGui(),{movable:z,resizable:J,maximizable:Z,modal:$}=this.config;if(this.addCss("ag-dialog"),super.postConstruct(),this.tabGuardFeature=this.createManagedBean(new H6(this,this.callbacks?.stopPropagationCallbacks)),this.tabGuardFeature.initialiseTabGuard({isFocusableContainer:!0,onFocusIn:()=>{this.popupSvc?.bringPopupToFront(Q)},onTabKeyDown:(X)=>{if($)return;let Y=X.shiftKey,G=R0(this.beans,Q,!1,Y);if(!G||this.tabGuardFeature.getTabGuardCtrl().isTabGuard(G)){if(this.callbacks?.focusNextContainer(this.beans,Y))X.preventDefault()}}}),z)this.setMovable(z);if(Z)this.setMaximizable(Z);if(J)this.setResizable(J);if(!this.config.modal)this.callbacks?.configureFocusableContainer(this.beans,this)}setAllowFocus(Q){this.tabGuardFeature.getTabGuardCtrl().setAllowFocus(Q)}renderComponent(){let Q=this.getGui(),{alwaysOnTop:z,modal:J,title:Z,afterGuiAttached:$}=this.config,X=this.getLocaleTextFunc(),Y=this.popupSvc?.addPopup({modal:J,eChild:Q,closeOnEsc:!0,closedCallback:this.onClosed.bind(this),alwaysOnTop:z,ariaLabel:Z||X("ariaLabelDialog","Dialog"),afterGuiAttached:$});if(Y)this.close=Y.hideFunc}onClosed(Q){this.destroy(),this.config.closedCallback?.(Q)}setMaximized(Q){if(this.isMaximizable&&Q!==this.isMaximized)this.toggleMaximize()}toggleMaximize(){let Q=this.positionableFeature.getPosition();if(this.isMaximized){let{x:z,y:J,width:Z,height:$}=this.lastPosition;this.setWidth(Z),this.setHeight($),this.positionableFeature.offsetElement(z,J)}else this.lastPosition.width=this.getWidth(),this.lastPosition.height=this.getHeight(),this.lastPosition.x=Q.x,this.lastPosition.y=Q.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 Q of this.maximizeListeners)Q();this.maximizeListeners.length=0}if(this.resizeListenerDestroy)this.resizeListenerDestroy(),this.resizeListenerDestroy=null}destroy(){this.maximizeButtonComp=this.destroyBean(this.maximizeButtonComp),this.clearMaximizebleListeners(),super.destroy()}setResizable(Q){this.positionableFeature.setResizable(Q)}setMovable(Q){this.positionableFeature.setMovable(Q,this.eTitleBar)}setMaximizable(Q){if(!Q){if(this.clearMaximizebleListeners(),this.maximizeButtonComp)this.destroyBean(this.maximizeButtonComp),this.maximizeButtonComp=this.maximizeIcon=this.minimizeIcon=void 0;return}let z=this.eTitleBar;if(!z||Q===this.isMaximizable)return;this.isMaximizable=Q;let J=this.buildMaximizeAndMinimizeElements();this.refreshMaximizeIcon(),J.addManagedElementListeners(J.getGui(),{click:this.toggleMaximize.bind(this)}),this.addTitleBarButton(J,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 Q=this.maximizeButtonComp=this.createBean(new p0({tag:"div",cls:"ag-dialog-button"})),z=Q.getGui(),J=this.beans.iconSvc;return this.maximizeIcon=J.createIconNoSpan("maximize"),z.appendChild(this.maximizeIcon),this.maximizeIcon.classList.add("ag-panel-title-bar-button-icon"),this.minimizeIcon=J.createIconNoSpan("minimize"),z.appendChild(this.minimizeIcon),this.minimizeIcon.classList.add("ag-panel-title-bar-button-icon"),Q}};var Yf=class extends pQ{constructor(Q){super();this.setTemplateFromElement(Q.getGui(),void 0,void 0,!0)}postConstruct(){this.initialiseTabGuard({onTabKeyDown:(Q)=>this.onTabKeyDown(Q),handleKeyDown:(Q)=>this.handleKeyDown(Q)})}handleKeyDown(Q){if(Q.key===V.ESCAPE)this.closePanel()}onTabKeyDown(Q){if(Q.defaultPrevented)return;this.closePanel(),Q.preventDefault()}closePanel(){let Q=this.parentComponent;Q.closeSubMenu(),setTimeout(()=>Q.getGui().focus(),0)}},o6=class extends j0{constructor(Q){super();this.callbacks=Q,this.ACTIVATION_DELAY=80,this.isActive=!1,this.subMenuIsOpen=!1,this.subMenuIsOpening=!1,this.suppressRootStyles=!0,this.suppressAria=!0,this.suppressFocus=!0}init(Q){let{menuItemDef:z,isAnotherSubMenuOpen:J,level:Z,childComponent:$,contextParams:X}=Q;return this.params=Q.menuItemDef,this.level=Z,this.isAnotherSubMenuOpen=J,this.childComponent=$,this.contextParams=X,this.cssClassPrefix=this.params.menuItemParams?.cssClassPrefix??"ag-menu-option",this.callbacks.getMenuItemComp(this.beans,this.params,{...z,level:Z,isAnotherSubMenuOpen:J,openSubMenu:(Y)=>this.openSubMenu(Y),closeSubMenu:()=>this.closeSubMenu(),closeMenu:(Y)=>this.closeMenu(Y),updateTooltip:(Y,G)=>this.refreshTooltip(Y,G),onItemActivated:()=>this.onItemActivated()}).then((Y)=>{if(!Y)return;this.menuItemComp=Y;let G=Y.configureDefaults?.();if(G)this.configureDefaults(G===!0?void 0:G)})}addListeners(Q,z){if(!z?.suppressClick)this.addManagedElementListeners(Q,{click:(J)=>this.onItemSelected(J)});if(!z?.suppressKeyboardSelect)this.addManagedElementListeners(Q,{keydown:(J)=>{if(J.key===V.ENTER||J.key===V.SPACE)J.preventDefault(),this.onItemSelected(J)}});if(!z?.suppressMouseDown)this.addManagedElementListeners(Q,{mousedown:(J)=>{J.stopPropagation(),J.preventDefault()}});if(!z?.suppressMouseOver)this.addManagedElementListeners(Q,{mouseenter:()=>this.onMouseEnter(),mouseleave:()=>this.onMouseLeave()})}isDisabled(){return!!this.params.disabled}openSubMenu(Q=!1,z){if(this.closeSubMenu(),!this.params.subMenu)return;this.subMenuIsOpening=!0;let J=Z0({tag:"div",cls:"ag-menu",role:"presentation"});this.eSubMenuGui=J;let Z,$=()=>{this.subMenuIsOpening=!1};if(this.childComponent){let H=this.createBean(new Yf(this.childComponent));H.setParentComponent(this);let _=H.getGui(),U="mouseenter",W=()=>this.cancelDeactivate();if(_.addEventListener(U,W),Z=()=>{_.removeEventListener(U,W),this.destroyBean(H)},J.appendChild(_),this.childComponent.afterGuiAttached)$=()=>{this.childComponent.afterGuiAttached(),this.subMenuIsOpening=!1}}else if(this.params.subMenu){let H=this.createBean(new RY(this.level+1,this.contextParams,this.callbacks));if(H.setParentComponent(this),H.addMenuItems(this.params.subMenu),J.appendChild(H.getGui()),this.addManagedListeners(H,{closeMenu:(_)=>this.dispatchLocalEvent(_)}),H.addGuiEventListener("mouseenter",()=>this.cancelDeactivate()),Z=()=>this.destroyBean(H),Q)$=()=>{H.activateFirstItem(),this.subMenuIsOpening=!1}}let X=this.beans.popupSvc,Y=()=>{let H=this.eGui;X?.positionPopupForMenu({eventSource:H,ePopup:J,event:z instanceof MouseEvent?z:void 0,additionalParams:this.callbacks.getPostProcessPopupParams(this.contextParams)})},G=this.getLocaleTextFunc(),q=X?.addPopup({modal:!0,eChild:J,positionCallback:Y,anchorToElement:this.eGui,ariaLabel:G("ariaLabelSubMenu","SubMenu"),afterGuiAttached:$});this.subMenuIsOpen=!0,this.setAriaExpanded(!0),this.hideSubMenu=()=>{if(q)q.hideFunc();this.subMenuIsOpen=!1,this.setAriaExpanded(!1),Z(),this.menuItemComp.setExpanded?.(!1),this.eSubMenuGui=void 0},this.menuItemComp.setExpanded?.(!0)}setAriaExpanded(Q){if(!this.suppressAria)w0(this.eGui,Q)}closeSubMenu(){if(!this.hideSubMenu)return;this.hideSubMenu(),this.hideSubMenu=null,this.setAriaExpanded(!1)}isSubMenuOpen(){return this.subMenuIsOpen}isSubMenuOpening(){return this.subMenuIsOpening}activate(Q,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(Q&&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(Q){this.parentComponent=Q}getSubMenuGui(){return this.eSubMenuGui}onItemSelected(Q){if(this.menuItemComp.select?.(),this.params.action)this.beans.frameworkOverrides.wrapOutgoing(()=>this.params.action(this.gos.addCommon({...this.contextParams})));else this.openSubMenu(Q&&Q.type==="keydown",Q);if(this.params.subMenu&&!this.params.action||this.params.suppressCloseOnSelect)return;this.closeMenu(Q)}closeMenu(Q){let z={type:"closeMenu"};if(Q)if(Q instanceof MouseEvent)z.mouseEvent=Q;else z.keyboardEvent=Q;this.dispatchLocalEvent(z)}onItemActivated(){let Q={type:"menuItemActivated",menuItem:this};this.dispatchLocalEvent(Q)}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(Q){let z=this.menuItemComp.getGui(),{cssClassPrefix:J,params:{cssClasses:Z,disabled:$}}=this,X=this.menuItemComp.getRootElement?.();if(X){if(!Q)z.classList.add("ag-menu-option-custom");z=X}if(this.suppressRootStyles=!!Q,!this.suppressRootStyles){z.classList.add(J);for(let Y of Z??[])z.classList.add(Y);if($)z.classList.add(`${J}-disabled`)}return z}applyAriaProperties(Q){let{params:{checked:z,subMenu:J,subMenuRole:Z,disabled:$}}=this,X=z!=null;if(H0(Q,X?"menuitemcheckbox":"menuitem"),J)b8(Q,Z??"menu");if($)P8(Q,!0)}configureDefaults(Q){if(!this.menuItemComp){setTimeout(()=>this.configureDefaults(Q));return}let{suppressRootStyles:z,suppressTooltip:J,suppressAria:Z,suppressTabIndex:$,suppressFocus:X}=Q||{},{params:{tooltip:Y,disabled:G}}=this,q=this.eGui=this.refreshRootElementGui(!!z);if(this.suppressAria=!!Z,!Z)this.applyAriaProperties(q);if(!$)q.setAttribute("tabindex","-1");if(!J)this.refreshTooltip(Y);if(!G)this.addListeners(q,Q);this.suppressFocus=!!X}refreshTooltip(Q,z){if(this.tooltip=Q,this.tooltipFeature=this.destroyBean(this.tooltipFeature),!Q||!this.menuItemComp)return;let J=this.beans.registry.createDynamicBean("tooltipFeature",!1,{getGui:()=>this.getGui(),getTooltipValue:()=>this.tooltip,getLocation:()=>"menu",shouldDisplayTooltip:z});if(J)this.tooltipFeature=this.createBean(J)}destroy(){this.tooltipFeature=this.destroyBean(this.tooltipFeature),this.menuItemComp?.destroy?.(),super.destroy()}},RY=class extends pQ{constructor(Q=0,z,J){super({tag:"div",cls:"ag-menu-list",role:"menu"});this.level=Q,this.menuActionParams=z,this.callbacks=J,this.menuItems=[]}postConstruct(){this.initialiseTabGuard({onTabKeyDown:(Q)=>this.onTabKeyDown(Q),handleKeyDown:(Q)=>this.callbacks.preserveRangesWhile(this.beans,()=>this.handleKeyDown(Q)),onFocusIn:(Q)=>this.handleFocusIn(Q),onFocusOut:(Q)=>this.handleFocusOut(Q)})}onTabKeyDown(Q){if(!this.getParentComponent()?.getGui()?.classList.contains("ag-focus-managed"))Q.preventDefault();if(Q.shiftKey)this.closeIfIsChild(Q)}handleKeyDown(Q){switch(Q.key){case V.UP:case V.RIGHT:case V.DOWN:case V.LEFT:Q.preventDefault(),this.handleNavKey(Q.key);break;case V.ESCAPE:if(this.closeIfIsChild())this.callbacks.stopPropagationCallbacks.stopPropagation(Q);break}}handleFocusIn(Q){let z=Q.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(Q){let z=Q.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(Q){if(Q==null)return;g.all(Q.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 J of z??[])if(J?.eGui){if(this.appendChild(J.eGui),J.comp)this.menuItems.push(J.comp)}})}addItem(Q){let z=this.createManagedBean(new o6(this.callbacks));return z.init({menuItemDef:Q,isAnotherSubMenuOpen:()=>this.menuItems.some((J)=>J.isSubMenuOpen()),level:this.level,contextParams:this.menuActionParams}).then(()=>{return z.setParentComponent(this),this.addManagedListeners(z,{closeMenu:(J)=>{this.dispatchLocalEvent(J)},menuItemActivated:(J)=>{if(this.activeMenuItem&&this.activeMenuItem!==J.menuItem)this.activeMenuItem.deactivate();this.activeMenuItem=J.menuItem}}),{comp:z,eGui:z.getGui()}})}activateFirstItem(){let Q=this.menuItems.filter((z)=>!z.isDisabled())[0];if(!Q)return;Q.activate()}createSeparator(){let Q={tag:"div",cls:"ag-menu-separator-part"};return K0({tag:"div",cls:"ag-menu-separator",attrs:{"aria-hidden":"true"},children:[Q,Q,Q,Q]})}handleNavKey(Q){switch(Q){case V.UP:case V.DOWN:{let J=this.findNextItem(Q===V.UP);if(J&&J!==this.activeMenuItem)J.activate(!1,!0);return}}let z=this.gos.get("enableRtl")?V.RIGHT:V.LEFT;if(Q===z)this.closeIfIsChild();else this.openChild()}closeIfIsChild(Q){let z=this.getParentComponent();if(z&&z instanceof o6){if(Q)Q.preventDefault();return z.closeSubMenu(),z.getGui().focus(),!0}return!1}openChild(){if(this.activeMenuItem)this.activeMenuItem.openSubMenu(!0)}findNextItem(Q){let z=[...this.menuItems];if(!z.length)return;if(!this.activeMenuItem)return Q?b(z):z[0];if(Q)z.reverse();let J,Z=!1;for(let $ of z){if(!Z){if($===this.activeMenuItem)Z=!0;continue}J=$;break}if(Z&&!J)return z[0];return J||this.activeMenuItem}destroy(){this.clearActiveItem(),super.destroy()}};var Gf=class extends p0{constructor(Q){super({tag:"div"});this.callbacks=Q}init(Q){this.params=Q,this.cssClassPrefix=this.params.cssClassPrefix??"ag-menu-option",this.addAriaAttributes(),this.addIcon(),this.addName(),this.addShortcut(),this.addSubMenu()}configureDefaults(){return!0}addAriaAttributes(){let{checked:Q,subMenu:z}=this.params,J=this.getGui();if(Q)I8(J,Q);if(z)w0(J,!1)}addIcon(){if(this.params.isCompact)return;let Q=K0({tag:"span",ref:"eIcon",cls:`${this.getClassName("part")} ${this.getClassName("icon")}`,role:"presentation"}),{checked:z,icon:J}=this.params;if(z)Q.appendChild(this.beans.iconSvc.createIconNoSpan("check"));else if(J)if(XJ(J))Q.appendChild(J);else if(typeof J==="string")Q.innerHTML=J;else this.callbacks?.warnNoIcon?.();this.getGui().appendChild(Q)}addName(){let Q=K0({tag:"span",ref:"eName",cls:`${this.getClassName("part")} ${this.getClassName("text")}`,children:this.params.name||""});this.getGui().appendChild(Q)}addShortcut(){if(this.params.isCompact)return;let Q=K0({tag:"span",ref:"eShortcut",cls:`${this.getClassName("part")} ${this.getClassName("shortcut")}`,children:this.params.shortcut||""});this.getGui().appendChild(Q)}addSubMenu(){let Q=K0({tag:"span",ref:"ePopupPointer",cls:`${this.getClassName("part")} ${this.getClassName("popup-pointer")}`}),z=this.getGui();if(this.params.subMenu){let J=this.gos.get("enableRtl")?"subMenuOpenRtl":"subMenuOpen";Q.appendChild(this.beans.iconSvc.createIconNoSpan(J))}z.appendChild(Q)}getClassName(Q){return`${this.cssClassPrefix}-${Q}`}};function e6(Q,z){if(!z)return null;let J=EQ(Q),Z=J.indexOf(z);if(Z===-1)return null;let $=-1;for(let X=Z-1;X>=0;X--)if(J[X].classList.contains(g1.TAB_GUARD_TOP)){$=X;break}if($<=0)return null;return J[$-1]}function SY(Q,z){if(!z)return!1;let J=Q.querySelectorAll(`.${l5}`);if(!J.length)return!1;for(let Z=0;Zthis.activeItem?.tabbedItem?.afterDetachedCallback?.())}setupHeader(){let{enableCloseButton:Q,cssClass:z}=this.params,J=(Z,$)=>{if(Z.classList.add(`ag-tabs-${$}`),z)Z.classList.add(`${z}-${$}`)};if(Q)this.setupCloseButton(J),this.eTabHeader=K0({tag:"div",role:"presentation"}),J(this.eHeader,"header-wrapper"),this.eHeader.appendChild(this.eTabHeader);else this.eTabHeader=this.eHeader;H0(this.eTabHeader,"tablist"),J(this.eTabHeader,"header")}setupCloseButton(Q){let z=K0({tag:"button"});Q(z,"close-button");let J=this.beans.iconSvc.createIconNoSpan("close");E0(z,this.params.closeButtonAriaLabel),z.appendChild(J),this.addManagedElementListeners(z,{click:()=>this.params.onCloseClicked?.()});let Z=K0({tag:"div",role:"presentation"});Q(Z,"close-button-wrapper"),Z.appendChild(z),this.eHeader.appendChild(Z),this.eCloseButton=z}handleKeyDown(Q){switch(Q.key){case V.RIGHT:case V.LEFT:{if(!this.eTabHeader.contains(d(this.beans)))return;let z=Q.key===V.RIGHT,J=this.gos.get("enableRtl"),Z=this.items.indexOf(this.activeItem),$=z!==J?Math.min(Z+1,this.items.length-1):Math.max(Z-1,0);if(Z===$)return;Q.preventDefault();let X=this.items[$];this.showItemWrapper(X),X.eHeaderButton.focus();break}case V.UP:case V.DOWN:Q.stopPropagation();break}}onTabKeyDown(Q){if(Q.defaultPrevented)return;let{beans:z,eHeader:J,eBody:Z,activeItem:$,params:X}=this,{suppressTrapFocus:Y,enableCloseButton:G}=X,q=d(z),H=Q.target,_=Q.shiftKey;if(J.contains(q)){if(Q.preventDefault(),G&&_&&!this.eCloseButton?.contains(q))this.eCloseButton?.focus();else if(Y&&_)e6(Y0(z).body,H)?.focus();else this.focusBody(Q.shiftKey);return}let U=null;if(SY(Z,H)){if(_)U=e6(Z,H);if(!U&&!Y)U=$.eHeaderButton}if(!U&&Z.contains(q)){if(U=R0(z,Z,!1,_),!U){if(Y&&!_)this.forceFocusOutOfContainer(_);else if(G&&!_)Q.preventDefault(),this.eCloseButton?.focus();else Q.preventDefault(),this.focusHeader();return}}if(U)Q.preventDefault(),U.focus()}focusInnerElement(Q){if(Q)return this.focusBody(!0);else return this.focusHeader(),!0}focusHeader(Q){this.activeItem.eHeaderButton.focus({preventScroll:Q})}focusBody(Q){return D0(this.eBody,Q)}setAfterAttachedParams(Q){this.afterAttachedParams=Q}showFirstItem(){if(this.items.length>0)this.showItemWrapper(this.items[0])}addItem(Q){let z=K0({tag:"span",cls:"ag-tab",role:"tab",attrs:{tabindex:"-1"}});z.appendChild(Q.title),this.eTabHeader.appendChild(z),E0(z,Q.titleLabel);let J={tabbedItem:Q,eHeaderButton:z};this.items.push(J),z.addEventListener("click",this.showItemWrapper.bind(this,J))}showItem(Q){let z=this.items.find((J)=>J.tabbedItem===Q);if(z)this.showItemWrapper(z)}showItemWrapper(Q){let{tabbedItem:z,eHeaderButton:J}=Q;if(this.params.onItemClicked?.({item:z}),this.activeItem===Q){this.params.onActiveItemClicked?.();return}if(this.lastScrollListener)this.lastScrollListener=this.lastScrollListener();if(z0(this.eBody),z.bodyPromise.then((Z)=>{this.eBody.appendChild(Z);let $=!V1();if(!this.params.suppressFocusBodyOnOpen)D0(this.eBody,!1,$);if(z.afterAttachedCallback)z.afterAttachedCallback(this.afterAttachedParams);if(this.params.keepScrollPosition){let X=z.getScrollableContainer?.()||Z;[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?.();J.classList.add("ag-tab-selected"),this.activeItem=Q}},_f=".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 Uf(Q){let z=Q.cssIdentifier||"default",J=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-${J} ag-${z}-group-container`}]}}var Wf=class extends p0{constructor(Q={}){super(Uf(Q),[yQ]);this.params=Q,this.suppressEnabledCheckbox=!0,this.suppressToggleExpandOnEnableChange=!1,this.eToolbar=S,this.cbGroupEnabled=S,this.eContainer=S,this.registerCSS(_f);let{enabled:z,items:J,suppressEnabledCheckbox:Z,expanded:$,suppressToggleExpandOnEnableChange:X,useToggle:Y}=Q;if(this.cssIdentifier=Q.cssIdentifier||"default",this.enabled=z!=null?z:!0,this.items=J||[],this.useToggle=Y??!1,this.alignItems=Q.alignItems||"center",this.expanded=$==null?!0:$,Z!=null)this.suppressEnabledCheckbox=Z;if(X!=null)this.suppressToggleExpandOnEnableChange=X}postConstruct(){if(this.setupTitleBar(),this.items.length){let $=this.items;this.items=[],this.addItems($)}let Q=this.getLocaleTextFunc();if(this.cbGroupEnabled.setLabel(Q("enabled","Enabled")),this.enabled)this.setEnabled(this.enabled,void 0,!0);this.setAlignItems(this.alignItems);let{onEnableChange:z,onExpandedChange:J,suppressOpenCloseIcons:Z}=this.params;if(this.hideEnabledCheckbox(this.suppressEnabledCheckbox),this.hideOpenCloseIcons(Z??!1),this.refreshChildDisplay(),N(this.eContainer,this.expanded),this.cbGroupEnabled.onValueChange(($)=>{this.setEnabled($,!0,this.suppressToggleExpandOnEnableChange),this.dispatchEnableChangeEvent($)}),z!=null)this.onEnableChange(z);if(J!=null)this.onExpandedChange(J)}refreshChildDisplay(){N(this.eToolbar,this.expanded&&!this.suppressEnabledCheckbox),this.eTitleBar?.refreshOnExpand(this.expanded)}isExpanded(){return this.expanded}setAlignItems(Q){if(this.alignItems!==Q)this.removeCss(`ag-group-item-alignment-${this.alignItems}`);this.alignItems=Q;let z=`ag-group-item-alignment-${this.alignItems}`;return this.addCss(z),this}toggleGroupExpand(Q,z){if(this.eTitleBar?.isSuppressCollapse()&&!this.useToggle)Q=!0,z=!0;else if(Q=Q!=null?Q:!this.expanded,this.expanded===Q)return this;if(this.expanded=Q,this.refreshChildDisplay(),N(this.eContainer,Q),!z)this.dispatchLocalEvent({type:Q?"expanded":"collapsed"});return this}addItems(Q){for(let z of Q)this.addItem(z)}prependItem(Q){this.insertItem(Q,!0)}addItem(Q){this.insertItem(Q,!1)}updateItems(Q){let z=this.items,J=0;for(let Z=0;ZQ(z.enabled)}),this}onExpandedChange(Q){return this.addManagedListeners(this,{expanded:()=>Q(!0),collapsed:()=>Q(!1)}),this}hideEnabledCheckbox(Q){return this.suppressEnabledCheckbox=Q,this.refreshChildDisplay(),this.refreshDisabledStyles(),this}hideOpenCloseIcons(Q){return this.eTitleBar?.hideOpenCloseIcons(Q),this}refreshDisabledStyles(){let Q=!this.enabled;this.eContainer.classList.toggle("ag-disabled",Q),this.eTitleBar?.refreshDisabledStyles(this.suppressEnabledCheckbox&&Q),this.eContainer.classList.toggle("ag-disabled-group-container",Q)}setupTitleBar(){let Q=this.useToggle?this.createToggleTitleBar():this.createDefaultTitleBar();this.eToolbar.insertAdjacentElement("beforebegin",Q.getGui())}createDefaultTitleBar(){let Q=this.createManagedBean(new Ef(this.params));return this.eTitleBar=Q,Q.refreshOnExpand(this.expanded),this.addManagedListeners(Q,{expandedChanged:(z)=>this.toggleGroupExpand(z.expanded)}),Q}createToggleTitleBar(){let Q=this.createManagedBean(new N6({value:this.enabled,label:this.params.title,labelAlignment:"left",labelWidth:"flex",onValueChange:(z)=>{this.setEnabled(z,!0),this.dispatchEnableChangeEvent(z)}}));return Q.addCss("ag-group-title-bar"),Q.addCss(`ag-${this.params.cssIdentifier??"default"}-group-title-bar ag-unselectable`),this.eToggle=Q,this.toggleGroupExpand(this.enabled),Q}},c6="ag-disabled-group-title-bar";function Bf(Q){let z=Q.cssIdentifier??"default";return{tag:"div",cls:`ag-group-title-bar ag-${z}-group-title-bar ag-unselectable`,role:Q.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 Ef=class extends p0{constructor(Q={}){super(Bf(Q));this.suppressOpenCloseIcons=!1,this.suppressKeyboardNavigation=!1,this.eGroupOpenedIcon=S,this.eGroupClosedIcon=S,this.eTitle=S;let{title:z,suppressOpenCloseIcons:J,suppressKeyboardNavigation:Z}=Q;if(!!z&&z.length>0)this.title=z;if(J!=null)this.suppressOpenCloseIcons=J;this.suppressKeyboardNavigation=Z??!1}postConstruct(){this.setTitle(this.title),this.hideOpenCloseIcons(this.suppressOpenCloseIcons),this.setupExpandContract()}setupExpandContract(){let Q=this.beans.iconSvc;this.eGroupClosedIcon.appendChild(Q.createIconNoSpan("accordionClosed")),this.eGroupOpenedIcon.appendChild(Q.createIconNoSpan("accordionOpen")),this.addManagedElementListeners(this.getGui(),{click:()=>this.dispatchExpandChanged(),keydown:(z)=>{switch(z.key){case V.ENTER:case V.SPACE:z.preventDefault(),this.dispatchExpandChanged();break;case V.RIGHT:case V.LEFT:z.preventDefault(),this.dispatchExpandChanged(z.key===V.RIGHT);break}}})}refreshOnExpand(Q){this.refreshAriaStatus(Q),this.refreshOpenCloseIcons(Q)}refreshAriaStatus(Q){if(!this.suppressOpenCloseIcons)w0(this.getGui(),Q)}refreshOpenCloseIcons(Q){let z=!this.suppressOpenCloseIcons;N(this.eGroupOpenedIcon,z&&Q),N(this.eGroupClosedIcon,z&&!Q)}isSuppressCollapse(){return this.suppressOpenCloseIcons}dispatchExpandChanged(Q){let z={type:"expandedChanged",expanded:Q};this.dispatchLocalEvent(z)}setTitle(Q){let z=this.getGui(),J=!!Q&&Q.length>0;if(Q=J?Q:void 0,this.eTitle.textContent=Q??"",N(z,J),Q!==this.title)this.title=Q;let Z=z.classList.contains(c6);return this.refreshDisabledStyles(Z),this}addWidget(Q){return this.getGui().appendChild(Q),this}hideOpenCloseIcons(Q){if(this.suppressOpenCloseIcons=Q,Q)this.dispatchExpandChanged(!0);return this}refreshDisabledStyles(Q){let z=this.getGui();if(Q)z.classList.add(c6),z.removeAttribute("tabindex"),H0(z,"presentation");else if(z.classList.remove(c6),typeof this.title==="string"&&!this.suppressKeyboardNavigation)this.activateTabIndex([z]),H0(z,"group");else z.removeAttribute("tabindex"),H0(z,"presentation")}};var J0="35.2.0",I0={moduleName:"EnterpriseCore",version:J0,beans:[PX],icons:{accordionOpen:"tree-open",accordionClosed:"tree-closed",accordionIndeterminate:"tree-indeterminate",close:"cross",cancel:"cancel",maximize:"maximize",minimize:"minimize",columnDrag:"grip"},dependsOn:[],setLicenseKey:PX.setLicenseKey};var Kf={stopPropagationCallbacks:Uz,focusNextContainer:(Q,z)=>{return $Q(Q,z)},configureFocusableContainer:(Q,z)=>{let J=Q.ctrlsSvc.get("gridCtrl");J.addFocusableContainer(z),z.addDestroyFunc(()=>J.removeFocusableContainer(z))}},Lf=class extends Xf{constructor(Q){super(Q,Kf)}getFocusableContainerName(){return"dialog"}};var OY=class extends eV{constructor(Q){super(Uz,Q)}};var Ff=class extends zf{};function Df(Q){return Q.sideBar?.comp.isDisplayed()??!1}function Mf(Q,z){Q.sideBar?.comp.setDisplayed(z)}function kf(Q,z){Q.sideBar?.comp.setSideBarPosition(z)}function Vf(Q,z,J){Q.sideBar?.comp.openToolPanel(z,"api",J)}function ff(Q){Q.sideBar?.comp.close("api")}function Af(Q){return Q.sideBar?.comp.openedItem()??null}function jf(Q){Q.sideBar?.comp.refresh()}function Rf(Q){return Q.sideBar?.comp.isToolPanelShowing()??!1}function Sf(Q,z){let J=Q.sideBar?.comp.getToolPanelInstance(z);return mQ(J)}function Of(Q){return Q.sideBar?.comp.getDef()}var Pf=`.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)}}`,Tf={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"}]}]},vf=class extends x{constructor(Q){super();this.toolPanelDef=Q,this.eToggleButton=S,this.eIconWrapper=S,this.eLabel=S}getToolPanelId(){return this.toolPanelDef.id}postConstruct(){this.setTemplate(Tf,[]),this.setLabel(),this.setIcon(),this.addManagedElementListeners(this.eToggleButton,{click:this.onButtonPressed.bind(this)}),this.eToggleButton.setAttribute("id",`ag-${this.getCompId()}-button`)}setLabel(){let Q=this.toolPanelDef,z=this.getLocaleTextFunc()(Q.labelKey,Q.labelDefault);this.eLabel.textContent=z}setIcon(){this.eIconWrapper.insertAdjacentElement("afterbegin",h(this.toolPanelDef.iconKey,this.beans))}onButtonPressed(){this.dispatchLocalEvent({type:"toggleButtonClicked"})}setSelected(Q){this.toggleCss("ag-selected",Q),w0(this.eToggleButton,Q)}},If={tag:"div",cls:"ag-side-buttons",role:"tablist"},Cf=class extends x{constructor(){super(If);this.buttonComps=[]}postConstruct(){this.addManagedElementListeners(this.getFocusableElement(),{keydown:this.handleKeyDown.bind(this)})}handleKeyDown(Q){if(Q.key!==V.TAB||!Q.shiftKey)return;if($Q(this.beans,!0)){Q.preventDefault();return}i0(Q)}setActiveButton(Q){for(let z of this.buttonComps)z.setSelected(Q===z.getToolPanelId())}addButtonComp(Q){let z=this.createBean(new vf(Q));return this.buttonComps.push(z),this.appendChild(z),z.addEventListener("toggleButtonClicked",()=>{this.dispatchLocalEvent({type:"sideBarButtonClicked",toolPanelId:Q.id})}),z}clearButtons(){this.buttonComps=this.destroyBeans(this.buttonComps),z0(this.getGui())}destroy(){this.clearButtons(),super.destroy()}},bf={selector:"AG-SIDE-BAR-BUTTONS",component:Cf},PY={id:"columns",labelDefault:"Columns",labelKey:"columns",iconKey:"columnsToolPanel",toolPanel:"agColumnsToolPanel"},TY={id:"filters",labelDefault:"Filters",labelKey:"filters",iconKey:"filtersToolPanel",toolPanel:"agFiltersToolPanel"},yf={id:"filters-new",labelDefault:"Filters",labelKey:"filters",iconKey:"filtersToolPanel",toolPanel:"agNewFiltersToolPanel"},SJ={columns:PY,filters:TY,"filters-new":yf};function Q7(Q){if(!Q)return;if(Q===!0)return{toolPanels:[PY,TY],defaultToolPanel:"columns"};if(typeof Q==="string")return Q7([Q]);if(Array.isArray(Q)){let z=[];for(let J of Q){let Z=SJ[J];if(!Z){R(215,{key:J,defaultByKey:SJ});continue}z.push(Z)}if(z.length===0)return;return{toolPanels:z,defaultToolPanel:z[0].id}}return{toolPanels:xf(Q.toolPanels),defaultToolPanel:Q.defaultToolPanel,hiddenByDefault:Q.hiddenByDefault,position:Q.position,hideButtons:Q.hideButtons}}function xf(Q){let z=[];if(!Q)return z;return Q.forEach((J)=>{let Z=wf(J);if(!Z)return;z.push(Z)}),z}function wf(Q){if(typeof Q!=="string")return Q;if(SJ[Q])return SJ[Q];return R(215,{key:Q,defaultByKey:SJ}),null}var Nf=class extends x{constructor(){super({tag:"div",cls:"ag-tool-panel-horizontal-resize"});this.minWidth=100,this.maxWidth=null}postConstruct(){let Q=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(Q),this.inverted=this.gos.get("enableRtl")}dispatchResizeEvent(Q,z,J){this.eventSvc.dispatchEvent({type:"toolPanelSizeChanged",width:J,started:Q,ended:z})}onResizeStart(){this.startingWidth=this.elementToResize.offsetWidth,this.dispatchResizeEvent(!0,!1,this.startingWidth)}onResizeEnd(Q){return this.onResizing(Q,!0)}onResizing(Q,z=!1){let J=this.inverted?-1:1,Z=Math.max(this.minWidth,Math.floor(this.startingWidth-Q*J));if(this.maxWidth!=null)Z=Math.min(this.maxWidth,Z);this.elementToResize.style.setProperty("--ag-horizontal-size",`${Z}px`),this.dispatchResizeEvent(!1,z,Z)}};function gf(Q,z,J){return Q.getCompDetails(z,hf,void 0,J,!0)}var hf={name:"toolPanel",optionalMethods:["refresh","getState"]},uf={tag:"div",cls:"ag-tool-panel-wrapper",role:"tabpanel",children:[{tag:"div",cls:"ag-tool-panel-content",ref:"eContent"}]},mf=class extends x{constructor(){super(uf);this.eContent=S,this.animationId=0,this.defParent=null}postConstruct(){let Q=this.getGui(),z=this.resizeBar=this.createManagedBean(new Nf);Q.setAttribute("id",`ag-${this.getCompId()}`),z.elementToResize=Q,this.appendChild(z)}getToolPanelId(){return this.toolPanelId}getDefParent(){return this.defParent}setDefParent(Q){this.defParent=Q}setToolPanelDef(Q,z){let{id:J,minWidth:Z,maxWidth:$,width:X,parent:Y}=Q;if(this.toolPanelId=J,this.defParent=Y??null,X)this.getGui().style.setProperty("--ag-side-bar-panel-width",`${X}px`);let G=gf(this.beans.userCompFactory,Q,z);if(G==null)return!1;let q=G.newAgStackInstance();this.params=G.params,q.then(this.setToolPanelComponent.bind(this));let H=this.resizeBar;if(Z!=null)H.minWidth=Z;if($!=null)H.maxWidth=$;return!0}setToolPanelComponent(Q){this.toolPanelCompInstance=Q;let{eContent:z}=this;z.appendChild(Q.getGui()),this.addDestroyFunc(()=>{this.destroyBean(Q)})}getToolPanelInstance(){return this.toolPanelCompInstance}setResizerSizerSide(Q){let z=this.gos.get("enableRtl"),J=Q==="left",Z=z?J:!J;this.resizeBar.inverted=Z}refresh(){this.toolPanelCompInstance?.refresh(this.params)}animateDisplayed(Q){if(this.isDisplayed()===Q)return;let z=++this.animationId,{eContent:J}=this,Z=()=>{if(this.animationId===z)$.classList.remove("ag-tool-panel-animating"),J.style.width="",$.style.width=""},$=this.getGui(),X=$.offsetWidth;this.setDisplayed(Q),$.classList.add("ag-tool-panel-animating");let Y=getComputedStyle($).transitionDuration;if(!parseFloat(Y)){Z();return}$.style.transition="none",$.style.width="",J.style.width=`${J.offsetWidth}px`,$.style.width=`${X}px`;let G=$.offsetWidth;$.style.transition="",$.style.width=Q?"":"0";let q=setTimeout(Z,100);$.addEventListener("transitionstart",()=>clearTimeout(q),{once:!0}),$.addEventListener("transitionend",Z,{once:!0})}},cf={tag:"div",cls:"ag-side-bar ag-unselectable",children:[{tag:"ag-side-bar-buttons",ref:"sideBarButtons"}]},pf=class extends x{constructor(){super(cf,[bf]);this.sideBarButtons=S,this.toolPanelWrappers=[],this.registerCSS(Pf)}postConstruct(){this.sideBarButtons.addEventListener("sideBarButtonClicked",this.onToolPanelButtonClicked.bind(this));let{beans:Q,gos:z}=this,{sideBar:J}=z.get("initialState")??{};this.setSideBarDef({sideBarDef:Q7(z.get("sideBar")),sideBarState:J}),this.addManagedPropertyListener("sideBar",()=>this.setState()),Q.sideBar.comp=this;let Z=this.getFocusableElement();this.createManagedBean(new cQ(Z,{onTabKeyDown:this.onTabKeyDown.bind(this),handleKeyDown:this.handleKeyDown.bind(this)})),Bz(Q,this,Z),this.addManagedPropertyListener("enableAdvancedFilter",this.onAdvancedFilterChanged.bind(this))}getFocusableContainerName(){return"sideBar"}onTabKeyDown(Q){if(Q.defaultPrevented)return;let{beans:z,sideBarButtons:J}=this,Z=this.getGui(),$=J.getGui(),X=d(z),Y=Z.querySelector(".ag-tool-panel-wrapper:not(.ag-hidden)"),G=Q.target,q=Q.shiftKey;if(!Y){if($Q(z,q,!0))return Q.preventDefault(),!0;return p9(Q),!1}if($.contains(X)){if(D0(Y,q))Q.preventDefault();return}if(!q)return;let H=null;if(Y.contains(X))H=R0(z,Y,void 0,!0);else if(SY(Y,G))H=e6(Y,G);if(!H)H=$.querySelector(".ag-selected button"),H=f0(H)?H:null;if(H&&H!==Q.target)Q.preventDefault(),H.focus()}handleKeyDown(Q){let z=d(this.beans),J=this.sideBarButtons;if(!J.getGui().contains(z))return;let Z=J.getGui(),$=Array.prototype.slice.call(Z.querySelectorAll(".ag-side-button")),X=$.findIndex((q)=>q.contains(z)),Y=null;switch(Q.key){case V.LEFT:case V.UP:Y=Math.max(0,X-1);break;case V.RIGHT:case V.DOWN:Y=Math.min(X+1,$.length-1);break}if(Y===null)return;let G=$[Y].querySelector("button");if(G)G.focus(),Q.preventDefault()}onToolPanelButtonClicked(Q){let z=Q.toolPanelId;if(this.openedItem()===z)this.openToolPanel(void 0,"sideBarButtonClicked");else this.openToolPanel(z,"sideBarButtonClicked")}clearDownUi(){this.sideBarButtons.clearButtons(),this.destroyToolPanelWrappers()}setSideBarDef({sideBarDef:Q,sideBarState:z,existingToolPanelWrappers:J}){if(this.setDisplayed(!1),this.sideBar=Q,Q)this.sideBarButtons.setDisplayed(!Q.hideButtons);if(Q?.toolPanels){let Z=Q.toolPanels;if(this.createToolPanelsAndSideButtons(Z,z,J),!this.toolPanelWrappers.length)return;let $=z?z.visible:!Q.hiddenByDefault;if(this.setDisplayed($),this.setSideBarPosition(z?z.position:Q.position),$)if(z){let{openToolPanel:X}=z;if(X)this.openToolPanel(X,"sideBarInitializing")}else this.openToolPanel(Q.defaultToolPanel,"sideBarInitializing")}}getDef(){return this.sideBar}setSideBarPosition(Q){if(!Q)Q="right";this.position=Q;let z=Q==="left",J=z?"right":"left";this.toggleCss("ag-side-bar-left",z),this.toggleCss("ag-side-bar-right",!z);for(let Z of this.toolPanelWrappers)Z.setResizerSizerSide(J);return this.dispatchSideBarUpdated(),this}setDisplayed(Q,z){super.setDisplayed(Q,z),this.dispatchSideBarUpdated()}getState(){let Q={};for(let z of this.toolPanelWrappers)Q[z.getToolPanelId()]=z.getToolPanelInstance()?.getState?.();return{visible:this.isDisplayed(),position:this.position,openToolPanel:this.openedItem(),toolPanels:Q}}createToolPanelsAndSideButtons(Q,z,J){for(let Z of Q)this.createToolPanelAndSideButton(Z,z?.toolPanels?.[Z.id],J?.[Z.id])}validateDef(Q){let{id:z,toolPanel:J}=Q;if(z==null)return R(212),!1;if(gX(J)){if(this.beans.filterManager?.isAdvFilterEnabled())return R(213),!1}return!0}createToolPanelAndSideButton(Q,z,J){if(!this.validateDef(Q)){this.destroyBean(J);return}let Z;if(J)Z=J,Z.setDefParent(Q.parent??null);else if(Z=this.createBean(new mf),!Z.setToolPanelDef(Q,y(this.gos,{initialState:z,onStateUpdated:()=>this.dispatchSideBarUpdated()})))return;Z.setDisplayed(!1),this.renderToolPanelUnderParent(Z,Q.parent),this.toolPanelWrappers.push(Z);let $=this.sideBarButtons.addButtonComp(Q);C8($.eToggleButton,Z.getGui())}refresh(){for(let Q of this.toolPanelWrappers)Q.refresh()}renderToolPanelUnderParent(Q,z){let J=Q.getGui();if(z)this.beans.environment.applyThemeClasses(z,["ag-external","ag-tool-panel-external"]),J.classList.add(this.gos.get("enableRtl")?"ag-rtl":"ag-ltr");let Z=z??Q.getDefParent()??this.getGui();if(J.parentElement!==Z)Z.appendChild(J)}getWrapper(Q){return this.toolPanelWrappers.find((z)=>z.getToolPanelId()===Q)}openToolPanel(Q,z="api",J){let Z=this.openedItem(),X=!!Q&&!!Z||z==="sideBarInitializing";for(let q of this.toolPanelWrappers){let H=Q===q.getToolPanelId();if(H)this.renderToolPanelUnderParent(q,J??null);if(X)q.setDisplayed(H);else q.animateDisplayed(H)}let Y=this.openedItem();if(Z!==Y)this.sideBarButtons.setActiveButton(Q),this.raiseToolPanelVisibleEvent(Q,Z??void 0,z)}getToolPanelInstance(Q){let z=this.getWrapper(Q);if(!z){R(214,{key:Q});return}return z.getToolPanelInstance()}raiseToolPanelVisibleEvent(Q,z,J){let Z=!!Q&&!!z,$=this.eventSvc;if(z)$.dispatchEvent({type:"toolPanelVisibleChanged",source:J,key:z,visible:!1,switchingToolPanel:Z});if(Q)$.dispatchEvent({type:"toolPanelVisibleChanged",source:J,key:Q,visible:!0,switchingToolPanel:Z})}close(Q="api"){this.openToolPanel(void 0,Q)}isToolPanelShowing(){return!!this.openedItem()}openedItem(){let Q=null;for(let z of this.toolPanelWrappers)if(z.isDisplayed())Q=z.getToolPanelId();return Q}setState(Q){let z=Q7(this.gos.get("sideBar")),J={};if(z&&this.sideBar)z.toolPanels?.forEach((Z)=>{let{id:$}=Z;if(!$)return;let X=this.sideBar.toolPanels?.find((H)=>H.id===$);if(!X||Z.toolPanel!==X.toolPanel)return;let Y=this.getWrapper($);if(!Y)return;let G=y(this.gos,{...Z.toolPanelParams??{},initialState:Q?.toolPanels?.[$],onStateUpdated:()=>this.dispatchSideBarUpdated()});if(Y.getToolPanelInstance()?.refresh(G)!==!0)return;this.toolPanelWrappers=this.toolPanelWrappers.filter((H)=>H!==Y),T0(Y.getGui()),J[$]=Y});this.clearDownUi(),this.setSideBarDef({sideBarDef:z,sideBarState:Q,existingToolPanelWrappers:J})}dispatchSideBarUpdated(){this.eventSvc.dispatchEvent({type:"sideBarUpdated"})}destroyToolPanelWrappers(){for(let Q of this.toolPanelWrappers)T0(Q.getGui()),this.destroyBean(Q);this.toolPanelWrappers.length=0}onAdvancedFilterChanged(){if(this.sideBar?.toolPanels?.some((z)=>gX(typeof z==="string"?z:z.toolPanel)))this.setState()}destroy(){this.destroyToolPanelWrappers(),super.destroy()}};function gX(Q){return Q==="agFiltersToolPanel"||Q==="agNewFiltersToolPanel"}var nf={selector:"AG-SIDE-BAR",component:pf},df=class extends j{constructor(){super(...arguments);this.beanName="sideBar"}getSelector(){return nf}},$7={moduleName:"SideBar",version:J0,beans:[df],apiFunctions:{isSideBarVisible:Df,setSideBarVisible:Mf,setSideBarPosition:kf,openToolPanel:Vf,closeToolPanel:ff,getOpenedToolPanel:Af,refreshToolPanel:jf,isToolPanelShowing:Rf,getToolPanelInstance:Sf,getSideBar:Of},dependsOn:[I0,B6]},tf='.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}',vY=class extends Gf{constructor(){super({warnNoIcon:()=>R(227)})}},X7={moduleName:"MenuItem",version:J0,userComponents:{agMenuItem:vY},icons:{check:"tick",subMenuOpen:"small-right",subMenuOpenRtl:"small-left"},css:[tf]},rf=".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}",sf=300,lf={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"}]},af=class extends x{constructor(){super(lf,[yQ,T6]);this.eExpand=S,this.eSelect=S,this.eFilterTextField=S}postConstruct(){this.createExpandIcons(),this.addManagedListeners(this.eExpand,{click:this.onExpandClicked.bind(this),keydown:(z)=>{if(z.key===V.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 Q=this.getLocaleTextFunc();this.eSelect.setInputAriaLabel(Q("ariaColumnSelectAll","Toggle All Columns Visibility")),this.eFilterTextField.setInputAriaLabel(Q("ariaFilterColumnsInput","Filter Columns Input")),this.activateTabIndex([this.eExpand])}onFunctionsReadOnlyPropChanged(){let Q=this.gos.get("functionsReadOnly");this.eSelect.setReadOnly(Q),this.eSelect.toggleCss("ag-column-select-column-readonly",Q)}init(Q){this.params=Q;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 Q=this.beans;this.eExpand.appendChild(this.eExpandChecked=h("columnSelectOpen",Q)),this.eExpand.appendChild(this.eExpandUnchecked=h("columnSelectClosed",Q)),this.eExpand.appendChild(this.eExpandIndeterminate=h("columnSelectIndeterminate",Q)),this.setExpandState(0)}showOrHideOptions(){let Q=this.params,z=!Q.suppressColumnFilter,J=!Q.suppressColumnSelectAll,Z=!Q.suppressColumnExpandAll,$=!!this.beans.colModel.colDefCols?.treeDepth,X=this.getLocaleTextFunc();this.eFilterTextField.setInputPlaceholder(X("searchOoo","Search...")),N(this.eFilterTextField.getGui(),z),N(this.eSelect.getGui(),J),N(this.eExpand,Z&&$)}onFilterTextChanged(){if(!this.onFilterTextChangedDebounced)this.onFilterTextChangedDebounced=gQ(this,()=>{let Q=this.eFilterTextField.getValue();this.dispatchLocalEvent({type:"filterChanged",filterText:Q})},sf);this.onFilterTextChangedDebounced()}onSelectClicked(){this.dispatchLocalEvent({type:this.selectState?"unselectAll":"selectAll"})}onExpandClicked(){this.dispatchLocalEvent({type:this.expandState===0?"collapseAll":"expandAll"})}setExpandState(Q){this.expandState=Q,N(this.eExpandChecked,Q===0),N(this.eExpandUnchecked,Q===1),N(this.eExpandIndeterminate,Q===2)}setSelectionState(Q){this.selectState=Q,this.eSelect.setValue(this.selectState)}},of={selector:"AG-PRIMARY-COLS-HEADER",component:af};function P1(Q){return!!Q&&typeof Q.children<"u"}function Fz(Q){return P1(Q)?Q.groupId:Q.colId}function IY(Q,z,J){let Z=(Y,G)=>{let H=Y.children.map(Fz).includes(Fz(G)),_=b(Y.children),U=_&&Fz(_)!==Fz(G);return H&&U};if(!P1(Q))return!0;let $=Q,X=J;if(Z($,X))return $.children.push(X),!0;if($.groupId===z){if(!$.children.map(Fz).includes(Fz(X)))return $.children.push(X),!0}for(let Y=$.children.length-1;Y>=0;Y--)if(IY($.children[Y],z,J))break;return!1}function CY(Q){let z=($,X)=>{return P1($)&&P1(X)&&Fz($)===Fz(X)},J=($,X)=>{if(!P1(X))return $;let Y=$,G=X;if(G.children&&G.groupId){if(IY(Y,G.groupId,G.children[0]))return Y}for(let q of G.children)J(Y,q);return Y},Z=[];for(let $=1;$<=Q.length;$++){let X=Q[$-1],Y=Q[$];if(z(X,Y))Q[$]=J(X,Y);else Z.push(X)}return Z}function ef(Q,z){let J=[],Z=(X,Y)=>{if(P1(X)){let G=X,q=typeof G.groupId<"u"?G.groupId:G.headerName,H=new Cz(G,q,!1,Y),_=[];for(let U of G.children){let W=Z(U,Y+1);if(W)_.push(W)}return H.setChildren(_),H}else{let G=X,q=G.colId?G.colId:G.field,H=Q.getColDefCol(q);if(!H)J.push(G);return H}},$=[];for(let X of z){let Y=Z(X,0);if(Y)$.push(Y)}if(J.length>0)R(217,{invalidColIds:J});return $}function QA(Q,z){let J=bY(JA(Q)),Z=CY(J);z(Z)}function zA(Q,z){let J=bY(Q),Z=CY(J);z(Z)}function bY(Q){let z=(J,Z)=>{let $;if(G0(J))if(J.isPadding())$=Z;else{let Y=Object.assign({},J.getColGroupDef());Y.groupId=J.getGroupId(),Y.children=[Z],$=Y}else{let Y=Object.assign({},J.getColDef());Y.colId=J.getColId(),$=Y}let X=J.getOriginalParent();if(X)return z(X,$);else return $};return Q.map((J)=>z(J,J.getColDef()))}function JA(Q){return Q.getCols().filter((z)=>{let J=z.getColDef();return z.isPrimary()&&!J.showRowGroup})}var hX=class{constructor(Q,z,J,Z=!1,$){if(this.displayName=Q,this.depth=J,this.group=Z,this.localEventService=new KQ,Z)this.columnGroup=z,this._expanded=$,this.children=[];else this.column=z}get expanded(){return!!this._expanded}set expanded(Q){if(Q===this._expanded)return;this._expanded=Q,this.localEventService.dispatchEvent({type:"expandedChanged"})}addEventListener(Q,z){this.localEventService.addEventListener(Q,z)}removeEventListener(Q,z){this.localEventService.removeEventListener(Q,z)}};function i(Q){return!!Q?.buttons?.includes("apply")}function N0(Q,z){if(!i(z))return;let J=Q.sideBar?.comp.openedItem();if(!J)return;Q.sideBar?.comp.getToolPanelInstance(J)?.refreshDeferredUi()}function yY(Q,z,J,Z,$){let X=ZA(z);xY(Q,X,J,Z,$)}function xY(Q,z,J,Z,$){if(Q.columnStateUpdateStrategy.getPivotMode(i($)))XA(Q,z,J,Z,$);else $A(Q,z,J,Z,$)}function ZA(Q){let z=[],J=(Z)=>{for(let $ of Z){if(!$.passesFilter)continue;if($.group)J($.children);else z.push($.column)}};return J(Q),z}function $A(Q,z,J,Z,$){let X=Q.columnStateUpdateStrategy,Y=[];for(let G of z){if(G.getColDef().lockVisible)continue;if(X.isColumnVisibleInToolPanel(i($),G)!==J)Y.push({colId:G.getId(),hide:!J})}X.applyColumnState(i($),Y,Z),N0(Q,$)}function XA(Q,z,J,Z,$){YA(Q,z,J,Z,$)}function YA(Q,z,J,Z,$){let X=Q.columnStateUpdateStrategy,Y=[],H=J?(_)=>{if(X.isColumnSelectedInPivotModeToolPanel(i($),_))return;if(_.isAllowValue()){let U=typeof _.getAggFunc()==="string"?_.getAggFunc():Q.aggFuncSvc?.getDefaultAggFunc(_);Y.push({colId:_.getId(),aggFunc:U})}else if(_.isAllowRowGroup())Y.push({colId:_.getId(),rowGroup:!0});else if(_.isAllowPivot())Y.push({colId:_.getId(),pivot:!0})}:(_)=>{if(X.isColumnSelectedInPivotModeToolPanel(i($),_))Y.push({colId:_.getId(),pivot:!1,rowGroup:!1,aggFunc:null})};z.forEach(H),X.applyColumnState(i($),Y,Z),N0(Q,$)}function wY(Q,z){let{columns:J,visibleState:Z,pivotState:$,eventType:X}=z,Y=Q.columnStateUpdateStrategy,G=Y.getPivotMode(i(z)),q=J.map((H)=>{let _=H.getColId();if(G){let U=$?.[_];return{colId:_,pivot:U?.pivot,rowGroup:U?.rowGroup,aggFunc:U?.aggFunc}}else return{colId:_,hide:!Z?.[_]}});Y.applyColumnState(i(z),q,X),N0(Q,z)}function GA(Q){return{pivot:Q.isPivotActive(),rowGroup:Q.isRowGroupActive(),aggFunc:Q.isValueActive()?Q.getAggFunc():void 0}}function NY(Q,z,J){if(!J)return GA(Q);let Z=z.getRowGroupColumns(J).includes(Q),$=z.getPivotColumns(J).includes(Q),X=z.getValueColumns(J).includes(Q);return{pivot:$,rowGroup:Z,aggFunc:X?z.getColumnAggFunc(J,Q):void 0}}var gY=(Q,z)=>{if(!z)return[];let J=Q;for(let Z=0,$=z.length;Z<$&&J;++Z)J=J[z[Z]];return Array.isArray(J)?J:[]},O1=(Q,z,J)=>{let Z=Q.aggData;if(Z===z)return;if(Q.aggData=z,Q.__localEventService)qA(Q,Z,z,J)},uX=(Q,z,J)=>{O1(Q,z,J);let Z=Q.pinnedSibling;if(Z)O1(Z,z,J);let $=Q.sibling;if($){O1($,z,J);let X=$.pinnedSibling;if(X)O1(X,z,J)}},qA=(Q,z,J,Z)=>{if(!J){if(!z)return;let Y=Object.keys(z);for(let G=0,q=Y.length;G{if(!Q)return;let Z=Q.group;if(Z===J)return;if(Q.group=J,Q.updateHasChildren(),Z&&!J)O1(Q,null,z.colModel),Q.setAllChildrenCount(null);z.selectionSvc?.updateRowSelectable(Q),Q.dispatchRowEvent("groupChanged")},hY=(Q,z,J)=>{mX(Q,z,J),mX(Q.pinnedSibling,z,J)},TJ=(Q,z)=>{let{gos:J,rowGroupColsSvc:Z}=z;if(!Z||!Q)return!1;let $=J.get("groupLockGroupColumns");if(!Q.isRowGroupActive()||$===0)return!1;if($===-1)return!0;let X=Z.columns.findIndex((Y)=>Y.getColId()===Q.getColId());return $>X},OJ=(Q,z,J)=>{let $=Q(z,`${z==="groupBy"?"Group by":"Un-Group by"} ${J}`,[J]);if($.indexOf(J)>=0)return $;else return`${$} ${J}`};function HA(Q){let z=s0(Q),J="getSelection"in z?z.getSelection():null,Z=[];for(let $=0;$<(J?.rangeCount??0);$++){let X=J?.getRangeAt($);if(X)Z.push(X)}return{selection:J,ranges:Z}}function _A(Q,z){if(!Q.gos.get("enableCellTextSelection"))return z();if(!yZ()&&!cz())return z();let{selection:Z,ranges:$}=HA(Q);z(),Z?.removeAllRanges();for(let X of $)Z?.addRange(X)}var UA={name:"menuItem",optionalMethods:["setActive","select","setExpanded","configureDefaults"]},uY={getMenuItemComp:(Q,z,J)=>{return Q.userCompFactory.getCompDetails(z,UA,"agMenuItem",y(Q.gos,J),!0)?.newAgStackInstance()??g.resolve()},getPostProcessPopupParams:({column:Q,node:z})=>({column:Q,rowNode:z}),preserveRangesWhile:_A,stopPropagationCallbacks:Uz,warnNoItem:(Q)=>{R(228,{menuItemOrString:Q})}},WA=class extends o6{constructor(){super(uY)}},mY=class extends RY{constructor(Q,z={column:null,node:null,value:null}){super(Q,z,uY)}},cY=class extends x{constructor(Q,z,J,Z={}){super({tag:"div",cls:"ag-menu"});this.column=Q,this.mouseEventOrTouch=z,this.parentEl=J,this.params=Z,this.displayName=null}postConstruct(){let{column:Q,beans:{colNames:z}}=this;this.initializeProperties(Q);let J;if(JQ(Q))J=z.getDisplayNameForColumn(Q,"columnToolPanel");else J=z.getDisplayNameForProvidedColumnGroup(null,Q,"columnToolPanel");if(this.displayName=J,this.buildMenuItemMap(),this.isActive()){let Z=this.mouseEventOrTouch;if("preventDefault"in Z)Z.preventDefault();let $=this.getMappedMenuItems();if($.length===0)return;this.displayContextMenu($)}}initializeProperties(Q){let z=this.beans.columnStateUpdateStrategy,J;if(G0(Q))J=Q.getLeafColumns();else J=[Q];this.columns=J;let Z=z.getPivotMode(i(this.params));this.allowScrollIntoView=!Z&&J.some(this.isColumnValidForScrollIntoView),this.allowGrouping=J.some(($)=>$.isPrimary()&&$.isAllowRowGroup()),this.allowValues=J.some(($)=>$.isPrimary()&&$.isAllowValue()),this.allowPivoting=Z&&J.some(($)=>$.isPrimary()&&$.isAllowPivot())}buildMenuItemMap(){let Q=this.getLocaleTextFunc(),{beans:z,displayName:J}=this,Z=this.beans.columnStateUpdateStrategy,$=new Map;this.menuItemMap=$;let X=i(this.params),Y=Z.getPivotMode(X),G=new Set(Z.getRowGroupColumns(X).map((B)=>B.getColId())),q=new Set(Z.getValueColumns(X).map((B)=>B.getColId())),H=new Set(Z.getPivotColumns(X).map((B)=>B.getColId()));$.set("scrollIntoView",{allowedFunction:(B)=>!B.isPinned()&&!Y&&this.isColumnValidForScrollIntoView(B),activeFunction:()=>!1,activateLabel:()=>Q("scrollColumnIntoView",`Scroll ${J} into View`,[J]),activateFunction:()=>{let B=this.columns.find(this.isColumnValidForScrollIntoView);if(B)this.beans.ctrlsSvc.getScrollFeature().ensureColumnVisible(B)},deActivateFunction:()=>{},addIcon:"ensureColumnVisible"});let _=(B)=>B.isPrimary()&&B.isAllowRowGroup()&&!TJ(B,z);$.set("rowGroup",{allowedFunction:_,activeFunction:(B)=>G.has(B.getColId()),activateLabel:()=>OJ(Q,"groupBy",J),deactivateLabel:()=>OJ(Q,"ungroupBy",J),activateFunction:()=>{let B=this.addColumnsToList(Z.getRowGroupColumns(X),_);Z.setRowGroupColumns(X,B,"toolPanelUi"),N0(this.beans,this.params)},deActivateFunction:()=>{let B=this.removeColumnsFromList(Z.getRowGroupColumns(X),_);Z.setRowGroupColumns(X,B,"toolPanelUi"),N0(this.beans,this.params)},addIcon:"menuAddRowGroup",removeIcon:"menuRemoveRowGroup"});let U=(B)=>B.isPrimary()&&B.isAllowValue();$.set("value",{allowedFunction:U,activeFunction:(B)=>q.has(B.getColId()),activateLabel:()=>Q("addToValues",`Add ${J} to values`,[J]),deactivateLabel:()=>Q("removeFromValues",`Remove ${J} from values`,[J]),activateFunction:()=>{let B=this.addColumnsToList(Z.getValueColumns(X),U);Z.setValueColumns(X,B,"toolPanelUi"),N0(this.beans,this.params)},deActivateFunction:()=>{let B=this.removeColumnsFromList(Z.getValueColumns(X),U);Z.setValueColumns(X,B,"toolPanelUi"),N0(this.beans,this.params)},addIcon:"valuePanel",removeIcon:"valuePanel"});let W=(B)=>Y&&B.isPrimary()&&B.isAllowPivot();$.set("pivot",{allowedFunction:W,activeFunction:(B)=>H.has(B.getColId()),activateLabel:()=>Q("addToLabels",`Add ${J} to labels`,[J]),deactivateLabel:()=>Q("removeFromLabels",`Remove ${J} from labels`,[J]),activateFunction:()=>{let B=this.addColumnsToList(Z.getPivotColumns(X),W);Z.setPivotColumns(X,B,"toolPanelUi"),N0(this.beans,this.params)},deActivateFunction:()=>{let B=this.removeColumnsFromList(Z.getPivotColumns(X),W);Z.setPivotColumns(X,B,"toolPanelUi"),N0(this.beans,this.params)},addIcon:"pivotPanel",removeIcon:"pivotPanel"})}isColumnValidForScrollIntoView(Q){if(!Q.isVisible())return!1;let J=Q.getParent();if(!J)return!0;return J.getDisplayedChildren()?.includes(Q)??!0}addColumnsToList(Q,z){return[...Q].concat(this.columns.filter((J)=>z(J)&&!Q.includes(J)))}removeColumnsFromList(Q,z){return Q.filter((J)=>!z(J)||!this.columns.includes(J))}displayContextMenu(Q){let z=this.getGui(),J=this.createBean(new mY),Z=this.getLocaleTextFunc(),$=()=>{};z.appendChild(J.getGui()),J.addMenuItems(Q),J.addManagedListeners(J,{closeMenu:()=>{this.parentEl.focus(),$()}});let X=this.beans.popupSvc,Y=X.addPopup({modal:!0,eChild:z,closeOnEsc:!0,afterGuiAttached:()=>D0(J.getGui()),ariaLabel:Z("ariaLabelContextMenu","Context Menu"),closedCallback:(G)=>{if(G instanceof KeyboardEvent)this.parentEl.focus();this.destroyBean(J)}});if(Y)$=Y.hideFunc;X.positionPopupUnderMouseEvent({type:"columnContextMenu",mouseEvent:this.mouseEventOrTouch,ePopup:z})}isActive(){return this.allowScrollIntoView||this.allowGrouping||this.allowValues||this.allowPivoting}getMappedMenuItems(){let Q=[],{menuItemMap:z,columns:J,displayName:Z,beans:$}=this;for(let X of z.values()){let Y=J.some((q)=>X.allowedFunction(q)&&!X.activeFunction(q)),G=J.some((q)=>X.allowedFunction(q)&&X.activeFunction(q));if(Y)Q.push({name:X.activateLabel(Z),icon:h(X.addIcon,$,null),action:()=>X.activateFunction()});if(G&&X.removeIcon&&X.deactivateLabel)Q.push({name:X.deactivateLabel(Z),icon:h(X.removeIcon,$,null),action:()=>X.deActivateFunction?.()})}return Q}},BA={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"}]},pY=class extends x{constructor(Q,z,J,Z,$){super();this.modelItem=Q,this.allowDragging=z,this.eventType=J,this.focusWrapper=Z,this.params=$,this.cbSelect=S,this.eLabel=S,this.eGroupOpenedIcon=S,this.eGroupClosedIcon=S,this.eColumnGroupIcons=S,this.processingColumnStateChange=!1;let{columnGroup:X,depth:Y,displayName:G}=Q;this.columnGroup=X,this.columnDepth=Y,this.displayName=G}postConstruct(){this.setTemplate(BA,[yQ]);let{beans:Q,cbSelect:z,eLabel:J,displayName:Z,columnDepth:$,modelItem:X,focusWrapper:Y,columnGroup:G}=this,{registry:q,gos:H}=Q,_=h("columnDrag",Q);this.eDragHandle=_,_.classList.add("ag-drag-handle","ag-column-select-column-group-drag-handle");let U=z.getGui(),W=z.getInputElement();U.after(_),W.setAttribute("tabindex","-1"),J.textContent=Z??"",this.setupExpandContract(),this.addCss("ag-column-select-indent-"+$),this.getGui().style.setProperty("--ag-indentation-level",String($)),this.tooltipFeature=this.createOptionalManagedBean(q.createDynamicBean("tooltipFeature",!1,{getGui:()=>this.focusWrapper,getLocation:()=>"columnToolPanelColumnGroup",shouldDisplayTooltip:tZ(H,()=>J)})),this.addManagedEventListeners({columnPivotModeChanged:this.onColumnStateChanged.bind(this)}),this.addManagedElementListeners(J,{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=hZ(G.getColGroupDef(),H,null,G);for(let K of E)this.toggleCss(K,!0)}getColumns(){return this.columnGroup.getLeafColumns()}setupTooltip(){let Q=this.columnGroup.getColGroupDef();if(!Q)return;let z=()=>this.tooltipFeature?.setTooltipAndRefresh(Q.headerTooltip);z(),this.addManagedEventListeners({newColumnsLoaded:z})}handleKeyDown(Q){switch(Q.key){case V.LEFT:Q.preventDefault(),this.modelItem.expanded=!1;break;case V.RIGHT:Q.preventDefault(),this.modelItem.expanded=!0;break;case V.SPACE:if(Q.preventDefault(),this.isSelectable())this.onSelectAllChanged(!this.isSelected());break}}onContextMenu(Q){let{columnGroup:z,gos:J}=this;if(J.get("functionsReadOnly"))return;let Z=this.createBean(new cY(z,Q,this.focusWrapper,this.params));this.addDestroyFunc(()=>{if(Z.isAlive())this.destroyBean(Z)})}addVisibilityListenersToAllChildren(){let Q=this.onColumnStateChanged.bind(this);for(let z of this.columnGroup.getLeafColumns())this.addManagedListeners(z,{visibleChanged:Q,columnValueChanged:Q,columnPivotChanged:Q,columnRowGroupChanged:Q})}setupDragging(){if(!this.allowDragging){N(this.eDragHandle,!1);return}let Q=this.beans,{gos:z,eventSvc:J,dragAndDrop:Z}=Q,$=!z.get("suppressDragLeaveHidesColumns"),X={type:qQ.ToolPanel,eElement:this.eDragHandle,dragItemName:this.displayName,getDefaultIconName:()=>$?"hide":"notAllowed",getDragItem:()=>this.createDragItem(),onDragStarted:()=>{$=!z.get("suppressDragLeaveHidesColumns"),J.dispatchEvent({type:"columnPanelItemDragStart",column:this.columnGroup})},onDragStopped:()=>{J.dispatchEvent({type:"columnPanelItemDragEnd"})},onGridEnter:(Y)=>{if($)wY(Q,{columns:this.columnGroup.getLeafColumns(),visibleState:Y?.visibleState,pivotState:Y?.pivotState,eventType:this.eventType,buttons:this.params.buttons})},onGridExit:()=>{if($)this.onChangeCommon(!1)}};Z.addDragSource(X,!0),this.addDestroyFunc(()=>Z.removeDragSource(X))}createDragItem(){let Q=this.columnGroup.getLeafColumns(),z={},J={},Z=this.beans.columnStateUpdateStrategy,$=i(this.params);for(let X of Q){let Y=X.getId();z[Y]=X.isVisible(),J[Y]=NY(X,Z,$)}return{columns:Q,visibleState:z,pivotState:J}}setupExpandContract(){let{beans:Q,eGroupClosedIcon:z,eGroupOpenedIcon:J,eColumnGroupIcons:Z}=this;z.appendChild(uZ("columnSelectClosed",Q,null)),J.appendChild(uZ("columnSelectOpen",Q,null));let $=this.onExpandOrContractClicked.bind(this);this.addManagedElementListeners(z,{click:$}),this.addManagedElementListeners(J,{click:$});let X=new h0(Z,!0);this.addManagedListeners(X,{tap:$}),this.addDestroyFunc(X.destroy.bind(X))}onLabelClicked(){let Q=!this.cbSelect.getValue();this.onChangeCommon(Q)}onCheckboxChanged(Q){this.onChangeCommon(Q.selected)}getVisibleLeafColumns(){let Q=[],z=(J)=>{for(let Z of J)if(Z.passesFilter)if(Z.group)z(Z.children);else Q.push(Z.column)};return z(this.modelItem.children),Q}onChangeCommon(Q){if(this.refreshAriaLabel(),this.processingColumnStateChange)return;yY(this.beans,this.modelItem.children,Q,this.eventType,this.params)}refreshAriaLabel(){let{cbSelect:Q,focusWrapper:z,displayName:J}=this,Z=this.getLocaleTextFunc(),$=Z("ariaColumnGroup","Column Group"),X=Q.getValue(),Y=X===void 0?Z("ariaIndeterminate","indeterminate"):X?Z("ariaVisible","visible"):Z("ariaHidden","hidden"),G=Z("ariaToggleVisibility","Press SPACE to toggle visibility");E0(z,`${J} ${$}`),Q.setInputAriaLabel(`${G} (${Y})`),MZ(z,Q.getInputElement().id)}onColumnStateChanged(){let Q=this.workOutSelectedValue(),z=this.workOutReadOnlyValue();this.processingColumnStateChange=!0;let J=this.cbSelect;J.setValue(Q),J.setReadOnly(z),this.toggleCss("ag-column-select-column-group-readonly",z),this.processingColumnStateChange=!1}workOutSelectedValue(){let z=this.beans.columnStateUpdateStrategy.getPivotMode(i(this.params)),J=this.getVisibleLeafColumns(),Z=0,$=0;for(let X of J)if(z||!X.getColDef().lockVisible)if(this.isColumnChecked(X))Z++;else $++;if(Z>0&&$>0)return;return Z>0}workOutReadOnlyValue(){let Q=this.beans.columnStateUpdateStrategy.getPivotMode(i(this.params)),z=0;for(let J of this.columnGroup.getLeafColumns())if(Q){if(J.isAnyFunctionAllowed())z++}else if(!J.getColDef().lockVisible)z++;return z===0}isColumnChecked(Q){let z=this.beans.columnStateUpdateStrategy;if(z.getPivotMode(i(this.params)))return z.isColumnSelectedInPivotModeToolPanel(i(this.params),Q);return z.isColumnVisibleInToolPanel(i(this.params),Q)}onExpandOrContractClicked(){let Q=this.modelItem,z=Q.expanded;Q.expanded=!z}onExpandChanged(){this.setOpenClosedIcons(),this.refreshAriaExpanded()}setOpenClosedIcons(){let Q=this.modelItem.expanded;N(this.eGroupClosedIcon,!Q),N(this.eGroupOpenedIcon,Q)}refreshAriaExpanded(){w0(this.focusWrapper,this.modelItem.expanded)}getDisplayName(){return this.displayName}onSelectAllChanged(Q){let z=this.cbSelect,J=z.getValue();if(!z.isReadOnly()&&(Q&&!J||!Q&&J))z.toggle()}isSelected(){return this.cbSelect.getValue()}isSelectable(){return!this.cbSelect.isReadOnly()}setSelected(Q){this.cbSelect.setValue(Q,!0)}},p6=(Q)=>{if(G0(Q))return Q.getLeafColumns();return Q?[Q]:[]},EA=(Q,z,J,Z)=>{if(!z||!Q)return null;let $=Z.indexOf(z),X=J?$:$+1,Y=KA(Z,Q,X);return X-Y},KA=(Q,z,J)=>{if(!z)return 0;let Z=z[0],$=z.length;if(Q.indexOf(Z){let $=i(Z);if(Q.get("suppressMovableColumns")||z.columnStateUpdateStrategy.getPivotMode($))return!0;return!!J.find(({colDef:G})=>!!G.suppressMovable||!!G.lockPosition)},pX=(Q,z,J,Z)=>{if(!J)return;let{component:$}=J,X=null,Y=J.position==="top";if($ instanceof pY)X=$.getColumns()[0],Y=!0;else if($)X=$.column;if(!X)return;let G=i(Z),q=G?Q.columnStateUpdateStrategy.getPrimaryColumns(G):Q.colModel.getCols(),H=EA(z,X,Y,q);if(H!=null)Q.columnStateUpdateStrategy.moveColumns(G,z,H,"toolPanelUi"),N0(Q,Z)},LA=(Q)=>{return Q.column},FA={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"}]},DA=class extends x{constructor(Q,z,J,Z,$){super();this.modelItem=Q,this.allowDragging=z,this.groupsExist=J,this.focusWrapper=Z,this.params=$,this.eLabel=S,this.cbSelect=S,this.processingColumnStateChange=!1;let{column:X,depth:Y,displayName:G}=Q;this.column=X,this.columnDepth=Y,this.displayName=G}postConstruct(){this.setTemplate(FA,[yQ]);let{beans:Q,cbSelect:z,displayName:J,eLabel:Z,columnDepth:$,groupsExist:X,column:Y,gos:G,focusWrapper:q}=this,H=h("columnDrag",Q);this.eDragHandle=H,H.classList.add("ag-drag-handle","ag-column-select-column-drag-handle");let _=z.getGui(),U=z.getInputElement();if(_.after(H),U.setAttribute("tabindex","-1"),Z.textContent=J,X)this.addCss("ag-column-select-add-group-indent");this.addCss(`ag-column-select-indent-${$}`),this.getGui().style.setProperty("--ag-indentation-level",String($)),this.tooltipFeature=this.createOptionalManagedBean(Q.registry.createDynamicBean("tooltipFeature",!1,{getGui:()=>this.focusWrapper,getLocation:()=>"columnToolPanelColumn",shouldDisplayTooltip:tZ(G,()=>Z),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(q,{keydown:this.handleKeyDown.bind(this),contextmenu:this.onContextMenu.bind(this)});let B=new h0(q);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(Z,{click:this.onLabelClicked.bind(this)}),this.onColumnStateChanged(),this.refreshAriaLabel(),this.setupTooltip();let E=hZ(Y.getColDef(),G,Y,null);for(let K of E)this.toggleCss(K,!0)}getColumn(){return this.column}setupTooltip(){let Q=()=>this.tooltipFeature?.setTooltipAndRefresh(this.column.getColDef().headerTooltip);Q(),this.addManagedEventListeners({newColumnsLoaded:Q})}onContextMenu(Q){let{column:z,gos:J}=this;if(J.get("functionsReadOnly"))return;let Z=this.createBean(new cY(z,Q,this.focusWrapper,this.params));this.addDestroyFunc(()=>{if(Z.isAlive())this.destroyBean(Z)})}handleKeyDown(Q){if(Q.key===V.SPACE){if(Q.preventDefault(),this.isSelectable())this.onSelectAllChanged(!this.isSelected())}}onLabelClicked(){if(this.gos.get("functionsReadOnly"))return;let Q=!this.cbSelect.getValue();this.onChangeCommon(Q)}onCheckboxChanged(Q){this.onChangeCommon(Q.selected)}onChangeCommon(Q){if(this.cbSelect.isReadOnly())return;if(this.refreshAriaLabel(),this.processingColumnStateChange)return;xY(this.beans,[this.column],Q,"toolPanelUi",this.params)}refreshAriaLabel(){let{cbSelect:Q,focusWrapper:z,displayName:J}=this,Z=this.getLocaleTextFunc(),$=Z("ariaColumn","Column"),X=Q.getValue()?Z("ariaVisible","visible"):Z("ariaHidden","hidden"),Y=Z("ariaToggleVisibility","Press SPACE to toggle visibility");E0(z,`${J} ${$}`),this.cbSelect.setInputAriaLabel(`${Y} (${X})`),MZ(z,Q.getInputElement().id)}setupDragging(){let Q=this.eDragHandle;if(!this.allowDragging){N(Q,!1);return}let z=this.beans,{gos:J,eventSvc:Z,dragAndDrop:$}=z;if(i(this.params))Q.setAttribute("data-column-tool-panel-deferred","");let X=!J.get("suppressDragLeaveHidesColumns"),Y={type:qQ.ToolPanel,eElement:Q,dragItemName:this.displayName,getDefaultIconName:()=>X&&!i(this.params)?"hide":"notAllowed",getDragItem:()=>this.createDragItem(),onDragStarted:()=>{X=!J.get("suppressDragLeaveHidesColumns"),Z.dispatchEvent({type:"columnPanelItemDragStart",column:this.column})},onDragStopped:()=>{Z.dispatchEvent({type:"columnPanelItemDragEnd"})},onGridEnter:(G)=>{if(X&&!i(this.params))wY(z,{columns:[this.column],visibleState:G?.visibleState,pivotState:G?.pivotState,eventType:"toolPanelUi",buttons:this.params.buttons})},onGridExit:()=>{if(X&&!i(this.params))this.onChangeCommon(!1)}};$.addDragSource(Y,!0),this.addDestroyFunc(()=>$.removeDragSource(Y))}createDragItem(){let Q=this.column.getColId(),z={[Q]:this.column.isVisible()},J=this.beans.columnStateUpdateStrategy,Z={[Q]:NY(this.column,J,i(this.params))};return{columns:[this.column],visibleState:z,pivotState:Z}}onColumnStateChanged(){this.processingColumnStateChange=!0;let Q=this.beans.columnStateUpdateStrategy,z=Q.getPivotMode(i(this.params));if(z){let $=Q.isColumnSelectedInPivotModeToolPanel(i(this.params),this.column);this.cbSelect.setValue($)}else this.cbSelect.setValue(Q.isColumnVisibleInToolPanel(i(this.params),this.column));let J=!0,Z=!0;if(z){let $=this.gos.get("functionsReadOnly"),X=!this.column.isAnyFunctionAllowed();J=!$&&!X,Z=J}else{let{enableRowGroup:$,enableValue:X,lockPosition:Y,suppressMovable:G,lockVisible:q}=this.column.getColDef(),H=!!$||!!X,_=!!Y||!!G;J=!q,Z=H||!_}this.cbSelect.setReadOnly(!J),this.eDragHandle.classList.toggle("ag-column-select-column-readonly",!Z),this.toggleCss("ag-column-select-column-readonly",!Z&&!J),this.cbSelect.setPassive(!1),this.processingColumnStateChange=!1}getDisplayName(){return this.displayName}onSelectAllChanged(Q){let z=this.cbSelect;if(Q!==z.getValue()){if(!z.isReadOnly())z.toggle()}}isSelected(){return this.cbSelect.getValue()}isSelectable(){return!this.cbSelect.isReadOnly()}isExpandable(){return!1}setExpanded(Q){R(158)}},MA=class{constructor(Q){this.items=Q}getRowCount(){return this.items.length}getRow(Q){return this.items[Q]}},kA="ag-column-select-list",VA=class extends x{constructor(){super({tag:"div",cls:kA,role:"presentation"});this.destroyColumnItemFuncs=[],this.hasLoadedInitialState=!1,this.isInitialState=!1,this.skipRefocus=!1}wireBeans(Q){this.colModel=Q.colModel}destroy(){this.destroyColumnTree(),super.destroy()}destroyColumnTree(){this.allColsTree=[];for(let Q of this.destroyColumnItemFuncs)Q();this.destroyColumnItemFuncs=[]}init(Q,z,J){this.params=Q;let{suppressSyncLayoutWithGrid:Z,contractColumnSelection:$,suppressColumnMove:X}=Q;if(this.allowDragging=z,this.eventType=J,!Z)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=!$;let G=X||Z,q=this.createManagedBean(new OY({cssIdentifier:"column-select",ariaRole:"tree",moveItemCallback:(H,_)=>{if(G)return;this.moveItems(H,_)}}));if(this.virtualList=q,this.appendChild(q.getGui()),q.setComponentCreator((H,_)=>{return O8(_,H.depth+1),this.createComponentFromItem(H,_)}),this.colModel.ready)this.onColumnsChanged();if(G)return;this.createItemDragFeature()}createItemDragFeature(){let{gos:Q,beans:z,virtualList:J}=this;this.createManagedBean(new Ff(this,J,{dragSourceType:qQ.ToolPanel,addListeners:(Z,$,X)=>{Z.addManagedEventListeners({columnPanelItemDragStart:$,columnPanelItemDragEnd:X})},getCurrentDragValue:(Z)=>LA(Z),isMoveBlocked:(Z)=>cX(Q,z,p6(Z),this.params),getNumRows:(Z)=>Z.getDisplayedColsList().length,moveItem:(Z,$)=>pX(z,p6(Z),$,this.params)}))}moveItems(Q,z){let{gos:J,beans:Z}=this,{modelItem:$}=Q,{group:X,columnGroup:Y,column:G,expanded:q}=$,H=p6(X?Y:G);if(cX(J,Z,H,this.params))return;let _=this.displayedColsList.indexOf($),U=z?-1:1,W=0;if(z){let E=Q.columnDepth>0?G.getParent()?.getChildren():null;if(E?.length&&G===E[0])W=-1}else if(X)W=q?$.children.length:0;let B=Math.min(Math.max(_+W+U,0),this.displayedColsList.length-1);this.skipRefocus=!0,pX(Z,H,{rowIndex:B,position:z?"top":"bottom",component:this.virtualList.getComponentAt(B)},this.params),this.focusRowIfAlive(B-W).then(()=>{this.skipRefocus=!1})}createComponentFromItem(Q,z){let J=this.allowDragging;if(Q.group){let $=new pY(Q,J,this.eventType,z,this.params);return this.createBean($),$}let Z=new DA(Q,J,this.groupsExist,z,this.params);return this.createBean(Z),Z}onColumnsChanged(){let Q=this.params;if(!this.hasLoadedInitialState)this.hasLoadedInitialState=!0,this.isInitialState=!!Q.initialState;let z=this.getExpandedStates(),J=this.colModel.isPivotMode(),Z=i(Q),$=Z&&this.beans.columnStateUpdateStrategy.hasDeferredColumnOrder(Z);if((!Q.suppressSyncLayoutWithGrid||Z)&&!J||$)this.buildTreeFromWhatGridIsDisplaying();else this.buildTreeFromProvidedColumnDefs();this.setExpandedStates(z),this.markFilteredColumns(),this.flattenAndFilterModel(),this.isInitialState=!1}getDisplayedColsList(){return this.displayedColsList}getExpandedStates(){let Q={};if(this.isInitialState){let{expandedGroupIds:z}=this.params.initialState;for(let J of z)Q[J]=!0;return Q}if(!this.allColsTree)return{};return this.forEachItem((z)=>{if(!z.group)return;let J=z.columnGroup;if(J)Q[J.getId()]=z.expanded}),Q}setExpandedStates(Q){if(!this.allColsTree)return;let{isInitialState:z}=this;this.forEachItem((J)=>{if(!J.group)return;let Z=J.columnGroup;if(Z){let $=Q[Z.getId()];if($!=null||z)J.expanded=!!$}})}buildTreeFromWhatGridIsDisplaying(){let Q=i(this.params);if(Q&&this.beans.columnStateUpdateStrategy.hasDeferredColumnOrder(Q)){let z=this.beans.columnStateUpdateStrategy.getPrimaryColumns(Q);if(z.length>0){zA(z,this.setColumnLayout.bind(this));return}}if(this.params.suppressSyncLayoutWithGrid){this.buildTreeFromProvidedColumnDefs();return}QA(this.colModel,this.setColumnLayout.bind(this))}setColumnLayout(Q){let z=ef(this.colModel,Q);this.buildListModel(z),this.groupsExist=Q.some((J)=>{return J&&typeof J.children<"u"}),this.markFilteredColumns(),this.flattenAndFilterModel()}buildTreeFromProvidedColumnDefs(){let Q=this.colModel;this.buildListModel(Q.getColDefColTree()),this.groupsExist=!!Q.colDefCols?.treeDepth}buildListModel(Q){let z=this.onColumnExpanded.bind(this),J=(G)=>{G.addEventListener("expandedChanged",z);let q=G.removeEventListener.bind(G,"expandedChanged",z);this.destroyColumnItemFuncs.push(q)},Z=this.beans.colNames,$=(G,q,H)=>{for(let _ of G)if(G0(_))X(_,q,H);else Y(_,q,H)},X=(G,q,H)=>{if(G.getColGroupDef()?.suppressColumnsToolPanel)return;if(G.isPadding()){$(G.getChildren(),q,H);return}let W=Z.getDisplayNameForProvidedColumnGroup(null,G,"columnToolPanel"),B=new hX(W,G,q,!0,this.expandGroupsByDefault);H.push(B),J(B),$(G.getChildren(),q+1,B.children)},Y=(G,q,H)=>{if(G.getColDef()?.suppressColumnsToolPanel)return;let U=Z.getDisplayNameForColumn(G,"columnToolPanel");H.push(new hX(U,G,q))};this.destroyColumnTree(),$(Q,0,this.allColsTree)}onColumnExpanded(){this.flattenAndFilterModel()}flattenAndFilterModel(){this.displayedColsList=[];let Q=(Z)=>{if(!Z.passesFilter)return;if(this.displayedColsList.push(Z),Z.group&&Z.expanded)Z.children.forEach(Q)},z=this.virtualList;this.allColsTree.forEach(Q),z.setModel(new MA(this.displayedColsList));let J=null;if(!this.skipRefocus)J=z.getLastFocusedRow();if(z.refresh(),J!=null)this.focusRowIfAlive(J);this.notifyListeners(),this.refreshAriaLabel()}refreshAriaLabel(){let Q=this.getLocaleTextFunc(),z=Q("ariaColumnPanelList","Column List"),J=Q("columns","Columns"),Z=this.displayedColsList.length;E0(this.virtualList.getAriaElement(),`${z} ${Z} ${J}`)}focusRowIfAlive(Q){if(Q===-1)return Promise.resolve();return new Promise((z)=>{window.setTimeout(()=>{if(this.isAlive())this.virtualList.focusRow(Q);z()},0)})}forEachItem(Q){let z=(Z)=>{for(let $ of Z)if(Q($),$.group)z($.children)},J=this.allColsTree;if(!J)return;z(J)}doSetExpandedAll(Q){this.forEachItem((z)=>{if(z.group)z.expanded=Q})}setGroupsExpanded(Q,z){if(!z){this.doSetExpandedAll(Q);return}let J=[];this.forEachItem(($)=>{if(!$.group)return;let X=$.columnGroup.getId();if(z.indexOf(X)>=0)$.expanded=Q,J.push(X)});let Z=z.filter(($)=>!J.includes($));if(Z.length>0)R(157,{unrecognisedGroupIds:Z})}getExpandState(){let Q=0,z=0;if(this.forEachItem((J)=>{if(!J.group)return;if(J.expanded)Q++;else z++}),Q>0&&z>0)return 2;if(z>0)return 1;return 0}doSetSelectedAll(Q){yY(this.beans,this.allColsTree,Q,this.eventType,this.params),this.syncVisibleSelectionState(),this.fireSelectionChangedEvent()}syncVisibleSelectionState(){for(let Q=0;Q{if($.group)return;if(!$.passesFilter)return;let X=$.column,Y=X.getColDef(),G;if(Z){if(!X.isAllowPivot()&&!X.isAllowRowGroup()&&!X.isAllowValue())return;G=J.isColumnSelectedInPivotModeToolPanel(i(this.params),X)??!1}else{if(Y.lockVisible)return;G=J.isColumnVisibleInToolPanel(i(this.params),X)??!1}if(G)Q++;else z++}),Q>0&&z>0)return;return!(Q===0||z>0)}setFilterText(Q){this.filterText=T(Q)?Q.toLowerCase():null,this.markFilteredColumns(),this.flattenAndFilterModel()}markFilteredColumns(){let Q=(J)=>{if(!T(this.filterText))return!0;let Z=J.displayName;return Z==null||Z.toLowerCase().indexOf(this.filterText)!==-1},z=(J,Z)=>{let $=!1;if(J.group){let Y=Q(J);for(let G of J.children){let q=z(G,Y||Z);if(q)$=q}}let X=Z||$?!0:Q(J);return J.passesFilter=X,X};for(let J of this.allColsTree)z(J,!1)}notifyListeners(){this.fireGroupExpandedEvent(),this.fireSelectionChangedEvent()}fireGroupExpandedEvent(){let Q=this.getExpandState();this.dispatchLocalEvent({type:"groupExpanded",state:Q})}fireSelectionChangedEvent(){if(!this.allColsTree)return;let Q=this.getSelectionState();this.dispatchLocalEvent({type:"selectionChanged",state:Q})}getExpandedGroups(){let Q=[];if(!this.allColsTree)return Q;return this.forEachItem((z)=>{if(z.group&&z.expanded)Q.push(z.columnGroup.getId())}),Q}},fA={selector:"AG-PRIMARY-COLS-LIST",component:VA},AA={tag:"div",cls:"ag-column-select",children:[{tag:"ag-primary-cols-header",ref:"primaryColsHeaderPanel"},{tag:"ag-primary-cols-list",ref:"primaryColsListPanel"}]},iY=class extends x{constructor(){super(AA,[of,fA]);this.primaryColsHeaderPanel=S,this.primaryColsListPanel=S,this.registerCSS(rf)}init(Q,z,J){let{primaryColsHeaderPanel:Z,primaryColsListPanel:$}=this;Z.init(z);let{suppressColumnFilter:X,suppressColumnSelectAll:Y}=z;if(z.suppressColumnExpandAll&&X&&Y)Z.setDisplayed(!1);this.addManagedListeners($,{groupExpanded:(q)=>{Z.setExpandState(q.state),z.onStateUpdated()},selectionChanged:(q)=>Z.setSelectionState(q.state)}),$.init(z,Q,J),this.addManagedListeners(Z,{expandAll:$.doSetExpandedAll.bind($,!0),collapseAll:$.doSetExpandedAll.bind($,!1),selectAll:$.doSetSelectedAll.bind($,!0),unselectAll:$.doSetSelectedAll.bind($,!1),filterChanged:(q)=>$.setFilterText(q.filterText)}),this.positionableFeature=this.createManagedBean(new UJ(this.getGui(),{minHeight:100}))}toggleResizable(Q){this.positionableFeature.setResizable(Q?{bottom:!0}:!1)}expandGroups(Q){this.primaryColsListPanel.setGroupsExpanded(!0,Q)}collapseGroups(Q){this.primaryColsListPanel.setGroupsExpanded(!1,Q)}setColumnLayout(Q){this.primaryColsListPanel.setColumnLayout(Q)}syncLayoutWithGrid(){this.primaryColsListPanel.onColumnsChanged()}getExpandedGroups(){return this.primaryColsListPanel.getExpandedGroups()}},jA=".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)}",RA="ag-column-panel-deferred",SA=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 Q=this.captureGridState();if(!this.beans.columnStateUpdateStrategy.hasPendingChanges(this.isDeferModeEnabled)){this.lastKnownGridState=Q;return}let z=this.lastKnownGridState&&this.isGridStateEqual(this.lastKnownGridState,Q);if(this.lastKnownGridState=Q,!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(jA)}wireBeans(Q){this.colToolPanelFactory=Q.colToolPanelFactory}setVisible(Q){if(super.setDisplayed(Q),Q&&!this.initialised)this.init(this.params)}init(Q){let J={...y(this.gos,{suppressColumnMove:!1,suppressColumnSelectAll:!1,suppressColumnFilter:!1,suppressColumnExpandAll:!1,contractColumnSelection:!1,suppressPivotMode:!1,suppressRowGroups:!1,suppressValues:!1,suppressPivots:!1,suppressSyncLayoutWithGrid:!1}),...Q};this.params=J;let{childDestroyFuncs:Z,colToolPanelFactory:$,gos:X}=this,Y=X.isModuleRegistered("SharedPivot"),G=Y||X.isModuleRegistered("SharedRowGrouping");if(this.isDeferModeEnabled=i(J),this.toggleCss(RA,this.isDeferModeEnabled),!J.suppressPivotMode&&$&&Y)this.pivotModePanel=$.createPivotModePanel(this,Z,J,this.onPivotModePanelValueChanged);let q=this.createBean(new iY);if(this.primaryColsPanel=q,Z.push(()=>this.destroyBean(this.primaryColsPanel)),q.init(!0,J,"toolPanelUi"),q.addCss("ag-column-panel-column-select"),this.appendChild(q),$){if(!J.suppressRowGroups&&G)this.rowGroupDropZonePanel=$.createRowGroupPanel(this,Z,J);if(!J.suppressValues&&G)this.valuesDropZonePanel=$.createValuesPanel(this,Z,J);if(!J.suppressPivots&&Y)this.pivotDropZonePanel=$.createPivotPanel(this,Z,J);this.setLastVisible();let[H]=this.addManagedEventListeners({columnPivotModeChanged:()=>{this.resetChildrenHeight(),this.setLastVisible()}});Z.push(()=>H())}if(this.isDeferModeEnabled){let H=this.onExternalGridChange;Z.push(...this.addManagedEventListeners({columnEverythingChanged:this.onColumnEverythingChanged,sortChanged:H,columnVisible:H,columnRowGroupChanged:H,columnValueChanged:H,columnPivotChanged:H,columnPivotModeChanged:H,newColumnsLoaded:H,...J.suppressSyncLayoutWithGrid?{}:{columnMoved:H}}))}if(J.buttons){if(!J.buttons.includes("apply"))R(298);if(J.buttons.length)this.initDeferredButtons(J.buttons)}this.initialised=!0}initDeferredButtons(Q){let z=this.createBean(new y6({className:"ag-column-panel-buttons"}));this.deferredButtonsComp=z,this.childDestroyFuncs.push(()=>{this.deferredButtonsComp=this.destroyBean(this.deferredButtonsComp)});let J=this.getLocaleTextFunc(),Z=Q.map(($)=>({type:$,label:J($==="apply"?"applyColumnToolPanel":"cancelColumnToolPanel",$==="apply"?"Apply":"Cancel")}));z.updateButtons(Z),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:Q}=this,z=(J)=>(J??[]).map((Z)=>Z.getColId());return{rowGroupColIds:z(Q.rowGroupColsSvc?.columns),valueColIds:z(Q.valueColsSvc?.columns),pivotColIds:z(Q.pivotColsSvc?.columns),pivotMode:Q.colModel.isPivotMode(),columnOrder:Q.colModel.getCols().map((J)=>J.getColId()),visibleColIds:Q.colModel.getCols().filter((J)=>J.isVisible()).map((J)=>J.getColId()),sortState:Q.colModel.getCols().filter((J)=>J.getSort()).map((J)=>`${J.getColId()}:${J.getSort()}:${J.getSortIndex()}`),aggFuncState:(Q.valueColsSvc?.columns??[]).map((J)=>J.getAggFunc()),widthState:Q.colModel.getCols().map((J)=>`${J.getColId()}:${J.getActualWidth()}`)}}isGridStateEqual(Q,z){return X0(Q.rowGroupColIds,z.rowGroupColIds)&&X0(Q.valueColIds,z.valueColIds)&&X0(Q.pivotColIds,z.pivotColIds)&&Q.pivotMode===z.pivotMode&&X0(Q.columnOrder,z.columnOrder)&&X0(Q.visibleColIds,z.visibleColIds)&&X0(Q.sortState,z.sortState)&&X0(Q.aggFuncState,z.aggFuncState)&&X0(Q.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(Q){let z=this.colToolPanelFactory;if(!z)return;this.pivotModePanel=z.setPanelVisible(this.pivotModePanel,Q,z.createPivotModePanel.bind(z,this,this.childDestroyFuncs,this.params,this.onPivotModePanelValueChanged,!0)),this.setLastVisible()}setRowGroupsSectionVisible(Q){let z=this.colToolPanelFactory;if(!z)return;this.rowGroupDropZonePanel=z.setPanelVisible(this.rowGroupDropZonePanel,Q,z.createRowGroupPanel.bind(z,this,this.childDestroyFuncs,this.params)),this.setLastVisible()}setValuesSectionVisible(Q){let z=this.colToolPanelFactory;if(!z)return;this.valuesDropZonePanel=z.setPanelVisible(this.valuesDropZonePanel,Q,z.createValuesPanel.bind(z,this,this.childDestroyFuncs,this.params)),this.setLastVisible()}setPivotSectionVisible(Q){let z=this.colToolPanelFactory;if(!z)return;this.pivotDropZonePanel=z.setPanelVisible(this.pivotDropZonePanel,Q,z.createPivotPanel.bind(z,this,this.childDestroyFuncs,this.params)),this.pivotDropZonePanel?.setDisplayed(Q),this.setLastVisible()}setResizers(){for(let Q of[this.primaryColsPanel,this.rowGroupDropZonePanel,this.valuesDropZonePanel,this.pivotDropZonePanel]){if(!Q)continue;let z=Q.getGui();Q.toggleResizable(!z.classList.contains("ag-last-column-drop")&&!z.classList.contains("ag-hidden")&&!z.classList.contains("ag-last-visible-child"))}}setLastVisible(){let Q=this.getGui(),z=Array.prototype.slice.call(Q.querySelectorAll(".ag-column-drop"));for(let $ of z)$.classList.remove("ag-last-column-drop");let J=Q.querySelectorAll(".ag-column-drop:not(.ag-hidden)"),Z=b(J);if(Z)Z.classList.add("ag-last-column-drop");this.primaryColsPanel.getGui().classList.toggle("ag-last-visible-child",!Z),this.setResizers()}resetChildrenHeight(){let z=this.getGui().children;for(let J=0;JX.getGui().getBoundingClientRect()),$=Z.findIndex((X)=>this.horizontal?X.right>J&&X.leftJ);if($===-1){let X=this.gos.get("enableRtl");if(Z.every((q)=>J>(this.horizontal?q.right:q.bottom)))return X&&this.horizontal?0:this.childPillComponents.length;if(Z.every((q)=>J<(this.horizontal?q.left:q.top)))return X&&this.horizontal?this.childPillComponents.length:0;return this.insertIndex}if(this.insertIndex<=$)return $+1;return $}checkDragStartedBySelf(Q){if(this.state!=="notDragging")return;this.state="rearrangeItems",this.potentialDndItems=this.getItems(Q.dragSource.getDragItem()),this.refreshGui(),this.checkInsertIndex(Q),this.refreshGui()}onDragging(Q){if(this.checkDragStartedBySelf(Q),this.checkInsertIndex(Q))this.refreshGui()}handleDragEnterEnd(Q){}onDragEnter(Q){let z=this.getItems(Q.dragSource.getDragItem());this.state="newItemsIn";let J=z.filter(($)=>this.isItemDroppable($,Q)),Z=J.every(($)=>this.childPillComponents.map((X)=>X.getItem()).indexOf($)!==-1);if(J.length===0)return;if(this.potentialDndItems=J,Z){this.state="notDragging";return}this.handleDragEnterEnd(Q),this.checkInsertIndex(Q),this.refreshGui()}isPotentialDndItems(){return!!this.potentialDndItems?.length}handleDragLeaveEnd(Q){}onDragLeave(Q){if(this.state==="rearrangeItems"){let z=this.getItems(Q.dragSource.getDragItem());this.removeItems(z)}if(this.isPotentialDndItems())this.handleDragLeaveEnd(Q),this.potentialDndItems=[],this.refreshGui();this.state="notDragging"}onDragCancel(Q){if(this.isPotentialDndItems()){if(this.state==="newItemsIn")this.handleDragLeaveEnd(Q);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(Q){let z=this.getExistingItems().filter((J)=>!Q.includes(J));this.updateItems(z),this.refreshGui()}addItems(Q){if(!Q)return;let z=this.getExistingItems().slice(),J=Q.filter((Z)=>z.indexOf(Z)<0);iX(z,J,this.insertIndex),this.updateItems(z),this.refreshGui()}addItem(Q){this.insertIndex=this.getExistingItems().length,this.addItems([Q])}rearrangeItems(Q,z){let J;if(!z)J=this.getNonGhostItems().slice();else J=this.getExistingItems().filter((Z)=>Q.indexOf(Z)===-1);if(iX(J,Q,this.insertIndex),X0(J,this.getExistingItems()))return!1;return this.updateItems(J),this.refreshGui(),!0}refreshGui(){let Q=0;if(!this.horizontal)Q=this.ePillDropList.scrollTop;let z=this.resizeEnabled,J=this.getFocusedItem(),{eGridDiv:Z}=this.beans,$=V1(),X=null;if($)X=R0(this.beans,Z)??R0(this.beans,Z,!1,!0);if(this.toggleResizable(!1),this.destroyGui(),this.addIconAndTitleToGui(),this.addEmptyMessageToGui(),this.addItemsToGui(),Q!==0)this.ePillDropList.scrollTop=Q;if(z)this.toggleResizable(z);if($)this.restoreFocus(J,X)}getFocusedItem(){let Q=this.getGui(),z=d(this.beans);if(!Q.contains(z))return-1;return Array.from(Q.querySelectorAll(".ag-column-drop-cell")).indexOf(z)}focusItemAtIndex(Q){let z=this.getGui(),Z=Array.from(z.querySelectorAll(".ag-column-drop-cell"))[Q];if(!Z)return;Z.focus({preventScroll:!0})}restoreFocus(Q,z){let J=this.getGui(),Z=Array.from(J.querySelectorAll(".ag-column-drop-cell"));if(Q===-1)return;if(Z.length===0)z.focus();let $=Math.min(Z.length-1,Q),X=Z[$];if(X)X.focus()}focusList(Q){let z=Q?this.childPillComponents.length-1:0;this.restoreFocus(z,this.getFocusableElement())}getNonGhostItems(){let Q=this.getExistingItems();if(this.isPotentialDndItems())return Q.filter((z)=>!this.potentialDndItems.includes(z));return Q}addItemsToGui(){let z=this.getNonGhostItems().map((J)=>this.createItemComponent(J,!1));if(this.isPotentialDndItems()){let J=this.potentialDndItems.map((Z)=>this.createItemComponent(Z,!0));if(this.insertIndex>=z.length)z.push(...J);else z.splice(this.insertIndex,0,...J)}this.appendChild(this.ePillDropList),z.forEach((J,Z)=>{if(Z>0)this.addArrow(this.ePillDropList);this.ePillDropList.appendChild(J.getGui())}),this.addAriaLabelsToComponents()}addAriaLabelsToComponents(){let{childPillComponents:Q,ePillDropList:z}=this,J=Q.length;H0(z,J===0?"presentation":"listbox");for(let Z=0;Zthis.destroyBean(J)),!z)this.childPillComponents.push(J);return J}addIconAndTitleToGui(){let{title:Q,icon:z}=this.params;if(!Q||!z)return;let J=Z0({tag:"div"});if(kZ(J,!0),this.addElementClasses(J,"title-bar"),this.addElementClasses(z,"icon"),this.toggleCss("ag-column-drop-empty",this.isExistingItemsEmpty()),J.appendChild(z),!this.horizontal){let Z=Z0({tag:"span"});this.addElementClasses(Z,"title"),Z.textContent=Q,J.appendChild(Z)}this.appendChild(J)}isExistingItemsEmpty(){return this.getExistingItems().length===0}addEmptyMessageToGui(){let{emptyMessage:Q}=this.params;if(!Q||!this.isExistingItemsEmpty()||this.isPotentialDndItems())return;let z=Z0({tag:"span"});z.textContent=Q,this.addElementClasses(z,"empty-message"),this.ePillDropList.appendChild(z)}addArrow(Q){if(this.horizontal){let z=this.gos.get("enableRtl"),J=h(z?"panelDelimiterRtl":"panelDelimiter",this.beans);this.addElementClasses(J,"cell-separator"),Q.appendChild(J)}}},vA={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"}]},IA=class extends x{constructor(Q,z,J,Z,$){super();this.dragSourceDropTarget=Q,this.ghost=z,this.horizontal=J,this.template=Z,this.agComponents=$,this.eText=S,this.eDragHandle=S,this.eButton=S}postConstruct(){this.setTemplate(this.template??vA,this.agComponents);let Q=this.getGui(),{beans:z,eDragHandle:J,eText:Z,eButton:$}=this;if(this.addElementClasses(Q),this.addElementClasses(J,"drag-handle"),this.addElementClasses(Z,"text"),this.addElementClasses($,"button"),J.appendChild(h("columnDrag",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 Q=this.getLocaleTextFunc(),z=[this.getAriaDisplayName()];this.addAdditionalAriaInstructions(z,Q),E0(this.getGui(),z.join(". "))}addAdditionalAriaInstructions(Q,z){if(this.isRemovable()){let J=z("ariaDropZoneColumnComponentDescription","Press DELETE to remove");Q.push(J)}}setupTooltip(){let Q=()=>this.tooltipFeature?.setTooltipAndRefresh(this.getTooltip());Q(),this.addManagedEventListeners({newColumnsLoaded:Q})}getDragSourceId(){return}getDefaultIconName(){return"notAllowed"}addDragSource(){let{beans:{dragAndDrop:Q},eDragHandle:z}=this,J=this.createGetDragItem(),Z=this.getDefaultIconName(),$={type:this.getDragSourceType(),sourceId:this.getDragSourceId(),eElement:z,getDefaultIconName:()=>Z,getDragItem:J,dragItemName:this.getDisplayName()};Q?.addDragSource($,!0),this.addDestroyFunc(()=>Q?.removeDragSource($))}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 Q={type:"columnRemove"};this.addGuiEventListener("keydown",(J)=>this.onKeyDown(J)),this.addManagedElementListeners(this.eButton,{click:(J)=>{this.dispatchLocalEvent(Q),J.stopPropagation()}});let z=new h0(this.eButton);this.addManagedListeners(z,{tap:()=>this.dispatchLocalEvent(Q)}),this.addDestroyFunc(z.destroy.bind(z))}onKeyDown(Q){if(Q.key===V.DELETE){if(this.isRemovable())Q.preventDefault(),this.dispatchLocalEvent({type:"columnRemove"})}}getDisplayValue(){return this.getDisplayName()}addElementClasses(Q,z){z=z?`-${z}`:"";let J=this.horizontal?"horizontal":"vertical";Q.classList.add(`ag-column-drop-cell${z}`,`ag-column-drop-${J}-cell${z}`)}destroy(){super.destroy(),this.dragSourceDropTarget=null}},CA=class extends IA{constructor(Q,z,J,Z,$,X){super(z,J,$);this.column=Q,this.dropZonePurpose=Z,this.updateParams=X,this.eSortIndicator=S,this.popupShowing=!1,this.deferApply=i(X)}postConstruct(){let{sortSvc:Q,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"}},Q?{tag:"ag-sort-indicator",ref:"eSortIndicator"}:void 0,{tag:"span",ref:"eButton",cls:"ag-column-drop-cell-button",role:"presentation"}]},Q)this.agComponents=[Q.getSortIndicatorSelector()];if(this.displayName=z.getDisplayNameForColumn(this.column,"columnDrop"),super.postConstruct(),this.deferApply)this.eDragHandle.setAttribute("data-column-tool-panel-deferred","");if(Q)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(Q,z){let J=this.gos.get("rowGroupPanelSuppressSort"),Z=this.gos.get("functionsReadOnly");if(this.isAggregationZone()&&!Z){let $=z("ariaDropZoneColumnValueItemDescription","Press ENTER to change the aggregation type");Q.push($)}if(this.isGroupingZone()&&this.column.isSortable()&&!J){let $=z("ariaDropZoneColumnGroupItemDescription","Press ENTER to sort");Q.push($)}super.addAdditionalAriaInstructions(Q,z)}isMovable(){return this.isDraggable()}isDraggable(){return this.isReadOnly()}isRemovable(){return this.isReadOnly()}isReadOnly(){return!this.isGroupingAndLocked()&&!this.gos.get("functionsReadOnly")}getAriaDisplayName(){let Q=this.getLocaleTextFunc(),{name:z,aggFuncName:J}=this.getColumnAndAggFuncName(),Z=Q("ariaDropZoneColumnComponentAggFuncSeparator"," of "),$={asc:Q("ariaDropZoneColumnComponentSortAscending","ascending"),desc:Q("ariaDropZoneColumnComponentSortDescending","descending")},X=this.getCurrentSortDirection(this.column),Y=this.gos.get("rowGroupPanelSuppressSort");return[J&&`${J}${Z}`,z,this.isGroupingZone()&&!Y&&X&&`, ${$[X]}`].filter((G)=>!!G).join("")}getColumnAndAggFuncName(){let Q=this.displayName,z="";if(this.isAggregationZone()){let J=this.beans.columnStateUpdateStrategy.getColumnAggFunc(this.deferApply,this.column),Z=typeof J==="string"?J:"agg";z=this.getLocaleTextFunc()(Z,Z)}return{name:Q,aggFuncName:z}}setupSort(){if(!this.column.isSortable()||!this.isGroupingZone())return;let{gos:Q,column:z,eSortIndicator:J}=this;if(!Q.get("rowGroupPanelSuppressSort")){J.setupSort(z,!0,this.getSortDefOverride.bind(this));let Z=($)=>{$.preventDefault(),this.beans.columnStateUpdateStrategy.progressSortFromEvent(this.deferApply,z,$),J.refresh(),this.setupAria(),N0(this.beans,this.updateParams)};this.addGuiEventListener("click",Z),this.addGuiEventListener("keydown",($)=>{if($.key===V.ENTER&&this.isGroupingZone())Z($)})}}getCurrentSortDirection(Q){return this.beans.columnStateUpdateStrategy.getSortDef(this.deferApply,Q)?.direction??null}getSortDefOverride(){if(!this.deferApply)return;return this.beans.columnStateUpdateStrategy.getSortDef(this.deferApply,this.column)}getDefaultIconName(){return"hide"}createGetDragItem(){let{column:Q}=this;return()=>{let z={};return z[Q.getId()]=Q.isVisible(),{columns:[Q],visibleState:z}}}setupComponents(){if(super.setupComponents(),this.isAggregationZone()&&!this.gos.get("functionsReadOnly"))this.addGuiEventListener("click",this.onShowAggFuncSelection.bind(this))}onKeyDown(Q){if(super.onKeyDown(Q),Q.key===V.ENTER&&this.isAggregationZone()&&!this.gos.get("functionsReadOnly"))Q.preventDefault(),this.onShowAggFuncSelection()}getDisplayValue(){let{name:Q,aggFuncName:z}=this.getColumnAndAggFuncName();return this.isAggregationZone()?`${z}(${Q})`:Q}onShowAggFuncSelection(){if(this.popupShowing)return;this.popupShowing=!0;let{aggFuncSvc:Q,popupSvc:z}=this.beans,J=new OY({cssIdentifier:"select-agg-func"}),Z=Q.getFuncNames(this.column),$=this.getGui(),X=J.getGui();J.setModel({getRow:function(B){return Z[B]},getRowCount:function(){return Z.length}}),this.createBean(J);let Y=Z0({tag:"div",cls:"ag-select-agg-func-popup"});Y.style.top="0px",Y.style.left="0px",Y.appendChild(X),Y.style.width=`${$.clientWidth}px`;let[G]=this.addManagedElementListeners(Y,{focusout:(B)=>{if(!Y.contains(B.relatedTarget)&&_)_.hideFunc()}}),q=(B)=>{if(this.destroyBean(J),this.popupShowing=!1,B?.key==="Escape")$.focus();if(G)G()},H=this.getLocaleTextFunc(),_=z.addPopup({modal:!0,eChild:Y,closeOnEsc:!0,closedCallback:q,ariaLabel:H("ariaLabelAggregationFunction","Aggregation Function")});if(_)J.setComponentCreator(this.createAggSelect.bind(this,_.hideFunc));J.addGuiEventListener("keydown",(B)=>{if(B.key===V.ENTER||B.key===V.SPACE){let E=J.getLastFocusedRow();if(E==null)return;let K=J.getComponentAt(E);if(K)K.selectItem()}}),z.positionPopupByComponent({type:"aggFuncSelect",eventSource:$,ePopup:Y,keepWithinBounds:!0,additionalParams:{column:this.column},position:"under"}),J.refresh();let U=this.beans.columnStateUpdateStrategy.getColumnAggFunc(this.deferApply,this.column),W=Z.findIndex((B)=>B===U);if(W===-1)W=0;J.focusRow(W)}createAggSelect(Q,z){let J=()=>{if(Q(),this.getGui().focus(),this.beans.columnStateUpdateStrategy.setColumnAggFunc(this.deferApply,this.column,z,"toolPanelDragAndDrop"),this.column){let G=this.getGui().querySelector(".ag-column-drop-cell-text");if(G)G.textContent=this.getDisplayValue();this.setupAria()}N0(this.beans,this.updateParams)},Z=this.getLocaleTextFunc(),$=(z||"").toString(),X=Z($,$);return new bA(J,X)}isGroupingAndLocked(){return this.isGroupingZone()&&TJ(this.column,this.beans)}isAggregationZone(){return this.dropZonePurpose==="aggregation"}isGroupingZone(){return this.dropZonePurpose==="rowGroup"}getDragSourceType(){return qQ.ToolPanel}destroy(){super.destroy(),this.column=null}},bA=class extends x{constructor(Q,z){super({tag:"div",cls:"ag-select-agg-func-item",children:z});this.selectItem=Q,this.addGuiEventListener("click",this.selectItem)}},Y7=class extends TA{constructor(Q,z,J){super(Q);this.dropZonePurpose=z,this.updateParams=J,this.addElementClasses(this.getGui(),this.dropZonePurpose.toLowerCase())}init(Q){super.init(Q),this.addManagedEventListeners({newColumnsLoaded:this.refreshGui.bind(this)}),this.addManagedPropertyListeners(["functionsReadOnly","rowGroupPanelSuppressSort","groupLockGroupColumns"],this.refreshGui.bind(this))}getItems(Q){return Q.columns??[]}isInterestedIn(Q,z){if(Q===qQ.HeaderCell)return!0;if(Q!==qQ.ToolPanel)return!1;if(!this.horizontal)return!0;return!z.hasAttribute("data-column-tool-panel-deferred")}minimumAllowedNewInsertIndex(){let{gos:Q,rowGroupColsSvc:z}=this.beans,J=Q.get("groupLockGroupColumns"),Z=z?.columns.length??0;if(J===-1)return Z;return Math.min(J,Z)}showOrHideColumnOnExit(Q){return this.isRowGroupPanel()&&TZ(this.gos,!0)&&!Q.fromNudge}handleDragEnterEnd(Q){if(this.showOrHideColumnOnExit(Q)){let Z=Q.dragSource.getDragItem().columns;this.setColumnsVisible(Z,!1,"uiColumnDragged")}}handleDragLeaveEnd(Q){if(this.showOrHideColumnOnExit(Q)){let J=Q.dragSource.getDragItem();this.setColumnsVisible(J.columns,!0,"uiColumnDragged")}}setColumnsVisible(Q,z,J){if(!Q)return;if(i(this.updateParams))return;let Z=Q.filter(($)=>!$.getColDef().lockVisible);this.beans.columnStateUpdateStrategy.setColumnsVisible(!1,Z,z,J)}isRowGroupPanel(){return this.dropZonePurpose==="rowGroup"}createPillComponent(Q,z,J,Z){return new CA(Q,z,J,this.dropZonePurpose,Z,this.updateParams)}},yA=class extends Y7{constructor(Q,z){super(Q,"pivot",z)}postConstruct(){let Q=this.getLocaleTextFunc(),z=Q("pivotColumnsEmptyMessage","Drag here to set column labels"),J=Q("pivots","Column Labels");if(super.init({icon:h("pivotPanel",this.beans,null),emptyMessage:z,title:J}),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 Q=this.beans.colModel,z=Q.isPivotMode();if(this.horizontal)switch(this.gos.get("pivotPanelShow")){case"always":this.setDisplayed(z);break;case"onlyWhenPivoting":{let J=Q.isPivotActive();this.setDisplayed(z&&J);break}default:this.setDisplayed(!1);break}else this.setDisplayed(this.beans.columnStateUpdateStrategy.getPivotMode(i(this.updateParams)))}isItemDroppable(Q,z){if(this.gos.get("functionsReadOnly")||!Q.isPrimary())return!1;let J=this.beans.columnStateUpdateStrategy.getPivotColumns(i(this.updateParams)).includes(Q);return Q.isAllowPivot()&&(!J||this.isSourceEventFromTarget(z))}updateItems(Q){this.beans.columnStateUpdateStrategy.setPivotColumns(i(this.updateParams),Q,"toolPanelUi"),N0(this.beans,this.updateParams)}getIconName(){return this.isPotentialDndItems()?"pivot":"notAllowed"}getExistingItems(){return this.beans.columnStateUpdateStrategy.getPivotColumns(i(this.updateParams))}getFocusableContainerName(){return"pivotToolbar"}},xA=class extends Y7{constructor(Q,z){super(Q,"rowGroup",z)}postConstruct(){let Q=this.getLocaleTextFunc(),z=Q("rowGroupColumnsEmptyMessage","Drag here to set row groups"),J=Q("groups","Row Groups");if(super.init({icon:h("rowGroupPanel",this.beans,null),emptyMessage:z,title:J}),this.horizontal)Bz(this.beans,this,this.getGui());this.addManagedEventListeners({columnRowGroupChanged:this.refreshGui.bind(this)})}getAriaLabel(){return this.getLocaleTextFunc()("ariaRowGroupDropZonePanelLabel","Row Groups")}isItemDroppable(Q,z){if(this.gos.get("functionsReadOnly")||!Q.isPrimary()||Q.colDef.showRowGroup)return!1;let J=this.beans.columnStateUpdateStrategy.getRowGroupColumns(i(this.updateParams)).includes(Q);return Q.isAllowRowGroup()&&(!J||this.isSourceEventFromTarget(z))}updateItems(Q){this.beans.columnStateUpdateStrategy.setRowGroupColumns(i(this.updateParams),Q,"toolPanelUi"),N0(this.beans,this.updateParams)}getIconName(){return this.isPotentialDndItems()?"group":"notAllowed"}getExistingItems(){return this.beans.columnStateUpdateStrategy.getRowGroupColumns(i(this.updateParams))}getFocusableContainerName(){return"rowGroupToolbar"}},wA=class extends Y7{constructor(Q,z){super(Q,"aggregation",z)}postConstruct(){let Q=this.getLocaleTextFunc(),z=Q("valueColumnsEmptyMessage","Drag here to aggregate"),J=Q("values","Values");super.init({icon:h("valuePanel",this.beans,null),emptyMessage:z,title:J}),this.addManagedEventListeners({columnValueChanged:this.refreshGui.bind(this)})}getAriaLabel(){return this.getLocaleTextFunc()("ariaValuesDropZonePanelLabel","Values")}getIconName(){return this.isPotentialDndItems()?"aggregate":"notAllowed"}isItemDroppable(Q,z){if(this.gos.get("functionsReadOnly")||!Q.isPrimary())return!1;let J=this.beans.columnStateUpdateStrategy.getValueColumns(i(this.updateParams)).includes(Q);return Q.isAllowValue()&&(!J||this.isSourceEventFromTarget(z))}updateItems(Q){this.beans.columnStateUpdateStrategy.setValueColumns(i(this.updateParams),Q,"toolPanelUi"),N0(this.beans,this.updateParams)}getExistingItems(){return this.beans.columnStateUpdateStrategy.getValueColumns(i(this.updateParams))}},NA={tag:"div",cls:"ag-pivot-mode-panel",children:[{tag:"ag-toggle-button",ref:"cbPivotMode",cls:"ag-pivot-mode-select"}]},gA=class extends x{constructor(Q,z){super();this.params=Q,this.onPivotModeValueChanged=z,this.cbPivotMode=S}getCurrentPivotMode(){return this.beans.columnStateUpdateStrategy.getPivotMode(i(this.params))}syncFromGrid(){this.cbPivotMode.setValue(this.getCurrentPivotMode())}refreshEditStrategy(){this.syncFromGrid()}postConstruct(){this.setTemplate(NA,[OX]);let Q=this.cbPivotMode;Q.setValue(this.getCurrentPivotMode());let z=this.getLocaleTextFunc();Q.setLabel(z("pivotMode","Pivot Mode"));let J=()=>{let $=!!Q.getValue();this.beans.columnStateUpdateStrategy.setPivotMode(i(this.params),$,"toolPanelUi"),this.onPivotModeValueChanged?.()},Z=()=>{Q.setValue(this.getCurrentPivotMode())};this.addManagedListeners(Q,{fieldValueChanged:J}),this.addManagedEventListeners({newColumnsLoaded:Z,columnPivotModeChanged:Z})}},hA=class extends j{constructor(){super(...arguments);this.beanName="colToolPanelFactory"}setPanelVisible(Q,z,J){if(Q)Q.setDisplayed(z);else if(z)Q=J();return Q}createRowGroupPanel(Q,z,J){return this.createPanel(Q,z,new xA(!1,J))}createValuesPanel(Q,z,J){return this.createPanel(Q,z,new wA(!1,J))}createPivotPanel(Q,z,J){return this.createPanel(Q,z,new yA(!1,J))}createPivotModePanel(Q,z,J,Z,$){return this.createPanel(Q,z,new gA(J,Z),$)}createPanel(Q,z,J,Z){if(J=Q.createBean(J),z.push(()=>Q.destroyBean(J)),Z)Q.prependChild(J);else Q.appendChild(J);return J}},nX=()=>{},uA=class extends j{constructor(){super(...arguments);this.beanName="columnStateUpdateExecutionStrategy"}applyColumnState(Q,z,J){this.getUpdateStrategy(Q).applyColumnState(z,J)}commit(Q){this.getUpdateStrategy(Q).commit()}hasPendingChanges(Q){return this.getUpdateStrategy(Q).hasPendingChanges()}moveColumns(Q,z,J,Z){this.getUpdateStrategy(Q).moveColumns(z,J,Z)}reset(Q){this.getUpdateStrategy(Q).reset()}setColumnsVisible(Q,z,J,Z){this.getUpdateStrategy(Q).setColumnsVisible(z,J,Z)}isColumnVisibleInToolPanel(Q,z){return this.getUpdateStrategy(Q).isColumnVisibleInToolPanel(z)}setRowGroupColumns(Q,z,J){this.getUpdateStrategy(Q).setRowGroupColumns(z,J)}getRowGroupColumns(Q){return this.getUpdateStrategy(Q).getRowGroupColumns()}getPrimaryColumns(Q){return this.getUpdateStrategy(Q).getPrimaryColumns()}hasDeferredColumnOrder(Q){return this.getUpdateStrategy(Q).hasDeferredColumnOrder()}setValueColumns(Q,z,J){this.getUpdateStrategy(Q).setValueColumns(z,J)}getValueColumns(Q){return this.getUpdateStrategy(Q).getValueColumns()}setColumnAggFunc(Q,z,J,Z){this.getUpdateStrategy(Q).setColumnAggFunc(z,J,Z)}getColumnAggFunc(Q,z){return this.getUpdateStrategy(Q).getColumnAggFunc(z)}setPivotColumns(Q,z,J){this.getUpdateStrategy(Q).setPivotColumns(z,J)}getPivotColumns(Q){return this.getUpdateStrategy(Q).getPivotColumns()}setPivotMode(Q,z,J){this.getUpdateStrategy(Q).setPivotMode(z,J)}getPivotMode(Q){return this.getUpdateStrategy(Q).getPivotMode()}isColumnSelectedInPivotModeToolPanel(Q,z){return this.getUpdateStrategy(Q).isColumnSelectedInPivotModeToolPanel(z)}progressSortFromEvent(Q,z,J){this.getUpdateStrategy(Q).progressSortFromEvent(z,J)}getSortDef(Q,z){return this.getUpdateStrategy(Q).getSortDef(z)}getUpdateStrategy(Q){return Q?this.getDeferredUpdateStrategy():this.getSyncUpdateStrategy()}getSyncUpdateStrategy(){return this.syncUpdateStrategy??(this.syncUpdateStrategy=new mA(this.beans))}getDeferredUpdateStrategy(){return this.deferredUpdateStrategy??(this.deferredUpdateStrategy=new cA(this.beans))}},mA=class{constructor(Q){this.beans=Q,this.lastPivotColIds=[],this.reset=nX,this.commit=nX,this.hasPendingChanges=()=>!1,this.hasDeferredColumnOrder=()=>!1}applyColumnState(Q,z){if(Q.length===0)return;n0(this.beans,{state:Q},z)}moveColumns(Q,z,J){this.beans.colMoves?.moveColumns(Q,z,J),pA(this.beans)}setColumnsVisible(Q,z,J){let Z=Q.filter(($)=>!$.getColDef().lockVisible);this.beans.colModel.setColsVisible(Z,z,J)}setRowGroupColumns(Q,z){this.beans.rowGroupColsSvc?.setColumns(Q,z)}getRowGroupColumns(){return this.beans.rowGroupColsSvc?.columns??[]}getPrimaryColumns(){return G7(this.beans)}setValueColumns(Q,z){this.beans.valueColsSvc?.setColumns(Q,z)}getValueColumns(){return this.beans.valueColsSvc?.columns??[]}setColumnAggFunc(Q,z,J){this.beans.valueColsSvc?.setColumnAggFunc?.(Q,z,J)}getColumnAggFunc(Q){return Q.getAggFunc()}setPivotColumns(Q,z){this.lastPivotColIds=Q.map((J)=>J.getColId()),this.beans.pivotColsSvc?.setColumns(Q,z)}getPivotColumns(){return this.beans.pivotColsSvc?.columns??[]}setPivotMode(Q,z){let{colModel:J,gos:Z,ctrlsSvc:$}=this.beans;if(Q===J.isPivotMode())return;let X=this.beans.pivotColsSvc?.columns.map((Y)=>Y.getColId())??[];if(X.length>0)this.lastPivotColIds=X;if(!Q){let Y=this.beans.colModel.getColDefCols()??[];n0(this.beans,{state:Y.map((G)=>({colId:G.getColId(),pivot:!1,pivotIndex:null}))},z)}if(Z.updateGridOptions({options:{pivotMode:Q},source:z}),Q&&this.lastPivotColIds.length>0)this.beans.pivotColsSvc?.setColumns(this.lastPivotColIds,z);for(let Y of $.getHeaderRowContainerCtrls())Y.refresh()}progressSortFromEvent(Q,z){this.beans.sortSvc?.progressSortFromEvent(Q,z)}isColumnVisibleInToolPanel(Q){return Q.isVisible()}isColumnSelectedInPivotModeToolPanel(Q){return Q.isAnyFunctionActive()}getPivotMode(){return this.beans.colModel.isPivotMode()}getSortDef(Q){return Q.getSortDef()}},cA=class{constructor(Q){this.beans=Q,this.state={},this.sequence=0,this.lastPivotColIds=[]}reset(){this.sequence=0,this.state={}}hasPendingChanges(){let{state:Q,beans:z}=this,{columnState:J,columnOrder:Z,rowGroup:$,aggregation:X,pivot:Y,pivotMode:G,sort:q,aggFuncs:H}=Q,_=(U)=>(U??[]).map((W)=>W.getColId());if(J)for(let[U,W]of J.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(Z&&!X0(Z.colIds,n6(z)))return!0;if($&&!X0($.colIds,_(z.rowGroupColsSvc?.columns)))return!0;if(X&&!X0(X.colIds,_(z.valueColsSvc?.columns)))return!0;if(Y&&!X0(Y.colIds,_(z.pivotColsSvc?.columns)))return!0;if(G&&G.pivotMode!==z.colModel.isPivotMode())return!0;if(q){for(let[U,W]of q.sortDefsByColId){let B=z.colModel.getColDefCol(U);if(!B)continue;if((W?.direction??null)!==(B.getSortDef()?.direction??null))return!0}if(q.baselineCleared){let U=G7(z);for(let W of U)if(!q.sortDefsByColId.has(W.getColId())&&W.getSortDef()!==null)return!0}}if(H)for(let[U,W]of H.values){let B=z.colModel.getColDefCol(U);if(!B)continue;if(W!==B.getAggFunc())return!0}return!1}commit(){let{beans:Q,state:z}=this,J=[];for(let $ of Object.keys(z)){let X=z[$];if(X)J.push({type:$,...X})}let Z=J.sort(($,X)=>$.seq-X.seq);for(let $ of Z)switch($.type){case"columnState":{n0(Q,{state:[...$.patches.values()]},$.eventType);break}case"columnOrder":{let X=$.colIds.map((Y)=>Q.colModel.getColDefCol(Y)).filter((Y)=>!!Y&&vJ(Y));if(!Q.colModel.isPivotMode())for(let Y=0;YvJ(U)),_=(H>=0?H:0)+Y;if(q[_]!==G)Q.colMoves?.moveColumns([G],_,$.eventType,!0)}nY(Q,X);break}case"rowGroup":{Q.rowGroupColsSvc?.setColumns($.colIds,$.eventType);break}case"aggregation":{Q.valueColsSvc?.setColumns($.colIds,$.eventType);break}case"pivot":{this.lastPivotColIds=$.colIds,Q.pivotColsSvc?.setColumns($.colIds,$.eventType);break}case"pivotMode":{let{colModel:X,ctrlsSvc:Y,gos:G,stateSvc:q}=Q;if($.pivotMode!==X.isPivotMode()){let H=Q.pivotColsSvc?.columns.map((W)=>W.getColId())??[];if(H.length>0)this.lastPivotColIds=H;let _=q?.getState().pivot?.pivotColIds??H,U=$.pivotMode?this.state.pivot?.colIds??this.lastPivotColIds:_;if(q?.setState({...q.getState(),pivot:{pivotMode:$.pivotMode,pivotColIds:U}},["pivot"]),!$.pivotMode){let W=Q.colModel.getColDefCols()??[];n0(Q,{state:W.map((B)=>({colId:B.getColId(),pivot:!1,pivotIndex:null}))},$.eventType)}if(G.updateGridOptions({options:{pivotMode:$.pivotMode},source:$.eventType}),$.pivotMode&&U.length>0)Q.pivotColsSvc?.setColumns(U,$.eventType);for(let W of Y.getHeaderRowContainerCtrls())W.refresh()}break}case"sort":{let X=[],Y=0;for(let[G,q]of $.sortDefsByColId)X.push({colId:G,sort:q?.direction??null,sortIndex:q?.direction?Y++:null,sortType:q?.type??void 0});n0(Q,{state:X,defaultState:$.baselineCleared?{sort:null,sortIndex:null,sortType:void 0}:void 0},$.eventType);break}case"aggFuncs":{for(let[X,Y]of $.values){let G=Q.colModel.getColDefCol(X);if(!G)continue;Q.valueColsSvc?.setColumnAggFunc?.(G,Y,$.eventType)}break}}this.reset()}applyColumnState(Q,z){for(let Z of Q)d6(this.state,Z);let J=Z2(this.state);J.seq=iQ(this.sequence),this.sequence=J.seq,J.eventType=z}moveColumns(Q,z,J){let Z=new Set(Q.map((q)=>q.getColId())),X=(this.state.columnOrder?.colIds??n6(this.beans)).filter((q)=>!Z.has(q)),Y=Q.map((q)=>q.getColId()),G=iQ(this.sequence);this.sequence=G,this.state.columnOrder={colIds:[...X.slice(0,z),...Y,...X.slice(z)],eventType:J,seq:G}}setColumnsVisible(Q,z,J){for(let $ of Q){if($.getColDef().lockVisible)continue;d6(this.state,{colId:$.getColId(),hide:!z})}let Z=Z2(this.state);Z.seq=iQ(this.sequence),this.sequence=Z.seq,Z.eventType=J}setRowGroupColumns(Q,z){t6(this.state,"rowGroup");let J=iQ(this.sequence);this.sequence=J,this.state.rowGroup={colIds:Q.map((Z)=>Z.getColId()),eventType:z,seq:J}}setValueColumns(Q,z){t6(this.state,"aggFunc");let J=new Set((this.beans.valueColsSvc?.columns??[]).map((X)=>X.getColId())),Z=dX(this.state);for(let X of Q)if(!J.has(X.getColId())&&!Z.values.has(X.getColId())){let Y=X.getAggFunc(),G=Y!=null?Y:this.beans.aggFuncSvc?.getDefaultAggFunc(X);if(G!=null)Z.values.set(X.getColId(),G)}let $=iQ(this.sequence);this.sequence=$,Z.seq=$,Z.eventType=z,this.state.aggregation={colIds:Q.map((X)=>X.getColId()),eventType:z,seq:$}}setColumnAggFunc(Q,z,J){d6(this.state,{colId:Q.getColId(),aggFunc:z});let Z=Z2(this.state);Z.seq=iQ(this.sequence),this.sequence=Z.seq,Z.eventType=J;let $=dX(this.state);$.seq=Z.seq,$.eventType=J,$.values.set(Q.getColId(),z)}getColumnAggFunc(Q){let z=Q.getColId();if(this.state.aggFuncs?.values.has(z))return this.state.aggFuncs.values.get(z);return Q.getAggFunc()}isColumnVisibleInToolPanel(Q){let z=this.state.columnState?.patches.get(Q.getColId());if(z?.hide!==void 0)return!z.hide;return Q.isVisible()}isColumnSelectedInPivotModeToolPanel(Q){let z=Q.getColId(),J=this.state.columnState?.patches.get(z),Z;if(J?.rowGroup!==void 0)Z=!!J.rowGroup;else if(this.state.rowGroup)Z=this.state.rowGroup.colIds.includes(z);else Z=Q.isRowGroupActive();let $;if(J?.pivot!==void 0)$=!!J.pivot;else if(this.state.pivot)$=this.state.pivot.colIds.includes(z);else $=Q.isPivotActive();let X;if(J?.aggFunc!==void 0)X=J.aggFunc!=null;else if(this.state.aggregation)X=this.state.aggregation.colIds.includes(z);else X=Q.isValueActive();return Z||$||X}setPivotColumns(Q,z){t6(this.state,"pivot");let J=iQ(this.sequence);this.sequence=J,this.state.pivot={colIds:Q.map((Z)=>Z.getColId()),eventType:z,seq:J}}setPivotMode(Q,z){let J=iQ(this.sequence);this.sequence=J,this.state.pivotMode={pivotMode:Q,eventType:z,seq:J}}getRowGroupColumns(){return VJ(this.beans,i6(this.state.rowGroup?.colIds,this.beans.rowGroupColsSvc?.columns,this.state.columnState?.patches,(Q)=>Q.rowGroup==null?void 0:!!Q.rowGroup))}getPrimaryColumns(){return VJ(this.beans,this.state.columnOrder?.colIds??n6(this.beans))}hasDeferredColumnOrder(){return!!this.state.columnOrder}getValueColumns(){return VJ(this.beans,i6(this.state.aggregation?.colIds,this.beans.valueColsSvc?.columns,this.state.columnState?.patches,(Q)=>Q.aggFunc===void 0?void 0:Q.aggFunc!=null))}getPivotColumns(){if(!this.getPivotMode())return[];let Q=this.beans.pivotColsSvc?.columns,z=Q?.length?Q:VJ(this.beans,this.lastPivotColIds);return VJ(this.beans,i6(this.state.pivot?.colIds,z,this.state.columnState?.patches,(J)=>J.pivot==null?void 0:!!J.pivot))}getPivotMode(){return this.state.pivotMode?.pivotMode??this.beans.colModel.isPivotMode()}getSortDef(Q){let z=this.state.sort,J=Q.getColId(),Z=z?.sortDefsByColId;if(Z?.has(J))return Z.get(J)??null;if(z?.baselineCleared)return null;return Q.getSortDef()}progressSortFromEvent(Q,z){let J=this.state.sort??{sortDefsByColId:new Map,baselineCleared:!1,seq:0,eventType:"toolPanelUi"},{sortSvc:Z}=this.beans,$=Q.getColId(),X;if(J.sortDefsByColId.has($))X=J.sortDefsByColId.get($);else if(J.baselineCleared)X=null;else X=Q.getSortDef();let Y=Z?.getNextSortDirection(Q,X);if(!Y)return;let{gos:G}=this.beans;if(!(((G.get("multiSortKey")==="ctrl"?z.ctrlKey||z.metaKey:z.shiftKey)||G.get("alwaysMultiSort"))&&!G.get("suppressMultiSort")))J.sortDefsByColId.clear(),J.baselineCleared=!0;J.sortDefsByColId.set($,Y.direction?Y:null),J.seq=iQ(this.sequence),this.sequence=J.seq,this.state.sort=J}};function VJ(Q,z){if(!z)return[];return z.map((J)=>Q.colModel.getColDefCol(J)).filter((J)=>!!J)}function i6(Q,z,J,Z){let $=[...Q??z?.map((Y)=>Y.getColId())??[]];if(!J?.size)return $;let X=new Set($);for(let[Y,G]of J){let q=Z(G);if(q===void 0)continue;if(q){if(!X.has(Y))$.push(Y),X.add(Y);continue}if(!X.has(Y))continue;X.delete(Y);let H=$.indexOf(Y);if(H>=0)$.splice(H,1)}return $}function pA(Q){let z=Q.colModel.getCols().filter((J)=>vJ(J)).map((J)=>Q.colModel.getColDefCol(J.getColId())).filter((J)=>!!J);nY(Q,z)}function nY(Q,z){let J=iA(Q);if(!J)return;let Z=new Set(z);J.list=[...z,...J.list.filter(($)=>vJ($)&&!Z.has($))]}function n6(Q){return G7(Q).map((z)=>z.getColId())}function G7(Q){return(Q.colModel.getColDefCols()??Q.colModel.getCols()).filter((z)=>vJ(z))}function iA(Q){let z=Q.colModel.colDefCols,J=z?.list;if(!Array.isArray(J))return;return z}function vJ(Q){if(!Q.isPrimary())return!1;return!mz(Q)&&!GJ(Q)}function iQ(Q){return Q+1}function d6(Q,z){let J=Z2(Q),Z=J.patches.get(z.colId);J.patches.set(z.colId,Z?{...Z,...z}:z)}function t6(Q,z){let J=Q.columnState?.patches;if(!J?.size)return;for(let[Z,$]of J){if(!(z in $))continue;let X={...$};if(delete X[z],Object.keys(X).length===1){J.delete(Z);continue}J.set(Z,X)}}function Z2(Q){let{columnState:z}=Q;if(!z)z={patches:new Map,seq:0,eventType:"toolPanelUi"},Q.columnState=z;return z}function dX(Q){let{aggFuncs:z}=Q;if(!z)z={values:new Map,seq:0,eventType:"toolPanelUi"},Q.aggFuncs=z;return z}var nA=class extends j{constructor(){super(...arguments);this.beanName="columnStateUpdateStrategy"}applyColumnState(Q,z,J){this.delegate("applyColumnState",Q,z,J)}commit(Q){this.delegate("commit",Q)}hasPendingChanges(Q){return this.delegate("hasPendingChanges",Q)}moveColumns(Q,z,J,Z){this.delegate("moveColumns",Q,z,J,Z)}reset(Q){this.delegate("reset",Q)}setColumnsVisible(Q,z,J,Z){this.delegate("setColumnsVisible",Q,z,J,Z)}isColumnVisibleInToolPanel(Q,z){return this.delegate("isColumnVisibleInToolPanel",Q,z)}setRowGroupColumns(Q,z,J){this.delegate("setRowGroupColumns",Q,z,J)}getRowGroupColumns(Q){return this.delegate("getRowGroupColumns",Q)}getPrimaryColumns(Q){return this.delegate("getPrimaryColumns",Q)}hasDeferredColumnOrder(Q){return this.delegate("hasDeferredColumnOrder",Q)}setValueColumns(Q,z,J){this.delegate("setValueColumns",Q,z,J)}getValueColumns(Q){return this.delegate("getValueColumns",Q)}setColumnAggFunc(Q,z,J,Z){this.delegate("setColumnAggFunc",Q,z,J,Z)}getColumnAggFunc(Q,z){return this.delegate("getColumnAggFunc",Q,z)}setPivotColumns(Q,z,J){this.delegate("setPivotColumns",Q,z,J)}getPivotColumns(Q){return this.delegate("getPivotColumns",Q)}setPivotMode(Q,z,J){this.delegate("setPivotMode",Q,z,J)}getPivotMode(Q){return this.delegate("getPivotMode",Q)}isColumnSelectedInPivotModeToolPanel(Q,z){return this.delegate("isColumnSelectedInPivotModeToolPanel",Q,z)}progressSortFromEvent(Q,z,J){this.delegate("progressSortFromEvent",Q,z,J)}getSortDef(Q,z){return this.delegate("getSortDef",Q,z)}getUpdateStrategy(){return this.executionStrategy??(this.executionStrategy=this.createManagedBean(new uA))}delegate(Q,...z){let J=this.getUpdateStrategy();return J[Q].bind(J)(...z)}},dA={moduleName:"SharedColumnStateUpdateStrategy",version:J0,beans:[nA],dependsOn:[I0]},dY={moduleName:"ColumnsToolPanel",version:J0,beans:[hA],userComponents:{agColumnsToolPanel:SA},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,dA,$7,FJ,LJ,nz,X7]},tA=class extends j{constructor(){super(...arguments);this.beanName="chartMenuItemMapper"}getChartItems(Q){let z=this.beans,J=z.chartSvc,Z=Q==="pivotChart";if(!J)return null;let $=this.getLocaleTextFunc.bind(this),X=Z?new rA(z,J,$):new sA(z,J,$),Y=J.isEnterprise(),G=X.getMenuItem();if(G?.subMenu&&!Y){let H=(_)=>({..._,subMenu:_.subMenu?.filter((U)=>!U._enterprise).map((U)=>H(U))});G=H(G)}let q=this.gos.get("chartToolPanelsDef")?.settingsPanel?.chartGroupsDef;if(q)G=this.filterAndOrderChartMenu(G,q,X.getConfigLookup());return this.cleanInternals(G)}cleanInternals(Q){if(!Q)return Q;let z=(J)=>{delete J?._key,delete J?._enterprise;for(let Z of J?.subMenu??[])z(Z);return J};return z(Q)}buildLookup(Q){let z={},J=(Z)=>{if(z[Z._key]=Z,Z.subMenu)for(let $ of Z.subMenu)J($)};return J(Q),z}filterAndOrderChartMenu(Q,z,J){let Z=this.buildLookup(Q),$={...Q,subMenu:[]};for(let X of Object.keys(z)){let Y=z[X],G=J[X];if(G===null)continue;if(G==null){R(173,{group:X});continue}let q=Z[G._key];if(q)if(q.subMenu){let H=Y.map((_)=>{let U=G[_];if(U==null){R(174,{group:X,chartType:_});return}return Z[U]}).filter((_)=>_!==void 0);if(H.length>0)q.subMenu=H,$.subMenu?.push(q)}else $.subMenu?.push(q)}if($.subMenu?.length==0)return null;return $}},rA=class{constructor(Q,z,J){this.beans=Q,this.chartSvc=z,this.getLocaleTextFunc=J}getMenuItem(){let Q=this.getLocaleTextFunc(),z=(J,Z,$,X,Y=!1)=>{return{name:Q(J,Z+"‎"),action:()=>this.chartSvc.createPivotChart({chartType:$}),_key:X,_enterprise:Y}};return{name:Q("pivotChart","Pivot Chart"),_key:"pivotChart",subMenu:[{_key:"pivotColumnChart",name:Q("columnChart","Column"),subMenu:[z("groupedColumn","Grouped","groupedColumn","pivotGroupedColumn"),z("stackedColumn","Stacked","stackedColumn","pivotStackedColumn"),z("normalizedColumn","100% Stacked","normalizedColumn","pivotNormalizedColumn")]},{_key:"pivotBarChart",name:Q("barChart","Bar"),subMenu:[z("groupedBar","Grouped","groupedBar","pivotGroupedBar"),z("stackedBar","Stacked","stackedBar","pivotStackedBar"),z("normalizedBar","100% Stacked","normalizedBar","pivotNormalizedBar")]},{_key:"pivotPieChart",name:Q("pieChart","Pie"),subMenu:[z("pie","Pie","pie","pivotPie"),z("donut","Donut","donut","pivotDonut")]},{_key:"pivotLineChart",name:Q("lineChart","Line"),subMenu:[z("lineChart","Line","line","pivotLineChart"),z("stackedLine","Stacked","stackedLine","pivotStackedLine"),z("normalizedLine","100% Stacked","normalizedLine","pivotNormalizedLine")]},{_key:"pivotAreaChart",name:Q("areaChart","Area"),subMenu:[z("areaChart","Area","area","pivotArea"),z("stackedArea","Stacked","stackedArea","pivotStackedArea"),z("normalizedArea","100% Stacked","normalizedArea","pivotNormalizedArea")]},{_key:"pivotXYChart",name:Q("xyChart","X Y (Scatter)"),subMenu:[z("scatter","Scatter","scatter","pivotScatter"),z("bubble","Bubble","bubble","pivotBubble")]},{_key:"pivotStatisticalChart",_enterprise:!1,name:Q("statisticalChart","Statistical"),subMenu:[z("histogramChart","Histogram","histogram","pivotHistogram",!1)]},{_key:"pivotHierarchicalChart",_enterprise:!0,name:Q("hierarchicalChart","Hierarchical"),subMenu:[z("treemapChart","Treemap","treemap","pivotTreemap",!0),z("sunburstChart","Sunburst","sunburst","pivotSunburst",!0)]},{_key:"pivotFunnel",name:Q("funnel","Funnel"),subMenu:[z("funnel","Funnel","funnel","pivotFunnel"),z("coneFunnel","Cone Funnel","coneFunnel","pivotConeFunnel"),z("pyramid","Pyramid","pyramid","pivotPyramid")]},{_key:"pivotCombinationChart",name:Q("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}}},sA=class{constructor(Q,z,J){this.beans=Q,this.chartSvc=z,this.getLocaleTextFunc=J}getMenuItem(){let Q=this.getLocaleTextFunc(),z=(J,Z,$,X,Y=!1)=>{return{name:Q(J,Z),action:()=>this.chartSvc.createChartFromCurrentRange($),_key:X,_enterprise:Y}};return{name:Q("chartRange","Chart Range"),_key:"chartRange",subMenu:[{name:Q("columnChart","Column"),subMenu:[z("groupedColumn","Grouped","groupedColumn","rangeGroupedColumn"),z("stackedColumn","Stacked","stackedColumn","rangeStackedColumn"),z("normalizedColumn","100% Stacked","normalizedColumn","rangeNormalizedColumn")],_key:"rangeColumnChart"},{name:Q("barChart","Bar"),subMenu:[z("groupedBar","Grouped","groupedBar","rangeGroupedBar"),z("stackedBar","Stacked","stackedBar","rangeStackedBar"),z("normalizedBar","100% Stacked","normalizedBar","rangeNormalizedBar")],_key:"rangeBarChart"},{name:Q("pieChart","Pie"),subMenu:[z("pie","Pie","pie","rangePie"),z("donut","Donut","donut","rangeDonut")],_key:"rangePieChart"},{name:Q("lineChart","Line"),subMenu:[z("lineChart","Line","line","rangeLineChart"),z("stackedLine","Stacked","stackedLine","rangeStackedLine"),z("normalizedLine","100% Stacked","normalizedLine","rangeNormalizedLine")],_key:"rangeLineChart"},{name:Q("areaChart","Area"),subMenu:[z("areaChart","Area","area","rangeArea"),z("stackedArea","Stacked","stackedArea","rangeStackedArea"),z("normalizedArea","100% Stacked","normalizedArea","rangeNormalizedArea")],_key:"rangeAreaChart"},{name:Q("xyChart","X Y (Scatter)"),subMenu:[z("scatter","Scatter","scatter","rangeScatter"),z("bubble","Bubble","bubble","rangeBubble")],_key:"rangeXYChart"},{name:Q("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:Q("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:Q("hierarchicalChart","Hierarchical"),subMenu:[z("treemap","Treemap","treemap","rangeTreemap"),z("sunburst","Sunburst","sunburst","rangeSunburst")],_key:"rangeHierarchicalChart",_enterprise:!0},{name:Q("specializedChart","Specialized"),subMenu:[z("heatmap","Heatmap","heatmap","rangeHeatmap"),z("waterfall","Waterfall","waterfall","rangeWaterfall")],_key:"rangeSpecializedChart",_enterprise:!0},{name:Q("funnel","Funnel"),subMenu:[z("funnel","Funnel","funnel","rangeFunnel"),z("coneFunnel","Cone Funnel","coneFunnel","rangeConeFunnel"),z("pyramid","Pyramid","pyramid","rangePyramid")],_key:"rangeFunnel",_enterprise:!0},{name:Q("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}}}},lA=class extends j{constructor(){super(...arguments);this.beanName="colChooserFactory"}createColumnSelectPanel(Q,z,J,Z){let $=Q.createManagedBean(new iY),X=Z??z?.getColDef().columnChooserParams??{},{contractColumnSelection:Y,suppressColumnExpandAll:G,suppressColumnFilter:q,suppressColumnSelectAll:H,suppressSyncLayoutWithGrid:_,columnLayout:U}=X;if($.init(!!J,y(this.gos,{suppressColumnMove:!1,suppressValues:!1,suppressPivots:!1,suppressRowGroups:!1,suppressPivotMode:!1,contractColumnSelection:!!Y,suppressColumnExpandAll:!!G,suppressColumnFilter:!!q,suppressColumnSelectAll:!!H,suppressSyncLayoutWithGrid:!!U||!!_,onStateUpdated:()=>{}}),"columnMenu"),U)$.setColumnLayout(U);return $}showColumnChooser({column:Q,chooserParams:z,eventSource:J,headerPosition:Z}){this.hideActiveColumnChooser();let $=this.createColumnSelectPanel(this,Q,!0,z),X=this.getLocaleTextFunc(),Y=this.beans,{visibleCols:G,focusSvc:q,menuUtils:H}=Y,_=G.allCols.indexOf(Q),U=Q?q.focusedHeader??Z??null:null;this.activeColumnChooserDialog=this.createBean(new Lf({title:X("chooseColumns","Choose Columns"),component:$,width:300,height:300,resizable:!0,movable:!0,centered:!0,closable:!0,afterGuiAttached:()=>{R0(Y,$.getGui())?.focus({preventScroll:!0}),this.dispatchVisibleChangedEvent(!0,Q)},closedCallback:(W)=>{let B=this.activeColumnChooser.getGui();if(this.destroyBean(this.activeColumnChooser),this.activeColumnChooser=void 0,this.activeColumnChooserDialog=void 0,this.dispatchVisibleChangedEvent(!1,Q),Q)H.restoreFocusOnClose({column:Q,headerPosition:U,columnIndex:_,eventSource:J},B,W,!0)},postProcessPopupParams:{type:"columnChooser",column:Q,eventSource:J}})),this.activeColumnChooser=$}hideActiveColumnChooser(){this.destroyBean(this.activeColumnChooserDialog)}dispatchVisibleChangedEvent(Q,z){this.eventSvc.dispatchEvent({type:"columnMenuVisibleChanged",visible:Q,switchingTab:!1,key:"columnChooser",column:z??null})}},aA={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 oA(Q,z){let J=aA[z];if(J)Q.assertModuleRegistered(J,`menu item '${z}'`)}var dz="separator";function tY(Q,z){if(!Q)return;for(let J=Q.length-2;J>=0;J--){let Z=Q[J]===z,$=Q[J+1]===z;if(Z&&$)Q.splice(J+1,1)}}var eA={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:(Q)=>({type:LQ(Q.getSortDef()?.type),direction:null})}},Qj=class extends j{constructor(){super(...arguments);this.beanName="menuItemMapper"}mapWithStockItems(Q,z,J,Z,$){if(!Q)return[];let X=[],Y=this.getLocaleTextFunc(),{beans:G,gos:q}=this,{pinnedCols:H,colAutosize:_,aggFuncSvc:U,rowGroupColsSvc:W,colNames:B,colModel:E,clipboardSvc:K,expansionSvc:L,focusSvc:F,csvCreator:D,excelCreator:M,menuSvc:k,colChooserFactory:f,sortSvc:A,chartMenuItemMapper:O,valueColsSvc:v,pinnedRowModel:I}=G,C=(m,w,a,t)=>{switch(oA(q,m),m){case"pinSubMenu":return H&&w?{name:Y("pinColumn","Pin Column"),icon:h("menuPin",G,null),subMenu:["clearPinned","pinLeft","pinRight"]}:null;case"pinLeft":return H&&w?{name:Y("pinLeft","Pin Left"),action:()=>H.setColsPinned([w],"left",t),checked:!!w&&w.isPinnedLeft()}:null;case"pinRight":return H&&w?{name:Y("pinRight","Pin Right"),action:()=>H.setColsPinned([w],"right",t),checked:!!w&&w.isPinnedRight()}:null;case"clearPinned":return H&&w?{name:Y("noPin","No Pin"),action:()=>H.setColsPinned([w],null,t),checked:!!w&&!w.isPinned()}:null;case"pinRowSubMenu":{let u=q.get("enableRowPinning"),Q0=[],r=J?.rowPinned??J?.pinnedSibling?.rowPinned;if(r)Q0.push("unpinRow");if(u&&u!=="bottom"&&r!="top")Q0.push("pinTop");if(u&&u!=="top"&&r!="bottom")Q0.push("pinBottom");return I?.isManual()?{name:Y("pinRow","Pin Row"),icon:h("rowPin",G,w),subMenu:Q0}:null}case"pinTop":return I?.isManual()?{name:Y("pinTop","Pin to Top"),icon:h("rowPinTop",G,w),action:({node:u,column:Q0})=>u&&I.pinRow(u,"top",Q0)}:null;case"pinBottom":return I?.isManual()?{name:Y("pinBottom","Pin to Bottom"),icon:h("rowPinBottom",G,w),action:({node:u,column:Q0})=>u&&I.pinRow(u,"bottom",Q0)}:null;case"unpinRow":return I?.isManual()?{name:Y("unpinRow","Unpin Row"),icon:h("rowUnpin",G,w),action:({node:u,column:Q0})=>u&&I.pinRow(u,null,Q0)}:null;case"valueAggSubMenu":if(U&&v&&(w?.isPrimary()||w?.getColDef().pivotValueColumn))return{name:Y("valueAggregation","Value Aggregation"),icon:h("menuValue",G,null),subMenu:zj(w,U,v,Y),disabled:q.get("functionsReadOnly")};else return null;case"autoSizeThis":return _?{name:Y("autosizeThisColumn","Autosize This Column"),action:()=>w&&_.autoSizeColumn(w,t,q.get("skipHeaderOnAutoSize"))}:null;case"autoSizeAll":return _?{name:Y("autosizeAllColumns","Autosize All Columns"),action:()=>_.autoSizeAllColumns({source:t,skipHeader:q.get("skipHeaderOnAutoSize")})}:null;case"rowGroup":return W?{name:OJ(Y,"groupBy",B.getDisplayNameForColumn(w,"header")),disabled:q.get("functionsReadOnly")||w?.isRowGroupActive()||!w?.getColDef().enableRowGroup,action:()=>W.addColumns([w],t),icon:h("menuAddRowGroup",G,null)}:null;case"rowUnGroup":if(W&&q.isModuleRegistered("SharedRowGrouping")){let u=w?.getColDef().showRowGroup,Q0=q.get("groupLockGroupColumns"),r,S0,O0;if(u===!0)r=Y("ungroupAll","Un-Group All"),S0=q.get("functionsReadOnly")||Q0===-1||Q0>=(W.columns.length??0),O0=()=>W.setColumns(W.columns.slice(0,Q0),t);else if(typeof u==="string"){let k0=E.getColDefCol(u),Az=k0!=null?B.getDisplayNameForColumn(k0,"header"):u;r=OJ(Y,"ungroupBy",Az),S0=q.get("functionsReadOnly")||TJ(k0,G),O0=()=>{W.removeColumns([u],t)}}else r=OJ(Y,"ungroupBy",B.getDisplayNameForColumn(w,"header")),S0=q.get("functionsReadOnly")||!w?.isRowGroupActive()||!w?.getColDef().enableRowGroup||TJ(w,G),O0=()=>W.removeColumns([w],t);return{name:r,disabled:S0,action:O0,icon:h("menuRemoveRowGroup",G,null)}}else return null;case"resetColumns":return{name:Y("resetColumns","Reset Columns"),action:()=>V$(G,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",G,null),action:()=>K.copyToClipboard()}:null;case"copyWithHeaders":return K?{name:Y("copyWithHeaders","Copy with Headers"),icon:h("clipboardCopy",G,null),action:()=>K.copyToClipboard({includeHeaders:!0})}:null;case"copyWithGroupHeaders":return K?{name:Y("copyWithGroupHeaders","Copy with Group Headers"),icon:h("clipboardCopy",G,null),action:()=>K.copyToClipboard({includeHeaders:!0,includeGroupHeaders:!0})}:null;case"cut":if(K){let u=F.getFocusedCell(),Q0=u?M0(G,u):null,r=Q0?u?.column.isCellEditable(Q0):!1;return{name:Y("cut","Cut"),shortcut:Y("ctrlX","Ctrl+X"),icon:h("clipboardCut",G,null),disabled:!r||q.get("suppressCutToClipboard"),action:()=>K.cutToClipboard(void 0,"contextMenu")}}else return null;case"paste":if(K){let u=q.get("suppressClipboardApi")||q.get("suppressClipboardPaste")||!w||!J||!w.isCellEditable(J)||w.isSuppressPaste(J);return{name:Y("paste","Paste"),shortcut:Y("ctrlV","Ctrl+V"),icon:h("clipboardPaste",G,null),disabled:u,action:()=>K.pasteFromClipboard()}}else return null;case"export":{let u=[];if(!q.get("suppressCsvExport")&&D)u.push("csvExport");if(!q.get("suppressExcelExport")&&M)u.push("excelExport");return u.length?{name:Y("export","Export"),subMenu:u,icon:h("save",G,null)}:null}case"csvExport":return D?{name:Y("csvExport","CSV Export"),icon:h("csvExport",G,null),action:()=>D.exportDataAsCsv()}:null;case"excelExport":return M?{name:Y("excelExport","Excel Export"),icon:h("excelExport",G,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",G,null),action:()=>k.showFilterMenu({column:w,buttonElement:a(),containerType:"columnFilter",positionBy:"button"})}:null;case"columnChooser":{let u=F.focusedHeader;return f?{name:Y("columnChooser","Choose Columns"),icon:h("columns",G,null),action:()=>f.showColumnChooser({column:w,eventSource:a(),headerPosition:u})}:null}case"sortUnSort":case"sortAscending":case"sortDescending":case"sortAbsoluteAscending":case"sortAbsoluteDescending":{if(!A||!w)return null;let{fallback:u,getSortDef:Q0}=eA[m];return{name:Y(m,u),icon:h(m,G,null),action:()=>A.setSortForColumn(w,Q0(w),!1,t)}}default:return R(176,{key:m}),null}};for(let m of Q){let w;if(typeof m==="string")w=C(m,z,Z,$);else w={...m};if(!w)continue;let a=w,{subMenu:t}=a;if(t&&t instanceof Array)a.subMenu=this.mapWithStockItems(t,z,J,Z,$);if(w!=null)X.push(w)}return tY(X,dz),X}};function zj(Q,z,J,Z){let $;if(Q.isPrimary())$=Q;else{let Y=Q.getColDef().pivotValueColumn;$=T(Y)?Y:void 0}let X=[];if($){let Y=$.isValueActive(),G=z.getFuncNames($);X.push({name:Z("noAggregation","None"),action:()=>{J.removeColumns([$],"contextMenu"),J.setColumnAggFunc($,void 0,"contextMenu")},checked:!Y});for(let q of G)X.push({name:Z(q,z.getDefaultFuncLabel(q)),action:()=>{J.setColumnAggFunc($,q,"contextMenu"),J.addColumns([$],"contextMenu")},checked:Y&&$.getAggFunc()===q})}return X}var Jj=class extends j{constructor(){super(...arguments);this.beanName="colMenuFactory"}createMenu(Q,z,J,Z){let $=Q.createManagedBean(new mY(0,{column:J??null,node:null,value:null})),X=this.beans.menuItemMapper.mapWithStockItems(z,J??null,null,Z,"columnMenu");return $.addMenuItems(X),$}getMenuItems(Q=null,z=null){let J=this.getDefaultMenuOptions(Q),Z,$=(Q?.getColDef()??z?.getColGroupDef())?.mainMenuItems;if(Array.isArray($))Z=$;else if(typeof $==="function")Z=$(y(this.gos,{column:Q,columnGroup:z,defaultItems:J}));else{let X=this.gos.getCallback("getMainMenuItems");if(X)Z=X({column:Q,columnGroup:z,defaultItems:J});else Z=J}return tY(Z,dz),Z}getDefaultMenuOptions(Q){let z=[],{beans:J,gos:Z}=this,{colChooserFactory:$,rowGroupColsSvc:X,colModel:Y,expansionSvc:G,sortSvc:q,menuSvc:H,pinnedCols:_,aggFuncSvc:U,colAutosize:W}=J,B=U0(Z),E=()=>{if(!B&&$)z.push("columnChooser");z.push("resetColumns")};if(!Q)return E(),z;let{colDef:K}=Q,L=_&&!K.lockPinned,F=X?.columns.length??0,D=F>0,M=_z(Z),k=Z.get("treeData"),f=Q.isPrimary(),A=!f||U&&Q.isAllowValue()&&(D||M||k);if(q&&!B&&Q.isSortable()){let{isDefaultSortAllowed:O,isAbsoluteSortAllowed:v,isAbsoluteSort:I,isDefaultSort:C,isAscending:m,isDescending:w,direction:a}=c5(Q,J);if(O&&!(m&&C))z.push("sortAscending");if(O&&!(w&&C))z.push("sortDescending");if(v&&!(m&&I))z.push("sortAbsoluteAscending");if(v&&!(w&&I))z.push("sortAbsoluteDescending");if(a)z.push("sortUnSort");z.push(dz)}if(H?.isFilterMenuItemEnabled(Q))z.push("columnFilter"),z.push(dz);if(L)z.push("pinSubMenu");if(A)z.push("valueAggSubMenu");if(L||A)z.push(dz);if(W){if(!K.suppressAutoSize)z.push("autoSizeThis");z.push("autoSizeAll"),z.push(dz)}if(X&&Z.isModuleRegistered("SharedRowGrouping")){let O=z.length;if(K.showRowGroup)z.push("rowUnGroup");else if(Q.isAllowRowGroup()&&f)if(Q.isRowGroupActive()){if(!TJ(Q,J))z.push("rowUnGroup")}else z.push("rowGroup");if(z.length>O)z.push(dz)}if(E(),G&&(o(Z)||Z.get("ssrmExpandAllAffectsAllRows"))&&(k||F>(Y.isPivotMode()?1:0)))z.push("expandAll"),z.push("contractAll");return z}};var Dz="filterMenuTab",Mz="generalMenuTab",tz="columnsMenuTab",$2=[Mz,Dz,tz],Zj=class extends j{constructor(){super(...arguments);this.beanName="enterpriseMenuFactory"}hideActiveMenu(){this.destroyBean(this.activeMenu)}showMenuAfterMouseEvent(Q,z,J,Z,$){let{column:X,columnGroup:Y}=this.splitColumnOrGroup(Q),G=$?"filterMenuTab":void 0;this.showMenu(X,Y,(q)=>{let H=q.getGui();if(this.beans.popupSvc.positionPopupUnderMouseEvent({type:J,additionalParams:{column:X},mouseEvent:z,ePopup:H}),G)q.showTab?.(G);this.dispatchVisibleChangedEvent(!0,!1,X,Y,G)},J,G,void 0,z.target,Z)}splitColumnOrGroup(Q){let z=Q&&JQ(Q);return{column:z?Q:void 0,columnGroup:z?void 0:Q}}showMenuAfterButtonClick(Q,z,J,Z,$){let X=-1,Y="left";if(this.gos.get("enableRtl"))X=1,Y="right";let G=$?"filterMenuTab":void 0,q=G?[G]:void 0,H=U0(this.gos),_=(H?9:4)*X,U=H?-23:4,{column:W,columnGroup:B}=this.splitColumnOrGroup(Q);this.showMenu(W,B,(E)=>{let K=E.getGui();if(this.beans.popupSvc.positionPopupByComponent({type:J,additionalParams:{column:W},eventSource:z,ePopup:K,alignSide:Y,nudgeX:_,nudgeY:U,position:"under",keepWithinBounds:!0}),G)E.showTab?.(G);this.dispatchVisibleChangedEvent(!0,!1,W,B,G)},J,G,q,z,Z)}showMenu(Q,z,J,Z,$,X,Y,G){let q=this.getMenuParams(Q,z,X,Y);if(!q)return;let{menu:H,eMenuGui:_,anchorToElement:U,restoreFocusParams:W}=q,B=[],{menuUtils:E,popupSvc:K}=this.beans;B.push((F)=>{let D=H.getGui();if(this.destroyBean(H),Q)zJ(Q,!1,"contextMenu"),E.restoreFocusOnClose(W,D,F);G?.()});let L=this.getLocaleTextFunc();if(K.addPopup({modal:!0,eChild:_,closeOnEsc:!0,closedCallback:(F)=>{for(let D of B)D(F);this.dispatchVisibleChangedEvent(!1,!1,Q,z,$)},afterGuiAttached:(F)=>H.afterGuiAttached(Object.assign({},{container:Z},F)),positionCallback:$?()=>J(H):void 0,ariaLabel:L("ariaLabelColumnMenu","Column Menu")}),!$)H.showTabBasedOnPreviousSelection?.(),J(H);if(h5(this.gos)){let F=K.setPopupPositionRelatedToElement(_,U);if(F&&Q)this.addStopAnchoring(F,Q,B)}if(H.addEventListener("tabSelected",(F)=>{this.dispatchVisibleChangedEvent(!1,!0,Q),this.lastSelectedTab=F.key,this.dispatchVisibleChangedEvent(!0,!0,Q)}),Q)zJ(Q,!0,"contextMenu");this.activeMenu=H,H.addEventListener("destroyed",()=>{if(this.activeMenu===H)this.activeMenu=null})}addStopAnchoring(Q,z,J){Q.then((Z)=>{z.__addEventListener("leftChanged",Z),z.__addEventListener("visibleChanged",Z),J.push(()=>{z.__removeEventListener("leftChanged",Z),z.__removeEventListener("visibleChanged",Z)})})}getMenuParams(Q,z,J,Z){let{focusSvc:$,visibleCols:X,ctrlsSvc:Y}=this.beans,G={column:Q,headerPosition:$.focusedHeader,columnIndex:X.allCols.indexOf(Q),eventSource:Z},q=this.createMenu(Q,z,G,J,Z);return q?{menu:q,eMenuGui:q.getGui(),anchorToElement:Z||Y.getGridBodyCtrl().eGridBody,restoreFocusParams:G}:void 0}createMenu(Q,z,J,Z,$){if(U0(this.gos))return this.createBean(new $j(Q,J,this.lastSelectedTab,Z,$));else{let X=this.beans.colMenuFactory.getMenuItems(Q,z);return X.length?this.createBean(new Xj(X,Q,J,$)):void 0}}dispatchVisibleChangedEvent(Q,z,J,Z,$){this.eventSvc.dispatchEvent({type:"columnMenuVisibleChanged",visible:Q,switchingTab:z,key:this.lastSelectedTab??$??(U0(this.gos)?Mz:"columnMenu"),column:J??null,columnGroup:Z??null})}isMenuEnabled(Q){if(!U0(this.gos))return!0;let z=!this.beans.filterManager?.isFilterAllowed(Q),J=Q.getColDef().menuTabs??$2;return(z&&J.includes(Dz)?J.length-1:J.length)>0}showMenuAfterContextMenuEvent(Q,z,J){this.beans.menuUtils.onContextMenu({mouseEvent:z,touchEvent:J,source:"ui",showMenuCallback:(Z)=>{return this.showMenuAfterMouseEvent(Q,Z,"columnMenu"),!0}})}},$j=class extends j{constructor(Q,z,J,Z,$){super();this.column=Q,this.restoreFocusParams=z,this.initialSelection=J,this.restrictTo=Z,this.sourceElement=$,this.tabFactories={},this.includeChecks={};let{tabFactories:X,includeChecks:Y}=this;X[Mz]=this.createMainPanel.bind(this),X[Dz]=this.createFilterPanel.bind(this),X[tz]=this.createColumnsPanel.bind(this),Y[Mz]=()=>!0,Y[Dz]=()=>Q?!!this.beans.filterManager?.isFilterAllowed(Q):!1,Y[tz]=()=>!0}postConstruct(){let Q=this.getTabsToCreate().map((J)=>this.createTab(J)),z=new Hf({items:Q,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??$2).filter((Q)=>this.isValidMenuTabItem(Q)&&this.isNotSuppressed(Q))}isValidMenuTabItem(Q){let z=!0,J=$2;if(this.restrictTo!=null)z=this.restrictTo.indexOf(Q)>-1,J=this.restrictTo;if(z=z&&$2.indexOf(Q)>-1,!z)R(175,{menuTabName:Q,itemsToConsider:J});return z}isNotSuppressed(Q){return this.includeChecks[Q]()}createTab(Q){return this.tabFactories[Q]()}showTabBasedOnPreviousSelection(){this.showTab(this.initialSelection)}showTab(Q){let{tabItemColumns:z,tabbedLayout:J,tabItemFilter:Z,tabItemGeneral:$}=this;if(z&&Q===tz)J.showItem(z);else if(Z&&Q===Dz)J.showItem(Z);else if($&&Q===Mz)J.showItem($);else J.showFirstItem()}onTabItemClicked(Q){let z=null;switch(Q.item){case this.tabItemColumns:z=tz;break;case this.tabItemFilter:z=Dz;break;case this.tabItemGeneral:z=Mz;break}if(z)this.activateTab(z)}activateTab(Q){let z={type:"tabSelected",key:Q};this.dispatchLocalEvent(z)}createMainPanel(){let{beans:Q,column:z}=this,J=Q.colMenuFactory,Z=J.createMenu(this,J.getMenuItems(z),this.column,()=>this.sourceElement??this.getGui());this.mainMenuList=Z,Z.addEventListener("closeMenu",this.onHidePopup.bind(this));let $={title:h("legacyMenu",Q,z),titleLabel:Mz.replace("MenuTab",""),bodyPromise:g.resolve(Z.getGui()),name:Mz};return this.tabItemGeneral=$,$}onHidePopup(Q){this.beans.menuUtils.closePopupAndRestoreFocusOnSelect(this.hidePopupFunc,this.restoreFocusParams,Q)}createFilterPanel(){let Q=this.column?this.createBean(new w6(this.column,"COLUMN_MENU")):null;if(this.filterComp=Q,!Q?.hasFilter())e(119);let z=(Z)=>Q?.afterGuiAttached(Z),J=()=>Q?.afterGuiDetached();return this.tabItemFilter={title:h("filterTab",this.beans,this.column),titleLabel:Dz.replace("MenuTab",""),bodyPromise:g.resolve(Q?.getGui()),afterAttachedCallback:z,afterDetachedCallback:J,name:Dz},this.tabItemFilter}createColumnsPanel(){let Q=Z0({tag:"div",cls:"ag-menu-column-select-wrapper"}),{beans:z,column:J}=this,$=z.colChooserFactory.createColumnSelectPanel(this,J).getGui();$.classList.add("ag-menu-column-select"),Q.appendChild($);let X={title:h("columns",z,J),titleLabel:tz.replace("MenuTab",""),bodyPromise:g.resolve(Q),name:tz};return this.tabItemColumns=X,X}afterGuiAttached(Q){let{container:z,hidePopup:J}=Q;if(this.tabbedLayout.setAfterAttachedParams({container:z,hidePopup:J}),J)this.hidePopupFunc=J,this.addDestroyFunc(J)}getGui(){return this.tabbedLayout.getGui()}destroy(){super.destroy(),this.destroyBean(this.filterComp)}},Xj=class extends x{constructor(Q,z,J,Z){super({tag:"div",ref:"eColumnMenu",cls:"ag-menu ag-column-menu",role:"presentation"});this.menuItems=Q,this.column=z,this.restoreFocusParams=J,this.sourceElement=Z,this.eColumnMenu=S}postConstruct(){let Q=this.beans.colMenuFactory.createMenu(this,this.menuItems,this.column,()=>this.sourceElement??this.getGui());this.mainMenuList=Q,Q.addEventListener("closeMenu",this.onHidePopup.bind(this)),this.eColumnMenu.appendChild(Q.getGui())}onHidePopup(Q){this.beans.menuUtils.closePopupAndRestoreFocusOnSelect(this.hidePopupFunc,this.restoreFocusParams,Q)}afterGuiAttached({hidePopup:Q}){if(Q)this.hidePopupFunc=Q,this.addDestroyFunc(Q);D0(this.mainMenuList.getGui())}};function Yj(Q,z){Q.colChooserFactory?.showColumnChooser({chooserParams:z})}function Gj(Q){Q.colChooserFactory?.hideActiveColumnChooser()}var qj=class extends j{constructor(){super(...arguments);this.beanName="menuUtils"}restoreFocusOnClose(Q,z,J,Z){let{eventSource:$}=Q,X=J instanceof KeyboardEvent;if(!Z&&!X||!$)return;let Y=d(this.beans);if(!z.contains(Y)&&!hz(this.beans))return;this.focusHeaderCell(Q)}closePopupAndRestoreFocusOnSelect(Q,z,J){let Z;if(J?.keyboardEvent)Z=J.keyboardEvent;Q(Z&&{keyboardEvent:Z});let $=this.beans,X=$.focusSvc,Y=X.getFocusedCell();if(hz($))if(Y){let{rowIndex:G,rowPinned:q,column:H}=Y;X.setFocusedCell({rowIndex:G,column:H,rowPinned:q,forceBrowserFocus:!0,preventScrollOnBrowserFocus:!0})}else this.focusHeaderCell(z)}onContextMenu(Q){let{mouseEvent:z,touchEvent:J,showMenuCallback:Z,source:$}=Q;if(!this.gos.get("allowContextMenuWithControlKey")){if(z&&(z.ctrlKey||z.metaKey))return}if(z)this.blockMiddleClickScrollsIfNeeded(z);if($==="ui"&&this.gos.get("suppressContextMenu"))return;let X=z??J.touches[0];if(Z(X)){let Y=z??J;if(Y?.cancelable)Y.preventDefault()}}async focusHeaderCell(Q){let{column:z,columnIndex:J,headerPosition:Z,eventSource:$}=Q,{visibleCols:X,headerNavigation:Y,focusSvc:G}=this.beans,q=await X.allCols.some((H)=>H===z);if(!this.isAlive())return;if(z?.isAlive()&&q&&$&&f0($)){let H=xZ($);if(H)Y?.scrollToColumn(z),H.focus()}else if(Z&&J!==-1){let H=X.allCols,_=H[J]||b(H);if(_)G.focusHeaderPosition({headerPosition:{headerRowIndex:Z.headerRowIndex,column:_}})}}blockMiddleClickScrollsIfNeeded(Q){if(this.gos.get("suppressMiddleClickScrolls")&&Q.which===2)Q.preventDefault()}},Hj={moduleName:"MenuCore",version:J0,beans:[Qj,tA,qj],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,v6,X7]},rY={moduleName:"ColumnMenu",version:J0,beans:[Zj,Jj,lA],icons:{ensureColumnVisible:"column-arrow",legacyMenu:"menu",filterTab:"filter",columnSelectClosed:"tree-closed",columnSelectOpen:"tree-open",columnSelectIndeterminate:"tree-indeterminate"},apiFunctions:{showColumnChooser:Yj,hideColumnChooser:Gj},dependsOn:[Hj,LJ,FJ]};var _j=".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 Uj(Q,z,J){return Q.getCompDetails(z,Wj,void 0,J,!0)}var Wj={name:"statusPanel",optionalMethods:["refresh"]},Bj={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]}},Ej={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"}]},Kj=class extends x{constructor(){super(Ej);this.updateQueued=!1,this.panelsPromise=g.resolve(),this.eStatusBarLeft=S,this.eStatusBarCenter=S,this.eStatusBarRight=S,this.compDestroyFunctions={},this.registerCSS(_j)}wireBeans(Q){this.userCompFactory=Q.userCompFactory,this.statusBarSvc=Q.statusBarSvc}postConstruct(){this.processStatusPanels(new Map),this.addManagedPropertyListeners(["statusBar"],this.handleStatusBarChanged.bind(this)),Bz(this.beans,this,this.getGui())}getFocusableContainerName(){return"statusBar"}getValidPanels(){let Q=this.gos,z=Q.get("statusBar")?.statusPanels;if(!z)return z;return z.filter((J)=>{let{rowModels:Z,warnArgs:$}=Bj[J.statusPanel]??{};if(!Z)return!0;if(Z.includes(Q.get("rowModelType")))return!0;return R(...$),!1})}processStatusPanels(Q){let z=this.getValidPanels();if(z){let J=z.filter((X)=>X.align==="left"),Z=z.filter((X)=>X.align==="center"),$=z.filter((X)=>!X.align||X.align==="right");this.panelsPromise=g.all([this.createAndRenderComponents(J,this.eStatusBarLeft,Q),this.createAndRenderComponents(Z,this.eStatusBarCenter,Q),this.createAndRenderComponents($,this.eStatusBarRight,Q)])}else this.setDisplayed(!1)}handleStatusBarChanged(){if(this.updateQueued)return;this.updateQueued=!0,this.panelsPromise.then(()=>{this.updateStatusBar(),this.updateQueued=!1})}updateStatusBar(){let Q=this.getValidPanels(),z=Array.isArray(Q)&&Q.length>0;this.setDisplayed(z);let J=new Map;if(z)for(let Z of Q){let $=Z.key??Z.statusPanel,X=this.statusBarSvc.getStatusPanel($);if(X?.refresh){let Y=y(this.gos,{...Z.statusPanelParams??{},key:$});if(X.refresh(Y))J.set($,X),delete this.compDestroyFunctions[$],T0(X.getGui())}}if(this.resetStatusBar(),z)this.processStatusPanels(J)}resetStatusBar(){z0(this.eStatusBarLeft),z0(this.eStatusBarCenter),z0(this.eStatusBarRight),this.destroyComponents(),this.statusBarSvc.unregisterAllComponents()}destroy(){this.destroyComponents(),super.destroy()}destroyComponents(){for(let Q of Object.values(this.compDestroyFunctions))Q();this.compDestroyFunctions={}}createAndRenderComponents(Q,z,J){let Z=[];for(let $ of Q){let X=$.key||$.statusPanel,Y=J.get(X),G;if(Y)G=g.resolve(Y);else{let q=Uj(this.userCompFactory,$,y(this.gos,{key:X}));if(q==null)continue;G=q.newAgStackInstance()}Z.push({key:X,promise:G})}return g.all(Z.map(($)=>$.promise)).then(()=>{for(let $ of Z)$.promise.then((X)=>{let Y=()=>{this.destroyBean(X)};if(this.isAlive())this.statusBarSvc.registerStatusPanel($.key,X),z.appendChild(X.getGui()),this.compDestroyFunctions[$.key]=Y;else Y()})})}},Lj={selector:"AG-STATUS-BAR",component:Kj},Fj={tag:"div",cls:"ag-status-name-value",children:[{tag:"span",ref:"eLabel"},": ",{tag:"span",ref:"eValue",cls:"ag-status-name-value-value"}]},Dj=BigInt(Number.MIN_SAFE_INTEGER),Mj=BigInt(Number.MAX_SAFE_INTEGER),CJ=class extends x{constructor(){super(Fj);this.eLabel=S,this.eValue=S}setLabel(Q,z){this.setDisplayed(!1),this.eLabel.textContent=this.getLocaleTextFunc()(Q,z)}setValue(Q,z){let J=null,Z;if(typeof Q==="bigint"){if(Z=Q,Q>=Dj&&Q<=Mj)J=Number(Q)}else J=Q;this.eValue.textContent=this.valueFormatter(y(this.gos,{value:J,bigintValue:Z,totalRows:z,key:this.key}))}},kj={selector:"AG-NAME-VALUE",component:CJ},sY=(Q)=>{let z=0;return Q.forEachNodeAfterFilter((J)=>{if(J.data)z++}),z},bJ=(Q)=>{let z=0;return Q.forEachNode((J)=>{if(J.data)z++}),z};function Vj(Q,z){if(typeof Q!=="number")return"";return MQ(Math.round(Q*100)/100,z)}var fj={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"}]},Aj=class extends x{constructor(){super(fj,[kj]);this.sumAggregationComp=S,this.countAggregationComp=S,this.minAggregationComp=S,this.maxAggregationComp=S,this.avgAggregationComp=S}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(Q){this.refresh(Q)}refresh(Q){this.params=Q;let z=Q.valueFormatter??((Z)=>{let{value:$,bigintValue:X}=Z;if(X!=null)return X.toString();return Vj($,this.getLocaleTextFunc.bind(this))}),J=["avg","count","min","max","sum"];for(let Z of J){let $=this.getAllowedAggregationValueComponent(Z);if($)$.key=Z,$.valueFormatter=z.bind(this)}return this.onCellSelectionChanged(),!0}setAggregationComponentValue(Q,z,J){let Z=this.getAllowedAggregationValueComponent(Q),$=bJ(this.beans.rowModel);if(T(Z)&&Z)Z.setValue(z,$),Z.setDisplayed(J);else this.getAggregationValueComponent(Q)?.setDisplayed(!1)}getAllowedAggregationValueComponent(Q){let{aggFuncs:z}=this.params;if(!z||z.includes(Q))return this.getAggregationValueComponent(Q);return null}getAggregationValueComponent(Q){let z=`${Q}AggregationComp`;return this[z]}onCellSelectionChanged(){let Q=this.beans,{rangeSvc:z,valueSvc:J}=Q,Z=z?.getCellRanges(),$=0,X=0n,Y=!1,G=!1,q=0,H=0,_=null,U=null,W=null,B=null,E=(I)=>{if(typeof I==="number"){if($+=I,_===null||I<_)_=I;if(U===null||I>U)U=I;if(!Number.isInteger(I)||!Number.isSafeInteger(I))G=!0;else{let C=BigInt(I);if(X+=C,W===null||CB)B=C}}else{if(Y=!0,X+=I,W===null||IB)B=I;let C=Number(I);if($+=C,_===null||C<_)_=C;if(U===null||C>U)U=C}H++},K={};if(Z?.length&&z)for(let I=0;I{if(m===null)return;let u=bQ({rowPinned:m.rowPinned,column:t,rowIndex:m.rowIndex});if(K[u])return;K[u]=!0;let Q0=M0(Q,m);if(n(Q0))return;let r=J.getValue(t,Q0,"data");if(n(r)||r==="")return;if(q++,typeof r==="object"&&"value"in r){if(r=r.value,r==="")return}if(typeof r==="string"){let S0=r.trim();if(S0==="")return;let O0=Number(S0);if(!Number.isFinite(O0))return;if($+O0>=Number.MAX_SAFE_INTEGER||$+O0<=Number.MIN_SAFE_INTEGER||O0>=Number.MAX_SAFE_INTEGER||O0<=Number.MIN_SAFE_INTEGER){if(r=qz(S0),r===null)r=O0}else r=O0}if(typeof r==="number"&&!isNaN(r)||typeof r==="bigint")E(r)}),m=L0(Q,m)}}let L=q>1,F=H>1,D=Y&&!G,M;if(D)M=X/BigInt(H);else M=$/H;let k=F?D?X:$:null,f=F?D?W:_:null,A=F?D?B:U:null,O=F?M:null,v=F;this.setAggregationComponentValue("count",q,L),this.setAggregationComponentValue("sum",k,F),this.setAggregationComponentValue("min",f,F),this.setAggregationComponentValue("max",A,F),this.setAggregationComponentValue("avg",O,v)}},jj=class extends CJ{postConstruct(){this.setLabel("filteredRows","Filtered"),this.addCss("ag-status-panel"),this.addCss("ag-status-panel-filtered-row-count"),this.setDisplayed(!0);let Q=this.onDataChanged.bind(this);this.addManagedEventListeners({modelUpdated:Q})}onDataChanged(){let{rowModel:Q}=this.beans,z=bJ(Q),J=sY(Q);this.setValue(J,z),this.setDisplayed(z!==J)}init(Q){this.refresh(Q),this.onDataChanged()}updateValueFormatter(Q){this.valueFormatter=Q??(({value:z})=>MQ(z,this.getLocaleTextFunc.bind(this)))}refresh(Q){let{key:z,valueFormatter:J}=Q;return this.key=z,this.updateValueFormatter(J),!0}},Rj=class extends CJ{postConstruct(){this.setLabel("selectedRows","Selected"),this.addCss("ag-status-panel"),this.addCss("ag-status-panel-selected-row-count");let Q=this.onRowSelectionChanged.bind(this);this.addManagedEventListeners({modelUpdated:Q,selectionChanged:Q})}onRowSelectionChanged(){let{selectionSvc:Q,rowModel:z}=this.beans,J=Q?.getSelectionCount()??0,Z=bJ(z);if(this.setValue(J,Z),J<0){this.setDisplayed(!0);return}this.setDisplayed(J>0)}init(Q){this.refresh(Q),this.onRowSelectionChanged()}updateValueFormatter(Q){this.valueFormatter=Q??(({value:z})=>{if(z==null||z>=0)return MQ(z,this.getLocaleTextFunc.bind(this));return this.getLocaleTextFunc()("statusBarLastRowUnknown","?")})}refresh(Q){let{key:z,valueFormatter:J}=Q;return this.key=z,this.updateValueFormatter(J),!0}},Sj=class extends CJ{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:Q}=this.beans,z=sY(Q),J=bJ(Q);this.setValue(z,J)}init(Q){this.refresh(Q),this.onDataChanged()}updateValueFormatter(Q){this.valueFormatter=Q??(({value:z,totalRows:J})=>{let Z=this.getLocaleTextFunc.bind(this),$=MQ(z,Z),X=MQ(J??z,Z);if(z===J)return $;let Y=Z();return`${$} ${Y("of","of")} ${X}`})}refresh(Q){let{key:z,valueFormatter:J}=Q;return this.key=z,this.updateValueFormatter(J),!0}},Oj=class extends CJ{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 Q=bJ(this.beans.rowModel);this.setValue(Q,Q)}init(Q){this.refresh(Q),this.onDataChanged()}updateValueFormatter(Q){this.valueFormatter=Q??(({value:z})=>MQ(z,this.getLocaleTextFunc.bind(this)))}refresh(Q){let{key:z,valueFormatter:J}=Q;return this.key=z,this.updateValueFormatter(J),!0}};function Pj(Q,z){let J=Q.statusBarSvc?.getStatusPanel(z);return mQ(J)}var Tj=class extends j{constructor(){super();this.beanName="statusBarSvc",this.comps=new Map}registerStatusPanel(Q,z){this.comps.set(Q,z)}unregisterStatusPanel(Q){this.comps.delete(Q)}unregisterAllComponents(){this.comps.clear()}getStatusPanel(Q){return this.comps.get(Q)}destroy(){this.unregisterAllComponents(),super.destroy()}},lY={moduleName:"StatusBar",version:J0,beans:[Tj],userComponents:{agAggregationComponent:Aj,agTotalRowCountComponent:Oj,agFilteredRowCountComponent:jj,agTotalAndFilteredRowCountComponent:Sj,agSelectedRowCountComponent:Rj},selectors:[Lj],apiFunctions:{getStatusPanel:Pj},dependsOn:[I0,iz]};function aY(Q){if(Q.excelCreator?.getFactoryMode()==="MULTI_SHEET")return R(161),!1;return!0}function vj(Q,z){if(aY(Q))return Q.excelCreator?.getDataAsExcel(z);return}function Ij(Q,z){if(aY(Q))Q.excelCreator?.exportDataAsExcel(z)}function Cj(Q,z){return Q.excelCreator?.setFactoryMode("MULTI_SHEET"),Q.excelCreator?.getSheetDataForExcel(z)}function bj(Q,z){return Q.excelCreator?.getMultipleSheetsAsExcel(z)}function yj(Q,z){Q.excelCreator?.exportMultipleSheetsAsExcel(z)}var oY={moduleName:"ExcelExport",version:J0,beans:[lV],apiFunctions:{getDataAsExcel:vj,exportDataAsExcel:Ij,getSheetDataForExcel:Cj,getMultipleSheetsAsExcel:bj,exportMultipleSheetsAsExcel:yj},dependsOn:[S6,I0]};function L2(Q){let{filters:z}=Q;return z&&z.length>0?z:[{filter:"agTextColumnFilter"},{filter:"agSetColumnFilter"}]}function U2(Q,z){if(Q==null)return;for(let J=Q.length-1;J>=0;J--)z(Q[J],J)}function xj(Q,z){if(z.title!=null)return z.title;return Q instanceof wZ?Q.getFilterTitle():"Filter"}function W2(Q,z,J,Z){let $=[],X=Q?.filterModels;for(let Y=0;YY==null)?null:{filterType:"multi",filterModels:$}}function nQ(Q,z){return Q?.filterModels?.[z]??null}function B2(Q,z,J,Z){let $=J.filterValueGetter;return $?Q.colFilter.createGetValue(z,$):Z}var eY=class extends _6{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:(Q)=>this.onFocusIn(Q)})}refreshGui(Q){if(Q===this.lastOpenedInContainer)return g.resolve();return this.tabGuardFeature.removeAllChildrenExceptTabGuards(),this.destroyChildren(),g.all(this.getFilterWrappers().map((z,J)=>{if(!z)return g.resolve(null);let Z=this.getFilterFromWrapper(z),$=this.getCompFromWrapper(z),X=this.filterDefs[J],Y=xj(Z,X),G;if(X.display==="subMenu"&&Q!=="toolPanel")G=this.insertFilterMenu($,Z,Y).then((q)=>q.getGui());else if(X.display==="subMenu"||X.display==="accordion"){let q=this.insertFilterGroup(Z,$,Y);G=g.resolve(q.getGui())}else G=g.resolve($.getGui());return G})).then((z)=>{z.forEach((J,Z)=>{if(!J)return;if(Z>0)this.appendChild(Z0({tag:"div",cls:"ag-filter-separator"}));this.appendChild(J)}),this.filterGuis=z,this.lastOpenedInContainer=Q})}destroyChildren(){for(let Q of this.guiDestroyFuncs)Q();this.guiDestroyFuncs.length=0,this.filterGuis.length=0}insertFilterMenu(Q,z,J){let Z=Q.getGui();H0(Z,"dialog");let $=this.createBean(new WA),X={getGui:()=>Q.getGui(),afterGuiAttached:(Y)=>{if(Q.afterGuiAttached?.(Y),Q!==z)z.afterGuiAttached?.(Y)}};return $.init({menuItemDef:{name:J,subMenu:[],subMenuRole:"dialog",cssClasses:["ag-multi-filter-menu-item"],menuItem:vY,menuItemParams:{cssClassPrefix:"ag-compact-menu-option",isCompact:!0}},level:0,isAnotherSubMenuOpen:()=>!1,childComponent:X,contextParams:{column:null,node:null,value:null}}).then(()=>{$.setParentComponent(this),this.guiDestroyFuncs.push(()=>this.destroyBean($)),this.addManagedListeners($,{menuItemActivated:(G)=>{if(this.lastActivatedMenuItem&&this.lastActivatedMenuItem!==G.menuItem)this.lastActivatedMenuItem.deactivate();this.lastActivatedMenuItem=G.menuItem}});let Y=$.getGui();return $.addManagedElementListeners(Y,{keydown:(G)=>{let{key:q}=G;switch(q){case V.UP:case V.RIGHT:case V.DOWN:case V.LEFT:if(G.preventDefault(),q===V.RIGHT)$.openSubMenu(!0);break}},focusin:()=>$.activate(),focusout:()=>{if(!$.isSubMenuOpen()&&!$.isSubMenuOpening())$.deactivate()}}),$})}insertFilterGroup(Q,z,J){let Z=this.createBean(new Wf({title:J,cssIdentifier:"multi-filter"}));if(this.guiDestroyFuncs.push(()=>this.destroyBean(Z)),Z.addItem(z.getGui()),Z.toggleGroupExpand(!1),Q.afterGuiAttached)Z.addManagedListeners(Z,{expanded:()=>Q.afterGuiAttached({container:this.lastOpenedInContainer,suppressFocus:!0,hidePopup:this.hidePopup})});return Z}afterGuiAttached(Q){let z;if(Q)this.hidePopup=Q.hidePopup,z=this.refreshGui(Q.container);else this.hidePopup=void 0,z=g.resolve();let J=Q?.suppressFocus;z.then(()=>{let{filterDefs:Z,filterGuis:$,beans:X}=this,Y=this.getFilterWrappers(),G=!!J;if(Z)U2(Z,(H,_)=>{let U=_===0,W=H.display&&H.display!=="inline",B=J||!U||W,E={...Q??{},suppressFocus:B},K=Y[_],L=K?this.getFilterFromWrapper(K):void 0;if(K){let F=this.getCompFromWrapper(K);if(F!==L)F.afterGuiAttached(E)}if(L){if(this.executeFunctionIfExistsOnFilter(L,"afterGuiAttached",E),U&&!B)G=!0}if(!J&&U&&W){let F=$[_];if(F){if(!D0(F))F.focus({preventScroll:!0});G=!0}}});let q=d(X);if(!G&&(hz(X)||this.getGui().contains(q)))this.forceFocusOutOfContainer(!0)})}afterGuiDetached(){this.executeFunctionIfExists("afterGuiDetached")}onAnyFilterChanged(){this.executeFunctionIfExists("onAnyFilterChanged",(Q)=>this.executeOnWrapper(Q,"onAnyFilterChanged"))}onNewRowsLoaded(){this.executeFunctionIfExists("onNewRowsLoaded",(Q)=>this.executeOnWrapper(Q,"onNewRowsLoaded"))}destroy(){this.destroyChildren(),this.hidePopup=void 0,super.destroy()}executeOnWrapper(Q,z){}executeFunctionIfExists(Q,z){U2(this.getFilterWrappers(),(J)=>{if(J)z?.(J),this.executeFunctionIfExistsOnFilter(this.getFilterFromWrapper(J),Q)})}executeFunctionIfExistsOnFilter(Q,z,...J){let Z=Q[z];if(typeof Z==="function")Z.apply(Q,J)}onFocusIn(Q){let z=this.lastActivatedMenuItem;if(z!=null&&!z.getGui().contains(Q.target))z.deactivate(),this.lastActivatedMenuItem=null}},Q4=class extends eY{constructor(){super(...arguments);this.filterType="multi",this.wrappers=[],this.activeFilterIndices=[],this.afterFiltersReadyFuncs=[]}init(Q){this.params=Q,this.filterDefs=L2(Q);let z=F0(this.beans.colFilter.model,Q.column.getColId()),{filterChangedCallback:J}=Q;this.filterChangedCallback=J;let Z=this.filterDefs.map(($,X)=>this.createFilter($,X,z));return new g(($)=>{g.all(Z).then((X)=>{this.wrappers=X,this.refreshGui("columnMenu").then(()=>{$()})})}).then(()=>{for(let $ of this.afterFiltersReadyFuncs)$();this.afterFiltersReadyFuncs.length=0})}refresh(Q){return this.params=Q,!0}isFilterActive(){return this.wrappers.some((Q)=>{if(!Q)return!1;let{filter:z,handler:J,model:Z}=Q;if(J)return Z!=null;return z.isFilterActive()})}getLastActiveFilterIndex(){let Q=this.activeFilterIndices;return Q.length>0?Q[Q.length-1]:null}doesFilterPass(Q,z){return this.wrappers.every((J,Z)=>{if(!J||z!=null&&Z===z)return!0;let{handler:$,filter:X,model:Y}=J;if($)return Y==null||$.doesFilterPass({...Q,model:Y,handlerParams:J.handlerParams});return!X.isFilterActive()||X.doesFilterPass(Q)})}getModelFromUi(){return{filterType:this.filterType,filterModels:this.wrappers.map((z)=>{if(!z)return null;let J=z.filter;if(typeof J.getModelFromUi==="function")return J.getModelFromUi();return null})}}getModel(){if(!this.isFilterActive())return null;return{filterType:this.filterType,filterModels:this.wrappers.map((z)=>{if(!z)return null;let{filter:J,handler:Z,model:$}=z;if(Z)return $;return J.isFilterActive()?J.getModel():null})}}setModel(Q){let z=(Z,$)=>{return new g((X)=>{let Y=Z.setModel($);if(Y)Y.then(X);else X()})},J=[];return this.wrappers.forEach((Z,$)=>{if(!Z)return;let X=nQ(Q,$),{filter:Y,filterParams:G,handler:q,handlerParams:H,state:_}=Z;if(q){let U={model:X,state:_?.state};Z.state=U,Z.model=X,J.push(rZ(()=>g.resolve({filter:Y,filterParams:G}),q,H,X,U,"api").then(()=>{this.updateActiveListForHandler($,Z.model)}))}else J.push(z(Y,X).then(()=>{this.updateActiveListForFilter($,Y)}))}),g.all(J).then(()=>{})}applyModel(Q="api"){let z=!1;for(let J of this.wrappers)if(J){let Z=J.filter;if(Z instanceof wZ)z=Z.applyModel(Q)||z}return z}getChildFilterInstance(Q){return this.wrappers[Q]?.filter}getNumChildFilters(){return this.wrappers.length}destroy(){for(let Q of this.wrappers)this.destroyBean(Q?.filter),this.destroyBean(Q?.handler);this.wrappers.length=0,super.destroy()}getFilterWrappers(){return this.wrappers}getFilterFromWrapper(Q){return Q.filter}getCompFromWrapper(Q){return Q.comp}executeOnWrapper(Q,z){Q.handler?.[z]?.()}createFilter(Q,z,J){let Z=this.params.column,$=null,X,Y=this.beans,G=(B,E)=>{let K=this.wrappers[z];if(!K)return;let L={model:B,state:K.state?.state};K.state=L,K.model=B,rZ(()=>g.resolve({filter:K.filter,filterParams:K.filterParams}),K.handler,K.handlerParams,B,L,"ui").then(()=>{this.onHandlerModelChanged(z,K.model,E)})},{compDetails:q,handler:H,handlerParams:_,createFilterUi:U}=Y.colFilter.createFilterInstance(Z,Q,"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:B2(Y,Z,Q,B.getValue)};if(E)$=nQ(J,z),X=this.updateDisplayParams(K,z,$,()=>q,()=>H,G);return K});if(!U)return g.resolve(null);let W;if(H){let{doesRowPassOtherFilter:B,getValue:E}=_;W={..._,onModelChange:G,doesRowPassOtherFilter:(K)=>B(K)&&this.doesFilterPass({node:K,data:K.data},z),getValue:B2(Y,Z,Q,E)},H.init?.({...W,model:$,source:"init"})}return U().then((B)=>{if(!H)return{filter:B,comp:B};let E=q?.params,K=X(B);return{filter:B,comp:K,filterParams:E,handler:H,handlerParams:W,model:$}})}updateDisplayParams(Q,z,J,Z,$,X){let Y=this.params.column,G=new KQ;Q.model=J,Q.state={model:J},Q.onModelChange=X,Q.getHandler=$;let q=(_,U)=>{_.state=U,G.dispatchEvent({type:"filterStateChanged",column:Y,state:U})};Q.onStateChange=(_)=>{let U=this.wrappers[z];if(!U)return;q(U,_),A1(U.filter,U.filterParams,U.model??null,_,"ui")};let H=(_,U,W)=>{let B=this.wrappers[z];if(!B)return;let E=()=>B?.model??null;FZ({action:U,filterParams:B.filterParams,getFilterUi:()=>{let K=g.resolve(B.filter);return{created:!0,filterParams:B.filterParams,compDetails:Z(),create:()=>K,promise:K}},getModel:E,getState:()=>B?.state??{model:E()},updateState:(K)=>q(B,K),updateModel:(K)=>B.filterParams?.onModelChange(K,W),processModelToApply:B.handler?.processModelToApply?.bind(B.handler)})};return Q.onAction=(_,U,W)=>{H(Y,_,U),G.dispatchEvent({type:"filterAction",column:Y,action:_,event:W})},(_)=>{let U=Z()?.params;return this.createManagedBean(new x6(Y,{comp:_,params:U,isHandler:!0},G,H,!1))}}executeWhenAllFiltersReady(Q){if((this.wrappers?.length??0)>0)Q();else this.afterFiltersReadyFuncs.push(Q)}updateActiveListForFilter(Q,z){this.updateActiveList(Q,()=>z?.isFilterActive())}updateActiveListForHandler(Q,z){this.updateActiveList(Q,()=>z!=null)}updateActiveList(Q,z){let J=this.activeFilterIndices;if($0(this.activeFilterIndices,Q),z())J.push(Q)}onFilterModelChanged(Q,z){this.updateActiveListForFilter(Q,this.wrappers[Q]?.filter),this.filterChanged(Q,z)}onHandlerModelChanged(Q,z,J){this.updateActiveListForHandler(Q,z),this.filterChanged(Q,J)}filterChanged(Q,z){this.filterChangedCallback(z),this.wrappers.forEach((J,Z)=>{if(Q===Z||!J)return;let{filter:$,handler:X}=J;if(X?.onAnyFilterChanged?.(),typeof $.onAnyFilterChanged==="function")$.onAnyFilterChanged()})}getModelAsString(Q){if(!Q?.filterModels?.length)return"";let z=this.getLastActiveFilterIndex()??0;return this.wrappers[z]?.filter?.getModelAsString?.(Q.filterModels[z])??""}},wj=class extends j{constructor(){super(...arguments);this.filterType="multi",this.handlerWrappers=[],this.activeFilterIndices=[],this.filterDefs=[]}init(Q){this.params=Q;let z=L2(Q.filterParams);this.filterDefs=z,z.forEach((J,Z)=>{let $=this.beans.colFilter.createHandler(Q.column,J,"agTextColumnFilter");if(this.handlerWrappers.push($),!$){R(278,{colId:Q.column.getColId()});return}let{handler:X,handlerParams:Y}=$;X.init?.({...this.updateHandlerParams(Y,Z,!0),model:nQ(Q.model,Z),source:"init"})}),this.resetActiveList(Q.model)}refresh(Q){this.params=Q;let{model:z,source:J,filterParams:Z}=Q,$=Z?.filters;if(this.handlerWrappers.forEach((X,Y)=>{if(X){let G=this.updateHandlerParams(Q,Y,!1,$?.[Y].filterParams);X.handlerParams=G,X.handler.refresh?.({...G,model:nQ(z,Y),source:J})}}),Q.source!=="floating"&&Q.source!=="ui")this.resetActiveList(Q.model);if(Q.additionalEventAttributes?.fromButtons)this.onAnyFilterChanged()}updateHandlerParams(Q,z,J,Z){let{onModelChange:$,doesRowPassOtherFilter:X,getValue:Y}=Q,G={...Q,onModelChange:(q,H)=>$(W2(this.params.model,this.handlerWrappers.length,q,z),H),doesRowPassOtherFilter:(q)=>X(q)&&this.doesFilterPass({node:q,data:q.data,model:this.params.model,handlerParams:G},z),getValue:B2(this.beans,Q.column,this.filterDefs[z],Y),filterParams:this.updateFilterParams(Q,J,Z)};return G}updateFilterParams(Q,z,J){let Z=Q.filterParams;if(J?.buttons&&z)R(292,{colId:Q.column.getColId()});let $=J?{...Z,...J}:Z;if(!$.buttons)return $;if(J)return delete $.buttons,$;let{buttons:X,...Y}=$;return Y}doesFilterPass(Q,z){let J=Q.model?.filterModels;if(J==null)return!0;return this.handlerWrappers.every((Z,$)=>{let X=J[$];if(X==null||z!=null&&$===z)return!0;let Y=Z?.handler;return!Y||Y.doesFilterPass({...Q,model:X,handlerParams:Z.handlerParams})})}resetActiveList(Q){this.activeFilterIndices=[];let z=Q?.filterModels;if(z==null)return;for(let J=0;J0?Q[Q.length-1]:null}getModelAsString(Q,z){let J=z==="filterToolPanel",Z=()=>J?this.getLocaleTextFunc()("filterSummaryInactive","is (All)"):"";if(!Q?.filterModels?.length)return Z();let $=this.getLastActiveFilterIndex()??0;return this.handlerWrappers[$]?.handler.getModelAsString?.(Q.filterModels[$],z)??Z()}getHandler(Q){return this.handlerWrappers[Q]?.handler}onAnyFilterChanged(){U2(this.handlerWrappers,(Q)=>Q?.handler?.onAnyFilterChanged?.())}onNewRowsLoaded(){U2(this.handlerWrappers,(Q)=>Q?.handler?.onNewRowsLoaded?.())}destroy(){for(let Q of this.handlerWrappers)this.destroyBean(Q?.handler);this.handlerWrappers.length=0,super.destroy()}},Nj=class extends j{constructor(){super(...arguments);this.beanName="multiFilter"}getParamsForDataType(Q,z,J,Z){let $=Q?.filters,X=this.beans;if(!$)$=[{filter:C6(J.baseDataType)},{filter:"agSetColumnFilter"}];let Y=this.getLocaleTextFunc();return $=$.map((G)=>{let{filter:q,filterParams:H,filterValueGetter:_}=G;if(typeof q!=="string")return G;let{filterParams:U,filterValueGetter:W}=I6(q,H,_??z,J,Z,X,Y);return{...G,filterParams:U,filterValueGetter:W}}),{filterParams:{...Q,filters:$}}}},z4=class extends eY{constructor(){super(...arguments);this.filterType="multi",this.filters=[],this.filterParams=[],this.validity=[]}init(Q){this.params=Q;let z=L2(Q).map((Z)=>{if(Z.filterParams?.buttons){R(292,{colId:Q.column.getColId()});let $={...Z.filterParams};return delete $.buttons,{...Z,filterParams:$}}return Z});this.filterDefs=z,this.allState=Q.state;let J=this.filterDefs.map((Z,$)=>this.createFilter(Z,$));return new g((Z)=>{g.all(J).then(($)=>{this.filters=$,this.refreshGui("columnMenu").then(()=>{Z()})})})}refresh(Q){let{model:z,state:J,source:Z}=Q;if(Z==="colDef")return!1;this.params=Q;let $=this.filterParams;if(J===this.allState)return!0;this.allState=J;let X=J.state;return this.filters.forEach((Y,G)=>{let q=nQ(z,G),H={state:X?.[G],model:nQ(J.model,G)};A1(Y,$[G],q,H,Z)}),!0}getLastActiveFilterIndex(){return this.getHandler().getLastActiveFilterIndex?.()??null}getChildFilterInstance(Q){return this.filters[Q]??void 0}getNumChildFilters(){return this.filters.length}destroy(){for(let Q of this.filters)this.destroyBean(Q);this.filters.length=0,super.destroy()}getFilterWrappers(){return this.filters}getFilterFromWrapper(Q){return Q}getCompFromWrapper(Q){return Q}createFilter(Q,z){let J=this.beans.userCompFactory,Z=this.updateParams(Q,this.params,z),$=d5(J,Q,Z,"agTextColumnFilter");if(!$)return g.resolve(null);return this.filterParams[z]=$.params,$.newAgStackInstance()}updateParams(Q,z,J){let{doesRowPassOtherFilter:Z,model:$,onModelChange:X,state:Y,onStateChange:G,column:q,source:H,onAction:_,onUiChange:U,getValue:W}=z,B=nQ($,J),E=Y?{model:nQ(Y.model,J),state:Y.state?.[J]}:{model:B},K=()=>{let F=this.getHandler();this.filters.forEach((D,M)=>{if(J!==M)F.getHandler(M)?.onAnyFilterChanged?.(),D?.onAnyFilterChanged?.()})},L=this.beans.colFilter;return{...L.createBaseFilterParams(q),...Q,doesRowPassOtherFilter:(F)=>Z(F)&&this.getHandler().doesFilterPass({node:F,data:F.data,model:this.params.model,handlerParams:L.getHandlerParams(q)},J),model:B,state:E,onModelChange:(F,D)=>{let{filters:M,params:k}=this,f=W2(k.model,M.length,F,J);this.updateActiveList(J,F),X(f,D),K()},onStateChange:(F)=>this.onStateChange(G,J,F),getHandler:()=>this.getHandler().getHandler(J),onAction:(F,D,M)=>{if(WJ(z))return;let k=F==="apply"||F==="reset";if(k)this.updateActiveList(J,nQ(this.params.state.model,J));if(_(F,D,M),k)K()},onUiChange:U,source:H,getValue:B2(this.beans,q,Q,W)}}updateActiveList(Q,z){this.getHandler().updateActiveList?.(Q,z)}getHandler(){return this.params.getHandler()}onStateChange(Q,z,J){let{model:Z,state:$,valid:X}=J,Y=this.validity;Y[z]=X;let G=this.allState,q=W2(G.model,this.filters.length,Z,z),H=Y.every((W)=>W!==!1),_=[...G.state??[]];_[z]=$;let U={state:_,model:q,valid:H};this.allState=U,Q(U)}getModelAsString(Q){return this.getHandler().getModelAsString?.(Q)??""}},gj={tag:"div",cls:"ag-multi-floating-filter ag-floating-filter-input"},hj=class extends x{constructor(){super(gj);this.floatingFilters=[],this.compDetailsList=[]}init(Q){this.params=Q;let{compDetailsList:z}=this.getCompDetailsList(Q);return this.setParams(z)}setParams(Q){let z=[];return Q.forEach((J)=>{let Z=J?.newAgStackInstance();if(Z!=null)this.compDetailsList.push(J),z.push(Z)}),g.all(z).then((J)=>{J.forEach((Z,$)=>{this.floatingFilters.push(Z);let X=Z.getGui();if(this.appendChild(X),$>0)N(X,!1)})})}refresh(Q){this.params=Q;let{compDetailsList:z,floatingFilterParamsList:J}=this.getCompDetailsList(Q);if(z.length===this.compDetailsList.length&&z.every(($,X)=>!this.beans.colFilter?.areFilterCompsDifferent(this.compDetailsList[X],$))){if(J.forEach(($,X)=>{this.floatingFilters[X].refresh?.($)}),this.gos.get("enableFilterHandlers")){let $=Q;if($.model==null)this.floatingFilters.forEach((X,Y)=>{N(X.getGui(),Y===0)});else{let X=$.getHandler()?.getLastActiveFilterIndex?.();this.floatingFilters.forEach((Y,G)=>{let q=X==null?G===0:G===X;N(Y.getGui(),q)})}}}else z0(this.getGui()),this.destroyBeans(this.floatingFilters),this.floatingFilters=[],this.compDetailsList=[],this.setParams(z)}getCompDetailsList(Q){let z=[],J=[],Z=Q.filterParams,$=Q.currentParentModel,X=L2(Z);return X.forEach((Y,G)=>{let q={...Q,parentFilterInstance:(_)=>{this.parentMultiFilterInstance((U)=>{let W=U.getChildFilterInstance(G);if(W==null)return;_(W)})},currentParentModel:()=>$()?.filterModels?.[G]??null};if(this.gos.get("enableFilterHandlers")){let _=q;_.model=_.model?.filterModels?.[G]??null;let{onModelChange:U,getHandler:W}=_;_.onModelChange=(B,E)=>U(W2(this.params.model,X.length,B,G),E),_.getHandler=()=>{return W().getHandler(G)}}B0(q.filterParams,Y.filterParams);let H=this.getCompDetails(Y,q);if(H)z.push(H),J.push(q)}),{compDetailsList:z,floatingFilterParamsList:J}}onParentModelChanged(Q,z){if(z?.afterFloatingFilter)return;this.parentMultiFilterInstance((J)=>{if(Q==null)this.floatingFilters.forEach((Z,$)=>{Z.onParentModelChanged(null,z),N(Z.getGui(),$===0)});else{let Z=J.getLastActiveFilterIndex();this.floatingFilters.forEach(($,X)=>{let Y=Q.filterModels.length>X?Q.filterModels[X]:null;$.onParentModelChanged(Y,z);let G=Z==null?X===0:X===Z;N($.getGui(),G)})}})}destroy(){this.destroyBeans(this.floatingFilters),this.floatingFilters.length=0,super.destroy()}getCompDetails(Q,z){let{colFilter:J,frameworkOverrides:Z,userCompFactory:$}=this.beans,X=b6(Z,Q,()=>J.getDefaultFloatingFilter(this.params.column))??"agReadOnlyFloatingFilter";return t5($,Q,z,X)}parentMultiFilterInstance(Q){this.params.parentFilterInstance((z)=>{if(!(z instanceof Q4||z instanceof z4))e(120);Q(z)})}},J4={moduleName:"MultiFilter",version:J0,userComponents:{agMultiColumnFilter:{getComp:(Q)=>Q.gos.get("enableFilterHandlers")?{classImp:z4,params:{useForm:!0}}:Q4},agMultiColumnFloatingFilter:hj},beans:[Nj],dynamicBeans:{agMultiColumnFilterHandler:wj},dependsOn:[I0,FX,X7]},uj=class extends j{constructor(){super(...arguments);this.beanName="aggColNameSvc"}getHeaderName(Q,z){if(this.gos.get("suppressAggFuncInHeader"))return z;let{valueColsSvc:J,colModel:Z,rowGroupColsSvc:$}=this.beans,X=Q.getColDef().pivotValueColumn,Y=T(X),G=null,q;if(Y){let H=J?.columns??[],_=this.gos.get("removePivotHeaderRowWhenSingleValueColumn")&&H.length===1,U=Q.getColDef().pivotTotalColumnIds!==void 0;if(_&&!U)return z;G=X?X.getAggFunc():null,q=!0}else{let H=Q.isValueActive(),_=$?.columns.length!==0,U=Z.isPivotMode()||_||this.gos.get("treeData");if(H&&U)G=Q.getAggFunc(),q=!0;else q=!1}if(q){let H=typeof G==="string"?G:"func";return`${this.getLocaleTextFunc()(H,H)}(${z})`}return z}},mj={sum:"Sum",first:"First",last:"Last",min:"Min",max:"Max",count:"Count",avg:"Average"},cj=class extends j{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 Q=this.aggFuncsMap;Q.sum=pj,Q.first=ij,Q.last=nj,Q.min=dj,Q.max=tj,Q.count=sj,Q.avg=aj,this.initialised=!0}isAggFuncPossible(Q,z){let Z=this.getFuncNames(Q).includes(z),$=T(this.aggFuncsMap[z]);return Z&&$}getDefaultFuncLabel(Q){return mj[Q]??Q}getDefaultAggFunc(Q){let z=Q.getColDef().defaultAggFunc;if(T(z)&&this.isAggFuncPossible(Q,z))return z;if(this.isAggFuncPossible(Q,"sum"))return"sum";let J=this.getFuncNames(Q);return J?.length?J[0]:null}addAggFuncs(Q){if(this.init(),!Q)return;for(let z of Object.keys(Q))if(Q[z])this.aggFuncsMap[z]=Q[z]}getAggFunc(Q){return this.init(),this.aggFuncsMap[Q]}getFuncNames(Q){let z=Q.getColDef().allowedAggFuncs;return z==null?Object.keys(this.aggFuncsMap).sort():z}clear(){this.aggFuncsMap={}}};function pj(Q){let{values:z}=Q,J=null;for(let Z=0;Z0?Q.values[0]:null}function nj(Q){return Q.values.length>0?b(Q.values):null}function dj(Q){let{values:z}=Q,J=null;for(let Z=0;Z$))J=$}return J}function tj(Q){let{values:z}=Q,J=null;for(let Z=0;Z0)$=J/(typeof J==="number"?Z:BigInt(Z));let X=Q.rowNode?.aggData?.[Q.column?.getColId()];if(X&&X.count===Z&&X.value===$)return X;let Y=Object.create(lj);return Y.count=Z,Y.value=$,Y}var oj=class extends j{constructor(){super(...arguments);this.beanName="aggChildrenSvc"}getAggregatedChildren(Q,z,J){if(!Q?.group)return[];if(Q.rowPinned){if(Q=Q.pinnedSibling,!Q)return[]}let Z=this.gos,$=Z4(Q,z,Z);if(!J)return $;let X=[];return $4($,z,Z,X),X}},Z4=(Q,z,J)=>{let Z=z?.colDef,$=Z?.pivotKeys;if($){if(Q.leafGroup&&$.length&&!Z.pivotTotalColumnIds)return gY(Q.childrenMapped,$);return Q.childrenAfterFilter??Q.childrenAfterGroup??[]}if(TQ(J)||J.get("suppressAggFilteredOnly"))return Q.childrenAfterGroup??[];return Q.childrenAfterFilter??Q.childrenAfterGroup??[]},$4=(Q,z,J,Z)=>{for(let $=0,X=Q.length;${uX(A,null,k)})}return}this.hadAgg=!0;let{colModel:X,aggFuncSvc:Y}=J,G=z.get("alwaysAggregateAtRootLevel")||!!_z(z)||X.isPivotMode(),q=!TQ(z)&&!z.get("suppressAggFilteredOnly"),H=J.valueSvc,_=J.gridApi,U=J.gridOptions.context,W=$??[],B=W.length,E=Q?.kind==="cells"?Q:void 0,K,L=Array(B);for(let k=0;k=0)K=E;L[k]={column:f,colId:f.colId,colDef:f.colDef,aggFunc:X4(f.getAggFunc(),Y,f),colSlot:A}}let F=XR(X,J.pivotResultCols,Y),D=B>0?Array(B):null,M=J.rowModel;A0(M.rootNode,M.hierarchical,Q,(k)=>{if(k.level===-1&&!G){O1(k,null,X);return}let f;if(Z)f=Z({nodes:k.childrenAfterFilter});else if(!D)f=null;else if(F)f=$R(k,F,H,_,U);else f=ZR(k,L,B,D,K,q,H,_,U);uX(k,f,X)})}},ZR=(Q,z,J,Z,$,X,Y,G,q)=>{let H=(X?Q.childrenAfterFilter:Q.childrenAfterGroup)??[],_=H.length,U=Q.data,W=Object.create(null),B=$?$.getSlot(Q):-1,E=B>=0?Q.aggData:void 0,K=0;for(let L=0;L=0&&!$.hasCellBySlot(B,F.colSlot)){if(Z[L]=null,E)W[F.colId]=E[F.colId]}else Z[L]=Array(_),++K}if(K===0)return W;for(let L=0;L<_;++L){let F=H[L],D=F.aggData;if(D)for(let M=0;M{let X=z.length,Y=Q.leafGroup,G=Q.data,q=Q.childrenMapped,H=Q.childrenAfterFilter??[],_=Object.create(null),U,W;for(let B=0;B{if(typeof Q==="function")return Q;if(Q==null)return null;let Z=z.getAggFunc(Q);if(typeof Z!=="function")return R(109,{inputValue:Q.toString(),allSuggestions:z.getFuncNames(J)}),null;return Z},XR=(Q,z,J)=>{if(!Q.isPivotActive())return null;let Z=z?.getAggregationOrderedList();if(!Z||Z.length===0)return null;let $=Z.length,X=Array($),Y=0;for(let G=0;G<$;++G){let q=Z[G],H=q.colDef,_=H.pivotValueColumn;if(!_)continue;X[Y++]={column:_,colId:H.colId,aggFunc:X4(_.getAggFunc(),J,_),pivotResultCol:q,pivotKeys:H.pivotKeys,totalColIds:H.pivotTotalColumnIds}}if(Y===0)return null;return X.length=Y,X},YR=class extends j{constructor(){super(...arguments);this.beanName="filterAggStage",this.step="filter_aggregates",this.refreshProps=[],this.setAllChildrenCountTreeData=(Q)=>{let z=Q.childrenAfterAggFilter,J=0;if(z){let $=z.length;J=$;for(let X=0;X<$;++X)J+=z[X].allChildrenCount??0}let Z=J===0&&Q.level>=0?null:J;Q.setAllChildrenCount(Z),Q.pinnedSibling?.setAllChildrenCount(Z)},this.setAllChildrenCountGridGrouping=(Q)=>{let z=Q.childrenAfterAggFilter,J=0;for(let Z=0,$=z.length;Z<$;++Z){let X=z[Z];if(X.group)J+=X.allChildrenCount;else J++}Q.setAllChildrenCount(J),Q.pinnedSibling?.setAllChildrenCount(J)}}wireBeans(Q){this.filterManager=Q.filterManager}execute(Q){let{rowModel:z,colModel:J,groupStage:Z}=this.beans,{filterManager:$}=this,X=J.isPivotMode(),Y=$?.isAggregateFilterPresent()||$?.isAggregateQuickFilterPresent(),G=!!Z?.treeData,q=(E)=>!E.node.group,H=(E)=>E.node.leafGroup,_=TQ(this.gos)||(X?H:q),U=G?this.setAllChildrenCountTreeData:this.setAllChildrenCountGridGrouping,W=(E,K=!1)=>{if(E.childrenAfterFilter){if(E.childrenAfterAggFilter=E.childrenAfterFilter,K){let L=E.childrenAfterAggFilter;for(let F=0,D=L.length;F{if(E.childrenAfterAggFilter=E.childrenAfterFilter?.filter((K)=>{if(_({node:K})){if($.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};A0(z.rootNode,z.hierarchical,Q,Y?B:W)}};function PJ(Q,z){if(Q.sibling)return;let J=g9(Q,z);J.footer=!0,J.setRowTop(null),J.setRowIndex(null),J.oldRowTop=null,J.id="rowGroupFooter_"+Q.id,J.sibling=Q,Q.sibling=J}function GR(Q){let z=Q.sibling;if(!z)return;z._destroy(!1),Q.sibling=void 0,z.sibling=void 0}var qR=class extends j{constructor(){super(...arguments);this.beanName="footerSvc"}addTotalRows(Q,z,J,Z,$,X){let Y=Q;if($){let H=Z&&_z(this.gos);if(HR(X,H))PJ(z,this.beans),J(z.sibling,Y++);return Y}let G=OZ(this.gos);if((Z&&G({node:z}))===X)PJ(z,this.beans),J(z.sibling,Y++);return Y}getTopDisplayIndex(Q,z,J,Z){let $=z;if(Q[0].footer){if(z===0)return 0;$-=1}let X=Q[Q.length-1],Y=$>=J.length;if(X.footer&&Y)return X.rowIndex;return Z($)}doesCellShowTotalPrefix(Q,z){if(!Q.footer||!z?.getColDef().showRowGroup)return!1;if(this.gos.get("treeData"))return!0;if(Q.level===-1)return this.beans.showRowGroupCols?.columns[0]===z;return!!Q.rowGroupColumn&&z?.isRowGroupDisplayed(Q.rowGroupColumn.getId())}applyTotalPrefix(Q,z,J,Z){let $=Z.getColDef().cellRendererParams?.totalValueGetter;if($){let X=y(this.gos,{column:Z,node:J,value:Q,formattedValue:z});if(typeof $==="function")return $(X);if(typeof $==="string")return this.beans.expressionSvc?.evaluate($,X);R(179)}if(J.level===-1)return this.getLocaleTextFunc()("footerTotal","Total")+" ";return this.getTotalValue(z??Q)??""}getTotalValue(Q){return this.getLocaleTextFunc()("footerTotal","Total")+" "+(Q??"")}};function HR(Q,z){switch(z){case"top":case"pinnedTop":return Q==="top";case"bottom":case"pinnedBottom":return Q==="bottom";default:return!1}}var Y4=class extends j1{constructor(){super(...arguments);this.beanName="valueColsSvc",this.eventName="columnValueChanged",this.columnProcessors={set:(Q,z,J)=>this.setValueActive(z,Q,J),add:(Q,z,J)=>this.setValueActive(!0,Q,J),remove:(Q,z,J)=>this.setValueActive(!1,Q,J)},this.columnExtractors={setFlagFunc:(Q,z,J)=>this.setColValueActive(Q,z,J),getIndexFunc:()=>{return},getInitialIndexFunc:()=>{return},getValueFunc:(Q)=>{let z=Q.aggFunc;if(z===null||z==="")return null;if(z===void 0)return;return!!z},getInitialValueFunc:(Q)=>{return Q.initialAggFunc!=null&&Q.initialAggFunc!=""}},this.modifyColumnsNoEventsCallbacks={addCol:(Q)=>this.columns.push(Q),removeCol:(Q)=>$0(this.columns,Q)}}extractCols(Q,z){this.columns=super.extractCols(Q,z);for(let J of this.columns){let Z=J.getColDef();if(Z.aggFunc!=null&&Z.aggFunc!="")this.setColAggFunc(J,Z.aggFunc);else if(!J.getAggFunc())this.setColAggFunc(J,Z.initialAggFunc)}return this.columns}setColumnAggFunc(Q,z,J){if(!Q)return;let Z=this.colModel.getColDefCol(Q);if(!Z)return;this.setColAggFunc(Z,z),this.dispatchColumnChangedEvent(this.eventSvc,this.eventName,[Z],J)}syncColumnWithState(Q,z,J){let Z=J("aggFunc").value1;if(Z!==void 0)if(typeof Z==="string"){if(this.setColAggFunc(Q,Z),!Q.isValueActive())this.setColValueActive(Q,!0,z),this.modifyColumnsNoEventsCallbacks.addCol(Q)}else{if(T(Z))R(33);if(Q.isValueActive())this.setColValueActive(Q,!1,z),this.modifyColumnsNoEventsCallbacks.removeCol(Q)}}setValueActive(Q,z,J){if(Q===z.isValueActive())return;if(this.setColValueActive(z,Q,J),Q&&!z.getAggFunc()&&this.aggFuncSvc){let Z=this.aggFuncSvc.getDefaultAggFunc(z);this.setColAggFunc(z,Z)}}setColAggFunc(Q,z){Q.aggFunc=z,Q.dispatchStateUpdatedEvent("aggFunc")}setColValueActive(Q,z,J){if(Q.aggregationActive!==z)Q.aggregationActive=z,Q.dispatchColEvent("columnValueChanged",J)}},G4={moduleName:"SharedAggregation",version:J0,beans:[cj,uj,qR,Y4],apiFunctions:{addAggFuncs:ej,clearAggFuncs:QR,setColumnAggFunc:zR},dependsOn:[I0]},_R={moduleName:"Aggregation",version:J0,beans:[JR,YR,oj],rowModels:["clientSide"],dependsOn:[G4]},q4=class extends j1{constructor(){super(...arguments);this.beanName="pivotColsSvc",this.eventName="columnPivotChanged",this.columnProcessors={set:(Q,z,J)=>this.setColPivotActive(Q,z,J),add:(Q,z,J)=>this.setColPivotActive(Q,!0,J),remove:(Q,z,J)=>this.setColPivotActive(Q,!1,J)},this.columnOrdering={enableProp:"pivot",initialEnableProp:"initialPivot",indexProp:"pivotIndex",initialIndexProp:"initialPivotIndex"},this.columnExtractors={setFlagFunc:(Q,z,J)=>this.setColPivotActive(Q,z,J),getIndexFunc:(Q)=>Q.pivotIndex,getInitialIndexFunc:(Q)=>Q.initialPivotIndex,getValueFunc:(Q)=>Q.pivot,getInitialValueFunc:(Q)=>Q.initialPivot},this.modifyColumnsNoEventsCallbacks={addCol:(Q)=>{if(!this.columns.includes(Q))this.columns.push(Q)},removeCol:(Q)=>$0(this.columns,Q)}}syncColumnWithState(Q,z,J,Z){let{value1:$,value2:X}=J("pivot","pivotIndex");if($!==void 0||X!==void 0){if(typeof X==="number"||$){if(!Q.isPivotActive())this.setColPivotActive(Q,!0,z),this.modifyColumnsNoEventsCallbacks.addCol(Q);if(Z&&typeof X==="number")Z[Q.getId()]=X}else if(Q.isPivotActive())this.setColPivotActive(Q,!1,z),this.modifyColumnsNoEventsCallbacks.removeCol(Q)}}setColPivotActive(Q,z,J){if(Q.pivotActive!==z){if(Q.pivotActive=z,z)this.beans.groupHierarchyColSvc?.insertVirtualColumnsForCol(this.columns,Q)?.forEach(($)=>this.setColPivotActive($,z,J));Q.dispatchColEvent("columnPivotChanged",J)}Q.dispatchStateUpdatedEvent("pivot")}},UR=class extends j1{constructor(){super(...arguments);this.beanName="rowGroupColsSvc",this.eventName="columnRowGroupChanged",this.columnProcessors={set:(Q,z,J)=>this.setActive(z,Q,J),add:(Q,z,J)=>this.setActive(!0,Q,J),remove:(Q,z,J)=>this.setActive(!1,Q,J)},this.columnOrdering={enableProp:"rowGroup",initialEnableProp:"initialRowGroup",indexProp:"rowGroupIndex",initialIndexProp:"initialRowGroupIndex"},this.columnExtractors={setFlagFunc:(Q,z,J)=>this.setColRowGroupActive(Q,z,J),getIndexFunc:(Q)=>Q.rowGroupIndex,getInitialIndexFunc:(Q)=>Q.initialRowGroupIndex,getValueFunc:(Q)=>Q.rowGroup,getInitialValueFunc:(Q)=>Q.initialRowGroup},this.modifyColumnsNoEventsCallbacks={addCol:(Q)=>{if(!this.columns.includes(Q))this.columns.push(Q)},removeCol:(Q)=>$0(this.columns,Q)}}moveColumn(Q,z,J){if(this.columns.length===0)return;let Z=this.columns[Q],$=this.columns.slice(Q,z);this.columns.splice(Q,1),this.columns.splice(z,0,Z),this.updateIndexMap(),this.eventSvc.dispatchEvent({type:this.eventName,columns:$,column:$.length===1?$[0]:null,source:J})}syncColumnWithState(Q,z,J,Z){let{value1:$,value2:X}=J("rowGroup","rowGroupIndex");if($!==void 0||X!==void 0){if(typeof X==="number"||$){if(!Q.isRowGroupActive())this.setColRowGroupActive(Q,!0,z),this.modifyColumnsNoEventsCallbacks.addCol(Q);if(Z&&typeof X==="number")Z[Q.getId()]=X}else if(Q.isRowGroupActive())this.setColRowGroupActive(Q,!1,z),this.modifyColumnsNoEventsCallbacks.removeCol(Q)}}setActive(Q,z,J){if(Q===z.isRowGroupActive())return;this.setColRowGroupActive(z,Q,J);let Z=this.beans.groupHierarchyColSvc?.getColumn(z);if(TZ(this.gos,Q)&&!Z)this.colModel.setColsVisible([z],!Q,J)}setColRowGroupActive(Q,z,J){if(Q.rowGroupActive!==z){if(Q.rowGroupActive=z,z)this.beans.groupHierarchyColSvc?.insertVirtualColumnsForCol(this.columns,Q)?.forEach(($)=>this.setColRowGroupActive($,z,J));Q.dispatchColEvent("columnRowGroupChanged",J)}Q.dispatchStateUpdatedEvent("rowGroup")}},WR=class extends j{constructor(){super(...arguments);this.beanName="autoColSvc"}postConstruct(){this.addManagedPropertyListener("autoGroupColumnDef",this.updateColumns.bind(this)),this.setupGroupHideColumnsUntilExpanded()}setupGroupHideColumnsUntilExpanded(){let Q=()=>this.updateGroupColumnVisibility();this.addManagedEventListeners({modelUpdated:Q}),this.addManagedPropertyListeners(["groupHideColumnsUntilExpanded","groupDisplayType","groupHideOpenParents"],Q)}addColumns(Q){let{columns:z}=this;if(z==null)return;Q.list=z.list.concat(Q.list),Q.tree=z.tree.concat(Q.tree),HJ(Q)}createColumns(Q,z,J){let Z=this.beans,{colModel:$,gos:X,rowGroupColsSvc:Y,colGroupSvc:G}=Z,q=$.isPivotMode(),H=PZ(X,q),_=q?X.get("pivotSuppressAutoColumn"):this.isSuppressAutoCol(),U=Y?.columns,B=!(U&&U.length>0||X.get("treeData"))||_||H,E=()=>{if(this.columns)ZQ(Z,this.columns.tree),this.columns=null};if(B){E();return}let K=this.generateAutoCols(U),L=qJ(K,this.columns?.list||null),F=Q.treeDepth,M=(this.columns?this.columns.treeDepth:-1)==F;if(L&&M){let O=new Map(K.map((v)=>[v.getId(),v]));for(let v of this.columns?.list??[]){let I=O.get(v.getId());if(I)v.setColDef(I.getColDef(),null,J)}return}E();let k=G?.findDepth(Q.tree)??0,f=G?.balanceTreeForAutoCols(K,k)??[];this.columns={list:K,tree:f,treeDepth:k,map:{}},z((O)=>{if(!O)return null;let v=O.filter((I)=>!mz(I));return[...K,...v]})}updateColumns(Q){let z=Xz(Q.source);this.columns?.list.forEach((J,Z)=>this.updateOneAutoCol(J,Z,z))}getColumn(Q){return this.columns?.list.find((z)=>PQ(z,Q))??null}getColumns(){return this.columns?.list??null}generateAutoCols(Q=[]){let z=[],{gos:J}=this,Z=J.get("treeData"),$=YJ(J);if(Z&&$)R(182),$=!1;if($)Q.forEach((X,Y)=>{z.push(this.createOneAutoCol(X,Y))});else z.push(this.createOneAutoCol());return z}isSuppressAutoCol(){let Q=this.gos;if(Q.get("groupDisplayType")==="custom")return!0;return Q.get("treeDataDisplayType")==="custom"}createOneAutoCol(Q,z){let J;if(Q)J=`${uz}-${Q.getId()}`;else J=uz;let Z=this.createAutoColDef(J,Q,z);Z.colId=J;let $=new GQ(Z,null,J,!0);return this.createBean($),$}updateOneAutoCol(Q,z,J){let Z=Q.getColDef(),$=typeof Z.showRowGroup=="string"?Z.showRowGroup:void 0,X=this.beans,Y=$!=null?X.colModel.getColDefCol($):void 0,G=Q.getId(),q=this.createAutoColDef(G,Y??void 0,z);Q.setColDef(q,null,J),n0(X,{state:[i5(q,G)]},J)}createAutoColDef(Q,z,J){let Z=this.createBaseColDef(z),$=this.gos.get("autoGroupColumnDef");if(B0(Z,$),Z=uQ(this.beans,Z,Q,!0),$?.groupRowEditable==null)Z.groupRowEditable=void 0;if($?.groupRowValueSetter==null)Z.groupRowValueSetter=void 0;if(!this.gos.get("treeData")){if(n(Z.field)&&n(Z.valueGetter)&&n(Z.filterValueGetter)&&Z.filter!=="agGroupColumnFilter")Z.filter=!1}if(J&&J>0)Z.headerCheckboxSelection=!1;let X=WQ(this.gos),Y=Z.valueGetter||Z.field!=null;if(X&&!Y)Z.sortIndex=void 0,Z.initialSort=void 0;return Z}createBaseColDef(Q){let z=this.gos.get("autoGroupColumnDef"),Z={headerName:this.getLocaleTextFunc()("group","Group"),showRowGroup:Q?.getColId()??!0};if(!(z&&(z.cellRenderer||z.cellRendererSelector)))Z.cellRenderer="agGroupCellRenderer";if(Q)Z.headerName=this.beans.colNames.getDisplayNameForColumn(Q,"header")??void 0,Z.headerValueGetter=Q.colDef.headerValueGetter;return Z}getDeepestExpandedLevel(Q,z){let J=-1;if(!Q)return J;for(let Z of Q){if(!Z.group||!Z.expanded)continue;if(Z.level>J)J=Z.level;if(J>=z)return J;let $=this.getDeepestExpandedLevel(Z.childrenAfterGroup,z);if($>J)J=$;if(J>=z)return J}return J}updateGroupColumnVisibility(){let Q=this.columns?.list;if(!Q||Q.length===0)return;let{gos:z,visibleCols:J,rowModel:Z}=this.beans,$=g5(z),X=!1,Y=(q,H)=>{if(H!==q.isVisible())q.setVisible(H,"api"),X=!0},G=()=>{for(let q of Q)Y(q,!0)};if(!$)G();else if(Q.length>1){let q=Q.length-2,H=Z?.rootNode?.childrenAfterGroup,_=this.getDeepestExpandedLevel(H,q);if(_>=q)G();else for(let U=0;U=U)}if(X)J.refresh("api")}destroy(){ZQ(this.beans,this.columns?.tree),super.destroy()}},z7=null,tX=(Q)=>{let z=z7,J=new Uint32Array(1<<32-Math.clz32(Q|63));if(z)J.set(z);return z7=J,J},BR=(Q,z,J,Z)=>{let $=z-Z,X=J-1;if($===1){let H=0;while(Q[H].level===X)++H;if(H0){let _=Q[H];Q.copyWithin(1,0,H),Q[0]=_}return Q}let Y=Array($),G=0,q=0;for(let H=0;H{let J=Q[0].level+1,Z=J,$=0,X=J,Y=z7;if(!Y||J>=Y.length)Y=tX(J);++Y[J];for(let U=1;UJ){if(J=W,J>=Y.length)Y=tX(J)}else if(W=0)return Y.fill(0,Z,J+1),Q;let G=Y[Z],q=Y[J];if(G+q===z)return Y[Z]=0,Y[J]=0,BR(Q,z,J,q);let H=0;for(let U=J;U>=Z;--U){let W=Y[U];Y[U]=H,H+=W}let _=Array(z);for(let U=0;U{if(z===2){if(Q[0].level16)return ER(Q,z);for(let J=1;J=0&&Q[X].level<$);Q[Y]=Z}}return Q},KR=class{constructor(){this.kind="cells",this.rows=[],this.unsorted=!1,this.slots=new Map,this.bits=[],this.extraBits=null,this.colCount=0}addRow(Q){let z=Q;if(z==null)return;let J=this.slots;if(J.get(z)!==void 0){while(z!=null&&J.get(z)>=0)J.set(z,-1),z=z.parent;return}let Z=this.rows;do J.set(z,-1),Z.push(z),z=z.parent;while(z!=null&&!J.has(z));this.unsorted=!0}addCell(Q,z){if(z==null){this.addRow(Q);return}if(Q==null)return;let J=this.slots,Z=this.bits,$=J.get(z)??this.ensureCol(z),X=J.get(Q);if(X===void 0)X=this.ensureRow(Q);else if(X<0)return;let Y=$<32?Z:this.extraBits[($>>>5)-1],G=1<<($&31),q=Y[X];if((q&G)!==0)return;Y[X]=q|G;let H=Q.parent;while(H!=null){let _=J.get(H);if(_<0)break;let U=Y[_];if((U&G)!==0)break;Y[_]=U|G,H=H.parent}}hasRow(Q){return this.slots.has(Q)}getSortedRows(){if(!this.unsorted)return this.rows;this.unsorted=!1;let Q=H4(this.rows);return this.rows=Q,Q}getSlot(Q){return this.slots.get(Q)??-1}hasCellBySlot(Q,z){if(Q<0)return!0;if(z<32)return z>=0&&(this.bits[Q]&1<>>5)-1][Q]&1<<(z&31))!==0}ensureRow(Q){let z=this.slots,J=this.rows,Z=this.bits,$=this.extraBits,X=Z.push(0),Y=X-1;if($!==null)for(let q=0,H=$.length;q=32){let J=(z>>>5)-1,Z=this.extraBits;if(Z===null)Z=[],this.extraBits=Z;if(J>=Z.length)Z.push(Array(this.bits.length).fill(0))}return z}},rX=class{constructor(){this.kind="rows",this.rows=[],this.unsorted=!1,this.rowSet=new Set}addRow(Q){let z=Q;if(z==null)return;let J=this.rowSet;if(J.has(z))return;let Z=this.rows;do J.add(z),Z.push(z),z=z.parent;while(z!=null&&!J.has(z));this.unsorted=!0}addCell(Q,z){this.addRow(Q)}hasRow(Q){return this.rowSet.has(Q)}getSortedRows(){if(!this.unsorted)return this.rows;this.unsorted=!1;let Q=H4(this.rows);return this.rows=Q,Q}},LR=class extends j{constructor(){super(...arguments);this.beanName="changedPathFactory"}newPath(Q){return Q?new KR:new rX}ensureRowsPath(Q){let z=Q.changedPath;if(!z&&Q.changedRowNodes&&!Q.newData){let J=this.beans.rowModel;if(J.hierarchical)z=new rX,Q.changedPath=z,z.addRow(J.rootNode)}return z}},FR=class extends j{addExpandedCss(Q,z){if(z.isExpandable())Q.push("ag-row-group"),Q.push(z.expanded?"ag-row-group-expanded":"ag-row-group-contracted")}getRowExpandedListeners(Q){let{rowNode:z}=Q,J=this.updateExpandedCss.bind(this,Q,z);return{expandedChanged:J,hasChildrenChanged:J}}setExpanded(Q,z,J,Z){if(Q.expanded===z)return;Q._expanded=z,Q.dispatchRowEvent("expandedChanged");let $={...e5(Q,this.gos,"rowGroupOpened"),expanded:z,event:J||null};this.dispatchExpandedEvent($,Z)}defaultExpanded(Q){let J=this.beans.gos,Z=Q.level??0,$=Q.group&&J.get("isGroupOpenByDefault");if(!$){let Y=J.get("groupDefaultExpanded");return Y===-1||Z{let X=$.rowComp;X.toggleCss("ag-row-group",J),X.toggleCss("ag-row-group-expanded",J&&Z),X.toggleCss("ag-row-group-contracted",J&&!Z),w0($.element,J&&Z)})}dispatchStateUpdatedEvent(){this.eventSvc.dispatchEvent({type:"rowExpansionStateChanged"})}},DR=class extends FR{constructor(){super(...arguments);this.beanName="expansionSvc",this.events=null,this.dispatchExpandedDebounced=null}destroy(){super.destroy(),this.events=null,this.dispatchExpandedDebounced=null}setExpansionState(Q){let z=new Set(Q.expandedRowGroupIds);this.beans.rowModel.forEachNode((J)=>{let Z=J.id;if(!Z)return;J._expanded=z.has(Z)}),this.onGroupExpandedOrCollapsed()}getInternalExpansionState(Q=!1){let z=[],J=[];return this.beans.rowModel.forEachNode((Z)=>{let $=Z.id;if(!$)return;if(Z.expanded)z.push($);else if(Q&&Z.isExpandable())J.push($)}),{expandedRowGroupIds:z,collapsedRowGroupIds:J}}getExpansionState(){return this.getInternalExpansionState()}isExpanded(Q){if(Q.footer)return!!Q._expanded;if(!(Q.group||Q.master)||Q.leafGroup&&this.beans.colModel.isPivotMode())return!1;let z=Q._expanded;if(z===null)z=this.defaultExpanded(Q)??!1,Q._expanded=z;return!!z}resetExpansion(){let{rowModel:Q}=this.beans;Q.forEachNode((z)=>{if(!z.group&&!z.master)return;z._expanded=null}),this.onGroupExpandedOrCollapsed()}expandAll(Q){let{gos:z,rowModel:J,colModel:Z,eventSvc:$}=this.beans,X=z.get("treeData"),Y=Z.isPivotActive(),G=(H)=>{if(!H)return;for(let _ of H){let U=()=>{_._expanded=Q,G(_.childrenAfterGroup)};if(_.master){U();continue}if(X){if(T(_.childrenAfterGroup))U();continue}if(Y){if(!_.leafGroup)U();continue}if(_.group)U()}},q=J.rootNode;if(q)G(q.childrenAfterGroup);this.onGroupExpandedOrCollapsed(),$.dispatchEvent({type:"expandOrCollapseAll",source:Q?"expandAll":"collapseAll"})}onGroupExpandedOrCollapsed(){this.dispatchStateUpdatedEvent(),this.beans.rowModel.reMapRows()}setDetailsExpansionState(Q){let z=this.getInternalExpansionState(!0),J=z.collapsedRowGroupIds.length===0;if(z.expandedRowGroupIds.length===0===J)return;return J?Q.expandAll():Q.collapseAll()}dispatchExpandedEvent(Q,z){if((this.events??(this.events=[])).push(Q),z){this.dispatchExpandedEvents();return}let J=this.dispatchExpandedDebounced;if(!J){if(!this.isAlive())return;J=this.debounce(()=>this.dispatchExpandedEvents()),this.dispatchExpandedDebounced=J}J()}dispatchExpandedEvents(){let{eventSvc:Q,rowRenderer:z}=this.beans,J=this.events,Z=J?.length;if(!Z)return;this.events=null;let $=Array(Z);for(let X=0;Xwindow.setTimeout(Q,0);let J=!1;return()=>{if(!z.active){window.setTimeout(Q,0);return}if(J)return;J=!0,z.addDestroyTask(()=>{J=!1,Q()})}}};function MR(Q){let z=Q.get("groupHideParentOfSingleChild");if(!z){if(z=Q.get("groupRemoveSingleChildren"),!z&&Q.get("groupRemoveLowestSingleChildren"))z="leafGroupsOnly"}return{groupHideParentOfSingleChild:z,isGroupMultiAutoColumn:YJ(Q),hideOpenParents:Q.get("groupHideOpenParents"),grandTotalRow:_z(Q),groupTotalRow:OZ(Q)}}function kR(Q,z,J){return Q.groupHideParentOfSingleChild===!0&&J&&z.childrenAfterGroup.length===1}function VR(Q,z,J){return Q.groupHideParentOfSingleChild==="leafGroupsOnly"&&J&&z.leafGroup&&z.childrenAfterGroup.length===1}function fR(Q,z,J,Z,$,X){if(Z&&!J)return!1;if($||X)return!1;if(!Q.hideOpenParents)return!0;if(z.master||z.level===-1)return!0;if(!(Z&&z.leafGroup)&&z.expanded)return!1;return!0}var AR=class extends j{constructor(){super(...arguments);this.beanName="flattenStage",this.step="map",this.refreshProps=["groupHideParentOfSingleChild","groupRemoveSingleChildren","groupRemoveLowestSingleChildren","groupTotalRow","masterDetail"]}execute(){let{beans:Q,gos:z}=this,J=[],Z=Q.rowModel.rootNode;if(!Z)return J;let $=Q.colModel.isPivotMode(),X=$&&Z.leafGroup&&Z.aggData,Y=X?[Z]:Z.childrenAfterSort,G=MR(z);this.recursivelyAddToRowsToDisplay(G,Y,J,$,0);let q=J.length>0,H=G.grandTotalRow;if(!X&&q&&H)if(PJ(Z,Q),H==="pinnedBottom"||H==="pinnedTop")this.beans.pinnedRowModel?.setGrandTotalPinned(H==="pinnedBottom"?"bottom":"top");else{let U=H==="top";this.addRowNodeToRowsToDisplay(G,Z.sibling,J,0,U)}return J}recursivelyAddToRowsToDisplay(Q,z,J,Z,$){if(!z?.length)return;let X=this.beans.masterDetailSvc;for(let Y=0;Ythis.onCsrmCellChange(Q),batchEditingStopped:()=>this.flushGroupEdits()})}destroy(){this.stopDragging(!0),super.destroy()}isGroupingDrop(Q){if(!Q.rowDragManaged||!Q.sameGrid)return!1;if(!this.gos.get("refreshAfterGroupEdit"))return!1;return!!this.beans.rowGroupColsSvc?.columns?.length&&!this.beans.colModel.isPivotMode()}initDraggingGroups(Q){let z=new Map,J=(Z)=>{let $=Z.childrenAfterGroup;if($){if(z.has(Z))return;let X=$.slice();z.set(Z,X);for(let Y of X)J(Y)}};for(let Z of Q.rows)if(Z.group)J(Z);this.draggingGroups=z}canSetParent(Q){if(!Q.sameGrid)return!1;if(this.beans.groupStage?.treeData)return!0;if(Q.rowDragManaged&&!this.gos.get("refreshAfterGroupEdit"))return!1;return!!this.beans.rowGroupColsSvc?.columns?.length}canDropRow(Q,z){if(this.beans.groupStage?.treeData)return!RR(Q,z.newParent);let{position:J,target:Z,newParent:$,rootNode:X}=z,Y=Q.parent;if(Q.group&&(lX(Q,Z)||lX(Q,$)))return!1;if(J==="inside")return!0;if($&&$!==Y)return $!==X||Y===X;let G=$??Z?.parent??X;if(G!==Y)return!1;let q=Q.group?Q.level:Y.level??-1,H=-1;if(Z)H=Z.group?Z.level:Z.parent?.level??-1;else if(G)H=G.level;if(q>=0&&H>=0&&H!==q)return!1;return!0}fixRowsDrop(Q,z,J,Z){let $=!!this.beans.groupStage?.treeData;if(Q.treeData=$,!(!!this.beans.rowGroupColsSvc?.columns?.length||this.gos.get("pivotMode"))&&!$)return;if(!this.draggingGroups&&this.isGroupingDrop(Q)&&!Q.suppressMoveWhenRowDragging)this.initDraggingGroups(Q);let Y=Q.target,G=null,q=!1,H=Q.rootNode,_=this.beans.rowModel,U=this.canStartGroup(Y,$);this.updateDropTarget(Q,J,U);let W=this.beans.pageBounds?.getLastRow?.()??_.getRowCount()-1;if(z){if(!Y||Z>=0.5&&Y.rowIndex===W)G=H;else if(Q.moved&&Y&&this.dropGroupThrottled&&this.shouldDropTargetBeParent(Q))G=Y;if(!G)G=Y?.parent??H}if(!J&&Y&&U&&!(Y.group&&Y.expanded))this.startDropGroupDelay(Y);if(G){if(Y&&G===Y&&G!==H){let B=G.expanded?h9(_,1,Y):null;if(B?.parent===G)Y=B,Z=-0.5;else q=!0}if(Y&&!q){let B=Y;while(B&&B!==H&&B!==G)Y=B,B=B.parent}}Q.target=Y,Q.newParent=G,Q.yDelta=Z,Q.inside=q}clearNewSameParent(Q,z){let J=Q.newParent;if(J&&(!z||SR(Q.rows,J)))Q.newParent=null}updateDropTarget(Q,z,J){let Z=J?Q.target:null;if(this.dropGroupTarget&&this.dropGroupTarget!==Z)this.resetDragGroup();if(!Z?.childrenAfterSort?.length)return;if(z&&this.dropGroupThrottled&&!Z.expanded&&Z.isExpandable?.())Z.setExpanded(!0,void 0,!0);if(this.canDropInTarget(Z,Q))this.dropGroupThrottled=!0,this.dropGroupTarget=Z}canDropInTarget(Q,z){if(Q.expanded)return!0;if(!Q.group)return!1;if(z.pointerPos==="inside")return!0;if(z.treeData)return!1;let J=z.rows,Z=Q.level;for(let $=0,X=J.length;${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(Q){if(Q)this.draggingGroups=null;this.resetDragGroup()}shouldDropTargetBeParent({target:Q,rows:z,pointerPos:J,treeData:Z}){if(!Q||J==="none")return!1;if(J==="inside")return!0;if(!Z&&Q.group&&!Q.expanded)return!0;if(J==="above")return!1;let $=this.beans.rowModel,Y=Q.rowIndex+1,G;do G=$.getRow(Y++);while(G?.footer);let q=this.draggingGroups?.get(Q)??Q.childrenAfterGroup;if(G&&G.parent===Q&&q?.length){let H=new Set(z);for(let _=0,U=q.length;_{if(H.has(D))return;if(H.add(D),W??(W=this.newGroupValues(X)),this.setRowGroup(D,W))U.add(D)},E=(D)=>{let M=this.draggingGroups?.get(D)??D.childrenAfterGroup,k=M?.length;if(k)for(let f=0;f=0)B(A);else E(A)}};for(let D of Q.rows)if(D.group)E(D);else{let M=D.sourceRowIndex>=0&&!D.destroyed?D:this.csrmFirstLeaf(D);if(M)B(M)}let K=J==="inside"?"above":J,L=J==="inside"?this.findFirstLeafForParent(X,H)??Z:Z,F=!1;if(H.size&&K!=="none")F=U$($._leafs,H,L,K==="above");if(!U.size&&!F)return!1;_.reordered=F;for(let D of H)_.updates.add(D);if(this.csrmRefresh(_),q)q.focusCell();else Y.clearFocusedCell();return!0}canStartGroup(Q,z){if(!Q||Q.level<0||Q.footer||Q.detail)return!1;if(Q.group)return!0;return z}flushGroupEdits(){let Q=this.pendingEditRefresh;if(Q)this.pendingEditRefresh=null,this.csrmRefresh(Q)}csrmRefresh(Q){let z=this.beans.rowModel;if(!z.rootNode)return;z.refreshModel({step:"group",keepRenderedRows:!0,animate:!this.gos.get("suppressAnimationFrame"),changedRowNodes:Q})}newGroupValues(Q){let z=this.beans.rowGroupColsSvc?.columns??[],J=Array(z.length),Z=-1,$=Q;while($&&$.level>=0){let X=z[$.level];if(X){let Y=X.getColId(),G=$.level;if(J[G]=$.groupData?.[Y]??$.key??void 0,G>Z)Z=G}$=$.parent}return{values:J,columns:z,maxLevel:Z}}setRowGroup(Q,{values:z,columns:J,maxLevel:Z}){if(Z<0)return!1;let{valueSvc:$,changeDetectionSvc:X}=this.beans,Y=!1;X?.beginDeferred();try{for(let G=0;GZ)continue;let H=z[G],_=$.getValue(q,Q,"data");if(_===H||_==null&&H==null)continue;let U=H,W=$.parseValue(q,Q,H,_);if(W!==void 0)U=W;if(Q.setDataValue(q,U,"rowDrag"))Y=!0}}finally{X?.endDeferred()}return Y}onCsrmCellChange(Q){let{column:z,node:J,source:Z}=Q;if(!this.gos.get("refreshAfterGroupEdit"))return;if(Z==="rowDrag")return;if(!z?.isRowGroupActive())return;if(J.group||!J.data)return;if(this.beans.editSvc?.isBatchEditing()){let X=this.pendingEditRefresh;if(!X)X=sX(),this.pendingEditRefresh=X;X.updates.add(J)}else{let X=sX();X.updates.add(J),this.csrmRefresh(X)}}csrmFirstLeaf(Q){if(!Q)return null;let z=this.draggingGroups,J=z?.get(Q)??Q.childrenAfterGroup;while(J?.length){let Z=J[0];if(Z.sourceRowIndex>=0){if(!Z.destroyed)return Z;return this.firstAliveChildLeaf(Z)}J=z?.get(Z)??Z.childrenAfterGroup}return pz(Q)}firstAliveChildLeaf(Q){let z=this.draggingGroups?.get(Q)??Q.childrenAfterGroup;if(z){for(let J of z)if(J.sourceRowIndex>=0&&!J.destroyed)return J}return null}findFirstLeafForParent(Q,z){if(!Q)return null;let J=this.draggingGroups?.get(Q)??Q?.childrenAfterGroup;if(!J)return null;for(let Z=0,$=J.length;Z<$;++Z){let X=J[Z];if(X.sourceRowIndex>=0&&!z.has(X))return X;let Y=this.findFirstLeafForParent(X,z);if(Y!==null)return Y}return null}},sX=()=>{let Q=new W1;return Q.reordered=!0,Q},lX=(Q,z)=>{if(!Q||!z)return!1;let J=z;while(J){if(J===Q)return!0;J=J.parent}return!1},RR=(Q,z)=>{if(!z||Q.parent===z)return!1;let J=z,Z=Q.id;while(J){if(J===Q)return!0;if(Z!=null&&J.id===Z)return!0;J=J.parent}return!1},SR=(Q,z)=>{for(let J=0,Z=Q.length;Jthis.strategy?.onShowRowGroupColsSetChanged()})}invalidateGroupCols(){this.columnsInvalidated=!0,this.strategy?.invalidateGroupCols?.()}destroy(){this.strategy=this.destroyBean(this.strategy),super.destroy()}getNonLeaf(Q){return this.strategy?.nonLeafsById?.get(Q)}getNestedDataGetter(){return this.getStrategy()?.nestedDataGetter}onPropChange(Q){let z=this.gos,J=this.strategy?.nestedDataGetter;if(Q.has("treeData"))this.gosTreeData=z.get("treeData")&&this.hasTreeData,this.columnsInvalidated=!0;return this.strategy?.onPropChange?.(Q),this.getNestedDataGetter()!==J}extractData(){let Q=this.beans.rowModel.rootNode,z=this.nested?Q?.childrenAfterGroup:Q?._leafs;if(!z)return this.gos.get("rowData")??[];let J=z.length,Z=Array(J),$=0;for(let X=0;X{let z=Q.sibling;if(!z)return null;let J=z._leafs;if(J!==void 0)return J;return E2(z)},E2=(Q)=>{let z=Q.childrenAfterGroup,J=z?.length;if(Q._leafs=null,!J)return null;let Z,$=J===1?z[0]:null;if($?.group&&$.sourceRowIndex<0){if(Z=$._leafs,Z===void 0)Z=E2($)}else if(Q.leafGroup)Z=z;else{Z=[];for(let X=0;X=0)Z.push(Y);if(!Y.group)continue;let G=Y._leafs;if(G===void 0)G=E2(Y);if(G)for(let q=0,H=G.length;q{let{_leafs:Z,sibling:$}=Q;if(Q.treeNodeFlags=0,Q.childrenAfterGroup=Z,Q.childrenMapped=null,Q._groupData=void 0,Q.aggData=null,$)$.childrenAfterGroup=Q.childrenAfterGroup,$.childrenAfterAggFilter=Q.childrenAfterAggFilter,$.childrenAfterFilter=Q.childrenAfterFilter,$.childrenAfterSort=Q.childrenAfterSort,$.childrenMapped=null,$._groupData=void 0,$.aggData=null;for(let X=0,Y=Z.length??0;X{Q.key=null,Q.treeNodeFlags=0,Q.allChildrenCount=null,Q.childrenAfterGroup=null,Q.childrenAfterAggFilter=null,Q.childrenAfterFilter=null,Q.childrenAfterSort=null,Q.childrenMapped=null,Q.level=0,Q._groupData=void 0};function oX(Q,z,J){let Z=Q,$=Z.level-z.level;if($<=0)return!1;if(!J.get("groupHideOpenParents"))return!1;for(let Y=0;Y<$;Y++){if(Z.parent?.getFirstChild()!==Z)return!1;Z=Z.parent}return Z===z}var _4=class extends j{constructor(){super(...arguments);this.indentClass=null}init(Q,z,J,Z,$,X,Y){this.params=Y,this.eGui=z,this.eCheckbox=J,this.eExpanded=Z,this.eContracted=$,this.comp=Q,this.compClass=X;let{node:G,column:q}=Y;if(this.node=G,this.displayedNode=G,this.isEmbeddedRowMismatch())return;if(G.footer){this.initFooterCell();return}if(!q){this.initFullWidthCell();return}this.displayedNode=this.beans.showRowGroupColValueSvc?.getDisplayedNode(G,q)??this.node,this.setupExpand(),this.setupCheckbox(),this.addGroupValue(),this.setupIndent()}initFooterCell(){let{node:Q}=this.params;if(this.addGroupValue(),this.setupIndent(),Q.level!==-1)this.comp.toggleCss("ag-row-group-leaf-indent",!0)}initFullWidthCell(){let Q=()=>{let{rowDragSvc:z}=this.beans;if(!this.params.rowDrag||!z)return;let J=z.createRowDragComp(()=>this.params.value,this.params.node);this.createManagedBean(J),this.eGui.insertAdjacentElement("afterbegin",J.getGui())};this.setupExpand(),Q(),this.setupCheckbox(),this.addGroupValue(),this.setupIndent()}getCellAriaRole(){let Q=this.params.colDef?.cellAriaRole,z=this.params.column?.getColDef().cellAriaRole;return Q||z||"gridcell"}isEmbeddedRowMismatch(){if(!this.params.fullWidth||!this.gos.get("embedFullWidthRows"))return!1;let{visibleCols:Q}=this.beans,z=this.params.pinned==="left",J=this.params.pinned==="right",Z=!z&&!J;if(this.gos.get("enableRtl")){if(Q.isPinningLeft())return!J;return!Z}if(Q.isPinningLeft())return!z;return!Z}addGroupValue(){let{params:{value:Q,valueFormatted:z}}=this,J=this.getInnerCompDetails();this.comp.setInnerRenderer(J,z??Q??null)}setupExpand(){let{colModel:Q}=this.beans,{eGridCell:z,suppressDoubleClickExpand:J}=this.params,Z=(q,H)=>{let _=h(q,this.beans,null);if(_)H.appendChild(_),this.addDestroyFunc(()=>_.remove())};Z("groupExpanded",this.eExpanded),Z("groupContracted",this.eContracted);let $=this.comp,X=()=>{if(!this.isExpandable())return;let H=!!this.displayedNode.expanded;$.setExpandedDisplayed(H),$.setContractedDisplayed(!H),w0(z,H)},Y=()=>{let q=this.isExpandable();$.toggleCss("ag-cell-expandable",q),$.toggleCss("ag-row-group",q);let H=!q&&Q.isPivotMode();$.toggleCss("ag-pivot-leaf-group",H);let _=!Q.isPivotMode()&&(!this.displayedNode.footer||this.displayedNode.level!==-1);$.toggleCss("ag-row-group-leaf-indent",!q&&_);let U=this.getChildCount(),W=U>0?`(${U})`:"";if($.setChildCount(W),!q)$.setExpandedDisplayed(!1),$.setContractedDisplayed(!1),T8(z);else X()};(()=>{if(!J&&!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:Q,findSvc:z}=this.beans,J=this.params;if(J.fullWidth){let q=this.gos.get("groupRowRendererParams"),H=_J(Q,q,J);if(H)return H;if(z?.isMatch(J.node,null))return _J(Q,{...q,innerRenderer:"agFindCellRenderer"},J);return}let Z=(q)=>q&&q.componentClass==this.compClass,$=_J(Q,J,J);if($&&!Z($))return $;let{displayedNode:{rowGroupColumn:X}}=this,Y=X?.colDef,G=X&&J.column?.isRowGroupDisplayed(X.getId());if(Y&&G){let q=o1(Q,Y,J);if(q)if(Z(q)){if(Y?.cellRendererParams?.innerRenderer)return _J(Q,Y.cellRendererParams,J)}else return q}if(z?.isMatch(J.node,J.column))return o1(Q,{...Y??J.colDef,cellRenderer:"agFindCellRenderer"},J)}getChildCount(){let{column:Q,suppressCount:z}=this.params;if(z)return 0;let{allChildrenCount:J,rowGroupColumn:Z}=this.displayedNode;if(!((J??0)>0&&(!Z||!Q||Q?.isRowGroupDisplayed(Z.getId()))))return 0;if(this.gos.get("showOpenedGroup")&&this.displayedNode!==this.node&&!oX(this.node,this.displayedNode,this.gos))return 0;return J??0}isExpandable(){let{node:Q,column:z,colDef:J}=this.params;if(!this.displayedNode.isExpandable())return!1;if(Q.rowPinned)return!1;if(!z)return!0;if(Q.hasChildren()&&J){let{showRowGroup:X}=J;if(!X)return!1;if(X===!0)return!0}if(Q===this.displayedNode){if(Q.rowGroupColumn){if(z?.isRowGroupDisplayed(Q.rowGroupColumn.getId()))return!0}if(Q.master)return J?.showRowGroup===!0||J?.showRowGroup==null;return!1}return oX(this.node,this.displayedNode,this.gos)}setupIndent(){let{suppressPadding:Q,node:z,colDef:J}=this.params;if(Q)return;let Z=()=>{let $=z.uiLevel;if(J&&J.showRowGroup!==!0)$=0;let X="ag-row-group-indent-"+$;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($))};this.addManagedListeners(z,{uiLevelChanged:Z.bind(this)}),Z()}setupCheckbox(){let{node:Q}=this.params;if(!(!Q.footer&&!Q.rowPinned&&!Q.detail))return;this.addManagedPropertyListener("rowSelection",({currentValue:J,previousValue:Z})=>{let $=typeof J==="object"?J:void 0,X=typeof Z==="object"?Z:void 0;if($?.checkboxLocation!==X?.checkboxLocation)this.destroyCheckbox(),this.addCheckbox()}),this.addCheckbox()}addCheckbox(){let{selectionSvc:Q}=this.beans;if(!Q||!hQ(this.gos))return;let{node:z,column:J}=this.params,Z=this.gos.get("rowSelection"),$=E1(Z);if($==="selectionColumn")return;if($==="autoGroupColumn"){let H=J?.getColDef().showRowGroup!=null,_=!J&&z.group;if(!(H||_))return}let X=typeof Z==="object"?Jz(Z):this.params.checkbox;if(!(typeof X==="function"||X===!0))return;if(typeof J?.getColDef().showRowGroup==="string"&&!this.isExpandable()){this.comp.setCheckboxSpacing(!0);return}let q=Q.createCheckboxSelectionComponent();this.cbComp=q,this.createBean(q),q.init({rowNode:z,column:J,overrides:{isVisible:X,callbackParams:this.params,removeHidden:!0}}),this.eCheckbox.appendChild(q.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(Q){let z=this.params.column;return!!z&&(!!z.getColDef().groupRowEditable||this.gos.get("enableGroupEdit"))&&z.isCellEditable(Q)}onExpandClicked(Q){if(zQ(Q))return;i0(Q),this.onExpandOrContract(Q)}onKeyDown(Q){if(Q.key!==V.ENTER||this.params.suppressEnterExpand)return;if(this.isGroupCellEditable(this.params.node))return;this.onExpandOrContract(Q)}onCellDblClicked(Q){if(zQ(Q))return;if(!(jZ(this.eExpanded,Q)||jZ(this.eContracted,Q)))this.onExpandOrContract(Q)}onExpandOrContract(Q){if(!this.isExpandable())return;let z=this.displayedNode,J=!z.expanded;if(!J&&z.sticky)this.beans.ctrlsSvc.getScrollFeature().setVerticalScrollPosition(z.rowTop-z.stickyRowTop);z.setExpanded(J,Q)}destroy(){super.destroy(),this.destroyCheckbox()}},vR={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"}]},eX=class extends x{constructor(){super(vR);this.eExpanded=S,this.eContracted=S,this.eCheckbox=S,this.eValue=S,this.eChildCount=S}init(Q){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)},J=this.createManagedBean(new _4),Z=!Q.colDef,$=this.getGui();if(J.init(z,$,this.eCheckbox,this.eExpanded,this.eContracted,this.constructor,Q),Z)H0($,J.getCellAriaRole())}setRenderDetails(Q,z){if(Q)Q.newAgStackInstance().then((J)=>{if(!J)return;let Z=()=>this.destroyBean(J);if(this.isAlive())this.eValue.appendChild(J.getGui()),this.addDestroyFunc(Z);else Z()});else this.eValue.innerText=z}destroy(){this.destroyBean(this.innerCellRenderer),super.destroy()}refresh(){return!1}},IR=".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)}",CR=class extends j{constructor(){super(...arguments);this.beanName="showRowGroupColValueSvc"}getGroupValue(Q,z,J){if(!z){if(!Q.group)return null;return{displayedNode:Q,value:Q.groupValue}}let Z=this.beans.valueSvc,$=z.colDef.showRowGroup;if(!$)return null;if(Q.level===-1&&Q.footer)return{displayedNode:Q,value:null};if(typeof $==="string"){if((this.beans.rowGroupColsSvc?.getColumnIndex($)??-1)>Q.level)return null;let G=this.getDisplayedNode(Q,z,!0);if(G)return{displayedNode:G,value:Z.getValue(z,G,"data",J)}}let X=Z.getValue(z,Q,"data",J);if(X==null){let Y=this.getDisplayedNode(Q,z);if(Y)return{displayedNode:Y,value:Z.getValue(z,Y,"data",J)}}return{displayedNode:Q,value:X}}formatAndPrefixGroupColValue(Q,z,J=!1){let Z=this.formatGroupColValue(Q,z,J),{value:$,displayedNode:X}=Q,Y=this.beans.footerSvc;if(Y?.doesCellShowTotalPrefix(X,z))return Y.applyTotalPrefix($,Z,X,z);if(X.footer&&X.level===-1)return null;return Z}formatGroupColValue(Q,z,J=!1){let Z=this.beans.valueSvc,{displayedNode:$,value:X}=Q,Y=$.rowGroupColumn,G=$.group&&!z;if(Y&&(G||z?.isRowGroupDisplayed(Y.colId))){if(J&&Y.colDef.useValueFormatterForExport===!1)return null;let H=Z.formatValue(Y,$,X);if(H==null&&$.key==="")return this.getLocaleTextFunc()("blanks","(Blanks)");return H}if(!z||$.group)return null;if(J&&z.colDef.useValueFormatterForExport===!1)return null;return Z.formatValue(z,$,X)}getDisplayedNode(Q,z,J=!1){let Z=this.gos,$=Z.get("groupHideOpenParents"),X=Z.get("showOpenedGroup")&&!J;if(!$&&!X)return;let Y=z.colDef.showRowGroup;if(Y===!0){if(Q.group)return;return Q.parent??void 0}let G=Q;while(G&&G.rowGroupColumn?.getId()!=Y){let q=G===G.parent?.getFirstChild();if(!X&&!q)return;G=G.parent}if(G===Q)return;return G??void 0}},bR=class extends j{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:Q,rowGroupColsSvc:z}=this.beans,J=this.columns,Z=this.colsSet,$=this.colsMap;$.clear();let X=J.length,Y=0,G=!1,q=Q.getCols();for(let H=0,_=q.length;H<_;++H){let U=q[H],B=U.getColDef().showRowGroup;if(typeof B==="string")$.set(B,U);else if(B===!0){let E=z?.columns;if(E)for(let K=0,L=E.length;K=X||!Z.has(U)),J[Y++]=U}if(G||(G=Y!==X),G){J.length=Y,Z.clear();for(let H=0;H{this.gridBodyCtrl=Q.gridBodyCtrl}),this.resetStickyContainers()}setOffsetTop(Q){if(this.extraTopHeight===Q)return;this.extraTopHeight=Q,this.eventSvc.dispatchEvent({type:"stickyTopOffsetChanged",offset:Q})}setOffsetBottom(Q){if(this.extraBottomHeight===Q)return;this.extraBottomHeight=Q}resetOffsets(){this.setOffsetBottom(0),this.setOffsetTop(0)}getLastPixelOfGroup(Q){return this.isClientSide?wR(Q):xR(Q)}getFirstPixelOfGroup(Q){if(Q.footer)return Q.sibling.rowTop+Q.sibling.rowHeight-1;if(Q.hasChildren())return Q.rowTop-1;return 0}updateStickyRows(Q){let z=Q==="top",J=0;if(!this.canRowsBeSticky())return this.refreshNodesAndContainerHeight(Q,new Set,J);let Z=new Set,{rowModel:$,rowRenderer:X,pinnedRowModel:Y,pageBounds:G,rowContainerHeight:q}=this.beans,{pageFirstPixel:H,pageLastPixel:_}=G.getCurrentPagePixelRange(),U=z?X.firstVisibleVPixel-this.extraTopHeight:X.lastVisibleVPixel-this.extraTopHeight,W=q.divStretchOffset??0,B=H+W,E=_+W,K=(M)=>{if(Z.add(M),z){let k=this.getLastPixelOfGroup(M),f=U+J+M.rowHeight;if(kf)M.stickyRowTop=J-(k-f);else M.stickyRowTop=J}J=0,Z.forEach((k)=>{let f=k.stickyRowTop+k.rowHeight;if(J{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(Q==="bottom"&&k)return!1;if(M.level===-1&&Y?.getGrandTotalPinned())return!1;return!Z.has(M)}if(M.isExpandable()){if(F===!0)return!1;if(Q==="bottom")return!1;return!Z.has(M)&&!!M.expanded}return!1};for(let M=0;M<100;M++){let k=U+J;if(!z)k=U-J;if(z&&kE)k=E;let f=$.getRowIndexAtPixel(k),A=$.getRow(f);if(A==null)break;let v=this.getStickyAncestors(A).find((C)=>(z?C.rowIndexf)&&D(C));if(v){K(v);continue}if((z?A.rowTopk)&&D(A)){K(A);continue}break}if(!z)Z.forEach((M)=>{M.stickyRowTop=J-(M.stickyRowTop+M.rowHeight)});return this.refreshNodesAndContainerHeight(Q,Z,J)}areFooterRowsStickySuppressed(){let Q=this.gos.get("suppressStickyTotalRow");if(Q===!0)return!0;let z=Q==="group",J=Q==="grand";if(z&&J)return!0;if(J)return"grand";if(z)return"group";return!1}canRowsBeSticky(){let Q=k1(this.gos),z=this.areFooterRowsStickySuppressed(),J=this.gos.get("suppressGroupRowsSticky");return Q&&(!z||!J)}getStickyAncestors(Q){let z=[],J=Q.footer?Q.sibling:Q.parent;while(J){if(J.sibling)z.push(J.sibling);z.push(J),J=J.parent}return z.reverse()}checkStickyRows(){let Q=this.updateStickyRows("top"),z=this.updateStickyRows("bottom");return Q||z}destroyStickyCtrls(){this.resetStickyContainers()}resetStickyContainers(){this.refreshNodesAndContainerHeight("top",new Set,0),this.refreshNodesAndContainerHeight("bottom",new Set,0)}refreshStickyNode(Q){let z=new Set;if(this.stickyTopRowCtrls.some((J)=>J.rowNode===Q)){for(let J=0;J{if(G.has(B))return;B.sticky=!0,q.push(this.createRowCon(B,!1,!1))});let H=!!q.length||Y.length!==$.length;if(Z){if(this.topContainerHeight!==J)this.topContainerHeight=J,this.gridBodyCtrl.setStickyTopHeight(J),H=!0}else if(this.bottomContainerHeight!==J)this.bottomContainerHeight=J,this.gridBodyCtrl.setStickyBottomHeight(J),H=!0;this.destroyRowCtrls(X,!1);let _=[...Y,...q];if(_.sort((B,E)=>E.rowNode.rowIndex-B.rowNode.rowIndex),!Z)_.reverse();for(let B of _)B.setRowTop(B.rowNode.stickyRowTop);let U=this.beans.pageBounds,W=0;if(Z){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(!H)return!1;if(Z)this.stickyTopRowCtrls=_;else this.stickyBottomRowCtrls=_;return!0}ensureRowHeightsValid(){let Q=!1,z=(J)=>{let Z=J.rowNode;if(Z.rowHeightEstimated){let $=r1(this.beans,Z);Z.setRowHeight($.height),Q=!0}};return this.stickyTopRowCtrls.forEach(z),this.stickyBottomRowCtrls.forEach(z),Q}};function xR(Q){if(Q.isExpandable()||Q.footer){if(Q.master&&Q.detailNode)return Q.detailNode.rowTop+Q.detailNode.rowHeight;if(!Q.sibling||Math.abs(Q.sibling.rowIndex-Q.rowIndex)===1){let J=Q.childStore?.getStoreBounds();if(Q.footer)J=Q.sibling.childStore?.getStoreBounds();return(J?.heightPx??0)+(J?.topPx??0)}if(Q.footer)return Q.rowTop+Q.rowHeight;return Q.sibling.rowTop+Q.sibling.rowHeight}return Number.MAX_SAFE_INTEGER}function wR(Q){if(Q.isExpandable()||Q.footer){if(Q.footer&&Q.rowIndex===0)return Number.MAX_SAFE_INTEGER;if(!Q.sibling||Math.abs(Q.sibling.rowIndex-Q.rowIndex)===1){let Z=Q.footer?Q.sibling:Q;while(Z.isExpandable()&&Z.expanded)if(Z.master&&Z.detailNode)Z=Z.detailNode;else if(Z.childrenAfterSort){if(Z.childrenAfterSort.length===0)break;Z=b(Z.childrenAfterSort)}return Z.rowTop+Z.rowHeight}if(Q.footer)return Q.rowTop+Q.rowHeight;return Q.sibling.rowTop+Q.sibling.rowHeight}return Number.MAX_SAFE_INTEGER}var NR=class extends j{constructor(){super(...arguments);this.beanName="stickyRowSvc"}createStickyRowFeature(Q,z,J){let Z=this.gos;if(k1(Z)&&o(Z)||Hz(Z))return Q.createManagedBean(new yR(z,J));return}},U4={moduleName:"GroupCellRenderer",version:J0,userComponents:{agGroupRowRenderer:eX,agGroupCellRenderer:eX},dynamicBeans:{groupCellRendererCtrl:_4},icons:{groupContracted:"tree-closed",groupExpanded:"tree-open"},css:[IR],dependsOn:[I0]},gR={moduleName:"GroupColumn",version:J0,beans:[WR,bR,CR,UR,q4,Y4],dependsOn:[I0,U4]},W4={moduleName:"ChangedPath",version:J0,beans:[LR],dependsOn:[I0]},F2={moduleName:"ClientSideRowModelHierarchy",version:J0,rowModels:["clientSide"],beans:[OR,AR,DR],dependsOn:[I0,W4]},B4={moduleName:"StickyRow",version:J0,beans:[NR]},hR={moduleName:"GroupEdit",version:J0,beans:[jR],dependsOn:[I0,F2]},uR=({valueSvc:Q,dataTypeSvc:z},J,Z)=>{let $=Q.getValue(J,Z,"data"),X=null;if($ instanceof Date)X=$;else if(typeof $==="string")X=(z?.getDateParserFunction(J)??e1)($)??null;return X},Kz=(Q,z,J,Z)=>($)=>{let X=uR(Q,z,$.node),Y=$1(X);if(!Y)return null;return Z?.(Y[J])??Y[J]},Lz=({colNames:Q},z,J)=>(Z)=>{let $=Q.getDisplayNameForColumn(z,Z.location);if($)return`${$} (${J})`;return""},mR=Object.fromEntries(F6.map((Q)=>[Q,Q.toLowerCase()])),cR=(Q)=>{let z=F6[Number.parseInt(Q,10)-1]??Q,J=mR[z]??Q;return{month:z,localeKey:J}};function QY(Q){return Q.groupHierarchy??Q.rowGroupingHierarchy}var pR=class extends j{constructor(){super(...arguments);this.beanName="groupHierarchyColSvc",this.columns=null,this.sourceColumnMap=new WeakMap,this.inverseColumnMap=new WeakMap}addColumns(Q){let z=this.columns;if(z==null)return;Q.list=z.list.filter((J)=>!Q.list.some((Z)=>Z.getColId()===J.getColId())).concat(Q.list),Q.tree=z.tree.filter((J)=>!Q.tree.some((Z)=>Z.getId()===J.getId())).concat(Q.tree),HJ(Q)}createColumns(Q){let z=new WeakMap,J=new WeakMap,Z=this.createGroupHierarchyColumns(Q,z,J);if(qJ(Z,this.columns?.list??[]))return;ZQ(this.beans,this.columns?.tree),this.columns=null;let{colGroupSvc:X}=this.beans,Y=X?.findDepth(Q.tree)??0,G=X?.balanceTreeForAutoCols(Z,Y)??[];this.columns={list:Z,tree:G,treeDepth:Y,map:{}},this.sourceColumnMap=z,this.inverseColumnMap=J}updateColumns(Q){}getColumn(Q){return this.columns?.list.find((z)=>PQ(z,Q))??null}getColumns(){return this.columns?.list??null}expandColumnInto(Q,z){let J=this.getVirtualColumnsForColumn(z).concat(z);for(let Z of J)if(!Q.some(($)=>PQ($,Z)||$.getColId()===Z.getColId()))Q.push(Z)}compareVirtualColumns(Q,z){let J=this.inverseColumnMap.get(Q),Z=this.inverseColumnMap.get(z);if(J&&J===Z){let $=this.sourceColumnMap.get(J)??[];return $?.indexOf(Q)-$?.indexOf(z)}if(this.sourceColumnMap.get(Q)?.includes(z))return 1;if(this.sourceColumnMap.get(z)?.includes(Q))return-1;return null}insertVirtualColumnsForCol(Q,z){let J=this.getVirtualColumnsForColumn(z);if(!J)return[];let Z=Q.indexOf(z);if(Z<0)Z=Q.length-1;return JJ(Q,J),Q.splice(Z,0,...J),J}getVirtualColumnsForColumn(Q){if(this.isGroupHierarchyColsEnabledForCol(Q))return this.sourceColumnMap.get(Q)??[];return[]}isGroupHierarchyColsEnabled(Q){return Q.list.some((z)=>this.isGroupHierarchyColsEnabledForCol(z))}isGroupHierarchyColsEnabledForCol(Q){let z=Q.getColDef();return!!(QY(z)&&(z.rowGroup||z.enableRowGroup||z.rowGroupIndex!=null||z.pivot||z.enablePivot||z.pivotIndex!=null))}createGroupHierarchyColDefs(Q){let z=[],J=Q.getColDef(),Z=QY(J);if(!Z)return z;if(!this.isGroupHierarchyColsEnabledForCol(Q))return z;for(let $ of Z){let X=null;if(typeof $==="string")X=this.createColDefForPart($,Q,J);else X=$;if(X)z.push(X)}return z}createGroupHierarchyColumns(Q,z,J){if(!this.isGroupHierarchyColsEnabled(Q))return[];let Z=[];for(let $ of Q.list)for(let X of this.createGroupHierarchyColDefs($)){let Y=X.colId;this.gos.validateColDef(X,Y,!0);let G=new GQ(X,null,Y,!0);this.createBean(G),Z.push(G),iR(z,$,G),J.set(G,$)}return Z}createColDefForPart(Q,z,J){let{beans:Z,gos:$}=this,X=`${f9}-${z.getColId()}-${Q}`,Y={enableRowGroup:J.enableRowGroup,rowGroup:J.rowGroup,enablePivot:J.enablePivot,hide:!0,editable:!1},G=$.get("groupHierarchyConfig")??{};if(Q in G){let U={...Y,...G[Q]};return U.colId??(U.colId=X),uQ(Z,U,U.colId,!0)}let q=uQ(Z,{colId:X,...Y},X,!0),H=this.getLocaleTextFunc(),_=(U,W)=>H?.(U,W)??W;switch(Q){case"year":return{...q,headerValueGetter:Lz(Z,z,_(Q,"Year")),valueGetter:Kz(Z,z,0)};case"quarter":return{...q,headerValueGetter:Lz(Z,z,_(Q,"Quarter")),valueGetter:Kz(Z,z,1,(U)=>(Math.floor(Number(U)/4)+1).toString())};case"month":return{...q,headerValueGetter:Lz(Z,z,_(Q,"Month")),valueGetter:Kz(Z,z,1)};case"formattedMonth":return{...q,headerValueGetter:Lz(Z,z,_("month","Month")),valueGetter:Kz(Z,z,1,(U)=>{let W=cR(U);return _(W.localeKey,W.month)})};case"day":return{...q,headerValueGetter:Lz(Z,z,_(Q,"Day")),valueGetter:Kz(Z,z,2)};case"hour":return{...q,headerValueGetter:Lz(Z,z,_(Q,"Hour")),valueGetter:Kz(Z,z,3)};case"minute":return{...q,headerValueGetter:Lz(Z,z,_(Q,"Minute")),valueGetter:Kz(Z,z,4)};case"second":return{...q,headerValueGetter:Lz(Z,z,_(Q,"Second")),valueGetter:Kz(Z,z,5)};default:return null}}};function iR(Q,z,J){let Z=Q.get(z);Q.set(z,(Z??[]).concat(J))}var nR={moduleName:"GroupHierarchy",version:J0,beans:[pR],dependsOn:[W4]};var dR=(Q,z)=>{if(!Q){z.length=0;return}let J=Q.length;z.length=J;for(let Z=0;Z{let J=Q.length;if(J!==z?.length)return!0;for(let Z=0;Z0){J=!0;break}if(!J)return!1;return Q.sort(zY),!0}function zY(Q,z){let J=Q.sourceRowIndex,Z=z.sourceRowIndex,$=J>=0,X=Z>=0,Y=$&&X,G=!$&&!X;if(Y)return J-Z;if(G)return Q.__objectId-z.__objectId;if($)return 1;return-1}var sR=class extends j{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 Q=this.nonLeafsById;for(let z of Q.values())z._destroy(!1);Q.clear()}loadGroupData(Q){if(!Q.group)return Q._groupData=null,null;let z=Q.rowGroupColumn,{valueSvc:J,showRowGroupCols:Z}=this.beans,$={};if(Q._groupData=$,!z)return $;let X=pz(Q),Y=z.getId();if(!Z)return $;let G=Z.columns;for(let q=0,H=G.length;q{let Z=J.childrenAfterGroup,$=Z?.length;if(!$)return;let X=Array($),Y=0,G=!1,q;for(let H=0;H<$;++H){let _=Z[H];if(!_.childrenAfterGroup?.length)G||(G=Y!==H),X[Y++]=_;else if(!q&&_.key===""){q=_;let U=$-1;G||(G=H!==U),X[U]=_}}if(G){for(let _=0;_<$;++_){let U=Z[_];if(U.childrenAfterGroup?.length&&U!==q)X[Y++]=U}J.childrenAfterGroup=X;let H=J.sibling;if(H)H.childrenAfterGroup=X}})}initRefresh(Q){let{rowGroupColsSvc:z,colModel:J,gos:Z}=this.beans;this.pivotMode=J.isPivotMode(),this.groupEmpty=this.pivotMode||!Z.get("groupAllowUnbalanced");let $=z?.columns,X=this.groupCols,Y=Q.afterColumnsChanged;if(Y||!X||this.checkGroupCols)if(this.checkGroupCols=!1,X&&!tR(X,$)){if(Y)return"skip"}else{Q.animate=!1;let G=X[0]?.col.getId()!==$?.[0]?.getId();return dR($,X),G?"refresh":"groupColsChanged"}return"refresh"}handleDeltaUpdate(Q,z,{removals:J,updates:Z,adds:$,reordered:X},Y){let G=new Set;for(let q=0,H=J.length;q1)}}if($.size)for(let q of $){this.insertOneNode(Q,q);let H=q.parent;z?.addRow(H),X||(X=(H?.childrenAfterGroup?.length??0)>1)}if(G.size)JY(G),this.removeEmptyGroups(G,Y);if(X)this.sortChildren(Q,z)}sortChildren(Q,z){A0(Q,!0,void 0,(J)=>{if(rR(J.childrenAfterGroup))z?.addRow(J)})}orderGroups(Q){let z=this.gos.getCallback("initialGroupOrderComparator");if(!z)return;let J=this.beans,Z=J.gridApi,$=J.gridOptions.context,X=(G,q)=>z({api:Z,context:$,nodeA:G,nodeB:q}),Y=(G)=>{let q=G.childrenAfterGroup,H=q?.length;if(!H||G.leafGroup)return;if(H>1)q.sort(X);for(let _=0,U=H;_=0;--G){let{col:q}=Y[G],H=J.getKeyForNode(q,z);if(H==null||H===""){if(!Z)continue;H=""}if(!$?.parent||$.key!==H){X=!0;break}$=$.parent}if(X||(X=!!$?.parent),!X)return!1;return this.removeFromParent(z),this.insertOneNode(Q,z),z.setData(z.data),!0}groupShouldBeRemoved(Q){let z=this.getChildrenMappedKey(Q.key,Q.rowGroupColumn),J=Q.parent?.childrenMapped;if(J?!J[z]:!0)return!1;return!!Q.group&&(Q.childrenAfterGroup?.length??0)===0}removeEmptyGroups(Q,z){let J=this.beans.selectionSvc,Z,$=Array.from(Q),X=this.nonLeafsById;do{Q.clear();for(let Y=0;Y<$.length;++Y){let G=$[Y];while(G){let q=G.parent;if(G.destroyed){$[Y]=q,G=q;continue}if(!q)break;if(!this.groupShouldBeRemoved(G)){G=q;continue}if(Q.add(q),this.removeFromParent(G),J&&G.isSelected())Z??(Z=[]),Z.push(G);$[Y]=q,X.delete(G.id),G._destroy(z),G=q}}JY(Q)}while(Q.size);if(Z)J.setNodesSelected({nodes:Z,newValue:!1,source:"rowGroupChanged"})}removeFromParent(Q){let z=Q.parent;if(z){let J=this.getChildrenMappedKey(Q.key,Q.rowGroupColumn),Z=z.childrenMapped;if(Z)delete Z[J]}return Q.setRowTop(null),Q.setRowIndex(null),z}addToParent(Q,z){let J=z.childrenMapped??(z.childrenMapped={}),Z=this.getChildrenMappedKey(Q.key,Q.rowGroupColumn);if(J[Z]!==Q){J[Z]=Q;let $=z.childrenAfterGroup;if(!$){z.childrenAfterGroup=$=[];let X=z.sibling;if(X)X.childrenAfterGroup=z.childrenAfterGroup}$.push(Q),hY(z,this.beans,!0),X2(z)}}shotgunResetEverything(Q){let z=this.nonLeafsById;for(let $ of z.values())$.childrenAfterGroup=null,$.childrenMapped=null;Q.leafGroup=!this.groupCols?.length,Q.childrenAfterGroup=[],Q.childrenMapped={},Q.updateHasChildren();let J=Q.sibling;if(J)J.childrenAfterGroup=Q.childrenAfterGroup,J.childrenMapped=Q.childrenMapped;let Z=Q._leafs;for(let $=0,X=Z.length;$=G-1,K=this.createGroup(J,H,U,B,E,z);this.addToParent(K,J),J=K}if(!J.group)R(184,{parentGroupData:J.data,childNodeData:z.data});z.parent=J,z.level=J.level+1,J.childrenAfterGroup.push(z),J.updateHasChildren(),X2(J)}createGroup(Q,z,J,Z,$,X){let Y=z.col,G=(Q.level>=0?Q.id+"-":"row-group-")+(Y.getColId()+"-"+J),q=this.nonLeafsById,H=q.get(G),_=!0;if(H){if(H.childrenAfterGroup!==null)return H._expanded??(H._expanded=null),H;_=!1,X2(H)}else H=new Wz(this.beans),H.group=!0,H.key=J,H.id=G,H.aggData=null,q.set(G,H);let U=(K)=>{K.childrenAfterGroup=W,K.childrenMapped=B,K.parent=Q,K.level=Z,K.rowGroupIndex=Z,K.leafGroup=$},W=[],B={};if(U(H),H.field=z.field??null,H.rowGroupColumn=Y,H.groupValue=this.beans.valueSvc.getValue(Y,X,"data"),H._expanded??(H._expanded=null),_)return H.setAllChildrenCount(0),H.updateHasChildren(),H;let E=H.sibling;if(E)U(E);return H.dispatchRowEvent("hasChildrenChanged"),H}getChildrenMappedKey(Q,z){return z?z.getId()+"-"+Q:Q}onShowRowGroupColsSetChanged(){let{rowModel:Q,valueSvc:z}=this.beans;for(let Z of this.nonLeafsById.values()){Z._groupData=void 0;let $=Z.rowGroupColumn,X=$&&pz(Z);Z.groupValue=X&&z.getValue($,X,"data")}let J=Q.rootNode?._leafs;if(J)for(let Z=0,$=J.length;Z<$;++Z){let X=J[Z];X.parent._groupData=void 0}}},JY=(Q)=>{for(let z of Q){let J=z?.childrenAfterGroup;if(!J)continue;let Z=J.length,$=0;for(let X=0;X{while(Q._leafs!==void 0){let z=Q.parent;if(!z)break;Q._leafs=void 0,Q=z}};function lR(Q,z){Q.rowGroupColsSvc?.setColumns(z,"api")}function aR(Q,z){Q.rowGroupColsSvc?.removeColumns(z,"api")}function oR(Q,z){Q.rowGroupColsSvc?.addColumns(z,"api")}function eR(Q,z,J){Q.rowGroupColsSvc?.moveColumn?.(z,J,"api")}function QS(Q){return Q.rowGroupColsSvc?.columns??[]}var E4={moduleName:"SharedRowGrouping",version:J0,apiFunctions:{setRowGroupColumns:lR,removeRowGroupColumns:aR,addRowGroupColumns:oR,getRowGroupColumns:QS,moveRowGroupColumn:eR},dependsOn:[I0,G4,gR,B4,nR]},zS={moduleName:"RowGrouping",version:J0,dynamicBeans:{groupStrategy:sR},rowModels:["clientSide"],dependsOn:[E4,_R,F2,hR]};function JS(Q,z){Q.clipboardSvc?.copyToClipboard(z)}function ZS(Q,z){Q.clipboardSvc?.cutToClipboard(z)}function $S(Q,z){Q.clipboardSvc?.copySelectedRowsToClipboard(z)}function XS(Q,z){Q.clipboardSvc?.copySelectedRangeToClipboard(z)}function YS(Q){Q.clipboardSvc?.copyRangeDown()}function GS(Q){Q.clipboardSvc?.pasteFromClipboard()}var Q2="paste",r6="dragCopy",s6="clipboard";function qS(Q,z=","){let J=[],Z=(X)=>X==="\r"||X===` -`,$=!1;if(Q==="")return[[""]];for(let X=0,Y=0,G=0;G{if(!J[X])J[X]=[];if(!J[X][Y])J[X][Y]=""};if(U(),H==='"'){if($)if(_==='"')J[X][Y]+='"',G++;else $=!1;else if(q===void 0||q===z||Z(q))$=!0}if(!$&&H!=='"'){if(H===z){Y++,U();continue}else if(Z(H)){if(Y=0,X++,U(),H==="\r"&&_===` -`)G++;continue}}J[X][Y]+=H}return J}var HS=class extends j{constructor(){super(...arguments);this.beanName="clipboardSvc",this.clientSideRowModel=null,this.gridCtrl=null,this.lastPasteOperationTime=0,this.navigatorApiFailed=!1}postConstruct(){let{gos:Q,rowModel:z,ctrlsSvc:J}=this.beans;if(o(Q,z))this.clientSideRowModel=z;J.whenReady(this,(Z)=>{this.gridCtrl=Z.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)=>{R(40,{e:z,method:"readText"}),this.navigatorApiFailed=!0,this.pasteFromClipboardLegacy()});else this.pasteFromClipboardLegacy()}pasteFromClipboardLegacy(){let Q=!1,z=(J)=>{let Z=Date.now();if(Z-this.lastPasteOperationTime<50)Q=!0,J.preventDefault();this.lastPasteOperationTime=Z};this.executeOnTempElement((J)=>{J.addEventListener("paste",z),J.focus({preventScroll:!0})},(J)=>{let Z=J.value;if(!Q)this.processClipboardData(Z);else this.refocusLastFocusedCell();J.removeEventListener("paste",z)})}refocusLastFocusedCell(){let{focusSvc:Q}=this.beans,z=Q.getFocusedCell();if(z)Q.setFocusedCell({rowIndex:z.rowIndex,column:z.column,rowPinned:z.rowPinned,forceBrowserFocus:!0})}getClipboardDelimiter(){let Q=this.gos.get("clipboardDelimiter");return T(Q)?Q:"\t"}processClipboardData(Q){if(Q==null)return;let z=qS(Q,this.getClipboardDelimiter()),J=this.gos.getCallback("processDataFromClipboard");if(J)z=J({data:z});if(z==null)return;if(this.gos.get("suppressLastEmptyLineOnPaste"))this.removeLastLineIfBlank(z);let{rangeSvc:Z,editSvc:$}=this.beans,X=(Y,G,q,H)=>{if(Z?.isMoreThanOneCell()&&!this.hasOnlyOneValueToPaste(z))this.pasteIntoActiveRange(z,Y,G,H);else this.pasteStartingFromFocusedCell(z,Y,G,q,H);$?.stopEditing(void 0,{source:Q2})};this.doPasteOperation(X)}doPasteOperation(Q){let{eventSvc:J,focusSvc:Z,rowRenderer:$,gos:X}=this.beans;J.dispatchEvent({type:"pasteStart",source:"clipboard"});let{clientSideRowModel:Y}=this,G=Y?.rootNode,q=G&&this.beans.changedPathFactory?.newPath(X.get("aggregateOnlyChangedColumns")),H={},_=[],U=Z.getFocusedCell();Q(H,_,U,q);let W=_.slice();if(q)Y.doAggregate(q),A0(G,Y.hierarchical,q,(B)=>{W.push(B)});$.refreshCells({rowNodes:W}),this.dispatchFlashCells(H),this.fireRowChanged(_),this.refocusLastFocusedCell(),J.dispatchEvent({type:"pasteEnd",source:"clipboard"})}getPreProcessRangeCallback(Q){return(z)=>{let{rangeSvc:J}=this.beans;if(!J)return;let{rowDiff:Z,colDiff:$}=this.getAdjustedRangeDimensionForPaste(z,Q);if(Z!==0)J.extendRangeRowCountBy(z,Z);if($!==0)J.extendRangeColumnCountBy(z,$)}}getAdjustedRangeDimensionForPaste(Q,z){let J=this.beans.rangeSvc,Z=z.length,$=J.getRangeRowCount(Q),X=$>=Z&&$%Z===0,Y=z[0].length,G=Q.columns.length,q=G>=Y&&G%Y===0;return{rowDiff:X?0:Z-$,colDiff:q?0:Y-G}}pasteIntoActiveRange(Q,z,J,Z){let $=0,X=0,Y=(G,q,H,_)=>{if(_-$>=Q.length){if(_%Q.length!==0)return;$+=X,X=0}let W=Q[_-$];J.push(q);let B=this.gos.getCallback("processCellFromClipboard"),E=H.columns,K=E.findIndex(IQ);if(K!==-1)E.splice(K,1);for(let L=0;L=W.length)D=L%W.length;let M=this.processCell(q,F,W[D],r6,B,!0);q.setDataValue(F,M,Q2),Z?.addCell(q.parent,F.getId());let{rowIndex:k,rowPinned:f}=G,A=bQ({rowIndex:k,column:F,rowPinned:f});z[A]=!0}X++};this.iterateActiveRanges(Y,!1,this.getPreProcessRangeCallback(Q))}getDisplayedColumnsStartingAt(Q){let z=Q,J=[],{visibleCols:Z}=this.beans;while(z&&GJ(z))z=Z.getColAfter(z);while(z!=null)J.push(z),z=Z.getColAfter(z);return J}pasteStartingFromFocusedCell(Q,z,J,Z,$){if(!Z)return;let X={rowIndex:Z.rowIndex,rowPinned:Z.rowPinned},Y=this.getDisplayedColumnsStartingAt(Z.column);if(this.isPasteSingleValueIntoRange(Q))this.pasteSingleValueIntoRange(Q,J,z,$);else this.pasteMultipleValues(Q,X,J,Y,z,s6,$)}isPasteSingleValueIntoRange(Q){let z=this.beans.rangeSvc;return this.hasOnlyOneValueToPaste(Q)&&!!z&&!z.isEmpty()}pasteSingleValueIntoRange(Q,z,J,Z){let $=Q[0][0],X=(Y,G,q)=>{z.push(G),q.columns.forEach((H)=>this.updateCellValue(G,H,$,J,s6,Z))};this.iterateActiveRanges(X)}hasOnlyOneValueToPaste(Q){return Q.length===1&&Q[0].length===1}copyRangeDown(){let{rangeSvc:Q,gos:z,formula:J,valueSvc:Z}=this.beans;if(!Q||Q.isEmpty())return;let $=[],X=(Y,G,q,H)=>{let _=z.getCallback("processCellForClipboard"),U=z.getCallback("processCellFromClipboard"),W=(B,E,K)=>{let{columns:L}=K;if(!$.length)L.forEach((F)=>{let D=this.processCell(E,F,Z.getValue(F,E,"batch"),r6,_,!1,!0);$.push(D)});else G.push(E),L.forEach((F,D)=>{if(!F.isCellEditable(E)||F.isSuppressPaste(E))return;if(F.isAllowFormula()&&J?.isFormula($[D]))$[D]=J?.updateFormulaByOffset({value:$[D],rowDelta:1});let k=this.processCell(E,F,$[D],r6,U,!0);E.setDataValue(F,k,Q2),H?.addCell(E.parent,F.getId());let{rowIndex:f,rowPinned:A}=B,O=bQ({rowIndex:f,column:F,rowPinned:A});Y[O]=!0})};this.iterateActiveRanges(W,!0)};this.doPasteOperation(X)}removeLastLineIfBlank(Q){let z=b(Q);if(z&&z.length===1&&z[0]===""){if(Q.length===1)return;$0(Q,z)}}fireRowChanged(Q){if(this.gos.get("editType")!=="fullRow")return;for(let z of Q)this.eventSvc.dispatchEvent({type:"rowValueChanged",node:z,data:z.data,rowIndex:z.rowIndex,rowPinned:z.rowPinned})}shouldSkipPasteRow(Q,z,J){if(Q.detail||Q.footer)return!0;if(J&&Q.group){for(let Z of z)if(Z.isCellEditable(Q))return!1;return!0}return!1}pasteMultipleValues(Q,z,J,Z,$,X,Y){let G=z,q=this.beans,{gos:H}=q,_=this.clientSideRowModel!=null&&!H.get("enableGroupEdit")&&!H.get("treeData"),U=()=>{while(G){let W=M0(q,G);if(G=L0(q,{rowPinned:G.rowPinned,rowIndex:G.rowIndex}),W!=null&&!this.shouldSkipPasteRow(W,Z,_))return W}return null};for(let W of Q){let B=U();if(!B)continue;W.forEach((E,K)=>this.updateCellValue(B,Z[K],E,$,X,Y)),J.push(B)}}updateCellValue(Q,z,J,Z,$,X){if(!Q||!z?.isCellEditable(Q)||z?.isSuppressPaste(Q))return;let Y=this.processCell(Q,z,J,$,this.gos.getCallback("processCellFromClipboard"),!0);Q.setDataValue(z,Y,Q2);let{rowIndex:G,rowPinned:q}=Q,H=bQ({rowIndex:G,column:z,rowPinned:q});Z[H]=!0,X?.addCell(Q.parent,z.getId())}copyToClipboard(Q={}){this.copyOrCutToClipboard(Q)}cutToClipboard(Q={},z="api"){if(this.gos.get("suppressCutToClipboard"))return;this.eventSvc.dispatchEvent({type:"cutStart",source:z}),this.copyOrCutToClipboard(Q,!0),this.eventSvc.dispatchEvent({type:"cutEnd",source:z})}copyOrCutToClipboard(Q,z){let{includeHeaders:J,includeGroupHeaders:Z}=Q,{gos:$,focusSvc:X}=this.beans;if(J==null)J=$.get("copyHeadersToClipboard");if(Z==null)Z=$.get("copyGroupHeadersToClipboard");let Y={includeHeaders:J,includeGroupHeaders:Z},G=$.get("rowSelection"),q=$.get("cellSelection"),H=null;if(this.shouldCopyCells(q,G))this.copySelectedRangeToClipboard(Y),H=0;else if(this.shouldCopyRows(G))this.copySelectedRowsToClipboard(Y),H=1;else if(X.isAnyCellFocused())this.copyFocusedCellToClipboard(Y),H=2;if(z&&H!==null)this.clearCellsAfterCopy(H)}shouldCopyCells(Q,z){let{rangeSvc:J,selectionSvc:Z,gos:$}=this.beans;if(!J||J.isEmpty())return!1;if(Q)return!(typeof z==="object"&&z.copySelectedRows&&!Z?.isEmpty());else{let X=$.get("suppressCopySingleCellRanges");return!(!J.isMoreThanOneCell()&&X)}}shouldCopyRows(Q){let{selectionSvc:z,gos:J}=this.beans;if(z?.isEmpty()??!0)return!1;if(Q&&typeof Q!=="string")return Q.copySelectedRows??!1;else return!J.get("suppressCopyRowsToClipboard")}clearCellsAfterCopy(Q){let z=this.beans,{rangeSvc:J,focusSvc:Z,eventSvc:$}=z;if($.dispatchEvent({type:"keyShortcutChangedCellStart"}),Q===0)J.clearCellRangeCellValues({cellEventSource:"clipboardSvc"});else if(Q===1)this.clearSelectedRows();else{let X=Z.getFocusedCell();if(X==null)return;let Y=M0(z,X);if(Y)this.clearCellValue(Y,X.column)}$.dispatchEvent({type:"keyShortcutChangedCellEnd"})}clearSelectedRows(){let{selectionSvc:Q,visibleCols:z}=this.beans,J=Q?.getSelectedNodes()??[],Z=z.allCols;for(let $ of J)for(let X of Z)this.clearCellValue($,X)}clearCellValue(Q,z){if(!z.isCellEditable(Q))return;let J=this.beans.valueSvc.getDeleteValue(z,Q);Q.setDataValue(z,J,"clipboardSvc")}iterateActiveRanges(Q,z,J){let Z=this.beans.rangeSvc;if(!Z||Z.isEmpty())return;let $=Z.getCellRanges(),X=z?[$[0]]:$;for(let Y of X)this.iterateActiveRange({cellRange:Y,rowCallback:Q,preProcessRange:J})}iterateActiveRange(Q){let{cellRange:z,preProcessRange:J,rowCallback:Z}=Q,{beans:$}=this,{rangeSvc:X}=$;if(!X)return;if(J)J(z);let Y=X.getRangeStartRow(z),G=X.getRangeEndRow(z),q=0,H=!1;while(!H&&Y!=null){let _=M0($,Y);H=l(Y,G),Z(Y,_,z,q++),Y=L0($,Y)}}copySelectedRangeToClipboard(Q={}){let z=this.beans.rangeSvc;if(!z||z.isEmpty())return;let J=z.areAllRangesAbleToMerge(),{data:Z,cellsToFlash:$}=J?this.buildDataFromMergedRanges(z,Q):this.buildDataFromRanges(z,Q);this.copyDataToClipboard(Z),this.dispatchFlashCells($)}buildDataFromMergedRanges(Q,z){let J=new Set,Z=Q.getCellRanges(),$=new Map,X=[],Y={},G=o(this.gos,this.beans.rowModel),q=new Set;if(!G)this.beans.rowModel.forEachNode((W)=>{q.add(W.rowIndex)});for(let W of Z){W.columns.forEach((K)=>J.add(K));let{rowPositions:B,cellsToFlash:E}=this.getRangeRowPositionsAndCellsToFlash(Q,W);for(let K of B){let L=q.has(K.rowIndex);if(!G&&!L)continue;let F=`${K.rowIndex}-${K.rowPinned||"null"}`;if(!$.get(F))$.set(F,!0),X.push(K)}Object.assign(Y,E)}let H=this.beans.visibleCols.allCols,_=Array.from(J);return _.sort((W,B)=>{let E=H.indexOf(W),K=H.indexOf(B);return E-K}),{data:this.buildExportParams({columns:_,rowPositions:X,includeHeaders:z.includeHeaders,includeGroupHeaders:z.includeGroupHeaders}),cellsToFlash:Y}}buildDataFromRanges(Q,z){let J=Q.getCellRanges(),Z=[],$={};for(let X of J){let{rowPositions:Y,cellsToFlash:G}=this.getRangeRowPositionsAndCellsToFlash(Q,X);Object.assign($,G),Z.push(this.buildExportParams({columns:X.columns,rowPositions:Y,includeHeaders:z.includeHeaders,includeGroupHeaders:z.includeGroupHeaders}))}return{data:Z.join(` -`),cellsToFlash:$}}getRangeRowPositionsAndCellsToFlash(Q,z){let J=[],Z={},$=Q.getRangeStartRow(z),X=Q.getRangeEndRow(z),Y=$;while(Y){J.push(Y);for(let G of z.columns){let{rowIndex:q,rowPinned:H}=Y,_=bQ({rowIndex:q,column:G,rowPinned:H});Z[_]=!0}if(l(Y,X))break;Y=L0(this.beans,Y)}return{rowPositions:J,cellsToFlash:Z}}getCellsToFlashFromRowNodes(Q){let z=this.beans.visibleCols.allCols,J={};for(let Z=0;Z{let{value:U,valueFormatted:W}=this.beans.valueSvc.getValueForDisplay({column:_,node:H,includeValueFormatted:!0,from:"batch"}),B=W??U??"",E=X.getCallback("processCellForClipboard");if(!E)return B;return E({column:_,node:H,value:B,type:s6,formatValue:(K)=>this.beans.valueSvc.formatValue(_,H,K)??K,parseValue:(K)=>this.beans.valueSvc.parseValue(_,H,K,U)??K})},q={columnKeys:z,rowPositions:J,skipColumnHeaders:!Z,skipColumnGroupHeaders:!$,suppressQuotes:!0,columnSeparator:this.getClipboardDelimiter(),onlySelected:!J,valueFrom:"batch",processCellCallback:X.getCallback("processCellForClipboard"),processRowGroupCallback:G,processHeaderCallback:X.getCallback("processHeaderForClipboard"),processGroupHeaderCallback:X.getCallback("processGroupHeaderForClipboard")};return Y.getDataAsCsv(q,!0)}dispatchFlashCells(Q){window.setTimeout(()=>{this.eventSvc.dispatchEvent({type:"flashCells",cells:Q})},0)}processCell(Q,z,J,Z,$,X,Y){let{valueSvc:G,formula:q}=this.beans;if($)return $({column:z,node:Q,value:J,type:Z,formatValue:(_)=>G.formatValue(z,Q??null,_)??_,parseValue:(_)=>G.parseValue(z,Q??null,_,G.getValue(z,Q,"edit"))});if(X&&z.getColDef().useValueParserForImport!==!1)return G.parseValue(z,Q??null,J,G.getValue(z,Q,"edit"));if(Y&&z.getColDef().useValueFormatterForExport!==!1){if(q?.isFormula(J))return J;return G.formatValue(z,Q??null,J)??J}return J}copyDataToClipboard(Q){let z=this.gos.getCallback("sendToClipboard");if(z){z({data:Q});return}if(!this.gos.get("suppressClipboardApi")&&navigator.clipboard){navigator.clipboard.writeText(Q).catch((Z)=>{R(40,{e:Z,method:"writeText"}),this.copyDataToClipboardLegacy(Q)});return}this.copyDataToClipboardLegacy(Q)}copyDataToClipboardLegacy(Q){this.executeOnTempElement((z)=>{let J=Y0(this.beans),Z=d(this.beans);if(z.value=Q||" ",z.select(),z.focus({preventScroll:!0}),!J.execCommand("copy"))R(41);if(Z?.focus!=null)Z.focus({preventScroll:!0})})}executeOnTempElement(Q,z){if(!this.gridCtrl)return;let J=Y0(this.beans),Z=J.createElement("textarea"),$=Z.style;$.width="1px",$.height="1px";let X=J.documentElement;$.top=X.scrollTop+"px",$.left=X.scrollLeft+"px",$.position="absolute",$.opacity="0",this.gridCtrl.getGui().appendChild(Z);try{Q(Z)}catch(G){R(42)}if(z)window.setTimeout(()=>{z(Z),Z.remove()},100);else Z.remove()}},K4={moduleName:"Clipboard",version:J0,beans:[HS],apiFunctions:{copyToClipboard:JS,cutToClipboard:ZS,copySelectedRowsToClipboard:$S,copySelectedRangeToClipboard:XS,copySelectedRangeDown:YS,pasteFromClipboard:GS},dependsOn:[I0,$X,iz,kX]};var L4=class extends j{constructor(){super(...arguments);this.loadRowDataVersion=0}wireBeans(Q){this.environment=Q.environment}init(Q,z){if(this.params=z,this.comp=Q,z.pinned!=null)return;this.setAutoHeightClasses(),this.setupRefreshStrategy(),this.createDetailGrid(),this.loadRowData(),this.addManagedEventListeners({fullWidthRowFocused:this.onFullWidthRowFocused.bind(this)})}onFullWidthRowFocused(Q){let z=this.params,J={rowIndex:z.node.rowIndex,rowPinned:z.node.rowPinned},Z={rowIndex:Q.rowIndex,rowPinned:Q.rowPinned};if(!l(J,Z))return;D0(this.comp.getGui(),Q.fromBelow)}setAutoHeightClasses(){let Q=this.gos.get("detailRowAutoHeight"),z=Q?"ag-details-row-auto-height":"ag-details-row-fixed-height",J=Q?"ag-details-grid-auto-height":"ag-details-grid-fixed-height",Z=this.comp;Z.toggleCss(z,!0),Z.toggleDetailGridCss(J,!0)}setupRefreshStrategy(){let Q=this.params.refreshStrategy;if(Q=="everything"||Q=="nothing"||Q=="rows"){this.refreshStrategy=Q;return}if(Q!=null)R(170,{providedStrategy:Q});this.refreshStrategy="rows"}createDetailGrid(){let{params:Q,gos:z}=this;if(n(Q.detailGridOptions)){R(171);return}let J=z.get("theme"),Z=Q.detailGridOptions.theme;if(Z&&Z!==J)R(267);let $={themeStyleContainer:this.environment.eStyleContainer,...Q.detailGridOptions,theme:J};if(z.get("detailRowAutoHeight"))$.domLayout="autoHeight";this.comp.setDetailGrid($)}registerDetailWithMaster(Q){let{params:z,beans:{selectionSvc:J,findSvc:Z,expansionSvc:$}}=this,X=z.node.id,Y=z.api,G={id:X,api:Q},q=z.node;if(Y.isDestroyed())return;Y.addDetailGridInfo(X,G),q.detailGridInfo=G;let H=q.parent;Z?.registerDetailGrid(q,Q);function _(){if(H)J?.refreshMasterNodeState(H)}function U({source:B}){if(B==="expandAll")return Q.expandAll();if(B==="collapseAll")return Q.collapseAll()}function W({node:B,source:E}){if(B!==H||E==="masterDetail"||Q.isDestroyed())return;J?.setDetailSelectionState(H,z.detailGridOptions,Q)}Q.addEventListener("firstDataRendered",()=>{if(Q.isDestroyed()||Y.isDestroyed())return;J?.setDetailSelectionState(H,z.detailGridOptions,Q),Q.addEventListener("selectionChanged",_),Y.addEventListener("rowSelected",W);let E=`${"CsrmSsrmSharedApi"}Module`;if(Q.isModuleRegistered(E))Y.addEventListener("expandOrCollapseAll",U),$?.setDetailsExpansionState(Q)}),this.addManagedListeners(H,{masterChanged:(B)=>{if(!B.node.master)this.onDestroy(G)}}),this.addDestroyFunc(()=>this.onDestroy(G))}onDestroy(Q){let{params:z}=this,J=z.node,Z=z.api;if(J.detailGridInfo!==Q)return;if(!Z.isDestroyed())Z.removeDetailGridInfo(J.id);J.detailGridInfo=null}loadRowData(){this.loadRowDataVersion++;let Q=this.loadRowDataVersion,z=this.params;if(z.detailGridOptions?.rowModelType==="serverSide"){z.node.detailGridInfo?.api?.refreshServerSide({purge:!0});return}let J=z.getDetailRowData;if(!J){R(172);return}let Z=(X)=>{if(this.loadRowDataVersion===Q)this.comp.setRowData(X)},$={node:z.node,data:z.node.data,successCallback:Z,context:y(this.gos,{}).context};J($)}refresh(){switch(this.refreshStrategy){case"nothing":return!0;case"everything":return!1}return this.loadRowData(),!0}},_S=class{constructor(Q){this.parentWrapper=Q}wrap(Q,z,J,Z){return this.parentWrapper.wrap(Q,z,J,Z)}},US={tag:"div",cls:"ag-details-row"},WS={tag:"div",cls:"ag-details-row",role:"gridcell",children:[{tag:"div",ref:"eDetailGrid",cls:"ag-details-grid",role:"presentation"}]},BS=class extends x{constructor(){super(...arguments);this.eDetailGrid=S}wireBeans(Q){this.context=Q.context}init(Q){this.params=Q,this.selectAndSetTemplate();let z={toggleCss:(J,Z)=>this.toggleCss(J,Z),toggleDetailGridCss:(J,Z)=>this.eDetailGrid.classList.toggle(J,Z),setDetailGrid:(J)=>this.setDetailGrid(J),setRowData:(J)=>this.setRowData(J),getGui:()=>this.eDetailGrid};this.ctrl=this.createManagedBean(new L4),this.ctrl.init(z,Q)}refresh(){return this.ctrl?.refresh()??!1}selectAndSetTemplate(){let Q=this.params;if(Q.pinned){this.setTemplate(US);return}let z=()=>{this.setTemplate(WS)};if(n(Q.template))z();else if(typeof Q.template==="string")this.setTemplate(Q.template,[]);else if(typeof Q.template==="function"){let J=Q.template,Z=J(Q);this.setTemplate(Z,[])}else R(168),z();if(this.eDetailGrid==null)R(169)}setDetailGrid(Q){if(!this.eDetailGrid)return;let z=this.context.getBean("frameworkCompWrapper"),J=new _S(z),{frameworkOverrides:Z}=this.beans,$=MJ(this.eDetailGrid,Q,{frameworkOverrides:Z,providedBeanInstances:{frameworkCompWrapper:J},modules:a8(this.params.api.getGridId(),Q.rowModelType??"clientSide")});this.detailApi=$,this.ctrl?.registerDetailWithMaster($),this.addDestroyFunc(()=>{$.destroy()})}setRowData(Q){this.detailApi?.setGridOption("rowData",Q)}};function D2(Q,z){let J=Q.masterDetailSvc?.store;return J?z(J):void 0}function ES(Q,z,J){D2(Q,(Z)=>{Z[z]=J})}function KS(Q,z){D2(Q,(J)=>{delete J[z]})}function LS(Q,z){return D2(Q,(J)=>J[z])}function FS(Q,z){D2(Q,(J)=>{let Z=0;Object.values(J).forEach(($)=>{if($)z($,Z++)})})}var DS=".ag-details-row{width:100%}.ag-details-row-fixed-height{height:100%}.ag-details-grid{width:100%}.ag-details-grid-fixed-height{height:100%}",MS=class extends j{constructor(){super(...arguments);this.beanName="masterDetailSvc",this.store={}}isEnabled(){return this.gos.get("masterDetail")}postConstruct(){let Q=this.gos;if(o(Q))this.enabled=this.isEnabled();if(Hz(Q))this.addEventListeners()}addEventListeners(){let Q=(Z)=>{this.setMaster(Z.node,!1,!0)},z,J=()=>{if(z){for(let Z of z)Z();z=void 0}if(this.isEnabled())z=this.addManagedListeners(this.beans.eventSvc,{rowNodeDataChanged:Q})};J(),this.gos.addPropertyEventListener("masterDetail",J)}refreshModel(Q){if(Q.changedProps){let z=this.isEnabled();if(this.enabled!==z){this.setMasters(null);return}}if(Q.rowDataUpdated)this.setMasters(Q.changedRowNodes)}setMaster(Q,z,J){let Z=Q.master,$=this.isEnabled(),X=$,Y=this.gos,G=Y.get("isRowMaster"),q=Y.get("treeData");if($)if(z||J){if(G){let H=Q.data;X=!!H&&!!G(H)}}else X=Z;if(!q){if(X&&z||!X&&Z)Q._expanded??(Q._expanded=null)}if(X!==Z)Q.master=X,Q.dispatchRowEvent("masterChanged")}setMasters(Q){if(this.enabled=this.isEnabled(),Q){for(let z of Q.updates)this.setMaster(z,!1,!0);for(let z of Q.adds)this.setMaster(z,!0,!1)}else{let z=o5(this.beans)?.rootNode?._leafs;if(z)for(let J=0,Z=z.length;J{let Y=z.clientHeight;if(Y!=null&&Y>0){let G=()=>{let{rowModel:q}=this.beans,{rowNode:H}=Q;if(H.setRowHeight(Y),o(J,q)||Hz(J,q))q.onRowHeightChanged()};window.setTimeout(G,0)}},X=DQ(Z,z,$);Q.addDestroyFunc(X),$()}destroy(){this.store={},super.destroy()}},kS={moduleName:"SharedMasterDetail",version:J0,beans:[MS],userComponents:{agDetailCellRenderer:BS},dynamicBeans:{detailCellRendererCtrl:L4},apiFunctions:{addDetailGridInfo:ES,removeDetailGridInfo:KS,getDetailGridInfo:LS,forEachDetailGridInfo:FS},dependsOn:[I0,U4,B4],css:[DS]},F4={moduleName:"MasterDetail",version:J0,dependsOn:[kS,F2,MX]},D4=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:(Q)=>{let z=!1;if(!this.dragging)z=!0,this.dragging=!0,D1(this.beans).classList?.add(this.getDraggingCssClass());if(this.updateValuesOnMove(Q),z){this.changedCalculatedValues=!1;return}if(this.beans.rangeSvc.autoScrollService.check(Q),this.changedCalculatedValues)this.onDrag(Q),this.changedCalculatedValues=!1},onDragStop:(Q)=>{this.dragging=!1,this.onDragEnd(Q),this.clearDragProperties()},onDragCancel:()=>{this.dragging=!1,this.onDragCancel(),this.clearDragProperties()}}),this.addManagedEventListeners({cellSelectionChanged:this.updateLocalRangeIfNeeded.bind(this)}),this.addManagedElementListeners(this.getGui(),{pointerdown:ZY,mousedown:ZY})}getLastCellHovered(){return this.lastCellHovered}getDraggingCssClass(){return`ag-dragging-${this.type===0?"fill":"range"}-handle`}updateValuesOnMove(Q){let z=U6(this.gos,Q);if(!z||this.shouldSkipCell(z)||this.lastCellHovered&&f1(z,this.lastCellHovered))return;this.lastCellHovered=z,this.changedCalculatedValues=!0}clearDragProperties(){if(this.clearValues(),this.beans.rangeSvc.autoScrollService.ensureCleared(),D1(this.beans).classList?.remove(this.getDraggingCssClass()),this.shouldDestroyOnEndDragging)this.destroy()}getType(){return this.type}refresh(Q,z){let J=this.cellCtrl,Z=this.getGui(),$=z??b(this.beans.rangeSvc.getCellRanges()),X=$.startRow,Y=$.endRow;if(X&&Y)if(q0(Y,X))this.rangeStartRow=Y,this.rangeEndRow=X;else this.rangeStartRow=X,this.rangeEndRow=Y;if(J!==Q||!f0(Z)){this.cellCtrl=Q;let G=Q.comp.getParentOfValue();if(G)G.appendChild(Z)}this.cellRange=$}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(Q){if(!this.cellRange)return;let{id:z,type:J}=this.cellRange;if(!z||z!==Q.id)return;let Z=this.beans.rangeSvc?.getCellRanges().find(($)=>$.id===z&&$.type===J);if(Z&&Z!==this.cellRange)this.cellRange=Z}},ZY=(Q)=>{Q.stopPropagation()};function VS(Q){let z=Q.length,J=0;if(z<=1)return Q;for(let U=0;U1){J=Math.max(J,parseInt(B[1],10));continue}if(Math.floor(W)===W)continue;J=Math.max(J,W.toString().split(".")[1].length)}let Z=0,$=0,X=0,Y=0,G=0;for(let U=0;UY?"x":"y";else q=G;if(q!==this.dragAxis)this.dragAxis=q,this.changedCalculatedValues=!0}shouldSkipCell(Q){return v0(Q.column)}onDrag(Q){if(!this.initialPosition){let J=this.cellCtrl;if(!J)return;this.initialPosition=J.cellPosition}let z=this.getLastCellHovered();if(z)this.markPathFrom(this.initialPosition,z)}onDragEnd(Q){if(this.initialXY=null,!this.markedCells.length)return;let z=this.dragAxis==="x",{cellRange:J,rangeStartRow:Z,rangeEndRow:$,beans:{rangeSvc:X}}=this,Y=J.columns.length,G;if(!this.isUp&&!this.isLeft)G=X.createCellRangeFromCellRangeParams({rowStartIndex:Z.rowIndex,rowStartPinned:Z.rowPinned,columnStart:J.columns[0],rowEndIndex:z?$.rowIndex:this.lastCellMarked.rowIndex,rowEndPinned:z?$.rowPinned:this.lastCellMarked.rowPinned,columnEnd:z?this.lastCellMarked.column:J.columns[Y-1]});else{let q=z?Z:this.lastCellMarked;G=X.createCellRangeFromCellRangeParams({rowStartIndex:q.rowIndex,rowStartPinned:q.rowPinned,columnStart:z?this.lastCellMarked.column:J.columns[0],rowEndIndex:$.rowIndex,rowEndPinned:$.rowPinned,columnEnd:J.columns[Y-1]})}if(G)this.performFill({event:Q,initialRange:J,finalRange:G,shouldUpdateRange:!0})}onDragCancel(){if(this.initialXY=null,!this.markedCells.length)return;this.clearMarkedPath()}performFill({event:Q,initialRange:z,finalRange:J,shouldUpdateRange:Z}){let{eventSvc:$,rangeSvc:X}=this.beans;if($.dispatchEvent({type:"fillStart"}),this.handleValueChanged(z,J,Q),Z)X.setCellRanges([J]);$.dispatchEvent({type:"fillEnd",initialRange:z,finalRange:J})}getFillHandleDirection(){let Q=vZ(this.gos)?.direction;if(!Q)return"xy";if(Q!=="x"&&Q!=="y"&&Q!=="xy")return R(177),"xy";return Q}handleValueChanged(Q,z,J){let{beans:Z}=this,{rangeSvc:$,gos:X,valueSvc:Y}=Z,G=$.getRangeEndRow(Q),q=$.getRangeStartRow(Q),H=$.getRangeEndRow(z),_=$.getRangeStartRow(z),U=this.dragAxis==="y";if(this.isReduce&&!vZ(X)?.suppressClearOnFillReduction){let A=U?Q.columns:Q.columns.filter((v)=>z.columns.indexOf(v)<0),O=U?L0(Z,H):_;if(O)this.clearCellsInRange(O,G,A);return}let W=[],B=[],E=[],K=[],L=!0,F=0,D=()=>{W.length=0,B.length=0,E.length=0,K.length=0,F=0},M=(A,O)=>{let v=this.isUp?G:q,I=!1;if(U)L=!0,D();while(!I&&v){let C=M0(Z,v);if(!C)break;if(U&&A)k(W,A,C,()=>!l(v,this.isUp?q:G));else if(O){L=!0,D();for(let m of O)k(W,m,C,()=>m!==(this.isLeft?Q.columns[0]:b(Q.columns)))}I=l(v,this.isUp?_:H),v=this.isUp?m0(this.beans,v):L0(Z,v)}},k=(A,O,v,I)=>{let C,m=!1;if(L)C=Y.getValue(O,v,"edit"),B.push(C),E.push(Y.getValue(O,v,"edit",!0)),K.push(Y.getValueForDisplay({column:O,node:v,from:"edit"}).valueFormatted),L=I();else{let{value:w,fromUserFunction:a,sourceCol:t,sourceRowNode:u}=this.processValues({event:J,values:A,initialValues:B,initialNonAggregatedValues:E,initialFormattedValues:K,col:O,rowNode:v,idx:F++});if(C=w,O.isCellEditable(v)){let Q0=Y.getValue(O,v,"edit");if(!a){if(t){let r=t.getColDef();if(r.useValueFormatterForExport!==!1&&r.valueFormatter){let S0=Y.getValueForDisplay({column:t,node:u,includeValueFormatted:!0,from:"edit"}).valueFormatted;if(S0!=null)C=S0}}if(O.getColDef().useValueParserForImport!==!1)C=Y.parseValue(O,v,t?C:c1(C),Q0)}if(!a||Q0!==C)v.setDataValue(O,C,"rangeSvc");else m=!0}}if(!m)A.push({value:C,column:O,rowNode:v})},{changeDetectionSvc:f}=this.beans;f?.beginDeferred();try{if(U)Q.columns.forEach((A)=>{M(A)});else{let A=this.isLeft?[...z.columns].reverse():z.columns;M(void 0,A)}this.beans.editSvc?.stopEditing(void 0,{source:"fillHandle"})}finally{f?.endDeferred()}}clearCellsInRange(Q,z,J){let Z={startRow:Q,endRow:z,columns:J,startColumn:J[0]};this.beans.rangeSvc.clearCellRangeCellValues({cellRanges:[Z],restoreSourceInBatch:!0})}processValues(Q){let{formula:z,valueSvc:J}=this.beans,{event:Z,values:$,initialValues:X,initialNonAggregatedValues:Y,initialFormattedValues:G,col:q,rowNode:H,idx:_}=Q,U=vZ(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:Z,values:$.map(({value:D})=>D),initialValues:X,initialNonAggregatedValues:Y,initialFormattedValues:G,currentIndex:_,currentCellValue:J.getValue(q,H,"edit"),direction:B,column:q,rowNode:H}),F=U(L);if(F!==!1)return{value:F,fromUserFunction:!0}}let E=(L)=>typeof L==="number"&&Number.isFinite(L)||typeof L==="string"&&/^[+-]?\d+(?:\.\d+)?$/.test(L.trim()),K=$.every(({value:L})=>E(L));if(Z.altKey||!K){let L=String(b($)?.value??"");if(K&&X.length===1){let A=this.isUp||this.isLeft?-1:1;return{value:parseFloat(L)+1*A,fromUserFunction:!1}}let{value:F,column:D,rowNode:M}=$[_%$.length],k,f=D.isAllowFormula()&&z?.isFormula(L);if(f){let A=B==="up"?-1:B==="down"?1:0,O=B==="left"?-1:B==="right"?1:0;k=z.updateFormulaByOffset({value:L,rowDelta:A,columnDelta:O})}else k=F;return{value:k,fromUserFunction:!1,sourceCol:f?void 0:D,sourceRowNode:M}}return{value:b(VS($.map(({value:L})=>Number(L)))),fromUserFunction:!1}}clearValues(){this.clearMarkedPath(),this.clearCellValues(),this.lastCellMarked=void 0,super.clearValues()}clearMarkedPath(){for(let Q of this.markedCells){if(!Q.isAlive())continue;let{comp:z}=Q;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(Q,z){if(this.clearMarkedPath(),this.clearCellValues(),this.dragAxis==="y"){if(l(z,Q))return;let J=q0(z,Q),{rangeStartRow:Z,rangeEndRow:$}=this;if(J&&(z.rowPinned==Z.rowPinned&&z.rowIndex>=Z.rowIndex||Z.rowPinned!=$.rowPinned&&z.rowPinned==$.rowPinned&&z.rowIndex<=$.rowIndex))this.reduceVertical(Q,z),this.isReduce=!0;else this.extendVertical(Q,z,J),this.isReduce=!1}else{let J=Q.column,Z=z.column;if(J===Z)return;let $=this.beans.visibleCols.allCols,X=$.indexOf(J),Y=$.indexOf(Z);if(Y<=X&&Y>=$.indexOf(this.cellRange.columns[0]))this.reduceHorizontal(Q,z),this.isReduce=!0;else this.extendHorizontal(Q,z,Y=4),Q.toggleCss(PS,X),S5(Z,$>0?!0:void 0),Q.toggleCss(TS,this.isSingleCell()),this.updateRangeBorders(),this.refreshRangeStyleAndHandle()}updateRangeBorders(){let Q=this.getRangeBorders(),z=this.isSingleCell(),J=!z&&Q.top,Z=!z&&Q.right,$=!z&&Q.bottom,X=!z&&Q.left,Y=this.cellComp;Y.toggleCss(IS,J),Y.toggleCss(CS,Z),Y.toggleCss(bS,$),Y.toggleCss(yS,X)}isSingleCell(){let{rangeSvc:Q}=this;return this.rangeCount===1&&!!Q&&!Q.isMoreThanOneCell()}getHasChartRange(){let{rangeSvc:Q}=this;if(!this.rangeCount||!Q)return!1;let z=Q.getCellRanges();return z.length>0&&z.every((J)=>[CQ.DIMENSION,CQ.VALUE].includes(J.type))}updateRangeBordersIfRangeCount(){if(this.rangeCount>0)this.updateRangeBorders(),this.refreshRangeStyleAndHandle()}getRangeBorders(){let Q=this.beans.gos.get("enableRtl"),z=!1,J=!1,Z=!1,$=!1,{rangeSvc:X,beans:{visibleCols:Y},cellCtrl:{cellPosition:G}}=this,q=G.column,H=X.getCellRanges().filter((W)=>X.isCellInSpecificRange(G,W));if(!H.length)return{top:z,right:J,bottom:Z,left:$};let _,U;if(Q)_=Y.getColAfter(q),U=Y.getColBefore(q);else _=Y.getColBefore(q),U=Y.getColAfter(q);if(!_)$=!0;if(!U)J=!0;for(let W=0;W=0;Z--){let $=J[Z],X=$.colorClass;if(!X)continue;if(Q.isCellInSpecificRange(this.cellCtrl.cellPosition,$))return X}return null}refreshHandleColor(Q){let z=this.selectionHandle?.getGui?.(),J=Q?.colorClass??null;if(!z){this.handleColorClass=null;return}if(this.handleColorClass&&this.handleColorClass!==J)z.classList.remove(this.handleColorClass);if(J)z.classList.add(J);else if(this.handleColorClass)z.classList.remove(this.handleColorClass);this.handleColorClass=J??null}getRangeForHandle(){let{gos:Q,editSvc:z}=this.beans,J=this.rangeSvc,Z=J.getCellRanges(),$=Z.length;if(this.rangeCount<1||$<1)return null;let X=z?.isRangeSelectionEnabledWhileEditing(),Y=X?Z:[b(Z)];for(let G of Y){let{cellPosition:q,column:H}=this.cellCtrl,_=YY(Q)&&!H.isSuppressFillHandle(),U=xS(Q),B=!z?.isEditing(this.cellCtrl,{withOpenEditor:!0})&&(X||$===1&&(_||U));if(this.hasChartRange)B=G.type===CQ.VALUE;if(B&&G.endRow!=null&&J.isContiguousRange(G)&&J.isBottomRightCell(G,q))return G}return null}addSelectionHandle(Q){let{beans:z}=this,J=z.editSvc?.isRangeSelectionEnabledWhileEditing(),Z=Q.type,X=!J&&YY(z.gos)&&n(Z)?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,Q)}destroy(){this.unsetComp()}},NS=class extends j{constructor(Q){super();this.eContainer=Q}postConstruct(){let{beans:Q,gos:z,eContainer:J}=this,Z=Q.rangeSvc,$={eElement:J,onDragStart:Z.onDragStart.bind(Z),onDragStop:Z.onDragStop.bind(Z),onDragging:Z.onDragging.bind(Z)},X=Q.dragSvc,Y=X.addDragSource.bind(X,$),G=X.removeDragSource.bind(X,$);if(this.addManagedPropertyListeners(["enableRangeSelection","cellSelection"],()=>{if(u0(z))Y();else G()}),this.addDestroyFunc(G),u0(z))Y()}},gS=class extends j{constructor(Q,z){super();this.column=Q,this.eGui=z}postConstruct(){this.addManagedElementListeners(this.eGui,{click:(Q)=>Q&&this.onClick(Q)})}onClick(Q){this.beans.rangeSvc?.handleColumnSelection(this.column,Q)}},hS=class extends j{constructor(Q,z){super();this.column=Q,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 Q;if(this.column.isColumn)Q=[this.column];else Q=this.column.getDisplayedLeafColumns();for(let z of Q)this.columnMap.set(z,!1)}refreshActive(){let{gos:Q,rangeSvc:z}=this.beans,J=Q.get("cellSelection");this.isActive=!!(J&&z&&typeof J==="object"&&J.enableHeaderHighlight)}setupRangeHeaderHighlight(){let Q=this.onRangeSelectionChanged.bind(this);this.addManagedEventListeners({rangeSelectionChanged:Q,columnPinned:Q,columnMoved:Q,columnGroupOpened:Q}),Q()}onRangeSelectionChanged(){if(!this.isActive)return;this.resetColumnMap();let Q=this.beans.rangeSvc.getCellRanges(),z=!1,J=!0;for(let Z of Q){if(z)break;for(let $ of Z.columns)if(this.columnMap.has($))this.columnMap.set($,!0),z||(z=!0)}for(let Z of Array.from(this.columnMap.values()))if(Z===!1){J=!1;break}this.comp.toggleCss("ag-header-range-highlight",z&&J)}destroy(){super.destroy(),this.comp=null,this.column=null}},uS=class extends j{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(Q){this.rowModel=Q.rowModel,this.dragSvc=Q.dragSvc,this.colModel=Q.colModel,this.visibleCols=Q.visibleCols,this.cellNavigation=Q.cellNavigation,this.ctrlsSvc=Q.ctrlsSvc}postConstruct(){let Q=this.onColumnsChanged.bind(this),z=()=>this.removeAllCellRanges(),J=this.refreshLastRangeStart.bind(this);this.addManagedEventListeners({newColumnsLoaded:Q,columnVisible:Q,columnValueChanged:Q,columnPivotModeChanged:z,columnRowGroupChanged:z,columnPivotChanged:z,columnGroupOpened:J,columnMoved:J,columnPinned:J}),this.ctrlsSvc.whenReady(this,(Z)=>{let $=Z.gridBodyCtrl;this.autoScrollService=new mZ({scrollContainer:$.eBodyViewport,scrollAxis:"xy",getVerticalPosition:()=>$.scrollFeature.getVScrollPosition().top,setVerticalPosition:(X)=>$.scrollFeature.setVerticalScrollPosition(X),getHorizontalPosition:()=>$.scrollFeature.getHScrollPosition().left,setHorizontalPosition:(X)=>$.scrollFeature.setHorizontalScrollPosition(X),shouldSkipVerticalScroll:()=>!V0(this.gos,"normal"),shouldSkipHorizontalScroll:()=>!$.scrollFeature.isHorizontalScrollShowing()})})}registerRangeSelectionExtension(Q){if(this.rangeSelectionExtensions.includes(Q))return;this.rangeSelectionExtensions.push(Q)}unregisterRangeSelectionExtension(Q){$0(this.rangeSelectionExtensions,Q)}shouldSuppressRangeSelection(Q){return this.rangeSelectionExtensions.some((z)=>z.shouldSuppressRangeSelection?.(Q))}shouldSkipColumn(Q){return this.rangeSelectionExtensions.some((z)=>z.shouldSkipColumn?.(Q))}isAllColumnsSelectionCell(Q){return this.rangeSelectionExtensions.some((z)=>z.isAllColumnsSelectionCell?.(Q))}isAllColumnsRange(Q,z){return this.rangeSelectionExtensions.some((J)=>J.isAllColumnsRange?.(Q,z))}updateSelectionModeForCell(Q){this.setSelectionMode(this.isAllColumnsSelectionCell(Q))}onDragStart(Q){let z=this.gos,J=Q.target;if(!u0(z)||q6(z,J)?.isSuppressMouseEvent(Q))return;if(this.shouldSuppressRangeSelection(J))return;let{shiftKey:Z}=Q,$=this.isMultiRange(Q),X=Z&&!!this.cellRanges?.length;if(!$&&(!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=Q,this.intersectionRange=$&&this.getCellRangeCount(this.lastCellHovered)>1,!X)this.setNewestRangeStartCell(this.lastCellHovered);if(this.cellRanges.length>0)this.draggingRange=b(this.cellRanges);else{let G={rowIndex:this.lastCellHovered.rowIndex,rowPinned:this.lastCellHovered.rowPinned},q=this.getColumnsFromModel([this.lastCellHovered.column]);if(!q?.length)return;this.draggingRange={startRow:G,endRow:G,columns:q,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(Q){let{dragging:z,lastCellHovered:J,newestRangeStartCell:Z,autoScrollService:$,cellHasChanged:X}=this;if(!z||!Q)return;this.updateValuesOnMove(Q.target),this.lastMouseEvent=Q;let Y=(B)=>J&&J.rowPinned===B&&Z.rowPinned===B,G=Y("top")||Y("bottom");if($.check(Q,G),!X||!J)return;let q=Z?.column,H=J?.column,_=this.calculateColumnsBetween(q,H);if(!_)return;let{rowIndex:U,rowPinned:W}=J;this.draggingRange.endRow={rowIndex:U,rowPinned:W},this.draggingRange.columns=_,this.dispatchChangedEvent(!1,!1,this.draggingRange.id)}onDragStop(){if(!this.dragging)return;let{id:Q}=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,Q)}onColumnsChanged(){this.refreshLastRangeStart();let Q=this.visibleCols.allCols;for(let J of this.cellRanges){let Z=J.columns;if(J.columns=J.columns.filter((X)=>X.isVisible()&&Q.indexOf(X)!==-1),!X0(Z,J.columns))this.dispatchChangedEvent(!1,!0,J.id)}let z=this.cellRanges.length;if(this.cellRanges=this.cellRanges.filter((J)=>J.columns.length>0),z>this.cellRanges.length)this.dispatchChangedEvent(!1,!0)}refreshLastRangeStart(){let Q=b(this.cellRanges);if(!Q)return;this.refreshRangeStart(Q)}isContiguousRange(Q){let z=Q.columns;if(!z.length)return!1;let J=this.visibleCols.allCols,Z=z.map(($)=>J.indexOf($)).sort(($,X)=>$-X);return b(Z)-Z[0]+1===z.length}getRangeStartRow(Q){if(Q.startRow&&Q.endRow)return q0(Q.startRow,Q.endRow)?Q.startRow:Q.endRow;return{rowIndex:0,rowPinned:(this.beans.pinnedRowModel?.getPinnedTopRowCount()??0)>0?"top":null}}getRangeEndRow(Q){if(Q.startRow&&Q.endRow)return q0(Q.startRow,Q.endRow)?Q.endRow:Q.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(Q){let z=this.beans,J=this.getRangeStartRow(Q),Z=this.getRangeEndRow(Q),$=Q6(z,J);return Q6(z,Z)-$+1}handleCellMouseDown(Q,z){let J=Q.ctrlKey||Q.metaKey;this.handleCellSelectionInput(z,{target:Q.target,shiftKey:Q.shiftKey,isRightClick:u5(this.beans,Q),isMultiRange:this.isMultiRange(Q),isMultiKey:J,preventDefault:()=>Q.preventDefault()})}handleCellKeyboardSelect(Q,z){let J=Q.ctrlKey||Q.metaKey;this.handleCellSelectionInput(z,{target:Q.target,shiftKey:Q.shiftKey,isRightClick:!1,isMultiRange:this.isMultiRangeForKeyState(J),isMultiKey:J,preventDefault:()=>Q.preventDefault()})}handleCellSelectionInput(Q,z){let{target:J,shiftKey:Z,isRightClick:$,isMultiRange:X,isMultiKey:Y,preventDefault:G}=z;if(this.shouldSuppressRangeSelection(J))return;let q=this.isAllColumnsSelectionCell(Q);if(q)G();if(Z)return this.extendLatestRangeToCell(Q);if(q&&$)return;this.updateSelectionModeForCell(Q);let H=this.calculateColumnsBetween(Q.column,Q.column);if(!H)return;let _=q?this.findContainingRange({columns:H,startRow:Q,endRow:Q}):void 0;if(q&&!!_&&X&&Y&&_)this.removeRowFromAllColumnsRange(Q,_);else this.setRangeToCell(Q,X)}isMultiRange(Q){return this.isMultiRangeForKeyState(Q.ctrlKey||Q.metaKey)}isMultiRangeForKeyState(Q){let{editingWithRanges:z,allowMulti:J}=this.getMultiRangeContext();return z||(J?Q:!1)}getMultiRangeContext(){let{gos:Q,editSvc:z}=this.beans,J=!!z?.isEditing()&&!!z?.isRangeSelectionEnabledWhileEditing(),Z=H9(Q)&&!J;return{editingWithRanges:J,suppressMultiRanges:Z,allowMulti:!Z}}removeRowFromAllColumnsRange(Q,z){let{beans:J,cellRanges:Z}=this,$=K1(J),X=Gz(J),Y=this.getRangeStartRow(z),G=this.getRangeEndRow(z);if(!Y&&l($,Q))z2(z,L0(J,$),"top");else if(!G&&l(X,Q))z2(z,m0(J,X),"bottom");else if(l(Y,G))$0(Z,z);else if(l(Y,Q))z2(z,L0(J,Q),"top");else if(l(G,Q))z2(z,m0(J,Q),"bottom");else{let q=m0(J,Q),H=L0(J,Q);z.startRow=Y,z.endRow=q??void 0,Z.push({...z,startRow:H??void 0,endRow:G})}this.dispatchChangedEvent(!0,!0)}setRangeToCell(Q,z=!1){let{gos:J}=this;if(!u0(J))return;this.updateSelectionModeForCell(Q);let Z=this.calculateColumnsBetween(Q.column,Q.column);if(!Z)return;let{suppressMultiRanges:$}=this.getMultiRangeContext();if($||!z||n(this.cellRanges))this.removeAllCellRanges(!0);let X={rowIndex:Q.rowIndex,rowPinned:Q.rowPinned},Y={startRow:X,endRow:X,columns:Z,startColumn:Q.column},G=this.ensureRangeStartColumn(Y);if(!G)return;this.cellRanges.push(Y),this.setNewestRangeStartCell({...Q,column:G}),this.onDragStop(),this.dispatchChangedEvent(!0,!0)}getRangeLastColumn(Q){let z=Q.columns[0],J=b(Q.columns);return this.newestRangeStartCell?.column===z?J:z}extendRangeRowCountBy(Q,z){let{beans:J}=this,{startRow:Z,endRow:$}=Q;if(!Z||!$)return;let X=0,Y,G=q0($,Z);if(G)Y=Z;else Y=$;let q=z>0?L0:m0,H=Math.abs(z);while(Xz.indexOf(Z)).filter((Z)=>Z>-1).sort((Z,$)=>Z-$);return{left:z[J[0]],right:z[b(J)]}}extendLatestRangeInDirection(Q){if(this.isEmpty()||!this.newestRangeStartCell)return;let z=Q.key,J=Q.ctrlKey||Q.metaKey,Z=b(this.cellRanges),$=this.newestRangeStartCell,X=Z.endRow.rowIndex,Y=Z.endRow.rowPinned,q={column:this.getRangeLastColumn(Z),rowIndex:X,rowPinned:Y},H=this.cellNavigation.getNextCellToFocus(z,q,J);if(!H)return;if(this.shouldSkipColumn(H.column))return;return this.setCellRange({rowStartIndex:$.rowIndex,rowStartPinned:$.rowPinned,rowEndIndex:H.rowIndex,rowEndPinned:H.rowPinned,columnStart:$.column,columnEnd:H.column}),H}setCellRange(Q){if(!u0(this.gos))return;this.removeAllCellRanges(!0),this.addCellRange(Q)}setCellRanges(Q){if(X0(this.cellRanges,Q))return;if(!this.verifyCellRanges(this.gos))return;this.setSelectionMode(!1),this.removeAllCellRanges(!0);let z=this.getColumnsFromModel(this.visibleCols.allCols)??[],J=!1;for(let Z of Q){if(Z.columns&&Z.startRow){let $=this.getColumnsFromModel(Z.columns);if(!$||$.length===0)continue;Z.columns=$;let{startRow:X}=Z;this.setNewestRangeStartCell({rowIndex:X.rowIndex,rowPinned:X.rowPinned,column:Z.columns[0]})}if(!J&&z.length>0&&this.isAllColumnsRange(Z,z))J=!0;this.cellRanges.push(Z)}this.setSelectionMode(J),this.dispatchChangedEvent(!1,!0)}clearCellRangeCellValues(Q){let{beans:z,eventSvc:J}=this,{cellEventSource:Z="rangeSvc",dispatchWrapperEvents:$,wrapperEventSource:X="deleteKey",restoreSourceInBatch:Y}=Q,{cellRanges:G}=Q;if($)J.dispatchEvent({type:"cellSelectionDeleteStart",source:X}),J.dispatchEvent({type:"rangeDeleteStart",source:X});if(!G)G=this.cellRanges;let{valueSvc:q,editSvc:H}=z,_=!!H?.isBatchEditing(),{changeDetectionSvc:U}=z;U?.beginDeferred();try{this.forEachEditableCellInRanges(G,(W,B)=>{if(Y&&_){H?.batchResetToSourceValue({rowNode:W,column:B});return}let E=q.getDeleteValue(B,W);W.setDataValue(B,E,Z)})}finally{U?.endDeferred()}if($)J.dispatchEvent({type:"cellSelectionDeleteEnd",source:X}),J.dispatchEvent({type:"rangeDeleteEnd",source:X})}createCellRangeFromCellRangeParams(Q){return this.createPartialCellRangeFromRangeParams(Q,!1)}createPartialCellRangeFromRangeParams(Q,z){let{columns:J,columnStart:Z,columnEnd:$,rowStartIndex:X,rowStartPinned:Y,rowEndIndex:G,rowEndPinned:q}=Q,H=this.getColumnsFromParams(J,Z,$);if(!H||!z&&H.columns.length===0)return;let{columns:_,startsOnTheRight:U}=H,W=GY(X,Y),B=GY(G,q);return{startRow:W,endRow:B,columns:_,startColumn:this.getColumnFromModel(Z)??(U?b(_):_[0])}}addCellRange(Q){let z=this.gos;if(!u0(z)||!this.verifyCellRanges(z))return;this.setSelectionMode(!1);let J=this.createCellRangeFromCellRangeParams(Q);if(J){if(J.startRow)this.setNewestRangeStartCell({rowIndex:J.startRow.rowIndex,rowPinned:J.startRow.rowPinned,column:J.startColumn});return this.cellRanges.push(J),this.dispatchChangedEvent(!1,!0,J.id),J}}getCellRanges(){return this.cellRanges}isEmpty(){return this.cellRanges.length===0}isMoreThanOneCell(){let Q=this.cellRanges.length;if(Q===0)return!1;if(Q>1)return!0;let z=this.cellRanges[0],J=this.getRangeStartRow(z),Z=this.getRangeEndRow(z);return J.rowPinned!==Z.rowPinned||J.rowIndex!==Z.rowIndex||z.columns.length!==1}areAllRangesAbleToMerge(){let Q=new Map;if(this.cellRanges.length<=1)return!0;for(let Z of this.cellRanges)this.forEachRowInRange(Z,($)=>{let X=`${$.rowPinned||"normal"}_${$.rowIndex}`,Y=Q.get(X),G=Z.columns.map((q)=>q.getId());if(Y){let q=G.filter((H)=>Y.indexOf(H)===-1);Y.push(...q)}else Q.set(X,G)});let J;for(let Z of Q.values()){let $=Z.sort().join();if(J===void 0){J=$;continue}if(J!==$)return!1}return!0}removeAllCellRanges(Q){if(this.isEmpty())return;if(this.onDragStop(),this.cellRanges.length=0,!Q)this.dispatchChangedEvent(!1,!0)}isCellInAnyRange(Q){return this.getCellRangeCount(Q)>0}isCellInSpecificRange(Q,z){let J=z.columns?.includes(Q.column),Z=this.isRowInRange(Q,z);return J&&Z}isColumnInAnyRange(Q){let{beans:z}=this,J=K1(z),Z=Gz(z);if(!J||!Z)return!1;let $=Q.isColumn?[Q]:Q.getDisplayedLeafColumns();return this.findContainingRange({columns:$,startRow:J,endRow:Z},!0)!=null}findContainingRange({columns:Q,startRow:z,endRow:J},Z=!1){let $=this.cellRanges;for(let X=$.length-1;X>=0;X--){let Y=$[X],G=Q.every((H)=>Y.columns.includes(H)),q=!1;if(Z)q=l(Y.startRow,z)&&l(Y.endRow,J);else{let H=z&&this.isRowInRange(z,Y),_=J&&this.isRowInRange(J,Y);q=!!H&&!!_}if(G&&q)return Y}}isBottomRightCell(Q,z){let J=this.visibleCols.allCols,Z=Q.columns.map((H)=>J.indexOf(H)).sort((H,_)=>H-_),{startRow:$,endRow:X}=Q,Y=q0($,X)?X:$,G=J.indexOf(z.column)===b(Z),q=z.rowIndex===Y.rowIndex&&RQ(z.rowPinned)===RQ(Y.rowPinned);return G&&q}getCellRangeCount(Q){return this.cellRanges.filter((z)=>this.isCellInSpecificRange(Q,z)).length}isRowInRange(Q,z){let J=this.getRangeStartRow(z),Z=this.getRangeEndRow(z),$=l(Q,J),X=l(Q,Z);if($||X)return!0;let Y=!q0(Q,J),G=q0(Q,Z);return Y&&G}intersectLastRange(Q){let{editingWithRanges:z,suppressMultiRanges:J}=this.getMultiRangeContext();if(z||J||Q&&this.dragging||this.isEmpty())return;let Z=b(this.cellRanges),$=this.getRangeStartRow(Z),X=this.getRangeEndRow(Z),Y=[];for(let G of this.cellRanges.slice(0,-1)){let q=this.getRangeStartRow(G),H=this.getRangeEndRow(G),_=G.columns,U=_.filter((B)=>Z.columns.indexOf(B)===-1);if(U.length===_.length){Y.push(G);continue}if(q0(X,q)||q0(H,$)){Y.push(G);continue}let W=Y.length;if(q0(q,$)){let B={columns:[..._],startColumn:Z.startColumn,startRow:{...q},endRow:m0(this.beans,$)};Y.push(B)}if(U.length>0){let B={columns:U,startColumn:U.includes(Z.startColumn)?Z.startColumn:U[0],startRow:mS([{...$},{...q}]),endRow:cS([{...X},{...H}])};Y.push(B)}if(q0(X,H))Y.push({columns:[..._],startColumn:Z.startColumn,startRow:L0(this.beans,X),endRow:{...H}});if(Y.length-W===1)Y[Y.length-1].id=G.id}if(this.cellRanges=Y,Q)this.dispatchChangedEvent(!1,!0)}createRangeHighlightFeature(Q,z,J){Q.createManagedBean(new hS(z,J))}setSelectionMode(Q){this.selectionMode=Q?1:0}refreshRangeStart(Q){let{columns:z}=Q,J=this.ensureRangeStartColumn(Q);if(!J)return;let Z=(q,H)=>{let _=Q.columns.filter((U)=>U!==q);if(q)Q.startColumn=q,Q.columns=H?[q,..._]:[..._,q];else Q.columns=_},{left:$,right:X}=this.getRangeEdgeColumns(Q);if(J===z[0]&&J!==$){Z($,!0);return}if(J===b(z)&&J===X)Z(X,!1)}setNewestRangeStartCell(Q){this.newestRangeStartCell=Q}getColumnsFromParams(Q,z,J){let Z=!Q&&!z&&!J,$,X=!1;if(Z||Q)$=this.getColumnsFromModel(Z?void 0:Q);else if(z&&J){if($=this.calculateColumnsBetween(z,J),$?.length)X=$[0]!==this.getColumnFromModel(z)}return $?{columns:$,startsOnTheRight:X}:void 0}verifyCellRanges(Q){let{suppressMultiRanges:z}=this.getMultiRangeContext(),J=q9(Q)&&z&&this.cellRanges.length>1;if(J)R(93);return!J}forEachRowInRange(Q,z){let J=this.getRangeStartRow(Q),Z=this.getRangeEndRow(Q),$=J;while($){if(z($),l($,Z))break;$=L0(this.beans,$)}}forEachEditableCellInRanges(Q,z){let{beans:J}=this;for(let Z of Q)this.forEachRowInRange(Z,($)=>{let X=M0(J,$);if(!X)return;for(let Y=0;Y0,H=z.ctrlKey||z.metaKey,_=!G||H,U=K1(Z),W=Gz(Z);if(!U||!W)return;if(z.key===V.ENTER)z.preventDefault();if(z.shiftKey){let E=$.root;if(!E)return;let K=Q.isColumn?Q:b(Q.getLeafColumns()),L=this.findContainingRange({columns:[E],startRow:U,endRow:W},!0);if(!L){$0(X,$.lastCellRange),this.selectColumns(this.calculateColumnsBetween(E,K),U,W);return}this.updateRangeRowBoundary({cellRange:L,boundary:"end",cellPosition:{column:K,...W}});return}if(q&&(Y||!H&&!G))this.removeAllCellRanges(!0);let B=(E,K)=>{let L=this.findContainingRange({columns:E,startRow:U,endRow:W},!0);if(L&&_)this.deselectColumnsFromRange(L,E);else{let F=this.selectColumns(E,U,W);if(F)$.lastCellRange=F}$.root=K};if(Q.isColumn)B([Q],Q);else{let E=Q.getDisplayedLeafColumns();B(E,E[0])}}deselectColumnsFromRange(Q,z){if(JJ(Q.columns,z),z.includes(Q.startColumn))Q.startColumn=Q.columns[0];if(Q.columns.length===0)$0(this.cellRanges,Q);this.dispatchChangedEvent(!0,!0)}selectColumns(Q,z,J){return this.addCellRange({columns:Q,columnStart:Q[0],columnEnd:b(Q),rowStartIndex:z.rowIndex,rowStartPinned:z.rowPinned,rowEndIndex:J.rowIndex,rowEndPinned:J.rowPinned})}};function GY(Q,z){return Q!=null?{rowIndex:Q,rowPinned:z}:void 0}function mS(Q){let z;for(let J of Q)if(z===void 0||q0(z,J))z=J;return z}function cS(Q){let z;for(let J of Q)if(z===void 0||q0(J,z))z=J;return z}function pS(Q,z){let{startRow:J,endRow:Z}=Q,$=q0(J,Z)?Z:J,X=z.rowIndex===$.rowIndex&&z.rowPinned===$.rowPinned,Y=Q.columns[0],G=b(Q.columns),q=Q.startColumn===Y?G:Y;return z.column===q&&X}function z2(Q,z,J){let Z;if(J==="top")Z=!Q.startRow||!Q.endRow||q0(Q.startRow,Q.endRow)?"startRow":"endRow";else Z=!Q.startRow||!Q.endRow||q0(Q.startRow,Q.endRow)?"endRow":"startRow";Q[Z]=z??void 0}var M4={moduleName:"CellSelection",version:J0,beans:[uS],dynamicBeans:{fillHandle:AS,rangeHandle:jS},apiFunctions:{getCellRanges:SS,addCellRange:OS,clearRangeSelection:$Y,clearCellSelection:$Y},dependsOn:[I0,iz,cZ],css:[RS]};function iS(Q){return Q.colModel.isPivotMode()}function nS(Q,z,J){return Q.pivotResultCols?.lookupPivotResultCol(z,J)??null}function dS(Q,z){Q.valueColsSvc?.setColumns(z,"api")}function tS(Q){return Q.valueColsSvc?.columns??[]}function rS(Q,z){Q.valueColsSvc?.removeColumns(z,"api")}function sS(Q,z){Q.valueColsSvc?.addColumns(z,"api")}function lS(Q,z){Q.pivotColsSvc?.setColumns(z,"api")}function aS(Q,z){Q.pivotColsSvc?.removeColumns(z,"api")}function oS(Q,z){Q.pivotColsSvc?.addColumns(z,"api")}function eS(Q){return Q.pivotColsSvc?.columns??[]}function QO(Q,z){Q.pivotResultCols?.setPivotResultCols(z,"api")}function zO(Q){let z=Q.pivotResultCols?.getPivotResultCols();return z?z.list:null}var qY="PivotRowTotal_",JO=({headerName:Q},{headerName:z})=>{if(Q&&!z)return 1;else if(!Q&&z)return-1;else if(!Q&&!z)return 0;if(Qz)return 1;else return 0},ZO=(Q)=>(z,J)=>Q(z.headerName,J.headerName),$O=class extends j{constructor(){super(...arguments);this.beanName="pivotColDefSvc"}wireBeans(Q){this.colModel=Q.colModel,this.pivotColsSvc=Q.pivotColsSvc,this.valueColsSvc=Q.valueColsSvc,this.colNames=Q.colNames}postConstruct(){let Q=()=>this.gos.get("serverSidePivotResultFieldSeparator")??"_";this.fieldSeparator=Q(),this.addManagedPropertyListener("serverSidePivotResultFieldSeparator",()=>{this.fieldSeparator=Q()});let z=()=>this.gos.get("pivotDefaultExpanded");this.pivotDefaultExpanded=z(),this.addManagedPropertyListener("pivotDefaultExpanded",()=>{this.pivotDefaultExpanded=z()})}createPivotColumnDefs(Q){let z=this.createPivotColumnsFromUniqueValues(Q);function J($,X=[]){return $.forEach((Y)=>{if(Y.children!==void 0)J(Y.children,X);else X.push(Y)}),X}let Z=J(z);return this.addRowGroupTotals(z,Z),this.addExpandablePivotGroups(z,Z),this.addPivotTotalsToGroups(z,Z),z}createPivotColumnsFromUniqueValues(Q){let z=this.pivotColsSvc?.columns??[],J=z.length;return this.recursivelyBuildGroup(0,Q,[],J,z)}recursivelyBuildGroup(Q,z,J,Z,$){if(Q>=Z)return this.buildMeasureCols(J);let{pivotComparator:X}=$[Q].getColDef(),Y=X?ZO(X):JO,G=this.valueColsSvc?.columns;if(G?.length===1&&this.gos.get("removePivotHeaderRowWhenSingleValueColumn")&&Q===Z-1){let H=[];for(let _ of z.keys()){let U=[...J,_],W=this.createColDef(G[0],_,U);W.columnGroupShow="open",H.push(W)}return H.sort(Y),H}let q=[];for(let H of z.keys()){let _=this.pivotDefaultExpanded===-1||Q{let Z=this.colNames.getDisplayNameForColumn(J,"header"),$=this.createColDef(J,Z,Q);return $.columnGroupShow="open",$})}addExpandablePivotGroups(Q,z){let J=this.gos.get("suppressExpandablePivotGroups");if(J||this.gos.get("pivotColumnGroupTotals"))return;let Z=($,X,Y)=>{if("children"in $){let{valueColsSvc:H}=this,{columns:_=[]}=H??{},U=new Map;$.children.forEach((E)=>{Z(E,X,U)});let W=!$.children.some((E)=>E.children),B=W&&_.length===1&&this.gos.get("removePivotHeaderRowWhenSingleValueColumn");for(let E of _){let K=this.colNames.getDisplayNameForColumn(E,"header"),L=this.createColDef(E,K,$.pivotKeys);if(L.pivotTotalColumnIds=U.get(E.getColId()),L.columnGroupShow=!J?"closed":"open",L.aggFunc=E.getAggFunc(),!W||B)$.children.push(L),X.push(L)}this.merge(Y,U);return}if(!$.pivotValueColumn)return;let G=$.pivotValueColumn.getColId();if(Y.has(G))Y.get(G).push($.colId);else Y.set(G,[$.colId])};Q.forEach(($)=>{Z($,z,new Map)})}addPivotTotalsToGroups(Q,z){if(!this.gos.get("pivotColumnGroupTotals"))return;let J=this.gos.get("pivotColumnGroupTotals")==="after",Z=this.valueColsSvc?.columns,$=Z?.map((X)=>X.getAggFunc());if(!$||$.length<1||!this.sameAggFuncs($))return;if(Z){let X=Z[0];Q.forEach((Y)=>{this.recursivelyAddPivotTotal(Y,z,X,J)})}}recursivelyAddPivotTotal(Q,z,J,Z){let $=Q;if(!$.children){let Y=Q;return Y.colId?[Y.colId]:null}let X=[];if($.children.forEach((Y)=>{let G=this.recursivelyAddPivotTotal(Y,z,J,Z);if(G)X=X.concat(G)}),$.children.length>1){let G=this.getLocaleTextFunc()("pivotColumnGroupTotals","Total"),q=this.createColDef(J,G,Q.pivotKeys,!0);q.pivotTotalColumnIds=X,q.aggFunc=J.getAggFunc(),q.columnGroupShow=this.gos.get("suppressExpandablePivotGroups")?"open":void 0;let H=Q.children;if(Z)H.push(q);else H.unshift(q);z.push(q)}return X}addRowGroupTotals(Q,z){if(!this.gos.get("pivotRowTotals"))return;let J=this.gos.get("pivotRowTotals")==="after",$=(this.valueColsSvc?.columns??[]).slice();if(!J)$.reverse();let X=$.length>1||!this.gos.get("removePivotHeaderRowWhenSingleValueColumn");for(let Y=0;Y<$.length;Y++){let G=$[Y],q=this.colNames.getDisplayNameForColumn(G,"header"),H=this.createColDef(G,q,[]),_=[];for(let W=0;WX.data?.[X.colDef.field],$.pivotKeys=J,$.pivotValueColumn=Q,$.filter===!0)$.filter="agNumberColumnFilter";return $}sameAggFuncs(Q){if(Q.length==1)return!0;for(let z=1;z{let X=[...Q.has(Z)?Q.get(Z):[],...J];Q.set(Z,X)})}generateColumnGroupId(Q){return`pivotGroup_${(this.pivotColsSvc?.columns??[]).map((J)=>J.getColId()).join("-")}_${Q.join("-")}`}generateColumnId(Q,z){return`pivot_${(this.pivotColsSvc?.columns??[]).map((Z)=>Z.getColId()).join("-")}_${Q.join("-")}_${z}`}createColDefsFromFields(Q){let z=new Map;for(let $=0;${let q=[];for(let[U,W]of Y){let B=J(`${$}${this.fieldSeparator}${U}`,U,W,G+1);q.push(B)}if(q.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=$,E.aggFunc=U.getAggFunc(),E.valueGetter=(K)=>K.data?.[$],E}return{colId:$,headerName:X,valueGetter:(B)=>B.data?.[$]}}if(this.gos.get("removePivotHeaderRowWhenSingleValueColumn")&&q.length===1&&"colId"in q[0])return q[0].headerName=X,q[0];return{openByDefault:this.pivotDefaultExpanded===-1||G{$.forEach((X)=>{if(T(X.children)){let G=X;if(J)J(G);Z(G.children)}else{let G=X;if(z)z(G)}})};if(Q)Z(Q)}},HY="Exceeded maximum allowed pivot column count.",Y2=(Q)=>{let z={};return Q.forEach((J,Z)=>z[Z]=J instanceof Map?Y2(J):J),z},YO=class extends j{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(Q){this.valueSvc=Q.valueSvc,this.colModel=Q.colModel,this.pivotResultCols=Q.pivotResultCols,this.rowGroupColsSvc=Q.rowGroupColsSvc,this.valueColsSvc=Q.valueColsSvc,this.pivotColsSvc=Q.pivotColsSvc,this.pivotColDefSvc=Q.pivotColDefSvc}execute(Q){if(this.colModel.isPivotActive())return this.executePivotOn(Q);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(Q){let z=this.valueColsSvc?.columns.length??1,J=this.gos.get("pivotMaxGeneratedColumns");this.maxUniqueValues=J===-1?-1:J/z;let Z;try{Z=this.bucketUpRowNodes(Q)}catch(F){if(F.message===HY)return this.pivotResultCols.setPivotResultCols([],"rowModelUpdated"),this.eventSvc.dispatchEvent({type:"pivotMaxColumnsExceeded",message:F.message}),this.lastTimeFailed=!0,!1;throw F}let $=this.setUniqueValues(Z),X=this.valueColsSvc?.columns??[],Y=X.map((F)=>`${F.getId()}-${F.getColDef().headerName}`).join("#"),G=X.map((F)=>F.getAggFunc().toString()).join("#"),q=this.aggregationColumnsHashLastTime!==Y,H=this.aggregationFuncsHashLastTime!==G;this.aggregationColumnsHashLastTime=Y,this.aggregationFuncsHashLastTime=G;let _=(this.rowGroupColsSvc?.columns??[]).map((F)=>F.getId()).join("#"),U=_!==this.groupColumnsHashLastTime;this.groupColumnsHashLastTime=_;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||$||q||U||H||L){let F=this.pivotColDefSvc.createPivotColumnDefs(this.uniqueValues);return this.pivotResultCols.setPivotResultCols(F,"rowModelUpdated"),this.lastTimeFailed=!1,!0}return this.lastTimeFailed=!1,!1}setUniqueValues(Q){if(!DZ(Y2(this.uniqueValues),Y2(Q)))return this.uniqueValues=Q,!0;return!1}bucketUpRowNodes(Q){this.currentUniqueCount=0;let z=new Map;A0(this.beans.rowModel.rootNode,this.beans.rowModel.hierarchical,Q,(Z)=>{if(Z.leafGroup)Z.childrenMapped=null});let J=(Z)=>{if(Z.leafGroup)this.bucketRowNode(Z,z);else{let $=Z.childrenAfterFilter;if($)for(let X=0,Y=$.length;Xthis.maxUniqueValues;if(Y&&W)throw Error(HY)}if(!$.has(U))$.set(U,[]);$.get(U).push(_)}if(J===z.length-1)return $;let G=new Map;for(let q of $.keys())G.set(q,this.bucketChildren($.get(q),z,J+1,Z.get(q)));return G}},GO={moduleName:"SharedPivot",version:J0,beans:[XO,$O,q4],apiFunctions:{isPivotMode:iS,getPivotResultColumn:nS,setValueColumns:dS,getValueColumns:tS,removeValueColumns:rS,addValueColumns:sS,setPivotColumns:lS,removePivotColumns:aS,addPivotColumns:oS,getPivotColumns:eS,setPivotResultColumns:QO,getPivotResultColumns:zO},dependsOn:[E4,E6]},k4={moduleName:"Pivot",version:J0,rowModels:["clientSide"],beans:[YO],dependsOn:[GO,zS,F2]};var ub=String.fromCodePoint(31,41150,8291);var V4=[{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"}],_Y=new Map;for(let Q of V4){let z=_Y.get(Q.symbol)??[];z.push(Q),_Y.set(Q.symbol,z)}var mb=[...new Set(V4.map((Q)=>Q.symbol))].sort((Q,z)=>z.length-Q.length);var cb=Symbol("WrappedFunctionMarker");var qO={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"},HO=new Set(["columnLineCombo","areaColumnCombo","customCombo"]);function _O(Q){return HO.has(Q)}function UO(Q){return Q==="doughnut"?"donut":Q}function WO(Q){return qO[Q]}var BO=["number","category","grouped-category","log","time"];var pb=BO.reduce((Q,z)=>({...Q,[z]:{title:{_enabledFromTheme:!0}}}),{});var M2=(Q)=>{return(z)=>{if(z==null)return!0;return Q(z)}};var EO=["doughnut"];function KO(Q){return!!WO(Q)||_O(Q)}function LO(Q){return EO.includes(Q)}var nb=M2((Q)=>{if(KO(Q))return!0;if(LO(Q)){let z=UO(Q);return zz(`The chart type '${Q}' has been deprecated. Please use '${z}' instead.`),z}return!1}),db=M2((Q)=>{return typeof Q==="object"}),tb=M2((Q)=>{return typeof Q==="object"}),rb=M2((Q)=>{return typeof Q==="string"||typeof Q==="function"});function f4(Q){return Q.map((z,J,Z)=>z.map(($,X)=>Z.slice(0,J+1).reduce((Y,G)=>Y+G[X],0)))}function A4(Q){let z=Q.map((J,Z)=>Q.reduce(($,X)=>Math.max($,X[Z]),0));return Q.map((J)=>J.map((Z,$)=>Z/z[$]*19))}var j4=[[1,3,5],[2,6,4],[5,3,1]];var FO=f4(j4);var sb=A4(FO);var DO=j4;var MO=f4(DO);var lb=A4(MO);var kO=["number","category","time","grouped-category"],VO=["angle-category","angle-number","radius-category","radius-number"],ab=[...kO,...VO];var{h:fO,watch:q7,onUnmount:AO}=window;N5.registerModules([SX,ZX,RX,DX,jX,WX,zX,J4,M4,k4,F4,$7,dY,rY,lY,oY,K4]);var R4=(Q)=>{let{data:z,options:J,api:Z,on:$,class:X,style:Y="height: 100%; width: 100%",dark:G}=Q,q=null,H=null,_=()=>G!==void 0?typeof G==="function"?G():G:document.documentElement.getAttribute("data-theme")==="dark"||window.matchMedia("(prefers-color-scheme: dark)").matches,U=()=>_()?"ag-theme-balham-dark":"ag-theme-balham";return fO("div",{class:X,style:Y,ref:(B)=>{if(H)H(),H=null;if(q&&!q.isDestroyed()){if(q.destroy(),Z)Z.current=null;q=null}if(!B)return;let E=typeof z==="function"?z():z,K=typeof J==="function"?J():J,L=["onFilterChanged","onModelUpdated","onGridSizeChanged","onFirstDataRendered","onRowValueChanged","onSelectionChanged","onCellClicked","onCellDoubleClicked","onCellValueChanged","onRowClicked","onSortChanged","onContextMenu","onColumnResized","onColumnMoved","onRowDataUpdated","onCellEditingStarted","onCellEditingStopped","onPaginationChanged","onBodyScroll"],F={};L.forEach((A)=>{if($?.[A])F[A]=(O)=>$[A](O)});let D={...K,theme:U(),rowData:E||[],onGridReady:(A)=>{if(q=A.api,Z)Z.current=q;if($?.onGridReady)$.onGridReady(A);if(K?.autoSizeColumns)A.api.autoSizeAllColumns()},...F};q=MJ(B,D);let M=q7(()=>{if(!q||q.isDestroyed())return;let A=typeof z==="function"?z():z;if(Array.isArray(A)){let O=q.getGridOption("rowData");if(A!==O)q.setGridOption("rowData",A)}}),k=q7(()=>{if(!q||q.isDestroyed())return;_();let A=U();if(A!==q.getGridOption("theme"))q.setGridOption("theme",A)}),f=q7(()=>{if(!q||q.isDestroyed()||!J)return;let A=typeof J==="function"?J():J;if(A)Object.entries(A).forEach(([O,v])=>{try{q.setGridOption(O,v)}catch(I){}})});H=()=>{if(M(),k(),f(),q&&!q.isDestroyed()){if(q.destroy(),Z)Z.current=null;q=null}},AO(()=>{if(H)H(),H=null})}})};if(typeof window<"u")window.Grid=R4;})(); diff --git a/index.js b/index.js index 986a3a4..8cc909d 100644 --- a/index.js +++ b/index.js @@ -1,4 +1,4 @@ -const { h, watch, onUnmount } = window; +import { h, watch, onUnmount } from "sigpro" import { ModuleRegistry, @@ -10,11 +10,14 @@ import { TextEditorModule, ClientSideRowModelModule, themeQuartz, - iconSetQuartzLight, - createGrid + createGrid, + NumberFilterModule, + TextFilterModule, + DateFilterModule } from "ag-grid-community"; import { MultiFilterModule, + SetFilterModule, CellSelectionModule, PivotModule, MasterDetailModule, @@ -44,6 +47,10 @@ ModuleRegistry.registerModules([ StatusBarModule, ExcelExportModule, ClipboardModule, + NumberFilterModule, + TextFilterModule, + SetFilterModule, + DateFilterModule ]); const Grid = (props) => { @@ -55,9 +62,33 @@ const Grid = (props) => { dark !== undefined ? (typeof dark === 'function' ? dark() : dark) : document.documentElement.getAttribute('data-theme') === 'dark' || - window.matchMedia('(prefers-color-scheme: dark)').matches; + window.matchMedia('(prefers-color-scheme: dark)').matches; - const getTheme = () => getDark() ? 'ag-theme-balham-dark' : 'ag-theme-balham'; + const getTheme = () => { + const isDark = getDark(); + + if (isDark) { + return themeQuartz.withParams({ + headerFontSize: 14, + headerVerticalPaddingScale: 0.4, + rowVerticalPaddingScale: 0.4, + backgroundColor: "#1d1d1d", + foregroundColor: "#ffffff", + headerBackgroundColor: "#2a2a2a", + headerForegroundColor: "#ffffff", + oddRowBackgroundColor: "#262626", + borderColor: "#404040", + browserColorScheme: "dark" + }); + } + + return themeQuartz.withParams({ + browserColorScheme: "light", + headerFontSize: 14, + headerVerticalPaddingScale: 0.4, + rowVerticalPaddingScale: 0.4 + }); + }; const initGrid = (container) => { if (cleanupFn) { @@ -124,9 +155,10 @@ const Grid = (props) => { const stopTheme = watch(() => { if (!gridApi || gridApi.isDestroyed()) return; getDark(); - const currentTheme = getTheme(); - if (currentTheme !== gridApi.getGridOption("theme")) { - gridApi.setGridOption("theme", currentTheme); + const newTheme = getTheme(); + const currentTheme = gridApi.getGridOption("theme"); + if (JSON.stringify(newTheme) !== JSON.stringify(currentTheme)) { + gridApi.setGridOption("theme", newTheme); } }); @@ -137,7 +169,7 @@ const Grid = (props) => { Object.entries(newOptions).forEach(([key, val]) => { try { gridApi.setGridOption(key, val); - } catch (e) {} + } catch (e) { } }); } }); @@ -168,5 +200,4 @@ const Grid = (props) => { }); }; -if (typeof window !== 'undefined') window.Grid = Grid; -export { Grid, createGrid, themeQuartz, iconSetQuartzLight, ModuleRegistry }; \ No newline at end of file +export { Grid }; \ No newline at end of file diff --git a/package.json b/package.json index a5998f9..6c66ed2 100644 --- a/package.json +++ b/package.json @@ -14,11 +14,9 @@ ], "scripts": { "clean": "rm -rf dist", - "build:iife": "bun build ./index.js --bundle --external sigpro-ui --outfile=./dist/sigpro-grid.js --format=iife --global-name=SigProGrid", - "build:iife:min": "bun build ./index.js --bundle --external sigpro-ui --outfile=./dist/sigpro-grid.min.js --format=iife --global-name=SigProGrid --minify", - "build:esm": "bun build ./index.js --bundle --external sigpro-ui --external ag-grid-community --external ag-grid-enterprise --outfile=./dist/sigpro-grid.esm.js --format=esm", - "build:esm:min": "bun build ./index.js --bundle --external sigpro-ui --external ag-grid-community --external ag-grid-enterprise --outfile=./dist/sigpro-grid.esm.min.js --format=esm --minify", - "build": "bun run clean && bun run build:iife:min && bun run build:esm:min", + "build:esm": "bun build ./index.js --bundle --external sigpro --outfile=./dist/sigpro-grid.esm.js --format=esm", + "build:esm:min": "bun build ./index.js --bundle --external sigpro --outfile=./dist/sigpro-grid.esm.min.js --format=esm --minify", + "build": "bun run clean && bun run build:esm && bun run build:esm:min", "prepublishOnly": "npm run build" }, "repository": { @@ -39,12 +37,7 @@ "license": "MIT", "dependencies": { "ag-grid-community": "^35.2.0", - "ag-grid-enterprise": "^35.2.0" - }, - "peerDependencies": { - "sigpro-ui": "^1.2.6" - }, - "devDependencies": { - "sigpro-ui": "^1.2.6" + "ag-grid-enterprise": "^35.2.0", + "sigpro": "git+http://gitea:3000/natxocc/sigpro" } -} +} \ No newline at end of file diff --git a/sigpro.js b/sigpro.js new file mode 100644 index 0000000..db6e922 --- /dev/null +++ b/sigpro.js @@ -0,0 +1,433 @@ +const isFunc = f => typeof f === "function" +const isObj = o => o && typeof o === "object" +const isArr = Array.isArray +const doc = typeof document !== "undefined" ? document : null +const ensureNode = n => n?._isRuntime ? n.container : (n instanceof Node ? n : doc.createTextNode(n == null ? "" : String(n))) + +let activeEffect = null +let activeOwner = null +let isFlushing = false +let batchDepth = 0 +const effectQueue = new Set() +const MOUNTED_NODES = new WeakMap() + +const SVG_NS = "http://www.w3.org/2000/svg" +const XLINK_NS = "http://www.w3.org/1999/xlink" +const SVG_TAGS = new Set("svg,path,circle,rect,line,polyline,polygon,g,defs,text,textPath,tspan,use,symbol,image,marker,ellipse".split(",")) + +const dispose = eff => { + if (!eff || eff._disposed) return + eff._disposed = true + const stack = [eff] + while (stack.length) { + const e = stack.pop() + if (e._cleanups) { + e._cleanups.forEach(fn => fn()) + e._cleanups.clear() + } + if (e._children) { + e._children.forEach(child => stack.push(child)) + e._children.clear() + } + if (e._deps) { + e._deps.forEach(depSet => depSet.delete(e)) + e._deps.clear() + } + } +} + +const onUnmount = fn => { + if (activeOwner) (activeOwner._cleanups ||= new Set()).add(fn) +} + +const untrack = fn => { + const p = activeEffect + activeEffect = null + try { return fn() } finally { activeEffect = p } +} + +const createEffect = (fn, isComputed = false) => { + const effect = () => { + if (effect._disposed) return + if (effect._deps) effect._deps.forEach(s => s.delete(effect)) + if (effect._cleanups) { + effect._cleanups.forEach(c => c()) + effect._cleanups.clear() + } + const prevEffect = activeEffect + const prevOwner = activeOwner + activeEffect = activeOwner = effect + try { + return effect._result = fn() + } catch (e) { + console.error("[SigPro]", e) + } finally { + activeEffect = prevEffect + activeOwner = prevOwner + } + } + effect._deps = effect._cleanups = effect._children = null + effect._disposed = false + effect._isComputed = isComputed + effect._depth = activeEffect ? activeEffect._depth + 1 : 0 + effect._mounts = [] + effect._parent = activeOwner + if (activeOwner) (activeOwner._children ||= new Set()).add(effect) + return effect +} + +const flush = () => { + if (isFlushing) return + isFlushing = true + const sorted = Array.from(effectQueue).sort((a, b) => a._depth - b._depth) + effectQueue.clear() + for (const e of sorted) if (!e._disposed) e() + isFlushing = false +} + +const batch = fn => { + batchDepth++ + try { + return fn() + } finally { + batchDepth-- + if (batchDepth === 0 && effectQueue.size > 0 && !isFlushing) flush() + } +} + +const trackUpdate = (subs, trigger = false) => { + if (!trigger && activeEffect && !activeEffect._disposed) { + subs.add(activeEffect); + (activeEffect._deps ||= new Set()).add(subs) + } else if (trigger && subs.size > 0) { + let hasQueue = false + for (const e of subs) { + if (e === activeEffect || e._disposed) continue + if (e._isComputed) { + e._dirty = true + if (e._subs) trackUpdate(e._subs, true) + } else { + effectQueue.add(e) + hasQueue = true + } + } + if (hasQueue && !isFlushing && batchDepth === 0) queueMicrotask(flush) + } +} + +const $ = (val, key = null) => { + const subs = new Set() + if (isFunc(val)) { + let cache + const computed = () => { + if (computed._dirty) { + const prev = activeEffect + activeEffect = computed + try { + const next = val() + if (!Object.is(cache, next)) { + cache = next + trackUpdate(subs, true) + } + } finally { + activeEffect = prev + } + computed._dirty = false + } + trackUpdate(subs) + return cache + } + computed._isComputed = true + computed._subs = subs + computed._dirty = true + computed._deps = null + computed._disposed = false + return computed + } + if (key) try { val = JSON.parse(localStorage.getItem(key)) ?? val } catch (e) { } + return (...args) => { + if (args.length) { + const next = isFunc(args[0]) ? args[0](val) : args[0] + if (!Object.is(val, next)) { + val = next + if (key) localStorage.setItem(key, JSON.stringify(val)) + trackUpdate(subs, true) + } + } + trackUpdate(subs) + return val + } +} + +const watch = (sources, cb) => { + if (cb === undefined) { + const effect = createEffect(sources) + effect() + return () => dispose(effect) + } + const effect = createEffect(() => { + const vals = isArr(sources) ? sources.map(s => s()) : sources() + untrack(() => cb(vals)) + }) + effect() + return () => dispose(effect) +} + +const cleanupNode = (node) => { + if (!node) return; + if (node._cleanups) { + node._cleanups.forEach(fn => fn()); + node._cleanups.clear(); + } + if (node._ownerEffect) dispose(node._ownerEffect); + if (node.childNodes) node.childNodes.forEach(n => cleanupNode(n)); +}; + +var DANGEROUS_PROTOCOL = /^\s*(javascript|data|vbscript):/i; +var DANGEROUS_URI_ATTRS = new Set(["src", "href", "formaction", "action", "background", "code", "archive"]); +var isDangerousAttr = (key) => DANGEROUS_URI_ATTRS.has(key) || key.startsWith("on"); + +const validateAttr = (key, val) => { + if (val == null || val === false) return null + if (isDangerousAttr(key)) { + const sVal = String(val) + if (DANGEROUS_PROTOCOL.test(sVal)) return '#' + } + return val +} + +const h = (tag, props = {}, children = []) => { + if (props instanceof Node || isArr(props) || !isObj(props)) { + children = props + props = {} + } + + if (isFunc(tag)) { + const effect = createEffect(() => { + const result = tag(props, { + children, + emit: (ev, ...args) => props[`on${ev[0].toUpperCase()}${ev.slice(1)}`]?.(...args) + }) + effect._result = result + return result + }) + effect() + + const result = effect._result + if (result == null) return null + + const node = (result instanceof Node || (isArr(result) && result.every(n => n instanceof Node))) + ? result + : doc.createTextNode(String(result)) + + const attach = n => { + if (isObj(n) && !n._isRuntime) { + n._mounts = effect._mounts || [] + n._cleanups = effect._cleanups || new Set() + n._ownerEffect = effect + } + } + + isArr(node) ? node.forEach(attach) : attach(node) + return node + } + + const isSVG = SVG_TAGS.has(tag) + const el = isSVG ? doc.createElementNS(SVG_NS, tag) : doc.createElement(tag) + el._cleanups = new Set() + + for (const k of Object.keys(props)) { + let v = props[k] + if (k === "ref") { + isFunc(v) ? v(el) : (v.current = el) + continue + } + if (isSVG && k.startsWith("xlink:")) { + const cleanVal = validateAttr(k.slice(6), v) + cleanVal == null + ? el.removeAttributeNS(XLINK_NS, k.slice(6)) + : el.setAttributeNS(XLINK_NS, k.slice(6), cleanVal) + continue + } + if (k.startsWith("on")) { + const ev = k.slice(2).toLowerCase() + el.addEventListener(ev, v) + const off = () => el.removeEventListener(ev, v) + el._cleanups.add(off) + onUnmount(off) + } else if (isFunc(v)) { + const effect = createEffect(() => { + const val = validateAttr(k, v()) + if (k === "class") el.className = val || "" + else if (val == null) el.removeAttribute(k) + else if (k === "style" && typeof val === "string") el.setAttribute("style", val) + else if (k in el && !isSVG) el[k] = val + else el.setAttribute(k, val === true ? "" : val) + }) + effect() + el._cleanups.add(() => dispose(effect)) + onUnmount(() => dispose(effect)) + if (/^(INPUT|TEXTAREA|SELECT)$/.test(el.tagName) && (k === "value" || k === "checked")) { + const evType = k === "checked" ? "change" : "input" + el.addEventListener(evType, ev => v(ev.target[k])) + } + } else { + const val = validateAttr(k, v) + if (val != null) { + if (k === "style" && typeof val === "string") el.setAttribute("style", val) + else if (k in el && !isSVG) el[k] = val + else el.setAttribute(k, val === true ? "" : val) + } + } + } + + const append = c => { + if (isArr(c)) return c.forEach(append) + if (isFunc(c)) { + const anchor = doc.createTextNode("") + el.appendChild(anchor) + let currentNodes = [] + const effect = createEffect(() => { + const res = c() + const next = (isArr(res) ? res : [res]).map(ensureNode) + currentNodes.forEach(n => { + if (n._isRuntime) n.destroy() + else cleanupNode(n) + if (n.parentNode) n.remove() + }) + let ref = anchor + for (let i = next.length - 1; i >= 0; i--) { + const node = next[i] + if (node.parentNode !== ref.parentNode) ref.parentNode?.insertBefore(node, ref) + if (node._mounts) node._mounts.forEach(fn => fn()) + ref = node + } + currentNodes = next + }) + effect() + el._cleanups.add(() => dispose(effect)) + onUnmount(() => dispose(effect)) + } else { + const node = ensureNode(c) + el.appendChild(node) + if (node._mounts) node._mounts.forEach(fn => fn()) + } + } + append(children) + return el +} + +const render = renderFn => { + const cleanups = new Set() + const previousOwner = activeOwner + const previousEffect = activeEffect + const container = doc.createElement("div") + container.style.display = "contents" + container.setAttribute("role", "presentation") + activeOwner = { _cleanups: cleanups } + activeEffect = null + + const processResult = result => { + if (!result) return + if (result._isRuntime) { + cleanups.add(result.destroy) + container.appendChild(result.container) + } else if (isArr(result)) { + result.forEach(processResult) + } else { + container.appendChild(result instanceof Node ? result : doc.createTextNode(String(result == null ? "" : result))) + } + } + + try { + processResult(renderFn({ onCleanup: fn => cleanups.add(fn) })) + } finally { + activeOwner = previousOwner + activeEffect = previousEffect + } + + return { + _isRuntime: true, + container, + destroy: () => { + cleanups.forEach(fn => fn()) + cleanupNode(container) + container.remove() + } + } +} + +const when = (cond, SIP, NOP = null) => { + const anchor = doc.createTextNode("") + const root = h("div", { style: "display:contents" }, [anchor]) + let currentView = null + + watch( + () => !!(isFunc(cond) ? cond() : cond), + show => { + if (currentView) { + currentView.destroy() + currentView = null + } + + const content = show ? SIP : NOP + if (content) { + currentView = render(() => isFunc(content) ? content() : content) + root.insertBefore(currentView.container, anchor) + } + } + ) + + onUnmount(() => currentView?.destroy()) + return root +} + +const each = (src, itemFn, keyField) => { + const anchor = doc.createTextNode("") + const root = h("div", { style: "display:contents" }, [anchor]) + let cache = new Map() + watch(() => (isFunc(src) ? src() : src) || [], items => { + const nextCache = new Map() + const nextOrder = [] + const newItems = items || [] + for (let i = 0; i < newItems.length; i++) { + const item = newItems[i] + const key = keyField ? (item?.[keyField] ?? i) : (item?.id ?? i) + let view = cache.get(key) + if (!view) view = render(() => itemFn(item, i)) + else cache.delete(key) + nextCache.set(key, view) + nextOrder.push(view) + } + cache.forEach(view => view.destroy()) + let lastRef = anchor + for (let i = nextOrder.length - 1; i >= 0; i--) { + const view = nextOrder[i] + const node = view.container + if (node.nextSibling !== lastRef) root.insertBefore(node, lastRef) + lastRef = node + } + cache = nextCache + }) + return root +} + +const Fragment = (props) => props.children; + +const mount = (comp, target) => { + const t = typeof target === "string" ? doc.querySelector(target) : target + if (!t) return + if (MOUNTED_NODES.has(t)) MOUNTED_NODES.get(t).destroy() + const inst = render(isFunc(comp) ? comp : () => comp) + t.replaceChildren(inst.container) + MOUNTED_NODES.set(t, inst) + return inst +} + +if (typeof window !== "undefined") { + "a abbr article aside audio b blockquote br button canvas caption cite code col colgroup datalist dd del details dfn dialog div dl dt em embed fieldset figcaption figure footer form h1 h2 h3 h4 h5 h6 header hr i iframe img input ins kbd label legend li main mark meter nav object ol optgroup option output p picture pre progress section select slot small source span strong sub summary sup svg table tbody td template textarea tfoot th thead time tr u ul video" + .split(" ") + .forEach(tag => { window[tag] = (props, children) => h(tag, props, children) }) +} + +export { $, watch, batch, h, Fragment, render, mount, when, each, onUnmount, isArr, isFunc, isObj } \ No newline at end of file