@toclocoinc/lattice-grid 1.99.0 → 1.99.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/README.md +83 -14
- package/angular/package.json +1 -1
- package/docs/API.html +4 -4
- package/docs/api/adapters.html +1 -1
- package/docs/api/ai.html +1 -1
- package/docs/api/alarms.html +1 -1
- package/docs/api/calendar.html +1 -1
- package/docs/api/charts.html +1 -1
- package/docs/api/dashboard.html +1 -1
- package/docs/api/data-router.html +1 -1
- package/docs/api/deckgl.html +1 -1
- package/docs/api/designer.html +1 -1
- package/docs/api/form.html +1 -1
- package/docs/api/gantt.html +1 -1
- package/docs/api/geometry.html +1 -1
- package/docs/api/grid.html +2 -2
- package/docs/api/index.html +1 -1
- package/docs/api/kanban.html +1 -1
- package/docs/api/kpi.html +1 -1
- package/docs/api/layout.html +1 -1
- package/docs/api/leaflet.html +1 -1
- package/docs/api/list.html +1 -1
- package/docs/api/mapview.html +1 -1
- package/docs/api/mock-socket.html +1 -1
- package/docs/api/presets.html +1 -1
- package/docs/api/scheduler.html +1 -1
- package/docs/api/shell.html +1 -1
- package/docs/api/tabs.html +1 -1
- package/docs/api/types.html +1 -1
- package/docs/api-detail.html +4 -4
- package/docs/warnings.json +1 -1
- package/lattice-grid.d.ts +1 -1
- package/lattice-grid.esm.min.js +2 -2
- package/lattice-grid.min.cjs +2 -2
- package/lattice-grid.min.js +2 -2
- package/locales/all.d.ts +1 -1
- package/locales/all.esm.min.js +1 -1
- package/locales/all.min.cjs +1 -1
- package/locales/all.min.js +1 -1
- package/locales/ar.d.ts +1 -1
- package/locales/ar.esm.min.js +1 -1
- package/locales/ar.min.cjs +1 -1
- package/locales/ar.min.js +1 -1
- package/locales/cs-CZ.d.ts +1 -1
- package/locales/cs-CZ.esm.min.js +1 -1
- package/locales/cs-CZ.min.cjs +1 -1
- package/locales/cs-CZ.min.js +1 -1
- package/locales/da-DK.d.ts +1 -1
- package/locales/da-DK.esm.min.js +1 -1
- package/locales/da-DK.min.cjs +1 -1
- package/locales/da-DK.min.js +1 -1
- package/locales/de-DE.d.ts +1 -1
- package/locales/de-DE.esm.min.js +1 -1
- package/locales/de-DE.min.cjs +1 -1
- package/locales/de-DE.min.js +1 -1
- package/locales/el-GR.d.ts +1 -1
- package/locales/el-GR.esm.min.js +1 -1
- package/locales/el-GR.min.cjs +1 -1
- package/locales/el-GR.min.js +1 -1
- package/locales/en-US.d.ts +1 -1
- package/locales/en-US.esm.min.js +1 -1
- package/locales/en-US.min.cjs +1 -1
- package/locales/en-US.min.js +1 -1
- package/locales/es-ES.d.ts +1 -1
- package/locales/es-ES.esm.min.js +1 -1
- package/locales/es-ES.min.cjs +1 -1
- package/locales/es-ES.min.js +1 -1
- package/locales/fi-FI.d.ts +1 -1
- package/locales/fi-FI.esm.min.js +1 -1
- package/locales/fi-FI.min.cjs +1 -1
- package/locales/fi-FI.min.js +1 -1
- package/locales/fr-CA.d.ts +1 -1
- package/locales/fr-CA.esm.min.js +1 -1
- package/locales/fr-CA.min.cjs +1 -1
- package/locales/fr-CA.min.js +1 -1
- package/locales/fr-FR.d.ts +1 -1
- package/locales/fr-FR.esm.min.js +1 -1
- package/locales/fr-FR.min.cjs +1 -1
- package/locales/fr-FR.min.js +1 -1
- package/locales/hu-HU.d.ts +1 -1
- package/locales/hu-HU.esm.min.js +1 -1
- package/locales/hu-HU.min.cjs +1 -1
- package/locales/hu-HU.min.js +1 -1
- package/locales/it-IT.d.ts +1 -1
- package/locales/it-IT.esm.min.js +1 -1
- package/locales/it-IT.min.cjs +1 -1
- package/locales/it-IT.min.js +1 -1
- package/locales/ja-JP.d.ts +1 -1
- package/locales/ja-JP.esm.min.js +1 -1
- package/locales/ja-JP.min.cjs +1 -1
- package/locales/ja-JP.min.js +1 -1
- package/locales/nb-NO.d.ts +1 -1
- package/locales/nb-NO.esm.min.js +1 -1
- package/locales/nb-NO.min.cjs +1 -1
- package/locales/nb-NO.min.js +1 -1
- package/locales/nl-NL.d.ts +1 -1
- package/locales/nl-NL.esm.min.js +1 -1
- package/locales/nl-NL.min.cjs +1 -1
- package/locales/nl-NL.min.js +1 -1
- package/locales/pl-PL.d.ts +1 -1
- package/locales/pl-PL.esm.min.js +1 -1
- package/locales/pl-PL.min.cjs +1 -1
- package/locales/pl-PL.min.js +1 -1
- package/locales/pt-BR.d.ts +1 -1
- package/locales/pt-BR.esm.min.js +1 -1
- package/locales/pt-BR.min.cjs +1 -1
- package/locales/pt-BR.min.js +1 -1
- package/locales/ro-RO.d.ts +1 -1
- package/locales/ro-RO.esm.min.js +1 -1
- package/locales/ro-RO.min.cjs +1 -1
- package/locales/ro-RO.min.js +1 -1
- package/locales/sv-SE.d.ts +1 -1
- package/locales/sv-SE.esm.min.js +1 -1
- package/locales/sv-SE.min.cjs +1 -1
- package/locales/sv-SE.min.js +1 -1
- package/locales/uk-UA.d.ts +1 -1
- package/locales/uk-UA.esm.min.js +1 -1
- package/locales/uk-UA.min.cjs +1 -1
- package/locales/uk-UA.min.js +1 -1
- package/modules/ai.d.ts +1 -1
- package/modules/ai.esm.min.js +1 -1
- package/modules/ai.min.cjs +1 -1
- package/modules/ai.min.js +1 -1
- package/modules/alarms.d.ts +1 -1
- package/modules/alarms.esm.min.js +1 -1
- package/modules/alarms.min.cjs +1 -1
- package/modules/alarms.min.js +1 -1
- package/modules/angular.d.ts +1 -1
- package/modules/angular.esm.min.js +1 -1
- package/modules/angular.min.cjs +1 -1
- package/modules/angular.min.js +1 -1
- package/modules/calendar.d.ts +1 -1
- package/modules/calendar.esm.min.js +1 -1
- package/modules/calendar.min.cjs +1 -1
- package/modules/calendar.min.js +1 -1
- package/modules/chart-alluvial.d.ts +1 -1
- package/modules/chart-alluvial.esm.min.js +1 -1
- package/modules/chart-alluvial.min.cjs +1 -1
- package/modules/chart-alluvial.min.js +1 -1
- package/modules/chart-arc.d.ts +1 -1
- package/modules/chart-arc.esm.min.js +1 -1
- package/modules/chart-arc.min.cjs +1 -1
- package/modules/chart-arc.min.js +1 -1
- package/modules/chart-barrace.d.ts +1 -1
- package/modules/chart-barrace.esm.min.js +1 -1
- package/modules/chart-barrace.min.cjs +1 -1
- package/modules/chart-barrace.min.js +1 -1
- package/modules/chart-bubblemap.d.ts +1 -1
- package/modules/chart-bubblemap.esm.min.js +1 -1
- package/modules/chart-bubblemap.min.cjs +1 -1
- package/modules/chart-bubblemap.min.js +1 -1
- package/modules/chart-bump.d.ts +1 -1
- package/modules/chart-bump.esm.min.js +1 -1
- package/modules/chart-bump.min.cjs +1 -1
- package/modules/chart-bump.min.js +1 -1
- package/modules/chart-calendar.d.ts +1 -1
- package/modules/chart-calendar.esm.min.js +1 -1
- package/modules/chart-calendar.min.cjs +1 -1
- package/modules/chart-calendar.min.js +1 -1
- package/modules/chart-choropleth.d.ts +1 -1
- package/modules/chart-choropleth.esm.min.js +1 -1
- package/modules/chart-choropleth.min.cjs +1 -1
- package/modules/chart-choropleth.min.js +1 -1
- package/modules/chart-decomposition.d.ts +1 -1
- package/modules/chart-decomposition.esm.min.js +1 -1
- package/modules/chart-decomposition.min.cjs +1 -1
- package/modules/chart-decomposition.min.js +1 -1
- package/modules/chart-diverging.d.ts +1 -1
- package/modules/chart-diverging.esm.min.js +1 -1
- package/modules/chart-diverging.min.cjs +1 -1
- package/modules/chart-diverging.min.js +1 -1
- package/modules/chart-dumbbell.d.ts +1 -1
- package/modules/chart-dumbbell.esm.min.js +1 -1
- package/modules/chart-dumbbell.min.cjs +1 -1
- package/modules/chart-dumbbell.min.js +1 -1
- package/modules/chart-fan.d.ts +1 -1
- package/modules/chart-fan.esm.min.js +1 -1
- package/modules/chart-fan.min.cjs +1 -1
- package/modules/chart-fan.min.js +1 -1
- package/modules/chart-forcetree.d.ts +1 -1
- package/modules/chart-forcetree.esm.min.js +1 -1
- package/modules/chart-forcetree.min.cjs +1 -1
- package/modules/chart-forcetree.min.js +1 -1
- package/modules/chart-hexbin.d.ts +1 -1
- package/modules/chart-hexbin.esm.min.js +1 -1
- package/modules/chart-hexbin.min.cjs +1 -1
- package/modules/chart-hexbin.min.js +1 -1
- package/modules/chart-hexmap.d.ts +1 -1
- package/modules/chart-hexmap.esm.min.js +1 -1
- package/modules/chart-hexmap.min.cjs +1 -1
- package/modules/chart-hexmap.min.js +1 -1
- package/modules/chart-icicle.d.ts +1 -1
- package/modules/chart-icicle.esm.min.js +1 -1
- package/modules/chart-icicle.min.cjs +1 -1
- package/modules/chart-icicle.min.js +1 -1
- package/modules/chart-markermap.d.ts +1 -1
- package/modules/chart-markermap.esm.min.js +1 -1
- package/modules/chart-markermap.min.cjs +1 -1
- package/modules/chart-markermap.min.js +1 -1
- package/modules/chart-motion.d.ts +1 -1
- package/modules/chart-motion.esm.min.js +1 -1
- package/modules/chart-motion.min.cjs +1 -1
- package/modules/chart-motion.min.js +1 -1
- package/modules/chart-pack.d.ts +1 -1
- package/modules/chart-pack.esm.min.js +1 -1
- package/modules/chart-pack.min.cjs +1 -1
- package/modules/chart-pack.min.js +1 -1
- package/modules/chart-parallel.d.ts +1 -1
- package/modules/chart-parallel.esm.min.js +1 -1
- package/modules/chart-parallel.min.cjs +1 -1
- package/modules/chart-parallel.min.js +1 -1
- package/modules/chart-pictorial.d.ts +1 -1
- package/modules/chart-pictorial.esm.min.js +1 -1
- package/modules/chart-pictorial.min.cjs +1 -1
- package/modules/chart-pictorial.min.js +1 -1
- package/modules/chart-polararea.d.ts +1 -1
- package/modules/chart-polararea.esm.min.js +1 -1
- package/modules/chart-polararea.min.cjs +1 -1
- package/modules/chart-polararea.min.js +1 -1
- package/modules/chart-polarscatter.d.ts +1 -1
- package/modules/chart-polarscatter.esm.min.js +1 -1
- package/modules/chart-polarscatter.min.cjs +1 -1
- package/modules/chart-polarscatter.min.js +1 -1
- package/modules/chart-pyramid.d.ts +1 -1
- package/modules/chart-pyramid.esm.min.js +1 -1
- package/modules/chart-pyramid.min.cjs +1 -1
- package/modules/chart-pyramid.min.js +1 -1
- package/modules/chart-radialbar.d.ts +1 -1
- package/modules/chart-radialbar.esm.min.js +1 -1
- package/modules/chart-radialbar.min.cjs +1 -1
- package/modules/chart-radialbar.min.js +1 -1
- package/modules/chart-ridgeline.d.ts +1 -1
- package/modules/chart-ridgeline.esm.min.js +1 -1
- package/modules/chart-ridgeline.min.cjs +1 -1
- package/modules/chart-ridgeline.min.js +1 -1
- package/modules/chart-roc.d.ts +1 -1
- package/modules/chart-roc.esm.min.js +1 -1
- package/modules/chart-roc.min.cjs +1 -1
- package/modules/chart-roc.min.js +1 -1
- package/modules/chart-scatter3d.d.ts +1 -1
- package/modules/chart-scatter3d.esm.min.js +1 -1
- package/modules/chart-scatter3d.min.cjs +1 -1
- package/modules/chart-scatter3d.min.js +1 -1
- package/modules/chart-serpentine.d.ts +1 -1
- package/modules/chart-serpentine.esm.min.js +1 -1
- package/modules/chart-serpentine.min.cjs +1 -1
- package/modules/chart-serpentine.min.js +1 -1
- package/modules/chart-slope.d.ts +1 -1
- package/modules/chart-slope.esm.min.js +1 -1
- package/modules/chart-slope.min.cjs +1 -1
- package/modules/chart-slope.min.js +1 -1
- package/modules/chart-spiral.d.ts +1 -1
- package/modules/chart-spiral.esm.min.js +1 -1
- package/modules/chart-spiral.min.cjs +1 -1
- package/modules/chart-spiral.min.js +1 -1
- package/modules/chart-splom.d.ts +1 -1
- package/modules/chart-splom.esm.min.js +1 -1
- package/modules/chart-splom.min.cjs +1 -1
- package/modules/chart-splom.min.js +1 -1
- package/modules/chart-tree.d.ts +1 -1
- package/modules/chart-tree.esm.min.js +1 -1
- package/modules/chart-tree.min.cjs +1 -1
- package/modules/chart-tree.min.js +1 -1
- package/modules/chart-venn.d.ts +1 -1
- package/modules/chart-venn.esm.min.js +1 -1
- package/modules/chart-venn.min.cjs +1 -1
- package/modules/chart-venn.min.js +1 -1
- package/modules/chart-voronoi.d.ts +1 -1
- package/modules/chart-voronoi.esm.min.js +1 -1
- package/modules/chart-voronoi.min.cjs +1 -1
- package/modules/chart-voronoi.min.js +1 -1
- package/modules/chart-waffle.d.ts +1 -1
- package/modules/chart-waffle.esm.min.js +1 -1
- package/modules/chart-waffle.min.cjs +1 -1
- package/modules/chart-waffle.min.js +1 -1
- package/modules/chart-wordcloud.d.ts +1 -1
- package/modules/chart-wordcloud.esm.min.js +1 -1
- package/modules/chart-wordcloud.min.cjs +1 -1
- package/modules/chart-wordcloud.min.js +1 -1
- package/modules/charts.d.ts +1 -1
- package/modules/charts.esm.min.js +1 -1
- package/modules/charts.min.cjs +1 -1
- package/modules/charts.min.js +1 -1
- package/modules/dashboard.d.ts +1 -1
- package/modules/dashboard.esm.min.js +1 -1
- package/modules/dashboard.min.cjs +1 -1
- package/modules/dashboard.min.js +1 -1
- package/modules/data-router.d.ts +1 -1
- package/modules/data-router.esm.min.js +1 -1
- package/modules/data-router.min.cjs +1 -1
- package/modules/data-router.min.js +1 -1
- package/modules/deckgl.d.ts +1 -1
- package/modules/deckgl.esm.min.js +1 -1
- package/modules/deckgl.min.cjs +1 -1
- package/modules/deckgl.min.js +1 -1
- package/modules/designer.d.ts +1 -1
- package/modules/designer.esm.min.js +1 -1
- package/modules/designer.min.cjs +1 -1
- package/modules/designer.min.js +1 -1
- package/modules/devtools.d.ts +1 -1
- package/modules/devtools.esm.min.js +1 -1
- package/modules/devtools.min.cjs +1 -1
- package/modules/devtools.min.js +1 -1
- package/modules/dhtmlx-compat.d.ts +1 -1
- package/modules/dhtmlx-compat.esm.min.js +1 -1
- package/modules/dhtmlx-compat.min.cjs +1 -1
- package/modules/dhtmlx-compat.min.js +1 -1
- package/modules/form.d.ts +1 -1
- package/modules/form.esm.min.js +17 -14
- package/modules/form.esm.min.js.map +2 -2
- package/modules/form.min.cjs +17 -14
- package/modules/form.min.js +17 -14
- package/modules/form.min.js.map +2 -2
- package/modules/gantt.d.ts +1 -1
- package/modules/gantt.esm.min.js +1 -1
- package/modules/gantt.min.cjs +1 -1
- package/modules/gantt.min.js +1 -1
- package/modules/geo-europe-nuts.d.ts +1 -1
- package/modules/geo-europe-nuts.esm.min.js +1 -1
- package/modules/geo-europe-nuts.min.cjs +1 -1
- package/modules/geo-europe-nuts.min.js +1 -1
- package/modules/geo-uk.d.ts +1 -1
- package/modules/geo-uk.esm.min.js +1 -1
- package/modules/geo-uk.min.cjs +1 -1
- package/modules/geo-uk.min.js +1 -1
- package/modules/geo-us-states.d.ts +1 -1
- package/modules/geo-us-states.esm.min.js +1 -1
- package/modules/geo-us-states.min.cjs +1 -1
- package/modules/geo-us-states.min.js +1 -1
- package/modules/geo-world-110m.d.ts +1 -1
- package/modules/geo-world-110m.esm.min.js +1 -1
- package/modules/geo-world-110m.min.cjs +1 -1
- package/modules/geo-world-110m.min.js +1 -1
- package/modules/geo-world-50m.d.ts +1 -1
- package/modules/geo-world-50m.esm.min.js +1 -1
- package/modules/geo-world-50m.min.cjs +1 -1
- package/modules/geo-world-50m.min.js +1 -1
- package/modules/geometry.d.ts +1 -1
- package/modules/geometry.esm.min.js +1 -1
- package/modules/geometry.min.cjs +1 -1
- package/modules/geometry.min.js +1 -1
- package/modules/htmx.d.ts +1 -1
- package/modules/htmx.esm.min.js +2 -2
- package/modules/htmx.min.cjs +2 -2
- package/modules/htmx.min.js +2 -2
- package/modules/kanban.d.ts +1 -1
- package/modules/kanban.esm.min.js +1 -1
- package/modules/kanban.min.cjs +1 -1
- package/modules/kanban.min.js +1 -1
- package/modules/kpi.d.ts +1 -1
- package/modules/kpi.esm.min.js +1 -1
- package/modules/kpi.min.cjs +1 -1
- package/modules/kpi.min.js +1 -1
- package/modules/layout.d.ts +1 -1
- package/modules/layout.esm.min.js +1 -1
- package/modules/layout.min.cjs +1 -1
- package/modules/layout.min.js +1 -1
- package/modules/leaflet.d.ts +1 -1
- package/modules/leaflet.esm.min.js +1 -1
- package/modules/leaflet.min.cjs +1 -1
- package/modules/leaflet.min.js +1 -1
- package/modules/list.d.ts +1 -1
- package/modules/list.esm.min.js +1 -1
- package/modules/list.min.cjs +1 -1
- package/modules/list.min.js +1 -1
- package/modules/mapview.d.ts +1 -1
- package/modules/mapview.esm.min.js +1 -1
- package/modules/mapview.min.cjs +1 -1
- package/modules/mapview.min.js +1 -1
- package/modules/mock-socket.d.ts +1 -1
- package/modules/mock-socket.esm.min.js +1 -1
- package/modules/mock-socket.min.cjs +1 -1
- package/modules/mock-socket.min.js +1 -1
- package/modules/presets.d.ts +1 -1
- package/modules/presets.esm.min.js +1 -1
- package/modules/presets.min.cjs +1 -1
- package/modules/presets.min.js +1 -1
- package/modules/react.d.ts +1 -1
- package/modules/react.esm.min.js +1 -1
- package/modules/react.min.cjs +1 -1
- package/modules/react.min.js +1 -1
- package/modules/scheduler.d.ts +1 -1
- package/modules/scheduler.esm.min.js +1 -1
- package/modules/scheduler.min.cjs +1 -1
- package/modules/scheduler.min.js +1 -1
- package/modules/shell.d.ts +1 -1
- package/modules/shell.esm.min.js +1 -1
- package/modules/shell.min.cjs +1 -1
- package/modules/shell.min.js +1 -1
- package/modules/svelte.d.ts +1 -1
- package/modules/svelte.esm.min.js +1 -1
- package/modules/svelte.min.cjs +1 -1
- package/modules/svelte.min.js +1 -1
- package/modules/tabs.d.ts +1 -1
- package/modules/tabs.esm.min.js +1 -1
- package/modules/tabs.min.cjs +1 -1
- package/modules/tabs.min.js +1 -1
- package/modules/vue.d.ts +1 -1
- package/modules/vue.esm.min.js +1 -1
- package/modules/vue.min.cjs +1 -1
- package/modules/vue.min.js +1 -1
- package/modules/webcomponent.d.ts +1 -1
- package/modules/webcomponent.esm.min.js +2 -2
- package/modules/webcomponent.min.cjs +2 -2
- package/modules/webcomponent.min.js +2 -2
- package/package.json +9 -2
package/modules/htmx.min.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* Lattice Grid 1.99.
|
|
2
|
+
* Lattice Grid 1.99.1, htmx module
|
|
3
3
|
* Copyright (c) 2026 TOCLOCO Inc. All rights reserved.
|
|
4
4
|
* https://latticegrid.dev
|
|
5
5
|
*/
|
|
6
6
|
(function(mr){"use strict";var Yi=!0,Yn=Object.create(null),Xn=Object.create(null);function Ue(e,U){Yn[e]=U}function Dn(e){var U=Xn[e];if(U)return U;var te=Object.create(null);Xn[e]=te;var E=Yn[e];if(!E)throw new Error("[lattice] missing module: "+e);return E(te,Dn),te}Ue("packages/core/src/internal/predicates.js",function(e,U){"use strict";Object.defineProperty(e,"isObject",{enumerable:!0,get:function(){return te}}),Object.defineProperty(e,"isFunction",{enumerable:!0,get:function(){return E}}),Object.defineProperty(e,"isNil",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"isBlank",{enumerable:!0,get:function(){return z}}),Object.defineProperty(e,"isCtor",{enumerable:!0,get:function(){return _}});function te(Z){return Z!==null&&typeof Z=="object"&&!Array.isArray(Z)}function E(Z){return typeof Z=="function"}function q(Z){return Z==null}function z(Z){return Z==null||Z===""}function _(Z){return typeof Z!="function"?!1:/^class[\s{]/.test(Function.prototype.toString.call(Z))?!0:!!(Z.prototype&&Object.getOwnPropertyNames(Z.prototype).length>1)}}),Ue("packages/core/src/internal/warn.js",function(e,U){"use strict";Object.defineProperty(e,"reportedWarnings",{enumerable:!0,get:function(){return B}}),Object.defineProperty(e,"warnOnce",{enumerable:!0,get:function(){return G}}),Object.defineProperty(e,"infoOnce",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"resetWarnings",{enumerable:!0,get:function(){return k}}),Object.defineProperty(e,"fail",{enumerable:!0,get:function(){return g}}),Object.defineProperty(e,"invariant",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"DEV",{enumerable:!0,get:function(){return d}});const te=new Set,E=2e3;function q(l){if(te.add(l),te.size>E){const i=te.values().next().value;i!==void 0&&te.delete(i)}}const z=[],_=500;function Z(l,i,n){z.push({key:l,level:i,message:n.map(a=>typeof a=="string"?a:X(a)).join(" "),at:Date.now()}),z.length>_&&z.shift()}function X(l){if(l instanceof Error)return l.message;try{return JSON.stringify(l)}catch{return String(l)}}function B(){return z.map(l=>({...l}))}function Y(l){if(l.length===0||typeof l[0]!="string")return l;const i=l[0].replace(/^\[lattice\]\s*/,"");return i===l[0]?l:[i,...l.slice(1)]}function G(l,...i){if(te.has(l))return;q(l);const n=Y(i);Z(l,"warn",n),console.warn("[lattice]",...n)}function j(l,...i){if(te.has(l))return;q(l);const n=Y(i);Z(l,"info",n),console.info("[lattice]",...n)}function k(){te.clear(),z.length=0}function g(l,i){const n=new Error(`[lattice] ${l}`);throw i!==void 0&&(n.cause=i),n}function c(l,i){l||g(i)}const d=(()=>{try{return!(typeof process<"u"&&process.env&&process.env.NODE_ENV==="production")}catch{return!0}})()}),Ue("packages/core/src/formatting/rules.js",function(e,U){"use strict";Object.defineProperty(e,"RULE_OPS",{enumerable:!0,get:function(){return _}}),Object.defineProperty(e,"DISTRIBUTION_OPS",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"DISTRIBUTION_LABELS",{enumerable:!0,get:function(){return X}}),Object.defineProperty(e,"testRule",{enumerable:!0,get:function(){return G}}),Object.defineProperty(e,"mixColour",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"summariseColumn",{enumerable:!0,get:function(){return k}}),Object.defineProperty(e,"quantileOf",{enumerable:!0,get:function(){return g}}),Object.defineProperty(e,"needsDistribution",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"resolveDistribution",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"ICON_SETS",{enumerable:!0,get:function(){return h}}),Object.defineProperty(e,"compileRules",{enumerable:!0,get:function(){return L}});const E=U("packages/core/src/internal/predicates.js").isFunction,z=U("packages/core/src/internal/warn.js").warnOnce,_=Object.freeze(["eq","ne","gt","gte","lt","lte","between","outside","contains","notContains","startsWith","endsWith","blank","notBlank","true","false"]),Z=Object.freeze(["topPercent","bottomPercent","topN","bottomN","aboveMean","belowMean","aboveMedian","belowMedian","zAbove","zBelow","outlier"]),X=Object.freeze({topPercent:"In the top %",bottomPercent:"In the bottom %",topN:"In the top N",bottomN:"In the bottom N",aboveMean:"Above average",belowMean:"Below average",aboveMedian:"Above the median",belowMedian:"Below the median",zAbove:"Standard deviations above the mean",zBelow:"Standard deviations below the mean",outlier:"An outlier"});function B(M,D){const F=Number(M),T=Number(D);if(M!==null&&M!==""&&D!==null&&D!==""&&Number.isFinite(F)&&Number.isFinite(T))return F<T?-1:F>T?1:0;const P=String(M??"").toLowerCase(),R=String(D??"").toLowerCase();return P<R?-1:P>R?1:0}function Y(M){return M==null||M===""}function G(M,D){if(!D||typeof D!="object")return!1;const{op:F}=D,T=D.value,I=D.value2;switch(F){case"blank":return Y(M);case"notBlank":return!Y(M);case"true":return M===!0;case"false":return M===!1;default:break}if(Y(M))return!1;switch(F){case"eq":return B(M,T)===0;case"ne":return B(M,T)!==0;case"gt":return B(M,T)>0;case"gte":return B(M,T)>=0;case"lt":return B(M,T)<0;case"lte":return B(M,T)<=0;case"between":return B(M,T)>=0&&B(M,I)<=0;case"outside":return B(M,T)<0||B(M,I)>0;case"contains":return String(M).toLowerCase().includes(String(T??"").toLowerCase());case"notContains":return!String(M).toLowerCase().includes(String(T??"").toLowerCase());case"startsWith":return String(M).toLowerCase().startsWith(String(T??"").toLowerCase());case"endsWith":return String(M).toLowerCase().endsWith(String(T??"").toLowerCase());default:return!1}}function j(M,D,F){const T=H=>{const V=String(H).replace("#",""),W=V.length===3?V.split("").map(Q=>Q+Q).join(""):V;return[0,2,4].map(Q=>parseInt(W.slice(Q,Q+2),16)||0)},[I,P,R]=T(M),[$,C,A]=T(D),S=Math.max(0,Math.min(1,F)),x=(H,V)=>Math.round(H+(V-H)*S);return`#${[x(I,$),x(P,C),x(R,A)].map(H=>H.toString(16).padStart(2,"0")).join("")}`}function k(M){const D=[];for(const $ of M||[]){if($==null||$==="")continue;const C=$ instanceof Date?$.getTime():Number($);Number.isFinite(C)&&D.push(C)}if(!D.length)return null;D.sort(($,C)=>$-C);let F=0,T=0,I=0;for(const $ of D){F++;const C=$-T;T+=C/F,I+=C*($-T)}const P=g(D,.25),R=g(D,.75);return{n:D.length,min:D[0],max:D[D.length-1],mean:T,stddev:D.length>1?Math.sqrt(I/(D.length-1)):0,median:g(D,.5),q1:P,q3:R,iqr:R-P,sorted:D}}function g(M,D){if(!M.length)return 0;const F=(M.length-1)*Math.max(0,Math.min(1,D)),T=Math.floor(F),I=Math.ceil(F);return T===I?M[T]:M[T]+(F-T)*(M[I]-M[T])}function c(M){for(const D of Array.isArray(M)?M:[])if(!(!D||typeof D!="object")&&(D.when&&Z.includes(D.when.op)||D.scale&&D.scale.from||D.dataBar&&!(Number.isFinite(Number(D.dataBar.min))&&Number.isFinite(Number(D.dataBar.max)))||D.iconSet&&!Array.isArray(D.iconSet.thresholds)))return!0;return!1}function d(M,D){const F=Number(M.value),T=I=>g(D.sorted,I);switch(M.op){case"topPercent":{const I=l(F,10);return{op:"gte",value:T(1-I)}}case"bottomPercent":{const I=l(F,10);return{op:"lte",value:T(I)}}case"topN":{const I=Math.max(1,Math.floor(F)||1),P=Math.max(0,D.sorted.length-I);return{op:"gte",value:D.sorted[P]}}case"bottomN":{const I=Math.max(1,Math.floor(F)||1),P=Math.min(D.sorted.length-1,I-1);return{op:"lte",value:D.sorted[P]}}case"aboveMean":return{op:"gt",value:D.mean};case"belowMean":return{op:"lt",value:D.mean};case"aboveMedian":return{op:"gt",value:D.median};case"belowMedian":return{op:"lt",value:D.median};case"zAbove":return D.stddev?{op:"gte",value:D.mean+(Number.isFinite(F)?F:2)*D.stddev}:null;case"zBelow":return D.stddev?{op:"lte",value:D.mean-(Number.isFinite(F)?F:2)*D.stddev}:null;case"outlier":{const I=(Number.isFinite(F)&&F>0?F:1.5)*D.iqr;return D.iqr?{op:"outside",value:D.q1-I,value2:D.q3+I}:null}default:return null}}function l(M,D){const F=Number.isFinite(M)?M:D,T=F>1?F/100:F;return Math.max(0,Math.min(1,T))}function i(M,D){if(M.from==="minmax")return{...M,min:D.min,max:D.max};if(M.from==="quantile")return{...M,min:g(D.sorted,l(Number(M.low),5)),max:g(D.sorted,l(Number(M.high),95))};if(M.from==="stddev"){const F=Number.isFinite(Number(M.deviations))?Number(M.deviations):2;return{...M,min:D.mean-F*D.stddev,max:D.mean+F*D.stddev}}return M}function n(M,D){const F=Array.isArray(M)?M:[];return!D||!D.n?F.map(T=>T&&c([T])?{...T,enabled:!1}:T):F.map(T=>{if(!T||typeof T!="object")return T;if(T.scale&&T.scale.from)return{...T,scale:i(T.scale,D)};if(T.dataBar)return{...T,dataBar:a(T.dataBar,D)};if(T.iconSet)return{...T,iconSet:s(T.iconSet,D)};if(!T.when||!Z.includes(T.when.op))return T;const I=d(T.when,D);return I?{...T,when:I}:{...T,enabled:!1}})}function a(M,D){const F=Number.isFinite(Number(M.min))?Number(M.min):void 0,T=Number.isFinite(Number(M.max))?Number(M.max):void 0;if(F!==void 0&&T!==void 0)return{...M,min:F,max:T};if(M.from==="quantile")return{...M,min:F??g(D.sorted,l(Number(M.low),5)),max:T??g(D.sorted,l(Number(M.high),95))};if(M.from==="stddev"){const I=Number.isFinite(Number(M.deviations))?Number(M.deviations):2;return{...M,min:F??D.mean-I*D.stddev,max:T??D.mean+I*D.stddev}}return{...M,min:F??D.min,max:T??D.max}}function s(M,D){if(Array.isArray(M.thresholds))return M;const F=t(M),T=[];for(let I=1;I<F;I++)T.push(g(D.sorted,I/F));return{...M,thresholds:T}}function t(M){if(Array.isArray(M.icons)&&M.icons.length>=2)return M.icons.length;if(Number.isFinite(Number(M.count))&&Number(M.count)>=2)return Math.floor(Number(M.count));const D=v[M.set];return D?D.length:3}function u(M){return`url("data:image/svg+xml,${encodeURIComponent(M)}")`}function r(M){return`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><circle cx="8" cy="8" r="6" fill="${M}"/></svg>`}function o(M,D){return`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><polygon points="${D==="up"?"8,2 14,13 2,13":D==="down"?"2,3 14,3 8,14":"4,2 14,8 4,14"}" fill="${M}"/></svg>`}function f(M,D){const F="M8 1l1.9 3.9 4.3.6-3.1 3 .7 4.3L8 13.8 4.2 15.8l.7-4.3-3.1-3 4.3-.6z";let T=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 ${D*16} 16">`;for(let I=0;I<D;I++){const P=I<M?"#f5a623":"#d0d0d0";T+=`<path transform="translate(${I*16},0)" d="${F}" fill="${P}"/>`}return`${T}</svg>`}const w=Object.freeze([o("#c0392b","down"),o("#e0a800","right"),o("#2e7d32","up")]),m=Object.freeze([r("#d13438"),r("#f5a623"),r("#2e9e44")]),v=Object.freeze({arrows:w,trafficLights:m,ratings:Object.freeze([1,2,3,4,5].map(M=>f(M,5)))}),h=Object.freeze({arrows:"Arrows",trafficLights:"Traffic lights",ratings:"Ratings"});function p(M){if(Array.isArray(M.icons)&&M.icons.length>=2)return M.icons.map(T=>/^\s*(url\(|data:|<)/.test(String(T))&&String(T).trim().startsWith("<")?u(String(T)):String(T));const D=M.set||"arrows";if(D==="ratings"){const T=t(M),I=[];for(let P=1;P<=T;P++)I.push(u(f(P,T)));return I}const F=v[D];return F?F.map(u):(z(`iconSet:${D}`,`unknown icon set '${D}'; falling back to arrows.`),w.map(u))}function b(M){const D=Number(M.min),T=Number(M.max)-D,I=M.colour||M.color||"#5b9bd5",P=M.negativeColour||M.negativeColor||"#d13438",R=M.direction==="rtl"?"left":"right",$=A=>Math.max(0,Math.min(1,(A-D)/T))*100,C=T?Math.max(0,Math.min(100,(0-D)/T*100)):0;return A=>{if(Y(A))return null;const S=Number(A);if(!Number.isFinite(S)||!T)return null;const x=$(S),H=Math.min(x,C),V=Math.max(x,C),W=S>=0?I:P;return{backgroundImage:`linear-gradient(to ${R}, transparent ${H}%, ${W} ${H}%, ${W} ${V}%, transparent ${V}%)`,backgroundRepeat:"no-repeat",backgroundPosition:"0 0"}}}function O(M){const D=p(M),F=M.reverse?[...D].reverse():D,T=(Array.isArray(M.thresholds)?M.thresholds:[]).map(Number).filter(Number.isFinite),I=Number.isFinite(Number(M.size))?Number(M.size):16,P=M.set==="ratings"?I*t(M):I;return R=>{if(Y(R))return null;const $=Number(R);if(!Number.isFinite($))return null;let C=0;for(const S of T)$>=S&&C++;const A=F[Math.min(C,F.length-1)];return A?{backgroundImage:A,backgroundRepeat:"no-repeat",backgroundPosition:"left center",backgroundSize:`${P}px ${I}px`,paddingLeft:`${P+4}px`}:null}}function y(M){const D=Array.isArray(M.colours)&&M.colours.length>=2?M.colours:["#f8f9fa","#1a6bc7"],F=Number(M.min),T=Number(M.max),I=T-F,P=D.length-1,R=[];for(let C=0;C<=P;C++)R.push(P?C/P:0);const $=Number(M.mid);if(M.mid!==void 0&&M.mid!==null)if(D.length%2===0)z("formatting.scale.mid.even",`a scale's "mid" needs an odd number of colours (a middle stop to pin); ${D.length} were given, so "mid" was ignored.`);else if(Number.isFinite($)&&I&&$>Math.min(F,T)&&$<Math.max(F,T)){const C=P/2,A=Math.max(0,Math.min(1,($-F)/I));for(let S=0;S<=P;S++)R[S]=S<=C?C?S/C*A:A:A+(S-C)/(P-C)*(1-A)}else Number.isFinite($)&&z("formatting.scale.mid.range",`a scale's "mid" (${$}) is outside its min..max range, so it was ignored.`);return C=>{const A=Number(C);if(!Number.isFinite(A)||!I)return null;const S=Math.max(0,Math.min(1,(A-F)/I));let x=0;for(;x<P-1&&S>R[x+1];)x++;const H=R[x+1]-R[x],V=H>0?(S-R[x])/H:0;return{background:j(D[x],D[x+1],Math.max(0,Math.min(1,V)))}}}function L(M,D=null){const F=c(M)?n(M,D):M,T=(Array.isArray(F)?F:[]).filter(P=>P&&typeof P=="object");if(!T.length)return()=>null;const I=T.map(P=>P.scale?{scale:y(P.scale),enabled:P.enabled!==!1}:P.dataBar?{scale:b(P.dataBar),enabled:P.enabled!==!1}:P.iconSet?{scale:O(P.iconSet),enabled:P.enabled!==!1}:{when:P.when,style:P.style,stop:P.stopIfTrue!==!1,enabled:P.enabled!==!1});return P=>{const R=P?P.value:void 0;let $=null;for(const C of I){if(!C.enabled)continue;if(C.scale){const S=C.scale(R);S&&($={...$||{},...S});continue}if(!G(R,C.when))continue;const A=E(C.style)?C.style(P):C.style;if(A&&($={...$||{},...A}),C.stop)break}return $}}}),Ue("packages/core/src/formula/parse.js",function(e,U){"use strict";Object.defineProperty(e,"FormulaError",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(e,"tokenise",{enumerable:!0,get:function(){return G}}),Object.defineProperty(e,"parseFormula",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"referencesOf",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"looksLikeFormula",{enumerable:!0,get:function(){return n}});const te="num",E="str",q="ref",z="name",_="op",Z="end",X=["<=",">=","<>","!="],B="+-*/^%(),<>=";class Y extends Error{constructor(s,t){super(s),this.name="FormulaError",this.at=t}}function G(a){const s=[];let t=0;for(;t<a.length;){const u=a[t];if(u===" "||u===" "||u===`
|
|
7
|
-
`||u==="\r"){t++;continue}if(u>="0"&&u<="9"){t=k(a,t,s);continue}if(u==="."&&a[t+1]>="0"&&a[t+1]<="9"){t=k(a,t,s);continue}if(u==='"'||u==="'"){t=g(a,t,s);continue}if(u==="["){const o=a.indexOf("]",t+1);if(o<0)throw new Y("a [column reference] was opened and never closed",t);s.push({kind:q,value:a.slice(t+1,o).trim(),at:t}),t=o+1;continue}if(j(u)){t=c(a,t,s);continue}const r=a.slice(t,t+2);if(X.includes(r)){s.push({kind:_,value:r==="!="?"<>":r,at:t}),t+=2;continue}if(B.includes(u)){s.push({kind:_,value:u,at:t}),t++;continue}throw new Y(`unexpected character ${JSON.stringify(u)}`,t)}return s.push({kind:Z,value:null,at:a.length}),s}function j(a){return/[A-Za-z_À-]/.test(a)}function k(a,s,t){let u=s,r=!1;for(;u<a.length;){const o=a[u];if(o>="0"&&o<="9"){u++;continue}if(o==="."&&!r){r=!0,u++;continue}if((o==="e"||o==="E")&&/[0-9+-]/.test(a[u+1]||"")){for(u+=2;u<a.length&&a[u]>="0"&&a[u]<="9";)u++;break}break}return t.push({kind:te,value:Number(a.slice(s,u)),at:s}),u}function g(a,s,t){const u=a[s];let r=s+1,o="";for(;r<a.length;){if(a[r]===u){if(a[r+1]===u){o+=u,r+=2;continue}return t.push({kind:E,value:o,at:s}),r+1}o+=a[r],r++}throw new Y("a string was opened and never closed",s)}function c(a,s,t){let u=s;for(;u<a.length&&/[A-Za-z0-9_.À-]/.test(a[u]);)u++;const r=a.slice(s,u);let o=u;for(;o<a.length&&a[o]===" ";)o++;return t.push({kind:a[o]==="("?z:q,value:r,at:s}),u}const d={"=":1,"<>":1,"<":1,"<=":1,">":1,">=":1,"+":2,"-":2,"*":3,"/":3,"^":4};function l(a){const s=String(a??"").replace(/^\s*=/,"");if(!s.trim())throw new Y("the formula is empty");const t=G(s);let u=0;const r=()=>t[u],o=()=>t[u++],f=O=>{const y=r();if(y.kind!==_||y.value!==O)throw new Y(`expected ${JSON.stringify(O)}`,y.at);u++},w=O=>{let y=m();for(;;){const L=r();if(L.kind!==_)break;const M=d[L.value];if(!M||M<O)break;u++;const D=w(L.value==="^"?M:M+1);y={kind:"bin",op:L.value,left:y,right:D}}return y},m=()=>{const O=r();return O.kind===_&&(O.value==="-"||O.value==="+")?(u++,{kind:"unary",op:O.value,arg:m()}):v()},v=()=>{let O=h();for(;r().kind===_&&r().value==="%";)u++,O={kind:"unary",op:"%",arg:O};return O},h=()=>{const O=o();if(O.kind===te)return{kind:"num",value:O.value};if(O.kind===E)return{kind:"str",value:O.value};if(O.kind===q)return{kind:"ref",name:O.value};if(O.kind===z){f("(");const y=[];if(!(r().kind===_&&r().value===")"))for(;;){if(y.push(w(1)),r().kind===_&&r().value===","){u++;continue}break}return f(")"),{kind:"call",name:String(O.value).toUpperCase(),args:y}}if(O.kind===_&&O.value==="("){const y=w(1);return f(")"),y}throw O.kind===Z?new Y("the formula ends unexpectedly",O.at):new Y(`unexpected ${JSON.stringify(O.value)}`,O.at)},p=w(1),b=r();if(b.kind!==Z)throw new Y(`unexpected ${JSON.stringify(b.value)}: is an operator missing?`,b.at);return p}function i(a){const s=new Set,t=u=>{if(!(!u||typeof u!="object")){if(u.kind==="ref"){s.add(String(u.name));return}if(u.kind==="bin"){t(u.left),t(u.right);return}if(u.kind==="unary"){t(u.arg);return}if(u.kind==="call")for(const r of u.args)t(r)}};return t(a),[...s]}function n(a){return typeof a=="string"&&/^\s*=/.test(a)&&a.trim()!=="="}}),Ue("packages/core/src/formula/evaluate.js",function(e,U){"use strict";Object.defineProperty(e,"FUNCTIONS",{enumerable:!0,get:function(){return G}}),Object.defineProperty(e,"evaluateAst",{enumerable:!0,get:function(){return k}});const E=U("packages/core/src/formula/parse.js").FormulaError;function q(g){if(g==null||g==="")return 0;if(typeof g=="boolean")return g?1:0;if(g instanceof Date)return g.getTime();const c=typeof g=="number"?g:Number(String(g).replace(/[,\s]/g,""));if(!Number.isFinite(c))throw new E(`${JSON.stringify(g)} is not a number`);return c}function z(g){return g==null?"":String(g)}function _(g){if(typeof g=="boolean")return g;if(g==null||g==="")return!1;if(typeof g=="number")return g!==0;const c=String(g).trim().toLowerCase();return c==="false"||c==="no"||c==="0"?!1:c!==""}function Z(g){const c=[];for(const d of g){if(Array.isArray(d)){for(const l of d)l!=null&&l!==""&&c.push(q(l));continue}d==null||d===""||c.push(q(d))}return c}function X(g,c){const d=10**c,l=g*d;return Math.sign(l)*Math.round(Math.abs(l)+Number.EPSILON*Math.abs(l))/d}function B(g,c){if(!g.length)return 0;const d=g.slice().sort((a,s)=>a-s),l=(d.length-1)*Math.min(1,Math.max(0,c)),i=Math.floor(l),n=Math.ceil(l);return i===n?d[i]:d[i]+(l-i)*(d[n]-d[i])}function Y(g,c){let d=0,l=0,i=0;for(const a of g){d++;const s=a-l;l+=s/d,i+=s*(a-l)}const n=c?d-1:d;return n>0?Math.sqrt(i/n):0}const G={SUM:g=>Z(g).reduce((c,d)=>c+d,0),AVERAGE:g=>{const c=Z(g);return c.length?c.reduce((d,l)=>d+l,0)/c.length:0},MIN:g=>{const c=Z(g);return c.length?Math.min(...c):0},MAX:g=>{const c=Z(g);return c.length?Math.max(...c):0},COUNT:g=>Z(g).length,PRODUCT:g=>Z(g).reduce((c,d)=>c*d,1),ROUND:g=>X(q(g[0]),g.length>1?q(g[1]):0),ROUNDDOWN:g=>{const c=10**(g.length>1?q(g[1]):0),d=q(g[0])*c;return(d<0?Math.ceil(d):Math.floor(d))/c},ROUNDUP:g=>{const c=10**(g.length>1?q(g[1]):0),d=q(g[0])*c;return(d<0?Math.floor(d):Math.ceil(d))/c},ABS:g=>Math.abs(q(g[0])),FLOOR:g=>Math.floor(q(g[0])),CEILING:g=>Math.ceil(q(g[0])),SQRT:g=>Math.sqrt(q(g[0])),POWER:g=>q(g[0])**q(g[1]),MOD:g=>{const c=q(g[1]);if(c===0)throw new E("MOD by zero");return(q(g[0])%c+c)%c},IF:g=>_(g[0])?g[1]:g.length>2?g[2]:!1,AND:g=>g.every(_),OR:g=>g.some(_),NOT:g=>!_(g[0]),COALESCE:g=>g.find(c=>c!=null&&c!=="")??null,CONCAT:g=>g.map(z).join(""),LEN:g=>z(g[0]).length,UPPER:g=>z(g[0]).toUpperCase(),LOWER:g=>z(g[0]).toLowerCase(),TRIM:g=>z(g[0]).trim(),LEFT:g=>z(g[0]).slice(0,g.length>1?q(g[1]):1),RIGHT:g=>{const c=g.length>1?q(g[1]):1;return c<=0?"":z(g[0]).slice(-c)},MEDIAN:g=>B(Z(g),.5),PERCENTILE:g=>{const c=q(g[g.length-1]);return B(Z(g.slice(0,-1)),c>1?c/100:c)},QUARTILE1:g=>B(Z(g),.25),QUARTILE3:g=>B(Z(g),.75),STDEV:g=>Y(Z(g),!0),STDEVP:g=>Y(Z(g),!1),VAR:g=>{const c=Y(Z(g),!0);return c*c},VARP:g=>{const c=Y(Z(g),!1);return c*c},COUNTDISTINCT:g=>{const c=new Set;for(const d of g){const l=Array.isArray(d)?d:[d];for(const i of l)i!=null&&i!==""&&c.add(i)}return c.size},IQR:g=>{const c=Z(g);return B(c,.75)-B(c,.25)}};G.AVG=G.AVERAGE,G.CEIL=G.CEILING,G.POW=G.POWER,G.STDEVS=G.STDEV,G.PERCENTILEINC=G.PERCENTILE;function j(g,c){const d=Number(g),l=Number(c);if(g!==null&&g!==""&&c!==null&&c!==""&&Number.isFinite(d)&&Number.isFinite(l))return d<l?-1:d>l?1:0;const n=z(g).toLowerCase(),a=z(c).toLowerCase();return n<a?-1:n>a?1:0}function k(g,c={}){const d=typeof c.lookup=="function"?c.lookup:null,l=c.functions?{...G,...c.functions}:G,i=n=>{switch(n.kind){case"num":return n.value;case"str":return n.value;case"ref":{if(!d)throw new E(`there is no column called ${JSON.stringify(n.name)} here`);const a=d(String(n.name));if(a===void 0)throw new E(`there is no column called ${JSON.stringify(n.name)}`);return a}case"unary":{if(n.op==="%")return q(i(n.arg))/100;const a=q(i(n.arg));return n.op==="-"?-a:a}case"bin":{const a=n.op;if(a==="=")return j(i(n.left),i(n.right))===0;if(a==="<>")return j(i(n.left),i(n.right))!==0;if(a==="<")return j(i(n.left),i(n.right))<0;if(a==="<=")return j(i(n.left),i(n.right))<=0;if(a===">")return j(i(n.left),i(n.right))>0;if(a===">=")return j(i(n.left),i(n.right))>=0;const s=q(i(n.left)),t=q(i(n.right));if(a==="+")return s+t;if(a==="-")return s-t;if(a==="*")return s*t;if(a==="^")return s**t;if(a==="/"){if(t===0)throw new E("division by zero");return s/t}throw new E(`unknown operator ${JSON.stringify(a)}`)}case"call":{const a=c.lazy&&c.lazy[n.name];if(typeof a=="function")return a(n.args,i,c);const s=l[n.name];if(typeof s!="function")throw new E(`there is no function called ${n.name}`);return s(n.args.map(i),c)}default:throw new E("the formula could not be read")}};return i(g)}}),Ue("packages/core/src/formula/index.js",function(e,U){"use strict";Object.defineProperty(e,"parseFormula",{enumerable:!0,get:function(){return E}}),Object.defineProperty(e,"referencesOf",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"looksLikeFormula",{enumerable:!0,get:function(){return z}}),Object.defineProperty(e,"FormulaError",{enumerable:!0,get:function(){return _}}),Object.defineProperty(e,"tokenise",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"evaluateAst",{enumerable:!0,get:function(){return B}}),Object.defineProperty(e,"FUNCTIONS",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(e,"rowLookup",{enumerable:!0,get:function(){return G}}),Object.defineProperty(e,"evaluateFormula",{enumerable:!0,get:function(){return j}});const te=U("packages/core/src/formula/parse.js"),E=te.parseFormula,q=te.referencesOf,z=te.looksLikeFormula,_=te.FormulaError,Z=te.tokenise,X=U("packages/core/src/formula/evaluate.js"),B=X.evaluateAst,Y=X.FUNCTIONS;function G(k){const{grid:g,row:c,data:d}=k||{},l=t=>String(t).toLowerCase().replace(/[\s_-]/g,""),i=g&&g.columns&&typeof g.columns.all=="function"?g.columns.all():[],n=g&&g.permissions,a=n&&typeof n.isReadable=="function"?t=>n.isReadable(t):()=>!0,s=new Set;for(const t of i)a(t)||(s.add(l(t.id)),t.field&&s.add(l(t.field)),t.title&&s.add(l(t.title)));return t=>{const u=l(t);if(s.has(u))throw new _(`"${t}" cannot be read`);for(const r of i)if(l(r.id)===u||r.field&&l(r.field)===u||r.title&&l(r.title)===u)return c&&g.rows&&typeof g.rows.value=="function"?g.rows.value(c.key,r.id):d?d[r.field||r.id]:void 0;if(d&&typeof d=="object"){for(const r of Object.keys(d))if(l(r)===u){if(!a(r))throw new _(`"${t}" cannot be read`);return d[r]}}}}function j(k,g={}){try{const c=E(k);return{ok:!0,value:B(c,{lookup:G(g),functions:g.formulaFunctions}),references:q(c)}}catch(c){return{ok:!1,error:c instanceof _?c.message:"the formula could not be read",at:c instanceof _?c.at:void 0}}}}),Ue("packages/core/src/internal/version.js",function(e,U){"use strict";Object.defineProperty(e,"VERSION",{enumerable:!0,get:function(){return q}});const te="1.99.0";async function E(){return te}const q="1.99.0"}),Ue("packages/core/src/internal/merge.js",function(e,U){"use strict";Object.defineProperty(e,"expand",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"toArray",{enumerable:!0,get:function(){return z}}),Object.defineProperty(e,"merge",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"mergeRow",{enumerable:!0,get:function(){return X}});const E=U("packages/core/src/internal/predicates.js").isObject;function q(B,Y,G){if(B!==void 0)return B===!0?{enabled:!0,...G}:B===!1?{enabled:!1}:E(B)?B:{[Y]:B,enabled:!0}}function z(B){return B==null?[]:Array.isArray(B)?B:[B]}const _=Object.freeze(new Set(["__proto__","constructor","prototype"]));function Z(B,Y){if(!E(B))return E(Y)?{...Y}:Y;if(!E(Y))return Y===void 0?B:Y;const G={...B};for(const j of Object.keys(Y)){if(_.has(j))continue;const k=Y[j];k!==void 0&&(G[j]=E(k)&&E(G[j])?Z(G[j],k):k)}return G}function X(B,Y){if(!E(B)||!E(Y)||B===Y)return Y;const G=Object.create(Object.getPrototypeOf(B));return Object.assign(G,B,Y),G}}),Ue("packages/core/src/internal/schedule.js",function(e,U){"use strict";Object.defineProperty(e,"now",{enumerable:!0,get:function(){return te}}),Object.defineProperty(e,"nextFrame",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"cancelFrame",{enumerable:!0,get:function(){return z}}),Object.defineProperty(e,"frameBatched",{enumerable:!0,get:function(){return _}}),Object.defineProperty(e,"settleDebounce",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"whenIdle",{enumerable:!0,get:function(){return X}});function te(){return typeof performance<"u"&&performance.now?performance.now():Date.now()}const E=typeof requestAnimationFrame=="function";function q(B){return E?requestAnimationFrame(B):setTimeout(()=>B(te()),16)}function z(B){B!=null&&(E?cancelAnimationFrame(B):clearTimeout(B))}function _(B){let Y=null,G=null;const j=()=>{Y=null;const g=G;G=null,B(...g||[])},k=(...g)=>{G=g,Y===null&&(Y=q(j))};return k.cancel=()=>{z(Y),Y=null,G=null},k.flush=()=>{Y!==null&&(z(Y),j())},k}function Z(B,Y){let G=null,j=null;const k=()=>{if(G=null,j===null)return;const d=j;j=null,B(...d),g()},g=()=>{G=setTimeout(k,Y),typeof G?.unref=="function"&&G.unref()},c=(...d)=>{G===null?(B(...d),g()):(j=d,clearTimeout(G),g())};return c.flush=()=>{if(G!==null&&clearTimeout(G),G=null,j===null)return;const d=j;j=null,B(...d)},c.cancel=()=>{G!==null&&clearTimeout(G),G=null,j=null},c.pending=()=>G!==null||j!==null,c}function X(B,Y=50){return typeof requestIdleCallback=="function"?requestIdleCallback(B,{timeout:Y}):setTimeout(()=>B({timeRemaining:()=>0,didTimeout:!0}),1)}}),Ue("packages/core/src/internal/paths.js",function(e,U){"use strict";Object.defineProperty(e,"pathGetter",{enumerable:!0,get:function(){return E}}),Object.defineProperty(e,"pathSetter",{enumerable:!0,get:function(){return z}}),Object.defineProperty(e,"getPath",{enumerable:!0,get:function(){return _}}),Object.defineProperty(e,"setPath",{enumerable:!0,get:function(){return Z}});const te=new Map;function E(X){let B=te.get(X);if(B)return B;if(!X.includes("."))B=Y=>Y?.[X];else{const Y=X.split("."),G=Y.length;B=j=>{let k=j;for(let g=0;g<G;g++){if(k==null)return;k=k[Y[g]]}return k}}return te.set(X,B),B}const q=new Map;function z(X){let B=q.get(X);if(B)return B;if(!X.includes("."))B=(Y,G)=>{Y!=null&&(Y[X]=G)};else{const Y=X.split("."),G=Y.length-1;B=(j,k)=>{let g=j;for(let c=0;c<G;c++){if(g==null)return;const d=Y[c];g[d]==null&&(g[d]={}),g=g[d]}g!=null&&(g[Y[G]]=k)}}return q.set(X,B),B}function _(X,B){return E(B)(X)}function Z(X,B,Y){z(B)(X,Y)}}),Ue("packages/core/src/internal/compare.js",function(e,U){"use strict";Object.defineProperty(e,"collator",{enumerable:!0,get:function(){return E}}),Object.defineProperty(e,"defaultCompare",{enumerable:!0,get:function(){return q}});const te=new Map;function E(z,_){const Z=`${z||""}|${_?JSON.stringify(_):""}`;let X=te.get(Z);return X||(X=new Intl.Collator(z||void 0,{numeric:!0,sensitivity:"variant",..._}),te.set(Z,X)),X}function q(z,_){if(z===_)return 0;if(z==null)return 1;if(_==null)return-1;if(typeof z=="number"&&typeof _=="number")return Number.isNaN(z)?Number.isNaN(_)?0:1:Number.isNaN(_)||z<_?-1:z>_?1:0;const Z=String(z),X=String(_);return Z<X?-1:Z>X?1:0}}),Ue("packages/core/src/defaults.js",function(e,U){"use strict";Object.defineProperty(e,"defaults",{enumerable:!0,get:function(){return G}}),Object.defineProperty(e,"applyDefaults",{enumerable:!0,get:function(){return j}});const E=U("packages/core/src/internal/predicates.js").isObject,z=U("packages/core/src/internal/merge.js").merge,Z=U("packages/core/src/internal/warn.js").warnOnce;let X=null;class B extends Error{}function Y(k,g=new Set){if(Array.isArray(k)){if(g.has(k))throw new B;g.add(k);const d=k.map(l=>Y(l,g));return g.delete(k),d}if(!E(k)||Object.getPrototypeOf(k)!==Object.prototype&&Object.getPrototypeOf(k)!==null)return k;if(g.has(k))throw new B;g.add(k);const c={};for(const[d,l]of Object.entries(k))c[d]=Y(l,g);return g.delete(k),c}function G(k){if(k===void 0)return Y(X??{});if(k===null)return X=null,{};if(!E(k))return Z("defaults:type",`defaults() expects a configuration object, or null to clear it, but got ${Array.isArray(k)?"an array":typeof k}. The call was ignored and the defaults are unchanged.`),Y(X??{});try{X=Y(k)}catch(g){if(!(g instanceof B))throw g;return Z("defaults:cyclic","defaults() expects a configuration object with no circular references, but the object passed refers back to itself. The call was ignored and the defaults are unchanged."),Y(X??{})}return Y(X)}function j(k){return X===null?k:z(Y(X),k)}}),Ue("packages/core/src/internal/uid.js",function(e,U){"use strict";Object.defineProperty(e,"uid",{enumerable:!0,get:function(){return E}});let te=0;function E(q="l"){return`${q}${(++te).toString(36)}`}}),Ue("packages/core/src/events/names.js",function(e,U){"use strict";Object.defineProperty(e,"EVENT_NAMES",{enumerable:!0,get:function(){return te}}),Object.defineProperty(e,"isKnownEvent",{enumerable:!0,get:function(){return q}});const te=Object.freeze(["ready","destroy","render:first","render:done","config:changed","licence:changed","model:changed","rows:changed","rows:queued","rows:deferred","rows:paused","rows:resumed","row:received","row:sent","row:copied","row:moved","source:error","source:total","stream:chunk","stream:end","stream:evicted","rowDrag:started","rowDrag:moved","rowDrag:left","rowDrag:ended","cell:changed","cell:pending","cell:confirmed","cell:reverted","cell:conflict","cell:clicked","cell:dblclicked","cell:contextmenu","cell:mouseover","cell:mouseout","cell:mousedown","cell:mouseup","cell:edit:start","cell:edit:end","row:edit:start","row:edit:end","row:clicked","row:dblclicked","row:pending","row:confirmed","row:reverted","row:conflict","form:opened","form:closed","form:saved","form:error","sort:changed","filter:changed","group:toggled","facet:computed","facet:filtered","facet:expanded","facet:failed","column:moved","column:resized","column:visible","column:pinned","column:grouped","column:pivoted","column:filter:open","column:profile:open","column:menu:open","columns:changed","columns:tagged","columngroup:changed","header:contextmenu","pivot:drill","selection:changed","range:changed","clipboard:copy","page:changed","scroll","scroll:end","size:changed","detail:toggled","detail:cell:edit:start","detail:cell:edit:end","detail:row:edit:start","detail:row:edit:end","detail:cell:changed","toolpanel:focus","highlight:changed","find:changed","tree:loading","tree:loaded","tree:loadFailed","tree:loadAborted","state:changed","state:reset","history:changed","history:applied","views:changed","view:applied","view:saved","view:removed","view:renamed","view:default","validation:failed","validation:cleared","formatting:changed","redaction:changed","permissions:changed","presentation:changed","presentation:started","presentation:ended","presentation:view","presentation:scale","presentation:spotlight","presentation:captured","comment:added","comment:edited","comment:deleted","comment:failed","comment:resolved","comment:unresolved","comment:threadOpened","comment:threadClosed","comment:indexLoaded","presence:published","presence:joined","presence:updated","presence:left","presence:failed","presence:lockRefused","diff:changed","diff:swapped","timeline:attached","timeline:detached","timeline:seek","timeline:seeking","annotation:changed","export:progress","export:request","export:done","shortcuts:opened","shortcuts:closed","print:before","print:after","beforeEdit","beforeSort","beforeFilter","beforeColumnMove","beforeColumnResize","beforeColumnHide","beforeSelect","beforeRowAdd","beforeDelete","beforeRowMove","beforeGroup","beforeRowReceive","edit:cancelled","sort:cancelled","filter:cancelled","columnMove:cancelled","columnResize:cancelled","columnHide:cancelled","selection:cancelled","rowAdd:cancelled","delete:cancelled","rowMove:cancelled","group:cancelled","rowReceive:cancelled"]),E=new Set(te);function q(z){return z==="*"||E.has(z)}}),Ue("packages/core/src/events/bus.js",function(e,U){"use strict";Object.defineProperty(e,"WILDCARD",{enumerable:!0,get:function(){return B}}),Object.defineProperty(e,"EventBus",{enumerable:!0,get:function(){return d}});const te=U("packages/core/src/internal/warn.js"),E=te.warnOnce,q=te.DEV,_=U("packages/core/src/internal/uid.js").uid,X=U("packages/core/src/events/names.js").isKnownEvent,B="*";function Y(l,i){!q||X(i)||E(`bus.unknown:${i}`,`${l}('${i}') subscribes to an event the grid never raises, so the handler will never fire. Check the name against the EventName list — a common cause is a near miss such as 'row:click' for 'row:clicked'.`)}const G=new Set(["api","user","init","ai"]),j=new WeakMap;function k(l){let i=j.get(l);return i||(i=_("h"),j.set(l,i)),i}function g(){return typeof performance=="object"&&performance?performance.now():Date.now()}function c(l){if(!l||typeof l!="object")return{};const i={};for(const[n,a]of Object.entries(l))n!=="grid"&&(a==null?i[n]=String(a):Array.isArray(a)?i[n]=`[${a.length}]`:typeof a=="object"?i[n]=a.key?`row ${a.key}`:"{…}":typeof a=="function"?i[n]="[function]":i[n]=String(a).slice(0,60));return i}class d{#e=new Map;#t=!1;#n=[];#r=200;#s=new Map;#i=null;#o=!1;#l=0;constructor(i=null){this.#i=i}attach(i){this.#i=i}get grid(){return this.#i}get destroyed(){return this.#o}on(i,n){if(typeof n!="function")return E(`bus.handler:${i}`,`on('${i}') needs a function; ignored.`),()=>{};Y("on",i);let a=this.#e.get(i);return a||(a=[],this.#e.set(i,a)),a.push(n),()=>this.off(i,n)}once(i,n){if(typeof n!="function")return E(`bus.handler:${i}`,`once('${i}') needs a function; ignored.`),()=>{};Y("once",i);const a=s=>{this.off(i,n),n(s)};return this.#s.set(n,a),this.on(i,a)}off(i,n){if(n===void 0){this.#e.delete(i);return}const a=this.#e.get(i);if(!a)return;const s=this.#s.get(n),t=s&&a.includes(s)?s:n,u=a.indexOf(t);u>=0&&a.splice(u,1),s&&t===s&&this.#s.delete(n),a.length===0&&this.#e.delete(i)}count(i){const n=this.#e.get(i),a=i===B?null:this.#e.get(B);return(n?n.length:0)+(a?a.length:0)}#a(i,n,a,s,t){this.#n.push({type:i,origin:n,listeners:(s?s.length:0)+(t?t.length:0),payload:c(a),at:Date.now(),ms:0}),this.#n.length>this.#r&&this.#n.shift()}recordEvents(i,n){this.#t=!!i,Number.isFinite(n)&&n>0&&(this.#r=Math.floor(n)),i||(this.#n=[])}eventLog(){return this.#n.map(i=>({...i}))}clearEventLog(){this.#n=[]}counts(){const i={};for(const[n,a]of this.#e)i[n]=a.length;return i}emit(i,n,a){const s=a??(n&&n.origin),t=G.has(s)?s:"api",u={...n||null,type:i,origin:t,grid:this.#i};if(this.#o)return u;const r=this.#e.get(i),o=i===B?void 0:this.#e.get(B);if(this.#t&&this.#a(i,t,n,r,o),!r&&!o)return u;const f=this.#t?g():0;this.#l++;try{r&&this.#c(r.slice(),u,i),o&&this.#c(o.slice(),u,B)}finally{this.#l--,this.#t&&this.#n.length&&(this.#n[this.#n.length-1].ms=g()-f)}return u}emitBefore(i,n,a){const s=a??(n&&n.origin),t=G.has(s)?s:"user";let u=!1,r=null;const o=p=>{u=!0,p!=null&&r===null&&(r=String(p))},f={...n||null,type:i,origin:t,grid:this.#i,get defaultPrevented(){return u},get reason(){return r},preventDefault(p){o(p)}};if(this.#o)return!0;const w=this.#e.get(i);this.#t&&this.#a(i,t,n,w,void 0);const m=w?w.slice():[];if(m.length===0)return!0;const v=()=>(u&&r===null&&(r="prevented"),u&&n&&typeof n=="object"&&(n.reason=r),!u),h=[];for(const p of m)try{const b=p(f);b&&typeof b.then=="function"?h.push(b):b===!1&&o("prevented")}catch(b){o("error"),E(`bus.beforeThrow:${i}:${k(p)}`,`a '${i}' before-handler threw; the action was cancelled.`,b)}return h.length===0?v():Promise.allSettled(h).then(p=>{for(const b of p)b.status==="rejected"?(o("error"),E(`bus.beforeReject:${i}`,`a '${i}' before-handler rejected; the action was cancelled.`,b.reason)):b.value===!1&&o("prevented");return v()})}#c(i,n,a){for(let s=0;s<i.length;s++)try{i[s](n)}catch(t){E(`bus.throw:${a}:${k(i[s])}`,`a '${a}' handler threw; other handlers were unaffected.`,t)}}clear(){this.#e.clear(),this.#s.clear()}destroy(){this.clear(),this.#o=!0,this.#i=null}}}),Ue("packages/core/src/registry/free-tier-notice.js",function(e,U){"use strict";Object.defineProperty(e,"FREE_TIER_NOTICE",{enumerable:!0,get:function(){return te}});const te="Free for non-commercial use: latticegrid.dev/free"}),Ue("packages/core/src/registry/licence.js",function(e,U){"use strict";Object.defineProperty(e,"PRODUCT",{enumerable:!0,get:function(){return _}}),Object.defineProperty(e,"LICENCE_VERSION",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"PUBLIC_KEY",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(e,"fromBase64Url",{enumerable:!0,get:function(){return k}}),Object.defineProperty(e,"toBase64Url",{enumerable:!0,get:function(){return g}}),Object.defineProperty(e,"asciiBytes",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"parseLicence",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"hasEd25519",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"verifyLicence",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"isLocalHost",{enumerable:!0,get:function(){return w}}),Object.defineProperty(e,"currentHost",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"matchesDomain",{enumerable:!0,get:function(){return v}}),Object.defineProperty(e,"LicenceHolder",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"setLicence",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"licenceInfo",{enumerable:!0,get:function(){return M}}),Object.defineProperty(e,"watermark",{enumerable:!0,get:function(){return D}}),Object.defineProperty(e,"licenceState",{enumerable:!0,get:function(){return F}}),Object.defineProperty(e,"sharedLicence",{enumerable:!0,get:function(){return T}});const E=U("packages/core/src/internal/warn.js").warnOnce,q=U("packages/core/src/registry/free-tier-notice.js"),z=q.FREE_TIER_NOTICE;Object.defineProperty(e,"FREE_TIER_NOTICE",{enumerable:!0,get:function(){return q.FREE_TIER_NOTICE}});const _="lattice-grid",Z=1,X="LG1",B=64,Y="GwmaCOkGedHulqsa-DOV1TU8On1rsalWv519c_dW4j4",G="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",j=(()=>{const I=new Int16Array(128).fill(-1);for(let P=0;P<G.length;P++)I[G.charCodeAt(P)]=P;return I[43]=62,I[47]=63,I})();function k(I){if(typeof I!="string")return null;let P="";for(let x=0;x<I.length;x++){const H=I.charCodeAt(x);if(H!==61){if(H>127||j[H]<0)return null;P+=I[x]}}const R=P.length;if(R%4===1)return null;const $=new Uint8Array(Math.floor(R*3/4));let C=0,A=0,S=0;for(let x=0;x<R;x++)C=C<<6|j[P.charCodeAt(x)],A+=6,A>=8&&(A-=8,$[S++]=C>>A&255);return S===$.length?$:$.subarray(0,S)}function g(I){let P="",R=0;for(;R+2<I.length;R+=3){const C=I[R]<<16|I[R+1]<<8|I[R+2];P+=G[C>>18&63]+G[C>>12&63]+G[C>>6&63]+G[C&63]}const $=I.length-R;if($===1){const C=I[R]<<16;P+=G[C>>18&63]+G[C>>12&63]}else if($===2){const C=I[R]<<16|I[R+1]<<8;P+=G[C>>18&63]+G[C>>12&63]+G[C>>6&63]}return P}function c(I){const P=new Uint8Array(I.length);for(let R=0;R<I.length;R++)P[R]=I.charCodeAt(R)&127;return P}function d(I){if(typeof TextDecoder=="function")return new TextDecoder().decode(I);let P="";for(let R=0;R<I.length;R++)P+=String.fromCharCode(I[R]);return P}function l(I){const P={ok:!1,reason:"malformed",product:null,issuedTo:null,expires:null,terms:null,features:[],deployments:[],version:0,message:null,signature:null,raw:typeof I=="string"?I:""};if(typeof I!="string"||I.length===0)return{...P,reason:"missing"};const R=I.trim(),$=R.split(".");if($.length!==3)return P;const[C,A,S]=$;if(C!==X)return{...P,reason:"prefix"};const x=k(A),H=k(S);if(!x||!H)return P;let V;try{V=JSON.parse(d(x))}catch{return P}return V===null||typeof V!="object"?P:{ok:!0,reason:null,product:typeof V.p=="string"?V.p:null,issuedTo:typeof V.t=="string"?V.t:null,expires:typeof V.e=="string"?V.e:null,terms:typeof V.terms=="string"?V.terms:null,features:Array.isArray(V.f)?V.f.slice():[],deployments:Array.isArray(V.d)?V.d.slice():[],version:typeof V.v=="number"?V.v:0,message:c(A),signature:H,raw:R}}function i(I,P){if(!I)return!1;const R=Date.parse(/^\d{4}-\d{2}-\d{2}$/.test(I)?`${I}T23:59:59.999Z`:I);return Number.isNaN(R)?!0:P>R}function n(I){return I==="non-commercial"?"non-commercial":"commercial"}let a=null,s=null,t=null;function u(){const I=globalThis.crypto;return I&&I.subtle?I.subtle:null}async function r(I){if(a&&s===I)return a;const P=u();if(!P)return null;const R=k(I);if(!R)return null;try{const $=await P.importKey("raw",R,{name:"Ed25519"},!1,["verify"]);return a=$,s=I,$}catch{return null}}async function o(){return t!==null||(t=await r(Y)!==null),t}async function f(I,P={}){const R=P.warn!==!1,$=P.product||_,C=P.publicKey||Y,A=P.now??Date.now(),S=P.host??m(),x=w(S)?"":` ${z}`,H=l(I);if(!H.ok){const re=H.reason==="missing"?"missing":"malformed";return R&&E(`licence.${re}`,re==="missing"?`no licence key supplied. The grid renders in full and carries a trial watermark on any host other than localhost. Get a key at latticegrid.dev.${x}`:`licence key could not be read. The grid will render with a watermark.${x}`),{valid:!1,reason:re,terms:"commercial"}}const V={product:H.product||void 0,issuedTo:H.issuedTo||void 0,expires:H.expires||void 0,terms:n(H.terms)};if(H.product!==$)return R&&E("licence.product",`licence key is for '${H.product}', not '${$}'. The grid will render with a watermark.`),{valid:!1,...V,reason:"product"};if(i(H.expires,A))return R&&E("licence.expired",`licence expired on ${H.expires}. The grid will render with a watermark. Renew at latticegrid.dev.`),{valid:!1,...V,reason:"expired"};const W=H.deployments||[];if(W.length&&S&&!w(S)&&!v(S,W))return R&&E("licence.domain",`licence key is not valid for ${S}; it covers ${W.join(", ")}. The grid will render with a watermark.`),{valid:!1,...V,reason:"domain"};const Q=await r(C);if(!Q){const re=!!H.signature&&H.signature.length===B;return R&&E("licence.algorithm","this host does not provide crypto.subtle Ed25519, so the licence signature could not be verified. A structural check was used instead."),re?{valid:!0,...V,reason:"unverified"}:{valid:!1,...V,reason:"signature"}}let ee=!1;try{ee=await u().verify({name:"Ed25519"},Q,H.signature,H.message)}catch{ee=!1}return ee?{valid:!0,...V}:(R&&E("licence.signature","licence signature is not valid. The grid will render with a watermark."),{valid:!1,...V,reason:"signature"})}function w(I){const P=String(I??m()??"").trim().toLowerCase().replace(/^\[/,"").replace(/\]$/,"");return!P||P==="localhost"||P.endsWith(".localhost")||P==="::1"||P==="0:0:0:0:0:0:0:1"?!0:/^127\.\d{1,3}\.\d{1,3}\.\d{1,3}$/.test(P)}function m(){const I=globalThis.location;return I&&typeof I.hostname=="string"?I.hostname:null}function v(I,P){const R=h(I);return!R||!Array.isArray(P)?!1:P.some($=>{const C=h($);if(!C)return!1;if(C==="*")return!0;if(C.startsWith("*.")){const A=C.slice(2);return R===A||R.endsWith(`.${A}`)}return R===C})}function h(I){return String(I??"").trim().toLowerCase().replace(/\.$/,"")}class p{#e="";#t={valid:!1,reason:"missing",terms:"commercial"};#n=null;#r=null;#s;#i=new Set;constructor(P={}){this.#s=P}set(P){this.#e=typeof P=="string"?P.trim():"";const R=l(this.#e);return this.#t=R.ok?{valid:!i(R.expires,Date.now())&&R.product===(this.#s.product||_),product:R.product||void 0,issuedTo:R.issuedTo||void 0,expires:R.expires||void 0,terms:n(R.terms),reason:"pending"}:{valid:!1,reason:R.reason||"malformed",terms:"commercial"},this.#n=null,this.#e&&this.verify(),this.#t}verify(){if(this.#n)return this.#n;const P=this.#e;return this.#n=f(P,this.#s).then(R=>{if(this.#e===P){this.#t=R;for(const $ of this.#i)$(R)}return R}),this.#n}onSettled(P){return this.#i.add(P),()=>this.#i.delete(P)}info(){return{...this.#t}}watermark(){return this.#t.valid?!1:!w(this.#r)}setHost(P){this.#r=P}state(){return this.#t.valid?"licensed":w(this.#r)?"localhost":"trial"}reset(){this.#e="",this.#t={valid:!1,reason:"missing",terms:"commercial"},this.#n=null,this.#i.clear()}}const b=Symbol.for("lattice-grid/licence/holder");function O(){const I=globalThis,P=I&&I[b];if(P&&typeof P.set=="function"&&typeof P.watermark=="function")return P;const R=new p;if(I)try{I[b]=R}catch{}return R}const y=O();function L(I){return y.set(I)}function M(){return y.info()}function D(){return y.watermark()}function F(){return y.state()}function T(){return y}}),Ue("packages/core/src/registry/registry.js",function(e,U){"use strict";Object.defineProperty(e,"KINDS",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(e,"REGIONS",{enumerable:!0,get:function(){return G}}),Object.defineProperty(e,"Registry",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"sharedRegistry",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"registerModules",{enumerable:!0,get:function(){return a}});const te=U("packages/core/src/internal/warn.js"),E=te.warnOnce,q=te.DEV,_=U("packages/core/src/internal/predicates.js").isFunction,Z=U("packages/core/src/registry/licence.js"),X=Z.LicenceHolder,B=Z.sharedLicence,Y=["renderer","editor","filter","dataType","totalFn","pipe","component"],G=["all","header","body","totals","panels"];class j{#e=new Map;#t=new Map;#n=new Set;#r=new Set;#s;#i=null;#o=null;#l=new Set;#a=new Map;constructor(t={}){for(const u of Y)this.#t.set(u,new Map);this.#s=t.holder||B(),this.#o=t.grid??null,this.#i=this.#s.onSettled(()=>{this.#f({reason:"licence",name:"licence",capabilities:this.capabilities(),regions:["all"]})}),t.licence&&this.setLicence(t.licence)}registerModules(t,u={}){u.licence&&this.setLicence(u.licence),u.grid!==void 0&&(this.#o=u.grid);const r=Array.isArray(t)?t:[t],o=[];for(const f of r){if(!f||typeof f!="object"||typeof f.name!="string"||!f.name){E("registry.module.shape","registerModules received something that is not a module; ignored.");continue}if(this.#e.has(f.name)){q&&this.#u(this.#e.get(f.name),f);continue}if(!_(f.install)){E(`registry.module.install:${f.name}`,`module '${f.name}' has no install() and was ignored.`);continue}const w={registry:this,grid:this.#o};try{f.install(w)}catch(m){E(`registry.module.throw:${f.name}`,`module '${f.name}' threw during install; it was not registered.`,m);continue}this.#e.set(f.name,f);for(const m of k(f))this.#n.add(m);o.push(f.name),this.#f({reason:"module",name:f.name,capabilities:this.capabilities(),regions:d(f)})}return o}unregisterModule(t){const u=this.#e.get(t);if(!u)return!1;if(_(u.uninstall))try{u.uninstall({registry:this,grid:this.#o})}catch(r){E(`registry.module.uninstall:${t}`,`module '${t}' threw during uninstall.`,r)}return this.#e.delete(t),this.#c(),this.#f({reason:"unmodule",name:t,capabilities:this.capabilities(),regions:d(u)}),!0}modules(){return[...this.#e.values()]}has(t){return this.#e.has(t)}#c(){this.#n.clear();for(const t of this.#e.values())for(const u of k(t))this.#n.add(u)}#u(t,u){!t||t===u||g(t,u)||E(`registry.module.reconfigure:${u.name}`,`module '${u.name}' was re-registered with different options; the first registration is kept and this call was ignored. Unregister it first if you mean to replace it.`)}capabilities(){return[...this.#n].sort()}can(t){return this.#n.has(t)}onChange(t){return _(t)?(this.#r.add(t),this.#a.set(t,this.#o),()=>{this.#r.delete(t),this.#a.delete(t)}):()=>{}}#f(t){for(const u of[...this.#r])try{u(t)}catch(r){E("registry.onChange.throw","a registry change handler threw.",r)}}register(t,u,r){const o=this.#t.get(t);if(!o){E(`registry.kind:${t}`,`unknown registry kind '${t}'; expected one of ${Y.join(", ")}.`);return}if(!u||typeof u!="string"){E(`registry.name:${t}`,`register('${t}', ...) needs a name.`);return}o.has(u)&&o.get(u)!==r&&E(`registry.replace:${t}:${u}`,`'${u}' was already registered as a ${t} and has been replaced.`),o.set(u,r),this.#f({reason:"register",name:u,kind:t,capabilities:this.capabilities(),regions:l(t)})}registerAll(t,u){if(u)for(const r of Object.keys(u))this.register(t,r,u[r])}get(t,u){const r=this.#t.get(t);return r?r.get(u):void 0}names(t){const u=this.#t.get(t);return u?[...u.keys()]:[]}#d(t,u){const r=this.#t.get(t).get(u);return r!==void 0?r:this.#t.get("component").get(u)}renderer(t){return this.#d("renderer",t)}editor(t){return this.#d("editor",t)}filter(t){return this.#d("filter",t)}dataType(t){return this.get("dataType",t)}totalFn(t){return this.get("totalFn",t)}pipe(t){return this.get("pipe",t)}setLicence(t){return this.#s.set(t)}licence(){return this.#s.info()}licenceVerified(){return this.#s.verify()}watermark(){return this.#s.watermark()}attach(t){t!=null&&(this.#l.add(t),this.#o=t)}detach(t){if(t!=null){this.#l.delete(t);for(const[u,r]of[...this.#a])r===t&&(this.#r.delete(u),this.#a.delete(u));if(this.#o===t){const u=this.#l.size?[...this.#l][this.#l.size-1]:null;this.#o=u}this.#l.size===0&&this.#i&&(this.#i(),this.#i=null)}}destroy(t){if(t!=null){this.detach(t);return}for(const u of[...this.#e.keys()])this.unregisterModule(u);this.#r.clear(),this.#a.clear(),this.#l.clear(),this.#i&&this.#i(),this.#i=null,this.#o=null}}function k(s){const t=s.capabilities,u=Array.isArray(t)?t.filter(r=>typeof r=="string"):[];return[s.name,...u]}function g(s,t){return s.install!==t.install||s.uninstall!==t.uninstall||(s.version||"")!==(t.version||"")?!1:c(k(s),k(t))&&c(d(s),d(t))}function c(s,t){const u=new Set(s),r=new Set(t);if(u.size!==r.size)return!1;for(const o of u)if(!r.has(o))return!1;return!0}function d(s){const t=s.regions;return!Array.isArray(t)||t.length===0?["all"]:t.filter(u=>G.includes(u))}function l(s){switch(s){case"filter":return["header"];case"totalFn":return["totals"];case"renderer":case"editor":case"pipe":return["body"];default:return["all"]}}const i=new j;function n(){return i}function a(s,t={}){return i.registerModules(s,t)}}),Ue("packages/core/src/internal/text.js",function(e,U){"use strict";Object.defineProperty(e,"humanise",{enumerable:!0,get:function(){return te}}),Object.defineProperty(e,"escapeHtml",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"titleCase",{enumerable:!0,get:function(){return z}});function te(_){return _?(_.includes(".")?_.slice(_.lastIndexOf(".")+1):_).replace(/[_-]+/g," ").replace(/([a-z0-9])([A-Z])/g,"$1 $2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1 $2").replace(/\s+/g," ").trim().replace(/^./,X=>X.toUpperCase()):""}const E={"&":"&","<":"<",">":">",'"':""","'":"'"};function q(_){const Z=_==null?"":String(_);return/[&<>"']/.test(Z)?Z.replace(/[&<>"']/g,X=>E[X]):Z}function z(_){return String(_).replace(/\w\S*/g,Z=>Z[0].toUpperCase()+Z.slice(1).toLowerCase())}}),Ue("packages/core/src/format/mask.js",function(e,U){"use strict";Object.defineProperty(e,"splitSections",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"parseSection",{enumerable:!0,get:function(){return z}}),Object.defineProperty(e,"compileMask",{enumerable:!0,get:function(){return Z}});const te=new Set(["0","#","?",",","."]),E="\0";function q(B){const Y=[];let G="",j=!1;for(let k=0;k<B.length;k++){const g=B[k];if(g==="\\"){G+=g+(B[k+1]??""),k+=1;continue}if(g==='"'){j=!j,G+=g;continue}if(g===";"&&!j){Y.push(G),G="";continue}G+=g}return Y.push(G),Y}function z(B){let Y="",G="",j="",k=1,g=!1,c=!1;const d=o=>{c?G+=o:Y+=o};for(let o=0;o<B.length;o++){const f=B[o];if(f==="\\"){d(B[o+1]??""),o+=1;continue}if(f==='"'){const w=B.indexOf('"',o+1);d(w===-1?B.slice(o+1):B.slice(o+1,w)),o=w===-1?B.length:w;continue}if(f==="%"){k*=100,d("%");continue}if(f==="@"){g=!0,d("\0");continue}if(te.has(f)){j+=f,c=!0;continue}d(f)}let l=-1;for(let o=j.length-1;o>=0;o--){const f=j[o];if(f==="0"||f==="#"||f==="?"){l=o;break}}let i=!1,n="";for(let o=0;o<j.length;o++){const f=j[o];if(f===","){o>l?k/=1e3:i=!0;continue}n+=f}const a=n.indexOf("."),s=a===-1?n:n.slice(0,a),t=a===-1?"":n.slice(a+1);let u=0;for(const o of s)o==="0"&&(u+=1);let r=0;for(const o of t)o==="0"&&(r+=1);return{prefix:Y,suffix:G,minInt:u,minDec:r,maxDec:t.length,grouping:i,scale:k,hasNumber:l!==-1,isText:g}}function _(B,Y){const G=new Intl.NumberFormat(Y,{minimumIntegerDigits:Math.max(B.minInt,1),minimumFractionDigits:B.minDec,maximumFractionDigits:Math.max(B.maxDec,B.minDec),useGrouping:B.grouping}),{prefix:j,suffix:k,scale:g,hasNumber:c}=B;return d=>{if(!c)return j+k;const l=g===1?d:d*g;return j+G.format(l)+k}}function Z(B,Y){const j=q(String(B)).map(z),k=j.map(n=>_(n,Y)),g=0,c=j.length>1?1:-1,d=j.length>2?2:-1,l=j.length>3?3:-1,i=n=>{if(n==null||n==="")return"";if(typeof n!="number"||Number.isNaN(n)){const a=Number(n);if(Number.isNaN(a))return l===-1?String(n):(j[l].prefix+j[l].suffix).split("\0").join(String(n));n=a}return n===0&&d!==-1?k[d](0):n<0&&c!==-1?k[c](-n):k[g](n)};return i.spec={mask:B},{format:i,ooxml:X(String(B))}}function X(B){return B.trim()}}),Ue("packages/core/src/format/pattern.js",function(e,U){"use strict";Object.defineProperty(e,"parseNumberPattern",{enumerable:!0,get:function(){return _}});const E=U("packages/core/src/format/mask.js").splitSections;function q(Z){let X="",B="",Y="",G="",j=!1,k=!1,g=!1,c=!1;const d=i=>{g?B+=i:X+=i};for(let i=0;i<Z.length;i++){const n=Z[i];if(n==="\\"){d(Z[i+1]??""),i+=1;continue}if(n==='"'){const a=Z.indexOf('"',i+1);d(a===-1?Z.slice(i+1):Z.slice(i+1,a)),i=a===-1?Z.length:a;continue}if(n==="%"){k=!0;continue}if(n==="0"||n==="#"){g=!0,c?G+=n:Y+=n;continue}if(n===","){c||(j=!0);continue}if(n==="."&&!c){c=!0;continue}d(n)}if(!g)return{hasDigit:!1,prefix:X,suffix:B,minDec:0,maxDec:0,grouping:!1,percent:k};let l=0;for(const i of G)i==="0"&&(l+=1);return{hasDigit:!0,prefix:X,suffix:B,minDec:l,maxDec:G.length,grouping:j,percent:k}}function z(Z,X){const B=X.trim(),Y=Z.trim();return B.startsWith("(")&&B.endsWith(")")&&B.slice(1,-1).trim()===Y?"parentheses":B.endsWith("-")?"suffix":"minus"}function _(Z){if(typeof Z!="string")return null;const X=E(Z);if(X.length===0)return null;const B=q(X[0]);if(!B.hasDigit)return null;const Y={style:B.percent?"percent":"decimal",prefix:B.prefix,suffix:B.suffix,minDecimals:B.minDec,maxDecimals:Math.max(B.maxDec,B.minDec),thousandsSeparator:B.grouping?void 0:!1};if(X.length>1&&(Y.negative=z(X[0],X[1])),X.length>2){const G=q(X[2]);G.hasDigit||(Y.zeroDisplay=G.prefix+G.suffix)}return Y}}),Ue("packages/core/src/format/number.js",function(e,U){"use strict";Object.defineProperty(e,"compileNumber",{enumerable:!0,get:function(){return X}});const E=U("packages/core/src/internal/predicates.js").isNil,z=U("packages/core/src/internal/warn.js").warnOnce,Z=U("packages/core/src/format/pattern.js").parseNumberPattern;function X(B,Y){const G=typeof B=="string"?{pattern:B}:B||{};let j=G;if(typeof G.pattern=="string"){const O=Z(G.pattern);if(O){const{pattern:y,...L}=G;j={...O,...L}}else z(`format:pattern:${G.pattern}`,`invalid number format pattern "${G.pattern}"; the value will use the default number format`)}const k=j.locale||Y||void 0,g=j.style||"decimal",c=typeof j.scale=="number"?j.scale:1,d=j.nullDisplay??"",l=j.zeroDisplay,i=j.prefix||"",n=j.suffix||"",a=j.negative||"minus",s=j.signed===!0,t={style:g,notation:j.notation||"standard"};g==="currency"&&(t.currency=j.currency||"USD",j.currencyDisplay&&(t.currencyDisplay=j.currencyDisplay)),typeof j.decimals=="number"?(t.minimumFractionDigits=j.decimals,t.maximumFractionDigits=j.decimals):(typeof j.minDecimals=="number"&&(t.minimumFractionDigits=j.minDecimals),typeof j.maxDecimals=="number"&&(t.maximumFractionDigits=j.maxDecimals),t.minimumFractionDigits>(t.maximumFractionDigits??20)&&(t.maximumFractionDigits=t.minimumFractionDigits)),j.thousandsSeparator===!1&&(t.useGrouping=!1),t.notation==="compact"&&(t.compactDisplay=j.compactDisplay||"short");const u=new Intl.NumberFormat(k,t),r=typeof j.thousandsSeparator=="string"?j.thousandsSeparator:null,o=typeof j.decimalSeparator=="string"?j.decimalSeparator:null;let f=",",w=".";if(r||o)for(const O of u.formatToParts(12345.6))O.type==="group"?f=O.value:O.type==="decimal"&&(w=O.value);const m=O=>{let y=O;return r&&(y=y.split(f).join("")),o&&(y=y.split(w).join("")),r&&(y=y.split("").join(r)),o&&(y=y.split("").join(o)),y},v=!!(r||o),h=i!==""&&g==="currency",p=O=>{let y;if(h){const L=u.formatToParts(O);let M=!1;y="";for(const D of L)y+=D.value,!M&&D.type==="currency"&&(y+=i,M=!0);M||(y=i+y)}else y=i+u.format(O);return v&&(y=m(y)),y+n},b=O=>{if(E(O)||O==="")return d;const y=typeof O=="number"?O:Number(O);if(Number.isNaN(y))return d;const L=c===1?y:y*c;return L===0&&l!==void 0?l:L<0?a==="parentheses"?`(${p(-L)})`:a==="suffix"?`${p(-L)}-`:p(L):s&&L>0?`+${p(L)}`:p(L)};return b.negativeClass=j.negativeClass||null,b.spec=j,b}}),Ue("packages/core/src/format/date.js",function(e,U){"use strict";Object.defineProperty(e,"scanPattern",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"toDate",{enumerable:!0,get:function(){return B}}),Object.defineProperty(e,"compilePattern",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"compileDate",{enumerable:!0,get:function(){return g}}),Object.defineProperty(e,"toIsoDate",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"toIsoDateTime",{enumerable:!0,get:function(){return d}}),Object.defineProperty(e,"compareIso",{enumerable:!0,get:function(){return n}});const E=U("packages/core/src/internal/predicates.js").isNil,z=U("packages/core/src/internal/warn.js").warnOnce,_=["yyyy","yy","MMMM","MMM","MM","M","dd","d","EEEE","EEE","HH","H","hh","h","mm","m","ss","s","SSS","a"];function Z(a){const s=[];let t=0,u="";const r=()=>{u&&(s.push({token:null,text:u}),u="")};for(;t<a.length;){const o=a[t];if(o==="'"){if(a[t+1]==="'"){u+="'",t+=2;continue}const w=a.indexOf("'",t+1);if(w===-1){u+=a.slice(t+1),t=a.length;continue}u+=a.slice(t+1,w),t=w+1;continue}const f=_.find(w=>a.startsWith(w,t));if(f){r(),s.push({token:f,text:f}),t+=f.length;continue}/[A-Za-z]/.test(o)&&z(`date.pattern.token:${o}`,`the date pattern "${a}" contains '${o}', which is not a supported token, so it is rendered as text. Quote it as a literal to silence this. Supported: ${_.join(" ")}.`),u+=o,t+=1}return r(),s}const X=/^(\d{4})-(\d{2})-(\d{2})(?:[T ](\d{2}):(\d{2})(?::(\d{2}))?(?:\.\d+)?)?$/;function B(a){if(E(a)||a==="")return null;if(a instanceof Date)return Number.isNaN(a.getTime())?null:a;if(typeof a=="number")return Number.isNaN(a)?null:new Date(a);if(typeof a=="string"){const s=X.exec(a.trim());if(s){const[,u,r,o,f="0",w="0",m="0"]=s;return new Date(+u,+r-1,+o,+f,+w,+m)}const t=new Date(a);return Number.isNaN(t.getTime())?null:t}return null}function Y(a,s){return String(a).padStart(s,"0")}function G(a){if(!a)return u=>({year:u.getFullYear(),month:u.getMonth()+1,day:u.getDate(),hour:u.getHours(),minute:u.getMinutes(),second:u.getSeconds(),ms:u.getMilliseconds(),weekday:u.getDay()});const s=new Intl.DateTimeFormat("en-US",{timeZone:a,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1,weekday:"short"}),t={Sun:0,Mon:1,Tue:2,Wed:3,Thu:4,Fri:5,Sat:6};return u=>{const r={year:0,month:1,day:1,hour:0,minute:0,second:0,ms:u.getMilliseconds(),weekday:0};for(const o of s.formatToParts(u))switch(o.type){case"year":r.year=Number(o.value);break;case"month":r.month=Number(o.value);break;case"day":r.day=Number(o.value);break;case"hour":r.hour=Number(o.value)%24;break;case"minute":r.minute=Number(o.value);break;case"second":r.second=Number(o.value);break;case"weekday":r.weekday=t[o.value]??0;break;default:break}return r}}function j(a,s,t){const u=Z(a),r=G(t),o=new Set(u.filter(h=>h.token).map(h=>h.token)),f=o.has("MMM")?new Intl.DateTimeFormat(s,{month:"short",timeZone:t}):null,w=o.has("MMMM")?new Intl.DateTimeFormat(s,{month:"long",timeZone:t}):null,m=o.has("EEE")?new Intl.DateTimeFormat(s,{weekday:"short",timeZone:t}):null,v=o.has("EEEE")?new Intl.DateTimeFormat(s,{weekday:"long",timeZone:t}):null;return h=>{const p=r(h);let b="";for(const O of u){if(!O.token){b+=O.text;continue}switch(O.token){case"yyyy":b+=Y(p.year,4);break;case"yy":b+=Y(p.year%100,2);break;case"MMMM":b+=w.format(h);break;case"MMM":b+=f.format(h);break;case"MM":b+=Y(p.month,2);break;case"M":b+=String(p.month);break;case"dd":b+=Y(p.day,2);break;case"d":b+=String(p.day);break;case"EEEE":b+=v.format(h);break;case"EEE":b+=m.format(h);break;case"HH":b+=Y(p.hour,2);break;case"H":b+=String(p.hour);break;case"hh":b+=Y(p.hour%12===0?12:p.hour%12,2);break;case"h":b+=String(p.hour%12===0?12:p.hour%12);break;case"mm":b+=Y(p.minute,2);break;case"m":b+=String(p.minute);break;case"ss":b+=Y(p.second,2);break;case"s":b+=String(p.second);break;case"SSS":b+=Y(p.ms,3);break;case"a":b+=p.hour<12?"AM":"PM";break;default:b+=O.text;break}}return b}}const k=[["year",365*24*36e5],["month",720*36e5],["week",168*36e5],["day",24*36e5],["hour",36e5],["minute",6e4],["second",1e3]];function g(a,s){const t=a||{},u=t.locale||s||void 0,r=t.nullDisplay??"",o=t.timeZone;let f;if(t.pattern)f=j(t.pattern,u,o);else if(t.dateStyle||t.timeStyle){const p={timeZone:o};t.dateStyle&&(p.dateStyle=t.dateStyle),t.timeStyle&&(p.timeStyle=t.timeStyle);const b=new Intl.DateTimeFormat(u,p);f=O=>b.format(O)}else{const p=new Intl.DateTimeFormat(u,{dateStyle:"medium",timeZone:o});f=b=>p.format(b)}const w=t.relative?new Intl.RelativeTimeFormat(u,{numeric:"auto"}):null,v=(typeof t.relative=="object"&&t.relative?t.relative.threshold??7:7)*24*36e5,h=(p,b)=>{const O=B(p);if(!O)return r;if(w){const y=b&&typeof b.now=="number"?b.now:Date.now(),L=O.getTime()-y;if(Math.abs(L)<v){for(const[M,D]of k)if(Math.abs(L)>=D||M==="second")return w.format(Math.round(L/D),M)}}return f(O)};return h.spec=t,h}function c(a){if(E(a)||a==="")return null;if(typeof a=="string"){const u=/^(\d{4}-\d{2}-\d{2})/.exec(a.trim());if(u)return u[1];const r=B(a);return r?c(r):null}const s=B(a);if(!s)return null;const t=u=>String(u).padStart(2,"0");return`${s.getFullYear()}-${t(s.getMonth()+1)}-${t(s.getDate())}`}function d(a,s){if(E(a)||a==="")return null;if(typeof a=="string"){const u=a.trim();if(l.test(u)){const f=B(u);return f?i(f,s):null}const r=/^(\d{4}-\d{2}-\d{2})[T ](\d{2}):(\d{2})(?::(\d{2}))?/.exec(u);if(r){const[,f,w,m,v]=r;return`${f}T${w}:${m}${v&&v!=="00"?`:${v}`:""}`}if(/^\d{4}-\d{2}-\d{2}$/.test(u))return`${u}T00:00`;const o=B(u);return o?d(o):null}const t=B(a);return t?i(t,s):null}const l=/(?:Z|[+-]\d{2}:?\d{2})$/i;function i(a,s){const t=f=>String(f).padStart(2,"0");if(s)try{const f=new Intl.DateTimeFormat("en-CA",{timeZone:s,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1}).formatToParts(a).reduce((v,h)=>(h.type!=="literal"&&(v[h.type]=h.value),v),{}),w=f.hour==="24"?"00":f.hour,m=Number(f.second);return`${f.year}-${f.month}-${f.day}T${w}:${f.minute}`+(m?`:${f.second}`:"")}catch{}const u=`${a.getFullYear()}-${t(a.getMonth()+1)}-${t(a.getDate())}`,r=a.getSeconds(),o=`${t(a.getHours())}:${t(a.getMinutes())}${r?`:${t(r)}`:""}`;return`${u}T${o}`}function n(a,s){const t=E(a)||a===""?null:String(a),u=E(s)||s===""?null:String(s);return t===null?u===null?0:1:u===null||t<u?-1:t>u?1:0}}),Ue("packages/core/src/format/boolean.js",function(e,U){"use strict";Object.defineProperty(e,"toTriState",{enumerable:!0,get:function(){return _}}),Object.defineProperty(e,"compileBoolean",{enumerable:!0,get:function(){return Z}});const E=U("packages/core/src/internal/predicates.js").isNil,q={true:"☑",false:"☐",null:""},z={true:"◉",false:"◯",null:""};function _(X){if(E(X)||X==="")return null;if(typeof X=="boolean")return X;if(typeof X=="number")return X!==0;const B=String(X).trim().toLowerCase();return B==="true"||B==="yes"||B==="y"||B==="1"?!0:B==="false"||B==="no"||B==="n"||B==="0"?!1:null}function Z(X,B){const Y=X||{},G=Y.display||"text",j=Y.trueLabel??"Yes",k=Y.falseLabel??"No",g=Y.nullLabel??"";let c=j,d=k;const l=g;G==="checkbox"?(c=q.true,d=q.false):G==="switch"?(c=z.true,d=z.false):G==="icon"&&(c=Y.trueIcon??j,d=Y.falseIcon??k);const i=n=>{const a=_(n);return a===null?l:a?c:d};return i.display=G,i.labels={true:j,false:k,null:g},i.locale=B,i.spec=Y,i}}),Ue("packages/core/src/format/text.js",function(e,U){"use strict";Object.defineProperty(e,"compileText",{enumerable:!0,get:function(){return _}});const E=U("packages/core/src/internal/predicates.js").isNil,z=U("packages/core/src/internal/text.js").titleCase;function _(Z,X){const B=Z||{},Y=B.locale||X||void 0,G=B.nullDisplay??"",j=B.emptyDisplay??"",k=B.transform||"none",g=typeof B.truncate=="number"?{chars:B.truncate}:B.truncate||null,c=g?g.chars:0,d=g?g.ellipsis??"…":"",l=n=>{switch(k){case"upper":return Y?n.toLocaleUpperCase(Y):n.toUpperCase();case"lower":return Y?n.toLocaleLowerCase(Y):n.toLowerCase();case"title":return z(n);default:return n}},i=n=>{if(E(n))return G;let a=typeof n=="string"?n:String(n);return a===""?j:(k!=="none"&&(a=l(a)),c>0&&a.length>c&&(a=a.slice(0,c)+d),a)};return i.spec=B,i}}),Ue("packages/core/src/format/shorthand.js",function(e,U){"use strict";Object.defineProperty(e,"looksLikeMask",{enumerable:!0,get:function(){return z}}),Object.defineProperty(e,"looksLikeDatePattern",{enumerable:!0,get:function(){return _}}),Object.defineProperty(e,"parseShorthand",{enumerable:!0,get:function(){return X}});const te=["currency","number","percent","date","boolean","text","relative"],E=/[#0?@;"\\]/,q=/(yyyy|yy|MMMM|MMM|MM|EEEE|EEE|dd|HH|hh|mm|ss|SSS)/;function z(B){return typeof B!="string"||B===""||Z(B)?!1:E.test(B)}function _(B){return typeof B!="string"||B===""||Z(B)?!1:q.test(B)}function Z(B){const Y=B.indexOf(":"),G=Y===-1?B:B.slice(0,Y);return te.includes(G)?G:null}function X(B){const Y=Z(B);if(!Y)return null;const G=B.indexOf(":"),j=G===-1?"":B.slice(G+1),k=j===""?[]:j.split(":");switch(Y){case"currency":{const g={type:"number",style:"currency",currency:k[0]||"USD"};return k[1]!==void 0&&k[1]!==""&&(g.decimals=Number(k[1])),g}case"number":{const g={type:"number",style:"decimal"};return k[0]!==void 0&&k[0]!==""&&(g.decimals=Number(k[0])),g}case"percent":{const g={type:"number",style:"percent"};return k[0]!==void 0&&k[0]!==""&&(g.decimals=Number(k[0])),g}case"date":return{type:"date",pattern:j||void 0};case"relative":return{type:"date",relative:!0};case"boolean":{const g=j.split("/"),c={type:"boolean",display:"text"};return g[0]!==void 0&&g[0]!==""&&(c.trueLabel=g[0]),g[1]!==void 0&&g[1]!==""&&(c.falseLabel=g[1]),g[2]!==void 0&&(c.nullLabel=g[2]),c}case"text":{const g={type:"text"};return k[0]&&(g.transform=k[0]),k[1]!==void 0&&k[1]!==""&&(g.truncate=Number(k[1])),g}default:return null}}}),Ue("packages/core/src/format/index.js",function(e,U){"use strict";Object.defineProperty(e,"compileFormat",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"specToOoxml",{enumerable:!0,get:function(){return y}});const te=U("packages/core/src/internal/predicates.js"),E=te.isFunction,q=te.isObject,_=U("packages/core/src/internal/warn.js").warnOnce,Z=U("packages/core/src/format/number.js"),X=Z.compileNumber,B=U("packages/core/src/format/date.js"),Y=B.compileDate,G=B.scanPattern,j=U("packages/core/src/format/boolean.js"),k=j.compileBoolean,g=U("packages/core/src/format/text.js"),c=g.compileText,d=U("packages/core/src/format/mask.js"),l=d.compileMask,i=U("packages/core/src/format/shorthand.js"),n=i.parseShorthand,a=i.looksLikeMask,s=i.looksLikeDatePattern,u=U("packages/core/src/format/pattern.js").parseNumberPattern;Object.defineProperty(e,"compileNumber",{enumerable:!0,get:function(){return Z.compileNumber}}),Object.defineProperty(e,"compileDate",{enumerable:!0,get:function(){return B.compileDate}}),Object.defineProperty(e,"compilePattern",{enumerable:!0,get:function(){return B.compilePattern}}),Object.defineProperty(e,"scanPattern",{enumerable:!0,get:function(){return B.scanPattern}}),Object.defineProperty(e,"toDate",{enumerable:!0,get:function(){return B.toDate}}),Object.defineProperty(e,"compileBoolean",{enumerable:!0,get:function(){return j.compileBoolean}}),Object.defineProperty(e,"toTriState",{enumerable:!0,get:function(){return j.toTriState}}),Object.defineProperty(e,"compileText",{enumerable:!0,get:function(){return g.compileText}}),Object.defineProperty(e,"compileMask",{enumerable:!0,get:function(){return d.compileMask}}),Object.defineProperty(e,"splitSections",{enumerable:!0,get:function(){return d.splitSections}}),Object.defineProperty(e,"parseSection",{enumerable:!0,get:function(){return d.parseSection}}),Object.defineProperty(e,"parseShorthand",{enumerable:!0,get:function(){return i.parseShorthand}}),Object.defineProperty(e,"looksLikeMask",{enumerable:!0,get:function(){return i.looksLikeMask}}),Object.defineProperty(e,"looksLikeDatePattern",{enumerable:!0,get:function(){return i.looksLikeDatePattern}});const r=new Set(["decimal","currency","percent","unit"]),o=new Set(["type","locale"]),f={number:new Set(["style","currency","currencyDisplay","decimals","minDecimals","maxDecimals","thousandsSeparator","decimalSeparator","notation","compactDisplay","negative","negativeClass","signed","prefix","suffix","zeroDisplay","nullDisplay","messages","scale","pattern"]),date:new Set(["pattern","dateStyle","timeStyle","timeZone","relative","nullDisplay"]),boolean:new Set(["display","trueLabel","falseLabel","nullLabel","trueIcon","falseIcon"]),text:new Set(["transform","truncate","nullDisplay","emptyDisplay"])},w=new Set(["number","date","boolean","text"]);function m(F,T){const I=F.type;if(I===void 0||w.has(I)||!r.has(String(I)))return;const P=T?`"${T}"`:"with no id";_(`format:unknown-style-key:${T||""}:${I}`,`column ${P} has format: { type: "${I}" }, which is not a valid format type ("number", "date", "boolean" or "text") and is ignored; did you mean style: "${I}" instead?`)}function v(F,T,I){const P=f[T],R=I?`"${I}"`:"with no id";for(const $ of F){if(o.has($)||P.has($))continue;const C=Object.keys(f).find(A=>A!==T&&f[A].has($));C?_(`format:inapplicable:${I||""}:${$}`,`column ${R} has format key "${$}", which applies to a ${C} column, not the ${T} column it was applied to; it is ignored.`):_(`format:unknown:${I||""}:${$}`,`column ${R} has an unrecognised format key "${$}" for its ${T} format; it is ignored.`)}}function h(F){if(F.type==="number"||F.type==="date"||F.type==="boolean"||F.type==="text")return!0;const T=r.has(String(F.style));return!!(F.pattern||F.dateStyle||F.timeStyle||F.relative||F.timeZone||F.trueLabel||F.falseLabel||F.display||F.trueIcon||F.falseIcon||F.transform||F.truncate||F.emptyDisplay||T||F.currency||F.decimals!==void 0||F.minDecimals!==void 0||F.maxDecimals!==void 0||F.notation||F.negative||F.scale!==void 0||F.prefix||F.suffix||F.zeroDisplay!==void 0)}function p(F,T){if(F.type==="number"||F.type==="date"||F.type==="boolean"||F.type==="text")return F.type;if(F.pattern){if(a(F.pattern))return"number";if(s(F.pattern))return"date"}if(F.dateStyle||F.timeStyle||F.relative||F.timeZone)return"date";if(F.trueLabel||F.falseLabel||F.display||F.trueIcon||F.falseIcon)return"boolean";if(F.transform||F.truncate||F.emptyDisplay)return"text";if(F.style||F.currency||F.decimals!==void 0||F.minDecimals!==void 0||F.maxDecimals!==void 0||F.notation||F.negative||F.scale!==void 0||F.prefix||F.suffix||F.zeroDisplay!==void 0)return"number";const I=T&&T.base;return I==="number"?"number":I==="date"||I==="dateString"?"date":I==="boolean"?"boolean":"text"}function b(F,T=null,I=void 0,P=void 0,R=void 0){if(F==null||F==="")return null;const $=q(F)?Object.keys(F):null;if(typeof F=="function"){const S=(x,H)=>String(F({...H||{},value:x,locale:I})??"");return S.ooxml=T&&T.excel||"General",S}if(typeof F=="string"){if(a(F)){const{format:x,ooxml:H}=l(F,I);return x.ooxml=H,x}const S=n(F)||(s(F)?{type:"date",pattern:F}:null);return S?b(S,T,I,P,R):(_(`format:${F}`,`unrecognised format string "${F}"; the value will be stringified`),null)}if(!q(F))return _("format:shape","format must be a spec object or a string; ignoring",F),null;if(T&&E(T.format)&&!h(F)||T&&E(T.format)&&Array.isArray(T.formatPatterns)&&F.type===void 0)return null;const C=p(F,T);C==="date"&&P&&F.timeZone===void 0&&(F={...F,timeZone:P}),m(F,R),v($||Object.keys(F),C,R);let A;switch(C){case"number":A=X(F,I);break;case"date":A=Y(F,I);break;case"boolean":A=k(F,I);break;default:A=c(F,I);break}return A.ooxml=y(F,C,I,T),A.kind=C,A}const O={yyyy:"yyyy",yy:"yy",MMMM:"mmmm",MMM:"mmm",MM:"mm",M:"m",dd:"dd",d:"d",EEEE:"dddd",EEE:"ddd",HH:"hh",H:"h",hh:"hh",h:"h",mm:"mm",m:"m",ss:"ss",s:"s",SSS:"000",a:"AM/PM"};function y(F,T,I=void 0,P=null){if(T==="date"){if(F.pattern){let S="";for(const x of G(F.pattern))S+=x.token?O[x.token]??x.text:x.text;return S}return P&&P.excel||"yyyy-mm-dd"}if(T==="boolean")return"General";if(T==="text")return"@";if(typeof F.pattern=="string"&&u(F.pattern))return String(F.pattern).trim();if(F.notation==="compact"||F.notation==="scientific")return"General";const R=typeof F.decimals=="number"?F.decimals:typeof F.minDecimals=="number"?F.minDecimals:F.style==="currency"?2:0;let C=`${F.thousandsSeparator===!1?"":"#,#"}#0${R>0?`.${"0".repeat(R)}`:""}`,A="";return F.style==="currency"&&(A+=L(D(F.currency||"USD",I))),F.prefix&&(A+=L(F.prefix)),C=A+C,F.style==="percent"&&(C=`${C}%`),F.suffix&&(C+=L(F.suffix)),F.negative==="parentheses"?`${C};(${C})`:F.negative==="suffix"?`${C};${C}-`:C}function L(F){return`"${String(F).split('"').join("")}"`}const M=new Map;function D(F,T){const I=`${F}|${T||""}`;let P=M.get(I);if(P!==void 0)return P;P=F;try{const $=new Intl.NumberFormat(T,{style:"currency",currency:F}).formatToParts(0).find(C=>C.type==="currency");$&&(P=$.value)}catch{}return M.set(I,P),P}}),Ue("packages/core/src/columns/types/temporal.js",function(e,U){"use strict";Object.defineProperty(e,"MS_SECOND",{enumerable:!0,get:function(){return k}}),Object.defineProperty(e,"MS_MINUTE",{enumerable:!0,get:function(){return g}}),Object.defineProperty(e,"MS_HOUR",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"MS_DAY",{enumerable:!0,get:function(){return d}}),Object.defineProperty(e,"MS_WEEK",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"parseTime",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"toTimeMs",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"formatTime",{enumerable:!0,get:function(){return v}}),Object.defineProperty(e,"zonedParts",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"zoneOffsetAt",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"instantFromParts",{enumerable:!0,get:function(){return M}}),Object.defineProperty(e,"parseDateTime",{enumerable:!0,get:function(){return T}}),Object.defineProperty(e,"toEpochMs",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"formatDateTime",{enumerable:!0,get:function(){return $}}),Object.defineProperty(e,"parseDuration",{enumerable:!0,get:function(){return re}}),Object.defineProperty(e,"toDurationMs",{enumerable:!0,get:function(){return ae}}),Object.defineProperty(e,"formatDuration",{enumerable:!0,get:function(){return pe}}),Object.defineProperty(e,"zoneAbbrev",{enumerable:!0,get:function(){return ie}}),Object.defineProperty(e,"resolveZoneName",{enumerable:!0,get:function(){return Oe}}),Object.defineProperty(e,"zoneLabel",{enumerable:!0,get:function(){return je}}),Object.defineProperty(e,"formatInstant",{enumerable:!0,get:function(){return fe}}),Object.defineProperty(e,"bucketInstant",{enumerable:!0,get:function(){return Ee}}),Object.defineProperty(e,"timestampGroupProjector",{enumerable:!0,get:function(){return le}}),Object.defineProperty(e,"TEMPORAL_TYPES",{enumerable:!0,get:function(){return de}}),Object.defineProperty(e,"TEMPORAL_INFERENCE_ORDER",{enumerable:!0,get:function(){return Se}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return Fe}});const te=U("packages/core/src/internal/predicates.js"),E=te.isNil,q=te.isFunction,z=U("packages/core/src/format/date.js"),_=z.toDate,Z=z.compilePattern,X=z.compileDate,B=z.toIsoDateTime,Y=z.compareIso,G=864e5,j=Object.freeze({}),k=1e3,g=60*k,c=60*g,d=24*c,l=7*d,i=new WeakMap;function n(ke,Ie){const Be=ke&&ke.locale||"",Ke=ke&&ke.column;if(!Ke)return Be?{locale:Be}:j;const rt=i.get(Ke);if(rt&&rt.locale===Be)return rt.bag;const tt=Ke.typeOptions||Ke[Ie]||(a(Ke.format)?Ke.format:null),pt={...tt||j,locale:tt&&tt.locale||Be||void 0};return i.set(Ke,{locale:Be,bag:pt}),pt}function a(ke){return ke!==null&&typeof ke=="object"&&!Array.isArray(ke)&&!(ke instanceof Date)}function s(ke,Ie){const Be=ke===null||Number.isNaN(ke)?null:ke,Ke=Ie===null||Number.isNaN(Ie)?null:Ie;return Be===null?Ke===null?0:1:Ke===null||Be<Ke?-1:Be>Ke?1:0}const t=/^(\d{1,2})(?:\s*[:.h]\s*(\d{1,2})(?:\s*[:.]\s*(\d{1,2})(?:[.,](\d{1,3}))?)?)?\s*(a\.?m\.?|p\.?m\.?|a|p)?$/i,u=/^(\d{3,6})$/;function r(ke,Ie,Be,Ke){return!(ke>=0&&ke<=23)||!(Ie>=0&&Ie<=59)||!(Be>=0&&Be<=59)||!(Ke>=0&&Ke<=999)?null:ke*c+Ie*g+Be*k+Ke}function o(ke){if(E(ke))return null;const Ie=String(ke).trim();if(Ie==="")return null;const Be=u.exec(Ie);if(Be){const Pt=Be[1];if(Pt.length===5)return null;const Ct=Pt.length===3?1:2;return r(Number(Pt.slice(0,Ct)),Number(Pt.slice(Ct,Ct+2)),Number(Pt.slice(Ct+2,Ct+4)||0),0)}const Ke=t.exec(Ie);if(!Ke)return null;let rt=Number(Ke[1]);const tt=Number(Ke[2]||0),pt=Number(Ke[3]||0),yt=Ke[4]?Number(Ke[4].padEnd(3,"0")):0,kt=Ke[5]?Ke[5][0].toLowerCase():null;if(kt){if(rt<1||rt>12)return null;rt=rt%12,kt==="p"&&(rt+=12)}return r(rt,tt,pt,yt)}function f(ke){return E(ke)||ke===""?null:typeof ke=="number"?Number.isFinite(ke)?(ke%d+d)%d:null:ke instanceof Date?Number.isNaN(ke.getTime())?null:ke.getHours()*c+ke.getMinutes()*g+ke.getSeconds()*k+ke.getMilliseconds():o(ke)}const w=new Map;function m(ke){const Ie=ke.pattern||"",Be=ke.timeStyle||(ke.seconds?"medium":"short"),Ke=`${ke.locale||""}|${Ie}|${Be}`;let rt=w.get(Ke);if(rt)return rt;if(Ie)rt=Z(Ie,ke.locale||void 0,"UTC");else{const tt=new Intl.DateTimeFormat(ke.locale||void 0,{timeStyle:Be,timeZone:"UTC"});rt=pt=>tt.format(pt)}return w.set(Ke,rt),rt}function v(ke,Ie){const Be=Ie||j;if(ke==null||typeof ke!="number"||!Number.isFinite(ke))return Be.nullDisplay??"";const Ke=(ke%d+d)%d;return m(Be)(new Date(Ke))}function h(ke){return ke instanceof Date?!Number.isNaN(ke.getTime()):typeof ke=="number"?Number.isFinite(ke)&&ke>=0&&ke<d:typeof ke!="string"||!ke.includes(":")?!1:o(ke)!==null}function p(ke){const Ie=f(ke);return Ie==null?"":v(Ie,{pattern:Ie%k===0?"HH:mm:ss":"HH:mm:ss.SSS"})}const b=new Map;function O(ke){const Ie=ke||"";let Be=b.get(Ie);return Be||(Be=new Intl.DateTimeFormat("en-GB",{timeZone:ke||void 0,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1}),b.set(Ie,Be)),Be}function y(ke,Ie){const Be={year:1970,month:1,day:1,hour:0,minute:0,second:0};for(const Ke of O(Ie).formatToParts(new Date(ke)))Ke.type==="year"?Be.year=Number(Ke.value):Ke.type==="month"?Be.month=Number(Ke.value):Ke.type==="day"?Be.day=Number(Ke.value):Ke.type==="hour"?Be.hour=Number(Ke.value)%24:Ke.type==="minute"?Be.minute=Number(Ke.value):Ke.type==="second"&&(Be.second=Number(Ke.value));return Be}function L(ke,Ie){const Be=y(ke,Ie);return Date.UTC(Be.year,Be.month-1,Be.day,Be.hour,Be.minute,Be.second,0)-Math.floor(ke/1e3)*1e3}function M(ke,Ie){const Be=ke.hour||0,Ke=ke.minute||0,rt=ke.second||0,tt=ke.ms||0;if(!Ie)return new Date(ke.year,ke.month-1,ke.day,Be,Ke,rt,tt).getTime();const pt=Date.UTC(ke.year,ke.month-1,ke.day,Be,Ke,rt,tt);let yt=pt-L(pt,Ie);return yt=pt-L(yt,Ie),yt}const D=/(?:Z|[+-]\d{2}:?\d{2})$/i,F=/^(\d{4})-(\d{1,2})-(\d{1,2})(?:[T\s]+(.*))?$/;function T(ke,Ie){if(E(ke))return null;const Be=String(ke).trim();if(Be==="")return null;const Ke=Ie&&Ie.timeZone||void 0;if(!D.test(Be)){const rt=F.exec(Be);if(rt){const tt=(rt[4]||"").trim(),pt=tt===""?0:o(tt);if(pt===null)return null;const yt=M({year:Number(rt[1]),month:Number(rt[2]),day:Number(rt[3]),hour:Math.floor(pt/c),minute:Math.floor(pt/g)%60,second:Math.floor(pt/k)%60,ms:pt%k},Ke);return Number.isNaN(yt)?null:new Date(yt)}}return _(Be)}function I(ke){if(typeof ke=="number")return Number.isFinite(ke)?ke:null;const Ie=_(ke);return Ie?Ie.getTime():null}const P=new Map;function R(ke){const Ie=[ke.locale||"",ke.pattern||"",ke.dateStyle||"",ke.timeStyle||"",ke.timeZone||"",ke.seconds?"1":""].join("|");let Be=P.get(Ie);if(Be)return Be;const Ke=ke.pattern?{type:"date",pattern:ke.pattern,timeZone:ke.timeZone}:{type:"date",dateStyle:ke.dateStyle||"medium",timeStyle:ke.timeStyle||(ke.seconds?"medium":"short"),timeZone:ke.timeZone};return Be=X(Ke,ke.locale||void 0),P.set(Ie,Be),Be}function $(ke,Ie){const Be=Ie||j,Ke=I(ke);return Ke==null?Be.nullDisplay??"":R(Be)(Ke)}function C(ke){return ke instanceof Date?!Number.isNaN(ke.getTime()):typeof ke!="string"||!F.test(ke.trim())?!1:T(ke)!==null}const A=Object.freeze([{key:"w",ms:l,intl:"week",long:["week","weeks"],names:["w","wk","wks","week","weeks"]},{key:"d",ms:d,intl:"day",long:["day","days"],names:["d","dy","day","days"]},{key:"h",ms:c,intl:"hour",long:["hour","hours"],names:["h","hr","hrs","hour","hours"]},{key:"m",ms:g,intl:"minute",long:["minute","minutes"],names:["m","min","mins","minute","minutes"]},{key:"s",ms:k,intl:"second",long:["second","seconds"],names:["s","sec","secs","second","seconds"]},{key:"ms",ms:1,intl:"millisecond",long:["millisecond","milliseconds"],names:["ms","msec","msecs","milli","millis","millisecond","milliseconds"]}]),S=new Map;for(const ke of A)for(const Ie of ke.names)S.set(Ie,ke);const x=Object.freeze(A.filter(ke=>ke.key!=="w")),H=/^(\d+(?:\.\d+)?)\s*([a-z]+)\s*(?:,\s*)?/,V=/^\d+(?:\.\d+)?$/,W=/^(\d+):([0-5]?\d)(?::([0-5]?\d))?(?:\.(\d{1,3}))?$/;function Q(ke){const Ie=ke&&ke.defaultUnit?S.get(String(ke.defaultUnit).toLowerCase()):null;return Ie?Ie.ms:g}function ee(ke){return(ke&&ke.defaultUnit?S.get(String(ke.defaultUnit).toLowerCase()):null)||S.get("m")}function re(ke,Ie){if(E(ke))return null;let Be=String(ke).trim().toLowerCase();if(Be==="")return null;let Ke=1;if(Be[0]==="-"?(Ke=-1,Be=Be.slice(1).trim()):Be[0]==="+"&&(Be=Be.slice(1).trim()),Be==="")return null;const rt=W.exec(Be);if(rt){const kt=rt[3]!==void 0,Pt=Number(rt[1])*c+Number(rt[2])*g+(kt?Number(rt[3])*k:0)+(rt[4]?Number(rt[4].padEnd(3,"0")):0);return Ke*Pt}if(V.test(Be))return Math.round(Ke*Number(Be)*Q(Ie||j));let tt=Be,pt=0,yt=0;for(;tt!=="";){const kt=H.exec(tt);if(!kt)return null;const Pt=S.get(kt[2]);if(!Pt)return null;pt+=Number(kt[1])*Pt.ms,tt=tt.slice(kt[0].length),yt++}return yt===0?null:Math.round(Ke*pt)}function ae(ke){return E(ke)||ke===""?null:typeof ke=="number"?Number.isFinite(ke)?ke:null:re(ke)}const ue=new Map;function ge(ke,Ie,Be){const Ke=`${Be||""}|${Ie.intl}`;let rt=ue.get(Ke);if(rt===void 0){try{rt=new Intl.NumberFormat(Be||void 0,{style:"unit",unit:Ie.intl,unitDisplay:"long"})}catch{rt=null}ue.set(Ke,rt)}return rt?rt.format(ke):`${ke} ${ke===1?Ie.long[0]:Ie.long[1]}`}function Ae(ke,Ie){return String(ke).padStart(Ie,"0")}function pe(ke,Ie){const Be=Ie||j;if(ke==null||typeof ke!="number"||!Number.isFinite(ke))return Be.nullDisplay??"";const Ke=Be.style||"short",rt=ke<0;let tt=Math.round(Math.abs(ke));const pt=rt?"-":"";if(tt===0&&Be.zeroDisplay!=null)return Be.zeroDisplay;if(Ke==="clock"){const Ct=Math.floor(tt/c),Lt=Math.floor(tt/g)%60,Rt=Math.floor(tt/k)%60;return`${pt}${Ae(Ct,2)}:${Ae(Lt,2)}:${Ae(Rt,2)}`}if(tt===0){const Ct=ee(Be);return Ke==="long"?ge(0,Ct,Be.locale):`0${Ct.key}`}const yt=Be.weeks===!0?A:x,kt=typeof Be.maxUnits=="number"&&Be.maxUnits>0?Be.maxUnits:Be.maxUnits===void 0?2:1/0,Pt=[];for(const Ct of yt){if(Pt.length>=kt)break;const Lt=Math.floor(tt/Ct.ms);Lt!==0&&(tt-=Lt*Ct.ms,Pt.push(Ke==="long"?ge(Lt,Ct,Be.locale):`${Lt}${Ct.key}`))}return pt+Pt.join(" ")}function Me(ke){if(typeof ke!="string")return!1;const Ie=ke.trim();return Ie===""||W.test(Ie)||!/[a-z]/i.test(Ie)?!1:re(Ie)!==null}const Ne=Date.UTC(1899,11,30),Pe=new Map;function ie(ke,Ie){const Be=ke||"";let Ke=Pe.get(Be);Ke||(Ke=new Intl.DateTimeFormat("en-GB",{timeZone:ke||void 0,timeZoneName:"short",hour:"2-digit",hour12:!1}),Pe.set(Be,Ke));const rt=typeof Ie=="number"?Ie:Date.now();for(const tt of Ke.formatToParts(new Date(rt)))if(tt.type==="timeZoneName")return tt.value;return""}function Oe(ke){if(ke)return ke;try{return new Intl.DateTimeFormat().resolvedOptions().timeZone||"UTC"}catch{return"UTC"}}function je(ke,Ie){const Be=Oe(ke),Ke=ie(ke,Ie);return Ke?`${Be} (${Ke})`:Be}function Ce(ke,Ie){if(ke&&ke.timeZone)return ke.timeZone;const Be=Ie&&Ie.grid;return(Be&&q(Be.get)?Be.get("timeZone"):void 0)||void 0}function fe(ke,Ie){const Be=Ie||j,Ke=I(ke);if(Ke==null)return Be.nullDisplay??"";const rt=R(Be)(Ke);if(!Be.showOrigin)return rt;const tt=Be.originZone;return tt?tt===(Be.timeZone||Oe(Be.timeZone))?rt:`${rt} (${je(tt,Ke)})`:`${rt} (no origin recorded)`}function Ee(ke,Ie,Be,Ke){if(Ie==="instant"||!Ie)return ke;const rt=y(ke,Be);if(Ie==="month")return M({year:rt.year,month:rt.month,day:1},Be);if(Ie==="week"){const tt=Ke>=1&&Ke<=7?Ke:1,yt=((new Date(Date.UTC(rt.year,rt.month-1,rt.day)).getUTCDay()+6)%7+1-tt+7)%7,kt=new Date(Date.UTC(rt.year,rt.month-1,rt.day-yt));return M({year:kt.getUTCFullYear(),month:kt.getUTCMonth()+1,day:kt.getUTCDate()},Be)}return M({year:rt.year,month:rt.month,day:rt.day},Be)}function le(ke,Ie){const Be=ke&&ke.group,Ke=Be&&Be.granularity||"day";if(Ke==="instant")return null;const rt=Be&&Be.weekStart;return tt=>typeof tt=="number"?Ee(tt,Ke,Ie,rt):tt}const de={time:{base:"number",storage:"float64",matches:h,format:ke=>v(f(ke.value),n(ke,"time")),parse:ke=>o(ke.text),compare:(ke,Ie)=>s(f(ke),f(Ie)),defaults:{filter:"number",editor:"time",align:"start"},excel:"hh:mm:ss",excelKind:"number",toExcelValue:ke=>{const Ie=f(ke);return Ie===null?null:Ie/G},toStorage:ke=>f(ke),toClipboard:p,fromClipboard:o},datetime:{base:"dateString",storage:"dictionary",matches:C,format:ke=>$(ke.value,n(ke,"datetime")),parse:ke=>B(T(ke.text,n(ke,"datetime"))??ke.text),compare:Y,defaults:{filter:"date",editor:"datetime",align:"start"},excel:"yyyy-mm-dd hh:mm",toStorage:(ke,Ie)=>B(ke,Ie&&Ie.timeZone),toClipboard:ke=>E(ke)?"":String(ke),fromClipboard:ke=>B(ke)},duration:{base:"number",storage:"float64",matches:Me,format:ke=>pe(ae(ke.value),n(ke,"duration")),parse:ke=>re(ke.text,n(ke,"duration")),compare:(ke,Ie)=>s(ae(ke),ae(Ie)),defaults:{filter:"number",editor:"duration",align:"end",total:"sum"},excel:"[h]:mm:ss",excelKind:"number",toExcelValue:ke=>{const Ie=ae(ke);return Ie===null?null:Ie/G},toStorage:ke=>ae(ke),toClipboard:ke=>pe(ae(ke),{style:"short",maxUnits:-1}),fromClipboard:ke=>re(ke)},timestamp:{base:"number",storage:"float64",format:ke=>{const Ie=n(ke,"timestamp");return fe(ke.value,{...Ie,timeZone:Ce(Ie,ke)})},parse:ke=>{const Ie=n(ke,"timestamp"),Be=T(ke.text,{timeZone:Ce(Ie,ke)});return Be?Be.getTime():null},compare:(ke,Ie)=>s(I(ke),I(Ie)),groupProjector:(ke,Ie)=>le(ke,Ie),defaults:{filter:"date",editor:"datetime",align:"start"},excel:"yyyy-mm-dd hh:mm",excelKind:"number",toExcelValue:(ke,Ie)=>{const Be=I(ke);if(Be==null)return null;const Ke=y(Be,Ie&&Ie.timeZone||void 0);return(Date.UTC(Ke.year,Ke.month-1,Ke.day,Ke.hour,Ke.minute,Ke.second)-Ne)/G},toStorage:ke=>I(ke),toClipboard:ke=>{const Ie=I(ke);return Ie==null?"":new Date(Ie).toISOString()},fromClipboard:ke=>I(ke)}},Se=["datetime","time","duration"],Fe=de}),Ue("packages/core/src/internal/lru.js",function(e,U){"use strict";Object.defineProperty(e,"Lru",{enumerable:!0,get:function(){return te}});class te{#e;#t=new Map;#n;constructor(q=256,z=null){this.#e=q,this.#n=z}get size(){return this.#t.size}get max(){return this.#e}set max(q){this.#e=q,this.#r()}has(q){return this.#t.has(q)}get(q){const z=this.#t;if(!z.has(q))return;const _=z.get(q);return z.delete(q),z.set(q,_),_}peek(q){return this.#t.get(q)}set(q,z){const _=this.#t;return _.has(q)&&_.delete(q),_.set(q,z),this.#r(),z}delete(q){const z=this.#t.get(q);return this.#t.delete(q)&&this.#n&&this.#n(z,q),z}clear(){if(this.#n)for(const[q,z]of this.#t)this.#n(z,q);this.#t.clear()}keys(){return this.#t.keys()}values(){return this.#t.values()}#r(){const q=this.#t;for(;q.size>this.#e;){const z=q.keys().next().value,_=q.get(z);q.delete(z),this.#n&&this.#n(_,z)}}}}),Ue("packages/core/src/columns/types/network.js",function(e,U){"use strict";Object.defineProperty(e,"toUint32",{enumerable:!0,get:function(){return X}}),Object.defineProperty(e,"parseIpv4",{enumerable:!0,get:function(){return B}}),Object.defineProperty(e,"formatIpv4",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(e,"isIpv4",{enumerable:!0,get:function(){return G}}),Object.defineProperty(e,"compareIpv4",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"packCidr",{enumerable:!0,get:function(){return d}}),Object.defineProperty(e,"cidrParts",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"parseCidr",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"formatCidr",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"isCidr",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"compareCidr",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"netmask",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"networkAddress",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"broadcastAddress",{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,"addressCount",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"hostCount",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"containsAddress",{enumerable:!0,get:function(){return w}}),Object.defineProperty(e,"overlaps",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"ipv6Groups",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"parseIpv6",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"formatIpv6",{enumerable:!0,get:function(){return M}}),Object.defineProperty(e,"isIpv6",{enumerable:!0,get:function(){return D}}),Object.defineProperty(e,"compareIpv6",{enumerable:!0,get:function(){return F}}),Object.defineProperty(e,"NETWORK_TYPES",{enumerable:!0,get:function(){return T}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return I}});const E=U("packages/core/src/internal/predicates.js").isNil,z=U("packages/core/src/internal/lru.js").Lru,_=4294967295,Z=/^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/;function X(P){if(E(P))return null;if(typeof P=="string")return B(P);const R=Number(P);return Number.isFinite(R)?R<0?R<-2147483648?null:R>>>0:R>_?null:Math.trunc(R)>>>0:null}function B(P){if(E(P))return null;const R=String(P).trim();if(R==="")return null;const $=Z.exec(R);if(!$)return null;let C=0;for(let A=1;A<=4;A++){const S=$[A];if(S.length>1&&S.charCodeAt(0)===48)return null;const x=Number(S);if(x>255)return null;C=C*256+x}return C}function Y(P){const R=X(P);return R===null?"":`${R>>>24&255}.${R>>>16&255}.${R>>>8&255}.${R&255}`}function G(P){return typeof P=="string"&&B(P)!==null}function j(P,R){const $=X(P),C=X(R);return $===null?C===null?0:1:C===null||$<C?-1:$>C?1:0}const k=64,g=_*k+32,c=/^(?:0|[1-9]\d?)$/;function d(P,R){return P*k+R}function l(P){if(E(P))return null;if(typeof P=="string"){const C=i(P);return C===null?null:l(C)}if(typeof P=="object"){const C=X(P.address),A=Number(P.prefix);return C===null||!Number.isInteger(A)||A<0||A>32?null:{address:C,prefix:A}}const R=Number(P);if(!Number.isInteger(R)||R<0||R>g)return null;const $=R%k;return $>32?null:{address:(R-$)/k,prefix:$}}function i(P){if(E(P))return null;const R=String(P).trim();if(R==="")return null;const $=R.indexOf("/");if($<0)return null;const C=B(R.slice(0,$));if(C===null)return null;const A=R.slice($+1).trim();if(!c.test(A))return null;const S=Number(A);return S>32?null:d(C,S)}function n(P){const R=l(P);return R?`${Y(R.address)}/${R.prefix}`:""}function a(P){return typeof P=="string"&&i(P)!==null}function s(P,R){const $=l(P),C=l(R);return $?C?$.address!==C.address?$.address<C.address?-1:1:$.prefix-C.prefix:-1:C?1:0}function t(P){return P===0?0:4294967295<<32-P>>>0}function u(P){const R=l(P);return R?(R.address&t(R.prefix))>>>0:null}function r(P){const R=l(P);return R?(R.address&t(R.prefix)|~t(R.prefix)>>>0)>>>0:null}function o(P){const R=l(P);return R?2**(32-R.prefix):null}function f(P){const R=l(P);return R?R.prefix===32?1:R.prefix===31?2:2**(32-R.prefix)-2:null}function w(P,R){const $=l(P);if(!$)return!1;const C=X(R);if(C===null)return!1;const A=t($.prefix);return(C&A)>>>0===($.address&A)>>>0}function m(P,R){const $=u(P),C=u(R);return $===null||C===null?!1:$<=r(R)&&C<=r(P)}const v=/^[0-9a-fA-F]{1,4}$/,h=new z(512);function p(P){if(E(P))return null;let R=String(P).trim();if(R==="")return null;const $=R.indexOf("%");if($>=0&&(R=R.slice(0,$)),R==="")return null;if(R.indexOf(".")>=0){const V=R.lastIndexOf(":");if(V<0)return null;const W=B(R.slice(V+1));if(W===null)return null;R=`${R.slice(0,V+1)}${(W>>>16&65535).toString(16)}:${(W&65535).toString(16)}`}const C=R.split("::");if(C.length>2)return null;const A=b(C[0]);if(A===null)return null;if(C.length===1)return A.length===8?A:null;const S=b(C[1]);if(S===null)return null;const x=8-A.length-S.length;if(x<1)return null;const H=A.slice();for(let V=0;V<x;V++)H.push(0);for(const V of S)H.push(V);return H}function b(P){if(P==="")return[];const R=[];for(const $ of P.split(":")){if(!v.test($))return null;R.push(parseInt($,16))}return R}function O(P){if(typeof P!="string")return p(P);if(h.has(P))return h.get(P);const R=p(P);return h.set(P,R),R}function y(P){if(P[0]===0&&P[1]===0&&P[2]===0&&P[3]===0&&P[4]===0&&P[5]===65535)return`::ffff:${Y((P[6]<<16|P[7])>>>0)}`;let R=-1,$=0,C=-1,A=0;for(let H=0;H<8;H++)P[H]===0?(C<0?(C=H,A=1):A++,A>$&&($=A,R=C)):(C=-1,A=0);if($<2)return P.map(H=>H.toString(16)).join(":");const S=P.slice(0,R).map(H=>H.toString(16)).join(":"),x=P.slice(R+$).map(H=>H.toString(16)).join(":");return`${S}::${x}`}function L(P){const R=p(P);return R===null?null:y(R)}function M(P){return L(P)??""}function D(P){return typeof P=="string"&&P.indexOf(":")>=0&&p(P)!==null}function F(P,R){const $=O(P),C=O(R);if(!$)return C?1:0;if(!C)return-1;for(let A=0;A<8;A++)if($[A]!==C[A])return $[A]<C[A]?-1:1;return 0}const T=Object.freeze({ipv4:{base:"number",storage:"int32",unsignedInt32:!0,matches:G,parse:P=>B(P.text),compare:j,format:P=>Y(P.value),defaults:{filter:"text",editor:"ipaddress",align:"start"},excel:"@",excelKind:"string",toStorage:P=>X(P),toClipboard:P=>Y(P),fromClipboard:P=>B(P)},cidr:{base:"number",storage:"float64",matches:a,parse:P=>i(P.text),compare:s,format:P=>n(P.value),defaults:{filter:"text",editor:"ipaddress",align:"start"},excel:"@",excelKind:"string",toStorage:P=>{const R=l(P);return R===null?null:d(R.address,R.prefix)},toClipboard:P=>n(P),fromClipboard:P=>i(P)},ipv6:{base:"text",storage:"dictionary",matches:D,parse:P=>L(P.text),compare:F,format:P=>M(P.value),defaults:{filter:"text",editor:"ipaddress",align:"start"},excel:"@",toStorage:P=>L(P),toClipboard:P=>M(P),fromClipboard:P=>L(P)}}),I=T}),Ue("packages/core/src/i18n/catalogue.js",function(e,U){"use strict";Object.defineProperty(e,"EN_GB",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"MESSAGE_KEYS",{enumerable:!0,get:function(){return z}});const E=U("packages/core/src/registry/free-tier-notice.js").FREE_TIER_NOTICE,q=Object.freeze({"count.rows":{one:"{count} row",other:"{count} rows"},"count.comments":{one:"{count} comment",other:"{count} comments"},"comments.someUnresolved":"{comments}, {unresolved} unresolved","comments.allResolved":"{comments}, all resolved","count.unresolvedComments":{one:"{count} unresolved comment",other:"{count} unresolved comments"},"count.items":{one:"{count} item",other:"{count} items"},"count.keys":{one:"{count} key",other:"{count} keys"},"count.values":{one:"value",other:"values"},"count.waiting":{one:"{count} waiting",other:"{count} waiting"},"count.rowsAdded":{one:"{count} row added",other:"{count} rows added"},"count.rowsRemoved":{one:"{count} row removed",other:"{count} rows removed"},"value.empty":"empty","a11y.sort.cleared":"Sort cleared","a11y.sort.by":"Sorted by {columns}","a11y.sort.column":"{column} {direction}","a11y.sort.ascending":"ascending","a11y.sort.descending":"descending","a11y.filter.cleared":"Filter cleared, {rows}","a11y.filter.applied":"Filtered to {shown} of {total}","a11y.find.count":{one:"{current} of {count} match",other:"{current} of {count} matches"},"a11y.find.countLoaded":{one:"{current} of {count} match in loaded rows",other:"{current} of {count} matches in loaded rows"},"a11y.find.none":"No matches","a11y.find.noneLoaded":"No matches in loaded rows","a11y.selection.cleared":"Selection cleared","a11y.selection.count":{one:"{count} row selected",other:"{count} rows selected"},"tabs.tablist":"Tabs","a11y.tabs.selected":"{label} tab selected","a11y.scrollbar.horizontal":"Horizontal scrollbar","a11y.scrollbar.vertical":"Vertical scrollbar","designer.canvas":"Dashboard canvas","designer.chrome":"Designer tools","designer.page":"Page {n}","a11y.designer.edit":"Edit mode","a11y.designer.view":"View mode","layout.region":"Dashboard layout","layout.move":"Move {title}","layout.resize":"Resize {title}","layout.close":"Close {title}","a11y.layout.grabbed":"{title} grabbed, column {x} of {columns}, row {y}","a11y.layout.position":"{title}, column {x} of {columns}, row {y}","a11y.layout.dropped":"{title} dropped, column {x} of {columns}, row {y}","a11y.layout.cancelled":"{title} move cancelled","a11y.layout.resizeCancelled":"{title} resize cancelled","a11y.layout.reverted":"{title} returned to column {x}, row {y}","a11y.layout.resizeGrabbed":"{title} resize grabbed, {w} by {h} cells","a11y.layout.resizeStep":"{title}, {w} by {h} cells","a11y.layout.resized":"{title} resized to {w} by {h} cells","a11y.layout.closed":"{title} closed","layout.maximise":"Maximise {title}","layout.minimise":"Minimise {title}","layout.restore":"Restore {title}","a11y.layout.maximised":"{title} maximised, filling the dashboard; press Escape to restore it","a11y.layout.minimised":"{title} minimised","a11y.layout.restored":"{title} restored to column {x}, row {y}","a11y.group.cleared":"Grouping cleared","a11y.group.by":"Grouped by {columns}","a11y.group.expanded":"{label} expanded, {rows} shown","a11y.group.collapsed":"{label} collapsed, {rows} shown","a11y.page.position":"Page {page} of {pages}","a11y.updates.paused":"Updates paused","a11y.updates.resumed":"Updates resumed","a11y.edit.refusedOne":"Edit to {column} was refused and put back to {value}{reason}","a11y.edit.refusedMany":{one:"{count} edit was refused and put back{reason}",other:"{count} edits were refused and put back{reason}"},"a11y.edit.reason":", {reason}","a11y.history.undo":"Undid {label}","a11y.history.redo":"Redid {label}","a11y.history.undoLast":"Undid the last change","a11y.history.redoLast":"Redid the last change","a11y.column.cannotResize":"{column} cannot be resized","a11y.column.resized":"{column} is {width} pixels wide","a11y.column.atMinimum":"{column} is at its narrowest, {width} pixels","a11y.column.atMaximum":"{column} is at its widest, {width} pixels","a11y.column.cannotMove":"{column} cannot be moved","a11y.column.alreadyFirst":"{column} is already first in its group","a11y.column.alreadyLast":"{column} is already last in its group","a11y.column.cannotMoveThere":"{column} cannot be moved there","a11y.column.moved":"{column} moved to position {at} of {of}","a11y.group.formed":"{column} grouped with {other} in a new band","a11y.group.dissolved":"band {group} dissolved","a11y.group.renamed":"band renamed to {group}","a11y.group.moved":"band {group} moved to position {at} of {of}","a11y.column.addedToGroup":"{column} added to band {group}","a11y.column.removedFromGroup":"{column} removed from its band","a11y.column.notInGroup":"{column} is not in a band","a11y.column.cannotGroup":"{column} cannot be grouped","a11y.group.cannotMove":"band {group} cannot be moved there","columngroup.newGroup":"New group","columngroup.rename":"Rename band","columngroup.dissolve":"Dissolve band","columngroup.group":"Group with adjacent column","columngroup.untitled":"Untitled band","panel.bandCollapse":"Collapse band {band}","panel.bandExpand":"Expand band {band}","panel.bandVisible":"Show or hide every column in band {band}","panel.bandRenameFor":"Rename band {band}","panel.bandDissolveFor":"Dissolve band {band}","header.filter":"Filter {column}","header.menu":"Column menu for {column}","header.toggleGroup":"Toggle {group}","header.dragHint":"Drag {column} to reorder, or onto another column to group","header.dragRole":"draggable column header","header.group":"group","header.selectAllRows":"Select all rows","header.clearSelection":"Clear selection","cell.selectRow":"Select row","cell.detail.show":"Show detail","cell.detail.hide":"Hide detail","cell.detail.showInPane":"Show in the detail pane","cell.detail.showingInPane":"Showing in the detail pane","cell.group.expand":"Expand","cell.group.collapse":"Collapse","cell.delta.up":"up","cell.delta.down":"down","cell.delta.unchanged":"unchanged","cell.delta.moved":"{direction} {magnitude}","cell.delta.describedUnchanged":"{label}, unchanged","cell.delta.described":"{label}, {direction} by {magnitude}","cell.qr.of":"QR code for {text}","cell.qr.empty":"No QR code","cell.rating.of":"{rating} of {max}","cell.rating.empty":"Not rated","cell.stage.of":"Stage {current} of {total}: {label}","cell.stage.empty":"No stage","a11y.panel.cannotMove":"{column} cannot be moved","a11y.panel.alreadyFirst":"{column} is already first","a11y.panel.alreadyLast":"{column} is already last","a11y.panel.moved":"{column} moved to position {at} of {of}","a11y.panel.removedFrom":"{column} removed from {list}","a11y.panel.addedTo":"{column} added to {list}","a11y.panel.cannotAddTo":"{column} cannot be added to {list}","a11y.annotate.erased":"Annotation removed","a11y.annotate.noMarks":"No annotations to erase","a11y.annotate.focusedMark":"Mark {at} of {of} selected","a11y.annotate.confirmClear":"Clear all annotations? Choose Clear or Keep.","a11y.annotate.cleared":"All annotations cleared","a11y.range.written":{one:"{count} cell updated",other:"{count} cells updated"},"a11y.range.cleared":{one:"{count} cell cleared",other:"{count} cells cleared"},"paste.preview.title":"Review paste","paste.preview.summary":{one:"{changes} cell will change, {rejected} rejected.",other:"{changes} cells will change, {rejected} rejected."},"paste.preview.changesHeading":{one:"{count} change",other:"{count} changes"},"paste.preview.rejectedHeading":{one:"{count} rejected",other:"{count} rejected"},"paste.preview.colOld":"Current","paste.preview.colNew":"New","paste.preview.colCell":"Cell","paste.preview.colReason":"Reason","paste.preview.empty":"This paste would change nothing.","paste.preview.confirm":"Apply","paste.preview.cancel":"Cancel","paste.preview.reason.permission":"Not permitted","paste.preview.reason.readOnly":"Read-only","paste.preview.reason.validation":"Invalid value","paste.preview.reason.locked":"Being edited","paste.preview.reason.missing":"No such cell","a11y.paste.previewOpened":{one:"Paste preview: {changes} cell changes, {rejected} rejected. Review, then apply or cancel.",other:"Paste preview: {changes} cell changes, {rejected} rejected. Review, then apply or cancel."},"a11y.paste.cancelled":"Paste cancelled; nothing changed","status.total":"{rows}","status.counting":"Counting rows…","status.shownOfTotal":"{shown} of {total}","status.selected":"{count} selected","status.selectedAcrossSource":"{count} selected across the source","status.selectedAcrossSourceCounting":"All matching rows selected, counting…","status.count":"Count {count}","status.loading":"Loading {count}…","status.loadingOf":"Loading {loaded} of {total} ({percent}%)","status.stat.sum":"Sum","status.stat.min":"Min","status.stat.max":"Max","status.stat.avg":"Avg","status.paused":"Paused","status.pausedWaiting":"Paused · {waiting}","status.coalesced":"{count} coalesced","status.hiddenComments":"{comments} on hidden rows","pagination.label":"Pagination","pagination.first":"First page","pagination.previous":"Previous page","pagination.next":"Next page","pagination.last":"Last page","pagination.page":"Page","pagination.ofPages":"of {pages}","pagination.summary":"{from}–{to} of {total}","pagination.pageSize":"Rows per page","pagination.range":"{from}–{to}","pagination.counting":"{from}–{to}, counting…","pagination.jump":"Page number, press Enter to jump","pagination.jumpBounded":"Page number, 1 to {pages}, press Enter to jump","panel.columns":"Columns","panel.filters":"Filters","panel.views":"Views","panel.quickFilter":"Quick filter","find.label":"Find in grid","find.placeholder":"Find in grid","find.next":"Next match","find.previous":"Previous match","find.close":"Close find","find.matchCase":"Match case","find.wholeCell":"Whole cell","find.columnScope":"Search in","find.allColumns":"All columns","find.count":"{current} of {total}","find.countPartial":"{current} of {total} so far","find.none":"No matches","find.searching":"Searching…","find.loadedRows":"in loaded rows","panel.formatting":"Formatting","panel.statistics":"Statistics","stat.noData":"No data","stat.tone.good":"good","stat.tone.bad":"bad","stat.tone.flat":"flat","panel.regression":"Regression","panel.compare":"Compare","panel.insights":"Insights","insights.subset":"Filtered subset vs whole","insights.dataset":"This grid vs another dataset","insights.groups":"Group comparison","insights.noFilter":"Filter the grid to compare the subset against the whole.","insights.by":"Group by","insights.test":"Test","insights.effect":"Effect size","insights.interval":"Confidence interval","insights.pValue":"p-value","insights.smallSample":"small sample — interpret with care","insights.needGroups":"Choose two columns with groups to compare.","insights.empty":"No columns to analyse.","insights.anomalies":"Anomalies","insights.anomalyCount":"{count} flagged of {n}","insights.anomalyMethod":"Method","insights.anomalyThreshold":"Threshold","anomaly.chip":"{count} anomalies flagged","anomaly.chipActive":"Showing {count} anomalies — clear","compare.first":"First column","compare.second":"Second column","compare.needTwo":"Two numeric columns are needed to compare","compare.noPairs":"No rows have a value in both","compare.pairs":"{count} pairs","compare.pearson":"Correlation (Pearson)","compare.spearman":"Rank correlation (Spearman)","compare.kendall":"Kendall’s tau","compare.covariance":"Covariance","compare.slope":"Slope","compare.intercept":"Intercept","compare.r2":"R²","compare.stdError":"Standard error","compare.weighted":"Weighted average","panel.zone.group":"row groups","panel.zone.values":"values","panel.zone.pivot":"pivot columns","groupZone.label":"Row groups","groupZone.title":"Group by","groupZone.hint":"Drag a column here to group rows by its values","groupZone.chip":"{column}, group {at} of {of}","groupZone.remove":"Stop grouping by {column}","groupZone.add":"Add a group","total.sum":"Sum","total.avg":"Average","total.min":"Min","total.max":"Max","total.count":"Count","total.countValues":"Count of values","total.first":"First","total.last":"Last","total.custom":"Total","total.median":"Median","total.p25":"25th percentile","total.p75":"75th percentile","total.p90":"90th percentile","total.p95":"95th percentile","total.p99":"99th percentile","total.iqr":"Interquartile range","total.mad":"Median absolute deviation","total.variance":"Variance","total.varianceP":"Variance (population)","total.stddev":"Standard deviation","total.stddevP":"Standard deviation (population)","total.range":"Range","total.distinct":"Distinct","total.mode":"Mode","total.skewness":"Skewness","total.kurtosis":"Kurtosis","total.geomean":"Geometric mean","total.harmean":"Harmonic mean","total.sumSquares":"Sum of squares","total.weightedAvg":"Weighted average","total.argmin":"Lowest by","total.argmax":"Highest by","total.hhi":"Concentration (HHI)","total.entropy":"Entropy","total.evenness":"Evenness","total.top3Share":"Top 3 share","total.top10Share":"Top 10 share","total.gini":"Gini coefficient","total.trimmedMean":"Trimmed mean","total.winsorizedMean":"Winsorized mean","total.robustOutliers":"Outliers (robust)","total.jarqueBera":"Jarque–Bera","total.passRate":"Pass rate","total.failureCount":"Failures","stats.column":"Column","stats.choose":"Choose a column to profile","stats.noColumns":"No numeric columns to profile","stats.noValues":"Nothing numeric in this column","stats.count":"Count","stats.present":"Present","stats.missing":"Missing","stats.distinct":"Distinct","stats.min":"Minimum","stats.max":"Maximum","stats.mean":"Mean","stats.median":"Median","stats.q1":"Lower quartile","stats.q3":"Upper quartile","stats.iqr":"Interquartile range","stats.stddev":"Standard deviation","stats.outliers":"Outliers","stats.distribution":"Distribution","stats.distribution.detail":"Distribution: rows per range","stats.bin":"{count} between {from} and {to}","stats.topValues":"Top values","stats.section.shape":"Shape","stats.section.robust":"Robust","stats.section.concentration":"Concentration","stats.section.capability":"Capability","stats.cp":"Cp","stats.cpk":"Cpk","stats.pp":"Pp","stats.ppk":"Ppk","stats.outOfSpec":"Out of specification","stats.filtered":"Over the {count} filtered rows","stats.unavailable":"Not computed by the source: {stats}.","stats.unavailable.notPlain":"`{column}` is not a plain column the engine can name","stats.unavailable.where":"a `where` predicate is in force ({list}), which only the browser can run","stats.unavailable.filter":"the grid's filter did not fully push to the engine","stats.unavailable.quick":"the quick search did not push to the engine","stats.unavailable.client":'the source did not compute "{fn}" in the engine ({reason}); set the pushdown source\'s `{setting}`',"stats.unavailable.outliers":"the count of values outside Tukey's fences is not an engine aggregate","stats.unavailable.histogram":"the shape of the column is not an engine aggregate","stats.unavailable.topValues":"the source did not answer a grouped count in the engine","regression.noModel":"No model configured. Set predictors and a response on the panel.","regression.cannotFit":"The model cannot be fitted over the current rows.","regression.observations":"Fitted over {count} rows","regression.r2":"R²","regression.adjR2":"Adjusted R²","regression.coefficients":"Coefficients","regression.term":"Term","regression.estimate":"Estimate ± SE","regression.stdError":"Std error","regression.t":"t","regression.p":"p","regression.vif":"Variance inflation (VIF)","regression.heteroscedasticity":"Heteroscedasticity (Breusch–Pagan)","regression.heteroscedastic":"Heteroscedastic: BP {statistic}, p {p}","regression.homoscedastic":"No heteroscedasticity detected: BP {statistic}, p {p}","menu.sortAscending":"Sort ascending","menu.sortDescending":"Sort descending","menu.clearSort":"Clear sort","menu.groupBy":"Group by this column","menu.ungroup":"Stop grouping by this column","menu.hideColumn":"Hide column","menu.pinStart":"Pin to start","menu.pinEnd":"Pin to end","menu.unpin":"Unpin","menu.autosize":"Fit to content","ai.valuesNotAmongOptions":'{values} {shown} not among the options for "{column}"',"menu.clearCells":{one:"Clear cell",other:"Clear {count} cells"},"menu.fillDown":"Fill down","menu.copy":"Copy","menu.copyWithHeaders":"Copy with headers","menu.paste":"Paste","menu.filterEllipsis":"Filter…","menu.columnStatistics":"Column statistics","menu.pinColumn":"Pin column","menu.sizeToFit":"Size to fit content","menu.sizeAllToFit":"Size all columns to fit","menu.width":"Width","menu.narrower":"Narrower","menu.wider":"Wider","menu.moveColumn":"Move column","menu.moveLeft":"Move left","menu.moveRight":"Move right","menu.moveToStart":"Move to start","menu.moveToEnd":"Move to end","menu.unpivot":"Remove from pivot","menu.pivotBy":"Pivot by this column","menu.stopTotalling":"Stop totalling","menu.totalColumn":"Total this column","menu.aggregate":"Aggregate","menu.aggregateNone":"None","menu.aggregateGroup":"Group subtotals","menu.aggregateGrand":"Grand total","menu.aggregateSame":"Same as total","menu.redactColumn":"Redact column","menu.stopRedacting":"Stop redacting","menu.stopRedactingAll":"Stop redacting everything","menu.sortGroupsAscending":"Sort groups ascending","menu.sortGroupsDescending":"Sort groups descending","menu.filterGroups":"Filter groups…","menu.expandAll":"Expand all","menu.collapseAll":"Collapse all","menu.clearGrouping":"Clear grouping","menu.colour":"Colour","menu.importCsv":"Import rows from CSV…","import.title":"Import rows","import.clipboard":"the clipboard","import.summary":{one:"{count} row from {name}",other:"{count} rows from {name}"},"import.opened":{one:"Import preview open, {count} row",other:"Import preview open, {count} rows"},"import.done":{one:"{count} row imported",other:"{count} rows imported"},"import.confirm":"Import","import.cancel":"Cancel","import.colSource":"Column","import.colField":"Maps to","import.colType":"Type","import.skip":"— skip —","import.mapLabel":'Map "{source}" to a field',"import.modeLabel":"On import","import.sheetLabel":"Sheet","import.append":"Add to existing rows","import.replace":"Replace all rows","menu.deleteRow":{one:"Delete row",other:"Delete {count} rows"},"toolbar.undo":"Undo","toolbar.redo":"Redo","toolbar.undoLabelled":"Undo {label}","toolbar.redoLabelled":"Redo {label}","toolbar.exportCsv":"Export to CSV","toolbar.exportExcel":"Export to Excel","toolbar.clipboard":"Copy visible rows to the clipboard","toolbar.print":"Print","toolbar.pause":"Hold incoming updates","toolbar.resume":"Resume updates","toolbar.applyHeld":{one:"Apply {count} held update",other:"Apply {count} held updates"},"toolbar.restoreView":"Restore the default view","toolbar.maximiseGrid":"Maximise the grid to fill the window","toolbar.restoreSize":"Restore the grid to the page (Esc)","toolbar.annotate.pen":"Draw freehand","toolbar.annotate.arrow":"Draw an arrow","toolbar.annotate.rect":"Draw a rectangle","toolbar.annotate.highlight":"Highlight","toolbar.annotate.erase":"Erase","toolbar.annotate.clearAll":"Clear all annotations","toolbar.annotate.clearAllConfirm":"Clear","toolbar.annotate.clearAllKeep":"Keep","overlay.noRows":"No rows to show","overlay.noResults":"No rows match the current filters","overlay.loading":"Loading…","overlay.error":"Something went wrong","overlay.loadingRows":"Loading rows {from} to {to}","overlay.rowError":"Failed to load","comments.panel":"Cell comments","comments.close":"Close comments","comments.write":"Write a comment","comments.post":"Comment","comments.delete":"Delete","comments.valueMoved":"Written when the value was {was}: it is now {now}.","comments.resolve":"Resolve","comments.reopen":"Reopen","comments.loading":"Loading…","comments.empty":"No comments yet.","comments.unknownAuthor":"Unknown","comments.edited":"{time} (edited)","comments.cellTitle":"{column}: {row}","presence.hidden":{one:"{count} not in view",other:"{count} not in view"},"presence.someoneElse":"someone else","a11y.presence.refused":"This cell is being edited by {name}","presence.peer":"{name}: jump to their cursor","presence.peerIdle":"{name}, idle: jump to their cursor","presence.peerHidden":"{name}, not in the current view","facets.filter":"{column} distribution filter","header.totalOf":"{total} of {column}","diff.before":"Was: {value}","diff.empty":"(empty)","kanban.columnCards":{one:"{title}, {count} card",other:"{title}, {count} cards"},"kanban.laneCards":{one:"{lane}, {title}, {count} card",other:"{lane}, {title}, {count} cards"},"kanban.blocked":"Blocked","kanban.ready":"Ready","kanban.blockedBy":{one:"blocked by {count} card",other:"blocked by {count} cards"},"kanban.card.assignedTo":"Assigned to {names}","kanban.card.overdue":"Overdue","kanban.card.dueSoon":"Due soon","kanban.card.progress":"{percent}% complete","kanban.card.checklist":"{done} of {total} done","gantt.lag":"+{days}d","gantt.lead":"{days}d","gantt.a11y.moved":"{name} moved to {date}","gantt.a11y.day":"day {day}","gantt.a11y.resized":"{name} resized to {days} days","gantt.a11y.linkFrom":"Linking from {name}. Focus the successor and press L.","gantt.a11y.linked":"Linked {from} to {to}, finish to start.","gantt.a11y.linkCancelled":"Link cancelled.","gantt.a11y.deleted":"{name} deleted.","gantt.a11y.readOnly":"Read-only.","gantt.row.moveHandle":"Drag to reorder or re-parent {name}","gantt.a11y.rowMoved":"{name} moved.","gantt.a11y.rowReparented":"{name} moved under {parent}.","gantt.a11y.rowPromoted":"{name} moved to the top level.","gantt.a11y.rowMoveCancelled":"Move cancelled.","gantt.a11y.copied":"{count} tasks copied.","gantt.a11y.cut":"{count} tasks cut.","gantt.a11y.pasted":"{count} tasks pasted.","gantt.task.newName":"New task","gantt.a11y.taskAdded":"{name} added.","gantt.menu.addAbove":"Add task above","gantt.menu.addBelow":"Add task below","gantt.menu.addChild":"Add subtask","gantt.menu.addSuccessor":"Add successor","gantt.menu.addPredecessor":"Add predecessor","gantt.menu.toMilestone":"Convert to milestone","gantt.menu.toTask":"Convert to task","gantt.menu.delete":"Delete task","gantt.a11y.linkCycle":"Linking {from} to {to} would create a cycle; link not created.","gantt.a11y.linkCreated":"{from} linked to {to}, {type}.","gantt.a11y.linkDeleted":"Link from {from} to {to} deleted.","gantt.a11y.linkLabel":"Link, {from} to {to}, {type}","gantt.linkEditor.title":"Edit link from {from} to {to}","gantt.linkEditor.type":"Link type","gantt.linkEditor.lag":"Lag, in days","gantt.linkEditor.apply":"Apply","gantt.linkEditor.delete":"Delete link","gantt.linkEditor.cancel":"Cancel","gantt.a11y.undone":"Undone.","gantt.a11y.redone":"Redone.","gantt.a11y.nothingToUndo":"Nothing to undo.","gantt.a11y.nothingToRedo":"Nothing to redo.","gantt.workload.title":"Resource workload","gantt.workload.resource":"Resource","gantt.workload.total":"Total","gantt.workload.unassigned":"Unassigned","gantt.workload.ungrouped":"No group","gantt.workload.cell":"{hours} h from {date}","gantt.workload.over":"{hours} h from {date}, over a capacity of {capacity} h","gantt.workload.expand":"Show {name}’s tasks","gantt.workload.collapse":"Hide {name}’s tasks","gantt.workload.expandGroup":"Show the {name} group","gantt.workload.collapseGroup":"Hide the {name} group","gantt.workload.unitToggle":"Hours / % / Cost","gantt.workload.unitHours":"Showing hours","gantt.workload.unitPercent":"Showing percent of capacity","gantt.workload.unitCost":"Showing cost","gantt.workload.cellPercent":"{percent}% from {date}","gantt.workload.overPercent":"{percent}% from {date}, over capacity","gantt.workload.cellNoCapacity":"No available hours from {date}","gantt.workload.cellCost":"{cost} from {date}","gantt.workload.otherProjectLabel":"{name} (other project)","gantt.workload.external":"External booking","gantt.a11y.hoursSet":"{name}: {hours} h from {date}","gantt.a11y.hoursCleared":"{name}: no hours from {date}","gantt.a11y.hoursRefused":"{date} is not a working day; {name} was not changed.","gantt.histogram.title":"Resource histogram","gantt.histogram.tableTitle":"Resource histogram data","gantt.histogram.resource":"Resource","gantt.histogram.period":"Period","gantt.histogram.hours":"Hours","gantt.histogram.percent":"Percent of capacity","gantt.histogram.cost":"Cost","gantt.histogram.capacity":"Capacity","gantt.histogram.overAllocated":"Over-allocated","gantt.histogram.yes":"Yes","gantt.histogram.no":"No","gantt.histogram.tip":"{name}, {from} to {to}: {value}{capacity}{tasks}","gantt.histogram.tipHours":"{hours} h","gantt.histogram.tipPercent":"{percent}% of capacity","gantt.histogram.tipCost":"{cost}","gantt.histogram.tipCapacity":", capacity {hours} h","gantt.histogram.tipTasks":" ({tasks})","gantt.histogram.tipOver":", over capacity","gantt.histogram.tipNoCapacity":"no available hours","gantt.picker.title":"Assign resources to {name}","gantt.picker.open":"Edit assignments for {name}","gantt.picker.search":"Search resources","gantt.picker.list":"Resources","gantt.picker.selected":"Assigned resources","gantt.picker.load":"{load}% booked of {capacity}% over these dates","gantt.picker.none":"No matching resources","gantt.picker.units":"{name}, units in percent","gantt.picker.remove":"Remove {name}","gantt.picker.apply":"Apply","gantt.picker.cancel":"Cancel","gantt.picker.warn":"{name} would be over-allocated: {load}% booked of {capacity}%","gantt.picker.ok":"No resource would be over-allocated","gantt.picker.assign":"Assign","gantt.col.effort":"Effort","gantt.col.units":"Units","gantt.unscheduled":"Unscheduled","gantt.col.unscheduled":"Unscheduled","gantt.inactive":"Inactive","gantt.col.inactive":"Inactive","gantt.col.slack":"Slack","gantt.col.deadline":"Deadline","gantt.col.constraint":"Constraint","gantt.col.constraintDate":"Constraint date","gantt.col.earlyStart":"Early start","gantt.col.lateStart":"Late start","gantt.col.lateFinish":"Late finish","gantt.col.baselineStart":"Baseline start","gantt.col.baselineEnd":"Baseline finish","gantt.col.variance":"Variance","gantt.col.note":"Note","gantt.col.sequence":"#","gantt.col.predecessors":"Predecessors","gantt.col.successors":"Successors","gantt.link.invalid":"Cannot read “{token}” as a link. Write a task number, a type and a lag, like 3FS+2; links not changed.","gantt.link.unknownRef":"No task is numbered “{token}”; links not changed.","gantt.link.self":"“{token}” links a task to itself; links not changed.","gantt.link.duplicate":"“{token}” repeats a link already listed; links not changed.","gantt.link.cycle":"“{token}” would create a cycle; links not changed.","gantt.constraint.ASAP":"As soon as possible","gantt.constraint.MSO":"Must start on","gantt.constraint.MFO":"Must finish on","gantt.constraint.ALAP":"As late as possible","gantt.constraint.SNET":"Start no earlier than","gantt.constraint.SNLT":"Start no later than","gantt.constraint.FNET":"Finish no earlier than","gantt.constraint.FNLT":"Finish no later than","gantt.row.ancestor":"Shown because a task inside it matches the filter","gantt.progress.handle":"Drag to set the progress of {name}","gantt.a11y.progress":"{name} {percent}% complete","gantt.col.name":"Task name","gantt.col.start":"Start","gantt.col.end":"Finish","gantt.col.duration":"Duration","gantt.col.assignee":"Assignee","gantt.col.progress":"%","gantt.col.wbs":"WBS","gantt.zoom.label":"Zoom","gantt.zoom.day":"Day","gantt.zoom.week":"Week","gantt.zoom.month":"Month","gantt.zoom.quarter":"Quarter","gantt.zoom.fit":"Fit to plan","gantt.tip.range":"{from} to {to}","gantt.tip.duration":"{days}d","gantt.tip.slack":"slack {days}d","gantt.tip.effort":"{hours}h","gantt.tip.row":"{label}: {value}","gantt.tip.start":"Start","gantt.tip.end":"End","gantt.tip.date":"Date","gantt.tip.durationLabel":"Duration","gantt.tip.durationValue":"{days} days","gantt.tip.complete":"Complete","gantt.tip.effortLabel":"Effort","gantt.tip.effortValue":"{hours} h","gantt.tip.assigned":"Assigned","gantt.tip.cost":"Cost","gantt.tip.slackLabel":"Slack","gantt.tip.slackValue":"{days} days","gantt.tip.deadline":"Deadline","gantt.mode.fixedDuration":"Fixed duration","gantt.mode.fixedEffort":"Fixed effort","gantt.mode.fixedUnits":"Fixed units","gantt.scurve.spi":"SPI {index}","gantt.scurve.cpi":"CPI {index}","gantt.print.page":"Page {page} of {pages}","gantt.print.printed":"Printed {date}","gantt.dataBand.title":"Data band","gantt.dataBand.name":"Task","gantt.dataBand.resource":"Resource","gantt.dataBand.total":"Total","gantt.dataBand.unassigned":"Unassigned","gantt.dataBand.collapse":"Collapse {name}","gantt.dataBand.expand":"Expand {name}","gantt.dataBand.cell":"{name}, {date}: {value}","gantt.issues.title":"Scheduling conflicts","gantt.issues.empty":"No scheduling conflicts","gantt.issues.count":"{count} scheduling conflicts","gantt.issues.toggle":"Toggle the conflicts panel","gantt.issues.cycle":"Circular dependency: {tasks}","gantt.issues.constraint":"{task} cannot meet its {constraint} constraint of {date}","gantt.issues.lock":"{task} is locked but a dependency would move it","gantt.issues.deadline":"{task} finishes after its deadline of {date}","gantt.issues.fixRemoveLink":"Remove link","gantt.issues.fixAsap":"Set as soon as possible","gantt.issues.fixUnlock":"Unlock task","gantt.issues.fixClearDeadline":"Clear deadline","gantt.resize.startHandle":"Drag to change the start of {name}","gantt.a11y.resizedStart":"{name} start moved to {date}, now {days} days","gantt.a11y.startEdge":"Start edge can be resized: drag the left edge, or press Ctrl+Shift+Left or Right.","gantt.a11y.chain":"Dependency chain highlighted: {preds} predecessors, {succs} successors.","timeline.scrub":"Scrub through recent changes","timeline.goLive":"Go live","timeline.returnToPresent":"Return to the present","a11y.fillHandle":"Drag to fill","panel.icons":"Icons","value.tooLong":"Too long","shortcuts.title":"Keyboard shortcuts","shortcuts.close":"Close keyboard shortcuts","shortcuts.hint":"Press Escape to close.","shortcuts.or":"or","a11y.reorder.moved":"Moved to position {position} of {total}","a11y.reorder.sorted":"Rows cannot be reordered while the grid is sorted","a11y.reorder.filtered":"Rows cannot be reordered while a filter is applied","a11y.reorder.grouped":"Rows cannot be reordered while the grid is grouped","a11y.reorder.grab":"Reorder row","a11y.reorder.sortedManual":"Rows cannot be reordered while the grid is sorted. Press Alt+Shift+M, or the Manual order button in the heading, to order them by hand","a11y.reorder.groupDerived":"The row cannot join that group: the group is worked out from the value, so there is no single value to give it","a11y.reorder.groupReadOnly":"The row cannot join that group: its grouping value cannot be edited","a11y.reorder.invalid":"The row cannot join that group: the new value was not valid","a11y.reorder.vetoed":"The move was declined; the row stays where it was","a11y.reorder.vetoedBecause":"The move was declined ({reason}); the row stays where it was","a11y.reorder.refused":"The row cannot be moved there","a11y.reorder.regrouped":"Moved into {group}","a11y.rowOrder.entered":"Manual order: the rows keep their places and can be moved by hand","a11y.rowOrder.exited":"Manual order ended; the rows follow the sort","rowOrder.button":"Manual order","rowOrder.enter":"Order the rows by hand instead of by the sort","rowOrder.exit":"Return to the sorted order","a11y.transfer.moved":"Row moved to the other grid","a11y.transfer.copied":"Row copied to the other grid","a11y.transfer.refused":"That grid does not accept this row","a11y.transfer.declined":"The drop was declined; the row stays where it was","a11y.transfer.stale":"The drop target changed while it was being confirmed; the row stays where it was","shortcuts.group.grid":"In the data","shortcuts.group.header":"On a column heading","shortcuts.group.panel":"In the column list","shortcut.moveCell":"Move the focused cell","shortcut.rowEnds":"First / last cell of the row","shortcut.gridEnds":"First cell of the first row / last cell of the last row","shortcut.pageRows":"Move one viewport of rows","shortcut.nextCell":"Leave the grid for the next / previous focusable element (arrows move between cells)","shortcut.undo":"Undo the last edit, paste, fill or clear","shortcut.redo":"Redo the step that was undone","shortcut.startEdit":"Start editing the focused cell","shortcut.toggleRow":"Toggle selection of the focused row","shortcut.cancel":"Cancel the current edit or drag","shortcut.expandCollapse":"Expand / collapse a group or tree row","shortcut.focusHeader":"Move focus to the column header","shortcut.focusPanel":"Move focus to the tool panel","shortcut.contextMenu":"Open the context menu for the focused cell","shortcut.moveRow":"Move the focused row, when row reorder is enabled","shortcut.manualOrder":"Order the rows by hand, or return to the sort, when row reorder allows a manual order","shortcut.headingMove":"Move between headings","shortcut.headingEnds":"First / last heading","shortcut.headingSort":"Sort by the column, Shift to add to the sort","shortcut.headingResize":"Resize the column, Ctrl for a coarse step","shortcut.headingAutosize":"Size the column to its content","shortcut.headingReorder":"Move the column","shortcut.headingMenu":"Open the column menu","shortcut.headingExit":"Return focus to the data","shortcut.listGroup":"Group by the column, or stop grouping by it","shortcut.listValues":"Add the column to values, or take it out","shortcut.listPivot":"Pivot by the column, or stop pivoting by it","shortcut.listMove":"Move the column","shortcut.find":"Find in the grid","tags.label":"Show columns","tags.all":"All columns","tags.showing":"Showing {tag}","form.title":"Edit row","form.save":"Save","form.cancel":"Cancel","form.loading":"Loading…","form.loadFailed":"Could not load this record.","form.loadTimeout":"The record did not arrive in time.","form.retry":"Try again","form.choose":"Choose…","form.newTitle":"New row","form.createFailed":"Could not add this record.","presentation.cards":"Showing records as cards","presentation.table":"Showing records as a table","editor.format":"Format","editor.codeHint":"Tab indents · Esc cancels · Ctrl+Enter saves","editor.colours":"Colours","editor.customColour":"Custom colour","editor.hexValue":"Hex value","editor.hexPlaceholder":"#rrggbb","editor.clearColour":"Clear colour","editor.time":"Time","editor.noIcon":"No icon","editor.selectAll":"Select all","editor.passwordHint":"Enter the value twice to save it.","editor.clearRating":"Clear rating","editor.clear":"Clear","editor.value":"Value","editor.currency":"Currency","editor.richtext.formatting":"Formatting","editor.richtext.richText":"Rich text","editor.richtext.placeholder":"Start writing…","editor.richtext.linkLabel":"Link address","editor.richtext.linkPlaceholder":"https://","editor.richtext.linkAdd":"Add link","editor.richtext.bold":"Bold (Ctrl+B)","editor.richtext.italic":"Italic (Ctrl+I)","editor.richtext.underline":"Underline (Ctrl+U)","editor.richtext.strike":"Strikethrough","editor.richtext.heading":"Paragraph style","editor.richtext.alignLeft":"Align left","editor.richtext.alignCenter":"Align centre","editor.richtext.alignRight":"Align right","editor.richtext.ul":"Bulleted list","editor.richtext.ol":"Numbered list","editor.richtext.color":"Text colour","editor.richtext.link":"Link (Ctrl+K)","editor.richtext.image":"Insert image","editor.richtext.clear":"Clear formatting","editor.richtext.source":"HTML source","editor.richtext.undo":"Undo (Ctrl+Z)","editor.richtext.redo":"Redo (Ctrl+Y)","formatting.format":"Format","formatting.noRules":"No rules yet. The first one that matches a cell wins.","formatting.clearAll":"Clear all","formatting.addRule":"Add rule","formatting.condition":"Condition","formatting.value":"Value","formatting.secondValue":"Second value","formatting.moveEarlier":"Move earlier","formatting.moveLater":"Move later","formatting.ruleKind":"Rule type","formatting.aCondition":"A condition","formatting.aColourScale":"A colour scale","formatting.compare":"Compare a value","formatting.distribution":"By the distribution","formatting.colourScale":"Colour scale","formatting.scaleBounds":"Scale bounds","formatting.preview":"Preview","formatting.livePreview":"Live preview","history.title":"History","history.show":"Show history","history.empty":"Nothing to undo yet.","prompt.ask":"Ask","prompt.apply":"Apply","prompt.discard":"Discard","panel.searchColumns":"Search columns","panel.searchColumnsPlaceholder":"Search columns…","panel.searchColumnsToFilter":"Search columns to filter","panel.showAll":"Show all","panel.hideAll":"Hide all","panel.clearAll":"Clear all","panel.clear":"Clear","panel.filterAllColumns":"Filter all columns","panel.columnFiltered":"This column is filtered","panel.clearFilterOn":"Clear the filter on {column}","panel.clearFilter":"Clear this filter","panel.filterEmptyNoMatch":"No column matches “{query}”.","panel.filterEmptyNone":"No column on this grid can be filtered.","panel.filterSummaryActive":"{active} of {total} columns filtered","panel.filterSummaryNone":"No filters · {total} columns available","panel.filterBy":"Filter by {column}","panel.filteredBy":"Filtered by {column}","panel.columnDragHint":"Drag {column} into a zone above, or onto another column to reorder","panel.gridActions":"Grid actions","views.default":"Default","views.namePlaceholder":"Name this view…","views.nameLabel":"Name for the current layout","views.save":"Save view","licence.watermark":"Unlicensed: Lattice Grid trial","licence.watermark.free":E,"filter.op.contains":"Contains","filter.op.notContains":"Does not contain","filter.op.equals":"Equals","filter.op.notEqual":"Does not equal","filter.op.startsWith":"Starts with","filter.op.endsWith":"Ends with","filter.op.blank":"Is blank","filter.op.notBlank":"Is not blank","filter.op.lessThan":"Less than","filter.op.lessThanOrEqual":"Less than or equal","filter.op.greaterThan":"Greater than","filter.op.greaterThanOrEqual":"Greater than or equal","filter.op.inRange":"In range","filter.op.matches":"Matches","filter.op.before":"Before","filter.op.after":"After","filter.op.relative":"Relative to today","filter.rel.today":"Today","filter.rel.yesterday":"Yesterday","filter.rel.tomorrow":"Tomorrow","filter.rel.lastNDays":"Last N days","filter.rel.nextNDays":"Next N days","filter.rel.thisWeek":"This week","filter.rel.lastWeek":"Last week","filter.rel.thisMonth":"This month","filter.rel.lastMonth":"Last month","filter.rel.thisQuarter":"This quarter","filter.rel.quarterToDate":"Quarter to date","filter.rel.thisYear":"This year","filter.rel.yearToDate":"Year to date","filter.operator":"Operator","filter.join":"Join","filter.value":"Value","filter.from":"From","filter.to":"To","filter.addCondition":"Add condition","filter.noConditions":"No conditions","filter.removeCondition":"Remove condition","filter.search":"Search","filter.searchValues":"Search values","filter.noMatches":"No values match","filter.selectAll":"Select all","filter.clear":"Clear","filter.all":"All","filter.allExcept":"All but {count}","filter.loadingValues":"Loading values…","filter.topValues":"Top {shown} of {total} values","filter.valuesFailed":"Values could not be loaded: {error}","filter.valuesUnsupported":"This source cannot list the values of {column}; filter by condition instead.","filter.true":"True","filter.false":"False","filter.expression":"Filter expression","filter.column":"Column","filter.relativePeriod":"Relative period","filter.days":"Number of days","filter.tab.set":"Values","filter.tab.text":"Text","filter.tab.number":"Number","filter.tab.date":"Date","filter.tab.advanced":"Advanced","filterRow.label":"Filter row","filterRow.conditions":{one:"{count} condition",other:"{count} conditions"},"chart.empty":"Nothing to chart","chart.summary":"{type} chart of {measure} by {dimension}","chart.summaryShare":"{type} chart of {measure}","chart.summaryType":"{type} chart","chart.summaryGauge":"{type} chart of {measure}, {fn}: {value}","chart.waterfallTotal":"Total","chart.summaryEngine":"Figures computed by the data engine over every matching row","chart.summaryEngineViewport":"{count} points in this view, fetched from the data engine","chart.summaryEngineDensity":"{count} rows in this view, more than the {cap} drawn as points, so shown as {cells} density cells counted by the data engine","chart.summaryClientDensity":"{count} rows in this view, more than the {cap} drawn as points, so shown as {cells} density cells computed in the browser","chart.viewportOverCap":"{count} rows in this view, more than the {cap} this map draws; zoom in or narrow the filter","chart.dataTable":"Chart data","chart.viewportFilter.label":"Map view","chart.annotate.rail":"Drawing tools","chart.annotate.select":"Select and move a drawing","chart.annotate.trendLine":"Trend line","chart.annotate.horizontalLine":"Horizontal line","chart.annotate.verticalLine":"Vertical line","chart.annotate.channel":"Parallel channel","chart.annotate.fibonacci":"Fibonacci retracement","chart.annotate.arrow":"Arrow","chart.annotate.pen":"Freehand pen","chart.annotate.pen.described":"Freehand drawing from {from} to {to}","chart.annotate.measure-x":"Date range","chart.annotate.measure-y":"Price range","chart.annotate.measure-xy":"Date and price range","chart.annotate.measure.bars":{one:"{count} bar",other:"{count} bars"},"chart.annotate.measure.points":{one:"{count} point",other:"{count} points"},"chart.annotate.measure.volume":"Vol {value}","chart.annotate.measure.seconds":"{count}s","chart.annotate.measure.minutes":"{count}m","chart.annotate.measure.hours":"{count}h","chart.annotate.measure.days":"{count}d","chart.annotate.measure.weeks":"{count}w","chart.annotate.measure.months":"{count}mo","chart.annotate.measure.years":"{count}y","chart.annotate.measure":"Measure","chart.annotate.measure.dx":"Δx {value}","chart.annotate.measure.dy":"Δy {value}","chart.annotate.measure.pct":"{value}%","chart.annotate.measure.categories":{one:"{count} category",other:"{count} categories"},"chart.annotate.measure.slope.perDay":"Slope {value} per day","chart.annotate.measure.slope.perCategory":"Slope {value} per category","chart.annotate.measure.slope.perUnit":"Slope {value} per unit","chart.annotate.measure.dur.d":"{count} d","chart.annotate.measure.dur.h":"{count} h","chart.annotate.measure.dur.min":"{count} min","chart.annotate.measure.dur.s":"{count} s","chart.annotate.measure.dur.ms":"{count} ms","chart.annotate.measure.announce":"Measurement: {readout}","chart.annotate.measure.start":"Measure start: {x}, {y}","chart.annotate.text":"Text","chart.annotate.callout":"Callout","chart.annotate.note":"Note","chart.annotate.delete":"Delete the selected drawing","chart.annotate.editLabel":"Annotation text","chart.zoom.toolbar":"Zoom controls","chart.zoom.in":"Zoom in","chart.zoom.out":"Zoom out","chart.zoom.left":"Pan left","chart.zoom.right":"Pan right","chart.zoom.reset":"Reset the zoom","chart.legendMore":{one:"+{count} more",other:"+{count} more"},"chart.type.line":"Line","chart.type.area":"Area","chart.type.bar":"Bar","chart.type.pie":"Pie","chart.type.donut":"Donut","chart.type.sunburst":"Sunburst","chart.type.scatter":"Scatter","chart.type.step":"Step","chart.type.rangeArea":"Range","chart.type.horizontalBar":"Horizontal bar","chart.type.waterfall":"Waterfall","chart.type.floatingBar":"Floating bar","chart.type.horizontalFloatingBar":"Horizontal floating bar","chart.type.populationPyramid":"Population pyramid","chart.type.bullet":"Bullet","chart.type.bubble":"Bubble","chart.type.histogram":"Histogram","chart.type.boxplot":"Box plot","chart.type.forest":"Forest plot","chart.type.qq":"QQ plot","chart.type.ecdf":"ECDF","chart.type.lorenz":"Lorenz","chart.type.correlogram":"Correlogram","chart.type.control":"Control","chart.type.capability":"Capability","chart.type.movingRange":"Moving range","chart.type.treemap":"Treemap","chart.type.combo":"Combination","chart.type.pareto":"Pareto","chart.type.heatmap":"Heat map","chart.type.radar":"Radar","chart.type.gauge":"Gauge","chart.type.funnel":"Funnel","chart.type.candlestick":"Candlestick","chart.type.ohlc":"OHLC","chart.type.polarArea":"Polar area","chart.type.nightingale":"Nightingale rose","chart.type.rose":"Rose","chart.type.radialBar":"Radial bar","chart.type.polarScatter":"Polar scatter","chart.type.geomap":"Map","chart.type.sankey":"Sankey","chart.type.chord":"Chord","chart.type.pyramid":"Pyramid","chart.type.pictorial":"Pictorial","chart.type.serpentine":"Serpentine timeline","chart.type.spiral":"Spiral timeline","chart.edit.aggregated":"This value is a total of several rows, so it cannot be dragged.","chart.edit.refused":"That change was not applied.","chart.edit.refusedWhy":"That change was not applied: {reason}","chart.type.network":"Network","chart.type.stream":"Stream","chart.type.marimekko":"Marimekko","chart.type.violin":"Violin","chart.type.gantt":"Gantt","chart.type.forceTree":"Force-directed tree","chart.type.pack":"Packed circles","chart.type.tree":"Tree","chart.type.voronoiTreemap":"Voronoi treemap","chart.type.alluvial":"Alluvial","chart.type.arc":"Arc diagram","chart.type.barRace":"Bar chart race","chart.type.bubblemap":"Bubble map","chart.type.bump":"Bump chart","chart.type.calendar":"Calendar heat map","chart.type.choropleth":"Choropleth map","chart.type.decomposition":"Decomposition tree","chart.type.diverging":"Diverging bar","chart.type.dumbbell":"Dumbbell","chart.type.fan":"Fan chart","chart.type.hexbin":"Hexagonal bin","chart.type.hexmap":"Hex map","chart.type.icicle":"Icicle","chart.type.markermap":"Marker map","chart.type.motion":"Motion chart","chart.type.parallel":"Parallel coordinates","chart.type.ridgeline":"Ridgeline","chart.type.roc":"ROC curve","chart.type.scatter3d":"3D scatter","chart.type.slope":"Slope chart","chart.type.splom":"Scatter plot matrix","chart.type.venn":"Venn diagram","chart.type.waffle":"Waffle","chart.type.wordCloud":"Word cloud","chart.tasksDropped":{one:"{count} more task not shown",other:"{count} more tasks not shown"},"chart.geoUnmatched":{one:"{count} row could not be placed on the map",other:"{count} rows could not be placed on the map"},"chart.r2":"R² {value}","ai.insights":"Insights","ai.explainView":"Explain this view","ai.explain":"Explain","ai.ask":"Ask","ai.apply":"Apply","ai.discard":"Discard","ai.propose":"Propose","ai.approve":"Approve","ai.thinking":"Thinking…","ai.applying":"Applying…","ai.applied":"Applied: {what}","ai.couldNotApply":"Could not apply: {why}","ai.applyFailed":"it failed","ai.discarded":"Discarded.","ai.discardedNothingWritten":"Discarded. Nothing was written.","ai.nothingWritten":"Nothing was written.","ai.nothingWrittenVetoed":"Nothing was written — a before-handler vetoed it.","ai.scope":"Scope: {scope}","ai.unsafeQuery":"I could not turn that into a safe query: {why}","ai.nothingToDo":"nothing to do","ai.insightsFailed":"Could not generate insights right now. The grid is unaffected.","ai.modelUnreachable":"Could not reach the model right now. The grid is unaffected.","ai.flagged":{one:"{count} unverified figure was removed as ungrounded.",other:"{count} unverified figures were removed as ungrounded."},"ai.askPlaceholder":"Ask your data: “EMEA deals over 50k, biggest first”","ai.askLabel":"Ask your data","ai.actorPlaceholder":"Ask AI to change data: “set the Network Upgrade project to In Progress”","ai.actorLabel":"Ask AI to change data","editor.password.show":"Show value","editor.password.hide":"Hide value","editor.password.showField":"Show {column}","editor.password.hideField":"Hide {column}","facets.computing":"Computing…","facets.suppressed.cardinality":"Too many distinct values to chart","facets.suppressed.rows":"Too many rows to chart","facets.suppressed.streaming":"Paused while live data is streaming","facets.suppressed.noProvider":"No distribution available for this data source","facets.suppressed.type":"This column has no chartable distribution","facets.bucketOf":"{count} of {whole} rows","history.undo":"Undo","history.redo":"Redo","history.described":"{action} {label}","history.nothingToUndo":"Nothing to undo","history.nothingToRedo":"Nothing to redo","history.undoDisabled":"Undo (nothing to undo)","history.redoDisabled":"Redo (nothing to redo)","a11y.presence.joined":"{name} joined","a11y.presence.left":"{name} left","prompt.asking":"Asking…","prompt.moreNotes":{one:"and {count} more",other:"and {count} more"},"shortcuts.key.cmd":"Cmd","timeline.live":"Live","timeline.recording":"recording…","panel.zoneHint.group":"Drag a column here to group rows by its values","panel.zoneHint.values":"Drag a column here to total it","panel.zoneHint.pivot":"Drag a column here to pivot across its values","panel.zoneHint.any":"Drag a column here","panel.rowsOf":"{shown} of {total} rows","views.empty":"No saved views yet. Set the grid up as you want it, then save it below.","views.applied":"Applied","views.matchesGrid":"Matches the grid as it is","views.delete":"Delete","views.confirmDelete":"Delete {name}?","views.confirmDeleteLabel":"Confirm deleting {name}","gantt.row.expand":"Expand {name}","gantt.row.collapse":"Collapse {name}","gantt.resource.over":"{name} — over-allocated","kanban.board":"Board","kanban.requiredTitle":"Required fields","kanban.requiredSave":"Save","kanban.requiredCancel":"Cancel","kpi.status.good":"good","kpi.status.warn":"warn","kpi.status.critical":"critical","kpi.status.unknown":"No data","kpi.node.item":"{count} item","kpi.node.items":"{count} items","kpi.node.worst":"worst status {status}","kpi.node.unknown":"{count} unknown"}),z=Object.freeze(Object.keys(q))}),Ue("packages/core/src/i18n/format.js",function(e,U){"use strict";Object.defineProperty(e,"formatList",{enumerable:!0,get:function(){return X}}),Object.defineProperty(e,"formatMessage",{enumerable:!0,get:function(){return G}}),Object.defineProperty(e,"resolveLocale",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"lookup",{enumerable:!0,get:function(){return k}});const E=U("packages/core/src/internal/predicates.js").isFunction,q=/\{(\w+)\}/g,z=new Map,_=new Map;function Z(g){const c=g||"";if(z.has(c))return z.get(c);let d=null;try{d=new Intl.PluralRules(g||void 0)}catch{d=null}return z.set(c,d),d}function X(g,c,d="conjunction"){const l=Array.isArray(g)?g.filter(a=>a!=null&&a!==""):[];if(l.length===0)return"";if(l.length===1)return String(l[0]);const i=`${c||""}|${d}`;let n=_.get(i);if(n===void 0){try{n=new Intl.ListFormat(c||void 0,{style:"long",type:d})}catch{n=null}_.set(i,n)}return n?n.format(l.map(String)):l.map(String).join(", ")}function B(g,c){return g==null?"":typeof g=="number"?Number.isFinite(g)?g.toLocaleString(c||void 0,{maximumFractionDigits:20}):"":String(g)}function Y(g,c,d){if(typeof g=="string")return g;if(!g||typeof g!="object")return"";const l=c&&typeof c.count=="number"?c.count:null;if(l===null)return g.other??"";const i=Z(d),n=i?i.select(l):l===1?"one":"other";return g[n]??g.other??""}function G(g,c={},d){const l=Y(g,c,d);return l?l.replace(q,(i,n)=>Object.prototype.hasOwnProperty.call(c,n)?B(c[n],d):i):""}function j(g,c,d="en-GB"){return typeof g=="string"&&g?g:typeof c=="string"&&c?c:d}function k(g,c){const d=g?g[c]:void 0;return d==null||E(d)?c:d}}),Ue("packages/core/src/i18n/registry.js",function(e,U){"use strict";Object.defineProperty(e,"registerLocale",{enumerable:!0,get:function(){return z}}),Object.defineProperty(e,"localeCatalogue",{enumerable:!0,get:function(){return _}}),Object.defineProperty(e,"registeredTags",{enumerable:!0,get:function(){return Z}});const E=U("packages/core/src/i18n/catalogue.js").EN_GB,q=new Map([["en-gb",E]]);function z(X,B){const Y=typeof X=="string"?X.toLowerCase():"";return!Y||!B||typeof B!="object"?!1:(q.set(Y,B),!0)}function _(X){if(typeof X!="string"||!X)return null;const B=X.toLowerCase(),Y=q.get(B);if(Y)return Y;const G=B.split("-")[0],j=q.get(G);if(j)return j;for(const[k,g]of q)if(k.split("-")[0]===G)return g;return null}function Z(){return[...q.keys()]}}),Ue("packages/core/src/i18n/index.js",function(e,U){"use strict";Object.defineProperty(e,"DEFAULT_LOCALE",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"Messages",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"defaultMessages",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"createMessages",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"auditCatalogue",{enumerable:!0,get:function(){return s}});const te=U("packages/core/src/i18n/catalogue.js"),E=te.EN_GB,q=te.MESSAGE_KEYS,z=U("packages/core/src/i18n/format.js"),_=z.formatMessage,Z=z.formatList,X=z.lookup,B=z.resolveLocale,G=U("packages/core/src/internal/predicates.js").isFunction,k=U("packages/core/src/internal/warn.js").warnOnce,g=U("packages/core/src/i18n/registry.js"),c=g.registerLocale,d=g.localeCatalogue;Object.defineProperty(e,"EN_GB",{enumerable:!0,get:function(){return te.EN_GB}}),Object.defineProperty(e,"MESSAGE_KEYS",{enumerable:!0,get:function(){return te.MESSAGE_KEYS}}),Object.defineProperty(e,"formatList",{enumerable:!0,get:function(){return z.formatList}}),Object.defineProperty(e,"resolveLocale",{enumerable:!0,get:function(){return z.resolveLocale}}),Object.defineProperty(e,"registerLocale",{enumerable:!0,get:function(){return g.registerLocale}});const l="en-GB";class i{#e=l;#t=E;constructor(u={}){this.configure(u)}configure(u={}){this.#e=B(u.locale,u.declared,l);const r=u.messages,o=d(this.#e);if(!o&&this.#e.toLowerCase()!=="en-gb"&&(!r||typeof r!="object")&&k(`i18n:locale:not-loaded:${this.#e.toLowerCase()}`,`locale "${this.#e}" is not loaded: import "@toclocoinc/lattice-grid/locales/${this.#e}" to add its text; English is used until then.`),!r||typeof r!="object"){this.#t=o?{...E,...o}:E;return}const w=Object.keys(r).filter(m=>!(m in E));w.length&&k(`i18n:unknown:${w[0]}`,`message keys not in the catalogue and so ignored: ${w.slice(0,5).join(", ")}${w.length>5?`, and ${w.length-5} more`:""}`),this.#t={...E,...o||{},...r}}get locale(){return this.#e}t(u,r){return _(X(this.#t,u),r||{},this.#e)}list(u,r){return Z(u,this.#e,r)}number(u,r){const o=Number(u);return Number.isFinite(o)?o.toLocaleString(this.#e,r||{maximumFractionDigits:20}):""}}const n=new i;function a(t){return t instanceof i?t:new i(t||{})}function s(t){const u=t&&typeof t=="object"?t:{},r=q.filter(f=>{const w=u[f];return w==null||w===""||G(w)}),o=Object.keys(u).filter(f=>!(f in E));return{missing:r,unknown:o}}}),Ue("packages/core/src/columns/types/structured.js",function(e,U){"use strict";Object.defineProperty(e,"MASK_DEFAULTS",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"maskValue",{enumerable:!0,get:function(){return X}}),Object.defineProperty(e,"summariseJson",{enumerable:!0,get:function(){return G}}),Object.defineProperty(e,"canonicalJson",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"parseJsonText",{enumerable:!0,get:function(){return g}}),Object.defineProperty(e,"STRUCTURED_TYPES",{enumerable:!0,get:function(){return d}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return l}});const te=U("packages/core/src/internal/predicates.js"),E=te.isNil,q=te.isObject,_=U("packages/core/src/i18n/index.js").defaultMessages,Z=Object.freeze({char:"•",length:8,fixedLength:!0,lastVisible:0,emptyDisplay:""});function X(i,n){const a=n||{},s=a.emptyDisplay??Z.emptyDisplay;if(E(i)||i==="")return s;const u=[...typeof a.char=="string"&&a.char!==""?a.char:Z.char][0]||Z.char,r=a.fixedLength??Z.fixedLength,o=Number.isFinite(a.length)&&Number(a.length)>0?Math.floor(Number(a.length)):Z.length,f=typeof i=="string"?i:typeof i=="number"||typeof i=="boolean"||typeof i=="bigint"?String(i):null;let w=0;if(f!==null){const m=Number.isFinite(a.lastVisible)?Math.floor(Number(a.lastVisible)):Z.lastVisible,v=[...f];if(w=m>0&&m<v.length?m:0,w>0){const h=v.slice(v.length-w).join(""),p=Math.max(1,(r?o:v.length)-w);return u.repeat(p)+h}return u.repeat(r?o:Math.max(1,v.length))}return u.repeat(o)}const B=48;function Y(i){try{const n=JSON.stringify(i);return n===void 0?null:n}catch{return null}}function G(i,n){if(E(i))return"";const a=Number.isFinite(n&&n.inlineLimit)?Number(n.inlineLimit):B;if(typeof i=="string")return i.length>a?`${i.slice(0,a-1)}…`:i;if(typeof i!="object")return String(i);const s=Y(i);if(s!==null&&s.length<=a)return s;if(Array.isArray(i)){const u=i.length;return`[${_.t("count.items",{count:u})}]`}const t=Object.keys(i).length;return`{${_.t("count.keys",{count:t})}}`}function j(i,n){if(i==null)return"null";const a=typeof i;if(a==="number"||a==="boolean"||a==="bigint")return String(i);if(a==="string")return JSON.stringify(i);if(a!=="object")return JSON.stringify(String(i));const s=n||new WeakSet;return s.has(i)?'"[circular]"':(s.add(i),i instanceof Date?JSON.stringify(i.toISOString()):Array.isArray(i)?`[${i.map(r=>j(r,s)).join(",")}]`:`{${Object.keys(i).sort().map(r=>`${JSON.stringify(r)}:${j(i[r],s)}`).join(",")}}`)}function k(i,n){if(E(i))return E(n)?0:1;if(E(n))return-1;const a=j(i),s=j(n);return a<s?-1:a>s?1:0}function g(i){if(E(i))return null;const n=String(i);if(n.trim()==="")return null;try{return JSON.parse(n)}catch{return n}}function c(i){const n=i&&i.cell&&i.cell.props;return q(n)?n:{}}const d=Object.freeze({json:{base:"object",storage:"object",format:i=>G(i&&i.value,c(i&&i.column)),parse:i=>g(i&&i.text),compare:k,defaults:{editor:"code",filter:"text",align:"start"},excel:"@",toClipboard:i=>{if(E(i))return"";if(typeof i=="string")return i;try{const n=JSON.stringify(i,null,2);return n===void 0?String(i):n}catch{return String(i)}},fromClipboard:i=>g(i)},secret:{base:"text",storage:"object",format:i=>X(i&&i.value,c(i&&i.column)),parse:i=>{const n=i&&i.text;return E(n)||String(n)===""?null:String(n)},compare:(i,n)=>{const a=E(i)||i==="",s=E(n)||n==="";return a===s?0:a?1:-1},defaults:{editor:"password",filter:"none",align:"start"},excel:"@",export:{csv:!1,excel:!1},toClipboard:i=>X(i),fromClipboard:i=>E(i)||String(i)===""?null:String(i)}}),l=d}),Ue("packages/core/src/columns/types/unit.js",function(e,U){"use strict";Object.defineProperty(e,"defineUnit",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"UNIT_SYSTEMS",{enumerable:!0,get:function(){return X}}),Object.defineProperty(e,"registerUnitSystem",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"unitSystemNames",{enumerable:!0,get:function(){return k}}),Object.defineProperty(e,"unitsOf",{enumerable:!0,get:function(){return g}}),Object.defineProperty(e,"findUnit",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"localeSeparators",{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,"parseUnit",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"formatUnit",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"createUnitType",{enumerable:!0,get:function(){return $}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return C}});const E=U("packages/core/src/internal/predicates.js").isNil,z=U("packages/core/src/internal/warn.js").warnOnce;function _(A,S,x,H){return Object.freeze({symbol:A,factor:S,aliases:Object.freeze(x||[]),binary:!!(H&&H.binary),prefix:H&&H.prefix||null,auto:!(H&&H.auto===!1)})}function Z(A,S,x,H){return _(A,S,x,H)}const X=Object.freeze({data:Object.freeze([_("B",1,["byte","bytes"]),_("kB",1e3,["kilobyte","kilobytes"],{prefix:"k"}),_("KiB",1024,["kibibyte","kibibytes"],{binary:!0,prefix:"k"}),_("MB",1e6,["megabyte","megabytes"],{prefix:"m"}),_("MiB",1024**2,["mebibyte","mebibytes"],{binary:!0,prefix:"m"}),_("GB",1e9,["gigabyte","gigabytes"],{prefix:"g"}),_("GiB",1024**3,["gibibyte","gibibytes"],{binary:!0,prefix:"g"}),_("TB",1e12,["terabyte","terabytes"],{prefix:"t"}),_("TiB",1024**4,["tebibyte","tebibytes"],{binary:!0,prefix:"t"}),_("PB",1e15,["petabyte","petabytes"],{prefix:"p"})]),bitrate:Object.freeze([_("bps",1,["bit","bits","bit/s","b/s"]),_("kbps",1e3,["kbit","kbits","kbit/s","kb/s","kilobit","kilobits"],{prefix:"k"}),_("Mbps",1e6,["mbit","mbits","mbit/s","mb/s","megabit","megabits"],{prefix:"m"}),_("Gbps",1e9,["gbit","gbits","gbit/s","gb/s","gigabit","gigabits"],{prefix:"g"}),_("Tbps",1e12,["tbit","tbits","tbit/s","tb/s","terabit","terabits"],{prefix:"t"})]),length:Object.freeze([_("nm",1e-9,["nanometre","nanometres","nanometer","nanometers"]),_("µm",1e-6,["um","micrometre","micrometres","micrometer","micrometers","micron","microns"]),_("mm",.001,["millimetre","millimetres","millimeter","millimeters"]),_("cm",.01,["centimetre","centimetres","centimeter","centimeters"]),_("in",.0254,["inch","inches"],{auto:!1}),_("ft",.3048,["foot","feet"],{auto:!1}),_("yd",.9144,["yard","yards"],{auto:!1}),_("m",1,["metre","metres","meter","meters"]),_("km",1e3,["kilometre","kilometres","kilometer","kilometers"]),_("mi",1609.344,["mile","miles"],{auto:!1}),_("nmi",1852,["nauticalmile","nauticalmiles"],{auto:!1})]),mass:Object.freeze([_("mg",.001,["milligram","milligrams"]),_("g",1,["gram","grams"]),_("oz",28.349523125,["ounce","ounces"],{auto:!1}),_("lb",453.59237,["pound","pounds","lbs"],{auto:!1}),_("kg",1e3,["kilogram","kilograms"]),_("st",6350.29318,["stone"],{auto:!1}),_("t",1e6,["tonne","tonnes","ton"],{auto:!1}),_("ton (US)",907184.74,["ton","shortton"],{auto:!1}),_("ton (UK)",10160469088e-4,["ton","longton"],{auto:!1})]),duration:Object.freeze([_("ns",1e-9,["nsec","nsecs","nanosecond","nanoseconds"]),_("µs",1e-6,["us","usec","usecs","microsecond","microseconds"]),_("ms",.001,["msec","msecs","millisecond","milliseconds"]),_("s",1,["sec","secs","second","seconds"]),_("m",60,["min","mins","minute","minutes"]),_("h",3600,["hr","hrs","hour","hours"]),_("d",86400,["day","days"])]),speed:Object.freeze([_("mm/s",.001,["millimetre/s","millimeter/s"]),_("ft/s",.3048,["fps","foot/s","feet/s"],{auto:!1}),_("km/h",1/3.6,["kph","kmh","kilometre/h","kilometer/h"],{auto:!1}),_("mph",.44704,["mile/h","miles/h"],{auto:!1}),_("kn",1852/3600,["knot","knots"],{auto:!1}),_("m/s",1,["metre/s","meter/s","mps"]),_("km/s",1e3,["kilometre/s","kilometer/s"])]),acceleration:Object.freeze([_("mm/s²",.001,["mm/s2"]),_("ft/s²",.3048,["ft/s2"],{auto:!1}),_("m/s²",1,["m/s2","metre/s2","meter/s2"]),_("g",9.80665,["gee","gravity"],{auto:!1})]),area:Object.freeze([_("mm²",1e-6,["mm2"]),_("cm²",1e-4,["cm2"]),_("in²",64516e-8,["in2","sqin"],{auto:!1}),_("ft²",.09290304,["ft2","sqft"],{auto:!1}),_("yd²",.83612736,["yd2","sqyd"],{auto:!1}),_("m²",1,["m2","sqm"]),_("ha",1e4,["hectare","hectares"],{auto:!1}),_("ac",4046.8564224,["acre","acres"],{auto:!1}),_("km²",1e6,["km2","sqkm"])]),volume:Object.freeze([_("µL",1e-6,["ul","microlitre","microliter"]),_("mL",.001,["millilitre","milliliter"]),_("fl oz (US)",.0295735295625,["fl oz","usfloz"],{auto:!1}),_("fl oz (imp)",.0284130625,["fl oz","impfloz"],{auto:!1}),_("L",1,["litre","litres","liter","liters"]),_("gal (US)",3.785411784,["gal","usgal","usgallon"],{auto:!1}),_("gal (imp)",4.54609,["gal","impgal","impgallon"],{auto:!1}),_("m³",1e3,["m3","cubicmetre","cubicmeter","kl"],{auto:!1}),_("bbl",158.987294928,["barrel","barrels"],{auto:!1})]),energy:Object.freeze([_("eV",1602176634e-28,["electronvolt","electronvolts"],{auto:!1}),_("J",1,["joule","joules"]),_("cal",4.184,["calorie","calories"],{auto:!1}),_("kJ",1e3,["kilojoule","kilojoules"]),_("BTU",1055.05585262,["btu"],{auto:!1}),_("kcal",4184,["kilocalorie","kilocalories","Cal"],{auto:!1}),_("MJ",1e6,["megajoule","megajoules"]),_("kWh",36e5,["kilowatthour","kilowatthours"],{auto:!1}),_("GJ",1e9,["gigajoule","gigajoules"]),_("MWh",36e8,["megawatthour","megawatthours"],{auto:!1})]),power:Object.freeze([_("mW",.001,["milliwatt","milliwatts"]),_("W",1,["watt","watts"]),_("BTU/h",1055.05585262/3600,["btuh","btu/h"],{auto:!1}),_("kW",1e3,["kilowatt","kilowatts"]),_("hp",745.6998715822702,["horsepower"],{auto:!1}),_("MW",1e6,["megawatt","megawatts"]),_("GW",1e9,["gigawatt","gigawatts"])]),force:Object.freeze([_("mN",.001,["millinewton","millinewtons"]),_("N",1,["newton","newtons"]),_("lbf",4.4482216152605,["poundforce"],{auto:!1}),_("kgf",9.80665,["kilogramforce"],{auto:!1}),_("kN",1e3,["kilonewton","kilonewtons"]),_("MN",1e6,["meganewton","meganewtons"])]),pressure:Object.freeze([_("Pa",1,["pascal","pascals"]),_("mbar",100,["millibar"],{auto:!1}),_("inH₂O",249.0889,["inh2o"],{auto:!1}),_("mmHg",133.322387415,["torr"],{auto:!1}),_("kPa",1e3,["kilopascal","kilopascals"]),_("inHg",3386.388640341,["inhg"],{auto:!1}),_("psi",6894.757293168361,["lbf/in2"],{auto:!1}),_("bar",1e5,[],{auto:!1}),_("atm",101325,["atmosphere","atmospheres"],{auto:!1}),_("MPa",1e6,["megapascal","megapascals"]),_("GPa",1e9,["gigapascal","gigapascals"])]),torque:Object.freeze([_("N·m",1,["nm","n.m","newtonmetre","newtonmeter"]),_("lbf·ft",1.3558179483314003,["lbfft","lbf.ft","ftlb","ft-lb"],{auto:!1}),_("kN·m",1e3,["knm","kn.m"],{auto:!1}),_("MN·m",1e6,["mnm","mn.m"],{auto:!1})]),density:Object.freeze([_("kg/m³",1,["kg/m3"]),_("lb/ft³",16.01846337396014,["lb/ft3","pcf"],{auto:!1}),_("g/cm³",1e3,["g/cm3","g/ml","kg/l"],{auto:!1}),_("t/m³",1e3,["t/m3"],{auto:!1})]),flow:Object.freeze([_("L/min",1/6e4,["lpm","l/min"],{auto:!1}),_("m³/h",1/3600,["m3/h","cmh"],{auto:!1}),_("gpm (US)",.003785411784/60,["gpm","usgpm"],{auto:!1}),_("gpm (imp)",.00454609/60,["gpm","impgpm"],{auto:!1}),_("cfm",.0004719474432,["ft3/min"],{auto:!1}),_("L/s",.001,["lps","l/s"],{auto:!1}),_("m³/s",1,["m3/s","cms"])]),angle:Object.freeze([_("″",Math.PI/648e3,["arcsec","arcsecond","arcseconds"],{auto:!1}),_("′",Math.PI/10800,["arcmin","arcminute","arcminutes"],{auto:!1}),_("mrad",.001,["milliradian","milliradians"],{auto:!1}),_("mil",Math.PI/3200,["nato-mil"],{auto:!1}),_("°",Math.PI/180,["deg","degree","degrees"],{auto:!1}),_("gon",Math.PI/200,["grad","gradian","gradians"],{auto:!1}),_("rad",1,["radian","radians"]),_("turn",2*Math.PI,["rev","revolution","revolutions"],{auto:!1})]),angularVelocity:Object.freeze([_("°/s",Math.PI/180,["degps","deg/s","degrees/s"],{auto:!1}),_("rad/s",1,["radps","radians/s"]),_("rpm",2*Math.PI/60,["rev/min","r/min","revolutions/min"],{auto:!1}),_("rps",2*Math.PI,["rev/s","r/s","revolutions/s"],{auto:!1})]),fraction:Object.freeze([_("ppt",1e-12,["partspertrillion"],{auto:!1}),_("ppb",1e-9,["partsperbillion"]),_("ppm",1e-6,["partspermillion"]),_("bp",1e-4,["bps-finance","basispoint","basispoints","bips"],{auto:!1}),_("‰",.001,["permille","permil"],{auto:!1}),_("%",.01,["pct","percent"]),_("×",1,["x","ratio","times"])]),molarity:Object.freeze([_("pM",1e-12,["picomolar","picomolarity"]),_("nM",1e-9,["nanomolar","nanomolarity"]),_("µM",1e-6,["um-molar","micromolar","micromolarity"]),_("mM",.001,["millimolar","millimolarity"]),_("M",1,["molar","mol/l","mol/L","molarity"]),_("mol/m³",.001,["mol/m3"],{auto:!1})]),massFlow:Object.freeze([_("mg/s",1e-6,["milligrams/s"]),_("g/s",.001,["grams/s"]),_("kg/h",1/3600,["kilograms/h","kgph"],{auto:!1}),_("kg/s",1,["kilograms/s","kgps"]),_("t/h",1e3/3600,["tonnes/h","tph"],{auto:!1}),_("lb/h",.45359237/3600,["pounds/h","pph"],{auto:!1}),_("t/s",1e3,["tonnes/s"],{auto:!1})]),viscosity:Object.freeze([_("µPa·s",1e-6,["upas","micropascalsecond"]),_("cP",.001,["centipoise"],{auto:!1}),_("mPa·s",.001,["mpas","millipascalsecond"]),_("P",.1,["poise"],{auto:!1}),_("Pa·s",1,["pas","pascalsecond"])]),kinematicViscosity:Object.freeze([_("cSt",1e-6,["centistokes","centistoke"]),_("mm²/s",1e-6,["mm2/s"],{auto:!1}),_("St",1e-4,["stokes","stoke"],{auto:!1}),_("m²/s",1,["m2/s"])]),thermalConductivity:Object.freeze([_("mW/(m·K)",.001,["mw/mk"]),_("W/(m·K)",1,["w/mk","wmk"]),_("kW/(m·K)",1e3,["kw/mk"],{auto:!1}),_("BTU/(hr·ft·°F)",1.730734666,["btu/hrftf"],{auto:!1})]),specificHeat:Object.freeze([_("J/(kg·K)",1,["j/kgk","jkgk"]),_("kJ/(kg·K)",1e3,["kj/kgk"]),_("cal/(g·°C)",4184,["cal/gc"],{auto:!1})]),doseRate:Object.freeze([_("nSv/h",1e-9,["nsvh"]),_("µSv/h",1e-6,["usv/h","usvh"]),_("mSv/h",.001,["msvh"]),_("Sv/h",1,["svh"]),_("mSv/a",.001/8766,["msv/year","msvpa"],{auto:!1})])}),B=Symbol("ambiguous"),Y=new Map,G=new Map;function j(A,S){const x=String(A||"").trim();if(!x)throw new Error("[lattice] a unit system needs a name");if(X[x]||G.has(x))throw new Error(`[lattice] unit system "${x}" already exists`);const H=[...S||[]];if(!H.length)throw new Error(`[lattice] unit system "${x}" has no units`);if(!H.some(W=>W.factor===1))throw new Error(`[lattice] unit system "${x}" has no base unit (none with factor 1)`);const V=new Set;for(const W of H){if(V.has(W.symbol))throw new Error(`[lattice] unit system "${x}" declares "${W.symbol}" twice`);V.add(W.symbol)}return G.set(x,Object.freeze(H)),Y.delete(x),x}function k(){return[...Object.keys(X),...G.keys()]}function g(A){const S=c(A);return S?S.units:[]}function c(A){const S=String(A||""),x=Y.get(S);if(x!==void 0)return x;const H=X[S]||G.get(S);if(!H)return Y.set(S,null),null;const V=Object.freeze([...H].sort((ae,ue)=>ae.factor-ue.factor)),W=new Map,Q=new Map,ee=(ae,ue)=>{const ge=W.get(ae);ge===void 0?W.set(ae,ue):ge!==ue&&W.set(ae,B)};for(const ae of V){ee(ae.symbol.toLowerCase(),ae);for(const ue of ae.aliases)ee(ue.toLowerCase(),ae);if(ae.prefix){const ue=Q.get(ae.prefix)||[];ue.push(ae),Q.set(ae.prefix,ue)}}const re={units:V,byToken:W,byPrefix:Q,decimal:V.filter(ae=>!ae.binary&&ae.auto),binary:V.some(ae=>ae.binary)?V.filter(ae=>(ae.binary||ae.factor===1)&&ae.auto):null};return Y.set(S,re),re}function d(A,S){return S&&A.binary||A.decimal}function l(A,S){const x=c(A);if(!x||E(S))return null;const H=x.units.find(W=>W.symbol===String(S));if(H)return H;const V=x.byToken.get(String(S).trim().toLowerCase());return V&&V!==B?V:null}const i=new WeakMap;function n(A){const S=A||{};if(typeof S=="object"&&S!==null){const W=i.get(S);if(W!==void 0)return W}const x=S.system||"data",H=c(x);let V=null;if(!H)z(`unit:system:${x}`,`unknown unit system "${x}"; known systems are ${k().join(", ")}`);else{let W=S.unit?l(x,S.unit):null;W||(S.unit&&z(`unit:unit:${x}:${S.unit}`,`unknown unit "${S.unit}" in system "${x}"; falling back to ${H.units[0].symbol}`),W=H.units.find(Q=>Q.factor===1)||H.units[0]),V={index:H,base:W,binary:S.binary===!0}}return typeof S=="object"&&S!==null&&i.set(S,V),V}const a=new WeakMap;function s(A,S){if(!A||!S||!Array.isArray(A.compound)||A.compound.length===0)return null;const x=a.get(A);if(x!==void 0)return x;const H=new Set,V=[];for(const Q of A.compound){const ee=l(A.system||"data",Q);if(!ee){z(`unit:compound:${A.system}:${Q}`,`unknown compound unit "${Q}" in system "${A.system||"data"}"; ignoring it`);continue}H.has(ee.symbol)||(H.add(ee.symbol),V.push(ee))}V.sort((Q,ee)=>ee.factor-Q.factor);const W=V.length>=2?V:null;return a.set(A,W),W}function t(A,S,x){return S===x||S.factor===x.factor?A:A*S.factor/x.factor}const u=new Map;function r(A){const S=A||"",x=u.get(S);if(x)return x;const H={group:",",decimal:"."};try{for(const V of new Intl.NumberFormat(A||void 0).formatToParts(12345.6))V.type==="group"?H.group=V.value:V.type==="decimal"&&(H.decimal=V.value)}catch{}return u.set(S,H),H}const o=/[\s ]/g,f=/^[+-]?[\d '’ .,]*(?:[eE][+-]?\d+)?/,w=/^[^\d+\-(.,\s]+\s*/,m=/^[+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?$/;function v(A,S){const{group:x,decimal:H}=r(S);let V=String(A).replace(o,"");if(V==="")return null;const W=H?V.indexOf(H):-1;if(x&&x!==H){if(W>=0&&V.indexOf(x,W+H.length)>=0)return null;V=V.split(x).join("")}if(H&&H!=="."&&(V=V.split(H).join(".")),!m.test(V))return null;const Q=Number(V);return Number.isFinite(Q)?Q:null}function h(A,S,x){const H=String(A).trim().replace(/\.$/,"");if(H==="")return null;const V=S.units.find(ue=>ue.symbol===H);if(V)return V;const W=H.toLowerCase(),Q=S.byToken.get(W);if(Q===B)return null;if(Q)return Q;const ee=S.byPrefix.get(W);if(!ee||!ee.length)return null;const re=d(S,x),ae=ee.filter(ue=>re.includes(ue));return ae.length===1?ae[0]:null}function p(A,S,x,H){let V=A,W=0,Q=!1,ee=!1;for(;V!=="";){const re=f.exec(V)[0];if(re==="")return null;const ae=v(re,H&&H.locale);if(ae===null)return null;V=V.slice(re.length).trim();const ue=V.search(/[+-]?[\d]/),ge=(ue>=0?V.slice(0,ue):V).trim();if(V=ue>=0?V.slice(ue).trim():"",ge===""){if(Q)return null;ee=!0,W+=t(ae,x[0],S.base)}else{const Ae=h(ge,S.index,S.binary);if(!Ae)return null;W+=t(ae,Ae,S.base)}if(Q=!0,ee&&V!=="")return null}return Q?W:null}function b(A,S){if(E(A))return null;if(typeof A=="number")return Number.isFinite(A)?A:null;const x=n(S);if(!x)return null;let H=String(A).trim();if(H==="")return null;let V=!1;H.startsWith("(")&&H.endsWith(")")&&(V=!0,H=H.slice(1,-1).trim());const W=s(S,x);if(W){H.startsWith("-")&&(V=!0,H=H.slice(1).trim());const pe=p(H,x,W,S);return pe===null?null:V?-pe:pe}let Q=null;const ee=w.exec(H);if(ee&&ee[0]){const pe=h(ee[0].trim(),x.index,x.binary);pe&&(Q=pe,H=H.slice(ee[0].length).trim())}const re=f.exec(H)[0],ae=v(re,S&&S.locale);if(ae===null)return null;const ue=H.slice(re.length).trim();if(Q&&ue!=="")return null;const ge=Q||(ue===""?x.base:h(ue,x.index,x.binary));if(!ge)return null;const Ae=t(ae,ge,x.base);return V?-Ae:Ae}const O=new Map;function y(A,S,x,H){const V=`${A||""}|${S}|${x}|${H?1:0}`;let W=O.get(V);return W||(W=new Intl.NumberFormat(A||void 0,{minimumFractionDigits:S,maximumFractionDigits:x,useGrouping:H}),O.set(V,W)),W}function L(A,S){if(!Number.isFinite(A)||A===0)return Math.max(0,S-1);const x=Math.floor(Math.log10(Math.abs(A)));return Math.min(20,Math.max(0,S-1-x))}function M(A,S){if(!Number.isFinite(A)||A===0)return A;const x=Math.ceil(Math.log10(Math.abs(A))),H=10**(S-x);return Math.round(A*H)/H}function D(A,S,x){if(!x||x===S.base.symbol)return S.base;if(x!=="auto")return F(S,x);if(A===0||!Number.isFinite(A))return S.base;const H=Math.abs(A)*S.base.factor,V=d(S.index,S.binary);let W=V[0];for(const re of V)H>=re.factor&&(W=re);if(H>=W.factor)return W;let Q=W;for(const re of S.index.units)re.binary!==S.binary&&re.factor!==1||re.factor<=H&&re.factor>(Q===W?0:Q.factor)&&(Q=re);if(Q!==W)return Q;let ee=W;for(const re of S.index.units)re.binary!==S.binary&&re.factor!==1||re.factor<ee.factor&&(ee=re);return ee.factor<S.base.factor?ee:S.base}function F(A,S){const x=A.index.units.find(V=>V.symbol===S);if(x)return x;const H=A.index.byToken.get(String(S).toLowerCase());return H&&H!==B?H:(z(`unit:display:${S}`,`unknown display unit "${S}"; rendering in ${A.base.symbol}`),A.base)}function T(A,S,x,H){const V=A<0;let W=Math.abs(A)*S.base.factor;const Q=typeof H.decimals=="number"?H.decimals:H.minDecimals??0,ee=typeof H.decimals=="number"?H.decimals:H.maxDecimals??Math.max(Q,2),re=H.space??" ",ae=[];for(let ge=0;ge<x.length;ge++){const Ae=x[ge],pe=ge===x.length-1;let Me=pe?W/Ae.factor:Math.floor(W/Ae.factor);if(W-=Me*Ae.factor,pe){const Pe=10**ee;Me=Math.round(Me*Pe)/Pe+0}const Ne=pe?y(H.locale,Q,ee,H.group!==!1):y(H.locale,0,0,H.group!==!1);ae.push(`${Ne.format(Me)}${re}${Ae.symbol}`)}const ue=ae.join(" ");return V?`-${ue}`:ue}function I(A,S){const x=S||{},H=x.nullDisplay??"";if(E(A)||A==="")return H;const V=typeof A=="number"?A:Number(A);if(!Number.isFinite(V))return H;const W=n(x);if(!W)return String(V);const Q=s(x,W);if(Q)return T(V,W,Q,x);const ee=typeof x.significantFigures=="number"&&x.significantFigures>0?x.significantFigures:0,re=ee?M(V,ee):V,ae=D(re,W,x.display),ue=t(re,W.base,ae);let ge=typeof x.decimals=="number"?x.decimals:x.minDecimals??0,Ae=typeof x.decimals=="number"?x.decimals:x.maxDecimals??Math.max(ge,2);ee&&(ge=L(ue,ee),Ae=ge);const pe=y(x.locale,ge,Ae,x.group!==!1).format(ue),Me=x.space??" ";return x.placement==="prefix"?`${ae.symbol}${x.space??""}${pe}`:`${pe}${Me}${ae.symbol}`}function P(A,S){const x=E(A)||Number.isNaN(A)?null:Number(A),H=E(S)||Number.isNaN(S)?null:Number(S);return x===null||Number.isNaN(x)?H===null||Number.isNaN(H)?0:1:H===null||Number.isNaN(H)||x<H?-1:x>H?1:0}function R(A){const S=typeof A.decimals=="number"&&A.decimals>0?`.${"0".repeat(A.decimals)}`:"";return`${typeof A.decimals=="number"?`#,##0${S}`:"#,##0.##"}" ${A.symbol}"`}function $(A){const S={system:"data",...A||{}},x=n(S),H=x?x.base.symbol:String(S.unit||""),V=Object.freeze({...S,unit:H}),W=Object.freeze({...V,display:H,decimals:void 0,minDecimals:0,maxDecimals:20,group:!1}),Q=new Map([[V.locale||"",V]]),ee=re=>{const ae=re||"";let ue=Q.get(ae);return ue||(ue=Object.freeze({...V,locale:re||void 0}),Q.set(ae,ue)),ue};return{base:"number",extends:"number",storage:"float64",unitConfig:V,format:re=>I(re.value,re.locale?ee(re.locale):V),parse:re=>b(re.text,re.locale?ee(re.locale):V),compare:P,defaults:{filter:"number",editor:"unit",align:"end",total:S.total||"sum"},...S.totals?{totals:S.totals}:{},excel:S.excel||R({decimals:S.decimals,symbol:H}),toStorage:re=>typeof re=="number"?Number.isFinite(re)?re:null:typeof re=="string"?b(re,V):E(re)?null:b(String(re),V),toClipboard:re=>I(re,W),fromClipboard:re=>b(re,V)}}const C=$}),Ue("packages/core/src/columns/types/engineering.js",function(e,U){"use strict";Object.defineProperty(e,"ENGINEERING_TYPES",{enumerable:!0,get:function(){return X}}),Object.defineProperty(e,"circularMean",{enumerable:!0,get:function(){return _}});const E=U("packages/core/src/internal/predicates.js").isNil,z=U("packages/core/src/columns/types/unit.js").createUnitType;function _(B){const Y=2*Math.PI/B;return G=>{let j=0,k=0,g=0;for(const d of G||[]){if(E(d))continue;const l=Number(d);Number.isFinite(l)&&(j+=Math.cos(l*Y),k+=Math.sin(l*Y),g+=1)}return!g||Math.hypot(j,k)/g<1e-12?null:(Math.atan2(k,j)/Y%B+B)%B}}function Z(B){return{supported:["sum","avg","min","max","count","countValues"],implement:{avg:_(B)}}}const X=Object.freeze({metres:z({system:"length",unit:"m",display:"auto",maxDecimals:3}),millimetres:z({system:"length",unit:"mm",maxDecimals:2}),kilometres:z({system:"length",unit:"km",maxDecimals:3}),grams:z({system:"mass",unit:"g",display:"auto",maxDecimals:3}),kilograms:z({system:"mass",unit:"kg",maxDecimals:3}),tonnes:z({system:"mass",unit:"t",maxDecimals:3}),seconds:z({system:"duration",unit:"s",display:"auto",maxDecimals:3}),milliseconds:z({system:"duration",unit:"ms",maxDecimals:3}),hours:z({system:"duration",unit:"h",maxDecimals:2}),speed:z({system:"speed",unit:"m/s",display:"auto",maxDecimals:2}),kph:z({system:"speed",unit:"km/h",maxDecimals:1}),mph:z({system:"speed",unit:"mph",maxDecimals:1}),knots:z({system:"speed",unit:"kn",maxDecimals:1}),acceleration:z({system:"acceleration",unit:"m/s²",maxDecimals:3}),area:z({system:"area",unit:"m²",display:"auto",maxDecimals:2}),hectares:z({system:"area",unit:"ha",maxDecimals:4}),volume:z({system:"volume",unit:"L",display:"auto",maxDecimals:3}),cubicMetres:z({system:"volume",unit:"m³",maxDecimals:3}),energy:z({system:"energy",unit:"J",display:"auto",maxDecimals:3}),kilowattHours:z({system:"energy",unit:"kWh",maxDecimals:2}),power:z({system:"power",unit:"W",display:"auto",maxDecimals:2}),kilowatts:z({system:"power",unit:"kW",maxDecimals:2}),force:z({system:"force",unit:"N",display:"auto",maxDecimals:2}),pressure:z({system:"pressure",unit:"Pa",display:"auto",maxDecimals:2}),bar:z({system:"pressure",unit:"bar",maxDecimals:3}),psi:z({system:"pressure",unit:"psi",maxDecimals:1}),torque:z({system:"torque",unit:"N·m",maxDecimals:2}),density:z({system:"density",unit:"kg/m³",maxDecimals:2}),flow:z({system:"flow",unit:"m³/s",maxDecimals:4}),litresPerMinute:z({system:"flow",unit:"L/min",maxDecimals:1}),radians:z({system:"angle",unit:"rad",maxDecimals:4,totals:Z(2*Math.PI)}),degrees:z({system:"angle",unit:"°",maxDecimals:2,totals:Z(360)}),rpm:z({system:"angularVelocity",unit:"rpm",maxDecimals:0}),angularVelocity:z({system:"angularVelocity",unit:"rad/s",maxDecimals:3}),ppm:z({system:"fraction",unit:"ppm",maxDecimals:2}),ppb:z({system:"fraction",unit:"ppb",maxDecimals:2}),basisPoints:z({system:"fraction",unit:"bp",maxDecimals:1}),molarity:z({system:"molarity",unit:"M",display:"auto",maxDecimals:3}),massFlow:z({system:"massFlow",unit:"kg/s",maxDecimals:3}),tonnesPerHour:z({system:"massFlow",unit:"t/h",maxDecimals:2}),viscosity:z({system:"viscosity",unit:"Pa·s",display:"auto",maxDecimals:3}),kinematicViscosity:z({system:"kinematicViscosity",unit:"cSt",maxDecimals:2}),thermalConductivity:z({system:"thermalConductivity",unit:"W/(m·K)",maxDecimals:3}),specificHeat:z({system:"specificHeat",unit:"J/(kg·K)",maxDecimals:1}),doseRate:z({system:"doseRate",unit:"µSv/h",display:"auto",maxDecimals:2})})}),Ue("packages/core/src/columns/types/si.js",function(e,U){"use strict";Object.defineProperty(e,"SI_PREFIXES",{enumerable:!0,get:function(){return _}}),Object.defineProperty(e,"siUnits",{enumerable:!0,get:function(){return X}}),Object.defineProperty(e,"createSiSystem",{enumerable:!0,get:function(){return B}}),Object.defineProperty(e,"createSiType",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(e,"SI_TYPES",{enumerable:!0,get:function(){return G}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return j}});const te=U("packages/core/src/columns/types/unit.js"),E=te.defineUnit,q=te.registerUnitSystem,z=te.createUnitType,_=Object.freeze([Object.freeze({symbol:"f",name:"femto",factor:1e-15}),Object.freeze({symbol:"p",name:"pico",factor:1e-12}),Object.freeze({symbol:"n",name:"nano",factor:1e-9}),Object.freeze({symbol:"µ",name:"micro",factor:1e-6}),Object.freeze({symbol:"m",name:"milli",factor:.001}),Object.freeze({symbol:"c",name:"centi",factor:.01}),Object.freeze({symbol:"",name:"",factor:1}),Object.freeze({symbol:"k",name:"kilo",factor:1e3}),Object.freeze({symbol:"M",name:"mega",factor:1e6}),Object.freeze({symbol:"G",name:"giga",factor:1e9}),Object.freeze({symbol:"T",name:"tera",factor:1e12}),Object.freeze({symbol:"P",name:"peta",factor:1e15})]),Z=Object.freeze(["p","n","µ","m","","k","M","G"]);function X(k){const g=String(k.base),c=new Set([...k.prefixes||Z,""]),d=[];for(const l of _){if(!c.has(l.symbol))continue;const i=`${l.symbol}${g}`,n=[];if(k.name){n.push(`${l.name}${k.name}`,`${l.name}${k.name}s`);const a=l.name.slice(-1);if(a&&k.name.startsWith(a)){const s=`${l.name.slice(0,-1)}${k.name}`;n.push(s,`${s}s`)}}l.symbol==="µ"&&n.push(`u${g}`),l.factor===1&&k.aliases&&n.push(...k.aliases),d.push(E(i,l.factor,n))}for(const l of k.extra||[])d.push(l);return d}function B(k,g){const c=X(g);return q(k,c)}function Y(k,g,c){return B(k,g),z({system:k,unit:g.base,display:"auto",maxDecimals:3,...c||{}})}const G=Object.freeze({voltage:Y("voltage",{base:"V",name:"volt"}),current:Y("current",{base:"A",name:"amp",aliases:["ampere","amperes"]}),resistance:Y("resistance",{base:"Ω",name:"ohm",aliases:["ohm","ohms","R"],prefixes:["m","","k","M","G"]}),capacitance:Y("capacitance",{base:"F",name:"farad",prefixes:["f","p","n","µ","m",""]}),inductance:Y("inductance",{base:"H",name:"henry",prefixes:["p","n","µ","m",""]}),charge:Y("charge",{base:"C",name:"coulomb",prefixes:["p","n","µ","m",""],extra:[E("mAh",3.6,["milliamphour","milliamphours"],{auto:!1}),E("Ah",3600,["amphour","amphours"],{auto:!1})]}),conductance:Y("conductance",{base:"S",name:"siemens",prefixes:["n","µ","m","","k"]}),fluxDensity:Y("fluxDensity",{base:"T",name:"tesla",prefixes:["n","µ","m",""],extra:[E("G",1e-4,["gauss"],{auto:!1})]}),luminousFlux:Y("luminousFlux",{base:"lm",name:"lumen",prefixes:["m","","k"]}),illuminance:Y("illuminance",{base:"lx",name:"lux",prefixes:["m","","k"]}),luminousIntensity:Y("luminousIntensity",{base:"cd",name:"candela",prefixes:["m","","k"]}),substance:Y("substance",{base:"mol",name:"mole",prefixes:["n","µ","m","","k"]}),absorbedDose:Y("absorbedDose",{base:"Gy",name:"gray",prefixes:["µ","m",""]}),equivalentDose:Y("equivalentDose",{base:"Sv",name:"sievert",prefixes:["n","µ","m",""]}),radioactivity:Y("radioactivity",{base:"Bq",name:"becquerel",prefixes:["","k","M","G","T"],extra:[E("Ci",37e9,["curie","curies"],{auto:!1})]}),frequency:Y("frequency",{base:"Hz",name:"hertz",prefixes:["m","","k","M","G","T"]})}),j=Y}),Ue("packages/core/src/columns/types/temperature.js",function(e,U){"use strict";Object.defineProperty(e,"TEMPERATURE_SCALES",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"findScale",{enumerable:!0,get:function(){return z}}),Object.defineProperty(e,"convertTemperature",{enumerable:!0,get:function(){return _}}),Object.defineProperty(e,"formatTemperature",{enumerable:!0,get:function(){return B}}),Object.defineProperty(e,"parseTemperature",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"createTemperatureType",{enumerable:!0,get:function(){return k}}),Object.defineProperty(e,"TEMPERATURE_TYPES",{enumerable:!0,get:function(){return g}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return c}});const E=U("packages/core/src/internal/predicates.js").isNil,q=Object.freeze({C:Object.freeze({symbol:"°C",aliases:["c","°c","celsius","centigrade"],toKelvin:d=>d+273.15,fromKelvin:d=>d-273.15}),F:Object.freeze({symbol:"°F",aliases:["f","°f","fahrenheit"],toKelvin:d=>(d+459.67)*(5/9),fromKelvin:d=>d*(9/5)-459.67}),K:Object.freeze({symbol:"K",aliases:["k","kelvin"],toKelvin:d=>d,fromKelvin:d=>d}),R:Object.freeze({symbol:"°R",aliases:["r","°r","rankine"],toKelvin:d=>d*(5/9),fromKelvin:d=>d*(9/5)})});function z(d){if(E(d))return null;const l=String(d).trim();if(l==="")return null;for(const[n,a]of Object.entries(q))if(l===n||l===a.symbol)return{key:n,scale:a};const i=l.toLowerCase();for(const[n,a]of Object.entries(q))if(a.aliases.includes(i))return{key:n,scale:a};return null}function _(d,l,i){const n=z(l),a=z(i);return!n||!a||!Number.isFinite(Number(d))?null:n.key===a.key?Number(d):a.scale.fromKelvin(n.scale.toKelvin(Number(d)))}const Z=new Map;function X(d,l,i){const n=`${d||""}|${l}|${i}`;let a=Z.get(n);return a||(a=new Intl.NumberFormat(d||void 0,{minimumFractionDigits:l,maximumFractionDigits:i}),Z.set(n,a)),a}function B(d,l){const i=l||{},n=i.nullDisplay??"";if(E(d)||d==="")return n;const a=Number(d);if(!Number.isFinite(a))return n;const s=z(i.scale||"C");if(!s)return String(a);const t=z(i.display||i.scale||"C")||s,u=t.key===s.key?a:t.scale.fromKelvin(s.scale.toKelvin(a)),r=typeof i.decimals=="number"?i.decimals:null,o=r??i.minDecimals??0,f=r??i.maxDecimals??1;return`${X(i.locale,o,f).format(u)}${i.space??" "}${t.scale.symbol}`}const Y=/^[+-]?[\d\s., ]*\d/;function G(d,l){const i=String(d).trim();if(i==="")return null;const n=new Intl.NumberFormat(l||void 0).formatToParts(1.1).find(u=>u.type==="decimal")?.value||".",a=n===","?".":",",s=i.split(a).join("").split(/[\s ]/).join("").replace(n,"."),t=Number(s);return Number.isFinite(t)?t:null}function j(d,l){if(E(d))return null;const i=l||{},n=z(i.scale||"C");if(!n)return null;if(typeof d=="number")return Number.isFinite(d)?d:null;let a=String(d).trim();if(a==="")return null;let s=!1;a.startsWith("(")&&a.endsWith(")")&&(s=!0,a=a.slice(1,-1).trim());const t=Y.exec(a);if(!t)return null;const u=G(t[0],i.locale);if(u===null)return null;const r=a.slice(t[0].length).trim();if(r==="")return s?-u:u;const o=z(r);if(!o)return null;const f=o.key===n.key?u:n.scale.fromKelvin(o.scale.toKelvin(u));return s?-f:f}function k(d){const l=Object.freeze({scale:"C",...d||{}}),n=(z(l.scale)||z("C")).scale.symbol,a=Object.freeze({...l,display:l.scale,decimals:void 0,minDecimals:0,maxDecimals:20}),s=new Map([[l.locale||"",l]]),t=u=>{const r=u||"";let o=s.get(r);return o||(o=Object.freeze({...l,locale:u||void 0}),s.set(r,o)),o};return{base:"number",extends:"number",storage:"float64",temperatureConfig:l,format:u=>B(u.value,u.locale?t(u.locale):l),parse:u=>j(u.text,u.locale?t(u.locale):l),defaults:{filter:"number",editor:"temperature",align:"end",total:"avg"},totals:{supported:["avg","min","max","count","countValues"]},excel:l.excel||`#,##0${typeof l.decimals=="number"&&l.decimals>0?`.${"0".repeat(l.decimals)}`:".#"}" ${n}"`,toStorage:u=>typeof u=="number"?Number.isFinite(u)?u:null:typeof u=="string"?j(u,l):E(u)?null:j(String(u),l),toClipboard:u=>B(u,a),fromClipboard:u=>j(u,l)}}const g=Object.freeze({celsius:k({scale:"C"}),fahrenheit:k({scale:"F"}),kelvin:k({scale:"K"})}),c=k}),Ue("packages/core/src/columns/types/radix.js",function(e,U){"use strict";Object.defineProperty(e,"RADIX_PRESETS",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"digitsForWidth",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"radixRange",{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,"radixName",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"normaliseRadixOptions",{enumerable:!0,get:function(){return w}}),Object.defineProperty(e,"compileRadixFormat",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"formatRadix",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"compileRadixParse",{enumerable:!0,get:function(){return O}}),Object.defineProperty(e,"parseRadixResult",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"parseRadix",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"createRadixType",{enumerable:!0,get:function(){return F}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return T}});const E=U("packages/core/src/internal/predicates.js").isNil,z=U("packages/core/src/internal/warn.js").warnOnce,_=Object.freeze({2:2,8:8,16:16,bin:2,binary:2,base2:2,oct:8,octal:8,base8:8,hex:16,hexadecimal:16,base16:16}),Z=Object.freeze({2:1,8:3,16:4}),X=Object.freeze({2:"0b",8:"0o",16:"0x"}),B=Object.freeze({2:4,8:3,16:2}),Y=Object.freeze({2:/^[01]+$/,8:/^[0-7]+$/,16:/^[0-9a-f]+$/i}),G=Object.freeze({2:"binary",8:"octal",16:"hexadecimal"}),j=Object.freeze([[/^0x/i,16],[/^0b/i,2],[/^0o/i,8],[/^#/,16]]),k=/[\s\u00a0\u202f_,']/g,g=/^\d+(?:\.\d+)?(?:e[+-]?\d+)?$/i,c=Object.freeze([8,16,32,53]),d=new WeakSet,l=new WeakMap,i=new Map,n=new WeakMap,a=new WeakMap,s=Object.freeze({hex:Object.freeze({radix:16}),hex8:Object.freeze({radix:16,bitWidth:8,pad:!0,signed:!1}),hex16:Object.freeze({radix:16,bitWidth:16,pad:!0,signed:!1}),hex32:Object.freeze({radix:16,bitWidth:32,pad:!0,signed:!1}),binary:Object.freeze({radix:2}),binary8:Object.freeze({radix:2,bitWidth:8,pad:!0,signed:!1,group:4}),octal:Object.freeze({radix:8})});function t(I){if(I==null)return 16;const P=typeof I=="string"?I.toLowerCase():I,R=_[P];return R||(z(`radix:base:${String(I)}`,`unsupported radix ${String(I)}; use 2, 8, 16, 'binary', 'octal' or 'hex'. Falling back to hex`),16)}function u(I,P){return Math.ceil(I/Z[P])}function r(I,P){if(!I)return P?{min:-Number.MAX_SAFE_INTEGER,max:Number.MAX_SAFE_INTEGER}:{min:0,max:Number.MAX_SAFE_INTEGER};if(!P)return{min:0,max:2**I-1};const R=2**(I-1);return{min:-R,max:R-1}}function o(I){return G[I]||"hexadecimal"}function f(I){if(typeof I=="string"){const P=s[I];return P||z(`radix:preset:${I}`,`unknown radix preset "${I}"; known presets are ${Object.keys(s).join(", ")}`),{...P||{}}}if(I&&typeof I.preset=="string"){const P=s[I.preset];return P||z(`radix:preset:${I.preset}`,`unknown radix preset "${I.preset}"; known presets are ${Object.keys(s).join(", ")}`),{...P||{},...I}}return I||{}}function w(I){const P=f(I),R=t(P.radix),$=Z[R];let C=null;if(P.bitWidth!==void 0&&P.bitWidth!==null&&P.bitWidth!==!1){const re=Number(P.bitWidth);c.includes(re)?C=re:z(`radix:width:${String(P.bitWidth)}`,`unsupported bitWidth ${String(P.bitWidth)}; use 8, 16, 32 or 53. Ignoring it`)}let A=P.signed!==!1;!A&&C===null&&(z("radix:unsigned:width","signed: false needs a bitWidth to render a two's-complement pattern; defaulting to 32"),C=32);const S=P.prefix===void 0||P.prefix===!0?X[R]:P.prefix===!1?"":String(P.prefix);let x=0;P.pad===!0?x=C?u(C,R):0:typeof P.pad=="number"&&P.pad>0&&(x=Math.floor(P.pad));let H=0;P.group===!0?H=B[R]:typeof P.group=="number"&&P.group>0&&(H=Math.floor(P.group));const V=r(C,A),W=typeof P.min=="number"?Math.max(V.min,P.min):V.min,Q=typeof P.max=="number"?Math.min(V.max,P.max):V.max,ee=Object.freeze({radix:R,bits:$,prefix:S,uppercase:P.uppercase!==!1,pad:x,group:H,groupSeparator:typeof P.groupSeparator=="string"?P.groupSeparator:" ",bitWidth:C,signed:A,min:W,max:Q<W?W:Q,nullDisplay:typeof P.nullDisplay=="string"?P.nullDisplay:"",name:o(R)});return d.add(ee),ee}function m(I){if(I&&d.has(I))return I;if(typeof I=="string"){let P=i.get(I);return P||(P=w(I),i.set(I,P)),P}if(I&&typeof I=="object"){let P=l.get(I);return P||(P=w(I),l.set(I,P)),P}return m("hex")}function v(I){return I<0?-Math.round(-I):Math.round(I)}function h(I,P,R){if(P<=0||I.length<=P)return I;const $=I.length%P||P,C=[I.slice(0,$)];for(let A=$;A<I.length;A+=P)C.push(I.slice(A,A+P));return C.join(R)}function p(I){const P=m(I),{radix:R,prefix:$,uppercase:C,pad:A,group:S,groupSeparator:x,signed:H,bitWidth:V,nullDisplay:W}=P,Q=V?2**V:0,ee=re=>{if(E(re)||re==="")return W;const ae=typeof re=="number"?re:Number(re);if(!Number.isFinite(ae))return W;const ue=v(ae);let ge="",Ae=ue;ue<0&&(H?(ge="-",Ae=-ue):Ae=(ue%Q+Q)%Q);let pe=Ae.toString(R);return pe=C?pe.toUpperCase():pe.toLowerCase(),A>0&&pe.length<A&&(pe=pe.padStart(A,"0")),S>0&&(pe=h(pe,S,x)),ge+$+pe};return ee.options=P,ee}function b(I,P){const R=m(P);let $=n.get(R);return $||($=p(R),n.set(R,$)),$(I)}function O(I){const P=m(I),{radix:R,groupSeparator:$,signed:C,min:A,max:S}=P,x=Y[R],H=V=>{if(E(V))return{ok:!0,value:null,reason:"blank"};let W=String(V);if($&&$!==""&&(W=W.split($).join("")),W=W.replace(k,""),W==="")return{ok:!0,value:null,reason:"blank"};let Q=!1;if((W[0]==="-"||W[0]==="+")&&(Q=W[0]==="-",W=W.slice(1)),W==="")return{ok:!1,value:null,reason:"digits"};let ee=null;for(const[ae,ue]of j){const ge=ae.exec(W);if(!ge)continue;const Ae=W.slice(ge[0].length);if(Ae==="")break;if(!Y[ue].test(Ae))return{ok:!1,value:null,reason:"digits"};ee=parseInt(Ae,ue);break}if(ee===null)if(x.test(W))ee=parseInt(W,R);else if(g.test(W))ee=Number(W);else return{ok:!1,value:null,reason:"digits"};if(!Number.isFinite(ee))return{ok:!1,value:null,reason:"digits"};const re=v(Q?-ee:ee);return!C&&re<0?{ok:!1,value:re,reason:"negative"}:re<A||re>S?{ok:!1,value:re,reason:"range"}:{ok:!0,value:re,reason:"ok"}};return H.options=P,H}function y(I,P){const R=m(P);let $=a.get(R);return $||($=O(R),a.set(R,$)),$(I)}function L(I,P){const R=y(I,P);return R.ok?R.value:null}function M(I,P){const R=E(I)||Number.isNaN(I)?null:Number(I),$=E(P)||Number.isNaN(P)?null:Number(P);return R===null?$===null?0:1:$===null||R<$?-1:R>$?1:0}function D(I){const P=I.min>=-2147483648&&I.max<=2147483647;return I.bitWidth&&P?"int32":"float64"}function F(I){const P=w(I),R=p(P),$=O(P);return{base:"number",extends:"number",storage:D(P),matches:null,format:C=>R(C.value),parse:C=>{const A=$(C.text);return A.ok?A.value:null},compare:M,defaults:{filter:"number",editor:"radix",total:"sum",align:"end"},excel:"General",toClipboard:C=>R(C),fromClipboard:C=>{const A=$(C);return A.ok?A.value:null},radix:P,formatValue:R,parseText:$}}const T=F}),Ue("packages/core/src/columns/types/aggregable.js",function(e,U){"use strict";Object.defineProperty(e,"createLogarithmicType",{enumerable:!0,get:function(){return X}}),Object.defineProperty(e,"createRatioType",{enumerable:!0,get:function(){return B}}),Object.defineProperty(e,"AGGREGABLE_TYPES",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(e,"weightedMean",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"logarithmicSum",{enumerable:!0,get:function(){return z}}),Object.defineProperty(e,"logarithmicMean",{enumerable:!0,get:function(){return _}});const E=U("packages/core/src/internal/predicates.js").isNil;function q(G){const j=[];for(const k of G||[]){if(E(k))continue;const g=Number(k);Number.isFinite(g)&&j.push(g)}return j}function z(G){return j=>{const k=q(j);if(!k.length)return null;let g=0;for(const c of k)g+=10**(c/G);return G*Math.log10(g)}}function _(G){return j=>{const k=q(j);if(!k.length)return null;let g=0;for(const c of k)g+=10**(c/G);return G*Math.log10(g/k.length)}}function Z(G,j){const k=j&&j.column,c=(k&&k.typeOptions||{}).weight,d=j&&j.valueAt;if(!c||typeof d!="function")return null;let l=0,i=0;for(let n=0;n<G.length;n++){if(E(G[n]))continue;const a=Number(G[n]);if(!Number.isFinite(a))continue;const s=d(c,n);if(E(s))continue;const t=Number(s);!Number.isFinite(t)||t<=0||(l+=a*t,i+=t)}return i===0?null:l/i}function X(G={}){const j=G.factor===20?20:10,k=typeof G.suffix=="string"?G.suffix:"",g=Number.isInteger(G.decimals)?G.decimals:1;return{base:"number",storage:"float64",name:G.name||"logarithmic",format:c=>{const d=c&&c.value;return E(d)||!Number.isFinite(Number(d))?"":`${Number(d).toFixed(g)}${k}`},parse:c=>{const d=String((c&&c.text)??"").replace(k,"").trim();if(!d)return null;const l=Number(d);return Number.isFinite(l)?l:null},defaults:{align:"end",filter:"number"},totals:{supported:["sum","avg","min","max","count","countValues"],implement:{sum:z(j),avg:_(j)}}}}function B(G={}){const j=Number.isInteger(G.decimals)?G.decimals:1,k=G.percent===!0;return{base:"number",storage:"float64",name:G.name||"ratio",format:g=>{const c=g&&g.value;return E(c)||!Number.isFinite(Number(c))?"":k?`${Number(c).toFixed(j)}%`:Number(c).toFixed(j)},parse:g=>{const c=String((g&&g.text)??"").replace("%","").trim();if(!c)return null;const d=Number(c);return Number.isFinite(d)?d:null},defaults:{align:"end",filter:"number"},totals:{supported:["avg","min","max","count","countValues"],implement:{avg:Z}}}}const Y=Object.freeze({decibel:X({name:"decibel",factor:10,suffix:" dB"}),decibelAmplitude:X({name:"decibelAmplitude",factor:20,suffix:" dB"}),ratio:B({name:"ratio"}),percentRate:B({name:"percentRate",percent:!0})})}),Ue("packages/core/src/columns/types/currency.js",function(e,U){"use strict";Object.defineProperty(e,"MISSING_RATE",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"normaliseCode",{enumerable:!0,get:function(){return z}}),Object.defineProperty(e,"toMoney",{enumerable:!0,get:function(){return _}}),Object.defineProperty(e,"parseMoney",{enumerable:!0,get:function(){return G}}),Object.defineProperty(e,"rateFunction",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"convertMoney",{enumerable:!0,get:function(){return k}}),Object.defineProperty(e,"formatMoney",{enumerable:!0,get:function(){return d}}),Object.defineProperty(e,"moneyToText",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"moneyComparator",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"createCurrencyType",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"CURRENCY_TYPES",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return t}});const E=U("packages/core/src/internal/predicates.js").isNil,q="⚠ no rate";function z(u){if(E(u))return null;const r=String(u).trim().toUpperCase();return r===""?null:r}function _(u){if(E(u))return null;if(typeof u=="object"&&!Array.isArray(u)){const r=Number(u.amount),o=z(u.code);return!o||!Number.isFinite(r)?null:{amount:r,code:o}}if(Array.isArray(u)&&u.length===2){const r=Number(u[0]),o=z(u[1]);return!o||!Number.isFinite(r)?null:{amount:r,code:o}}return null}const Z=Object.freeze({$:"USD","€":"EUR","£":"GBP","¥":"JPY","₹":"INR","₩":"KRW","₽":"RUB","₺":"TRY","₴":"UAH","₪":"ILS"}),X=Object.freeze({USD:"$",EUR:"€",GBP:"£",JPY:"¥",INR:"₹",KRW:"₩",RUB:"₽",TRY:"₺",UAH:"₴",ILS:"₪"}),B=/[+-]?[\d\s., ]*\d/;function Y(u,r){const o=String(u).trim();if(o==="")return null;const f=new Intl.NumberFormat(r||void 0).formatToParts(1.1).find(h=>h.type==="decimal")?.value||".",w=f===","?".":",",m=o.split(w).join("").split(/[\s ]/).join("").replace(f,"."),v=Number(m);return Number.isFinite(v)?v:null}function G(u,r){const o=r||{},f=z(o.code);if(E(u))return null;const w=_(u);if(w)return w;if(typeof u=="number")return Number.isFinite(u)&&f?{amount:u,code:f}:null;let m=String(u).trim();if(m==="")return null;let v=!1;m.startsWith("(")&&m.endsWith(")")&&(v=!0,m=m.slice(1,-1).trim());let h=null;for(const[M,D]of Object.entries(Z)){if(m.startsWith(M)){h=D,m=m.slice(M.length).trim();break}if(m.endsWith(M)){h=D,m=m.slice(0,-M.length).trim();break}}const p=B.exec(m);if(!p)return null;const b=Y(p[0],o.locale);if(b===null)return null;const O=(m.slice(0,p.index)+" "+m.slice(p.index+p[0].length)).trim();!h&&O!==""&&(h=z(O));const y=h||f;return y?{amount:v?-b:b,code:y}:null}function j(u,r){if(typeof u=="function")return(o,f)=>{if(o===f)return 1;const w=u(o,f);return typeof w=="number"&&Number.isFinite(w)&&w>0?w:null};if(u&&typeof u=="object"){const o=u;return(f,w)=>{if(f===w)return 1;const m=Number(o[f]),v=Number(o[w]);return!Number.isFinite(m)||!Number.isFinite(v)||m<=0||v<=0?null:v/m}}return(o,f)=>o===f?1:null}function k(u,r,o){if(!u)return null;if(u.code===r)return u.amount;const f=o(u.code,r);return f===null?null:u.amount*f}const g=new Map;function c(u,r,o){const f=`${u||""}|${r}|${o??""}`;let w=g.get(f);if(!w){const m={style:"currency",currency:r};typeof o=="number"&&(m.minimumFractionDigits=o,m.maximumFractionDigits=o);try{w={fmt:new Intl.NumberFormat(u||void 0,m),currency:!0}}catch{w={fmt:new Intl.NumberFormat(u||void 0,typeof o=="number"?{minimumFractionDigits:o,maximumFractionDigits:o}:{}),currency:!1}}g.set(f,w)}return w}function d(u,r){const o=r||{},f=o.nullDisplay??"",w=_(u);if(!w)return f;const m=z(o.display)||w.code;let v=w.amount,h=w.code;if(m!==w.code){const O=o.rateFn||j(o.rates,o.rateBase),y=k(w,m,O);if(y===null)return`${o.missingRate??q} ${w.code}→${m}`;v=y,h=m}const{fmt:p,currency:b}=c(o.locale,h,o.decimals);return b?p.format(v):`${p.format(v)} ${h}`}function l(u){const r=_(u);return r?`${r.amount} ${r.code}`:""}function i(u){const r=u||{},o=z(r.display),f=r.rateFn||j(r.rates,r.rateBase);return(w,m)=>{const v=_(w),h=_(m);if(!v&&!h)return 0;if(!v)return 1;if(!h)return-1;if(o){const p=k(v,o,f),b=k(h,o,f);if(p!==null&&b!==null)return p===b?0:p<b?-1:1}return v.code===h.code?v.amount===h.amount?0:v.amount<h.amount?-1:1:v.code<h.code?-1:1}}function n(u){const r=u||{},o=(w,m)=>{const v=[];for(const y of w||[]){const L=_(y);L&&v.push(L)}if(!v.length)return null;if(new Set(v.map(y=>y.code)).size===1){const y=v[0].code;return{amount:m(v.map(L=>L.amount)),code:y}}const p=z(r.display);if(!p)return`${r.missingRate??q}: mixed currencies, no display currency set`;const b=r.rateFn||j(r.rates,r.rateBase),O=[];for(const y of v){const L=k(y,p,b);if(L===null)return`${r.missingRate??q}: ${y.code}→${p}`;O.push(L)}return{amount:m(O),code:p}},f=w=>w.reduce((m,v)=>m+v,0);return{sum:w=>o(w,f),avg:w=>o(w,m=>f(m)/m.length),min:w=>o(w,m=>Math.min(...m)),max:w=>o(w,m=>Math.max(...m))}}function a(u){const r=Object.freeze({code:"USD",...u||{}}),o=j(r.rates,r.rateBase),f=Object.freeze({...r,rateFn:o}),w=n(f),m=i(f),v=new Map([[r.locale||"",f]]),h=O=>{const y=O||"";let L=v.get(y);return L||(L=Object.freeze({...f,locale:O||void 0}),v.set(y,L)),L},p=X[z(r.display||r.code)]||"",b=typeof r.decimals=="number"&&r.decimals>0?`.${"0".repeat(r.decimals)}`:".00";return{base:"object",extends:"object",storage:"object",name:"currency",currencyConfig:f,format:O=>d(O.value,O.locale?h(O.locale):f),parse:O=>G(O.text,O.locale?h(O.locale):f),compare:m,defaults:{filter:"number",editor:"currency",align:"end",total:"sum"},totals:{supported:["sum","avg","min","max","count","countValues"],implement:w},excel:r.excel||(p?`"${p}"#,##0${b}`:`#,##0${b}`),toStorage:O=>{const y=_(O);return y||(typeof O=="string"||typeof O=="number"?G(O,f):null)},toClipboard:O=>l(O),fromClipboard:O=>G(O,f)}}const s=Object.freeze({currency:a({code:"USD"}),usd:a({code:"USD"}),eur:a({code:"EUR"}),gbp:a({code:"GBP"}),jpy:a({code:"JPY",decimals:0})}),t=a}),Ue("packages/core/src/columns/types/index.js",function(e,U){"use strict";Object.defineProperty(e,"EXTENDED_TYPES",{enumerable:!0,get:function(){return W}}),Object.defineProperty(e,"createUnitType",{enumerable:!0,get:function(){return B}}),Object.defineProperty(e,"UNIT_SYSTEMS",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(e,"parseUnit",{enumerable:!0,get:function(){return G}}),Object.defineProperty(e,"formatUnit",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"registerUnitSystem",{enumerable:!0,get:function(){return k}}),Object.defineProperty(e,"unitSystemNames",{enumerable:!0,get:function(){return g}}),Object.defineProperty(e,"unitsOf",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"defineUnit",{enumerable:!0,get:function(){return d}}),Object.defineProperty(e,"SI_TYPES",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"createSiType",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"createSiSystem",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"siUnits",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"SI_PREFIXES",{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,"createRadixType",{enumerable:!0,get:function(){return O}}),Object.defineProperty(e,"RADIX_PRESETS",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"parseRadix",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"formatRadix",{enumerable:!0,get:function(){return M}});const te=U("packages/core/src/columns/types/temporal.js"),E=te.TEMPORAL_TYPES,q=U("packages/core/src/columns/types/network.js"),z=q.NETWORK_TYPES,_=U("packages/core/src/columns/types/structured.js"),Z=_.STRUCTURED_TYPES,X=U("packages/core/src/columns/types/unit.js"),B=X.createUnitType,Y=X.UNIT_SYSTEMS,G=X.parseUnit,j=X.formatUnit,k=X.registerUnitSystem,g=X.unitSystemNames,c=X.unitsOf,d=X.defineUnit,l=U("packages/core/src/columns/types/engineering.js"),i=l.ENGINEERING_TYPES,n=U("packages/core/src/columns/types/si.js"),a=n.SI_TYPES,s=n.createSiType,t=n.createSiSystem,u=n.siUnits,r=n.SI_PREFIXES,o=U("packages/core/src/columns/types/temperature.js"),f=o.TEMPERATURE_TYPES,w=o.createTemperatureType,m=o.convertTemperature,v=o.formatTemperature,h=o.parseTemperature,p=o.TEMPERATURE_SCALES,b=U("packages/core/src/columns/types/radix.js"),O=b.createRadixType,y=b.RADIX_PRESETS,L=b.parseRadix,M=b.formatRadix,D=U("packages/core/src/columns/types/aggregable.js"),F=D.AGGREGABLE_TYPES,T=U("packages/core/src/columns/types/currency.js"),I=T.CURRENCY_TYPES,P=T.createCurrencyType,R=T.parseMoney,$=T.formatMoney,C=T.convertMoney,A=T.toMoney,S=T.rateFunction,x=T.moneyComparator,H=T.normaliseCode,V=T.MISSING_RATE;Object.defineProperty(e,"findUnit",{enumerable:!0,get:function(){return X.findUnit}}),Object.defineProperty(e,"ENGINEERING_TYPES",{enumerable:!0,get:function(){return l.ENGINEERING_TYPES}}),Object.defineProperty(e,"circularMean",{enumerable:!0,get:function(){return l.circularMean}}),Object.defineProperty(e,"TEMPERATURE_TYPES",{enumerable:!0,get:function(){return o.TEMPERATURE_TYPES}}),Object.defineProperty(e,"createTemperatureType",{enumerable:!0,get:function(){return o.createTemperatureType}}),Object.defineProperty(e,"convertTemperature",{enumerable:!0,get:function(){return o.convertTemperature}}),Object.defineProperty(e,"formatTemperature",{enumerable:!0,get:function(){return o.formatTemperature}}),Object.defineProperty(e,"parseTemperature",{enumerable:!0,get:function(){return o.parseTemperature}}),Object.defineProperty(e,"TEMPERATURE_SCALES",{enumerable:!0,get:function(){return o.TEMPERATURE_SCALES}}),Object.defineProperty(e,"findScale",{enumerable:!0,get:function(){return o.findScale}}),Object.defineProperty(e,"CURRENCY_TYPES",{enumerable:!0,get:function(){return T.CURRENCY_TYPES}}),Object.defineProperty(e,"createCurrencyType",{enumerable:!0,get:function(){return T.createCurrencyType}}),Object.defineProperty(e,"parseMoney",{enumerable:!0,get:function(){return T.parseMoney}}),Object.defineProperty(e,"formatMoney",{enumerable:!0,get:function(){return T.formatMoney}}),Object.defineProperty(e,"convertMoney",{enumerable:!0,get:function(){return T.convertMoney}}),Object.defineProperty(e,"toMoney",{enumerable:!0,get:function(){return T.toMoney}}),Object.defineProperty(e,"rateFunction",{enumerable:!0,get:function(){return T.rateFunction}}),Object.defineProperty(e,"moneyComparator",{enumerable:!0,get:function(){return T.moneyComparator}}),Object.defineProperty(e,"normaliseCode",{enumerable:!0,get:function(){return T.normaliseCode}}),Object.defineProperty(e,"MISSING_RATE",{enumerable:!0,get:function(){return T.MISSING_RATE}}),Object.defineProperty(e,"TEMPORAL_TYPES",{enumerable:!0,get:function(){return te.TEMPORAL_TYPES}}),Object.defineProperty(e,"NETWORK_TYPES",{enumerable:!0,get:function(){return q.NETWORK_TYPES}}),Object.defineProperty(e,"STRUCTURED_TYPES",{enumerable:!0,get:function(){return _.STRUCTURED_TYPES}}),Object.defineProperty(e,"AGGREGABLE_TYPES",{enumerable:!0,get:function(){return D.AGGREGABLE_TYPES}}),Object.defineProperty(e,"createLogarithmicType",{enumerable:!0,get:function(){return D.createLogarithmicType}}),Object.defineProperty(e,"createRatioType",{enumerable:!0,get:function(){return D.createRatioType}}),Object.defineProperty(e,"parseTime",{enumerable:!0,get:function(){return te.parseTime}}),Object.defineProperty(e,"formatTime",{enumerable:!0,get:function(){return te.formatTime}}),Object.defineProperty(e,"parseDateTime",{enumerable:!0,get:function(){return te.parseDateTime}}),Object.defineProperty(e,"formatDateTime",{enumerable:!0,get:function(){return te.formatDateTime}}),Object.defineProperty(e,"parseDuration",{enumerable:!0,get:function(){return te.parseDuration}}),Object.defineProperty(e,"formatDuration",{enumerable:!0,get:function(){return te.formatDuration}}),Object.defineProperty(e,"parseIpv4",{enumerable:!0,get:function(){return q.parseIpv4}}),Object.defineProperty(e,"formatIpv4",{enumerable:!0,get:function(){return q.formatIpv4}}),Object.defineProperty(e,"parseCidr",{enumerable:!0,get:function(){return q.parseCidr}}),Object.defineProperty(e,"formatCidr",{enumerable:!0,get:function(){return q.formatCidr}}),Object.defineProperty(e,"parseIpv6",{enumerable:!0,get:function(){return q.parseIpv6}}),Object.defineProperty(e,"formatIpv6",{enumerable:!0,get:function(){return q.formatIpv6}}),Object.defineProperty(e,"networkAddress",{enumerable:!0,get:function(){return q.networkAddress}}),Object.defineProperty(e,"broadcastAddress",{enumerable:!0,get:function(){return q.broadcastAddress}}),Object.defineProperty(e,"hostCount",{enumerable:!0,get:function(){return q.hostCount}}),Object.defineProperty(e,"containsAddress",{enumerable:!0,get:function(){return q.containsAddress}}),Object.defineProperty(e,"overlaps",{enumerable:!0,get:function(){return q.overlaps}}),Object.defineProperty(e,"maskValue",{enumerable:!0,get:function(){return _.maskValue}}),Object.defineProperty(e,"summariseJson",{enumerable:!0,get:function(){return _.summariseJson}});const W=Object.freeze({...E,...z,...Z,...F,hex:O(y.hex),hex8:O(y.hex8),hex16:O(y.hex16),hex32:O(y.hex32),binary:O(y.binary),binary8:O(y.binary8),octal:O(y.octal),bytes:B({system:"data",unit:"B",display:"auto"}),megabytes:B({system:"data",unit:"MB"}),gigabytes:B({system:"data",unit:"GB"}),bitrate:B({system:"bitrate",unit:"Mbps"}),gigabits:B({system:"bitrate",unit:"Gbps"}),...i,...a,...f,...I});{const Q=new Set;for(const ee of[E,z,Z,F,i,a,f,I])for(const re of Object.keys(ee)){if(Q.has(re))throw new Error(`[lattice] data type "${re}" is declared twice`);Q.add(re)}}}),Ue("packages/core/src/compute/handle.js",function(e,U){"use strict";Object.defineProperty(e,"identity",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"rowCount",{enumerable:!0,get:function(){return X}}),Object.defineProperty(e,"bitReader",{enumerable:!0,get:function(){return G}}),Object.defineProperty(e,"presenceReader",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"dictSize",{enumerable:!0,get:function(){return k}}),Object.defineProperty(e,"dictValue",{enumerable:!0,get:function(){return g}}),Object.defineProperty(e,"multiValue",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"valueReader",{enumerable:!0,get:function(){return d}}),Object.defineProperty(e,"numericTotalOrder",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"valueComparator",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"dictRanks",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"isMissing",{enumerable:!0,get:function(){return a}});const te=U("packages/core/src/internal/compare.js"),E=te.collator,q=te.defaultCompare,_=U("packages/core/src/internal/warn.js").warnOnce;function Z(s){const t=new Uint32Array(s);for(let u=0;u<s;u++)t[u]=u;return t}function X(s,t){if(t&&typeof t.count=="number")return t.count;if(!s)return 0;if(typeof s.count=="number")return s.count;if(typeof s.length=="number")return s.length;const u=s.values;return s.kind==="multi"&&s.offsets?Math.max(0,s.offsets.length-1):u?s.kind==="bitset"?typeof u.size=="number"?u.size:s.presence&&typeof s.presence.size=="number"?s.presence.size:(_(`count:${s.id}`,`column "${s.id}" is bitset-backed with no declared row count; assuming ${u.length*8}`),u.length*8):u.length:s.presence&&typeof s.presence.size=="number"?s.presence.size:0}const B=new WeakMap;function Y(s){const t=s.constructor;if(!t)return"unknown";const u=B.get(t);if(u)return u;let r="unknown";try{let o=null;typeof t.from=="function"?o=t.from([!1,!0]):(o=new t(8),o.set(1));const f=o&&o.words;f&&f.length&&(f[0]===2?r="lsb":f[0]===64&&(r="msb"))}catch{r="unknown"}return B.set(t,r),r}function G(s){if(!s)return()=>0;const t=s instanceof Uint8Array?s:s.words;if(t instanceof Uint8Array){const u=s instanceof Uint8Array?"lsb":Y(s);if(u==="lsb")return r=>t[r>>>3]>>>(r&7)&1;if(u==="msb")return r=>t[r>>>3]>>>7-(r&7)&1}return typeof s.get=="function"?u=>s.get(u)?1:0:()=>0}function j(s){return!s||!s.presence?null:G(s.presence)}function k(s){return s?typeof s.size=="number"?s.size:typeof s.values=="function"?s.values().length:0:0}function g(s,t){return s?typeof s.valueOf=="function"?s.valueOf(t):typeof s.values=="function"?s.values()[t]:null:null}function c(s,t){const u=s.offsets,r=s.values;if(!u||!r)return[];const o=u[t],f=u[t+1];if(!(f>o))return[];const w=s.dict,m=new Array(f-o);for(let v=o;v<f;v++)m[v-o]=w?g(w,r[v]):r[v];return m}function d(s){if(!s)return()=>{};const t=s.values,u=j(s),r=s.kind;if(r==="dictionary"){const o=s.dict;return u?f=>u(f)?g(o,t[f]):null:f=>g(o,t[f])}if(r==="bitset"){const o=G(t);return u?f=>u(f)?o(f)===1:null:f=>o(f)===1}if(r==="multi")return u?o=>u(o)?c(s,o):null:o=>c(s,o);if(!t&&typeof s.get=="function"){const o=s.get.bind(s);return f=>{const w=o(f);return w===void 0?null:w}}return u?o=>{if(!u(o))return null;const f=t[o];return f===void 0?null:f}:o=>{const f=t[o];return f===void 0?null:f}}function l(s,t){if(s<t)return-1;if(s>t)return 1;if(s===t){const o=Object.is(s,-0),f=Object.is(t,-0);return o===f?0:o?-1:1}const u=Number.isNaN(s),r=Number.isNaN(t);return u&&r?0:u?1:-1}function i(s){const t=E(s);return(u,r)=>{if(u===r)return 0;const o=typeof u,f=typeof r;if(o==="string"&&f==="string")return t.compare(u,r);if(o==="number"&&f==="number")return l(u,r);if(o==="boolean"&&f==="boolean")return u===r?0:u?1:-1;if(u instanceof Date||r instanceof Date){const w=u instanceof Date?u.getTime():Number(u),m=r instanceof Date?r.getTime():Number(r);return l(w,m)}return q(u,r)}}function n(s,t){if(s&&typeof s.ranks=="function")return s.ranks(t);const u=s&&typeof s.values=="function"?s.values():[],r=u.length,o=i(t),f=new Array(r);for(let m=0;m<r;m++)f[m]=m;f.sort((m,v)=>o(u[m],u[v])||m-v);const w=new Uint32Array(r);for(let m=0;m<r;m++)w[f[m]]=m;return w}function a(s){return s==null||typeof s=="number"&&Number.isNaN(s)}}),Ue("packages/core/src/compute/filter.js",function(e,U){"use strict";Object.defineProperty(e,"releaseMask",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"compilePredicate",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"wallMs",{enumerable:!0,get:function(){return D}}),Object.defineProperty(e,"testValue",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"itemwisePredicate",{enumerable:!0,get:function(){return $}}),Object.defineProperty(e,"evaluateCondition",{enumerable:!0,get:function(){return V}}),Object.defineProperty(e,"evaluateFilters",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(e,"pruneColumn",{enumerable:!0,get:function(){return ee}}),Object.defineProperty(e,"mentionsColumn",{enumerable:!0,get:function(){return re}}),Object.defineProperty(e,"compact",{enumerable:!0,get:function(){return ae}}),Object.defineProperty(e,"declareOperators",{enumerable:!0,get:function(){return ge}}),Object.defineProperty(e,"declaredOperator",{enumerable:!0,get:function(){return Ae}});const E=U("packages/core/src/internal/predicates.js").isBlank,z=U("packages/core/src/internal/merge.js").toArray,Z=U("packages/core/src/internal/warn.js").warnOnce,X=U("packages/core/src/format/date.js"),B=X.toDate,Y=X.toIsoDate,G=U("packages/core/src/compute/handle.js"),j=G.bitReader,k=G.dictSize,g=G.dictValue,c=G.presenceReader,d=G.valueComparator,l=G.valueReader,i=/^\d{4}-\d{2}-\d{2}$/,n="\0null\0";function a(pe,Me){const Ne=pe&&pe.pool;if(Ne){const Pe=Ne.mask||Ne.acquireMask||Ne.acquire||Ne.take;if(typeof Pe=="function"){const ie=Pe.call(Ne,Me);if(ie&&ie.length>=Me)return ie}}return new Uint8Array(Me)}function s(pe,Me){const Ne=pe&&pe.pool;if(!Ne||!Me)return;const Pe=Ne.release||Ne.releaseMask||Ne.free||Ne.recycle;typeof Pe=="function"&&Pe.call(Ne,Me)}function t(pe,Me,Ne){return pe.fill(Ne,0,Me),pe}function u(pe){return pe==null||typeof pe=="number"&&Number.isNaN(pe)}function r(pe,Me){if(pe==null)return pe;if(Me==="number")return typeof pe=="number"?pe:Number(pe);if(Me==="date"||Me==="dateString"){const Ne=Y(pe);return Ne===null?o(pe):Ne}return Me==="boolean"?typeof pe=="boolean"?pe:pe==="true"||pe===1?!0:pe==="false"||pe===0?!1:!!pe:pe}function o(pe){return pe instanceof Date?pe.getTime():typeof pe=="number"?pe:Date.parse(String(pe))}function f(pe){return typeof pe=="number"?pe:pe instanceof Date?pe.getTime():pe==null||pe===""?NaN:Number(pe)}function w(pe,Me){const Ne=typeof pe=="string"?pe:String(pe);return Me?Ne:Ne.toLowerCase()}function m(pe,Me){return pe==null?n:typeof pe=="string"?Me?pe:pe.toLowerCase():pe instanceof Date?pe.getTime():pe}function v(pe,Me,Ne){const Pe=new Set;for(const ie of z(pe)){const Oe=r(ie,Ne);Pe.add(m(Oe,Me)),typeof Oe=="string"&&Oe!==""&&Number.isFinite(Number(Oe))?Pe.add(Number(Oe)):typeof Oe=="number"&&Number.isFinite(Oe)&&Pe.add(m(String(Oe),Me))}return Pe}function h(pe,Me,Ne){if(pe==null||Me===null||Me===void 0)return pe==null&&Me==null;const Pe=typeof pe,ie=typeof Me;return Pe==="string"&&ie==="string"?Ne?pe===Me:pe.toLowerCase()===Me.toLowerCase():pe instanceof Date||Me instanceof Date?o(pe)===o(Me):Pe==="number"&&ie==="number"?pe===Me||Number.isNaN(pe)&&Number.isNaN(Me):Pe==="number"&&ie==="string"?pe===Number(Me):Pe==="string"&&ie==="number"?Number(pe)===Me:Pe==="boolean"||ie==="boolean"?pe===Me:Array.isArray(pe)&&Array.isArray(Me)?pe.length===Me.length&&pe.every((Oe,je)=>h(Oe,Me[je],Ne)):pe===Me}function p(pe,Me){try{if(pe instanceof RegExp){const Ne=pe.flags.replace(/[gy]/g,"");return new RegExp(pe.source,Me||Ne.includes("i")?Ne:`${Ne}i`)}return new RegExp(String(pe),Me?"":"i")}catch(Ne){return Z(`regex:${String(pe)}`,`filter operator "matches" received an invalid pattern: ${String(pe)}`,Ne),null}}function b(pe,Me){if(pe&&pe.type==="datetime"&&O.has(pe.op))return F(pe,Me);const Ne=T(pe,Me),Pe=pe&&pe.type;return Pe!=="date"&&Pe!=="dateString"?Ne:ie=>Ne(typeof ie=="string"&&i.test(ie)?ie:Y(ie)??ie)}const O=new Set(["eq","ne","lt","lte","gt","gte","between","notBetween","in","notIn"]),y=/^(\d{4})-(\d{2})-(\d{2})(?:[T ](\d{2}):(\d{2})(?::(\d{2})(?:\.(\d{1,3})\d*)?)?)?$/,L=new Map;function M(pe,Me){let Ne=L.get(Me);if(Ne===void 0){try{Ne=new Intl.DateTimeFormat("en-CA",{timeZone:Me,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1})}catch{Ne=null}L.set(Me,Ne)}if(!Ne)return null;const Pe={};for(const ie of Ne.formatToParts(pe))ie.type!=="literal"&&(Pe[ie.type]=ie.value);return Pe}function D(pe,Me){if(pe==null||pe==="")return null;if(typeof pe=="string"){const Oe=y.exec(pe.trim());if(Oe)return Date.UTC(+Oe[1],+Oe[2]-1,+Oe[3],+(Oe[4]||0),+(Oe[5]||0),+(Oe[6]||0),+(Oe[7]||"0").padEnd(3,"0"))}const Ne=B(pe);if(!Ne)return null;const Pe=Ne.getUTCMilliseconds(),ie=Me?M(Ne,Me):null;return ie?Date.UTC(+ie.year,+ie.month-1,+ie.day,ie.hour==="24"?0:+ie.hour,+ie.minute,+ie.second,Pe):Date.UTC(Ne.getFullYear(),Ne.getMonth(),Ne.getDate(),Ne.getHours(),Ne.getMinutes(),Ne.getSeconds(),Pe)}function F(pe,Me){const Ne=typeof pe.timeZone=="string"&&pe.timeZone?pe.timeZone:void 0,Pe=je=>D(je,Ne),ie=Array.isArray(pe.value)?pe.value.map(Pe):Pe(pe.value),Oe=T({...pe,type:"number",value:ie},Me);return je=>Oe(D(je))}function T(pe,Me){const Ne=pe&&pe.op,Pe=!!(pe&&pe.caseSensitive),ie=pe&&pe.type,Oe=d(Me),je=Ce=>fe=>!Ce(fe);switch(Ne){case"eq":{const Ce=r(pe.value,ie);return fe=>h(fe,Ce,Pe)}case"ne":{const Ce=r(pe.value,ie);return fe=>!h(fe,Ce,Pe)}case"lt":case"lte":case"gt":case"gte":{const Ce=r(pe.value,ie);if(u(Ce))return()=>!1;const fe=Ne==="lt"?-1:Ne==="lte"?0:Ne==="gt"?1:2;return Ee=>{if(u(Ee))return!1;const le=Oe(Ee,Ce);return fe===-1?le<0:fe===0?le<=0:fe===1?le>0:le>=0}}case"between":case"notBetween":{const Ce=z(pe.value),fe=r(Ce[0],ie),Ee=r(Ce[1],ie),le=pe.bounds||"[]",de=le.charAt(0)!=="(",Se=le.charAt(1)!==")";if(u(fe)||u(Ee))return Ne==="between"?()=>!1:()=>!0;const Fe=ke=>{if(u(ke))return!1;const Ie=Oe(ke,fe),Be=Oe(ke,Ee);return(de?Ie>=0:Ie>0)&&(Se?Be<=0:Be<0)};return Ne==="between"?Fe:je(Fe)}case"in":case"notIn":{const Ce=v(pe.value,Pe,ie),fe=Ee=>Ce.has(m(Ee,Pe));return Ne==="in"?fe:je(fe)}case"contains":case"notContains":{const Ce=w(r(pe.value,ie),Pe),fe=Ee=>Ee==null?!1:w(Ee,Pe).includes(Ce);return Ne==="contains"?fe:je(fe)}case"startsWith":{const Ce=w(r(pe.value,ie),Pe);return fe=>fe==null?!1:w(fe,Pe).startsWith(Ce)}case"endsWith":{const Ce=w(r(pe.value,ie),Pe);return fe=>fe==null?!1:w(fe,Pe).endsWith(Ce)}case"matches":{const Ce=p(pe.value,Pe);return Ce?fe=>fe==null?!1:Ce.test(String(fe)):()=>!1}case"blank":return Ce=>E(Ce)||Array.isArray(Ce)&&Ce.length===0;case"notBlank":return Ce=>!(E(Ce)||Array.isArray(Ce)&&Ce.length===0);case"containsAny":case"containsNone":{const Ce=v(pe.value,Pe,ie),fe=Ee=>{const le=Ee==null?[]:z(Ee);for(let de=0;de<le.length;de++)if(Ce.has(m(le[de],Pe)))return!0;return!1};return Ne==="containsAny"?fe:je(fe)}case"containsAll":{const Ce=z(pe.value).map(fe=>m(r(fe,ie),Pe));return fe=>{const Ee=fe==null?[]:z(fe);if(Ce.length===0)return!0;const le=new Set(Ee.map(de=>m(de,Pe)));for(let de=0;de<Ce.length;de++)if(!le.has(Ce[de]))return!1;return!0}}default:{const Ce=Ae(Ne);return Ce?Ce.compile(pe.value):(Z(`op:${String(Ne)}`,`unknown filter operator "${String(Ne)}"; the condition is refused rather than matching every row`),()=>!1)}}}function I(pe,Me,Ne){return b(Me,Ne)(pe)}const P=Object.freeze({ne:"eq",notIn:"in",notBetween:"between",notContains:"contains"}),R=new Set(["containsAny","containsAll","containsNone"]);function $(pe,Me,Ne){const Pe=pe&&pe.op,ie=P[Pe]||Pe,Oe=b({...pe,op:ie,type:Me.type},Ne),je=Me.items,Ce=fe=>{const Ee=je(fe);if(!Ee)return!1;for(let le=0;le<Ee.length;le++)if(Oe(Ee[le]))return!0;return!1};return P[Pe]?fe=>!Ce(fe):Ce}function C(pe,Me,Ne,Pe){const ie=c(pe);if(ie){const Ce=Me?1:0;for(let fe=0;fe<Pe;fe++)Ne[fe]=ie(fe)===Ce?1:0;return Ne}const Oe=pe.kind;if(Oe==="float64"||Oe==="int32"||Oe==="bitset")return t(Ne,Pe,Me?1:0);const je=l(pe);for(let Ce=0;Ce<Pe;Ce++){const fe=je(Ce),Ee=E(fe)||Array.isArray(fe)&&fe.length===0;Ne[Ce]=Ee===Me?0:1}return Ne}function A(pe,Me,Ne,Pe){const ie=pe.dict,Oe=k(ie),je=new Uint8Array(Oe);for(let le=0;le<Oe;le++)je[le]=Me(g(ie,le))?1:0;const Ce=pe.values,fe=c(pe);if(!fe){for(let le=0;le<Pe;le++)Ne[le]=je[Ce[le]];return Ne}const Ee=Me(null)?1:0;for(let le=0;le<Pe;le++)Ne[le]=fe(le)===1?je[Ce[le]]:Ee;return Ne}function S(pe,Me,Ne,Pe){const ie=j(pe.values),Oe=Me(!0)?1:0,je=Me(!1)?1:0,Ce=c(pe);if(!Ce){for(let Ee=0;Ee<Pe;Ee++)Ne[Ee]=ie(Ee)===1?Oe:je;return Ne}const fe=Me(null)?1:0;for(let Ee=0;Ee<Pe;Ee++)Ne[Ee]=Ce(Ee)===0?fe:ie(Ee)===1?Oe:je;return Ne}function x(pe,Me,Ne,Pe,ie){const Oe=pe.values,je=Me.type,Ce=Me.op;let fe=!0;switch(Ce){case"eq":case"ne":{const le=f(r(Me.value,je)),de=typeof Me.value=="number"&&Number.isNaN(Me.value),Se=Ce==="ne"?1:0;if(de)for(let Fe=0;Fe<ie;Fe++)Pe[Fe]=(Number.isNaN(Oe[Fe])?1:0)^Se;else for(let Fe=0;Fe<ie;Fe++)Pe[Fe]=(Oe[Fe]===le?1:0)^Se;break}case"lt":{const le=f(r(Me.value,je));for(let de=0;de<ie;de++)Pe[de]=Oe[de]<le?1:0;break}case"lte":{const le=f(r(Me.value,je));for(let de=0;de<ie;de++)Pe[de]=Oe[de]<=le?1:0;break}case"gt":{const le=f(r(Me.value,je));for(let de=0;de<ie;de++)Pe[de]=Oe[de]>le?1:0;break}case"gte":{const le=f(r(Me.value,je));for(let de=0;de<ie;de++)Pe[de]=Oe[de]>=le?1:0;break}case"between":case"notBetween":{const le=z(Me.value),de=f(r(le[0],je)),Se=f(r(le[1],je)),Fe=Me.bounds||"[]",ke=Fe.charAt(0)!=="(",Ie=Fe.charAt(1)!==")",Be=Ce==="notBetween"?1:0;if(ke&&Ie)for(let Ke=0;Ke<ie;Ke++)Pe[Ke]=(Oe[Ke]>=de&Oe[Ke]<=Se?1:0)^Be;else if(ke)for(let Ke=0;Ke<ie;Ke++)Pe[Ke]=(Oe[Ke]>=de&Oe[Ke]<Se?1:0)^Be;else if(Ie)for(let Ke=0;Ke<ie;Ke++)Pe[Ke]=(Oe[Ke]>de&Oe[Ke]<=Se?1:0)^Be;else for(let Ke=0;Ke<ie;Ke++)Pe[Ke]=(Oe[Ke]>de&Oe[Ke]<Se?1:0)^Be;break}case"in":case"notIn":{const le=new Set;for(const Se of z(Me.value)){const Fe=f(r(Se,je));Number.isNaN(Fe)||le.add(Fe)}const de=Ce==="notIn"?1:0;for(let Se=0;Se<ie;Se++)Pe[Se]=(le.has(Oe[Se])?1:0)^de;break}default:fe=!1;break}if(!fe)return!1;const Ee=c(pe);if(Ee){const le=Ne(null)?1:0;for(let de=0;de<ie;de++)Ee(de)===0&&(Pe[de]=le)}return!0}function H(pe,Me,Ne,Pe){const ie=l(pe);for(let Oe=0;Oe<Pe;Oe++)Ne[Oe]=Me(ie(Oe))?1:0;return Ne}function V(pe,Me,Ne){const Pe=Me.count|0,ie=Ne||a(Me,Pe);if(!pe)return t(ie,Pe,1);const Oe=typeof Me.handle=="function"?Me.handle(pe.col):void 0,je=typeof Me.custom=="function"?Me.custom:null;if(!Oe){if(je){for(let le=0;le<Pe;le++)ie[le]=je(pe,le)?1:0;return ie}return Z(`filter:col:${String(pe.col)}`,`filter references unknown column "${String(pe.col)}"; the condition is refused rather than matching every row`),t(ie,Pe,0)}const Ce=pe.op;if(Ce==="blank"||Ce==="notBlank")return C(Oe,Ce==="notBlank",ie,Pe);const fe=typeof Me.itemwise=="function"?Me.itemwise(pe.col):null;if(fe&&!Ae(Ce)&&!R.has(Ce))return H(Oe,$(pe,fe,Me.locale),ie,Pe);const Ee=b(pe,Me.locale);switch(Oe.kind){case"dictionary":return A(Oe,Ee,ie,Pe);case"bitset":return S(Oe,Ee,ie,Pe);case"float64":case"int32":return x(Oe,pe,Ee,ie,Pe)?ie:H(Oe,Ee,ie,Pe);default:return H(Oe,Ee,ie,Pe)}}function W(pe,Me,Ne){if(!pe)return t(a(Me,Ne),Ne,1);if(Array.isArray(pe.conditions)){const Pe=pe.conditions.filter(je=>je!=null),ie=pe.op==="or"?"or":pe.op==="not"?"not":"and";if(Pe.length===0)return t(a(Me,Ne),Ne,1);const Oe=W(Pe[0],Me,Ne);for(let je=1;je<Pe.length;je++){const Ce=W(Pe[je],Me,Ne);if(ie==="or")for(let fe=0;fe<Ne;fe++)Oe[fe]|=Ce[fe];else for(let fe=0;fe<Ne;fe++)Oe[fe]&=Ce[fe];s(Me,Ce)}if(ie==="not")for(let je=0;je<Ne;je++)Oe[je]^=1;return Oe}return V(pe,Me,a(Me,Ne))}function Q(pe,Me){return W(pe,Me,Me.count|0)}function ee(pe,Me){if(!pe||!Me)return pe||null;const Ne=pe;if(Array.isArray(Ne.conditions)){if((Ne.op==="or"?"or":Ne.op==="not"?"not":"and")!=="and")return re(Ne,Me)?null:pe;const ie=[];for(const Oe of Ne.conditions){const je=ee(Oe,Me);je&&ie.push(je)}return ie.length?{...Ne,op:"and",conditions:ie}:null}return Ne.col===Me?null:pe}function re(pe,Me){if(!pe||typeof pe!="object")return!1;const Ne=pe;if(Ne.col===Me)return!0;if(Array.isArray(Ne.conditions)){for(const Pe of Ne.conditions)if(re(Pe,Me))return!0}return!1}function ae(pe,Me,Ne){if(Ne&&Ne.length>=Me){let je=0;for(let Ce=0;Ce<Me;Ce++)pe[Ce]&&(Ne[je++]=Ce);return Ne.subarray(0,je)}let Pe=0;for(let je=0;je<Me;je++)Pe+=pe[je]?1:0;const ie=new Uint32Array(Pe);let Oe=0;for(let je=0;je<Me;je++)pe[je]&&(ie[Oe++]=je);return ie}const ue=new Map;function ge(pe){if(!(!pe||typeof pe!="object"))for(const[Me,Ne]of Object.entries(pe))Ne&&typeof Ne.compile=="function"&&ue.set(Me,Ne)}function Ae(pe){return typeof pe=="string"?ue.get(pe):void 0}}),Ue("packages/core/src/columns/datatypes.js",function(e,U){"use strict";Object.defineProperty(e,"localeSeparators",{enumerable:!0,get:function(){return v}}),Object.defineProperty(e,"parseNumberText",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"BUILTIN_TYPES",{enumerable:!0,get:function(){return D}}),Object.defineProperty(e,"INFERENCE_ORDER",{enumerable:!0,get:function(){return F}}),Object.defineProperty(e,"createTypeRegistry",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"comparatorFor",{enumerable:!0,get:function(){return P}}),Object.defineProperty(e,"storageKind",{enumerable:!0,get:function(){return R}}),Object.defineProperty(e,"typeLabel",{enumerable:!0,get:function(){return $}});const te=U("packages/core/src/internal/compare.js"),E=te.collator,q=te.defaultCompare,z=U("packages/core/src/internal/predicates.js"),_=z.isNil,Z=z.isObject,X=z.isFunction,Y=U("packages/core/src/internal/warn.js").fail,j=U("packages/core/src/internal/text.js").titleCase,k=U("packages/core/src/format/date.js"),g=k.toDate,c=k.toIsoDate,d=k.compareIso,i=U("packages/core/src/format/boolean.js").toTriState,a=U("packages/core/src/columns/types/index.js").EXTENDED_TYPES,s=U("packages/core/src/formula/index.js"),t=s.evaluateFormula,u=s.looksLikeFormula,o=U("packages/core/src/compute/filter.js").declareOperators,f=/^\d{4}-\d{2}-\d{2}$/;function w(C){return C.getHours()===0&&C.getMinutes()===0&&C.getSeconds()===0&&C.getMilliseconds()===0}const m=new Map;function v(C){const A=C||"",S=m.get(A);if(S)return S;const x={group:",",decimal:"."};try{for(const H of new Intl.NumberFormat(C||void 0).formatToParts(12345.6))H.type==="group"?x.group=H.value:H.type==="decimal"&&(x.decimal=H.value)}catch{}return m.set(A,x),x}const h=/\d\s*[*/^]\s*[\d.(]/;function p(C,A){if(_(C))return null;let S=String(C).trim();if(S===""||S.startsWith("=")||h.test(S))return null;let x=1;S.startsWith("(")&&S.endsWith(")")&&(x=-1,S=S.slice(1,-1));const H=S.endsWith("%"),{group:V,decimal:W}=v(A);if(S=S.replace(/[\s\u00a0\u202f\u2009']/g,""),V&&V!=="."&&V!==","&&(S=S.split(V).join("")),S=S.replace(/[^0-9eE+\-.,]/g,""),W===","?S=S.split(".").join("").replace(",","."):S=S.split(",").join(""),S===""||S==="-"||S==="+")return null;const Q=Number(S);return Number.isNaN(Q)?null:x*(H?Q/100:Q)}function b(C,A){const S=_(C)||Number.isNaN(C)?null:Number(C),x=_(A)||Number.isNaN(A)?null:Number(A);return S===null?x===null?0:1:x===null||S<x?-1:S>x?1:0}function O(C,A){const S=i(C),x=i(A);return S===null?x===null?0:1:x===null?-1:S===x?0:S?1:-1}function y(C,A){const S=g(C),x=g(A);if(!S)return x?1:0;if(!x)return-1;const H=S.getTime(),V=x.getTime();return H<V?-1:H>V?1:0}const L=new Map;function M(C){const A=g(C.value);if(!A)return"";const S=C.locale||"";let x=L.get(S);return x||(x=new Intl.DateTimeFormat(C.locale||void 0,{dateStyle:"medium"}),L.set(S,x)),x.format(A)}const D={boolean:{base:"boolean",storage:"bitset",matches:C=>typeof C=="boolean",parse:C=>i(C.text),compare:O,format:C=>i(C.value)===null?"":i(C.value)?"Yes":"No",defaults:{filter:"set",editor:"checkbox",align:"center"},excel:"General",toClipboard:C=>i(C)===null?"":String(i(C)),fromClipboard:C=>i(C)},number:{base:"number",storage:"float64",matches:C=>typeof C=="number"&&!Number.isNaN(C),parse:C=>{if(u(C.text)){const A=t(C.text,C);if(!A.ok)return null;const S=Number(A.value);return Number.isFinite(S)?S:null}return p(C.text,C.locale)},compare:b,defaults:{filter:"number",editor:"number",align:"end"},excel:"General",toClipboard:C=>_(C)?"":String(C),fromClipboard:(C,A)=>p(C,A&&A.locale)},date:{base:"dateString",storage:"dictionary",matches:C=>typeof C=="string"&&f.test(C)&&!Number.isNaN(Date.parse(C))||C instanceof Date&&!Number.isNaN(C.getTime())&&w(C),parse:C=>c(C.text),compare:d,format:M,defaults:{filter:"date",editor:"date",align:"start"},excel:"yyyy-mm-dd",toStorage:C=>c(C),toClipboard:C=>_(C)?"":String(C),fromClipboard:C=>c(C)},dateString:{base:"dateString",storage:"dictionary",matches:C=>typeof C=="string"&&f.test(C)&&!Number.isNaN(Date.parse(C)),parse:C=>c(C.text),compare:d,format:M,defaults:{filter:"date",editor:"date",align:"start"},excel:"yyyy-mm-dd",toStorage:C=>c(C),toClipboard:C=>_(C)?"":String(C),fromClipboard:C=>c(C)},text:{base:"text",storage:"dictionary",matches:C=>typeof C=="string",parse:C=>C.text===""?null:String(C.text),compare:(C,A)=>_(C)?_(A)?0:1:_(A)?-1:E().compare(String(C),String(A)),defaults:{filter:"text",editor:"text",align:"start"},excel:"@",toClipboard:C=>_(C)?"":String(C),fromClipboard:C=>C},image:{base:"text",storage:"dictionary",parse:C=>C.text===""||C.text==null?null:String(C.text).trim(),compare:(C,A)=>_(C)?_(A)?0:1:_(A)?-1:E().compare(String(C),String(A)),defaults:{filter:"text",editor:"text",align:"center",render:"image"},excel:"@",toClipboard:C=>_(C)?"":String(C),fromClipboard:C=>C},lookup:{base:"text",storage:"dictionary",parse:C=>{if(C.text===""||C.text==null)return null;const A=C.column&&C.column.lookup,S=A&&X(A.options)?A.options():null;if(!S)return C.text;const x=String(C.text),H=S.find(Q=>String(Q.id)===x);if(H)return H.id;const V=x.trim().toLowerCase(),W=S.find(Q=>String(Q.label).toLowerCase()===V);return W?W.id:C.text},compare:q,defaults:{filter:"set",editor:"select",align:"start"},excel:"@",multiStorage:"multi",toClipboard:C=>_(C)?"":String(C),fromClipboard:C=>C},object:{base:"object",storage:"object",matches:C=>C!==null&&typeof C=="object"&&!(C instanceof Date),parse:C=>{try{return C.text===""?null:JSON.parse(C.text)}catch{return C.text}},compare:(C,A)=>q(C,A),format:C=>{const A=C.value;if(_(A))return"";if(typeof A=="string")return A;try{return JSON.stringify(A)}catch{return String(A)}},defaults:{filter:"none",editor:"none",align:"start"},excel:"@",toClipboard:C=>_(C)?"":typeof C=="string"?C:JSON.stringify(C),fromClipboard:C=>C}},F=["boolean","number","date","dateString","datetime","text","object"];function T(C,A,S,x){const H=S.get(C);if(H)return H;x.includes(C)&&Y(`circular data type extends chain: ${[...x,C].join(" → ")}`);const V=A[C];V||Y(`unknown data type "${C}"`);let W=null;V.extends&&(W=T(V.extends,A,S,[...x,C]));const Q={...W||{},...V,name:C,defaults:{...W&&W.defaults||{},...V.defaults||{}}};return Q.base||(Q.base=W&&W.base||"text"),Q.storage||(Q.storage=W&&W.storage||"object"),S.set(C,Q),Q}function I(C,A){const S={...D,...a};if(A&&typeof A.dataType=="function"&&typeof A.names=="function")for(const H of A.names("dataType")){const V=A.dataType(H);V&&(S[H]=V)}if(Z(C))for(const[H,V]of Object.entries(C))S[H]=V;const x=new Map;for(const H of F)T(H,S,x,[]);T("lookup",S,x,[]);for(const H of Object.keys(S))T(H,S,x,[]);for(const H of x.values())o(H.operators);return x}function P(C,A){if(C.base==="text"&&(!C.compare||C.compare===D.text.compare)){const S=E(A);return(x,H)=>_(x)?_(H)?0:1:_(H)?-1:S.compare(String(x),String(H))}return C.compare||q}function R(C,A){return A?C.multiStorage||"multi":C.storage||"object"}function $(C){return j(String(C).replace(/([a-z])([A-Z])/g,"$1 $2"))}}),Ue("packages/core/src/columns/infer.js",function(e,U){"use strict";Object.defineProperty(e,"DEFAULT_SAMPLE",{enumerable:!0,get:function(){return _}}),Object.defineProperty(e,"inferFromValues",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"inferColumnType",{enumerable:!0,get:function(){return X}});const E=U("packages/core/src/internal/warn.js").infoOnce,z=U("packages/core/src/internal/predicates.js").isNil,_=100;function Z(B,Y,G={}){const j=G.sampleSize??_,k=[];for(let g=0;g<B.length&&k.length<j;g++){const c=B[g];z(c)||typeof c=="number"&&Number.isNaN(c)||k.push(c)}if(k.length===0)return{type:"text",unanimous:!1,sampled:0};for(const[g,c]of Y){if(typeof c.matches!="function")continue;let d=!0;for(let l=0;l<k.length;l++)if(!c.matches(k[l])){d=!1;break}if(d)return{type:g,unanimous:!0,sampled:k.length}}return G.quiet||E(`infer:${G.colId||"?"}`,`column "${G.colId||"?"}" has mixed or ambiguous values and was inferred as "text". Declare \`type\` on the column to get correct sorting, filtering and export.`),{type:"text",unanimous:!1,sampled:k.length}}function X(B,Y,G,j,k={}){const g=k.sampleSize??_,c=[];for(let d=0;d<Y.length&&c.length<g;d++){const l=G(Y[d]);z(l)||typeof l=="number"&&Number.isNaN(l)||c.push(l)}return Z(c,j,{...k,colId:B}).type}}),Ue("packages/core/src/columns/graph.js",function(e,U){"use strict";Object.defineProperty(e,"WHOLE_ROW",{enumerable:!0,get:function(){return X}}),Object.defineProperty(e,"declarationOf",{enumerable:!0,get:function(){return B}}),Object.defineProperty(e,"buildGraph",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(e,"affectedBy",{enumerable:!0,get:function(){return G}}),Object.defineProperty(e,"depsProxy",{enumerable:!0,get:function(){return j}});const te=U("packages/core/src/internal/warn.js"),E=te.DEV,q=te.fail,z=te.warnOnce,Z=U("packages/core/src/internal/predicates.js").isFunction,X="*";function B(k){const g=k.value||{};if(!Z(g.compute))return{computed:!1,wholeRow:!1,deps:[],pure:!0};const d=g.pure!==!1;return g.deps===X?{computed:!0,wholeRow:!0,deps:[],pure:d}:Array.isArray(g.deps)?{computed:!0,wholeRow:!1,deps:g.deps.slice(),pure:d}:(z(`deps:missing:${k.id}`,`computed column "${k.id}" declares no \`value.deps\`; treating it as \`deps: '*'\` (a whole-row dependency). Declare the dependencies to get precise invalidation.`),{computed:!0,wholeRow:!0,deps:[],pure:d})}function Y(k){const g=new Map;for(const f of k)g.set(f.id,f);const c=new Map,d=new Map,l=new Set,i=new Set,n=new Set,a=new Set;for(const f of k){const w=B(f);if(!w.computed){c.set(f.id,[]);continue}i.add(f.id),(w.pure?n:a).add(f.id),w.wholeRow&&l.add(f.id);const m=[],v=[];for(const h of w.deps)(g.has(h)?m:v).push(h);c.set(f.id,m),v.length&&d.set(f.id,v)}for(const f of n)for(const w of c.get(f))a.has(w)&&q(`pure computed column "${f}" depends on impure column "${w}". Mark it \`value.pure: false\` or make the dependency pure.`);const s=[],t=new Map,u=[],r=f=>{const w=t.get(f);if(w!=="done"){if(w==="open"){const m=u.indexOf(f);q(`circular column dependency: ${[...u.slice(m),f].join(" → ")}`)}t.set(f,"open"),u.push(f);for(const m of c.get(f)||[])g.has(m)&&r(m);u.pop(),t.set(f,"done"),s.push(f)}};for(const f of k)r(f.id);const o=new Map;for(const f of k)o.set(f.id,[]);for(const f of k)for(const w of c.get(f.id)||[]){const m=o.get(w);m&&!m.includes(f.id)&&m.push(f.id)}if(l.size)for(const f of k){if(i.has(f.id))continue;const w=o.get(f.id);for(const m of l)w.includes(m)||w.push(m)}return{order:s,dependents:o,pure:n,impure:a,computed:i,deps:c,wholeRow:l,external:d,index:g}}function G(k,g){const c=Array.isArray(g)?g:[g],d=new Set,l=[...c];for(;l.length;){const i=l.shift();for(const n of k.dependents.get(i)||[])d.has(n)||(d.add(n),l.push(n))}for(const i of c)d.delete(i);return k.order.filter(i=>d.has(i))}function j(k,g,c){if(!E)return k;const d=g instanceof Set?g:new Set(g);return new Proxy(k,{get(l,i){return typeof i=="string"&&!d.has(i)&&!Object.hasOwn(l,i)&&z(`undeclared:${c}:${i}`,`computed column "${c}" read undeclared dependency "${i}". Add it to \`value.deps\` or the value will go stale.`),l[i]}})}}),Ue("packages/core/src/model/rowkey.js",function(e,U){"use strict";Object.defineProperty(e,"KEY_DEPENDENT_FEATURES",{enumerable:!0,get:function(){return B}}),Object.defineProperty(e,"compositeKey",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"createRowKey",{enumerable:!0,get:function(){return k}}),Object.defineProperty(e,"warnMissingKeys",{enumerable:!0,get:function(){return d}}),Object.defineProperty(e,"groupPathKey",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"splitPathKey",{enumerable:!0,get:function(){return i}});const E=U("packages/core/src/internal/warn.js").warnOnce,z=U("packages/core/src/internal/paths.js").pathGetter,_=U("packages/core/src/internal/predicates.js"),Z=_.isFunction,X=_.isBlank,B=["changes (rows.apply / rows.queue)","streaming dedupe","selection persistence","remote reload","cell comments"],Y="";function G(n){if(n===null)return"\0n";if(n===void 0)return"\0u";const a=typeof n;if(a==="string")return n;if(a==="number"||a==="bigint"||a==="boolean")return String(n);if(n instanceof Date)return`\0d${n.getTime()}`;try{return`\0o${JSON.stringify(n)}`}catch{return"\0o?"}}function j(n){if(n.length===1)return G(n[0]);let a="";for(let s=0;s<n.length;s++)s&&(a+=Y),a+=G(n[s]);return a}function k(n,a={}){const s=a.warn!==!1;if(Z(n)){const t=n;return{stable:!0,fields:[],disabled:[],key(u,r){try{const o=t(u);return Array.isArray(o)?j(o):G(o)}catch(o){return E("rowKey.throw","rowKey function threw; falling back to index identity for the affected rows.",o),`#${r??-1}`}},keyEmpty(u){try{const r=t(u);return Array.isArray(r)?r.length===0||r.some(X):X(r)}catch{return!1}},missingFields(){return[]}}}if(Array.isArray(n)&&n.length>0){const t=n.filter(o=>typeof o=="string"),u=t.map(o=>z(o)),r=u.length;return{stable:!0,fields:t,disabled:[],key(o){const f=new Array(r);for(let w=0;w<r;w++)f[w]=u[w](o);return j(f)},keyEmpty(o){for(let f=0;f<r;f++)if(X(u[f](o)))return!0;return!1},missingFields(o){const f=[];for(let w=0;w<r;w++)X(u[w](o))&&f.push(t[w]);return f}}}if(typeof n=="string"&&n.length>0){const t=z(n);return{stable:!0,fields:[n],disabled:[],key(u){return G(t(u))},keyEmpty(u){return X(t(u))},missingFields(u){return X(t(u))?[n]:[]}}}return s&&E("rowKey.missing",`no rowKey configured, so rows are identified by object identity. This disables: ${B.join(", ")}. Set rowKey to a field name, an array of field names, or a function.`),{stable:!1,fields:[],disabled:B.slice(),key(t,u){if(t===null||typeof t!="object")return`#${u??0}:${String(t)}`;let r=g.get(t);return r===void 0&&(r=`#${c++}`,g.set(t,r)),r}}}const g=new WeakMap;let c=0;function d(n,a){if(!n||n.stable===!1||!Z(n.keyEmpty)||!Array.isArray(a)||a.length===0)return;let s=0,t=null,u;for(let w=0;w<a.length;w++){const m=a[w];n.keyEmpty(m)&&(s++,t===null&&(t=Z(n.missingFields)?n.missingFields(m):[],u=m))}if(s===0)return;const r=n.fields.length?n.fields.join(","):"(function)",o=t&&t.length?t.join(", "):n.fields.length?n.fields.join(", "):"the rowKey function",f=u!==null&&typeof u=="object"?Object.keys(u).join(", ")||"(no fields)":String(u);E(`rowKey.emptyValue:${r}`,`rowKey ${o} is missing on ${s} of ${a.length} rows; the first such row has: ${f}. Rows without a key value collapse onto one key, so selection, edits and rows.apply updates land on whichever row now shares it. Set rowKey to a field present on every row, or fix the source data.`)}function l(n){return j(n)}function i(n){return n.split(Y)}}),Ue("packages/core/src/columns/lookup.js",function(e,U){"use strict";Object.defineProperty(e,"DEFAULT_SEPARATOR",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"normaliseOption",{enumerable:!0,get:function(){return g}}),Object.defineProperty(e,"flattenOptions",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"Lookup",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"toValueArray",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"createLookup",{enumerable:!0,get:function(){return n}});const te=U("packages/core/src/internal/compare.js"),E=te.collator,q=te.defaultCompare,z=U("packages/core/src/internal/predicates.js"),_=z.isFunction,Z=z.isNil,B=U("packages/core/src/internal/warn.js").warnOnce,G=U("packages/core/src/model/rowkey.js").compositeKey,j=", ",k="";function g(a,s,t,u){if(a===null||typeof a!="object")return{id:a,label:a==null?"":String(a)};const r=a[s],o=a[t],f={id:r,label:o==null?String(r??""):String(o)};a.disabled&&(f.disabled=!0),a.variant&&(f.variant=a.variant),a.icon&&(f.icon=a.icon);const w=u?a[u]:a.group;return w!==void 0&&(f.group=w),f}function c(a,s,t=0,u=[],r=[]){for(const o of a||[]){const f=o&&typeof o=="object"?o[s]:null;if(r.push({raw:o,depth:t,path:u}),Array.isArray(f)&&f.length){const w=String(o&&typeof o=="object"?o.label??o.name??o.id??"":o);c(f,s,t+1,[...u,w],r)}}return r}function d(a){return!!a&&typeof a=="object"&&!Array.isArray(a)&&_(a.router&&a.router.subscribe)}class l{#e;#t;#n;#r;#s=[];#i=new Map;#o=new Map;#l=0;#a="idle";#c=null;#u;#f=null;#d=new Map;constructor(s,t={}){this.#e=s||{},this.#t=t.colId||"?",this.#n=t.locale,this.#r=t.onChange||null,this.#u=E(this.#n),Array.isArray(this.#e.options)?this.#h(this.#e.options):this.#e.options===void 0&&(this.#a="ready")}get colId(){return this.#t}get version(){return this.#l}get state(){return this.#a}get ready(){return this.#a==="ready"}get multiple(){return this.#e.multiple===!0}get separator(){return this.#e.separator??j}get allowCustom(){return this.#e.allowCustom===!0}get sortBy(){return this.#e.sortBy||"label"}get spec(){return this.#e}options(){return this.#s}setLocale(s){this.#n=s,this.#u=E(s)}#h(s){const t=this.#e,u=t.valueKey||"id",r=t.labelKey||"label",o=t.childrenKey||"children";this.#s=c(s,o).map(f=>{const w=g(f.raw,u,r,t.groupKey);return f.depth&&(w.depth=f.depth,w.path=f.path),w}),this.#i=new Map,this.#o=new Map,this.#s.forEach((f,w)=>{this.#i.set(f.id,f),this.#o.set(f.id,w)}),this.#a="ready",this.#l+=1}load(){if(this.#c)return this.#c;const s=this.#e.options;if(Array.isArray(s)||s===void 0)return this.#c=Promise.resolve(this.#s),this.#c;if(d(s))return this.#c=this.#p(s),this.#c;if(!_(s))return B(`lookup:options:${this.#t}`,`column "${this.#t}" has an invalid \`lookup.options\`; expected an array, a function, or a router route`),this.#a="ready",this.#c=Promise.resolve([]),this.#c;this.#a="loading";let t;try{t=s()}catch(u){return this.#a="error",B(`lookup:load:${this.#t}`,`column "${this.#t}" failed to load lookup options`,u),this.#c=Promise.resolve([]),this.#c}return!t||!_(t.then)?(this.#h(t),this.#c=Promise.resolve(this.#s),this.#r&&this.#r(this),this.#c):(this.#c=t.then(u=>(this.#h(u),this.#r&&this.#r(this),this.#s),u=>(this.#a="error",B(`lookup:load:${this.#t}`,`column "${this.#t}" failed to load lookup options`,u),[])),this.#c)}refresh(){return this.#c=null,Array.isArray(this.#e.options)?(this.#h(this.#e.options),this.#r&&this.#r(this),Promise.resolve(this.#s)):this.load()}#p(s){if(this.#f)return Promise.resolve(this.#s);const t=this.#e,u=t.valueKey||"id",r=t.labelKey||"label",o=t.groupKey,f=_(s.map)?s.map:null,w=v=>g(f?f(v):v,u,r,o).id,m=v=>this.#m(v,f,u,r,o);return s.router.subscribe(s.predicate,m,{rowKey:w}),this.#f=()=>{_(s.router.detach)&&s.router.detach(m)},this.#a="ready",Promise.resolve(this.#s)}#m(s,t,u,r,o){const f=s&&s.add||[],w=s&&s.update||[],m=s&&s.remove||[];if(!(!f.length&&!w.length&&!m.length)){for(const v of f)this.#g(v,t,u,r,o);for(const v of w)this.#g(v,t,u,r,o);for(const v of m){if(!this.#d.has(v))continue;const h=this.#d.get(v);this.#d.delete(v),this.#i.delete(h);const p=this.#s.findIndex(b=>b.id===h);p>=0&&this.#s.splice(p,1)}this.#o=new Map(this.#s.map((v,h)=>[v.id,h])),this.#a="ready",this.#l+=1,this.#r&&this.#r(this)}}#g(s,t,u,r,o){const f=g(t?t(s):s,u,r,o);this.#d.set(G([f.id]),f.id);const w=this.#s.findIndex(m=>m.id===f.id);w>=0?this.#s[w]=f:this.#s.push(f),this.#i.set(f.id,f)}destroy(){this.#f&&(this.#f(),this.#f=null)}search(s,t){const u=this.#e;if(!_(u.search)){const f=String(s||"").toLowerCase();return Promise.resolve(f===""?this.#s:this.#s.filter(w=>w.label.toLowerCase().includes(f)))}const r=u.valueKey||"id",o=u.labelKey||"label";return Promise.resolve(u.search(s,t)).then(f=>(f||[]).map(w=>g(w,r,o,u.groupKey)))}option(s){return this.#i.get(s)}has(s){return this.#i.has(s)}label(s){if(Z(s)||s==="")return"";const t=this.#i.get(s);if(t)return t.label;if(this.#a==="loading"||this.#a==="idle")return"";this.allowCustom||B(`lookup:unknown:${this.#t}`,`column "${this.#t}" holds value ${JSON.stringify(s)} which is not in its lookup options. Showing the raw value; set \`lookup.unknownLabel\` or \`lookup.allowCustom\` to change that.`);const u=this.#e.unknownLabel;return _(u)?String(u(s)??""):typeof u=="string"?u:String(s)}text(s){if(this.multiple){const t=i(s);return t.length===0?"":t.map(u=>this.label(u)).join(this.separator)}return this.label(s)}dictionary(){return this.#s.map(s=>s.id)}sorted(){const s=this.sortBy;if(s==="optionOrder"||s==="count")return this.#s.slice();if(s==="value")return this.#s.slice().sort((u,r)=>q(u.id,r.id));const t=this.#u;return this.#s.slice().sort((u,r)=>t.compare(u.label,r.label))}comparator(){const s=this.sortBy,t=this.multiple,u=this.#u,r=this.#o;if(t&&s==="count")return(f,w)=>i(f).length-i(w).length;const o=t?f=>i(f)[0]:f=>f;return s==="value"?(f,w)=>q(o(f),o(w)):s==="optionOrder"?(f,w)=>{const m=r.has(o(f))?r.get(o(f)):Number.MAX_SAFE_INTEGER,v=r.has(o(w))?r.get(o(w)):Number.MAX_SAFE_INTEGER;return m-v}:(f,w)=>{const m=o(f),v=o(w);return Z(m)?Z(v)?0:1:Z(v)?-1:u.compare(this.label(m),this.label(v))}}groupKey(s){return this.multiple?i(s).map(u=>String(u)).sort().join(k):Z(s)?"":String(s)}countValues(s){return this.multiple?i(s).length:Z(s)?0:1}contains(s,t,u){const r=this.multiple?i(s):Z(s)?[]:[s],o=Array.isArray(t)?t:[t];switch(u){case"containsAll":return o.every(f=>r.includes(f));case"containsNone":return!o.some(f=>r.includes(f));default:return o.some(f=>r.includes(f))}}exportText(s,t="label"){return t==="value"?this.multiple?i(s).join(this.separator):Z(s)?"":String(s):this.text(s)}exportColumns(){const s=this.multiple;return this.#s.map(t=>({id:t.id,label:t.label,has:u=>s?i(u).includes(t.id):u===t.id}))}}function i(a){return Array.isArray(a)?a:Z(a)||a===""?[]:[a]}function n(a,s={}){const t=a.lookup;if(!t)return null;const u=new l(t,{colId:a.id,locale:s.locale,onChange:s.onChange});return!Array.isArray(t.options)&&t.options!==void 0&&u.load(),u}}),Ue("packages/core/src/columns/value.js",function(e,U){"use strict";Object.defineProperty(e,"compileDisplay",{enumerable:!0,get:function(){return g}}),Object.defineProperty(e,"warnImpureUse",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"ValuePipeline",{enumerable:!0,get:function(){return d}}),Object.defineProperty(e,"defaultRowKey",{enumerable:!0,get:function(){return l}});const E=U("packages/core/src/internal/paths.js").getPath,q=U("packages/core/src/internal/predicates.js"),z=q.isFunction,_=q.isNil,X=U("packages/core/src/internal/lru.js").Lru,Y=U("packages/core/src/internal/warn.js").warnOnce,j=U("packages/core/src/columns/graph.js").depsProxy,k="\0";function g(s,t={}){const u=t.locale,r=t.grid??null,o=t.context,f=s.value&&s.value.format,w=s.formatter||null,m=s.dataType&&s.dataType.format,v=s.lookup||null,h=(p,b,O)=>({value:p,data:O,row:b,column:s,colId:s.id,grid:r,context:o,locale:u});if(z(f))return(p,b,O)=>{const y=f(h(p,b,O));return y==null?"":String(y)};if(w){if(v){const p=w.kind==="text";return(b,O,y)=>w(p?v.text(b):b,h(b,O,y))}return(p,b,O)=>w(p,h(p,b,O))}return z(m)?(p,b,O)=>{const y=m(h(p,b,O));return y==null?"":String(y)}:v?p=>v.text(p):p=>_(p)?"":typeof p=="string"?p:String(p)}function c(s,t){!s||!s.value||s.value.pure!==!1||Y(`impure:${t}:${s.id}`,`column "${s.id}" is an impure computed column (\`value.pure: false\`) and is being used to ${t}. The result is not stable across passes.`)}class d{#e;#t;#n;#r;#s;#i;#o=new X(4096);constructor(t){this.#e=t.columns instanceof Map?t.columns:new Map((t.columns||[]).map(u=>[u.id,u])),this.#t=t.graph,this.#n=t.grid??null,this.#r=t.context,this.#i=t.stored||null,this.#s=t.rowKey||l}get graph(){return this.#t}setGraph(t){this.#t=t,this.#o.clear()}beginPass(){this.#o.clear()}endPass(){this.#o.clear()}invalidate(t){if(this.#o.size===0)return;const u=t&&t.rows?new Set([...t.rows].map(String)):null,r=t&&t.columns?[...t.columns]:null;if(!u&&!r){this.#o.clear();return}const o=r?this.#l(r):null;for(const f of[...this.#o.keys()]){const w=String(f).split(k);w.length===3&&(u&&!u.has(w[0])||o&&!o.has(w[2])||this.#o.delete(f))}}#l(t){const u=new Set,r=this.#t,o=[...t];for(;o.length;){const f=o.pop();if(!u.has(f)){u.add(f);for(const w of r?r.dependents.get(f)||[]:[])o.push(w)}}return u}value(t,u,r){const o=typeof t=="string"?this.#e.get(t):t;if(!o)return;if(!o.computed)return this.#c(o,u,r);if(o.value.pure!==!1&&this.#i&&r&&r.physical!=null&&this.#i.has(o.id))return this.#i.get(o.id,r.physical);if(o.volatile)return this.compute(o,u,r);if(o.value.pure===!1)return this.compute(o,u,r);const f=`${this.#a(u,r)}${k}${o.id}`;if(this.#o.has(f))return this.#o.get(f);const w=this.compute(o,u,r);return this.#o.set(f,w),w}#a(t,u){return`${this.#s(t,u)}${k}${i(t)}`}#c(t,u,r){if(this.#i&&r&&r.physical!=null&&this.#i.has(t.id))return this.#i.get(t.id,r.physical);if(t.field)return t.read?t.read(u):E(u,t.field)}compute(t,u,r){const o=this.#t,f=o&&o.wholeRow.has(t.id);let w;if(f)w=u??{};else{w={};const v=o&&o.deps.get(t.id)||[];for(const p of v)w[p]=this.value(p,u,r);const h=o&&o.external.get(t.id)||[];for(const p of h)w[p]=E(u,p);w=j(w,[...v,...h],t.id)}const m={data:u,row:r,column:t,grid:this.#n,context:this.#r};return t.value.compute(w,m)}values(t,u){const r={},o=this.#t?this.#t.order:[...this.#e.keys()];for(const f of o)r[f]=this.value(f,t,u);return r}text(t,u,r){const o=typeof t=="string"?this.#e.get(t):t;return o?o.formatValue(this.value(o,u,r),r,u):""}key(t,u,r){const o=typeof t=="string"?this.#e.get(t):t;if(!o)return"";const f=this.value(o,u,r);return z(o.value.key)?String(o.value.key(this.#u(o,f,u,r))):o.lookup?o.lookup.groupKey(f):_(f)?"":String(f)}quickFilterText(t,u,r){const o=typeof t=="string"?this.#e.get(t):t;if(!o)return"";if(z(o.value.quickFilterText)){const f=this.value(o,u,r);return String(o.value.quickFilterText(this.#u(o,f,u,r))??"")}return this.text(o,u,r)}#u(t,u,r,o){return{value:u,data:r,row:o,column:t,colId:t.id,grid:this.#n,context:this.#r}}parse(t,u,r,o){const f=typeof t=="string"?this.#e.get(t):t;if(!f)return u;const w={text:u,value:this.value(f,r,o),data:r,row:o,column:f,grid:this.#n,context:this.#r,locale:this.#n&&z(this.#n.get)?this.#n.get("locale"):void 0,formulaFunctions:this.#n&&z(this.#n.get)?this.#n.get("formulaFunctions"):void 0};return z(f.value.parse)?f.value.parse(w):f.dataType&&z(f.dataType.parse)?f.dataType.parse(w):u}validate(t,u,r,o,f){const w=typeof t=="string"?this.#e.get(t):t;if(!w||!z(w.edit.validate))return!0;const m=w.edit.validate({value:u,oldValue:r,data:o,row:f,column:w,grid:this.#n,context:this.#r});return m===!0||m===void 0?!0:String(m)}apply(t,u,r,o){const f=typeof t=="string"?this.#e.get(t):t;if(!f)return!1;const w=this.value(f,r,o);if(z(f.value.apply)){const m=f.value.apply({value:u,oldValue:w,data:r,row:o,column:f,grid:this.#n,context:this.#r});return this.#f(f,r,o),m!==!1}return f.field?w===u?!1:(f.write(r,u),this.#f(f,r,o),!0):(Y(`apply:${f.id}`,`column "${f.id}" has no \`field\` and no \`value.apply\`, so an edit cannot be written back.`),!1)}commit(t,u,r,o){const f=typeof t=="string"?this.#e.get(t):t;if(!f)return{ok:!1,value:void 0,oldValue:void 0,changed:!1,error:"unknown column"};const w=this.value(f,r,o),m=this.parse(f,u,r,o),v=this.validate(f,m,w,r,o);if(v!==!0)return{ok:!1,value:m,oldValue:w,changed:!1,error:v};const h=this.apply(f,m,r,o);return{ok:!0,value:m,oldValue:w,changed:h}}#f(t,u,r){if(this.#o.size===0)return;const o=this.#a(u,r);this.#o.delete(`${o}${k}${t.id}`);for(const f of this.#t?this.#t.dependents.get(t.id)||[]:[])this.#o.delete(`${o}${k}${f}`)}}function l(s,t){return t&&t.key!=null?String(t.key):i(s)}function i(s){if(s&&typeof s=="object"){let t=n.get(s);return t===void 0&&(t=`#${a++}`,n.set(s,t)),t}return String(s)}const n=new WeakMap;let a=0}),Ue("packages/core/src/model/shadow.js",function(e,U){"use strict";Object.defineProperty(e,"MAX_TRACKED",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"DEFAULT_DEPTH",{enumerable:!0,get:function(){return z}}),Object.defineProperty(e,"HISTORY_TICK_MAX_MS",{enumerable:!0,get:function(){return _}}),Object.defineProperty(e,"HISTORY_TICK_MIN_MS",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"historyTickFor",{enumerable:!0,get:function(){return X}}),Object.defineProperty(e,"SHADOW_KINDS",{enumerable:!0,get:function(){return B}}),Object.defineProperty(e,"ROLLING_KINDS",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(e,"FIT_SHADOW_KINDS",{enumerable:!0,get:function(){return G}}),Object.defineProperty(e,"MAD_SCALE",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"DEFAULT_ANOMALY_THRESHOLD",{enumerable:!0,get:function(){return k}}),Object.defineProperty(e,"SPEC_STATUS",{enumerable:!0,get:function(){return g}}),Object.defineProperty(e,"POSITIONAL_KINDS",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"SHADOW_LABELS",{enumerable:!0,get:function(){return d}}),Object.defineProperty(e,"specStatusOf",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"ShadowTracker",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"shadowsIn",{enumerable:!0,get:function(){return r}});const E=U("packages/core/src/internal/warn.js").warnOnce,q=2e5,z=20,_=1e3,Z=50;function X(o){return Math.min(_,Math.max(Z,Math.floor(o)))}const B=Object.freeze(["updates","updatedAt","sinceUpdate","delta","deltaPercent","rate","history","firstValue","streak","rank","rankAsc","rankChange","percentile","quartile","zScore","shareOfTotal","anomalyScore","anomalyFlag","specStatus","rollingSum","rollingAvg","rollingMin","rollingMax","windowCoverage","cumulativeToDate","periodOverPeriod","rollingQuantile","windowApproximate","tsTrend","tsSeasonal","tsResidual","tsCoverage","tsSmoothed","tsSmoothingAlpha","tsSmoothingBeta","fitPredicted","fitResidual","fitInfluence","fitStdResidual","fitLeverage","fitCooksD"]),Y=Object.freeze(["rollingSum","rollingAvg","rollingMin","rollingMax","windowCoverage","cumulativeToDate","periodOverPeriod","rollingQuantile","windowApproximate","tsTrend","tsSeasonal","tsResidual","tsCoverage","tsSmoothed","tsSmoothingAlpha","tsSmoothingBeta"]),G=Object.freeze(["fitPredicted","fitResidual","fitInfluence","fitStdResidual","fitLeverage","fitCooksD"]),j=.6745,k=3.5,g=Object.freeze({PASS:"PASS",WARN:"WARN",FAIL:"FAIL"}),c=Object.freeze(["rank","rankAsc","rankChange","percentile","quartile","zScore","shareOfTotal","anomalyScore","anomalyFlag"]),d=Object.freeze({updates:"Updates",updatedAt:"Updated at",sinceUpdate:"Since update",delta:"Change",deltaPercent:"Change %",rate:"Rate of change",history:"History",firstValue:"Baseline",streak:"Streak",rank:"Rank",rankAsc:"Rank, ascending",rankChange:"Rank change",percentile:"Percentile",quartile:"Quartile",zScore:"Z-score",shareOfTotal:"Share of total",anomalyScore:"Anomaly score",anomalyFlag:"Anomaly",specStatus:"Spec status",rollingSum:"Rolling sum",rollingAvg:"Rolling average",rollingMin:"Rolling minimum",rollingMax:"Rolling maximum",windowCoverage:"Window coverage",cumulativeToDate:"Cumulative to date",periodOverPeriod:"Period over period",rollingQuantile:"Rolling quantile",windowApproximate:"Window approximate",tsTrend:"Trend",tsSeasonal:"Seasonal",tsResidual:"Seasonal residual",tsCoverage:"Decomposition coverage",tsSmoothed:"Smoothed",tsSmoothingAlpha:"Smoothing α",tsSmoothingBeta:"Smoothing β",fitPredicted:"Predicted",fitResidual:"Residual",fitInfluence:"Influence",fitStdResidual:"Std. residual",fitLeverage:"Leverage",fitCooksD:"Cook's D"});function l(o,f){if(!f)return null;const w=Number.isFinite(Number(f.lower))?Number(f.lower):null,m=Number.isFinite(Number(f.upper))?Number(f.upper):null;if(w===null&&m===null||!Number.isFinite(o))return null;if(w!==null&&o<w||m!==null&&o>m)return g.FAIL;const v=Number.isFinite(Number(f.warnLower))?Number(f.warnLower):null,h=Number.isFinite(Number(f.warnUpper))?Number(f.warnUpper):null;return v!==null&&o<v||h!==null&&o>h?g.WARN:g.PASS}function i(o,f,w){if(!f||typeof f!="object")return null;if(f.kind!=="time")return f.kind!==void 0&&E(`shadow.history.window.kind:${o}`,`a 'history' shadow's 'window' only accepts {kind: 'time', span}; '${f.kind}' is not honoured (a plain count is already what 'depth' means, and a session has no span to divide into buckets), so it reported the original, unwindowed history.`),null;const m=f.minutes!=null?Number(f.minutes)*6e4:Number(f.span);if(!(m>0))return E(`shadow.history.window.span:${o}`,"a 'history' shadow's time window needs a positive 'span' (ms) or 'minutes'; it had none, so it reported the original, unwindowed history."),null;const v=Math.max(2,Math.floor(w)||z);return{span:m,bucketMs:Math.max(1,Math.floor(m/v))}}class n{#e;#t=new Map;#n=new Map;#r=new Map;#s=new Map;#i=new Map;#o=new Map;#l=0;#a;#c;#u;#f;#d=new Map;#h=null;#p=null;#m=null;constructor(f){this.#e=f.colId,this.#a=Math.max(2,f.depth||z),this.#c=Math.max(1,f.max||q),this.#u=f.now||(()=>Date.now()),this.#f=i(this.#e,f.historyWindow,this.#a),this.#f&&(this.#h=Math.floor(this.#u()/this.#f.bucketMs))}get colId(){return this.#e}get forgotten(){return this.#l}get size(){return this.#n.size}get historyWindow(){return this.#f}observe(f,w){const m=u(w);if(m===null)return;if(!this.#n.has(f)){this.#p=null,this.#m=null,this.#g(),this.#t.set(f,m),this.#n.set(f,m),this.#r.set(f,0),this.#s.set(f,this.#u()),this.#i.set(f,[m]),this.#f&&this.#d.set(f,[m]),this.#o.set(f,0);return}const v=this.#n.get(f);if(v===m)return;this.#p=null,this.#m=null,this.#n.set(f,m),this.#r.set(f,(this.#r.get(f)||0)+1),this.#s.set(f,this.#u());const h=this.#i.get(f)||[];h.push(m),h.length>this.#a&&h.splice(0,h.length-this.#a),this.#i.set(f,h);const p=Math.sign(m-v),b=this.#o.get(f)||0;this.#o.set(f,Math.sign(b)===p?b+p:p)}#g(){if(this.#n.size<this.#c)return;const f=this.#n.keys().next().value;f!==void 0&&(this.#t.delete(f),this.#n.delete(f),this.#r.delete(f),this.#s.delete(f),this.#i.delete(f),this.#d.delete(f),this.#o.delete(f),this.#l++)}rebase(){for(const[f,w]of this.#n)this.#t.set(f,w);this.#p=null,this.#m=null}reset(){this.#t.clear(),this.#n.clear(),this.#r.clear(),this.#s.clear(),this.#i.clear(),this.#d.clear(),this.#o.clear(),this.#l=0,this.#p=null,this.#m=null,this.#f&&(this.#h=Math.floor(this.#u()/this.#f.bucketMs))}retain(f){const w=f instanceof Set?f:new Set(f);let m=0;for(const v of[...this.#n.keys()])w.has(v)||(this.#t.delete(v),this.#n.delete(v),this.#r.delete(v),this.#s.delete(v),this.#i.delete(v),this.#d.delete(v),this.#o.delete(v),m++);return m&&(this.#p=null,this.#m=null),m}advanceHistoryWindow(f=this.#u()){const w=this.#f;if(!w)return 0;const m=Math.floor(f/w.bucketMs),v=m-this.#h;if(!(v>0))return 0;const h=Math.min(v,this.#a);for(const[p,b]of this.#d){const O=this.#n.get(p);for(let y=0;y<h;y++)b.push(O);b.length>this.#a&&b.splice(0,b.length-this.#a)}return this.#h=m,v}read(f,w,m,v){switch(f){case"updates":return this.#r.has(w)?this.#r.get(w):0;case"updatedAt":{const h=this.#s.get(w);return h===void 0?null:new Date(h)}case"sinceUpdate":{const h=this.#s.get(w);return h===void 0?null:this.#u()-h}case"firstValue":return this.#t.has(w)?this.#t.get(w):null;case"delta":return this.#n.has(w)?this.#n.get(w)-this.#t.get(w):null;case"deltaPercent":{if(!this.#n.has(w))return null;const h=this.#t.get(w);return h?(this.#n.get(w)-h)/Math.abs(h)*100:null}case"rate":{const h=this.#i.get(w),p=this.#s.get(w);if(!h||h.length<2||p===void 0)return null;const b=this.#u()-p,O=h[h.length-1]-h[h.length-2];return b>0?O/b*1e3:O}case"history":return this.#f?this.#d.has(w)?[...this.#d.get(w)]:null:this.#i.has(w)?[...this.#i.get(w)]:null;case"streak":return this.#o.has(w)?this.#o.get(w):0;case"specStatus":return this.#n.has(w)?l(this.#n.get(w),v):null;default:return c.includes(f)?this.#A(f,w,m,v):null}}#b(f){if(f){if(this.#m&&this.#m.only===f)return this.#m.view;const w=this.#y(f);return this.#m={only:f,view:w},w}return this.#p?this.#p:(this.#p=this.#y(null),this.#p)}#y(f){const w=[];for(const[D,F]of this.#n)f&&!f.has(D)||w.push(F);const m=w.sort((D,F)=>D-F);let v=0,h=0,p=0,b=0;for(const D of m){b+=D,v++;const F=D-h;h+=F/v,p+=F*(D-h)}const O=[];for(const[D,F]of this.#t)f&&!f.has(D)||O.push(F);const y=v?a(m):0,L=m.map(D=>Math.abs(D-y)).sort((D,F)=>D-F),M=v?a(L):0;return{sorted:m,baseline:O.sort((D,F)=>D-F),sum:b,mean:v?h:0,sd:v>1?Math.sqrt(p/(v-1)):0,median:y,mad:M}}#A(f,w,m,v){if(!this.#n.has(w)||m&&!m.has(w))return null;const h=this.#n.get(w),p=this.#b(m),b=p.sorted.length;if(!b)return null;switch(f){case"rank":return b-t(p.sorted,h)+1;case"rankAsc":return s(p.sorted,h)+1;case"rankChange":{if(!this.#t.has(w)||!p.baseline.length)return null;const O=p.baseline.length-t(p.baseline,this.#t.get(w))+1,y=b-t(p.sorted,h)+1;return O-y}case"percentile":return t(p.sorted,h)/b*100;case"quartile":{const O=t(p.sorted,h)/b;return Math.min(4,Math.max(1,Math.ceil(O*4)))}case"zScore":return p.sd?(h-p.mean)/p.sd:null;case"anomalyScore":return p.mad?j*(h-p.median)/p.mad:null;case"anomalyFlag":{if(!p.mad)return null;const O=v&&Number.isFinite(Number(v.threshold))?Number(v.threshold):k;return Math.abs(j*(h-p.median)/p.mad)>O}case"shareOfTotal":return p.sum?h/p.sum*100:null;default:return null}}}function a(o){const f=o.length;if(!f)return 0;const w=(f-1)*.5,m=Math.floor(w),v=Math.ceil(w);return m===v?o[m]:o[m]+(w-m)*(o[v]-o[m])}function s(o,f){let w=0,m=o.length;for(;w<m;){const v=w+m>>1;o[v]<f?w=v+1:m=v}return w}function t(o,f){let w=0,m=o.length;for(;w<m;){const v=w+m>>1;o[v]<=f?w=v+1:m=v}return w}function u(o){if(o==null||o==="")return null;if(o instanceof Date){const w=o.getTime();return Number.isFinite(w)?w:null}const f=typeof o=="number"?o:Number(o);return Number.isFinite(f)?f:null}function r(o){const f=[];for(const w of o||[]){const m=w.shadow;if(!m)continue;const v=typeof m=="string"?{kind:m}:m,h=v.kind;B.includes(h)&&(Y.includes(h)||G.includes(h)||f.push({colId:w.id||w.field,of:v.of||w.field||w.id,kind:h,depth:v.depth,historyWindow:h==="history"?v.window:void 0}))}return f}}),Ue("packages/core/src/columns/model.js",function(e,U){"use strict";Object.defineProperty(e,"BUILTIN_DEFAULTS",{enumerable:!0,get:function(){return P}}),Object.defineProperty(e,"normaliseAlign",{enumerable:!0,get:function(){return C}}),Object.defineProperty(e,"normaliseVAlign",{enumerable:!0,get:function(){return A}}),Object.defineProperty(e,"expandColumn",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"ColumnModel",{enumerable:!0,get:function(){return ue}}),Object.defineProperty(e,"flattenTree",{enumerable:!0,get:function(){return Me}});const te=U("packages/core/src/internal/merge.js"),E=te.expand,q=te.merge,z=te.toArray,_=U("packages/core/src/internal/warn.js"),Z=_.fail,X=_.warnOnce,B=U("packages/core/src/internal/paths.js"),Y=B.getPath,G=B.pathGetter,j=B.pathSetter,g=U("packages/core/src/internal/text.js").humanise,c=U("packages/core/src/internal/predicates.js"),d=c.isFunction,l=c.isObject,n=U("packages/core/src/internal/uid.js").uid,s=U("packages/core/src/format/index.js").compileFormat,t=U("packages/core/src/columns/datatypes.js"),u=t.comparatorFor,r=t.createTypeRegistry,o=t.storageKind,f=U("packages/core/src/columns/infer.js"),w=f.inferColumnType,m=f.DEFAULT_SAMPLE,v=U("packages/core/src/columns/graph.js"),h=v.buildGraph,p=v.affectedBy,O=U("packages/core/src/columns/lookup.js").createLookup,y=U("packages/core/src/columns/value.js"),L=y.compileDisplay,M=y.ValuePipeline,D=y.warnImpureUse,T=U("packages/core/src/model/shadow.js").FIT_SHADOW_KINDS,I=Object.freeze({geometry:"geometry",list:"list"}),P={value:{pure:!0},cell:{},edit:{enabled:!1},sort:{enabled:!0,direction:null,order:0,nullsFirst:!1},filter:{enabled:!0,type:"text"},group:{enabled:!1,index:-1,explode:!1},pivot:{enabled:!1,index:-1},total:null,layout:{width:150,min:40,max:null,flex:0,pin:null,hidden:!1,resizable:!0,movable:!0,lockVisible:!1,lockPosition:!1},header:{},facet:{},export:{lookup:"label",csv:!0,excel:!0},allowGroup:!0,allowPivot:!0,allowTotal:!0,nullable:!0,quickFilter:!0},R={centre:"center"},$=new Set(["start","center","end","left","right"]);function C(Pe){if(typeof Pe!="string")return;const ie=Pe.toLowerCase();return R[ie]?R[ie]:$.has(ie)?ie:void 0}function A(Pe){if(typeof Pe!="string")return;const ie=Pe.toLowerCase();return ie==="center"||ie==="centre"?"middle":ie==="top"||ie==="middle"||ie==="bottom"?ie:void 0}const S=["cell","layout","header"];function x(Pe){if(!l(Pe))return{};const ie={...Pe},Oe=(je,Ce)=>{if(Pe[je]===void 0)return;const fe=E(Pe[je],Ce);fe&&S.includes(je)&&!l(Pe[je])&&delete fe.enabled,ie[je]=fe};return Oe("sort","direction"),Oe("filter","type"),Oe("cell","render"),Oe("edit","editor"),Oe("layout","width"),Oe("group","index"),Oe("pivot","index"),Oe("header","render"),Oe("facet","strategy"),ie}function H(Pe,ie){const Oe={...Pe||{}},je=l(ie)&&l(ie.layout)&&ie.layout.width!==void 0;return Oe.fit==="content"&&!je&&delete Oe.width,Oe}const V=new Set(["allowGroup","allowPivot","allowTotal","cell","colSpan","contextMenu","diff","edit","export","facet","field","filter","filterRow","format","grandTotal","group","groupTotal","header","headerControls","id","layout","lookup","nullable","pivot","preset","quickFilter","rowSpan","running","shadow","showWhen","sort","spec","tags","title","total","type","typeOptions","validation","value","verticalAlign"]),W=new Set(["collapsible","columns","facet","header","id","marryChildren","openByDefault","showWhen","title"]);function Q(Pe,ie,Oe,je){const Ce=Oe==="columnGroup"?"column group":"column";for(const fe of Object.keys(Pe))if(!ie.has(fe)){if(fe==="timeZone"&&Oe==="column"){X("column.timeZone",`\`timeZone\` is not a column option, so it had no effect on column "${je}". A date column stores, displays, sorts and filters in the grid-level \`timeZone\` (else the viewer's); set \`timeZone\` on the grid, not the column.`);continue}X(`${Oe}.unknown:${fe}`,`'${fe}' is not a configuration key this grid recognises, so it had no effect on ${Ce} "${je}". Check the spelling against the reference.`)}}function ee(Pe){l(Pe.cell)&&Pe.cell.autoHeight!==void 0&&X("column.cell.autoHeight",`\`cell.autoHeight\` is not a column option, so it had no effect on column "${Pe.id||Pe.field||"(unnamed)"}". Rows grow to fit with the grid-level \`autoHeight\`; \`cell.wrap\` lets this column's text wrap.`)}function re(Pe,ie){const Oe=ie&&d(Pe.defaultsFor)?Pe.defaultsFor(ie):null,je={...Pe.defaults||{},...l(Oe)?Oe:{}},Ce={};return je.align&&(Ce.align=je.align,Ce.cell={align:je.align},Ce.header={align:je.align}),je.filter&&(Ce.filter=je.filter==="none"?{enabled:!1,type:"none"}:{enabled:!0,type:je.filter}),je.editor&&(Ce.edit=je.editor==="none"?{editor:null}:{editor:je.editor}),je.total&&(Ce.total=je.total),je.render&&(Ce.cell={...Ce.cell||{},render:je.render}),Pe.export&&(Ce.export={...Pe.export}),Ce}function ae(Pe){if(typeof Pe=="string")return Pe.trim()?[Pe.trim()]:[];if(!Array.isArray(Pe))return[];const ie=[];for(const Oe of Pe){if(typeof Oe!="string")continue;const je=Oe.trim();je&&!ie.includes(je)&&ie.push(je)}return ie}class ue{#e=new Map;#t=[];#n=[];#r=new WeakMap;#s;#i;#o;#l;#a;#c;#u(ie,Oe,je){const Ce=this.#f(ie,Oe,je);if(typeof Ce!="string"||!this.#d)return Ce??null;const fe=Oe&&Oe.totals&&Oe.totals.implement;if(fe&&d(fe[Ce])){const le=fe[Ce];return le.totalName=Ce,le}const Ee=this.#d.totalFn?.(Ce);return d(Ee)?Ee:Ce}#f(ie,Oe,je){if(typeof ie!="string")return ie;const Ce=Oe&&Oe.totals&&Oe.totals.supported;if(!Array.isArray(Ce)||Ce.includes(ie))return ie;const fe=Ce.length?Ce.join(", "):"none";return Z(`column "${je}" is typed ${Oe.name||"a type"}, for which the total "${ie}" is not meaningful. Supported: ${fe}. Aggregating it anyway would produce a confident wrong number.`),ie}#d;#h;#p;#m;#g;#b;#y=!1;#A;#w;constructor(ie={}){this.#i=x(ie.columnDefaults||{}),this.#o=ie.columnPresets||{},this.#a=ie.locale,this.#l=ie.timeZone,this.#c=A(ie.verticalAlign),this.#d=ie.registry||null,this.#h=ie.grid||null,this.#p=ie.context,this.#A=ie.sampleSize??m,this.#w=ie.onChange||null,this.#b=d(ie.rowKey)?ie.rowKey:void 0,this.#s=r(ie.dataTypes,this.#d);const{leaves:Oe,groups:je}=Me(ie.columns||[]);this.#n=je;for(const Ce of Oe){Ce.facet!==void 0&&this.#r.set(Ce.def,Ce.facet);const fe=this.#O(Ce.def,null);if(fe.groupPath=Ce.path,this.#e.has(fe.id)){X(`columns.duplicate:${fe.id}`,`two columns resolve to the id '${fe.id}', so the second is ignored. An id defaults to the column's field, so declare an explicit \`id\` when two columns read the same field.`);continue}Ce.column=fe,this.#e.set(fe.id,fe),this.#t.push(fe.id)}this.#E(ie.stored||null)}#O(ie,Oe){Q(ie,V,"column",ie.id||ie.field||"(unnamed)"),ee(ie);const je=x(ie),Ce=z(ie.preset),fe=Ce.map(tt=>{const pt=this.#o[tt];return pt?x(pt):(X(`preset:${tt}`,`unknown column preset "${tt}"; ignoring`),{})}),Ee=this.#S(je,fe,Oe),le=this.#s.get(Ee)||this.#s.get("text");if(!this.#s.has(Ee)&&ie.type){const tt=I[Ee];X(`type:${Ee}`,`unknown data type "${Ee}"; falling back to "text"`+(tt?`. It is registered by importing '@toclocoinc/lattice-grid/modules/${tt}'.`:""))}const de=d(le.items)?this.#T(je,fe,ie.id||ie.field||"(unnamed)"):null;let Se=P;Se=q(Se,this.#i),ie.type!==!1&&(Se=q(Se,re(le,de)));for(const tt of fe)Se=q(Se,tt);this.#r.has(ie)&&(Se=q(Se,x({facet:this.#r.get(ie)}))),Se=q(Se,je);const Fe=Se.edit;Fe&&Fe.editor&&Fe.enabled!==!0&&!d(Fe.enabled)&&(ie.edit||{}).editor&&X(`column.editor-not-enabled:${ie.id||ie.field}`,`column '${ie.id||ie.field}' names the editor '${Fe.editor}' but does not enable editing, so it stays read-only. Add \`enabled: true\`, or use \`edit: true\` and set \`editor\` alongside it.`);const ke=ie.id||ie.field||n("col");if(ie.shadow&&!d(Se.value&&Se.value.compute)){const tt=typeof ie.shadow=="string"?{kind:ie.shadow}:ie.shadow,pt=tt.of||ie.field||ke,yt=T.includes(tt.kind),kt=yt?tt.model||tt:null,Pt=yt&&kt?[...Array.isArray(kt.predictors)?kt.predictors:[],kt.response].filter(Boolean):null;Se.value={...Se.value||{},deps:Pt&&Pt.length?Pt:tt.orderBy&&tt.orderBy!==pt?[pt,tt.orderBy]:[pt],pure:!1,compute:(Ct,Lt)=>{const Rt=Lt.grid&&Lt.grid.statistics;if(!Rt)return null;const Bt=Lt.row&&Lt.row.key||Rt.keyOf(Lt.data);if(!Bt)return null;if(yt){if(!d(Rt.fitShadow))return null;const ht=tt.model?{...tt.model,threshold:tt.threshold}:tt;return Rt.fitShadow(tt.kind,Bt,ht)}return Rt.shadow(pt,tt.kind,Bt,tt.scope,tt)}}}if(ie.running&&!d(Se.value&&Se.value.compute)){const tt=typeof ie.running=="string"?{kind:ie.running}:ie.running,pt=tt.of||ie.field||ke;Se.value={...Se.value||{},deps:[pt],pure:!1,compute:(yt,kt)=>{const Pt=kt.grid&&kt.grid.statistics;if(!Pt||!d(Pt.running))return null;const Ct=kt.row&&kt.row.key||Pt.keyOf(kt.data);return Ct?Pt.running(pt,tt.kind||"total",Ct):null}},ie.sort===void 0&&(Se.sort={...Se.sort||{},enabled:!1})}const Ie=ie.field??(d(Se.value&&Se.value.compute)?null:ie.id??null),Be=d(Se.value&&Se.value.compute),Ke={id:ke,field:Ie,shadow:ie.shadow||null,running:ie.running||null,spec:ie.spec||null,validation:ie.validation||null,volatile:!!(ie.shadow||ie.running),title:Se.title??g(Ie||ke),type:le.name,dataType:le,itemType:de,nullable:Se.nullable!==!1,align:C(je.cell&&je.cell.align||je.align||Se.cell&&Se.cell.align||Se.align||le.defaults&&le.defaults.align)||"start",verticalAlign:A(je.cell&&je.cell.verticalAlign||je.verticalAlign||Se.cell&&Se.cell.verticalAlign||Se.verticalAlign)||this.#c,rowSpan:d(Se.rowSpan)?Se.rowSpan:null,colSpan:d(Se.colSpan)?Se.colSpan:null,value:{pure:!0,...Se.value||{}},cell:{...Se.cell||{}},edit:{...Se.edit||{}},sort:{...Se.sort||{}},filter:{...Se.filter||{}},group:{enabled:!1,index:-1,explode:!1,...Se.group||{}},pivot:{enabled:!1,index:-1,...Se.pivot||{}},total:this.#u(Se.total,le,ie.id||ie.field||"(unnamed)"),groupTotal:Se.groupTotal===void 0?null:this.#u(Se.groupTotal,le,ie.id||ie.field||"(unnamed)"),grandTotal:Se.grandTotal===void 0?null:this.#u(Se.grandTotal,le,ie.id||ie.field||"(unnamed)"),tags:ae(Se.tags),typeOptions:Se.typeOptions??null,...l(Se[Ee])?{[Ee]:Se[Ee]}:{},layout:H(Se.layout,je),header:{...Se.header||{}},contextMenu:Se.contextMenu===void 0?null:Se.contextMenu,facet:{...Se.facet||{}},export:{...Se.export||{}},allowGroup:Se.allowGroup!==!1,allowPivot:Se.allowPivot!==!1,allowTotal:Se.allowTotal!==!1,quickFilter:Se.quickFilter!==!1,def:ie,format:Se.format,presets:Ce,inferred:Oe!=null&&!ie.type,computed:Be,diff:ie.diff===void 0?void 0:!!ie.diff,read:Ie?G(Ie):null,write:Ie?j(Ie):null};Ke.cell.align=C(je.cell&&je.cell.align)||Ke.align,Ke.header.align=C(je.header&&je.header.align)||Ke.align;const rt=Se.lookup||null;return Ke.lookup=rt?O({id:ke,lookup:rt},{locale:this.#a,onChange:()=>{this.#w&&this.#w("lookup",{colId:ke})}}):null,Ke.group.explode&&Ke.lookup&&Ke.lookup.multiple&&X(`explode:${ke}`,`column "${ke}" has \`group.explode\`, so rows appear under each of their values and totals double-count. Group footers should be annotated accordingly.`),this.#v(Ke),Ke}#v(ie){ie.formatter=s(ie.format,ie.dataType,this.#a,this.#l,ie.id),ie.formatValue=L(ie,{locale:this.#a,grid:this.#h,context:this.#p}),ie.itemCompare=ie.itemType?u(ie.itemType,this.#a):null,ie.compare=d(ie.value.compare)?ie.value.compare:ie.lookup?ie.lookup.comparator():d(ie.dataType.compareFor)?ie.dataType.compareFor(ie):u(ie.dataType,this.#a),ie.excel=ie.formatter&&ie.formatter.ooxml||ie.dataType&&ie.dataType.excel||"General",ie.storeKind=o(ie.dataType,!!(ie.lookup&&ie.lookup.multiple))}#T(ie,Oe,je){let Ce=l(ie.typeOptions)?ie.typeOptions:null;for(let de=Oe.length-1;!Ce&&de>=0;de--)l(Oe[de].typeOptions)&&(Ce=Oe[de].typeOptions);!Ce&&l(this.#i.typeOptions)&&(Ce=this.#i.typeOptions);const fe=Ce&&Ce.of!==void 0?Ce.of:"text",Ee=typeof fe=="string"?this.#s.get(fe):void 0;return Ee&&!d(Ee.items)&&Ee.storage!=="object"?Ee:(X(`type:of:${String(fe)}`,`column "${je}" names "${String(fe)}" as its item type (typeOptions.of), which is not ${Ee?"a scalar data type":"a known data type"}; its items are read as text.`),this.#s.get("text"))}#S(ie,Oe,je){if(ie.type===!1)return"text";if(ie.type)return ie.type;for(let Ce=Oe.length-1;Ce>=0;Ce--)if(Oe[Ce].type)return Oe[Ce].type;if(this.#i.type)return this.#i.type;if(ie.shadow){const Ce=typeof ie.shadow=="string"?ie.shadow:ie.shadow.kind;if(Ce==="fitInfluence")return"boolean";if(Ce==="fitPredicted"||Ce==="fitResidual"||Ce==="fitStdResidual"||Ce==="fitLeverage"||Ce==="fitCooksD"||Ce==="tsTrend"||Ce==="tsSeasonal"||Ce==="tsResidual"||Ce==="tsCoverage"||Ce==="tsSmoothed"||Ce==="tsSmoothingAlpha"||Ce==="tsSmoothingBeta")return"number"}return je||(ie.lookup?"lookup":"text")}#E(ie){const Oe=this.all();this.#m=h(Oe),this.#g?this.#g.setGraph(this.#m):this.#g=new M({columns:this.#e,graph:this.#m,grid:this.#h,context:this.#p,stored:ie||null,rowKey:this.#b});const je=this.#g;for(const Ce of Oe)Ce.getValue=(fe,Ee)=>je.value(Ce,fe,Ee)}all(){return this.#t.map(ie=>this.#e.get(ie))}visible(){return this.all().filter(ie=>!ie.layout.hidden)}get(ie){return this.#e.get(ie)}groups(){const ie=Oe=>{const je=[];for(const Ce of Oe)Array.isArray(Ce.columns)?je.push({...Ce,columns:ie(Ce.columns)}):Ce.column&&je.push(Ce.column);return je};return ie(this.#n)}graph(){return this.#m}pipeline(){return this.#g}types(){return this.#s}affectedBy(ie){return p(this.#m,ie)}value(ie,Oe,je){return this.#g.value(ie,Oe,je)}text(ie,Oe,je){return this.#g.text(ie,Oe,je)}checkImpure(ie,Oe){D(this.#e.get(ie),Oe)}setLocale(ie){this.#a=ie;for(const Oe of this.all())Oe.lookup&&Oe.lookup.setLocale(ie),this.#v(Oe);this.#w&&this.#w("locale",{locale:ie})}infer(ie){const Oe={};if(this.#y||!Array.isArray(ie)||ie.length===0)return Oe;this.#y=!0;let je=!1;for(const Ce of this.all()){const fe=Ce.def;if(fe.type!==void 0||!Ce.field||Ce.computed||Ce.lookup||this.#M(Ce))continue;const Ee=Ce.read||(Se=>Y(Se,Ce.field)),le=w(Ce.id,ie,Ee,this.#s,{sampleSize:this.#A});if(le===Ce.type)continue;Oe[Ce.id]=le;const de=this.#O(fe,le);de.groupPath=Ce.groupPath,de.layout={...de.layout,...ge(Ce.layout)},this.#e.set(Ce.id,de),Ne(this.#n,Ce.id,de),je=!0}return je&&this.#E(null),Oe}redecorate(ie,Oe,je={}){const Ce=this.#e.get(ie);if(!Ce){X(`redecorate:${ie}`,`columns.decorate('${ie}', …): no column with id '${ie}'.`);return}const fe=Ce.def||{},Ee={...l(fe.cell)?fe.cell:{}};Ee.decoration=Oe??void 0,je&&"variant"in je&&(Ee.variant=je.variant);const le={...fe,cell:Ee};this.#r.has(fe)&&this.#r.set(le,this.#r.get(fe));const de=this.#O(le,Ce.type);return de.groupPath=Ce.groupPath,de.layout={...de.layout,...ge(Ce.layout)},Ce.lookup&&Ce.lookup!==de.lookup&&d(Ce.lookup.destroy)&&Ce.lookup.destroy(),this.#e.set(ie,de),Ne(this.#n,ie,de),this.#E(null),this.#w&&this.#w("decorate",{colId:ie}),de}destroy(){for(const ie of this.#e.values())ie.lookup&&d(ie.lookup.destroy)&&ie.lookup.destroy()}#M(ie){for(const Oe of ie.presets){const je=this.#o[Oe];if(je&&je.type)return!0}return!!this.#i.type}#P(ie){return!ie.computed&&d(ie.dataType&&ie.dataType.toStorage)}storeReader(ie){if(ie.computed)return Oe=>this.#g.value(ie,Oe,null);if(this.#P(ie)){const Oe=ie.dataType.toStorage,je={timeZone:this.#l,colId:ie.id,itemType:ie.itemType||null};return Ce=>Oe(ie.read(Ce),je)}return ie.read}storeValue(ie,Oe){if(!(!ie||ie.computed)&&d(ie.read))return this.storeReader(ie)(Oe)}storeSchema(){const ie=[];for(const Oe of this.all()){if(Oe.computed&&Oe.value.pure===!1||!Oe.computed&&!Oe.field)continue;const je=this.storeReader(Oe);let Ce=null;!Oe.computed&&!this.#P(Oe)&&typeof Oe.field=="string"&&!Oe.lookup&&(Ce=Oe.field);const fe={id:Oe.id,kind:Oe.storeKind,nullable:Oe.nullable,read:je};Ce!==null&&(fe.field=Ce),Oe.lookup&&(fe.dictionary=Oe.lookup.dictionary()),ie.push(fe)}return ie}state(){return this.all().map(ie=>({id:ie.id,width:ie.layout.width,flex:ie.layout.flex||void 0,hidden:!!ie.layout.hidden,headerWrap:ie.header?.wrap===!0?!0:void 0,headerOrientation:ie.header?.orientation==="vertical"?"vertical":void 0,pin:ie.layout.pin??null,sort:ie.sort.direction??null,sortIndex:ie.sort.direction?ie.sort.order??0:null,groupIndex:ie.group.enabled?ie.group.index??0:null,pivotIndex:ie.pivot.enabled?ie.pivot.index??0:null,total:typeof ie.total=="string"?ie.total:null,groupTotal:typeof ie.groupTotal=="string"?ie.groupTotal:void 0,grandTotal:typeof ie.grandTotal=="string"?ie.grandTotal:void 0,decoration:ie.cell&&ie.cell.decoration!=null?Ae(ie.cell.decoration):void 0,variant:ie.cell&&ie.cell.variant!=null?Ae(ie.cell.variant):void 0}))}applyState(ie,Oe={}){const je={applied:[],skipped:[]},Ce=Array.isArray(ie)?ie:ie&&ie.columns||[],fe=!Array.isArray(ie)&&ie&&ie.columnOrder||null;for(const le of Ce){if(!le||!le.id){je.skipped.push({key:"?",reason:"no id"});continue}let de=this.#e.get(le.id);if(!de){je.skipped.push({key:le.id,reason:"unknown column"});continue}if(Object.hasOwn(le,"decoration")||Object.hasOwn(le,"variant")){const Se=de.cell?de.cell.decoration:void 0,Fe=le.decoration??null,ke=Object.hasOwn(le,"variant"),Ie=ke&&!pe(de.cell?de.cell.variant:void 0,le.variant);(!pe(Se,Fe)||Ie)&&(this.redecorate(le.id,Fe,ke?{variant:le.variant??void 0}:{}),de=this.#e.get(le.id)||de)}le.width!=null&&(de.layout.width=le.width),le.flex!=null&&(de.layout.flex=le.flex),le.hidden!=null&&(de.layout.hidden=!!le.hidden),le.headerWrap!==void 0&&(de.header.wrap=!!le.headerWrap),le.headerOrientation!==void 0&&(de.header.orientation=le.headerOrientation==="vertical"?"vertical":"horizontal"),le.pin!==void 0&&(de.layout.pin=le.pin),le.sort!==void 0&&(de.sort.direction=le.sort),le.sortIndex!=null&&(de.sort.order=le.sortIndex),le.groupIndex!=null&&(de.group.enabled=!0,de.group.index=le.groupIndex),le.pivotIndex!=null&&(de.pivot.enabled=!0,de.pivot.index=le.pivotIndex),le.total!==void 0&&(de.total=le.total),le.groupTotal!==void 0&&(de.groupTotal=le.groupTotal),le.grandTotal!==void 0&&(de.grandTotal=le.grandTotal),je.applied.push(le.id)}const Ee=fe||(Oe&&Oe.keepOrder?[]:Ce.map(le=>le&&le.id).filter(Boolean));if(Ee.length){const le=Ee.filter(Se=>this.#e.has(Se)),de=this.#t.filter(Se=>!le.includes(Se));this.#t=[...le,...de]}return this.#w&&this.#w("state",je),je}move(ie,Oe){this.#N(ie,Oe)&&(this.#$(),this.#w&&this.#w("move",{id:ie,to:Oe}))}reorder(ie){const Oe={applied:[],skipped:[]},je=[];let Ce=0;for(const fe of Array.isArray(ie)?ie:[]){const Ee=Ce++;this.#N(fe,Ee)&&(Oe.applied.push(fe),je.push({id:fe,to:Ee}))}if(!je.length)return Oe;if(this.#$(),this.#w)for(const fe of je)this.#w("move",fe);return Oe}#N(ie,Oe){const je=this.#t.indexOf(ie);if(je===-1||Math.max(0,Math.min(Number(Oe)||0,this.#t.length-1))===je)return!1;const fe=this.#e.get(ie);if(fe.layout.movable===!1||fe.layout.lockPosition)return X(`move:${ie}`,`column "${ie}" is not movable; the move was ignored`),!1;const Ee=this.#R(ie,Oe);return Ee?(X(`move.married:${Ee}`,`band "${Ee}" declares marryChildren, so its columns stay together; the move was ignored`),!1):(this.#t.splice(je,1),this.#t.splice(Math.max(0,Math.min(Oe,this.#t.length)),0,ie),!0)}#R(ie,Oe){if(!this.#n||!this.#n.length)return null;const je=this.#t.filter(le=>le!==ie),Ce=Math.max(0,Math.min(Oe,je.length)),fe=(le,de)=>{if(Array.isArray(le.columns)){for(const Fe of le.columns)fe(Fe,de);return de}const Se=le.column?le.column.id:le.id;return Se&&de.push(Se),de},Ee=le=>{for(const de of le){if(!Array.isArray(de.columns))continue;if(de.marryChildren===!0){const Fe=fe(de,[]),ke=Fe.includes(ie),Ie=Fe.map(Be=>je.indexOf(Be)).filter(Be=>Be>=0);if(Ie.length){const Be=Math.min(...Ie),Ke=Math.max(...Ie);if(ke?Ce<Be||Ce>Ke+1:Ce>Be&&Ce<=Ke)return de.id}}const Se=Ee(de.columns);if(Se)return Se}return null};return Ee(this.#n)}#$(){const ie=new Map(this.#t.map((Ce,fe)=>[Ce,fe])),Oe=Ce=>{if(!Array.isArray(Ce.columns)){const Ee=Ce.column?Ce.column.id:Ce.id;return ie.has(Ee)?ie.get(Ee):1/0}let fe=1/0;for(const Ee of Ce.columns)fe=Math.min(fe,Oe(Ee));return fe},je=Ce=>{Ce.sort((fe,Ee)=>Oe(fe)-Oe(Ee));for(const fe of Ce)Array.isArray(fe.columns)&&je(fe.columns)};je(this.#n)}#_(ie){const Oe=je=>{for(let Ce=0;Ce<je.length;Ce++){const fe=je[Ce];if(Array.isArray(fe.columns)){const Ee=Oe(fe.columns);if(Ee)return Ee}else if(fe.column&&fe.column.id===ie)return je.splice(Ce,1)[0]}return null};return Oe(this.#n)}#G(ie){const Oe=[];for(let je=ie.length-1;je>=0;je--){const Ce=ie[je];Array.isArray(Ce.columns)&&(Oe.push(...this.#G(Ce.columns)),Ce.columns.length===0&&(Oe.push(Ce.id),ie.splice(je,1)))}return Oe}#D(){const ie=(Oe,je,Ce)=>{for(const fe of Oe)Array.isArray(fe.columns)?ie(fe.columns,[...je,fe.id]):fe.column&&(fe.column.groupPath=je)};ie(this.#n,[])}#F(ie){const Oe=new Set(ie),je=this.#t.filter(le=>Oe.has(le));if(!je.length)return;const Ce=Math.min(...je.map(le=>this.#t.indexOf(le))),fe=this.#t.slice(0,Ce).filter(le=>!Oe.has(le)),Ee=this.#t.slice(Ce).filter(le=>!Oe.has(le));this.#t=[...fe,...je,...Ee]}#Y(ie){const Oe=[],je=Ce=>{if(Array.isArray(Ce.columns))for(const fe of Ce.columns)je(fe);else Ce.column&&Oe.push(Ce.column.id)};return je(ie),Oe}#x(ie){const Oe=je=>{for(const Ce of je){if(!Array.isArray(Ce.columns))continue;if(Ce.id===ie)return{node:Ce,parent:je};const fe=Oe(Ce.columns);if(fe)return fe}return null};return Oe(this.#n)}groupColumns(ie,Oe={}){const je=z(ie).filter(de=>this.#e.has(de));if(!je.length)return X("columns.group.empty","groupColumns was given no known column ids; nothing was grouped."),null;for(const de of je)if(this.#e.get(de).layout.lockPosition)return X(`columns.group.locked:${de}`,`column "${de}" is position-locked and cannot be grouped.`),null;const Ce=Oe.groupId?this.#x(Oe.groupId):null;if(Oe.groupId&&!Ce)return X(`columns.group.unknown:${Oe.groupId}`,`no band "${Oe.groupId}" to add to; nothing was grouped.`),null;let fe=null;if(!Ce&&Oe.id!=null&&(fe=String(Oe.id),this.#x(fe)||this.#e.has(fe)))return X(`columns.group.idtaken:${fe}`,`band id "${fe}" is already in use; nothing was grouped.`),null;const Ee=je.map(de=>this.#_(de)).filter(Boolean);if(!Ee.length)return null;let le;if(Ce)Ce.node.columns.push(...Ee),le=Ce.node.id;else{const de={id:fe||n("grp"),title:Oe.title||"",collapsible:!1,openByDefault:!0,showWhen:"always",marryChildren:!1,header:{},def:{},columns:Ee},Se=Number.isInteger(Oe.at)?Math.max(0,Math.min(Oe.at,this.#n.length)):this.#n.length;this.#n.splice(Se,0,de),le=de.id}return this.#G(this.#n),this.#F(je),this.#D(),this.#$(),this.#w&&this.#w("columngroup",{action:"formed",groupId:le,ids:je}),le}ungroupColumn(ie){const Oe=this.#e.get(ie);if(!Oe){X(`columns.ungroup.unknown:${ie}`,`no column "${ie}" to ungroup.`);return}const je=Oe.groupPath||[];if(!je.length)return;const Ce=je[je.length-1],fe=this.#x(Ce);if(!fe)return;const Ee=this.#_(ie);if(!Ee)return;const le=fe.parent.indexOf(fe.node);fe.parent.splice(le+1,0,Ee);const de=this.#G(this.#n),Se=this.#Y(fe.node);if(Se.length){this.#F(Se);const Fe=Math.max(...Se.map(Ie=>this.#t.indexOf(Ie))),ke=this.#t.filter(Ie=>Ie!==ie);ke.splice(Fe+1,0,ie),this.#t=ke}this.#D(),this.#$(),this.#w&&this.#w("columngroup",{action:"removed",id:ie,dissolved:de})}renameGroup(ie,Oe){const je=this.#x(ie);if(!je){X(`columns.group.rename:${ie}`,`no band "${ie}" to rename.`);return}je.node.title=String(Oe??""),this.#w&&this.#w("columngroup",{action:"renamed",groupId:ie,title:je.node.title})}dissolveGroup(ie){const Oe=this.#x(ie);if(!Oe){X(`columns.group.dissolve:${ie}`,`no band "${ie}" to dissolve.`);return}const je=Oe.parent.indexOf(Oe.node);Oe.parent.splice(je,1,...Oe.node.columns),this.#D(),this.#$(),this.#w&&this.#w("columngroup",{action:"dissolved",groupId:ie})}moveGroup(ie,Oe){const je=this.#x(ie);if(!je){X(`columns.group.move:${ie}`,`no band "${ie}" to move.`);return}const Ce=je.parent,fe=Ce.indexOf(je.node);fe!==-1&&(Ce.splice(fe,1),Ce.splice(Math.max(0,Math.min(Oe,Ce.length)),0,je.node),this.#K(),this.#D(),this.#w&&this.#w("columngroup",{action:"moved",groupId:ie,to:Oe}))}#K(){const ie=[],Oe=Ce=>{for(const fe of Ce)Array.isArray(fe.columns)?Oe(fe.columns):fe.column&&ie.push(fe.column.id)};Oe(this.#n);const je=new Set(ie);this.#t=[...ie,...this.#t.filter(Ce=>!je.has(Ce))]}groupTree(){const ie=je=>je.map(Ce=>Array.isArray(Ce.columns)?{id:Ce.id,title:Ce.title||"",collapsible:!!Ce.collapsible,openByDefault:Ce.openByDefault!==!1,columns:ie(Ce.columns)}:Ce.column?Ce.column.id:null).filter(Ce=>Ce!==null),Oe=ie(this.#n);return Oe.some(je=>je&&typeof je=="object")?Oe:[]}applyGroupTree(ie){if(!Array.isArray(ie))return;const Oe=new Set,je=fe=>{const Ee=[];for(const le of fe)if(le&&typeof le=="object"&&Array.isArray(le.columns)){const de=je(le.columns);if(!de.length)continue;Ee.push({id:le.id||n("grp"),title:le.title||"",collapsible:le.collapsible===!0,openByDefault:le.openByDefault!==!1,showWhen:"always",marryChildren:!1,header:{},def:{},columns:de})}else if(typeof le=="string"){const de=this.#e.get(le);de&&!Oe.has(le)&&(Oe.add(le),Ee.push({column:de,path:[]}))}return Ee},Ce=je(ie);for(const fe of this.#t){if(Oe.has(fe))continue;const Ee=this.#e.get(fe);Ee&&Ce.push({column:Ee,path:[]})}this.#n=Ce,this.#D(),this.#$(),this.#w&&this.#w("columngroup",{action:"applied"})}show(ie){this.#U(ie,!1)}hide(ie){this.#U(ie,!0)}#U(ie,Oe){const je=[];for(const Ce of z(ie)){const fe=this.#e.get(Ce);if(fe){if(Oe&&fe.layout.lockVisible){X(`lockVisible:${Ce}`,`column "${Ce}" is \`layout.lockVisible\` and cannot be hidden`);continue}fe.layout.hidden!==Oe&&(fe.layout.hidden=Oe,je.push(Ce))}}je.length&&this.#w&&this.#w("visible",{ids:je,hidden:Oe})}pin(ie,Oe){const je=this.#e.get(ie);je&&(je.layout.pin=Oe??null,this.#w&&this.#w("pin",{id:ie,side:je.layout.pin}))}pinMany(ie){const Oe={};for(const[Ce,fe]of ie){const Ee=this.#e.get(Ce);Ee&&(Ee.layout.pin=fe??null,Oe[Ce]=Ee.layout.pin)}const je=Object.keys(Oe);je.length&&this.#w&&this.#w("pin",{ids:je,pins:Oe})}#H(ie,Oe){const je=ie.layout.min??0,Ce=ie.layout.max;let fe=Math.max(je,Oe);return Ce!=null&&(fe=Math.min(Ce,fe)),ie.layout.width=fe,ie.layout.flex=0,fe}resize(ie,Oe){const je=this.#e.get(ie);if(!je)return;if(je.layout.resizable===!1){X(`resize:${ie}`,`column "${ie}" is not resizable; the resize was ignored`);return}const Ce=this.#H(je,Oe);this.#w&&this.#w("resize",{id:ie,width:Ce})}resizeMany(ie){const Oe={};for(const[Ce,fe]of ie){const Ee=this.#e.get(Ce);if(Ee){if(Ee.layout.resizable===!1){X(`resize:${Ce}`,`column "${Ce}" is not resizable; the resize was ignored`);continue}Oe[Ce]=this.#H(Ee,fe)}}const je=Object.keys(Oe);je.length&&this.#w&&this.#w("resize",{ids:je,widths:Oe})}}function ge(Pe){const ie={};return Pe.width!=null&&(ie.width=Pe.width),Pe.hidden!=null&&(ie.hidden=Pe.hidden),Pe.pin!==void 0&&(ie.pin=Pe.pin),ie}function Ae(Pe){if(Pe===null||typeof Pe!="object")return Pe;try{return structuredClone(Pe)}catch{}try{return JSON.parse(JSON.stringify(Pe))}catch{return Pe}}function pe(Pe,ie){const Oe=Pe??null,je=ie??null;if(Oe===je)return!0;if(Oe===null||je===null)return!1;if(typeof Oe!="object"||typeof je!="object")return Oe===je;try{return JSON.stringify(Oe)===JSON.stringify(je)}catch{return!1}}function Me(Pe){const ie=[],Oe=(Ce,fe,Ee)=>{const le=[];for(const de of Ce){if(!l(de)){Z("a column definition must be an object");continue}if(Array.isArray(de.columns)){Q(de,W,"columnGroup",de.title||de.id||"(unnamed)");const Se={id:de.id||n("grp"),title:de.title||"",collapsible:de.collapsible===!0,openByDefault:de.openByDefault!==!1,showWhen:de.showWhen||"always",marryChildren:de.marryChildren===!0,header:de.header||{},def:de,columns:[]};Se.columns=Oe(de.columns,[...fe,Se.id],de.facet!==void 0?de.facet:Ee),le.push(Se)}else{const Se={def:de,path:fe,facet:Ee};ie.push(Se),le.push(Se)}}return le},je=Oe(Pe,[],void 0);return{leaves:ie,groups:je}}function Ne(Pe,ie,Oe){for(const je of Pe){if(je.columns){if(Ne(je.columns,ie,Oe))return!0;continue}if(je.column&&je.column.id===ie)return je.column=Oe,!0}return!1}}),Ue("packages/core/src/columns/autogroup.js",function(e,U){"use strict";Object.defineProperty(e,"AUTO_GROUP_ID",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"createAutoGroupColumn",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"warnOnAbsurdGrouping",{enumerable:!0,get:function(){return X}});const E=U("packages/core/src/internal/warn.js").warnOnce,q="__lattice_group",z=240,_=.5;function Z(B){const{columns:Y,groupBy:G}=B,j=G.map(c=>Y.get(c)).filter(Boolean),k=j.length?j.map(c=>c.title||c.id).join(" > "):"Group",g=B.config&&B.config.autoGroupColumnWidth||z;return{id:q,field:null,title:k,type:"text",dataType:{base:"text"},nullable:!0,align:"start",generated:!0,value:{pure:!0},cell:{render:"group"},edit:{enabled:!1},sort:{enabled:!0,direction:null},filter:{enabled:!0},groupedIds:G.slice(),group:{enabled:!1,index:0,explode:!1},pivot:{enabled:!1,index:0},total:null,lookup:null,layout:{width:g,min:120,pin:B.config&&B.config.autoGroupColumnPin||null,hidden:!1,resizable:!0,movable:!1,lockPosition:!0},header:{},export:{csv:!1,excel:!1},allowGroup:!1,allowPivot:!1,allowTotal:!1,def:{},getValue(c,d){return d&&d.group?d.groupValue:null},formatValue(c,d){if(!d||!d.group)return"";if(d.grandTotal)return B.config&&B.config.grandTotalLabel||"Total";const l=j[Math.min(d.level||0,j.length-1)];return l&&typeof l.formatValue=="function"?l.formatValue(c,d):c==null?"":String(c)}}}function X(B,Y,G){!B.length||G<100||Y<G*_||E(`grouping.cardinality:${B.join(",")}`,`grouping by ${B.join(", ")} produced ${Y} groups for ${G} rows: nearly one group per row. Grouping a continuous value such as a percentage or a timestamp rarely reads usefully; consider a computed banding column.`)}}),Ue("packages/core/src/columns/selectcolumn.js",function(e,U){"use strict";Object.defineProperty(e,"SELECT_COLUMN_ID",{enumerable:!0,get:function(){return te}}),Object.defineProperty(e,"createSelectionColumn",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return z}});const te="__lattice_select",E=44;function q(_){const Z=_.selection||{},X=_.config&&_.config.selectionColumnWidth||E;return{id:te,field:null,title:"",type:"boolean",dataType:{base:"boolean"},nullable:!1,align:"center",generated:!0,control:!0,value:{pure:!0},cell:{render:"checkbox",props:{mode:"selection"},align:"center"},edit:{enabled:!1},sort:{enabled:!1,direction:null},filter:{enabled:!1},group:{enabled:!1,index:0,explode:!1},pivot:{enabled:!1,index:0},total:null,lookup:null,layout:{width:X,min:X,max:X,pin:_.config&&_.config.selectionColumnPin||"start",hidden:!1,resizable:!1,movable:!1,lockPosition:!0},header:{},export:{csv:!1,excel:!1},allowGroup:!1,allowPivot:!1,allowTotal:!1,headerCheckbox:Z.headerCheckbox===!0,def:{},getValue(B,Y){return Y?Y.selected:!1},formatValue(){return""}}}const z=q}),Ue("packages/core/src/columns/rownumbercolumn.js",function(e,U){"use strict";Object.defineProperty(e,"ROW_NUMBER_COLUMN_ID",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"createRowNumberColumn",{enumerable:!0,get:function(){return B}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return Y}});const E=U("packages/core/src/internal/predicates.js").isFunction,q="__lattice_rownumber",z=40,_=9,Z=22;function X(G){const j=String(Math.max(1,Math.trunc(Math.abs(G))||1)).length;return Math.max(z,j*_+Z)}function B(G){const j=G.rowNumbers,k=j&&typeof j=="object"?j:{},g=Number.isFinite(k.start)?k.start:1,c=Number.isFinite(k.width)?k.width:X((G.maxNumber||0)+g),d=E(G.rank)?G.rank:()=>null;return{id:q,field:null,title:typeof k.title=="string"?k.title:"",type:"number",dataType:{base:"number"},nullable:!0,align:"end",generated:!0,control:!0,value:{pure:!0},cell:{align:"end"},edit:{enabled:!1},sort:{enabled:!1,direction:null},filter:{enabled:!1},group:{enabled:!1,index:0,explode:!1},pivot:{enabled:!1,index:0},total:null,lookup:null,layout:{width:c,min:c,max:c,pin:"start",hidden:!1,resizable:k.width==null,movable:!1,lockPosition:!0},header:{},export:{csv:!1,excel:!1},allowGroup:!1,allowPivot:!1,allowTotal:!1,def:{},getValue(l,i){const n=d(i);return n==null?null:n-1+g},formatValue(l){return l==null?"":String(l)}}}const Y=B}),Ue("packages/core/src/model/detail.js",function(e,U){"use strict";Object.defineProperty(e,"DEFAULT_DETAIL_HEIGHT",{enumerable:!0,get:function(){return _}}),Object.defineProperty(e,"DEFAULT_CACHE_LIMIT",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"resolveDetail",{enumerable:!0,get:function(){return X}}),Object.defineProperty(e,"DetailModel",{enumerable:!0,get:function(){return B}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return Y}});const E=U("packages/core/src/internal/predicates.js").isFunction,z=U("packages/core/src/internal/warn.js").warnOnce,_=240,Z=10;function X(G){if(!G)return null;const j=G===!0?{}:G;return j.enabled===!1?null:!E(j.rows)&&!j.render?(z("detail.rows","detail is enabled but neither `rows` nor `render` was supplied; expanding a master would show an empty region, so it stays off."),null):{render:j.render||null,config:j.config||null,rows:E(j.rows)?j.rows:null,height:j.height??_,cacheLimit:Number.isFinite(j.cacheLimit)?Math.max(0,j.cacheLimit):Z,isMaster:E(j.isMaster)?j.isMaster:null,target:j.target||null,onCreate:E(j.onCreate)?j.onCreate:null,path:typeof j.path=="string"?j.path:null}}class B{#e;#t=new Set;#n;#r=0;constructor(j){this.#e=j.config,this.#n=E(j.onChange)?j.onChange:()=>{}}get config(){return this.#e}get inline(){return!this.#e.target}isMaster(j){if(!j||j.group||j.detail)return!1;const k=this.#e.isMaster;return k?!!k(j.data,j):!0}isOpen(j){return this.#t.has(j)}keys(){return[...this.#t]}activeKey(){for(const j of this.#t)return j;return null}heightOf(j){const k=this.#e.height;return E(k)?Number(k(j))||_:k==="auto"?_:Number(k)||_}open(j){return this.#t.has(j)?!1:(this.inline||this.#t.clear(),this.#t.add(j),this.#s(),!0)}close(j){return this.#t.delete(j)?(this.#s(),!0):!1}toggle(j){return this.#t.has(j)?(this.close(j),!1):(this.open(j),!0)}closeAll(){this.#t.size&&(this.#t.clear(),this.#s())}prune(j){if(!this.#t.size||!E(j))return;let k=!1;for(const g of[...this.#t])j(g)||(this.#t.delete(g),k=!0);k&&this.#s()}signature(){return`${this.#r}`}set(j){this.#t.clear();const k=Array.isArray(j)?j:[];for(const g of this.inline?k:k.slice(0,1))this.#t.add(g);this.#s()}#s(){this.#r++,this.#n()}}const Y=B}),Ue("packages/core/src/compute/special.js",function(e,U){"use strict";Object.defineProperty(e,"logGamma",{enumerable:!0,get:function(){return z}}),Object.defineProperty(e,"incompleteBeta",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"normalQuantile",{enumerable:!0,get:function(){return X}}),Object.defineProperty(e,"normalCdf",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(e,"studentT",{enumerable:!0,get:function(){return G}}),Object.defineProperty(e,"studentTQuantile",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"regularizedGammaP",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"chiSquareCdf",{enumerable:!0,get:function(){return d}}),Object.defineProperty(e,"chiSquareUpperTail",{enumerable:!0,get:function(){return l}});const te=Object.freeze([676.5203681218851,-1259.1392167224028,771.3234287776531,-176.6150291621406,12.507343278686905,-.13857109526572012,9984369578019572e-21,15056327351493116e-23]),E=3e-12,q=1e-300;function z(i){if(i<.5)return Math.log(Math.PI/Math.sin(Math.PI*i))-z(1-i);const n=i-1;let a=.9999999999998099;const s=n+7.5;for(let t=0;t<te.length;t++)a+=te[t]/(n+t+1);return .5*Math.log(2*Math.PI)+(n+.5)*Math.log(s)-s+Math.log(a)}function _(i,n,a){const s=i+n,t=i+1,u=i-1;let r=1,o=1-s*a/t;Math.abs(o)<q&&(o=q),o=1/o;let f=o;for(let w=1;w<=300;w++){const m=2*w;let v=w*(n-w)*a/((u+m)*(i+m));o=1+v*o,Math.abs(o)<q&&(o=q),r=1+v/r,Math.abs(r)<q&&(r=q),o=1/o,f*=o*r,v=-(i+w)*(s+w)*a/((i+m)*(t+m)),o=1+v*o,Math.abs(o)<q&&(o=q),r=1+v/r,Math.abs(r)<q&&(r=q),o=1/o;const h=o*r;if(f*=h,Math.abs(h-1)<E)break}return f}function Z(i,n,a){if(!(i>0)||!(n>0)||!Number.isFinite(a))return Number.NaN;if(a<=0)return 0;if(a>=1)return 1;const s=Math.exp(z(i+n)-z(i)-z(n)+i*Math.log(a)+n*Math.log(1-a));return a<(i+1)/(i+n+2)?s*_(i,n,a)/i:1-s*_(n,i,1-a)/n}function X(i){if(!(i>0)||!(i<1))return i===0?-1/0:i===1?1/0:Number.NaN;const n=[-39.69683028665376,220.9460984245205,-275.9285104469687,138.357751867269,-30.66479806614716,2.506628277459239],a=[-54.47609879822406,161.5858368580409,-155.6989798598866,66.80131188771972,-13.28068155288572],s=[-.007784894002430293,-.3223964580411365,-2.400758277161838,-2.549732539343734,4.374664141464968,2.938163982698783],t=[.007784695709041462,.3224671290700398,2.445134137142996,3.754408661907416],u=.02425;let r,o,f;i<u?(r=Math.sqrt(-2*Math.log(i)),f=(((((s[0]*r+s[1])*r+s[2])*r+s[3])*r+s[4])*r+s[5])/((((t[0]*r+t[1])*r+t[2])*r+t[3])*r+1)):i<=1-u?(r=i-.5,o=r*r,f=(((((n[0]*o+n[1])*o+n[2])*o+n[3])*o+n[4])*o+n[5])*r/(((((a[0]*o+a[1])*o+a[2])*o+a[3])*o+a[4])*o+1)):(r=Math.sqrt(-2*Math.log(1-i)),f=-(((((s[0]*r+s[1])*r+s[2])*r+s[3])*r+s[4])*r+s[5])/((((t[0]*r+t[1])*r+t[2])*r+t[3])*r+1));const m=(.5*B(-f/Math.SQRT2)-i)*Math.sqrt(2*Math.PI)*Math.exp(f*f/2);return f-m/(1+f*m/2)}function B(i){const n=Math.abs(i),a=2/(2+n),s=4*a-2,t=[-1.3026537197817094,.6419697923564902,.019476473204185836,-.00956151478680863,-.000946595344482036,.000366839497852761,42523324806907e-18,-20278578112534e-18,-1624290004647e-18,130365583558e-17,15626441722e-18,-85238095915e-18,6529054439e-18,5059343495e-18,-991364156e-18,-227365122e-18,96467911e-18,2394038e-18,-6886027e-18,894487e-18,313092e-18,-112708e-18,381e-18,7106e-18];let u=0,r=0,o;for(let w=t.length-1;w>0;w--)o=r,r=s*r-u+t[w],u=o;const f=a*Math.exp(-n*n+.5*(t[0]+s*r)-u);return i>=0?f:2-f}function Y(i){return .5*B(-i/Math.SQRT2)}function G(i,n){if(!(n>0)||!Number.isFinite(i))return Number.NaN;const a=.5*Z(n/2,.5,n/(n+i*i));return i>0?1-a:a}function j(i,n){if(!(i>0)||!(i<1)||!(n>0))return Number.NaN;if(n>1e7)return X(i);let a=-1e4,s=1e4,t=X(i);const u=z(n/2)+z(.5)-z((n+1)/2);for(let r=0;r<60;r++){const o=G(t,n);o<i?a=t:s=t;const f=Math.exp(-((n+1)/2)*Math.log(1+t*t/n)-u)/Math.sqrt(n),w=f>0?(o-i)/f:0;if(Math.abs(w)<1e-12)break;const m=t-w;if(t=m>a&&m<s&&Number.isFinite(m)?m:(a+s)/2,s-a<1e-12)break}return t}function k(i,n){let a=i,s=1/i,t=s;for(let u=0;u<300&&(a+=1,t*=n/a,s+=t,!(Math.abs(t)<Math.abs(s)*E));u++);return s*Math.exp(-n+i*Math.log(n)-z(i))}function g(i,n){let a=n+1-i,s=1/q,t=1/a,u=t;for(let r=1;r<=300;r++){const o=-r*(r-i);a+=2,t=o*t+a,Math.abs(t)<q&&(t=q),s=a+o/s,Math.abs(s)<q&&(s=q),t=1/t;const f=t*s;if(u*=f,Math.abs(f-1)<E)break}return Math.exp(-n+i*Math.log(n)-z(i))*u}function c(i,n){return!(i>0)||!(n>=0)||!Number.isFinite(n)?Number.NaN:n===0?0:n<i+1?k(i,n):1-g(i,n)}function d(i,n){return n>0?c(n/2,i/2):Number.NaN}function l(i,n){const a=d(i,n);return Number.isNaN(a)?Number.NaN:Math.min(1,Math.max(0,1-a))}}),Ue("packages/core/src/compute/linalg.js",function(e,U){"use strict";Object.defineProperty(e,"cholesky",{enumerable:!0,get:function(){return te}}),Object.defineProperty(e,"choleskySolve",{enumerable:!0,get:function(){return E}}),Object.defineProperty(e,"choleskyInverse",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"normalEquations",{enumerable:!0,get:function(){return z}}),Object.defineProperty(e,"matVec",{enumerable:!0,get:function(){return _}}),Object.defineProperty(e,"quadForm",{enumerable:!0,get:function(){return Z}});function te(X){const B=X.length,Y=Array.from({length:B},()=>new Array(B).fill(0));for(let G=0;G<B;G++)for(let j=0;j<=G;j++){let k=X[G][j];for(let g=0;g<j;g++)k-=Y[G][g]*Y[j][g];if(G===j){if(!(k>0))return null;Y[G][j]=Math.sqrt(k)}else Y[G][j]=k/Y[j][j]}return Y}function E(X,B){const Y=X.length,G=new Array(Y).fill(0);for(let k=0;k<Y;k++){let g=B[k];for(let c=0;c<k;c++)g-=X[k][c]*G[c];G[k]=g/X[k][k]}const j=new Array(Y).fill(0);for(let k=Y-1;k>=0;k--){let g=G[k];for(let c=k+1;c<Y;c++)g-=X[c][k]*j[c];j[k]=g/X[k][k]}return j}function q(X){const B=X.length,Y=Array.from({length:B},()=>new Array(B).fill(0));for(let G=0;G<B;G++){const j=new Array(B).fill(0);j[G]=1;const k=E(X,j);for(let g=0;g<B;g++)Y[g][G]=k[g]}return Y}function z(X,B,Y){const G=X.length,j=G?X[0].length:0,k=Array.from({length:j},()=>new Array(j).fill(0)),g=new Array(j).fill(0);for(let c=0;c<G;c++){const d=Y?Y[c]:1,l=X[c];for(let i=0;i<j;i++){const n=d*l[i];g[i]+=n*B[c];for(let a=i;a<j;a++)k[i][a]+=n*l[a]}}for(let c=0;c<j;c++)for(let d=0;d<c;d++)k[c][d]=k[d][c];return{xtwx:k,xtwy:g}}function _(X,B){return X.map(Y=>Y.reduce((G,j,k)=>G+j*B[k],0))}function Z(X,B){let Y=0;for(let G=0;G<X.length;G++){let j=0;for(let k=0;k<X.length;k++)j+=B[G][k]*X[k];Y+=X[G]*j}return Y}}),Ue("packages/core/src/compute/sketch.js",function(e,U){"use strict";Object.defineProperty(e,"Welford",{enumerable:!0,get:function(){return te}}),Object.defineProperty(e,"Reservoir",{enumerable:!0,get:function(){return E}}),Object.defineProperty(e,"hash32",{enumerable:!0,get:function(){return z}}),Object.defineProperty(e,"HyperLogLog",{enumerable:!0,get:function(){return _}}),Object.defineProperty(e,"SpaceSaving",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(e,"KLL",{enumerable:!0,get:function(){return G}}),Object.defineProperty(e,"SKETCH_BOUNDS",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return k}});class te{#e=0;#t=0;#n=0;static get errorBound(){return Object.freeze({kind:"exact",metric:"none",value:0,statement:"mean and variance match a full recompute to float rounding"})}get count(){return this.#e}add(c){if(!Number.isFinite(c))return;this.#e++;const d=c-this.#t;this.#t+=d/this.#e,this.#n+=d*(c-this.#t)}merge(c){if(c.#e===0)return;if(this.#e===0){this.#e=c.#e,this.#t=c.#t,this.#n=c.#n;return}const d=this.#e+c.#e,l=c.#t-this.#t;this.#t+=l*(c.#e/d),this.#n+=c.#n+l*l*(this.#e*c.#e/d),this.#e=d}mean(){return this.#e?this.#t:null}variance(){return this.#e>1?this.#n/(this.#e-1):null}varianceP(){return this.#e?this.#n/this.#e:null}stddev(){const c=this.variance();return c===null?null:Math.sqrt(c)}stddevP(){const c=this.varianceP();return c===null?null:Math.sqrt(c)}}class E{#e=[];#t=0;#n;#r;constructor(c,d=Math.random){if(!(c>0))throw new RangeError("reservoir capacity must be positive");this.#n=Math.floor(c),this.#r=d}static get errorBound(){return Object.freeze({kind:"probabilistic",metric:"none",value:0,statement:"uniform sample: each element included with probability capacity/n; sample statistics are unbiased estimators"})}get seen(){return this.#t}get size(){return this.#e.length}add(c){if(!Number.isFinite(c))return;if(this.#t++,this.#e.length<this.#n){this.#e.push(c);return}const d=Math.floor(this.#r()*this.#t);d<this.#n&&(this.#e[d]=c)}sample(){return this.#e.slice()}mean(){if(!this.#e.length)return null;let c=0;for(const d of this.#e)c+=d;return c/this.#e.length}quantile(c){const d=this.#e.length;if(!d)return null;const l=this.#e.slice().sort((s,t)=>s-t);if(d===1)return l[0];const i=(d-1)*Math.min(1,Math.max(0,c)),n=Math.floor(i),a=Math.ceil(i);return n===a?l[n]:l[n]+(i-n)*(l[a]-l[n])}}function q(g){return g^=g>>>16,g=Math.imul(g,2246822507),g^=g>>>13,g=Math.imul(g,3266489909),g^=g>>>15,g>>>0}function z(g){if(typeof g=="number"){const l=new DataView(new ArrayBuffer(8));return l.setFloat64(0,g===0?0:g),q(l.getUint32(0)^l.getUint32(4))}const c=typeof g=="string"?g:String(g);let d=2166136261;for(let l=0;l<c.length;l++)d^=c.charCodeAt(l),d=Math.imul(d,16777619);return q(d)}class _{#e;#t;#n;constructor(c=14){const d=Math.floor(c);if(d<4||d>16)throw new RangeError("HLL precision must be 4..16");this.#e=d,this.#t=1<<d,this.#n=new Uint8Array(this.#t)}static errorBoundFor(c=14){const d=1<<Math.floor(c),l=1.04/Math.sqrt(d);return Object.freeze({kind:"probabilistic",metric:"relative",value:l,statement:`distinct count within ~${(l*100).toFixed(2)}% relative standard error (m=${d} buckets)`})}errorBound(){return _.errorBoundFor(this.#e)}add(c){const d=z(c),l=d&this.#t-1,i=d>>>this.#e|1<<32-this.#e;let n=1,a=i;for(;(a&1)===0;)n++,a>>>=1;n>this.#n[l]&&(this.#n[l]=n)}count(){const c=this.#t,d=32-this.#e,l=new Float64Array(d+2);for(let a=0;a<c;a++)l[this.#n[a]]++;let i=c*B(1-l[d+1]/c);for(let a=d;a>=1;a--)i=.5*(i+l[a]);i+=c*X(l[0]/c);const n=Z*c*c/i;return Math.round(n)}}const Z=.5/Math.log(2);function X(g){if(g===1)return 1/0;let c=1,d=g,l;do g*=g,l=d,d+=g*c,c+=c;while(d!==l);return d}function B(g){if(g===0||g===1)return 0;let c=1,d=1-g,l;do g=Math.sqrt(g),l=d,c*=.5,d-=(1-g)**2*c;while(d!==l);return d/3}class Y{#e=new Map;#t;#n=0;constructor(c){if(!(c>0))throw new RangeError("Space-Saving capacity must be positive");this.#t=Math.floor(c)}errorBoundFor(c){const d=c/this.#t;return Object.freeze({kind:"deterministic",metric:"absolute",value:d,statement:`each count overestimates the truth by at most N/m = ${d.toFixed(2)} (N=${c}, m=${this.#t})`})}get seen(){return this.#n}add(c){this.#n++;const d=this.#e.get(c);if(d){d.count++;return}if(this.#e.size<this.#t){this.#e.set(c,{count:1,error:0});return}let l,i=1/0;for(const[n,a]of this.#e)a.count<i&&(i=a.count,l=n);this.#e.delete(l),this.#e.set(c,{count:i+1,error:i})}top(c=this.#t){return[...this.#e.entries()].map(([l,i])=>({item:l,count:i.count,error:i.error})).sort((l,i)=>i.count-l.count).slice(0,Math.max(0,Math.floor(c)))}}class G{#e;#t=[[]];#n=0;#r;#s;constructor(c=200,d=Math.random){this.#e=Math.max(8,Math.floor(c)),this.#r=d,this.#s=2/3}static errorBoundFor(c=200){const d=1/Math.max(8,Math.floor(c));return Object.freeze({kind:"probabilistic",metric:"rank",value:d,statement:`queried quantile's true rank within ~${(d*100).toFixed(2)}% of N of the requested rank (k=${c})`})}errorBound(){return G.errorBoundFor(this.#e)}get count(){return this.#n}#i(c){const l=this.#t.length-1-c,i=Math.ceil(this.#e*this.#s**l);return Math.max(2,i)}add(c){Number.isFinite(c)&&(this.#n++,this.#t[0].push(c),this.#t[0].length>=this.#i(0)&&this.#o(0))}#o(c){const d=this.#t[c];d.sort((n,a)=>n-a),c+1>=this.#t.length&&this.#t.push([]);const l=this.#t[c+1],i=this.#r()<.5?0:1;for(let n=i;n<d.length;n+=2)l.push(d[n]);this.#t[c]=[];for(let n=0;n<this.#t.length;n++)if(this.#t[n].length>=this.#i(n)){this.#o(n);return}}#l(){const c=[];for(let d=0;d<this.#t.length;d++){const l=1<<d;for(const i of this.#t[d])c.push({v:i,w:l})}return c}quantile(c){const d=this.#l();if(!d.length)return null;d.sort((a,s)=>a.v-s.v);let l=0;for(const a of d)l+=a.w;const i=Math.min(1,Math.max(0,c))*l;let n=0;for(const a of d)if(n+=a.w,n>=i)return a.v;return d[d.length-1].v}rank(c){let d=0;for(let l=0;l<this.#t.length;l++){const i=1<<l;for(const n of this.#t[l])n<=c&&(d+=i)}return d}}const j=Object.freeze({distinct:_.errorBoundFor(14),median:G.errorBoundFor(200),p25:G.errorBoundFor(200),p75:G.errorBoundFor(200),p90:G.errorBoundFor(200),p95:G.errorBoundFor(200),p99:G.errorBoundFor(200),iqr:G.errorBoundFor(200),topK:Object.freeze({kind:"deterministic",metric:"absolute",value:0,statement:"each count overestimates the truth by at most N/m; top-K exact when the K-th item exceeds N/m"})}),k={Welford:te,Reservoir:E,HyperLogLog:_,SpaceSaving:Y,KLL:G,hash32:z,SKETCH_BOUNDS:j}}),Ue("packages/core/src/compute/statistics.js",function(e,U){"use strict";Object.defineProperty(e,"KENDALL_LIMIT",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"MAINTENANCE",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"APPROXIMATE",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"maintenanceOf",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"numbers",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"frequencies",{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,"herfindahl",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"entropy",{enumerable:!0,get:function(){return w}}),Object.defineProperty(e,"evenness",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"topShare",{enumerable:!0,get:function(){return v}}),Object.defineProperty(e,"gini",{enumerable:!0,get:function(){return h}}),Object.defineProperty(e,"moments",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"quantileSorted",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"quantile",{enumerable:!0,get:function(){return O}}),Object.defineProperty(e,"STAT_FNS",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"STAT_LABELS",{enumerable:!0,get:function(){return M}}),Object.defineProperty(e,"weightedAverage",{enumerable:!0,get:function(){return D}}),Object.defineProperty(e,"extremeRow",{enumerable:!0,get:function(){return F}}),Object.defineProperty(e,"correlation",{enumerable:!0,get:function(){return T}}),Object.defineProperty(e,"trimmedMean",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"winsorizedMean",{enumerable:!0,get:function(){return P}}),Object.defineProperty(e,"modifiedZOutliers",{enumerable:!0,get:function(){return R}}),Object.defineProperty(e,"jarqueBera",{enumerable:!0,get:function(){return $}}),Object.defineProperty(e,"weightedQuantile",{enumerable:!0,get:function(){return C}}),Object.defineProperty(e,"pairs",{enumerable:!0,get:function(){return A}}),Object.defineProperty(e,"covariance",{enumerable:!0,get:function(){return S}}),Object.defineProperty(e,"regression",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"fitLinearModel",{enumerable:!0,get:function(){return Ae}}),Object.defineProperty(e,"ADF_CT_CRITICAL",{enumerable:!0,get:function(){return Me}}),Object.defineProperty(e,"augmentedDickeyFuller",{enumerable:!0,get:function(){return ie}}),Object.defineProperty(e,"autocorrelations",{enumerable:!0,get:function(){return Oe}}),Object.defineProperty(e,"spearman",{enumerable:!0,get:function(){return je}}),Object.defineProperty(e,"kendall",{enumerable:!0,get:function(){return Ce}}),Object.defineProperty(e,"seriesStats",{enumerable:!0,get:function(){return fe}}),Object.defineProperty(e,"D2_N2",{enumerable:!0,get:function(){return Ee}}),Object.defineProperty(e,"D4_N2",{enumerable:!0,get:function(){return le}}),Object.defineProperty(e,"movingRanges",{enumerable:!0,get:function(){return de}}),Object.defineProperty(e,"withinSigma",{enumerable:!0,get:function(){return Se}}),Object.defineProperty(e,"capability",{enumerable:!0,get:function(){return Fe}}),Object.defineProperty(e,"controlLimits",{enumerable:!0,get:function(){return ke}}),Object.defineProperty(e,"westernElectricViolations",{enumerable:!0,get:function(){return Ie}}),Object.defineProperty(e,"nelsonViolations",{enumerable:!0,get:function(){return Be}}),Object.defineProperty(e,"CONTROL_RULE_SETS",{enumerable:!0,get:function(){return Ke}}),Object.defineProperty(e,"controlViolations",{enumerable:!0,get:function(){return rt}}),Object.defineProperty(e,"countOutside",{enumerable:!0,get:function(){return tt}}),Object.defineProperty(e,"histogram",{enumerable:!0,get:function(){return pt}}),Object.defineProperty(e,"DEFAULT_CONFIDENCE",{enumerable:!0,get:function(){return yt}}),Object.defineProperty(e,"meanInterval",{enumerable:!0,get:function(){return Pt}}),Object.defineProperty(e,"proportionInterval",{enumerable:!0,get:function(){return Ct}}),Object.defineProperty(e,"slopeInterval",{enumerable:!0,get:function(){return Lt}}),Object.defineProperty(e,"capabilityInterval",{enumerable:!0,get:function(){return Rt}}),Object.defineProperty(e,"standardizedMeanDifference",{enumerable:!0,get:function(){return Bt}}),Object.defineProperty(e,"normalTotalVariation",{enumerable:!0,get:function(){return ht}}),Object.defineProperty(e,"frequencyMap",{enumerable:!0,get:function(){return ct}}),Object.defineProperty(e,"categoricalDistance",{enumerable:!0,get:function(){return bt}}),Object.defineProperty(e,"SUBSET_RELIABILITY_FLOOR",{enumerable:!0,get:function(){return it}}),Object.defineProperty(e,"compareColumn",{enumerable:!0,get:function(){return we}}),Object.defineProperty(e,"isNumericColumn",{enumerable:!0,get:function(){return Le}}),Object.defineProperty(e,"populationRead",{enumerable:!0,get:function(){return Re}});const te=U("packages/core/src/compute/handle.js"),E=te.presenceReader,q=te.valueReader,z=U("packages/core/src/compute/special.js"),_=z.studentTQuantile,Z=z.studentT,X=z.normalQuantile,B=z.normalCdf,Y=z.chiSquareUpperTail,G=U("packages/core/src/compute/linalg.js"),j=G.cholesky,k=G.choleskySolve,g=G.choleskyInverse,c=G.normalEquations,d=G.quadForm,i=U("packages/core/src/compute/sketch.js").SKETCH_BOUNDS,n=5e3,a=Object.freeze({variance:"rescan",varianceP:"rescan",stddev:"rescan",stddevP:"rescan",sumSquares:"rescan",weightedAvg:"rescan",median:"rescan",p25:"rescan",p75:"rescan",p90:"rescan",p95:"rescan",p99:"rescan",iqr:"rescan",mode:"rescan",distinct:"rescan",range:"rescan",skewness:"rescan",kurtosis:"rescan",geomean:"rescan",harmean:"rescan",mad:"rescan",argmin:"rescan",argmax:"rescan",hhi:"rescan",entropy:"rescan",evenness:"rescan",top3Share:"rescan",top10Share:"rescan",gini:"rescan",trimmedMean:"rescan",winsorizedMean:"rescan",robustOutliers:"rescan",jarqueBera:"rescan",passRate:"rescan",failureCount:"rescan"}),s=Object.freeze({distinct:Object.freeze({sketch:"HyperLogLog",bound:i.distinct}),median:Object.freeze({sketch:"KLL",bound:i.median}),p25:Object.freeze({sketch:"KLL",bound:i.p25}),p75:Object.freeze({sketch:"KLL",bound:i.p75}),p90:Object.freeze({sketch:"KLL",bound:i.p90}),p95:Object.freeze({sketch:"KLL",bound:i.p95}),p99:Object.freeze({sketch:"KLL",bound:i.p99}),iqr:Object.freeze({sketch:"KLL",bound:i.iqr}),top3Share:Object.freeze({sketch:"SpaceSaving",bound:i.topK}),top10Share:Object.freeze({sketch:"SpaceSaving",bound:i.topK})});function t(ne){const se=ne==="sum"||ne==="avg"||ne==="countValues"||ne==="min"||ne==="max"?"maintained":Object.prototype.hasOwnProperty.call(a,ne)?a[ne]:null,ce=Object.prototype.hasOwnProperty.call(s,ne)?s[ne]:null;return{stat:ne,exact:se,approximate:ce}}function u(ne,se){const ce=se.length,he=new Float64Array(ce);let ye=0;if(ne&&(ne.kind==="float64"||ne.kind==="int32")){const xe=ne.values,ze=E(ne);for(let Ye=0;Ye<ce;Ye++){const $e=se[Ye];if(ze&&ze($e)!==1)continue;const Ge=xe[$e];Number.isNaN(Ge)||(he[ye++]=Ge)}return he.subarray(0,ye)}const Te=q(ne);for(let xe=0;xe<ce;xe++){const ze=Te(se[xe]);if(ze==null||ze==="")continue;const Ye=typeof ze=="number"?ze:Number(ze);Number.isFinite(Ye)&&(he[ye++]=Ye)}return he.subarray(0,ye)}function r(ne,se){const ce=new Map,he=q(ne);let ye=0;for(let Te=0;Te<se.length;Te++){const xe=he(se[Te]);if(xe==null||xe===""||typeof xe=="number"&&Number.isNaN(xe))continue;const ze=typeof xe=="object"?String(xe):xe;ce.set(ze,(ce.get(ze)||0)+1),ye++}const ve=[...ce.values()].sort((Te,xe)=>xe-Te);return{counts:ve,total:ye,distinct:ve.length}}function o(ne){return ne.total>0?ne.counts.map(se=>se/ne.total):[]}function f(ne,se){const ce=r(ne,se);if(!ce.total)return null;let he=0;for(const ye of o(ce))he+=ye*ye;return he}function w(ne,se){const ce=r(ne,se);if(!ce.total)return null;let he=0;for(const ye of o(ce))ye>0&&(he-=ye*Math.log2(ye));return he}function m(ne,se){const ce=r(ne,se);if(!ce.total||ce.distinct<2)return ce.total?1:null;let he=0;for(const ye of o(ce))ye>0&&(he-=ye*Math.log2(ye));return he/Math.log2(ce.distinct)}function v(ne,se,ce=3){const he=r(ne,se);if(!he.total)return null;const ye=Math.max(1,Math.floor(ce));let ve=0;for(let Te=0;Te<Math.min(ye,he.counts.length);Te++)ve+=he.counts[Te];return ve/he.total}function h(ne,se){const ce=u(ne,se),he=ce.length;if(!he)return null;const ye=ce.slice().sort();if(ye[0]<0)return null;let ve=0,Te=0;for(let xe=0;xe<he;xe++)ve+=ye[xe],Te+=(xe+1)*ye[xe];return ve===0?0:2*Te/(he*ve)-(he+1)/he}function p(ne){let se=0,ce=0,he=0;for(let ye=0;ye<ne.length;ye++){const ve=ne[ye];se++;const Te=ve-ce;ce+=Te/se,he+=Te*(ve-ce)}return{n:se,mean:ce,m2:he}}function b(ne,se){const ce=ne.length;if(!ce)return NaN;if(ce===1)return ne[0];const he=(ce-1)*Math.min(1,Math.max(0,se)),ye=Math.floor(he),ve=Math.ceil(he);return ye===ve?ne[ye]:ne[ye]+(he-ye)*(ne[ve]-ne[ye])}function O(ne,se){if(!ne.length)return NaN;const ce=ne.slice().sort();return b(ce,se)}function y(ne,se){const ce=q(ne);let he=0,ye=0,ve=0;for(let Te=0;Te<se.length;Te++){const xe=ce(se[Te]);if(xe==null||xe==="")continue;const ze=String(xe).toUpperCase();ze==="PASS"?he++:ze==="FAIL"?ye++:ze==="WARN"&&ve++}return{pass:he+ve,fail:ye,warn:ve,judged:he+ve+ye}}const L=Object.freeze({hhi:(ne,se)=>f(ne,se),entropy:(ne,se)=>w(ne,se),evenness:(ne,se)=>m(ne,se),top3Share:(ne,se)=>v(ne,se,3),top10Share:(ne,se)=>v(ne,se,10),gini:(ne,se)=>h(ne,se),trimmedMean:(ne,se)=>I(u(ne,se),.1),winsorizedMean:(ne,se)=>P(u(ne,se),.1),robustOutliers:(ne,se)=>R(u(ne,se),3.5),jarqueBera:(ne,se)=>$(u(ne,se)),variance:(ne,se)=>{const{n:ce,m2:he}=p(u(ne,se));return ce>1?he/(ce-1):null},varianceP:(ne,se)=>{const{n:ce,m2:he}=p(u(ne,se));return ce>0?he/ce:null},stddev:(ne,se)=>{const{n:ce,m2:he}=p(u(ne,se));return ce>1?Math.sqrt(he/(ce-1)):null},stddevP:(ne,se)=>{const{n:ce,m2:he}=p(u(ne,se));return ce>0?Math.sqrt(he/ce):null},median:(ne,se)=>{const ce=u(ne,se);return ce.length?O(ce,.5):null},p25:(ne,se)=>{const ce=u(ne,se);return ce.length?O(ce,.25):null},p75:(ne,se)=>{const ce=u(ne,se);return ce.length?O(ce,.75):null},p90:(ne,se)=>{const ce=u(ne,se);return ce.length?O(ce,.9):null},p95:(ne,se)=>{const ce=u(ne,se);return ce.length?O(ce,.95):null},p99:(ne,se)=>{const ce=u(ne,se);return ce.length?O(ce,.99):null},iqr:(ne,se)=>{const ce=u(ne,se);if(!ce.length)return null;const he=ce.slice().sort();return b(he,.75)-b(he,.25)},mad:(ne,se)=>{const ce=u(ne,se);if(!ce.length)return null;const he=O(ce,.5),ye=new Float64Array(ce.length);for(let ve=0;ve<ce.length;ve++)ye[ve]=Math.abs(ce[ve]-he);return O(ye,.5)},range:(ne,se)=>{const ce=u(ne,se);if(!ce.length)return null;let he=1/0,ye=-1/0;for(let ve=0;ve<ce.length;ve++)ce[ve]<he&&(he=ce[ve]),ce[ve]>ye&&(ye=ce[ve]);return ye-he},distinct:(ne,se)=>{const ce=q(ne),he=new Set;for(let ye=0;ye<se.length;ye++){const ve=ce(se[ye]);ve==null||ve===""||he.add(ve instanceof Date?ve.getTime():ve)}return he.size},mode:(ne,se)=>{const ce=q(ne),he=new Map;for(let Te=0;Te<se.length;Te++){const xe=ce(se[Te]);if(xe==null||xe==="")continue;const ze=xe instanceof Date?xe.getTime():xe;he.set(ze,(he.get(ze)||0)+1)}let ye=null,ve=1;for(const[Te,xe]of he)xe>ve&&(ve=xe,ye=Te);return ye},skewness:(ne,se)=>{const ce=u(ne,se),{n:he,mean:ye,m2:ve}=p(ce);if(he<3||ve<=0)return null;const Te=Math.sqrt(ve/(he-1));let xe=0;for(let ze=0;ze<ce.length;ze++)xe+=((ce[ze]-ye)/Te)**3;return he/((he-1)*(he-2))*xe},kurtosis:(ne,se)=>{const ce=u(ne,se),{n:he,mean:ye,m2:ve}=p(ce);if(he<4||ve<=0)return null;const Te=Math.sqrt(ve/(he-1));let xe=0;for(let $e=0;$e<ce.length;$e++)xe+=((ce[$e]-ye)/Te)**4;const ze=he*(he+1)/((he-1)*(he-2)*(he-3)),Ye=3*(he-1)**2/((he-2)*(he-3));return ze*xe-Ye},geomean:(ne,se)=>{const ce=u(ne,se);if(!ce.length)return null;let he=0;for(let ye=0;ye<ce.length;ye++){if(ce[ye]<=0)return null;he+=Math.log(ce[ye])}return Math.exp(he/ce.length)},harmean:(ne,se)=>{const ce=u(ne,se);if(!ce.length)return null;let he=0;for(let ye=0;ye<ce.length;ye++){if(ce[ye]===0)return null;he+=1/ce[ye]}return ce.length/he},sumSquares:(ne,se)=>{const ce=u(ne,se);let he=0;for(let ye=0;ye<ce.length;ye++)he+=ce[ye]*ce[ye];return he},passRate:(ne,se)=>{const{pass:ce,judged:he}=y(ne,se);return he?ce/he:null},failureCount:(ne,se)=>y(ne,se).fail}),M=Object.freeze({hhi:"Concentration (HHI)",entropy:"Entropy",evenness:"Evenness",top3Share:"Top 3 share",top10Share:"Top 10 share",gini:"Gini coefficient",trimmedMean:"Trimmed mean",winsorizedMean:"Winsorized mean",robustOutliers:"Outliers (robust)",jarqueBera:"Jarque–Bera",median:"Median",p25:"25th percentile",p75:"75th percentile",p90:"90th percentile",p95:"95th percentile",p99:"99th percentile",iqr:"Interquartile range",mad:"Median absolute deviation",variance:"Variance",varianceP:"Variance (population)",stddev:"Standard deviation",stddevP:"Standard deviation (population)",range:"Range",distinct:"Distinct",mode:"Mode",skewness:"Skewness",kurtosis:"Kurtosis",geomean:"Geometric mean",harmean:"Harmonic mean",sumSquares:"Sum of squares",weightedAvg:"Weighted average",argmin:"Lowest by",argmax:"Highest by",passRate:"Pass rate",failureCount:"Failures"});function D(ne,se,ce){const he=q(ne),ye=q(se);let ve=0,Te=0;for(let xe=0;xe<ce.length;xe++){const ze=ce[xe],Ye=Number(he(ze)),$e=Number(ye(ze));!Number.isFinite(Ye)||!Number.isFinite($e)||(ve+=Ye*$e,Te+=$e)}return Te===0?null:ve/Te}function F(ne,se,ce){const he=q(ne);let ye=null,ve=ce?-1/0:1/0;for(let Te=0;Te<se.length;Te++){const xe=se[Te],ze=Number(he(xe));Number.isFinite(ze)&&(ce?ze>ve:ze<ve)&&(ve=ze,ye=xe)}return ye}function T(ne,se,ce){const he=q(ne),ye=q(se);let ve=0,Te=0,xe=0,ze=0,Ye=0,$e=0;for(let Qe=0;Qe<ce.length;Qe++){const lt=ce[Qe],ot=Number(he(lt)),st=Number(ye(lt));!Number.isFinite(ot)||!Number.isFinite(st)||(ve++,Te+=ot,xe+=st,ze+=ot*ot,Ye+=st*st,$e+=ot*st)}if(ve<2)return null;const Ge=ve*$e-Te*xe,Ze=Math.sqrt((ve*ze-Te*Te)*(ve*Ye-xe*xe));if(Ze===0)return null;const Je=Ge/Ze;return Math.max(-1,Math.min(1,Je))}function I(ne,se=.1){const ce=ne.length;if(!ce)return null;const he=Array.from(ne).sort((xe,ze)=>xe-ze),ye=Math.floor(ce*Math.min(.49,Math.max(0,se))),ve=he.slice(ye,ce-ye);if(!ve.length)return b(he,.5);let Te=0;for(const xe of ve)Te+=xe;return Te/ve.length}function P(ne,se=.1){const ce=ne.length;if(!ce)return null;const he=Array.from(ne).sort((ze,Ye)=>ze-Ye),ye=Math.floor(ce*Math.min(.49,Math.max(0,se))),ve=he[ye],Te=he[ce-1-ye];let xe=0;for(const ze of he)xe+=Math.min(Te,Math.max(ve,ze));return xe/ce}function R(ne,se=3.5){if(!ne.length)return null;const he=Array.from(ne).sort((ze,Ye)=>ze-Ye),ye=b(he,.5),ve=he.map(ze=>Math.abs(ze-ye)).sort((ze,Ye)=>ze-Ye),Te=b(ve,.5);if(Te===0)return null;let xe=0;for(const ze of he)Math.abs(.6745*(ze-ye)/Te)>se&&xe++;return xe}function $(ne){const se=ne.length;if(se<8)return null;let ce=0;for(const ze of ne)ce+=ze;ce/=se;let he=0,ye=0,ve=0;for(const ze of ne){const Ye=ze-ce;he+=Ye*Ye,ye+=Ye*Ye*Ye,ve+=Ye*Ye*Ye*Ye}if(he/=se,ye/=se,ve/=se,he===0)return null;const Te=ye/he**1.5,xe=ve/(he*he)-3;return se/6*(Te*Te+xe*xe/4)}function C(ne,se,ce){const he=[];let ye=0;for(let ze=0;ze<ne.length;ze++){const Ye=Number(ne[ze]),$e=Number(se[ze]);!Number.isFinite(Ye)||!Number.isFinite($e)||$e<=0||(he.push([Ye,$e]),ye+=$e)}if(!he.length||ye<=0)return null;if(he.sort((ze,Ye)=>ze[0]-Ye[0]),he.length===1)return he[0][0];const ve=[];let Te=0;for(const[,ze]of he)ve.push((Te+ze/2)/ye),Te+=ze;const xe=Math.max(0,Math.min(1,ce));if(xe<=ve[0])return he[0][0];if(xe>=ve[ve.length-1])return he[he.length-1][0];for(let ze=1;ze<ve.length;ze++){if(xe>ve[ze])continue;const Ye=ve[ze]-ve[ze-1],$e=Ye>0?(xe-ve[ze-1])/Ye:0;return he[ze-1][0]+(he[ze][0]-he[ze-1][0])*$e}return he[he.length-1][0]}function A(ne,se,ce){const he=q(ne),ye=q(se),ve=new Float64Array(ce.length),Te=new Float64Array(ce.length);let xe=0;for(let ze=0;ze<ce.length;ze++){const Ye=ce[ze],$e=Number(he(Ye)),Ge=Number(ye(Ye));!Number.isFinite($e)||!Number.isFinite(Ge)||(ve[xe]=$e,Te[xe]=Ge,xe++)}return{xs:ve.subarray(0,xe),ys:Te.subarray(0,xe),n:xe}}function S(ne,se,ce,he=!1){const{xs:ye,ys:ve,n:Te}=A(ne,se,ce);if(Te<2)return null;let xe=0,ze=0;for(let $e=0;$e<Te;$e++)xe+=ye[$e],ze+=ve[$e];xe/=Te,ze/=Te;let Ye=0;for(let $e=0;$e<Te;$e++)Ye+=(ye[$e]-xe)*(ve[$e]-ze);return Ye/(he?Te:Te-1)}function x(ne,se,ce){const{xs:he,ys:ye,n:ve}=A(ne,se,ce);if(ve<2)return null;let Te=0,xe=0;for(let ot=0;ot<ve;ot++)Te+=he[ot],xe+=ye[ot];Te/=ve,xe/=ve;let ze=0,Ye=0,$e=0;for(let ot=0;ot<ve;ot++){const st=he[ot]-Te,St=ye[ot]-xe;ze+=st*st,Ye+=st*St,$e+=St*St}if(ze===0)return null;const Ge=Ye/ze,Ze=xe-Ge*Te,Je=$e===0?1:Math.max(0,Math.min(1,Ye*Ye/(ze*$e))),Qe=Math.max(0,$e-Ge*Ye),lt=ve>2?Math.sqrt(Qe/(ve-2)/ze):0;return{slope:Ge,intercept:Ze,r2:Je,stdError:lt,n:ve}}const H=new Set(["ols","wls","robust"]),V=new Set(["quantile"]),W=new Set(["ridge","lasso","elasticnet","mixed","gls"]),Q=1.345;function ee(ne,se,ce){const{xtwx:he,xtwy:ye}=c(ne,se,ce),ve=j(he);if(!ve)return null;const Te=k(ve,ye),xe=g(ve),ze=re(ne,Te),Ye=se.map(($e,Ge)=>$e-ze[Ge]);return{beta:Te,cov:xe,fitted:ze,residuals:Ye}}function re(ne,se){return ne.map(ce=>ce.reduce((he,ye,ve)=>he+ye*se[ve],0))}function ae(ne,se){const ce=ne.length,he=ne.map(Ye=>Ye[se]),ye=ne.map(Ye=>[1,...Ye.filter(($e,Ge)=>Ge!==se)]),ve=ee(ye,he,null);if(!ve)return 1;const Te=he.reduce((Ye,$e)=>Ye+$e,0)/ce;let xe=0,ze=0;for(let Ye=0;Ye<ce;Ye++)xe+=ve.residuals[Ye]**2,ze+=(he[Ye]-Te)**2;return ze===0?1:Math.max(0,Math.min(1,1-xe/ze))}function ue(ne){const se=[...ne].sort((ye,ve)=>ye-ve),ce=ge(se),he=ne.map(ye=>Math.abs(ye-ce)).sort((ye,ve)=>ye-ve);return ge(he)/.6745}function ge(ne){const se=ne.length;if(!se)return 0;const ce=Math.floor(se/2);return se%2?ne[ce]:(ne[ce-1]+ne[ce])/2}function Ae(ne,se,ce={}){const he=ce.method||"ols";if(W.has(he))throw new Error(`[lattice] regression method "${he}" is out of scope; use ols, wls or robust.`);if(V.has(he))throw new Error("[lattice] quantile regression is coming next and not yet available; use ols, wls or robust.");if(!H.has(he))throw new Error(`[lattice] unknown regression method "${he}"; use ols, wls or robust.`);const ye=Array.isArray(se)?se.length:0,ve=ye&&Array.isArray(ne[0])?ne[0].length:0,Te=ve+1;if(!(ye>Te))return null;for(let $t=0;$t<ye;$t++){if(!Number.isFinite(se[$t])||!Array.isArray(ne[$t])||ne[$t].length!==ve)return null;for(let Dt=0;Dt<ve;Dt++)if(!Number.isFinite(ne[$t][Dt]))return null}let xe=null;if(he==="wls"){if(xe=ce.weights,!Array.isArray(xe)||xe.length!==ye)return null;for(let $t=0;$t<ye;$t++)if(!(xe[$t]>0)||!Number.isFinite(xe[$t]))return null}const ze=ne.map($t=>[1,...$t]);let Ye,$e=null;if(he==="robust"){if(Ye=ee(ze,se,null),!Ye)return null;for(let $t=0;$t<50;$t++){const Dt=ue(Ye.residuals);if(!(Dt>0))break;const Ht=Ye.residuals.map(Qt=>{const Xt=Math.abs(Qt/Dt);return Xt<=Q?1:Q/Xt}),Kt=ee(ze,se,Ht);if(!Kt)return null;const Zt=Kt.beta.reduce((Qt,Xt,nn)=>Math.max(Qt,Math.abs(Xt-Ye.beta[nn])),0);if(Ye=Kt,$e=Ht,Zt<1e-10)break}}else if(Ye=ee(ze,se,xe),!Ye)return null;const Ge=he==="robust"?$e:xe,{beta:Ze,cov:Je,fitted:Qe,residuals:lt}=Ye;let ot=0,st=0,St=0;for(let $t=0;$t<ye;$t++){const Dt=Ge?Ge[$t]:1;ot+=Dt*lt[$t]**2,st+=Dt,St+=Dt*se[$t]}const jt=St/st;let Mt=0;for(let $t=0;$t<ye;$t++){const Dt=Ge?Ge[$t]:1;Mt+=Dt*(se[$t]-jt)**2}const We=ye-Te,ut=ot/We,ft=Mt===0?1:Math.max(0,Math.min(1,1-ot/Mt)),wt=1-(1-ft)*(ye-1)/We,Et=Array.isArray(ce.names)&&ce.names.length===ve?ce.names:ne[0].map(($t,Dt)=>`x${Dt+1}`),mt=kt(ce.confidence),dt=We>0?_(1-(1-mt)/2,We):1/0,Nt=Ze.map(($t,Dt)=>{const Ht=Math.sqrt(Math.max(0,ut*Je[Dt][Dt])),Kt=Ht>0?$t/Ht:$t===0?0:1/0,Zt=Number.isFinite(Kt)?2*(1-Z(Math.abs(Kt),We)):0,Qt=Number.isFinite(dt)?dt*Ht:null;return{name:Dt===0?"(intercept)":Et[Dt-1],estimate:$t,stdError:Ht,t:Kt,p:Math.max(0,Math.min(1,Zt)),lower:Qt===null?null:$t-Qt,upper:Qt===null?null:$t+Qt}}),Ut=new Array(ye),Yt=new Array(ye);for(let $t=0;$t<ye;$t++){const Dt=Ge?Ge[$t]:1,Ht=Math.max(0,Math.min(1,Dt*d(ze[$t],Je)));Ut[$t]=Ht;const Kt=(1-Ht)**2;Yt[$t]=Kt>0&&ut>0?lt[$t]**2/(Te*ut)*(Ht/Kt):null}const pn=ne[0].map(($t,Dt)=>{if(ve<2)return 1;const Ht=ae(ne,Dt);return Ht>=1?1/0:1/(1-Ht)});let un=null;{const $t=lt.map(Ht=>Ht*Ht),Dt=ee(ze,$t,null);if(Dt){const Ht=$t.reduce((Jt,mn)=>Jt+mn,0)/ye;let Kt=0,Zt=0;for(let Jt=0;Jt<ye;Jt++)Kt+=Dt.residuals[Jt]**2,Zt+=($t[Jt]-Ht)**2;const Qt=Zt===0?0:Math.max(0,Math.min(1,1-Kt/Zt)),Xt=ye*Qt,nn=Y(Xt,ve);un={statistic:Xt,df:ve,p:nn,heteroscedastic:nn<.05}}}let on=null;if(ve===1){const $t=ne.map((Dt,Ht)=>Ht).sort((Dt,Ht)=>ne[Dt][0]-ne[Ht][0]);on={confidence:mt,points:$t.map(Dt=>{const Ht=ze[Dt],Kt=Math.sqrt(Math.max(0,ut*d(Ht,Je)));return{x:ne[Dt][0],yhat:Qe[Dt],lower:Qe[Dt]-dt*Kt,upper:Qe[Dt]+dt*Kt}})}}return{method:he,coefficients:Nt,r2:ft,adjR2:wt,n:ye,df:We,sigma2:ut,fitted:Qe,residuals:lt,leverage:Ut,cooksD:Yt,vif:pn,heteroscedasticity:un,band:on,weights:Ge?[...Ge]:null}}function pe(ne){const se=ne.length,ce=Array.from({length:se},(ve,Te)=>Te).sort((ve,Te)=>ne[ve]-ne[Te]),he=new Float64Array(se);let ye=0;for(;ye<se;){let ve=ye;for(;ve+1<se&&ne[ce[ve+1]]===ne[ce[ye]];)ve++;const Te=(ye+ve)/2+1;for(let xe=ye;xe<=ve;xe++)he[ce[xe]]=Te;ye=ve+1}return he}const Me=Object.freeze({"1%":-3.9638,"5%":-3.4126,"10%":-3.1279});function Ne(ne){const se=[.01,.05,.1],ce=[Me["1%"],Me["5%"],Me["10%"]];if(ne<=ce[0]){const ve=(Math.log(se[1])-Math.log(se[0]))/(ce[1]-ce[0]);return Math.max(1e-4,Math.min(.01,Math.exp(Math.log(se[0])+ve*(ne-ce[0]))))}if(ne>=ce[2]){const ve=(Math.log(se[2])-Math.log(se[1]))/(ce[2]-ce[1]);return Math.max(.1,Math.min(.999,Math.exp(Math.log(se[2])+ve*(ne-ce[2]))))}const he=ne<ce[1]?0:1,ye=(ne-ce[he])/(ce[he+1]-ce[he]);return Math.exp(Math.log(se[he])+ye*(Math.log(se[he+1])-Math.log(se[he])))}function Pe(ne,se,ce,he){const ye=ce-he,ve=he+3,Te=new Array(ye),xe=new Array(ye);let ze=!0,Ye=he;for(let Qe=0;Qe<ye;Qe++){const lt=he+Qe,ot=new Float64Array(ve);ot[0]=1,ot[1]=Qe+1,ot[2]=ne[lt];for(let st=1;st<=he;st++)ot[2+st]=se[lt-st];for(let st=1;st<ve;st++)Number.isFinite(ot[st])||(Ye=Math.min(Ye,st-3));Te[Qe]=ot,xe[Qe]=se[lt],Number.isFinite(xe[Qe])||(ze=!1)}if(!ze)return 0;const{xtwx:$e,xtwy:Ge}=c(Te,xe,null);let Ze=0,Je=1/0;for(let Qe=0;Qe<=Ye;Qe++){const lt=Qe+3;if(!(ye>lt))continue;const ot=new Array(lt);for(let ft=0;ft<lt;ft++)ot[ft]=$e[ft].slice(0,lt);const st=j(ot);if(!st)continue;const St=k(st,Ge.slice(0,lt));let jt=0;for(let ft=0;ft<ye;ft++){const wt=Te[ft];let Et=0;for(let mt=0;mt<lt;mt++)Et+=wt[mt]*St[mt];jt+=(xe[ft]-Et)**2}const We=jt/(ye-lt)*(ye-lt);if(!(We>0))continue;const ut=ye*Math.log(We/ye)+2*lt;ut<Je&&(Je=ut,Ze=Qe)}return Ze}function ie(ne,se={}){const ce=[];for(let Je=0;Je<ne.length;Je++){const Qe=Number(ne[Je]);Number.isFinite(Qe)&&ce.push(Qe)}const he=ce.length,ye=he-1;if(he<8||ye<6)return null;const ve=new Array(ye);for(let Je=0;Je<ye;Je++)ve[Je]=ce[Je+1]-ce[Je];let Te=Number.isFinite(se.maxlag)?Math.floor(se.maxlag):Math.ceil(12*(he/100)**.25);Te=Math.max(0,Math.min(Te,Math.floor((ye-5)/2)));const xe=(Je,Qe)=>{const lt=[],ot=[];for(let st=Qe;st<ye;st++){const St=[st-Qe+1,ce[st]];for(let jt=1;jt<=Je;jt++)St.push(ve[st-jt]);lt.push(St),ot.push(ve[st])}return Ae(lt,ot,{method:"ols"})},ze=Pe(ce,ve,ye,Te),Ye=xe(ze,ze);if(!Ye||!Ye.coefficients[2])return null;const $e=Ye.coefficients[2].t,Ge=Ne($e),Ze=$e<Me["5%"];return{statistic:$e,usedLag:ze,nobs:ye-ze,criticalValues:{...Me},pValue:Ge,pApproximate:!0,stationary:Ze,verdict:Ze?"stationary":"non-stationary",regression:"ct"}}function Oe(ne,se={}){const ce=[];for(let Ze=0;Ze<ne.length;Ze++){const Je=Number(ne[Ze]);Number.isFinite(Je)&&ce.push(Je)}const he=ce.length;if(he<3)return null;let ye=Number.isFinite(se.maxlag)?Math.floor(se.maxlag):Math.min(10,he-1);ye=Math.max(1,Math.min(ye,he-1));let ve=0;for(const Ze of ce)ve+=Ze;ve/=he;const Te=ce.map(Ze=>Ze-ve);let xe=0;for(const Ze of Te)xe+=Ze*Ze;xe/=he;const ze=new Array(ye+1).fill(0);ze[0]=1;for(let Ze=1;Ze<=ye;Ze++){let Je=0;for(let Qe=Ze;Qe<he;Qe++)Je+=Te[Qe]*Te[Qe-Ze];ze[Ze]=xe>0?Je/he/xe:0}const Ye=new Array(ye+1).fill(0);Ye[0]=1;let $e=[];for(let Ze=1;Ze<=ye;Ze++){let Je=ze[Ze];for(let st=1;st<Ze;st++)Je-=$e[st-1]*ze[Ze-st];let Qe=1;for(let st=1;st<Ze;st++)Qe-=$e[st-1]*ze[st];const lt=Qe!==0?Je/Qe:0,ot=new Array(Ze);for(let st=1;st<Ze;st++)ot[st-1]=$e[st-1]-lt*$e[Ze-1-st];ot[Ze-1]=lt,Ye[Ze]=lt,$e=ot}const Ge=1.96/Math.sqrt(he);return{acf:ze,pacf:Ye,bounds:{upper:Ge,lower:-Ge},n:he,nlags:ye,approximate:!0}}function je(ne,se,ce){const{xs:he,ys:ye,n:ve}=A(ne,se,ce);if(ve<2)return null;const Te=pe(he),xe=pe(ye);let ze=0,Ye=0;for(let Je=0;Je<ve;Je++)ze+=Te[Je],Ye+=xe[Je];ze/=ve,Ye/=ve;let $e=0,Ge=0,Ze=0;for(let Je=0;Je<ve;Je++){const Qe=Te[Je]-ze,lt=xe[Je]-Ye;$e+=Qe*lt,Ge+=Qe*Qe,Ze+=lt*lt}return Ge===0||Ze===0?null:Math.max(-1,Math.min(1,$e/Math.sqrt(Ge*Ze)))}function Ce(ne,se,ce){const{xs:he,ys:ye,n:ve}=A(ne,se,ce);if(ve<2||ve>n)return null;let Te=0,xe=0,ze=0,Ye=0;for(let Ze=0;Ze<ve;Ze++)for(let Je=Ze+1;Je<ve;Je++){const Qe=Math.sign(he[Ze]-he[Je]),lt=Math.sign(ye[Ze]-ye[Je]),ot=Qe*lt;ot>0?Te++:ot<0?xe++:Qe===0&<===0||(Qe===0?ze++:Ye++)}const $e=Te+xe+Ye,Ge=Te+xe+ze;return $e===0||Ge===0?null:(Te-xe)/Math.sqrt($e*Ge)}function fe(ne,se={}){const ce=ne.length;if(ce<2)return null;const he=ne[0],ye=ne[ce-1],ve=[];for(let st=1;st<ce;st++){const St=ne[st-1];St!==0&&ve.push((ne[st]-St)/Math.abs(St))}let Te=null;if(ve.length>1){let st=0;for(const jt of ve)st+=jt;st/=ve.length;let St=0;for(const jt of ve)St+=(jt-st)**2;Te=Math.sqrt(St/(ve.length-1))}const xe=Number(se.periodsPerYear)>0?Number(se.periodsPerYear):null;let ze=ne[0],Ye=0,$e=0,Ge=0,Ze=0;for(let st=1;st<ce;st++){if(ne[st]>ze){ze=ne[st],Ye=st;continue}if(ze<=0)continue;const St=(ze-ne[st])/ze;St>$e&&($e=St,Ge=Ye,Ze=st)}let Je=null;if(ce>2){let st=0;for(let Mt=0;Mt<ce;Mt++)st+=ne[Mt];st/=ce;let St=0,jt=0;for(let Mt=0;Mt<ce;Mt++){const We=ne[Mt]-st;jt+=We*We,Mt>0&&(St+=We*(ne[Mt-1]-st))}Je=jt>0?St/jt:null}let Qe=0,lt=0;for(const st of ve)st>0?Qe++:st<0&<++;let ot=null;if(he>0&&ye>0){const st=(ye/he)**(1/(ce-1))-1;ot=xe?(1+st)**xe-1:st}return{n:ce,first:he,last:ye,change:ye-he,changePercent:he===0?null:(ye-he)/Math.abs(he)*100,volatility:Te,annualisedVolatility:Te!==null&&xe?Te*Math.sqrt(xe):null,growth:ot,maxDrawdown:$e,maxDrawdownFrom:Ge,maxDrawdownTo:Ze,autocorrelation:Je,upDays:Qe,downDays:lt}}const Ee=1.128,le=3.267;function de(ne){const se=ne.length;if(se<2)return null;const ce=[];for(let ye=1;ye<se;ye++)ce.push(Math.abs(ne[ye]-ne[ye-1]));const he=ce.reduce((ye,ve)=>ye+ve,0)/ce.length;return{ranges:ce,centre:he,upper:le*he,lower:0}}function Se(ne){const se=ne.length;if(se<2)return null;let ce=0;for(let ye=1;ye<se;ye++)ce+=Math.abs(ne[ye]-ne[ye-1]);const he=ce/(se-1);return{sigma:he/Ee,meanRange:he}}function Fe(ne,se){const ce=ne.length;if(ce<2||!se)return null;const he=Number.isFinite(Number(se.lower))?Number(se.lower):null,ye=Number.isFinite(Number(se.upper))?Number(se.upper):null;if(he===null&&ye===null)return null;let ve=0;for(let Qe=0;Qe<ce;Qe++)ve+=ne[Qe];ve/=ce;let Te=0;for(let Qe=0;Qe<ce;Qe++)Te+=(ne[Qe]-ve)**2;const xe=Math.sqrt(Te/(ce-1)),ze=Se(ne),Ye=ze?ze.sigma:null,$e=Qe=>{if(!Qe||Qe<=0)return{index:null,k:null};const ot=he!==null&&ye!==null?(ye-he)/(6*Qe):null,st=ye!==null?(ye-ve)/(3*Qe):1/0,St=he!==null?(ve-he)/(3*Qe):1/0;return{index:ot,k:Math.min(st,St)}},Ge=$e(Ye),Ze=$e(xe);let Je=0;for(let Qe=0;Qe<ce;Qe++){if(he!==null&&ne[Qe]<he){Je++;continue}ye!==null&&ne[Qe]>ye&&Je++}return{n:ce,mean:ve,lower:he,upper:ye,target:Number.isFinite(Number(se.target))?Number(se.target):null,sigmaWithin:Ye,sigmaOverall:xe,cp:Ge.index,cpk:Ge.k,pp:Ze.index,ppk:Ze.k,outOfSpec:Je,defectRate:ce?Je/ce:null}}function ke(ne){const se=ne.length;if(se<2)return null;const ce=Se(ne);if(!ce||!(ce.sigma>0))return null;let he=0;for(let ye=0;ye<se;ye++)he+=ne[ye];return he/=se,{centre:he,sigma:ce.sigma,upper:he+3*ce.sigma,lower:he-3*ce.sigma}}function Ie(ne,se){if(!se||!(se.sigma>0))return[];const ce=ne.length,{centre:he,sigma:ye}=se,ve=xe=>(ne[xe]-he)/ye,Te=[];for(let xe=0;xe<ce;xe++){if(Math.abs(ve(xe))>3&&Te.push({index:xe,rule:1,description:"beyond three sigma"}),xe>=2)for(const ze of[1,-1]){let Ye=0;for(let $e=xe-2;$e<=xe;$e++)ve($e)*ze>2&&Ye++;if(Ye>=2){Te.push({index:xe,rule:2,description:"two of three past two sigma"});break}}if(xe>=4)for(const ze of[1,-1]){let Ye=0;for(let $e=xe-4;$e<=xe;$e++)ve($e)*ze>1&&Ye++;if(Ye>=4){Te.push({index:xe,rule:3,description:"four of five past one sigma"});break}}if(xe>=7)for(const ze of[1,-1]){let Ye=!0;for(let $e=xe-7;$e<=xe;$e++)if(ve($e)*ze<=0){Ye=!1;break}if(Ye){Te.push({index:xe,rule:4,description:"eight in a row on one side"});break}}}return Te}function Be(ne,se){if(!se||!(se.sigma>0))return[];const ce=ne.length,{centre:he,sigma:ye}=se,ve=ze=>(ne[ze]-he)/ye,Te=(ze,Ye,$e,Ge)=>{for(const Ze of[1,-1]){let Je=0;for(let Qe=ze;Qe<=Ye;Qe++)ve(Qe)*Ze>$e&&Je++;if(Je>=Ge)return!0}return!1},xe=[];for(let ze=0;ze<ce;ze++){if(Math.abs(ve(ze))>3&&xe.push({index:ze,rule:1,description:"beyond three sigma"}),ze>=8)for(const Ye of[1,-1]){let $e=!0;for(let Ge=ze-8;Ge<=ze;Ge++)if(ve(Ge)*Ye<=0){$e=!1;break}if($e){xe.push({index:ze,rule:2,description:"nine in a row on one side"});break}}if(ze>=5)for(const Ye of[1,-1]){let $e=!0;for(let Ge=ze-4;Ge<=ze;Ge++)if((ne[Ge]-ne[Ge-1])*Ye<=0){$e=!1;break}if($e){xe.push({index:ze,rule:3,description:Ye>0?"six rising":"six falling"});break}}if(ze>=13){let Ye=!0;for(let $e=ze-12;$e<=ze;$e++){const Ge=ne[$e]-ne[$e-1],Ze=ne[$e+1<=ze?$e+1:$e]-ne[$e];if($e+1>ze)break;if(Ge===0||Ze===0||Ge>0==Ze>0){Ye=!1;break}}Ye&&xe.push({index:ze,rule:4,description:"fourteen alternating"})}if(ze>=2&&Te(ze-2,ze,2,2)&&xe.push({index:ze,rule:5,description:"two of three past two sigma"}),ze>=4&&Te(ze-4,ze,1,4)&&xe.push({index:ze,rule:6,description:"four of five past one sigma"}),ze>=14){let Ye=!0;for(let $e=ze-14;$e<=ze;$e++)if(Math.abs(ve($e))>=1){Ye=!1;break}Ye&&xe.push({index:ze,rule:7,description:"fifteen within one sigma"})}if(ze>=7){let Ye=!0;for(let $e=ze-7;$e<=ze;$e++)if(Math.abs(ve($e))<=1){Ye=!1;break}Ye&&xe.push({index:ze,rule:8,description:"eight beyond one sigma"})}}return xe}const Ke=Object.freeze(["westernElectric","nelson"]);function rt(ne,se,ce="westernElectric"){return String(ce)==="nelson"?Be(ne,se):Ie(ne,se)}function tt(ne,se,ce){let he=0;for(let ye=0;ye<ne.length;ye++)(ne[ye]<se||ne[ye]>ce)&&he++;return he}function pt(ne,se,ce,he=20){const ye=ne.length;if(!ye)return[];const ve=ne[0],Te=ne[ye-1];if(Te===ve)return[{from:ve,to:Te,count:ye}];const xe=ce-se,ze=1.5*xe;let Ye=xe>0?Math.max(ve,se-ze):ve,$e=xe>0?Math.min(Te,ce+ze):Te;$e>Ye||(Ye=ve,$e=Te);const Ge=xe>0?2*xe/Math.cbrt(ye):($e-Ye)/(Math.ceil(Math.log2(ye))+1),Ze=Ge>0?Math.min(he,Math.max(1,Math.ceil(($e-Ye)/Ge))):1,Je=($e-Ye)/Ze,Qe=[];for(let lt=0;lt<Ze;lt++)Qe.push({from:Ye+lt*Je,to:Ye+(lt+1)*Je,count:0});for(let lt=0;lt<ye;lt++){const ot=Math.min(Ze-1,Math.max(0,Math.floor((ne[lt]-Ye)/Je)));Qe[ot].count++}return Qe[0].from=ve,Qe[Ze-1].to=Te,Qe}const yt=.95;function kt(ne){const se=Number(ne);return Number.isFinite(se)&&se>0&&se<1?se:yt}function Pt(ne,se=yt){const ce=ne.length;if(ce<2)return null;let he=0;for(let $e=0;$e<ce;$e++)he+=ne[$e];const ye=he/ce;let ve=0;for(let $e=0;$e<ce;$e++){const Ge=ne[$e]-ye;ve+=Ge*Ge}const Te=Math.sqrt(ve/(ce-1)),xe=kt(se),Ye=_(1-(1-xe)/2,ce-1)*Te/Math.sqrt(ce);return{mean:ye,lower:ye-Ye,upper:ye+Ye,margin:Ye,n:ce,confidence:xe}}function Ct(ne,se,ce=yt){const he=Number(ne),ye=Number(se);if(!(ye>0)||!(he>=0)||he>ye)return null;const ve=kt(ce),Te=X(1-(1-ve)/2),xe=he/ye,ze=Te*Te,Ye=1+ze/ye,$e=(xe+ze/(2*ye))/Ye,Ge=Te/Ye*Math.sqrt(xe*(1-xe)/ye+ze/(4*ye*ye));return{proportion:xe,lower:Math.max(0,$e-Ge),upper:Math.min(1,$e+Ge),n:ye,confidence:ve}}function Lt(ne,se=yt){if(!ne||!(ne.n>2)||!Number.isFinite(ne.stdError))return null;const ce=kt(se),ye=_(1-(1-ce)/2,ne.n-2)*ne.stdError;return{slope:ne.slope,lower:ne.slope-ye,upper:ne.slope+ye,margin:ye,confidence:ce}}function Rt(ne,se,ce=yt){const he=Number(ne),ye=Number(se);if(!Number.isFinite(he)||!(ye>1))return null;const ve=kt(ce),xe=X(1-(1-ve)/2)*Math.sqrt(1/(9*ye)+he*he/(2*(ye-1)));return{index:he,lower:he-xe,upper:he+xe,margin:xe,n:ye,confidence:ve}}function Bt(ne,se){return!ne||!(ne.sd>0)||!Number.isFinite(se)||!Number.isFinite(ne.mean)?null:(se-ne.mean)/ne.sd}function ht(ne){return Number.isFinite(ne)?Math.min(1,Math.max(0,2*B(Math.abs(ne)/2)-1)):0}function ct(ne,se){const ce=new Map,he=q(ne);let ye=0;for(let ve=0;ve<se.length;ve++){const Te=he(se[ve]);if(Te==null||Te===""||typeof Te=="number"&&Number.isNaN(Te))continue;const xe=Te instanceof Date?Te.getTime():typeof Te=="object"?String(Te):Te;ce.set(xe,(ce.get(xe)||0)+1),ye++}return{map:ce,total:ye}}function bt(ne,se,ce,he){if(!(se>0)||!(he>0))return null;let ye=0;const ve=new Set(ne.keys());for(const Te of ce.keys())ve.add(Te);for(const Te of ve){const xe=(ne.get(Te)||0)/se,ze=(ce.get(Te)||0)/he;ye+=Math.abs(xe-ze)}return ye/2}const it=10;function we(ne,se,ce){if(ce&&ce.numeric){const xe=u(ne,se),{n:ze,mean:Ye}=p(xe),$e=ze>0?Bt({mean:ce.mean,sd:ce.sd},Ye):null;return{measure:"standardizedMeanDifference",magnitude:$e,distance:$e===null?0:ht($e),direction:$e===null?0:Math.sign($e),subsetN:ze,populationN:ce.n||0,reliable:ze>=it}}const{map:ye,total:ve}=ct(ne,se),Te=bt(ye,ve,ce.map,ce.total);return{measure:"categoricalTotalVariation",magnitude:Te,distance:Te===null?0:Te,direction:0,subsetN:ve,populationN:ce.total||0,reliable:ve>=it}}function Le(ne,se){if(ne&&(ne.kind==="float64"||ne.kind==="int32"))return!0;const ce=q(ne);let he=0,ye=0;for(let ve=0;ve<se.length&&he<200;ve++){const Te=ce(se[ve]);if(Te==null||Te==="")continue;if(Te instanceof Date)return!1;he++;const xe=typeof Te=="number"?Te:Number(Te);Number.isFinite(xe)&&ye++}return he===0?!1:ye/he>=.9}function Re(ne,se){if(Le(ne,se)){const ye=u(ne,se),{n:ve,mean:Te,m2:xe}=p(ye);return{numeric:!0,mean:Te,sd:ve>0?Math.sqrt(xe/ve):0,n:ve}}const{map:ce,total:he}=ct(ne,se);return{numeric:!1,map:ce,total:he}}}),Ue("packages/core/src/compute/total.js",function(e,U){"use strict";Object.defineProperty(e,"TOTAL_FNS",{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,"TOTAL_LABELS",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"totalLabel",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"aggregatesFor",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"aggregateAllowed",{enumerable:!0,get:function(){return v}}),Object.defineProperty(e,"collectValues",{enumerable:!0,get:function(){return h}}),Object.defineProperty(e,"total",{enumerable:!0,get:function(){return p}});const E=U("packages/core/src/internal/predicates.js").isFunction,z=U("packages/core/src/internal/warn.js").warnOnce,_=U("packages/core/src/compute/handle.js"),Z=_.presenceReader,X=_.valueComparator,B=_.valueReader,Y=U("packages/core/src/compute/statistics.js"),G=Y.STAT_FNS,j=Y.STAT_LABELS;function k(b){return!!b&&(b.kind==="float64"||b.kind==="int32")}function g(b,O){const y=O.length;let L=0;if(k(b)){const D=b.values,F=Z(b);if(!F){for(let T=0;T<y;T++){const I=D[O[T]];Number.isNaN(I)||(L+=I)}return L}for(let T=0;T<y;T++){const I=O[T];if(F(I)===1){const P=D[I];Number.isNaN(P)||(L+=P)}}return L}const M=B(b);for(let D=0;D<y;D++){const F=u(M(O[D]));F!==null&&(L+=F)}return L}g.kernel=!0;function c(b,O){const y=O.length;let L=0;if(k(b)){const D=b.values,F=Z(b);if(!F){for(let T=0;T<y;T++)Number.isNaN(D[O[T]])||L++;return L}for(let T=0;T<y;T++){const I=O[T];F(I)===1&&!Number.isNaN(D[I])&&L++}return L}const M=B(b);for(let D=0;D<y;D++){const F=M(O[D]);F!=null&&!(typeof F=="number"&&Number.isNaN(F))&&L++}return L}c.kernel=!0;function d(b,O){return O.length}d.kernel=!0;function l(b,O){const y=c(b,O);return y===0?null:g(b,O)/y}l.kernel=!0;function i(b,O,y,L){const M=O.length;if(k(b)){const I=b.values,P=Z(b);let R=null;if(!P){for(let $=0;$<M;$++){const C=I[O[$]];Number.isNaN(C)||(R===null||(y<0?C<R:C>R))&&(R=C)}return R}for(let $=0;$<M;$++){const C=O[$];if(P(C)===0)continue;const A=I[C];Number.isNaN(A)||(R===null||(y<0?A<R:A>R))&&(R=A)}return R}const D=B(b),F=X(L);let T=null;for(let I=0;I<M;I++){const P=D(O[I]);P==null||typeof P=="number"&&Number.isNaN(P)||(T===null||(y<0?F(P,T)<0:F(P,T)>0))&&(T=P)}return T}function n(b,O,y){return i(b,O,-1,y&&y.locale)}n.kernel=!0;function a(b,O,y){return i(b,O,1,y&&y.locale)}a.kernel=!0;function s(b,O){return O.length===0?null:B(b)(O[0])}s.kernel=!0;function t(b,O){return O.length===0?null:B(b)(O[O.length-1])}t.kernel=!0;function u(b){if(typeof b=="number")return Number.isNaN(b)?null:b;if(b==null||b===""||typeof b=="boolean")return null;if(b instanceof Date)return b.getTime();const O=Number(b);return Number.isNaN(O)?null:O}const r={sum:g,min:n,max:a,avg:l,count:d,first:s,last:t,countValues:c,...G},o=Object.freeze({...j,sum:"Sum",avg:"Average",min:"Min",max:"Max",count:"Count",countValues:"Count of values",first:"First",last:"Last"});function f(b){return b?typeof b=="string"?o[b]||b:"Total":""}const w=Object.freeze(["sum","avg","min","max","count","countValues","first","last"]);function m(b){const O=b&&b.dataType&&b.dataType.totals&&b.dataType.totals.supported;if(Array.isArray(O))return O.slice();const y=w.filter(L=>L in r);for(const L of Object.keys(r))y.includes(L)||y.push(L);return y}function v(b,O){return typeof O!="string"?!0:m(b).includes(O)}function h(b,O){const y=B(b),L=[];for(let M=0;M<O.length;M++){const D=y(O[M]);D!=null&&L.push(D)}return L}function p(b,O,y,L){const M=O||[];if(typeof y=="string"){const D=r[y];return D?D(b,M,L):(z(`total:${y}`,`unknown total function "${y}"; register it in config.totalFns`),null)}return E(y)?y.kernel===!0?y(b,M,L):y(h(b,M),L||{}):null}}),Ue("packages/core/src/compute/windowed.js",function(e,U){"use strict";Object.defineProperty(e,"Window",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"WINDOW_KINDS",{enumerable:!0,get:function(){return z}}),Object.defineProperty(e,"openWindow",{enumerable:!0,get:function(){return _}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return Z}});const E=U("packages/core/src/compute/sketch.js").Welford;class q{#e;#t;#n=[];#r;#s;constructor(B,Y=0,G=Date.now){if(B!=="count"&&B!=="time"&&B!=="session")throw new RangeError(`unknown window kind: ${B}`);if((B==="count"||B==="time")&&!(Y>0))throw new RangeError(`a ${B} window needs a positive span`);this.#e=B,this.#t=Math.floor(Y),this.#r=G,this.#s=G()}get size(){return this.#n.length}push(B,Y=this.#r()){Number.isFinite(B)&&(this.#n.push({t:Y,v:B}),this.#i(Y))}#i(B){if(this.#e==="count")for(;this.#n.length>this.#t;)this.#n.shift();else if(this.#e==="time"){const Y=B-this.#t;for(;this.#n.length&&this.#n[0].t<Y;)this.#n.shift()}}spec(){const B=this.#e==="session"?this.#r()-this.#s:this.#t;return{kind:this.#e,span:B,size:this.#n.length}}values(){return this.#n.map(B=>B.v)}aggregate(){const B=this.spec();if(!this.#n.length)return{over:B,count:0,sum:null,mean:null,min:null,max:null,variance:null,stddev:null};const Y=new E;let G=0,j=1/0,k=-1/0;for(const{v:g}of this.#n)G+=g,g<j&&(j=g),g>k&&(k=g),Y.add(g);return{over:B,count:this.#n.length,sum:G,mean:Y.mean(),min:j,max:k,variance:Y.variance(),stddev:Y.stddev()}}reduce(B){const Y=this.aggregate(),G={sum:Y.sum,avg:Y.mean,mean:Y.mean,min:Y.min,max:Y.max,count:Y.count,variance:Y.variance,stddev:Y.stddev};if(!(B in G))throw new RangeError(`unknown windowed aggregate: ${B}`);return{value:G[B],over:Y.over}}}const z=Object.freeze(["count","time","session"]);function _(X,B=Date.now){const Y=X.kind==="time"&&X.minutes!=null?X.minutes*6e4:X.span??0;return new q(X.kind,Y,B)}const Z={Window:q,WINDOW_KINDS:z,openWindow:_}}),Ue("packages/core/src/compute/rolling.js",function(e,U){"use strict";Object.defineProperty(e,"ROLLING_WINDOW_FIELDS",{enumerable:!0,get:function(){return _}}),Object.defineProperty(e,"rollingWindow",{enumerable:!0,get:function(){return X}}),Object.defineProperty(e,"cumulativeToDate",{enumerable:!0,get:function(){return B}}),Object.defineProperty(e,"periodOverPeriod",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(e,"QUANTILE_SPAN_CAP",{enumerable:!0,get:function(){return G}}),Object.defineProperty(e,"rollingQuantile",{enumerable:!0,get:function(){return g}}),Object.defineProperty(e,"seasonalDecompose",{enumerable:!0,get:function(){return d}}),Object.defineProperty(e,"exponentialSmoothing",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return u}});const E=U("packages/core/src/compute/windowed.js").openWindow,z=U("packages/core/src/compute/sketch.js").KLL,_=Object.freeze({rollingSum:"sum",rollingAvg:"avg",rollingMin:"min",rollingMax:"max"});function Z(r,o,f,w){if(r.kind==="count"){const m=Math.max(1,Math.floor(r.span||0));return{coverage:Math.min(1,o/m),partial:o<m}}if(r.kind==="time"){const m=r.minutes!=null?r.minutes*6e4:r.span||0;if(!(m>0))return{coverage:1,partial:!1};const v=f-w;return{coverage:Math.min(1,v/m),partial:v<m}}return{coverage:null,partial:!1}}function X(r,o){const f=E(o),w=new Map,m=r.length?r[0].at:0;for(let v=0;v<r.length;v++){const{key:h,at:p,value:b}=r[v];Number.isFinite(b)&&f.push(b,p);const O=f.aggregate(),y=Z(o,O.count,p,m);h!=null&&w.set(String(h),{sum:O.sum,avg:O.mean,min:O.min,max:O.max,count:O.count,coverage:y.coverage,partial:y.partial})}return w}function B(r){const o=new Map;let f=0;for(const{key:w,value:m}of r)Number.isFinite(m)&&(f+=m),w!=null&&o.set(String(w),f);return o}function Y(r,o=1){const f=new Map,w=Math.max(1,Math.floor(o));for(let m=0;m<r.length;m++){const{key:v,value:h}=r[m];if(v==null)continue;const p=m>=w?r[m-w].value:null,b=Number.isFinite(h)?h:null,O=Number.isFinite(p)?p:null;f.set(String(v),b!==null&&O!==null?b-O:null)}return f}const G=4096;function j(r){let o=r>>>0;return()=>{o+=1831565813;let f=o;return f=Math.imul(f^f>>>15,f|1),f^=f+Math.imul(f^f>>>7,f|61),((f^f>>>14)>>>0)/4294967296}}function k(r,o){const f=r.length;if(f===1)return r[0];const w=(f-1)*o,m=Math.floor(w),v=Math.ceil(w);return m===v?r[m]:r[m]+(w-m)*(r[v]-r[m])}function g(r,o,f={}){const w=Math.min(1,Math.max(0,f.q==null?.5:f.q)),m=Math.max(1,Math.floor(f.cap==null?G:f.cap)),v=j(f.seed==null?2654435769:f.seed),h=new Map,p=r.length?r[0].at:0;if(o.kind==="session"){const O=new z(200,v);let y=0;for(const{key:L,value:M}of r)Number.isFinite(M)&&(O.add(M),y++),L!=null&&h.set(String(L),{value:y?O.quantile(w):null,approx:y>0,count:y,coverage:null,partial:!1});return h}const b=E(o);for(const{key:O,at:y,value:L}of r){Number.isFinite(L)&&b.push(L,y);const M=b.values(),D=M.length;let F=null,T=!1;if(D)if(D<=m)F=k([...M].sort((P,R)=>P-R),w);else{const P=new z(200,v);for(const R of M)P.add(R);F=P.quantile(w),T=!0}const I=Z(o,D,y,p);O!=null&&h.set(String(O),{value:F,approx:T,count:D,coverage:I.coverage,partial:I.partial})}return h}function c(r,o){const f=r.length,w=new Array(f).fill(null),m=Math.floor(o/2),v=o%2===0;for(let h=0;h<f;h++){if(h-m<0||h+m>=f)continue;let p=0,b=!0;if(v)for(let O=-m;O<=m;O++){const y=r[h+O];if(!Number.isFinite(y)){b=!1;break}p+=O===-m||O===m?y*.5:y}else for(let O=-m;O<=m;O++){const y=r[h+O];if(!Number.isFinite(y)){b=!1;break}p+=y}b&&(w[h]=p/o)}return w}function d(r,o){const f=new Map,w=Math.floor(Number(o&&o.period));if(!(w>=2))return f;const m=o&&o.model==="multiplicative",v=r.length,h=r.map(T=>Number.isFinite(T.value)?T.value:null),p=c(h,w),b=new Array(v).fill(null);for(let T=0;T<v;T++){const I=p[T],P=h[T];I===null||P===null||(m?I!==0&&(b[T]=P/I):b[T]=P-I)}const O=new Array(w).fill(0),y=new Array(w).fill(0);for(let T=0;T<v;T++){if(b[T]===null)continue;const I=T%w;O[I]+=b[T],y[I]+=1}const L=m?1:0,M=O.map((T,I)=>y[I]?T/y[I]:L),D=M.reduce((T,I)=>T+I,0)/w,F=m?M.map(T=>D!==0?T/D:1):M.map(T=>T-D);for(let T=0;T<v;T++){const{key:I}=r[T];if(I==null)continue;const P=p[T],R=F[T%w],$=h[T];let C=null;P!==null&&$!==null&&(C=m?P*R!==0?$/(P*R):null:$-P-R),f.set(String(I),{trend:P,seasonal:$===null?null:R,residual:C,coverage:P===null?0:1,partial:P===null})}return f}function l(r,o,f,w=80){const m=(Math.sqrt(5)-1)/2;let v=o,h=f,p=h-m*(h-v),b=v+m*(h-v),O=r(p),y=r(b);for(let L=0;L<w;L++)O<y?(h=b,b=p,y=O,p=h-m*(h-v),O=r(p)):(v=p,p=b,O=y,b=v+m*(h-v),y=r(b));return(v+h)/2}const i=1e-4,n=1-1e-4;function a(r,o){const f=r.length,w=new Array(f).fill(null),m=new Array(f).fill(null);let v=null,h=0;for(let p=0;p<f;p++){const b=r[p];if(!Number.isFinite(b)){v!==null&&(m[p]=v,w[p]=v);continue}if(v===null){v=b,m[p]=b,w[p]=b;continue}m[p]=v,h+=(b-v)**2,v=o*b+(1-o)*v,w[p]=v}return{smoothed:w,fitted:m,sse:h}}function s(r,o,f){const w=r.length,m=new Array(w).fill(null),v=new Array(w).fill(null);let h=null,p=null,b=0;for(let O=0;O<w;O++){const y=r[O];if(!Number.isFinite(y)){h!==null&&(h+=p,m[O]=h);continue}if(h===null){h=y,m[O]=y;continue}if(p===null){p=y-h;const D=h+p;v[O]=D,b+=(y-D)**2;const F=h;h=o*y+(1-o)*(F+p),p=f*(h-F)+(1-f)*p,m[O]=h;continue}const L=h+p;v[O]=L,b+=(y-L)**2;const M=h;h=o*y+(1-o)*(M+p),p=f*(h-M)+(1-f)*p,m[O]=h}return{smoothed:m,fitted:v,sse:b}}function t(r,o={}){const f=new Map,w=o.method==="holt",m=r.map(L=>Number.isFinite(L.value)?L.value:null),v=m.filter(L=>L!==null).length,h=L=>Math.min(n,Math.max(i,L)),p=()=>{for(const{key:L}of r)L!=null&&f.set(String(L),{smoothed:null,fitted:null,alpha:null,beta:null,sse:null});return f};if(v<(w?2:1))return p();let b=Number.isFinite(o.alpha)?h(o.alpha):null,O=w&&Number.isFinite(o.beta)?h(o.beta):null;if(w){if(b===null||O===null){let L=b===null?.5:b,M=O===null?.5:O;for(let D=0;D<6;D++)b===null&&(L=l(F=>s(m,F,M).sse,i,n)),O===null&&(M=l(F=>s(m,L,F).sse,i,n));b=b===null?L:b,O=O===null?M:O}}else b===null&&(b=l(L=>a(m,L).sse,i,n));const y=w?s(m,b,O):a(m,b);for(let L=0;L<r.length;L++){const{key:M}=r[L];M!=null&&f.set(String(M),{smoothed:y.smoothed[L],fitted:y.fitted[L],alpha:b,beta:w?O:null,sse:y.sse})}return f}const u={ROLLING_WINDOW_FIELDS:_,QUANTILE_SPAN_CAP:G,rollingWindow:X,rollingQuantile:g,cumulativeToDate:B,periodOverPeriod:Y,seasonalDecompose:d,exponentialSmoothing:t}}),Ue("packages/core/src/compute/compare.js",function(e,U){"use strict";Object.defineProperty(e,"COMPARE_MEASURES",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(e,"pooledStandardMeanDifference",{enumerable:!0,get:function(){return G}}),Object.defineProperty(e,"numericSummary",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"bothNumeric",{enumerable:!0,get:function(){return k}}),Object.defineProperty(e,"compareColumnAcross",{enumerable:!0,get:function(){return g}}),Object.defineProperty(e,"compareDatasets",{enumerable:!0,get:function(){return c}});const te=U("packages/core/src/compute/statistics.js"),E=te.numbers,q=te.moments,z=te.frequencyMap,_=te.categoricalDistance,Z=te.normalTotalVariation,X=te.isNumericColumn,B=te.SUBSET_RELIABILITY_FLOOR,Y=Object.freeze({numeric:"pooledStandardMeanDifference",categorical:"categoricalTotalVariation",common:"totalVariationDistance"});function G(d,l){if(!d||!l||!(d.n>0)||!(l.n>0)||!Number.isFinite(d.mean)||!Number.isFinite(l.mean))return null;const i=(d.n*d.sd*d.sd+l.n*l.sd*l.sd)/(d.n+l.n);return i>0?(d.mean-l.mean)/Math.sqrt(i):null}function j(d,l){const i=E(d,l),{n,mean:a,m2:s}=q(i),t=n>0?Math.sqrt(s/n):0;return{mean:a,sd:t,n}}function k(d,l,i,n){return X(d,l)&&X(i,n)}function g(d,l,i,n){if(k(d,l,i,n)){const u=j(d,l),r=j(i,n),o=G(u,r);return{measure:Y.numeric,magnitude:o,distance:o===null?0:Z(o),direction:o===null?0:Math.sign(o),nA:u.n,nB:r.n,reliable:u.n>=B&&r.n>=B}}const a=z(d,l),s=z(i,n),t=_(a.map,a.total,s.map,s.total);return{measure:Y.categorical,magnitude:t,distance:t===null?0:t,direction:0,nA:a.total,nB:s.total,reliable:a.total>=B&&s.total>=B}}function c(d,l,i={}){const n=new Set(d.columns),a=new Set(l.columns),s=d.columns.filter(f=>a.has(f)),t=Array.isArray(i.columns)&&i.columns.length?s.filter(f=>i.columns.includes(f)):s,u=d.indices(),r=l.indices(),o=[];for(const f of t){const w=d.handle(f),m=l.handle(f);if(!w||!m)continue;const v=g(w,u,m,r);o.push({column:f,name:d.name&&d.name(f)||l.name&&l.name(f)||f,measure:v.measure,magnitude:v.magnitude,distance:v.distance,direction:v.direction,nA:v.nA,nB:v.nB,reliable:v.reliable})}return o.sort((f,w)=>w.distance-f.distance||Math.abs(w.magnitude||0)-Math.abs(f.magnitude||0)),{ranked:o,nA:u.length,nB:r.length,unmatched:{onlyA:d.columns.filter(f=>!a.has(f)),onlyB:l.columns.filter(f=>!n.has(f))},measures:Y}}}),Ue("packages/core/src/compute/anomaly.js",function(e,U){"use strict";Object.defineProperty(e,"MAD_SCALE",{enumerable:!0,get:function(){return _}}),Object.defineProperty(e,"DEFAULT_MODIFIED_Z_THRESHOLD",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"DEFAULT_IQR_K",{enumerable:!0,get:function(){return X}}),Object.defineProperty(e,"DEFAULT_CHI_SQUARE_P",{enumerable:!0,get:function(){return B}}),Object.defineProperty(e,"ANOMALY_METHODS",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(e,"robustSpread",{enumerable:!0,get:function(){return G}}),Object.defineProperty(e,"modifiedZScores",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"iqrFences",{enumerable:!0,get:function(){return k}}),Object.defineProperty(e,"chiSquareCdf",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"chiSquareQuantile",{enumerable:!0,get:function(){return d}}),Object.defineProperty(e,"mahalanobis",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"DEFAULT_ROLLING_WINDOW",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"ROLLING_ANOMALY_METHODS",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"rollingAnomalies",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"anomalyCondition",{enumerable:!0,get:function(){return u}});const E=U("packages/core/src/compute/statistics.js").quantileSorted,z=U("packages/core/src/compute/special.js").logGamma,_=.6745,Z=3.5,X=1.5,B=.975,Y=Object.freeze(["modifiedZScore","iqr","mahalanobis"]);function G(r){if(!r.length)return null;const f=Array.from(r,Number).sort((h,p)=>h-p),w=E(f,.5),m=f.map(h=>Math.abs(h-w)).sort((h,p)=>h-p),v=E(m,.5);return{median:w,mad:v}}function j(r,o={}){const f=Number.isFinite(o.threshold)?o.threshold:Z,w=r.length,m=new Array(w).fill(null),v=new Array(w).fill(!1),h=[];for(let O=0;O<w;O++){const y=Number(r[O]);Number.isFinite(y)&&h.push(y)}if(!h.length)return{median:null,mad:null,threshold:f,scores:m,flags:v,flagged:0};const p=G(h);if(p.mad===0)return{median:p.median,mad:0,threshold:f,scores:m,flags:v,flagged:0};let b=0;for(let O=0;O<w;O++){const y=Number(r[O]);if(!Number.isFinite(y))continue;const L=_*(y-p.median)/p.mad;m[O]=L,Math.abs(L)>f&&(v[O]=!0,b++)}return{median:p.median,mad:p.mad,threshold:f,scores:m,flags:v,flagged:b}}function k(r,o={}){const f=Number.isFinite(o.k)?o.k:X,w=[];for(let b=0;b<r.length;b++){const O=Number(r[b]);Number.isFinite(O)&&w.push(O)}if(!w.length)return null;const m=w.sort((b,O)=>b-O),v=E(m,.25),h=E(m,.75),p=h-v;return{q1:v,q3:h,iqr:p,lower:v-f*p,upper:h+f*p,k:f}}function g(r,o){if(o<=0)return 0;const f=z(r);if(o<r+1){let O=r,y=1/r,L=y;for(let M=0;M<1e3&&(O+=1,L*=o/O,y+=L,!(Math.abs(L)<Math.abs(y)*1e-15));M++);return y*Math.exp(-o+r*Math.log(o)-f)}const w=1e-300;let m=o+1-r,v=1/w,h=1/m,p=h;for(let O=1;O<1e3;O++){const y=-O*(O-r);m+=2,h=y*h+m,Math.abs(h)<w&&(h=w),v=m+y/v,Math.abs(v)<w&&(v=w),h=1/h;const L=h*v;if(p*=L,Math.abs(L-1)<1e-15)break}return 1-Math.exp(-o+r*Math.log(o)-f)*p}function c(r,o){return r<=0?0:g(o/2,r/2)}function d(r,o=B){if(!(o>0)||!(o<1))return NaN;let f=0,w=Math.max(1,r);for(;c(w,r)<o;)w*=2;for(let m=0;m<200;m++){const v=(f+w)/2;if(c(v,r)<o?f=v:w=v,w-f<1e-10)break}return(f+w)/2}function l(r){const o=r.length,f=r.map((w,m)=>{const v=w.slice();for(let h=0;h<o;h++)v.push(m===h?1:0);return v});for(let w=0;w<o;w++){let m=w;for(let h=w+1;h<o;h++)Math.abs(f[h][w])>Math.abs(f[m][w])&&(m=h);if(Math.abs(f[m][w])<1e-12)return null;if(m!==w){const h=f[m];f[m]=f[w],f[w]=h}const v=f[w][w];for(let h=0;h<2*o;h++)f[w][h]/=v;for(let h=0;h<o;h++){if(h===w)continue;const p=f[h][w];if(p!==0)for(let b=0;b<2*o;b++)f[h][b]-=p*f[w][b]}}return f.map(w=>w.slice(o))}function i(r,o){const f=r.length,w=new Array(o).fill(0);for(const h of r)for(let p=0;p<o;p++)w[p]+=h[p];for(let h=0;h<o;h++)w[h]/=f;const m=Array.from({length:o},()=>new Array(o).fill(0));for(const h of r)for(let p=0;p<o;p++){const b=h[p]-w[p];for(let O=p;O<o;O++)m[p][O]+=b*(h[O]-w[O])}const v=f>1?f-1:1;for(let h=0;h<o;h++)for(let p=h;p<o;p++)m[h][p]/=v,m[p][h]=m[h][p];return{mean:w,cov:m}}function n(r,o={}){const f=Number.isFinite(o.p)?o.p:B,w=Number.isFinite(o.ridge)?o.ridge:1e-6,m=r.length;if(!m)return null;const v=r[0].length;if(!v)return null;const h=new Array(m).fill(null),p=new Array(m).fill(null),b=new Array(m).fill(!1),O=[],y=[];for(let R=0;R<m;R++){const $=r[R];let C=$.length===v;const A=new Array(v);for(let S=0;C&&S<v;S++){const x=Number($[S]);Number.isFinite(x)?A[S]=x:C=!1}C&&(O.push(R),y.push(A))}const L=v,M=d(L,f);if(y.length<=v)return{center:[],df:L,cutoff:M,singular:!0,used:y.length,distances:h,squared:p,flags:b,flagged:0};const{mean:D,cov:F}=i(y,v);let T=l(F),I=!1;if(!T){I=!0;let R=0;for(let A=0;A<v;A++)R+=F[A][A];const $=R/v*w||w,C=F.map((A,S)=>A.map((x,H)=>S===H?x+$:x));if(T=l(C),!T)return{center:D,df:L,cutoff:M,singular:!0,used:y.length,distances:h,squared:p,flags:b,flagged:0}}let P=0;for(let R=0;R<y.length;R++){const $=y[R],C=new Array(v);for(let x=0;x<v;x++)C[x]=$[x]-D[x];let A=0;for(let x=0;x<v;x++){let H=0;for(let V=0;V<v;V++)H+=T[x][V]*C[V];A+=C[x]*H}A<0&&(A=0);const S=O[R];p[S]=A,h[S]=Math.sqrt(A),A>M&&(b[S]=!0,P++)}return{center:D,df:L,cutoff:M,singular:I,used:y.length,distances:h,squared:p,flags:b,flagged:P}}const a=20,s=Object.freeze(["rollingModifiedZScore","rollingIqr"]);function t(r,o={}){const f=o.method==="rollingIqr"?"rollingIqr":"rollingModifiedZScore",w=Number.isFinite(o.windowLen)&&o.windowLen>=1?Math.floor(o.windowLen):a,m=Number.isFinite(o.threshold)?o.threshold:Z,v=Number.isFinite(o.k)?o.k:X,h=Number.isFinite(o.minPeriods)&&o.minPeriods>=1?Math.floor(o.minPeriods):w,p=r.length,b=new Array(p).fill(null),O=new Array(p).fill(!1);let y=0;for(let L=0;L<p;L++){const M=Number(r[L]);if(!Number.isFinite(M))continue;const D=Math.max(0,L-w+1),F=[];for(let T=D;T<=L;T++){const I=Number(r[T]);Number.isFinite(I)&&F.push(I)}if(!(F.length<h))if(f==="rollingIqr"){const T=k(F,{k:v});if(!T)continue;(M<T.lower||M>T.upper)&&(O[L]=!0,y++)}else{const T=G(F);if(!T||T.mad===0)continue;const I=_*(M-T.median)/T.mad;b[L]=I,Math.abs(I)>m&&(O[L]=!0,y++)}}return{method:f,windowLen:w,minPeriods:h,threshold:m,k:v,scores:b,flags:O,flagged:y}}function u(r={}){const o=r||{},f=o.field;if(typeof f!="string"||!f)throw new TypeError("[lattice] anomalyCondition: a string `field` naming the numeric property to monitor is required");const w=o.method||"modifiedZScore";if(!(Y.includes(w)||s.includes(w))||w==="mahalanobis")throw new RangeError(`[lattice] anomalyCondition: unknown or unsupported method '${w}'`);const v=typeof o.orderBy=="string"?o.orderBy:null,h=o.latest===!0,p=s.includes(w),b=O=>Number(O==null?NaN:O[f]);return O=>{const y=Array.isArray(O)?O.slice():[...O];v&&y.sort((T,I)=>{const P=T?.[v],R=I?.[v];return P===R?0:P==null?-1:R==null?1:P<R?-1:1});const L=y.map(b);let M,D;if(p)({flags:M,scores:D}=t(L,{method:w,windowLen:o.windowLen,threshold:o.threshold,k:o.k,minPeriods:o.minPeriods}));else if(w==="iqr"){const T=k(L,{k:o.k});M=L.map(I=>T?Number.isFinite(I)&&(I<T.lower||I>T.upper):!1),D=L.map(()=>null)}else({flags:M,scores:D}=j(L,{threshold:o.threshold}));if(h){const T=M.length-1;return T<0||!M[T]?!1:{method:w,field:f,flagged:[{row:y[T],score:D[T]}]}}const F=[];for(let T=0;T<M.length;T++)M[T]&&F.push({row:y[T],score:D[T]});return F.length?{method:w,field:f,flagged:F}:!1}}}),Ue("packages/core/src/compute/forecast.js",function(e,U){"use strict";Object.defineProperty(e,"FORECAST_METHODS",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"forecast",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return r}});const te=U("packages/core/src/compute/special.js"),E=te.normalQuantile,q=te.studentTQuantile,_=U("packages/core/src/internal/warn.js").warnOnce,Z=Object.freeze(["movingAverage","ses","holt","holtWinters","linear"]),X=1e-4,B=1-1e-4;function Y(o){const f=[];for(let w=0;w<o.length;w++){const m=o[w];if(m!==null&&typeof m=="object"){const v=Number.isFinite(m.at)?m.at:w,h=Number.isFinite(m.value)?m.value:null;f.push({at:v,value:h})}else f.push({at:w,value:Number.isFinite(m)?Number(m):null})}return f}function G(o){const f=o.filter(p=>p.value!==null),w=f[0],m=f[f.length-1],v=m.at-w.at,h=f.length>1&&v>0?v/(f.length-1):1;return{lastAt:m.at,step:h}}function j(o){return Math.min(B,Math.max(X,o))}function k(o,f=X,w=B,m=80){const v=(Math.sqrt(5)-1)/2;let h=f,p=w,b=p-v*(p-h),O=h+v*(p-h),y=o(b),L=o(O);for(let M=0;M<m;M++)y<L?(p=O,O=b,L=y,b=p-v*(p-h),y=o(b)):(h=b,b=O,y=L,O=h+v*(p-h),L=o(O));return(h+p)/2}function g(o,f){let w=null,m=0,v=0;for(let h=0;h<o.length;h++){const p=o[h];if(p!==null){if(w===null){w=p;continue}m+=(p-w)**2,v+=1,w=f*p+(1-f)*w}}return{level:w,sse:m,m:v}}function c(o,f,w){let m=null,v=null,h=0,p=0;for(let b=0;b<o.length;b++){const O=o[b];if(O===null){m!==null&&v!==null&&(m+=v);continue}if(m===null){m=O;continue}v===null&&(v=O-m);const y=m+v;h+=(O-y)**2,p+=1;const L=m;m=f*O+(1-f)*(L+v),v=w*(m-L)+(1-w)*v}return{level:m,trend:v,sse:h,m:p}}function d(o,f,w,m,v){const h=o.length;if(h<2*f)return null;const p=I=>{let P=0,R=0;for(let $=I;$<I+f&&$<h;$++)o[$]!==null&&(P+=o[$],R+=1);return R?P/R:null},b=p(0),O=p(f);if(b===null||O===null)return null;let y=b,L=(O-b)/f;const M=new Array(f).fill(0);for(let I=0;I<f;I++)M[I]=o[I]===null?0:o[I]-y;const D=M.reduce((I,P)=>I+P,0)/f;for(let I=0;I<f;I++)M[I]-=D;let F=0,T=0;for(let I=f;I<h;I++){const P=I%f,R=M[P],$=o[I];if($===null){y+=L;continue}const C=y+L+R;F+=($-C)**2,T+=1;const A=y;y=w*($-R)+(1-w)*(y+L),L=m*(y-A)+(1-m)*L,M[P]=v*($-y)+(1-v)*R}return{level:y,trend:L,season:M,phase:(h-1)%f,sse:F,count:T}}function l(o,f,w){let m=1;for(const h of f)m+=h*h;const v=Math.sqrt(o*m);return{se:v,margin:w*v}}function i(o,f={}){if(!o||typeof o.length!="number"||o.length===0)return null;const w=Z.includes(f.method)?f.method:"linear",m=Math.max(1,Math.floor(Number(f.horizon)||1)),v=Number.isFinite(f.confidence)&&f.confidence>0&&f.confidence<1?f.confidence:.95,h=1-(1-v)/2,p=Y(o),b=p.map(F=>F.value),O=b.filter(F=>F!==null),y=O.length,{lastAt:L,step:M}=y?G(p):{lastAt:0,step:1},D=F=>L+F*M;return w==="linear"?n(p,y,m,v,h,D):w==="movingAverage"?a(O,y,m,v,h,f,D):w==="ses"?s(b,y,m,v,h,f,D):w==="holt"?t(b,y,m,v,h,f,D):u(b,y,m,v,h,f,D)}function n(o,f,w,m,v,h){if(f<2)return null;let p=0,b=0;for(const $ of o)$.value!==null&&(p+=$.at,b+=$.value);p/=f,b/=f;let O=0,y=0,L=0;for(const $ of o){if($.value===null)continue;const C=$.at-p,A=$.value-b;O+=C*C,y+=C*A,L+=A*A}if(O===0)return null;const M=y/O,D=b-M*p,F=L===0?1:Math.max(0,Math.min(1,y*y/(O*L))),T=Math.max(0,L-M*y),I=f>2?Math.sqrt(T/(f-2)):null,P=f>2?q(v,f-2):null,R=[];for(let $=1;$<=w;$++){const C=h($),A=D+M*C;let S=null,x=null,H=null,V=null,W=null;if(I!==null){const Q=1/f+(C-p)**2/O,ee=I*Math.sqrt(1+Q),re=I*Math.sqrt(Q);W=ee,S=A-P*ee,x=A+P*ee,H=A-P*re,V=A+P*re}R.push({step:$,at:C,mean:A,lower:S,upper:x,lowerMean:H,upperMean:V,se:W})}return{method:"linear",horizon:w,confidence:m,n:f,sigma:I,r2:F,params:{slope:M,intercept:D},points:R}}function a(o,f,w,m,v,h,p){if(f<1)return null;const b=Math.max(1,Math.min(f,Math.floor(Number(h.windowLen)||f))),O=o.slice(f-b);let y=0;for(const I of O)y+=I;const L=y/b;let M=null,D=null;if(b>1){let I=0;for(const R of O)I+=(R-L)**2;M=Math.sqrt(I/(b-1))*Math.sqrt(1+1/b),D=q(v,b-1)}const F=M===null?null:D*M,T=[];for(let I=1;I<=w;I++)T.push({step:I,at:p(I),mean:L,lower:F===null?null:L-F,upper:F===null?null:L+F,se:M});return{method:"movingAverage",horizon:w,confidence:m,n:f,sigma:M===null?null:M,params:{windowLen:b},points:T}}function s(o,f,w,m,v,h,p){if(f<1)return null;let b=Number.isFinite(h.alpha)?j(h.alpha):null;b===null&&(b=k(D=>g(o,D).sse));const O=g(o,b),y=E(v),L=O.m>0?O.sse/O.m:null,M=[];for(let D=1;D<=w;D++){const F=O.level;let T=null,I=null,P=null;if(L!==null){const R=[];for(let C=1;C<D;C++)R.push(b);const $=l(L,R,y);P=$.se,T=F-$.margin,I=F+$.margin}M.push({step:D,at:p(D),mean:F,lower:T,upper:I,se:P})}return{method:"ses",horizon:w,confidence:m,n:f,sigma:L===null?null:Math.sqrt(L),params:{alpha:b},points:M}}function t(o,f,w,m,v,h,p){if(f<2)return null;let b=Number.isFinite(h.alpha)?j(h.alpha):null,O=Number.isFinite(h.beta)?j(h.beta):null;if(b===null||O===null){let T=b===null?.5:b,I=O===null?.5:O;for(let P=0;P<6;P++)b===null&&(T=k(R=>c(o,R,I).sse)),O===null&&(I=k(R=>c(o,T,R).sse));b=b===null?T:b,O=O===null?I:O}const y=c(o,b,O),L=E(v),M=y.m>0?y.sse/y.m:null,D=b*O,F=[];for(let T=1;T<=w;T++){const I=y.level+T*y.trend;let P=null,R=null,$=null;if(M!==null){const C=[];for(let S=1;S<T;S++)C.push(b+S*D);const A=l(M,C,L);$=A.se,P=I-A.margin,R=I+A.margin}F.push({step:T,at:p(T),mean:I,lower:P,upper:R,se:$})}return{method:"holt",horizon:w,confidence:m,n:f,sigma:M===null?null:Math.sqrt(M),params:{alpha:b,beta:O},points:F}}function u(o,f,w,m,v,h,p){const b=Math.floor(Number(h.period));if(!(b>=2))return _("forecast.holtWinters.period","forecast: holtWinters needs a period (opts.period >= 2)"),null;if(f<2*b)return null;let O=Number.isFinite(h.alpha)?j(h.alpha):null,y=Number.isFinite(h.beta)?j(h.beta):null,L=Number.isFinite(h.gamma)?j(h.gamma):null;const M=($,C,A)=>{const S=d(o,b,$,C,A);return S?S.sse:1/0};if(O===null||y===null||L===null){let $=O===null?.5:O,C=y===null?.5:y,A=L===null?.5:L;for(let S=0;S<8;S++)O===null&&($=k(x=>M(x,C,A))),y===null&&(C=k(x=>M($,x,A))),L===null&&(A=k(x=>M($,C,x)));O=O===null?$:O,y=y===null?C:y,L=L===null?A:L}const D=d(o,b,O,y,L);if(!D)return null;const F=E(v),T=D.count>0?D.sse/D.count:null,I=O*y,P=L*(1-O),R=[];for(let $=1;$<=w;$++){const C=D.season[(D.phase+$)%b],A=D.level+$*D.trend+C;let S=null,x=null,H=null;if(T!==null){const V=[];for(let Q=1;Q<$;Q++)V.push(O+Q*I+(Q%b===0?P:0));const W=l(T,V,F);H=W.se,S=A-W.margin,x=A+W.margin}R.push({step:$,at:p($),mean:A,lower:S,upper:x,se:H})}return{method:"holtWinters",horizon:w,confidence:m,n:f,sigma:T===null?null:Math.sqrt(T),params:{alpha:O,beta:y,gamma:L,period:b},points:R}}const r={FORECAST_METHODS:Z,forecast:i}}),Ue("packages/core/src/compute/hypothesis.js",function(e,U){"use strict";Object.defineProperty(e,"GROUP_TESTS",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"NORMALITY_ALPHA",{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,"HL_PAIR_LIMIT",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"welchTTest",{enumerable:!0,get:function(){return h}}),Object.defineProperty(e,"mannWhitneyUTest",{enumerable:!0,get:function(){return O}}),Object.defineProperty(e,"chiSquareTest",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"compareGroups",{enumerable:!0,get:function(){return F}});const E=U("packages/core/src/internal/warn.js").warnOnce,z=U("packages/core/src/compute/handle.js").valueReader,_=U("packages/core/src/compute/statistics.js"),Z=_.numbers,X=_.moments,B=_.frequencyMap,Y=_.categoricalDistance,G=_.isNumericColumn,j=_.jarqueBera,k=_.proportionInterval,g=_.SUBSET_RELIABILITY_FLOOR,d=U("packages/core/src/compute/compare.js").pooledStandardMeanDifference,l=U("packages/core/src/compute/special.js"),i=l.studentT,n=l.studentTQuantile,a=l.normalCdf,s=l.normalQuantile,t=l.chiSquareUpperTail,u=Object.freeze({WELCH:"welch",MANN_WHITNEY:"mannWhitney",CHI_SQUARE:"chiSquare"}),r=.05,o=2e6;function f(T){const I=Number(T);return Number.isFinite(I)&&I>0&&I<1?I:.95}function w(T){const{n:I,mean:P,m2:R}=X(T);return{mean:P,sd:I>0?Math.sqrt(R/I):0,n:I}}function m(T,I){const P=T.length;if(P<2)return 0;let R=0;for(let $=0;$<P;$++){const C=T[$]-I;R+=C*C}return R/(P-1)}function v(T,I){return{name:"pooledStandardMeanDifference",value:d(w(T),w(I))}}function h(T,I,P){const R=T.length,$=I.length;if(R<2||$<2)return null;const C=f(P),{mean:A}=X(T),{mean:S}=X(I),x=m(T,A),H=m(I,S),V=x/R+H/$;if(!(V>0))return null;const W=Math.sqrt(V),Q=(A-S)/W,ee=x/R*(x/R)/(R-1),re=H/$*(H/$)/($-1),ae=V*V/(ee+re),ue=Math.min(1,Math.max(0,2*(1-i(Math.abs(Q),ae)))),ge=A-S,Ae=n(1-(1-C)/2,ae)*W;return{test:u.WELCH,statistic:Q,statisticName:"t",df:ae,pValue:ue,interval:{estimate:ge,lower:ge-Ae,upper:ge+Ae,confidence:C,method:"welch-t (difference of means)"},effectSize:v(T,I),nA:R,nB:$,reliable:R>=g&&$>=g,method:"Welch's t-test (unequal variances; Welch–Satterthwaite df)"}}function p(T){const I=T.length;if(I===0)return Number.NaN;const P=I>>1;return I%2?T[P]:(T[P-1]+T[P])/2}function b(T,I,P){const R=T.length,$=I.length,C=R*$;if(C===0||C>o)return null;const A=new Float64Array(C);let S=0;for(let ee=0;ee<R;ee++)for(let re=0;re<$;re++)A[S++]=T[ee]-I[re];A.sort();const x=p(A),H=Math.sqrt(R*$*(R+$+1)/12),V=s(1-(1-P)/2);let W=Math.round(C/2-V*H);W>=0||(W=0);const Q=Math.floor((C-1)/2);return W>Q&&(W=Q),{estimate:x,lower:A[W],upper:A[C-1-W],confidence:P,method:"hodges-lehmann (normal approximation)"}}function O(T,I,P){const R=T.length,$=I.length;if(R<1||$<1)return null;const C=f(P),A=R+$,S=new Array(A);for(let ue=0;ue<R;ue++)S[ue]={v:T[ue],g:0};for(let ue=0;ue<$;ue++)S[R+ue]={v:I[ue],g:1};S.sort((ue,ge)=>ue.v-ge.v);let x=0,H=0,V=0;for(;V<A;){let ue=V;for(;ue<A&&S[ue].v===S[V].v;)ue++;const ge=ue-V,Ae=(V+1+ue)/2;for(let pe=V;pe<ue;pe++)S[pe].g===0&&(x+=Ae);H+=ge*ge*ge-ge,V=ue}const W=x-R*(R+1)/2,Q=R*$/2,ee=R*$/12*(A+1-H/(A*(A-1)));let re=1;if(ee>0){const ue=Math.max(0,Math.abs(W-Q)-.5);re=Math.min(1,2*a(-ue/Math.sqrt(ee)))}const ae=b(T,I,C);return{test:u.MANN_WHITNEY,statistic:W,statisticName:"U",df:null,pValue:re,interval:ae,effectSize:v(T,I),nA:R,nB:$,reliable:R>=g&&$>=g,method:"Mann-Whitney U (normal approximation, tie- and continuity-corrected)"}}function y(T,I,P,R,$){const C=k(T,I,$),A=k(P,R,$);if(!C||!A)return null;const S=C.proportion-A.proportion,x=S-Math.sqrt((C.proportion-C.lower)**2+(A.upper-A.proportion)**2),H=S+Math.sqrt((C.upper-C.proportion)**2+(A.proportion-A.lower)**2);return{lower:x,upper:H}}function L(T,I,P,R,$,C={}){if(!(I>0)||!(R>0))return null;const A=new Set([...T.keys(),...P.keys()]),S=A.size;if(S<2)return null;const x=I+R;let H=0;for(const re of A){const ae=T.get(re)||0,ue=P.get(re)||0,ge=ae+ue,Ae=I*ge/x,pe=R*ge/x;Ae>0&&(H+=(ae-Ae)*(ae-Ae)/Ae),pe>0&&(H+=(ue-pe)*(ue-pe)/pe)}const V=S-1,W=t(H,V);let Q=null;C.category!==void 0&&A.has(C.category)?Q=C.category:S===2&&([Q]=[...A]);let ee=null;if(Q!==null){const re=y(T.get(Q)||0,I,P.get(Q)||0,R,f($));re&&(ee={estimate:(T.get(Q)||0)/I-(P.get(Q)||0)/R,lower:re.lower,upper:re.upper,confidence:f($),method:"newcombe (difference in this category's share)",category:Q})}return{test:u.CHI_SQUARE,statistic:H,statisticName:"chiSquare",df:V,pValue:W,interval:ee,effectSize:{name:"categoricalTotalVariation",value:Y(T,I,P,R)},nA:I,nB:R,reliable:I>=g&&R>=g,method:"Pearson chi-square test of independence (2×k, no continuity correction)"}}function M(T){return T==null||T===""||typeof T=="number"&&Number.isNaN(T)?null:T instanceof Date?T.getTime():typeof T=="object"?String(T):T}function D(T,I,P){if(P===u.WELCH||P===u.MANN_WHITNEY)return{test:P,chosenBy:"override",reason:`caller override: ${P}`};const R=j(T),$=j(I),C=R===null?null:Math.exp(-R/2),A=$===null?null:Math.exp(-$/2);return C!==null&&C<r||A!==null&&A<r?{test:u.MANN_WHITNEY,chosenBy:"auto",reason:`column family: numeric, non-normal by Jarque-Bera (p < ${r})`}:{test:u.WELCH,chosenBy:"auto",reason:C!==null||A!==null?"column family: numeric, no departure from normality detected":"column family: numeric (too few rows to screen normality)"}}function F(T,I,P,R={}){if(!T||!I)return null;const $=f(R.confidence),C=z(I);let A;if(Array.isArray(R.groups)&&R.groups.length===2)A=[M(R.groups[0]),M(R.groups[1])];else{const{map:ue}=B(I,P),ge=[...ue.entries()].sort((Ae,pe)=>pe[1]-Ae[1]).slice(0,2).map(Ae=>Ae[0]);if(ge.length<2)return E("compareGroups:groups",'[lattice] compareGroups: the "by" column has fewer than two distinct values to group by.'),null;A=ge}const[S,x]=A;if(S===null||x===null||S===x)return E("compareGroups:distinct","[lattice] compareGroups: the two groups must be two distinct, present values."),null;const H=[],V=[];for(let ue=0;ue<P.length;ue++){const ge=M(C(P[ue]));ge===S?H.push(P[ue]):ge===x&&V.push(P[ue])}if(H.length===0||V.length===0)return E("compareGroups:empty","[lattice] compareGroups: one of the two groups has no rows in the current set."),null;const W=R.test&&R.test!=="auto"?String(R.test):null,Q=G(T,H.concat(V));let ee,re,ae;if(W===u.CHI_SQUARE||!W&&!Q){re=W?"override":"auto",ae=W?"caller override: chiSquare":"column family: categorical";const ue=B(T,H),ge=B(T,V);ee=L(ue.map,ue.total,ge.map,ge.total,$,{category:R.category})}else{if((W===u.WELCH||W===u.MANN_WHITNEY)&&!Q)return E("compareGroups:numeric-override",`[lattice] compareGroups: ${W} needs a numeric column, but the column is not numeric.`),null;const ue=Z(T,H),ge=Z(T,V),Ae=D(ue,ge,W);re=Ae.chosenBy,ae=Ae.reason,ee=Ae.test===u.MANN_WHITNEY?O(ue,ge,$):h(ue,ge,$)}return ee?{...ee,chosenBy:re,reason:ae,groups:[S,x]}:(E("compareGroups:degenerate","[lattice] compareGroups: the chosen test had too little to work with (too few values, or no variation)."),null)}}),Ue("packages/core/src/columns/detailcolumn.js",function(e,U){"use strict";Object.defineProperty(e,"DETAIL_COLUMN_ID",{enumerable:!0,get:function(){return te}}),Object.defineProperty(e,"createDetailColumn",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return z}});const te="__lattice_detail",E=36;function q(_){const Z=_.config&&_.config.detailColumnWidth||E;return{id:te,field:null,title:"",type:"text",dataType:{base:"text"},nullable:!0,align:"center",generated:!0,control:!0,detailExpander:!0,value:{pure:!0},cell:{render:"detailExpander",align:"center"},edit:{enabled:!1},sort:{enabled:!1,direction:null},filter:{enabled:!1},group:{enabled:!1,index:0,explode:!1},pivot:{enabled:!1,index:0},total:null,lookup:null,layout:{width:Z,min:Z,max:Z,pin:_.config&&_.config.detailColumnPin||"start",hidden:!1,resizable:!1,movable:!1,lockPosition:!0},header:{},export:{csv:!1,excel:!1},allowGroup:!1,allowPivot:!1,allowTotal:!1,def:{},getValue(X,B){return!!(B&&B.expanded)},formatValue(){return""}}}const z=q}),Ue("packages/core/src/columns/treecolumn.js",function(e,U){"use strict";Object.defineProperty(e,"TREE_COLUMN_ID",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"createTreeColumn",{enumerable:!0,get:function(){return _}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return Z}});const E=U("packages/core/src/internal/predicates.js").isFunction,q="__lattice_tree",z=260;function _(X){const B=X.tree||{},Y=X.config&&X.config.treeColumnWidth||z,G=()=>(X.columns&&E(X.columns.visible)?X.columns.visible():[]).find(c=>!c.generated)||null,j=(g,c)=>{if(c&&c.group)return c.groupValue;if(E(B.label))return B.label(g,c);if(typeof B.label=="string")return g==null?null:g[B.label];const d=G();return d&&E(d.getValue)?d.getValue(g,c):null},k=()=>{if(B.title)return B.title;const g=typeof B.label=="string"?X.columns&&E(X.columns.get)?X.columns.get(B.label):null:G();return g&&(g.title||g.id)||"Hierarchy"};return{id:q,get title(){return k()},field:null,type:"text",dataType:{base:"text"},nullable:!0,align:"start",generated:!0,value:{pure:!0},cell:{render:"group"},edit:{enabled:!1},sort:{enabled:!0,direction:null},filter:{enabled:!1},group:{enabled:!1,index:0,explode:!1},pivot:{enabled:!1,index:0},total:null,lookup:null,layout:{width:Y,min:140,pin:X.config&&X.config.treeColumnPin||null,hidden:!1,resizable:!0,movable:!1,lockPosition:!0},header:{},export:{csv:!1,excel:!1},allowGroup:!1,allowPivot:!1,allowTotal:!1,def:{},getValue(g,c){return j(g,c)},formatValue(g,c){if(c&&c.grandTotal)return X.config&&X.config.grandTotalLabel||"Total";if(g==null)return"";if(!B.label){const d=G();if(d&&E(d.formatValue))return d.formatValue(g,c)}return String(g)}}}const Z=_}),Ue("packages/core/src/columns/pivotcolumns.js",function(e,U){"use strict";Object.defineProperty(e,"PIVOT_PREFIX",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"createPivotColumns",{enumerable:!0,get:function(){return _}});const E=U("packages/core/src/internal/warn.js").warnOnce,q="__lattice_pivot",z=500;function _(Y){const{pivot:G,valueColumns:j,config:k}=Y,g=G&&G.paths||[],c=Y.separator||k&&k.pivot&&k.pivot.separator||" | ",d=k&&k.pivot&&k.pivot.maxColumns||z;if(!g.length||!j.length)return{tree:[],leaves:[],error:null};const l=Z(k),i=g.length*j.length+(l?j.length:0);if(i>d){const s=`pivot would generate ${i} columns, above the limit of ${d}. Pivot on a lower-cardinality column, or raise pivot.maxColumns.`;return E(`pivot.maxColumns:${i}`,s),{tree:[],leaves:[],error:s}}const n=[],a=[];for(const s of g){const t=[];for(const u of j){const r=B(s,u,c);t.push(r),a.push(r)}t.length===1?(t[0].title=String(s),n.push(t[0])):n.push({id:`${q}:group:${s}`,title:String(s),columns:t,collapsible:!1,openByDefault:!0,showWhen:"always",marryChildren:!0,generated:!0})}if(l){const s=j.map(u=>X(u,k));a.push(...s);const t=k&&k.pivot&&k.pivot.totalsLabel||"Total";if(s.length===1)s[0].title=t,l==="before"?n.unshift(s[0]):n.push(s[0]);else{const u={id:`${q}:group:__totals`,title:t,columns:s,collapsible:!1,openByDefault:!0,showWhen:"always",marryChildren:!0,generated:!0};l==="before"?n.unshift(u):n.push(u)}}return{tree:n,leaves:a,error:null}}function Z(Y){const G=Y&&Y.pivot&&Y.pivot.groupTotals;return G==="before"||G==="after"?G:null}function X(Y,G){return{id:`${q}:__total${G&&G.pivot&&G.pivot.separator||" | "}${Y.id}`,field:null,title:Y.title||Y.id,type:Y.type,dataType:Y.dataType,nullable:!0,align:Y.align,generated:!0,pivot:{enabled:!1,index:0,sourceId:Y.id,total:!0},value:{pure:!0},cell:{align:Y.align},edit:{enabled:!1},sort:{enabled:!1,direction:null},filter:{enabled:!1},group:{enabled:!1,index:0,explode:!1},total:Y.total,lookup:null,layout:{width:Y.layout&&Y.layout.width||120,min:80,pin:null,hidden:!1,resizable:!0,movable:!1},header:{},export:{csv:!0,excel:!0},allowGroup:!1,allowPivot:!1,allowTotal:!1,def:{},getValue(j,k){const g=k&&k.totals;return g&&Object.hasOwn(g,Y.id)?g[Y.id]:null},formatValue(j,k){return j==null?"":Y.formatValue?Y.formatValue(j,k):String(j)}}}function B(Y,G,j){return{id:`${q}:${Y}${j}${G.id}`,field:null,title:G.title||G.id,type:G.type,dataType:G.dataType,nullable:!0,align:G.align,generated:!0,pivot:{enabled:!1,index:0,path:Y,sourceId:G.id},value:{pure:!0},cell:{align:G.align},edit:{enabled:!1},sort:{enabled:!1,direction:null},filter:{enabled:!1},group:{enabled:!1,index:0,explode:!1},total:G.total,lookup:null,layout:{width:G.layout&&G.layout.width||120,min:80,pin:null,hidden:!1,resizable:!0,movable:!1},header:{},export:{csv:!0,excel:!0},allowGroup:!1,allowPivot:!1,allowTotal:!1,def:{},getValue(){return null},formatValue(k,g){return k==null?"":G.formatValue?G.formatValue(k,g):String(k)}}}}),Ue("packages/core/src/compute/group.js",function(e,U){"use strict";Object.defineProperty(e,"packKeys",{enumerable:!0,get:function(){return G}}),Object.defineProperty(e,"groupByColumns",{enumerable:!0,get:function(){return k}});const te=U("packages/core/src/compute/handle.js"),E=te.dictSize,q=te.identity,z=te.presenceReader,_=te.rowCount,Z=te.valueReader,X="",B="\0",Y=1<<20;function G(g,c,d,l){const i=g.length,n=g.map(o=>Z(o)),a=Array.isArray(l)&&l.some(Boolean),s=a?n.map((o,f)=>l[f]?w=>l[f](o(w)):o):n;if(!a&&i>0&&g.every(o=>o&&o.kind==="dictionary"&&o.dict)){const o=g.map(w=>E(w.dict)+1);let f=1;for(let w=0;w<i;w++)f*=o[w];if(f<=Number.MAX_SAFE_INTEGER){const w=g.map(p=>p.values),m=g.map(p=>z(p)),v=p=>{let b=0;for(let O=0;O<i;O++){const y=m[O],L=y&&y(p)===0?o[O]-1:w[O][p];b=b*o[O]+L}return b},h=new Float64Array(d);for(let p=0;p<d;p++)h[p]=v(c[p]);return{packed:h,strings:null,product:f,readers:s,keyOf:v}}}const u=o=>{let f="";for(let w=0;w<i;w++){const m=s[w](o);f+=(w===0?"":X)+(m==null?B:String(m))}return f},r=new Array(d);for(let o=0;o<d;o++)r[o]=u(c[o]);return{packed:null,strings:r,product:1/0,readers:s,keyOf:u}}function j(g,c,d,l){const i=new Uint32Array(l+1);for(let t=0;t<d;t++)i[c[t]+1]++;for(let t=0;t<l;t++)i[t+1]+=i[t];const n=new Uint32Array(d),a=i.slice(0,l);for(let t=0;t<d;t++)n[a[c[t]]++]=g[t];const s=new Array(l);for(let t=0;t<l;t++)s[t]=n.subarray(i[t],i[t+1]);return s}function k(g,c,d={}){const l=g||[],i=c||q(_(l[0],d)),n=i.length;if(l.length===0||n===0)return{keys:[],buckets:[]};const{packed:a,strings:s,product:t,readers:u}=G(l,i,n,d.project),r=new Uint32Array(n);let o=0,f=null;if(a&&t<=Math.max(1024,Math.min(Y,n*4))){const h=t,p=new Int32Array(h).fill(-1);for(let b=0;b<n;b++)p[a[b]]=0;for(let b=0;b<h;b++)p[b]===0&&(p[b]=o++);for(let b=0;b<n;b++)r[b]=p[a[b]];f=new Float64Array(o);for(let b=0;b<h;b++)p[b]>=0&&(f[p[b]]=b)}else if(a){const h=new Map;for(let p=0;p<n;p++){const b=a[p];let O=h.get(b);O===void 0&&(O=o++,h.set(b,O)),r[p]=O}f=new Float64Array(o);for(const[p,b]of h)f[b]=p}else{const h=new Map;for(let p=0;p<n;p++){const b=s[p];let O=h.get(b);O===void 0&&(O=o++,h.set(b,O)),r[p]=O}}const w=j(i,r,n,o),m=new Array(o);for(let h=0;h<o;h++){const p=w[h][0],b=new Array(u.length);for(let O=0;O<u.length;O++)b[O]=u[O](p);m[h]=b}const v={keys:m,buckets:w};return f&&(v.packed=f),v}}),Ue("packages/core/src/compute/pivot.js",function(e,U){"use strict";Object.defineProperty(e,"KEY_DELIMITER",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(e,"DEFAULT_PATH_SEPARATOR",{enumerable:!0,get:function(){return G}}),Object.defineProperty(e,"DEFAULT_MAX_COLUMNS",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"pivotKey",{enumerable:!0,get:function(){return k}}),Object.defineProperty(e,"joinPath",{enumerable:!0,get:function(){return g}}),Object.defineProperty(e,"resolvePivotKeys",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"pivot",{enumerable:!0,get:function(){return n}});const E=U("packages/core/src/internal/warn.js").warnOnce,z=U("packages/core/src/compute/handle.js").valueComparator,Z=U("packages/core/src/compute/group.js").packKeys,B=U("packages/core/src/compute/total.js").total,Y="|",G="/",j=2e3;function k(t,u,r){return`${t}${Y}${u}${Y}${r}`}function g(t,u){let r="";for(let o=0;o<t.length;o++){const f=t[o];r+=(o===0?"":u)+(f==null?"":String(f))}return r}function c(t,u,r={}){const o=r.separator||G,f=u.length,{keyOf:w,readers:m}=Z(t,u,0),v=new Map,h=[],p=[];for(let F=0;F<f;F++){const T=u[F],I=w(T);if(v.has(I))continue;v.set(I,h.length),p.push(I);const P=new Array(m.length);for(let R=0;R<m.length;R++)P[R]=m[R](T);h.push(P)}const b=z(r.locale),O=h.map((F,T)=>T);O.sort((F,T)=>{const I=h[F],P=h[T];for(let R=0;R<I.length;R++){const $=d(I[R],P[R],b);if($!==0)return $}return F-T});const y=new Array(O.length),L=new Array(O.length),M=new Map;for(let F=0;F<O.length;F++){const T=O[F];y[F]=h[T],L[F]=g(h[T],o),M.set(p[T],F)}return{keys:y,paths:L,idOf:F=>{const T=M.get(w(F));return T===void 0?-1:T}}}function d(t,u,r){const o=t==null,f=u==null;return o||f?o&&f?0:o?1:-1:r(t,u)}function l(t){const u=t.values||t.totals||[];if(u.length&&typeof u[0]=="object"&&u[0]!==null)return u.filter(w=>w&&w.handle);const r=typeof t.handle=="function"?t.handle:null;if(!r)return u.length&&E("pivot:handles","pivot was given total column ids but no handle(colId) resolver, so no cell values were reduced. Pass values: [{ colId, handle, fn }] or opts.handle."),[];const o=typeof t.totalOf=="function"?t.totalOf:null,f=[];for(const w of u){const m=r(w);m&&f.push({colId:w,handle:m,fn:o?o(w):"sum"})}return f}function i(t,u,r){if(Array.isArray(t)){const o=r||{};return{...o,pivotHandles:t,order:u||null,groups:o.groups||null}}return t||{}}function n(t,u,r){const o=i(t,u,r),f=o.separator||G,w=l(o),m=o.maxColumns===void 0?j:o.maxColumns,v=o.groups&&o.groups.buckets?o.groups:null,h=v?v.buckets:[o.order||new Uint32Array(0)],p=o.groupPaths||(v?v.keys.map(I=>g(I,f)):[""]),b=s(h),{keys:O,paths:y,idOf:L}=c(o.pivotHandles||[],b,o),M=y.length*Math.max(1,w.length),D=a(y,w,f);if(m&&M>m){const I=new Map;return{keys:O,paths:y,fields:D,groupPaths:p,columns:M,values:I,cells:I,error:{code:"pivot-max-columns",message:`[lattice] pivot would generate ${M} columns, above pivot.maxColumns of ${m}. Narrow the pivot columns or raise the limit.`,columns:M,maxColumns:m}}}const F=new Map,T=y.length;for(let I=0;I<h.length;I++){const P=h[I],R=p[I]===void 0?"":p[I],$=P.length;if($===0)continue;const C=new Int32Array($),A=new Uint32Array(T+1);for(let H=0;H<$;H++){const V=L(P[H]);C[H]=V,V>=0&&A[V+1]++}for(let H=0;H<T;H++)A[H+1]+=A[H];const S=new Uint32Array($),x=A.slice(0,T);for(let H=0;H<$;H++){const V=C[H];V>=0&&(S[x[V]++]=P[H])}for(let H=0;H<T;H++){const V=A[H],W=A[H+1];if(W===V)continue;const Q=S.subarray(V,W);for(let ee=0;ee<w.length;ee++){const re=w[ee],ae=B(re.handle,Q,re.fn,o.totalContext||{locale:o.locale});F.set(k(R,y[H],re.colId),ae)}}}return{keys:O,paths:y,fields:D,groupPaths:p,columns:M,values:F,cells:F,error:null}}function a(t,u,r){if(u.length===0)return t.slice();const o=[];for(const f of t)for(const w of u)o.push(`${f}${r}${w.colId}`);return o}function s(t){if(t.length===1)return t[0]||new Uint32Array(0);let u=0;for(const f of t)u+=f?f.length:0;const r=new Uint32Array(u);let o=0;for(const f of t)!f||f.length===0||(r.set(f,o),o+=f.length);return r}}),Ue("packages/core/src/store/bitset.js",function(e,U){"use strict";Object.defineProperty(e,"Bitset",{enumerable:!0,get:function(){return E}});const te=8;class E{static#e=new Uint8Array(256);static{for(let z=1;z<256;z++)E.#e[z]=E.#e[z>>1]+(z&1)}#t;#n;constructor(z=0){const _=Math.max(0,z|0);this.#n=_,this.#t=new Uint8Array(Math.ceil(_/te))}get size(){return this.#n}get words(){return this.#t}get bytes(){return this.#t?this.#t.byteLength:0}get(z){return z<0||z>=this.#n?0:this.#t[z>>3]>>(z&7)&1}set(z){return z>=0&&z<this.#n&&(this.#t[z>>3]|=1<<(z&7)),this}clear(z){return z>=0&&z<this.#n&&(this.#t[z>>3]&=~(1<<(z&7))),this}assign(z,_){return _?this.set(z):this.clear(z)}fill(z=!1){return this.#t.fill(z?255:0),z&&this.#r(),this}grow(z){const _=Math.max(0,z|0);if(_<=this.#n)return this;const Z=Math.ceil(_/te);if(Z>this.#t.length){const X=new Uint8Array(Z);X.set(this.#t),this.#t=X}return this.#n=_,this}count(){const z=this.#t,_=E.#e;let Z=0;for(let X=0;X<z.length;X++)Z+=_[z[X]];return Z}and(z){const _=z instanceof E?z.words:z,Z=this.#t,X=Math.min(Z.length,_.length);for(let B=0;B<X;B++)Z[B]&=_[B];for(let B=X;B<Z.length;B++)Z[B]=0;return this}or(z){const _=z instanceof E?z.words:z,Z=this.#t,X=Math.min(Z.length,_.length);for(let B=0;B<X;B++)Z[B]|=_[B];return this}not(){const z=this.#t;for(let _=0;_<z.length;_++)z[_]=~z[_]&255;return this.#r(),this}clone(){const z=new E(this.#n);return z.words.set(this.#t.subarray(0,z.words.length)),z}release(){this.#t=new Uint8Array(0),this.#n=0}#r(){const z=this.#n&7;if(z===0)return;const _=this.#n>>3;_<this.#t.length&&(this.#t[_]&=(1<<z)-1)}static from(z){const _=Array.isArray(z)?z:Array.from(z),Z=new E(_.length);for(let X=0;X<_.length;X++)_[X]&&Z.set(X);return Z}}}),Ue("packages/core/src/store/dictionary.js",function(e,U){"use strict";Object.defineProperty(e,"Dictionary",{enumerable:!0,get:function(){return z}});const te=U("packages/core/src/internal/compare.js"),E=te.collator,q=te.defaultCompare;class z{#e;#t=new Map;#n=0;#r=null;#s=-1;#i="\0";constructor(Z=[]){this.#e=[];for(let X=0;X<Z.length;X++){const B=Z[X];this.#t.has(B)||(this.#t.set(B,this.#e.length),this.#e.push(B))}}get size(){return this.#e.length}get version(){return this.#n}get bytes(){let Z=this.#e.length*8;for(let X=0;X<this.#e.length;X++){const B=this.#e[X];typeof B=="string"&&(Z+=B.length*2),Z+=16}return Z}codeOf(Z){const X=this.#t.get(Z);if(X!==void 0)return X;const B=this.#e.length;return this.#e.push(Z),this.#t.set(Z,B),this.#n++,B}lookup(Z){const X=this.#t.get(Z);return X===void 0?-1:X}has(Z){return this.#t.has(Z)}valueOf(Z){return this.#e[Z]}values(){return this.#e}ranks(Z){const X=Z||"";if(this.#r&&this.#s===this.#n&&this.#i===X)return this.#r;const B=this.#e.length,Y=new Array(B);for(let g=0;g<B;g++)Y[g]=g;const G=E(Z).compare,j=this.#e;Y.sort((g,c)=>this.#o(j[g],j[c],G));const k=new Uint32Array(B);for(let g=0;g<B;g++)k[Y[g]]=g;return this.#r=k,this.#s=this.#n,this.#i=X,k}#o(Z,X,B){return typeof Z=="string"&&typeof X=="string"?B(Z,X):q(Z,X)}}}),Ue("packages/core/src/store/multivalue.js",function(e,U){"use strict";Object.defineProperty(e,"MultiValue",{enumerable:!0,get:function(){return te}});class te{#e;#t;#n=0;#r=0;constructor(q={}){const z=Math.max(1,q.rows??16),_=Math.max(1,q.values??z);this.#e=new Int32Array(_),this.#t=new Uint32Array(z+1)}get values(){return this.#e}get offsets(){return this.#t}get rows(){return this.#n}get length(){return this.#r}get bytes(){return this.#e.byteLength+this.#t.byteLength}count(q){return q<0||q>=this.#n?0:this.#t[q+1]-this.#t[q]}at(q){return q<0||q>=this.#n?this.#e.subarray(0,0):this.#e.subarray(this.#t[q],this.#t[q+1])}has(q,z){if(q<0||q>=this.#n)return!1;const _=this.#e,Z=this.#t[q+1];for(let X=this.#t[q];X<Z;X++)if(_[X]===z)return!0;return!1}hasAny(q,z){for(let _=0;_<z.length;_++)if(this.has(q,z[_]))return!0;return!1}hasAll(q,z){for(let _=0;_<z.length;_++)if(!this.has(q,z[_]))return!1;return!0}hasNone(q,z){return!this.hasAny(q,z)}push(q){const z=this.#n,_=q.length;this.#s(z+1),this.#i(this.#r+_);const Z=this.#r;for(let X=0;X<_;X++)this.#e[Z+X]=q[X]|0;return this.#r+=_,this.#n=z+1,this.#t[z]=Z,this.#t[z+1]=this.#r,z}write(q,z){if(q===this.#n){this.push(z);return}if(q<0||q>this.#n)return;const _=this.#t[q],Z=this.#t[q+1],X=z.length;if(Z-_===X){for(let B=0;B<X;B++)this.#e[_+B]=z[B]|0;return}this.#o(q,z)}compact(q,z,_){const Z=this.#e,X=this.#t,B=this.#n,Y=new Int32Array(Math.max(1,this.#r)),G=new Uint32Array(z+1);let j=0;for(let k=0;k<B;k++){if(q[k]===_)continue;const g=X[k],c=X[k+1];G[q[k]]=j;for(let d=g;d<c;d++)Y[j++]=Z[d];G[q[k]+1]=j}this.#e=Y,this.#t=G,this.#n=z,this.#r=j}release(){this.#e=new Int32Array(0),this.#t=new Uint32Array(1),this.#n=0,this.#r=0}#s(q){if(q+1<=this.#t.length)return;let z=this.#t.length-1;for(;z<q;)z=z*2||16;const _=new Uint32Array(z+1);_.set(this.#t),this.#t=_}#i(q){if(q<=this.#e.length)return;let z=this.#e.length;for(;z<q;)z=z*2||16;const _=new Int32Array(z);_.set(this.#e),this.#e=_}#o(q,z){const _=this.#e,Z=this.#t,X=this.#n,B=z.length-(Z[q+1]-Z[q]),Y=new Int32Array(Math.max(1,this.#r+B)),G=new Uint32Array(Z.length);let j=0;for(let k=0;k<X;k++){if(G[k]=j,k===q)for(let g=0;g<z.length;g++)Y[j++]=z[g]|0;else for(let g=Z[k];g<Z[k+1];g++)Y[j++]=_[g];G[k+1]=j}this.#e=Y,this.#t=G,this.#r=j}}}),Ue("packages/core/src/compute/sort.js",function(e,U){"use strict";Object.defineProperty(e,"radixSortFloat64",{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,"radixSortInt32",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"rankSortDictionary",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"mergeSortComparator",{enumerable:!0,get:function(){return w}}),Object.defineProperty(e,"rankSortStrings",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"collateStringRanks",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"sortColumn",{enumerable:!0,get:function(){return F}}),Object.defineProperty(e,"sortMulti",{enumerable:!0,get:function(){return T}});const te=U("packages/core/src/compute/handle.js"),E=te.bitReader,q=te.dictRanks,z=te.dictSize,_=te.identity,Z=te.isMissing,X=te.presenceReader,B=te.rowCount,Y=te.valueComparator,G=te.valueReader,j=new Uint32Array(0),k=new ArrayBuffer(8),g=new Float64Array(k),c=new Uint32Array(k),d=(g[0]=-1,(c[1]&2147483648)!==0?1:0),l=d===1?0:1;function i(P,R){g[0]=P;let $=c[d],C=c[l];($&2147483648)!==0?($=~$>>>0,C=~C>>>0):$=($^2147483648)>>>0,R[0]=C,R[1]=$}function n(P,R,$,C){if(C<2)return P;const A=new Uint32Array(256*8);for(let re=0;re<C;re++){const ae=R[re],ue=$[re];A[ae&255]++,A[256+(ae>>>8&255)]++,A[512+(ae>>>16&255)]++,A[768+(ae>>>24&255)]++,A[1024+(ue&255)]++,A[1280+(ue>>>8&255)]++,A[1536+(ue>>>16&255)]++,A[1792+(ue>>>24&255)]++}let S=P,x=R,H=$,V=new Uint32Array(C),W=new Uint32Array(C),Q=new Uint32Array(C);const ee=new Uint32Array(256);for(let re=0;re<8;re++){const ae=re<<8,ue=(re&3)<<3,ge=re>=4;let Ae=!1;for(let Ne=0;Ne<256;Ne++)if(A[ae+Ne]===C){Ae=!0;break}if(Ae)continue;let pe=0;for(let Ne=0;Ne<256;Ne++)ee[Ne]=pe,pe+=A[ae+Ne];for(let Ne=0;Ne<C;Ne++){const Pe=x[Ne],ie=H[Ne],Oe=(ge?ie:Pe)>>>ue&255,je=ee[Oe]++;V[je]=S[Ne],W[je]=Pe,Q[je]=ie}let Me=S;S=V,V=Me,Me=x,x=W,W=Me,Me=H,H=Q,Q=Me}return S}function a(P,R,$){if($<2)return P;const C=new Uint32Array(256*4);for(let W=0;W<$;W++){const Q=R[W];C[Q&255]++,C[256+(Q>>>8&255)]++,C[512+(Q>>>16&255)]++,C[768+(Q>>>24&255)]++}let A=P,S=R,x=new Uint32Array($),H=new Uint32Array($);const V=new Uint32Array(256);for(let W=0;W<4;W++){const Q=W<<8,ee=W<<3;let re=!1;for(let ge=0;ge<256;ge++)if(C[Q+ge]===$){re=!0;break}if(re)continue;let ae=0;for(let ge=0;ge<256;ge++)V[ge]=ae,ae+=C[Q+ge];for(let ge=0;ge<$;ge++){const Ae=S[ge],pe=V[Ae>>>ee&255]++;x[pe]=A[ge],H[pe]=Ae}let ue=A;A=x,x=ue,ue=S,S=H,H=ue}return A}function s(P,R,$,C){const A=new Uint32Array(C+1);for(let H=0;H<$;H++)A[R[H]]++;let S=0;for(let H=0;H<=C;H++){const V=A[H];A[H]=S,S+=V}const x=new Uint32Array($);for(let H=0;H<$;H++)x[A[R[H]]++]=P[H];return x}function t(P,R,$,C){return $<2?P:C<=65536||C<=$*2?s(P,R,$,C):a(P,R,$)}function u(P,R){return P.length===R&&P.byteOffset===0?P:Uint32Array.prototype.slice.call(P,0,R)}function r(P,R,$=!1){const C=R||_(P.length),A=C.length;if(A<2)return Uint32Array.from(C);const S=new Uint32Array(A),x=new Uint32Array(A),H=new Uint32Array(A),V=new Uint32Array(A),W=new Uint32Array(2);let Q=0,ee=0;for(let ue=0;ue<A;ue++){const ge=C[ue],Ae=P[ge];if(Number.isNaN(Ae)){V[ee++]=ge;continue}i(Ae,W),$?(x[Q]=~W[0]>>>0,H[Q]=~W[1]>>>0):(x[Q]=W[0],H[Q]=W[1]),S[Q++]=ge}const re=n(S.subarray(0,Q),x.subarray(0,Q),H.subarray(0,Q),Q);if(ee===0)return u(re,Q);const ae=new Uint32Array(A);return ae.set(re.subarray(0,Q),0),ae.set(V.subarray(0,ee),Q),ae}function o(P,R,$=!1){const C=R||_(P.length),A=C.length;if(A<2)return Uint32Array.from(C);const S=Uint32Array.from(C),x=new Uint32Array(A);for(let H=0;H<A;H++){const V=(P[S[H]]^2147483648)>>>0;x[H]=$?~V>>>0:V}return u(a(S,x,A),A)}function f(P,R,$={}){const C=R||_(B(P,$)),A=C.length;if(A<2)return Uint32Array.from(C);const S=q(P.dict,$.locale),x=P.values,H=X(P),V=Math.max(z(P.dict),S.length),W=V,Q=Uint32Array.from(C),ee=new Uint32Array(A),re=!!$.descending;for(let ae=0;ae<A;ae++){const ue=Q[ae];let ge=H&&H(ue)===0?W:S[x[ue]];ge===void 0&&(ge=W),ee[ae]=re?W-ge:ge}return u(t(Q,ee,A,V+1),A)}function w(P,R,$){const C=R.length;let A=Uint32Array.from(R);if(C<2)return A;let S=new Uint32Array(C);for(let x=1;x<C;x<<=1){for(let V=0;V<C;V+=x<<1){const W=Math.min(V+x,C),Q=Math.min(V+(x<<1),C);let ee=V,re=W,ae=V;for(;ee<W&&re<Q;)S[ae++]=$(P[A[ee]],P[A[re]])<=0?A[ee++]:A[re++];for(;ee<W;)S[ae++]=A[ee++];for(;re<Q;)S[ae++]=A[re++]}const H=A;A=S,S=H}return A}function m(P,R,$){const C=E(P.values),A=R.length,S=new Uint32Array(A),x=$?1:0;let H=0;for(let V=0;V<A;V++)C(R[V])===x&&(S[H++]=R[V]);for(let V=0;V<A;V++)C(R[V])!==x&&(S[H++]=R[V]);return S}function v(P,R){const $=P.values,C=P.kind;if((C==="object"||C===void 0)&&(Array.isArray($)||ArrayBuffer.isView($))&&!P.presence)return $;const S=G(P),x=new Array(B(P)||0);for(let H=0;H<R.length;H++){const V=R[H];x[V]=S(V)}return x}function h(P,R){for(let $=0;$<R.length;$++)if(typeof P[R[$]]!="string")return!1;return!0}function p(P,R,$,C,A){const S=P.length,x=Uint32Array.from(P);if(S<2||C<1)return x;const H=new Uint32Array(S),V=C-1;for(let W=0;W<S;W++){const Q=$[R[W]];H[W]=A?V-Q:Q}return u(t(x,H,S,C),S)}function b(P,R,$){const C=Y($),A=new Array(R);for(let x=0;x<R;x++)A[x]=x;A.sort((x,H)=>C(P[x],P[H])||x-H);const S=new Uint32Array(R);for(let x=0;x<R;x++)S[A[x]]=x;return S}function O(P,R,$){const C=R.length,A=new Map,S=[],x=new Uint32Array(C);for(let W=0;W<C;W++){const Q=P[R[W]];let ee=A.get(Q);ee===void 0&&(ee=S.length,A.set(Q,ee),S.push(Q)),x[W]=ee}const H=S.length,V=b(S,H,$.locale);return p(R,x,V,H,!!$.descending)}function y(P,R,$){const C=v(P,R);if(R.length>=2&&h(C,R)){const x=P.stringRank;return x&&x.version===P.version&&x.usable(R,C,$.locale)?x.sort(R,$):O(C,R,$)}const A=Y($.locale),S=$.descending?(x,H)=>A(H,x):A;return w(C,R,S)}function L(P,R,$){const C=v(P,R),A=$.compare,x=!!$.descending?(H,V)=>-A(H,V,void 0,void 0,!0):(H,V)=>A(H,V,void 0,void 0,!1);return w(C,R,x)}function M(P,R){const $=R.length,C=X(P),A=P.values,S=P.kind==="float64"&&!!A,x=P.kind==="object"||P.kind==="multi"||P.kind===void 0;if(!C&&!S&&!x)return{present:R,absent:j};const H=new Uint32Array($),V=new Uint32Array($);let W=0,Q=0;if(C&&S)for(let ee=0;ee<$;ee++){const re=R[ee];C(re)===1&&!Number.isNaN(A[re])?H[W++]=re:V[Q++]=re}else if(S&&!C)for(let ee=0;ee<$;ee++){const re=R[ee];Number.isNaN(A[re])?V[Q++]=re:H[W++]=re}else if(C&&!x)for(let ee=0;ee<$;ee++){const re=R[ee];C(re)===1?H[W++]=re:V[Q++]=re}else{const ee=G(P);for(let re=0;re<$;re++){const ae=R[re];Z(ee(ae))?V[Q++]=ae:H[W++]=ae}}return Q===0?{present:R,absent:j}:{present:H.subarray(0,W),absent:V.subarray(0,Q)}}function D(P,R,$){if(R.length===0)return P;const C=new Uint32Array(P.length+R.length);return $?(C.set(R,0),C.set(P,R.length)):(C.set(P,0),C.set(R,P.length)),C}function F(P,R,$={}){const C=R||_(B(P,$));if(!P||C.length<2)return Uint32Array.from(C);const{present:A,absent:S}=M(P,C);if(A.length===0)return Uint32Array.from(C);const x=!!$.descending;let H;if(typeof $.compare=="function")H=L(P,A,$);else switch(P.kind){case"float64":H=r(P.values,A,x);break;case"int32":H=o(P.values,A,x);break;case"dictionary":H=f(P,A,$);break;case"bitset":H=m(P,A,x);break;default:H=y(P,A,$);break}return D(H,S,!!$.nullsFirst)}function T(P,R,$,C={}){const A=R||[],S=A.length&&(A[0].handle||I(P,A[0].col))||P&&P[0];let x=$||_(B(S,C));for(let H=A.length-1;H>=0;H--){const V=A[H],W=V.handle||I(P,V.col)||P&&P[H];W&&(x=F(W,x,{descending:V.descending!==void 0?!!V.descending:V.dir==="desc",nullsFirst:!!V.nullsFirst,locale:V.locale!==void 0?V.locale:C.locale,compare:V.compare}))}return x instanceof Uint32Array?x:Uint32Array.from(x)}function I(P,R){if(!(!P||R===void 0)){for(let $=0;$<P.length;$++)if(P[$]&&P[$].id===R)return P[$]}}}),Ue("packages/core/src/store/stringrank.js",function(e,U){"use strict";Object.defineProperty(e,"DEFAULT_MAX_DISTINCT",{enumerable:!0,get:function(){return z}}),Object.defineProperty(e,"StringRankIndex",{enumerable:!0,get:function(){return _}});const te=U("packages/core/src/compute/sort.js"),E=te.collateStringRanks,q=te.rankSortStrings,z=1e5;class _{#e=[];#t=new Map;#n;#r=0;#s=0;#i=-1;#o;#l=!1;#a=null;#c=-1;#u="\0";constructor(X=z){this.#o=X>0?X:z,this.#n=new Uint32Array(0)}get version(){return this.#i}set version(X){this.#i=X}get generation(){return this.#s}get size(){return this.#e.length}get capped(){return this.#l}get length(){return this.#r}get bytes(){let X=this.#n.byteLength;const B=this.#e;for(let Y=0;Y<B.length;Y++)X+=B[Y].length*2+24;return X}#f(X,B){const Y=this.#t.get(X);if(Y!==void 0)return Y;if(this.#l)return-1;if(B&&this.#e.length>=this.#o)return this.#l=!0,-1;const G=this.#e.length;return this.#e.push(X),this.#t.set(X,G),this.#s++,G}build(X,B){const Y=B|0;this.#e=[],this.#t=new Map,this.#s=0,this.#l=!1,this.#a=null,this.#c=-1,this.#n=new Uint32Array(Y);for(let G=0;G<Y;G++){const j=X[G],k=typeof j=="string"?this.#f(j,!1):-1;this.#n[G]=k<0?0:k}this.#r=Y}append(X,B,Y){const G=(B|0)+(Y|0);if(G>this.#n.length){const j=new Uint32Array(G);j.set(this.#n.subarray(0,this.#r)),this.#n=j}for(let j=B|0;j<G;j++){const k=X[j],g=typeof k=="string"?this.#f(k,!0):-1;this.#n[j]=g<0?0:g}this.#r=Math.max(this.#r,G)}ranks(X){const B=X||"";if(this.#a&&this.#c===this.#s&&this.#u===B)return this.#a;const Y=E(this.#e,this.#e.length,X);return this.#a=Y,this.#c=this.#s,this.#u=B,Y}usable(X,B,Y){if(this.#l||this.#e.length===0)return!1;const G=this.#n,j=this.#e,k=this.#r;for(let g=0;g<X.length;g++){const c=X[g];if(c>=k||j[G[c]]!==B[c])return!1}return!0}sort(X,B){const Y=this.ranks(B.locale),G=this.#e.length,j=X.length,k=new Uint32Array(j),g=this.#n;for(let c=0;c<j;c++)k[c]=g[X[c]];return q(X,k,Y,G,!!B.descending)}}}),Ue("packages/core/src/store/columnstore.js",function(e,U){"use strict";Object.defineProperty(e,"REMOVED",{enumerable:!0,get:function(){return d}}),Object.defineProperty(e,"toFloat",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"ColumnHandle",{enumerable:!0,get:function(){return w}}),Object.defineProperty(e,"ColumnStore",{enumerable:!0,get:function(){return m}});const E=U("packages/core/src/internal/warn.js").warnOnce,z=U("packages/core/src/internal/predicates.js").isFunction,Z=U("packages/core/src/internal/paths.js").pathGetter,B=U("packages/core/src/store/bitset.js").Bitset,G=U("packages/core/src/store/dictionary.js").Dictionary,k=U("packages/core/src/store/multivalue.js").MultiValue,c=U("packages/core/src/store/stringrank.js").StringRankIndex,d=4294967295,l=1024,i=5e3,n=.2,a=new Set(["float64","int32","bitset","dictionary","object","multi"]);function s(v){return v==null}function t(v){if(typeof v=="number")return v;if(v instanceof Date)return v.getTime();if(typeof v=="boolean")return v?1:0;const h=Number(v);return Number.isNaN(h)&&typeof v=="string"?Date.parse(v):h}function u(v){const h=t(v);return Number.isFinite(h)?h|0:0}function r(v){return s(v)?[]:Array.isArray(v)?v:[v]}function o(v,h){switch(v.kind){case"float64":case"int32":return v.buf[h];case"bitset":return v.bits.get(h)===1;case"dictionary":return v.dict.valueOf(v.buf[h]);case"multi":{const p=v.mv.at(h),b=new Array(p.length);for(let O=0;O<p.length;O++)b[O]=v.dict.valueOf(p[O]);return b}default:return v.buf[h]}}function f(v,h){switch(v.kind){case"float64":case"int32":return v.values[h];case"bitset":return(v.values[h>>3]&1<<(h&7))!==0;case"dictionary":return(v.table||[])[v.values[h]];case"multi":{const p=v.offsets[h],b=v.offsets[h+1],O=v.table||[],y=new Array(b-p);for(let L=p;L<b;L++)y[L-p]=O[v.values[L]];return y}default:return v.values[h]}}class w{#e;#t;#n;#r;#s;#i;#o;#l=!1;#a=null;#c=null;#u=null;#f=null;#d=null;#h;#p;#m=-1;#g=null;#b=0;#y=0;#A=null;#w=null;#O=!1;constructor(h,p){this.#e=h.id;const b=a.has(h.kind)?h.kind:"object";h.kind&&!a.has(h.kind)&&E(`store.kind.${h.id}`,`column "${h.id}" declares unknown storage kind "${h.kind}"; falling back to object`),this.#n=b,this.#t=b,this.#r=h.nullable!==!1,this.#o=h.dictionary??null,this.#i=p,this.#s=z(h.read)?h.read:Z(h.field||h.id),this.#h=h.stringRankIndex!=="off",this.#p=typeof h.stringRankMaxDistinct=="number"?h.stringRankMaxDistinct:0,this.#A=new Map}get id(){return this.#e}get kind(){return this.#l?this.#t:"object"}get target(){return this.#n}get nullable(){return this.#r}get values(){return this.#O?null:this.#l?this.#t==="bitset"?this.#c.words:this.#t==="multi"?this.#u.values:this.#a:this.#P().values}get presence(){return this.#O||!this.#r?null:this.#l?this.#g:this.#P().presence}get dict(){return this.#O||!this.#l?null:this.#t==="dictionary"||this.#t==="multi"?this.#f:null}get stringRank(){if(this.#O||!this.#h||this.kind!=="object")return null;const h=this.values,p=this.#i.physical();if(!h||p===0)return null;if(this.#d===null){if(typeof h[0]!="string")return null;const b=new c(this.#v());return b.build(h,p),b.version=this.#y,this.#d=b,this.#m=this.#y,b.capped?null:b}return this.#d.length<p&&this.#d.append(h,this.#d.length,p-this.#d.length),this.#d.version=this.#y,this.#m=this.#y,this.#d.capped?null:this.#d}#v(){return this.#p}#T(){this.#d=null,this.#m=-1}get offsets(){return this.#O||!this.#l||this.#t!=="multi"?null:this.#u.offsets}get version(){return this.#y}get bytes(){let h=0;return this.#a&&(h+=this.#a.byteLength??this.#a.length*8),this.#c&&(h+=this.#c.bytes),this.#u&&(h+=this.#u.bytes),this.#g&&(h+=this.#g.bytes),this.#f&&(h+=this.#f.bytes),this.#A&&(h+=this.#A.size*24),h}get(h){if(!this.#O&&!(h<0||h>=this.#i.physical())){if(!this.#l)return this.#M(h);if(this.#r&&this.#g.get(h)===0)return null;switch(this.#t){case"float64":case"int32":return this.#a[h];case"bitset":return this.#c.get(h)===1;case"dictionary":return this.#f.valueOf(this.#a[h]);case"multi":{const p=this.#u.at(h),b=new Array(p.length);for(let O=0;O<p.length;O++)b[O]=this.#f.valueOf(p[O]);return b}default:return this.#a[h]}}}set(h,p){this.#O||(this.#l?this.#E(h,p):this.#A.set(h,p===void 0?null:p),this.#d&&this.#T(),this.#y++)}read(h){return this.#s(h)}appendColumn(h,p,b){if(this.#O||b<=0)return;if(!this.#l){this.#y++;return}const O=this.#s,y=this.#r,L=this.#g;let M=!1;switch(this.#t){case"float64":{const D=this.#a;for(let F=0;F<b;F++){const T=O(h[F]);if(typeof T=="number"){y&&L.set(p+F),D[p+F]=T;continue}const I=T==null;y?L.assign(p+F,!I):I&&(M=!0),D[p+F]=I?NaN:t(T)}break}case"int32":{const D=this.#a;for(let F=0;F<b;F++){const T=O(h[F]),I=T==null;y?L.assign(p+F,!I):I&&(M=!0),D[p+F]=I?0:u(T)}break}case"bitset":{const D=this.#c;for(let F=0;F<b;F++){const T=O(h[F]),I=T==null;y?L.assign(p+F,!I):I&&(M=!0),D.assign(p+F,!I&&!!T)}break}case"dictionary":{const D=this.#a,F=this.#f;for(let T=0;T<b;T++){const I=O(h[T]),P=I==null;y?L.assign(p+T,!P):P&&(M=!0),D[p+T]=P?0:F.codeOf(I)}break}case"multi":{const D=this.#u,F=this.#f;for(let T=0;T<b;T++){const I=O(h[T]),P=I==null;y?L.assign(p+T,!P):P&&(M=!0);const R=r(I),$=new Array(R.length);for(let C=0;C<R.length;C++)$[C]=F.codeOf(R[C]);D.write(p+T,$)}break}default:{const D=this.#a;for(let F=0;F<b;F++){const T=O(h[F]),I=T==null;y?L.assign(p+F,!I):I&&(M=!0),D[p+F]=I?null:T}break}}M&&E(`store.null.${this.#e}`,`column "${this.#e}" is declared non-nullable but received null; storing a filler value`),this.#d&&this.#t==="object"&&(this.#d.append(this.#a,p,b),this.#d.version=this.#y+1,this.#m=this.#y+1),this.#y++}appendPacked(h,p,b){if(this.#O||b<=0||!h)return;if(!this.#l){this.#y++;return}const O=this.#g,y=h.presence;if(O)if(y)for(let M=0;M<b;M++)O.assign(p+M,(y[M>>3]&1<<(M&7))!==0);else for(let M=0;M<b;M++)O.set(p+M);const L=h.kind===this.#t;if(L&&(this.#t==="float64"||this.#t==="int32")){this.#a.set(h.values,p),this.#y++;return}if(L&&this.#t==="bitset"){const M=h.values;for(let D=0;D<b;D++)this.#c.assign(p+D,(M[D>>3]&1<<(D&7))!==0);this.#y++;return}if(L&&this.#t==="dictionary"){const M=h.table||[],D=new Uint32Array(M.length);for(let P=0;P<M.length;P++)D[P]=this.#f.codeOf(M[P]);const F=h.values,T=this.#a,I=O;for(let P=0;P<b;P++){if(I&&(y&&(y[P>>3]&1<<(P&7))===0)){T[p+P]=0;continue}T[p+P]=D[F[P]]??0}this.#y++;return}if(L&&this.#t==="multi"){const M=h.table||[],D=new Uint32Array(M.length);for(let I=0;I<M.length;I++)D[I]=this.#f.codeOf(M[I]);const F=h.values,T=h.offsets;for(let I=0;I<b;I++){const P=T[I],R=T[I+1],$=new Array(R-P);for(let C=P;C<R;C++)$[C-P]=D[F[C]]??0;this.#u.write(p+I,$)}this.#y++;return}for(let M=0;M<b;M++){const D=y?(y[M>>3]&1<<(M&7))===0:h.kind==="object"?h.values[M]===null:!1;this.#E(p+M,D?null:f(h,M))}this.#y++}touch(){this.#y++}columnarise(h,p){if(this.#l||this.#O)return;const b=new Array(p);for(let O=0;O<p;O++)b[O]=this.#M(O);this.#t=this.#n,this.#l=!0,this.#S(h);for(let O=0;O<p;O++)this.#E(O,b[O]);this.#A.clear(),this.#w=null,this.#T(),this.#y++}grow(h){if(!(!this.#l||this.#O||h<=this.#b)){switch(this.#t){case"float64":case"int32":case"dictionary":{const p=new this.#a.constructor(h);p.set(this.#a),this.#a=p;break}case"bitset":this.#c.grow(h);break;case"multi":break;default:this.#a.length=h;break}this.#g&&this.#g.grow(h),this.#b=h,this.#y++}}convert(h){if(this.#O||!a.has(h)||(this.#n=h,!this.#l||h===this.#t))return!1;const p={kind:this.#t,buf:this.#a,bits:this.#c,mv:this.#u,dict:this.#f},b=this.#i.physical(),O=this.#g;this.#t=h,this.#S(this.#b);for(let y=0;y<b;y++){const L=O!==null&&O.get(y)===0;L&&h!=="multi"||this.#E(y,L?null:o(p,y))}return this.#T(),this.#y++,!0}compact(h,p,b){if(!this.#O){if(this.#T(),!this.#l){const O=this.#A;if(O.size){const y=new Map;for(const[L,M]of O)h[L]!==d&&y.set(h[L],M);this.#A=y}this.#w=null,this.#y++;return}switch(this.#t){case"float64":case"int32":case"dictionary":case"object":{const O=this.#a;for(let y=0;y<p;y++)h[y]!==d&&(O[h[y]]=O[y]);if(this.#t==="object")for(let y=b;y<p;y++)O[y]=void 0;break}case"bitset":{const O=this.#c;for(let y=0;y<p;y++)h[y]!==d&&O.assign(h[y],O.get(y)===1);for(let y=b;y<p;y++)O.clear(y);break}case"multi":this.#u.compact(h,b,d);break;default:break}if(this.#g){const O=this.#g;for(let y=0;y<p;y++)h[y]!==d&&O.assign(h[y],O.get(y)===1);for(let y=b;y<p;y++)O.clear(y)}this.#y++}}release(){this.#O||(this.#O=!0,this.#a=null,this.#c&&this.#c.release(),this.#c=null,this.#u&&this.#u.release(),this.#u=null,this.#g&&this.#g.release(),this.#g=null,this.#f=null,this.#d=null,this.#A=new Map,this.#w=null,this.#b=0,this.#y++)}#S(h){const p=Math.max(1,h);switch(this.#a=null,this.#c=null,this.#u=null,this.#t){case"float64":this.#a=new Float64Array(p);break;case"int32":this.#a=new Int32Array(p);break;case"bitset":this.#c=new B(p);break;case"dictionary":this.#a=new Uint32Array(p),this.#f=this.#f??new G(this.#o??[]);break;case"multi":this.#u=new k({rows:p,values:p}),this.#f=this.#f??new G(this.#o??[]);break;default:this.#a=new Array(p);break}this.#t!=="dictionary"&&this.#t!=="multi"&&(this.#f=null),this.#r&&(this.#g?this.#g.grow(p):this.#g=new B(p)),this.#b=p}#E(h,p){const b=s(p);switch(this.#r?this.#g.assign(h,!b):b&&E(`store.null.${this.#e}`,`column "${this.#e}" is declared non-nullable but received null; storing a filler value`),this.#t){case"float64":this.#a[h]=b?NaN:t(p);break;case"int32":this.#a[h]=b?0:u(p);break;case"bitset":this.#c.assign(h,!b&&!!p);break;case"dictionary":this.#a[h]=b?0:this.#f.codeOf(p);break;case"multi":{const O=r(p),y=new Array(O.length);for(let L=0;L<O.length;L++)y[L]=this.#f.codeOf(O[L]);this.#u.write(h,y);break}default:this.#a[h]=b?null:p;break}}#M(h){if(this.#A.has(h))return this.#A.get(h);const p=this.#s(this.#i.rowAt(h));return p===void 0?null:p}#P(){if(this.#w&&this.#w.version===this.#y)return this.#w;const h=this.#i.physical(),p=new Array(h),b=this.#r?new B(h):null;for(let O=0;O<h;O++){const y=this.#M(O);p[O]=y,b&&!s(y)&&b.set(O)}return this.#w={version:this.#y,values:p,presence:b},this.#w}}class m{#e;#t=new Map;#n=[];#r=[];#s=0;#i=0;#o=0;#l=0;#a=new B(0);#c=!1;#u=!0;#f;#d;#h;#p=!1;constructor(h,p={}){this.#e=Array.isArray(h)?h:[],this.#d=Math.max(1,p.initialCapacity??l),this.#u=p.retainSource!==!1,this.#f=this.#u?p.columnarBelow??i:0,this.#h=p.compactRatio??n;const b={rowAt:O=>this.#r[O],physical:()=>this.#s};for(const O of this.#e){if(!O||!O.id)continue;if(this.#t.has(O.id)){E(`store.dup.${O.id}`,`duplicate column id "${O.id}" in the store schema; ignoring the second`);continue}const y=new w(O,b);this.#t.set(O.id,y),this.#n.push(y)}this.#f<=0&&this.#b()}get count(){return this.#o}get physical(){return this.#s}get capacity(){return this.#c?this.#i:this.#r.length}get tombstones(){return this.#l}get columnar(){return this.#c}get destroyed(){return this.#p}get bytes(){let h=this.#a.bytes+this.#r.length*8;for(const p of this.#n)h+=p.bytes;return h}append(h){const p=this.#s;if(this.#p||!h)return{from:p,to:p};const b=h.length|0;if(b===0)return{from:p,to:p};if(this.#u)for(let y=0;y<b;y++)this.#r[p+y]=h[y];if(this.#s=p+b,this.#o+=b,this.#a.grow(this.#s),!this.#c){if(this.#s>=this.#f)this.#b();else for(const y of this.#n)y.touch();return{from:p,to:this.#s}}this.#m(this.#s);const O=this.#n;for(let y=0;y<O.length;y++)O[y].appendColumn(h,p,b);return{from:p,to:this.#s}}appendPacked(h,p){const b=this.#s;if(this.#p||!h)return{from:b,to:b};const O=h.count|0;if(O===0)return{from:b,to:b};if(this.#u&&p)for(let L=0;L<O;L++)this.#r[b+L]=p[L];this.#s=b+O,this.#o+=O,this.#a.grow(this.#s),this.#c||this.#b(),this.#m(this.#s);const y=new Map;for(const L of h.columns)y.set(L.id,L);for(const L of this.#n){const M=y.get(L.id);M?L.appendPacked(M,b,O):L.grow(this.#i)}return{from:b,to:this.#s}}source(h){if(this.#u)return this.#r[h];if(!(h<0||h>=this.#s))return this.#g(h)}setSource(h,p){this.#p||h<0||h>=this.#s||this.#u&&(this.#r[h]=p)}get(h,p){const b=this.#t.get(h);return b?b.get(p):void 0}set(h,p,b){if(this.#p||p<0||p>=this.#s)return;const O=this.#t.get(h);if(!O){E(`store.set.${h}`,`set() on unknown column "${h}"`);return}O.set(p,b)}remove(h){return this.#p||h<0||h>=this.#s||this.#a.get(h)===1?!1:(this.#a.set(h),this.#l++,this.#o--,!0)}live(h){return h<0||h>=this.#s?!1:this.#a.get(h)===0}compact(h={}){if(this.#p||this.#l===0||!h.force&&this.#l/this.#s<this.#h)return null;const p=this.#s,b=new Uint32Array(p);let O=0;for(let y=0;y<p;y++)b[y]=this.#a.get(y)===1?d:O++;for(const y of this.#n)y.compact(b,p,O);if(this.#u){const y=this.#r;for(let L=0;L<p;L++)b[L]!==d&&(y[b[L]]=y[L]);y.length=O}return this.#s=O,this.#o=O,this.#l=0,this.#a=new B(Math.max(this.#i,O)),b}column(h){return this.#t.get(h)}columns(){return this.#n.slice()}liveIndices(){const h=new Uint32Array(this.#o);if(this.#l===0){for(let b=0;b<this.#s;b++)h[b]=b;return h}let p=0;for(let b=0;b<this.#s;b++)this.#a.get(b)===0&&(h[p++]=b);return h}convert(h,p){const b=this.#t.get(h);return b?b.convert(p):!1}destroy(){if(!this.#p){this.#p=!0;for(const h of this.#n)h.release();this.#t.clear(),this.#n.length=0,this.#r.length=0,this.#a.release(),this.#s=0,this.#o=0,this.#l=0,this.#i=0}}#m(h){if(h<=this.#i)return;let p=this.#i||this.#d;for(;p<h;)p*=2;for(const b of this.#n)b.grow(p);this.#a.grow(p),this.#i=p}#g(h){const p={};for(const b of this.#n)p[b.id]=b.get(h);return p}#b(){if(this.#c)return;let h=this.#d;for(;h<this.#s;)h*=2;this.#c=!0,this.#i=h,this.#a.grow(h);for(const p of this.#n)p.columnarise(h,this.#s)}}}),Ue("packages/core/src/store/pool.js",function(e,U){"use strict";Object.defineProperty(e,"MaskPool",{enumerable:!0,get:function(){return z}}),Object.defineProperty(e,"sharedPool",{enumerable:!0,get:function(){return _}});const te=64,E=8;function q(X){let B=te;for(;B<X;)B*=2;return B}class z{#e=new Map;#t=new WeakSet;#n;#r=0;#s={acquired:0,reused:0,released:0};constructor(B={}){this.#n=B.limit??E}get bytes(){return this.#r}mask(B){const Y=new Uint8Array(this.#i(B),0,B);return Y.fill(0),Y}indices(B){return new Uint32Array(this.#i(B*4),0,B)}release(B){if(!B||!B.buffer)return!1;const Y=B.buffer;if(!this.#t.has(Y))return!1;this.#t.delete(Y),this.#s.released++;const G=Y.byteLength;let j=this.#e.get(G);return j||this.#e.set(G,j=[]),j.length>=this.#n||(j.push(Y),this.#r+=G),!0}releaseAll(B){for(const Y of B)this.release(Y)}clear(){this.#e.clear(),this.#r=0}stats(){return{...this.#s,retained:this.#r}}#i(B){const Y=q(B),G=this.#e.get(Y);this.#s.acquired++;let j;return G&&G.length?(j=G.pop(),this.#r-=Y,this.#s.reused++):j=new ArrayBuffer(Y),this.#t.add(j),j}}function _(){return Z??=new z,Z}let Z=null}),Ue("packages/core/src/compute/sortspec.js",function(e,U){"use strict";Object.defineProperty(e,"collationDescriptor",{enumerable:!0,get:function(){return te}}),Object.defineProperty(e,"isPortableSort",{enumerable:!0,get:function(){return E}}),Object.defineProperty(e,"isPortableSortSet",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"describeSortEntry",{enumerable:!0,get:function(){return z}}),Object.defineProperty(e,"describeSort",{enumerable:!0,get:function(){return _}});function te(Z){return{locale:Z===void 0?void 0:String(Z),numeric:!0,sensitivity:"variant"}}function E(Z){return!!Z&&typeof Z.compare!="function"}function q(Z){if(!Z)return!0;for(let X=0;X<Z.length;X++)if(!E(Z[X]))return!1;return!0}function z(Z,X){const B=Z.col!==void 0?Z.col:Z.handle&&Z.handle.id,Y=Z.locale!==void 0?Z.locale:X;return{col:B,descending:Z.descending!==void 0?!!Z.descending:Z.dir==="desc",nullsFirst:!!Z.nullsFirst,collation:te(Y)}}function _(Z,X){const B=Z||[],Y=new Array(B.length);for(let G=0;G<B.length;G++)Y[G]=z(B[G],X);return Y}}),Ue("packages/core/src/compute/facet.js",function(e,U){"use strict";Object.defineProperty(e,"STRATEGIES",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"GRANULARITIES",{enumerable:!0,get:function(){return X}}),Object.defineProperty(e,"DEFAULT_BUCKETS",{enumerable:!0,get:function(){return B}}),Object.defineProperty(e,"DEFAULT_CARDINALITY_LIMIT",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(e,"QUANTILE_SAMPLE",{enumerable:!0,get:function(){return G}}),Object.defineProperty(e,"facetKind",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"orderedReader",{enumerable:!0,get:function(){return k}}),Object.defineProperty(e,"toNumeric",{enumerable:!0,get:function(){return g}}),Object.defineProperty(e,"cardinalityOf",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"pickGranularity",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"floorTo",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"advance",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"computeBounds",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"countInto",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"bucketOf",{enumerable:!0,get:function(){return v}}),Object.defineProperty(e,"facet",{enumerable:!0,get:function(){return h}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return p}});const te=U("packages/core/src/compute/handle.js"),E=te.presenceReader,q=te.valueReader,z=te.dictSize,_=te.dictValue,Z=Object.freeze(["equal","quantile","log"]),X=Object.freeze(["hour","day","week","month","quarter","year"]),B=20,Y=50,G=1e4;function j(b,O){if(!b)return"none";const y=O;if(y&&(y.multi===!0||typeof y.items=="function"))return"category";const L=O&&O.base;if(L==="date"||L==="datetime"||L==="time"||L==="dateString")return"date";switch(b.kind){case"bitset":return"boolean";case"float64":case"int32":return"numeric";case"dictionary":return"category";case"multi":return"category";default:return L==="number"?"numeric":L==="boolean"?"boolean":L==="text"?"category":"none"}}function k(b){const O=b.values,y=b.kind;if((y==="float64"||y==="int32")&&O)return M=>O[M];const L=q(b);return M=>g(L(M))}function g(b){if(typeof b=="number")return b;if(b instanceof Date)return b.getTime();if(b==null||b==="")return NaN;if(typeof b=="boolean")return b?1:0;if(typeof b=="string"){const O=Number(b);if(Number.isFinite(O))return O;const y=Date.parse(b);return Number.isFinite(y)?y:NaN}return NaN}function c(b,O,y,L=Y){if(!b)return{cardinality:0,exact:!0};if(b.dict)return{cardinality:z(b.dict),exact:!0};if(b.kind==="bitset")return{cardinality:2,exact:!0};const M=q(b),D=O?O.length:y,F=new Set;for(let T=0;T<D;T++){const I=M(O?O[T]:T);if(I!=null&&(F.add(I),F.size>L))return{cardinality:F.size,exact:!1}}return{cardinality:F.size,exact:!0}}const d=36e5,l=864e5;function i(b,O=B){const y=Number.isFinite(b)&&b>0?b:0,L=Math.max(1,O)*2;return y/d<=L?"hour":y/l<=L?"day":y/(7*l)<=L?"week":y/(30*l)<=L?"month":y/(91*l)<=L?"quarter":"year"}function n(b,O){if(!Number.isFinite(b))return NaN;const y=new Date(b);switch(O){case"hour":return y.setMinutes(0,0,0),y.getTime();case"day":return y.setHours(0,0,0,0),y.getTime();case"week":{y.setHours(0,0,0,0);const L=(y.getDay()+6)%7;return y.setDate(y.getDate()-L),y.getTime()}case"month":return y.setDate(1),y.setHours(0,0,0,0),y.getTime();case"quarter":return y.setMonth(Math.floor(y.getMonth()/3)*3,1),y.setHours(0,0,0,0),y.getTime();default:return y.setMonth(0,1),y.setHours(0,0,0,0),y.getTime()}}function a(b,O){const y=new Date(b);switch(O){case"hour":y.setHours(y.getHours()+1);break;case"day":y.setDate(y.getDate()+1);break;case"week":y.setDate(y.getDate()+7);break;case"month":y.setMonth(y.getMonth()+1);break;case"quarter":y.setMonth(y.getMonth()+3);break;default:y.setFullYear(y.getFullYear()+1);break}return y.getTime()}function s(b,O,y){const L=k(b),M=E(b),D=O?O.length:y;let F=1/0,T=-1/0,I=0,P=0;for(let R=0;R<D;R++){const $=O?O[R]:R;if(M&&!M($)){I++;continue}const C=L($);if(!Number.isFinite(C)){I++;continue}C<F&&(F=C),C>T&&(T=C),P++}return{min:F,max:T,nulls:I,finite:P}}function t(b,O,y,L){const M=k(b),D=E(b),F=O?O.length:y,T=F>L?F/L:1,I=[];for(let R=0;R<F;R+=T){const $=O?O[Math.floor(R)]:Math.floor(R);if(D&&!D($))continue;const C=M($);Number.isFinite(C)&&I.push(C)}const P=Float64Array.from(I);return P.sort(),P}function u(b,O,y,L={}){const M=L.kind||j(b,L.type);return M==="none"||!b?{kind:"none",buckets:[],suppressed:"type"}:M==="boolean"?r(b,O,y):M==="category"?o(b,O,y,L):f(b,O,y,M,L)}function r(b,O,y){const L=E(b);let M=0;if(L){const F=O?O.length:y;for(let T=0;T<F;T++)L(O?O[T]:T)||M++}const D=[{value:!1,label:"false"},{value:!0,label:"true"}];return M>0&&D.push({null:!0,label:"Empty"}),{kind:"boolean",buckets:D}}function o(b,O,y,L){const M=L.cardinalityLimit??Y,{cardinality:D}=c(b,O,y,M);if(D>M&&(L.aboveLimit||"suppress")==="suppress")return{kind:"category",buckets:[],suppressed:"cardinality",cardinality:D};const F=q(b),T=O?O.length:y,I=new Map;let P=0;for(let S=0;S<T;S++){const x=F(O?O[S]:S);if(x==null||x===""){P++;continue}if(Array.isArray(x)){if(!x.length){P++;continue}for(const H of x)I.set(H,(I.get(H)||0)+1);continue}I.set(x,(I.get(x)||0)+1)}let R=[...I.entries()];L.order==="alpha"?R.sort((S,x)=>String(S[0]).localeCompare(String(x[0]))):R.sort((S,x)=>x[1]-S[1]);let $=0,C=0;if(R.length>M){C=R.length-M;for(let S=M;S<R.length;S++)$+=R[S][1];R=R.slice(0,M)}const A=R.map(([S])=>({value:S,label:String(S)}));return $>0&&A.push({remainder:!0,label:`Other (${C} values)`}),P>0&&A.push({null:!0,label:"Empty"}),{kind:"category",buckets:A,cardinality:D}}function f(b,O,y,L,M){const{min:D,max:F,nulls:T,finite:I}=s(b,O,y);if(!I)return{kind:L,buckets:T?[{null:!0,label:"Empty"}]:[],empty:!0};const P=Math.max(1,Math.floor(M.buckets||B));let R=[];if(L==="date"){const C=X.includes(M.granularity)?M.granularity:i(F-D,P);let A=n(D,C);for(;A<=F&&R.length<4096;){const S=a(A,C);if(!(S>A))break;R.push({from:A,to:S}),A=S}return{kind:L,buckets:w(R,T),granularity:C}}const $=Z.includes(M.strategy)?M.strategy:"equal";if($==="quantile"){const C=t(b,O,y,G);if(C.length){const A=[C[0]];for(let S=1;S<P;S++){const x=C[Math.min(C.length-1,Math.floor(S/P*C.length))];x>A[A.length-1]&&A.push(x)}A.push(F);for(let S=0;S<A.length-1;S++)R.push({from:A[S],to:A[S+1]})}}else if($==="log"&&D>0){const C=Math.log10(D),S=(Math.log10(F)-C)/P||1;for(let x=0;x<P;x++)R.push({from:10**(C+x*S),to:10**(C+(x+1)*S)})}if(!R.length){const C=(F-D)/P||1;for(let A=0;A<P;A++)R.push({from:D+A*C,to:D+(A+1)*C})}return R[R.length-1].to=F,{kind:L,buckets:w(R,T),strategy:$,min:D,max:F}}function w(b,O){return O>0?[...b,{null:!0,label:"Empty"}]:b}function m(b,O,y,L,M){const D=L&&L.buckets||[],F=M&&M.length>=D.length?M.subarray(0,D.length):new Uint32Array(D.length);if(F.fill(0),!b||!D.length)return F;const T=D.length-1,I=!!D[T]&&D[T].null===!0,P=O?O.length:y;if(L.kind==="boolean"){const S=q(b);for(let x=0;x<P;x++){const H=S(O?O[x]:x);if(H==null){I&&F[T]++;continue}F[H?1:0]++}return F}if(L.kind==="category"){const S=new Map;for(let V=0;V<D.length;V++)!D[V].null&&!D[V].remainder&&S.set(D[V].value,V);const x=D.findIndex(V=>V.remainder),H=q(b);for(let V=0;V<P;V++){const W=H(O?O[V]:V);if(W==null||W===""){I&&F[T]++;continue}if(Array.isArray(W)){if(!W.length){I&&F[T]++;continue}for(const ee of W){const re=S.get(ee);re!==void 0?F[re]++:x>=0&&F[x]++}continue}const Q=S.get(W);Q!==void 0?F[Q]++:x>=0&&F[x]++}return F}const R=I?D.length-1:D.length,$=new Float64Array(R+1);for(let S=0;S<R;S++)$[S]=D[S].from;$[R]=R?D[R-1].to:0;const C=k(b),A=E(b);for(let S=0;S<P;S++){const x=O?O[S]:S;if(A&&!A(x)){I&&F[T]++;continue}const H=C(x);if(!Number.isFinite(H)){I&&F[T]++;continue}const V=v($,R,H);V>=0&&F[V]++}return F}function v(b,O,y){if(!O||y<b[0])return-1;if(y>=b[O])return y===b[O]?O-1:-1;let L=0,M=O-1;for(;L<M;){const D=L+M+1>>>1;y>=b[D]?L=D:M=D-1}return L}function h(b,O,y,L={}){const M=L.bounds||u(b,L.boundsIndices??O,y,L);return{bounds:M,counts:m(b,O,y,M)}}const p=h}),Ue("packages/core/src/compute/pivotmatrix.js",function(e,U){"use strict";Object.defineProperty(e,"GRAND_PATH",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"resolveAxis",{enumerable:!0,get:function(){return k}}),Object.defineProperty(e,"pivotMatrix",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"cellKey",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"marginKey",{enumerable:!0,get:function(){return n}});const E=U("packages/core/src/compute/handle.js").valueComparator,z=U("packages/core/src/compute/total.js").total,Z=U("packages/core/src/compute/group.js").packKeys,X=U("packages/core/src/compute/pivot.js"),B=X.joinPath,Y=X.DEFAULT_PATH_SEPARATOR,G=X.DEFAULT_MAX_COLUMNS,j="";function k(a,s,t={}){const u=t.separator||Y,r=a||[],o=s instanceof Uint32Array?s:Uint32Array.from(s||[]),f=o.length;if(r.length===0)return{tuples:[[]],paths:[j],buckets:[o]};const{keyOf:w,readers:m}=Z(r,o,0),v=new Map,h=[],p=[],b=[];for(let F=0;F<f;F++){const T=o[F],I=w(T);let P=v.get(I);if(P===void 0){P=h.length,v.set(I,P),p.push(I);const R=new Array(m.length);for(let $=0;$<m.length;$++)R[$]=m[$](T);h.push(R),b.push([])}b[P].push(T)}const O=E(t.locale),y=h.map((F,T)=>T);y.sort((F,T)=>{const I=h[F],P=h[T];for(let R=0;R<I.length;R++){const $=g(I[R],P[R],O);if($!==0)return $}return F-T});const L=new Array(y.length),M=new Array(y.length),D=new Array(y.length);for(let F=0;F<y.length;F++){const T=y[F];L[F]=h[T],M[F]=B(h[T],u),D[F]=Uint32Array.from(b[T])}return{tuples:L,paths:M,buckets:D}}function g(a,s,t){const u=a==null,r=s==null;return u||r?u&&r?0:u?1:-1:t(a,s)}function c(a,s,t){const u=[];for(let r=0;r<a.length;r++)t.has(a[r])&&u.push(a[r]);return Uint32Array.from(u)}function d(a,s,t,u){return{value:s.length?z(a,s,t,u):null,leaves:s,count:s.length}}function l(a){const s=a&&a.opts||{},t=s.separator||Y,u=s.totalContext||{locale:s.locale},r=(a.measures||[]).filter(M=>M&&M.handle),o=a.leaves instanceof Uint32Array?a.leaves:Uint32Array.from(a.leaves||[]),f=k(a.rowHandles||[],o,{...s,separator:t}),w=k(a.columnHandles||[],o,{...s,separator:t}),m=s.maxColumns===void 0?G:s.maxColumns,v=w.paths.length*Math.max(1,r.length),h=new Map;if(m&&v>m)return{rowAxis:f,columnAxis:w,measures:r.map(M=>({colId:M.colId,fn:M.fn})),body:h,rowMargin:h,columnMargin:h,grand:h,columns:v,error:{code:"pivot-max-columns",message:`[lattice] pivot would generate ${v} columns, above pivot.maxColumns of ${m}. Narrow the pivot columns or raise the limit.`,columns:v,maxColumns:m}};const p=new Map,b=new Map,O=new Map,y=new Map,L=w.buckets.map(M=>new Set(M));for(let M=0;M<w.paths.length;M++){const D=w.buckets[M],F=w.paths[M];for(const T of r)O.set(n(F,T.colId),d(T.handle,D,T.fn,u))}for(let M=0;M<f.paths.length;M++){const D=f.buckets[M],F=f.paths[M];for(const T of r)b.set(n(F,T.colId),d(T.handle,D,T.fn,u));for(let T=0;T<w.paths.length;T++){const I=c(D,w.buckets[T],L[T]);if(I.length===0)continue;const P=w.paths[T];for(const R of r)p.set(i(F,P,R.colId),d(R.handle,I,R.fn,u))}}for(const M of r)y.set(M.colId,d(M.handle,o,M.fn,u));return{rowAxis:f,columnAxis:w,measures:r.map(M=>({colId:M.colId,fn:M.fn})),body:p,rowMargin:b,columnMargin:O,grand:y,columns:v,error:null}}function i(a,s,t){return`${a}\0${s}\0${t}`}function n(a,s){return`${a}\0${s}`}}),Ue("packages/core/src/compute/reference.js",function(e,U){"use strict";Object.defineProperty(e,"referenceValue",{enumerable:!0,get:function(){return G}}),Object.defineProperty(e,"referenceSort",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"referenceFilter",{enumerable:!0,get:function(){return g}}),Object.defineProperty(e,"referencePasses",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"referenceGroup",{enumerable:!0,get:function(){return d}}),Object.defineProperty(e,"referenceTotal",{enumerable:!0,get:function(){return l}});const E=U("packages/core/src/internal/paths.js").getPath,q=U("packages/core/src/compute/handle.js"),z=q.isMissing,_=q.valueComparator,X=U("packages/core/src/compute/filter.js").testValue,B="",Y="\0";function G(a,s){const t=s.includes(".")?E(a,s):a?.[s];return t===void 0?null:t}function j(a,s,t={}){const u=s||[];let r=a.map((o,f)=>f);if(u.length===0)return r;for(let o=u.length-1;o>=0;o--)r=k(a,r,u[o],t);return r}function k(a,s,t,u){const r=t.locale!==void 0?t.locale:u.locale,o=_(r),f=t.descending!==void 0?!!t.descending:t.dir==="desc",w=[],m=[];for(const p of s){const b=G(a[p],t.col);z(b)?m.push(p):w.push(p)}const v=new Map;for(let p=0;p<w.length;p++)v.set(w[p],p);const h=(p,b)=>{const O=G(a[p],t.col),y=G(a[b],t.col);let L;return typeof t.compare=="function"?(L=t.compare(O,y,a[p],a[b],f),f&&(L=-L)):L=f?o(y,O):o(O,y),L!==0?L:v.get(p)-v.get(b)};return w.sort(h),t.nullsFirst?m.concat(w):w.concat(m)}function g(a,s,t={}){const u=[];for(let r=0;r<a.length;r++)c(a[r],s,t,r)&&u.push(r);return u}function c(a,s,t,u){if(!s)return!0;if(Array.isArray(s.conditions)){const r=s.conditions.filter(f=>f!=null);if(r.length===0)return!0;if(s.op==="or")return r.some(f=>c(a,f,t,u));const o=r.every(f=>c(a,f,t,u));return s.op==="not"?!o:o}return s.col===void 0&&typeof t.custom=="function"?!!t.custom(s,a,u):X(G(a,s.col),s,t.locale)}function d(a,s,t,u){const r=t||a.map((m,v)=>v),o=new Map,f=[],w=[];for(const m of r){const v=s.map((b,O)=>{const y=G(a[m],b);return u&&u[O]?u[O](y):y}),h=v.map(b=>b==null?Y:String(b)).join(B);let p=o.get(h);p===void 0&&(p=f.length,o.set(h,p),f.push(v),w.push([])),w[p].push(m)}return{keys:f,buckets:w}}function l(a,s,t={}){const u=_(t.locale),r=a.filter(f=>!z(f)),o=r.map(i).filter(f=>f!==null);switch(s){case"count":return a.length;case"countValues":return r.length;case"sum":return o.reduce((f,w)=>f+w,0);case"avg":return r.length===0?null:o.reduce((f,w)=>f+w,0)/r.length;case"min":return r.length===0?null:r.reduce((f,w)=>u(w,f)<0?w:f);case"max":return r.length===0?null:r.reduce((f,w)=>u(w,f)>0?w:f);case"first":return a.length===0?null:n(a[0]);case"last":return a.length===0?null:n(a[a.length-1]);default:return null}}function i(a){if(typeof a=="number")return Number.isNaN(a)?null:a;if(a==null||a===""||typeof a=="boolean")return null;if(a instanceof Date)return a.getTime();const s=Number(a);return Number.isNaN(s)?null:s}function n(a){return a===void 0?null:a}}),Ue("packages/core/src/compute/index.js",function(e,U){"use strict";const te=U("packages/core/src/compute/sort.js");Object.defineProperty(e,"sortColumn",{enumerable:!0,get:function(){return te.sortColumn}}),Object.defineProperty(e,"sortMulti",{enumerable:!0,get:function(){return te.sortMulti}}),Object.defineProperty(e,"radixSortFloat64",{enumerable:!0,get:function(){return te.radixSortFloat64}}),Object.defineProperty(e,"radixSortInt32",{enumerable:!0,get:function(){return te.radixSortInt32}}),Object.defineProperty(e,"rankSortDictionary",{enumerable:!0,get:function(){return te.rankSortDictionary}}),Object.defineProperty(e,"mergeSortComparator",{enumerable:!0,get:function(){return te.mergeSortComparator}}),Object.defineProperty(e,"collateStringRanks",{enumerable:!0,get:function(){return te.collateStringRanks}}),Object.defineProperty(e,"rankSortStrings",{enumerable:!0,get:function(){return te.rankSortStrings}});const E=U("packages/core/src/compute/sortspec.js");Object.defineProperty(e,"collationDescriptor",{enumerable:!0,get:function(){return E.collationDescriptor}}),Object.defineProperty(e,"isPortableSort",{enumerable:!0,get:function(){return E.isPortableSort}}),Object.defineProperty(e,"isPortableSortSet",{enumerable:!0,get:function(){return E.isPortableSortSet}}),Object.defineProperty(e,"describeSortEntry",{enumerable:!0,get:function(){return E.describeSortEntry}}),Object.defineProperty(e,"describeSort",{enumerable:!0,get:function(){return E.describeSort}});const q=U("packages/core/src/compute/filter.js");Object.defineProperty(e,"evaluateFilters",{enumerable:!0,get:function(){return q.evaluateFilters}}),Object.defineProperty(e,"evaluateCondition",{enumerable:!0,get:function(){return q.evaluateCondition}}),Object.defineProperty(e,"compact",{enumerable:!0,get:function(){return q.compact}}),Object.defineProperty(e,"testValue",{enumerable:!0,get:function(){return q.testValue}}),Object.defineProperty(e,"compilePredicate",{enumerable:!0,get:function(){return q.compilePredicate}}),Object.defineProperty(e,"releaseMask",{enumerable:!0,get:function(){return q.releaseMask}}),Object.defineProperty(e,"pruneColumn",{enumerable:!0,get:function(){return q.pruneColumn}}),Object.defineProperty(e,"mentionsColumn",{enumerable:!0,get:function(){return q.mentionsColumn}});const z=U("packages/core/src/compute/group.js");Object.defineProperty(e,"groupByColumns",{enumerable:!0,get:function(){return z.groupByColumns}}),Object.defineProperty(e,"packKeys",{enumerable:!0,get:function(){return z.packKeys}});const _=U("packages/core/src/compute/facet.js");Object.defineProperty(e,"facet",{enumerable:!0,get:function(){return _.facet}}),Object.defineProperty(e,"computeBounds",{enumerable:!0,get:function(){return _.computeBounds}}),Object.defineProperty(e,"countInto",{enumerable:!0,get:function(){return _.countInto}}),Object.defineProperty(e,"bucketOf",{enumerable:!0,get:function(){return _.bucketOf}}),Object.defineProperty(e,"facetKind",{enumerable:!0,get:function(){return _.facetKind}}),Object.defineProperty(e,"cardinalityOf",{enumerable:!0,get:function(){return _.cardinalityOf}}),Object.defineProperty(e,"pickGranularity",{enumerable:!0,get:function(){return _.pickGranularity}}),Object.defineProperty(e,"floorTo",{enumerable:!0,get:function(){return _.floorTo}}),Object.defineProperty(e,"advance",{enumerable:!0,get:function(){return _.advance}}),Object.defineProperty(e,"STRATEGIES",{enumerable:!0,get:function(){return _.STRATEGIES}}),Object.defineProperty(e,"GRANULARITIES",{enumerable:!0,get:function(){return _.GRANULARITIES}}),Object.defineProperty(e,"DEFAULT_BUCKETS",{enumerable:!0,get:function(){return _.DEFAULT_BUCKETS}}),Object.defineProperty(e,"DEFAULT_CARDINALITY_LIMIT",{enumerable:!0,get:function(){return _.DEFAULT_CARDINALITY_LIMIT}}),Object.defineProperty(e,"QUANTILE_SAMPLE",{enumerable:!0,get:function(){return _.QUANTILE_SAMPLE}});const Z=U("packages/core/src/compute/total.js");Object.defineProperty(e,"TOTAL_FNS",{enumerable:!0,get:function(){return Z.TOTAL_FNS}}),Object.defineProperty(e,"TOTAL_LABELS",{enumerable:!0,get:function(){return Z.TOTAL_LABELS}}),Object.defineProperty(e,"totalLabel",{enumerable:!0,get:function(){return Z.totalLabel}}),Object.defineProperty(e,"total",{enumerable:!0,get:function(){return Z.total}}),Object.defineProperty(e,"collectValues",{enumerable:!0,get:function(){return Z.collectValues}});const X=U("packages/core/src/compute/pivot.js");Object.defineProperty(e,"pivot",{enumerable:!0,get:function(){return X.pivot}}),Object.defineProperty(e,"resolvePivotKeys",{enumerable:!0,get:function(){return X.resolvePivotKeys}}),Object.defineProperty(e,"pivotKey",{enumerable:!0,get:function(){return X.pivotKey}}),Object.defineProperty(e,"joinPath",{enumerable:!0,get:function(){return X.joinPath}}),Object.defineProperty(e,"KEY_DELIMITER",{enumerable:!0,get:function(){return X.KEY_DELIMITER}}),Object.defineProperty(e,"DEFAULT_PATH_SEPARATOR",{enumerable:!0,get:function(){return X.DEFAULT_PATH_SEPARATOR}}),Object.defineProperty(e,"DEFAULT_MAX_COLUMNS",{enumerable:!0,get:function(){return X.DEFAULT_MAX_COLUMNS}});const B=U("packages/core/src/compute/pivotmatrix.js");Object.defineProperty(e,"pivotMatrix",{enumerable:!0,get:function(){return B.pivotMatrix}}),Object.defineProperty(e,"resolveAxis",{enumerable:!0,get:function(){return B.resolveAxis}}),Object.defineProperty(e,"cellKey",{enumerable:!0,get:function(){return B.cellKey}}),Object.defineProperty(e,"marginKey",{enumerable:!0,get:function(){return B.marginKey}}),Object.defineProperty(e,"GRAND_PATH",{enumerable:!0,get:function(){return B.GRAND_PATH}});const Y=U("packages/core/src/compute/reference.js");Object.defineProperty(e,"referenceSort",{enumerable:!0,get:function(){return Y.referenceSort}}),Object.defineProperty(e,"referenceFilter",{enumerable:!0,get:function(){return Y.referenceFilter}}),Object.defineProperty(e,"referenceGroup",{enumerable:!0,get:function(){return Y.referenceGroup}}),Object.defineProperty(e,"referenceTotal",{enumerable:!0,get:function(){return Y.referenceTotal}}),Object.defineProperty(e,"referencePasses",{enumerable:!0,get:function(){return Y.referencePasses}}),Object.defineProperty(e,"referenceValue",{enumerable:!0,get:function(){return Y.referenceValue}});const G=U("packages/core/src/compute/handle.js");Object.defineProperty(e,"identity",{enumerable:!0,get:function(){return G.identity}}),Object.defineProperty(e,"rowCount",{enumerable:!0,get:function(){return G.rowCount}}),Object.defineProperty(e,"presenceReader",{enumerable:!0,get:function(){return G.presenceReader}}),Object.defineProperty(e,"bitReader",{enumerable:!0,get:function(){return G.bitReader}}),Object.defineProperty(e,"valueReader",{enumerable:!0,get:function(){return G.valueReader}}),Object.defineProperty(e,"valueComparator",{enumerable:!0,get:function(){return G.valueComparator}}),Object.defineProperty(e,"numericTotalOrder",{enumerable:!0,get:function(){return G.numericTotalOrder}}),Object.defineProperty(e,"dictRanks",{enumerable:!0,get:function(){return G.dictRanks}}),Object.defineProperty(e,"dictSize",{enumerable:!0,get:function(){return G.dictSize}}),Object.defineProperty(e,"dictValue",{enumerable:!0,get:function(){return G.dictValue}}),Object.defineProperty(e,"multiValue",{enumerable:!0,get:function(){return G.multiValue}}),Object.defineProperty(e,"isMissing",{enumerable:!0,get:function(){return G.isMissing}});const j=U("packages/core/src/compute/sketch.js");Object.defineProperty(e,"Welford",{enumerable:!0,get:function(){return j.Welford}}),Object.defineProperty(e,"Reservoir",{enumerable:!0,get:function(){return j.Reservoir}}),Object.defineProperty(e,"HyperLogLog",{enumerable:!0,get:function(){return j.HyperLogLog}}),Object.defineProperty(e,"SpaceSaving",{enumerable:!0,get:function(){return j.SpaceSaving}}),Object.defineProperty(e,"KLL",{enumerable:!0,get:function(){return j.KLL}}),Object.defineProperty(e,"hash32",{enumerable:!0,get:function(){return j.hash32}}),Object.defineProperty(e,"SKETCH_BOUNDS",{enumerable:!0,get:function(){return j.SKETCH_BOUNDS}});const k=U("packages/core/src/compute/windowed.js");Object.defineProperty(e,"Window",{enumerable:!0,get:function(){return k.Window}}),Object.defineProperty(e,"WINDOW_KINDS",{enumerable:!0,get:function(){return k.WINDOW_KINDS}}),Object.defineProperty(e,"openWindow",{enumerable:!0,get:function(){return k.openWindow}});const g=U("packages/core/src/compute/statistics.js");Object.defineProperty(e,"MAINTENANCE",{enumerable:!0,get:function(){return g.MAINTENANCE}}),Object.defineProperty(e,"APPROXIMATE",{enumerable:!0,get:function(){return g.APPROXIMATE}}),Object.defineProperty(e,"maintenanceOf",{enumerable:!0,get:function(){return g.maintenanceOf}});const c=U("packages/core/src/compute/anomaly.js");Object.defineProperty(e,"ANOMALY_METHODS",{enumerable:!0,get:function(){return c.ANOMALY_METHODS}}),Object.defineProperty(e,"modifiedZScores",{enumerable:!0,get:function(){return c.modifiedZScores}}),Object.defineProperty(e,"iqrFences",{enumerable:!0,get:function(){return c.iqrFences}}),Object.defineProperty(e,"mahalanobis",{enumerable:!0,get:function(){return c.mahalanobis}}),Object.defineProperty(e,"ROLLING_ANOMALY_METHODS",{enumerable:!0,get:function(){return c.ROLLING_ANOMALY_METHODS}}),Object.defineProperty(e,"rollingAnomalies",{enumerable:!0,get:function(){return c.rollingAnomalies}}),Object.defineProperty(e,"anomalyCondition",{enumerable:!0,get:function(){return c.anomalyCondition}});const d=U("packages/core/src/compute/forecast.js");Object.defineProperty(e,"FORECAST_METHODS",{enumerable:!0,get:function(){return d.FORECAST_METHODS}}),Object.defineProperty(e,"forecast",{enumerable:!0,get:function(){return d.forecast}})}),Ue("packages/core/src/source/rows.js",function(e,U){"use strict";Object.defineProperty(e,"DEFAULT_ROW_HEIGHT",{enumerable:!0,get:function(){return _}}),Object.defineProperty(e,"KEY_SEP",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"createRowFactory",{enumerable:!0,get:function(){return X}}),Object.defineProperty(e,"RowFactory",{enumerable:!0,get:function(){return B}}),Object.defineProperty(e,"pinnedRow",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(e,"lazyRowView",{enumerable:!0,get:function(){return G}}),Object.defineProperty(e,"groupPathElement",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"groupKey",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"groupPrefixKeys",{enumerable:!0,get:function(){return d}});const E=U("packages/core/src/internal/warn.js").warnOnce,z=U("packages/core/src/internal/predicates.js").isFunction,_=32,Z="\0";function X(l){return new B(l)}class B{#e;#t;constructor(i){this.#e=z(i&&i.rowKey)?i.rowKey:null;const n=i&&i.config?i.config.rowHeight:void 0;this.#t=typeof n=="number"||z(n)?n:_}get keyed(){return this.#e!==null}keyOf(i,n){if(this.#e){const a=this.#e(i);if(a!=null)return String(a)}else E("source.rowKey.missing","no config.rowKey; falling back to index identity.","Row changes, streaming dedupe, selection persistence and remote reload are disabled.");return`#${n}`}heightOf(i){return z(this.#t)?Number(this.#t(i))||_:this.#t}leaf(i,n,a=0,s=null){const t={key:this.keyOf(i,n),data:i,level:a,parent:s,group:!1,expanded:!1,leafCount:1,height:0,index:null,selected:!1,physical:n};return t.height=this.heightOf(t),t}group(i){const n={key:c(i.keyPath||i.path),data:null,level:i.level,parent:i.parent||null,children:[],group:!0,expanded:i.expanded!==!1,leafCount:i.leafCount||0,height:0,index:null,selected:!1,physical:null,groupColumn:i.column,groupValue:i.value,groupPath:i.path,hasChildren:i.hasChildren!==!1};return i.totals&&(n.totals=i.totals),n.height=this.heightOf(n),n}footer(i){const n={key:`${i.key}${Z}footer`,data:null,level:i.level,parent:i,group:!0,footer:!0,expanded:!1,leafCount:i.leafCount||0,height:0,index:null,selected:!1,physical:null,groupColumn:i.groupColumn,groupValue:i.groupValue,groupPath:i.groupPath,hasChildren:!1,totals:i.totals};return n.height=this.heightOf(n),n}detail(i,n){return{key:`${i.key}${Z}detail`,data:i.data,level:i.level+1,parent:i,group:!1,detail:!0,expanded:!1,leafCount:0,height:n,index:null,selected:!1,physical:null,hasChildren:!1,masterKey:i.key}}grandTotal(i,n){const a={key:`${Z}grandTotal`,data:null,level:0,parent:null,group:!0,grandTotal:!0,expanded:!1,leafCount:n,height:0,index:null,selected:!1,physical:null,groupPath:[],hasChildren:!1,totals:i};return a.height=this.heightOf(a),a}skeleton(i,n=0,a=!1){const s={key:`${Z}pending${Z}${i}`,data:null,level:n,parent:null,group:!1,expanded:!1,leafCount:1,height:0,index:i,selected:!1,physical:null,pending:!0};return a&&(s.loadError=!0),s.height=this.heightOf(s),s}}function Y(l,i,n,a){return{key:`${Z}pinned${Z}${n}${Z}${i}`,data:l,level:0,parent:null,group:!1,expanded:!1,leafCount:0,height:a,index:null,selected:!1,physical:null,hasChildren:!1,pinned:n}}function G(l,i){return new Proxy([],{get(n,a,s){if(a==="length")return l();if(typeof a=="string"){const t=Number(a);if(Number.isInteger(t)&&t>=0)return i(t)}return Reflect.get(n,a,s)},has(n,a){if(typeof a=="string"){const s=Number(a);if(Number.isInteger(s)&&s>=0)return s<l()}return Reflect.has(n,a)}})}function j(l){return l==null?"":String(l)}const k="";function g(l){if(l==null)return k;const i=String(l);return i.startsWith(k)?k+i:i}function c(l){const i=l||[];let n="g";for(let a=0;a<i.length;a++)n+=Z+g(i[a]);return n}function d(l){const i=new Array(l.length),n=[];for(let a=0;a<l.length;a++)n.push(l[a]),i[a]=c(n);return i}}),Ue("packages/core/src/source/handles.js",function(e,U){"use strict";Object.defineProperty(e,"HandleProvider",{enumerable:!0,get:function(){return _}}),Object.defineProperty(e,"createHandleProvider",{enumerable:!0,get:function(){return Z}});const E=U("packages/core/src/internal/predicates.js").isFunction,z=U("packages/core/src/internal/warn.js").warnOnce;class _{#e;#t;#n;#r=new Map;#s=0;constructor(B,Y,G){this.#e=B,this.#t=Y,this.#n=E(G)?G:()=>!1}get store(){const B=this.#e.store;return B&&E(B.column)?B:null}invalidate(){this.#s++}handle(B){const Y=this.store;if(Y){const g=Y.column(B);if(g)return g}const G=this.#r.get(B);if(G&&G.builtAt===this.#s)return G.handle;const j=this.#i(B);if(!j)return;if(Y&&this.#n()){z(`source.dropped.${B}`,`column "${B}" cannot be served under ingest.dropSourceRows: it is an impure computed column (a shadow or a positional/rank column) that is never stored, so it can only be read from the caller's row objects — which dropSourceRows has released. Do not sort, filter, group or total on such a column with dropSourceRows enabled.`);return}const k=this.#o(j);return this.#r.set(B,{handle:k,builtAt:this.#s}),k}#i(B){const Y=this.#e.columns;return Y&&E(Y.get)?Y.get(B):void 0}#o(B){const Y=this.#t()||[],G=Y.length,j=new Array(G),k=E(B.getValue)?c=>B.getValue(c):c=>c?.[B.field||B.id];for(let c=0;c<G;c++)j[c]=Y[c]===void 0?void 0:k(Y[c]);const g=this.#s;return{id:B.id,kind:"object",nullable:!1,values:j,presence:null,dict:null,offsets:null,get(c){return j[c]},version:g}}}function Z(X,B,Y){return new _(X,B,Y)}}),Ue("packages/core/src/compute/incremental.js",function(e,U){"use strict";Object.defineProperty(e,"INCREMENTAL_FNS",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"INCREMENTAL_KINDS",{enumerable:!0,get:function(){return z}}),Object.defineProperty(e,"MAGNITUDE_LIMIT",{enumerable:!0,get:function(){return _}}),Object.defineProperty(e,"isIncremental",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"RunningTotal",{enumerable:!0,get:function(){return B}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return Y}});const E=U("packages/core/src/store/columnstore.js").toFloat,q=Object.freeze(["sum","avg","countValues","min","max"]),z=Object.freeze(["float64"]),_=1e15;function Z(G,j){return typeof G!="string"||!q.includes(G)?!1:!!j&&z.includes(j.kind)}function X(G){if(G==null)return null;const j=E(G);return Number.isNaN(j)?null:j}class B{#e;#t=0;#n=0;#r=0;#s=1/0;#i=-1/0;#o=!1;#l=!1;constructor(j){this.#e=j}get valid(){return this.#o&&!this.#l}get fn(){return this.#e}seed(j){this.#a();for(let k=0;k<j.length;k++){const g=X(j[k]);g!==null&&this.#c(g)}this.#o=!0}seedColumn(j,k,g){this.#a();for(let c=0;c<g.length;c++){const d=g[c];if(k&&k(d)===0)continue;const l=j[d];Number.isNaN(l)||this.#c(l)}this.#o=!0}#a(){this.#t=0,this.#n=0,this.#r=0,this.#s=1/0,this.#i=-1/0,this.#l=!1}#c(j){if(!Number.isFinite(j)){this.#l=!0;return}const k=this.#t+j;this.#n+=Math.abs(this.#t)>=Math.abs(j)?this.#t-k+j:j-k+this.#t,this.#t=k,this.#r++,j<this.#s&&(this.#s=j),j>this.#i&&(this.#i=j)}#u(j){const k=this.#t-j;this.#n+=Math.abs(this.#t)>=Math.abs(j)?this.#t-k-j:-j-k+this.#t,this.#t=k,this.#r--}update(j,k){if(!this.#o)return!1;const g=X(j),c=X(k);return g===null&&c===null?!0:g!==null&&!Number.isFinite(g)||c!==null&&!Number.isFinite(c)?!1:this.#e==="min"||this.#e==="max"?g===null||c===null?!1:this.#e==="min"?c<this.#s?(this.#s=c,!0):g>this.#s:c>this.#i?(this.#i=c,!0):g<this.#i:Math.abs(this.#t)>_?!1:(g!==null&&this.#u(g),c!==null&&this.#c(c),!0)}value(){switch(this.#e){case"countValues":return this.#r;case"avg":return this.#r?(this.#t+this.#n)/this.#r:null;case"min":return this.#r?this.#s:null;case"max":return this.#r?this.#i:null;default:return this.#t+this.#n}}invalidate(){this.#o=!1}}const Y=B}),Ue("packages/core/src/source/filterwire.js",function(e,U){"use strict";Object.defineProperty(e,"HOST_FILTER_WARN_ID",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"WHERE_PAGE_RELATIVE_WARN_ID",{enumerable:!0,get:function(){return z}}),Object.defineProperty(e,"warnWherePageRelative",{enumerable:!0,get:function(){return _}}),Object.defineProperty(e,"warnHostFilterNotApplied",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"WHERE_NOT_APPLIED_WARN_ID",{enumerable:!0,get:function(){return X}}),Object.defineProperty(e,"warnWhereNotApplied",{enumerable:!0,get:function(){return B}}),Object.defineProperty(e,"WHERE_OVER_THRESHOLD_WARN_ID",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(e,"warnWhereOverThreshold",{enumerable:!0,get:function(){return G}}),Object.defineProperty(e,"RELATIVE_TOKENS",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"parseRelativeToken",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"resolveRelativeRange",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"relativeTokenOf",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"relativeTokenHelp",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"isResolvableRelative",{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,"resolveRelativeCondition",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"isGroup",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"forEachCondition",{enumerable:!0,get:function(){return w}}),Object.defineProperty(e,"mapConditions",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"normaliseFilterSet",{enumerable:!0,get:function(){return h}}),Object.defineProperty(e,"buildFilterSet",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"wireFilters",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"querySignature",{enumerable:!0,get:function(){return O}});const E=U("packages/core/src/internal/warn.js").warnOnce,q="source.remote.hostFilter",z="source.where.pageRelative";function _(M,D){!Array.isArray(M)||!M.length||E(z,`filters.where (${M.join(", ")}) runs over the rows the ${D} source fetched,`,"not the whole dataset: match counts and totals are page-relative.","Give the predicate a { condition } twin so the engine can narrow the fetch itself.")}function Z(M){const D=(M||{}).config;!D||!D.hostFilter||E(q,"config.hostFilter is not sent to a server-delegated source (paged/remote) and is not applied:","filtering only the fetched window would give wrong counts and totals.","Express the filter as a FilterSet condition, or send it through config.context.")}const X="source.where.notApplied";function B(M,D){E(`${X}:${M}`,`filters.where("${M}") is registered but the ${D} source holds only its fetched window`,"and cannot run the predicate over it: the predicate is not applied there, and rows it would","exclude stay on screen.","Give it a { condition } twin so the engine can narrow the fetch itself — that is the","supported route for a paged or remote source.")}const Y="source.where.overThreshold";function G(M,D,F,T){!Array.isArray(M)||!M.length||E(`${Y}:${D}`,`filters.where (${M.join(", ")}) is not applied to the ${D} pushdown source:`,F===null?"the adapter reports no row total, so the size of the matching set is unknown.":`its matching set is ${F.toLocaleString()} rows, at or past the whereRowLimit of ${T.toLocaleString()}.`,"Running the predicate needs every matching row fetched and held here, which is the whole","download a pushdown source exists to avoid, so it is refused and the rows the predicate","would exclude stay on screen.","Give the predicate a { condition } twin so the engine narrows the fetch itself — that is the","route that works at any size — or raise `whereRowLimit` on the source config if you want the","download.")}const j=new Map;function k(M){let D=j.get(M);return D||(D=new Intl.DateTimeFormat("en-US",{timeZone:M,hourCycle:"h23",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}),j.set(M,D)),D}function g(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone||"UTC"}catch{return"UTC"}}function c(M,D){const F=k(D).formatToParts(new Date(M)),T={y:1970,m:1,d:1,h:0,mi:0,s:0};for(const I of F)I.type==="year"?T.y=+I.value:I.type==="month"?T.m=+I.value:I.type==="day"?T.d=+I.value:I.type==="hour"?T.h=+I.value%24:I.type==="minute"?T.mi=+I.value:I.type==="second"&&(T.s=+I.value);return T}function d(M,D){const F=c(M,D);return Date.UTC(F.y,F.m-1,F.d,F.h,F.mi,F.s)-Math.floor(M/1e3)*1e3}function l(M,D,F,T){const I=Date.UTC(M,D-1,F),P=I-d(I,T);return I-d(P,T)}function i(M,D,F){const T=new Date(Date.UTC(M.y,M.m-1,M.d+D));return l(T.getUTCFullYear(),T.getUTCMonth()+1,T.getUTCDate(),F)}const n=Object.freeze(["today","yesterday","lastNDays","thisWeek","thisMonth","thisQuarter","thisYear","quarterToDate","yearToDate"]);function a(M,D){if(typeof M!="string")return null;const F=M.trim().toLowerCase().replace(/[\s_-]+/g,""),T=/^last(\d*|n)days?$/.exec(F);if(T){const I=T[1]==="n"?"":T[1],P=Number(I||D);return!Number.isFinite(P)||P<=0?null:{kind:"lastNDays",n:Math.floor(P)}}switch(F){case"today":return{kind:"today",n:0};case"yesterday":return{kind:"yesterday",n:0};case"thisweek":return{kind:"thisWeek",n:0};case"thismonth":return{kind:"thisMonth",n:0};case"thisquarter":return{kind:"thisQuarter",n:0};case"thisyear":return{kind:"thisYear",n:0};case"quartertodate":case"qtd":return{kind:"quarterToDate",n:0};case"yeartodate":case"ytd":return{kind:"yearToDate",n:0};default:return null}}function s(M,D={}){const F=a(M,D.n);if(!F)return null;const T=D.tz||g(),I=D.now instanceof Date?D.now.getTime():typeof D.now=="number"?D.now:Date.now(),P=c(I,T),R=l(P.y,P.m,P.d,T),$=i(P,1,T);let C=R,A=$;switch(F.kind){case"today":break;case"yesterday":C=i(P,-1,T),A=R;break;case"lastNDays":A=D.includeToday?$:R,C=i(P,D.includeToday?-(F.n-1):-F.n,T);break;case"thisWeek":{const S=Number.isFinite(D.weekStartsOn)?Number(D.weekStartsOn):1,H=(new Date(Date.UTC(P.y,P.m-1,P.d)).getUTCDay()-S+7)%7;C=i(P,-H,T),A=i(P,-H+7,T);break}case"thisMonth":C=l(P.y,P.m,1,T),A=l(P.m===12?P.y+1:P.y,P.m===12?1:P.m+1,1,T);break;case"thisQuarter":case"quarterToDate":{const S=Math.floor((P.m-1)/3)*3+1;C=l(P.y,S,1,T),A=F.kind==="quarterToDate"?$:S===10?l(P.y+1,1,1,T):l(P.y,S+3,1,T);break}case"thisYear":case"yearToDate":C=l(P.y,1,1,T),A=F.kind==="yearToDate"?$:l(P.y+1,1,1,T);break;default:return null}return{from:new Date(C).toISOString(),to:new Date(A).toISOString(),bounds:"[)",tz:T,relative:F.kind==="lastNDays"?`last${F.n}Days`:F.kind,n:F.n}}function t(M){if(!M||typeof M!="object")return null;const D=M.value;if(D&&typeof D=="object"&&!Array.isArray(D)&&"relative"in D)return{token:String(D.relative),n:typeof D.n=="number"?D.n:void 0};if(M.op==="relative"&&typeof M.value=="string")return{token:M.value,n:void 0};const F=M.meta;return F&&typeof F.relative=="string"&&M.value===void 0?{token:F.relative,n:typeof F.n=="number"?F.n:void 0}:null}function u(){return`Known tokens: ${n.filter(D=>D!=="lastNDays").join(", ")}. "lastNDays" needs a count: pass "last7Days", or the value object { relative: 'lastNDays', n: 7 }.`}function r(M){const D=t(M);return D?a(D.token,D.n)!==null:!1}function o(M,D={}){const F=t(M);if(!F)return M;const T=s(F.token,{...D,n:F.n});return T?{...M,type:M.type||"date",op:"between",value:[T.from,T.to],bounds:M.bounds||T.bounds,meta:{...M.meta||{},relative:T.relative,tz:T.tz}}:(E(`source.relative.${F.token}`,`unknown relative date token "${F.token}"; sending the condition unresolved.`,u()),M)}function f(M){return!!M&&typeof M=="object"&&Array.isArray(M.conditions)}function w(M,D){if(M){if(f(M)){for(const F of M.conditions)w(F,D);return}D(M)}}function m(M,D){if(!M)return null;if(!f(M))return D(M);const F=M;let T=!1;const I=[];for(const P of F.conditions){const R=m(P,D);R!==P&&(T=!0),R&&I.push(R)}return!T&&I.length===F.conditions.length?M:I.length?{...F,conditions:I}:null}function v(M){if(!M)return null;if(!f(M))return M;const D=M,F=[];for(const T of D.conditions){const I=v(T);I&&F.push(I)}return F.length?{op:D.op,conditions:F}:null}function h(M){const D=v(M);return D?f(D)&&D.op==="and"?D:{op:"and",conditions:[D]}:null}function p(M){const D=(M||[]).filter(Boolean);return D.length?{op:"and",conditions:D}:null}function b(M,D={}){const F=m(M,T=>o(T,D));return h(F)}function O(M){const D=y(M.filters??null);return JSON.stringify([D,M.sort??null,M.quick??"",M.groupBy??null,M.pivotBy??null,L(M.context)])}function y(M){if(!M)return null;if(f(M)){const T=M;return{op:T.op,conditions:T.conditions.map(y)}}const D=M,F=D.meta&&typeof D.meta.relative=="string"?D.meta.relative:t(D)?.token;return{col:D.col,op:D.op,bounds:D.bounds??null,caseSensitive:D.caseSensitive??!1,value:F?`rel:${F}`:D.value??null}}function L(M){if(M==null)return null;try{return JSON.parse(JSON.stringify(M))}catch{return E("source.context.unserialisable","config.context is not JSON-serialisable; cache keys ignore it."),"[unserialisable]"}}}),Ue("packages/core/src/source/tree.js",function(e,U){"use strict";Object.defineProperty(e,"SYNTHETIC",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"buildFromPath",{enumerable:!0,get:function(){return B}}),Object.defineProperty(e,"buildFromParentKey",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(e,"assignLevels",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"resolveTree",{enumerable:!0,get:function(){return k}}),Object.defineProperty(e,"buildTree",{enumerable:!0,get:function(){return g}}),Object.defineProperty(e,"indexTree",{enumerable:!0,get:function(){return c}});const E=U("packages/core/src/internal/predicates.js").isFunction,z=U("packages/core/src/internal/warn.js").warnOnce,_="",Z="\0tree:";function X(d,l){return{physical:d,key:l,level:0,children:[],value:void 0}}function B(d,l){const i=[],n=new Map;for(let a=0;a<d.length;a++){const s=d[a],t=l.pathOf(s),u=Array.isArray(t)?t.map(o=>String(o)):[];if(!u.length){const o=X(s,l.keyOf(s));i.push(o);continue}let r=null;for(let o=0;o<u.length;o++){const f=u.slice(0,o+1).join(_),w=o===u.length-1;let m=n.get(f);m&&w&&m.physical===-1&&(m.physical=s,m.key=l.keyOf(s)),m||(m=X(w?s:-1,w?l.keyOf(s):Z+f),m.level=o,m.value=u[o],n.set(f,m),r?r.children.push(m):i.push(m)),r=m}}return{roots:i,nodes:n}}function Y(d,l){const i=new Map,n=[];for(let u=0;u<d.length;u++){const r=d[u],o=l.keyOf(r),f=X(r,o);i.set(o,f);const w=l.parentOf(r);w!=null&&w!==""&&n.push({node:f,parent:String(w)})}let a=null;const s=new Map;for(const{node:u,parent:r}of n){const o=i.get(r);if(o){s.set(u.key,o);continue}l.orphans&&l.orphans!=="root"&&(a||(a=X(-1,`${Z}orphans`),a.value=l.orphans),s.set(u.key,a))}const t=[];for(const u of i.values()){const r=s.get(u.key);r?r.children.push(u):t.push(u)}return a&&a.children.length&&t.push(a),{roots:G(t,i,l.orphans,a),nodes:i}}function G(d,l,i,n){const a=new Set,s=[...d];for(;s.length;){const f=s.pop();if(!a.has(f.key)){a.add(f.key);for(const w of f.children)s.push(w)}}const t=[];for(const f of l.values())a.has(f.key)||t.push(f);if(!t.length)return d;const u=!!i&&i!=="root";z("tree.cycle",`tree.parentKey produced ${t.length} row(s) inside a parent cycle; `+(u?`they are shown under "${i}".`:"they are shown at the root."));for(const f of t)f.children=f.children.filter(w=>a.has(w.key));if(!u)return[...d,...t];let r=n;const o=[...d];return r||(r=X(-1,`${Z}orphans`),r.value=i,o.push(r)),r.children.push(...t),o}function j(d){let l=0;const i=(n,a)=>{for(const s of n)s.level=a,a>l&&(l=a),s.children.length&&i(s.children,a+1)};return i(d,0),l}function k(d,l){if(!d||typeof d!="object")return null;const i=d.path,n=d.parentKey,a=E(d.hasChildren)?s=>!!d.hasChildren(l.dataAt(s)):null;if(E(i))return{mode:"path",pathOf:s=>i(l.dataAt(s)),keyOf:l.keyOf,declaresChildren:a};if(n!=null){const s=E(n)?n:t=>t?.[n];return{mode:"parentKey",parentOf:t=>s(l.dataAt(t)),keyOf:l.keyOf,orphans:d.orphans||"root",declaresChildren:a}}return z("tree.shape","tree is configured with neither `path` nor `parentKey`; rows stay flat."),null}function g(d,l){const i=l.mode==="path"?B(d,l):Y(d,l),n=j(i.roots);return{...i,depth:n}}function c(d,l){const i=new Map,n=a=>{for(let s=0;s<a.length;s++){const t=a[s];if(t.physical>=0){const u=l?l(t.physical):!1,r=u&&t.children.length===0;i.set(t.physical,{level:t.level,posinset:s+1,setsize:a.length,hasChildren:t.children.length>0||u,lazy:r})}t.children.length&&n(t.children)}};return n(d),i}}),Ue("packages/core/src/source/settle.js",function(e,U){"use strict";Object.defineProperty(e,"PIPELINE_SETTLE_REASONS",{enumerable:!0,get:function(){return te}}),Object.defineProperty(e,"isPipelineSettle",{enumerable:!0,get:function(){return E}});const te=Object.freeze(["pipeline:sort","pipeline:sort:error"]);function E(q){const z=q&&typeof q=="object"?q.reason:null;return typeof z=="string"&&te.includes(z)}}),Ue("packages/core/src/source/memory.js",function(e,U){"use strict";Object.defineProperty(e,"STAGES",{enumerable:!0,get:function(){return D}}),Object.defineProperty(e,"PIPELINE_SETTLE_REASONS",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"isPipelineSettle",{enumerable:!0,get:function(){return M}}),Object.defineProperty(e,"createMemorySource",{enumerable:!0,get:function(){return S}}),Object.defineProperty(e,"quickMatcher",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"MemorySource",{enumerable:!0,get:function(){return H}});const E=U("packages/core/src/internal/lru.js").Lru,q=U("packages/core/src/internal/warn.js"),z=q.warnOnce,_=q.fail,X=U("packages/core/src/internal/predicates.js").isFunction,Y=U("packages/core/src/internal/compare.js").defaultCompare,j=U("packages/core/src/internal/merge.js").mergeRow,k=U("packages/core/src/source/rows.js"),g=k.createRowFactory,c=k.groupKey,d=k.groupPathElement,l=k.groupPrefixKeys,i=k.lazyRowView,a=U("packages/core/src/source/handles.js").createHandleProvider,s=U("packages/core/src/compute/incremental.js"),t=s.RunningTotal,u=s.isIncremental,o=U("packages/core/src/compute/handle.js").presenceReader,f=U("packages/core/src/source/filterwire.js"),w=f.querySignature,m=f.mapConditions,v=f.resolveRelativeCondition,h=U("packages/core/src/source/tree.js"),p=h.buildTree,b=h.resolveTree,O=h.indexTree,y=U("packages/core/src/source/settle.js"),L=y.PIPELINE_SETTLE_REASONS,M=y.isPipelineSettle,D=Object.freeze(["filter","sort","group","total","pivot","flatten"]),F=Object.freeze([]);function T(V,W){if(!V)return null;const Q=W==="grand"?V.grandTotal:V.groupTotal;return Q??V.total}function I(V){return!!V&&!V.running}function P(V){if(V)return V.value&&X(V.value.compare)?V.value.compare:X(V.compare)?V.compare:void 0}function R(V){const W=V&&V.dataType;return!W||!X(W.items)?null:{items:W.items,type:V.itemType&&V.itemType.name||"text"}}function $(V){return!!V&&(typeof V=="object"||typeof V=="function")&&X(V.then)}const C=new Uint32Array(0),A=4096;function S(V,W){return new H(V,W)}function x(V,W){if(W==="regex")try{const Q=new RegExp(V,"iu");return ee=>Q.test(ee)}catch{return Q=>Q.includes(V)}if(W==="fuzzy"){const Q=[...V].filter(ee=>ee!==" ");return Q.length?ee=>{let re=0;for(let ae=0;ae<ee.length&&re<Q.length;ae++)ee[ae]===Q[re]&&re++;return re===Q.length}:()=>!0}if(W==="words"){const Q=V.split(/\s+/).filter(Boolean);return Q.length?ee=>Q.every(re=>ee.includes(re)):()=>!0}return Q=>Q.includes(V)}class H{mode="memory";#e;#t;#n;#r=!1;#s=null;#i;#o;#l=new Map;#a=!1;#c=0;#u=0;#f=new Map;#d=new Map;#h;#p=null;#m=H.#g();static#g(){return{slots:[],groupHeadings:F,unnumbered:F,pivot:null,inlineLeaves:null,matchCount:0,grand:null,grandLeaves:0,groupLeaves:null}}#b=new Map;#y=null;#A=new Map;#w=-1;#O=[];#v=new Map;#T=-1;#S=[];#E=null;#M=null;#P=null;#N=null;#R=null;#$=null;#_=null;#G=null;#D=Symbol("unset");#F=new Map;#Y=null;get#x(){return this.#m.slots}set#x(W){this.#m.slots=W}get#K(){return this.#m.inlineLeaves}set#K(W){this.#m.inlineLeaves=W}get#U(){return this.#m.groupHeadings}set#U(W){this.#m.groupHeadings=W}get#H(){return this.#m.unnumbered}set#H(W){this.#m.unnumbered=W}get#fe(){return this.#m.pivot}set#fe(W){this.#m.pivot=W}constructor(W,Q){this.#t=W||{mode:"memory"},this.#e=Q||{};const ee=this.#e.config||{};this.#n=this.#t.rows||ee.rows||[],this.#i=g(this.#e),this.#o=a(this.#e,()=>this.#n,()=>this.#r),this.#h=new E(Number(ee.rowCacheSize)||A);for(const re of D)this.#l.set(re,{key:null,result:null,id:0,computed:!1})}count(){this.#I();const W=this.#ne();return W?W.length:this.#x.length}#ne(){const W=Number(this.#z("pageSize",0))||0;if(W<=0)return null;const Q=this.#x.length,ee=Math.max(1,Math.ceil(Q/W)),ae=Math.min(Math.max(0,Number(this.#z("page",0))||0),ee-1)*W;return{offset:ae,length:Math.max(0,Math.min(W,Q-ae))}}pageInfo(){this.#I();const W=Number(this.#z("pageSize",0))||0,Q=this.#x.length;if(W<=0)return{page:0,pageSize:0,total:Q,pageCount:1};const ee=Math.max(1,Math.ceil(Q/W));return{page:Math.min(Math.max(0,Number(this.#z("page",0))||0),ee-1),pageSize:W,total:Q,pageCount:ee}}totalCount(){return this.#ue().length}matchCount(){return this.#I(),this.#m.matchCount}at(W){this.#I();const Q=this.#ne();if(Q)return W<0||W>=Q.length?void 0:this.#$e(Q.offset+W,W);if(!(W<0||W>=this.#x.length))return this.#$e(W,W)}byKey(W){this.#I(),this.#p||this.#Ce();const Q=this.#p.get(W);if(Q!==void 0)return this.#Ae(Q);for(let ee=0;ee<this.#x.length;ee++){const re=this.#x[ee];if(typeof re!="number"&&re&&re.key===W)return this.#$e(ee)}}loaded(W){return W>=0&&W<this.count()}hint(W,Q){}display(){return this.#I(),this.#Y||(this.#Y=this.#Nt()),this.#Y}invalidateQuickText(){this.#F.clear(),this.invalidate("filter")}invalidate(W){const Q=D.indexOf(W);Q<0&&_(`unknown pipeline stage "${W}"; expected one of ${D.join(", ")}`);for(let ee=Q;ee<D.length;ee++){const re=this.#l.get(D[ee]);re.key=null,re.computed=!1}this.#Y=null}apply(W){const Q=[],ee={added:[],updated:[],removed:[],rejected:Q};if(!W)return ee;let re=!1;const ae=new Set;if(W.remove&&W.remove.length)for(const ue of W.remove){const ge=this.#de(ue);if(ge===void 0){Q.push({operation:"remove",id:this.#ye(ue),reason:"unknown-id"});continue}ee.removed.push(this.#i.keyOf(this.#r?this.#ae(ge):this.#n[ge],ge)),this.#r||(this.#n[ge]=void 0),this.#h.delete(ge),this.#F.delete(ge),re=!0}if(W.update&&W.update.length){const ue=this.#A.size||this.#Ke()?this.#Ze():null,ge=this.#v.size?this.#kt():null,Ae=ge&&ge.length?this.#Ze():null;for(const pe of W.update){const Me=this.#de(pe);if(Me===void 0){Q.push({operation:"update",id:this.#Pe(pe),reason:"unknown-id"});continue}const Ne=this.#r?this.#s&&this.#s.has(Me)?this.#s.get(Me):this.#ae(Me):this.#n[Me],Pe=j(Ne,pe);for(const ie of this.#te(Ne,Pe))ae.add(ie);if(this.#r||(this.#n[Me]=Pe),ue&&this.#Tt(ue,Me,Ne,Pe),Ae&&this.#lt(ge,Ae,Me,Ne,Pe),this.#p){const ie=this.#i.keyOf(Ne,Me),Oe=this.#i.keyOf(Pe,Me);ie!==Oe&&(this.#p.delete(ie),this.#p.set(Oe,Me))}this.#h.delete(Me),this.#F.delete(Me),ee.updated.push(this.#Ae(Me))}}if(W.add&&W.add.length&&this.#r){typeof W.at=="number"&&W.at<this.#Ne()&&(this.#h.clear(),this.#F.clear()),this.#p=null;for(const ue of W.add){const ge=this.#se(this.#Pe(ue));ge!==void 0&&ee.added.push(this.#Ae(ge))}re=!0}else if(W.add&&W.add.length){const ue=typeof W.at=="number"?W.at:this.#n.length,ge=this.#n.length;let Ae=W.add===this.#n?W.add.slice():W.add;if(this.#i.keyed){const pe=[];for(const Me of Ae){const Ne=this.#Pe(Me);if(this.#de(Ne)!==void 0){Q.push({operation:"add",id:Ne,reason:"duplicate-id"});continue}pe.push(Me)}pe.length!==Ae.length&&(Ae=pe)}if(!Ae.length)return ee;if(ue>=ge)for(let pe=0;pe<Ae.length;pe++)this.#n.push(Ae[pe]);else this.#n.splice(ue,0,...Ae),this.#h.clear(),this.#F.clear();for(let pe=0;pe<Ae.length;pe++)ee.added.push(this.#Ae(ue>=ge?ge+pe:ue+pe));re=!0}return this.#c++,re&&(this.#p=null,this.#nt()),this.#o.invalidate(),this.#Y=null,re||this.#X(ae)?(this.#u++,this.invalidate("filter")):this.invalidate("total"),this.#Qe("rows:changed",{companion:!0,added:ee.added.length,updated:ee.updated.length,removed:ee.removed.length}),this.#s=null,ee}groupHeadingsAt(W){this.#I();const Q=this.#U;if(!Q.length||!Number.isInteger(W)||W<0)return F;let ee=0,re=Q.length-1,ae=-1;for(;ee<=re;){const ge=ee+re>>1;Q[ge].at<=W?(ae=ge,ee=ge+1):re=ge-1}if(ae<0)return F;const ue=[];for(let ge=Q[ae].row;ge;ge=ge.parent)ue.push(ge);return ue.reverse(),ue}unnumberedRowCount(W){this.#I();const Q=this.#H;if(!Q.length||!Number.isInteger(W)||W<0)return 0;let ee=0,re=Q.length-1,ae=-1;for(;ee<=re;){const ue=ee+re>>1;Q[ue].at<=W?(ae=ue,ee=ue+1):re=ue-1}return ae+1}moveRow(W,Q){if(this.#r)return z("source.moveRow.dropped","rows.move() is not supported under ingest.dropSourceRows: the source objects have been released and the store cannot reorder its columns in place. Enable retainSource (leave dropSourceRows off) to reorder rows."),!1;const ee=this.#n;if(!Number.isInteger(W)||!Number.isInteger(Q)||W<0||W>=ee.length)return!1;const re=Math.max(0,Math.min(ee.length-1,Q));if(re===W)return!1;const[ae]=ee.splice(W,1);return ee.splice(re,0,ae),this.#c++,this.#u++,this.#p=null,this.#h.clear(),this.#F.clear(),this.#nt(),this.#o.invalidate(),this.#Y=null,this.invalidate("filter"),this.#Qe("rows:changed",{companion:!0,added:0,updated:0,removed:0,moved:1}),!0}reload(W){this.#pe(),this.#c++,this.#u++,this.#p=null,this.#F.clear(),this.#h.clear(),this.#nt(),this.#o.invalidate(),this.invalidate("filter"),this.#Qe("model:changed",{reason:"reload"})}destroy(){this.#pe(),this.#h.clear(),this.#F.clear(),this.#p=null,this.#x=[],this.#K=null,this.#Y=null,this.#nt();for(const W of D)this.#l.set(W,{key:null,result:null,id:0,computed:!1})}#pe(){for(const{controller:W}of this.#b.values())try{W.abort()}catch{}this.#b.clear()}setRows(W){this.#n=W||[],this.#r=!1,this.#c++,this.#u++,this.#p=null,this.#F.clear(),this.#h.clear(),this.#nt(),this.#o.invalidate(),this.invalidate("filter")}notePriorRows(W){this.#s=W||null}releaseSource(){this.#r=!0,this.#n=[],this.#p=null,this.#h.clear(),this.#F.clear(),this.#o.invalidate()}data(){if(!this.#r)return this.#n;const W=this.#e.store;if(!W||!X(W.source))return this.#n;const Q=W.physical||0,ee=new Array(Q);for(let re=0;re<Q;re++)ee[re]=W.live&&!W.live(re)?void 0:W.source(re);return ee}#xe(){const W=this.#z("detail",null);return!W||!X(W.isOpen)||W.inline===!1?null:W}#Oe(){const W=(this.#e.config||{}).tree;return this.#D!==W&&(this.#D=W,this.#G=b(W,{dataAt:Q=>this.#ae(Q),keyOf:Q=>this.#i.keyOf(this.#ae(Q),Q)})),this.#G}#me(){return(this.#e.config||{}).grandTotalRow==="bottom"}grandTotalRow(){if(!this.#me())return null;this.#I();const W=this.#m.grand;return W?this.#i.grandTotal(W,this.#et(this.#m.grandLeaves)):null}pivot(){return this.#I(),this.#fe}pivotMatrix(){this.#I();const W=this.#m.groupLeaves,Q=(this.#e.compute||{}).pivotMatrix;if(!X(Q))return null;const ee=this.#z("groupBy",[]),re=this.#z("pivotBy",[]);if(!ee.length&&!re.length)return z("pivotView.no-dimension","pivotView is on but the grid has no pivot dimension, so there is no matrix to draw. Put a column on the pivot (its `pivot` setting, or `pivotBy` in the query) for the columns across the top, and group by a column for the rows down the side."),null;const ae=this.#Ze().map(ge=>({colId:ge.id,handle:this.#o.handle(ge.id),fn:T(ge,"group")})).filter(ge=>ge.handle&&ge.fn),ue=this.#e.config||{};return Q({rowHandles:ee.map(ge=>this.#o.handle(ge)).filter(Boolean),columnHandles:re.map(ge=>this.#o.handle(ge)).filter(Boolean),measures:ae,leaves:W||new Uint32Array(0),opts:{locale:ue.locale,separator:(ue.pivot||{}).separator,maxColumns:(ue.pivot||{}).maxColumns}})}keysForLeaves(W){const Q=[];if(!W)return Q;for(let ee=0;ee<W.length;ee++){const re=this.#Ae(W[ee]);re&&re.key!=null&&Q.push(String(re.key))}return Q}leavesOf(W){this.#I();const Q=this.#l.get("group"),ee=Q&&Q.result;if(!ee||!ee.nodes)return[];const re=ee.nodes.get(W);if(!re)return[];const ae=[],ue=ge=>{const Ae=ge.row&&ge.row.children;if(Ae&&Ae.length){for(const pe of Ae){const Me=ee.nodes.get(pe.key);Me&&ue(Me)}return}if(ge.leaves)for(let pe=0;pe<ge.leaves.length;pe++)ae.push(this.#Ae(ge.leaves[pe]))};return ue(re),ae}#ye(W){return typeof W=="string"?W:this.#Pe(W)}#Pe(W){try{return this.#i.keyOf(W,-1)}catch{return"(unkeyed)"}}#de(W){if(typeof W=="string")return this.#se(W);if(this.#i.keyed){const ee=this.#i.keyOf(W,-1),re=this.#se(ee);if(re!==void 0)return re}if(this.#r)return;const Q=this.#n.indexOf(W);return Q>=0?Q:void 0}#se(W){return this.#p||this.#Ce(),this.#p.get(W)}#Ce(){this.#p=new Map;const W=this.#Ne(),Q=this.#e.store,ee=Q&&X(Q.live)?re=>Q.live(re):null;for(let re=0;re<W;re++){if(ee&&!ee(re))continue;const ae=this.#ae(re);ae!==void 0&&this.#p.set(this.#i.keyOf(ae,re),re)}}#te(W,Q){const ee=[];for(const re of this.#V())this.#_e(re)&&this.#J(re,W,Q,new Set)&&ee.push(re);return ee}#J(W,Q,ee,re){if(re.has(W))return!1;re.add(W);const ae=this.#_e(W);if(!ae)return!1;const ue=ae.value&&ae.value.deps;return Array.isArray(ue)&&ue.length?ue.some(ge=>this.#J(String(ge),Q,ee,re)):X(ae.getValue)?!Object.is(ae.getValue(Q),ae.getValue(ee)):!1}#V(){const W=new Set;for(const ee of this.#z("sort",[]))W.add(ee.col);for(const ee of this.#z("groupBy",[]))W.add(ee);const Q=ee=>{if(ee){if(Array.isArray(ee.conditions)){ee.conditions.forEach(Q);return}ee.col&&W.add(ee.col)}};return Q(this.#z("filters",null)),[...W]}#X(W){if(!W.size)return!1;if(this.#z("quick",""))return!0;for(const Q of this.#V())if(W.has(Q))return!0;return!1}#I(){if(!this.#a){this.#a=!0;try{this.#Me()}finally{this.#a=!1}}}pipelineRunning(){return this.#a}#Me(){const W=this.#B("filter",()=>this.#W(),()=>this.#Re()),Q=this.#q(W),ee=this.#B("group",()=>this.#ge(),()=>this.#Ye(Q)),re=this.#B("total",()=>this.#we(),()=>this.#We(ee));this.#B("pivot",()=>this.#k(),()=>this.#At(ee)),this.#B("flatten",()=>this.#Se(),()=>this.#Ge(ee)),this.#Be(ee,re)}#q(W){const Q=this.#l.get("sort"),ee=this.#ie();if(Q.computed&&Q.key===ee&&!this.#b.has("sort"))return Q.result;const re=this.#b.get("sort");return re&&re.key===ee?Q.result:Q.result&&this.#Ee(W)?(this.#Te(W,ee),Q.result):this.#B("sort",()=>ee,()=>this.#Fe(W))}#re(){if(this.#y===null){const W=this.#e.pipelineWorker,Q=X(W)?W():null;this.#y=Q||!1}return this.#y||null}#ve(){const W=this.#z("sort",[]);if(!Array.isArray(W)||!W.length)return null;const Q=(this.#e.config||{}).locale,ee=[],re=[];for(const ae of W){const ue=this.#_e(ae.col);if(ue&&ue.running)continue;if(ue&&ue.value&&X(ue.value.compare))return null;const ge=this.#o.handle(ae.col);if(!ge)return null;ee.push({col:ae.col,descending:ae.dir==="desc",nullsFirst:!!ae.nullsFirst,locale:Q}),re.push(ge)}return ee.length?{entries:ee,handles:re,locale:Q}:null}#Ee(W){if(this.#ce())return!1;const Q=this.#re();if(!Q)return!1;const ee=Number(Q.threshold);return Number.isFinite(ee)&&W.length<ee?!1:!!this.#ve()}#Te(W,Q){const ee=this.#re(),re=ee&&this.#ve();if(!re){this.#B("sort",()=>Q,()=>this.#Fe(W));return}const ae=new AbortController;this.#b.set("sort",{key:Q,controller:ae});const ue=re.entries.length===1?ee.sortColumn(re.handles[0],W,{descending:re.entries[0].descending,nullsFirst:re.entries[0].nullsFirst,locale:re.locale,signal:ae.signal,key:"sort"}):ee.sortMulti(re.handles,re.entries.map((ge,Ae)=>({...ge,handle:re.handles[Ae]})),W,{signal:ae.signal,key:"sort"});if(!$(ue)){this.#b.delete("sort"),this.#B("sort",()=>Q,()=>ue);return}ue.then(ge=>this.#le(Q,ge),ge=>this.#he("sort",Q,ge))}#le(W,Q){const ee=this.#b.get("sort");if(!(!ee||ee.key!==W)){if(this.#ie()!==W){this.#b.delete("sort");return}this.#b.delete("sort"),this.#B("sort",()=>W,()=>Q),this.#Y=null,this.#I(),this.#Qe("model:changed",{reason:L[0]})}}#he(W,Q,ee){const re=this.#b.get(W);if(!(!re||re.key!==Q)&&(this.#b.delete(W),!(ee&&ee.name==="AbortError")&&W==="sort"&&this.#ie()===Q)){const ae=this.#B("filter",()=>this.#W(),()=>this.#Re());this.#B("sort",()=>Q,()=>this.#Fe(ae)),this.#Y=null,this.#I(),z("source.pipeline.sort","off-thread sort failed; recomputed on the main thread.",ee),this.#Qe("model:changed",{reason:L[1]})}}#Be(W,Q){const ee=W&&W.leaves?W.leaves.length:this.#m.slots.length;this.#m.matchCount=ee,this.#m.grand=Q&&Q.grand||null,this.#m.grandLeaves=W&&W.leaves?W.leaves.length:0,this.#m.groupLeaves=W&&W.leaves?W.leaves:null}#B(W,Q,ee){const re=this.#l.get(W),ae=Q();return re.computed&&re.key===ae||(re.result=ee(),re.key=ae,re.computed=!0,re.id++,W==="flatten"&&(this.#Y=null)),re.result}#C(W){return this.#l.get(W).id}#W(){const W=(this.#e.config||{}).hostFilter,Q=W&&X(W.active)&&W.active()?1:0,ee=this.#z("where",null),re=ee?ee.version:0,ae=this.#gt("filter.sig",`${this.#ut()}`,()=>w({filters:this.#z("filters",null),quick:this.#z("quick",""),quickMode:this.#z("quickMode","contains")}));return`${this.#u}|${ae}|${Q}|${re}`}#ie(){const W=this.#ce();return`${this.#C("filter")}|${JSON.stringify(this.#z("sort",[]))}`+(W?`|manual:${W.version}`:"")}#ce(){const W=this.#z("rowOrder",null);return W&&Array.isArray(W.keys)?W:null}#oe(W,Q){this.#p||this.#Ce();const ee=this.#p,re=this.#Ne(),ae=Q.keys.length,ue=new Float64Array(re);for(let ge=0;ge<re;ge++)ue[ge]=ae+ge;for(let ge=0;ge<ae;ge++){const Ae=ee.get(Q.keys[ge]);Ae!==void 0&&(ue[Ae]=ge)}return Uint32Array.from(W).sort((ge,Ae)=>ue[ge]-ue[Ae])}orderedKeys(){this.#p||this.#Ce();const W=this.#p,Q=new Map;for(const[ge,Ae]of W)Q.set(Ae,ge);const ee=Uint32Array.from([...Q.keys()]).sort(),re=this.#ce(),ae=re?this.#oe(ee,re):this.#Fe(ee),ue=new Array(ae.length);for(let ge=0;ge<ae.length;ge++)ue[ge]=Q.get(ae[ge]);return ue}#ge(){const W=this.#z("pivotBy",[]).length>0?"p":"u";return`${this.#C("sort")}|${JSON.stringify(this.#z("groupBy",[]))}|${W}`}#we(){const W=this.#Xe()?"f":"a",Q=(this.#e.config||{}).totalOnlyChangedColumns?"n":"w";return`${this.#C("group")}|${JSON.stringify(this.#z("totals",[]))}|${W}${Q}|${this.#c}`}#k(){return`${this.#C("group")}|${JSON.stringify(this.#z("pivotBy",[]))}`}#Se(){const Q=this.#He()||!this.#me()?this.#C("total"):"x",ee=`${this.#ut()}`,re=this.#gt("flatten.keys",ee,()=>{const ue=this.#z("expanded",null);return ue?[...ue].sort().join(""):"*"}),ae=this.#gt("flatten.detail",ee,()=>{const ue=this.#z("detail",null);return ue&&X(ue.signature)?ue.signature():""});return`${Q}|${this.#C("pivot")}|${re}|${ae}`}#He(){const W=this.#z("groupBy",[]);return Array.isArray(W)&&W.length>0}stageState(){const W=[];for(const[Q,ee]of this.#l){const re=ee.result;W.push({stage:Q,materialised:!!ee.computed,bytes:re&&typeof re.byteLength=="number"?re.byteLength:null,rows:re&&typeof re.length=="number"?re.length:null,rebuilds:ee.id})}return W}facetIndices(W){return this.#Re(W||null)}facetRows(W){const Q=this.facetIndices(W),ee=[];for(let re=0;re<Q.length;re++){const ae=this.#Ae(Q[re]);ae&&ee.push(ae)}return ee}invalidateRows(){this.#h.clear(),this.#F.clear(),this.#Y=null}invalidateHandles(){this.#o.invalidate()}rows(){return this.#n}unfilteredIndices(){return this.#ue()}filteredIndices(){const W=this.#l.get("filter");if(W&&W.computed&&W.key===this.#W())return W.result||this.#ue();this.#I();const Q=this.#l.get("filter");return(Q&&Q.computed?Q.result:null)||this.#ue()}unfilteredRows(){const W=this.#ue(),Q=[];for(let ee=0;ee<W.length;ee++){const re=this.#Ae(W[ee]);re&&Q.push(re)}return Q}#Re(W=null){const Q=this.#ue(),ee=this.#z("filters",null),re=W?this.#st("pruneColumn")(ee,W):ee,ae=this.#it(re),ue=String(this.#z("quick","")||"").trim().toLowerCase(),ge=ue?x(ue,String(this.#z("quickMode","contains")||"contains")):null,Ae=(this.#e.config||{}).hostFilter,pe=!!(Ae&&X(Ae.active)&&Ae.active()),Me=this.#z("where",null),Ne=!!(Me&&Me.active);if(!ae&&!ue&&!pe&&!Ne)return Q;let Pe=null;ae&&(Pe=this.#st("evaluateFilters")(ae,{handle:Ce=>this.#o.handle(Ce),count:this.#Ne(),pool:this.#e.pool,locale:(this.#e.config||{}).locale,itemwise:Ce=>R(this.#_e(Ce))}));const ie=new Uint32Array(Q.length);let Oe=0;for(let je=0;je<Q.length;je++){const Ce=Q[je];if(!(Pe&&!Pe[Ce])&&!(ge&&!this.#ct(Ce,ge))){if(pe||Ne){const fe=this.#Ae(Ce);if(pe&&!Ae.passes(fe)||Ne&&!Me.passes(fe.data,fe.key))continue}ie[Oe++]=Ce}}if(Pe){const je=(this.#e.compute||{}).releaseMask;X(je)&&je({pool:this.#e.pool},Pe)}return ie.subarray(0,Oe)}handleFor(W){return this.#o.handle(W)}#Fe(W){const Q=this.#ce();if(Q)return this.#oe(W,Q);const ee=this.#z("sort",[]).filter(ue=>{const ge=this.#_e(ue.col);return!ge||!ge.running?!0:(z(`source.sort.running.${ue.col}`,`sort ignores "${ue.col}": a running total is a function of the sort order, so it cannot also decide it. Sort by the column it runs over instead.`),!1)});if(!ee.length)return W;const re=(this.#e.config||{}).locale;if(ee.length===1){const ue=ee[0],ge=this.#o.handle(ue.col);if(!ge)return z(`source.sort.${ue.col}`,`sort ignores unknown column "${ue.col}".`),W;const Ae=this.#_e(ue.col);return this.#st("sortColumn")(ge,W,{descending:ue.dir==="desc",nullsFirst:ue.nullsFirst,locale:re,compare:P(Ae)})}const ae=[];for(const ue of ee){const ge=this.#o.handle(ue.col);if(!ge){z(`source.sort.${ue.col}`,`sort ignores unknown column "${ue.col}".`);continue}ae.push({handle:ge,descending:ue.dir==="desc",nullsFirst:ue.nullsFirst,locale:re,compare:P(this.#_e(ue.col))})}return ae.length?this.#st("sortMulti")(ae.map(ue=>ue.handle),ae,W):W}#Ye(W){const Q=this.#z("groupBy",[]),ee=this.#Oe();if(ee&&!Q.length){const je=p(W,ee);return this.#$=O(je.roots,ee.declaresChildren),{roots:null,leaves:W,nodes:new Map,tree:je}}if(this.#$=null,ee&&Q.length&&z("tree.grouped","grouping is active on a grid configured with `tree`; the grouping wins and the hierarchy is not shown."),!Q.length)return{roots:null,leaves:W,nodes:new Map};const re=(this.#e.config||{}).timeZone,ae=[],ue=[];let ge=!1;for(const je of Q){const Ce=this.#o.handle(je);if(!Ce){z(`source.group.${je}`,`grouping ignores unknown column "${je}".`);continue}ae.push(Ce);const fe=this.#_e(je),Ee=fe&&fe.dataType;if(Ee&&X(Ee.groupProjector)){const le=fe.typeOptions&&fe.typeOptions.timeZone||re||void 0,de=Ee.groupProjector(fe,le);ue.push(de||null),de&&(ge=!0)}else ue.push(null)}if(!ae.length)return{roots:null,leaves:W,nodes:new Map};const{keys:Ae,buckets:pe}=this.#st("groupByColumns")(ae,W,{locale:(this.#e.config||{}).locale,project:ge?ue:void 0}),Me=this.#z("pivotBy",[]).length>0,Ne=[],Pe=new Map;for(let je=0;je<pe.length;je++){const Ce=Ae[je];let fe=null;const Ee=[];for(let le=0;le<Ce.length;le++){Ee.push(d(Ce[le]));const de=c(Ee),Se=le===Ce.length-1;let Fe=Pe.get(de);if(!Fe){const ke=this.#i.group({path:[...Ee],column:Q[le],value:Ce[le],level:le,parent:fe,expanded:Me&&Se?!1:this.#pt(de,{key:de,column:Q[le],value:Ce[le],level:le,path:[...Ee]}),hasChildren:!(Me&&Se)});Fe={row:ke,leaves:null},Pe.set(de,Fe),fe?fe.children.push(ke):Ne.push(ke)}Fe.row.leafCount+=pe[je].length,le===Ce.length-1&&(Fe.leaves=pe[je]),fe=Fe.row}}const ie=this.#z("sort",[])||[],Oe=(je,Ce)=>{if(!je||je.length<2){if(je)for(const de of je)Oe(de.children,Ce+1);return}const fe=Q[Ce],Ee=ie.find(de=>de.col===fe),le=Ee&&Ee.dir==="desc"?-1:1;je.sort((de,Se)=>le*Y(de.groupValue,Se.groupValue));for(const de of je)Oe(de.children,Ce+1)};return Oe(Ne,0),{roots:Ne,leaves:W,nodes:Pe,keys:Ae,buckets:pe}}#ze(W,Q){const ee=new Map,re=new Map,ae=ue=>{const ge=ue.physical>=0?[ue.physical]:[];for(const Ae of ue.children)ge.push(...ae(Ae));if(ue.children.length){const Ae=this.#rt(Q,Uint32Array.from(ge),null);ue.physical>=0?ee.set(ue.physical,Ae):re.set(ue.key,Ae)}return ge};for(const ue of W.roots)ae(ue);return{byPhysical:ee,byKey:re}}#We(W){const Q=this.#Ze();if(!Q.length)return this.#M=null,this.#P=null,{grand:null};const ee={id:this.#C("group"),columns:Q.map(ie=>ie.id).join("")},re=this.#M&&this.#M.id===ee.id&&this.#M.columns===ee.columns,ae=this.#Ke()&&re?this.#E:null,ue=ae?Q.filter(ie=>ae.has(ie.id)):Q,ge=re?this.#P:null,Ae=this.#Xe()?null:this.#tt(),pe=this.#be(Q),Me=ie=>{const Oe=W.nodes.get(ie.key);let je=Oe&&Oe.leaves?Oe.leaves:null;if(ie.children&&ie.children.length){const Ee=ie.children.map(Me);let le=0;for(const Fe of Ee)le+=Fe.length;const de=new Uint32Array(le);let Se=0;for(const Fe of Ee)de.set(Fe,Se),Se+=Fe.length;je=de}je=je||new Uint32Array(0);const Ce=Ae?Ae.get(ie.key)||C:je,fe=this.#at(ie,ae?ue:Q,Ce,pe);return ie.totals=ae?{...ie.totals,...fe}:fe,je};if(W.roots&&ue.length)for(const ie of W.roots)Me(ie);if(this.#_=W.tree?this.#ze(W.tree,Q):null,this.#M=ee,this.#E=this.#Ke()?new Set:null,!(this.#e.config||{}).grandTotalRow)return this.#O.length=0,this.#P=null,{grand:null};const Pe=Ae?this.#qe():W.leaves;return this.#P=this.#Ve(Q,Pe,ae,ge),{grand:this.#P}}#Ve(W,Q,ee,re){const ae={},ue=this.#C("group");ue!==this.#w&&(this.#St(),this.#w=ue);const ge=this.#O;this.#O=[];for(const Ae of W){if(!I(Ae))continue;const pe=this.#o.handle(Ae.id);if(!pe)continue;const Me=T(Ae,"grand");if(!u(Me,pe)){if(ee&&!ee.has(Ae.id)&&re&&Ae.id in re){ae[Ae.id]=re[Ae.id];continue}ae[Ae.id]=this.#rt([Ae],Q,null,"grand")[Ae.id];continue}let Ne=this.#A.get(Ae.id);if((!Ne||Ne.fn!==Me)&&(Ne=new t(Me),this.#A.set(Ae.id,Ne)),Ne.valid){let Pe=!0;for(const ie of ge)if(ie.colId===Ae.id&&!Ne.update(ie.before,ie.after)){Pe=!1;break}if(Pe){ae[Ae.id]=Ne.value();continue}Ne.invalidate()}Ne.seedColumn(pe.values,o(pe),Q),ae[Ae.id]=Ne.valid?Ne.value():this.#rt([Ae],Q,null,"grand")[Ae.id]}return ae}#be(W){const Q=this.#C("group");Q!==this.#T&&(this.#v.clear(),this.#T=Q);const ee=new Map;for(const ae of W){if(!I(ae))continue;const ue=this.#o.handle(ae.id),ge=T(ae,"group");u(ge,ue)&&ee.set(ae.id,{fn:ge})}if(!ee.size)return this.#S.length=0,ee;const re=this.#S;this.#S=[];for(const ae of re){const{beforeKeys:ue,afterKeys:ge,colDeltas:Ae}=ae,pe=ue.length?new Set(ue):null,Me=ge.length?new Set(ge):null;for(const{colId:Ne,before:Pe,after:ie}of Ae)if(ee.has(Ne)){for(const Oe of ue)Me&&Me.has(Oe)||this.#ke(Oe,Ne,Pe,null);for(const Oe of ge)pe&&pe.has(Oe)||this.#ke(Oe,Ne,null,ie);for(const Oe of ue)Me&&!Me.has(Oe)||this.#ke(Oe,Ne,Pe,ie)}}return ee}#ke(W,Q,ee,re){const ae=this.#v.get(W),ue=ae&&ae.get(Q);!ue||!ue.valid||ue.update(ee,re)||ue.invalidate()}#at(W,Q,ee,re){if(!re||!re.size)return this.#rt(Q,ee,W);const ae={};let ue=null,ge=this.#v.get(W.key);for(const Ae of Q){const pe=re.get(Ae.id);if(!pe){(ue||(ue=[])).push(Ae);continue}const Me=this.#o.handle(Ae.id);if(!Me)continue;ge||(ge=new Map,this.#v.set(W.key,ge));let Ne=ge.get(Ae.id);if((!Ne||Ne.fn!==pe.fn)&&(Ne=new t(pe.fn),ge.set(Ae.id,Ne)),Ne.valid||Ne.seedColumn(Me.values,o(Me),ee),Ne.valid){ae[Ae.id]=Ne.value();continue}(ue||(ue=[])).push(Ae)}return ue&&Object.assign(ae,this.#rt(ue,ee,W)),ae}#Tt(W,Q,ee,re){const ae=!this.#Xe()||this.#Ot(Q);for(const ue of W){const ge=ue.getValue;if(!X(ge))continue;const Ae=ge(ee),pe=ge(re);Object.is(Ae,pe)||(this.#E&&this.#E.add(ue.id),ae&&this.#A.has(ue.id)&&this.#O.push({colId:ue.id,before:Ae,after:pe}))}}#kt(){const W=this.#z("groupBy",[]),Q=[];for(const ee of W){const re=this.#_e(ee);re&&Q.push(re)}return Q}#ee(W,Q){const ee=new Array(W.length);for(let re=0;re<W.length;re++){const ae=W[re].getValue;ee[re]=d(X(ae)?ae(Q):void 0)}return ee}#lt(W,Q,ee,re,ae){if(this.#Xe()&&!this.#Ot(ee))return;const ue=l(this.#ee(W,re)),ge=l(this.#ee(W,ae)),Ae=ue.length!==ge.length||ue.some((Me,Ne)=>Me!==ge[Ne]),pe=[];for(const Me of Q){const Ne=Me.getValue;if(!X(Ne))continue;const Pe=Ne(re),ie=Ne(ae);!Ae&&Object.is(Pe,ie)||pe.push({colId:Me.id,before:Pe,after:ie})}!pe.length&&!Ae||this.#S.push({beforeKeys:ue,afterKeys:ge,colDeltas:pe})}#Ot(W){const Q=this.#l.get("filter"),ee=Q&&Q.computed?Q.result:null;if(!ee)return!0;let re=0,ae=ee.length-1;for(;re<=ae;){const ue=re+ae>>1,ge=ee[ue];if(ge===W)return!0;ge<W?re=ue+1:ae=ue-1}return!1}#Xe(){return(this.#e.config||{}).totalFilteredOnly!==!1}#et(W){return this.#Xe()?W:this.#qe().length}#qe(){return(!this.#N||this.#N.version!==this.#u)&&(this.#N={version:this.#u,indices:this.#ue()}),this.#N.indices}#tt(){const W=this.#z("groupBy",[]),Q=`${this.#u}|${JSON.stringify(W)}`;if(this.#R&&this.#R.key===Q)return this.#R.map;const ee=new Map,re=[];for(const ae of W){const ue=this.#o.handle(ae);ue&&re.push(ue)}if(re.length){const ae=this.#qe(),{keys:ue,buckets:ge}=this.#st("groupByColumns")(re,ae,{locale:(this.#e.config||{}).locale}),Ae=new Map;for(let pe=0;pe<ge.length;pe++){const Me=ue[pe],Ne=[];for(let Pe=0;Pe<Me.length;Pe++){Ne.push(d(Me[Pe]));const ie=c(Ne);let Oe=Ae.get(ie);Oe||(Oe=[],Ae.set(ie,Oe));for(let je=0;je<ge[pe].length;je++)Oe.push(ge[pe][je])}}for(const[pe,Me]of Ae)ee.set(pe,Uint32Array.from(Me))}return this.#R={key:Q,map:ee},ee}#Ke(){return!!(this.#e.config||{}).totalOnlyChangedColumns}#nt(){this.#St(),this.#j(),this.#E=null,this.#M=null,this.#P=null}#St(){this.#A.clear(),this.#O.length=0,this.#w=-1}#j(){this.#v.clear(),this.#S.length=0,this.#T=-1}#At(W){const Q=this.#z("pivotBy",[]);if(!Q.length)return this.#fe=null,null;const ee=(this.#e.compute||{}).pivot;if(!X(ee))return z("source.pivot.kernel","pivot requested but ctx.compute.pivot is not available; showing unpivoted rows."),this.#fe=null,null;const re=Q.map(ue=>this.#o.handle(ue)).filter(Boolean),ae=this.#Ze();return this.#fe=ee(re,W.leaves,{groups:W.keys&&W.buckets?{keys:W.keys,buckets:W.buckets}:null,totals:ae.map(ue=>ue.id),handle:ue=>this.#o.handle(ue),totalOf:ue=>T(ae.find(ge=>ge.id===ue),"group"),separator:((this.#e.config||{}).pivot||{}).separator,maxColumns:((this.#e.config||{}).pivot||{}).maxColumns})||null,this.#fe}#Ge(W){const Q=this.#l.get("total").result,ee=!!(this.#e.config||{}).groupFooter,re=this.#xe();if(W.tree)return this.#jt(W,Q,re);if(!W.roots&&!re){if(Q&&Q.grand&&!this.#me()){const Me=this.#i.grandTotal(Q.grand,this.#et(W.leaves.length));if(this.#K===W.leaves&&Array.isArray(this.#x))this.#x[this.#x.length-1]=Me;else{const Ne=Array.from(W.leaves);Ne.push(Me),this.#x=Ne,this.#K=W.leaves}this.#H=[{at:this.#x.length-1}]}else this.#K=null,this.#x=W.leaves,this.#H=F;return this.#U=F,this.#x}const ae=[],ue=[],ge=[],Ae=Me=>{if(ae.push(Me),!re)return;const Ne=this.#Ae(Me);!Ne||!re.isOpen(Ne.key)||(Ne.master=!0,Ne.expanded=!0,ge.push({at:ae.length}),ae.push(this.#i.detail(Ne,re.heightOf(Ne))))};if(!W.roots){for(let Me=0;Me<W.leaves.length;Me++)Ae(W.leaves[Me]);return Q&&Q.grand&&!this.#me()&&(ge.push({at:ae.length}),ae.push(this.#i.grandTotal(Q.grand,this.#et(W.leaves.length)))),this.#K=null,this.#U=F,this.#H=ge.length?ge:F,this.#x=ae,ae}const pe=(Me,Ne,Pe)=>{if(Me.expanded=Me.hasChildren===!1?!1:this.#pt(Me.key,{key:Me.key,column:Me.groupColumn,value:Me.groupValue,level:Me.level,path:Me.groupPath}),Me.posinset=Ne+1,Me.setsize=Pe,ue.push({at:ae.length,row:Me}),ge.push({at:ae.length}),ae.push(Me),!!Me.expanded){if(Me.children&&Me.children.length)for(let ie=0;ie<Me.children.length;ie++)pe(Me.children[ie],ie,Me.children.length);else{const ie=W.nodes.get(Me.key),Oe=ie&&ie.leaves?ie.leaves:null;if(Oe)for(let je=0;je<Oe.length;je++)Ae(Oe[je])}ee&&Me.totals&&(ge.push({at:ae.length}),ae.push(this.#i.footer(Me)))}};for(let Me=0;Me<W.roots.length;Me++)pe(W.roots[Me],Me,W.roots.length);return Q&&Q.grand&&!this.#me()&&(ge.push({at:ae.length}),ae.push(this.#i.grandTotal(Q.grand,this.#et(W.leaves.length)))),this.#U=ue,this.#H=ge,this.#x=ae,ae}#ue(){const W=this.#e.store;if(W&&X(W.liveIndices))return W.liveIndices();const Q=new Uint32Array(this.#n.length);let ee=0;for(let re=0;re<this.#n.length;re++)this.#n[re]!==void 0&&(Q[ee++]=re);return Q.subarray(0,ee)}#Ne(){const W=this.#e.store;return W&&typeof W.physical=="number"?W.physical:this.#n.length}#ae(W){const Q=this.#e.store;return Q&&X(Q.source)?Q.source(W):this.#n[W]}#$e(W,Q=W){const ee=this.#x[W];if(typeof ee!="number")return ee.index=Q,ee;const re=this.#Ae(ee);return re.index=Q,re}#Ae(W){let Q=this.#h.get(W);Q||(Q=this.#i.leaf(this.#ae(W),W),this.#h.set(W,Q));const ee=this.#$?this.#$.get(W):null;if(ee){Q.level=ee.level,Q.posinset=ee.posinset,Q.setsize=ee.setsize,Q.hasChildren=ee.hasChildren,Q.expanded=ee.hasChildren&&!ee.lazy&&this.#pt(Q.key);const re=this.#_?this.#_.byPhysical.get(W):void 0;re?Q.totals=re:Q.totals&&(Q.totals=null)}else Q.hasChildren&&(Q.level=0,Q.hasChildren=!1,Q.expanded=!1,Q.posinset=void 0,Q.setsize=void 0);return Q}#jt(W,Q,ee){const re=[],ae=[],ue=Ae=>{if(Ae.leafCount!==void 0)return Ae.leafCount;let pe=Ae.physical>=0?1:0;for(const Me of Ae.children)pe+=ue(Me);return Ae.leafCount=pe,pe},ge=Ae=>{const pe=this.#pt(Ae.key);if(Ae.physical>=0){if(re.push(Ae.physical),ee&&ee.isOpen(this.#Ae(Ae.physical).key)){const Me=this.#Ae(Ae.physical);ae.push({at:re.length}),re.push(this.#i.detail(Me,ee.heightOf(Me)))}}else re.push(this.#i.group({path:[Ae.key],column:null,value:Ae.value,level:Ae.level,parent:null,expanded:pe,hasChildren:Ae.children.length>0,leafCount:ue(Ae),totals:this.#_?this.#_.byKey.get(Ae.key):void 0}));if(pe)for(const Me of Ae.children)ge(Me)};for(const Ae of W.tree.roots)ge(Ae);return Q&&Q.grand&&!this.#me()&&(ae.push({at:re.length}),re.push(this.#i.grandTotal(Q.grand,this.#et(W.leaves.length)))),this.#K=null,this.#U=F,this.#H=ae.length?ae:F,this.#x=re,re}#Nt(){return i(()=>this.count(),W=>this.at(W))}#ct(W,Q){let ee=this.#F.get(W);if(ee===void 0){const re=this.#ae(W),ae=this.#ot(),ue=[],ge=this.#e.columnHidden;for(const Ae of ae){if(Ae.quickFilter===!1||X(ge)&&ge(Ae.id))continue;const pe=Ae.value&&X(Ae.value.quickFilterText)?Ae.value.quickFilterText({value:void 0,data:re,row:null,column:Ae,colId:Ae.id,grid:null,context:this.#z("context",null)}):null,Me=pe??(X(Ae.formatValue)?Ae.formatValue(X(Ae.getValue)?Ae.getValue(re):void 0):"");Me!=null&&Me!==""&&ue.push(String(Me))}ee=ue.join(" ").toLowerCase(),this.#F.set(W,ee)}return Q(ee)}#Ze(){const W=this.#z("totals",[]),Q=W&&W.length?new Set(W):null;return this.#ot().filter(ee=>Q?Q.has(ee.id):!!(ee.total||ee.groupTotal||ee.grandTotal))}#rt(W,Q,ee,re="group"){const ae={},ue=(this.#e.compute||{}).total;for(const ge of W){if(!I(ge))continue;const Ae=this.#o.handle(ge.id);if(!Ae)continue;const pe=T(ge,re);if(pe)if(X(pe)){const Me=new Array(Q.length);for(let Ne=0;Ne<Q.length;Ne++)Me[Ne]=Ae.get(Q[Ne]);ae[ge.id]=pe(Me,{row:ee,column:ge,grid:this.#e.grid||null,context:this.#z("context",null),valueAt:(Ne,Pe)=>{const ie=this.#o.handle(Ne);return ie&&Pe>=0&&Pe<Q.length?ie.get(Q[Pe]):null}})}else X(ue)&&(ae[ge.id]=ue(Ae,Q,pe))}return ae}#it(W){if(!W)return W;const Q=this.#e.config||{},ee={tz:Q.timeZone,weekStartsOn:Q.weekStartsOn};return m(W,re=>{const ae=v(re,ee),ue=this.#_e(ae&&ae.col),ge=ue&&ue.type==="datetime";if(ae&&ae.type)return ae.type==="datetime"&&!ae.timeZone&&ue?{...ae,timeZone:Q.timeZone||void 0}:ae;if(ge)return{...ae,type:"datetime",timeZone:Q.timeZone||void 0};const Ae=ue&&(ue.dataType?.base||ue.type);return Ae?{...ae,type:Ae}:ae})}#pt(W,Q){const ee=this.#z("expanded",null);return ee?X(ee.has)?ee.has(W,Q):Array.prototype.includes.call(ee,W):!0}#z(W,Q){if(W==="context"||!X(this.#e.stateVersion))return this.#Mt(W,Q);const ee=this.#mt(W),re=this.#f.get(W);if(re&&re.version===ee)return re.value;const ae=this.#Mt(W,Q);return this.#f.set(W,{version:ee,value:ae}),ae}#Mt(W,Q){const ee=this.#e.state;if(ee&&X(ee[W])){const re=ee[W]();return re??Q}return Q}#ut(){const W=this.#e.stateVersion;return X(W)?W():0}#Dt(){const W=this.#e.columnsVersion,Q=this.#e.permissionsVersion;return`${X(W)?W():0}|${X(Q)?Q():0}`}#mt(W){return W==="totals"?this.#Dt():`${this.#ut()}`}#gt(W,Q,ee){if(!X(this.#e.stateVersion))return ee();const re=this.#d.get(W);if(re&&re.version===Q)return re.key;const ae=ee();return this.#d.set(W,{version:Q,key:ae}),ae}#st(W){const Q=(this.#e.compute||{})[W];return X(Q)||_(`ctx.compute.${W} is required by the memory source pipeline`),Q}#ot(){const W=this.#e.columns;return W&&X(W.all)?W.all():[]}#_e(W){const Q=this.#e.columns;return Q&&X(Q.get)?Q.get(W):void 0}#Qe(W,Q){const ee=this.#e.emit;X(ee)&&ee(W,Q)}}}),Ue("packages/core/src/source/abort.js",function(e,U){"use strict";Object.defineProperty(e,"SupersededError",{enumerable:!0,get:function(){return te}}),Object.defineProperty(e,"RequestToken",{enumerable:!0,get:function(){return E}}),Object.defineProperty(e,"AbortScope",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"createAbortScope",{enumerable:!0,get:function(){return z}}),Object.defineProperty(e,"isAbortError",{enumerable:!0,get:function(){return _}});class te extends Error{constructor(X,B="superseded"){super(`[lattice] request ${X?`"${X}" `:""}${B}`),this.name="SupersededError",this.superseded=!0,this.key=X}}class E{#e;constructor(X,B,Y,G){this.#e=X,this.key=B,this.controller=Y,this.signal=Y.signal,this.seq=G}get current(){return!this.signal.aborted&&this.#e.tokenFor(this.key)===this}settle(){this.#e.settle(this)}abort(X){this.signal.aborted||this.controller.abort(new te(this.key,X)),this.#e.settle(this)}}class q{#e=new Map;#t=0;begin(X="",B="superseded"){const Y=this.#e.get(X);Y&&!Y.signal.aborted&&Y.controller.abort(new te(X,B));const G=new E(this,X,new AbortController,++this.#t);return this.#e.set(X,G),G}tokenFor(X){return this.#e.get(X)}pending(X=""){const B=this.#e.get(X);return!!B&&!B.signal.aborted}get size(){return this.#e.size}settle(X){this.#e.get(X.key)===X&&this.#e.delete(X.key)}abort(X="",B="superseded"){const Y=this.#e.get(X);Y&&Y.abort(B)}abortAll(X="superseded"){for(const B of[...this.#e.values()])B.abort(X);this.#e.clear()}}function z(){return new q}function _(Z){if(!Z||typeof Z!="object")return!1;const X=Z;return X.superseded===!0||X.name==="AbortError"||X.name==="SupersededError"}}),Ue("packages/core/src/source/blockcache.js",function(e,U){"use strict";Object.defineProperty(e,"DEFAULT_PAGE_SIZE",{enumerable:!0,get:function(){return te}}),Object.defineProperty(e,"DEFAULT_MAX_CACHED_PAGES",{enumerable:!0,get:function(){return E}}),Object.defineProperty(e,"BlockCache",{enumerable:!0,get:function(){return z}});const te=100,E=32;class q{constructor(Z){this.id=Z,this.rows=null,this.state="pending",this.token=null,this.error=null}}class z{#e=new Map;#t;#n;#r=0;#s=-1;constructor(Z={}){this.#t=Math.max(1,Math.floor(Number(Z.pageSize)||te)),this.#n=Math.max(1,Math.floor(Number(Z.maxCachedPages)||E))}get pageSize(){return this.#t}get maxBlocks(){return this.#n}get size(){return this.#e.size}blockOf(Z){return Math.floor(Z/this.#t)}rangeOf(Z){return{start:Z*this.#t,end:(Z+1)*this.#t}}has(Z){return this.#e.has(Z)}pending(Z){const X=this.#e.get(Z);return!!X&&X.state==="pending"}loaded(Z){const X=this.#e.get(Z);return!!X&&X.state==="loaded"}begin(Z,X){let B=this.#e.get(Z);return B||(B=new q(Z)),B.state="pending",B.token=X,B.error=null,this.#i(Z,B),B}fill(Z,X){const B=this.#e.get(Z)||new q(Z);B.rows=X,B.state="loaded",B.token=null,this.#i(Z,B)}failed(Z,X){const B=this.#e.get(Z)||new q(Z);B.state="error",B.error=X,B.token=null,this.#i(Z,B)}delete(Z){return this.#e.delete(Z)}rowAt(Z){const X=this.blockOf(Z),B=this.#e.get(X);if(!(!B||B.state!=="loaded"||!B.rows))return this.#i(X,B),B.rows[Z-X*this.#t]}rowLoaded(Z){const X=this.blockOf(Z),B=this.#e.get(X);return!!B&&B.state==="loaded"&&!!B.rows&&Z-X*this.#t<B.rows.length}erroredAt(Z){const X=this.#e.get(this.blockOf(Z));return!!X&&X.state==="error"}loadedExtent(){let Z=0;for(const X of this.#e.values()){if(X.state!=="loaded"||!X.rows)continue;const B=X.id*this.#t+X.rows.length;B>Z&&(Z=B)}return Z}fillOf(Z){const X=this.#e.get(Z);return X&&X.state==="loaded"&&X.rows?X.rows.length:null}protect(Z,X){this.#r=this.blockOf(Math.max(0,Z)),this.#s=this.blockOf(Math.max(0,X))}evict(){const Z=[];if(this.#e.size<=this.#n)return Z;for(const[X,B]of this.#e){if(this.#e.size-Z.length<=this.#n)break;X>=this.#r&&X<=this.#s||B.state!=="pending"&&Z.push(X)}for(const X of Z)this.#e.delete(X);return Z}ids(){return[...this.#e.keys()]}clear(){this.#e.clear()}#i(Z,X){this.#e.delete(Z),this.#e.set(Z,X)}}}),Ue("packages/core/src/source/pagewindow.js",function(e,U){"use strict";Object.defineProperty(e,"pageWindow",{enumerable:!0,get:function(){return te}});function te(E,q,z,_){const Z=Math.floor(Number(E)||0);if(Z<=0)return null;const X=Math.max(0,Math.floor(Number(q)||0)),B=Math.max(0,Math.floor(Number(z)||0));if(_){const Y=Math.max(1,Math.ceil(B/Z)),G=Math.min(X,Y-1),j=G*Z;return{page:G,pageSize:Z,offset:j,length:Math.max(0,Math.min(Z,B-j)),pageCount:Y,total:B}}return{page:X,pageSize:Z,offset:X*Z,length:Z,pageCount:Math.max(X+2,Math.ceil(B/Z)),total:null}}}),Ue("packages/core/src/source/paged.js",function(e,U){"use strict";Object.defineProperty(e,"HINT_SETTLE_MS",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"createPagedSource",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"PagedSource",{enumerable:!0,get:function(){return w}});const E=U("packages/core/src/internal/lru.js").Lru,z=U("packages/core/src/internal/predicates.js").isFunction,Z=U("packages/core/src/internal/warn.js").warnOnce,B=U("packages/core/src/internal/schedule.js").settleDebounce,Y=U("packages/core/src/source/abort.js"),G=Y.createAbortScope,j=Y.isAbortError,k=U("packages/core/src/source/blockcache.js"),g=k.BlockCache,c=k.DEFAULT_PAGE_SIZE,d=k.DEFAULT_MAX_CACHED_PAGES,i=U("packages/core/src/source/rows.js").createRowFactory,n=U("packages/core/src/source/filterwire.js"),a=n.wireFilters,s=n.querySignature,t=n.warnHostFilterNotApplied,r=U("packages/core/src/source/pagewindow.js").pageWindow,o=120;function f(m,v){return new w(m,v)}class w{mode="paged";#e;#t;#n;#r=G();#s;#i;#o=new Map;#l=null;#a=null;#c=!1;#u=0;#f="";#d={start:0,end:0};#h;#p=!1;#m=0;#g="";constructor(v,h){this.#e=v||{mode:"paged"},this.#t=h||{},this.#n=new g({pageSize:this.#e.pageSize||c,maxCachedPages:this.#e.maxCachedPages||d}),this.#s=i(this.#t),this.#i=new E(this.#n.pageSize*4),this.#h=B((p,b)=>this.#w(p,b),o),this.#f=this.#E(),z(this.#e.fetch)||Z("source.paged.fetch",'source.mode "paged" requires a fetch function; the grid will stay empty.'),t(this.#t)}count(){const v=this.#y();return v?v.length:this.#b()}#b(){if(this.#T(),this.#l!==null)return this.#l;const v=Math.max(this.#u,this.#n.loadedExtent());return this.#c?v:v+this.#n.pageSize}matchCount(){return this.#b()}totalCount(){return this.#b()}pageInfo(){const v=this.#y();if(!v){const h=this.#b();return{page:0,pageSize:0,total:this.exact()?h:null,pageCount:1,counting:!1}}return{page:v.page,pageSize:v.pageSize,total:v.total,pageCount:v.pageCount,counting:v.total===null&&this.#r.size>0&&this.#u===0&&this.#n.loadedExtent()===0}}#y(){const v=this.#b(),h=r(this.#P("pageSize",0),this.#P("page",0),v,this.exact());if(!h)return this.#g="",null;const p=`${this.#m}:${h.offset}:${h.length}`;if(p!==this.#g&&!this.#p&&(this.#g=p,h.length>0)){const b=h.offset+h.length-1;this.#d={start:h.offset,end:b},this.#w(h.offset,b)}return h}at(v){const h=this.#y();if(h){if(v<0||v>=h.length)return;const p=this.#A(h.offset+v);return p&&(p.index=v),p}return this.#A(v)}#A(v){if(v<0||v>=this.#b())return;const h=this.#i.get(v);if(h&&(h.data!==null||!this.#n.rowLoaded(v)))return h;const p=this.#n.rowAt(v);if(p===void 0){const O=this.#s.skeleton(v,0,this.#n.erroredAt(v));return this.#i.set(v,O),O}const b=this.#s.leaf(p,v);return b.index=v,this.#i.set(v,b),this.#o.set(b.key,v),b}byKey(v){const h=this.#o.get(v);return h===void 0?void 0:this.#A(h)}loaded(v){const h=this.#y();return h?v>=0&&v<h.length&&this.#n.rowLoaded(h.offset+v):this.#n.rowLoaded(v)}loadedCount(){this.#T();let v=0;for(const h of this.#n.ids()){if(!this.#n.loaded(h))continue;const p=this.#n.fillOf(h);typeof p=="number"&&(v+=p)}return v}residentRows(){this.#T();const v=this.#y(),h=v?v.offset:0,p=v?v.offset+v.length:1/0,b=[],O=this.#n.ids().sort((y,L)=>y-L);for(const y of O){if(!this.#n.loaded(y))continue;const{start:L}=this.#n.rangeOf(y),M=this.#n.fillOf(y)||0;for(let D=L;D<L+M;D++){if(D<h||D>=p)continue;const F=this.#i.peek(D);if(F&&F.data!==null&&F.data!==void 0){b.push(F);continue}const T=this.#n.rowAt(D);if(T===void 0)continue;const I=this.#s.leaf(T,D);I.index=D,this.#i.set(D,I),this.#o.set(I.key,D),b.push(I)}}return b}hint(v,h){if(this.#p)return;const p=this.#T();let b=Math.max(0,Math.floor(v)),O=Math.max(b,Math.floor(h));const y=this.#y();if(y){if(y.length===0)return;b=y.offset,O=y.offset+y.length-1}this.#d={start:b,end:O},this.#n.protect(b,O);for(const L of this.#n.evict())this.#v(L);this.#h(b,O),p&&this.#h.flush()}#w(v,h){if(this.#p)return;this.#n.protect(v,h);const p=this.#n.blockOf(v),b=this.#n.blockOf(h);for(let O=p;O<=b&&!(this.#l!==null&&O*this.#n.pageSize>=this.#l);O++)this.#n.has(O)||this.#O(O)}apply(v){const h={added:[],updated:[],removed:[]};if(!v)return h;if(v.update)for(const p of v.update){const b=this.#s.keyOf(p,-1),O=this.#o.get(b);if(O===void 0)continue;const y=this.#s.leaf(p,O);y.index=O,this.#i.set(O,y),h.updated.push(y)}return(v.add&&v.add.length||v.remove&&v.remove.length)&&this.reload(),h}reload(v){this.#S("reload"),this.#h.cancel(),this.hint(this.#d.start,this.#d.end)}destroy(){this.#p=!0,this.#h.cancel(),this.#r.abortAll("destroyed"),this.#n.clear(),this.#i.clear(),this.#o.clear()}exact(){return this.#l!==null||this.#c}pending(){return this.#r.size}async#O(v){if(!z(this.#e.fetch))return;const h=this.#r.begin(`block:${v}`);this.#n.begin(v,h);const{start:p,end:b}=this.#n.rangeOf(v),O=this.#f;try{const y=await this.#e.fetch({range:{start:p,end:b},sort:this.#P("sort",[]),filters:a(this.#P("filters",null),this.#M()),quick:this.#P("quick","")||void 0,context:this.#P("context",null),signal:h.signal});if(!h.current||O!==this.#f||this.#p)return;h.settle();const L=y&&y.rows||[];this.#n.fill(v,L);for(let D=0;D<L.length;D++)this.#i.delete(p+D);const M=y&&typeof y.total=="number"?y.total:y&&typeof y.count=="number"?y.count:null;M!==null?(this.#l=M,this.#c=!0):L.length<this.#n.pageSize?(this.#c=!0,this.#l=p+L.length):this.#u=Math.max(this.#u,p+L.length),this.#N("model:changed",{reason:"page",block:v,from:p,to:p+L.length}),this.#N("rows:changed",{companion:!0,reason:"page",block:v,from:p,to:p+L.length}),this.#l!==null&&this.#l!==this.#a&&(this.#a=this.#l,this.#N("source:total",{total:this.#l,groupPath:[]}))}catch(y){if(h.settle(),j(y))return;this.#n.failed(v,y);for(let L=p;L<b;L++)this.#i.delete(L);this.#N("model:changed",{reason:"page-error",block:v,range:{start:p,end:b}}),this.#N("source:error",{error:y,block:v,range:{start:p,end:b}})}}#v(v){const{start:h,end:p}=this.#n.rangeOf(v);for(let b=h;b<p;b++){const O=this.#i.peek(b);O&&this.#o.delete(O.key),this.#i.delete(b)}}#T(){const v=this.#E();return v===this.#f?!1:(this.#f=v,this.#S("query"),!0)}#S(v){this.#r.abortAll(v),this.#n.clear(),this.#i.clear(),this.#o.clear(),this.#l=null,this.#a=null,this.#c=!1,this.#u=0,this.#m++,this.#N("model:changed",{reason:v})}#E(){return s({filters:this.#P("filters",null),sort:this.#P("sort",[]),quick:this.#P("quick",""),context:this.#P("context",null)})}#M(){const v=this.#t.config||{};return{tz:v.timeZone,weekStartsOn:v.weekStartsOn}}#P(v,h){const p=this.#t.state;if(p&&z(p[v])){const b=p[v]();return b??h}return h}#N(v,h){const p=this.#t.emit;z(p)&&p(v,h)}}}),Ue("packages/core/src/source/aggregates.js",function(e,U){"use strict";Object.defineProperty(e,"STAT_PUSHDOWN",{enumerable:!0,get:function(){return te}}),Object.defineProperty(e,"pushableAggregates",{enumerable:!0,get:function(){return E}}),Object.defineProperty(e,"fillAggregateSql",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"resolveAggregatesConfig",{enumerable:!0,get:function(){return z}}),Object.defineProperty(e,"routeAggregate",{enumerable:!0,get:function(){return _}}),Object.defineProperty(e,"resolveAggregatePlan",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"groupKeysPushable",{enumerable:!0,get:function(){return B}}),Object.defineProperty(e,"pushdownDocRows",{enumerable:!0,get:function(){return Y}});const te=Object.freeze({sum:{pushable:!0,class:"identical",sql:"sum(%c)"},avg:{pushable:!0,class:"identical",sql:"avg(%c)"},min:{pushable:!0,class:"identical",sql:"min(%c)"},max:{pushable:!0,class:"identical",sql:"max(%c)"},count:{pushable:!0,class:"identical",sql:"count(*)"},countValues:{pushable:!0,class:"identical",sql:"count(%c)",blankAware:!0},range:{pushable:!0,class:"identical",sql:"(max(%c) - min(%c))"},variance:{pushable:!0,class:"identical",sql:"var_samp(%c)"},varianceP:{pushable:!0,class:"identical",sql:"var_pop(%c)"},stddev:{pushable:!0,class:"identical",sql:"stddev_samp(%c)"},stddevP:{pushable:!0,class:"identical",sql:"stddev_pop(%c)"},sumSquares:{pushable:!0,class:"identical",sql:"sum(%c * %c)"},median:{pushable:!0,class:"identical",sql:"median(%c)"},p25:{pushable:!0,class:"identical",sql:"quantile_cont(%c, 0.25)"},p75:{pushable:!0,class:"identical",sql:"quantile_cont(%c, 0.75)"},p90:{pushable:!0,class:"identical",sql:"quantile_cont(%c, 0.9)"},p95:{pushable:!0,class:"identical",sql:"quantile_cont(%c, 0.95)"},p99:{pushable:!0,class:"identical",sql:"quantile_cont(%c, 0.99)"},iqr:{pushable:!0,class:"identical",sql:"(quantile_cont(%c, 0.75) - quantile_cont(%c, 0.25))"},mad:{pushable:!0,class:"identical",sql:"mad(%c)"},distinct:{pushable:!0,class:"identical",sql:"count(DISTINCT %c)",blankAware:!0},skewness:{pushable:!0,class:"identical",sql:"skewness(%c)"},kurtosis:{pushable:!0,class:"identical",sql:"kurtosis(%c)"},geomean:{pushable:!0,class:"identical",sql:"exp(avg(ln(%c)))"},harmean:{pushable:!0,class:"identical",sql:"(count(%c) / sum(1.0 / %c))"},entropy:{pushable:!0,class:"identical",sql:"entropy(%c)",blankAware:!0},correlation:{pushable:!0,class:"identical",sql:"corr(%w, %c)",twoColumn:!0},hhi:{pushable:!0,class:"identical",blankAware:!0,sql:"CASE WHEN count(%c)=0 THEN NULL ELSE list_sum(list_transform(map_values(histogram(%c)), lambda v: (v::DOUBLE/count(%c))*(v::DOUBLE/count(%c)))) END"},evenness:{pushable:!0,class:"identical",blankAware:!0,sql:"CASE WHEN count(%c)=0 THEN NULL WHEN count(DISTINCT %c)<2 THEN 1.0 ELSE entropy(%c)/log2(count(DISTINCT %c)) END"},top3Share:{pushable:!0,class:"identical",blankAware:!0,sql:"CASE WHEN count(%c)=0 THEN NULL ELSE list_sum(list_slice(list_sort(map_values(histogram(%c)),'DESC'),1,3))::DOUBLE/count(%c) END"},top10Share:{pushable:!0,class:"identical",blankAware:!0,sql:"CASE WHEN count(%c)=0 THEN NULL ELSE list_sum(list_slice(list_sort(map_values(histogram(%c)),'DESC'),1,10))::DOUBLE/count(%c) END"},gini:{pushable:!0,class:"identical",sql:"CASE WHEN list_min(list(%c) FILTER (WHERE isfinite(%c)))<0 THEN NULL WHEN len(list(%c) FILTER (WHERE isfinite(%c)))=0 THEN NULL WHEN list_sum(list(%c) FILTER (WHERE isfinite(%c)))=0 THEN 0 ELSE 2.0*list_sum(list_transform(list_sort(list(%c) FILTER (WHERE isfinite(%c))), lambda v, i: i*v))/(len(list(%c) FILTER (WHERE isfinite(%c)))*list_sum(list(%c) FILTER (WHERE isfinite(%c))))-(len(list(%c) FILTER (WHERE isfinite(%c)))+1.0)/len(list(%c) FILTER (WHERE isfinite(%c))) END"},trimmedMean:{pushable:!0,class:"identical",sql:"CASE WHEN len(list(%c) FILTER (WHERE isfinite(%c)))=0 THEN NULL ELSE list_avg(list_slice(list_sort(list(%c) FILTER (WHERE isfinite(%c))), floor(len(list(%c) FILTER (WHERE isfinite(%c)))*0.1)::BIGINT+1, len(list(%c) FILTER (WHERE isfinite(%c)))-floor(len(list(%c) FILTER (WHERE isfinite(%c)))*0.1)::BIGINT)) END"},winsorizedMean:{pushable:!0,class:"identical",sql:"CASE WHEN len(list(%c) FILTER (WHERE isfinite(%c)))=0 THEN NULL ELSE list_avg(list_transform(list_sort(list(%c) FILTER (WHERE isfinite(%c))), lambda v: least(list_sort(list(%c) FILTER (WHERE isfinite(%c)))[len(list(%c) FILTER (WHERE isfinite(%c)))-floor(len(list(%c) FILTER (WHERE isfinite(%c)))*0.1)::BIGINT], greatest(list_sort(list(%c) FILTER (WHERE isfinite(%c)))[floor(len(list(%c) FILTER (WHERE isfinite(%c)))*0.1)::BIGINT+1], v)))) END"},robustOutliers:{pushable:!0,class:"identical",sql:"(SELECT CASE WHEN len(d.a)=0 THEN NULL WHEN d.mad=0 THEN NULL ELSE len(list_filter(d.a, lambda v: abs(0.6745*(v-d.med)/d.mad)>3.5)) END FROM (SELECT xs AS a, list_median(xs) AS med, list_median(list_transform(xs, lambda w: abs(w-list_median(xs)))) AS mad FROM (SELECT list(%c) FILTER (WHERE isfinite(%c)) AS xs)) d)"},jarqueBera:{pushable:!0,class:"identical",sql:"CASE WHEN len(list(%c) FILTER (WHERE isfinite(%c)))<8 THEN NULL WHEN list_avg(list_transform(list(%c) FILTER (WHERE isfinite(%c)), lambda v: power(v-list_avg(list(%c) FILTER (WHERE isfinite(%c))),2)))=0 THEN NULL ELSE (len(list(%c) FILTER (WHERE isfinite(%c)))/6.0)*(power(list_avg(list_transform(list(%c) FILTER (WHERE isfinite(%c)), lambda v: power(v-list_avg(list(%c) FILTER (WHERE isfinite(%c))),3)))/power(list_avg(list_transform(list(%c) FILTER (WHERE isfinite(%c)), lambda v: power(v-list_avg(list(%c) FILTER (WHERE isfinite(%c))),2))),1.5),2)+power(list_avg(list_transform(list(%c) FILTER (WHERE isfinite(%c)), lambda v: power(v-list_avg(list(%c) FILTER (WHERE isfinite(%c))),4)))/power(list_avg(list_transform(list(%c) FILTER (WHERE isfinite(%c)), lambda v: power(v-list_avg(list(%c) FILTER (WHERE isfinite(%c))),2))),2)-3,2)/4.0) END"},weightedAvg:{pushable:!0,class:"identical",twoColumn:!0,sql:"sum(%c*%w) FILTER (WHERE isfinite(%c) AND isfinite(%w))/nullif(sum(%w) FILTER (WHERE isfinite(%c) AND isfinite(%w)),0)"},mode:{pushable:!0,class:"may-differ",sql:"mode(%c)",note:"DuckDB returns a modal value even for an all-distinct column; the grid returns null. Tie-breaking can also differ, and on a text column an empty string counts as a value. Under pushdown you will see a value."},weightedQuantile:{pushable:!1,class:"fallback",note:"No SQL equivalent for the grid's weighted-quantile midpoint convention; always computed client-side (needs a full-dataset pull for a correct figure over a remote source)."}});function E(){const G=new Set;for(const[j,k]of Object.entries(te))k.pushable&&G.add(j);return G}function q(G,j,k){let g=G.split("%c").join(j);return k!==void 0&&(g=g.split("%w").join(k)),g}function z(G){const j=G||{},k=j.default==="engine"||j.default==="engine-if-identical"?j.default:"client",g={};if(j.overrides&&typeof j.overrides=="object")for(const[c,d]of Object.entries(j.overrides))(d==="engine"||d==="client")&&(g[c]=d);return{default:k,overrides:g}}function _(G,j){const k=te[G];if(!k||!k.pushable)return"client";const g=j.overrides[G];return g==="engine"||g==="client"?g:j.default==="client"?"client":j.default==="engine-if-identical"?k.class==="identical"?"engine":"client":"engine"}function Z(G,j){const k=z(j),g=[],c=[];for(const d of G||[]){const l=te[d.fn],i=_(d.fn,k),n={id:d.id,col:d.col,fn:d.fn,class:l?l.class:"fallback"};d.weight!==void 0&&(n.weight=d.weight),d.params!==void 0&&(n.params=d.params),i==="engine"?g.push(n):(n.reason=l&&!l.pushable?l.note||"the engine cannot express this stat":"client by config",c.push(n))}return{engine:g,client:c,config:k}}const X=/^[A-Za-z_][A-Za-z0-9_$]*$/;function B(G,j=[]){return(G||[]).every(g=>{if(typeof g=="string")return X.test(g);if(!g||typeof g!="object")return!1;const c=g;return Array.isArray(j)&&j.includes(c.bucket)&&typeof c.col=="string"&&X.test(c.col)&&typeof c.size=="number"&&Number.isFinite(c.size)&&c.size>0})}function Y(){return Object.entries(te).map(([G,j])=>({stat:G,class:j.class,sql:j.sql?q(j.sql,"col",j.twoColumn?"weight":void 0):"",note:j.note||(j.class==="identical"?"Pushes to DuckDB with the same result.":"")}))}}),Ue("packages/core/src/source/pushdown.js",function(e,U){"use strict";Object.defineProperty(e,"FOREGROUND_WAIT_MS",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"NO_CAPABILITIES",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"resolveMutate",{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,"capabilitiesOf",{enumerable:!0,get:function(){return w}}),Object.defineProperty(e,"splitFilters",{enumerable:!0,get:function(){return v}}),Object.defineProperty(e,"LEAF_COUNT_ID",{enumerable:!0,get:function(){return h}}),Object.defineProperty(e,"PIVOT_UNSUPPORTED",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"GROUP_UNSUPPORTED",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"UNGROUPED_LEVEL",{enumerable:!0,get:function(){return M}}),Object.defineProperty(e,"planQuery",{enumerable:!0,get:function(){return F}}),Object.defineProperty(e,"applyResidual",{enumerable:!0,get:function(){return P}}),Object.defineProperty(e,"DEFAULT_WHERE_ROW_LIMIT",{enumerable:!0,get:function(){return A}}),Object.defineProperty(e,"createPushdownSource",{enumerable:!0,get:function(){return V}});const E=U("packages/core/src/internal/compare.js").defaultCompare,z=U("packages/core/src/internal/predicates.js").isFunction,Z=U("packages/core/src/internal/merge.js").toArray,B=U("packages/core/src/internal/warn.js").warnOnce,Y=U("packages/core/src/source/filterwire.js"),G=Y.isGroup,j=Y.warnWherePageRelative,k=Y.warnWhereOverThreshold,g=Y.wireFilters,c=U("packages/core/src/source/aggregates.js"),d=c.resolveAggregatePlan,l=c.groupKeysPushable,i=c.STAT_PUSHDOWN,a=U("packages/core/src/source/abort.js").SupersededError,s=1e3;function t(W){const Q=W&&W.signal;if(!Q||!Q.aborted)return;const ee=Q.reason;throw ee instanceof Error?ee:new a("","superseded before it was sent")}const u=Object.freeze({filter:!1,operators:Object.freeze([]),sort:!1,quick:!1,range:!1,total:!1,group:!1,pivot:!1,mutate:!1});function r(W){if(!W||typeof W!="object")return!1;const Q=W.returning==="row"||W.returning==="key"?W.returning:"none";return{append:W.append===!0,update:W.update===!0,delete:W.delete===!0,returning:Q}}function o(W,Q){if(!W||typeof Q!="string")return;if(!Q.includes("."))return W[Q];let ee=W;for(const re of Q.split(".")){if(ee===null||typeof ee!="object")return;ee=ee[re]}return ee}function f(W){if(W===!0)return!0;if(!W||typeof W!="object")return!1;const Q=W;return Q.enabled===!1?!1:Q.enabled===!0||z(Q.commit)}function w(W){const Q={...u,...W||{}};return Q.operators=new Set(Q.operators||[]),Q.mutate=r(Q.mutate),Q}function m(W,Q){return!W||!W.op||!Q.operators.size?!1:Q.operators.has(W.op)}function v(W,Q){if(!W)return{pushed:null,residual:null};if(!Q.filter)return{pushed:null,residual:W};if(Q.filter==="term"){if(G(W)){const ue=W.conditions||[];if(String(W.op)!=="and")return{pushed:null,residual:W};const ge=ue.findIndex(pe=>!G(pe)&&m(pe,Q));if(ge<0)return{pushed:null,residual:W};const Ae=ue.filter((pe,Me)=>Me!==ge);return{pushed:ue[ge],residual:Ae.length?{op:"and",conditions:Ae}:null}}return m(W,Q)?{pushed:W,residual:null}:{pushed:null,residual:W}}if(!G(W))return m(W,Q)?{pushed:W,residual:null}:{pushed:null,residual:W};if(String(W.op)!=="and")return(W.conditions||[]).every(ge=>G(ge)?v(ge,Q).residual===null:m(ge,Q))?{pushed:W,residual:null}:{pushed:null,residual:W};const ee=[],re=[];for(const ue of W.conditions||[]){if(G(ue)){if(Q.filter==="flat"){re.push(ue);continue}const ge=v(ue,Q);ge.pushed&&ee.push(ge.pushed),ge.residual&&re.push(ge.residual);continue}(m(ue,Q)?ee:re).push(ue)}const ae=ue=>ue.length===0?null:ue.length===1?ue[0]:{op:"and",conditions:ue};return{pushed:ae(ee),residual:ae(re)}}const h="__lattice_leaves";function p(W){return W.aggregates?W.aggregates instanceof Set?W.aggregates:new Set(Z(W.aggregates)):new Set}function b(W){const Q=p(W);return Q.size?Q.has("count")?W.filter!=="tree"||!W.operators||!W.operators.has("eq")?"the adapter does not declare the `group` capability, and cannot narrow a group's rows by its key (that needs a `tree` filter with the `eq` operator)":"":"the adapter does not declare the `group` capability, and its declared aggregates have no `count` to give each group its row count":"the adapter does not declare the `group` capability"}function O(W,Q,ee,re,ae,ue,ge){const Ae=Array.isArray(W.groupBy)?W.groupBy:[],pe=Array.isArray(W.groupPath)?W.groupPath:[],Me=Array.isArray(W.groupValues)?W.groupValues:null;if(!Q.group){const Ne=b(Q);if(Ne)return Ne}return l(Ae)?ee.residual?"the filter did not fully push, so the engine would group a superset of the matching rows":re?ae?ue?"a host `where` predicate can only run in the browser, over rows the engine grouped":ge?"fullDataset holds the whole matching set, so the grid groups it itself":!Me||Me.length!==pe.length?"the request carries no typed `groupValues` for its group path, and the string `groupPath` cannot be compared against a typed column":"":"a quick search did not push, so the engine would group unsearched rows":"the sort did not push, so the engine would order the groups differently":"a grouping key is not a plain column the engine can name in a GROUP BY"}const y="pushdown:pivot-unsupported",L="pushdown:group-unsupported",M=Symbol("lattice.remote.ungroupedLevel");function D(W,Q,ee,re,ae,ue){const ge=Array.isArray(W.pivotBy)?W.pivotBy:[],Ae=Array.isArray(W.groupBy)?W.groupBy:[],pe=Array.isArray(W.groupPath)?W.groupPath:[],Me=Array.isArray(W.groupValues)?W.groupValues:null;return Q.pivot?l(ge)?Ae.length&&!l(Ae)?"a grouping key is not a plain column the engine can name in a GROUP BY":ee.residual?"the filter did not fully push, so the engine would pivot a superset of the matching rows":re?ae?ue?"a host `where` predicate can only run in the browser, over rows the engine pivoted":!Me||Me.length!==pe.length?"the request carries no typed `groupValues` for its group path, and the string `groupPath` cannot be compared against a typed column":"":"a quick search did not push, so the engine would pivot unsearched rows":"the sort did not push, so the engine would order the rows differently":"a pivot column is not a plain column the engine can name in a GROUP BY":"the adapter does not declare the `pivot` capability"}function F(W,Q,ee=!1){const re=v(W.filters||null,Q),ae=[];re.residual&&ae.push("filter");const ue=W.sort||[],ge=ue.length===0||Q.sort==="multi"&&ue.length>=1||Q.sort==="single"&&ue.length===1;!ge&&ue.length&&ae.push("sort");const Ae=W.quick?String(W.quick):"",pe=!Ae||!!Q.quick;pe||ae.push("quick");const Me=W.where&&W.where.active?W.where:null;Me&&ae.push("where");const Ne={filters:re.residual,sort:ge?null:ue,quick:pe?"":Ae,where:Me},Pe=!!ee,ie=Array.isArray(W.groupBy)&&W.groupBy.length>0,Oe=ie?O(W,Q,re,ge,pe,Me,Pe):"",je=W.pivotMode!==!1&&Array.isArray(W.pivotBy)&&W.pivotBy.length>0,Ce=je?D(W,Q,re,ge,pe,Me):"",fe=je&&Ce==="";je&&!fe&&ae.push("pivot");const Ee=je?fe&&ie:ie&&Oe==="";ie&&!je&&!Ee&&ae.push("group");const le=(Ee||fe)&&Array.isArray(W.groupValues)?W.groupValues.length:0,de=Ee||je?!1:Pe||!!(Ne.filters||Ne.sort||Ne.quick||Ne.where)||!Q.range;return{pushed:{...W,filters:re.pushed,sort:ge?ue:[],quick:pe?Ae:"",range:de?null:W.range},residual:Ne,needsAll:de,unpushed:ae,full:Pe,grouped:Ee,groupLevel:le,groupReason:je?"":Oe,pivoted:fe,pivotReason:Ce}}function T(W){const Q=Array.isArray(W.totals)?W.totals:[],ee=W.totalFns&&typeof W.totalFns=="object"?W.totalFns:{},re=[],ae=[];for(const ue of Q){const ge=String(ue),Ae=typeof ee[ge]=="string"?ee[ge]:null,pe=Ae?i[Ae]:null;Ae?!pe||!pe.pushable||!pe.sql?ae.push({id:ge,fn:Ae,class:pe?pe.class:"fallback",reason:pe&&pe.note?pe.note:`the pushdown map cannot express "${Ae}"`}):pe.twoColumn?ae.push({id:ge,fn:Ae,class:pe.class,reason:`"${Ae}" reduces two columns, and a grouped request carries no weight column`}):re.push({id:ge,col:ge,fn:Ae,class:pe.class}):ae.push({id:ge,fn:null,class:"fallback",reason:"the column totals with a host function, so there is no named statistic to push"})}return{engine:re,client:ae}}const I=Object.freeze({items:W=>W==null?[]:Array.isArray(W)?W:[W]});function P(W,Q,ee){if(!Q)return W;let re=W;if(Q.filters&&z(ee.evaluateFilters)){const ae=re,ue={count:re.length,handle:pe=>({id:pe,get:Me=>o(ae[Me],pe)}),itemwise:pe=>ae.some(Me=>Array.isArray(o(Me,pe)))?I:null},ge=ee.evaluateFilters(Q.filters,ue),Ae=[];for(let pe=0;pe<re.length;pe++)ge[pe]&&Ae.push(re[pe]);re=Ae}if(Q.where&&Q.where.active&&(Q.whole||j(Q.where.names,"pushdown"),re=re.filter(ae=>Q.where.passes(ae))),Q.quick){const ae=Q.quick.toLowerCase();re=re.filter(ue=>{if(!ue||typeof ue!="object")return!1;for(const ge of Object.values(ue))if(ge!=null&&String(ge).toLowerCase().includes(ae))return!0;return!1})}if(Q.sort&&Q.sort.length&&z(ee.sortMulti)){const ae=[...new Set(Q.sort.map(pe=>pe.col))],ue=re,ge=ae.map(pe=>({id:pe,get:Me=>o(ue[Me],pe)})),Ae=ee.sortMulti(ge,Q.sort.map(pe=>({col:pe.col,dir:pe.dir})),Uint32Array.from({length:re.length},(pe,Me)=>Me),{});re=Array.from(Ae,pe=>ue[pe])}return re}function R(W){return JSON.stringify({filters:W.filters||null,sort:W.sort||[],quick:W.quick||"",groupBy:W.groupBy||[],groupPath:W.groupPath||[],context:W.context??null})}function $(W){if(!W||typeof W!="object")return 16;let Q="";try{Q=JSON.stringify(W)}catch{return 200}return Q.length*2+64}function C(W){const Q=W||{};return{enabled:!!Q.enabled,maxRows:Number.isFinite(Q.maxRows)?Q.maxRows:1e6,maxBytesEstimate:Number.isFinite(Q.maxBytesEstimate)?Q.maxBytesEstimate:512*1024*1024}}const A=5e4;function S(W){return Number.isFinite(W)&&W>=0?W:A}function x(W){return!!W&&z(W.then)}async function H(W){if(!W||W.total!==void 0||!x(W.pendingTotal))return W;const Q=await W.pendingTotal,{pendingTotal:ee,...re}=W;return typeof Q=="number"?{...re,total:Q}:re}function V(W={}){const Q=W.adapter;if(!Q||!z(Q.execute))return B("source.pushdown.adapter","createPushdownSource needs an `adapter` with an `execute(query)` function."),{...W,mode:"remote",fetch:async()=>({rows:[],total:0})};const ee=w(Q.capabilities),re=Q.capabilities&&Object.getOwnPropertyDescriptor(Q.capabilities,"operators");re&&z(re.get)&&Object.defineProperty(ee,"operators",{enumerable:!0,configurable:!0,get:()=>new Set(Q.capabilities.operators||[]),set:()=>{}});const ae=Q.name||"adapter";let ue=null;const ge=()=>z(Q.ready)?(ue||(ue=Promise.resolve(Q.ready()).then(()=>{Object.assign(ee,w(Q.capabilities))},ce=>{throw ue=null,ce})),ue):null,Ae=C(W.fullDataset),pe=!!W.allowPartialResults,Me=S(W.whereRowLimit);let Ne=null;const Pe=W.aggregates;let ie=null,Oe=null,je=null,Ce=null,fe=null,Ee,le=null,de=0,Se=null;const Fe=()=>!Ae.enabled||!ie?null:(Se!==ie.key&&(de++,Se=ie.key),{rows:ie.rows,version:de}),ke=async ce=>{const he=ce.where&&ce.where.active?ce.where:null;if(!he)return{request:ce,probe:null};const{where:ye,...ve}=ce,Te=F(ve,ee,Ae.enabled);if(Te.needsAll)return{request:ce,probe:null};const xe=R(Te.pushed);let ze=null;return(!Ne||Ne.key!==xe)&&(ee.total?(t(ce),ze=await H(await Q.execute(Te.pushed,ce)),Ne={key:xe,size:ze&&typeof ze.total=="number"?ze.total:null}):Ne={key:xe,size:null}),Ne.size!==null&&Ne.size<Me?{request:ce,probe:null}:(k(he.names,ae,Ne.size,Me),{request:ve,probe:ze})},Ie=async(ce,he)=>{le=null;const ye=T(ce.pushed);je={engine:ye.engine,client:ye.client,groupBy:ce.pushed.groupBy},ye.client.length&&B(`source.pushdown.group.totals.${ae}.${ye.client.map(xe=>xe.id).join(".")}`,`the ${ae} adapter cannot compute the group subtotal for ${ye.client.map(xe=>`"${xe.id}" (${xe.reason})`).join(", ")}, so those group rows carry no value for that column. A figure computed over anything other than the group would be wrong, so none is shown; \`lastPlan().aggregates.client\` names them.`);const ve=await Q.executeGroupLevel(ce.pushed,ye.engine,he)||{};let Te=ve.rows||[];return!ee.range&&he.range&&(Te=Te.slice(he.range.start,he.range.end)),tt(ve),ve.total===void 0?{rows:Te}:{rows:Te,total:ve.total}},Be=new Map,Ke=64,rt=async(ce,he)=>{le=null;const ye=ce.pushed,ve=ye.groupBy,Te=Array.isArray(ye.groupValues)?ye.groupValues:[],xe=Te.length,ze=[...ye.filters?[ye.filters]:[],...ve.slice(0,xe).map((mt,dt)=>({col:mt,op:"eq",value:Te[dt]===void 0?null:Te[dt],caseSensitive:!0}))],Ye=ze.length===0?null:ze.length===1?ze[0]:{op:"and",conditions:ze},$e=he.range?he.range.start:0;if(xe>=ve.length){const mt={...ye,filters:Ye,groupBy:[],groupPath:[],groupValues:[],totals:[],totalFns:{}},dt=await H(await Q.execute(mt,he))||{};let Nt=dt.rows||[];return!ee.range&&he.range&&(Nt=Nt.slice(he.range.start,he.range.end)),typeof dt.total=="number"?{rows:Nt,total:dt.total}:{rows:Nt}}const Ge=ve[xe],Ze=T(ye),Je=p(ee),Qe=Ze.engine.filter(mt=>Je.has(mt.fn)),lt=[...Ze.engine.filter(mt=>!Je.has(mt.fn)).map(mt=>({id:mt.id,fn:mt.fn,class:mt.class,reason:`the ${ae} adapter does not compute "${mt.fn}"`})),...Ze.client];je={engine:Qe,client:lt,groupBy:ve},lt.length&&B(`source.pushdown.group.totals.${ae}.${lt.map(mt=>mt.id).join(".")}`,`the ${ae} adapter cannot compute the group subtotal for ${lt.map(mt=>`"${mt.id}" (${mt.reason})`).join(", ")}, so those group rows carry no value for that column. A figure computed over anything other than the group would be wrong, so none is shown; \`lastPlan().aggregates.client\` names them.`);const ot=[...Qe.map(mt=>({id:mt.id,col:mt.col,fn:mt.fn})),{id:h,col:Ge,fn:"count"}],st={...ye,filters:Ye,range:null},St=JSON.stringify([R(st),Te,Ge,ot]);let jt=$e>0?Be.get(St):void 0;if(!jt){for(jt=Promise.resolve(Q.executeGroupedAggregates(st,[Ge],ot)),Be.delete(St),Be.set(St,jt);Be.size>Ke;)Be.delete(Be.keys().next().value);jt.catch(()=>{Be.get(St)===jt&&Be.delete(St)})}const Mt=await jt||[];t(he);const We=mt=>{const dt={};for(const Nt of Qe)dt[Nt.id]=mt?mt[Nt.id]:void 0;return dt},ut=(ye.sort||[]).find(mt=>mt&&mt.col===Ge),ft=ut&&ut.dir==="desc"?-1:1,wt=Mt.filter(mt=>mt&&mt.level===1).map(mt=>({[Ge]:mt.keys[0]===void 0?null:mt.keys[0],leafCount:Number(mt.values&&mt.values[h])||0,totals:We(mt.values)})).sort((mt,dt)=>ft*E(mt[Ge],dt[Ge]));if(xe===0){const mt=Mt.find(Nt=>Nt&&Nt.level===0),dt=mt?Number(mt.values&&mt.values[h]):NaN;tt({matchCount:Number.isFinite(dt)?dt:wt.reduce((Nt,Ut)=>Nt+Ut.leafCount,0),...mt?{grand:We(mt.values)}:{}})}const Et=he.range?he.range.end:wt.length;return{rows:wt.slice($e,Et),total:wt.length}},tt=ce=>{typeof ce.matchCount=="number"&&(Ce=ce.matchCount,fe=ce.grand?{totals:ce.grand,leafCount:ce.matchCount}:null,Ee===void 0&&z(Q.unfilteredCount)&&(Ee=null,Promise.resolve(Q.unfilteredCount()).then(he=>{Ee=typeof he=="number"?he:null}).catch(he=>{B(`source.pushdown.group.unfiltered.${ae}`,`the ${ae} adapter could not count the unfiltered set (${he&&he.message?he.message:he}), so "N of M" falls back to the display count for its denominator.`)})))},pt=async(ce,he)=>{le=null;const ye=T(ce.pushed);je={engine:ye.engine,client:ye.client,groupBy:ce.pushed.groupBy,pivotBy:ce.pushed.pivotBy},ye.client.length&&B(`source.pushdown.pivot.totals.${ae}.${ye.client.map(Ye=>Ye.id).join(".")}`,`the ${ae} adapter cannot compute the pivot cells for ${ye.client.map(Ye=>`"${Ye.id}" (${Ye.reason})`).join(", ")}, so those cells are empty. A figure computed over anything other than the cell would be wrong, so none is shown; \`lastPlan().aggregates.client\` names them.`);const ve=await Q.executePivotLevel(ce.pushed,ye.engine,he)||{};let Te=ve.rows||[];!ee.range&&he.range&&(Te=Te.slice(he.range.start,he.range.end)),tt(ve);const xe=ve.pivot&&typeof ve.pivot=="object"?ve.pivot:{},ze={cells:Array.isArray(xe.cells)?xe.cells:[],...Array.isArray(xe.axis)?{axis:xe.axis}:{}};return ve.total===void 0?{rows:Te,pivot:ze}:{rows:Te,total:ve.total,pivot:ze}},yt=ce=>{B(`source.pushdown.pivot.${ae}.${ce}`,`pushdown:pivot-unsupported: the ${ae} adapter cannot pivot this query because ${ce}, so no rows are fetched rather than every leaf row being pulled into the browser to pivot there. \`lastPlan().pivotReason\` says the same.`);const he=new Error(`[lattice] ${y}: the ${ae} adapter cannot pivot this query because ${ce}, so no rows are fetched rather than every leaf row being pulled into the browser to pivot there. \`lastPlan().pivotReason\` says the same.`);throw he.code=y,he.reason=ce,he},kt=(ce,he)=>{const ye={key:he,state:"pending",value:null};return le=ye,ce.then(ve=>(le===ye&&(le={key:he,state:"settled",value:typeof ve=="number"?ve:null}),ve),ve=>{throw le===ye&&(le={key:he,state:"failed",value:null}),ve})};let Pt=0,Ct=[];const Lt=()=>Pt===0?null:new Promise(ce=>{const he=setTimeout(ce,s);Ct.push(()=>{clearTimeout(he),ce()})});let Rt;const Bt=async ce=>{const he=ge();he&&await he;const ve=ce&&ce.pivotMode!==!1&&Array.isArray(ce.pivotBy)&&ce.pivotBy.length>0?{request:ce,probe:null}:await ke(ce);t(ce);let Te=F(ve.request,ee,Ae.enabled);if(ee.group&&Te.grouped&&!Te.pivoted&&!z(Q.executeGroupLevel)&&(B(`source.pushdown.group.method.${ae}`,`the ${ae} adapter declares the \`group\` capability but has no \`executeGroupLevel(query, aggregates, request)\`, so grouping is not pushed and the grid stays ungrouped unless it holds the whole matching set. Implement the method or drop the capability.`),Te=F(ve.request,{...ee,group:!1,aggregates:null},Ae.enabled)),Te.pivoted&&!z(Q.executePivotLevel)&&(Te=F(ve.request,{...ee,pivot:!1},Ae.enabled),Te.pivotReason="the adapter declares the `pivot` capability but has no `executePivotLevel(query, aggregates, request)`"),Te.grouped&&!Te.pivoted&&!ee.group&&!z(Q.executeGroupedAggregates)&&(B(`source.pushdown.group.aggregates.method.${ae}`,`the ${ae} adapter declares \`aggregates\` but has no \`executeGroupedAggregates(query, groupBy, aggregates)\`, so the grouped view cannot be built from grouped aggregates and the grid stays ungrouped unless it holds the whole matching set. Implement the method, or declare \`group\` and implement \`executeGroupLevel\`.`),Te=F(ve.request,{...ee,aggregates:null},Ae.enabled)),Oe=Te,Te.pivoted)return pt(Te,ce);if(Te.pivotReason&&yt(Te.pivotReason),Te.grouped)return ee.group?Ie(Te,ce):rt(Te,ce);const ze=!!Te.groupReason&&!Te.full;ze?B(`source.pushdown.group-unsupported.${ae}.${Te.groupReason}`,`pushdown:group-unsupported: the ${ae} adapter was not asked to group this query because ${Te.groupReason}, so the grid stays ungrouped rather than building group rows, counts and subtotals from a window of leaf rows. \`lastPlan().groupReason\` says the same.`):Te.groupReason&&B(`source.pushdown.group.${ae}.${Te.groupReason}`,`the ${ae} adapter was not asked to group this query because ${Te.groupReason}. The engine returns rows and the grouping is the grid's to do, which needs every matching row in the browser — correct where the grid holds them, and wrong-looking where it holds a window. \`lastPlan().unpushed\` names it.`);const Ye=ot=>ze?{...ot,[M]:!0}:ot;if(!Te.needsAll){const ot=ve.probe||await Q.execute(Te.pushed,ce),st=ot.rows||[];return x(ot.pendingTotal)&&ot.total===void 0?Ye({rows:st,pendingTotal:kt(ot.pendingTotal,R(Te.pushed))}):(le=null,!ee.total&&ot.total===void 0?Ye({rows:st}):Ye({rows:st,total:ot.total??st.length}))}Te.unpushed.length&&B(`source.pushdown.residual.${ae}.${Te.unpushed.join(".")}`,`the ${ae} adapter cannot push ${Te.unpushed.join(" or ")}, so every matching row is fetched and the rest is applied in the browser. Correct, and slower than it needs to be: widening the adapter is the fix.`);const $e=R(Te.pushed);if(!ie||ie.key!==$e){const ot=await H(await Q.execute(Te.pushed,ce));le=null;const st=ot.rows||[];if(Te.full){const St=typeof ot.total=="number"?Math.max(ot.total,st.length):st.length;if(St>Ae.maxRows)throw new Error(`[lattice] fullDataset refused: the ${ae} adapter's matching set is ${St.toLocaleString()} rows, past the configured maxRows of ${Ae.maxRows.toLocaleString()}. The whole set cannot be held client-side, so it is refused rather than truncated — a fraction shown as the whole would make every total and statistic silently wrong. Narrow the filter or raise maxRows.`);const jt=st.length*$(st[0]);if(jt>Ae.maxBytesEstimate)throw new Error(`[lattice] fullDataset refused: the ${ae} adapter's matching set is an estimated ${Math.round(jt/(1024*1024)).toLocaleString()} MB across ${st.length.toLocaleString()} rows, past the configured maxBytesEstimate of ${Math.round(Ae.maxBytesEstimate/(1024*1024)).toLocaleString()} MB. The whole set cannot be held client-side, so it is refused rather than truncated. Narrow the filter or raise maxBytesEstimate.`)}if(typeof ot.total=="number"&&st.length<ot.total){const St=!!(Te.residual.filters||Te.residual.quick||Te.residual.sort&&Te.residual.sort.length);if(St&&!pe)throw new Error(`[lattice] the ${ae} adapter returned ${st.length} of ${ot.total} matching rows when asked for the whole result, and the query has residual ${Te.unpushed.join(" and ")||"work"} to finish in the browser. Filtering or sorting a fraction of the result would return wrong rows, so the result is refused. Fix the adapter to follow the engine's own paging before returning, hold the data in memory, or set \`allowPartialResults: true\` on the source config to accept this knowingly.`);St?B(`source.pushdown.partial.residual.${ae}`,`the ${ae} adapter returned ${st.length} of ${ot.total} matching rows when asked for the whole result, and residual work will run over that fraction. allowPartialResults is set, so the result is used as-is — it may be wrong. The adapter must follow the engine's own paging to be correct.`):B(`source.pushdown.partial.${ae}`,`the ${ae} adapter returned ${st.length} of ${ot.total} matching rows when asked for the whole result. The adapter must follow the engine's own paging before returning.`)}ie={key:$e,rows:st,total:typeof ot.total=="number"?ot.total:null}}let Ge=Te;if(Te.residual.where){const ot=ie.total??ie.rows.length;if(ot>=Me){k(Te.residual.where.names,ae,ot,Me);const{where:st,...St}=ve.request;Ge=F(St,ee,Ae.enabled),Oe=Ge}}const Ze=ie.total!==null&&ie.rows.length>=ie.total,Je=P(ie.rows,{...Ge.residual,whole:Ze},W.compute||{}),Qe=ce.range?ce.range.start:0,lt=ce.range?ce.range.end:Je.length;return Ye({rows:Je.slice(Qe,lt),total:Je.length})},ht=async(ce,he,ye)=>{const Te=ye&&ye.waitForPage&&Rt&&z(Rt.pageForegroundIdle)?Rt.pageForegroundIdle():Lt();Te&&await Te;const xe=ge();xe&&await xe;const ze=F(ce,ee,Ae.enabled);Oe=ze;const Ye=d(he,Pe),$e=Array.isArray(ce.groupBy)?ce.groupBy:[],Ge=$e.length>0,Ze=!ze.residual.filters&&!ze.residual.quick,Je=!Ge||l($e,ee.buckets);let Qe=Ye.engine,lt=Ye.client;if(ee.aggregates&&Qe.length){const jt=ee.aggregates instanceof Set?ee.aggregates:new Set(Z(ee.aggregates)),Mt=Qe.filter(We=>!jt.has(We.fn));Mt.length&&(Qe=Qe.filter(We=>jt.has(We.fn)),lt=[...Mt.map(We=>({...We,reason:`the ${ae} adapter does not compute "${We.fn}"`})),...lt])}const ot=jt=>{lt=[...Qe.map(Mt=>({...Mt,reason:jt})),...lt],Qe=[]};Qe.length&&!Ze?ot(ze.residual.quick&&!ze.residual.filters?"a quick search the adapter cannot push forces all-client (no mixed provenance)":"residual filter forces all-client (no mixed provenance)"):Qe.length&&!Je&&ot("a grouping key the engine cannot form forces all-client (no mixed provenance)");let st={},St;return Qe.length&&(z(Ge?Q.executeGroupedAggregates:Q.executeAggregates)?Ge?St=await Q.executeGroupedAggregates(ze.pushed,$e,Qe)||[]:st=await Q.executeAggregates(ze.pushed,Qe)||{}:(B(`source.pushdown.aggregates.${ae}${Ge?".grouped":""}`,`the ${ae} adapter cannot compute ${Ge?"grouped ":""}aggregates, so every requested statistic is computed client-side. Correct, and slower than it needs to be.`),ot(`adapter cannot compute ${Ge?"grouped ":""}aggregates`))),je={engine:Qe,client:lt,...Ge?{groupBy:$e}:{}},{values:st,engine:Qe,client:lt,...St!==void 0?{groups:St}:{}}},ct=async ce=>{Pt++;try{return await Bt(ce)}finally{if(Pt--,Pt===0&&Ct.length){const he=Ct;Ct=[];for(const ye of he)ye()}}},bt=f(W.edit),it=W.edit&&typeof W.edit=="object"&&z(W.edit.commit);let we=W.edit;if(bt&&!it)if(ee.mutate&&ee.mutate.update){const ce=he=>{if(!ee.mutate||!ee.mutate.update)throw new Error(`[lattice] the ${ae} adapter cannot update rows (mutate.update is not declared), so this edit cannot be persisted. The cell is reverted rather than left looking saved.`);const ye={kind:"update",key:String(he.key),patch:{[he.colId]:he.value}};return Q.mutate(ye,he.request||{})};we={...W.edit===!0?{}:W.edit,commit:ce}}else B(`source.pushdown.readonly.${ae}`,`edit is enabled but the ${ae} adapter declares mutate: ${ee.mutate?"without update":"false"} (read-only by declaration), so no commit is synthesised and the grid stays read-only. Declare \`mutate: { update: true }\` on the adapter to allow cell edits.`);const Le=bt&&ee.mutate&&(ee.mutate.append||ee.mutate.delete)?{append:ee.mutate.append===!0,remove:ee.mutate.delete===!0,returning:ee.mutate.returning,mutate:(ce,he)=>Q.mutate(ce,he||{})}:null,Re=async ce=>{const he=ge();he&&await he;const{range:ye,signal:ve,export:Te,...xe}=ce||{},ze={...xe,groupBy:[],groupPath:[],groupValues:[],pivotBy:[],pivotMode:!1,totals:[]};return{plan:F(ze,ee,Ae.enabled),signal:ve}};async function*ne(ce,he={}){const{plan:ye,signal:ve}=await Re(ce),Te=Math.max(1,Math.floor(Number(he.pageSize))||5e3),xe={signal:ve,stream:!0};if(!ye.needsAll)for(let $e=0;;$e+=Te){t(xe);const Ge=await Q.execute({...ye.pushed,range:{start:$e,end:$e+Te}},xe);Ge&&x(Ge.pendingTotal)&&Ge.pendingTotal.then(null,()=>{});const Ze=Ge&&Ge.rows||[];if(Ze.length&&(yield Ze),Ze.length<Te)return}t(xe);const ze=await H(await Q.execute({...ye.pushed,range:void 0},xe)),Ye=P(ze&&ze.rows||[],{...ye.residual,whole:!0},W.compute||{});for(let $e=0;$e<Ye.length;$e+=Te)yield Ye.slice($e,$e+Te)}return Rt={...W,edit:we,rowMutate:Le,mode:"remote",fetch:ct,foregroundIdle:Lt,aggregate:ht,countMatching:async ce=>{const{plan:he,signal:ye}=await Re(ce);if(!he.needsAll&&ee.total){t({signal:ye});const Te=await H(await Q.execute({...he.pushed,range:{start:0,end:0}},{signal:ye}));if(Te&&typeof Te.total=="number")return Te.total}let ve=0;for await(const Te of ne(ce))ve+=Te.length;return ve},streamMatching:ne,capabilitiesOf:w,planQuery:F,wireFilters:g,resolveAggregatePlan:ce=>d(ce,Pe),STAT_PUSHDOWN:i,lastPlan:()=>Oe?{...Oe,...je?{aggregates:je}:{},...le?{total:{deferred:!0,state:le.state,value:le.value}}:{}}:null,fullFrame:Fe,counts:()=>({match:Ce,total:Ee??null,pending:!!le&&le.state==="pending"}),grandTotals:()=>fe},Rt}}),Ue("packages/core/src/source/remote.js",function(e,U){"use strict";Object.defineProperty(e,"PROTOCOL",{enumerable:!0,get:function(){return M}}),Object.defineProperty(e,"HINT_SETTLE_MS",{enumerable:!0,get:function(){return D}}),Object.defineProperty(e,"createRemoteSource",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"RemoteSource",{enumerable:!0,get:function(){return R}});const E=U("packages/core/src/internal/lru.js").Lru,z=U("packages/core/src/internal/predicates.js").isFunction,Z=U("packages/core/src/internal/warn.js").warnOnce,B=U("packages/core/src/internal/schedule.js").settleDebounce,Y=U("packages/core/src/source/abort.js"),G=Y.createAbortScope,j=Y.isAbortError,k=U("packages/core/src/source/blockcache.js"),g=k.BlockCache,c=k.DEFAULT_PAGE_SIZE,d=k.DEFAULT_MAX_CACHED_PAGES,l=U("packages/core/src/source/rows.js"),i=l.createRowFactory,n=l.groupKey,a=U("packages/core/src/source/filterwire.js"),s=a.wireFilters,t=a.querySignature,u=a.warnHostFilterNotApplied,o=U("packages/core/src/source/pagewindow.js").pageWindow,w=U("packages/core/src/source/memory.js").MemorySource,v=U("packages/core/src/compute/handle.js").valueComparator,h=U("packages/core/src/compute/pivot.js"),p=h.pivotKey,b=h.joinPath,O=h.DEFAULT_PATH_SEPARATOR,L=U("packages/core/src/source/pushdown.js").UNGROUPED_LEVEL,M=1,D=120,F=1e3;function T($,C,A){for(let S=0;S<Math.max($.length,C.length);S++){const x=$[S],H=C[S],V=x==null,W=H==null;if(V||W){if(V&&W)continue;return V?1:-1}const Q=A(x,H);if(Q!==0)return Q}return 0}function I($,C){return new R($,C)}class P{constructor(C,A,S,x){this.path=C,this.keyPath=x||C,this.values=[],this.level=A,this.key=n(this.keyPath),this.cache=new g(S),this.count=null,this.complete=!1,this.announced=null,this.counting=!1,this.failed=!1,this.children=new Map,this.row=null,this.flat=!1}}class R{mode="remote";#e;#t;#n;#r;#s=new Map;#i=new Set;#o=G();#l;#a;#c=new Map;#u=[];#f=null;#d="";#h;#p=!1;#m=!1;#g=[];#b=!1;#y=0;#A="";#w=null;#O=-1;constructor(C,A){this.#e=C||{mode:"remote"},this.#t=A||{},z(this.#e.fullFrame)&&(this.filteredIndices=()=>this.#_(),this.unfilteredIndices=()=>this.#G(),this.handleFor=W=>this.#D(W),this.display=()=>this.#F(),this.grandTotalRow=()=>this.#x(),this.unfilteredRows=()=>this.#H(),this.facetIndices=W=>this.#Y(W));const S=this.#e.counts;z(S)&&(this.matchCount=()=>this.#K("match"),this.totalCount=()=>this.#K("total"));const x=this.#e.grandTotals;z(x)&&(this.grandTotalRow=()=>this.#U());const H=this.#e.foregroundIdle;z(H)&&(this.foregroundIdle=()=>this.#ye(H),this.#e.pageForegroundIdle=()=>this.#b?this.#ye(H):null);const V=this.#e;z(V.countMatching)&&z(V.streamMatching)&&(this.selectionQuery=()=>this.#fe(),this.countMatching=W=>V.countMatching(W),this.streamMatching=(W,Q)=>V.streamMatching(W,Q),this.loadedRows=()=>this.#ne(),this.resident=()=>this.#R()!==null),this.#n={pageSize:this.#e.pageSize||c,maxCachedPages:this.#e.maxCachedPages||d},this.#l=i(this.#t),this.#a=new E(this.#n.pageSize*4),this.#h=B((W,Q)=>this.#P(W,Q),D),this.#r=new P([],0,this.#n),this.#s.set(this.#r.key,this.#r),this.#d=this.#ve(),z(this.#e.fetch)||Z("source.remote.fetch",'source.mode "remote" requires a fetch function; the grid will stay empty.'),this.#Be()}count(){const C=this.#S();return C?C.length:this.#v()}#v(){const C=this.#R();return C?C.count():(this.#q(),this.#te(this.#r))}#T(){if(this.#R())return!0;const C=A=>{if(A.count===null&&!A.complete)return!1;for(const S of A.children.values())if(this.#Ee(S.key)&&!C(S))return!1;return!0};return C(this.#r)}pageInfo(){const C=this.#S(),A=this.totalPending();if(!C){const S=this.#v();return{page:0,pageSize:0,total:this.#T()?S:null,pageCount:1,counting:A}}return{page:C.page,pageSize:C.pageSize,total:C.total,pageCount:C.pageCount,counting:A||C.total===null&&this.#o.size>0&&this.#r.cache.loadedExtent()===0}}#S(){const C=this.#v(),A=o(this.#C("pageSize",0),this.#C("page",0),C,this.#T());if(!A)return this.#A="",null;const S=`${this.#y}:${A.offset}:${A.length}`;return S!==this.#A&&!this.#p&&(this.#A=S,A.length>0&&!this.#R()&&this.#P(A.offset,A.offset+A.length-1)),A}at(C){const A=this.#S();if(A){if(C<0||C>=A.length)return;const S=this.#E(A.offset+C);return S&&(S.index=C),S}return this.#E(C)}#E(C){const A=this.#R();if(A)return A.at(C);if(this.#q(),C<0||C>=this.#v())return;const S=this.#V(this.#r,C);if(!S)return;const x=this.#X(S.node,S.local);return x&&(x.index=C),x||this.#l.skeleton(C,S.node.level,S.node.cache.erroredAt(S.local))}byKey(C){const A=this.#R();if(A)return A.byKey(C);const S=this.#c.get(C);if(!S)return;const x=S.lastIndexOf(":"),H=this.#s.get(S.slice(0,x));return H&&this.#X(H,Number(S.slice(x+1)))||void 0}loaded(C){const A=this.#S();if(A){if(C<0||C>=A.length)return!1;C+=A.offset}const S=this.#R();if(S)return S.loaded(C);if(C<0||C>=this.#v())return!1;const x=this.#V(this.#r,C);return!!x&&x.node.cache.rowLoaded(x.local)}hint(C,A){if(this.#p)return;this.#b=!0;const S=this.#q();let x=Math.max(0,Math.floor(C)),H=Math.max(x,Math.floor(A));const V=this.#S();if(V){if(V.length===0)return;x=V.offset,H=V.offset+V.length-1}for(const[W,Q]of this.#M(x,H)){W.cache.protect(Q.min,Q.max);for(const ee of W.cache.evict())this.#Me(W,ee)}this.#h(x,H),S&&this.#h.flush()}#M(C,A){const S=this.#v(),x=new Map;for(let H=C;H<=A&&H<S;H++){const V=this.#V(this.#r,H);if(!V)continue;const W=x.get(V.node);W?(W.min=Math.min(W.min,V.local),W.max=Math.max(W.max,V.local)):x.set(V.node,{min:V.local,max:V.local})}return x.size||x.set(this.#r,{min:C,max:C}),x}#P(C,A){if(!this.#p)for(const[S,x]of this.#M(C,A)){S.cache.protect(x.min,x.max);const H=S.cache.blockOf(x.min),V=S.cache.blockOf(x.max);for(let W=H;W<=V&&!(S.count!==null&&W*S.cache.pageSize>=S.count);W++)S.cache.has(W)||this.#xe(S,W)}}apply(C){const A={added:[],updated:[],removed:[]};if(!C)return A;if(C.update)for(const S of C.update){const x=this.#c.get(this.#l.keyOf(S,-1));if(!x)continue;this.#a.delete(x);const H=x.lastIndexOf(":"),V=this.#s.get(x.slice(0,H));if(!V)continue;const W=Number(x.slice(H+1)),Q=V.cache.blockOf(W);if(!V.cache.loaded(Q))continue;const{start:ee}=V.cache.rangeOf(Q),re=[];for(let ue=ee;ue<ee+V.cache.pageSize;ue++){const ge=V.cache.rowAt(ue);if(ge===void 0)break;re.push(ue===W?S:ge)}V.cache.fill(Q,re);const ae=this.#X(V,W);ae&&A.updated.push(ae)}return(C.add&&C.add.length||C.remove&&C.remove.length)&&this.reload({keepExpanded:!0}),A}reload(C){this.#o.abortAll("reload"),this.#h.cancel(),C&&C.keepExpanded===!1&&this.#i.clear(),this.#re(),this.#W("model:changed",{reason:"reload"})}destroy(){this.#p=!0,this.#h.cancel(),this.#o.abortAll("destroyed"),this.#re(),this.#s.clear(),this.#i.clear(),this.#w&&z(this.#w.destroy)&&this.#w.destroy(),this.#w=null}expand(C){this.#i.has(C)||(this.#i.add(C),this.#W("group:toggled",{key:C,expanded:!0}),this.#W("model:changed",{reason:"expand",key:C}))}collapse(C){this.#i.delete(C)&&(this.#W("group:toggled",{key:C,expanded:!1}),this.#W("model:changed",{reason:"collapse",key:C}))}expandedKeys(){return[...this.#i]}pivotFields(){return this.#u}pivot(){this.#q();const C=this.#f;if(!C||!C.keys.size||!this.#C("pivotBy",[]).length)return null;if(!C.result){const A=v((this.#t.config||{}).locale),S=[...C.keys.entries()].sort((H,V)=>T(H[1],V[1],A)),x=S.map(([H])=>H);C.result={keys:S.map(([,H])=>H),paths:x,fields:this.#se(x),groupPaths:[],columns:x.length*Math.max(1,this.#Te().length),values:C.cells,cells:C.cells,error:null}}return C.result}invalidateHandles(){this.#w&&(z(this.#w.invalidateHandles)&&this.#w.invalidateHandles(),z(this.#w.invalidate)&&this.#w.invalidate("filter"))}#N(){const C=this.#e.fullFrame;return z(C)?C():null}#R(){const C=this.#N();return C?(this.#w||(this.#w=new w({mode:"memory"},this.#$())),C.version!==this.#O&&(this.#w.setRows(C.rows),this.#O=C.version),this.#w):null}#$(){const C=this.#t,A=C.state||{};return{...C,state:{...A,page:()=>0,pageSize:()=>0}}}#_(){const C=this.#R();return C?C.filteredIndices():new Uint32Array(0)}#G(){const C=this.#R();return C?C.unfilteredIndices():new Uint32Array(0)}#D(C){const A=this.#R();return A?A.handleFor(C):void 0}#F(){const C=this.#R();return C?C.display():[]}#Y(C){const A=this.#R();return A&&z(A.facetIndices)?A.facetIndices(C):new Uint32Array(0)}#x(){const C=this.#R();return C&&z(C.grandTotalRow)?C.grandTotalRow():null}#K(C){const A=this.#R();if(A){const V=C==="match"?A.matchCount:A.totalCount;if(z(V))return V.call(A)}const S=this.#e.counts,x=z(S)?S():null,H=x?x[C]:null;return typeof H=="number"?H:this.#v()}#U(){const C=this.#R();if(C&&z(C.grandTotalRow))return C.grandTotalRow();if((this.#t.config||{}).grandTotalRow!=="bottom")return null;const S=this.#e.grandTotals,x=z(S)?S():null;return!x||!x.totals?null:this.#l.grandTotal(x.totals,x.leafCount||0)}#H(){const C=this.#R();if(C&&z(C.unfilteredRows))return C.unfilteredRows();const A=[],S=this.count();for(let x=0;x<S;x++){const H=this.at(x);H&&A.push(H)}return A}#fe(){const C=this.#C("quick",""),A={protocol:M,groupPath:[],groupValues:[],groupBy:[],totals:[],totalFns:{},pivotBy:[],pivotMode:!1,filters:s(this.#C("filters",null),this.#B()),sort:this.#C("sort",[]),context:this.#C("context",null)};C&&(A.quick=C);const S=this.#C("where",null);return S&&S.active&&(A.where=S),A}#ne(){const C=this.#C("groupBy",[]).length,A=[];for(const S of this.#s.values())if(!(S.level!==C&&!S.flat))for(const x of S.cache.ids()){if(!S.cache.loaded(x))continue;const{start:H,end:V}=S.cache.rangeOf(x);for(let W=H;W<V&&S.cache.rowLoaded(W);W++){const Q=this.#X(S,W);Q&&!Q.group&&A.push(Q)}}return A}loadedCount(){const C=this.#R();if(C){const x=C.matchCount();return typeof x=="number"?x:C.count()}this.#q();const A=this.#C("groupBy",[]).length;let S=0;for(const x of this.#s.values())if(!(x.level!==A&&!x.flat))for(const H of x.cache.ids()){if(!x.cache.loaded(H))continue;const V=x.cache.fillOf(H);typeof V=="number"&&(S+=V)}return S}residentRows(){const C=this.#R();return C?C.display():this.#C("groupBy",[]).length>0?null:(this.#q(),this.#ne())}#pe(C,A,S){const{start:x,end:H}=C.cache.rangeOf(A),V=this.#C("groupBy",[]),W=this.#C("pivotBy",[]),Q=this.#C("quick",""),ee=this.#Te(),re={protocol:M,range:{start:x,end:H},groupPath:C.path,groupValues:C.values,groupBy:V,totals:ee,totalFns:this.#le(ee),pivotBy:W,pivotMode:W.length>0,filters:s(this.#C("filters",null),this.#B()),sort:this.#C("sort",[]),context:this.#C("context",null),signal:S};Q&&(re.quick=Q);const ae=this.#C("where",null);return ae&&ae.active&&(re.where=ae),re}async#xe(C,A){if(!z(this.#e.fetch))return;if(!this.#m){this.#m=!0;const V=this.#g;this.#g=[],queueMicrotask(()=>{for(const W of V)W()})}const S=this.#o.begin(`${C.key}:${A}`);C.cache.begin(A,S);const x=this.#d,{start:H}=C.cache.rangeOf(A);try{const V=await this.#e.fetch(this.#pe(C,A,S.signal));if(!S.current||x!==this.#d||this.#p)return;S.settle();const W=V&&V.rows||[];if(!!(V&&V[L])&&!C.flat){C.flat=!0,C.children.clear();for(const[ae,ue]of[...this.#c])ue.startsWith(`${C.key}:`)&&(this.#a.delete(ue),this.#c.delete(ae))}C.cache.fill(A,W),C.failed=!1;for(let ae=0;ae<W.length;ae++)this.#a.delete(`${C.key}:${H+ae}`);const ee=V&&typeof V.count=="number"?V.count:V&&typeof V.total=="number"?V.total:null,re=V&&z(V.pendingTotal?.then)?V.pendingTotal:null;ee!==null?(C.count=ee,C.complete=!0):W.length<C.cache.pageSize?(C.count=H+W.length,C.complete=!0):re&&(C.counting=!0,C.announced=null),V&&Array.isArray(V.pivotFields)&&this.#Pe(V.pivotFields),V&&V.pivot&&typeof V.pivot=="object"&&this.#Ce(V.pivot),this.#W("model:changed",{reason:"page",groupPath:C.path,block:A}),this.#W("rows:changed",{companion:!0,reason:"page",groupPath:C.path,block:A}),this.#me(C),re&&this.#Oe(C,re,x)}catch(V){if(S.settle(),j(V))return;C.cache.failed(A,V),C.failed=!0;const{end:W}=C.cache.rangeOf(A);for(let Q=H;Q<W;Q++)this.#a.delete(`${C.key}:${Q}`);this.#W("model:changed",{reason:"page-error",groupPath:C.path,block:A}),this.#W("source:error",{error:V,groupPath:C.path,block:A})}}async#Oe(C,A,S){let x;try{x=await A}catch(H){if(S!==this.#d||this.#p)return;C.counting=!1,j(H)||(C.failed=!0),j(H)||this.#W("source:error",{error:H,groupPath:C.path});return}S!==this.#d||this.#p||(C.counting=!1,typeof x=="number"&&(C.count=x,C.complete=!0,this.#me(C),this.#W("model:changed",{reason:"total",count:x,groupPath:C.path})))}#me(C){typeof C.count!="number"||!C.complete||C.announced!==C.count&&(C.announced=C.count,this.#W("source:total",{total:C.count,groupPath:C.path}))}#ye(C){if(this.#p)return null;this.#q();const A=this.#m?null:new Promise(W=>{this.#g.push(W),setTimeout(W,F)}),S=C();if(!A&&!S)return null;const x=(async()=>{A&&await A;for(let W=C();W;W=C())await W})();let H;const V=new Promise(W=>{H=setTimeout(W,F)});return Promise.race([x,V]).then(()=>clearTimeout(H))}totalPending(){if(this.#r.failed)return!1;if(this.#r.counting===!0)return!0;if(this.#R())return!1;this.#q();const C=this.#r;return C.count===null&&!C.complete&&C.cache.loadedExtent()===0}totalFailed(){return this.#r.failed===!0}#Pe(C){C.length===this.#u.length&&C.every((A,S)=>A===this.#u[S])||(this.#u=C,this.#W("column:pivoted",{pivotFields:C,remote:!0}))}#de(){const C=this.#t.config||{};return C.pivot&&C.pivot.separator||O}#se(C){const A=this.#de(),S=this.#Te();if(!S.length)return C.slice();const x=[];for(const H of C)for(const V of S)x.push(`${H}${A}${V}`);return x}#Ce(C){const A=this.#de();this.#f||(this.#f={keys:new Map,cells:new Map,result:null});const S=this.#f;let x=!1;const H=W=>{const Q=Array.isArray(W)?W:[W],ee=b(Q,A);return S.keys.has(ee)||(S.keys.set(ee,Q),x=!0),ee},V=this.#C("groupBy",[]).length>0;for(const W of Array.isArray(C.axis)?C.axis:[])H(W);for(const W of Array.isArray(C.cells)?C.cells:[]){if(!W||typeof W!="object")continue;const Q=H(W.pivot);if(V&&!(Array.isArray(W.group)&&W.group.length))continue;const ee=b(Array.isArray(W.group)?W.group:[],A);for(const[re,ae]of Object.entries(W.values||{}))S.cells.set(p(ee,Q,re),ae)}S.result=null,x&&this.#Pe((this.pivot()||{fields:[]}).fields)}#te(C){let A=this.#J(C);for(const S of C.children.values())this.#Ee(S.key)&&(A+=this.#te(S));return A}#J(C){if(C.count!==null)return C.count;const A=C.cache.loadedExtent();return C.complete?A:C.row&&C.row.leafCount>0?C.level>=this.#C("groupBy",[]).length?Math.max(A,C.row.leafCount):A===0?1:Math.min(A+C.cache.pageSize,Math.max(A,C.row.leafCount)):A+C.cache.pageSize}#V(C,A){let S=A,x=0;const H=[...C.children.entries()].filter(([,W])=>this.#Ee(W.key)).sort((W,Q)=>W[0]-Q[0]);for(const[W,Q]of H){const ee=W-x+1;if(S<ee)return{node:C,local:x+S};S-=ee,x=W+1;const re=this.#te(Q);if(S<re)return this.#V(Q,S);S-=re}const V=this.#J(C);return x+S<V?{node:C,local:x+S}:null}#X(C,A){const S=`${C.key}:${A}`,x=this.#a.get(S);if(x)return x;const H=C.cache.rowAt(A);if(H===void 0)return null;const V=this.#C("groupBy",[]);let W;if(C.level<V.length&&!C.flat){const Q=V[C.level],ee=this.#f!==null&&C.level===V.length-1&&this.#C("pivotBy",[]).length>0,re=this.#he(H,Q),ae=re==null,ue=[...C.path,ae?"":String(re)],ge=[...C.keyPath,ae?null:String(re)];if(W=this.#l.group({path:ue,keyPath:ge,column:Q,value:re,level:C.level,parent:C.row,leafCount:Number(H.leafCount)||0,expanded:ee?!1:this.#Ee(n(ge)),...ee?{hasChildren:!1}:{}}),W.totals=this.#I(H),W.data=H,!ee){let Ae=this.#s.get(W.key);Ae?Ae.row=W:(Ae=new P(ue,C.level+1,this.#n,ge),Ae.row=W,this.#s.set(Ae.key,Ae)),Ae.values=[...C.values,re],C.children.set(A,Ae)}}else W=this.#l.leaf(H,A,C.level,C.row);return this.#a.set(S,W),this.#c.set(W.key,S),W}#I(C){const A=C||{};if(A.totals&&typeof A.totals=="object")return A.totals;const S={};for(const x of this.#Te())Object.hasOwn(A,x)&&(S[x]=A[x]);return S}#Me(C,A){const{start:S,end:x}=C.cache.rangeOf(A);for(let H=S;H<x;H++){const V=`${C.key}:${H}`,W=this.#a.peek(V);W&&this.#c.delete(W.key),this.#a.delete(V)}}#q(){const C=this.#ve();return C===this.#d?!1:(this.#d=C,this.#o.abortAll("query"),this.#re(),this.#m=!1,this.#W("model:changed",{reason:"query"}),!0)}#re(){for(const C of this.#s.values())C.cache.clear(),C.count=null,C.complete=!1,C.announced=null,C.counting=!1,C.failed=!1,C.children.clear(),C.flat=!1;this.#a.clear(),this.#c.clear(),this.#y++,this.#f=null}#ve(){const C=this.#C("where",null);return`${t({filters:this.#C("filters",null),sort:this.#C("sort",[]),quick:this.#C("quick",""),groupBy:this.#C("groupBy",[]),pivotBy:this.#C("pivotBy",[]),context:this.#C("context",null)})}|${C?C.version:0}`}#Ee(C){const A=this.#C("expanded",null);return A?z(A.has)?A.has(C):Array.prototype.includes.call(A,C):this.#i.has(C)}#Te(){const C=this.#C("totals",[]);if(C&&C.length)return[...C];const A=this.#t.columns;return!A||!z(A.all)?[]:A.all().filter(S=>!!S.total).map(S=>S.id)}#le(C){const A=this.#t.columns,S={};if(!A||!z(A.get))return S;for(const x of C){const H=A.get(x);if(!H)continue;const V=H.groupTotal!=null?H.groupTotal:H.total;typeof V=="string"&&(S[x]=V)}return S}#he(C,A){const S=this.#t.columns,x=S&&z(S.get)?S.get(A):void 0;return x&&z(x.getValue)?x.getValue(C):C?.[A]}#Be(){u(this.#t)}#B(){const C=this.#t.config||{};return{tz:C.timeZone,weekStartsOn:C.weekStartsOn}}#C(C,A){const S=this.#t.state;if(S&&z(S[C])){const x=S[C]();return x??A}return A}#W(C,A){const S=this.#t.emit;z(S)&&S(C,A)}}}),Ue("packages/core/src/source/gapbuffer.js",function(e,U){"use strict";Object.defineProperty(e,"GapBuffer",{enumerable:!0,get:function(){return E}});const te=64;class E{#e;#t=0;#n=0;constructor(z=te){this.#e=new Uint32Array(Math.max(1,z)),this.#n=this.#e.length}static from(z,_=te){const Z=new E(z.length+Math.max(1,_));return Z.#e.set(z,0),Z.#t=z.length,Z.#n=Z.#e.length,Z}get length(){return this.#t+(this.#e.length-this.#n)}get capacity(){return this.#e.length}at(z){return z<0||z>=this.length?0:z<this.#t?this.#e[z]:this.#e[z+(this.#n-this.#t)]}insert(z,_){const Z=z<0?0:z>this.length?this.length:z;this.#r(Z),this.#t===this.#n&&this.#s(),this.#e[this.#t++]=_}push(z){this.insert(this.length,z)}removeAt(z){return!Number.isInteger(z)||z<0||z>=this.length?!1:(this.#r(z),this.#n++,!0)}toArray(){const z=new Uint32Array(this.length);return z.set(this.#e.subarray(0,this.#t),0),z.set(this.#e.subarray(this.#n),this.#t),z}clear(){this.#t=0,this.#n=this.#e.length}#r(z){if(z!==this.#t)if(z<this.#t){const _=this.#t-z;this.#e.copyWithin(this.#n-_,z,this.#t),this.#t=z,this.#n-=_}else{const _=z-this.#t;this.#e.copyWithin(this.#t,this.#n,this.#n+_),this.#t=z,this.#n+=_}}#s(){const z=this.#e.length-this.#n,_=new Uint32Array(Math.max(this.#e.length*2,this.#e.length+te));_.set(this.#e.subarray(0,this.#t),0),_.set(this.#e.subarray(this.#n),_.length-z),this.#e=_,this.#n=_.length-z}}}),Ue("packages/core/src/store/ingest.js",function(e,U){"use strict";Object.defineProperty(e,"INGEST_DEFAULTS",{enumerable:!0,get:function(){return g}}),Object.defineProperty(e,"inferKind",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"decideText",{enumerable:!0,get:function(){return d}}),Object.defineProperty(e,"createReaders",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"Ingest",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"ingest",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"ingestSync",{enumerable:!0,get:function(){return s}});const te=U("packages/core/src/internal/schedule.js"),E=te.now,q=te.nextFrame,z=U("packages/core/src/internal/warn.js"),_=z.infoOnce,Z=z.warnOnce,B=U("packages/core/src/internal/predicates.js").isFunction,G=U("packages/core/src/internal/paths.js").pathGetter,k=U("packages/core/src/store/columnstore.js").ColumnStore,g=Object.freeze({chunkMs:8,chunkRows:512,sampleSize:100,dictionaryRatio:.1,columnarBelow:5e3,initialCapacity:1024});function c(t,u={}){if(u.multi)return"multi";if(t.length===0)return"object";let r=0,o=0,f=0,w=0,m=0;for(let h=0;h<t.length;h++){const p=t[h];typeof p=="number"?r++:typeof p=="boolean"?o++:typeof p=="string"?f++:p instanceof Date?w++:Array.isArray(p)&&m++}const v=t.length;return r===v?"float64":o===v?"bitset":w===v?"float64":f===v?"text":m===v?"multi":"object"}function d(t,u,r){return u<=0||t<r*u?"dictionary":"object"}function l(t,u,r){const o=new Map,f=new Map;for(const M of t){if(M.computed)continue;const D=B(M.read)?M.read:G(M.field||M.id);f.set(M.id,D),o.set(M.id,D)}const w=u?.order??[],m=u?.fns??{},v=u?.deps??{},h=u?.wrapDeps??null,p=w.filter(M=>B(m[M])),b=p.some(M=>v[M]==="*");let O=new WeakMap;const y=M=>{const D={};if(b)for(const[F,T]of f)D[F]=T(M);for(const F of p){const T=v[F];let I;if(T==="*")I=D;else{I={};const P=T||[];for(let R=0;R<P.length;R++){const $=P[R];I[$]=$ in D?D[$]:f.get($)?.(M)}}D[F]=m[F](h?h(I,F):I,{data:M,row:null,column:null,grid:null,context:r})}return D},L=M=>{if(M===null||typeof M!="object"&&typeof M!="function")return y(M);let D=O.get(M);return D===void 0&&(D=y(M),O.set(M,D)),D};for(const M of p)o.set(M,D=>L(D)[M]);return{readers:o,reset(){O=new WeakMap}}}class i{spec;read;kind;inferred;nullable;candidate=!1;distinct=null;change=null;reason="";constructor(u,r){this.spec=u,this.read=r,this.kind="object",this.inferred=!1,this.nullable=u.nullable!==!1}}class n{#e;#t=[];#n=null;#r;#s=0;#i;#o=!1;#l=!1;#a=0;#c;constructor(u,r={},o={}){this.#e=Array.isArray(u)?u:Array.from(u||[]),this.#i={...g,...o};const f=r.columns??[];this.#r=l(f,r.computed??null,r.context),this.#c=this.#e.length>=this.#i.columnarBelow,this.#u(f,r.computed??null),this.#n=new k(this.#t.map(w=>({id:w.spec.id,kind:w.kind,nullable:w.nullable,read:w.read,dictionary:w.spec.dictionary})),{initialCapacity:this.#i.initialCapacity,columnarBelow:this.#i.columnarBelow})}get store(){return this.#n}get done(){return this.#o||this.#l}get progress(){return this.#s}slice(){if(this.done)return!1;if(this.#i.signal?.aborted)return this.#l=!0,!1;const u=E(),{chunkMs:r,chunkRows:o}=this.#i,f=this.#e.length;do{const w=Math.min(this.#s+o,f);this.#n.append(this.#e.slice(this.#s,w)),this.#f(this.#s,w),this.#s=w,this.#r.reset(),this.#h(!1)}while(this.#s<f&&E()-u<r);return this.#a+=E()-u,this.#i.onProgress?.({loaded:this.#s,total:f}),this.#s>=f?(this.#h(!0),this.#o=!0,!1):!0}cancel(){this.#l=!0}result(){return{store:this.#n,schema:this.#t.map(u=>({id:u.spec.id,kind:u.kind,nullable:u.nullable,read:u.read,dictionary:u.spec.dictionary})),decisions:this.#t.map(u=>({id:u.spec.id,kind:u.kind,nullable:u.nullable,inferred:u.inferred,distinct:u.candidate||u.change?this.#d(u):null,change:u.change,reason:u.reason})),count:this.#n.count,elapsed:this.#a,cancelled:this.#l}}#u(u,r){const o=this.#e,f=Math.min(this.#i.sampleSize,o.length),w=this.#i.dictionaryRatio,m=r?.pure instanceof Set?r.pure:new Set(r?.pure??r?.order??[]);for(const v of u){if(!v||!v.id)continue;if(v.computed&&(v.pure===!1||r&&!m.has(v.id))){Z(`ingest.impure.${v.id}`,`column "${v.id}" is an impure computed column and is not materialised into the store`);continue}const h=this.#r.readers.get(v.id)??(B(v.read)?v.read:G(v.field||v.id)),p=new i(v,h);if(v.kind)p.kind=v.kind,p.reason="declared by the caller";else if(v.dictionary)p.kind=v.multi?"multi":"dictionary",p.reason="value table supplied (lookup column)";else{const b=[];for(let y=0;y<f&&b.length<this.#i.sampleSize;y++){const L=h(o[y]);L!=null&&b.push(L)}p.inferred=!0;const O=c(b,{multi:v.multi});if(O==="text"){const y=new Set(b).size;p.kind=d(y,b.length,w),p.candidate=this.#c,p.reason=`sampled ${y} distinct in ${b.length}`}else p.kind=O,p.reason=`inferred from ${b.length} sampled values`,O==="object"&&b.length&&_(`ingest.mixed.${v.id}`,`column "${v.id}" holds mixed or unrecognised value types; storing as an object array. Declare a type to avoid this.`);p.kind==="object"&&p.candidate&&(p.distinct=new Set(b))}this.#t.push(p)}}#f(u,r){const o=this.#e;for(const f of this.#t){if(!f.candidate||!f.distinct)continue;const w=f.distinct;for(let m=u;m<r;m++){const v=f.read(o[m]);v!=null&&w.add(v)}}}#d(u){if(u.distinct)return u.distinct.size;const r=this.#n.column(u.spec.id);return r?.dict?r.dict.size:0}#h(u){const r=this.#i.dictionaryRatio,o=this.#e.length;for(const f of this.#t){if(!f.candidate)continue;const w=this.#d(f);if(f.kind==="dictionary"&&w>=r*o){const m=this.#n.column(f.spec.id);f.distinct=new Set(m?.dict?m.dict.values():[]),this.#n.convert(f.spec.id,"object"),f.kind="object",f.change="demoted",f.reason=`${w} distinct values is at or above ${r*100}% of ${o} rows`;continue}if(f.kind==="object"&&w>=r*o){f.candidate=!1,f.distinct=null,f.reason=`${w} distinct values is at or above ${r*100}% of ${o} rows`;continue}u&&f.kind==="object"&&w<r*o&&(this.#n.convert(f.spec.id,"dictionary"),f.kind="dictionary",f.change=f.change==="demoted"?null:"promoted",f.reason=`${w} distinct values is below ${r*100}% of ${o} rows`,f.distinct=null),u&&(f.candidate=!1)}}}async function a(t,u={},r={}){const o=new n(t,u,r),f=r.scheduler?.frame??q;for(;o.slice();)await new Promise(w=>{f(w)});return o.result()}function s(t,u={},r={}){const o=new n(t,u,{...r,chunkMs:1/0});for(;o.slice(););return o.result()}}),Ue("packages/core/src/store/columnpack.js",function(e,U){"use strict";Object.defineProperty(e,"isPortableSchema",{enumerable:!0,get:function(){return G}}),Object.defineProperty(e,"packChunk",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"packedTransfers",{enumerable:!0,get:function(){return d}});const E=U("packages/core/src/internal/paths.js").pathGetter,q=U("packages/core/src/store/ingest.js"),z=q.inferKind,_=q.decideText,Z=q.INGEST_DEFAULTS,B=U("packages/core/src/store/columnstore.js").toFloat,Y=new Set(["float64","int32","bitset","dictionary","object","multi"]);function G(l){if(!Array.isArray(l)||l.length===0)return!1;for(const i of l)if(!i||typeof i.id!="string"||typeof i.field!="string"||i.field===""||i.kind&&!Y.has(i.kind))return!1;return!0}function j(l){const i=B(l);return Number.isFinite(i)?i|0:0}function k(l){return l==null?[]:Array.isArray(l)?l:[l]}function g(l,i,n,a){if(l.kind)return l.kind;const s=[];for(let r=0;r<i.length&&s.length<Z.sampleSize;r++){const o=i[r];o!=null&&s.push(o)}const t=z(s,{multi:l.multi});if(t!=="text")return t;const u=new Set(s).size;return _(u,s.length,a)}function c(l,i,n={}){const a=i.length|0,s=n.dictionaryRatio??Z.dictionaryRatio,t=[];for(const u of l){const r=E(u.field||u.id),o=u.nullable!==!1,f=new Array(a);for(let p=0;p<a;p++){const b=r(i[p]);f[p]=b===void 0?null:b}const w=g(u,f,a,s),m=o?new Uint8Array(a+7>>3):null,v=p=>{m&&(m[p>>3]|=1<<(p&7))};let h;switch(w){case"float64":{const p=new Float64Array(a);for(let b=0;b<a;b++){const O=f[b],y=O===null;y||v(b),p[b]=y?NaN:B(O)}h={id:u.id,kind:w,nullable:o,values:p,presence:m,offsets:null,table:null};break}case"int32":{const p=new Int32Array(a);for(let b=0;b<a;b++){const O=f[b],y=O===null;y||v(b),p[b]=y?0:j(O)}h={id:u.id,kind:w,nullable:o,values:p,presence:m,offsets:null,table:null};break}case"bitset":{const p=new Uint8Array(a+7>>3);for(let b=0;b<a;b++){const O=f[b],y=O===null;y||v(b),!y&&O&&(p[b>>3]|=1<<(b&7))}h={id:u.id,kind:w,nullable:o,values:p,presence:m,offsets:null,table:null};break}case"dictionary":{const p=new Uint32Array(a),b=[],O=new Map;for(let y=0;y<a;y++){const L=f[y];if(L===null){p[y]=0;continue}v(y);let M=O.get(L);M===void 0&&(M=b.length,b.push(L),O.set(L,M)),p[y]=M}h={id:u.id,kind:w,nullable:o,values:p,presence:m,offsets:null,table:b};break}case"multi":{const p=[],b=new Map,O=new Uint32Array(a+1),y=[];for(let L=0;L<a;L++){const M=f[L];O[L]=y.length,M===null||v(L);const F=k(M);for(let T=0;T<F.length;T++){const I=F[T];let P=b.get(I);P===void 0&&(P=p.length,p.push(I),b.set(I,P)),y.push(P)}}O[a]=y.length,h={id:u.id,kind:w,nullable:o,values:Int32Array.from(y),presence:m,offsets:O,table:p};break}default:{const p=new Array(a);for(let b=0;b<a;b++){const O=f[b];O!==null&&v(b),p[b]=O}h={id:u.id,kind:"object",nullable:o,values:p,presence:m,offsets:null,table:null};break}}t.push(h)}return{count:a,columns:t}}function d(l){const i=[];if(!l||!Array.isArray(l.columns))return i;const n=a=>{ArrayBuffer.isView(a)&&a.buffer&&!i.includes(a.buffer)&&i.push(a.buffer)};for(const a of l.columns)n(a.values),n(a.presence),n(a.offsets);return i}}),Ue("packages/core/src/source/stream.js",function(e,U){"use strict";Object.defineProperty(e,"DEFAULT_PROMOTE_BELOW",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"createStreamSource",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"StreamSource",{enumerable:!0,get:function(){return P}});const E=U("packages/core/src/internal/lru.js").Lru,z=U("packages/core/src/internal/predicates.js").isFunction,_=U("packages/core/src/internal/schedule.js"),Z=_.now,X=_.nextFrame,B=_.cancelFrame,Y=_.whenIdle,j=U("packages/core/src/internal/compare.js").defaultCompare,k=U("packages/core/src/internal/warn.js"),g=k.warnOnce,c=k.infoOnce,l=U("packages/core/src/internal/paths.js").getPath,i=U("packages/core/src/source/abort.js"),n=i.createAbortScope,a=i.isAbortError,s=U("packages/core/src/source/rows.js"),t=s.createRowFactory,u=s.lazyRowView,o=U("packages/core/src/source/gapbuffer.js").GapBuffer,w=U("packages/core/src/source/memory.js").createMemorySource,v=U("packages/core/src/source/filterwire.js").querySignature,p=U("packages/core/src/store/columnpack.js").isPortableSchema,b=25e4,O=Symbol("lattice.stream.storeBacked"),y=8,L=.1,M=1e3,D=50;function F(R){return Math.min(M,Math.max(D,Math.floor(R/4)))}function T(R){if(R instanceof Date)return R.getTime();if(typeof R=="number")return Number.isFinite(R)?R:NaN;if(typeof R=="string"){const $=R.trim();if(!$)return NaN;const C=Date.parse($);return Number.isNaN(C)?Number($):C}return NaN}function I(R,$){return new P(R,$)}class P{mode="stream";writesStore=!0;#e;#t;#n=[];#r=null;#s=[];#i=null;#o;#l;#a=new Map;#c=n();#u={loaded:0,estimated:void 0};#f=null;#d=0;#h=0;#p=0;#m=0;#g=null;#b=null;#y=null;#A=!1;#w=!1;#O=!1;#v=!1;#T="";#S=0;#E=0;#M=0;#P=null;#N=1/0;#R=!1;#$=null;#_=null;#G=null;#D=null;#F=!1;#Y=0;#x=0;#K=!1;constructor($,C){this.#e=$||{mode:"stream"},this.#t=C||{},this.#o=t(this.#t),this.#l=new E(4096),this.#T=this.#Ve();const A=(this.#t.config||{}).ingest;this.#F=!!A&&A.retainSource===!1,z(this.#e.open)||g("source.stream.open",'source.mode "stream" requires an open function; the grid will stay empty.'),this.#e.autoStart!==!1&&queueMicrotask(()=>this.start());const S=Number(this.#e.poll);Number.isFinite(S)&&S>0&&(this.#D=setInterval(()=>{this.#v||this.reload()},S),this.#D&&z(this.#D.unref)&&this.#D.unref()),this.#H()}#U(){const $=Number(this.#e.maxAge);return Number.isFinite($)&&$>0?$:0}#H(){const $=this.#U();if(!$)return;const C=this.#e.ageBy;z(C)?this.#_=C:typeof C=="string"&&C?this.#_=A=>l(A,C):this.#_=null,this.#P=[],this.#$=setInterval(()=>{this.#v||this.#fe()&&(this.#q(),this.#ce())},F($)),this.#$&&z(this.#$.unref)&&this.#$.unref()}#fe(){const $=this.#U();return!$||!this.#P?!1:this.#R?!0:this.#N<Date.now()-$*(1+L)}#ne($,C){if(!this.#P)return;const A=this.#_?T(this.#_(C)):Date.now();this.#P[$]=A,Number.isNaN(A)||(A<this.#N&&(this.#N=A),A<Date.now()-this.#U()&&(this.#R=!0))}#pe(){return this.#be("groupBy",[]).length>0?!0:!!this.#be("pivotMode",!1)&&this.#be("pivotBy",[]).length>0}#xe(){if(this.#g||this.#v)return;const $=this.#pe();if($&&!this.#b){this.#b=w({mode:"memory",rows:this.#n},this.#Oe()),this.#A=!1;return}!$&&this.#b&&(this.#b.destroy(),this.#b=null)}#Oe(){if(this.#y)return this.#y;const $=this,C={liveIndices:()=>$.#me(),live:A=>$.#n[A]!==void 0,source:A=>$.#Se(A),get physical(){return $.#n.length}};return this.#F&&(C.column=A=>{const S=$.#t.store;return S&&z(S.column)?S.column(A):void 0}),this.#y=Object.create(this.#t,{store:{value:C,enumerable:!0,configurable:!0}}),this.#y}#me(){const $=new Uint32Array(this.#n.length);let C=0;for(let A=0;A<this.#n.length;A++)this.#n[A]!==void 0&&($[C++]=A);return $.subarray(0,C)}#ye(){return this.#g?this.#g:this.#b?(this.#A&&(this.#A=!1,this.#b.setRows(this.#n)),this.#b):null}invalidate($="filter"){if(this.#g){this.#g.invalidate($);return}this.#xe(),this.#b&&this.#b.invalidate($),($==="filter"||$==="sort")&&this.#Te()}count(){const $=this.#ye();return $?$.count():this.#r?this.#r.length:this.#S}matchCount(){const $=this.#ye();return $&&z($.matchCount)?$.matchCount():this.#r?this.#r.length:this.#S}totalCount(){const $=this.#ye();return $&&z($.totalCount)?$.totalCount():this.#S}unfilteredRows(){const $=this.#ye();if($&&z($.unfilteredRows))return $.unfilteredRows();const C=[];for(let A=0;A<this.#n.length;A++){if(!this.#n[A])continue;const S=this.#Re(A);S&&C.push(S)}return C}at($){const C=this.#ye();if(C)return C.at($);if($<0||$>=this.count())return;const A=this.#r?this.#r.at($):$,S=this.#Re(A);return S.index=$,S}byKey($){const C=this.#ye();if(C)return C.byKey($);const A=this.#a.get($);return A===void 0?void 0:this.#Re(A)}leavesOf($){const C=this.#ye();return C&&z(C.leavesOf)?C.leavesOf($):[]}loaded($){return $>=0&&$<this.count()}hint($,C){if(this.#g){this.#g.hint($,C);return}this.#Pe(),this.#p=Math.max(0,Math.floor($))}#Pe(){this.#v||this.#Ve()===this.#T||this.reload()}display(){const $=this.#ye();return $?$.display():u(()=>this.count(),C=>this.at(C))}apply($){if(this.#g)return this.#g.apply($);const C={added:[],updated:[],removed:[]};if(!$)return C;if($.update){let A=!1;for(const S of $.update){const x=this.#a.get(this.#o.keyOf(S,-1));if(x===void 0)continue;const H=this.#Be(x);this.#F?this.#He(x,S):this.#n[x]=S,this.#l.delete(x),this.#B(x,H),this.#P&&(this.#ne(x,S),A=!0),this.#A=!0,C.updated.push(this.#Re(x))}A&&this.#q()}if($.add&&$.add.length){const A=this.#I($.add);for(const S of A)C.added.push(this.#Re(S))}return $.remove&&$.remove.length&&g("source.stream.remove","removing rows from a live stream is not supported; reload instead."),this.#ce(),C}reload($){this.#c.abortAll("reload"),this.#We(),this.#b&&(this.#b.destroy(),this.#b=null),this.#A=!1,this.#n=[],this.#r=null,this.#a.clear(),this.#l.clear(),this.#g=null,this.#S=0,this.#E=0,this.#M=0,this.#P&&(this.#P=[]),this.#N=1/0,this.#R=!1,this.#w=!1,this.#O=!1,this.#u={loaded:0,estimated:void 0},this.#T=this.#Ve(),this.#ke("model:changed",{reason:"reload"}),this.start()}destroy(){this.#v=!0,this.#D!==null&&(clearInterval(this.#D),this.#D=null),this.#$!==null&&(clearInterval(this.#$),this.#$=null),this.#P=null,this.#c.abortAll("destroyed"),this.#We(),this.#f!==null&&(this.#k(this.#f),this.#f=null),this.#b&&(this.#b.destroy(),this.#b=null),this.#g&&this.#g.destroy(),this.#n=[],this.#r=null,this.#a.clear(),this.#l.clear()}async start(){if(this.#O||this.#v||!z(this.#e.open))return;this.#O=!0;const $=this.#c.begin("stream");this.#Te(),this.#xe();let C;try{C=this.#e.open({sort:this.#be("sort",[]),filters:this.#be("filters",null),quick:this.#be("quick","")||void 0,context:this.#be("context",null),signal:$.signal})}catch(S){this.#ke("source:error",{error:S});return}const A=z(C[Symbol.asyncIterator])?C[Symbol.asyncIterator]():C[Symbol.iterator]();this.#G=A;try{for(;;){const S=await A.next();if(!$.current||this.#v)return;if(S.done){this.#ie();return}if(await this.#de(S.value,$),!$.current||this.#v)return;if(S.value&&S.value.done){this.#ie();return}if(await this.#oe(),!$.current||this.#v)return}}catch(S){if(a(S))return;this.#ke("source:error",{error:S})}finally{$.settle()}}progress(){return{loaded:this.#u.loaded,estimated:this.#u.estimated,done:this.#w,live:this.#S,evicted:this.#E}}promoted(){return this.#g!==null}memorySource(){return this.#g}invalidateHandles(){const $=this.#ye();$&&(z($.invalidateHandles)&&$.invalidateHandles(),z($.invalidate)&&$.invalidate("sort"))}renderCount(){return this.#d}ingestStats(){return{worker:this.#Y,inline:this.#x,storeBacked:this.#F}}#de($,C){if(!$)return;const A=$.rows;if(A&&A.length&&this.#Ce(A))return this.#J($,C);const S=Z();A&&A.length&&(this.#I(A),this.#x++),this.#se($),this.#h+=Z()-S,this.#ce()}#se($){this.#u.loaded=$.progress&&typeof $.progress.loaded=="number"?$.progress.loaded:this.#n.length,$.progress&&typeof $.progress.estimated=="number"&&(this.#u.estimated=$.progress.estimated)}#Ce($){if(this.#K||this.#g)return!1;const C=this.#V();if(!C)return!1;const A=this.#t.store;if(!A||!z(A.appendPacked))return!1;const S=this.#X();return!S||!p(S)?(this.#K=!0,c("source.stream.ingest-worker","stream ingest.useWorker is on but a column reads through a closure (a computed or date column); columnizing on the main thread instead."),!1):$.length<C.threshold?!1:!this.#te($)}#te($){if(!this.#o.keyed)return!1;const C=new Set;for(let A=0;A<$.length;A++){const S=this.#o.keyOf($[A],this.#n.length+A);if(S!=null){if(C.has(S)||this.#a.has(S))return!0;C.add(S)}}return!1}async#J($,C){const A=$.rows,S=this.#V(),x=this.#X();let H;try{H=await S.columnize(x,A,{key:"ingest:stream",signal:C&&C.signal})}catch(re){if(a(re)||(g("source.stream.columnize","worker columnization failed; columnizing on the main thread",re),this.#K=!0,C&&(!C.current||this.#v)))return;this.#I(A),this.#x++,this.#se($),this.#ce();return}if(C&&(!C.current||this.#v))return;const V=this.#t.store,W=this.#F?void 0:A,{from:Q}=V.appendPacked(H,W),ee=H.count|0;for(let re=0;re<ee;re++){const ae=Q+re,ue=A[re],ge=this.#o.keyed?this.#o.keyOf(ue,ae):null;if(this.#n[ae]=this.#F?O:ue,this.#S++,this.#ne(ae,ue),ge!==null&&this.#a.set(ge,ae),!this.#r||!this.#le(ae))continue;const Ae=this.#C(ae);this.#r.insert(Ae,ae),Ae<=this.#p&&this.#m++}this.#A=!0,this.#q(),this.#Y++,this.#se($),this.#ce()}#V(){const $=this.#t.ingestWorker;return z($)?$():null}#X(){const $=this.#t.storeSchema;return z($)?$():null}#I($){const C=[],A=this.#t.store,S=new Array($.length),x=[],H=new Set;for(let W=0;W<$.length;W++){const Q=this.#o.keyed?this.#o.keyOf($[W],this.#n.length+x.length):null;S[W]=Q,!(Q!==null&&(this.#a.has(Q)||H.has(Q)))&&(Q!==null&&H.add(Q),x.push($[W]))}let V=x.length&&A&&z(A.append)?A.append(x).from:this.#n.length;for(let W=0;W<$.length;W++){const Q=$[W],ee=S[W];if(ee!==null&&this.#a.has(ee)){const ue=this.#a.get(ee),ge=this.#Be(ue);this.#F||(this.#n[ue]=Q,A&&z(A.setSource)&&A.setSource(ue,Q)),this.#He(ue,Q),this.#l.delete(ue),this.#ne(ue,Q),this.#B(ue,ge);continue}const re=V++;if(this.#n[re]=this.#F?O:Q,this.#S++,this.#ne(re,Q),ee!==null&&this.#a.set(ee,re),C.push(re),!this.#r||!this.#le(re))continue;const ae=this.#C(re);this.#r.insert(ae,re),ae<=this.#p&&this.#m++}return this.#A=!0,this.#q(),C}#Me($){const C=this.#n[$];let A=!1;if(this.#r){const V=this.#Ee($);V>=0&&V<=this.#p&&(A=!0)}else $<=this.#p&&(A=!0);const S=C===O?this.#Se($):C,x=this.#o.keyed?this.#o.keyOf(S,$):null;x!==null&&this.#a.get(x)===$&&this.#a.delete(x),this.#n[$]=void 0,this.#P&&(this.#P[$]=NaN),this.#l.delete($);const H=this.#t.store;return H&&z(H.remove)&&H.remove($),this.#S--,A}#q(){let $=0,C=0;const A=this.#ve();$+=A.dropped,C+=A.aboveAnchor;const S=this.#re();$+=S.dropped,C+=S.aboveAnchor,$&&(this.#A=!0,this.#E+=$,this.#Te(),this.#m-=C,this.#ke("stream:evicted",{evicted:$,total:this.#E,live:this.#S}))}#re(){const $=this.#e.maxRows;if(!Number.isFinite($)||$<=0||this.#S<=$)return{dropped:0,aboveAnchor:0};const C=Math.max(1,Math.floor($*(1-L)));let A=0,S=0;for(;this.#S>C&&this.#M<this.#n.length;){const x=this.#M++;this.#n[x]!==void 0&&(this.#Me(x)&&S++,A++)}return{dropped:A,aboveAnchor:S}}#ve(){const $=this.#U();if(!$||!this.#P||!this.#fe())return{dropped:0,aboveAnchor:0};const C=Date.now()-$;let A=0,S=0,x=1/0;for(let H=this.#M;H<this.#n.length;H++){if(this.#n[H]===void 0)continue;const V=this.#P[H];if(!(Number.isNaN(V)||V===void 0)){if(V>=C){V<x&&(x=V);continue}this.#Me(H)&&S++,A++}}for(this.#N=x,this.#R=!1;this.#M<this.#n.length&&this.#n[this.#M]===void 0;)this.#M++;return{dropped:A,aboveAnchor:S}}#Ee($){if(!this.#r)return $;for(let C=0;C<this.#r.length;C++)if(this.#r.at(C)===$)return C;return-1}#Te(){this.#s=this.#be("sort",[]),this.#i=this.#be("filters",null);const $=Number.isFinite(this.#e.maxRows)&&this.#e.maxRows>0||this.#U()>0,C=this.#be("where",null),A=(this.#t.config||{}).hostFilter,S=!!(C&&C.active)||!!(A&&z(A.active)&&A.active());if(!($||this.#s.length>0||!!this.#i||!!this.#be("quick","")||S)){this.#r=null;return}this.#r=new o(Math.max(64,this.#n.length+64));for(let H=0;H<this.#n.length;H++)this.#n[H]!==void 0&&this.#le(H)&&this.#r.insert(this.#C(H),H)}#le($){const C=this.#Se($);if(this.#i&&!this.#he(this.#i,C))return!1;const A=String(this.#be("quick","")||"").toLowerCase();if(A&&!this.#Ye(C).includes(A))return!1;const S=(this.#t.config||{}).hostFilter;if(S&&z(S.active)&&S.active()&&!S.passes(this.#Re($)))return!1;const x=this.#be("where",null);if(x&&x.active){const H=this.#Re($);if(!x.passes(H.data,H.key))return!1}return!0}#he($,C){if(!$)return!0;const A=$;if(Array.isArray(A.conditions))return A.op==="or"?A.conditions.some(H=>this.#he(H,C)):A.op==="not"?!A.conditions.some(H=>this.#he(H,C)):A.conditions.every(H=>this.#he(H,C));const S=$,x=(this.#t.compute||{}).testValue;return z(x)?!!x(this.#Fe(C,S.col),S,(this.#t.config||{}).locale):(g("source.stream.testValue","ctx.compute.testValue is unavailable; streamed rows are not filtered client-side."),!0)}#Be($){if(!this.#r)return-1;if(!this.#s.length)return this.#Ee($);let C=0,A=this.#r.length;for(;C<A;){const S=C+A>>>1;this.#W(this.#r.at(S),$)<0?C=S+1:A=S}for(let S=C;S<this.#r.length;S++){const x=this.#r.at(S);if(x===$)return S;if(this.#W(x,$)>0)break}return this.#Ee($)}#B($,C){if(!this.#r||!this.#s.length)return;const A=this.#le($);if(C>=0&&this.#r.at(C)===$)this.#r.removeAt(C),C<=this.#p&&this.#m--;else if(C>=0)return;if(!A)return;const S=this.#C($);this.#r.insert(S,$),S<=this.#p&&this.#m++}#C($){if(!this.#r||!this.#s.length)return this.#r?this.#r.length:0;let C=0,A=this.#r.length;for(;C<A;){const S=C+A>>>1;this.#W($,this.#r.at(S))<0?A=S:C=S+1}return C}#W($,C){const A=this.#Se($),S=this.#Se(C);for(const x of this.#s){const H=this.#ze(x.col),V=this.#Fe(A,x.col),W=this.#Fe(S,x.col),ee=(H&&H.value&&z(H.value.compare)?H.value.compare:j)(V,W);if(ee!==0)return x.dir==="desc"?-ee:ee}return 0}#ie(){this.#w=!0,this.#u.loaded=this.#u.loaded||this.#n.length;const $=typeof this.#e.promoteToMemoryBelow=="number"?this.#e.promoteToMemoryBelow:b;!this.#F&&this.#n.length<$&&(this.#g=w({mode:"memory",rows:this.#n},this.#t),this.#$!==null&&(clearInterval(this.#$),this.#$=null),this.#b&&(this.#b.destroy(),this.#b=null)),this.#ce(),this.#ke("stream:end",{loaded:this.#n.length,promoted:this.#g!==null,threshold:$})}#ce(){this.#f!==null||this.#v||(this.#f=this.#we(()=>{this.#f=null,this.#d++;const $=this.#m;this.#m=0,this.#h=0,this.#ke("stream:chunk",{loaded:this.#u.loaded,estimated:this.#u.estimated,count:this.count(),renders:this.#d}),this.#ke("model:changed",{reason:"stream",shiftAboveViewport:$,anchor:this.#p}),this.#ke("rows:changed",{companion:!0,reason:"stream"})}))}#oe(){return this.#d===0||this.#h<this.#ge()?Promise.resolve():(this.#h=0,new Promise($=>{const C=(this.#t.scheduler||{}).idle;z(C)?C(()=>$()):Y(()=>$())}))}#ge(){return typeof this.#e.coalesceMs=="number"&&this.#e.coalesceMs>0?this.#e.coalesceMs:y}#we($){const C=this.#t.scheduler||{};return z(C.frame)?C.frame($):X($)}#k($){const C=this.#t.scheduler||{};z(C.cancel)?C.cancel($):B($)}#Se($){const C=this.#n[$];if(C!==void 0&&C!==O)return C;if(C===void 0)return;const A=this.#t.store;return A&&z(A.source)?A.source($):void 0}#He($,C){const A=this.#t.store;if(!A||!z(A.set))return;const S=this.#X();if(Array.isArray(S))for(const x of S){if(!x||!x.id)continue;const H=z(x.read)?x.read:V=>l(V,x.field||x.id);A.set(x.id,$,H(C))}}#Re($){let C=this.#l.get($);return C||(C=this.#o.leaf(this.#Se($),$),this.#l.set($,C)),C}#Fe($,C){const A=this.#ze(C);return A&&z(A.getValue)?A.getValue($):$?.[C]}#Ye($){const C=this.#t.columns,A=C&&z(C.all)?C.all():[],S=[];for(const x of A){const H=z(x.getValue)?x.getValue($):void 0;H!=null&&H!==""&&S.push(String(H))}return S.join(" ").toLowerCase()}#ze($){const C=this.#t.columns;return C&&z(C.get)?C.get($):void 0}#We(){const $=this.#G;if(this.#G=null,$&&z($.return))try{$.return()}catch{}}#Ve(){return v({context:this.#be("context",null)})}#be($,C){const A=this.#t.state;if(A&&z(A[$])){const S=A[$]();return S??C}return C}#ke($,C){const A=this.#t.emit;z(A)&&A($,C)}}}),Ue("packages/core/src/source/url.js",function(e,U){"use strict";Object.defineProperty(e,"DEFAULT_URL_BATCH",{enumerable:!0,get:function(){return G}}),Object.defineProperty(e,"createUrlSource",{enumerable:!0,get:function(){return g}});const E=U("packages/core/src/internal/warn.js").warnOnce,q=U("packages/core/src/internal/predicates.js"),z=q.isObject,_=q.isFunction,X=U("packages/core/src/internal/paths.js").getPath,Y=U("packages/core/src/source/abort.js").isAbortError,G=500,j=new Set(["application/x-ndjson","application/ndjson","application/jsonlines","application/jsonl","application/x-jsonlines","text/x-ndjson"]),k=Symbol("lattice.url.skip");function g(m,v={}){const h=z(v)?v:{},p=_(h.fetch)?h.fetch:typeof globalThis<"u"&&_(globalThis.fetch)?globalThis.fetch:null,b=h.format==="json"||h.format==="ndjson"?h.format:void 0,O=typeof h.rowsPath=="string"&&h.rowsPath?h.rowsPath:void 0,y=_(h.map)?h.map:void 0,L=z(h.headers)?h.headers:void 0,M=Number.isFinite(h.batchSize)&&h.batchSize>0?Math.floor(h.batchSize):G,D=h.lenient===!0,F=Number.isFinite(h.poll)&&h.poll>0?Math.floor(h.poll):void 0,T=typeof m=="string"&&m.length>0;T||E("source.url.url","createUrlSource needs a URL string; the grid will stay empty.");async function*I(R={}){if(!T)return;if(!p)throw new Error("[lattice] createUrlSource: no fetch available — pass opts.fetch or run where globalThis.fetch exists.");const $=R&&R.signal;let C;try{C=await p(m,L?{signal:$,headers:L}:{signal:$})}catch(x){throw Y(x)?x:new Error(`[lattice] createUrlSource: request to ${m} failed — ${x&&x.message||x}`)}if(!C||!C.ok){const x=C?C.status:"no response";throw new Error(`[lattice] createUrlSource: ${x} for ${m}`)}const A=c(m,b,C),S=C.body&&_(C.body.getReader)?C.body.getReader():null;try{if(!S){const V=await C.text();(A||i(V,m))==="ndjson"?yield*r(null,null,V,0,C,m,M,D):yield*u(V,m,O,y);return}const x=new TextDecoder("utf-8");if(A==="json"){yield*u(await t(S,x,""),m,O,y);return}if(A==="ndjson"){yield*r(S,x,"",0,C,m,M,D);return}const H=await n(S,x,m);H.format==="json"?yield*u(await t(S,x,H.seed),m,O,y):yield*r(S,x,H.seed,H.bytes,C,m,M,D)}finally{if(S&&_(S.cancel))try{await S.cancel()}catch{}}}const P={mode:"stream",open:I,autoStart:h.autoStart!==!1};return F!==void 0&&(P.poll=F),Number.isFinite(h.maxRows)&&(P.maxRows=h.maxRows),Number.isFinite(h.maxAge)&&(P.maxAge=h.maxAge),(typeof h.ageBy=="string"||_(h.ageBy))&&(P.ageBy=h.ageBy),Number.isFinite(h.coalesceMs)&&(P.coalesceMs=h.coalesceMs),Number.isFinite(h.promoteToMemoryBelow)&&(P.promoteToMemoryBelow=h.promoteToMemoryBelow),P}function c(m,v,h){if(v)return v;const p=d(m);if(p)return p;const b=h&&h.headers&&_(h.headers.get)?h.headers.get("content-type"):null;return l(b)}function d(m){const v=String(m).split(/[?#]/)[0].toLowerCase();if(v.endsWith(".ndjson")||v.endsWith(".jsonl"))return"ndjson";if(v.endsWith(".json"))return"json"}function l(m){if(!m)return;const v=m.split(";")[0].trim().toLowerCase();if(j.has(v))return"ndjson";if(v==="application/json"||v==="text/json"||v.endsWith("+json"))return"json"}function i(m,v){const h=m.replace(/^\s+/,""),p=a(h);if(p==="error")throw new Error(`[lattice] createUrlSource: could not tell JSON from NDJSON for ${v} — pass opts.format: 'json' | 'ndjson'.`);return p}async function n(m,v,h){let p="",b=0;for(;;){const{value:y,done:L}=await m.read();if(y&&(b+=y.byteLength,p+=v.decode(y,{stream:!0})),L){p+=v.decode();break}const M=p.replace(/^\s+/,"");if(M){if(M[0]==="[")return{format:"json",seed:p,bytes:b};if(M[0]!=="{"||p.indexOf(`
|
|
7
|
+
`||u==="\r"){t++;continue}if(u>="0"&&u<="9"){t=k(a,t,s);continue}if(u==="."&&a[t+1]>="0"&&a[t+1]<="9"){t=k(a,t,s);continue}if(u==='"'||u==="'"){t=g(a,t,s);continue}if(u==="["){const o=a.indexOf("]",t+1);if(o<0)throw new Y("a [column reference] was opened and never closed",t);s.push({kind:q,value:a.slice(t+1,o).trim(),at:t}),t=o+1;continue}if(j(u)){t=c(a,t,s);continue}const r=a.slice(t,t+2);if(X.includes(r)){s.push({kind:_,value:r==="!="?"<>":r,at:t}),t+=2;continue}if(B.includes(u)){s.push({kind:_,value:u,at:t}),t++;continue}throw new Y(`unexpected character ${JSON.stringify(u)}`,t)}return s.push({kind:Z,value:null,at:a.length}),s}function j(a){return/[A-Za-z_À-]/.test(a)}function k(a,s,t){let u=s,r=!1;for(;u<a.length;){const o=a[u];if(o>="0"&&o<="9"){u++;continue}if(o==="."&&!r){r=!0,u++;continue}if((o==="e"||o==="E")&&/[0-9+-]/.test(a[u+1]||"")){for(u+=2;u<a.length&&a[u]>="0"&&a[u]<="9";)u++;break}break}return t.push({kind:te,value:Number(a.slice(s,u)),at:s}),u}function g(a,s,t){const u=a[s];let r=s+1,o="";for(;r<a.length;){if(a[r]===u){if(a[r+1]===u){o+=u,r+=2;continue}return t.push({kind:E,value:o,at:s}),r+1}o+=a[r],r++}throw new Y("a string was opened and never closed",s)}function c(a,s,t){let u=s;for(;u<a.length&&/[A-Za-z0-9_.À-]/.test(a[u]);)u++;const r=a.slice(s,u);let o=u;for(;o<a.length&&a[o]===" ";)o++;return t.push({kind:a[o]==="("?z:q,value:r,at:s}),u}const d={"=":1,"<>":1,"<":1,"<=":1,">":1,">=":1,"+":2,"-":2,"*":3,"/":3,"^":4};function l(a){const s=String(a??"").replace(/^\s*=/,"");if(!s.trim())throw new Y("the formula is empty");const t=G(s);let u=0;const r=()=>t[u],o=()=>t[u++],f=O=>{const y=r();if(y.kind!==_||y.value!==O)throw new Y(`expected ${JSON.stringify(O)}`,y.at);u++},w=O=>{let y=m();for(;;){const L=r();if(L.kind!==_)break;const M=d[L.value];if(!M||M<O)break;u++;const D=w(L.value==="^"?M:M+1);y={kind:"bin",op:L.value,left:y,right:D}}return y},m=()=>{const O=r();return O.kind===_&&(O.value==="-"||O.value==="+")?(u++,{kind:"unary",op:O.value,arg:m()}):v()},v=()=>{let O=h();for(;r().kind===_&&r().value==="%";)u++,O={kind:"unary",op:"%",arg:O};return O},h=()=>{const O=o();if(O.kind===te)return{kind:"num",value:O.value};if(O.kind===E)return{kind:"str",value:O.value};if(O.kind===q)return{kind:"ref",name:O.value};if(O.kind===z){f("(");const y=[];if(!(r().kind===_&&r().value===")"))for(;;){if(y.push(w(1)),r().kind===_&&r().value===","){u++;continue}break}return f(")"),{kind:"call",name:String(O.value).toUpperCase(),args:y}}if(O.kind===_&&O.value==="("){const y=w(1);return f(")"),y}throw O.kind===Z?new Y("the formula ends unexpectedly",O.at):new Y(`unexpected ${JSON.stringify(O.value)}`,O.at)},p=w(1),b=r();if(b.kind!==Z)throw new Y(`unexpected ${JSON.stringify(b.value)}: is an operator missing?`,b.at);return p}function i(a){const s=new Set,t=u=>{if(!(!u||typeof u!="object")){if(u.kind==="ref"){s.add(String(u.name));return}if(u.kind==="bin"){t(u.left),t(u.right);return}if(u.kind==="unary"){t(u.arg);return}if(u.kind==="call")for(const r of u.args)t(r)}};return t(a),[...s]}function n(a){return typeof a=="string"&&/^\s*=/.test(a)&&a.trim()!=="="}}),Ue("packages/core/src/formula/evaluate.js",function(e,U){"use strict";Object.defineProperty(e,"FUNCTIONS",{enumerable:!0,get:function(){return G}}),Object.defineProperty(e,"evaluateAst",{enumerable:!0,get:function(){return k}});const E=U("packages/core/src/formula/parse.js").FormulaError;function q(g){if(g==null||g==="")return 0;if(typeof g=="boolean")return g?1:0;if(g instanceof Date)return g.getTime();const c=typeof g=="number"?g:Number(String(g).replace(/[,\s]/g,""));if(!Number.isFinite(c))throw new E(`${JSON.stringify(g)} is not a number`);return c}function z(g){return g==null?"":String(g)}function _(g){if(typeof g=="boolean")return g;if(g==null||g==="")return!1;if(typeof g=="number")return g!==0;const c=String(g).trim().toLowerCase();return c==="false"||c==="no"||c==="0"?!1:c!==""}function Z(g){const c=[];for(const d of g){if(Array.isArray(d)){for(const l of d)l!=null&&l!==""&&c.push(q(l));continue}d==null||d===""||c.push(q(d))}return c}function X(g,c){const d=10**c,l=g*d;return Math.sign(l)*Math.round(Math.abs(l)+Number.EPSILON*Math.abs(l))/d}function B(g,c){if(!g.length)return 0;const d=g.slice().sort((a,s)=>a-s),l=(d.length-1)*Math.min(1,Math.max(0,c)),i=Math.floor(l),n=Math.ceil(l);return i===n?d[i]:d[i]+(l-i)*(d[n]-d[i])}function Y(g,c){let d=0,l=0,i=0;for(const a of g){d++;const s=a-l;l+=s/d,i+=s*(a-l)}const n=c?d-1:d;return n>0?Math.sqrt(i/n):0}const G={SUM:g=>Z(g).reduce((c,d)=>c+d,0),AVERAGE:g=>{const c=Z(g);return c.length?c.reduce((d,l)=>d+l,0)/c.length:0},MIN:g=>{const c=Z(g);return c.length?Math.min(...c):0},MAX:g=>{const c=Z(g);return c.length?Math.max(...c):0},COUNT:g=>Z(g).length,PRODUCT:g=>Z(g).reduce((c,d)=>c*d,1),ROUND:g=>X(q(g[0]),g.length>1?q(g[1]):0),ROUNDDOWN:g=>{const c=10**(g.length>1?q(g[1]):0),d=q(g[0])*c;return(d<0?Math.ceil(d):Math.floor(d))/c},ROUNDUP:g=>{const c=10**(g.length>1?q(g[1]):0),d=q(g[0])*c;return(d<0?Math.floor(d):Math.ceil(d))/c},ABS:g=>Math.abs(q(g[0])),FLOOR:g=>Math.floor(q(g[0])),CEILING:g=>Math.ceil(q(g[0])),SQRT:g=>Math.sqrt(q(g[0])),POWER:g=>q(g[0])**q(g[1]),MOD:g=>{const c=q(g[1]);if(c===0)throw new E("MOD by zero");return(q(g[0])%c+c)%c},IF:g=>_(g[0])?g[1]:g.length>2?g[2]:!1,AND:g=>g.every(_),OR:g=>g.some(_),NOT:g=>!_(g[0]),COALESCE:g=>g.find(c=>c!=null&&c!=="")??null,CONCAT:g=>g.map(z).join(""),LEN:g=>z(g[0]).length,UPPER:g=>z(g[0]).toUpperCase(),LOWER:g=>z(g[0]).toLowerCase(),TRIM:g=>z(g[0]).trim(),LEFT:g=>z(g[0]).slice(0,g.length>1?q(g[1]):1),RIGHT:g=>{const c=g.length>1?q(g[1]):1;return c<=0?"":z(g[0]).slice(-c)},MEDIAN:g=>B(Z(g),.5),PERCENTILE:g=>{const c=q(g[g.length-1]);return B(Z(g.slice(0,-1)),c>1?c/100:c)},QUARTILE1:g=>B(Z(g),.25),QUARTILE3:g=>B(Z(g),.75),STDEV:g=>Y(Z(g),!0),STDEVP:g=>Y(Z(g),!1),VAR:g=>{const c=Y(Z(g),!0);return c*c},VARP:g=>{const c=Y(Z(g),!1);return c*c},COUNTDISTINCT:g=>{const c=new Set;for(const d of g){const l=Array.isArray(d)?d:[d];for(const i of l)i!=null&&i!==""&&c.add(i)}return c.size},IQR:g=>{const c=Z(g);return B(c,.75)-B(c,.25)}};G.AVG=G.AVERAGE,G.CEIL=G.CEILING,G.POW=G.POWER,G.STDEVS=G.STDEV,G.PERCENTILEINC=G.PERCENTILE;function j(g,c){const d=Number(g),l=Number(c);if(g!==null&&g!==""&&c!==null&&c!==""&&Number.isFinite(d)&&Number.isFinite(l))return d<l?-1:d>l?1:0;const n=z(g).toLowerCase(),a=z(c).toLowerCase();return n<a?-1:n>a?1:0}function k(g,c={}){const d=typeof c.lookup=="function"?c.lookup:null,l=c.functions?{...G,...c.functions}:G,i=n=>{switch(n.kind){case"num":return n.value;case"str":return n.value;case"ref":{if(!d)throw new E(`there is no column called ${JSON.stringify(n.name)} here`);const a=d(String(n.name));if(a===void 0)throw new E(`there is no column called ${JSON.stringify(n.name)}`);return a}case"unary":{if(n.op==="%")return q(i(n.arg))/100;const a=q(i(n.arg));return n.op==="-"?-a:a}case"bin":{const a=n.op;if(a==="=")return j(i(n.left),i(n.right))===0;if(a==="<>")return j(i(n.left),i(n.right))!==0;if(a==="<")return j(i(n.left),i(n.right))<0;if(a==="<=")return j(i(n.left),i(n.right))<=0;if(a===">")return j(i(n.left),i(n.right))>0;if(a===">=")return j(i(n.left),i(n.right))>=0;const s=q(i(n.left)),t=q(i(n.right));if(a==="+")return s+t;if(a==="-")return s-t;if(a==="*")return s*t;if(a==="^")return s**t;if(a==="/"){if(t===0)throw new E("division by zero");return s/t}throw new E(`unknown operator ${JSON.stringify(a)}`)}case"call":{const a=c.lazy&&c.lazy[n.name];if(typeof a=="function")return a(n.args,i,c);const s=l[n.name];if(typeof s!="function")throw new E(`there is no function called ${n.name}`);return s(n.args.map(i),c)}default:throw new E("the formula could not be read")}};return i(g)}}),Ue("packages/core/src/formula/index.js",function(e,U){"use strict";Object.defineProperty(e,"parseFormula",{enumerable:!0,get:function(){return E}}),Object.defineProperty(e,"referencesOf",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"looksLikeFormula",{enumerable:!0,get:function(){return z}}),Object.defineProperty(e,"FormulaError",{enumerable:!0,get:function(){return _}}),Object.defineProperty(e,"tokenise",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"evaluateAst",{enumerable:!0,get:function(){return B}}),Object.defineProperty(e,"FUNCTIONS",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(e,"rowLookup",{enumerable:!0,get:function(){return G}}),Object.defineProperty(e,"evaluateFormula",{enumerable:!0,get:function(){return j}});const te=U("packages/core/src/formula/parse.js"),E=te.parseFormula,q=te.referencesOf,z=te.looksLikeFormula,_=te.FormulaError,Z=te.tokenise,X=U("packages/core/src/formula/evaluate.js"),B=X.evaluateAst,Y=X.FUNCTIONS;function G(k){const{grid:g,row:c,data:d}=k||{},l=t=>String(t).toLowerCase().replace(/[\s_-]/g,""),i=g&&g.columns&&typeof g.columns.all=="function"?g.columns.all():[],n=g&&g.permissions,a=n&&typeof n.isReadable=="function"?t=>n.isReadable(t):()=>!0,s=new Set;for(const t of i)a(t)||(s.add(l(t.id)),t.field&&s.add(l(t.field)),t.title&&s.add(l(t.title)));return t=>{const u=l(t);if(s.has(u))throw new _(`"${t}" cannot be read`);for(const r of i)if(l(r.id)===u||r.field&&l(r.field)===u||r.title&&l(r.title)===u)return c&&g.rows&&typeof g.rows.value=="function"?g.rows.value(c.key,r.id):d?d[r.field||r.id]:void 0;if(d&&typeof d=="object"){for(const r of Object.keys(d))if(l(r)===u){if(!a(r))throw new _(`"${t}" cannot be read`);return d[r]}}}}function j(k,g={}){try{const c=E(k);return{ok:!0,value:B(c,{lookup:G(g),functions:g.formulaFunctions}),references:q(c)}}catch(c){return{ok:!1,error:c instanceof _?c.message:"the formula could not be read",at:c instanceof _?c.at:void 0}}}}),Ue("packages/core/src/internal/version.js",function(e,U){"use strict";Object.defineProperty(e,"VERSION",{enumerable:!0,get:function(){return q}});const te="1.99.1";async function E(){return te}const q="1.99.1"}),Ue("packages/core/src/internal/merge.js",function(e,U){"use strict";Object.defineProperty(e,"expand",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"toArray",{enumerable:!0,get:function(){return z}}),Object.defineProperty(e,"merge",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"mergeRow",{enumerable:!0,get:function(){return X}});const E=U("packages/core/src/internal/predicates.js").isObject;function q(B,Y,G){if(B!==void 0)return B===!0?{enabled:!0,...G}:B===!1?{enabled:!1}:E(B)?B:{[Y]:B,enabled:!0}}function z(B){return B==null?[]:Array.isArray(B)?B:[B]}const _=Object.freeze(new Set(["__proto__","constructor","prototype"]));function Z(B,Y){if(!E(B))return E(Y)?{...Y}:Y;if(!E(Y))return Y===void 0?B:Y;const G={...B};for(const j of Object.keys(Y)){if(_.has(j))continue;const k=Y[j];k!==void 0&&(G[j]=E(k)&&E(G[j])?Z(G[j],k):k)}return G}function X(B,Y){if(!E(B)||!E(Y)||B===Y)return Y;const G=Object.create(Object.getPrototypeOf(B));return Object.assign(G,B,Y),G}}),Ue("packages/core/src/internal/schedule.js",function(e,U){"use strict";Object.defineProperty(e,"now",{enumerable:!0,get:function(){return te}}),Object.defineProperty(e,"nextFrame",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"cancelFrame",{enumerable:!0,get:function(){return z}}),Object.defineProperty(e,"frameBatched",{enumerable:!0,get:function(){return _}}),Object.defineProperty(e,"settleDebounce",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"whenIdle",{enumerable:!0,get:function(){return X}});function te(){return typeof performance<"u"&&performance.now?performance.now():Date.now()}const E=typeof requestAnimationFrame=="function";function q(B){return E?requestAnimationFrame(B):setTimeout(()=>B(te()),16)}function z(B){B!=null&&(E?cancelAnimationFrame(B):clearTimeout(B))}function _(B){let Y=null,G=null;const j=()=>{Y=null;const g=G;G=null,B(...g||[])},k=(...g)=>{G=g,Y===null&&(Y=q(j))};return k.cancel=()=>{z(Y),Y=null,G=null},k.flush=()=>{Y!==null&&(z(Y),j())},k}function Z(B,Y){let G=null,j=null;const k=()=>{if(G=null,j===null)return;const d=j;j=null,B(...d),g()},g=()=>{G=setTimeout(k,Y),typeof G?.unref=="function"&&G.unref()},c=(...d)=>{G===null?(B(...d),g()):(j=d,clearTimeout(G),g())};return c.flush=()=>{if(G!==null&&clearTimeout(G),G=null,j===null)return;const d=j;j=null,B(...d)},c.cancel=()=>{G!==null&&clearTimeout(G),G=null,j=null},c.pending=()=>G!==null||j!==null,c}function X(B,Y=50){return typeof requestIdleCallback=="function"?requestIdleCallback(B,{timeout:Y}):setTimeout(()=>B({timeRemaining:()=>0,didTimeout:!0}),1)}}),Ue("packages/core/src/internal/paths.js",function(e,U){"use strict";Object.defineProperty(e,"pathGetter",{enumerable:!0,get:function(){return E}}),Object.defineProperty(e,"pathSetter",{enumerable:!0,get:function(){return z}}),Object.defineProperty(e,"getPath",{enumerable:!0,get:function(){return _}}),Object.defineProperty(e,"setPath",{enumerable:!0,get:function(){return Z}});const te=new Map;function E(X){let B=te.get(X);if(B)return B;if(!X.includes("."))B=Y=>Y?.[X];else{const Y=X.split("."),G=Y.length;B=j=>{let k=j;for(let g=0;g<G;g++){if(k==null)return;k=k[Y[g]]}return k}}return te.set(X,B),B}const q=new Map;function z(X){let B=q.get(X);if(B)return B;if(!X.includes("."))B=(Y,G)=>{Y!=null&&(Y[X]=G)};else{const Y=X.split("."),G=Y.length-1;B=(j,k)=>{let g=j;for(let c=0;c<G;c++){if(g==null)return;const d=Y[c];g[d]==null&&(g[d]={}),g=g[d]}g!=null&&(g[Y[G]]=k)}}return q.set(X,B),B}function _(X,B){return E(B)(X)}function Z(X,B,Y){z(B)(X,Y)}}),Ue("packages/core/src/internal/compare.js",function(e,U){"use strict";Object.defineProperty(e,"collator",{enumerable:!0,get:function(){return E}}),Object.defineProperty(e,"defaultCompare",{enumerable:!0,get:function(){return q}});const te=new Map;function E(z,_){const Z=`${z||""}|${_?JSON.stringify(_):""}`;let X=te.get(Z);return X||(X=new Intl.Collator(z||void 0,{numeric:!0,sensitivity:"variant",..._}),te.set(Z,X)),X}function q(z,_){if(z===_)return 0;if(z==null)return 1;if(_==null)return-1;if(typeof z=="number"&&typeof _=="number")return Number.isNaN(z)?Number.isNaN(_)?0:1:Number.isNaN(_)||z<_?-1:z>_?1:0;const Z=String(z),X=String(_);return Z<X?-1:Z>X?1:0}}),Ue("packages/core/src/defaults.js",function(e,U){"use strict";Object.defineProperty(e,"defaults",{enumerable:!0,get:function(){return G}}),Object.defineProperty(e,"applyDefaults",{enumerable:!0,get:function(){return j}});const E=U("packages/core/src/internal/predicates.js").isObject,z=U("packages/core/src/internal/merge.js").merge,Z=U("packages/core/src/internal/warn.js").warnOnce;let X=null;class B extends Error{}function Y(k,g=new Set){if(Array.isArray(k)){if(g.has(k))throw new B;g.add(k);const d=k.map(l=>Y(l,g));return g.delete(k),d}if(!E(k)||Object.getPrototypeOf(k)!==Object.prototype&&Object.getPrototypeOf(k)!==null)return k;if(g.has(k))throw new B;g.add(k);const c={};for(const[d,l]of Object.entries(k))c[d]=Y(l,g);return g.delete(k),c}function G(k){if(k===void 0)return Y(X??{});if(k===null)return X=null,{};if(!E(k))return Z("defaults:type",`defaults() expects a configuration object, or null to clear it, but got ${Array.isArray(k)?"an array":typeof k}. The call was ignored and the defaults are unchanged.`),Y(X??{});try{X=Y(k)}catch(g){if(!(g instanceof B))throw g;return Z("defaults:cyclic","defaults() expects a configuration object with no circular references, but the object passed refers back to itself. The call was ignored and the defaults are unchanged."),Y(X??{})}return Y(X)}function j(k){return X===null?k:z(Y(X),k)}}),Ue("packages/core/src/internal/uid.js",function(e,U){"use strict";Object.defineProperty(e,"uid",{enumerable:!0,get:function(){return E}});let te=0;function E(q="l"){return`${q}${(++te).toString(36)}`}}),Ue("packages/core/src/events/names.js",function(e,U){"use strict";Object.defineProperty(e,"EVENT_NAMES",{enumerable:!0,get:function(){return te}}),Object.defineProperty(e,"isKnownEvent",{enumerable:!0,get:function(){return q}});const te=Object.freeze(["ready","destroy","render:first","render:done","config:changed","licence:changed","model:changed","rows:changed","rows:queued","rows:deferred","rows:paused","rows:resumed","row:received","row:sent","row:copied","row:moved","source:error","source:total","stream:chunk","stream:end","stream:evicted","rowDrag:started","rowDrag:moved","rowDrag:left","rowDrag:ended","cell:changed","cell:pending","cell:confirmed","cell:reverted","cell:conflict","cell:clicked","cell:dblclicked","cell:contextmenu","cell:mouseover","cell:mouseout","cell:mousedown","cell:mouseup","cell:edit:start","cell:edit:end","row:edit:start","row:edit:end","row:clicked","row:dblclicked","row:pending","row:confirmed","row:reverted","row:conflict","form:opened","form:closed","form:saved","form:error","sort:changed","filter:changed","group:toggled","facet:computed","facet:filtered","facet:expanded","facet:failed","column:moved","column:resized","column:visible","column:pinned","column:grouped","column:pivoted","column:filter:open","column:profile:open","column:menu:open","columns:changed","columns:tagged","columngroup:changed","header:contextmenu","pivot:drill","selection:changed","range:changed","clipboard:copy","page:changed","scroll","scroll:end","size:changed","detail:toggled","detail:cell:edit:start","detail:cell:edit:end","detail:row:edit:start","detail:row:edit:end","detail:cell:changed","toolpanel:focus","highlight:changed","find:changed","tree:loading","tree:loaded","tree:loadFailed","tree:loadAborted","state:changed","state:reset","history:changed","history:applied","views:changed","view:applied","view:saved","view:removed","view:renamed","view:default","validation:failed","validation:cleared","formatting:changed","redaction:changed","permissions:changed","presentation:changed","presentation:started","presentation:ended","presentation:view","presentation:scale","presentation:spotlight","presentation:captured","comment:added","comment:edited","comment:deleted","comment:failed","comment:resolved","comment:unresolved","comment:threadOpened","comment:threadClosed","comment:indexLoaded","presence:published","presence:joined","presence:updated","presence:left","presence:failed","presence:lockRefused","diff:changed","diff:swapped","timeline:attached","timeline:detached","timeline:seek","timeline:seeking","annotation:changed","export:progress","export:request","export:done","shortcuts:opened","shortcuts:closed","print:before","print:after","beforeEdit","beforeSort","beforeFilter","beforeColumnMove","beforeColumnResize","beforeColumnHide","beforeSelect","beforeRowAdd","beforeDelete","beforeRowMove","beforeGroup","beforeRowReceive","edit:cancelled","sort:cancelled","filter:cancelled","columnMove:cancelled","columnResize:cancelled","columnHide:cancelled","selection:cancelled","rowAdd:cancelled","delete:cancelled","rowMove:cancelled","group:cancelled","rowReceive:cancelled"]),E=new Set(te);function q(z){return z==="*"||E.has(z)}}),Ue("packages/core/src/events/bus.js",function(e,U){"use strict";Object.defineProperty(e,"WILDCARD",{enumerable:!0,get:function(){return B}}),Object.defineProperty(e,"EventBus",{enumerable:!0,get:function(){return d}});const te=U("packages/core/src/internal/warn.js"),E=te.warnOnce,q=te.DEV,_=U("packages/core/src/internal/uid.js").uid,X=U("packages/core/src/events/names.js").isKnownEvent,B="*";function Y(l,i){!q||X(i)||E(`bus.unknown:${i}`,`${l}('${i}') subscribes to an event the grid never raises, so the handler will never fire. Check the name against the EventName list — a common cause is a near miss such as 'row:click' for 'row:clicked'.`)}const G=new Set(["api","user","init","ai"]),j=new WeakMap;function k(l){let i=j.get(l);return i||(i=_("h"),j.set(l,i)),i}function g(){return typeof performance=="object"&&performance?performance.now():Date.now()}function c(l){if(!l||typeof l!="object")return{};const i={};for(const[n,a]of Object.entries(l))n!=="grid"&&(a==null?i[n]=String(a):Array.isArray(a)?i[n]=`[${a.length}]`:typeof a=="object"?i[n]=a.key?`row ${a.key}`:"{…}":typeof a=="function"?i[n]="[function]":i[n]=String(a).slice(0,60));return i}class d{#e=new Map;#t=!1;#n=[];#r=200;#s=new Map;#i=null;#o=!1;#l=0;constructor(i=null){this.#i=i}attach(i){this.#i=i}get grid(){return this.#i}get destroyed(){return this.#o}on(i,n){if(typeof n!="function")return E(`bus.handler:${i}`,`on('${i}') needs a function; ignored.`),()=>{};Y("on",i);let a=this.#e.get(i);return a||(a=[],this.#e.set(i,a)),a.push(n),()=>this.off(i,n)}once(i,n){if(typeof n!="function")return E(`bus.handler:${i}`,`once('${i}') needs a function; ignored.`),()=>{};Y("once",i);const a=s=>{this.off(i,n),n(s)};return this.#s.set(n,a),this.on(i,a)}off(i,n){if(n===void 0){this.#e.delete(i);return}const a=this.#e.get(i);if(!a)return;const s=this.#s.get(n),t=s&&a.includes(s)?s:n,u=a.indexOf(t);u>=0&&a.splice(u,1),s&&t===s&&this.#s.delete(n),a.length===0&&this.#e.delete(i)}count(i){const n=this.#e.get(i),a=i===B?null:this.#e.get(B);return(n?n.length:0)+(a?a.length:0)}#a(i,n,a,s,t){this.#n.push({type:i,origin:n,listeners:(s?s.length:0)+(t?t.length:0),payload:c(a),at:Date.now(),ms:0}),this.#n.length>this.#r&&this.#n.shift()}recordEvents(i,n){this.#t=!!i,Number.isFinite(n)&&n>0&&(this.#r=Math.floor(n)),i||(this.#n=[])}eventLog(){return this.#n.map(i=>({...i}))}clearEventLog(){this.#n=[]}counts(){const i={};for(const[n,a]of this.#e)i[n]=a.length;return i}emit(i,n,a){const s=a??(n&&n.origin),t=G.has(s)?s:"api",u={...n||null,type:i,origin:t,grid:this.#i};if(this.#o)return u;const r=this.#e.get(i),o=i===B?void 0:this.#e.get(B);if(this.#t&&this.#a(i,t,n,r,o),!r&&!o)return u;const f=this.#t?g():0;this.#l++;try{r&&this.#c(r.slice(),u,i),o&&this.#c(o.slice(),u,B)}finally{this.#l--,this.#t&&this.#n.length&&(this.#n[this.#n.length-1].ms=g()-f)}return u}emitBefore(i,n,a){const s=a??(n&&n.origin),t=G.has(s)?s:"user";let u=!1,r=null;const o=p=>{u=!0,p!=null&&r===null&&(r=String(p))},f={...n||null,type:i,origin:t,grid:this.#i,get defaultPrevented(){return u},get reason(){return r},preventDefault(p){o(p)}};if(this.#o)return!0;const w=this.#e.get(i);this.#t&&this.#a(i,t,n,w,void 0);const m=w?w.slice():[];if(m.length===0)return!0;const v=()=>(u&&r===null&&(r="prevented"),u&&n&&typeof n=="object"&&(n.reason=r),!u),h=[];for(const p of m)try{const b=p(f);b&&typeof b.then=="function"?h.push(b):b===!1&&o("prevented")}catch(b){o("error"),E(`bus.beforeThrow:${i}:${k(p)}`,`a '${i}' before-handler threw; the action was cancelled.`,b)}return h.length===0?v():Promise.allSettled(h).then(p=>{for(const b of p)b.status==="rejected"?(o("error"),E(`bus.beforeReject:${i}`,`a '${i}' before-handler rejected; the action was cancelled.`,b.reason)):b.value===!1&&o("prevented");return v()})}#c(i,n,a){for(let s=0;s<i.length;s++)try{i[s](n)}catch(t){E(`bus.throw:${a}:${k(i[s])}`,`a '${a}' handler threw; other handlers were unaffected.`,t)}}clear(){this.#e.clear(),this.#s.clear()}destroy(){this.clear(),this.#o=!0,this.#i=null}}}),Ue("packages/core/src/registry/free-tier-notice.js",function(e,U){"use strict";Object.defineProperty(e,"FREE_TIER_NOTICE",{enumerable:!0,get:function(){return te}});const te="Free for non-commercial use: latticegrid.dev/free"}),Ue("packages/core/src/registry/licence.js",function(e,U){"use strict";Object.defineProperty(e,"PRODUCT",{enumerable:!0,get:function(){return _}}),Object.defineProperty(e,"LICENCE_VERSION",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"PUBLIC_KEY",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(e,"fromBase64Url",{enumerable:!0,get:function(){return k}}),Object.defineProperty(e,"toBase64Url",{enumerable:!0,get:function(){return g}}),Object.defineProperty(e,"asciiBytes",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"parseLicence",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"hasEd25519",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"verifyLicence",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"isLocalHost",{enumerable:!0,get:function(){return w}}),Object.defineProperty(e,"currentHost",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"matchesDomain",{enumerable:!0,get:function(){return v}}),Object.defineProperty(e,"LicenceHolder",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"setLicence",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"licenceInfo",{enumerable:!0,get:function(){return M}}),Object.defineProperty(e,"watermark",{enumerable:!0,get:function(){return D}}),Object.defineProperty(e,"licenceState",{enumerable:!0,get:function(){return F}}),Object.defineProperty(e,"sharedLicence",{enumerable:!0,get:function(){return T}});const E=U("packages/core/src/internal/warn.js").warnOnce,q=U("packages/core/src/registry/free-tier-notice.js"),z=q.FREE_TIER_NOTICE;Object.defineProperty(e,"FREE_TIER_NOTICE",{enumerable:!0,get:function(){return q.FREE_TIER_NOTICE}});const _="lattice-grid",Z=1,X="LG1",B=64,Y="GwmaCOkGedHulqsa-DOV1TU8On1rsalWv519c_dW4j4",G="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",j=(()=>{const I=new Int16Array(128).fill(-1);for(let P=0;P<G.length;P++)I[G.charCodeAt(P)]=P;return I[43]=62,I[47]=63,I})();function k(I){if(typeof I!="string")return null;let P="";for(let x=0;x<I.length;x++){const H=I.charCodeAt(x);if(H!==61){if(H>127||j[H]<0)return null;P+=I[x]}}const R=P.length;if(R%4===1)return null;const $=new Uint8Array(Math.floor(R*3/4));let C=0,A=0,S=0;for(let x=0;x<R;x++)C=C<<6|j[P.charCodeAt(x)],A+=6,A>=8&&(A-=8,$[S++]=C>>A&255);return S===$.length?$:$.subarray(0,S)}function g(I){let P="",R=0;for(;R+2<I.length;R+=3){const C=I[R]<<16|I[R+1]<<8|I[R+2];P+=G[C>>18&63]+G[C>>12&63]+G[C>>6&63]+G[C&63]}const $=I.length-R;if($===1){const C=I[R]<<16;P+=G[C>>18&63]+G[C>>12&63]}else if($===2){const C=I[R]<<16|I[R+1]<<8;P+=G[C>>18&63]+G[C>>12&63]+G[C>>6&63]}return P}function c(I){const P=new Uint8Array(I.length);for(let R=0;R<I.length;R++)P[R]=I.charCodeAt(R)&127;return P}function d(I){if(typeof TextDecoder=="function")return new TextDecoder().decode(I);let P="";for(let R=0;R<I.length;R++)P+=String.fromCharCode(I[R]);return P}function l(I){const P={ok:!1,reason:"malformed",product:null,issuedTo:null,expires:null,terms:null,features:[],deployments:[],version:0,message:null,signature:null,raw:typeof I=="string"?I:""};if(typeof I!="string"||I.length===0)return{...P,reason:"missing"};const R=I.trim(),$=R.split(".");if($.length!==3)return P;const[C,A,S]=$;if(C!==X)return{...P,reason:"prefix"};const x=k(A),H=k(S);if(!x||!H)return P;let V;try{V=JSON.parse(d(x))}catch{return P}return V===null||typeof V!="object"?P:{ok:!0,reason:null,product:typeof V.p=="string"?V.p:null,issuedTo:typeof V.t=="string"?V.t:null,expires:typeof V.e=="string"?V.e:null,terms:typeof V.terms=="string"?V.terms:null,features:Array.isArray(V.f)?V.f.slice():[],deployments:Array.isArray(V.d)?V.d.slice():[],version:typeof V.v=="number"?V.v:0,message:c(A),signature:H,raw:R}}function i(I,P){if(!I)return!1;const R=Date.parse(/^\d{4}-\d{2}-\d{2}$/.test(I)?`${I}T23:59:59.999Z`:I);return Number.isNaN(R)?!0:P>R}function n(I){return I==="non-commercial"?"non-commercial":"commercial"}let a=null,s=null,t=null;function u(){const I=globalThis.crypto;return I&&I.subtle?I.subtle:null}async function r(I){if(a&&s===I)return a;const P=u();if(!P)return null;const R=k(I);if(!R)return null;try{const $=await P.importKey("raw",R,{name:"Ed25519"},!1,["verify"]);return a=$,s=I,$}catch{return null}}async function o(){return t!==null||(t=await r(Y)!==null),t}async function f(I,P={}){const R=P.warn!==!1,$=P.product||_,C=P.publicKey||Y,A=P.now??Date.now(),S=P.host??m(),x=w(S)?"":` ${z}`,H=l(I);if(!H.ok){const re=H.reason==="missing"?"missing":"malformed";return R&&E(`licence.${re}`,re==="missing"?`no licence key supplied. The grid renders in full and carries a trial watermark on any host other than localhost. Get a key at latticegrid.dev.${x}`:`licence key could not be read. The grid will render with a watermark.${x}`),{valid:!1,reason:re,terms:"commercial"}}const V={product:H.product||void 0,issuedTo:H.issuedTo||void 0,expires:H.expires||void 0,terms:n(H.terms)};if(H.product!==$)return R&&E("licence.product",`licence key is for '${H.product}', not '${$}'. The grid will render with a watermark.`),{valid:!1,...V,reason:"product"};if(i(H.expires,A))return R&&E("licence.expired",`licence expired on ${H.expires}. The grid will render with a watermark. Renew at latticegrid.dev.`),{valid:!1,...V,reason:"expired"};const W=H.deployments||[];if(W.length&&S&&!w(S)&&!v(S,W))return R&&E("licence.domain",`licence key is not valid for ${S}; it covers ${W.join(", ")}. The grid will render with a watermark.`),{valid:!1,...V,reason:"domain"};const Q=await r(C);if(!Q){const re=!!H.signature&&H.signature.length===B;return R&&E("licence.algorithm","this host does not provide crypto.subtle Ed25519, so the licence signature could not be verified. A structural check was used instead."),re?{valid:!0,...V,reason:"unverified"}:{valid:!1,...V,reason:"signature"}}let ee=!1;try{ee=await u().verify({name:"Ed25519"},Q,H.signature,H.message)}catch{ee=!1}return ee?{valid:!0,...V}:(R&&E("licence.signature","licence signature is not valid. The grid will render with a watermark."),{valid:!1,...V,reason:"signature"})}function w(I){const P=String(I??m()??"").trim().toLowerCase().replace(/^\[/,"").replace(/\]$/,"");return!P||P==="localhost"||P.endsWith(".localhost")||P==="::1"||P==="0:0:0:0:0:0:0:1"?!0:/^127\.\d{1,3}\.\d{1,3}\.\d{1,3}$/.test(P)}function m(){const I=globalThis.location;return I&&typeof I.hostname=="string"?I.hostname:null}function v(I,P){const R=h(I);return!R||!Array.isArray(P)?!1:P.some($=>{const C=h($);if(!C)return!1;if(C==="*")return!0;if(C.startsWith("*.")){const A=C.slice(2);return R===A||R.endsWith(`.${A}`)}return R===C})}function h(I){return String(I??"").trim().toLowerCase().replace(/\.$/,"")}class p{#e="";#t={valid:!1,reason:"missing",terms:"commercial"};#n=null;#r=null;#s;#i=new Set;constructor(P={}){this.#s=P}set(P){this.#e=typeof P=="string"?P.trim():"";const R=l(this.#e);return this.#t=R.ok?{valid:!i(R.expires,Date.now())&&R.product===(this.#s.product||_),product:R.product||void 0,issuedTo:R.issuedTo||void 0,expires:R.expires||void 0,terms:n(R.terms),reason:"pending"}:{valid:!1,reason:R.reason||"malformed",terms:"commercial"},this.#n=null,this.#e&&this.verify(),this.#t}verify(){if(this.#n)return this.#n;const P=this.#e;return this.#n=f(P,this.#s).then(R=>{if(this.#e===P){this.#t=R;for(const $ of this.#i)$(R)}return R}),this.#n}onSettled(P){return this.#i.add(P),()=>this.#i.delete(P)}info(){return{...this.#t}}watermark(){return this.#t.valid?!1:!w(this.#r)}setHost(P){this.#r=P}state(){return this.#t.valid?"licensed":w(this.#r)?"localhost":"trial"}reset(){this.#e="",this.#t={valid:!1,reason:"missing",terms:"commercial"},this.#n=null,this.#i.clear()}}const b=Symbol.for("lattice-grid/licence/holder");function O(){const I=globalThis,P=I&&I[b];if(P&&typeof P.set=="function"&&typeof P.watermark=="function")return P;const R=new p;if(I)try{I[b]=R}catch{}return R}const y=O();function L(I){return y.set(I)}function M(){return y.info()}function D(){return y.watermark()}function F(){return y.state()}function T(){return y}}),Ue("packages/core/src/registry/registry.js",function(e,U){"use strict";Object.defineProperty(e,"KINDS",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(e,"REGIONS",{enumerable:!0,get:function(){return G}}),Object.defineProperty(e,"Registry",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"sharedRegistry",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"registerModules",{enumerable:!0,get:function(){return a}});const te=U("packages/core/src/internal/warn.js"),E=te.warnOnce,q=te.DEV,_=U("packages/core/src/internal/predicates.js").isFunction,Z=U("packages/core/src/registry/licence.js"),X=Z.LicenceHolder,B=Z.sharedLicence,Y=["renderer","editor","filter","dataType","totalFn","pipe","component"],G=["all","header","body","totals","panels"];class j{#e=new Map;#t=new Map;#n=new Set;#r=new Set;#s;#i=null;#o=null;#l=new Set;#a=new Map;constructor(t={}){for(const u of Y)this.#t.set(u,new Map);this.#s=t.holder||B(),this.#o=t.grid??null,this.#i=this.#s.onSettled(()=>{this.#f({reason:"licence",name:"licence",capabilities:this.capabilities(),regions:["all"]})}),t.licence&&this.setLicence(t.licence)}registerModules(t,u={}){u.licence&&this.setLicence(u.licence),u.grid!==void 0&&(this.#o=u.grid);const r=Array.isArray(t)?t:[t],o=[];for(const f of r){if(!f||typeof f!="object"||typeof f.name!="string"||!f.name){E("registry.module.shape","registerModules received something that is not a module; ignored.");continue}if(this.#e.has(f.name)){q&&this.#u(this.#e.get(f.name),f);continue}if(!_(f.install)){E(`registry.module.install:${f.name}`,`module '${f.name}' has no install() and was ignored.`);continue}const w={registry:this,grid:this.#o};try{f.install(w)}catch(m){E(`registry.module.throw:${f.name}`,`module '${f.name}' threw during install; it was not registered.`,m);continue}this.#e.set(f.name,f);for(const m of k(f))this.#n.add(m);o.push(f.name),this.#f({reason:"module",name:f.name,capabilities:this.capabilities(),regions:d(f)})}return o}unregisterModule(t){const u=this.#e.get(t);if(!u)return!1;if(_(u.uninstall))try{u.uninstall({registry:this,grid:this.#o})}catch(r){E(`registry.module.uninstall:${t}`,`module '${t}' threw during uninstall.`,r)}return this.#e.delete(t),this.#c(),this.#f({reason:"unmodule",name:t,capabilities:this.capabilities(),regions:d(u)}),!0}modules(){return[...this.#e.values()]}has(t){return this.#e.has(t)}#c(){this.#n.clear();for(const t of this.#e.values())for(const u of k(t))this.#n.add(u)}#u(t,u){!t||t===u||g(t,u)||E(`registry.module.reconfigure:${u.name}`,`module '${u.name}' was re-registered with different options; the first registration is kept and this call was ignored. Unregister it first if you mean to replace it.`)}capabilities(){return[...this.#n].sort()}can(t){return this.#n.has(t)}onChange(t){return _(t)?(this.#r.add(t),this.#a.set(t,this.#o),()=>{this.#r.delete(t),this.#a.delete(t)}):()=>{}}#f(t){for(const u of[...this.#r])try{u(t)}catch(r){E("registry.onChange.throw","a registry change handler threw.",r)}}register(t,u,r){const o=this.#t.get(t);if(!o){E(`registry.kind:${t}`,`unknown registry kind '${t}'; expected one of ${Y.join(", ")}.`);return}if(!u||typeof u!="string"){E(`registry.name:${t}`,`register('${t}', ...) needs a name.`);return}o.has(u)&&o.get(u)!==r&&E(`registry.replace:${t}:${u}`,`'${u}' was already registered as a ${t} and has been replaced.`),o.set(u,r),this.#f({reason:"register",name:u,kind:t,capabilities:this.capabilities(),regions:l(t)})}registerAll(t,u){if(u)for(const r of Object.keys(u))this.register(t,r,u[r])}get(t,u){const r=this.#t.get(t);return r?r.get(u):void 0}names(t){const u=this.#t.get(t);return u?[...u.keys()]:[]}#d(t,u){const r=this.#t.get(t).get(u);return r!==void 0?r:this.#t.get("component").get(u)}renderer(t){return this.#d("renderer",t)}editor(t){return this.#d("editor",t)}filter(t){return this.#d("filter",t)}dataType(t){return this.get("dataType",t)}totalFn(t){return this.get("totalFn",t)}pipe(t){return this.get("pipe",t)}setLicence(t){return this.#s.set(t)}licence(){return this.#s.info()}licenceVerified(){return this.#s.verify()}watermark(){return this.#s.watermark()}attach(t){t!=null&&(this.#l.add(t),this.#o=t)}detach(t){if(t!=null){this.#l.delete(t);for(const[u,r]of[...this.#a])r===t&&(this.#r.delete(u),this.#a.delete(u));if(this.#o===t){const u=this.#l.size?[...this.#l][this.#l.size-1]:null;this.#o=u}this.#l.size===0&&this.#i&&(this.#i(),this.#i=null)}}destroy(t){if(t!=null){this.detach(t);return}for(const u of[...this.#e.keys()])this.unregisterModule(u);this.#r.clear(),this.#a.clear(),this.#l.clear(),this.#i&&this.#i(),this.#i=null,this.#o=null}}function k(s){const t=s.capabilities,u=Array.isArray(t)?t.filter(r=>typeof r=="string"):[];return[s.name,...u]}function g(s,t){return s.install!==t.install||s.uninstall!==t.uninstall||(s.version||"")!==(t.version||"")?!1:c(k(s),k(t))&&c(d(s),d(t))}function c(s,t){const u=new Set(s),r=new Set(t);if(u.size!==r.size)return!1;for(const o of u)if(!r.has(o))return!1;return!0}function d(s){const t=s.regions;return!Array.isArray(t)||t.length===0?["all"]:t.filter(u=>G.includes(u))}function l(s){switch(s){case"filter":return["header"];case"totalFn":return["totals"];case"renderer":case"editor":case"pipe":return["body"];default:return["all"]}}const i=new j;function n(){return i}function a(s,t={}){return i.registerModules(s,t)}}),Ue("packages/core/src/internal/text.js",function(e,U){"use strict";Object.defineProperty(e,"humanise",{enumerable:!0,get:function(){return te}}),Object.defineProperty(e,"escapeHtml",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"titleCase",{enumerable:!0,get:function(){return z}});function te(_){return _?(_.includes(".")?_.slice(_.lastIndexOf(".")+1):_).replace(/[_-]+/g," ").replace(/([a-z0-9])([A-Z])/g,"$1 $2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1 $2").replace(/\s+/g," ").trim().replace(/^./,X=>X.toUpperCase()):""}const E={"&":"&","<":"<",">":">",'"':""","'":"'"};function q(_){const Z=_==null?"":String(_);return/[&<>"']/.test(Z)?Z.replace(/[&<>"']/g,X=>E[X]):Z}function z(_){return String(_).replace(/\w\S*/g,Z=>Z[0].toUpperCase()+Z.slice(1).toLowerCase())}}),Ue("packages/core/src/format/mask.js",function(e,U){"use strict";Object.defineProperty(e,"splitSections",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"parseSection",{enumerable:!0,get:function(){return z}}),Object.defineProperty(e,"compileMask",{enumerable:!0,get:function(){return Z}});const te=new Set(["0","#","?",",","."]),E="\0";function q(B){const Y=[];let G="",j=!1;for(let k=0;k<B.length;k++){const g=B[k];if(g==="\\"){G+=g+(B[k+1]??""),k+=1;continue}if(g==='"'){j=!j,G+=g;continue}if(g===";"&&!j){Y.push(G),G="";continue}G+=g}return Y.push(G),Y}function z(B){let Y="",G="",j="",k=1,g=!1,c=!1;const d=o=>{c?G+=o:Y+=o};for(let o=0;o<B.length;o++){const f=B[o];if(f==="\\"){d(B[o+1]??""),o+=1;continue}if(f==='"'){const w=B.indexOf('"',o+1);d(w===-1?B.slice(o+1):B.slice(o+1,w)),o=w===-1?B.length:w;continue}if(f==="%"){k*=100,d("%");continue}if(f==="@"){g=!0,d("\0");continue}if(te.has(f)){j+=f,c=!0;continue}d(f)}let l=-1;for(let o=j.length-1;o>=0;o--){const f=j[o];if(f==="0"||f==="#"||f==="?"){l=o;break}}let i=!1,n="";for(let o=0;o<j.length;o++){const f=j[o];if(f===","){o>l?k/=1e3:i=!0;continue}n+=f}const a=n.indexOf("."),s=a===-1?n:n.slice(0,a),t=a===-1?"":n.slice(a+1);let u=0;for(const o of s)o==="0"&&(u+=1);let r=0;for(const o of t)o==="0"&&(r+=1);return{prefix:Y,suffix:G,minInt:u,minDec:r,maxDec:t.length,grouping:i,scale:k,hasNumber:l!==-1,isText:g}}function _(B,Y){const G=new Intl.NumberFormat(Y,{minimumIntegerDigits:Math.max(B.minInt,1),minimumFractionDigits:B.minDec,maximumFractionDigits:Math.max(B.maxDec,B.minDec),useGrouping:B.grouping}),{prefix:j,suffix:k,scale:g,hasNumber:c}=B;return d=>{if(!c)return j+k;const l=g===1?d:d*g;return j+G.format(l)+k}}function Z(B,Y){const j=q(String(B)).map(z),k=j.map(n=>_(n,Y)),g=0,c=j.length>1?1:-1,d=j.length>2?2:-1,l=j.length>3?3:-1,i=n=>{if(n==null||n==="")return"";if(typeof n!="number"||Number.isNaN(n)){const a=Number(n);if(Number.isNaN(a))return l===-1?String(n):(j[l].prefix+j[l].suffix).split("\0").join(String(n));n=a}return n===0&&d!==-1?k[d](0):n<0&&c!==-1?k[c](-n):k[g](n)};return i.spec={mask:B},{format:i,ooxml:X(String(B))}}function X(B){return B.trim()}}),Ue("packages/core/src/format/pattern.js",function(e,U){"use strict";Object.defineProperty(e,"parseNumberPattern",{enumerable:!0,get:function(){return _}});const E=U("packages/core/src/format/mask.js").splitSections;function q(Z){let X="",B="",Y="",G="",j=!1,k=!1,g=!1,c=!1;const d=i=>{g?B+=i:X+=i};for(let i=0;i<Z.length;i++){const n=Z[i];if(n==="\\"){d(Z[i+1]??""),i+=1;continue}if(n==='"'){const a=Z.indexOf('"',i+1);d(a===-1?Z.slice(i+1):Z.slice(i+1,a)),i=a===-1?Z.length:a;continue}if(n==="%"){k=!0;continue}if(n==="0"||n==="#"){g=!0,c?G+=n:Y+=n;continue}if(n===","){c||(j=!0);continue}if(n==="."&&!c){c=!0;continue}d(n)}if(!g)return{hasDigit:!1,prefix:X,suffix:B,minDec:0,maxDec:0,grouping:!1,percent:k};let l=0;for(const i of G)i==="0"&&(l+=1);return{hasDigit:!0,prefix:X,suffix:B,minDec:l,maxDec:G.length,grouping:j,percent:k}}function z(Z,X){const B=X.trim(),Y=Z.trim();return B.startsWith("(")&&B.endsWith(")")&&B.slice(1,-1).trim()===Y?"parentheses":B.endsWith("-")?"suffix":"minus"}function _(Z){if(typeof Z!="string")return null;const X=E(Z);if(X.length===0)return null;const B=q(X[0]);if(!B.hasDigit)return null;const Y={style:B.percent?"percent":"decimal",prefix:B.prefix,suffix:B.suffix,minDecimals:B.minDec,maxDecimals:Math.max(B.maxDec,B.minDec),thousandsSeparator:B.grouping?void 0:!1};if(X.length>1&&(Y.negative=z(X[0],X[1])),X.length>2){const G=q(X[2]);G.hasDigit||(Y.zeroDisplay=G.prefix+G.suffix)}return Y}}),Ue("packages/core/src/format/number.js",function(e,U){"use strict";Object.defineProperty(e,"compileNumber",{enumerable:!0,get:function(){return X}});const E=U("packages/core/src/internal/predicates.js").isNil,z=U("packages/core/src/internal/warn.js").warnOnce,Z=U("packages/core/src/format/pattern.js").parseNumberPattern;function X(B,Y){const G=typeof B=="string"?{pattern:B}:B||{};let j=G;if(typeof G.pattern=="string"){const O=Z(G.pattern);if(O){const{pattern:y,...L}=G;j={...O,...L}}else z(`format:pattern:${G.pattern}`,`invalid number format pattern "${G.pattern}"; the value will use the default number format`)}const k=j.locale||Y||void 0,g=j.style||"decimal",c=typeof j.scale=="number"?j.scale:1,d=j.nullDisplay??"",l=j.zeroDisplay,i=j.prefix||"",n=j.suffix||"",a=j.negative||"minus",s=j.signed===!0,t={style:g,notation:j.notation||"standard"};g==="currency"&&(t.currency=j.currency||"USD",j.currencyDisplay&&(t.currencyDisplay=j.currencyDisplay)),typeof j.decimals=="number"?(t.minimumFractionDigits=j.decimals,t.maximumFractionDigits=j.decimals):(typeof j.minDecimals=="number"&&(t.minimumFractionDigits=j.minDecimals),typeof j.maxDecimals=="number"&&(t.maximumFractionDigits=j.maxDecimals),t.minimumFractionDigits>(t.maximumFractionDigits??20)&&(t.maximumFractionDigits=t.minimumFractionDigits)),j.thousandsSeparator===!1&&(t.useGrouping=!1),t.notation==="compact"&&(t.compactDisplay=j.compactDisplay||"short");const u=new Intl.NumberFormat(k,t),r=typeof j.thousandsSeparator=="string"?j.thousandsSeparator:null,o=typeof j.decimalSeparator=="string"?j.decimalSeparator:null;let f=",",w=".";if(r||o)for(const O of u.formatToParts(12345.6))O.type==="group"?f=O.value:O.type==="decimal"&&(w=O.value);const m=O=>{let y=O;return r&&(y=y.split(f).join("")),o&&(y=y.split(w).join("")),r&&(y=y.split("").join(r)),o&&(y=y.split("").join(o)),y},v=!!(r||o),h=i!==""&&g==="currency",p=O=>{let y;if(h){const L=u.formatToParts(O);let M=!1;y="";for(const D of L)y+=D.value,!M&&D.type==="currency"&&(y+=i,M=!0);M||(y=i+y)}else y=i+u.format(O);return v&&(y=m(y)),y+n},b=O=>{if(E(O)||O==="")return d;const y=typeof O=="number"?O:Number(O);if(Number.isNaN(y))return d;const L=c===1?y:y*c;return L===0&&l!==void 0?l:L<0?a==="parentheses"?`(${p(-L)})`:a==="suffix"?`${p(-L)}-`:p(L):s&&L>0?`+${p(L)}`:p(L)};return b.negativeClass=j.negativeClass||null,b.spec=j,b}}),Ue("packages/core/src/format/date.js",function(e,U){"use strict";Object.defineProperty(e,"scanPattern",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"toDate",{enumerable:!0,get:function(){return B}}),Object.defineProperty(e,"compilePattern",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"compileDate",{enumerable:!0,get:function(){return g}}),Object.defineProperty(e,"toIsoDate",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"toIsoDateTime",{enumerable:!0,get:function(){return d}}),Object.defineProperty(e,"compareIso",{enumerable:!0,get:function(){return n}});const E=U("packages/core/src/internal/predicates.js").isNil,z=U("packages/core/src/internal/warn.js").warnOnce,_=["yyyy","yy","MMMM","MMM","MM","M","dd","d","EEEE","EEE","HH","H","hh","h","mm","m","ss","s","SSS","a"];function Z(a){const s=[];let t=0,u="";const r=()=>{u&&(s.push({token:null,text:u}),u="")};for(;t<a.length;){const o=a[t];if(o==="'"){if(a[t+1]==="'"){u+="'",t+=2;continue}const w=a.indexOf("'",t+1);if(w===-1){u+=a.slice(t+1),t=a.length;continue}u+=a.slice(t+1,w),t=w+1;continue}const f=_.find(w=>a.startsWith(w,t));if(f){r(),s.push({token:f,text:f}),t+=f.length;continue}/[A-Za-z]/.test(o)&&z(`date.pattern.token:${o}`,`the date pattern "${a}" contains '${o}', which is not a supported token, so it is rendered as text. Quote it as a literal to silence this. Supported: ${_.join(" ")}.`),u+=o,t+=1}return r(),s}const X=/^(\d{4})-(\d{2})-(\d{2})(?:[T ](\d{2}):(\d{2})(?::(\d{2}))?(?:\.\d+)?)?$/;function B(a){if(E(a)||a==="")return null;if(a instanceof Date)return Number.isNaN(a.getTime())?null:a;if(typeof a=="number")return Number.isNaN(a)?null:new Date(a);if(typeof a=="string"){const s=X.exec(a.trim());if(s){const[,u,r,o,f="0",w="0",m="0"]=s;return new Date(+u,+r-1,+o,+f,+w,+m)}const t=new Date(a);return Number.isNaN(t.getTime())?null:t}return null}function Y(a,s){return String(a).padStart(s,"0")}function G(a){if(!a)return u=>({year:u.getFullYear(),month:u.getMonth()+1,day:u.getDate(),hour:u.getHours(),minute:u.getMinutes(),second:u.getSeconds(),ms:u.getMilliseconds(),weekday:u.getDay()});const s=new Intl.DateTimeFormat("en-US",{timeZone:a,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1,weekday:"short"}),t={Sun:0,Mon:1,Tue:2,Wed:3,Thu:4,Fri:5,Sat:6};return u=>{const r={year:0,month:1,day:1,hour:0,minute:0,second:0,ms:u.getMilliseconds(),weekday:0};for(const o of s.formatToParts(u))switch(o.type){case"year":r.year=Number(o.value);break;case"month":r.month=Number(o.value);break;case"day":r.day=Number(o.value);break;case"hour":r.hour=Number(o.value)%24;break;case"minute":r.minute=Number(o.value);break;case"second":r.second=Number(o.value);break;case"weekday":r.weekday=t[o.value]??0;break;default:break}return r}}function j(a,s,t){const u=Z(a),r=G(t),o=new Set(u.filter(h=>h.token).map(h=>h.token)),f=o.has("MMM")?new Intl.DateTimeFormat(s,{month:"short",timeZone:t}):null,w=o.has("MMMM")?new Intl.DateTimeFormat(s,{month:"long",timeZone:t}):null,m=o.has("EEE")?new Intl.DateTimeFormat(s,{weekday:"short",timeZone:t}):null,v=o.has("EEEE")?new Intl.DateTimeFormat(s,{weekday:"long",timeZone:t}):null;return h=>{const p=r(h);let b="";for(const O of u){if(!O.token){b+=O.text;continue}switch(O.token){case"yyyy":b+=Y(p.year,4);break;case"yy":b+=Y(p.year%100,2);break;case"MMMM":b+=w.format(h);break;case"MMM":b+=f.format(h);break;case"MM":b+=Y(p.month,2);break;case"M":b+=String(p.month);break;case"dd":b+=Y(p.day,2);break;case"d":b+=String(p.day);break;case"EEEE":b+=v.format(h);break;case"EEE":b+=m.format(h);break;case"HH":b+=Y(p.hour,2);break;case"H":b+=String(p.hour);break;case"hh":b+=Y(p.hour%12===0?12:p.hour%12,2);break;case"h":b+=String(p.hour%12===0?12:p.hour%12);break;case"mm":b+=Y(p.minute,2);break;case"m":b+=String(p.minute);break;case"ss":b+=Y(p.second,2);break;case"s":b+=String(p.second);break;case"SSS":b+=Y(p.ms,3);break;case"a":b+=p.hour<12?"AM":"PM";break;default:b+=O.text;break}}return b}}const k=[["year",365*24*36e5],["month",720*36e5],["week",168*36e5],["day",24*36e5],["hour",36e5],["minute",6e4],["second",1e3]];function g(a,s){const t=a||{},u=t.locale||s||void 0,r=t.nullDisplay??"",o=t.timeZone;let f;if(t.pattern)f=j(t.pattern,u,o);else if(t.dateStyle||t.timeStyle){const p={timeZone:o};t.dateStyle&&(p.dateStyle=t.dateStyle),t.timeStyle&&(p.timeStyle=t.timeStyle);const b=new Intl.DateTimeFormat(u,p);f=O=>b.format(O)}else{const p=new Intl.DateTimeFormat(u,{dateStyle:"medium",timeZone:o});f=b=>p.format(b)}const w=t.relative?new Intl.RelativeTimeFormat(u,{numeric:"auto"}):null,v=(typeof t.relative=="object"&&t.relative?t.relative.threshold??7:7)*24*36e5,h=(p,b)=>{const O=B(p);if(!O)return r;if(w){const y=b&&typeof b.now=="number"?b.now:Date.now(),L=O.getTime()-y;if(Math.abs(L)<v){for(const[M,D]of k)if(Math.abs(L)>=D||M==="second")return w.format(Math.round(L/D),M)}}return f(O)};return h.spec=t,h}function c(a){if(E(a)||a==="")return null;if(typeof a=="string"){const u=/^(\d{4}-\d{2}-\d{2})/.exec(a.trim());if(u)return u[1];const r=B(a);return r?c(r):null}const s=B(a);if(!s)return null;const t=u=>String(u).padStart(2,"0");return`${s.getFullYear()}-${t(s.getMonth()+1)}-${t(s.getDate())}`}function d(a,s){if(E(a)||a==="")return null;if(typeof a=="string"){const u=a.trim();if(l.test(u)){const f=B(u);return f?i(f,s):null}const r=/^(\d{4}-\d{2}-\d{2})[T ](\d{2}):(\d{2})(?::(\d{2}))?/.exec(u);if(r){const[,f,w,m,v]=r;return`${f}T${w}:${m}${v&&v!=="00"?`:${v}`:""}`}if(/^\d{4}-\d{2}-\d{2}$/.test(u))return`${u}T00:00`;const o=B(u);return o?d(o):null}const t=B(a);return t?i(t,s):null}const l=/(?:Z|[+-]\d{2}:?\d{2})$/i;function i(a,s){const t=f=>String(f).padStart(2,"0");if(s)try{const f=new Intl.DateTimeFormat("en-CA",{timeZone:s,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1}).formatToParts(a).reduce((v,h)=>(h.type!=="literal"&&(v[h.type]=h.value),v),{}),w=f.hour==="24"?"00":f.hour,m=Number(f.second);return`${f.year}-${f.month}-${f.day}T${w}:${f.minute}`+(m?`:${f.second}`:"")}catch{}const u=`${a.getFullYear()}-${t(a.getMonth()+1)}-${t(a.getDate())}`,r=a.getSeconds(),o=`${t(a.getHours())}:${t(a.getMinutes())}${r?`:${t(r)}`:""}`;return`${u}T${o}`}function n(a,s){const t=E(a)||a===""?null:String(a),u=E(s)||s===""?null:String(s);return t===null?u===null?0:1:u===null||t<u?-1:t>u?1:0}}),Ue("packages/core/src/format/boolean.js",function(e,U){"use strict";Object.defineProperty(e,"toTriState",{enumerable:!0,get:function(){return _}}),Object.defineProperty(e,"compileBoolean",{enumerable:!0,get:function(){return Z}});const E=U("packages/core/src/internal/predicates.js").isNil,q={true:"☑",false:"☐",null:""},z={true:"◉",false:"◯",null:""};function _(X){if(E(X)||X==="")return null;if(typeof X=="boolean")return X;if(typeof X=="number")return X!==0;const B=String(X).trim().toLowerCase();return B==="true"||B==="yes"||B==="y"||B==="1"?!0:B==="false"||B==="no"||B==="n"||B==="0"?!1:null}function Z(X,B){const Y=X||{},G=Y.display||"text",j=Y.trueLabel??"Yes",k=Y.falseLabel??"No",g=Y.nullLabel??"";let c=j,d=k;const l=g;G==="checkbox"?(c=q.true,d=q.false):G==="switch"?(c=z.true,d=z.false):G==="icon"&&(c=Y.trueIcon??j,d=Y.falseIcon??k);const i=n=>{const a=_(n);return a===null?l:a?c:d};return i.display=G,i.labels={true:j,false:k,null:g},i.locale=B,i.spec=Y,i}}),Ue("packages/core/src/format/text.js",function(e,U){"use strict";Object.defineProperty(e,"compileText",{enumerable:!0,get:function(){return _}});const E=U("packages/core/src/internal/predicates.js").isNil,z=U("packages/core/src/internal/text.js").titleCase;function _(Z,X){const B=Z||{},Y=B.locale||X||void 0,G=B.nullDisplay??"",j=B.emptyDisplay??"",k=B.transform||"none",g=typeof B.truncate=="number"?{chars:B.truncate}:B.truncate||null,c=g?g.chars:0,d=g?g.ellipsis??"…":"",l=n=>{switch(k){case"upper":return Y?n.toLocaleUpperCase(Y):n.toUpperCase();case"lower":return Y?n.toLocaleLowerCase(Y):n.toLowerCase();case"title":return z(n);default:return n}},i=n=>{if(E(n))return G;let a=typeof n=="string"?n:String(n);return a===""?j:(k!=="none"&&(a=l(a)),c>0&&a.length>c&&(a=a.slice(0,c)+d),a)};return i.spec=B,i}}),Ue("packages/core/src/format/shorthand.js",function(e,U){"use strict";Object.defineProperty(e,"looksLikeMask",{enumerable:!0,get:function(){return z}}),Object.defineProperty(e,"looksLikeDatePattern",{enumerable:!0,get:function(){return _}}),Object.defineProperty(e,"parseShorthand",{enumerable:!0,get:function(){return X}});const te=["currency","number","percent","date","boolean","text","relative"],E=/[#0?@;"\\]/,q=/(yyyy|yy|MMMM|MMM|MM|EEEE|EEE|dd|HH|hh|mm|ss|SSS)/;function z(B){return typeof B!="string"||B===""||Z(B)?!1:E.test(B)}function _(B){return typeof B!="string"||B===""||Z(B)?!1:q.test(B)}function Z(B){const Y=B.indexOf(":"),G=Y===-1?B:B.slice(0,Y);return te.includes(G)?G:null}function X(B){const Y=Z(B);if(!Y)return null;const G=B.indexOf(":"),j=G===-1?"":B.slice(G+1),k=j===""?[]:j.split(":");switch(Y){case"currency":{const g={type:"number",style:"currency",currency:k[0]||"USD"};return k[1]!==void 0&&k[1]!==""&&(g.decimals=Number(k[1])),g}case"number":{const g={type:"number",style:"decimal"};return k[0]!==void 0&&k[0]!==""&&(g.decimals=Number(k[0])),g}case"percent":{const g={type:"number",style:"percent"};return k[0]!==void 0&&k[0]!==""&&(g.decimals=Number(k[0])),g}case"date":return{type:"date",pattern:j||void 0};case"relative":return{type:"date",relative:!0};case"boolean":{const g=j.split("/"),c={type:"boolean",display:"text"};return g[0]!==void 0&&g[0]!==""&&(c.trueLabel=g[0]),g[1]!==void 0&&g[1]!==""&&(c.falseLabel=g[1]),g[2]!==void 0&&(c.nullLabel=g[2]),c}case"text":{const g={type:"text"};return k[0]&&(g.transform=k[0]),k[1]!==void 0&&k[1]!==""&&(g.truncate=Number(k[1])),g}default:return null}}}),Ue("packages/core/src/format/index.js",function(e,U){"use strict";Object.defineProperty(e,"compileFormat",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"specToOoxml",{enumerable:!0,get:function(){return y}});const te=U("packages/core/src/internal/predicates.js"),E=te.isFunction,q=te.isObject,_=U("packages/core/src/internal/warn.js").warnOnce,Z=U("packages/core/src/format/number.js"),X=Z.compileNumber,B=U("packages/core/src/format/date.js"),Y=B.compileDate,G=B.scanPattern,j=U("packages/core/src/format/boolean.js"),k=j.compileBoolean,g=U("packages/core/src/format/text.js"),c=g.compileText,d=U("packages/core/src/format/mask.js"),l=d.compileMask,i=U("packages/core/src/format/shorthand.js"),n=i.parseShorthand,a=i.looksLikeMask,s=i.looksLikeDatePattern,u=U("packages/core/src/format/pattern.js").parseNumberPattern;Object.defineProperty(e,"compileNumber",{enumerable:!0,get:function(){return Z.compileNumber}}),Object.defineProperty(e,"compileDate",{enumerable:!0,get:function(){return B.compileDate}}),Object.defineProperty(e,"compilePattern",{enumerable:!0,get:function(){return B.compilePattern}}),Object.defineProperty(e,"scanPattern",{enumerable:!0,get:function(){return B.scanPattern}}),Object.defineProperty(e,"toDate",{enumerable:!0,get:function(){return B.toDate}}),Object.defineProperty(e,"compileBoolean",{enumerable:!0,get:function(){return j.compileBoolean}}),Object.defineProperty(e,"toTriState",{enumerable:!0,get:function(){return j.toTriState}}),Object.defineProperty(e,"compileText",{enumerable:!0,get:function(){return g.compileText}}),Object.defineProperty(e,"compileMask",{enumerable:!0,get:function(){return d.compileMask}}),Object.defineProperty(e,"splitSections",{enumerable:!0,get:function(){return d.splitSections}}),Object.defineProperty(e,"parseSection",{enumerable:!0,get:function(){return d.parseSection}}),Object.defineProperty(e,"parseShorthand",{enumerable:!0,get:function(){return i.parseShorthand}}),Object.defineProperty(e,"looksLikeMask",{enumerable:!0,get:function(){return i.looksLikeMask}}),Object.defineProperty(e,"looksLikeDatePattern",{enumerable:!0,get:function(){return i.looksLikeDatePattern}});const r=new Set(["decimal","currency","percent","unit"]),o=new Set(["type","locale"]),f={number:new Set(["style","currency","currencyDisplay","decimals","minDecimals","maxDecimals","thousandsSeparator","decimalSeparator","notation","compactDisplay","negative","negativeClass","signed","prefix","suffix","zeroDisplay","nullDisplay","messages","scale","pattern"]),date:new Set(["pattern","dateStyle","timeStyle","timeZone","relative","nullDisplay"]),boolean:new Set(["display","trueLabel","falseLabel","nullLabel","trueIcon","falseIcon"]),text:new Set(["transform","truncate","nullDisplay","emptyDisplay"])},w=new Set(["number","date","boolean","text"]);function m(F,T){const I=F.type;if(I===void 0||w.has(I)||!r.has(String(I)))return;const P=T?`"${T}"`:"with no id";_(`format:unknown-style-key:${T||""}:${I}`,`column ${P} has format: { type: "${I}" }, which is not a valid format type ("number", "date", "boolean" or "text") and is ignored; did you mean style: "${I}" instead?`)}function v(F,T,I){const P=f[T],R=I?`"${I}"`:"with no id";for(const $ of F){if(o.has($)||P.has($))continue;const C=Object.keys(f).find(A=>A!==T&&f[A].has($));C?_(`format:inapplicable:${I||""}:${$}`,`column ${R} has format key "${$}", which applies to a ${C} column, not the ${T} column it was applied to; it is ignored.`):_(`format:unknown:${I||""}:${$}`,`column ${R} has an unrecognised format key "${$}" for its ${T} format; it is ignored.`)}}function h(F){if(F.type==="number"||F.type==="date"||F.type==="boolean"||F.type==="text")return!0;const T=r.has(String(F.style));return!!(F.pattern||F.dateStyle||F.timeStyle||F.relative||F.timeZone||F.trueLabel||F.falseLabel||F.display||F.trueIcon||F.falseIcon||F.transform||F.truncate||F.emptyDisplay||T||F.currency||F.decimals!==void 0||F.minDecimals!==void 0||F.maxDecimals!==void 0||F.notation||F.negative||F.scale!==void 0||F.prefix||F.suffix||F.zeroDisplay!==void 0)}function p(F,T){if(F.type==="number"||F.type==="date"||F.type==="boolean"||F.type==="text")return F.type;if(F.pattern){if(a(F.pattern))return"number";if(s(F.pattern))return"date"}if(F.dateStyle||F.timeStyle||F.relative||F.timeZone)return"date";if(F.trueLabel||F.falseLabel||F.display||F.trueIcon||F.falseIcon)return"boolean";if(F.transform||F.truncate||F.emptyDisplay)return"text";if(F.style||F.currency||F.decimals!==void 0||F.minDecimals!==void 0||F.maxDecimals!==void 0||F.notation||F.negative||F.scale!==void 0||F.prefix||F.suffix||F.zeroDisplay!==void 0)return"number";const I=T&&T.base;return I==="number"?"number":I==="date"||I==="dateString"?"date":I==="boolean"?"boolean":"text"}function b(F,T=null,I=void 0,P=void 0,R=void 0){if(F==null||F==="")return null;const $=q(F)?Object.keys(F):null;if(typeof F=="function"){const S=(x,H)=>String(F({...H||{},value:x,locale:I})??"");return S.ooxml=T&&T.excel||"General",S}if(typeof F=="string"){if(a(F)){const{format:x,ooxml:H}=l(F,I);return x.ooxml=H,x}const S=n(F)||(s(F)?{type:"date",pattern:F}:null);return S?b(S,T,I,P,R):(_(`format:${F}`,`unrecognised format string "${F}"; the value will be stringified`),null)}if(!q(F))return _("format:shape","format must be a spec object or a string; ignoring",F),null;if(T&&E(T.format)&&!h(F)||T&&E(T.format)&&Array.isArray(T.formatPatterns)&&F.type===void 0)return null;const C=p(F,T);C==="date"&&P&&F.timeZone===void 0&&(F={...F,timeZone:P}),m(F,R),v($||Object.keys(F),C,R);let A;switch(C){case"number":A=X(F,I);break;case"date":A=Y(F,I);break;case"boolean":A=k(F,I);break;default:A=c(F,I);break}return A.ooxml=y(F,C,I,T),A.kind=C,A}const O={yyyy:"yyyy",yy:"yy",MMMM:"mmmm",MMM:"mmm",MM:"mm",M:"m",dd:"dd",d:"d",EEEE:"dddd",EEE:"ddd",HH:"hh",H:"h",hh:"hh",h:"h",mm:"mm",m:"m",ss:"ss",s:"s",SSS:"000",a:"AM/PM"};function y(F,T,I=void 0,P=null){if(T==="date"){if(F.pattern){let S="";for(const x of G(F.pattern))S+=x.token?O[x.token]??x.text:x.text;return S}return P&&P.excel||"yyyy-mm-dd"}if(T==="boolean")return"General";if(T==="text")return"@";if(typeof F.pattern=="string"&&u(F.pattern))return String(F.pattern).trim();if(F.notation==="compact"||F.notation==="scientific")return"General";const R=typeof F.decimals=="number"?F.decimals:typeof F.minDecimals=="number"?F.minDecimals:F.style==="currency"?2:0;let C=`${F.thousandsSeparator===!1?"":"#,#"}#0${R>0?`.${"0".repeat(R)}`:""}`,A="";return F.style==="currency"&&(A+=L(D(F.currency||"USD",I))),F.prefix&&(A+=L(F.prefix)),C=A+C,F.style==="percent"&&(C=`${C}%`),F.suffix&&(C+=L(F.suffix)),F.negative==="parentheses"?`${C};(${C})`:F.negative==="suffix"?`${C};${C}-`:C}function L(F){return`"${String(F).split('"').join("")}"`}const M=new Map;function D(F,T){const I=`${F}|${T||""}`;let P=M.get(I);if(P!==void 0)return P;P=F;try{const $=new Intl.NumberFormat(T,{style:"currency",currency:F}).formatToParts(0).find(C=>C.type==="currency");$&&(P=$.value)}catch{}return M.set(I,P),P}}),Ue("packages/core/src/columns/types/temporal.js",function(e,U){"use strict";Object.defineProperty(e,"MS_SECOND",{enumerable:!0,get:function(){return k}}),Object.defineProperty(e,"MS_MINUTE",{enumerable:!0,get:function(){return g}}),Object.defineProperty(e,"MS_HOUR",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"MS_DAY",{enumerable:!0,get:function(){return d}}),Object.defineProperty(e,"MS_WEEK",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"parseTime",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"toTimeMs",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"formatTime",{enumerable:!0,get:function(){return v}}),Object.defineProperty(e,"zonedParts",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"zoneOffsetAt",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"instantFromParts",{enumerable:!0,get:function(){return M}}),Object.defineProperty(e,"parseDateTime",{enumerable:!0,get:function(){return T}}),Object.defineProperty(e,"toEpochMs",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"formatDateTime",{enumerable:!0,get:function(){return $}}),Object.defineProperty(e,"parseDuration",{enumerable:!0,get:function(){return re}}),Object.defineProperty(e,"toDurationMs",{enumerable:!0,get:function(){return ae}}),Object.defineProperty(e,"formatDuration",{enumerable:!0,get:function(){return pe}}),Object.defineProperty(e,"zoneAbbrev",{enumerable:!0,get:function(){return ie}}),Object.defineProperty(e,"resolveZoneName",{enumerable:!0,get:function(){return Oe}}),Object.defineProperty(e,"zoneLabel",{enumerable:!0,get:function(){return je}}),Object.defineProperty(e,"formatInstant",{enumerable:!0,get:function(){return fe}}),Object.defineProperty(e,"bucketInstant",{enumerable:!0,get:function(){return Ee}}),Object.defineProperty(e,"timestampGroupProjector",{enumerable:!0,get:function(){return le}}),Object.defineProperty(e,"TEMPORAL_TYPES",{enumerable:!0,get:function(){return de}}),Object.defineProperty(e,"TEMPORAL_INFERENCE_ORDER",{enumerable:!0,get:function(){return Se}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return Fe}});const te=U("packages/core/src/internal/predicates.js"),E=te.isNil,q=te.isFunction,z=U("packages/core/src/format/date.js"),_=z.toDate,Z=z.compilePattern,X=z.compileDate,B=z.toIsoDateTime,Y=z.compareIso,G=864e5,j=Object.freeze({}),k=1e3,g=60*k,c=60*g,d=24*c,l=7*d,i=new WeakMap;function n(ke,Ie){const Be=ke&&ke.locale||"",Ke=ke&&ke.column;if(!Ke)return Be?{locale:Be}:j;const rt=i.get(Ke);if(rt&&rt.locale===Be)return rt.bag;const tt=Ke.typeOptions||Ke[Ie]||(a(Ke.format)?Ke.format:null),pt={...tt||j,locale:tt&&tt.locale||Be||void 0};return i.set(Ke,{locale:Be,bag:pt}),pt}function a(ke){return ke!==null&&typeof ke=="object"&&!Array.isArray(ke)&&!(ke instanceof Date)}function s(ke,Ie){const Be=ke===null||Number.isNaN(ke)?null:ke,Ke=Ie===null||Number.isNaN(Ie)?null:Ie;return Be===null?Ke===null?0:1:Ke===null||Be<Ke?-1:Be>Ke?1:0}const t=/^(\d{1,2})(?:\s*[:.h]\s*(\d{1,2})(?:\s*[:.]\s*(\d{1,2})(?:[.,](\d{1,3}))?)?)?\s*(a\.?m\.?|p\.?m\.?|a|p)?$/i,u=/^(\d{3,6})$/;function r(ke,Ie,Be,Ke){return!(ke>=0&&ke<=23)||!(Ie>=0&&Ie<=59)||!(Be>=0&&Be<=59)||!(Ke>=0&&Ke<=999)?null:ke*c+Ie*g+Be*k+Ke}function o(ke){if(E(ke))return null;const Ie=String(ke).trim();if(Ie==="")return null;const Be=u.exec(Ie);if(Be){const Pt=Be[1];if(Pt.length===5)return null;const Ct=Pt.length===3?1:2;return r(Number(Pt.slice(0,Ct)),Number(Pt.slice(Ct,Ct+2)),Number(Pt.slice(Ct+2,Ct+4)||0),0)}const Ke=t.exec(Ie);if(!Ke)return null;let rt=Number(Ke[1]);const tt=Number(Ke[2]||0),pt=Number(Ke[3]||0),yt=Ke[4]?Number(Ke[4].padEnd(3,"0")):0,kt=Ke[5]?Ke[5][0].toLowerCase():null;if(kt){if(rt<1||rt>12)return null;rt=rt%12,kt==="p"&&(rt+=12)}return r(rt,tt,pt,yt)}function f(ke){return E(ke)||ke===""?null:typeof ke=="number"?Number.isFinite(ke)?(ke%d+d)%d:null:ke instanceof Date?Number.isNaN(ke.getTime())?null:ke.getHours()*c+ke.getMinutes()*g+ke.getSeconds()*k+ke.getMilliseconds():o(ke)}const w=new Map;function m(ke){const Ie=ke.pattern||"",Be=ke.timeStyle||(ke.seconds?"medium":"short"),Ke=`${ke.locale||""}|${Ie}|${Be}`;let rt=w.get(Ke);if(rt)return rt;if(Ie)rt=Z(Ie,ke.locale||void 0,"UTC");else{const tt=new Intl.DateTimeFormat(ke.locale||void 0,{timeStyle:Be,timeZone:"UTC"});rt=pt=>tt.format(pt)}return w.set(Ke,rt),rt}function v(ke,Ie){const Be=Ie||j;if(ke==null||typeof ke!="number"||!Number.isFinite(ke))return Be.nullDisplay??"";const Ke=(ke%d+d)%d;return m(Be)(new Date(Ke))}function h(ke){return ke instanceof Date?!Number.isNaN(ke.getTime()):typeof ke=="number"?Number.isFinite(ke)&&ke>=0&&ke<d:typeof ke!="string"||!ke.includes(":")?!1:o(ke)!==null}function p(ke){const Ie=f(ke);return Ie==null?"":v(Ie,{pattern:Ie%k===0?"HH:mm:ss":"HH:mm:ss.SSS"})}const b=new Map;function O(ke){const Ie=ke||"";let Be=b.get(Ie);return Be||(Be=new Intl.DateTimeFormat("en-GB",{timeZone:ke||void 0,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1}),b.set(Ie,Be)),Be}function y(ke,Ie){const Be={year:1970,month:1,day:1,hour:0,minute:0,second:0};for(const Ke of O(Ie).formatToParts(new Date(ke)))Ke.type==="year"?Be.year=Number(Ke.value):Ke.type==="month"?Be.month=Number(Ke.value):Ke.type==="day"?Be.day=Number(Ke.value):Ke.type==="hour"?Be.hour=Number(Ke.value)%24:Ke.type==="minute"?Be.minute=Number(Ke.value):Ke.type==="second"&&(Be.second=Number(Ke.value));return Be}function L(ke,Ie){const Be=y(ke,Ie);return Date.UTC(Be.year,Be.month-1,Be.day,Be.hour,Be.minute,Be.second,0)-Math.floor(ke/1e3)*1e3}function M(ke,Ie){const Be=ke.hour||0,Ke=ke.minute||0,rt=ke.second||0,tt=ke.ms||0;if(!Ie)return new Date(ke.year,ke.month-1,ke.day,Be,Ke,rt,tt).getTime();const pt=Date.UTC(ke.year,ke.month-1,ke.day,Be,Ke,rt,tt);let yt=pt-L(pt,Ie);return yt=pt-L(yt,Ie),yt}const D=/(?:Z|[+-]\d{2}:?\d{2})$/i,F=/^(\d{4})-(\d{1,2})-(\d{1,2})(?:[T\s]+(.*))?$/;function T(ke,Ie){if(E(ke))return null;const Be=String(ke).trim();if(Be==="")return null;const Ke=Ie&&Ie.timeZone||void 0;if(!D.test(Be)){const rt=F.exec(Be);if(rt){const tt=(rt[4]||"").trim(),pt=tt===""?0:o(tt);if(pt===null)return null;const yt=M({year:Number(rt[1]),month:Number(rt[2]),day:Number(rt[3]),hour:Math.floor(pt/c),minute:Math.floor(pt/g)%60,second:Math.floor(pt/k)%60,ms:pt%k},Ke);return Number.isNaN(yt)?null:new Date(yt)}}return _(Be)}function I(ke){if(typeof ke=="number")return Number.isFinite(ke)?ke:null;const Ie=_(ke);return Ie?Ie.getTime():null}const P=new Map;function R(ke){const Ie=[ke.locale||"",ke.pattern||"",ke.dateStyle||"",ke.timeStyle||"",ke.timeZone||"",ke.seconds?"1":""].join("|");let Be=P.get(Ie);if(Be)return Be;const Ke=ke.pattern?{type:"date",pattern:ke.pattern,timeZone:ke.timeZone}:{type:"date",dateStyle:ke.dateStyle||"medium",timeStyle:ke.timeStyle||(ke.seconds?"medium":"short"),timeZone:ke.timeZone};return Be=X(Ke,ke.locale||void 0),P.set(Ie,Be),Be}function $(ke,Ie){const Be=Ie||j,Ke=I(ke);return Ke==null?Be.nullDisplay??"":R(Be)(Ke)}function C(ke){return ke instanceof Date?!Number.isNaN(ke.getTime()):typeof ke!="string"||!F.test(ke.trim())?!1:T(ke)!==null}const A=Object.freeze([{key:"w",ms:l,intl:"week",long:["week","weeks"],names:["w","wk","wks","week","weeks"]},{key:"d",ms:d,intl:"day",long:["day","days"],names:["d","dy","day","days"]},{key:"h",ms:c,intl:"hour",long:["hour","hours"],names:["h","hr","hrs","hour","hours"]},{key:"m",ms:g,intl:"minute",long:["minute","minutes"],names:["m","min","mins","minute","minutes"]},{key:"s",ms:k,intl:"second",long:["second","seconds"],names:["s","sec","secs","second","seconds"]},{key:"ms",ms:1,intl:"millisecond",long:["millisecond","milliseconds"],names:["ms","msec","msecs","milli","millis","millisecond","milliseconds"]}]),S=new Map;for(const ke of A)for(const Ie of ke.names)S.set(Ie,ke);const x=Object.freeze(A.filter(ke=>ke.key!=="w")),H=/^(\d+(?:\.\d+)?)\s*([a-z]+)\s*(?:,\s*)?/,V=/^\d+(?:\.\d+)?$/,W=/^(\d+):([0-5]?\d)(?::([0-5]?\d))?(?:\.(\d{1,3}))?$/;function Q(ke){const Ie=ke&&ke.defaultUnit?S.get(String(ke.defaultUnit).toLowerCase()):null;return Ie?Ie.ms:g}function ee(ke){return(ke&&ke.defaultUnit?S.get(String(ke.defaultUnit).toLowerCase()):null)||S.get("m")}function re(ke,Ie){if(E(ke))return null;let Be=String(ke).trim().toLowerCase();if(Be==="")return null;let Ke=1;if(Be[0]==="-"?(Ke=-1,Be=Be.slice(1).trim()):Be[0]==="+"&&(Be=Be.slice(1).trim()),Be==="")return null;const rt=W.exec(Be);if(rt){const kt=rt[3]!==void 0,Pt=Number(rt[1])*c+Number(rt[2])*g+(kt?Number(rt[3])*k:0)+(rt[4]?Number(rt[4].padEnd(3,"0")):0);return Ke*Pt}if(V.test(Be))return Math.round(Ke*Number(Be)*Q(Ie||j));let tt=Be,pt=0,yt=0;for(;tt!=="";){const kt=H.exec(tt);if(!kt)return null;const Pt=S.get(kt[2]);if(!Pt)return null;pt+=Number(kt[1])*Pt.ms,tt=tt.slice(kt[0].length),yt++}return yt===0?null:Math.round(Ke*pt)}function ae(ke){return E(ke)||ke===""?null:typeof ke=="number"?Number.isFinite(ke)?ke:null:re(ke)}const ue=new Map;function ge(ke,Ie,Be){const Ke=`${Be||""}|${Ie.intl}`;let rt=ue.get(Ke);if(rt===void 0){try{rt=new Intl.NumberFormat(Be||void 0,{style:"unit",unit:Ie.intl,unitDisplay:"long"})}catch{rt=null}ue.set(Ke,rt)}return rt?rt.format(ke):`${ke} ${ke===1?Ie.long[0]:Ie.long[1]}`}function Ae(ke,Ie){return String(ke).padStart(Ie,"0")}function pe(ke,Ie){const Be=Ie||j;if(ke==null||typeof ke!="number"||!Number.isFinite(ke))return Be.nullDisplay??"";const Ke=Be.style||"short",rt=ke<0;let tt=Math.round(Math.abs(ke));const pt=rt?"-":"";if(tt===0&&Be.zeroDisplay!=null)return Be.zeroDisplay;if(Ke==="clock"){const Ct=Math.floor(tt/c),Lt=Math.floor(tt/g)%60,Rt=Math.floor(tt/k)%60;return`${pt}${Ae(Ct,2)}:${Ae(Lt,2)}:${Ae(Rt,2)}`}if(tt===0){const Ct=ee(Be);return Ke==="long"?ge(0,Ct,Be.locale):`0${Ct.key}`}const yt=Be.weeks===!0?A:x,kt=typeof Be.maxUnits=="number"&&Be.maxUnits>0?Be.maxUnits:Be.maxUnits===void 0?2:1/0,Pt=[];for(const Ct of yt){if(Pt.length>=kt)break;const Lt=Math.floor(tt/Ct.ms);Lt!==0&&(tt-=Lt*Ct.ms,Pt.push(Ke==="long"?ge(Lt,Ct,Be.locale):`${Lt}${Ct.key}`))}return pt+Pt.join(" ")}function Me(ke){if(typeof ke!="string")return!1;const Ie=ke.trim();return Ie===""||W.test(Ie)||!/[a-z]/i.test(Ie)?!1:re(Ie)!==null}const Ne=Date.UTC(1899,11,30),Pe=new Map;function ie(ke,Ie){const Be=ke||"";let Ke=Pe.get(Be);Ke||(Ke=new Intl.DateTimeFormat("en-GB",{timeZone:ke||void 0,timeZoneName:"short",hour:"2-digit",hour12:!1}),Pe.set(Be,Ke));const rt=typeof Ie=="number"?Ie:Date.now();for(const tt of Ke.formatToParts(new Date(rt)))if(tt.type==="timeZoneName")return tt.value;return""}function Oe(ke){if(ke)return ke;try{return new Intl.DateTimeFormat().resolvedOptions().timeZone||"UTC"}catch{return"UTC"}}function je(ke,Ie){const Be=Oe(ke),Ke=ie(ke,Ie);return Ke?`${Be} (${Ke})`:Be}function Ce(ke,Ie){if(ke&&ke.timeZone)return ke.timeZone;const Be=Ie&&Ie.grid;return(Be&&q(Be.get)?Be.get("timeZone"):void 0)||void 0}function fe(ke,Ie){const Be=Ie||j,Ke=I(ke);if(Ke==null)return Be.nullDisplay??"";const rt=R(Be)(Ke);if(!Be.showOrigin)return rt;const tt=Be.originZone;return tt?tt===(Be.timeZone||Oe(Be.timeZone))?rt:`${rt} (${je(tt,Ke)})`:`${rt} (no origin recorded)`}function Ee(ke,Ie,Be,Ke){if(Ie==="instant"||!Ie)return ke;const rt=y(ke,Be);if(Ie==="month")return M({year:rt.year,month:rt.month,day:1},Be);if(Ie==="week"){const tt=Ke>=1&&Ke<=7?Ke:1,yt=((new Date(Date.UTC(rt.year,rt.month-1,rt.day)).getUTCDay()+6)%7+1-tt+7)%7,kt=new Date(Date.UTC(rt.year,rt.month-1,rt.day-yt));return M({year:kt.getUTCFullYear(),month:kt.getUTCMonth()+1,day:kt.getUTCDate()},Be)}return M({year:rt.year,month:rt.month,day:rt.day},Be)}function le(ke,Ie){const Be=ke&&ke.group,Ke=Be&&Be.granularity||"day";if(Ke==="instant")return null;const rt=Be&&Be.weekStart;return tt=>typeof tt=="number"?Ee(tt,Ke,Ie,rt):tt}const de={time:{base:"number",storage:"float64",matches:h,format:ke=>v(f(ke.value),n(ke,"time")),parse:ke=>o(ke.text),compare:(ke,Ie)=>s(f(ke),f(Ie)),defaults:{filter:"number",editor:"time",align:"start"},excel:"hh:mm:ss",excelKind:"number",toExcelValue:ke=>{const Ie=f(ke);return Ie===null?null:Ie/G},toStorage:ke=>f(ke),toClipboard:p,fromClipboard:o},datetime:{base:"dateString",storage:"dictionary",matches:C,format:ke=>$(ke.value,n(ke,"datetime")),parse:ke=>B(T(ke.text,n(ke,"datetime"))??ke.text),compare:Y,defaults:{filter:"date",editor:"datetime",align:"start"},excel:"yyyy-mm-dd hh:mm",toStorage:(ke,Ie)=>B(ke,Ie&&Ie.timeZone),toClipboard:ke=>E(ke)?"":String(ke),fromClipboard:ke=>B(ke)},duration:{base:"number",storage:"float64",matches:Me,format:ke=>pe(ae(ke.value),n(ke,"duration")),parse:ke=>re(ke.text,n(ke,"duration")),compare:(ke,Ie)=>s(ae(ke),ae(Ie)),defaults:{filter:"number",editor:"duration",align:"end",total:"sum"},excel:"[h]:mm:ss",excelKind:"number",toExcelValue:ke=>{const Ie=ae(ke);return Ie===null?null:Ie/G},toStorage:ke=>ae(ke),toClipboard:ke=>pe(ae(ke),{style:"short",maxUnits:-1}),fromClipboard:ke=>re(ke)},timestamp:{base:"number",storage:"float64",format:ke=>{const Ie=n(ke,"timestamp");return fe(ke.value,{...Ie,timeZone:Ce(Ie,ke)})},parse:ke=>{const Ie=n(ke,"timestamp"),Be=T(ke.text,{timeZone:Ce(Ie,ke)});return Be?Be.getTime():null},compare:(ke,Ie)=>s(I(ke),I(Ie)),groupProjector:(ke,Ie)=>le(ke,Ie),defaults:{filter:"date",editor:"datetime",align:"start"},excel:"yyyy-mm-dd hh:mm",excelKind:"number",toExcelValue:(ke,Ie)=>{const Be=I(ke);if(Be==null)return null;const Ke=y(Be,Ie&&Ie.timeZone||void 0);return(Date.UTC(Ke.year,Ke.month-1,Ke.day,Ke.hour,Ke.minute,Ke.second)-Ne)/G},toStorage:ke=>I(ke),toClipboard:ke=>{const Ie=I(ke);return Ie==null?"":new Date(Ie).toISOString()},fromClipboard:ke=>I(ke)}},Se=["datetime","time","duration"],Fe=de}),Ue("packages/core/src/internal/lru.js",function(e,U){"use strict";Object.defineProperty(e,"Lru",{enumerable:!0,get:function(){return te}});class te{#e;#t=new Map;#n;constructor(q=256,z=null){this.#e=q,this.#n=z}get size(){return this.#t.size}get max(){return this.#e}set max(q){this.#e=q,this.#r()}has(q){return this.#t.has(q)}get(q){const z=this.#t;if(!z.has(q))return;const _=z.get(q);return z.delete(q),z.set(q,_),_}peek(q){return this.#t.get(q)}set(q,z){const _=this.#t;return _.has(q)&&_.delete(q),_.set(q,z),this.#r(),z}delete(q){const z=this.#t.get(q);return this.#t.delete(q)&&this.#n&&this.#n(z,q),z}clear(){if(this.#n)for(const[q,z]of this.#t)this.#n(z,q);this.#t.clear()}keys(){return this.#t.keys()}values(){return this.#t.values()}#r(){const q=this.#t;for(;q.size>this.#e;){const z=q.keys().next().value,_=q.get(z);q.delete(z),this.#n&&this.#n(_,z)}}}}),Ue("packages/core/src/columns/types/network.js",function(e,U){"use strict";Object.defineProperty(e,"toUint32",{enumerable:!0,get:function(){return X}}),Object.defineProperty(e,"parseIpv4",{enumerable:!0,get:function(){return B}}),Object.defineProperty(e,"formatIpv4",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(e,"isIpv4",{enumerable:!0,get:function(){return G}}),Object.defineProperty(e,"compareIpv4",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"packCidr",{enumerable:!0,get:function(){return d}}),Object.defineProperty(e,"cidrParts",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"parseCidr",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"formatCidr",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"isCidr",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"compareCidr",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"netmask",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"networkAddress",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"broadcastAddress",{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,"addressCount",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"hostCount",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"containsAddress",{enumerable:!0,get:function(){return w}}),Object.defineProperty(e,"overlaps",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"ipv6Groups",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"parseIpv6",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"formatIpv6",{enumerable:!0,get:function(){return M}}),Object.defineProperty(e,"isIpv6",{enumerable:!0,get:function(){return D}}),Object.defineProperty(e,"compareIpv6",{enumerable:!0,get:function(){return F}}),Object.defineProperty(e,"NETWORK_TYPES",{enumerable:!0,get:function(){return T}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return I}});const E=U("packages/core/src/internal/predicates.js").isNil,z=U("packages/core/src/internal/lru.js").Lru,_=4294967295,Z=/^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/;function X(P){if(E(P))return null;if(typeof P=="string")return B(P);const R=Number(P);return Number.isFinite(R)?R<0?R<-2147483648?null:R>>>0:R>_?null:Math.trunc(R)>>>0:null}function B(P){if(E(P))return null;const R=String(P).trim();if(R==="")return null;const $=Z.exec(R);if(!$)return null;let C=0;for(let A=1;A<=4;A++){const S=$[A];if(S.length>1&&S.charCodeAt(0)===48)return null;const x=Number(S);if(x>255)return null;C=C*256+x}return C}function Y(P){const R=X(P);return R===null?"":`${R>>>24&255}.${R>>>16&255}.${R>>>8&255}.${R&255}`}function G(P){return typeof P=="string"&&B(P)!==null}function j(P,R){const $=X(P),C=X(R);return $===null?C===null?0:1:C===null||$<C?-1:$>C?1:0}const k=64,g=_*k+32,c=/^(?:0|[1-9]\d?)$/;function d(P,R){return P*k+R}function l(P){if(E(P))return null;if(typeof P=="string"){const C=i(P);return C===null?null:l(C)}if(typeof P=="object"){const C=X(P.address),A=Number(P.prefix);return C===null||!Number.isInteger(A)||A<0||A>32?null:{address:C,prefix:A}}const R=Number(P);if(!Number.isInteger(R)||R<0||R>g)return null;const $=R%k;return $>32?null:{address:(R-$)/k,prefix:$}}function i(P){if(E(P))return null;const R=String(P).trim();if(R==="")return null;const $=R.indexOf("/");if($<0)return null;const C=B(R.slice(0,$));if(C===null)return null;const A=R.slice($+1).trim();if(!c.test(A))return null;const S=Number(A);return S>32?null:d(C,S)}function n(P){const R=l(P);return R?`${Y(R.address)}/${R.prefix}`:""}function a(P){return typeof P=="string"&&i(P)!==null}function s(P,R){const $=l(P),C=l(R);return $?C?$.address!==C.address?$.address<C.address?-1:1:$.prefix-C.prefix:-1:C?1:0}function t(P){return P===0?0:4294967295<<32-P>>>0}function u(P){const R=l(P);return R?(R.address&t(R.prefix))>>>0:null}function r(P){const R=l(P);return R?(R.address&t(R.prefix)|~t(R.prefix)>>>0)>>>0:null}function o(P){const R=l(P);return R?2**(32-R.prefix):null}function f(P){const R=l(P);return R?R.prefix===32?1:R.prefix===31?2:2**(32-R.prefix)-2:null}function w(P,R){const $=l(P);if(!$)return!1;const C=X(R);if(C===null)return!1;const A=t($.prefix);return(C&A)>>>0===($.address&A)>>>0}function m(P,R){const $=u(P),C=u(R);return $===null||C===null?!1:$<=r(R)&&C<=r(P)}const v=/^[0-9a-fA-F]{1,4}$/,h=new z(512);function p(P){if(E(P))return null;let R=String(P).trim();if(R==="")return null;const $=R.indexOf("%");if($>=0&&(R=R.slice(0,$)),R==="")return null;if(R.indexOf(".")>=0){const V=R.lastIndexOf(":");if(V<0)return null;const W=B(R.slice(V+1));if(W===null)return null;R=`${R.slice(0,V+1)}${(W>>>16&65535).toString(16)}:${(W&65535).toString(16)}`}const C=R.split("::");if(C.length>2)return null;const A=b(C[0]);if(A===null)return null;if(C.length===1)return A.length===8?A:null;const S=b(C[1]);if(S===null)return null;const x=8-A.length-S.length;if(x<1)return null;const H=A.slice();for(let V=0;V<x;V++)H.push(0);for(const V of S)H.push(V);return H}function b(P){if(P==="")return[];const R=[];for(const $ of P.split(":")){if(!v.test($))return null;R.push(parseInt($,16))}return R}function O(P){if(typeof P!="string")return p(P);if(h.has(P))return h.get(P);const R=p(P);return h.set(P,R),R}function y(P){if(P[0]===0&&P[1]===0&&P[2]===0&&P[3]===0&&P[4]===0&&P[5]===65535)return`::ffff:${Y((P[6]<<16|P[7])>>>0)}`;let R=-1,$=0,C=-1,A=0;for(let H=0;H<8;H++)P[H]===0?(C<0?(C=H,A=1):A++,A>$&&($=A,R=C)):(C=-1,A=0);if($<2)return P.map(H=>H.toString(16)).join(":");const S=P.slice(0,R).map(H=>H.toString(16)).join(":"),x=P.slice(R+$).map(H=>H.toString(16)).join(":");return`${S}::${x}`}function L(P){const R=p(P);return R===null?null:y(R)}function M(P){return L(P)??""}function D(P){return typeof P=="string"&&P.indexOf(":")>=0&&p(P)!==null}function F(P,R){const $=O(P),C=O(R);if(!$)return C?1:0;if(!C)return-1;for(let A=0;A<8;A++)if($[A]!==C[A])return $[A]<C[A]?-1:1;return 0}const T=Object.freeze({ipv4:{base:"number",storage:"int32",unsignedInt32:!0,matches:G,parse:P=>B(P.text),compare:j,format:P=>Y(P.value),defaults:{filter:"text",editor:"ipaddress",align:"start"},excel:"@",excelKind:"string",toStorage:P=>X(P),toClipboard:P=>Y(P),fromClipboard:P=>B(P)},cidr:{base:"number",storage:"float64",matches:a,parse:P=>i(P.text),compare:s,format:P=>n(P.value),defaults:{filter:"text",editor:"ipaddress",align:"start"},excel:"@",excelKind:"string",toStorage:P=>{const R=l(P);return R===null?null:d(R.address,R.prefix)},toClipboard:P=>n(P),fromClipboard:P=>i(P)},ipv6:{base:"text",storage:"dictionary",matches:D,parse:P=>L(P.text),compare:F,format:P=>M(P.value),defaults:{filter:"text",editor:"ipaddress",align:"start"},excel:"@",toStorage:P=>L(P),toClipboard:P=>M(P),fromClipboard:P=>L(P)}}),I=T}),Ue("packages/core/src/i18n/catalogue.js",function(e,U){"use strict";Object.defineProperty(e,"EN_GB",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"MESSAGE_KEYS",{enumerable:!0,get:function(){return z}});const E=U("packages/core/src/registry/free-tier-notice.js").FREE_TIER_NOTICE,q=Object.freeze({"count.rows":{one:"{count} row",other:"{count} rows"},"count.comments":{one:"{count} comment",other:"{count} comments"},"comments.someUnresolved":"{comments}, {unresolved} unresolved","comments.allResolved":"{comments}, all resolved","count.unresolvedComments":{one:"{count} unresolved comment",other:"{count} unresolved comments"},"count.items":{one:"{count} item",other:"{count} items"},"count.keys":{one:"{count} key",other:"{count} keys"},"count.values":{one:"value",other:"values"},"count.waiting":{one:"{count} waiting",other:"{count} waiting"},"count.rowsAdded":{one:"{count} row added",other:"{count} rows added"},"count.rowsRemoved":{one:"{count} row removed",other:"{count} rows removed"},"value.empty":"empty","a11y.sort.cleared":"Sort cleared","a11y.sort.by":"Sorted by {columns}","a11y.sort.column":"{column} {direction}","a11y.sort.ascending":"ascending","a11y.sort.descending":"descending","a11y.filter.cleared":"Filter cleared, {rows}","a11y.filter.applied":"Filtered to {shown} of {total}","a11y.find.count":{one:"{current} of {count} match",other:"{current} of {count} matches"},"a11y.find.countLoaded":{one:"{current} of {count} match in loaded rows",other:"{current} of {count} matches in loaded rows"},"a11y.find.none":"No matches","a11y.find.noneLoaded":"No matches in loaded rows","a11y.selection.cleared":"Selection cleared","a11y.selection.count":{one:"{count} row selected",other:"{count} rows selected"},"tabs.tablist":"Tabs","a11y.tabs.selected":"{label} tab selected","a11y.scrollbar.horizontal":"Horizontal scrollbar","a11y.scrollbar.vertical":"Vertical scrollbar","designer.canvas":"Dashboard canvas","designer.chrome":"Designer tools","designer.page":"Page {n}","a11y.designer.edit":"Edit mode","a11y.designer.view":"View mode","layout.region":"Dashboard layout","layout.move":"Move {title}","layout.resize":"Resize {title}","layout.close":"Close {title}","a11y.layout.grabbed":"{title} grabbed, column {x} of {columns}, row {y}","a11y.layout.position":"{title}, column {x} of {columns}, row {y}","a11y.layout.dropped":"{title} dropped, column {x} of {columns}, row {y}","a11y.layout.cancelled":"{title} move cancelled","a11y.layout.resizeCancelled":"{title} resize cancelled","a11y.layout.reverted":"{title} returned to column {x}, row {y}","a11y.layout.resizeGrabbed":"{title} resize grabbed, {w} by {h} cells","a11y.layout.resizeStep":"{title}, {w} by {h} cells","a11y.layout.resized":"{title} resized to {w} by {h} cells","a11y.layout.closed":"{title} closed","layout.maximise":"Maximise {title}","layout.minimise":"Minimise {title}","layout.restore":"Restore {title}","a11y.layout.maximised":"{title} maximised, filling the dashboard; press Escape to restore it","a11y.layout.minimised":"{title} minimised","a11y.layout.restored":"{title} restored to column {x}, row {y}","a11y.group.cleared":"Grouping cleared","a11y.group.by":"Grouped by {columns}","a11y.group.expanded":"{label} expanded, {rows} shown","a11y.group.collapsed":"{label} collapsed, {rows} shown","a11y.page.position":"Page {page} of {pages}","a11y.updates.paused":"Updates paused","a11y.updates.resumed":"Updates resumed","a11y.edit.refusedOne":"Edit to {column} was refused and put back to {value}{reason}","a11y.edit.refusedMany":{one:"{count} edit was refused and put back{reason}",other:"{count} edits were refused and put back{reason}"},"a11y.edit.reason":", {reason}","a11y.history.undo":"Undid {label}","a11y.history.redo":"Redid {label}","a11y.history.undoLast":"Undid the last change","a11y.history.redoLast":"Redid the last change","a11y.column.cannotResize":"{column} cannot be resized","a11y.column.resized":"{column} is {width} pixels wide","a11y.column.atMinimum":"{column} is at its narrowest, {width} pixels","a11y.column.atMaximum":"{column} is at its widest, {width} pixels","a11y.column.cannotMove":"{column} cannot be moved","a11y.column.alreadyFirst":"{column} is already first in its group","a11y.column.alreadyLast":"{column} is already last in its group","a11y.column.cannotMoveThere":"{column} cannot be moved there","a11y.column.moved":"{column} moved to position {at} of {of}","a11y.group.formed":"{column} grouped with {other} in a new band","a11y.group.dissolved":"band {group} dissolved","a11y.group.renamed":"band renamed to {group}","a11y.group.moved":"band {group} moved to position {at} of {of}","a11y.column.addedToGroup":"{column} added to band {group}","a11y.column.removedFromGroup":"{column} removed from its band","a11y.column.notInGroup":"{column} is not in a band","a11y.column.cannotGroup":"{column} cannot be grouped","a11y.group.cannotMove":"band {group} cannot be moved there","columngroup.newGroup":"New group","columngroup.rename":"Rename band","columngroup.dissolve":"Dissolve band","columngroup.group":"Group with adjacent column","columngroup.untitled":"Untitled band","panel.bandCollapse":"Collapse band {band}","panel.bandExpand":"Expand band {band}","panel.bandVisible":"Show or hide every column in band {band}","panel.bandRenameFor":"Rename band {band}","panel.bandDissolveFor":"Dissolve band {band}","header.filter":"Filter {column}","header.menu":"Column menu for {column}","header.toggleGroup":"Toggle {group}","header.dragHint":"Drag {column} to reorder, or onto another column to group","header.dragRole":"draggable column header","header.group":"group","header.selectAllRows":"Select all rows","header.clearSelection":"Clear selection","cell.selectRow":"Select row","cell.detail.show":"Show detail","cell.detail.hide":"Hide detail","cell.detail.showInPane":"Show in the detail pane","cell.detail.showingInPane":"Showing in the detail pane","cell.group.expand":"Expand","cell.group.collapse":"Collapse","cell.delta.up":"up","cell.delta.down":"down","cell.delta.unchanged":"unchanged","cell.delta.moved":"{direction} {magnitude}","cell.delta.describedUnchanged":"{label}, unchanged","cell.delta.described":"{label}, {direction} by {magnitude}","cell.qr.of":"QR code for {text}","cell.qr.empty":"No QR code","cell.rating.of":"{rating} of {max}","cell.rating.empty":"Not rated","cell.stage.of":"Stage {current} of {total}: {label}","cell.stage.empty":"No stage","a11y.panel.cannotMove":"{column} cannot be moved","a11y.panel.alreadyFirst":"{column} is already first","a11y.panel.alreadyLast":"{column} is already last","a11y.panel.moved":"{column} moved to position {at} of {of}","a11y.panel.removedFrom":"{column} removed from {list}","a11y.panel.addedTo":"{column} added to {list}","a11y.panel.cannotAddTo":"{column} cannot be added to {list}","a11y.annotate.erased":"Annotation removed","a11y.annotate.noMarks":"No annotations to erase","a11y.annotate.focusedMark":"Mark {at} of {of} selected","a11y.annotate.confirmClear":"Clear all annotations? Choose Clear or Keep.","a11y.annotate.cleared":"All annotations cleared","a11y.range.written":{one:"{count} cell updated",other:"{count} cells updated"},"a11y.range.cleared":{one:"{count} cell cleared",other:"{count} cells cleared"},"paste.preview.title":"Review paste","paste.preview.summary":{one:"{changes} cell will change, {rejected} rejected.",other:"{changes} cells will change, {rejected} rejected."},"paste.preview.changesHeading":{one:"{count} change",other:"{count} changes"},"paste.preview.rejectedHeading":{one:"{count} rejected",other:"{count} rejected"},"paste.preview.colOld":"Current","paste.preview.colNew":"New","paste.preview.colCell":"Cell","paste.preview.colReason":"Reason","paste.preview.empty":"This paste would change nothing.","paste.preview.confirm":"Apply","paste.preview.cancel":"Cancel","paste.preview.reason.permission":"Not permitted","paste.preview.reason.readOnly":"Read-only","paste.preview.reason.validation":"Invalid value","paste.preview.reason.locked":"Being edited","paste.preview.reason.missing":"No such cell","a11y.paste.previewOpened":{one:"Paste preview: {changes} cell changes, {rejected} rejected. Review, then apply or cancel.",other:"Paste preview: {changes} cell changes, {rejected} rejected. Review, then apply or cancel."},"a11y.paste.cancelled":"Paste cancelled; nothing changed","status.total":"{rows}","status.counting":"Counting rows…","status.shownOfTotal":"{shown} of {total}","status.selected":"{count} selected","status.selectedAcrossSource":"{count} selected across the source","status.selectedAcrossSourceCounting":"All matching rows selected, counting…","status.count":"Count {count}","status.loading":"Loading {count}…","status.loadingOf":"Loading {loaded} of {total} ({percent}%)","status.stat.sum":"Sum","status.stat.min":"Min","status.stat.max":"Max","status.stat.avg":"Avg","status.paused":"Paused","status.pausedWaiting":"Paused · {waiting}","status.coalesced":"{count} coalesced","status.hiddenComments":"{comments} on hidden rows","pagination.label":"Pagination","pagination.first":"First page","pagination.previous":"Previous page","pagination.next":"Next page","pagination.last":"Last page","pagination.page":"Page","pagination.ofPages":"of {pages}","pagination.summary":"{from}–{to} of {total}","pagination.pageSize":"Rows per page","pagination.range":"{from}–{to}","pagination.counting":"{from}–{to}, counting…","pagination.jump":"Page number, press Enter to jump","pagination.jumpBounded":"Page number, 1 to {pages}, press Enter to jump","panel.columns":"Columns","panel.filters":"Filters","panel.views":"Views","panel.quickFilter":"Quick filter","find.label":"Find in grid","find.placeholder":"Find in grid","find.next":"Next match","find.previous":"Previous match","find.close":"Close find","find.matchCase":"Match case","find.wholeCell":"Whole cell","find.columnScope":"Search in","find.allColumns":"All columns","find.count":"{current} of {total}","find.countPartial":"{current} of {total} so far","find.none":"No matches","find.searching":"Searching…","find.loadedRows":"in loaded rows","panel.formatting":"Formatting","panel.statistics":"Statistics","stat.noData":"No data","stat.tone.good":"good","stat.tone.bad":"bad","stat.tone.flat":"flat","panel.regression":"Regression","panel.compare":"Compare","panel.insights":"Insights","insights.subset":"Filtered subset vs whole","insights.dataset":"This grid vs another dataset","insights.groups":"Group comparison","insights.noFilter":"Filter the grid to compare the subset against the whole.","insights.by":"Group by","insights.test":"Test","insights.effect":"Effect size","insights.interval":"Confidence interval","insights.pValue":"p-value","insights.smallSample":"small sample — interpret with care","insights.needGroups":"Choose two columns with groups to compare.","insights.empty":"No columns to analyse.","insights.anomalies":"Anomalies","insights.anomalyCount":"{count} flagged of {n}","insights.anomalyMethod":"Method","insights.anomalyThreshold":"Threshold","anomaly.chip":"{count} anomalies flagged","anomaly.chipActive":"Showing {count} anomalies — clear","compare.first":"First column","compare.second":"Second column","compare.needTwo":"Two numeric columns are needed to compare","compare.noPairs":"No rows have a value in both","compare.pairs":"{count} pairs","compare.pearson":"Correlation (Pearson)","compare.spearman":"Rank correlation (Spearman)","compare.kendall":"Kendall’s tau","compare.covariance":"Covariance","compare.slope":"Slope","compare.intercept":"Intercept","compare.r2":"R²","compare.stdError":"Standard error","compare.weighted":"Weighted average","panel.zone.group":"row groups","panel.zone.values":"values","panel.zone.pivot":"pivot columns","groupZone.label":"Row groups","groupZone.title":"Group by","groupZone.hint":"Drag a column here to group rows by its values","groupZone.chip":"{column}, group {at} of {of}","groupZone.remove":"Stop grouping by {column}","groupZone.add":"Add a group","total.sum":"Sum","total.avg":"Average","total.min":"Min","total.max":"Max","total.count":"Count","total.countValues":"Count of values","total.first":"First","total.last":"Last","total.custom":"Total","total.median":"Median","total.p25":"25th percentile","total.p75":"75th percentile","total.p90":"90th percentile","total.p95":"95th percentile","total.p99":"99th percentile","total.iqr":"Interquartile range","total.mad":"Median absolute deviation","total.variance":"Variance","total.varianceP":"Variance (population)","total.stddev":"Standard deviation","total.stddevP":"Standard deviation (population)","total.range":"Range","total.distinct":"Distinct","total.mode":"Mode","total.skewness":"Skewness","total.kurtosis":"Kurtosis","total.geomean":"Geometric mean","total.harmean":"Harmonic mean","total.sumSquares":"Sum of squares","total.weightedAvg":"Weighted average","total.argmin":"Lowest by","total.argmax":"Highest by","total.hhi":"Concentration (HHI)","total.entropy":"Entropy","total.evenness":"Evenness","total.top3Share":"Top 3 share","total.top10Share":"Top 10 share","total.gini":"Gini coefficient","total.trimmedMean":"Trimmed mean","total.winsorizedMean":"Winsorized mean","total.robustOutliers":"Outliers (robust)","total.jarqueBera":"Jarque–Bera","total.passRate":"Pass rate","total.failureCount":"Failures","stats.column":"Column","stats.choose":"Choose a column to profile","stats.noColumns":"No numeric columns to profile","stats.noValues":"Nothing numeric in this column","stats.count":"Count","stats.present":"Present","stats.missing":"Missing","stats.distinct":"Distinct","stats.min":"Minimum","stats.max":"Maximum","stats.mean":"Mean","stats.median":"Median","stats.q1":"Lower quartile","stats.q3":"Upper quartile","stats.iqr":"Interquartile range","stats.stddev":"Standard deviation","stats.outliers":"Outliers","stats.distribution":"Distribution","stats.distribution.detail":"Distribution: rows per range","stats.bin":"{count} between {from} and {to}","stats.topValues":"Top values","stats.section.shape":"Shape","stats.section.robust":"Robust","stats.section.concentration":"Concentration","stats.section.capability":"Capability","stats.cp":"Cp","stats.cpk":"Cpk","stats.pp":"Pp","stats.ppk":"Ppk","stats.outOfSpec":"Out of specification","stats.filtered":"Over the {count} filtered rows","stats.unavailable":"Not computed by the source: {stats}.","stats.unavailable.notPlain":"`{column}` is not a plain column the engine can name","stats.unavailable.where":"a `where` predicate is in force ({list}), which only the browser can run","stats.unavailable.filter":"the grid's filter did not fully push to the engine","stats.unavailable.quick":"the quick search did not push to the engine","stats.unavailable.client":'the source did not compute "{fn}" in the engine ({reason}); set the pushdown source\'s `{setting}`',"stats.unavailable.outliers":"the count of values outside Tukey's fences is not an engine aggregate","stats.unavailable.histogram":"the shape of the column is not an engine aggregate","stats.unavailable.topValues":"the source did not answer a grouped count in the engine","regression.noModel":"No model configured. Set predictors and a response on the panel.","regression.cannotFit":"The model cannot be fitted over the current rows.","regression.observations":"Fitted over {count} rows","regression.r2":"R²","regression.adjR2":"Adjusted R²","regression.coefficients":"Coefficients","regression.term":"Term","regression.estimate":"Estimate ± SE","regression.stdError":"Std error","regression.t":"t","regression.p":"p","regression.vif":"Variance inflation (VIF)","regression.heteroscedasticity":"Heteroscedasticity (Breusch–Pagan)","regression.heteroscedastic":"Heteroscedastic: BP {statistic}, p {p}","regression.homoscedastic":"No heteroscedasticity detected: BP {statistic}, p {p}","menu.sortAscending":"Sort ascending","menu.sortDescending":"Sort descending","menu.clearSort":"Clear sort","menu.groupBy":"Group by this column","menu.ungroup":"Stop grouping by this column","menu.hideColumn":"Hide column","menu.pinStart":"Pin to start","menu.pinEnd":"Pin to end","menu.unpin":"Unpin","menu.autosize":"Fit to content","ai.valuesNotAmongOptions":'{values} {shown} not among the options for "{column}"',"menu.clearCells":{one:"Clear cell",other:"Clear {count} cells"},"menu.fillDown":"Fill down","menu.copy":"Copy","menu.copyWithHeaders":"Copy with headers","menu.paste":"Paste","menu.filterEllipsis":"Filter…","menu.columnStatistics":"Column statistics","menu.pinColumn":"Pin column","menu.sizeToFit":"Size to fit content","menu.sizeAllToFit":"Size all columns to fit","menu.width":"Width","menu.narrower":"Narrower","menu.wider":"Wider","menu.moveColumn":"Move column","menu.moveLeft":"Move left","menu.moveRight":"Move right","menu.moveToStart":"Move to start","menu.moveToEnd":"Move to end","menu.unpivot":"Remove from pivot","menu.pivotBy":"Pivot by this column","menu.stopTotalling":"Stop totalling","menu.totalColumn":"Total this column","menu.aggregate":"Aggregate","menu.aggregateNone":"None","menu.aggregateGroup":"Group subtotals","menu.aggregateGrand":"Grand total","menu.aggregateSame":"Same as total","menu.redactColumn":"Redact column","menu.stopRedacting":"Stop redacting","menu.stopRedactingAll":"Stop redacting everything","menu.sortGroupsAscending":"Sort groups ascending","menu.sortGroupsDescending":"Sort groups descending","menu.filterGroups":"Filter groups…","menu.expandAll":"Expand all","menu.collapseAll":"Collapse all","menu.clearGrouping":"Clear grouping","menu.colour":"Colour","menu.importCsv":"Import rows from CSV…","import.title":"Import rows","import.clipboard":"the clipboard","import.summary":{one:"{count} row from {name}",other:"{count} rows from {name}"},"import.opened":{one:"Import preview open, {count} row",other:"Import preview open, {count} rows"},"import.done":{one:"{count} row imported",other:"{count} rows imported"},"import.confirm":"Import","import.cancel":"Cancel","import.colSource":"Column","import.colField":"Maps to","import.colType":"Type","import.skip":"— skip —","import.mapLabel":'Map "{source}" to a field',"import.modeLabel":"On import","import.sheetLabel":"Sheet","import.append":"Add to existing rows","import.replace":"Replace all rows","menu.deleteRow":{one:"Delete row",other:"Delete {count} rows"},"toolbar.undo":"Undo","toolbar.redo":"Redo","toolbar.undoLabelled":"Undo {label}","toolbar.redoLabelled":"Redo {label}","toolbar.exportCsv":"Export to CSV","toolbar.exportExcel":"Export to Excel","toolbar.clipboard":"Copy visible rows to the clipboard","toolbar.print":"Print","toolbar.pause":"Hold incoming updates","toolbar.resume":"Resume updates","toolbar.applyHeld":{one:"Apply {count} held update",other:"Apply {count} held updates"},"toolbar.restoreView":"Restore the default view","toolbar.maximiseGrid":"Maximise the grid to fill the window","toolbar.restoreSize":"Restore the grid to the page (Esc)","toolbar.annotate.pen":"Draw freehand","toolbar.annotate.arrow":"Draw an arrow","toolbar.annotate.rect":"Draw a rectangle","toolbar.annotate.highlight":"Highlight","toolbar.annotate.erase":"Erase","toolbar.annotate.clearAll":"Clear all annotations","toolbar.annotate.clearAllConfirm":"Clear","toolbar.annotate.clearAllKeep":"Keep","overlay.noRows":"No rows to show","overlay.noResults":"No rows match the current filters","overlay.loading":"Loading…","overlay.error":"Something went wrong","overlay.loadingRows":"Loading rows {from} to {to}","overlay.rowError":"Failed to load","comments.panel":"Cell comments","comments.close":"Close comments","comments.write":"Write a comment","comments.post":"Comment","comments.delete":"Delete","comments.valueMoved":"Written when the value was {was}: it is now {now}.","comments.resolve":"Resolve","comments.reopen":"Reopen","comments.loading":"Loading…","comments.empty":"No comments yet.","comments.unknownAuthor":"Unknown","comments.edited":"{time} (edited)","comments.cellTitle":"{column}: {row}","presence.hidden":{one:"{count} not in view",other:"{count} not in view"},"presence.someoneElse":"someone else","a11y.presence.refused":"This cell is being edited by {name}","presence.peer":"{name}: jump to their cursor","presence.peerIdle":"{name}, idle: jump to their cursor","presence.peerHidden":"{name}, not in the current view","facets.filter":"{column} distribution filter","header.totalOf":"{total} of {column}","diff.before":"Was: {value}","diff.empty":"(empty)","kanban.columnCards":{one:"{title}, {count} card",other:"{title}, {count} cards"},"kanban.laneCards":{one:"{lane}, {title}, {count} card",other:"{lane}, {title}, {count} cards"},"kanban.blocked":"Blocked","kanban.ready":"Ready","kanban.blockedBy":{one:"blocked by {count} card",other:"blocked by {count} cards"},"kanban.card.assignedTo":"Assigned to {names}","kanban.card.overdue":"Overdue","kanban.card.dueSoon":"Due soon","kanban.card.progress":"{percent}% complete","kanban.card.checklist":"{done} of {total} done","gantt.lag":"+{days}d","gantt.lead":"{days}d","gantt.a11y.moved":"{name} moved to {date}","gantt.a11y.day":"day {day}","gantt.a11y.resized":"{name} resized to {days} days","gantt.a11y.linkFrom":"Linking from {name}. Focus the successor and press L.","gantt.a11y.linked":"Linked {from} to {to}, finish to start.","gantt.a11y.linkCancelled":"Link cancelled.","gantt.a11y.deleted":"{name} deleted.","gantt.a11y.readOnly":"Read-only.","gantt.row.moveHandle":"Drag to reorder or re-parent {name}","gantt.a11y.rowMoved":"{name} moved.","gantt.a11y.rowReparented":"{name} moved under {parent}.","gantt.a11y.rowPromoted":"{name} moved to the top level.","gantt.a11y.rowMoveCancelled":"Move cancelled.","gantt.a11y.copied":"{count} tasks copied.","gantt.a11y.cut":"{count} tasks cut.","gantt.a11y.pasted":"{count} tasks pasted.","gantt.task.newName":"New task","gantt.a11y.taskAdded":"{name} added.","gantt.menu.addAbove":"Add task above","gantt.menu.addBelow":"Add task below","gantt.menu.addChild":"Add subtask","gantt.menu.addSuccessor":"Add successor","gantt.menu.addPredecessor":"Add predecessor","gantt.menu.toMilestone":"Convert to milestone","gantt.menu.toTask":"Convert to task","gantt.menu.delete":"Delete task","gantt.a11y.linkCycle":"Linking {from} to {to} would create a cycle; link not created.","gantt.a11y.linkCreated":"{from} linked to {to}, {type}.","gantt.a11y.linkDeleted":"Link from {from} to {to} deleted.","gantt.a11y.linkLabel":"Link, {from} to {to}, {type}","gantt.linkEditor.title":"Edit link from {from} to {to}","gantt.linkEditor.type":"Link type","gantt.linkEditor.lag":"Lag, in days","gantt.linkEditor.apply":"Apply","gantt.linkEditor.delete":"Delete link","gantt.linkEditor.cancel":"Cancel","gantt.a11y.undone":"Undone.","gantt.a11y.redone":"Redone.","gantt.a11y.nothingToUndo":"Nothing to undo.","gantt.a11y.nothingToRedo":"Nothing to redo.","gantt.workload.title":"Resource workload","gantt.workload.resource":"Resource","gantt.workload.total":"Total","gantt.workload.unassigned":"Unassigned","gantt.workload.ungrouped":"No group","gantt.workload.cell":"{hours} h from {date}","gantt.workload.over":"{hours} h from {date}, over a capacity of {capacity} h","gantt.workload.expand":"Show {name}’s tasks","gantt.workload.collapse":"Hide {name}’s tasks","gantt.workload.expandGroup":"Show the {name} group","gantt.workload.collapseGroup":"Hide the {name} group","gantt.workload.unitToggle":"Hours / % / Cost","gantt.workload.unitHours":"Showing hours","gantt.workload.unitPercent":"Showing percent of capacity","gantt.workload.unitCost":"Showing cost","gantt.workload.cellPercent":"{percent}% from {date}","gantt.workload.overPercent":"{percent}% from {date}, over capacity","gantt.workload.cellNoCapacity":"No available hours from {date}","gantt.workload.cellCost":"{cost} from {date}","gantt.workload.otherProjectLabel":"{name} (other project)","gantt.workload.external":"External booking","gantt.a11y.hoursSet":"{name}: {hours} h from {date}","gantt.a11y.hoursCleared":"{name}: no hours from {date}","gantt.a11y.hoursRefused":"{date} is not a working day; {name} was not changed.","gantt.histogram.title":"Resource histogram","gantt.histogram.tableTitle":"Resource histogram data","gantt.histogram.resource":"Resource","gantt.histogram.period":"Period","gantt.histogram.hours":"Hours","gantt.histogram.percent":"Percent of capacity","gantt.histogram.cost":"Cost","gantt.histogram.capacity":"Capacity","gantt.histogram.overAllocated":"Over-allocated","gantt.histogram.yes":"Yes","gantt.histogram.no":"No","gantt.histogram.tip":"{name}, {from} to {to}: {value}{capacity}{tasks}","gantt.histogram.tipHours":"{hours} h","gantt.histogram.tipPercent":"{percent}% of capacity","gantt.histogram.tipCost":"{cost}","gantt.histogram.tipCapacity":", capacity {hours} h","gantt.histogram.tipTasks":" ({tasks})","gantt.histogram.tipOver":", over capacity","gantt.histogram.tipNoCapacity":"no available hours","gantt.picker.title":"Assign resources to {name}","gantt.picker.open":"Edit assignments for {name}","gantt.picker.search":"Search resources","gantt.picker.list":"Resources","gantt.picker.selected":"Assigned resources","gantt.picker.load":"{load}% booked of {capacity}% over these dates","gantt.picker.none":"No matching resources","gantt.picker.units":"{name}, units in percent","gantt.picker.remove":"Remove {name}","gantt.picker.apply":"Apply","gantt.picker.cancel":"Cancel","gantt.picker.warn":"{name} would be over-allocated: {load}% booked of {capacity}%","gantt.picker.ok":"No resource would be over-allocated","gantt.picker.assign":"Assign","gantt.col.effort":"Effort","gantt.col.units":"Units","gantt.unscheduled":"Unscheduled","gantt.col.unscheduled":"Unscheduled","gantt.inactive":"Inactive","gantt.col.inactive":"Inactive","gantt.col.slack":"Slack","gantt.col.deadline":"Deadline","gantt.col.constraint":"Constraint","gantt.col.constraintDate":"Constraint date","gantt.col.earlyStart":"Early start","gantt.col.lateStart":"Late start","gantt.col.lateFinish":"Late finish","gantt.col.baselineStart":"Baseline start","gantt.col.baselineEnd":"Baseline finish","gantt.col.variance":"Variance","gantt.col.note":"Note","gantt.col.sequence":"#","gantt.col.predecessors":"Predecessors","gantt.col.successors":"Successors","gantt.link.invalid":"Cannot read “{token}” as a link. Write a task number, a type and a lag, like 3FS+2; links not changed.","gantt.link.unknownRef":"No task is numbered “{token}”; links not changed.","gantt.link.self":"“{token}” links a task to itself; links not changed.","gantt.link.duplicate":"“{token}” repeats a link already listed; links not changed.","gantt.link.cycle":"“{token}” would create a cycle; links not changed.","gantt.constraint.ASAP":"As soon as possible","gantt.constraint.MSO":"Must start on","gantt.constraint.MFO":"Must finish on","gantt.constraint.ALAP":"As late as possible","gantt.constraint.SNET":"Start no earlier than","gantt.constraint.SNLT":"Start no later than","gantt.constraint.FNET":"Finish no earlier than","gantt.constraint.FNLT":"Finish no later than","gantt.row.ancestor":"Shown because a task inside it matches the filter","gantt.progress.handle":"Drag to set the progress of {name}","gantt.a11y.progress":"{name} {percent}% complete","gantt.col.name":"Task name","gantt.col.start":"Start","gantt.col.end":"Finish","gantt.col.duration":"Duration","gantt.col.assignee":"Assignee","gantt.col.progress":"%","gantt.col.wbs":"WBS","gantt.zoom.label":"Zoom","gantt.zoom.day":"Day","gantt.zoom.week":"Week","gantt.zoom.month":"Month","gantt.zoom.quarter":"Quarter","gantt.zoom.fit":"Fit to plan","gantt.tip.range":"{from} to {to}","gantt.tip.duration":"{days}d","gantt.tip.slack":"slack {days}d","gantt.tip.effort":"{hours}h","gantt.tip.row":"{label}: {value}","gantt.tip.start":"Start","gantt.tip.end":"End","gantt.tip.date":"Date","gantt.tip.durationLabel":"Duration","gantt.tip.durationValue":"{days} days","gantt.tip.complete":"Complete","gantt.tip.effortLabel":"Effort","gantt.tip.effortValue":"{hours} h","gantt.tip.assigned":"Assigned","gantt.tip.cost":"Cost","gantt.tip.slackLabel":"Slack","gantt.tip.slackValue":"{days} days","gantt.tip.deadline":"Deadline","gantt.mode.fixedDuration":"Fixed duration","gantt.mode.fixedEffort":"Fixed effort","gantt.mode.fixedUnits":"Fixed units","gantt.scurve.spi":"SPI {index}","gantt.scurve.cpi":"CPI {index}","gantt.print.page":"Page {page} of {pages}","gantt.print.printed":"Printed {date}","gantt.dataBand.title":"Data band","gantt.dataBand.name":"Task","gantt.dataBand.resource":"Resource","gantt.dataBand.total":"Total","gantt.dataBand.unassigned":"Unassigned","gantt.dataBand.collapse":"Collapse {name}","gantt.dataBand.expand":"Expand {name}","gantt.dataBand.cell":"{name}, {date}: {value}","gantt.issues.title":"Scheduling conflicts","gantt.issues.empty":"No scheduling conflicts","gantt.issues.count":"{count} scheduling conflicts","gantt.issues.toggle":"Toggle the conflicts panel","gantt.issues.cycle":"Circular dependency: {tasks}","gantt.issues.constraint":"{task} cannot meet its {constraint} constraint of {date}","gantt.issues.lock":"{task} is locked but a dependency would move it","gantt.issues.deadline":"{task} finishes after its deadline of {date}","gantt.issues.fixRemoveLink":"Remove link","gantt.issues.fixAsap":"Set as soon as possible","gantt.issues.fixUnlock":"Unlock task","gantt.issues.fixClearDeadline":"Clear deadline","gantt.resize.startHandle":"Drag to change the start of {name}","gantt.a11y.resizedStart":"{name} start moved to {date}, now {days} days","gantt.a11y.startEdge":"Start edge can be resized: drag the left edge, or press Ctrl+Shift+Left or Right.","gantt.a11y.chain":"Dependency chain highlighted: {preds} predecessors, {succs} successors.","timeline.scrub":"Scrub through recent changes","timeline.goLive":"Go live","timeline.returnToPresent":"Return to the present","a11y.fillHandle":"Drag to fill","panel.icons":"Icons","value.tooLong":"Too long","shortcuts.title":"Keyboard shortcuts","shortcuts.close":"Close keyboard shortcuts","shortcuts.hint":"Press Escape to close.","shortcuts.or":"or","a11y.reorder.moved":"Moved to position {position} of {total}","a11y.reorder.sorted":"Rows cannot be reordered while the grid is sorted","a11y.reorder.filtered":"Rows cannot be reordered while a filter is applied","a11y.reorder.grouped":"Rows cannot be reordered while the grid is grouped","a11y.reorder.grab":"Reorder row","a11y.reorder.sortedManual":"Rows cannot be reordered while the grid is sorted. Press Alt+Shift+M, or the Manual order button in the heading, to order them by hand","a11y.reorder.groupDerived":"The row cannot join that group: the group is worked out from the value, so there is no single value to give it","a11y.reorder.groupReadOnly":"The row cannot join that group: its grouping value cannot be edited","a11y.reorder.invalid":"The row cannot join that group: the new value was not valid","a11y.reorder.vetoed":"The move was declined; the row stays where it was","a11y.reorder.vetoedBecause":"The move was declined ({reason}); the row stays where it was","a11y.reorder.refused":"The row cannot be moved there","a11y.reorder.regrouped":"Moved into {group}","a11y.rowOrder.entered":"Manual order: the rows keep their places and can be moved by hand","a11y.rowOrder.exited":"Manual order ended; the rows follow the sort","rowOrder.button":"Manual order","rowOrder.enter":"Order the rows by hand instead of by the sort","rowOrder.exit":"Return to the sorted order","a11y.transfer.moved":"Row moved to the other grid","a11y.transfer.copied":"Row copied to the other grid","a11y.transfer.refused":"That grid does not accept this row","a11y.transfer.declined":"The drop was declined; the row stays where it was","a11y.transfer.stale":"The drop target changed while it was being confirmed; the row stays where it was","shortcuts.group.grid":"In the data","shortcuts.group.header":"On a column heading","shortcuts.group.panel":"In the column list","shortcut.moveCell":"Move the focused cell","shortcut.rowEnds":"First / last cell of the row","shortcut.gridEnds":"First cell of the first row / last cell of the last row","shortcut.pageRows":"Move one viewport of rows","shortcut.nextCell":"Leave the grid for the next / previous focusable element (arrows move between cells)","shortcut.undo":"Undo the last edit, paste, fill or clear","shortcut.redo":"Redo the step that was undone","shortcut.startEdit":"Start editing the focused cell","shortcut.toggleRow":"Toggle selection of the focused row","shortcut.cancel":"Cancel the current edit or drag","shortcut.expandCollapse":"Expand / collapse a group or tree row","shortcut.focusHeader":"Move focus to the column header","shortcut.focusPanel":"Move focus to the tool panel","shortcut.contextMenu":"Open the context menu for the focused cell","shortcut.moveRow":"Move the focused row, when row reorder is enabled","shortcut.manualOrder":"Order the rows by hand, or return to the sort, when row reorder allows a manual order","shortcut.headingMove":"Move between headings","shortcut.headingEnds":"First / last heading","shortcut.headingSort":"Sort by the column, Shift to add to the sort","shortcut.headingResize":"Resize the column, Ctrl for a coarse step","shortcut.headingAutosize":"Size the column to its content","shortcut.headingReorder":"Move the column","shortcut.headingMenu":"Open the column menu","shortcut.headingExit":"Return focus to the data","shortcut.listGroup":"Group by the column, or stop grouping by it","shortcut.listValues":"Add the column to values, or take it out","shortcut.listPivot":"Pivot by the column, or stop pivoting by it","shortcut.listMove":"Move the column","shortcut.find":"Find in the grid","tags.label":"Show columns","tags.all":"All columns","tags.showing":"Showing {tag}","form.title":"Edit row","form.save":"Save","form.cancel":"Cancel","form.loading":"Loading…","form.loadFailed":"Could not load this record.","form.loadTimeout":"The record did not arrive in time.","form.retry":"Try again","form.choose":"Choose…","form.newTitle":"New row","form.createFailed":"Could not add this record.","presentation.cards":"Showing records as cards","presentation.table":"Showing records as a table","editor.format":"Format","editor.codeHint":"Tab indents · Esc cancels · Ctrl+Enter saves","editor.colours":"Colours","editor.customColour":"Custom colour","editor.hexValue":"Hex value","editor.hexPlaceholder":"#rrggbb","editor.clearColour":"Clear colour","editor.time":"Time","editor.noIcon":"No icon","editor.selectAll":"Select all","editor.passwordHint":"Enter the value twice to save it.","editor.clearRating":"Clear rating","editor.clear":"Clear","editor.value":"Value","editor.currency":"Currency","editor.richtext.formatting":"Formatting","editor.richtext.richText":"Rich text","editor.richtext.placeholder":"Start writing…","editor.richtext.linkLabel":"Link address","editor.richtext.linkPlaceholder":"https://","editor.richtext.linkAdd":"Add link","editor.richtext.bold":"Bold (Ctrl+B)","editor.richtext.italic":"Italic (Ctrl+I)","editor.richtext.underline":"Underline (Ctrl+U)","editor.richtext.strike":"Strikethrough","editor.richtext.heading":"Paragraph style","editor.richtext.alignLeft":"Align left","editor.richtext.alignCenter":"Align centre","editor.richtext.alignRight":"Align right","editor.richtext.ul":"Bulleted list","editor.richtext.ol":"Numbered list","editor.richtext.color":"Text colour","editor.richtext.link":"Link (Ctrl+K)","editor.richtext.image":"Insert image","editor.richtext.clear":"Clear formatting","editor.richtext.source":"HTML source","editor.richtext.undo":"Undo (Ctrl+Z)","editor.richtext.redo":"Redo (Ctrl+Y)","formatting.format":"Format","formatting.noRules":"No rules yet. The first one that matches a cell wins.","formatting.clearAll":"Clear all","formatting.addRule":"Add rule","formatting.condition":"Condition","formatting.value":"Value","formatting.secondValue":"Second value","formatting.moveEarlier":"Move earlier","formatting.moveLater":"Move later","formatting.ruleKind":"Rule type","formatting.aCondition":"A condition","formatting.aColourScale":"A colour scale","formatting.compare":"Compare a value","formatting.distribution":"By the distribution","formatting.colourScale":"Colour scale","formatting.scaleBounds":"Scale bounds","formatting.preview":"Preview","formatting.livePreview":"Live preview","history.title":"History","history.show":"Show history","history.empty":"Nothing to undo yet.","prompt.ask":"Ask","prompt.apply":"Apply","prompt.discard":"Discard","panel.searchColumns":"Search columns","panel.searchColumnsPlaceholder":"Search columns…","panel.searchColumnsToFilter":"Search columns to filter","panel.showAll":"Show all","panel.hideAll":"Hide all","panel.clearAll":"Clear all","panel.clear":"Clear","panel.filterAllColumns":"Filter all columns","panel.columnFiltered":"This column is filtered","panel.clearFilterOn":"Clear the filter on {column}","panel.clearFilter":"Clear this filter","panel.filterEmptyNoMatch":"No column matches “{query}”.","panel.filterEmptyNone":"No column on this grid can be filtered.","panel.filterSummaryActive":"{active} of {total} columns filtered","panel.filterSummaryNone":"No filters · {total} columns available","panel.filterBy":"Filter by {column}","panel.filteredBy":"Filtered by {column}","panel.columnDragHint":"Drag {column} into a zone above, or onto another column to reorder","panel.gridActions":"Grid actions","views.default":"Default","views.namePlaceholder":"Name this view…","views.nameLabel":"Name for the current layout","views.save":"Save view","licence.watermark":"Unlicensed: Lattice Grid trial","licence.watermark.free":E,"filter.op.contains":"Contains","filter.op.notContains":"Does not contain","filter.op.equals":"Equals","filter.op.notEqual":"Does not equal","filter.op.startsWith":"Starts with","filter.op.endsWith":"Ends with","filter.op.blank":"Is blank","filter.op.notBlank":"Is not blank","filter.op.lessThan":"Less than","filter.op.lessThanOrEqual":"Less than or equal","filter.op.greaterThan":"Greater than","filter.op.greaterThanOrEqual":"Greater than or equal","filter.op.inRange":"In range","filter.op.matches":"Matches","filter.op.before":"Before","filter.op.after":"After","filter.op.relative":"Relative to today","filter.rel.today":"Today","filter.rel.yesterday":"Yesterday","filter.rel.tomorrow":"Tomorrow","filter.rel.lastNDays":"Last N days","filter.rel.nextNDays":"Next N days","filter.rel.thisWeek":"This week","filter.rel.lastWeek":"Last week","filter.rel.thisMonth":"This month","filter.rel.lastMonth":"Last month","filter.rel.thisQuarter":"This quarter","filter.rel.quarterToDate":"Quarter to date","filter.rel.thisYear":"This year","filter.rel.yearToDate":"Year to date","filter.operator":"Operator","filter.join":"Join","filter.value":"Value","filter.from":"From","filter.to":"To","filter.addCondition":"Add condition","filter.noConditions":"No conditions","filter.removeCondition":"Remove condition","filter.search":"Search","filter.searchValues":"Search values","filter.noMatches":"No values match","filter.selectAll":"Select all","filter.clear":"Clear","filter.all":"All","filter.allExcept":"All but {count}","filter.loadingValues":"Loading values…","filter.topValues":"Top {shown} of {total} values","filter.valuesFailed":"Values could not be loaded: {error}","filter.valuesUnsupported":"This source cannot list the values of {column}; filter by condition instead.","filter.true":"True","filter.false":"False","filter.expression":"Filter expression","filter.column":"Column","filter.relativePeriod":"Relative period","filter.days":"Number of days","filter.tab.set":"Values","filter.tab.text":"Text","filter.tab.number":"Number","filter.tab.date":"Date","filter.tab.advanced":"Advanced","filterRow.label":"Filter row","filterRow.conditions":{one:"{count} condition",other:"{count} conditions"},"chart.empty":"Nothing to chart","chart.summary":"{type} chart of {measure} by {dimension}","chart.summaryShare":"{type} chart of {measure}","chart.summaryType":"{type} chart","chart.summaryGauge":"{type} chart of {measure}, {fn}: {value}","chart.waterfallTotal":"Total","chart.summaryEngine":"Figures computed by the data engine over every matching row","chart.summaryEngineViewport":"{count} points in this view, fetched from the data engine","chart.summaryEngineDensity":"{count} rows in this view, more than the {cap} drawn as points, so shown as {cells} density cells counted by the data engine","chart.summaryClientDensity":"{count} rows in this view, more than the {cap} drawn as points, so shown as {cells} density cells computed in the browser","chart.viewportOverCap":"{count} rows in this view, more than the {cap} this map draws; zoom in or narrow the filter","chart.dataTable":"Chart data","chart.viewportFilter.label":"Map view","chart.annotate.rail":"Drawing tools","chart.annotate.select":"Select and move a drawing","chart.annotate.trendLine":"Trend line","chart.annotate.horizontalLine":"Horizontal line","chart.annotate.verticalLine":"Vertical line","chart.annotate.channel":"Parallel channel","chart.annotate.fibonacci":"Fibonacci retracement","chart.annotate.arrow":"Arrow","chart.annotate.pen":"Freehand pen","chart.annotate.pen.described":"Freehand drawing from {from} to {to}","chart.annotate.measure-x":"Date range","chart.annotate.measure-y":"Price range","chart.annotate.measure-xy":"Date and price range","chart.annotate.measure.bars":{one:"{count} bar",other:"{count} bars"},"chart.annotate.measure.points":{one:"{count} point",other:"{count} points"},"chart.annotate.measure.volume":"Vol {value}","chart.annotate.measure.seconds":"{count}s","chart.annotate.measure.minutes":"{count}m","chart.annotate.measure.hours":"{count}h","chart.annotate.measure.days":"{count}d","chart.annotate.measure.weeks":"{count}w","chart.annotate.measure.months":"{count}mo","chart.annotate.measure.years":"{count}y","chart.annotate.measure":"Measure","chart.annotate.measure.dx":"Δx {value}","chart.annotate.measure.dy":"Δy {value}","chart.annotate.measure.pct":"{value}%","chart.annotate.measure.categories":{one:"{count} category",other:"{count} categories"},"chart.annotate.measure.slope.perDay":"Slope {value} per day","chart.annotate.measure.slope.perCategory":"Slope {value} per category","chart.annotate.measure.slope.perUnit":"Slope {value} per unit","chart.annotate.measure.dur.d":"{count} d","chart.annotate.measure.dur.h":"{count} h","chart.annotate.measure.dur.min":"{count} min","chart.annotate.measure.dur.s":"{count} s","chart.annotate.measure.dur.ms":"{count} ms","chart.annotate.measure.announce":"Measurement: {readout}","chart.annotate.measure.start":"Measure start: {x}, {y}","chart.annotate.text":"Text","chart.annotate.callout":"Callout","chart.annotate.note":"Note","chart.annotate.delete":"Delete the selected drawing","chart.annotate.editLabel":"Annotation text","chart.zoom.toolbar":"Zoom controls","chart.zoom.in":"Zoom in","chart.zoom.out":"Zoom out","chart.zoom.left":"Pan left","chart.zoom.right":"Pan right","chart.zoom.reset":"Reset the zoom","chart.legendMore":{one:"+{count} more",other:"+{count} more"},"chart.type.line":"Line","chart.type.area":"Area","chart.type.bar":"Bar","chart.type.pie":"Pie","chart.type.donut":"Donut","chart.type.sunburst":"Sunburst","chart.type.scatter":"Scatter","chart.type.step":"Step","chart.type.rangeArea":"Range","chart.type.horizontalBar":"Horizontal bar","chart.type.waterfall":"Waterfall","chart.type.floatingBar":"Floating bar","chart.type.horizontalFloatingBar":"Horizontal floating bar","chart.type.populationPyramid":"Population pyramid","chart.type.bullet":"Bullet","chart.type.bubble":"Bubble","chart.type.histogram":"Histogram","chart.type.boxplot":"Box plot","chart.type.forest":"Forest plot","chart.type.qq":"QQ plot","chart.type.ecdf":"ECDF","chart.type.lorenz":"Lorenz","chart.type.correlogram":"Correlogram","chart.type.control":"Control","chart.type.capability":"Capability","chart.type.movingRange":"Moving range","chart.type.treemap":"Treemap","chart.type.combo":"Combination","chart.type.pareto":"Pareto","chart.type.heatmap":"Heat map","chart.type.radar":"Radar","chart.type.gauge":"Gauge","chart.type.funnel":"Funnel","chart.type.candlestick":"Candlestick","chart.type.ohlc":"OHLC","chart.type.polarArea":"Polar area","chart.type.nightingale":"Nightingale rose","chart.type.rose":"Rose","chart.type.radialBar":"Radial bar","chart.type.polarScatter":"Polar scatter","chart.type.geomap":"Map","chart.type.sankey":"Sankey","chart.type.chord":"Chord","chart.type.pyramid":"Pyramid","chart.type.pictorial":"Pictorial","chart.type.serpentine":"Serpentine timeline","chart.type.spiral":"Spiral timeline","chart.edit.aggregated":"This value is a total of several rows, so it cannot be dragged.","chart.edit.refused":"That change was not applied.","chart.edit.refusedWhy":"That change was not applied: {reason}","chart.type.network":"Network","chart.type.stream":"Stream","chart.type.marimekko":"Marimekko","chart.type.violin":"Violin","chart.type.gantt":"Gantt","chart.type.forceTree":"Force-directed tree","chart.type.pack":"Packed circles","chart.type.tree":"Tree","chart.type.voronoiTreemap":"Voronoi treemap","chart.type.alluvial":"Alluvial","chart.type.arc":"Arc diagram","chart.type.barRace":"Bar chart race","chart.type.bubblemap":"Bubble map","chart.type.bump":"Bump chart","chart.type.calendar":"Calendar heat map","chart.type.choropleth":"Choropleth map","chart.type.decomposition":"Decomposition tree","chart.type.diverging":"Diverging bar","chart.type.dumbbell":"Dumbbell","chart.type.fan":"Fan chart","chart.type.hexbin":"Hexagonal bin","chart.type.hexmap":"Hex map","chart.type.icicle":"Icicle","chart.type.markermap":"Marker map","chart.type.motion":"Motion chart","chart.type.parallel":"Parallel coordinates","chart.type.ridgeline":"Ridgeline","chart.type.roc":"ROC curve","chart.type.scatter3d":"3D scatter","chart.type.slope":"Slope chart","chart.type.splom":"Scatter plot matrix","chart.type.venn":"Venn diagram","chart.type.waffle":"Waffle","chart.type.wordCloud":"Word cloud","chart.tasksDropped":{one:"{count} more task not shown",other:"{count} more tasks not shown"},"chart.geoUnmatched":{one:"{count} row could not be placed on the map",other:"{count} rows could not be placed on the map"},"chart.r2":"R² {value}","ai.insights":"Insights","ai.explainView":"Explain this view","ai.explain":"Explain","ai.ask":"Ask","ai.apply":"Apply","ai.discard":"Discard","ai.propose":"Propose","ai.approve":"Approve","ai.thinking":"Thinking…","ai.applying":"Applying…","ai.applied":"Applied: {what}","ai.couldNotApply":"Could not apply: {why}","ai.applyFailed":"it failed","ai.discarded":"Discarded.","ai.discardedNothingWritten":"Discarded. Nothing was written.","ai.nothingWritten":"Nothing was written.","ai.nothingWrittenVetoed":"Nothing was written — a before-handler vetoed it.","ai.scope":"Scope: {scope}","ai.unsafeQuery":"I could not turn that into a safe query: {why}","ai.nothingToDo":"nothing to do","ai.insightsFailed":"Could not generate insights right now. The grid is unaffected.","ai.modelUnreachable":"Could not reach the model right now. The grid is unaffected.","ai.flagged":{one:"{count} unverified figure was removed as ungrounded.",other:"{count} unverified figures were removed as ungrounded."},"ai.askPlaceholder":"Ask your data: “EMEA deals over 50k, biggest first”","ai.askLabel":"Ask your data","ai.actorPlaceholder":"Ask AI to change data: “set the Network Upgrade project to In Progress”","ai.actorLabel":"Ask AI to change data","editor.password.show":"Show value","editor.password.hide":"Hide value","editor.password.showField":"Show {column}","editor.password.hideField":"Hide {column}","facets.computing":"Computing…","facets.suppressed.cardinality":"Too many distinct values to chart","facets.suppressed.rows":"Too many rows to chart","facets.suppressed.streaming":"Paused while live data is streaming","facets.suppressed.noProvider":"No distribution available for this data source","facets.suppressed.type":"This column has no chartable distribution","facets.bucketOf":"{count} of {whole} rows","history.undo":"Undo","history.redo":"Redo","history.described":"{action} {label}","history.nothingToUndo":"Nothing to undo","history.nothingToRedo":"Nothing to redo","history.undoDisabled":"Undo (nothing to undo)","history.redoDisabled":"Redo (nothing to redo)","a11y.presence.joined":"{name} joined","a11y.presence.left":"{name} left","prompt.asking":"Asking…","prompt.moreNotes":{one:"and {count} more",other:"and {count} more"},"shortcuts.key.cmd":"Cmd","timeline.live":"Live","timeline.recording":"recording…","panel.zoneHint.group":"Drag a column here to group rows by its values","panel.zoneHint.values":"Drag a column here to total it","panel.zoneHint.pivot":"Drag a column here to pivot across its values","panel.zoneHint.any":"Drag a column here","panel.rowsOf":"{shown} of {total} rows","views.empty":"No saved views yet. Set the grid up as you want it, then save it below.","views.applied":"Applied","views.matchesGrid":"Matches the grid as it is","views.delete":"Delete","views.confirmDelete":"Delete {name}?","views.confirmDeleteLabel":"Confirm deleting {name}","gantt.row.expand":"Expand {name}","gantt.row.collapse":"Collapse {name}","gantt.resource.over":"{name} — over-allocated","kanban.board":"Board","kanban.requiredTitle":"Required fields","kanban.requiredSave":"Save","kanban.requiredCancel":"Cancel","kpi.status.good":"good","kpi.status.warn":"warn","kpi.status.critical":"critical","kpi.status.unknown":"No data","kpi.node.item":"{count} item","kpi.node.items":"{count} items","kpi.node.worst":"worst status {status}","kpi.node.unknown":"{count} unknown"}),z=Object.freeze(Object.keys(q))}),Ue("packages/core/src/i18n/format.js",function(e,U){"use strict";Object.defineProperty(e,"formatList",{enumerable:!0,get:function(){return X}}),Object.defineProperty(e,"formatMessage",{enumerable:!0,get:function(){return G}}),Object.defineProperty(e,"resolveLocale",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"lookup",{enumerable:!0,get:function(){return k}});const E=U("packages/core/src/internal/predicates.js").isFunction,q=/\{(\w+)\}/g,z=new Map,_=new Map;function Z(g){const c=g||"";if(z.has(c))return z.get(c);let d=null;try{d=new Intl.PluralRules(g||void 0)}catch{d=null}return z.set(c,d),d}function X(g,c,d="conjunction"){const l=Array.isArray(g)?g.filter(a=>a!=null&&a!==""):[];if(l.length===0)return"";if(l.length===1)return String(l[0]);const i=`${c||""}|${d}`;let n=_.get(i);if(n===void 0){try{n=new Intl.ListFormat(c||void 0,{style:"long",type:d})}catch{n=null}_.set(i,n)}return n?n.format(l.map(String)):l.map(String).join(", ")}function B(g,c){return g==null?"":typeof g=="number"?Number.isFinite(g)?g.toLocaleString(c||void 0,{maximumFractionDigits:20}):"":String(g)}function Y(g,c,d){if(typeof g=="string")return g;if(!g||typeof g!="object")return"";const l=c&&typeof c.count=="number"?c.count:null;if(l===null)return g.other??"";const i=Z(d),n=i?i.select(l):l===1?"one":"other";return g[n]??g.other??""}function G(g,c={},d){const l=Y(g,c,d);return l?l.replace(q,(i,n)=>Object.prototype.hasOwnProperty.call(c,n)?B(c[n],d):i):""}function j(g,c,d="en-GB"){return typeof g=="string"&&g?g:typeof c=="string"&&c?c:d}function k(g,c){const d=g?g[c]:void 0;return d==null||E(d)?c:d}}),Ue("packages/core/src/i18n/registry.js",function(e,U){"use strict";Object.defineProperty(e,"registerLocale",{enumerable:!0,get:function(){return z}}),Object.defineProperty(e,"localeCatalogue",{enumerable:!0,get:function(){return _}}),Object.defineProperty(e,"registeredTags",{enumerable:!0,get:function(){return Z}});const E=U("packages/core/src/i18n/catalogue.js").EN_GB,q=new Map([["en-gb",E]]);function z(X,B){const Y=typeof X=="string"?X.toLowerCase():"";return!Y||!B||typeof B!="object"?!1:(q.set(Y,B),!0)}function _(X){if(typeof X!="string"||!X)return null;const B=X.toLowerCase(),Y=q.get(B);if(Y)return Y;const G=B.split("-")[0],j=q.get(G);if(j)return j;for(const[k,g]of q)if(k.split("-")[0]===G)return g;return null}function Z(){return[...q.keys()]}}),Ue("packages/core/src/i18n/index.js",function(e,U){"use strict";Object.defineProperty(e,"DEFAULT_LOCALE",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"Messages",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"defaultMessages",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"createMessages",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"auditCatalogue",{enumerable:!0,get:function(){return s}});const te=U("packages/core/src/i18n/catalogue.js"),E=te.EN_GB,q=te.MESSAGE_KEYS,z=U("packages/core/src/i18n/format.js"),_=z.formatMessage,Z=z.formatList,X=z.lookup,B=z.resolveLocale,G=U("packages/core/src/internal/predicates.js").isFunction,k=U("packages/core/src/internal/warn.js").warnOnce,g=U("packages/core/src/i18n/registry.js"),c=g.registerLocale,d=g.localeCatalogue;Object.defineProperty(e,"EN_GB",{enumerable:!0,get:function(){return te.EN_GB}}),Object.defineProperty(e,"MESSAGE_KEYS",{enumerable:!0,get:function(){return te.MESSAGE_KEYS}}),Object.defineProperty(e,"formatList",{enumerable:!0,get:function(){return z.formatList}}),Object.defineProperty(e,"resolveLocale",{enumerable:!0,get:function(){return z.resolveLocale}}),Object.defineProperty(e,"registerLocale",{enumerable:!0,get:function(){return g.registerLocale}});const l="en-GB";class i{#e=l;#t=E;constructor(u={}){this.configure(u)}configure(u={}){this.#e=B(u.locale,u.declared,l);const r=u.messages,o=d(this.#e);if(!o&&this.#e.toLowerCase()!=="en-gb"&&(!r||typeof r!="object")&&k(`i18n:locale:not-loaded:${this.#e.toLowerCase()}`,`locale "${this.#e}" is not loaded: import "@toclocoinc/lattice-grid/locales/${this.#e}" to add its text; English is used until then.`),!r||typeof r!="object"){this.#t=o?{...E,...o}:E;return}const w=Object.keys(r).filter(m=>!(m in E));w.length&&k(`i18n:unknown:${w[0]}`,`message keys not in the catalogue and so ignored: ${w.slice(0,5).join(", ")}${w.length>5?`, and ${w.length-5} more`:""}`),this.#t={...E,...o||{},...r}}get locale(){return this.#e}t(u,r){return _(X(this.#t,u),r||{},this.#e)}list(u,r){return Z(u,this.#e,r)}number(u,r){const o=Number(u);return Number.isFinite(o)?o.toLocaleString(this.#e,r||{maximumFractionDigits:20}):""}}const n=new i;function a(t){return t instanceof i?t:new i(t||{})}function s(t){const u=t&&typeof t=="object"?t:{},r=q.filter(f=>{const w=u[f];return w==null||w===""||G(w)}),o=Object.keys(u).filter(f=>!(f in E));return{missing:r,unknown:o}}}),Ue("packages/core/src/columns/types/structured.js",function(e,U){"use strict";Object.defineProperty(e,"MASK_DEFAULTS",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"maskValue",{enumerable:!0,get:function(){return X}}),Object.defineProperty(e,"summariseJson",{enumerable:!0,get:function(){return G}}),Object.defineProperty(e,"canonicalJson",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"parseJsonText",{enumerable:!0,get:function(){return g}}),Object.defineProperty(e,"STRUCTURED_TYPES",{enumerable:!0,get:function(){return d}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return l}});const te=U("packages/core/src/internal/predicates.js"),E=te.isNil,q=te.isObject,_=U("packages/core/src/i18n/index.js").defaultMessages,Z=Object.freeze({char:"•",length:8,fixedLength:!0,lastVisible:0,emptyDisplay:""});function X(i,n){const a=n||{},s=a.emptyDisplay??Z.emptyDisplay;if(E(i)||i==="")return s;const u=[...typeof a.char=="string"&&a.char!==""?a.char:Z.char][0]||Z.char,r=a.fixedLength??Z.fixedLength,o=Number.isFinite(a.length)&&Number(a.length)>0?Math.floor(Number(a.length)):Z.length,f=typeof i=="string"?i:typeof i=="number"||typeof i=="boolean"||typeof i=="bigint"?String(i):null;let w=0;if(f!==null){const m=Number.isFinite(a.lastVisible)?Math.floor(Number(a.lastVisible)):Z.lastVisible,v=[...f];if(w=m>0&&m<v.length?m:0,w>0){const h=v.slice(v.length-w).join(""),p=Math.max(1,(r?o:v.length)-w);return u.repeat(p)+h}return u.repeat(r?o:Math.max(1,v.length))}return u.repeat(o)}const B=48;function Y(i){try{const n=JSON.stringify(i);return n===void 0?null:n}catch{return null}}function G(i,n){if(E(i))return"";const a=Number.isFinite(n&&n.inlineLimit)?Number(n.inlineLimit):B;if(typeof i=="string")return i.length>a?`${i.slice(0,a-1)}…`:i;if(typeof i!="object")return String(i);const s=Y(i);if(s!==null&&s.length<=a)return s;if(Array.isArray(i)){const u=i.length;return`[${_.t("count.items",{count:u})}]`}const t=Object.keys(i).length;return`{${_.t("count.keys",{count:t})}}`}function j(i,n){if(i==null)return"null";const a=typeof i;if(a==="number"||a==="boolean"||a==="bigint")return String(i);if(a==="string")return JSON.stringify(i);if(a!=="object")return JSON.stringify(String(i));const s=n||new WeakSet;return s.has(i)?'"[circular]"':(s.add(i),i instanceof Date?JSON.stringify(i.toISOString()):Array.isArray(i)?`[${i.map(r=>j(r,s)).join(",")}]`:`{${Object.keys(i).sort().map(r=>`${JSON.stringify(r)}:${j(i[r],s)}`).join(",")}}`)}function k(i,n){if(E(i))return E(n)?0:1;if(E(n))return-1;const a=j(i),s=j(n);return a<s?-1:a>s?1:0}function g(i){if(E(i))return null;const n=String(i);if(n.trim()==="")return null;try{return JSON.parse(n)}catch{return n}}function c(i){const n=i&&i.cell&&i.cell.props;return q(n)?n:{}}const d=Object.freeze({json:{base:"object",storage:"object",format:i=>G(i&&i.value,c(i&&i.column)),parse:i=>g(i&&i.text),compare:k,defaults:{editor:"code",filter:"text",align:"start"},excel:"@",toClipboard:i=>{if(E(i))return"";if(typeof i=="string")return i;try{const n=JSON.stringify(i,null,2);return n===void 0?String(i):n}catch{return String(i)}},fromClipboard:i=>g(i)},secret:{base:"text",storage:"object",format:i=>X(i&&i.value,c(i&&i.column)),parse:i=>{const n=i&&i.text;return E(n)||String(n)===""?null:String(n)},compare:(i,n)=>{const a=E(i)||i==="",s=E(n)||n==="";return a===s?0:a?1:-1},defaults:{editor:"password",filter:"none",align:"start"},excel:"@",export:{csv:!1,excel:!1},toClipboard:i=>X(i),fromClipboard:i=>E(i)||String(i)===""?null:String(i)}}),l=d}),Ue("packages/core/src/columns/types/unit.js",function(e,U){"use strict";Object.defineProperty(e,"defineUnit",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"UNIT_SYSTEMS",{enumerable:!0,get:function(){return X}}),Object.defineProperty(e,"registerUnitSystem",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"unitSystemNames",{enumerable:!0,get:function(){return k}}),Object.defineProperty(e,"unitsOf",{enumerable:!0,get:function(){return g}}),Object.defineProperty(e,"findUnit",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"localeSeparators",{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,"parseUnit",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"formatUnit",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"createUnitType",{enumerable:!0,get:function(){return $}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return C}});const E=U("packages/core/src/internal/predicates.js").isNil,z=U("packages/core/src/internal/warn.js").warnOnce;function _(A,S,x,H){return Object.freeze({symbol:A,factor:S,aliases:Object.freeze(x||[]),binary:!!(H&&H.binary),prefix:H&&H.prefix||null,auto:!(H&&H.auto===!1)})}function Z(A,S,x,H){return _(A,S,x,H)}const X=Object.freeze({data:Object.freeze([_("B",1,["byte","bytes"]),_("kB",1e3,["kilobyte","kilobytes"],{prefix:"k"}),_("KiB",1024,["kibibyte","kibibytes"],{binary:!0,prefix:"k"}),_("MB",1e6,["megabyte","megabytes"],{prefix:"m"}),_("MiB",1024**2,["mebibyte","mebibytes"],{binary:!0,prefix:"m"}),_("GB",1e9,["gigabyte","gigabytes"],{prefix:"g"}),_("GiB",1024**3,["gibibyte","gibibytes"],{binary:!0,prefix:"g"}),_("TB",1e12,["terabyte","terabytes"],{prefix:"t"}),_("TiB",1024**4,["tebibyte","tebibytes"],{binary:!0,prefix:"t"}),_("PB",1e15,["petabyte","petabytes"],{prefix:"p"})]),bitrate:Object.freeze([_("bps",1,["bit","bits","bit/s","b/s"]),_("kbps",1e3,["kbit","kbits","kbit/s","kb/s","kilobit","kilobits"],{prefix:"k"}),_("Mbps",1e6,["mbit","mbits","mbit/s","mb/s","megabit","megabits"],{prefix:"m"}),_("Gbps",1e9,["gbit","gbits","gbit/s","gb/s","gigabit","gigabits"],{prefix:"g"}),_("Tbps",1e12,["tbit","tbits","tbit/s","tb/s","terabit","terabits"],{prefix:"t"})]),length:Object.freeze([_("nm",1e-9,["nanometre","nanometres","nanometer","nanometers"]),_("µm",1e-6,["um","micrometre","micrometres","micrometer","micrometers","micron","microns"]),_("mm",.001,["millimetre","millimetres","millimeter","millimeters"]),_("cm",.01,["centimetre","centimetres","centimeter","centimeters"]),_("in",.0254,["inch","inches"],{auto:!1}),_("ft",.3048,["foot","feet"],{auto:!1}),_("yd",.9144,["yard","yards"],{auto:!1}),_("m",1,["metre","metres","meter","meters"]),_("km",1e3,["kilometre","kilometres","kilometer","kilometers"]),_("mi",1609.344,["mile","miles"],{auto:!1}),_("nmi",1852,["nauticalmile","nauticalmiles"],{auto:!1})]),mass:Object.freeze([_("mg",.001,["milligram","milligrams"]),_("g",1,["gram","grams"]),_("oz",28.349523125,["ounce","ounces"],{auto:!1}),_("lb",453.59237,["pound","pounds","lbs"],{auto:!1}),_("kg",1e3,["kilogram","kilograms"]),_("st",6350.29318,["stone"],{auto:!1}),_("t",1e6,["tonne","tonnes","ton"],{auto:!1}),_("ton (US)",907184.74,["ton","shortton"],{auto:!1}),_("ton (UK)",10160469088e-4,["ton","longton"],{auto:!1})]),duration:Object.freeze([_("ns",1e-9,["nsec","nsecs","nanosecond","nanoseconds"]),_("µs",1e-6,["us","usec","usecs","microsecond","microseconds"]),_("ms",.001,["msec","msecs","millisecond","milliseconds"]),_("s",1,["sec","secs","second","seconds"]),_("m",60,["min","mins","minute","minutes"]),_("h",3600,["hr","hrs","hour","hours"]),_("d",86400,["day","days"])]),speed:Object.freeze([_("mm/s",.001,["millimetre/s","millimeter/s"]),_("ft/s",.3048,["fps","foot/s","feet/s"],{auto:!1}),_("km/h",1/3.6,["kph","kmh","kilometre/h","kilometer/h"],{auto:!1}),_("mph",.44704,["mile/h","miles/h"],{auto:!1}),_("kn",1852/3600,["knot","knots"],{auto:!1}),_("m/s",1,["metre/s","meter/s","mps"]),_("km/s",1e3,["kilometre/s","kilometer/s"])]),acceleration:Object.freeze([_("mm/s²",.001,["mm/s2"]),_("ft/s²",.3048,["ft/s2"],{auto:!1}),_("m/s²",1,["m/s2","metre/s2","meter/s2"]),_("g",9.80665,["gee","gravity"],{auto:!1})]),area:Object.freeze([_("mm²",1e-6,["mm2"]),_("cm²",1e-4,["cm2"]),_("in²",64516e-8,["in2","sqin"],{auto:!1}),_("ft²",.09290304,["ft2","sqft"],{auto:!1}),_("yd²",.83612736,["yd2","sqyd"],{auto:!1}),_("m²",1,["m2","sqm"]),_("ha",1e4,["hectare","hectares"],{auto:!1}),_("ac",4046.8564224,["acre","acres"],{auto:!1}),_("km²",1e6,["km2","sqkm"])]),volume:Object.freeze([_("µL",1e-6,["ul","microlitre","microliter"]),_("mL",.001,["millilitre","milliliter"]),_("fl oz (US)",.0295735295625,["fl oz","usfloz"],{auto:!1}),_("fl oz (imp)",.0284130625,["fl oz","impfloz"],{auto:!1}),_("L",1,["litre","litres","liter","liters"]),_("gal (US)",3.785411784,["gal","usgal","usgallon"],{auto:!1}),_("gal (imp)",4.54609,["gal","impgal","impgallon"],{auto:!1}),_("m³",1e3,["m3","cubicmetre","cubicmeter","kl"],{auto:!1}),_("bbl",158.987294928,["barrel","barrels"],{auto:!1})]),energy:Object.freeze([_("eV",1602176634e-28,["electronvolt","electronvolts"],{auto:!1}),_("J",1,["joule","joules"]),_("cal",4.184,["calorie","calories"],{auto:!1}),_("kJ",1e3,["kilojoule","kilojoules"]),_("BTU",1055.05585262,["btu"],{auto:!1}),_("kcal",4184,["kilocalorie","kilocalories","Cal"],{auto:!1}),_("MJ",1e6,["megajoule","megajoules"]),_("kWh",36e5,["kilowatthour","kilowatthours"],{auto:!1}),_("GJ",1e9,["gigajoule","gigajoules"]),_("MWh",36e8,["megawatthour","megawatthours"],{auto:!1})]),power:Object.freeze([_("mW",.001,["milliwatt","milliwatts"]),_("W",1,["watt","watts"]),_("BTU/h",1055.05585262/3600,["btuh","btu/h"],{auto:!1}),_("kW",1e3,["kilowatt","kilowatts"]),_("hp",745.6998715822702,["horsepower"],{auto:!1}),_("MW",1e6,["megawatt","megawatts"]),_("GW",1e9,["gigawatt","gigawatts"])]),force:Object.freeze([_("mN",.001,["millinewton","millinewtons"]),_("N",1,["newton","newtons"]),_("lbf",4.4482216152605,["poundforce"],{auto:!1}),_("kgf",9.80665,["kilogramforce"],{auto:!1}),_("kN",1e3,["kilonewton","kilonewtons"]),_("MN",1e6,["meganewton","meganewtons"])]),pressure:Object.freeze([_("Pa",1,["pascal","pascals"]),_("mbar",100,["millibar"],{auto:!1}),_("inH₂O",249.0889,["inh2o"],{auto:!1}),_("mmHg",133.322387415,["torr"],{auto:!1}),_("kPa",1e3,["kilopascal","kilopascals"]),_("inHg",3386.388640341,["inhg"],{auto:!1}),_("psi",6894.757293168361,["lbf/in2"],{auto:!1}),_("bar",1e5,[],{auto:!1}),_("atm",101325,["atmosphere","atmospheres"],{auto:!1}),_("MPa",1e6,["megapascal","megapascals"]),_("GPa",1e9,["gigapascal","gigapascals"])]),torque:Object.freeze([_("N·m",1,["nm","n.m","newtonmetre","newtonmeter"]),_("lbf·ft",1.3558179483314003,["lbfft","lbf.ft","ftlb","ft-lb"],{auto:!1}),_("kN·m",1e3,["knm","kn.m"],{auto:!1}),_("MN·m",1e6,["mnm","mn.m"],{auto:!1})]),density:Object.freeze([_("kg/m³",1,["kg/m3"]),_("lb/ft³",16.01846337396014,["lb/ft3","pcf"],{auto:!1}),_("g/cm³",1e3,["g/cm3","g/ml","kg/l"],{auto:!1}),_("t/m³",1e3,["t/m3"],{auto:!1})]),flow:Object.freeze([_("L/min",1/6e4,["lpm","l/min"],{auto:!1}),_("m³/h",1/3600,["m3/h","cmh"],{auto:!1}),_("gpm (US)",.003785411784/60,["gpm","usgpm"],{auto:!1}),_("gpm (imp)",.00454609/60,["gpm","impgpm"],{auto:!1}),_("cfm",.0004719474432,["ft3/min"],{auto:!1}),_("L/s",.001,["lps","l/s"],{auto:!1}),_("m³/s",1,["m3/s","cms"])]),angle:Object.freeze([_("″",Math.PI/648e3,["arcsec","arcsecond","arcseconds"],{auto:!1}),_("′",Math.PI/10800,["arcmin","arcminute","arcminutes"],{auto:!1}),_("mrad",.001,["milliradian","milliradians"],{auto:!1}),_("mil",Math.PI/3200,["nato-mil"],{auto:!1}),_("°",Math.PI/180,["deg","degree","degrees"],{auto:!1}),_("gon",Math.PI/200,["grad","gradian","gradians"],{auto:!1}),_("rad",1,["radian","radians"]),_("turn",2*Math.PI,["rev","revolution","revolutions"],{auto:!1})]),angularVelocity:Object.freeze([_("°/s",Math.PI/180,["degps","deg/s","degrees/s"],{auto:!1}),_("rad/s",1,["radps","radians/s"]),_("rpm",2*Math.PI/60,["rev/min","r/min","revolutions/min"],{auto:!1}),_("rps",2*Math.PI,["rev/s","r/s","revolutions/s"],{auto:!1})]),fraction:Object.freeze([_("ppt",1e-12,["partspertrillion"],{auto:!1}),_("ppb",1e-9,["partsperbillion"]),_("ppm",1e-6,["partspermillion"]),_("bp",1e-4,["bps-finance","basispoint","basispoints","bips"],{auto:!1}),_("‰",.001,["permille","permil"],{auto:!1}),_("%",.01,["pct","percent"]),_("×",1,["x","ratio","times"])]),molarity:Object.freeze([_("pM",1e-12,["picomolar","picomolarity"]),_("nM",1e-9,["nanomolar","nanomolarity"]),_("µM",1e-6,["um-molar","micromolar","micromolarity"]),_("mM",.001,["millimolar","millimolarity"]),_("M",1,["molar","mol/l","mol/L","molarity"]),_("mol/m³",.001,["mol/m3"],{auto:!1})]),massFlow:Object.freeze([_("mg/s",1e-6,["milligrams/s"]),_("g/s",.001,["grams/s"]),_("kg/h",1/3600,["kilograms/h","kgph"],{auto:!1}),_("kg/s",1,["kilograms/s","kgps"]),_("t/h",1e3/3600,["tonnes/h","tph"],{auto:!1}),_("lb/h",.45359237/3600,["pounds/h","pph"],{auto:!1}),_("t/s",1e3,["tonnes/s"],{auto:!1})]),viscosity:Object.freeze([_("µPa·s",1e-6,["upas","micropascalsecond"]),_("cP",.001,["centipoise"],{auto:!1}),_("mPa·s",.001,["mpas","millipascalsecond"]),_("P",.1,["poise"],{auto:!1}),_("Pa·s",1,["pas","pascalsecond"])]),kinematicViscosity:Object.freeze([_("cSt",1e-6,["centistokes","centistoke"]),_("mm²/s",1e-6,["mm2/s"],{auto:!1}),_("St",1e-4,["stokes","stoke"],{auto:!1}),_("m²/s",1,["m2/s"])]),thermalConductivity:Object.freeze([_("mW/(m·K)",.001,["mw/mk"]),_("W/(m·K)",1,["w/mk","wmk"]),_("kW/(m·K)",1e3,["kw/mk"],{auto:!1}),_("BTU/(hr·ft·°F)",1.730734666,["btu/hrftf"],{auto:!1})]),specificHeat:Object.freeze([_("J/(kg·K)",1,["j/kgk","jkgk"]),_("kJ/(kg·K)",1e3,["kj/kgk"]),_("cal/(g·°C)",4184,["cal/gc"],{auto:!1})]),doseRate:Object.freeze([_("nSv/h",1e-9,["nsvh"]),_("µSv/h",1e-6,["usv/h","usvh"]),_("mSv/h",.001,["msvh"]),_("Sv/h",1,["svh"]),_("mSv/a",.001/8766,["msv/year","msvpa"],{auto:!1})])}),B=Symbol("ambiguous"),Y=new Map,G=new Map;function j(A,S){const x=String(A||"").trim();if(!x)throw new Error("[lattice] a unit system needs a name");if(X[x]||G.has(x))throw new Error(`[lattice] unit system "${x}" already exists`);const H=[...S||[]];if(!H.length)throw new Error(`[lattice] unit system "${x}" has no units`);if(!H.some(W=>W.factor===1))throw new Error(`[lattice] unit system "${x}" has no base unit (none with factor 1)`);const V=new Set;for(const W of H){if(V.has(W.symbol))throw new Error(`[lattice] unit system "${x}" declares "${W.symbol}" twice`);V.add(W.symbol)}return G.set(x,Object.freeze(H)),Y.delete(x),x}function k(){return[...Object.keys(X),...G.keys()]}function g(A){const S=c(A);return S?S.units:[]}function c(A){const S=String(A||""),x=Y.get(S);if(x!==void 0)return x;const H=X[S]||G.get(S);if(!H)return Y.set(S,null),null;const V=Object.freeze([...H].sort((ae,ue)=>ae.factor-ue.factor)),W=new Map,Q=new Map,ee=(ae,ue)=>{const ge=W.get(ae);ge===void 0?W.set(ae,ue):ge!==ue&&W.set(ae,B)};for(const ae of V){ee(ae.symbol.toLowerCase(),ae);for(const ue of ae.aliases)ee(ue.toLowerCase(),ae);if(ae.prefix){const ue=Q.get(ae.prefix)||[];ue.push(ae),Q.set(ae.prefix,ue)}}const re={units:V,byToken:W,byPrefix:Q,decimal:V.filter(ae=>!ae.binary&&ae.auto),binary:V.some(ae=>ae.binary)?V.filter(ae=>(ae.binary||ae.factor===1)&&ae.auto):null};return Y.set(S,re),re}function d(A,S){return S&&A.binary||A.decimal}function l(A,S){const x=c(A);if(!x||E(S))return null;const H=x.units.find(W=>W.symbol===String(S));if(H)return H;const V=x.byToken.get(String(S).trim().toLowerCase());return V&&V!==B?V:null}const i=new WeakMap;function n(A){const S=A||{};if(typeof S=="object"&&S!==null){const W=i.get(S);if(W!==void 0)return W}const x=S.system||"data",H=c(x);let V=null;if(!H)z(`unit:system:${x}`,`unknown unit system "${x}"; known systems are ${k().join(", ")}`);else{let W=S.unit?l(x,S.unit):null;W||(S.unit&&z(`unit:unit:${x}:${S.unit}`,`unknown unit "${S.unit}" in system "${x}"; falling back to ${H.units[0].symbol}`),W=H.units.find(Q=>Q.factor===1)||H.units[0]),V={index:H,base:W,binary:S.binary===!0}}return typeof S=="object"&&S!==null&&i.set(S,V),V}const a=new WeakMap;function s(A,S){if(!A||!S||!Array.isArray(A.compound)||A.compound.length===0)return null;const x=a.get(A);if(x!==void 0)return x;const H=new Set,V=[];for(const Q of A.compound){const ee=l(A.system||"data",Q);if(!ee){z(`unit:compound:${A.system}:${Q}`,`unknown compound unit "${Q}" in system "${A.system||"data"}"; ignoring it`);continue}H.has(ee.symbol)||(H.add(ee.symbol),V.push(ee))}V.sort((Q,ee)=>ee.factor-Q.factor);const W=V.length>=2?V:null;return a.set(A,W),W}function t(A,S,x){return S===x||S.factor===x.factor?A:A*S.factor/x.factor}const u=new Map;function r(A){const S=A||"",x=u.get(S);if(x)return x;const H={group:",",decimal:"."};try{for(const V of new Intl.NumberFormat(A||void 0).formatToParts(12345.6))V.type==="group"?H.group=V.value:V.type==="decimal"&&(H.decimal=V.value)}catch{}return u.set(S,H),H}const o=/[\s ]/g,f=/^[+-]?[\d '’ .,]*(?:[eE][+-]?\d+)?/,w=/^[^\d+\-(.,\s]+\s*/,m=/^[+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?$/;function v(A,S){const{group:x,decimal:H}=r(S);let V=String(A).replace(o,"");if(V==="")return null;const W=H?V.indexOf(H):-1;if(x&&x!==H){if(W>=0&&V.indexOf(x,W+H.length)>=0)return null;V=V.split(x).join("")}if(H&&H!=="."&&(V=V.split(H).join(".")),!m.test(V))return null;const Q=Number(V);return Number.isFinite(Q)?Q:null}function h(A,S,x){const H=String(A).trim().replace(/\.$/,"");if(H==="")return null;const V=S.units.find(ue=>ue.symbol===H);if(V)return V;const W=H.toLowerCase(),Q=S.byToken.get(W);if(Q===B)return null;if(Q)return Q;const ee=S.byPrefix.get(W);if(!ee||!ee.length)return null;const re=d(S,x),ae=ee.filter(ue=>re.includes(ue));return ae.length===1?ae[0]:null}function p(A,S,x,H){let V=A,W=0,Q=!1,ee=!1;for(;V!=="";){const re=f.exec(V)[0];if(re==="")return null;const ae=v(re,H&&H.locale);if(ae===null)return null;V=V.slice(re.length).trim();const ue=V.search(/[+-]?[\d]/),ge=(ue>=0?V.slice(0,ue):V).trim();if(V=ue>=0?V.slice(ue).trim():"",ge===""){if(Q)return null;ee=!0,W+=t(ae,x[0],S.base)}else{const Ae=h(ge,S.index,S.binary);if(!Ae)return null;W+=t(ae,Ae,S.base)}if(Q=!0,ee&&V!=="")return null}return Q?W:null}function b(A,S){if(E(A))return null;if(typeof A=="number")return Number.isFinite(A)?A:null;const x=n(S);if(!x)return null;let H=String(A).trim();if(H==="")return null;let V=!1;H.startsWith("(")&&H.endsWith(")")&&(V=!0,H=H.slice(1,-1).trim());const W=s(S,x);if(W){H.startsWith("-")&&(V=!0,H=H.slice(1).trim());const pe=p(H,x,W,S);return pe===null?null:V?-pe:pe}let Q=null;const ee=w.exec(H);if(ee&&ee[0]){const pe=h(ee[0].trim(),x.index,x.binary);pe&&(Q=pe,H=H.slice(ee[0].length).trim())}const re=f.exec(H)[0],ae=v(re,S&&S.locale);if(ae===null)return null;const ue=H.slice(re.length).trim();if(Q&&ue!=="")return null;const ge=Q||(ue===""?x.base:h(ue,x.index,x.binary));if(!ge)return null;const Ae=t(ae,ge,x.base);return V?-Ae:Ae}const O=new Map;function y(A,S,x,H){const V=`${A||""}|${S}|${x}|${H?1:0}`;let W=O.get(V);return W||(W=new Intl.NumberFormat(A||void 0,{minimumFractionDigits:S,maximumFractionDigits:x,useGrouping:H}),O.set(V,W)),W}function L(A,S){if(!Number.isFinite(A)||A===0)return Math.max(0,S-1);const x=Math.floor(Math.log10(Math.abs(A)));return Math.min(20,Math.max(0,S-1-x))}function M(A,S){if(!Number.isFinite(A)||A===0)return A;const x=Math.ceil(Math.log10(Math.abs(A))),H=10**(S-x);return Math.round(A*H)/H}function D(A,S,x){if(!x||x===S.base.symbol)return S.base;if(x!=="auto")return F(S,x);if(A===0||!Number.isFinite(A))return S.base;const H=Math.abs(A)*S.base.factor,V=d(S.index,S.binary);let W=V[0];for(const re of V)H>=re.factor&&(W=re);if(H>=W.factor)return W;let Q=W;for(const re of S.index.units)re.binary!==S.binary&&re.factor!==1||re.factor<=H&&re.factor>(Q===W?0:Q.factor)&&(Q=re);if(Q!==W)return Q;let ee=W;for(const re of S.index.units)re.binary!==S.binary&&re.factor!==1||re.factor<ee.factor&&(ee=re);return ee.factor<S.base.factor?ee:S.base}function F(A,S){const x=A.index.units.find(V=>V.symbol===S);if(x)return x;const H=A.index.byToken.get(String(S).toLowerCase());return H&&H!==B?H:(z(`unit:display:${S}`,`unknown display unit "${S}"; rendering in ${A.base.symbol}`),A.base)}function T(A,S,x,H){const V=A<0;let W=Math.abs(A)*S.base.factor;const Q=typeof H.decimals=="number"?H.decimals:H.minDecimals??0,ee=typeof H.decimals=="number"?H.decimals:H.maxDecimals??Math.max(Q,2),re=H.space??" ",ae=[];for(let ge=0;ge<x.length;ge++){const Ae=x[ge],pe=ge===x.length-1;let Me=pe?W/Ae.factor:Math.floor(W/Ae.factor);if(W-=Me*Ae.factor,pe){const Pe=10**ee;Me=Math.round(Me*Pe)/Pe+0}const Ne=pe?y(H.locale,Q,ee,H.group!==!1):y(H.locale,0,0,H.group!==!1);ae.push(`${Ne.format(Me)}${re}${Ae.symbol}`)}const ue=ae.join(" ");return V?`-${ue}`:ue}function I(A,S){const x=S||{},H=x.nullDisplay??"";if(E(A)||A==="")return H;const V=typeof A=="number"?A:Number(A);if(!Number.isFinite(V))return H;const W=n(x);if(!W)return String(V);const Q=s(x,W);if(Q)return T(V,W,Q,x);const ee=typeof x.significantFigures=="number"&&x.significantFigures>0?x.significantFigures:0,re=ee?M(V,ee):V,ae=D(re,W,x.display),ue=t(re,W.base,ae);let ge=typeof x.decimals=="number"?x.decimals:x.minDecimals??0,Ae=typeof x.decimals=="number"?x.decimals:x.maxDecimals??Math.max(ge,2);ee&&(ge=L(ue,ee),Ae=ge);const pe=y(x.locale,ge,Ae,x.group!==!1).format(ue),Me=x.space??" ";return x.placement==="prefix"?`${ae.symbol}${x.space??""}${pe}`:`${pe}${Me}${ae.symbol}`}function P(A,S){const x=E(A)||Number.isNaN(A)?null:Number(A),H=E(S)||Number.isNaN(S)?null:Number(S);return x===null||Number.isNaN(x)?H===null||Number.isNaN(H)?0:1:H===null||Number.isNaN(H)||x<H?-1:x>H?1:0}function R(A){const S=typeof A.decimals=="number"&&A.decimals>0?`.${"0".repeat(A.decimals)}`:"";return`${typeof A.decimals=="number"?`#,##0${S}`:"#,##0.##"}" ${A.symbol}"`}function $(A){const S={system:"data",...A||{}},x=n(S),H=x?x.base.symbol:String(S.unit||""),V=Object.freeze({...S,unit:H}),W=Object.freeze({...V,display:H,decimals:void 0,minDecimals:0,maxDecimals:20,group:!1}),Q=new Map([[V.locale||"",V]]),ee=re=>{const ae=re||"";let ue=Q.get(ae);return ue||(ue=Object.freeze({...V,locale:re||void 0}),Q.set(ae,ue)),ue};return{base:"number",extends:"number",storage:"float64",unitConfig:V,format:re=>I(re.value,re.locale?ee(re.locale):V),parse:re=>b(re.text,re.locale?ee(re.locale):V),compare:P,defaults:{filter:"number",editor:"unit",align:"end",total:S.total||"sum"},...S.totals?{totals:S.totals}:{},excel:S.excel||R({decimals:S.decimals,symbol:H}),toStorage:re=>typeof re=="number"?Number.isFinite(re)?re:null:typeof re=="string"?b(re,V):E(re)?null:b(String(re),V),toClipboard:re=>I(re,W),fromClipboard:re=>b(re,V)}}const C=$}),Ue("packages/core/src/columns/types/engineering.js",function(e,U){"use strict";Object.defineProperty(e,"ENGINEERING_TYPES",{enumerable:!0,get:function(){return X}}),Object.defineProperty(e,"circularMean",{enumerable:!0,get:function(){return _}});const E=U("packages/core/src/internal/predicates.js").isNil,z=U("packages/core/src/columns/types/unit.js").createUnitType;function _(B){const Y=2*Math.PI/B;return G=>{let j=0,k=0,g=0;for(const d of G||[]){if(E(d))continue;const l=Number(d);Number.isFinite(l)&&(j+=Math.cos(l*Y),k+=Math.sin(l*Y),g+=1)}return!g||Math.hypot(j,k)/g<1e-12?null:(Math.atan2(k,j)/Y%B+B)%B}}function Z(B){return{supported:["sum","avg","min","max","count","countValues"],implement:{avg:_(B)}}}const X=Object.freeze({metres:z({system:"length",unit:"m",display:"auto",maxDecimals:3}),millimetres:z({system:"length",unit:"mm",maxDecimals:2}),kilometres:z({system:"length",unit:"km",maxDecimals:3}),grams:z({system:"mass",unit:"g",display:"auto",maxDecimals:3}),kilograms:z({system:"mass",unit:"kg",maxDecimals:3}),tonnes:z({system:"mass",unit:"t",maxDecimals:3}),seconds:z({system:"duration",unit:"s",display:"auto",maxDecimals:3}),milliseconds:z({system:"duration",unit:"ms",maxDecimals:3}),hours:z({system:"duration",unit:"h",maxDecimals:2}),speed:z({system:"speed",unit:"m/s",display:"auto",maxDecimals:2}),kph:z({system:"speed",unit:"km/h",maxDecimals:1}),mph:z({system:"speed",unit:"mph",maxDecimals:1}),knots:z({system:"speed",unit:"kn",maxDecimals:1}),acceleration:z({system:"acceleration",unit:"m/s²",maxDecimals:3}),area:z({system:"area",unit:"m²",display:"auto",maxDecimals:2}),hectares:z({system:"area",unit:"ha",maxDecimals:4}),volume:z({system:"volume",unit:"L",display:"auto",maxDecimals:3}),cubicMetres:z({system:"volume",unit:"m³",maxDecimals:3}),energy:z({system:"energy",unit:"J",display:"auto",maxDecimals:3}),kilowattHours:z({system:"energy",unit:"kWh",maxDecimals:2}),power:z({system:"power",unit:"W",display:"auto",maxDecimals:2}),kilowatts:z({system:"power",unit:"kW",maxDecimals:2}),force:z({system:"force",unit:"N",display:"auto",maxDecimals:2}),pressure:z({system:"pressure",unit:"Pa",display:"auto",maxDecimals:2}),bar:z({system:"pressure",unit:"bar",maxDecimals:3}),psi:z({system:"pressure",unit:"psi",maxDecimals:1}),torque:z({system:"torque",unit:"N·m",maxDecimals:2}),density:z({system:"density",unit:"kg/m³",maxDecimals:2}),flow:z({system:"flow",unit:"m³/s",maxDecimals:4}),litresPerMinute:z({system:"flow",unit:"L/min",maxDecimals:1}),radians:z({system:"angle",unit:"rad",maxDecimals:4,totals:Z(2*Math.PI)}),degrees:z({system:"angle",unit:"°",maxDecimals:2,totals:Z(360)}),rpm:z({system:"angularVelocity",unit:"rpm",maxDecimals:0}),angularVelocity:z({system:"angularVelocity",unit:"rad/s",maxDecimals:3}),ppm:z({system:"fraction",unit:"ppm",maxDecimals:2}),ppb:z({system:"fraction",unit:"ppb",maxDecimals:2}),basisPoints:z({system:"fraction",unit:"bp",maxDecimals:1}),molarity:z({system:"molarity",unit:"M",display:"auto",maxDecimals:3}),massFlow:z({system:"massFlow",unit:"kg/s",maxDecimals:3}),tonnesPerHour:z({system:"massFlow",unit:"t/h",maxDecimals:2}),viscosity:z({system:"viscosity",unit:"Pa·s",display:"auto",maxDecimals:3}),kinematicViscosity:z({system:"kinematicViscosity",unit:"cSt",maxDecimals:2}),thermalConductivity:z({system:"thermalConductivity",unit:"W/(m·K)",maxDecimals:3}),specificHeat:z({system:"specificHeat",unit:"J/(kg·K)",maxDecimals:1}),doseRate:z({system:"doseRate",unit:"µSv/h",display:"auto",maxDecimals:2})})}),Ue("packages/core/src/columns/types/si.js",function(e,U){"use strict";Object.defineProperty(e,"SI_PREFIXES",{enumerable:!0,get:function(){return _}}),Object.defineProperty(e,"siUnits",{enumerable:!0,get:function(){return X}}),Object.defineProperty(e,"createSiSystem",{enumerable:!0,get:function(){return B}}),Object.defineProperty(e,"createSiType",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(e,"SI_TYPES",{enumerable:!0,get:function(){return G}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return j}});const te=U("packages/core/src/columns/types/unit.js"),E=te.defineUnit,q=te.registerUnitSystem,z=te.createUnitType,_=Object.freeze([Object.freeze({symbol:"f",name:"femto",factor:1e-15}),Object.freeze({symbol:"p",name:"pico",factor:1e-12}),Object.freeze({symbol:"n",name:"nano",factor:1e-9}),Object.freeze({symbol:"µ",name:"micro",factor:1e-6}),Object.freeze({symbol:"m",name:"milli",factor:.001}),Object.freeze({symbol:"c",name:"centi",factor:.01}),Object.freeze({symbol:"",name:"",factor:1}),Object.freeze({symbol:"k",name:"kilo",factor:1e3}),Object.freeze({symbol:"M",name:"mega",factor:1e6}),Object.freeze({symbol:"G",name:"giga",factor:1e9}),Object.freeze({symbol:"T",name:"tera",factor:1e12}),Object.freeze({symbol:"P",name:"peta",factor:1e15})]),Z=Object.freeze(["p","n","µ","m","","k","M","G"]);function X(k){const g=String(k.base),c=new Set([...k.prefixes||Z,""]),d=[];for(const l of _){if(!c.has(l.symbol))continue;const i=`${l.symbol}${g}`,n=[];if(k.name){n.push(`${l.name}${k.name}`,`${l.name}${k.name}s`);const a=l.name.slice(-1);if(a&&k.name.startsWith(a)){const s=`${l.name.slice(0,-1)}${k.name}`;n.push(s,`${s}s`)}}l.symbol==="µ"&&n.push(`u${g}`),l.factor===1&&k.aliases&&n.push(...k.aliases),d.push(E(i,l.factor,n))}for(const l of k.extra||[])d.push(l);return d}function B(k,g){const c=X(g);return q(k,c)}function Y(k,g,c){return B(k,g),z({system:k,unit:g.base,display:"auto",maxDecimals:3,...c||{}})}const G=Object.freeze({voltage:Y("voltage",{base:"V",name:"volt"}),current:Y("current",{base:"A",name:"amp",aliases:["ampere","amperes"]}),resistance:Y("resistance",{base:"Ω",name:"ohm",aliases:["ohm","ohms","R"],prefixes:["m","","k","M","G"]}),capacitance:Y("capacitance",{base:"F",name:"farad",prefixes:["f","p","n","µ","m",""]}),inductance:Y("inductance",{base:"H",name:"henry",prefixes:["p","n","µ","m",""]}),charge:Y("charge",{base:"C",name:"coulomb",prefixes:["p","n","µ","m",""],extra:[E("mAh",3.6,["milliamphour","milliamphours"],{auto:!1}),E("Ah",3600,["amphour","amphours"],{auto:!1})]}),conductance:Y("conductance",{base:"S",name:"siemens",prefixes:["n","µ","m","","k"]}),fluxDensity:Y("fluxDensity",{base:"T",name:"tesla",prefixes:["n","µ","m",""],extra:[E("G",1e-4,["gauss"],{auto:!1})]}),luminousFlux:Y("luminousFlux",{base:"lm",name:"lumen",prefixes:["m","","k"]}),illuminance:Y("illuminance",{base:"lx",name:"lux",prefixes:["m","","k"]}),luminousIntensity:Y("luminousIntensity",{base:"cd",name:"candela",prefixes:["m","","k"]}),substance:Y("substance",{base:"mol",name:"mole",prefixes:["n","µ","m","","k"]}),absorbedDose:Y("absorbedDose",{base:"Gy",name:"gray",prefixes:["µ","m",""]}),equivalentDose:Y("equivalentDose",{base:"Sv",name:"sievert",prefixes:["n","µ","m",""]}),radioactivity:Y("radioactivity",{base:"Bq",name:"becquerel",prefixes:["","k","M","G","T"],extra:[E("Ci",37e9,["curie","curies"],{auto:!1})]}),frequency:Y("frequency",{base:"Hz",name:"hertz",prefixes:["m","","k","M","G","T"]})}),j=Y}),Ue("packages/core/src/columns/types/temperature.js",function(e,U){"use strict";Object.defineProperty(e,"TEMPERATURE_SCALES",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"findScale",{enumerable:!0,get:function(){return z}}),Object.defineProperty(e,"convertTemperature",{enumerable:!0,get:function(){return _}}),Object.defineProperty(e,"formatTemperature",{enumerable:!0,get:function(){return B}}),Object.defineProperty(e,"parseTemperature",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"createTemperatureType",{enumerable:!0,get:function(){return k}}),Object.defineProperty(e,"TEMPERATURE_TYPES",{enumerable:!0,get:function(){return g}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return c}});const E=U("packages/core/src/internal/predicates.js").isNil,q=Object.freeze({C:Object.freeze({symbol:"°C",aliases:["c","°c","celsius","centigrade"],toKelvin:d=>d+273.15,fromKelvin:d=>d-273.15}),F:Object.freeze({symbol:"°F",aliases:["f","°f","fahrenheit"],toKelvin:d=>(d+459.67)*(5/9),fromKelvin:d=>d*(9/5)-459.67}),K:Object.freeze({symbol:"K",aliases:["k","kelvin"],toKelvin:d=>d,fromKelvin:d=>d}),R:Object.freeze({symbol:"°R",aliases:["r","°r","rankine"],toKelvin:d=>d*(5/9),fromKelvin:d=>d*(9/5)})});function z(d){if(E(d))return null;const l=String(d).trim();if(l==="")return null;for(const[n,a]of Object.entries(q))if(l===n||l===a.symbol)return{key:n,scale:a};const i=l.toLowerCase();for(const[n,a]of Object.entries(q))if(a.aliases.includes(i))return{key:n,scale:a};return null}function _(d,l,i){const n=z(l),a=z(i);return!n||!a||!Number.isFinite(Number(d))?null:n.key===a.key?Number(d):a.scale.fromKelvin(n.scale.toKelvin(Number(d)))}const Z=new Map;function X(d,l,i){const n=`${d||""}|${l}|${i}`;let a=Z.get(n);return a||(a=new Intl.NumberFormat(d||void 0,{minimumFractionDigits:l,maximumFractionDigits:i}),Z.set(n,a)),a}function B(d,l){const i=l||{},n=i.nullDisplay??"";if(E(d)||d==="")return n;const a=Number(d);if(!Number.isFinite(a))return n;const s=z(i.scale||"C");if(!s)return String(a);const t=z(i.display||i.scale||"C")||s,u=t.key===s.key?a:t.scale.fromKelvin(s.scale.toKelvin(a)),r=typeof i.decimals=="number"?i.decimals:null,o=r??i.minDecimals??0,f=r??i.maxDecimals??1;return`${X(i.locale,o,f).format(u)}${i.space??" "}${t.scale.symbol}`}const Y=/^[+-]?[\d\s., ]*\d/;function G(d,l){const i=String(d).trim();if(i==="")return null;const n=new Intl.NumberFormat(l||void 0).formatToParts(1.1).find(u=>u.type==="decimal")?.value||".",a=n===","?".":",",s=i.split(a).join("").split(/[\s ]/).join("").replace(n,"."),t=Number(s);return Number.isFinite(t)?t:null}function j(d,l){if(E(d))return null;const i=l||{},n=z(i.scale||"C");if(!n)return null;if(typeof d=="number")return Number.isFinite(d)?d:null;let a=String(d).trim();if(a==="")return null;let s=!1;a.startsWith("(")&&a.endsWith(")")&&(s=!0,a=a.slice(1,-1).trim());const t=Y.exec(a);if(!t)return null;const u=G(t[0],i.locale);if(u===null)return null;const r=a.slice(t[0].length).trim();if(r==="")return s?-u:u;const o=z(r);if(!o)return null;const f=o.key===n.key?u:n.scale.fromKelvin(o.scale.toKelvin(u));return s?-f:f}function k(d){const l=Object.freeze({scale:"C",...d||{}}),n=(z(l.scale)||z("C")).scale.symbol,a=Object.freeze({...l,display:l.scale,decimals:void 0,minDecimals:0,maxDecimals:20}),s=new Map([[l.locale||"",l]]),t=u=>{const r=u||"";let o=s.get(r);return o||(o=Object.freeze({...l,locale:u||void 0}),s.set(r,o)),o};return{base:"number",extends:"number",storage:"float64",temperatureConfig:l,format:u=>B(u.value,u.locale?t(u.locale):l),parse:u=>j(u.text,u.locale?t(u.locale):l),defaults:{filter:"number",editor:"temperature",align:"end",total:"avg"},totals:{supported:["avg","min","max","count","countValues"]},excel:l.excel||`#,##0${typeof l.decimals=="number"&&l.decimals>0?`.${"0".repeat(l.decimals)}`:".#"}" ${n}"`,toStorage:u=>typeof u=="number"?Number.isFinite(u)?u:null:typeof u=="string"?j(u,l):E(u)?null:j(String(u),l),toClipboard:u=>B(u,a),fromClipboard:u=>j(u,l)}}const g=Object.freeze({celsius:k({scale:"C"}),fahrenheit:k({scale:"F"}),kelvin:k({scale:"K"})}),c=k}),Ue("packages/core/src/columns/types/radix.js",function(e,U){"use strict";Object.defineProperty(e,"RADIX_PRESETS",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"digitsForWidth",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"radixRange",{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,"radixName",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"normaliseRadixOptions",{enumerable:!0,get:function(){return w}}),Object.defineProperty(e,"compileRadixFormat",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"formatRadix",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"compileRadixParse",{enumerable:!0,get:function(){return O}}),Object.defineProperty(e,"parseRadixResult",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"parseRadix",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"createRadixType",{enumerable:!0,get:function(){return F}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return T}});const E=U("packages/core/src/internal/predicates.js").isNil,z=U("packages/core/src/internal/warn.js").warnOnce,_=Object.freeze({2:2,8:8,16:16,bin:2,binary:2,base2:2,oct:8,octal:8,base8:8,hex:16,hexadecimal:16,base16:16}),Z=Object.freeze({2:1,8:3,16:4}),X=Object.freeze({2:"0b",8:"0o",16:"0x"}),B=Object.freeze({2:4,8:3,16:2}),Y=Object.freeze({2:/^[01]+$/,8:/^[0-7]+$/,16:/^[0-9a-f]+$/i}),G=Object.freeze({2:"binary",8:"octal",16:"hexadecimal"}),j=Object.freeze([[/^0x/i,16],[/^0b/i,2],[/^0o/i,8],[/^#/,16]]),k=/[\s\u00a0\u202f_,']/g,g=/^\d+(?:\.\d+)?(?:e[+-]?\d+)?$/i,c=Object.freeze([8,16,32,53]),d=new WeakSet,l=new WeakMap,i=new Map,n=new WeakMap,a=new WeakMap,s=Object.freeze({hex:Object.freeze({radix:16}),hex8:Object.freeze({radix:16,bitWidth:8,pad:!0,signed:!1}),hex16:Object.freeze({radix:16,bitWidth:16,pad:!0,signed:!1}),hex32:Object.freeze({radix:16,bitWidth:32,pad:!0,signed:!1}),binary:Object.freeze({radix:2}),binary8:Object.freeze({radix:2,bitWidth:8,pad:!0,signed:!1,group:4}),octal:Object.freeze({radix:8})});function t(I){if(I==null)return 16;const P=typeof I=="string"?I.toLowerCase():I,R=_[P];return R||(z(`radix:base:${String(I)}`,`unsupported radix ${String(I)}; use 2, 8, 16, 'binary', 'octal' or 'hex'. Falling back to hex`),16)}function u(I,P){return Math.ceil(I/Z[P])}function r(I,P){if(!I)return P?{min:-Number.MAX_SAFE_INTEGER,max:Number.MAX_SAFE_INTEGER}:{min:0,max:Number.MAX_SAFE_INTEGER};if(!P)return{min:0,max:2**I-1};const R=2**(I-1);return{min:-R,max:R-1}}function o(I){return G[I]||"hexadecimal"}function f(I){if(typeof I=="string"){const P=s[I];return P||z(`radix:preset:${I}`,`unknown radix preset "${I}"; known presets are ${Object.keys(s).join(", ")}`),{...P||{}}}if(I&&typeof I.preset=="string"){const P=s[I.preset];return P||z(`radix:preset:${I.preset}`,`unknown radix preset "${I.preset}"; known presets are ${Object.keys(s).join(", ")}`),{...P||{},...I}}return I||{}}function w(I){const P=f(I),R=t(P.radix),$=Z[R];let C=null;if(P.bitWidth!==void 0&&P.bitWidth!==null&&P.bitWidth!==!1){const re=Number(P.bitWidth);c.includes(re)?C=re:z(`radix:width:${String(P.bitWidth)}`,`unsupported bitWidth ${String(P.bitWidth)}; use 8, 16, 32 or 53. Ignoring it`)}let A=P.signed!==!1;!A&&C===null&&(z("radix:unsigned:width","signed: false needs a bitWidth to render a two's-complement pattern; defaulting to 32"),C=32);const S=P.prefix===void 0||P.prefix===!0?X[R]:P.prefix===!1?"":String(P.prefix);let x=0;P.pad===!0?x=C?u(C,R):0:typeof P.pad=="number"&&P.pad>0&&(x=Math.floor(P.pad));let H=0;P.group===!0?H=B[R]:typeof P.group=="number"&&P.group>0&&(H=Math.floor(P.group));const V=r(C,A),W=typeof P.min=="number"?Math.max(V.min,P.min):V.min,Q=typeof P.max=="number"?Math.min(V.max,P.max):V.max,ee=Object.freeze({radix:R,bits:$,prefix:S,uppercase:P.uppercase!==!1,pad:x,group:H,groupSeparator:typeof P.groupSeparator=="string"?P.groupSeparator:" ",bitWidth:C,signed:A,min:W,max:Q<W?W:Q,nullDisplay:typeof P.nullDisplay=="string"?P.nullDisplay:"",name:o(R)});return d.add(ee),ee}function m(I){if(I&&d.has(I))return I;if(typeof I=="string"){let P=i.get(I);return P||(P=w(I),i.set(I,P)),P}if(I&&typeof I=="object"){let P=l.get(I);return P||(P=w(I),l.set(I,P)),P}return m("hex")}function v(I){return I<0?-Math.round(-I):Math.round(I)}function h(I,P,R){if(P<=0||I.length<=P)return I;const $=I.length%P||P,C=[I.slice(0,$)];for(let A=$;A<I.length;A+=P)C.push(I.slice(A,A+P));return C.join(R)}function p(I){const P=m(I),{radix:R,prefix:$,uppercase:C,pad:A,group:S,groupSeparator:x,signed:H,bitWidth:V,nullDisplay:W}=P,Q=V?2**V:0,ee=re=>{if(E(re)||re==="")return W;const ae=typeof re=="number"?re:Number(re);if(!Number.isFinite(ae))return W;const ue=v(ae);let ge="",Ae=ue;ue<0&&(H?(ge="-",Ae=-ue):Ae=(ue%Q+Q)%Q);let pe=Ae.toString(R);return pe=C?pe.toUpperCase():pe.toLowerCase(),A>0&&pe.length<A&&(pe=pe.padStart(A,"0")),S>0&&(pe=h(pe,S,x)),ge+$+pe};return ee.options=P,ee}function b(I,P){const R=m(P);let $=n.get(R);return $||($=p(R),n.set(R,$)),$(I)}function O(I){const P=m(I),{radix:R,groupSeparator:$,signed:C,min:A,max:S}=P,x=Y[R],H=V=>{if(E(V))return{ok:!0,value:null,reason:"blank"};let W=String(V);if($&&$!==""&&(W=W.split($).join("")),W=W.replace(k,""),W==="")return{ok:!0,value:null,reason:"blank"};let Q=!1;if((W[0]==="-"||W[0]==="+")&&(Q=W[0]==="-",W=W.slice(1)),W==="")return{ok:!1,value:null,reason:"digits"};let ee=null;for(const[ae,ue]of j){const ge=ae.exec(W);if(!ge)continue;const Ae=W.slice(ge[0].length);if(Ae==="")break;if(!Y[ue].test(Ae))return{ok:!1,value:null,reason:"digits"};ee=parseInt(Ae,ue);break}if(ee===null)if(x.test(W))ee=parseInt(W,R);else if(g.test(W))ee=Number(W);else return{ok:!1,value:null,reason:"digits"};if(!Number.isFinite(ee))return{ok:!1,value:null,reason:"digits"};const re=v(Q?-ee:ee);return!C&&re<0?{ok:!1,value:re,reason:"negative"}:re<A||re>S?{ok:!1,value:re,reason:"range"}:{ok:!0,value:re,reason:"ok"}};return H.options=P,H}function y(I,P){const R=m(P);let $=a.get(R);return $||($=O(R),a.set(R,$)),$(I)}function L(I,P){const R=y(I,P);return R.ok?R.value:null}function M(I,P){const R=E(I)||Number.isNaN(I)?null:Number(I),$=E(P)||Number.isNaN(P)?null:Number(P);return R===null?$===null?0:1:$===null||R<$?-1:R>$?1:0}function D(I){const P=I.min>=-2147483648&&I.max<=2147483647;return I.bitWidth&&P?"int32":"float64"}function F(I){const P=w(I),R=p(P),$=O(P);return{base:"number",extends:"number",storage:D(P),matches:null,format:C=>R(C.value),parse:C=>{const A=$(C.text);return A.ok?A.value:null},compare:M,defaults:{filter:"number",editor:"radix",total:"sum",align:"end"},excel:"General",toClipboard:C=>R(C),fromClipboard:C=>{const A=$(C);return A.ok?A.value:null},radix:P,formatValue:R,parseText:$}}const T=F}),Ue("packages/core/src/columns/types/aggregable.js",function(e,U){"use strict";Object.defineProperty(e,"createLogarithmicType",{enumerable:!0,get:function(){return X}}),Object.defineProperty(e,"createRatioType",{enumerable:!0,get:function(){return B}}),Object.defineProperty(e,"AGGREGABLE_TYPES",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(e,"weightedMean",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"logarithmicSum",{enumerable:!0,get:function(){return z}}),Object.defineProperty(e,"logarithmicMean",{enumerable:!0,get:function(){return _}});const E=U("packages/core/src/internal/predicates.js").isNil;function q(G){const j=[];for(const k of G||[]){if(E(k))continue;const g=Number(k);Number.isFinite(g)&&j.push(g)}return j}function z(G){return j=>{const k=q(j);if(!k.length)return null;let g=0;for(const c of k)g+=10**(c/G);return G*Math.log10(g)}}function _(G){return j=>{const k=q(j);if(!k.length)return null;let g=0;for(const c of k)g+=10**(c/G);return G*Math.log10(g/k.length)}}function Z(G,j){const k=j&&j.column,c=(k&&k.typeOptions||{}).weight,d=j&&j.valueAt;if(!c||typeof d!="function")return null;let l=0,i=0;for(let n=0;n<G.length;n++){if(E(G[n]))continue;const a=Number(G[n]);if(!Number.isFinite(a))continue;const s=d(c,n);if(E(s))continue;const t=Number(s);!Number.isFinite(t)||t<=0||(l+=a*t,i+=t)}return i===0?null:l/i}function X(G={}){const j=G.factor===20?20:10,k=typeof G.suffix=="string"?G.suffix:"",g=Number.isInteger(G.decimals)?G.decimals:1;return{base:"number",storage:"float64",name:G.name||"logarithmic",format:c=>{const d=c&&c.value;return E(d)||!Number.isFinite(Number(d))?"":`${Number(d).toFixed(g)}${k}`},parse:c=>{const d=String((c&&c.text)??"").replace(k,"").trim();if(!d)return null;const l=Number(d);return Number.isFinite(l)?l:null},defaults:{align:"end",filter:"number"},totals:{supported:["sum","avg","min","max","count","countValues"],implement:{sum:z(j),avg:_(j)}}}}function B(G={}){const j=Number.isInteger(G.decimals)?G.decimals:1,k=G.percent===!0;return{base:"number",storage:"float64",name:G.name||"ratio",format:g=>{const c=g&&g.value;return E(c)||!Number.isFinite(Number(c))?"":k?`${Number(c).toFixed(j)}%`:Number(c).toFixed(j)},parse:g=>{const c=String((g&&g.text)??"").replace("%","").trim();if(!c)return null;const d=Number(c);return Number.isFinite(d)?d:null},defaults:{align:"end",filter:"number"},totals:{supported:["avg","min","max","count","countValues"],implement:{avg:Z}}}}const Y=Object.freeze({decibel:X({name:"decibel",factor:10,suffix:" dB"}),decibelAmplitude:X({name:"decibelAmplitude",factor:20,suffix:" dB"}),ratio:B({name:"ratio"}),percentRate:B({name:"percentRate",percent:!0})})}),Ue("packages/core/src/columns/types/currency.js",function(e,U){"use strict";Object.defineProperty(e,"MISSING_RATE",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"normaliseCode",{enumerable:!0,get:function(){return z}}),Object.defineProperty(e,"toMoney",{enumerable:!0,get:function(){return _}}),Object.defineProperty(e,"parseMoney",{enumerable:!0,get:function(){return G}}),Object.defineProperty(e,"rateFunction",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"convertMoney",{enumerable:!0,get:function(){return k}}),Object.defineProperty(e,"formatMoney",{enumerable:!0,get:function(){return d}}),Object.defineProperty(e,"moneyToText",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"moneyComparator",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"createCurrencyType",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"CURRENCY_TYPES",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return t}});const E=U("packages/core/src/internal/predicates.js").isNil,q="⚠ no rate";function z(u){if(E(u))return null;const r=String(u).trim().toUpperCase();return r===""?null:r}function _(u){if(E(u))return null;if(typeof u=="object"&&!Array.isArray(u)){const r=Number(u.amount),o=z(u.code);return!o||!Number.isFinite(r)?null:{amount:r,code:o}}if(Array.isArray(u)&&u.length===2){const r=Number(u[0]),o=z(u[1]);return!o||!Number.isFinite(r)?null:{amount:r,code:o}}return null}const Z=Object.freeze({$:"USD","€":"EUR","£":"GBP","¥":"JPY","₹":"INR","₩":"KRW","₽":"RUB","₺":"TRY","₴":"UAH","₪":"ILS"}),X=Object.freeze({USD:"$",EUR:"€",GBP:"£",JPY:"¥",INR:"₹",KRW:"₩",RUB:"₽",TRY:"₺",UAH:"₴",ILS:"₪"}),B=/[+-]?[\d\s., ]*\d/;function Y(u,r){const o=String(u).trim();if(o==="")return null;const f=new Intl.NumberFormat(r||void 0).formatToParts(1.1).find(h=>h.type==="decimal")?.value||".",w=f===","?".":",",m=o.split(w).join("").split(/[\s ]/).join("").replace(f,"."),v=Number(m);return Number.isFinite(v)?v:null}function G(u,r){const o=r||{},f=z(o.code);if(E(u))return null;const w=_(u);if(w)return w;if(typeof u=="number")return Number.isFinite(u)&&f?{amount:u,code:f}:null;let m=String(u).trim();if(m==="")return null;let v=!1;m.startsWith("(")&&m.endsWith(")")&&(v=!0,m=m.slice(1,-1).trim());let h=null;for(const[M,D]of Object.entries(Z)){if(m.startsWith(M)){h=D,m=m.slice(M.length).trim();break}if(m.endsWith(M)){h=D,m=m.slice(0,-M.length).trim();break}}const p=B.exec(m);if(!p)return null;const b=Y(p[0],o.locale);if(b===null)return null;const O=(m.slice(0,p.index)+" "+m.slice(p.index+p[0].length)).trim();!h&&O!==""&&(h=z(O));const y=h||f;return y?{amount:v?-b:b,code:y}:null}function j(u,r){if(typeof u=="function")return(o,f)=>{if(o===f)return 1;const w=u(o,f);return typeof w=="number"&&Number.isFinite(w)&&w>0?w:null};if(u&&typeof u=="object"){const o=u;return(f,w)=>{if(f===w)return 1;const m=Number(o[f]),v=Number(o[w]);return!Number.isFinite(m)||!Number.isFinite(v)||m<=0||v<=0?null:v/m}}return(o,f)=>o===f?1:null}function k(u,r,o){if(!u)return null;if(u.code===r)return u.amount;const f=o(u.code,r);return f===null?null:u.amount*f}const g=new Map;function c(u,r,o){const f=`${u||""}|${r}|${o??""}`;let w=g.get(f);if(!w){const m={style:"currency",currency:r};typeof o=="number"&&(m.minimumFractionDigits=o,m.maximumFractionDigits=o);try{w={fmt:new Intl.NumberFormat(u||void 0,m),currency:!0}}catch{w={fmt:new Intl.NumberFormat(u||void 0,typeof o=="number"?{minimumFractionDigits:o,maximumFractionDigits:o}:{}),currency:!1}}g.set(f,w)}return w}function d(u,r){const o=r||{},f=o.nullDisplay??"",w=_(u);if(!w)return f;const m=z(o.display)||w.code;let v=w.amount,h=w.code;if(m!==w.code){const O=o.rateFn||j(o.rates,o.rateBase),y=k(w,m,O);if(y===null)return`${o.missingRate??q} ${w.code}→${m}`;v=y,h=m}const{fmt:p,currency:b}=c(o.locale,h,o.decimals);return b?p.format(v):`${p.format(v)} ${h}`}function l(u){const r=_(u);return r?`${r.amount} ${r.code}`:""}function i(u){const r=u||{},o=z(r.display),f=r.rateFn||j(r.rates,r.rateBase);return(w,m)=>{const v=_(w),h=_(m);if(!v&&!h)return 0;if(!v)return 1;if(!h)return-1;if(o){const p=k(v,o,f),b=k(h,o,f);if(p!==null&&b!==null)return p===b?0:p<b?-1:1}return v.code===h.code?v.amount===h.amount?0:v.amount<h.amount?-1:1:v.code<h.code?-1:1}}function n(u){const r=u||{},o=(w,m)=>{const v=[];for(const y of w||[]){const L=_(y);L&&v.push(L)}if(!v.length)return null;if(new Set(v.map(y=>y.code)).size===1){const y=v[0].code;return{amount:m(v.map(L=>L.amount)),code:y}}const p=z(r.display);if(!p)return`${r.missingRate??q}: mixed currencies, no display currency set`;const b=r.rateFn||j(r.rates,r.rateBase),O=[];for(const y of v){const L=k(y,p,b);if(L===null)return`${r.missingRate??q}: ${y.code}→${p}`;O.push(L)}return{amount:m(O),code:p}},f=w=>w.reduce((m,v)=>m+v,0);return{sum:w=>o(w,f),avg:w=>o(w,m=>f(m)/m.length),min:w=>o(w,m=>Math.min(...m)),max:w=>o(w,m=>Math.max(...m))}}function a(u){const r=Object.freeze({code:"USD",...u||{}}),o=j(r.rates,r.rateBase),f=Object.freeze({...r,rateFn:o}),w=n(f),m=i(f),v=new Map([[r.locale||"",f]]),h=O=>{const y=O||"";let L=v.get(y);return L||(L=Object.freeze({...f,locale:O||void 0}),v.set(y,L)),L},p=X[z(r.display||r.code)]||"",b=typeof r.decimals=="number"&&r.decimals>0?`.${"0".repeat(r.decimals)}`:".00";return{base:"object",extends:"object",storage:"object",name:"currency",currencyConfig:f,format:O=>d(O.value,O.locale?h(O.locale):f),parse:O=>G(O.text,O.locale?h(O.locale):f),compare:m,defaults:{filter:"number",editor:"currency",align:"end",total:"sum"},totals:{supported:["sum","avg","min","max","count","countValues"],implement:w},excel:r.excel||(p?`"${p}"#,##0${b}`:`#,##0${b}`),toStorage:O=>{const y=_(O);return y||(typeof O=="string"||typeof O=="number"?G(O,f):null)},toClipboard:O=>l(O),fromClipboard:O=>G(O,f)}}const s=Object.freeze({currency:a({code:"USD"}),usd:a({code:"USD"}),eur:a({code:"EUR"}),gbp:a({code:"GBP"}),jpy:a({code:"JPY",decimals:0})}),t=a}),Ue("packages/core/src/columns/types/index.js",function(e,U){"use strict";Object.defineProperty(e,"EXTENDED_TYPES",{enumerable:!0,get:function(){return W}}),Object.defineProperty(e,"createUnitType",{enumerable:!0,get:function(){return B}}),Object.defineProperty(e,"UNIT_SYSTEMS",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(e,"parseUnit",{enumerable:!0,get:function(){return G}}),Object.defineProperty(e,"formatUnit",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"registerUnitSystem",{enumerable:!0,get:function(){return k}}),Object.defineProperty(e,"unitSystemNames",{enumerable:!0,get:function(){return g}}),Object.defineProperty(e,"unitsOf",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"defineUnit",{enumerable:!0,get:function(){return d}}),Object.defineProperty(e,"SI_TYPES",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"createSiType",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"createSiSystem",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"siUnits",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"SI_PREFIXES",{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,"createRadixType",{enumerable:!0,get:function(){return O}}),Object.defineProperty(e,"RADIX_PRESETS",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"parseRadix",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"formatRadix",{enumerable:!0,get:function(){return M}});const te=U("packages/core/src/columns/types/temporal.js"),E=te.TEMPORAL_TYPES,q=U("packages/core/src/columns/types/network.js"),z=q.NETWORK_TYPES,_=U("packages/core/src/columns/types/structured.js"),Z=_.STRUCTURED_TYPES,X=U("packages/core/src/columns/types/unit.js"),B=X.createUnitType,Y=X.UNIT_SYSTEMS,G=X.parseUnit,j=X.formatUnit,k=X.registerUnitSystem,g=X.unitSystemNames,c=X.unitsOf,d=X.defineUnit,l=U("packages/core/src/columns/types/engineering.js"),i=l.ENGINEERING_TYPES,n=U("packages/core/src/columns/types/si.js"),a=n.SI_TYPES,s=n.createSiType,t=n.createSiSystem,u=n.siUnits,r=n.SI_PREFIXES,o=U("packages/core/src/columns/types/temperature.js"),f=o.TEMPERATURE_TYPES,w=o.createTemperatureType,m=o.convertTemperature,v=o.formatTemperature,h=o.parseTemperature,p=o.TEMPERATURE_SCALES,b=U("packages/core/src/columns/types/radix.js"),O=b.createRadixType,y=b.RADIX_PRESETS,L=b.parseRadix,M=b.formatRadix,D=U("packages/core/src/columns/types/aggregable.js"),F=D.AGGREGABLE_TYPES,T=U("packages/core/src/columns/types/currency.js"),I=T.CURRENCY_TYPES,P=T.createCurrencyType,R=T.parseMoney,$=T.formatMoney,C=T.convertMoney,A=T.toMoney,S=T.rateFunction,x=T.moneyComparator,H=T.normaliseCode,V=T.MISSING_RATE;Object.defineProperty(e,"findUnit",{enumerable:!0,get:function(){return X.findUnit}}),Object.defineProperty(e,"ENGINEERING_TYPES",{enumerable:!0,get:function(){return l.ENGINEERING_TYPES}}),Object.defineProperty(e,"circularMean",{enumerable:!0,get:function(){return l.circularMean}}),Object.defineProperty(e,"TEMPERATURE_TYPES",{enumerable:!0,get:function(){return o.TEMPERATURE_TYPES}}),Object.defineProperty(e,"createTemperatureType",{enumerable:!0,get:function(){return o.createTemperatureType}}),Object.defineProperty(e,"convertTemperature",{enumerable:!0,get:function(){return o.convertTemperature}}),Object.defineProperty(e,"formatTemperature",{enumerable:!0,get:function(){return o.formatTemperature}}),Object.defineProperty(e,"parseTemperature",{enumerable:!0,get:function(){return o.parseTemperature}}),Object.defineProperty(e,"TEMPERATURE_SCALES",{enumerable:!0,get:function(){return o.TEMPERATURE_SCALES}}),Object.defineProperty(e,"findScale",{enumerable:!0,get:function(){return o.findScale}}),Object.defineProperty(e,"CURRENCY_TYPES",{enumerable:!0,get:function(){return T.CURRENCY_TYPES}}),Object.defineProperty(e,"createCurrencyType",{enumerable:!0,get:function(){return T.createCurrencyType}}),Object.defineProperty(e,"parseMoney",{enumerable:!0,get:function(){return T.parseMoney}}),Object.defineProperty(e,"formatMoney",{enumerable:!0,get:function(){return T.formatMoney}}),Object.defineProperty(e,"convertMoney",{enumerable:!0,get:function(){return T.convertMoney}}),Object.defineProperty(e,"toMoney",{enumerable:!0,get:function(){return T.toMoney}}),Object.defineProperty(e,"rateFunction",{enumerable:!0,get:function(){return T.rateFunction}}),Object.defineProperty(e,"moneyComparator",{enumerable:!0,get:function(){return T.moneyComparator}}),Object.defineProperty(e,"normaliseCode",{enumerable:!0,get:function(){return T.normaliseCode}}),Object.defineProperty(e,"MISSING_RATE",{enumerable:!0,get:function(){return T.MISSING_RATE}}),Object.defineProperty(e,"TEMPORAL_TYPES",{enumerable:!0,get:function(){return te.TEMPORAL_TYPES}}),Object.defineProperty(e,"NETWORK_TYPES",{enumerable:!0,get:function(){return q.NETWORK_TYPES}}),Object.defineProperty(e,"STRUCTURED_TYPES",{enumerable:!0,get:function(){return _.STRUCTURED_TYPES}}),Object.defineProperty(e,"AGGREGABLE_TYPES",{enumerable:!0,get:function(){return D.AGGREGABLE_TYPES}}),Object.defineProperty(e,"createLogarithmicType",{enumerable:!0,get:function(){return D.createLogarithmicType}}),Object.defineProperty(e,"createRatioType",{enumerable:!0,get:function(){return D.createRatioType}}),Object.defineProperty(e,"parseTime",{enumerable:!0,get:function(){return te.parseTime}}),Object.defineProperty(e,"formatTime",{enumerable:!0,get:function(){return te.formatTime}}),Object.defineProperty(e,"parseDateTime",{enumerable:!0,get:function(){return te.parseDateTime}}),Object.defineProperty(e,"formatDateTime",{enumerable:!0,get:function(){return te.formatDateTime}}),Object.defineProperty(e,"parseDuration",{enumerable:!0,get:function(){return te.parseDuration}}),Object.defineProperty(e,"formatDuration",{enumerable:!0,get:function(){return te.formatDuration}}),Object.defineProperty(e,"parseIpv4",{enumerable:!0,get:function(){return q.parseIpv4}}),Object.defineProperty(e,"formatIpv4",{enumerable:!0,get:function(){return q.formatIpv4}}),Object.defineProperty(e,"parseCidr",{enumerable:!0,get:function(){return q.parseCidr}}),Object.defineProperty(e,"formatCidr",{enumerable:!0,get:function(){return q.formatCidr}}),Object.defineProperty(e,"parseIpv6",{enumerable:!0,get:function(){return q.parseIpv6}}),Object.defineProperty(e,"formatIpv6",{enumerable:!0,get:function(){return q.formatIpv6}}),Object.defineProperty(e,"networkAddress",{enumerable:!0,get:function(){return q.networkAddress}}),Object.defineProperty(e,"broadcastAddress",{enumerable:!0,get:function(){return q.broadcastAddress}}),Object.defineProperty(e,"hostCount",{enumerable:!0,get:function(){return q.hostCount}}),Object.defineProperty(e,"containsAddress",{enumerable:!0,get:function(){return q.containsAddress}}),Object.defineProperty(e,"overlaps",{enumerable:!0,get:function(){return q.overlaps}}),Object.defineProperty(e,"maskValue",{enumerable:!0,get:function(){return _.maskValue}}),Object.defineProperty(e,"summariseJson",{enumerable:!0,get:function(){return _.summariseJson}});const W=Object.freeze({...E,...z,...Z,...F,hex:O(y.hex),hex8:O(y.hex8),hex16:O(y.hex16),hex32:O(y.hex32),binary:O(y.binary),binary8:O(y.binary8),octal:O(y.octal),bytes:B({system:"data",unit:"B",display:"auto"}),megabytes:B({system:"data",unit:"MB"}),gigabytes:B({system:"data",unit:"GB"}),bitrate:B({system:"bitrate",unit:"Mbps"}),gigabits:B({system:"bitrate",unit:"Gbps"}),...i,...a,...f,...I});{const Q=new Set;for(const ee of[E,z,Z,F,i,a,f,I])for(const re of Object.keys(ee)){if(Q.has(re))throw new Error(`[lattice] data type "${re}" is declared twice`);Q.add(re)}}}),Ue("packages/core/src/compute/handle.js",function(e,U){"use strict";Object.defineProperty(e,"identity",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"rowCount",{enumerable:!0,get:function(){return X}}),Object.defineProperty(e,"bitReader",{enumerable:!0,get:function(){return G}}),Object.defineProperty(e,"presenceReader",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"dictSize",{enumerable:!0,get:function(){return k}}),Object.defineProperty(e,"dictValue",{enumerable:!0,get:function(){return g}}),Object.defineProperty(e,"multiValue",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"valueReader",{enumerable:!0,get:function(){return d}}),Object.defineProperty(e,"numericTotalOrder",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"valueComparator",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"dictRanks",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"isMissing",{enumerable:!0,get:function(){return a}});const te=U("packages/core/src/internal/compare.js"),E=te.collator,q=te.defaultCompare,_=U("packages/core/src/internal/warn.js").warnOnce;function Z(s){const t=new Uint32Array(s);for(let u=0;u<s;u++)t[u]=u;return t}function X(s,t){if(t&&typeof t.count=="number")return t.count;if(!s)return 0;if(typeof s.count=="number")return s.count;if(typeof s.length=="number")return s.length;const u=s.values;return s.kind==="multi"&&s.offsets?Math.max(0,s.offsets.length-1):u?s.kind==="bitset"?typeof u.size=="number"?u.size:s.presence&&typeof s.presence.size=="number"?s.presence.size:(_(`count:${s.id}`,`column "${s.id}" is bitset-backed with no declared row count; assuming ${u.length*8}`),u.length*8):u.length:s.presence&&typeof s.presence.size=="number"?s.presence.size:0}const B=new WeakMap;function Y(s){const t=s.constructor;if(!t)return"unknown";const u=B.get(t);if(u)return u;let r="unknown";try{let o=null;typeof t.from=="function"?o=t.from([!1,!0]):(o=new t(8),o.set(1));const f=o&&o.words;f&&f.length&&(f[0]===2?r="lsb":f[0]===64&&(r="msb"))}catch{r="unknown"}return B.set(t,r),r}function G(s){if(!s)return()=>0;const t=s instanceof Uint8Array?s:s.words;if(t instanceof Uint8Array){const u=s instanceof Uint8Array?"lsb":Y(s);if(u==="lsb")return r=>t[r>>>3]>>>(r&7)&1;if(u==="msb")return r=>t[r>>>3]>>>7-(r&7)&1}return typeof s.get=="function"?u=>s.get(u)?1:0:()=>0}function j(s){return!s||!s.presence?null:G(s.presence)}function k(s){return s?typeof s.size=="number"?s.size:typeof s.values=="function"?s.values().length:0:0}function g(s,t){return s?typeof s.valueOf=="function"?s.valueOf(t):typeof s.values=="function"?s.values()[t]:null:null}function c(s,t){const u=s.offsets,r=s.values;if(!u||!r)return[];const o=u[t],f=u[t+1];if(!(f>o))return[];const w=s.dict,m=new Array(f-o);for(let v=o;v<f;v++)m[v-o]=w?g(w,r[v]):r[v];return m}function d(s){if(!s)return()=>{};const t=s.values,u=j(s),r=s.kind;if(r==="dictionary"){const o=s.dict;return u?f=>u(f)?g(o,t[f]):null:f=>g(o,t[f])}if(r==="bitset"){const o=G(t);return u?f=>u(f)?o(f)===1:null:f=>o(f)===1}if(r==="multi")return u?o=>u(o)?c(s,o):null:o=>c(s,o);if(!t&&typeof s.get=="function"){const o=s.get.bind(s);return f=>{const w=o(f);return w===void 0?null:w}}return u?o=>{if(!u(o))return null;const f=t[o];return f===void 0?null:f}:o=>{const f=t[o];return f===void 0?null:f}}function l(s,t){if(s<t)return-1;if(s>t)return 1;if(s===t){const o=Object.is(s,-0),f=Object.is(t,-0);return o===f?0:o?-1:1}const u=Number.isNaN(s),r=Number.isNaN(t);return u&&r?0:u?1:-1}function i(s){const t=E(s);return(u,r)=>{if(u===r)return 0;const o=typeof u,f=typeof r;if(o==="string"&&f==="string")return t.compare(u,r);if(o==="number"&&f==="number")return l(u,r);if(o==="boolean"&&f==="boolean")return u===r?0:u?1:-1;if(u instanceof Date||r instanceof Date){const w=u instanceof Date?u.getTime():Number(u),m=r instanceof Date?r.getTime():Number(r);return l(w,m)}return q(u,r)}}function n(s,t){if(s&&typeof s.ranks=="function")return s.ranks(t);const u=s&&typeof s.values=="function"?s.values():[],r=u.length,o=i(t),f=new Array(r);for(let m=0;m<r;m++)f[m]=m;f.sort((m,v)=>o(u[m],u[v])||m-v);const w=new Uint32Array(r);for(let m=0;m<r;m++)w[f[m]]=m;return w}function a(s){return s==null||typeof s=="number"&&Number.isNaN(s)}}),Ue("packages/core/src/compute/filter.js",function(e,U){"use strict";Object.defineProperty(e,"releaseMask",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"compilePredicate",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"wallMs",{enumerable:!0,get:function(){return D}}),Object.defineProperty(e,"testValue",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"itemwisePredicate",{enumerable:!0,get:function(){return $}}),Object.defineProperty(e,"evaluateCondition",{enumerable:!0,get:function(){return V}}),Object.defineProperty(e,"evaluateFilters",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(e,"pruneColumn",{enumerable:!0,get:function(){return ee}}),Object.defineProperty(e,"mentionsColumn",{enumerable:!0,get:function(){return re}}),Object.defineProperty(e,"compact",{enumerable:!0,get:function(){return ae}}),Object.defineProperty(e,"declareOperators",{enumerable:!0,get:function(){return ge}}),Object.defineProperty(e,"declaredOperator",{enumerable:!0,get:function(){return Ae}});const E=U("packages/core/src/internal/predicates.js").isBlank,z=U("packages/core/src/internal/merge.js").toArray,Z=U("packages/core/src/internal/warn.js").warnOnce,X=U("packages/core/src/format/date.js"),B=X.toDate,Y=X.toIsoDate,G=U("packages/core/src/compute/handle.js"),j=G.bitReader,k=G.dictSize,g=G.dictValue,c=G.presenceReader,d=G.valueComparator,l=G.valueReader,i=/^\d{4}-\d{2}-\d{2}$/,n="\0null\0";function a(pe,Me){const Ne=pe&&pe.pool;if(Ne){const Pe=Ne.mask||Ne.acquireMask||Ne.acquire||Ne.take;if(typeof Pe=="function"){const ie=Pe.call(Ne,Me);if(ie&&ie.length>=Me)return ie}}return new Uint8Array(Me)}function s(pe,Me){const Ne=pe&&pe.pool;if(!Ne||!Me)return;const Pe=Ne.release||Ne.releaseMask||Ne.free||Ne.recycle;typeof Pe=="function"&&Pe.call(Ne,Me)}function t(pe,Me,Ne){return pe.fill(Ne,0,Me),pe}function u(pe){return pe==null||typeof pe=="number"&&Number.isNaN(pe)}function r(pe,Me){if(pe==null)return pe;if(Me==="number")return typeof pe=="number"?pe:Number(pe);if(Me==="date"||Me==="dateString"){const Ne=Y(pe);return Ne===null?o(pe):Ne}return Me==="boolean"?typeof pe=="boolean"?pe:pe==="true"||pe===1?!0:pe==="false"||pe===0?!1:!!pe:pe}function o(pe){return pe instanceof Date?pe.getTime():typeof pe=="number"?pe:Date.parse(String(pe))}function f(pe){return typeof pe=="number"?pe:pe instanceof Date?pe.getTime():pe==null||pe===""?NaN:Number(pe)}function w(pe,Me){const Ne=typeof pe=="string"?pe:String(pe);return Me?Ne:Ne.toLowerCase()}function m(pe,Me){return pe==null?n:typeof pe=="string"?Me?pe:pe.toLowerCase():pe instanceof Date?pe.getTime():pe}function v(pe,Me,Ne){const Pe=new Set;for(const ie of z(pe)){const Oe=r(ie,Ne);Pe.add(m(Oe,Me)),typeof Oe=="string"&&Oe!==""&&Number.isFinite(Number(Oe))?Pe.add(Number(Oe)):typeof Oe=="number"&&Number.isFinite(Oe)&&Pe.add(m(String(Oe),Me))}return Pe}function h(pe,Me,Ne){if(pe==null||Me===null||Me===void 0)return pe==null&&Me==null;const Pe=typeof pe,ie=typeof Me;return Pe==="string"&&ie==="string"?Ne?pe===Me:pe.toLowerCase()===Me.toLowerCase():pe instanceof Date||Me instanceof Date?o(pe)===o(Me):Pe==="number"&&ie==="number"?pe===Me||Number.isNaN(pe)&&Number.isNaN(Me):Pe==="number"&&ie==="string"?pe===Number(Me):Pe==="string"&&ie==="number"?Number(pe)===Me:Pe==="boolean"||ie==="boolean"?pe===Me:Array.isArray(pe)&&Array.isArray(Me)?pe.length===Me.length&&pe.every((Oe,je)=>h(Oe,Me[je],Ne)):pe===Me}function p(pe,Me){try{if(pe instanceof RegExp){const Ne=pe.flags.replace(/[gy]/g,"");return new RegExp(pe.source,Me||Ne.includes("i")?Ne:`${Ne}i`)}return new RegExp(String(pe),Me?"":"i")}catch(Ne){return Z(`regex:${String(pe)}`,`filter operator "matches" received an invalid pattern: ${String(pe)}`,Ne),null}}function b(pe,Me){if(pe&&pe.type==="datetime"&&O.has(pe.op))return F(pe,Me);const Ne=T(pe,Me),Pe=pe&&pe.type;return Pe!=="date"&&Pe!=="dateString"?Ne:ie=>Ne(typeof ie=="string"&&i.test(ie)?ie:Y(ie)??ie)}const O=new Set(["eq","ne","lt","lte","gt","gte","between","notBetween","in","notIn"]),y=/^(\d{4})-(\d{2})-(\d{2})(?:[T ](\d{2}):(\d{2})(?::(\d{2})(?:\.(\d{1,3})\d*)?)?)?$/,L=new Map;function M(pe,Me){let Ne=L.get(Me);if(Ne===void 0){try{Ne=new Intl.DateTimeFormat("en-CA",{timeZone:Me,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1})}catch{Ne=null}L.set(Me,Ne)}if(!Ne)return null;const Pe={};for(const ie of Ne.formatToParts(pe))ie.type!=="literal"&&(Pe[ie.type]=ie.value);return Pe}function D(pe,Me){if(pe==null||pe==="")return null;if(typeof pe=="string"){const Oe=y.exec(pe.trim());if(Oe)return Date.UTC(+Oe[1],+Oe[2]-1,+Oe[3],+(Oe[4]||0),+(Oe[5]||0),+(Oe[6]||0),+(Oe[7]||"0").padEnd(3,"0"))}const Ne=B(pe);if(!Ne)return null;const Pe=Ne.getUTCMilliseconds(),ie=Me?M(Ne,Me):null;return ie?Date.UTC(+ie.year,+ie.month-1,+ie.day,ie.hour==="24"?0:+ie.hour,+ie.minute,+ie.second,Pe):Date.UTC(Ne.getFullYear(),Ne.getMonth(),Ne.getDate(),Ne.getHours(),Ne.getMinutes(),Ne.getSeconds(),Pe)}function F(pe,Me){const Ne=typeof pe.timeZone=="string"&&pe.timeZone?pe.timeZone:void 0,Pe=je=>D(je,Ne),ie=Array.isArray(pe.value)?pe.value.map(Pe):Pe(pe.value),Oe=T({...pe,type:"number",value:ie},Me);return je=>Oe(D(je))}function T(pe,Me){const Ne=pe&&pe.op,Pe=!!(pe&&pe.caseSensitive),ie=pe&&pe.type,Oe=d(Me),je=Ce=>fe=>!Ce(fe);switch(Ne){case"eq":{const Ce=r(pe.value,ie);return fe=>h(fe,Ce,Pe)}case"ne":{const Ce=r(pe.value,ie);return fe=>!h(fe,Ce,Pe)}case"lt":case"lte":case"gt":case"gte":{const Ce=r(pe.value,ie);if(u(Ce))return()=>!1;const fe=Ne==="lt"?-1:Ne==="lte"?0:Ne==="gt"?1:2;return Ee=>{if(u(Ee))return!1;const le=Oe(Ee,Ce);return fe===-1?le<0:fe===0?le<=0:fe===1?le>0:le>=0}}case"between":case"notBetween":{const Ce=z(pe.value),fe=r(Ce[0],ie),Ee=r(Ce[1],ie),le=pe.bounds||"[]",de=le.charAt(0)!=="(",Se=le.charAt(1)!==")";if(u(fe)||u(Ee))return Ne==="between"?()=>!1:()=>!0;const Fe=ke=>{if(u(ke))return!1;const Ie=Oe(ke,fe),Be=Oe(ke,Ee);return(de?Ie>=0:Ie>0)&&(Se?Be<=0:Be<0)};return Ne==="between"?Fe:je(Fe)}case"in":case"notIn":{const Ce=v(pe.value,Pe,ie),fe=Ee=>Ce.has(m(Ee,Pe));return Ne==="in"?fe:je(fe)}case"contains":case"notContains":{const Ce=w(r(pe.value,ie),Pe),fe=Ee=>Ee==null?!1:w(Ee,Pe).includes(Ce);return Ne==="contains"?fe:je(fe)}case"startsWith":{const Ce=w(r(pe.value,ie),Pe);return fe=>fe==null?!1:w(fe,Pe).startsWith(Ce)}case"endsWith":{const Ce=w(r(pe.value,ie),Pe);return fe=>fe==null?!1:w(fe,Pe).endsWith(Ce)}case"matches":{const Ce=p(pe.value,Pe);return Ce?fe=>fe==null?!1:Ce.test(String(fe)):()=>!1}case"blank":return Ce=>E(Ce)||Array.isArray(Ce)&&Ce.length===0;case"notBlank":return Ce=>!(E(Ce)||Array.isArray(Ce)&&Ce.length===0);case"containsAny":case"containsNone":{const Ce=v(pe.value,Pe,ie),fe=Ee=>{const le=Ee==null?[]:z(Ee);for(let de=0;de<le.length;de++)if(Ce.has(m(le[de],Pe)))return!0;return!1};return Ne==="containsAny"?fe:je(fe)}case"containsAll":{const Ce=z(pe.value).map(fe=>m(r(fe,ie),Pe));return fe=>{const Ee=fe==null?[]:z(fe);if(Ce.length===0)return!0;const le=new Set(Ee.map(de=>m(de,Pe)));for(let de=0;de<Ce.length;de++)if(!le.has(Ce[de]))return!1;return!0}}default:{const Ce=Ae(Ne);return Ce?Ce.compile(pe.value):(Z(`op:${String(Ne)}`,`unknown filter operator "${String(Ne)}"; the condition is refused rather than matching every row`),()=>!1)}}}function I(pe,Me,Ne){return b(Me,Ne)(pe)}const P=Object.freeze({ne:"eq",notIn:"in",notBetween:"between",notContains:"contains"}),R=new Set(["containsAny","containsAll","containsNone"]);function $(pe,Me,Ne){const Pe=pe&&pe.op,ie=P[Pe]||Pe,Oe=b({...pe,op:ie,type:Me.type},Ne),je=Me.items,Ce=fe=>{const Ee=je(fe);if(!Ee)return!1;for(let le=0;le<Ee.length;le++)if(Oe(Ee[le]))return!0;return!1};return P[Pe]?fe=>!Ce(fe):Ce}function C(pe,Me,Ne,Pe){const ie=c(pe);if(ie){const Ce=Me?1:0;for(let fe=0;fe<Pe;fe++)Ne[fe]=ie(fe)===Ce?1:0;return Ne}const Oe=pe.kind;if(Oe==="float64"||Oe==="int32"||Oe==="bitset")return t(Ne,Pe,Me?1:0);const je=l(pe);for(let Ce=0;Ce<Pe;Ce++){const fe=je(Ce),Ee=E(fe)||Array.isArray(fe)&&fe.length===0;Ne[Ce]=Ee===Me?0:1}return Ne}function A(pe,Me,Ne,Pe){const ie=pe.dict,Oe=k(ie),je=new Uint8Array(Oe);for(let le=0;le<Oe;le++)je[le]=Me(g(ie,le))?1:0;const Ce=pe.values,fe=c(pe);if(!fe){for(let le=0;le<Pe;le++)Ne[le]=je[Ce[le]];return Ne}const Ee=Me(null)?1:0;for(let le=0;le<Pe;le++)Ne[le]=fe(le)===1?je[Ce[le]]:Ee;return Ne}function S(pe,Me,Ne,Pe){const ie=j(pe.values),Oe=Me(!0)?1:0,je=Me(!1)?1:0,Ce=c(pe);if(!Ce){for(let Ee=0;Ee<Pe;Ee++)Ne[Ee]=ie(Ee)===1?Oe:je;return Ne}const fe=Me(null)?1:0;for(let Ee=0;Ee<Pe;Ee++)Ne[Ee]=Ce(Ee)===0?fe:ie(Ee)===1?Oe:je;return Ne}function x(pe,Me,Ne,Pe,ie){const Oe=pe.values,je=Me.type,Ce=Me.op;let fe=!0;switch(Ce){case"eq":case"ne":{const le=f(r(Me.value,je)),de=typeof Me.value=="number"&&Number.isNaN(Me.value),Se=Ce==="ne"?1:0;if(de)for(let Fe=0;Fe<ie;Fe++)Pe[Fe]=(Number.isNaN(Oe[Fe])?1:0)^Se;else for(let Fe=0;Fe<ie;Fe++)Pe[Fe]=(Oe[Fe]===le?1:0)^Se;break}case"lt":{const le=f(r(Me.value,je));for(let de=0;de<ie;de++)Pe[de]=Oe[de]<le?1:0;break}case"lte":{const le=f(r(Me.value,je));for(let de=0;de<ie;de++)Pe[de]=Oe[de]<=le?1:0;break}case"gt":{const le=f(r(Me.value,je));for(let de=0;de<ie;de++)Pe[de]=Oe[de]>le?1:0;break}case"gte":{const le=f(r(Me.value,je));for(let de=0;de<ie;de++)Pe[de]=Oe[de]>=le?1:0;break}case"between":case"notBetween":{const le=z(Me.value),de=f(r(le[0],je)),Se=f(r(le[1],je)),Fe=Me.bounds||"[]",ke=Fe.charAt(0)!=="(",Ie=Fe.charAt(1)!==")",Be=Ce==="notBetween"?1:0;if(ke&&Ie)for(let Ke=0;Ke<ie;Ke++)Pe[Ke]=(Oe[Ke]>=de&Oe[Ke]<=Se?1:0)^Be;else if(ke)for(let Ke=0;Ke<ie;Ke++)Pe[Ke]=(Oe[Ke]>=de&Oe[Ke]<Se?1:0)^Be;else if(Ie)for(let Ke=0;Ke<ie;Ke++)Pe[Ke]=(Oe[Ke]>de&Oe[Ke]<=Se?1:0)^Be;else for(let Ke=0;Ke<ie;Ke++)Pe[Ke]=(Oe[Ke]>de&Oe[Ke]<Se?1:0)^Be;break}case"in":case"notIn":{const le=new Set;for(const Se of z(Me.value)){const Fe=f(r(Se,je));Number.isNaN(Fe)||le.add(Fe)}const de=Ce==="notIn"?1:0;for(let Se=0;Se<ie;Se++)Pe[Se]=(le.has(Oe[Se])?1:0)^de;break}default:fe=!1;break}if(!fe)return!1;const Ee=c(pe);if(Ee){const le=Ne(null)?1:0;for(let de=0;de<ie;de++)Ee(de)===0&&(Pe[de]=le)}return!0}function H(pe,Me,Ne,Pe){const ie=l(pe);for(let Oe=0;Oe<Pe;Oe++)Ne[Oe]=Me(ie(Oe))?1:0;return Ne}function V(pe,Me,Ne){const Pe=Me.count|0,ie=Ne||a(Me,Pe);if(!pe)return t(ie,Pe,1);const Oe=typeof Me.handle=="function"?Me.handle(pe.col):void 0,je=typeof Me.custom=="function"?Me.custom:null;if(!Oe){if(je){for(let le=0;le<Pe;le++)ie[le]=je(pe,le)?1:0;return ie}return Z(`filter:col:${String(pe.col)}`,`filter references unknown column "${String(pe.col)}"; the condition is refused rather than matching every row`),t(ie,Pe,0)}const Ce=pe.op;if(Ce==="blank"||Ce==="notBlank")return C(Oe,Ce==="notBlank",ie,Pe);const fe=typeof Me.itemwise=="function"?Me.itemwise(pe.col):null;if(fe&&!Ae(Ce)&&!R.has(Ce))return H(Oe,$(pe,fe,Me.locale),ie,Pe);const Ee=b(pe,Me.locale);switch(Oe.kind){case"dictionary":return A(Oe,Ee,ie,Pe);case"bitset":return S(Oe,Ee,ie,Pe);case"float64":case"int32":return x(Oe,pe,Ee,ie,Pe)?ie:H(Oe,Ee,ie,Pe);default:return H(Oe,Ee,ie,Pe)}}function W(pe,Me,Ne){if(!pe)return t(a(Me,Ne),Ne,1);if(Array.isArray(pe.conditions)){const Pe=pe.conditions.filter(je=>je!=null),ie=pe.op==="or"?"or":pe.op==="not"?"not":"and";if(Pe.length===0)return t(a(Me,Ne),Ne,1);const Oe=W(Pe[0],Me,Ne);for(let je=1;je<Pe.length;je++){const Ce=W(Pe[je],Me,Ne);if(ie==="or")for(let fe=0;fe<Ne;fe++)Oe[fe]|=Ce[fe];else for(let fe=0;fe<Ne;fe++)Oe[fe]&=Ce[fe];s(Me,Ce)}if(ie==="not")for(let je=0;je<Ne;je++)Oe[je]^=1;return Oe}return V(pe,Me,a(Me,Ne))}function Q(pe,Me){return W(pe,Me,Me.count|0)}function ee(pe,Me){if(!pe||!Me)return pe||null;const Ne=pe;if(Array.isArray(Ne.conditions)){if((Ne.op==="or"?"or":Ne.op==="not"?"not":"and")!=="and")return re(Ne,Me)?null:pe;const ie=[];for(const Oe of Ne.conditions){const je=ee(Oe,Me);je&&ie.push(je)}return ie.length?{...Ne,op:"and",conditions:ie}:null}return Ne.col===Me?null:pe}function re(pe,Me){if(!pe||typeof pe!="object")return!1;const Ne=pe;if(Ne.col===Me)return!0;if(Array.isArray(Ne.conditions)){for(const Pe of Ne.conditions)if(re(Pe,Me))return!0}return!1}function ae(pe,Me,Ne){if(Ne&&Ne.length>=Me){let je=0;for(let Ce=0;Ce<Me;Ce++)pe[Ce]&&(Ne[je++]=Ce);return Ne.subarray(0,je)}let Pe=0;for(let je=0;je<Me;je++)Pe+=pe[je]?1:0;const ie=new Uint32Array(Pe);let Oe=0;for(let je=0;je<Me;je++)pe[je]&&(ie[Oe++]=je);return ie}const ue=new Map;function ge(pe){if(!(!pe||typeof pe!="object"))for(const[Me,Ne]of Object.entries(pe))Ne&&typeof Ne.compile=="function"&&ue.set(Me,Ne)}function Ae(pe){return typeof pe=="string"?ue.get(pe):void 0}}),Ue("packages/core/src/columns/datatypes.js",function(e,U){"use strict";Object.defineProperty(e,"localeSeparators",{enumerable:!0,get:function(){return v}}),Object.defineProperty(e,"parseNumberText",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"BUILTIN_TYPES",{enumerable:!0,get:function(){return D}}),Object.defineProperty(e,"INFERENCE_ORDER",{enumerable:!0,get:function(){return F}}),Object.defineProperty(e,"createTypeRegistry",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"comparatorFor",{enumerable:!0,get:function(){return P}}),Object.defineProperty(e,"storageKind",{enumerable:!0,get:function(){return R}}),Object.defineProperty(e,"typeLabel",{enumerable:!0,get:function(){return $}});const te=U("packages/core/src/internal/compare.js"),E=te.collator,q=te.defaultCompare,z=U("packages/core/src/internal/predicates.js"),_=z.isNil,Z=z.isObject,X=z.isFunction,Y=U("packages/core/src/internal/warn.js").fail,j=U("packages/core/src/internal/text.js").titleCase,k=U("packages/core/src/format/date.js"),g=k.toDate,c=k.toIsoDate,d=k.compareIso,i=U("packages/core/src/format/boolean.js").toTriState,a=U("packages/core/src/columns/types/index.js").EXTENDED_TYPES,s=U("packages/core/src/formula/index.js"),t=s.evaluateFormula,u=s.looksLikeFormula,o=U("packages/core/src/compute/filter.js").declareOperators,f=/^\d{4}-\d{2}-\d{2}$/;function w(C){return C.getHours()===0&&C.getMinutes()===0&&C.getSeconds()===0&&C.getMilliseconds()===0}const m=new Map;function v(C){const A=C||"",S=m.get(A);if(S)return S;const x={group:",",decimal:"."};try{for(const H of new Intl.NumberFormat(C||void 0).formatToParts(12345.6))H.type==="group"?x.group=H.value:H.type==="decimal"&&(x.decimal=H.value)}catch{}return m.set(A,x),x}const h=/\d\s*[*/^]\s*[\d.(]/;function p(C,A){if(_(C))return null;let S=String(C).trim();if(S===""||S.startsWith("=")||h.test(S))return null;let x=1;S.startsWith("(")&&S.endsWith(")")&&(x=-1,S=S.slice(1,-1));const H=S.endsWith("%"),{group:V,decimal:W}=v(A);if(S=S.replace(/[\s\u00a0\u202f\u2009']/g,""),V&&V!=="."&&V!==","&&(S=S.split(V).join("")),S=S.replace(/[^0-9eE+\-.,]/g,""),W===","?S=S.split(".").join("").replace(",","."):S=S.split(",").join(""),S===""||S==="-"||S==="+")return null;const Q=Number(S);return Number.isNaN(Q)?null:x*(H?Q/100:Q)}function b(C,A){const S=_(C)||Number.isNaN(C)?null:Number(C),x=_(A)||Number.isNaN(A)?null:Number(A);return S===null?x===null?0:1:x===null||S<x?-1:S>x?1:0}function O(C,A){const S=i(C),x=i(A);return S===null?x===null?0:1:x===null?-1:S===x?0:S?1:-1}function y(C,A){const S=g(C),x=g(A);if(!S)return x?1:0;if(!x)return-1;const H=S.getTime(),V=x.getTime();return H<V?-1:H>V?1:0}const L=new Map;function M(C){const A=g(C.value);if(!A)return"";const S=C.locale||"";let x=L.get(S);return x||(x=new Intl.DateTimeFormat(C.locale||void 0,{dateStyle:"medium"}),L.set(S,x)),x.format(A)}const D={boolean:{base:"boolean",storage:"bitset",matches:C=>typeof C=="boolean",parse:C=>i(C.text),compare:O,format:C=>i(C.value)===null?"":i(C.value)?"Yes":"No",defaults:{filter:"set",editor:"checkbox",align:"center"},excel:"General",toClipboard:C=>i(C)===null?"":String(i(C)),fromClipboard:C=>i(C)},number:{base:"number",storage:"float64",matches:C=>typeof C=="number"&&!Number.isNaN(C),parse:C=>{if(u(C.text)){const A=t(C.text,C);if(!A.ok)return null;const S=Number(A.value);return Number.isFinite(S)?S:null}return p(C.text,C.locale)},compare:b,defaults:{filter:"number",editor:"number",align:"end"},excel:"General",toClipboard:C=>_(C)?"":String(C),fromClipboard:(C,A)=>p(C,A&&A.locale)},date:{base:"dateString",storage:"dictionary",matches:C=>typeof C=="string"&&f.test(C)&&!Number.isNaN(Date.parse(C))||C instanceof Date&&!Number.isNaN(C.getTime())&&w(C),parse:C=>c(C.text),compare:d,format:M,defaults:{filter:"date",editor:"date",align:"start"},excel:"yyyy-mm-dd",toStorage:C=>c(C),toClipboard:C=>_(C)?"":String(C),fromClipboard:C=>c(C)},dateString:{base:"dateString",storage:"dictionary",matches:C=>typeof C=="string"&&f.test(C)&&!Number.isNaN(Date.parse(C)),parse:C=>c(C.text),compare:d,format:M,defaults:{filter:"date",editor:"date",align:"start"},excel:"yyyy-mm-dd",toStorage:C=>c(C),toClipboard:C=>_(C)?"":String(C),fromClipboard:C=>c(C)},text:{base:"text",storage:"dictionary",matches:C=>typeof C=="string",parse:C=>C.text===""?null:String(C.text),compare:(C,A)=>_(C)?_(A)?0:1:_(A)?-1:E().compare(String(C),String(A)),defaults:{filter:"text",editor:"text",align:"start"},excel:"@",toClipboard:C=>_(C)?"":String(C),fromClipboard:C=>C},image:{base:"text",storage:"dictionary",parse:C=>C.text===""||C.text==null?null:String(C.text).trim(),compare:(C,A)=>_(C)?_(A)?0:1:_(A)?-1:E().compare(String(C),String(A)),defaults:{filter:"text",editor:"text",align:"center",render:"image"},excel:"@",toClipboard:C=>_(C)?"":String(C),fromClipboard:C=>C},lookup:{base:"text",storage:"dictionary",parse:C=>{if(C.text===""||C.text==null)return null;const A=C.column&&C.column.lookup,S=A&&X(A.options)?A.options():null;if(!S)return C.text;const x=String(C.text),H=S.find(Q=>String(Q.id)===x);if(H)return H.id;const V=x.trim().toLowerCase(),W=S.find(Q=>String(Q.label).toLowerCase()===V);return W?W.id:C.text},compare:q,defaults:{filter:"set",editor:"select",align:"start"},excel:"@",multiStorage:"multi",toClipboard:C=>_(C)?"":String(C),fromClipboard:C=>C},object:{base:"object",storage:"object",matches:C=>C!==null&&typeof C=="object"&&!(C instanceof Date),parse:C=>{try{return C.text===""?null:JSON.parse(C.text)}catch{return C.text}},compare:(C,A)=>q(C,A),format:C=>{const A=C.value;if(_(A))return"";if(typeof A=="string")return A;try{return JSON.stringify(A)}catch{return String(A)}},defaults:{filter:"none",editor:"none",align:"start"},excel:"@",toClipboard:C=>_(C)?"":typeof C=="string"?C:JSON.stringify(C),fromClipboard:C=>C}},F=["boolean","number","date","dateString","datetime","text","object"];function T(C,A,S,x){const H=S.get(C);if(H)return H;x.includes(C)&&Y(`circular data type extends chain: ${[...x,C].join(" → ")}`);const V=A[C];V||Y(`unknown data type "${C}"`);let W=null;V.extends&&(W=T(V.extends,A,S,[...x,C]));const Q={...W||{},...V,name:C,defaults:{...W&&W.defaults||{},...V.defaults||{}}};return Q.base||(Q.base=W&&W.base||"text"),Q.storage||(Q.storage=W&&W.storage||"object"),S.set(C,Q),Q}function I(C,A){const S={...D,...a};if(A&&typeof A.dataType=="function"&&typeof A.names=="function")for(const H of A.names("dataType")){const V=A.dataType(H);V&&(S[H]=V)}if(Z(C))for(const[H,V]of Object.entries(C))S[H]=V;const x=new Map;for(const H of F)T(H,S,x,[]);T("lookup",S,x,[]);for(const H of Object.keys(S))T(H,S,x,[]);for(const H of x.values())o(H.operators);return x}function P(C,A){if(C.base==="text"&&(!C.compare||C.compare===D.text.compare)){const S=E(A);return(x,H)=>_(x)?_(H)?0:1:_(H)?-1:S.compare(String(x),String(H))}return C.compare||q}function R(C,A){return A?C.multiStorage||"multi":C.storage||"object"}function $(C){return j(String(C).replace(/([a-z])([A-Z])/g,"$1 $2"))}}),Ue("packages/core/src/columns/infer.js",function(e,U){"use strict";Object.defineProperty(e,"DEFAULT_SAMPLE",{enumerable:!0,get:function(){return _}}),Object.defineProperty(e,"inferFromValues",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"inferColumnType",{enumerable:!0,get:function(){return X}});const E=U("packages/core/src/internal/warn.js").infoOnce,z=U("packages/core/src/internal/predicates.js").isNil,_=100;function Z(B,Y,G={}){const j=G.sampleSize??_,k=[];for(let g=0;g<B.length&&k.length<j;g++){const c=B[g];z(c)||typeof c=="number"&&Number.isNaN(c)||k.push(c)}if(k.length===0)return{type:"text",unanimous:!1,sampled:0};for(const[g,c]of Y){if(typeof c.matches!="function")continue;let d=!0;for(let l=0;l<k.length;l++)if(!c.matches(k[l])){d=!1;break}if(d)return{type:g,unanimous:!0,sampled:k.length}}return G.quiet||E(`infer:${G.colId||"?"}`,`column "${G.colId||"?"}" has mixed or ambiguous values and was inferred as "text". Declare \`type\` on the column to get correct sorting, filtering and export.`),{type:"text",unanimous:!1,sampled:k.length}}function X(B,Y,G,j,k={}){const g=k.sampleSize??_,c=[];for(let d=0;d<Y.length&&c.length<g;d++){const l=G(Y[d]);z(l)||typeof l=="number"&&Number.isNaN(l)||c.push(l)}return Z(c,j,{...k,colId:B}).type}}),Ue("packages/core/src/columns/graph.js",function(e,U){"use strict";Object.defineProperty(e,"WHOLE_ROW",{enumerable:!0,get:function(){return X}}),Object.defineProperty(e,"declarationOf",{enumerable:!0,get:function(){return B}}),Object.defineProperty(e,"buildGraph",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(e,"affectedBy",{enumerable:!0,get:function(){return G}}),Object.defineProperty(e,"depsProxy",{enumerable:!0,get:function(){return j}});const te=U("packages/core/src/internal/warn.js"),E=te.DEV,q=te.fail,z=te.warnOnce,Z=U("packages/core/src/internal/predicates.js").isFunction,X="*";function B(k){const g=k.value||{};if(!Z(g.compute))return{computed:!1,wholeRow:!1,deps:[],pure:!0};const d=g.pure!==!1;return g.deps===X?{computed:!0,wholeRow:!0,deps:[],pure:d}:Array.isArray(g.deps)?{computed:!0,wholeRow:!1,deps:g.deps.slice(),pure:d}:(z(`deps:missing:${k.id}`,`computed column "${k.id}" declares no \`value.deps\`; treating it as \`deps: '*'\` (a whole-row dependency). Declare the dependencies to get precise invalidation.`),{computed:!0,wholeRow:!0,deps:[],pure:d})}function Y(k){const g=new Map;for(const f of k)g.set(f.id,f);const c=new Map,d=new Map,l=new Set,i=new Set,n=new Set,a=new Set;for(const f of k){const w=B(f);if(!w.computed){c.set(f.id,[]);continue}i.add(f.id),(w.pure?n:a).add(f.id),w.wholeRow&&l.add(f.id);const m=[],v=[];for(const h of w.deps)(g.has(h)?m:v).push(h);c.set(f.id,m),v.length&&d.set(f.id,v)}for(const f of n)for(const w of c.get(f))a.has(w)&&q(`pure computed column "${f}" depends on impure column "${w}". Mark it \`value.pure: false\` or make the dependency pure.`);const s=[],t=new Map,u=[],r=f=>{const w=t.get(f);if(w!=="done"){if(w==="open"){const m=u.indexOf(f);q(`circular column dependency: ${[...u.slice(m),f].join(" → ")}`)}t.set(f,"open"),u.push(f);for(const m of c.get(f)||[])g.has(m)&&r(m);u.pop(),t.set(f,"done"),s.push(f)}};for(const f of k)r(f.id);const o=new Map;for(const f of k)o.set(f.id,[]);for(const f of k)for(const w of c.get(f.id)||[]){const m=o.get(w);m&&!m.includes(f.id)&&m.push(f.id)}if(l.size)for(const f of k){if(i.has(f.id))continue;const w=o.get(f.id);for(const m of l)w.includes(m)||w.push(m)}return{order:s,dependents:o,pure:n,impure:a,computed:i,deps:c,wholeRow:l,external:d,index:g}}function G(k,g){const c=Array.isArray(g)?g:[g],d=new Set,l=[...c];for(;l.length;){const i=l.shift();for(const n of k.dependents.get(i)||[])d.has(n)||(d.add(n),l.push(n))}for(const i of c)d.delete(i);return k.order.filter(i=>d.has(i))}function j(k,g,c){if(!E)return k;const d=g instanceof Set?g:new Set(g);return new Proxy(k,{get(l,i){return typeof i=="string"&&!d.has(i)&&!Object.hasOwn(l,i)&&z(`undeclared:${c}:${i}`,`computed column "${c}" read undeclared dependency "${i}". Add it to \`value.deps\` or the value will go stale.`),l[i]}})}}),Ue("packages/core/src/model/rowkey.js",function(e,U){"use strict";Object.defineProperty(e,"KEY_DEPENDENT_FEATURES",{enumerable:!0,get:function(){return B}}),Object.defineProperty(e,"compositeKey",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"createRowKey",{enumerable:!0,get:function(){return k}}),Object.defineProperty(e,"warnMissingKeys",{enumerable:!0,get:function(){return d}}),Object.defineProperty(e,"groupPathKey",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"splitPathKey",{enumerable:!0,get:function(){return i}});const E=U("packages/core/src/internal/warn.js").warnOnce,z=U("packages/core/src/internal/paths.js").pathGetter,_=U("packages/core/src/internal/predicates.js"),Z=_.isFunction,X=_.isBlank,B=["changes (rows.apply / rows.queue)","streaming dedupe","selection persistence","remote reload","cell comments"],Y="";function G(n){if(n===null)return"\0n";if(n===void 0)return"\0u";const a=typeof n;if(a==="string")return n;if(a==="number"||a==="bigint"||a==="boolean")return String(n);if(n instanceof Date)return`\0d${n.getTime()}`;try{return`\0o${JSON.stringify(n)}`}catch{return"\0o?"}}function j(n){if(n.length===1)return G(n[0]);let a="";for(let s=0;s<n.length;s++)s&&(a+=Y),a+=G(n[s]);return a}function k(n,a={}){const s=a.warn!==!1;if(Z(n)){const t=n;return{stable:!0,fields:[],disabled:[],key(u,r){try{const o=t(u);return Array.isArray(o)?j(o):G(o)}catch(o){return E("rowKey.throw","rowKey function threw; falling back to index identity for the affected rows.",o),`#${r??-1}`}},keyEmpty(u){try{const r=t(u);return Array.isArray(r)?r.length===0||r.some(X):X(r)}catch{return!1}},missingFields(){return[]}}}if(Array.isArray(n)&&n.length>0){const t=n.filter(o=>typeof o=="string"),u=t.map(o=>z(o)),r=u.length;return{stable:!0,fields:t,disabled:[],key(o){const f=new Array(r);for(let w=0;w<r;w++)f[w]=u[w](o);return j(f)},keyEmpty(o){for(let f=0;f<r;f++)if(X(u[f](o)))return!0;return!1},missingFields(o){const f=[];for(let w=0;w<r;w++)X(u[w](o))&&f.push(t[w]);return f}}}if(typeof n=="string"&&n.length>0){const t=z(n);return{stable:!0,fields:[n],disabled:[],key(u){return G(t(u))},keyEmpty(u){return X(t(u))},missingFields(u){return X(t(u))?[n]:[]}}}return s&&E("rowKey.missing",`no rowKey configured, so rows are identified by object identity. This disables: ${B.join(", ")}. Set rowKey to a field name, an array of field names, or a function.`),{stable:!1,fields:[],disabled:B.slice(),key(t,u){if(t===null||typeof t!="object")return`#${u??0}:${String(t)}`;let r=g.get(t);return r===void 0&&(r=`#${c++}`,g.set(t,r)),r}}}const g=new WeakMap;let c=0;function d(n,a){if(!n||n.stable===!1||!Z(n.keyEmpty)||!Array.isArray(a)||a.length===0)return;let s=0,t=null,u;for(let w=0;w<a.length;w++){const m=a[w];n.keyEmpty(m)&&(s++,t===null&&(t=Z(n.missingFields)?n.missingFields(m):[],u=m))}if(s===0)return;const r=n.fields.length?n.fields.join(","):"(function)",o=t&&t.length?t.join(", "):n.fields.length?n.fields.join(", "):"the rowKey function",f=u!==null&&typeof u=="object"?Object.keys(u).join(", ")||"(no fields)":String(u);E(`rowKey.emptyValue:${r}`,`rowKey ${o} is missing on ${s} of ${a.length} rows; the first such row has: ${f}. Rows without a key value collapse onto one key, so selection, edits and rows.apply updates land on whichever row now shares it. Set rowKey to a field present on every row, or fix the source data.`)}function l(n){return j(n)}function i(n){return n.split(Y)}}),Ue("packages/core/src/columns/lookup.js",function(e,U){"use strict";Object.defineProperty(e,"DEFAULT_SEPARATOR",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"normaliseOption",{enumerable:!0,get:function(){return g}}),Object.defineProperty(e,"flattenOptions",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"Lookup",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"toValueArray",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"createLookup",{enumerable:!0,get:function(){return n}});const te=U("packages/core/src/internal/compare.js"),E=te.collator,q=te.defaultCompare,z=U("packages/core/src/internal/predicates.js"),_=z.isFunction,Z=z.isNil,B=U("packages/core/src/internal/warn.js").warnOnce,G=U("packages/core/src/model/rowkey.js").compositeKey,j=", ",k="";function g(a,s,t,u){if(a===null||typeof a!="object")return{id:a,label:a==null?"":String(a)};const r=a[s],o=a[t],f={id:r,label:o==null?String(r??""):String(o)};a.disabled&&(f.disabled=!0),a.variant&&(f.variant=a.variant),a.icon&&(f.icon=a.icon);const w=u?a[u]:a.group;return w!==void 0&&(f.group=w),f}function c(a,s,t=0,u=[],r=[]){for(const o of a||[]){const f=o&&typeof o=="object"?o[s]:null;if(r.push({raw:o,depth:t,path:u}),Array.isArray(f)&&f.length){const w=String(o&&typeof o=="object"?o.label??o.name??o.id??"":o);c(f,s,t+1,[...u,w],r)}}return r}function d(a){return!!a&&typeof a=="object"&&!Array.isArray(a)&&_(a.router&&a.router.subscribe)}class l{#e;#t;#n;#r;#s=[];#i=new Map;#o=new Map;#l=0;#a="idle";#c=null;#u;#f=null;#d=new Map;constructor(s,t={}){this.#e=s||{},this.#t=t.colId||"?",this.#n=t.locale,this.#r=t.onChange||null,this.#u=E(this.#n),Array.isArray(this.#e.options)?this.#h(this.#e.options):this.#e.options===void 0&&(this.#a="ready")}get colId(){return this.#t}get version(){return this.#l}get state(){return this.#a}get ready(){return this.#a==="ready"}get multiple(){return this.#e.multiple===!0}get separator(){return this.#e.separator??j}get allowCustom(){return this.#e.allowCustom===!0}get sortBy(){return this.#e.sortBy||"label"}get spec(){return this.#e}options(){return this.#s}setLocale(s){this.#n=s,this.#u=E(s)}#h(s){const t=this.#e,u=t.valueKey||"id",r=t.labelKey||"label",o=t.childrenKey||"children";this.#s=c(s,o).map(f=>{const w=g(f.raw,u,r,t.groupKey);return f.depth&&(w.depth=f.depth,w.path=f.path),w}),this.#i=new Map,this.#o=new Map,this.#s.forEach((f,w)=>{this.#i.set(f.id,f),this.#o.set(f.id,w)}),this.#a="ready",this.#l+=1}load(){if(this.#c)return this.#c;const s=this.#e.options;if(Array.isArray(s)||s===void 0)return this.#c=Promise.resolve(this.#s),this.#c;if(d(s))return this.#c=this.#p(s),this.#c;if(!_(s))return B(`lookup:options:${this.#t}`,`column "${this.#t}" has an invalid \`lookup.options\`; expected an array, a function, or a router route`),this.#a="ready",this.#c=Promise.resolve([]),this.#c;this.#a="loading";let t;try{t=s()}catch(u){return this.#a="error",B(`lookup:load:${this.#t}`,`column "${this.#t}" failed to load lookup options`,u),this.#c=Promise.resolve([]),this.#c}return!t||!_(t.then)?(this.#h(t),this.#c=Promise.resolve(this.#s),this.#r&&this.#r(this),this.#c):(this.#c=t.then(u=>(this.#h(u),this.#r&&this.#r(this),this.#s),u=>(this.#a="error",B(`lookup:load:${this.#t}`,`column "${this.#t}" failed to load lookup options`,u),[])),this.#c)}refresh(){return this.#c=null,Array.isArray(this.#e.options)?(this.#h(this.#e.options),this.#r&&this.#r(this),Promise.resolve(this.#s)):this.load()}#p(s){if(this.#f)return Promise.resolve(this.#s);const t=this.#e,u=t.valueKey||"id",r=t.labelKey||"label",o=t.groupKey,f=_(s.map)?s.map:null,w=v=>g(f?f(v):v,u,r,o).id,m=v=>this.#m(v,f,u,r,o);return s.router.subscribe(s.predicate,m,{rowKey:w}),this.#f=()=>{_(s.router.detach)&&s.router.detach(m)},this.#a="ready",Promise.resolve(this.#s)}#m(s,t,u,r,o){const f=s&&s.add||[],w=s&&s.update||[],m=s&&s.remove||[];if(!(!f.length&&!w.length&&!m.length)){for(const v of f)this.#g(v,t,u,r,o);for(const v of w)this.#g(v,t,u,r,o);for(const v of m){if(!this.#d.has(v))continue;const h=this.#d.get(v);this.#d.delete(v),this.#i.delete(h);const p=this.#s.findIndex(b=>b.id===h);p>=0&&this.#s.splice(p,1)}this.#o=new Map(this.#s.map((v,h)=>[v.id,h])),this.#a="ready",this.#l+=1,this.#r&&this.#r(this)}}#g(s,t,u,r,o){const f=g(t?t(s):s,u,r,o);this.#d.set(G([f.id]),f.id);const w=this.#s.findIndex(m=>m.id===f.id);w>=0?this.#s[w]=f:this.#s.push(f),this.#i.set(f.id,f)}destroy(){this.#f&&(this.#f(),this.#f=null)}search(s,t){const u=this.#e;if(!_(u.search)){const f=String(s||"").toLowerCase();return Promise.resolve(f===""?this.#s:this.#s.filter(w=>w.label.toLowerCase().includes(f)))}const r=u.valueKey||"id",o=u.labelKey||"label";return Promise.resolve(u.search(s,t)).then(f=>(f||[]).map(w=>g(w,r,o,u.groupKey)))}option(s){return this.#i.get(s)}has(s){return this.#i.has(s)}label(s){if(Z(s)||s==="")return"";const t=this.#i.get(s);if(t)return t.label;if(this.#a==="loading"||this.#a==="idle")return"";this.allowCustom||B(`lookup:unknown:${this.#t}`,`column "${this.#t}" holds value ${JSON.stringify(s)} which is not in its lookup options. Showing the raw value; set \`lookup.unknownLabel\` or \`lookup.allowCustom\` to change that.`);const u=this.#e.unknownLabel;return _(u)?String(u(s)??""):typeof u=="string"?u:String(s)}text(s){if(this.multiple){const t=i(s);return t.length===0?"":t.map(u=>this.label(u)).join(this.separator)}return this.label(s)}dictionary(){return this.#s.map(s=>s.id)}sorted(){const s=this.sortBy;if(s==="optionOrder"||s==="count")return this.#s.slice();if(s==="value")return this.#s.slice().sort((u,r)=>q(u.id,r.id));const t=this.#u;return this.#s.slice().sort((u,r)=>t.compare(u.label,r.label))}comparator(){const s=this.sortBy,t=this.multiple,u=this.#u,r=this.#o;if(t&&s==="count")return(f,w)=>i(f).length-i(w).length;const o=t?f=>i(f)[0]:f=>f;return s==="value"?(f,w)=>q(o(f),o(w)):s==="optionOrder"?(f,w)=>{const m=r.has(o(f))?r.get(o(f)):Number.MAX_SAFE_INTEGER,v=r.has(o(w))?r.get(o(w)):Number.MAX_SAFE_INTEGER;return m-v}:(f,w)=>{const m=o(f),v=o(w);return Z(m)?Z(v)?0:1:Z(v)?-1:u.compare(this.label(m),this.label(v))}}groupKey(s){return this.multiple?i(s).map(u=>String(u)).sort().join(k):Z(s)?"":String(s)}countValues(s){return this.multiple?i(s).length:Z(s)?0:1}contains(s,t,u){const r=this.multiple?i(s):Z(s)?[]:[s],o=Array.isArray(t)?t:[t];switch(u){case"containsAll":return o.every(f=>r.includes(f));case"containsNone":return!o.some(f=>r.includes(f));default:return o.some(f=>r.includes(f))}}exportText(s,t="label"){return t==="value"?this.multiple?i(s).join(this.separator):Z(s)?"":String(s):this.text(s)}exportColumns(){const s=this.multiple;return this.#s.map(t=>({id:t.id,label:t.label,has:u=>s?i(u).includes(t.id):u===t.id}))}}function i(a){return Array.isArray(a)?a:Z(a)||a===""?[]:[a]}function n(a,s={}){const t=a.lookup;if(!t)return null;const u=new l(t,{colId:a.id,locale:s.locale,onChange:s.onChange});return!Array.isArray(t.options)&&t.options!==void 0&&u.load(),u}}),Ue("packages/core/src/columns/value.js",function(e,U){"use strict";Object.defineProperty(e,"compileDisplay",{enumerable:!0,get:function(){return g}}),Object.defineProperty(e,"warnImpureUse",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"ValuePipeline",{enumerable:!0,get:function(){return d}}),Object.defineProperty(e,"defaultRowKey",{enumerable:!0,get:function(){return l}});const E=U("packages/core/src/internal/paths.js").getPath,q=U("packages/core/src/internal/predicates.js"),z=q.isFunction,_=q.isNil,X=U("packages/core/src/internal/lru.js").Lru,Y=U("packages/core/src/internal/warn.js").warnOnce,j=U("packages/core/src/columns/graph.js").depsProxy,k="\0";function g(s,t={}){const u=t.locale,r=t.grid??null,o=t.context,f=s.value&&s.value.format,w=s.formatter||null,m=s.dataType&&s.dataType.format,v=s.lookup||null,h=(p,b,O)=>({value:p,data:O,row:b,column:s,colId:s.id,grid:r,context:o,locale:u});if(z(f))return(p,b,O)=>{const y=f(h(p,b,O));return y==null?"":String(y)};if(w){if(v){const p=w.kind==="text";return(b,O,y)=>w(p?v.text(b):b,h(b,O,y))}return(p,b,O)=>w(p,h(p,b,O))}return z(m)?(p,b,O)=>{const y=m(h(p,b,O));return y==null?"":String(y)}:v?p=>v.text(p):p=>_(p)?"":typeof p=="string"?p:String(p)}function c(s,t){!s||!s.value||s.value.pure!==!1||Y(`impure:${t}:${s.id}`,`column "${s.id}" is an impure computed column (\`value.pure: false\`) and is being used to ${t}. The result is not stable across passes.`)}class d{#e;#t;#n;#r;#s;#i;#o=new X(4096);constructor(t){this.#e=t.columns instanceof Map?t.columns:new Map((t.columns||[]).map(u=>[u.id,u])),this.#t=t.graph,this.#n=t.grid??null,this.#r=t.context,this.#i=t.stored||null,this.#s=t.rowKey||l}get graph(){return this.#t}setGraph(t){this.#t=t,this.#o.clear()}beginPass(){this.#o.clear()}endPass(){this.#o.clear()}invalidate(t){if(this.#o.size===0)return;const u=t&&t.rows?new Set([...t.rows].map(String)):null,r=t&&t.columns?[...t.columns]:null;if(!u&&!r){this.#o.clear();return}const o=r?this.#l(r):null;for(const f of[...this.#o.keys()]){const w=String(f).split(k);w.length===3&&(u&&!u.has(w[0])||o&&!o.has(w[2])||this.#o.delete(f))}}#l(t){const u=new Set,r=this.#t,o=[...t];for(;o.length;){const f=o.pop();if(!u.has(f)){u.add(f);for(const w of r?r.dependents.get(f)||[]:[])o.push(w)}}return u}value(t,u,r){const o=typeof t=="string"?this.#e.get(t):t;if(!o)return;if(!o.computed)return this.#c(o,u,r);if(o.value.pure!==!1&&this.#i&&r&&r.physical!=null&&this.#i.has(o.id))return this.#i.get(o.id,r.physical);if(o.volatile)return this.compute(o,u,r);if(o.value.pure===!1)return this.compute(o,u,r);const f=`${this.#a(u,r)}${k}${o.id}`;if(this.#o.has(f))return this.#o.get(f);const w=this.compute(o,u,r);return this.#o.set(f,w),w}#a(t,u){return`${this.#s(t,u)}${k}${i(t)}`}#c(t,u,r){if(this.#i&&r&&r.physical!=null&&this.#i.has(t.id))return this.#i.get(t.id,r.physical);if(t.field)return t.read?t.read(u):E(u,t.field)}compute(t,u,r){const o=this.#t,f=o&&o.wholeRow.has(t.id);let w;if(f)w=u??{};else{w={};const v=o&&o.deps.get(t.id)||[];for(const p of v)w[p]=this.value(p,u,r);const h=o&&o.external.get(t.id)||[];for(const p of h)w[p]=E(u,p);w=j(w,[...v,...h],t.id)}const m={data:u,row:r,column:t,grid:this.#n,context:this.#r};return t.value.compute(w,m)}values(t,u){const r={},o=this.#t?this.#t.order:[...this.#e.keys()];for(const f of o)r[f]=this.value(f,t,u);return r}text(t,u,r){const o=typeof t=="string"?this.#e.get(t):t;return o?o.formatValue(this.value(o,u,r),r,u):""}key(t,u,r){const o=typeof t=="string"?this.#e.get(t):t;if(!o)return"";const f=this.value(o,u,r);return z(o.value.key)?String(o.value.key(this.#u(o,f,u,r))):o.lookup?o.lookup.groupKey(f):_(f)?"":String(f)}quickFilterText(t,u,r){const o=typeof t=="string"?this.#e.get(t):t;if(!o)return"";if(z(o.value.quickFilterText)){const f=this.value(o,u,r);return String(o.value.quickFilterText(this.#u(o,f,u,r))??"")}return this.text(o,u,r)}#u(t,u,r,o){return{value:u,data:r,row:o,column:t,colId:t.id,grid:this.#n,context:this.#r}}parse(t,u,r,o){const f=typeof t=="string"?this.#e.get(t):t;if(!f)return u;const w={text:u,value:this.value(f,r,o),data:r,row:o,column:f,grid:this.#n,context:this.#r,locale:this.#n&&z(this.#n.get)?this.#n.get("locale"):void 0,formulaFunctions:this.#n&&z(this.#n.get)?this.#n.get("formulaFunctions"):void 0};return z(f.value.parse)?f.value.parse(w):f.dataType&&z(f.dataType.parse)?f.dataType.parse(w):u}validate(t,u,r,o,f){const w=typeof t=="string"?this.#e.get(t):t;if(!w||!z(w.edit.validate))return!0;const m=w.edit.validate({value:u,oldValue:r,data:o,row:f,column:w,grid:this.#n,context:this.#r});return m===!0||m===void 0?!0:String(m)}apply(t,u,r,o){const f=typeof t=="string"?this.#e.get(t):t;if(!f)return!1;const w=this.value(f,r,o);if(z(f.value.apply)){const m=f.value.apply({value:u,oldValue:w,data:r,row:o,column:f,grid:this.#n,context:this.#r});return this.#f(f,r,o),m!==!1}return f.field?w===u?!1:(f.write(r,u),this.#f(f,r,o),!0):(Y(`apply:${f.id}`,`column "${f.id}" has no \`field\` and no \`value.apply\`, so an edit cannot be written back.`),!1)}commit(t,u,r,o){const f=typeof t=="string"?this.#e.get(t):t;if(!f)return{ok:!1,value:void 0,oldValue:void 0,changed:!1,error:"unknown column"};const w=this.value(f,r,o),m=this.parse(f,u,r,o),v=this.validate(f,m,w,r,o);if(v!==!0)return{ok:!1,value:m,oldValue:w,changed:!1,error:v};const h=this.apply(f,m,r,o);return{ok:!0,value:m,oldValue:w,changed:h}}#f(t,u,r){if(this.#o.size===0)return;const o=this.#a(u,r);this.#o.delete(`${o}${k}${t.id}`);for(const f of this.#t?this.#t.dependents.get(t.id)||[]:[])this.#o.delete(`${o}${k}${f}`)}}function l(s,t){return t&&t.key!=null?String(t.key):i(s)}function i(s){if(s&&typeof s=="object"){let t=n.get(s);return t===void 0&&(t=`#${a++}`,n.set(s,t)),t}return String(s)}const n=new WeakMap;let a=0}),Ue("packages/core/src/model/shadow.js",function(e,U){"use strict";Object.defineProperty(e,"MAX_TRACKED",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"DEFAULT_DEPTH",{enumerable:!0,get:function(){return z}}),Object.defineProperty(e,"HISTORY_TICK_MAX_MS",{enumerable:!0,get:function(){return _}}),Object.defineProperty(e,"HISTORY_TICK_MIN_MS",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"historyTickFor",{enumerable:!0,get:function(){return X}}),Object.defineProperty(e,"SHADOW_KINDS",{enumerable:!0,get:function(){return B}}),Object.defineProperty(e,"ROLLING_KINDS",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(e,"FIT_SHADOW_KINDS",{enumerable:!0,get:function(){return G}}),Object.defineProperty(e,"MAD_SCALE",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"DEFAULT_ANOMALY_THRESHOLD",{enumerable:!0,get:function(){return k}}),Object.defineProperty(e,"SPEC_STATUS",{enumerable:!0,get:function(){return g}}),Object.defineProperty(e,"POSITIONAL_KINDS",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"SHADOW_LABELS",{enumerable:!0,get:function(){return d}}),Object.defineProperty(e,"specStatusOf",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"ShadowTracker",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"shadowsIn",{enumerable:!0,get:function(){return r}});const E=U("packages/core/src/internal/warn.js").warnOnce,q=2e5,z=20,_=1e3,Z=50;function X(o){return Math.min(_,Math.max(Z,Math.floor(o)))}const B=Object.freeze(["updates","updatedAt","sinceUpdate","delta","deltaPercent","rate","history","firstValue","streak","rank","rankAsc","rankChange","percentile","quartile","zScore","shareOfTotal","anomalyScore","anomalyFlag","specStatus","rollingSum","rollingAvg","rollingMin","rollingMax","windowCoverage","cumulativeToDate","periodOverPeriod","rollingQuantile","windowApproximate","tsTrend","tsSeasonal","tsResidual","tsCoverage","tsSmoothed","tsSmoothingAlpha","tsSmoothingBeta","fitPredicted","fitResidual","fitInfluence","fitStdResidual","fitLeverage","fitCooksD"]),Y=Object.freeze(["rollingSum","rollingAvg","rollingMin","rollingMax","windowCoverage","cumulativeToDate","periodOverPeriod","rollingQuantile","windowApproximate","tsTrend","tsSeasonal","tsResidual","tsCoverage","tsSmoothed","tsSmoothingAlpha","tsSmoothingBeta"]),G=Object.freeze(["fitPredicted","fitResidual","fitInfluence","fitStdResidual","fitLeverage","fitCooksD"]),j=.6745,k=3.5,g=Object.freeze({PASS:"PASS",WARN:"WARN",FAIL:"FAIL"}),c=Object.freeze(["rank","rankAsc","rankChange","percentile","quartile","zScore","shareOfTotal","anomalyScore","anomalyFlag"]),d=Object.freeze({updates:"Updates",updatedAt:"Updated at",sinceUpdate:"Since update",delta:"Change",deltaPercent:"Change %",rate:"Rate of change",history:"History",firstValue:"Baseline",streak:"Streak",rank:"Rank",rankAsc:"Rank, ascending",rankChange:"Rank change",percentile:"Percentile",quartile:"Quartile",zScore:"Z-score",shareOfTotal:"Share of total",anomalyScore:"Anomaly score",anomalyFlag:"Anomaly",specStatus:"Spec status",rollingSum:"Rolling sum",rollingAvg:"Rolling average",rollingMin:"Rolling minimum",rollingMax:"Rolling maximum",windowCoverage:"Window coverage",cumulativeToDate:"Cumulative to date",periodOverPeriod:"Period over period",rollingQuantile:"Rolling quantile",windowApproximate:"Window approximate",tsTrend:"Trend",tsSeasonal:"Seasonal",tsResidual:"Seasonal residual",tsCoverage:"Decomposition coverage",tsSmoothed:"Smoothed",tsSmoothingAlpha:"Smoothing α",tsSmoothingBeta:"Smoothing β",fitPredicted:"Predicted",fitResidual:"Residual",fitInfluence:"Influence",fitStdResidual:"Std. residual",fitLeverage:"Leverage",fitCooksD:"Cook's D"});function l(o,f){if(!f)return null;const w=Number.isFinite(Number(f.lower))?Number(f.lower):null,m=Number.isFinite(Number(f.upper))?Number(f.upper):null;if(w===null&&m===null||!Number.isFinite(o))return null;if(w!==null&&o<w||m!==null&&o>m)return g.FAIL;const v=Number.isFinite(Number(f.warnLower))?Number(f.warnLower):null,h=Number.isFinite(Number(f.warnUpper))?Number(f.warnUpper):null;return v!==null&&o<v||h!==null&&o>h?g.WARN:g.PASS}function i(o,f,w){if(!f||typeof f!="object")return null;if(f.kind!=="time")return f.kind!==void 0&&E(`shadow.history.window.kind:${o}`,`a 'history' shadow's 'window' only accepts {kind: 'time', span}; '${f.kind}' is not honoured (a plain count is already what 'depth' means, and a session has no span to divide into buckets), so it reported the original, unwindowed history.`),null;const m=f.minutes!=null?Number(f.minutes)*6e4:Number(f.span);if(!(m>0))return E(`shadow.history.window.span:${o}`,"a 'history' shadow's time window needs a positive 'span' (ms) or 'minutes'; it had none, so it reported the original, unwindowed history."),null;const v=Math.max(2,Math.floor(w)||z);return{span:m,bucketMs:Math.max(1,Math.floor(m/v))}}class n{#e;#t=new Map;#n=new Map;#r=new Map;#s=new Map;#i=new Map;#o=new Map;#l=0;#a;#c;#u;#f;#d=new Map;#h=null;#p=null;#m=null;constructor(f){this.#e=f.colId,this.#a=Math.max(2,f.depth||z),this.#c=Math.max(1,f.max||q),this.#u=f.now||(()=>Date.now()),this.#f=i(this.#e,f.historyWindow,this.#a),this.#f&&(this.#h=Math.floor(this.#u()/this.#f.bucketMs))}get colId(){return this.#e}get forgotten(){return this.#l}get size(){return this.#n.size}get historyWindow(){return this.#f}observe(f,w){const m=u(w);if(m===null)return;if(!this.#n.has(f)){this.#p=null,this.#m=null,this.#g(),this.#t.set(f,m),this.#n.set(f,m),this.#r.set(f,0),this.#s.set(f,this.#u()),this.#i.set(f,[m]),this.#f&&this.#d.set(f,[m]),this.#o.set(f,0);return}const v=this.#n.get(f);if(v===m)return;this.#p=null,this.#m=null,this.#n.set(f,m),this.#r.set(f,(this.#r.get(f)||0)+1),this.#s.set(f,this.#u());const h=this.#i.get(f)||[];h.push(m),h.length>this.#a&&h.splice(0,h.length-this.#a),this.#i.set(f,h);const p=Math.sign(m-v),b=this.#o.get(f)||0;this.#o.set(f,Math.sign(b)===p?b+p:p)}#g(){if(this.#n.size<this.#c)return;const f=this.#n.keys().next().value;f!==void 0&&(this.#t.delete(f),this.#n.delete(f),this.#r.delete(f),this.#s.delete(f),this.#i.delete(f),this.#d.delete(f),this.#o.delete(f),this.#l++)}rebase(){for(const[f,w]of this.#n)this.#t.set(f,w);this.#p=null,this.#m=null}reset(){this.#t.clear(),this.#n.clear(),this.#r.clear(),this.#s.clear(),this.#i.clear(),this.#d.clear(),this.#o.clear(),this.#l=0,this.#p=null,this.#m=null,this.#f&&(this.#h=Math.floor(this.#u()/this.#f.bucketMs))}retain(f){const w=f instanceof Set?f:new Set(f);let m=0;for(const v of[...this.#n.keys()])w.has(v)||(this.#t.delete(v),this.#n.delete(v),this.#r.delete(v),this.#s.delete(v),this.#i.delete(v),this.#d.delete(v),this.#o.delete(v),m++);return m&&(this.#p=null,this.#m=null),m}advanceHistoryWindow(f=this.#u()){const w=this.#f;if(!w)return 0;const m=Math.floor(f/w.bucketMs),v=m-this.#h;if(!(v>0))return 0;const h=Math.min(v,this.#a);for(const[p,b]of this.#d){const O=this.#n.get(p);for(let y=0;y<h;y++)b.push(O);b.length>this.#a&&b.splice(0,b.length-this.#a)}return this.#h=m,v}read(f,w,m,v){switch(f){case"updates":return this.#r.has(w)?this.#r.get(w):0;case"updatedAt":{const h=this.#s.get(w);return h===void 0?null:new Date(h)}case"sinceUpdate":{const h=this.#s.get(w);return h===void 0?null:this.#u()-h}case"firstValue":return this.#t.has(w)?this.#t.get(w):null;case"delta":return this.#n.has(w)?this.#n.get(w)-this.#t.get(w):null;case"deltaPercent":{if(!this.#n.has(w))return null;const h=this.#t.get(w);return h?(this.#n.get(w)-h)/Math.abs(h)*100:null}case"rate":{const h=this.#i.get(w),p=this.#s.get(w);if(!h||h.length<2||p===void 0)return null;const b=this.#u()-p,O=h[h.length-1]-h[h.length-2];return b>0?O/b*1e3:O}case"history":return this.#f?this.#d.has(w)?[...this.#d.get(w)]:null:this.#i.has(w)?[...this.#i.get(w)]:null;case"streak":return this.#o.has(w)?this.#o.get(w):0;case"specStatus":return this.#n.has(w)?l(this.#n.get(w),v):null;default:return c.includes(f)?this.#A(f,w,m,v):null}}#b(f){if(f){if(this.#m&&this.#m.only===f)return this.#m.view;const w=this.#y(f);return this.#m={only:f,view:w},w}return this.#p?this.#p:(this.#p=this.#y(null),this.#p)}#y(f){const w=[];for(const[D,F]of this.#n)f&&!f.has(D)||w.push(F);const m=w.sort((D,F)=>D-F);let v=0,h=0,p=0,b=0;for(const D of m){b+=D,v++;const F=D-h;h+=F/v,p+=F*(D-h)}const O=[];for(const[D,F]of this.#t)f&&!f.has(D)||O.push(F);const y=v?a(m):0,L=m.map(D=>Math.abs(D-y)).sort((D,F)=>D-F),M=v?a(L):0;return{sorted:m,baseline:O.sort((D,F)=>D-F),sum:b,mean:v?h:0,sd:v>1?Math.sqrt(p/(v-1)):0,median:y,mad:M}}#A(f,w,m,v){if(!this.#n.has(w)||m&&!m.has(w))return null;const h=this.#n.get(w),p=this.#b(m),b=p.sorted.length;if(!b)return null;switch(f){case"rank":return b-t(p.sorted,h)+1;case"rankAsc":return s(p.sorted,h)+1;case"rankChange":{if(!this.#t.has(w)||!p.baseline.length)return null;const O=p.baseline.length-t(p.baseline,this.#t.get(w))+1,y=b-t(p.sorted,h)+1;return O-y}case"percentile":return t(p.sorted,h)/b*100;case"quartile":{const O=t(p.sorted,h)/b;return Math.min(4,Math.max(1,Math.ceil(O*4)))}case"zScore":return p.sd?(h-p.mean)/p.sd:null;case"anomalyScore":return p.mad?j*(h-p.median)/p.mad:null;case"anomalyFlag":{if(!p.mad)return null;const O=v&&Number.isFinite(Number(v.threshold))?Number(v.threshold):k;return Math.abs(j*(h-p.median)/p.mad)>O}case"shareOfTotal":return p.sum?h/p.sum*100:null;default:return null}}}function a(o){const f=o.length;if(!f)return 0;const w=(f-1)*.5,m=Math.floor(w),v=Math.ceil(w);return m===v?o[m]:o[m]+(w-m)*(o[v]-o[m])}function s(o,f){let w=0,m=o.length;for(;w<m;){const v=w+m>>1;o[v]<f?w=v+1:m=v}return w}function t(o,f){let w=0,m=o.length;for(;w<m;){const v=w+m>>1;o[v]<=f?w=v+1:m=v}return w}function u(o){if(o==null||o==="")return null;if(o instanceof Date){const w=o.getTime();return Number.isFinite(w)?w:null}const f=typeof o=="number"?o:Number(o);return Number.isFinite(f)?f:null}function r(o){const f=[];for(const w of o||[]){const m=w.shadow;if(!m)continue;const v=typeof m=="string"?{kind:m}:m,h=v.kind;B.includes(h)&&(Y.includes(h)||G.includes(h)||f.push({colId:w.id||w.field,of:v.of||w.field||w.id,kind:h,depth:v.depth,historyWindow:h==="history"?v.window:void 0}))}return f}}),Ue("packages/core/src/columns/model.js",function(e,U){"use strict";Object.defineProperty(e,"BUILTIN_DEFAULTS",{enumerable:!0,get:function(){return P}}),Object.defineProperty(e,"normaliseAlign",{enumerable:!0,get:function(){return C}}),Object.defineProperty(e,"normaliseVAlign",{enumerable:!0,get:function(){return A}}),Object.defineProperty(e,"expandColumn",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"ColumnModel",{enumerable:!0,get:function(){return ue}}),Object.defineProperty(e,"flattenTree",{enumerable:!0,get:function(){return Me}});const te=U("packages/core/src/internal/merge.js"),E=te.expand,q=te.merge,z=te.toArray,_=U("packages/core/src/internal/warn.js"),Z=_.fail,X=_.warnOnce,B=U("packages/core/src/internal/paths.js"),Y=B.getPath,G=B.pathGetter,j=B.pathSetter,g=U("packages/core/src/internal/text.js").humanise,c=U("packages/core/src/internal/predicates.js"),d=c.isFunction,l=c.isObject,n=U("packages/core/src/internal/uid.js").uid,s=U("packages/core/src/format/index.js").compileFormat,t=U("packages/core/src/columns/datatypes.js"),u=t.comparatorFor,r=t.createTypeRegistry,o=t.storageKind,f=U("packages/core/src/columns/infer.js"),w=f.inferColumnType,m=f.DEFAULT_SAMPLE,v=U("packages/core/src/columns/graph.js"),h=v.buildGraph,p=v.affectedBy,O=U("packages/core/src/columns/lookup.js").createLookup,y=U("packages/core/src/columns/value.js"),L=y.compileDisplay,M=y.ValuePipeline,D=y.warnImpureUse,T=U("packages/core/src/model/shadow.js").FIT_SHADOW_KINDS,I=Object.freeze({geometry:"geometry",list:"list"}),P={value:{pure:!0},cell:{},edit:{enabled:!1},sort:{enabled:!0,direction:null,order:0,nullsFirst:!1},filter:{enabled:!0,type:"text"},group:{enabled:!1,index:-1,explode:!1},pivot:{enabled:!1,index:-1},total:null,layout:{width:150,min:40,max:null,flex:0,pin:null,hidden:!1,resizable:!0,movable:!0,lockVisible:!1,lockPosition:!1},header:{},facet:{},export:{lookup:"label",csv:!0,excel:!0},allowGroup:!0,allowPivot:!0,allowTotal:!0,nullable:!0,quickFilter:!0},R={centre:"center"},$=new Set(["start","center","end","left","right"]);function C(Pe){if(typeof Pe!="string")return;const ie=Pe.toLowerCase();return R[ie]?R[ie]:$.has(ie)?ie:void 0}function A(Pe){if(typeof Pe!="string")return;const ie=Pe.toLowerCase();return ie==="center"||ie==="centre"?"middle":ie==="top"||ie==="middle"||ie==="bottom"?ie:void 0}const S=["cell","layout","header"];function x(Pe){if(!l(Pe))return{};const ie={...Pe},Oe=(je,Ce)=>{if(Pe[je]===void 0)return;const fe=E(Pe[je],Ce);fe&&S.includes(je)&&!l(Pe[je])&&delete fe.enabled,ie[je]=fe};return Oe("sort","direction"),Oe("filter","type"),Oe("cell","render"),Oe("edit","editor"),Oe("layout","width"),Oe("group","index"),Oe("pivot","index"),Oe("header","render"),Oe("facet","strategy"),ie}function H(Pe,ie){const Oe={...Pe||{}},je=l(ie)&&l(ie.layout)&&ie.layout.width!==void 0;return Oe.fit==="content"&&!je&&delete Oe.width,Oe}const V=new Set(["allowGroup","allowPivot","allowTotal","cell","colSpan","contextMenu","diff","edit","export","facet","field","filter","filterRow","format","grandTotal","group","groupTotal","header","headerControls","id","layout","lookup","nullable","pivot","preset","quickFilter","rowSpan","running","shadow","showWhen","sort","spec","tags","title","total","type","typeOptions","validation","value","verticalAlign"]),W=new Set(["collapsible","columns","facet","header","id","marryChildren","openByDefault","showWhen","title"]);function Q(Pe,ie,Oe,je){const Ce=Oe==="columnGroup"?"column group":"column";for(const fe of Object.keys(Pe))if(!ie.has(fe)){if(fe==="timeZone"&&Oe==="column"){X("column.timeZone",`\`timeZone\` is not a column option, so it had no effect on column "${je}". A date column stores, displays, sorts and filters in the grid-level \`timeZone\` (else the viewer's); set \`timeZone\` on the grid, not the column.`);continue}X(`${Oe}.unknown:${fe}`,`'${fe}' is not a configuration key this grid recognises, so it had no effect on ${Ce} "${je}". Check the spelling against the reference.`)}}function ee(Pe){l(Pe.cell)&&Pe.cell.autoHeight!==void 0&&X("column.cell.autoHeight",`\`cell.autoHeight\` is not a column option, so it had no effect on column "${Pe.id||Pe.field||"(unnamed)"}". Rows grow to fit with the grid-level \`autoHeight\`; \`cell.wrap\` lets this column's text wrap.`)}function re(Pe,ie){const Oe=ie&&d(Pe.defaultsFor)?Pe.defaultsFor(ie):null,je={...Pe.defaults||{},...l(Oe)?Oe:{}},Ce={};return je.align&&(Ce.align=je.align,Ce.cell={align:je.align},Ce.header={align:je.align}),je.filter&&(Ce.filter=je.filter==="none"?{enabled:!1,type:"none"}:{enabled:!0,type:je.filter}),je.editor&&(Ce.edit=je.editor==="none"?{editor:null}:{editor:je.editor}),je.total&&(Ce.total=je.total),je.render&&(Ce.cell={...Ce.cell||{},render:je.render}),Pe.export&&(Ce.export={...Pe.export}),Ce}function ae(Pe){if(typeof Pe=="string")return Pe.trim()?[Pe.trim()]:[];if(!Array.isArray(Pe))return[];const ie=[];for(const Oe of Pe){if(typeof Oe!="string")continue;const je=Oe.trim();je&&!ie.includes(je)&&ie.push(je)}return ie}class ue{#e=new Map;#t=[];#n=[];#r=new WeakMap;#s;#i;#o;#l;#a;#c;#u(ie,Oe,je){const Ce=this.#f(ie,Oe,je);if(typeof Ce!="string"||!this.#d)return Ce??null;const fe=Oe&&Oe.totals&&Oe.totals.implement;if(fe&&d(fe[Ce])){const le=fe[Ce];return le.totalName=Ce,le}const Ee=this.#d.totalFn?.(Ce);return d(Ee)?Ee:Ce}#f(ie,Oe,je){if(typeof ie!="string")return ie;const Ce=Oe&&Oe.totals&&Oe.totals.supported;if(!Array.isArray(Ce)||Ce.includes(ie))return ie;const fe=Ce.length?Ce.join(", "):"none";return Z(`column "${je}" is typed ${Oe.name||"a type"}, for which the total "${ie}" is not meaningful. Supported: ${fe}. Aggregating it anyway would produce a confident wrong number.`),ie}#d;#h;#p;#m;#g;#b;#y=!1;#A;#w;constructor(ie={}){this.#i=x(ie.columnDefaults||{}),this.#o=ie.columnPresets||{},this.#a=ie.locale,this.#l=ie.timeZone,this.#c=A(ie.verticalAlign),this.#d=ie.registry||null,this.#h=ie.grid||null,this.#p=ie.context,this.#A=ie.sampleSize??m,this.#w=ie.onChange||null,this.#b=d(ie.rowKey)?ie.rowKey:void 0,this.#s=r(ie.dataTypes,this.#d);const{leaves:Oe,groups:je}=Me(ie.columns||[]);this.#n=je;for(const Ce of Oe){Ce.facet!==void 0&&this.#r.set(Ce.def,Ce.facet);const fe=this.#O(Ce.def,null);if(fe.groupPath=Ce.path,this.#e.has(fe.id)){X(`columns.duplicate:${fe.id}`,`two columns resolve to the id '${fe.id}', so the second is ignored. An id defaults to the column's field, so declare an explicit \`id\` when two columns read the same field.`);continue}Ce.column=fe,this.#e.set(fe.id,fe),this.#t.push(fe.id)}this.#E(ie.stored||null)}#O(ie,Oe){Q(ie,V,"column",ie.id||ie.field||"(unnamed)"),ee(ie);const je=x(ie),Ce=z(ie.preset),fe=Ce.map(tt=>{const pt=this.#o[tt];return pt?x(pt):(X(`preset:${tt}`,`unknown column preset "${tt}"; ignoring`),{})}),Ee=this.#S(je,fe,Oe),le=this.#s.get(Ee)||this.#s.get("text");if(!this.#s.has(Ee)&&ie.type){const tt=I[Ee];X(`type:${Ee}`,`unknown data type "${Ee}"; falling back to "text"`+(tt?`. It is registered by importing '@toclocoinc/lattice-grid/modules/${tt}'.`:""))}const de=d(le.items)?this.#T(je,fe,ie.id||ie.field||"(unnamed)"):null;let Se=P;Se=q(Se,this.#i),ie.type!==!1&&(Se=q(Se,re(le,de)));for(const tt of fe)Se=q(Se,tt);this.#r.has(ie)&&(Se=q(Se,x({facet:this.#r.get(ie)}))),Se=q(Se,je);const Fe=Se.edit;Fe&&Fe.editor&&Fe.enabled!==!0&&!d(Fe.enabled)&&(ie.edit||{}).editor&&X(`column.editor-not-enabled:${ie.id||ie.field}`,`column '${ie.id||ie.field}' names the editor '${Fe.editor}' but does not enable editing, so it stays read-only. Add \`enabled: true\`, or use \`edit: true\` and set \`editor\` alongside it.`);const ke=ie.id||ie.field||n("col");if(ie.shadow&&!d(Se.value&&Se.value.compute)){const tt=typeof ie.shadow=="string"?{kind:ie.shadow}:ie.shadow,pt=tt.of||ie.field||ke,yt=T.includes(tt.kind),kt=yt?tt.model||tt:null,Pt=yt&&kt?[...Array.isArray(kt.predictors)?kt.predictors:[],kt.response].filter(Boolean):null;Se.value={...Se.value||{},deps:Pt&&Pt.length?Pt:tt.orderBy&&tt.orderBy!==pt?[pt,tt.orderBy]:[pt],pure:!1,compute:(Ct,Lt)=>{const Rt=Lt.grid&&Lt.grid.statistics;if(!Rt)return null;const Bt=Lt.row&&Lt.row.key||Rt.keyOf(Lt.data);if(!Bt)return null;if(yt){if(!d(Rt.fitShadow))return null;const ht=tt.model?{...tt.model,threshold:tt.threshold}:tt;return Rt.fitShadow(tt.kind,Bt,ht)}return Rt.shadow(pt,tt.kind,Bt,tt.scope,tt)}}}if(ie.running&&!d(Se.value&&Se.value.compute)){const tt=typeof ie.running=="string"?{kind:ie.running}:ie.running,pt=tt.of||ie.field||ke;Se.value={...Se.value||{},deps:[pt],pure:!1,compute:(yt,kt)=>{const Pt=kt.grid&&kt.grid.statistics;if(!Pt||!d(Pt.running))return null;const Ct=kt.row&&kt.row.key||Pt.keyOf(kt.data);return Ct?Pt.running(pt,tt.kind||"total",Ct):null}},ie.sort===void 0&&(Se.sort={...Se.sort||{},enabled:!1})}const Ie=ie.field??(d(Se.value&&Se.value.compute)?null:ie.id??null),Be=d(Se.value&&Se.value.compute),Ke={id:ke,field:Ie,shadow:ie.shadow||null,running:ie.running||null,spec:ie.spec||null,validation:ie.validation||null,volatile:!!(ie.shadow||ie.running),title:Se.title??g(Ie||ke),type:le.name,dataType:le,itemType:de,nullable:Se.nullable!==!1,align:C(je.cell&&je.cell.align||je.align||Se.cell&&Se.cell.align||Se.align||le.defaults&&le.defaults.align)||"start",verticalAlign:A(je.cell&&je.cell.verticalAlign||je.verticalAlign||Se.cell&&Se.cell.verticalAlign||Se.verticalAlign)||this.#c,rowSpan:d(Se.rowSpan)?Se.rowSpan:null,colSpan:d(Se.colSpan)?Se.colSpan:null,value:{pure:!0,...Se.value||{}},cell:{...Se.cell||{}},edit:{...Se.edit||{}},sort:{...Se.sort||{}},filter:{...Se.filter||{}},group:{enabled:!1,index:-1,explode:!1,...Se.group||{}},pivot:{enabled:!1,index:-1,...Se.pivot||{}},total:this.#u(Se.total,le,ie.id||ie.field||"(unnamed)"),groupTotal:Se.groupTotal===void 0?null:this.#u(Se.groupTotal,le,ie.id||ie.field||"(unnamed)"),grandTotal:Se.grandTotal===void 0?null:this.#u(Se.grandTotal,le,ie.id||ie.field||"(unnamed)"),tags:ae(Se.tags),typeOptions:Se.typeOptions??null,...l(Se[Ee])?{[Ee]:Se[Ee]}:{},layout:H(Se.layout,je),header:{...Se.header||{}},contextMenu:Se.contextMenu===void 0?null:Se.contextMenu,facet:{...Se.facet||{}},export:{...Se.export||{}},allowGroup:Se.allowGroup!==!1,allowPivot:Se.allowPivot!==!1,allowTotal:Se.allowTotal!==!1,quickFilter:Se.quickFilter!==!1,def:ie,format:Se.format,presets:Ce,inferred:Oe!=null&&!ie.type,computed:Be,diff:ie.diff===void 0?void 0:!!ie.diff,read:Ie?G(Ie):null,write:Ie?j(Ie):null};Ke.cell.align=C(je.cell&&je.cell.align)||Ke.align,Ke.header.align=C(je.header&&je.header.align)||Ke.align;const rt=Se.lookup||null;return Ke.lookup=rt?O({id:ke,lookup:rt},{locale:this.#a,onChange:()=>{this.#w&&this.#w("lookup",{colId:ke})}}):null,Ke.group.explode&&Ke.lookup&&Ke.lookup.multiple&&X(`explode:${ke}`,`column "${ke}" has \`group.explode\`, so rows appear under each of their values and totals double-count. Group footers should be annotated accordingly.`),this.#v(Ke),Ke}#v(ie){ie.formatter=s(ie.format,ie.dataType,this.#a,this.#l,ie.id),ie.formatValue=L(ie,{locale:this.#a,grid:this.#h,context:this.#p}),ie.itemCompare=ie.itemType?u(ie.itemType,this.#a):null,ie.compare=d(ie.value.compare)?ie.value.compare:ie.lookup?ie.lookup.comparator():d(ie.dataType.compareFor)?ie.dataType.compareFor(ie):u(ie.dataType,this.#a),ie.excel=ie.formatter&&ie.formatter.ooxml||ie.dataType&&ie.dataType.excel||"General",ie.storeKind=o(ie.dataType,!!(ie.lookup&&ie.lookup.multiple))}#T(ie,Oe,je){let Ce=l(ie.typeOptions)?ie.typeOptions:null;for(let de=Oe.length-1;!Ce&&de>=0;de--)l(Oe[de].typeOptions)&&(Ce=Oe[de].typeOptions);!Ce&&l(this.#i.typeOptions)&&(Ce=this.#i.typeOptions);const fe=Ce&&Ce.of!==void 0?Ce.of:"text",Ee=typeof fe=="string"?this.#s.get(fe):void 0;return Ee&&!d(Ee.items)&&Ee.storage!=="object"?Ee:(X(`type:of:${String(fe)}`,`column "${je}" names "${String(fe)}" as its item type (typeOptions.of), which is not ${Ee?"a scalar data type":"a known data type"}; its items are read as text.`),this.#s.get("text"))}#S(ie,Oe,je){if(ie.type===!1)return"text";if(ie.type)return ie.type;for(let Ce=Oe.length-1;Ce>=0;Ce--)if(Oe[Ce].type)return Oe[Ce].type;if(this.#i.type)return this.#i.type;if(ie.shadow){const Ce=typeof ie.shadow=="string"?ie.shadow:ie.shadow.kind;if(Ce==="fitInfluence")return"boolean";if(Ce==="fitPredicted"||Ce==="fitResidual"||Ce==="fitStdResidual"||Ce==="fitLeverage"||Ce==="fitCooksD"||Ce==="tsTrend"||Ce==="tsSeasonal"||Ce==="tsResidual"||Ce==="tsCoverage"||Ce==="tsSmoothed"||Ce==="tsSmoothingAlpha"||Ce==="tsSmoothingBeta")return"number"}return je||(ie.lookup?"lookup":"text")}#E(ie){const Oe=this.all();this.#m=h(Oe),this.#g?this.#g.setGraph(this.#m):this.#g=new M({columns:this.#e,graph:this.#m,grid:this.#h,context:this.#p,stored:ie||null,rowKey:this.#b});const je=this.#g;for(const Ce of Oe)Ce.getValue=(fe,Ee)=>je.value(Ce,fe,Ee)}all(){return this.#t.map(ie=>this.#e.get(ie))}visible(){return this.all().filter(ie=>!ie.layout.hidden)}get(ie){return this.#e.get(ie)}groups(){const ie=Oe=>{const je=[];for(const Ce of Oe)Array.isArray(Ce.columns)?je.push({...Ce,columns:ie(Ce.columns)}):Ce.column&&je.push(Ce.column);return je};return ie(this.#n)}graph(){return this.#m}pipeline(){return this.#g}types(){return this.#s}affectedBy(ie){return p(this.#m,ie)}value(ie,Oe,je){return this.#g.value(ie,Oe,je)}text(ie,Oe,je){return this.#g.text(ie,Oe,je)}checkImpure(ie,Oe){D(this.#e.get(ie),Oe)}setLocale(ie){this.#a=ie;for(const Oe of this.all())Oe.lookup&&Oe.lookup.setLocale(ie),this.#v(Oe);this.#w&&this.#w("locale",{locale:ie})}infer(ie){const Oe={};if(this.#y||!Array.isArray(ie)||ie.length===0)return Oe;this.#y=!0;let je=!1;for(const Ce of this.all()){const fe=Ce.def;if(fe.type!==void 0||!Ce.field||Ce.computed||Ce.lookup||this.#M(Ce))continue;const Ee=Ce.read||(Se=>Y(Se,Ce.field)),le=w(Ce.id,ie,Ee,this.#s,{sampleSize:this.#A});if(le===Ce.type)continue;Oe[Ce.id]=le;const de=this.#O(fe,le);de.groupPath=Ce.groupPath,de.layout={...de.layout,...ge(Ce.layout)},this.#e.set(Ce.id,de),Ne(this.#n,Ce.id,de),je=!0}return je&&this.#E(null),Oe}redecorate(ie,Oe,je={}){const Ce=this.#e.get(ie);if(!Ce){X(`redecorate:${ie}`,`columns.decorate('${ie}', …): no column with id '${ie}'.`);return}const fe=Ce.def||{},Ee={...l(fe.cell)?fe.cell:{}};Ee.decoration=Oe??void 0,je&&"variant"in je&&(Ee.variant=je.variant);const le={...fe,cell:Ee};this.#r.has(fe)&&this.#r.set(le,this.#r.get(fe));const de=this.#O(le,Ce.type);return de.groupPath=Ce.groupPath,de.layout={...de.layout,...ge(Ce.layout)},Ce.lookup&&Ce.lookup!==de.lookup&&d(Ce.lookup.destroy)&&Ce.lookup.destroy(),this.#e.set(ie,de),Ne(this.#n,ie,de),this.#E(null),this.#w&&this.#w("decorate",{colId:ie}),de}destroy(){for(const ie of this.#e.values())ie.lookup&&d(ie.lookup.destroy)&&ie.lookup.destroy()}#M(ie){for(const Oe of ie.presets){const je=this.#o[Oe];if(je&&je.type)return!0}return!!this.#i.type}#P(ie){return!ie.computed&&d(ie.dataType&&ie.dataType.toStorage)}storeReader(ie){if(ie.computed)return Oe=>this.#g.value(ie,Oe,null);if(this.#P(ie)){const Oe=ie.dataType.toStorage,je={timeZone:this.#l,colId:ie.id,itemType:ie.itemType||null};return Ce=>Oe(ie.read(Ce),je)}return ie.read}storeValue(ie,Oe){if(!(!ie||ie.computed)&&d(ie.read))return this.storeReader(ie)(Oe)}storeSchema(){const ie=[];for(const Oe of this.all()){if(Oe.computed&&Oe.value.pure===!1||!Oe.computed&&!Oe.field)continue;const je=this.storeReader(Oe);let Ce=null;!Oe.computed&&!this.#P(Oe)&&typeof Oe.field=="string"&&!Oe.lookup&&(Ce=Oe.field);const fe={id:Oe.id,kind:Oe.storeKind,nullable:Oe.nullable,read:je};Ce!==null&&(fe.field=Ce),Oe.lookup&&(fe.dictionary=Oe.lookup.dictionary()),ie.push(fe)}return ie}state(){return this.all().map(ie=>({id:ie.id,width:ie.layout.width,flex:ie.layout.flex||void 0,hidden:!!ie.layout.hidden,headerWrap:ie.header?.wrap===!0?!0:void 0,headerOrientation:ie.header?.orientation==="vertical"?"vertical":void 0,pin:ie.layout.pin??null,sort:ie.sort.direction??null,sortIndex:ie.sort.direction?ie.sort.order??0:null,groupIndex:ie.group.enabled?ie.group.index??0:null,pivotIndex:ie.pivot.enabled?ie.pivot.index??0:null,total:typeof ie.total=="string"?ie.total:null,groupTotal:typeof ie.groupTotal=="string"?ie.groupTotal:void 0,grandTotal:typeof ie.grandTotal=="string"?ie.grandTotal:void 0,decoration:ie.cell&&ie.cell.decoration!=null?Ae(ie.cell.decoration):void 0,variant:ie.cell&&ie.cell.variant!=null?Ae(ie.cell.variant):void 0}))}applyState(ie,Oe={}){const je={applied:[],skipped:[]},Ce=Array.isArray(ie)?ie:ie&&ie.columns||[],fe=!Array.isArray(ie)&&ie&&ie.columnOrder||null;for(const le of Ce){if(!le||!le.id){je.skipped.push({key:"?",reason:"no id"});continue}let de=this.#e.get(le.id);if(!de){je.skipped.push({key:le.id,reason:"unknown column"});continue}if(Object.hasOwn(le,"decoration")||Object.hasOwn(le,"variant")){const Se=de.cell?de.cell.decoration:void 0,Fe=le.decoration??null,ke=Object.hasOwn(le,"variant"),Ie=ke&&!pe(de.cell?de.cell.variant:void 0,le.variant);(!pe(Se,Fe)||Ie)&&(this.redecorate(le.id,Fe,ke?{variant:le.variant??void 0}:{}),de=this.#e.get(le.id)||de)}le.width!=null&&(de.layout.width=le.width),le.flex!=null&&(de.layout.flex=le.flex),le.hidden!=null&&(de.layout.hidden=!!le.hidden),le.headerWrap!==void 0&&(de.header.wrap=!!le.headerWrap),le.headerOrientation!==void 0&&(de.header.orientation=le.headerOrientation==="vertical"?"vertical":"horizontal"),le.pin!==void 0&&(de.layout.pin=le.pin),le.sort!==void 0&&(de.sort.direction=le.sort),le.sortIndex!=null&&(de.sort.order=le.sortIndex),le.groupIndex!=null&&(de.group.enabled=!0,de.group.index=le.groupIndex),le.pivotIndex!=null&&(de.pivot.enabled=!0,de.pivot.index=le.pivotIndex),le.total!==void 0&&(de.total=le.total),le.groupTotal!==void 0&&(de.groupTotal=le.groupTotal),le.grandTotal!==void 0&&(de.grandTotal=le.grandTotal),je.applied.push(le.id)}const Ee=fe||(Oe&&Oe.keepOrder?[]:Ce.map(le=>le&&le.id).filter(Boolean));if(Ee.length){const le=Ee.filter(Se=>this.#e.has(Se)),de=this.#t.filter(Se=>!le.includes(Se));this.#t=[...le,...de]}return this.#w&&this.#w("state",je),je}move(ie,Oe){this.#N(ie,Oe)&&(this.#$(),this.#w&&this.#w("move",{id:ie,to:Oe}))}reorder(ie){const Oe={applied:[],skipped:[]},je=[];let Ce=0;for(const fe of Array.isArray(ie)?ie:[]){const Ee=Ce++;this.#N(fe,Ee)&&(Oe.applied.push(fe),je.push({id:fe,to:Ee}))}if(!je.length)return Oe;if(this.#$(),this.#w)for(const fe of je)this.#w("move",fe);return Oe}#N(ie,Oe){const je=this.#t.indexOf(ie);if(je===-1||Math.max(0,Math.min(Number(Oe)||0,this.#t.length-1))===je)return!1;const fe=this.#e.get(ie);if(fe.layout.movable===!1||fe.layout.lockPosition)return X(`move:${ie}`,`column "${ie}" is not movable; the move was ignored`),!1;const Ee=this.#R(ie,Oe);return Ee?(X(`move.married:${Ee}`,`band "${Ee}" declares marryChildren, so its columns stay together; the move was ignored`),!1):(this.#t.splice(je,1),this.#t.splice(Math.max(0,Math.min(Oe,this.#t.length)),0,ie),!0)}#R(ie,Oe){if(!this.#n||!this.#n.length)return null;const je=this.#t.filter(le=>le!==ie),Ce=Math.max(0,Math.min(Oe,je.length)),fe=(le,de)=>{if(Array.isArray(le.columns)){for(const Fe of le.columns)fe(Fe,de);return de}const Se=le.column?le.column.id:le.id;return Se&&de.push(Se),de},Ee=le=>{for(const de of le){if(!Array.isArray(de.columns))continue;if(de.marryChildren===!0){const Fe=fe(de,[]),ke=Fe.includes(ie),Ie=Fe.map(Be=>je.indexOf(Be)).filter(Be=>Be>=0);if(Ie.length){const Be=Math.min(...Ie),Ke=Math.max(...Ie);if(ke?Ce<Be||Ce>Ke+1:Ce>Be&&Ce<=Ke)return de.id}}const Se=Ee(de.columns);if(Se)return Se}return null};return Ee(this.#n)}#$(){const ie=new Map(this.#t.map((Ce,fe)=>[Ce,fe])),Oe=Ce=>{if(!Array.isArray(Ce.columns)){const Ee=Ce.column?Ce.column.id:Ce.id;return ie.has(Ee)?ie.get(Ee):1/0}let fe=1/0;for(const Ee of Ce.columns)fe=Math.min(fe,Oe(Ee));return fe},je=Ce=>{Ce.sort((fe,Ee)=>Oe(fe)-Oe(Ee));for(const fe of Ce)Array.isArray(fe.columns)&&je(fe.columns)};je(this.#n)}#_(ie){const Oe=je=>{for(let Ce=0;Ce<je.length;Ce++){const fe=je[Ce];if(Array.isArray(fe.columns)){const Ee=Oe(fe.columns);if(Ee)return Ee}else if(fe.column&&fe.column.id===ie)return je.splice(Ce,1)[0]}return null};return Oe(this.#n)}#G(ie){const Oe=[];for(let je=ie.length-1;je>=0;je--){const Ce=ie[je];Array.isArray(Ce.columns)&&(Oe.push(...this.#G(Ce.columns)),Ce.columns.length===0&&(Oe.push(Ce.id),ie.splice(je,1)))}return Oe}#D(){const ie=(Oe,je,Ce)=>{for(const fe of Oe)Array.isArray(fe.columns)?ie(fe.columns,[...je,fe.id]):fe.column&&(fe.column.groupPath=je)};ie(this.#n,[])}#F(ie){const Oe=new Set(ie),je=this.#t.filter(le=>Oe.has(le));if(!je.length)return;const Ce=Math.min(...je.map(le=>this.#t.indexOf(le))),fe=this.#t.slice(0,Ce).filter(le=>!Oe.has(le)),Ee=this.#t.slice(Ce).filter(le=>!Oe.has(le));this.#t=[...fe,...je,...Ee]}#Y(ie){const Oe=[],je=Ce=>{if(Array.isArray(Ce.columns))for(const fe of Ce.columns)je(fe);else Ce.column&&Oe.push(Ce.column.id)};return je(ie),Oe}#x(ie){const Oe=je=>{for(const Ce of je){if(!Array.isArray(Ce.columns))continue;if(Ce.id===ie)return{node:Ce,parent:je};const fe=Oe(Ce.columns);if(fe)return fe}return null};return Oe(this.#n)}groupColumns(ie,Oe={}){const je=z(ie).filter(de=>this.#e.has(de));if(!je.length)return X("columns.group.empty","groupColumns was given no known column ids; nothing was grouped."),null;for(const de of je)if(this.#e.get(de).layout.lockPosition)return X(`columns.group.locked:${de}`,`column "${de}" is position-locked and cannot be grouped.`),null;const Ce=Oe.groupId?this.#x(Oe.groupId):null;if(Oe.groupId&&!Ce)return X(`columns.group.unknown:${Oe.groupId}`,`no band "${Oe.groupId}" to add to; nothing was grouped.`),null;let fe=null;if(!Ce&&Oe.id!=null&&(fe=String(Oe.id),this.#x(fe)||this.#e.has(fe)))return X(`columns.group.idtaken:${fe}`,`band id "${fe}" is already in use; nothing was grouped.`),null;const Ee=je.map(de=>this.#_(de)).filter(Boolean);if(!Ee.length)return null;let le;if(Ce)Ce.node.columns.push(...Ee),le=Ce.node.id;else{const de={id:fe||n("grp"),title:Oe.title||"",collapsible:!1,openByDefault:!0,showWhen:"always",marryChildren:!1,header:{},def:{},columns:Ee},Se=Number.isInteger(Oe.at)?Math.max(0,Math.min(Oe.at,this.#n.length)):this.#n.length;this.#n.splice(Se,0,de),le=de.id}return this.#G(this.#n),this.#F(je),this.#D(),this.#$(),this.#w&&this.#w("columngroup",{action:"formed",groupId:le,ids:je}),le}ungroupColumn(ie){const Oe=this.#e.get(ie);if(!Oe){X(`columns.ungroup.unknown:${ie}`,`no column "${ie}" to ungroup.`);return}const je=Oe.groupPath||[];if(!je.length)return;const Ce=je[je.length-1],fe=this.#x(Ce);if(!fe)return;const Ee=this.#_(ie);if(!Ee)return;const le=fe.parent.indexOf(fe.node);fe.parent.splice(le+1,0,Ee);const de=this.#G(this.#n),Se=this.#Y(fe.node);if(Se.length){this.#F(Se);const Fe=Math.max(...Se.map(Ie=>this.#t.indexOf(Ie))),ke=this.#t.filter(Ie=>Ie!==ie);ke.splice(Fe+1,0,ie),this.#t=ke}this.#D(),this.#$(),this.#w&&this.#w("columngroup",{action:"removed",id:ie,dissolved:de})}renameGroup(ie,Oe){const je=this.#x(ie);if(!je){X(`columns.group.rename:${ie}`,`no band "${ie}" to rename.`);return}je.node.title=String(Oe??""),this.#w&&this.#w("columngroup",{action:"renamed",groupId:ie,title:je.node.title})}dissolveGroup(ie){const Oe=this.#x(ie);if(!Oe){X(`columns.group.dissolve:${ie}`,`no band "${ie}" to dissolve.`);return}const je=Oe.parent.indexOf(Oe.node);Oe.parent.splice(je,1,...Oe.node.columns),this.#D(),this.#$(),this.#w&&this.#w("columngroup",{action:"dissolved",groupId:ie})}moveGroup(ie,Oe){const je=this.#x(ie);if(!je){X(`columns.group.move:${ie}`,`no band "${ie}" to move.`);return}const Ce=je.parent,fe=Ce.indexOf(je.node);fe!==-1&&(Ce.splice(fe,1),Ce.splice(Math.max(0,Math.min(Oe,Ce.length)),0,je.node),this.#K(),this.#D(),this.#w&&this.#w("columngroup",{action:"moved",groupId:ie,to:Oe}))}#K(){const ie=[],Oe=Ce=>{for(const fe of Ce)Array.isArray(fe.columns)?Oe(fe.columns):fe.column&&ie.push(fe.column.id)};Oe(this.#n);const je=new Set(ie);this.#t=[...ie,...this.#t.filter(Ce=>!je.has(Ce))]}groupTree(){const ie=je=>je.map(Ce=>Array.isArray(Ce.columns)?{id:Ce.id,title:Ce.title||"",collapsible:!!Ce.collapsible,openByDefault:Ce.openByDefault!==!1,columns:ie(Ce.columns)}:Ce.column?Ce.column.id:null).filter(Ce=>Ce!==null),Oe=ie(this.#n);return Oe.some(je=>je&&typeof je=="object")?Oe:[]}applyGroupTree(ie){if(!Array.isArray(ie))return;const Oe=new Set,je=fe=>{const Ee=[];for(const le of fe)if(le&&typeof le=="object"&&Array.isArray(le.columns)){const de=je(le.columns);if(!de.length)continue;Ee.push({id:le.id||n("grp"),title:le.title||"",collapsible:le.collapsible===!0,openByDefault:le.openByDefault!==!1,showWhen:"always",marryChildren:!1,header:{},def:{},columns:de})}else if(typeof le=="string"){const de=this.#e.get(le);de&&!Oe.has(le)&&(Oe.add(le),Ee.push({column:de,path:[]}))}return Ee},Ce=je(ie);for(const fe of this.#t){if(Oe.has(fe))continue;const Ee=this.#e.get(fe);Ee&&Ce.push({column:Ee,path:[]})}this.#n=Ce,this.#D(),this.#$(),this.#w&&this.#w("columngroup",{action:"applied"})}show(ie){this.#U(ie,!1)}hide(ie){this.#U(ie,!0)}#U(ie,Oe){const je=[];for(const Ce of z(ie)){const fe=this.#e.get(Ce);if(fe){if(Oe&&fe.layout.lockVisible){X(`lockVisible:${Ce}`,`column "${Ce}" is \`layout.lockVisible\` and cannot be hidden`);continue}fe.layout.hidden!==Oe&&(fe.layout.hidden=Oe,je.push(Ce))}}je.length&&this.#w&&this.#w("visible",{ids:je,hidden:Oe})}pin(ie,Oe){const je=this.#e.get(ie);je&&(je.layout.pin=Oe??null,this.#w&&this.#w("pin",{id:ie,side:je.layout.pin}))}pinMany(ie){const Oe={};for(const[Ce,fe]of ie){const Ee=this.#e.get(Ce);Ee&&(Ee.layout.pin=fe??null,Oe[Ce]=Ee.layout.pin)}const je=Object.keys(Oe);je.length&&this.#w&&this.#w("pin",{ids:je,pins:Oe})}#H(ie,Oe){const je=ie.layout.min??0,Ce=ie.layout.max;let fe=Math.max(je,Oe);return Ce!=null&&(fe=Math.min(Ce,fe)),ie.layout.width=fe,ie.layout.flex=0,fe}resize(ie,Oe){const je=this.#e.get(ie);if(!je)return;if(je.layout.resizable===!1){X(`resize:${ie}`,`column "${ie}" is not resizable; the resize was ignored`);return}const Ce=this.#H(je,Oe);this.#w&&this.#w("resize",{id:ie,width:Ce})}resizeMany(ie){const Oe={};for(const[Ce,fe]of ie){const Ee=this.#e.get(Ce);if(Ee){if(Ee.layout.resizable===!1){X(`resize:${Ce}`,`column "${Ce}" is not resizable; the resize was ignored`);continue}Oe[Ce]=this.#H(Ee,fe)}}const je=Object.keys(Oe);je.length&&this.#w&&this.#w("resize",{ids:je,widths:Oe})}}function ge(Pe){const ie={};return Pe.width!=null&&(ie.width=Pe.width),Pe.hidden!=null&&(ie.hidden=Pe.hidden),Pe.pin!==void 0&&(ie.pin=Pe.pin),ie}function Ae(Pe){if(Pe===null||typeof Pe!="object")return Pe;try{return structuredClone(Pe)}catch{}try{return JSON.parse(JSON.stringify(Pe))}catch{return Pe}}function pe(Pe,ie){const Oe=Pe??null,je=ie??null;if(Oe===je)return!0;if(Oe===null||je===null)return!1;if(typeof Oe!="object"||typeof je!="object")return Oe===je;try{return JSON.stringify(Oe)===JSON.stringify(je)}catch{return!1}}function Me(Pe){const ie=[],Oe=(Ce,fe,Ee)=>{const le=[];for(const de of Ce){if(!l(de)){Z("a column definition must be an object");continue}if(Array.isArray(de.columns)){Q(de,W,"columnGroup",de.title||de.id||"(unnamed)");const Se={id:de.id||n("grp"),title:de.title||"",collapsible:de.collapsible===!0,openByDefault:de.openByDefault!==!1,showWhen:de.showWhen||"always",marryChildren:de.marryChildren===!0,header:de.header||{},def:de,columns:[]};Se.columns=Oe(de.columns,[...fe,Se.id],de.facet!==void 0?de.facet:Ee),le.push(Se)}else{const Se={def:de,path:fe,facet:Ee};ie.push(Se),le.push(Se)}}return le},je=Oe(Pe,[],void 0);return{leaves:ie,groups:je}}function Ne(Pe,ie,Oe){for(const je of Pe){if(je.columns){if(Ne(je.columns,ie,Oe))return!0;continue}if(je.column&&je.column.id===ie)return je.column=Oe,!0}return!1}}),Ue("packages/core/src/columns/autogroup.js",function(e,U){"use strict";Object.defineProperty(e,"AUTO_GROUP_ID",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"createAutoGroupColumn",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"warnOnAbsurdGrouping",{enumerable:!0,get:function(){return X}});const E=U("packages/core/src/internal/warn.js").warnOnce,q="__lattice_group",z=240,_=.5;function Z(B){const{columns:Y,groupBy:G}=B,j=G.map(c=>Y.get(c)).filter(Boolean),k=j.length?j.map(c=>c.title||c.id).join(" > "):"Group",g=B.config&&B.config.autoGroupColumnWidth||z;return{id:q,field:null,title:k,type:"text",dataType:{base:"text"},nullable:!0,align:"start",generated:!0,value:{pure:!0},cell:{render:"group"},edit:{enabled:!1},sort:{enabled:!0,direction:null},filter:{enabled:!0},groupedIds:G.slice(),group:{enabled:!1,index:0,explode:!1},pivot:{enabled:!1,index:0},total:null,lookup:null,layout:{width:g,min:120,pin:B.config&&B.config.autoGroupColumnPin||null,hidden:!1,resizable:!0,movable:!1,lockPosition:!0},header:{},export:{csv:!1,excel:!1},allowGroup:!1,allowPivot:!1,allowTotal:!1,def:{},getValue(c,d){return d&&d.group?d.groupValue:null},formatValue(c,d){if(!d||!d.group)return"";if(d.grandTotal)return B.config&&B.config.grandTotalLabel||"Total";const l=j[Math.min(d.level||0,j.length-1)];return l&&typeof l.formatValue=="function"?l.formatValue(c,d):c==null?"":String(c)}}}function X(B,Y,G){!B.length||G<100||Y<G*_||E(`grouping.cardinality:${B.join(",")}`,`grouping by ${B.join(", ")} produced ${Y} groups for ${G} rows: nearly one group per row. Grouping a continuous value such as a percentage or a timestamp rarely reads usefully; consider a computed banding column.`)}}),Ue("packages/core/src/columns/selectcolumn.js",function(e,U){"use strict";Object.defineProperty(e,"SELECT_COLUMN_ID",{enumerable:!0,get:function(){return te}}),Object.defineProperty(e,"createSelectionColumn",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return z}});const te="__lattice_select",E=44;function q(_){const Z=_.selection||{},X=_.config&&_.config.selectionColumnWidth||E;return{id:te,field:null,title:"",type:"boolean",dataType:{base:"boolean"},nullable:!1,align:"center",generated:!0,control:!0,value:{pure:!0},cell:{render:"checkbox",props:{mode:"selection"},align:"center"},edit:{enabled:!1},sort:{enabled:!1,direction:null},filter:{enabled:!1},group:{enabled:!1,index:0,explode:!1},pivot:{enabled:!1,index:0},total:null,lookup:null,layout:{width:X,min:X,max:X,pin:_.config&&_.config.selectionColumnPin||"start",hidden:!1,resizable:!1,movable:!1,lockPosition:!0},header:{},export:{csv:!1,excel:!1},allowGroup:!1,allowPivot:!1,allowTotal:!1,headerCheckbox:Z.headerCheckbox===!0,def:{},getValue(B,Y){return Y?Y.selected:!1},formatValue(){return""}}}const z=q}),Ue("packages/core/src/columns/rownumbercolumn.js",function(e,U){"use strict";Object.defineProperty(e,"ROW_NUMBER_COLUMN_ID",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"createRowNumberColumn",{enumerable:!0,get:function(){return B}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return Y}});const E=U("packages/core/src/internal/predicates.js").isFunction,q="__lattice_rownumber",z=40,_=9,Z=22;function X(G){const j=String(Math.max(1,Math.trunc(Math.abs(G))||1)).length;return Math.max(z,j*_+Z)}function B(G){const j=G.rowNumbers,k=j&&typeof j=="object"?j:{},g=Number.isFinite(k.start)?k.start:1,c=Number.isFinite(k.width)?k.width:X((G.maxNumber||0)+g),d=E(G.rank)?G.rank:()=>null;return{id:q,field:null,title:typeof k.title=="string"?k.title:"",type:"number",dataType:{base:"number"},nullable:!0,align:"end",generated:!0,control:!0,value:{pure:!0},cell:{align:"end"},edit:{enabled:!1},sort:{enabled:!1,direction:null},filter:{enabled:!1},group:{enabled:!1,index:0,explode:!1},pivot:{enabled:!1,index:0},total:null,lookup:null,layout:{width:c,min:c,max:c,pin:"start",hidden:!1,resizable:k.width==null,movable:!1,lockPosition:!0},header:{},export:{csv:!1,excel:!1},allowGroup:!1,allowPivot:!1,allowTotal:!1,def:{},getValue(l,i){const n=d(i);return n==null?null:n-1+g},formatValue(l){return l==null?"":String(l)}}}const Y=B}),Ue("packages/core/src/model/detail.js",function(e,U){"use strict";Object.defineProperty(e,"DEFAULT_DETAIL_HEIGHT",{enumerable:!0,get:function(){return _}}),Object.defineProperty(e,"DEFAULT_CACHE_LIMIT",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"resolveDetail",{enumerable:!0,get:function(){return X}}),Object.defineProperty(e,"DetailModel",{enumerable:!0,get:function(){return B}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return Y}});const E=U("packages/core/src/internal/predicates.js").isFunction,z=U("packages/core/src/internal/warn.js").warnOnce,_=240,Z=10;function X(G){if(!G)return null;const j=G===!0?{}:G;return j.enabled===!1?null:!E(j.rows)&&!j.render?(z("detail.rows","detail is enabled but neither `rows` nor `render` was supplied; expanding a master would show an empty region, so it stays off."),null):{render:j.render||null,config:j.config||null,rows:E(j.rows)?j.rows:null,height:j.height??_,cacheLimit:Number.isFinite(j.cacheLimit)?Math.max(0,j.cacheLimit):Z,isMaster:E(j.isMaster)?j.isMaster:null,target:j.target||null,onCreate:E(j.onCreate)?j.onCreate:null,path:typeof j.path=="string"?j.path:null}}class B{#e;#t=new Set;#n;#r=0;constructor(j){this.#e=j.config,this.#n=E(j.onChange)?j.onChange:()=>{}}get config(){return this.#e}get inline(){return!this.#e.target}isMaster(j){if(!j||j.group||j.detail)return!1;const k=this.#e.isMaster;return k?!!k(j.data,j):!0}isOpen(j){return this.#t.has(j)}keys(){return[...this.#t]}activeKey(){for(const j of this.#t)return j;return null}heightOf(j){const k=this.#e.height;return E(k)?Number(k(j))||_:k==="auto"?_:Number(k)||_}open(j){return this.#t.has(j)?!1:(this.inline||this.#t.clear(),this.#t.add(j),this.#s(),!0)}close(j){return this.#t.delete(j)?(this.#s(),!0):!1}toggle(j){return this.#t.has(j)?(this.close(j),!1):(this.open(j),!0)}closeAll(){this.#t.size&&(this.#t.clear(),this.#s())}prune(j){if(!this.#t.size||!E(j))return;let k=!1;for(const g of[...this.#t])j(g)||(this.#t.delete(g),k=!0);k&&this.#s()}signature(){return`${this.#r}`}set(j){this.#t.clear();const k=Array.isArray(j)?j:[];for(const g of this.inline?k:k.slice(0,1))this.#t.add(g);this.#s()}#s(){this.#r++,this.#n()}}const Y=B}),Ue("packages/core/src/compute/special.js",function(e,U){"use strict";Object.defineProperty(e,"logGamma",{enumerable:!0,get:function(){return z}}),Object.defineProperty(e,"incompleteBeta",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"normalQuantile",{enumerable:!0,get:function(){return X}}),Object.defineProperty(e,"normalCdf",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(e,"studentT",{enumerable:!0,get:function(){return G}}),Object.defineProperty(e,"studentTQuantile",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"regularizedGammaP",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"chiSquareCdf",{enumerable:!0,get:function(){return d}}),Object.defineProperty(e,"chiSquareUpperTail",{enumerable:!0,get:function(){return l}});const te=Object.freeze([676.5203681218851,-1259.1392167224028,771.3234287776531,-176.6150291621406,12.507343278686905,-.13857109526572012,9984369578019572e-21,15056327351493116e-23]),E=3e-12,q=1e-300;function z(i){if(i<.5)return Math.log(Math.PI/Math.sin(Math.PI*i))-z(1-i);const n=i-1;let a=.9999999999998099;const s=n+7.5;for(let t=0;t<te.length;t++)a+=te[t]/(n+t+1);return .5*Math.log(2*Math.PI)+(n+.5)*Math.log(s)-s+Math.log(a)}function _(i,n,a){const s=i+n,t=i+1,u=i-1;let r=1,o=1-s*a/t;Math.abs(o)<q&&(o=q),o=1/o;let f=o;for(let w=1;w<=300;w++){const m=2*w;let v=w*(n-w)*a/((u+m)*(i+m));o=1+v*o,Math.abs(o)<q&&(o=q),r=1+v/r,Math.abs(r)<q&&(r=q),o=1/o,f*=o*r,v=-(i+w)*(s+w)*a/((i+m)*(t+m)),o=1+v*o,Math.abs(o)<q&&(o=q),r=1+v/r,Math.abs(r)<q&&(r=q),o=1/o;const h=o*r;if(f*=h,Math.abs(h-1)<E)break}return f}function Z(i,n,a){if(!(i>0)||!(n>0)||!Number.isFinite(a))return Number.NaN;if(a<=0)return 0;if(a>=1)return 1;const s=Math.exp(z(i+n)-z(i)-z(n)+i*Math.log(a)+n*Math.log(1-a));return a<(i+1)/(i+n+2)?s*_(i,n,a)/i:1-s*_(n,i,1-a)/n}function X(i){if(!(i>0)||!(i<1))return i===0?-1/0:i===1?1/0:Number.NaN;const n=[-39.69683028665376,220.9460984245205,-275.9285104469687,138.357751867269,-30.66479806614716,2.506628277459239],a=[-54.47609879822406,161.5858368580409,-155.6989798598866,66.80131188771972,-13.28068155288572],s=[-.007784894002430293,-.3223964580411365,-2.400758277161838,-2.549732539343734,4.374664141464968,2.938163982698783],t=[.007784695709041462,.3224671290700398,2.445134137142996,3.754408661907416],u=.02425;let r,o,f;i<u?(r=Math.sqrt(-2*Math.log(i)),f=(((((s[0]*r+s[1])*r+s[2])*r+s[3])*r+s[4])*r+s[5])/((((t[0]*r+t[1])*r+t[2])*r+t[3])*r+1)):i<=1-u?(r=i-.5,o=r*r,f=(((((n[0]*o+n[1])*o+n[2])*o+n[3])*o+n[4])*o+n[5])*r/(((((a[0]*o+a[1])*o+a[2])*o+a[3])*o+a[4])*o+1)):(r=Math.sqrt(-2*Math.log(1-i)),f=-(((((s[0]*r+s[1])*r+s[2])*r+s[3])*r+s[4])*r+s[5])/((((t[0]*r+t[1])*r+t[2])*r+t[3])*r+1));const m=(.5*B(-f/Math.SQRT2)-i)*Math.sqrt(2*Math.PI)*Math.exp(f*f/2);return f-m/(1+f*m/2)}function B(i){const n=Math.abs(i),a=2/(2+n),s=4*a-2,t=[-1.3026537197817094,.6419697923564902,.019476473204185836,-.00956151478680863,-.000946595344482036,.000366839497852761,42523324806907e-18,-20278578112534e-18,-1624290004647e-18,130365583558e-17,15626441722e-18,-85238095915e-18,6529054439e-18,5059343495e-18,-991364156e-18,-227365122e-18,96467911e-18,2394038e-18,-6886027e-18,894487e-18,313092e-18,-112708e-18,381e-18,7106e-18];let u=0,r=0,o;for(let w=t.length-1;w>0;w--)o=r,r=s*r-u+t[w],u=o;const f=a*Math.exp(-n*n+.5*(t[0]+s*r)-u);return i>=0?f:2-f}function Y(i){return .5*B(-i/Math.SQRT2)}function G(i,n){if(!(n>0)||!Number.isFinite(i))return Number.NaN;const a=.5*Z(n/2,.5,n/(n+i*i));return i>0?1-a:a}function j(i,n){if(!(i>0)||!(i<1)||!(n>0))return Number.NaN;if(n>1e7)return X(i);let a=-1e4,s=1e4,t=X(i);const u=z(n/2)+z(.5)-z((n+1)/2);for(let r=0;r<60;r++){const o=G(t,n);o<i?a=t:s=t;const f=Math.exp(-((n+1)/2)*Math.log(1+t*t/n)-u)/Math.sqrt(n),w=f>0?(o-i)/f:0;if(Math.abs(w)<1e-12)break;const m=t-w;if(t=m>a&&m<s&&Number.isFinite(m)?m:(a+s)/2,s-a<1e-12)break}return t}function k(i,n){let a=i,s=1/i,t=s;for(let u=0;u<300&&(a+=1,t*=n/a,s+=t,!(Math.abs(t)<Math.abs(s)*E));u++);return s*Math.exp(-n+i*Math.log(n)-z(i))}function g(i,n){let a=n+1-i,s=1/q,t=1/a,u=t;for(let r=1;r<=300;r++){const o=-r*(r-i);a+=2,t=o*t+a,Math.abs(t)<q&&(t=q),s=a+o/s,Math.abs(s)<q&&(s=q),t=1/t;const f=t*s;if(u*=f,Math.abs(f-1)<E)break}return Math.exp(-n+i*Math.log(n)-z(i))*u}function c(i,n){return!(i>0)||!(n>=0)||!Number.isFinite(n)?Number.NaN:n===0?0:n<i+1?k(i,n):1-g(i,n)}function d(i,n){return n>0?c(n/2,i/2):Number.NaN}function l(i,n){const a=d(i,n);return Number.isNaN(a)?Number.NaN:Math.min(1,Math.max(0,1-a))}}),Ue("packages/core/src/compute/linalg.js",function(e,U){"use strict";Object.defineProperty(e,"cholesky",{enumerable:!0,get:function(){return te}}),Object.defineProperty(e,"choleskySolve",{enumerable:!0,get:function(){return E}}),Object.defineProperty(e,"choleskyInverse",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"normalEquations",{enumerable:!0,get:function(){return z}}),Object.defineProperty(e,"matVec",{enumerable:!0,get:function(){return _}}),Object.defineProperty(e,"quadForm",{enumerable:!0,get:function(){return Z}});function te(X){const B=X.length,Y=Array.from({length:B},()=>new Array(B).fill(0));for(let G=0;G<B;G++)for(let j=0;j<=G;j++){let k=X[G][j];for(let g=0;g<j;g++)k-=Y[G][g]*Y[j][g];if(G===j){if(!(k>0))return null;Y[G][j]=Math.sqrt(k)}else Y[G][j]=k/Y[j][j]}return Y}function E(X,B){const Y=X.length,G=new Array(Y).fill(0);for(let k=0;k<Y;k++){let g=B[k];for(let c=0;c<k;c++)g-=X[k][c]*G[c];G[k]=g/X[k][k]}const j=new Array(Y).fill(0);for(let k=Y-1;k>=0;k--){let g=G[k];for(let c=k+1;c<Y;c++)g-=X[c][k]*j[c];j[k]=g/X[k][k]}return j}function q(X){const B=X.length,Y=Array.from({length:B},()=>new Array(B).fill(0));for(let G=0;G<B;G++){const j=new Array(B).fill(0);j[G]=1;const k=E(X,j);for(let g=0;g<B;g++)Y[g][G]=k[g]}return Y}function z(X,B,Y){const G=X.length,j=G?X[0].length:0,k=Array.from({length:j},()=>new Array(j).fill(0)),g=new Array(j).fill(0);for(let c=0;c<G;c++){const d=Y?Y[c]:1,l=X[c];for(let i=0;i<j;i++){const n=d*l[i];g[i]+=n*B[c];for(let a=i;a<j;a++)k[i][a]+=n*l[a]}}for(let c=0;c<j;c++)for(let d=0;d<c;d++)k[c][d]=k[d][c];return{xtwx:k,xtwy:g}}function _(X,B){return X.map(Y=>Y.reduce((G,j,k)=>G+j*B[k],0))}function Z(X,B){let Y=0;for(let G=0;G<X.length;G++){let j=0;for(let k=0;k<X.length;k++)j+=B[G][k]*X[k];Y+=X[G]*j}return Y}}),Ue("packages/core/src/compute/sketch.js",function(e,U){"use strict";Object.defineProperty(e,"Welford",{enumerable:!0,get:function(){return te}}),Object.defineProperty(e,"Reservoir",{enumerable:!0,get:function(){return E}}),Object.defineProperty(e,"hash32",{enumerable:!0,get:function(){return z}}),Object.defineProperty(e,"HyperLogLog",{enumerable:!0,get:function(){return _}}),Object.defineProperty(e,"SpaceSaving",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(e,"KLL",{enumerable:!0,get:function(){return G}}),Object.defineProperty(e,"SKETCH_BOUNDS",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return k}});class te{#e=0;#t=0;#n=0;static get errorBound(){return Object.freeze({kind:"exact",metric:"none",value:0,statement:"mean and variance match a full recompute to float rounding"})}get count(){return this.#e}add(c){if(!Number.isFinite(c))return;this.#e++;const d=c-this.#t;this.#t+=d/this.#e,this.#n+=d*(c-this.#t)}merge(c){if(c.#e===0)return;if(this.#e===0){this.#e=c.#e,this.#t=c.#t,this.#n=c.#n;return}const d=this.#e+c.#e,l=c.#t-this.#t;this.#t+=l*(c.#e/d),this.#n+=c.#n+l*l*(this.#e*c.#e/d),this.#e=d}mean(){return this.#e?this.#t:null}variance(){return this.#e>1?this.#n/(this.#e-1):null}varianceP(){return this.#e?this.#n/this.#e:null}stddev(){const c=this.variance();return c===null?null:Math.sqrt(c)}stddevP(){const c=this.varianceP();return c===null?null:Math.sqrt(c)}}class E{#e=[];#t=0;#n;#r;constructor(c,d=Math.random){if(!(c>0))throw new RangeError("reservoir capacity must be positive");this.#n=Math.floor(c),this.#r=d}static get errorBound(){return Object.freeze({kind:"probabilistic",metric:"none",value:0,statement:"uniform sample: each element included with probability capacity/n; sample statistics are unbiased estimators"})}get seen(){return this.#t}get size(){return this.#e.length}add(c){if(!Number.isFinite(c))return;if(this.#t++,this.#e.length<this.#n){this.#e.push(c);return}const d=Math.floor(this.#r()*this.#t);d<this.#n&&(this.#e[d]=c)}sample(){return this.#e.slice()}mean(){if(!this.#e.length)return null;let c=0;for(const d of this.#e)c+=d;return c/this.#e.length}quantile(c){const d=this.#e.length;if(!d)return null;const l=this.#e.slice().sort((s,t)=>s-t);if(d===1)return l[0];const i=(d-1)*Math.min(1,Math.max(0,c)),n=Math.floor(i),a=Math.ceil(i);return n===a?l[n]:l[n]+(i-n)*(l[a]-l[n])}}function q(g){return g^=g>>>16,g=Math.imul(g,2246822507),g^=g>>>13,g=Math.imul(g,3266489909),g^=g>>>15,g>>>0}function z(g){if(typeof g=="number"){const l=new DataView(new ArrayBuffer(8));return l.setFloat64(0,g===0?0:g),q(l.getUint32(0)^l.getUint32(4))}const c=typeof g=="string"?g:String(g);let d=2166136261;for(let l=0;l<c.length;l++)d^=c.charCodeAt(l),d=Math.imul(d,16777619);return q(d)}class _{#e;#t;#n;constructor(c=14){const d=Math.floor(c);if(d<4||d>16)throw new RangeError("HLL precision must be 4..16");this.#e=d,this.#t=1<<d,this.#n=new Uint8Array(this.#t)}static errorBoundFor(c=14){const d=1<<Math.floor(c),l=1.04/Math.sqrt(d);return Object.freeze({kind:"probabilistic",metric:"relative",value:l,statement:`distinct count within ~${(l*100).toFixed(2)}% relative standard error (m=${d} buckets)`})}errorBound(){return _.errorBoundFor(this.#e)}add(c){const d=z(c),l=d&this.#t-1,i=d>>>this.#e|1<<32-this.#e;let n=1,a=i;for(;(a&1)===0;)n++,a>>>=1;n>this.#n[l]&&(this.#n[l]=n)}count(){const c=this.#t,d=32-this.#e,l=new Float64Array(d+2);for(let a=0;a<c;a++)l[this.#n[a]]++;let i=c*B(1-l[d+1]/c);for(let a=d;a>=1;a--)i=.5*(i+l[a]);i+=c*X(l[0]/c);const n=Z*c*c/i;return Math.round(n)}}const Z=.5/Math.log(2);function X(g){if(g===1)return 1/0;let c=1,d=g,l;do g*=g,l=d,d+=g*c,c+=c;while(d!==l);return d}function B(g){if(g===0||g===1)return 0;let c=1,d=1-g,l;do g=Math.sqrt(g),l=d,c*=.5,d-=(1-g)**2*c;while(d!==l);return d/3}class Y{#e=new Map;#t;#n=0;constructor(c){if(!(c>0))throw new RangeError("Space-Saving capacity must be positive");this.#t=Math.floor(c)}errorBoundFor(c){const d=c/this.#t;return Object.freeze({kind:"deterministic",metric:"absolute",value:d,statement:`each count overestimates the truth by at most N/m = ${d.toFixed(2)} (N=${c}, m=${this.#t})`})}get seen(){return this.#n}add(c){this.#n++;const d=this.#e.get(c);if(d){d.count++;return}if(this.#e.size<this.#t){this.#e.set(c,{count:1,error:0});return}let l,i=1/0;for(const[n,a]of this.#e)a.count<i&&(i=a.count,l=n);this.#e.delete(l),this.#e.set(c,{count:i+1,error:i})}top(c=this.#t){return[...this.#e.entries()].map(([l,i])=>({item:l,count:i.count,error:i.error})).sort((l,i)=>i.count-l.count).slice(0,Math.max(0,Math.floor(c)))}}class G{#e;#t=[[]];#n=0;#r;#s;constructor(c=200,d=Math.random){this.#e=Math.max(8,Math.floor(c)),this.#r=d,this.#s=2/3}static errorBoundFor(c=200){const d=1/Math.max(8,Math.floor(c));return Object.freeze({kind:"probabilistic",metric:"rank",value:d,statement:`queried quantile's true rank within ~${(d*100).toFixed(2)}% of N of the requested rank (k=${c})`})}errorBound(){return G.errorBoundFor(this.#e)}get count(){return this.#n}#i(c){const l=this.#t.length-1-c,i=Math.ceil(this.#e*this.#s**l);return Math.max(2,i)}add(c){Number.isFinite(c)&&(this.#n++,this.#t[0].push(c),this.#t[0].length>=this.#i(0)&&this.#o(0))}#o(c){const d=this.#t[c];d.sort((n,a)=>n-a),c+1>=this.#t.length&&this.#t.push([]);const l=this.#t[c+1],i=this.#r()<.5?0:1;for(let n=i;n<d.length;n+=2)l.push(d[n]);this.#t[c]=[];for(let n=0;n<this.#t.length;n++)if(this.#t[n].length>=this.#i(n)){this.#o(n);return}}#l(){const c=[];for(let d=0;d<this.#t.length;d++){const l=1<<d;for(const i of this.#t[d])c.push({v:i,w:l})}return c}quantile(c){const d=this.#l();if(!d.length)return null;d.sort((a,s)=>a.v-s.v);let l=0;for(const a of d)l+=a.w;const i=Math.min(1,Math.max(0,c))*l;let n=0;for(const a of d)if(n+=a.w,n>=i)return a.v;return d[d.length-1].v}rank(c){let d=0;for(let l=0;l<this.#t.length;l++){const i=1<<l;for(const n of this.#t[l])n<=c&&(d+=i)}return d}}const j=Object.freeze({distinct:_.errorBoundFor(14),median:G.errorBoundFor(200),p25:G.errorBoundFor(200),p75:G.errorBoundFor(200),p90:G.errorBoundFor(200),p95:G.errorBoundFor(200),p99:G.errorBoundFor(200),iqr:G.errorBoundFor(200),topK:Object.freeze({kind:"deterministic",metric:"absolute",value:0,statement:"each count overestimates the truth by at most N/m; top-K exact when the K-th item exceeds N/m"})}),k={Welford:te,Reservoir:E,HyperLogLog:_,SpaceSaving:Y,KLL:G,hash32:z,SKETCH_BOUNDS:j}}),Ue("packages/core/src/compute/statistics.js",function(e,U){"use strict";Object.defineProperty(e,"KENDALL_LIMIT",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"MAINTENANCE",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"APPROXIMATE",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"maintenanceOf",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"numbers",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"frequencies",{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,"herfindahl",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"entropy",{enumerable:!0,get:function(){return w}}),Object.defineProperty(e,"evenness",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"topShare",{enumerable:!0,get:function(){return v}}),Object.defineProperty(e,"gini",{enumerable:!0,get:function(){return h}}),Object.defineProperty(e,"moments",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"quantileSorted",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"quantile",{enumerable:!0,get:function(){return O}}),Object.defineProperty(e,"STAT_FNS",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"STAT_LABELS",{enumerable:!0,get:function(){return M}}),Object.defineProperty(e,"weightedAverage",{enumerable:!0,get:function(){return D}}),Object.defineProperty(e,"extremeRow",{enumerable:!0,get:function(){return F}}),Object.defineProperty(e,"correlation",{enumerable:!0,get:function(){return T}}),Object.defineProperty(e,"trimmedMean",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"winsorizedMean",{enumerable:!0,get:function(){return P}}),Object.defineProperty(e,"modifiedZOutliers",{enumerable:!0,get:function(){return R}}),Object.defineProperty(e,"jarqueBera",{enumerable:!0,get:function(){return $}}),Object.defineProperty(e,"weightedQuantile",{enumerable:!0,get:function(){return C}}),Object.defineProperty(e,"pairs",{enumerable:!0,get:function(){return A}}),Object.defineProperty(e,"covariance",{enumerable:!0,get:function(){return S}}),Object.defineProperty(e,"regression",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"fitLinearModel",{enumerable:!0,get:function(){return Ae}}),Object.defineProperty(e,"ADF_CT_CRITICAL",{enumerable:!0,get:function(){return Me}}),Object.defineProperty(e,"augmentedDickeyFuller",{enumerable:!0,get:function(){return ie}}),Object.defineProperty(e,"autocorrelations",{enumerable:!0,get:function(){return Oe}}),Object.defineProperty(e,"spearman",{enumerable:!0,get:function(){return je}}),Object.defineProperty(e,"kendall",{enumerable:!0,get:function(){return Ce}}),Object.defineProperty(e,"seriesStats",{enumerable:!0,get:function(){return fe}}),Object.defineProperty(e,"D2_N2",{enumerable:!0,get:function(){return Ee}}),Object.defineProperty(e,"D4_N2",{enumerable:!0,get:function(){return le}}),Object.defineProperty(e,"movingRanges",{enumerable:!0,get:function(){return de}}),Object.defineProperty(e,"withinSigma",{enumerable:!0,get:function(){return Se}}),Object.defineProperty(e,"capability",{enumerable:!0,get:function(){return Fe}}),Object.defineProperty(e,"controlLimits",{enumerable:!0,get:function(){return ke}}),Object.defineProperty(e,"westernElectricViolations",{enumerable:!0,get:function(){return Ie}}),Object.defineProperty(e,"nelsonViolations",{enumerable:!0,get:function(){return Be}}),Object.defineProperty(e,"CONTROL_RULE_SETS",{enumerable:!0,get:function(){return Ke}}),Object.defineProperty(e,"controlViolations",{enumerable:!0,get:function(){return rt}}),Object.defineProperty(e,"countOutside",{enumerable:!0,get:function(){return tt}}),Object.defineProperty(e,"histogram",{enumerable:!0,get:function(){return pt}}),Object.defineProperty(e,"DEFAULT_CONFIDENCE",{enumerable:!0,get:function(){return yt}}),Object.defineProperty(e,"meanInterval",{enumerable:!0,get:function(){return Pt}}),Object.defineProperty(e,"proportionInterval",{enumerable:!0,get:function(){return Ct}}),Object.defineProperty(e,"slopeInterval",{enumerable:!0,get:function(){return Lt}}),Object.defineProperty(e,"capabilityInterval",{enumerable:!0,get:function(){return Rt}}),Object.defineProperty(e,"standardizedMeanDifference",{enumerable:!0,get:function(){return Bt}}),Object.defineProperty(e,"normalTotalVariation",{enumerable:!0,get:function(){return ht}}),Object.defineProperty(e,"frequencyMap",{enumerable:!0,get:function(){return ct}}),Object.defineProperty(e,"categoricalDistance",{enumerable:!0,get:function(){return bt}}),Object.defineProperty(e,"SUBSET_RELIABILITY_FLOOR",{enumerable:!0,get:function(){return it}}),Object.defineProperty(e,"compareColumn",{enumerable:!0,get:function(){return we}}),Object.defineProperty(e,"isNumericColumn",{enumerable:!0,get:function(){return Le}}),Object.defineProperty(e,"populationRead",{enumerable:!0,get:function(){return Re}});const te=U("packages/core/src/compute/handle.js"),E=te.presenceReader,q=te.valueReader,z=U("packages/core/src/compute/special.js"),_=z.studentTQuantile,Z=z.studentT,X=z.normalQuantile,B=z.normalCdf,Y=z.chiSquareUpperTail,G=U("packages/core/src/compute/linalg.js"),j=G.cholesky,k=G.choleskySolve,g=G.choleskyInverse,c=G.normalEquations,d=G.quadForm,i=U("packages/core/src/compute/sketch.js").SKETCH_BOUNDS,n=5e3,a=Object.freeze({variance:"rescan",varianceP:"rescan",stddev:"rescan",stddevP:"rescan",sumSquares:"rescan",weightedAvg:"rescan",median:"rescan",p25:"rescan",p75:"rescan",p90:"rescan",p95:"rescan",p99:"rescan",iqr:"rescan",mode:"rescan",distinct:"rescan",range:"rescan",skewness:"rescan",kurtosis:"rescan",geomean:"rescan",harmean:"rescan",mad:"rescan",argmin:"rescan",argmax:"rescan",hhi:"rescan",entropy:"rescan",evenness:"rescan",top3Share:"rescan",top10Share:"rescan",gini:"rescan",trimmedMean:"rescan",winsorizedMean:"rescan",robustOutliers:"rescan",jarqueBera:"rescan",passRate:"rescan",failureCount:"rescan"}),s=Object.freeze({distinct:Object.freeze({sketch:"HyperLogLog",bound:i.distinct}),median:Object.freeze({sketch:"KLL",bound:i.median}),p25:Object.freeze({sketch:"KLL",bound:i.p25}),p75:Object.freeze({sketch:"KLL",bound:i.p75}),p90:Object.freeze({sketch:"KLL",bound:i.p90}),p95:Object.freeze({sketch:"KLL",bound:i.p95}),p99:Object.freeze({sketch:"KLL",bound:i.p99}),iqr:Object.freeze({sketch:"KLL",bound:i.iqr}),top3Share:Object.freeze({sketch:"SpaceSaving",bound:i.topK}),top10Share:Object.freeze({sketch:"SpaceSaving",bound:i.topK})});function t(ne){const se=ne==="sum"||ne==="avg"||ne==="countValues"||ne==="min"||ne==="max"?"maintained":Object.prototype.hasOwnProperty.call(a,ne)?a[ne]:null,ce=Object.prototype.hasOwnProperty.call(s,ne)?s[ne]:null;return{stat:ne,exact:se,approximate:ce}}function u(ne,se){const ce=se.length,he=new Float64Array(ce);let ye=0;if(ne&&(ne.kind==="float64"||ne.kind==="int32")){const xe=ne.values,ze=E(ne);for(let Ye=0;Ye<ce;Ye++){const $e=se[Ye];if(ze&&ze($e)!==1)continue;const Ge=xe[$e];Number.isNaN(Ge)||(he[ye++]=Ge)}return he.subarray(0,ye)}const Te=q(ne);for(let xe=0;xe<ce;xe++){const ze=Te(se[xe]);if(ze==null||ze==="")continue;const Ye=typeof ze=="number"?ze:Number(ze);Number.isFinite(Ye)&&(he[ye++]=Ye)}return he.subarray(0,ye)}function r(ne,se){const ce=new Map,he=q(ne);let ye=0;for(let Te=0;Te<se.length;Te++){const xe=he(se[Te]);if(xe==null||xe===""||typeof xe=="number"&&Number.isNaN(xe))continue;const ze=typeof xe=="object"?String(xe):xe;ce.set(ze,(ce.get(ze)||0)+1),ye++}const ve=[...ce.values()].sort((Te,xe)=>xe-Te);return{counts:ve,total:ye,distinct:ve.length}}function o(ne){return ne.total>0?ne.counts.map(se=>se/ne.total):[]}function f(ne,se){const ce=r(ne,se);if(!ce.total)return null;let he=0;for(const ye of o(ce))he+=ye*ye;return he}function w(ne,se){const ce=r(ne,se);if(!ce.total)return null;let he=0;for(const ye of o(ce))ye>0&&(he-=ye*Math.log2(ye));return he}function m(ne,se){const ce=r(ne,se);if(!ce.total||ce.distinct<2)return ce.total?1:null;let he=0;for(const ye of o(ce))ye>0&&(he-=ye*Math.log2(ye));return he/Math.log2(ce.distinct)}function v(ne,se,ce=3){const he=r(ne,se);if(!he.total)return null;const ye=Math.max(1,Math.floor(ce));let ve=0;for(let Te=0;Te<Math.min(ye,he.counts.length);Te++)ve+=he.counts[Te];return ve/he.total}function h(ne,se){const ce=u(ne,se),he=ce.length;if(!he)return null;const ye=ce.slice().sort();if(ye[0]<0)return null;let ve=0,Te=0;for(let xe=0;xe<he;xe++)ve+=ye[xe],Te+=(xe+1)*ye[xe];return ve===0?0:2*Te/(he*ve)-(he+1)/he}function p(ne){let se=0,ce=0,he=0;for(let ye=0;ye<ne.length;ye++){const ve=ne[ye];se++;const Te=ve-ce;ce+=Te/se,he+=Te*(ve-ce)}return{n:se,mean:ce,m2:he}}function b(ne,se){const ce=ne.length;if(!ce)return NaN;if(ce===1)return ne[0];const he=(ce-1)*Math.min(1,Math.max(0,se)),ye=Math.floor(he),ve=Math.ceil(he);return ye===ve?ne[ye]:ne[ye]+(he-ye)*(ne[ve]-ne[ye])}function O(ne,se){if(!ne.length)return NaN;const ce=ne.slice().sort();return b(ce,se)}function y(ne,se){const ce=q(ne);let he=0,ye=0,ve=0;for(let Te=0;Te<se.length;Te++){const xe=ce(se[Te]);if(xe==null||xe==="")continue;const ze=String(xe).toUpperCase();ze==="PASS"?he++:ze==="FAIL"?ye++:ze==="WARN"&&ve++}return{pass:he+ve,fail:ye,warn:ve,judged:he+ve+ye}}const L=Object.freeze({hhi:(ne,se)=>f(ne,se),entropy:(ne,se)=>w(ne,se),evenness:(ne,se)=>m(ne,se),top3Share:(ne,se)=>v(ne,se,3),top10Share:(ne,se)=>v(ne,se,10),gini:(ne,se)=>h(ne,se),trimmedMean:(ne,se)=>I(u(ne,se),.1),winsorizedMean:(ne,se)=>P(u(ne,se),.1),robustOutliers:(ne,se)=>R(u(ne,se),3.5),jarqueBera:(ne,se)=>$(u(ne,se)),variance:(ne,se)=>{const{n:ce,m2:he}=p(u(ne,se));return ce>1?he/(ce-1):null},varianceP:(ne,se)=>{const{n:ce,m2:he}=p(u(ne,se));return ce>0?he/ce:null},stddev:(ne,se)=>{const{n:ce,m2:he}=p(u(ne,se));return ce>1?Math.sqrt(he/(ce-1)):null},stddevP:(ne,se)=>{const{n:ce,m2:he}=p(u(ne,se));return ce>0?Math.sqrt(he/ce):null},median:(ne,se)=>{const ce=u(ne,se);return ce.length?O(ce,.5):null},p25:(ne,se)=>{const ce=u(ne,se);return ce.length?O(ce,.25):null},p75:(ne,se)=>{const ce=u(ne,se);return ce.length?O(ce,.75):null},p90:(ne,se)=>{const ce=u(ne,se);return ce.length?O(ce,.9):null},p95:(ne,se)=>{const ce=u(ne,se);return ce.length?O(ce,.95):null},p99:(ne,se)=>{const ce=u(ne,se);return ce.length?O(ce,.99):null},iqr:(ne,se)=>{const ce=u(ne,se);if(!ce.length)return null;const he=ce.slice().sort();return b(he,.75)-b(he,.25)},mad:(ne,se)=>{const ce=u(ne,se);if(!ce.length)return null;const he=O(ce,.5),ye=new Float64Array(ce.length);for(let ve=0;ve<ce.length;ve++)ye[ve]=Math.abs(ce[ve]-he);return O(ye,.5)},range:(ne,se)=>{const ce=u(ne,se);if(!ce.length)return null;let he=1/0,ye=-1/0;for(let ve=0;ve<ce.length;ve++)ce[ve]<he&&(he=ce[ve]),ce[ve]>ye&&(ye=ce[ve]);return ye-he},distinct:(ne,se)=>{const ce=q(ne),he=new Set;for(let ye=0;ye<se.length;ye++){const ve=ce(se[ye]);ve==null||ve===""||he.add(ve instanceof Date?ve.getTime():ve)}return he.size},mode:(ne,se)=>{const ce=q(ne),he=new Map;for(let Te=0;Te<se.length;Te++){const xe=ce(se[Te]);if(xe==null||xe==="")continue;const ze=xe instanceof Date?xe.getTime():xe;he.set(ze,(he.get(ze)||0)+1)}let ye=null,ve=1;for(const[Te,xe]of he)xe>ve&&(ve=xe,ye=Te);return ye},skewness:(ne,se)=>{const ce=u(ne,se),{n:he,mean:ye,m2:ve}=p(ce);if(he<3||ve<=0)return null;const Te=Math.sqrt(ve/(he-1));let xe=0;for(let ze=0;ze<ce.length;ze++)xe+=((ce[ze]-ye)/Te)**3;return he/((he-1)*(he-2))*xe},kurtosis:(ne,se)=>{const ce=u(ne,se),{n:he,mean:ye,m2:ve}=p(ce);if(he<4||ve<=0)return null;const Te=Math.sqrt(ve/(he-1));let xe=0;for(let $e=0;$e<ce.length;$e++)xe+=((ce[$e]-ye)/Te)**4;const ze=he*(he+1)/((he-1)*(he-2)*(he-3)),Ye=3*(he-1)**2/((he-2)*(he-3));return ze*xe-Ye},geomean:(ne,se)=>{const ce=u(ne,se);if(!ce.length)return null;let he=0;for(let ye=0;ye<ce.length;ye++){if(ce[ye]<=0)return null;he+=Math.log(ce[ye])}return Math.exp(he/ce.length)},harmean:(ne,se)=>{const ce=u(ne,se);if(!ce.length)return null;let he=0;for(let ye=0;ye<ce.length;ye++){if(ce[ye]===0)return null;he+=1/ce[ye]}return ce.length/he},sumSquares:(ne,se)=>{const ce=u(ne,se);let he=0;for(let ye=0;ye<ce.length;ye++)he+=ce[ye]*ce[ye];return he},passRate:(ne,se)=>{const{pass:ce,judged:he}=y(ne,se);return he?ce/he:null},failureCount:(ne,se)=>y(ne,se).fail}),M=Object.freeze({hhi:"Concentration (HHI)",entropy:"Entropy",evenness:"Evenness",top3Share:"Top 3 share",top10Share:"Top 10 share",gini:"Gini coefficient",trimmedMean:"Trimmed mean",winsorizedMean:"Winsorized mean",robustOutliers:"Outliers (robust)",jarqueBera:"Jarque–Bera",median:"Median",p25:"25th percentile",p75:"75th percentile",p90:"90th percentile",p95:"95th percentile",p99:"99th percentile",iqr:"Interquartile range",mad:"Median absolute deviation",variance:"Variance",varianceP:"Variance (population)",stddev:"Standard deviation",stddevP:"Standard deviation (population)",range:"Range",distinct:"Distinct",mode:"Mode",skewness:"Skewness",kurtosis:"Kurtosis",geomean:"Geometric mean",harmean:"Harmonic mean",sumSquares:"Sum of squares",weightedAvg:"Weighted average",argmin:"Lowest by",argmax:"Highest by",passRate:"Pass rate",failureCount:"Failures"});function D(ne,se,ce){const he=q(ne),ye=q(se);let ve=0,Te=0;for(let xe=0;xe<ce.length;xe++){const ze=ce[xe],Ye=Number(he(ze)),$e=Number(ye(ze));!Number.isFinite(Ye)||!Number.isFinite($e)||(ve+=Ye*$e,Te+=$e)}return Te===0?null:ve/Te}function F(ne,se,ce){const he=q(ne);let ye=null,ve=ce?-1/0:1/0;for(let Te=0;Te<se.length;Te++){const xe=se[Te],ze=Number(he(xe));Number.isFinite(ze)&&(ce?ze>ve:ze<ve)&&(ve=ze,ye=xe)}return ye}function T(ne,se,ce){const he=q(ne),ye=q(se);let ve=0,Te=0,xe=0,ze=0,Ye=0,$e=0;for(let Qe=0;Qe<ce.length;Qe++){const lt=ce[Qe],ot=Number(he(lt)),st=Number(ye(lt));!Number.isFinite(ot)||!Number.isFinite(st)||(ve++,Te+=ot,xe+=st,ze+=ot*ot,Ye+=st*st,$e+=ot*st)}if(ve<2)return null;const Ge=ve*$e-Te*xe,Ze=Math.sqrt((ve*ze-Te*Te)*(ve*Ye-xe*xe));if(Ze===0)return null;const Je=Ge/Ze;return Math.max(-1,Math.min(1,Je))}function I(ne,se=.1){const ce=ne.length;if(!ce)return null;const he=Array.from(ne).sort((xe,ze)=>xe-ze),ye=Math.floor(ce*Math.min(.49,Math.max(0,se))),ve=he.slice(ye,ce-ye);if(!ve.length)return b(he,.5);let Te=0;for(const xe of ve)Te+=xe;return Te/ve.length}function P(ne,se=.1){const ce=ne.length;if(!ce)return null;const he=Array.from(ne).sort((ze,Ye)=>ze-Ye),ye=Math.floor(ce*Math.min(.49,Math.max(0,se))),ve=he[ye],Te=he[ce-1-ye];let xe=0;for(const ze of he)xe+=Math.min(Te,Math.max(ve,ze));return xe/ce}function R(ne,se=3.5){if(!ne.length)return null;const he=Array.from(ne).sort((ze,Ye)=>ze-Ye),ye=b(he,.5),ve=he.map(ze=>Math.abs(ze-ye)).sort((ze,Ye)=>ze-Ye),Te=b(ve,.5);if(Te===0)return null;let xe=0;for(const ze of he)Math.abs(.6745*(ze-ye)/Te)>se&&xe++;return xe}function $(ne){const se=ne.length;if(se<8)return null;let ce=0;for(const ze of ne)ce+=ze;ce/=se;let he=0,ye=0,ve=0;for(const ze of ne){const Ye=ze-ce;he+=Ye*Ye,ye+=Ye*Ye*Ye,ve+=Ye*Ye*Ye*Ye}if(he/=se,ye/=se,ve/=se,he===0)return null;const Te=ye/he**1.5,xe=ve/(he*he)-3;return se/6*(Te*Te+xe*xe/4)}function C(ne,se,ce){const he=[];let ye=0;for(let ze=0;ze<ne.length;ze++){const Ye=Number(ne[ze]),$e=Number(se[ze]);!Number.isFinite(Ye)||!Number.isFinite($e)||$e<=0||(he.push([Ye,$e]),ye+=$e)}if(!he.length||ye<=0)return null;if(he.sort((ze,Ye)=>ze[0]-Ye[0]),he.length===1)return he[0][0];const ve=[];let Te=0;for(const[,ze]of he)ve.push((Te+ze/2)/ye),Te+=ze;const xe=Math.max(0,Math.min(1,ce));if(xe<=ve[0])return he[0][0];if(xe>=ve[ve.length-1])return he[he.length-1][0];for(let ze=1;ze<ve.length;ze++){if(xe>ve[ze])continue;const Ye=ve[ze]-ve[ze-1],$e=Ye>0?(xe-ve[ze-1])/Ye:0;return he[ze-1][0]+(he[ze][0]-he[ze-1][0])*$e}return he[he.length-1][0]}function A(ne,se,ce){const he=q(ne),ye=q(se),ve=new Float64Array(ce.length),Te=new Float64Array(ce.length);let xe=0;for(let ze=0;ze<ce.length;ze++){const Ye=ce[ze],$e=Number(he(Ye)),Ge=Number(ye(Ye));!Number.isFinite($e)||!Number.isFinite(Ge)||(ve[xe]=$e,Te[xe]=Ge,xe++)}return{xs:ve.subarray(0,xe),ys:Te.subarray(0,xe),n:xe}}function S(ne,se,ce,he=!1){const{xs:ye,ys:ve,n:Te}=A(ne,se,ce);if(Te<2)return null;let xe=0,ze=0;for(let $e=0;$e<Te;$e++)xe+=ye[$e],ze+=ve[$e];xe/=Te,ze/=Te;let Ye=0;for(let $e=0;$e<Te;$e++)Ye+=(ye[$e]-xe)*(ve[$e]-ze);return Ye/(he?Te:Te-1)}function x(ne,se,ce){const{xs:he,ys:ye,n:ve}=A(ne,se,ce);if(ve<2)return null;let Te=0,xe=0;for(let ot=0;ot<ve;ot++)Te+=he[ot],xe+=ye[ot];Te/=ve,xe/=ve;let ze=0,Ye=0,$e=0;for(let ot=0;ot<ve;ot++){const st=he[ot]-Te,St=ye[ot]-xe;ze+=st*st,Ye+=st*St,$e+=St*St}if(ze===0)return null;const Ge=Ye/ze,Ze=xe-Ge*Te,Je=$e===0?1:Math.max(0,Math.min(1,Ye*Ye/(ze*$e))),Qe=Math.max(0,$e-Ge*Ye),lt=ve>2?Math.sqrt(Qe/(ve-2)/ze):0;return{slope:Ge,intercept:Ze,r2:Je,stdError:lt,n:ve}}const H=new Set(["ols","wls","robust"]),V=new Set(["quantile"]),W=new Set(["ridge","lasso","elasticnet","mixed","gls"]),Q=1.345;function ee(ne,se,ce){const{xtwx:he,xtwy:ye}=c(ne,se,ce),ve=j(he);if(!ve)return null;const Te=k(ve,ye),xe=g(ve),ze=re(ne,Te),Ye=se.map(($e,Ge)=>$e-ze[Ge]);return{beta:Te,cov:xe,fitted:ze,residuals:Ye}}function re(ne,se){return ne.map(ce=>ce.reduce((he,ye,ve)=>he+ye*se[ve],0))}function ae(ne,se){const ce=ne.length,he=ne.map(Ye=>Ye[se]),ye=ne.map(Ye=>[1,...Ye.filter(($e,Ge)=>Ge!==se)]),ve=ee(ye,he,null);if(!ve)return 1;const Te=he.reduce((Ye,$e)=>Ye+$e,0)/ce;let xe=0,ze=0;for(let Ye=0;Ye<ce;Ye++)xe+=ve.residuals[Ye]**2,ze+=(he[Ye]-Te)**2;return ze===0?1:Math.max(0,Math.min(1,1-xe/ze))}function ue(ne){const se=[...ne].sort((ye,ve)=>ye-ve),ce=ge(se),he=ne.map(ye=>Math.abs(ye-ce)).sort((ye,ve)=>ye-ve);return ge(he)/.6745}function ge(ne){const se=ne.length;if(!se)return 0;const ce=Math.floor(se/2);return se%2?ne[ce]:(ne[ce-1]+ne[ce])/2}function Ae(ne,se,ce={}){const he=ce.method||"ols";if(W.has(he))throw new Error(`[lattice] regression method "${he}" is out of scope; use ols, wls or robust.`);if(V.has(he))throw new Error("[lattice] quantile regression is coming next and not yet available; use ols, wls or robust.");if(!H.has(he))throw new Error(`[lattice] unknown regression method "${he}"; use ols, wls or robust.`);const ye=Array.isArray(se)?se.length:0,ve=ye&&Array.isArray(ne[0])?ne[0].length:0,Te=ve+1;if(!(ye>Te))return null;for(let $t=0;$t<ye;$t++){if(!Number.isFinite(se[$t])||!Array.isArray(ne[$t])||ne[$t].length!==ve)return null;for(let Dt=0;Dt<ve;Dt++)if(!Number.isFinite(ne[$t][Dt]))return null}let xe=null;if(he==="wls"){if(xe=ce.weights,!Array.isArray(xe)||xe.length!==ye)return null;for(let $t=0;$t<ye;$t++)if(!(xe[$t]>0)||!Number.isFinite(xe[$t]))return null}const ze=ne.map($t=>[1,...$t]);let Ye,$e=null;if(he==="robust"){if(Ye=ee(ze,se,null),!Ye)return null;for(let $t=0;$t<50;$t++){const Dt=ue(Ye.residuals);if(!(Dt>0))break;const Ht=Ye.residuals.map(Qt=>{const Xt=Math.abs(Qt/Dt);return Xt<=Q?1:Q/Xt}),Kt=ee(ze,se,Ht);if(!Kt)return null;const Zt=Kt.beta.reduce((Qt,Xt,nn)=>Math.max(Qt,Math.abs(Xt-Ye.beta[nn])),0);if(Ye=Kt,$e=Ht,Zt<1e-10)break}}else if(Ye=ee(ze,se,xe),!Ye)return null;const Ge=he==="robust"?$e:xe,{beta:Ze,cov:Je,fitted:Qe,residuals:lt}=Ye;let ot=0,st=0,St=0;for(let $t=0;$t<ye;$t++){const Dt=Ge?Ge[$t]:1;ot+=Dt*lt[$t]**2,st+=Dt,St+=Dt*se[$t]}const jt=St/st;let Mt=0;for(let $t=0;$t<ye;$t++){const Dt=Ge?Ge[$t]:1;Mt+=Dt*(se[$t]-jt)**2}const We=ye-Te,ut=ot/We,ft=Mt===0?1:Math.max(0,Math.min(1,1-ot/Mt)),wt=1-(1-ft)*(ye-1)/We,Et=Array.isArray(ce.names)&&ce.names.length===ve?ce.names:ne[0].map(($t,Dt)=>`x${Dt+1}`),mt=kt(ce.confidence),dt=We>0?_(1-(1-mt)/2,We):1/0,Nt=Ze.map(($t,Dt)=>{const Ht=Math.sqrt(Math.max(0,ut*Je[Dt][Dt])),Kt=Ht>0?$t/Ht:$t===0?0:1/0,Zt=Number.isFinite(Kt)?2*(1-Z(Math.abs(Kt),We)):0,Qt=Number.isFinite(dt)?dt*Ht:null;return{name:Dt===0?"(intercept)":Et[Dt-1],estimate:$t,stdError:Ht,t:Kt,p:Math.max(0,Math.min(1,Zt)),lower:Qt===null?null:$t-Qt,upper:Qt===null?null:$t+Qt}}),Ut=new Array(ye),Yt=new Array(ye);for(let $t=0;$t<ye;$t++){const Dt=Ge?Ge[$t]:1,Ht=Math.max(0,Math.min(1,Dt*d(ze[$t],Je)));Ut[$t]=Ht;const Kt=(1-Ht)**2;Yt[$t]=Kt>0&&ut>0?lt[$t]**2/(Te*ut)*(Ht/Kt):null}const pn=ne[0].map(($t,Dt)=>{if(ve<2)return 1;const Ht=ae(ne,Dt);return Ht>=1?1/0:1/(1-Ht)});let un=null;{const $t=lt.map(Ht=>Ht*Ht),Dt=ee(ze,$t,null);if(Dt){const Ht=$t.reduce((Jt,mn)=>Jt+mn,0)/ye;let Kt=0,Zt=0;for(let Jt=0;Jt<ye;Jt++)Kt+=Dt.residuals[Jt]**2,Zt+=($t[Jt]-Ht)**2;const Qt=Zt===0?0:Math.max(0,Math.min(1,1-Kt/Zt)),Xt=ye*Qt,nn=Y(Xt,ve);un={statistic:Xt,df:ve,p:nn,heteroscedastic:nn<.05}}}let on=null;if(ve===1){const $t=ne.map((Dt,Ht)=>Ht).sort((Dt,Ht)=>ne[Dt][0]-ne[Ht][0]);on={confidence:mt,points:$t.map(Dt=>{const Ht=ze[Dt],Kt=Math.sqrt(Math.max(0,ut*d(Ht,Je)));return{x:ne[Dt][0],yhat:Qe[Dt],lower:Qe[Dt]-dt*Kt,upper:Qe[Dt]+dt*Kt}})}}return{method:he,coefficients:Nt,r2:ft,adjR2:wt,n:ye,df:We,sigma2:ut,fitted:Qe,residuals:lt,leverage:Ut,cooksD:Yt,vif:pn,heteroscedasticity:un,band:on,weights:Ge?[...Ge]:null}}function pe(ne){const se=ne.length,ce=Array.from({length:se},(ve,Te)=>Te).sort((ve,Te)=>ne[ve]-ne[Te]),he=new Float64Array(se);let ye=0;for(;ye<se;){let ve=ye;for(;ve+1<se&&ne[ce[ve+1]]===ne[ce[ye]];)ve++;const Te=(ye+ve)/2+1;for(let xe=ye;xe<=ve;xe++)he[ce[xe]]=Te;ye=ve+1}return he}const Me=Object.freeze({"1%":-3.9638,"5%":-3.4126,"10%":-3.1279});function Ne(ne){const se=[.01,.05,.1],ce=[Me["1%"],Me["5%"],Me["10%"]];if(ne<=ce[0]){const ve=(Math.log(se[1])-Math.log(se[0]))/(ce[1]-ce[0]);return Math.max(1e-4,Math.min(.01,Math.exp(Math.log(se[0])+ve*(ne-ce[0]))))}if(ne>=ce[2]){const ve=(Math.log(se[2])-Math.log(se[1]))/(ce[2]-ce[1]);return Math.max(.1,Math.min(.999,Math.exp(Math.log(se[2])+ve*(ne-ce[2]))))}const he=ne<ce[1]?0:1,ye=(ne-ce[he])/(ce[he+1]-ce[he]);return Math.exp(Math.log(se[he])+ye*(Math.log(se[he+1])-Math.log(se[he])))}function Pe(ne,se,ce,he){const ye=ce-he,ve=he+3,Te=new Array(ye),xe=new Array(ye);let ze=!0,Ye=he;for(let Qe=0;Qe<ye;Qe++){const lt=he+Qe,ot=new Float64Array(ve);ot[0]=1,ot[1]=Qe+1,ot[2]=ne[lt];for(let st=1;st<=he;st++)ot[2+st]=se[lt-st];for(let st=1;st<ve;st++)Number.isFinite(ot[st])||(Ye=Math.min(Ye,st-3));Te[Qe]=ot,xe[Qe]=se[lt],Number.isFinite(xe[Qe])||(ze=!1)}if(!ze)return 0;const{xtwx:$e,xtwy:Ge}=c(Te,xe,null);let Ze=0,Je=1/0;for(let Qe=0;Qe<=Ye;Qe++){const lt=Qe+3;if(!(ye>lt))continue;const ot=new Array(lt);for(let ft=0;ft<lt;ft++)ot[ft]=$e[ft].slice(0,lt);const st=j(ot);if(!st)continue;const St=k(st,Ge.slice(0,lt));let jt=0;for(let ft=0;ft<ye;ft++){const wt=Te[ft];let Et=0;for(let mt=0;mt<lt;mt++)Et+=wt[mt]*St[mt];jt+=(xe[ft]-Et)**2}const We=jt/(ye-lt)*(ye-lt);if(!(We>0))continue;const ut=ye*Math.log(We/ye)+2*lt;ut<Je&&(Je=ut,Ze=Qe)}return Ze}function ie(ne,se={}){const ce=[];for(let Je=0;Je<ne.length;Je++){const Qe=Number(ne[Je]);Number.isFinite(Qe)&&ce.push(Qe)}const he=ce.length,ye=he-1;if(he<8||ye<6)return null;const ve=new Array(ye);for(let Je=0;Je<ye;Je++)ve[Je]=ce[Je+1]-ce[Je];let Te=Number.isFinite(se.maxlag)?Math.floor(se.maxlag):Math.ceil(12*(he/100)**.25);Te=Math.max(0,Math.min(Te,Math.floor((ye-5)/2)));const xe=(Je,Qe)=>{const lt=[],ot=[];for(let st=Qe;st<ye;st++){const St=[st-Qe+1,ce[st]];for(let jt=1;jt<=Je;jt++)St.push(ve[st-jt]);lt.push(St),ot.push(ve[st])}return Ae(lt,ot,{method:"ols"})},ze=Pe(ce,ve,ye,Te),Ye=xe(ze,ze);if(!Ye||!Ye.coefficients[2])return null;const $e=Ye.coefficients[2].t,Ge=Ne($e),Ze=$e<Me["5%"];return{statistic:$e,usedLag:ze,nobs:ye-ze,criticalValues:{...Me},pValue:Ge,pApproximate:!0,stationary:Ze,verdict:Ze?"stationary":"non-stationary",regression:"ct"}}function Oe(ne,se={}){const ce=[];for(let Ze=0;Ze<ne.length;Ze++){const Je=Number(ne[Ze]);Number.isFinite(Je)&&ce.push(Je)}const he=ce.length;if(he<3)return null;let ye=Number.isFinite(se.maxlag)?Math.floor(se.maxlag):Math.min(10,he-1);ye=Math.max(1,Math.min(ye,he-1));let ve=0;for(const Ze of ce)ve+=Ze;ve/=he;const Te=ce.map(Ze=>Ze-ve);let xe=0;for(const Ze of Te)xe+=Ze*Ze;xe/=he;const ze=new Array(ye+1).fill(0);ze[0]=1;for(let Ze=1;Ze<=ye;Ze++){let Je=0;for(let Qe=Ze;Qe<he;Qe++)Je+=Te[Qe]*Te[Qe-Ze];ze[Ze]=xe>0?Je/he/xe:0}const Ye=new Array(ye+1).fill(0);Ye[0]=1;let $e=[];for(let Ze=1;Ze<=ye;Ze++){let Je=ze[Ze];for(let st=1;st<Ze;st++)Je-=$e[st-1]*ze[Ze-st];let Qe=1;for(let st=1;st<Ze;st++)Qe-=$e[st-1]*ze[st];const lt=Qe!==0?Je/Qe:0,ot=new Array(Ze);for(let st=1;st<Ze;st++)ot[st-1]=$e[st-1]-lt*$e[Ze-1-st];ot[Ze-1]=lt,Ye[Ze]=lt,$e=ot}const Ge=1.96/Math.sqrt(he);return{acf:ze,pacf:Ye,bounds:{upper:Ge,lower:-Ge},n:he,nlags:ye,approximate:!0}}function je(ne,se,ce){const{xs:he,ys:ye,n:ve}=A(ne,se,ce);if(ve<2)return null;const Te=pe(he),xe=pe(ye);let ze=0,Ye=0;for(let Je=0;Je<ve;Je++)ze+=Te[Je],Ye+=xe[Je];ze/=ve,Ye/=ve;let $e=0,Ge=0,Ze=0;for(let Je=0;Je<ve;Je++){const Qe=Te[Je]-ze,lt=xe[Je]-Ye;$e+=Qe*lt,Ge+=Qe*Qe,Ze+=lt*lt}return Ge===0||Ze===0?null:Math.max(-1,Math.min(1,$e/Math.sqrt(Ge*Ze)))}function Ce(ne,se,ce){const{xs:he,ys:ye,n:ve}=A(ne,se,ce);if(ve<2||ve>n)return null;let Te=0,xe=0,ze=0,Ye=0;for(let Ze=0;Ze<ve;Ze++)for(let Je=Ze+1;Je<ve;Je++){const Qe=Math.sign(he[Ze]-he[Je]),lt=Math.sign(ye[Ze]-ye[Je]),ot=Qe*lt;ot>0?Te++:ot<0?xe++:Qe===0&<===0||(Qe===0?ze++:Ye++)}const $e=Te+xe+Ye,Ge=Te+xe+ze;return $e===0||Ge===0?null:(Te-xe)/Math.sqrt($e*Ge)}function fe(ne,se={}){const ce=ne.length;if(ce<2)return null;const he=ne[0],ye=ne[ce-1],ve=[];for(let st=1;st<ce;st++){const St=ne[st-1];St!==0&&ve.push((ne[st]-St)/Math.abs(St))}let Te=null;if(ve.length>1){let st=0;for(const jt of ve)st+=jt;st/=ve.length;let St=0;for(const jt of ve)St+=(jt-st)**2;Te=Math.sqrt(St/(ve.length-1))}const xe=Number(se.periodsPerYear)>0?Number(se.periodsPerYear):null;let ze=ne[0],Ye=0,$e=0,Ge=0,Ze=0;for(let st=1;st<ce;st++){if(ne[st]>ze){ze=ne[st],Ye=st;continue}if(ze<=0)continue;const St=(ze-ne[st])/ze;St>$e&&($e=St,Ge=Ye,Ze=st)}let Je=null;if(ce>2){let st=0;for(let Mt=0;Mt<ce;Mt++)st+=ne[Mt];st/=ce;let St=0,jt=0;for(let Mt=0;Mt<ce;Mt++){const We=ne[Mt]-st;jt+=We*We,Mt>0&&(St+=We*(ne[Mt-1]-st))}Je=jt>0?St/jt:null}let Qe=0,lt=0;for(const st of ve)st>0?Qe++:st<0&<++;let ot=null;if(he>0&&ye>0){const st=(ye/he)**(1/(ce-1))-1;ot=xe?(1+st)**xe-1:st}return{n:ce,first:he,last:ye,change:ye-he,changePercent:he===0?null:(ye-he)/Math.abs(he)*100,volatility:Te,annualisedVolatility:Te!==null&&xe?Te*Math.sqrt(xe):null,growth:ot,maxDrawdown:$e,maxDrawdownFrom:Ge,maxDrawdownTo:Ze,autocorrelation:Je,upDays:Qe,downDays:lt}}const Ee=1.128,le=3.267;function de(ne){const se=ne.length;if(se<2)return null;const ce=[];for(let ye=1;ye<se;ye++)ce.push(Math.abs(ne[ye]-ne[ye-1]));const he=ce.reduce((ye,ve)=>ye+ve,0)/ce.length;return{ranges:ce,centre:he,upper:le*he,lower:0}}function Se(ne){const se=ne.length;if(se<2)return null;let ce=0;for(let ye=1;ye<se;ye++)ce+=Math.abs(ne[ye]-ne[ye-1]);const he=ce/(se-1);return{sigma:he/Ee,meanRange:he}}function Fe(ne,se){const ce=ne.length;if(ce<2||!se)return null;const he=Number.isFinite(Number(se.lower))?Number(se.lower):null,ye=Number.isFinite(Number(se.upper))?Number(se.upper):null;if(he===null&&ye===null)return null;let ve=0;for(let Qe=0;Qe<ce;Qe++)ve+=ne[Qe];ve/=ce;let Te=0;for(let Qe=0;Qe<ce;Qe++)Te+=(ne[Qe]-ve)**2;const xe=Math.sqrt(Te/(ce-1)),ze=Se(ne),Ye=ze?ze.sigma:null,$e=Qe=>{if(!Qe||Qe<=0)return{index:null,k:null};const ot=he!==null&&ye!==null?(ye-he)/(6*Qe):null,st=ye!==null?(ye-ve)/(3*Qe):1/0,St=he!==null?(ve-he)/(3*Qe):1/0;return{index:ot,k:Math.min(st,St)}},Ge=$e(Ye),Ze=$e(xe);let Je=0;for(let Qe=0;Qe<ce;Qe++){if(he!==null&&ne[Qe]<he){Je++;continue}ye!==null&&ne[Qe]>ye&&Je++}return{n:ce,mean:ve,lower:he,upper:ye,target:Number.isFinite(Number(se.target))?Number(se.target):null,sigmaWithin:Ye,sigmaOverall:xe,cp:Ge.index,cpk:Ge.k,pp:Ze.index,ppk:Ze.k,outOfSpec:Je,defectRate:ce?Je/ce:null}}function ke(ne){const se=ne.length;if(se<2)return null;const ce=Se(ne);if(!ce||!(ce.sigma>0))return null;let he=0;for(let ye=0;ye<se;ye++)he+=ne[ye];return he/=se,{centre:he,sigma:ce.sigma,upper:he+3*ce.sigma,lower:he-3*ce.sigma}}function Ie(ne,se){if(!se||!(se.sigma>0))return[];const ce=ne.length,{centre:he,sigma:ye}=se,ve=xe=>(ne[xe]-he)/ye,Te=[];for(let xe=0;xe<ce;xe++){if(Math.abs(ve(xe))>3&&Te.push({index:xe,rule:1,description:"beyond three sigma"}),xe>=2)for(const ze of[1,-1]){let Ye=0;for(let $e=xe-2;$e<=xe;$e++)ve($e)*ze>2&&Ye++;if(Ye>=2){Te.push({index:xe,rule:2,description:"two of three past two sigma"});break}}if(xe>=4)for(const ze of[1,-1]){let Ye=0;for(let $e=xe-4;$e<=xe;$e++)ve($e)*ze>1&&Ye++;if(Ye>=4){Te.push({index:xe,rule:3,description:"four of five past one sigma"});break}}if(xe>=7)for(const ze of[1,-1]){let Ye=!0;for(let $e=xe-7;$e<=xe;$e++)if(ve($e)*ze<=0){Ye=!1;break}if(Ye){Te.push({index:xe,rule:4,description:"eight in a row on one side"});break}}}return Te}function Be(ne,se){if(!se||!(se.sigma>0))return[];const ce=ne.length,{centre:he,sigma:ye}=se,ve=ze=>(ne[ze]-he)/ye,Te=(ze,Ye,$e,Ge)=>{for(const Ze of[1,-1]){let Je=0;for(let Qe=ze;Qe<=Ye;Qe++)ve(Qe)*Ze>$e&&Je++;if(Je>=Ge)return!0}return!1},xe=[];for(let ze=0;ze<ce;ze++){if(Math.abs(ve(ze))>3&&xe.push({index:ze,rule:1,description:"beyond three sigma"}),ze>=8)for(const Ye of[1,-1]){let $e=!0;for(let Ge=ze-8;Ge<=ze;Ge++)if(ve(Ge)*Ye<=0){$e=!1;break}if($e){xe.push({index:ze,rule:2,description:"nine in a row on one side"});break}}if(ze>=5)for(const Ye of[1,-1]){let $e=!0;for(let Ge=ze-4;Ge<=ze;Ge++)if((ne[Ge]-ne[Ge-1])*Ye<=0){$e=!1;break}if($e){xe.push({index:ze,rule:3,description:Ye>0?"six rising":"six falling"});break}}if(ze>=13){let Ye=!0;for(let $e=ze-12;$e<=ze;$e++){const Ge=ne[$e]-ne[$e-1],Ze=ne[$e+1<=ze?$e+1:$e]-ne[$e];if($e+1>ze)break;if(Ge===0||Ze===0||Ge>0==Ze>0){Ye=!1;break}}Ye&&xe.push({index:ze,rule:4,description:"fourteen alternating"})}if(ze>=2&&Te(ze-2,ze,2,2)&&xe.push({index:ze,rule:5,description:"two of three past two sigma"}),ze>=4&&Te(ze-4,ze,1,4)&&xe.push({index:ze,rule:6,description:"four of five past one sigma"}),ze>=14){let Ye=!0;for(let $e=ze-14;$e<=ze;$e++)if(Math.abs(ve($e))>=1){Ye=!1;break}Ye&&xe.push({index:ze,rule:7,description:"fifteen within one sigma"})}if(ze>=7){let Ye=!0;for(let $e=ze-7;$e<=ze;$e++)if(Math.abs(ve($e))<=1){Ye=!1;break}Ye&&xe.push({index:ze,rule:8,description:"eight beyond one sigma"})}}return xe}const Ke=Object.freeze(["westernElectric","nelson"]);function rt(ne,se,ce="westernElectric"){return String(ce)==="nelson"?Be(ne,se):Ie(ne,se)}function tt(ne,se,ce){let he=0;for(let ye=0;ye<ne.length;ye++)(ne[ye]<se||ne[ye]>ce)&&he++;return he}function pt(ne,se,ce,he=20){const ye=ne.length;if(!ye)return[];const ve=ne[0],Te=ne[ye-1];if(Te===ve)return[{from:ve,to:Te,count:ye}];const xe=ce-se,ze=1.5*xe;let Ye=xe>0?Math.max(ve,se-ze):ve,$e=xe>0?Math.min(Te,ce+ze):Te;$e>Ye||(Ye=ve,$e=Te);const Ge=xe>0?2*xe/Math.cbrt(ye):($e-Ye)/(Math.ceil(Math.log2(ye))+1),Ze=Ge>0?Math.min(he,Math.max(1,Math.ceil(($e-Ye)/Ge))):1,Je=($e-Ye)/Ze,Qe=[];for(let lt=0;lt<Ze;lt++)Qe.push({from:Ye+lt*Je,to:Ye+(lt+1)*Je,count:0});for(let lt=0;lt<ye;lt++){const ot=Math.min(Ze-1,Math.max(0,Math.floor((ne[lt]-Ye)/Je)));Qe[ot].count++}return Qe[0].from=ve,Qe[Ze-1].to=Te,Qe}const yt=.95;function kt(ne){const se=Number(ne);return Number.isFinite(se)&&se>0&&se<1?se:yt}function Pt(ne,se=yt){const ce=ne.length;if(ce<2)return null;let he=0;for(let $e=0;$e<ce;$e++)he+=ne[$e];const ye=he/ce;let ve=0;for(let $e=0;$e<ce;$e++){const Ge=ne[$e]-ye;ve+=Ge*Ge}const Te=Math.sqrt(ve/(ce-1)),xe=kt(se),Ye=_(1-(1-xe)/2,ce-1)*Te/Math.sqrt(ce);return{mean:ye,lower:ye-Ye,upper:ye+Ye,margin:Ye,n:ce,confidence:xe}}function Ct(ne,se,ce=yt){const he=Number(ne),ye=Number(se);if(!(ye>0)||!(he>=0)||he>ye)return null;const ve=kt(ce),Te=X(1-(1-ve)/2),xe=he/ye,ze=Te*Te,Ye=1+ze/ye,$e=(xe+ze/(2*ye))/Ye,Ge=Te/Ye*Math.sqrt(xe*(1-xe)/ye+ze/(4*ye*ye));return{proportion:xe,lower:Math.max(0,$e-Ge),upper:Math.min(1,$e+Ge),n:ye,confidence:ve}}function Lt(ne,se=yt){if(!ne||!(ne.n>2)||!Number.isFinite(ne.stdError))return null;const ce=kt(se),ye=_(1-(1-ce)/2,ne.n-2)*ne.stdError;return{slope:ne.slope,lower:ne.slope-ye,upper:ne.slope+ye,margin:ye,confidence:ce}}function Rt(ne,se,ce=yt){const he=Number(ne),ye=Number(se);if(!Number.isFinite(he)||!(ye>1))return null;const ve=kt(ce),xe=X(1-(1-ve)/2)*Math.sqrt(1/(9*ye)+he*he/(2*(ye-1)));return{index:he,lower:he-xe,upper:he+xe,margin:xe,n:ye,confidence:ve}}function Bt(ne,se){return!ne||!(ne.sd>0)||!Number.isFinite(se)||!Number.isFinite(ne.mean)?null:(se-ne.mean)/ne.sd}function ht(ne){return Number.isFinite(ne)?Math.min(1,Math.max(0,2*B(Math.abs(ne)/2)-1)):0}function ct(ne,se){const ce=new Map,he=q(ne);let ye=0;for(let ve=0;ve<se.length;ve++){const Te=he(se[ve]);if(Te==null||Te===""||typeof Te=="number"&&Number.isNaN(Te))continue;const xe=Te instanceof Date?Te.getTime():typeof Te=="object"?String(Te):Te;ce.set(xe,(ce.get(xe)||0)+1),ye++}return{map:ce,total:ye}}function bt(ne,se,ce,he){if(!(se>0)||!(he>0))return null;let ye=0;const ve=new Set(ne.keys());for(const Te of ce.keys())ve.add(Te);for(const Te of ve){const xe=(ne.get(Te)||0)/se,ze=(ce.get(Te)||0)/he;ye+=Math.abs(xe-ze)}return ye/2}const it=10;function we(ne,se,ce){if(ce&&ce.numeric){const xe=u(ne,se),{n:ze,mean:Ye}=p(xe),$e=ze>0?Bt({mean:ce.mean,sd:ce.sd},Ye):null;return{measure:"standardizedMeanDifference",magnitude:$e,distance:$e===null?0:ht($e),direction:$e===null?0:Math.sign($e),subsetN:ze,populationN:ce.n||0,reliable:ze>=it}}const{map:ye,total:ve}=ct(ne,se),Te=bt(ye,ve,ce.map,ce.total);return{measure:"categoricalTotalVariation",magnitude:Te,distance:Te===null?0:Te,direction:0,subsetN:ve,populationN:ce.total||0,reliable:ve>=it}}function Le(ne,se){if(ne&&(ne.kind==="float64"||ne.kind==="int32"))return!0;const ce=q(ne);let he=0,ye=0;for(let ve=0;ve<se.length&&he<200;ve++){const Te=ce(se[ve]);if(Te==null||Te==="")continue;if(Te instanceof Date)return!1;he++;const xe=typeof Te=="number"?Te:Number(Te);Number.isFinite(xe)&&ye++}return he===0?!1:ye/he>=.9}function Re(ne,se){if(Le(ne,se)){const ye=u(ne,se),{n:ve,mean:Te,m2:xe}=p(ye);return{numeric:!0,mean:Te,sd:ve>0?Math.sqrt(xe/ve):0,n:ve}}const{map:ce,total:he}=ct(ne,se);return{numeric:!1,map:ce,total:he}}}),Ue("packages/core/src/compute/total.js",function(e,U){"use strict";Object.defineProperty(e,"TOTAL_FNS",{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,"TOTAL_LABELS",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"totalLabel",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"aggregatesFor",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"aggregateAllowed",{enumerable:!0,get:function(){return v}}),Object.defineProperty(e,"collectValues",{enumerable:!0,get:function(){return h}}),Object.defineProperty(e,"total",{enumerable:!0,get:function(){return p}});const E=U("packages/core/src/internal/predicates.js").isFunction,z=U("packages/core/src/internal/warn.js").warnOnce,_=U("packages/core/src/compute/handle.js"),Z=_.presenceReader,X=_.valueComparator,B=_.valueReader,Y=U("packages/core/src/compute/statistics.js"),G=Y.STAT_FNS,j=Y.STAT_LABELS;function k(b){return!!b&&(b.kind==="float64"||b.kind==="int32")}function g(b,O){const y=O.length;let L=0;if(k(b)){const D=b.values,F=Z(b);if(!F){for(let T=0;T<y;T++){const I=D[O[T]];Number.isNaN(I)||(L+=I)}return L}for(let T=0;T<y;T++){const I=O[T];if(F(I)===1){const P=D[I];Number.isNaN(P)||(L+=P)}}return L}const M=B(b);for(let D=0;D<y;D++){const F=u(M(O[D]));F!==null&&(L+=F)}return L}g.kernel=!0;function c(b,O){const y=O.length;let L=0;if(k(b)){const D=b.values,F=Z(b);if(!F){for(let T=0;T<y;T++)Number.isNaN(D[O[T]])||L++;return L}for(let T=0;T<y;T++){const I=O[T];F(I)===1&&!Number.isNaN(D[I])&&L++}return L}const M=B(b);for(let D=0;D<y;D++){const F=M(O[D]);F!=null&&!(typeof F=="number"&&Number.isNaN(F))&&L++}return L}c.kernel=!0;function d(b,O){return O.length}d.kernel=!0;function l(b,O){const y=c(b,O);return y===0?null:g(b,O)/y}l.kernel=!0;function i(b,O,y,L){const M=O.length;if(k(b)){const I=b.values,P=Z(b);let R=null;if(!P){for(let $=0;$<M;$++){const C=I[O[$]];Number.isNaN(C)||(R===null||(y<0?C<R:C>R))&&(R=C)}return R}for(let $=0;$<M;$++){const C=O[$];if(P(C)===0)continue;const A=I[C];Number.isNaN(A)||(R===null||(y<0?A<R:A>R))&&(R=A)}return R}const D=B(b),F=X(L);let T=null;for(let I=0;I<M;I++){const P=D(O[I]);P==null||typeof P=="number"&&Number.isNaN(P)||(T===null||(y<0?F(P,T)<0:F(P,T)>0))&&(T=P)}return T}function n(b,O,y){return i(b,O,-1,y&&y.locale)}n.kernel=!0;function a(b,O,y){return i(b,O,1,y&&y.locale)}a.kernel=!0;function s(b,O){return O.length===0?null:B(b)(O[0])}s.kernel=!0;function t(b,O){return O.length===0?null:B(b)(O[O.length-1])}t.kernel=!0;function u(b){if(typeof b=="number")return Number.isNaN(b)?null:b;if(b==null||b===""||typeof b=="boolean")return null;if(b instanceof Date)return b.getTime();const O=Number(b);return Number.isNaN(O)?null:O}const r={sum:g,min:n,max:a,avg:l,count:d,first:s,last:t,countValues:c,...G},o=Object.freeze({...j,sum:"Sum",avg:"Average",min:"Min",max:"Max",count:"Count",countValues:"Count of values",first:"First",last:"Last"});function f(b){return b?typeof b=="string"?o[b]||b:"Total":""}const w=Object.freeze(["sum","avg","min","max","count","countValues","first","last"]);function m(b){const O=b&&b.dataType&&b.dataType.totals&&b.dataType.totals.supported;if(Array.isArray(O))return O.slice();const y=w.filter(L=>L in r);for(const L of Object.keys(r))y.includes(L)||y.push(L);return y}function v(b,O){return typeof O!="string"?!0:m(b).includes(O)}function h(b,O){const y=B(b),L=[];for(let M=0;M<O.length;M++){const D=y(O[M]);D!=null&&L.push(D)}return L}function p(b,O,y,L){const M=O||[];if(typeof y=="string"){const D=r[y];return D?D(b,M,L):(z(`total:${y}`,`unknown total function "${y}"; register it in config.totalFns`),null)}return E(y)?y.kernel===!0?y(b,M,L):y(h(b,M),L||{}):null}}),Ue("packages/core/src/compute/windowed.js",function(e,U){"use strict";Object.defineProperty(e,"Window",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"WINDOW_KINDS",{enumerable:!0,get:function(){return z}}),Object.defineProperty(e,"openWindow",{enumerable:!0,get:function(){return _}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return Z}});const E=U("packages/core/src/compute/sketch.js").Welford;class q{#e;#t;#n=[];#r;#s;constructor(B,Y=0,G=Date.now){if(B!=="count"&&B!=="time"&&B!=="session")throw new RangeError(`unknown window kind: ${B}`);if((B==="count"||B==="time")&&!(Y>0))throw new RangeError(`a ${B} window needs a positive span`);this.#e=B,this.#t=Math.floor(Y),this.#r=G,this.#s=G()}get size(){return this.#n.length}push(B,Y=this.#r()){Number.isFinite(B)&&(this.#n.push({t:Y,v:B}),this.#i(Y))}#i(B){if(this.#e==="count")for(;this.#n.length>this.#t;)this.#n.shift();else if(this.#e==="time"){const Y=B-this.#t;for(;this.#n.length&&this.#n[0].t<Y;)this.#n.shift()}}spec(){const B=this.#e==="session"?this.#r()-this.#s:this.#t;return{kind:this.#e,span:B,size:this.#n.length}}values(){return this.#n.map(B=>B.v)}aggregate(){const B=this.spec();if(!this.#n.length)return{over:B,count:0,sum:null,mean:null,min:null,max:null,variance:null,stddev:null};const Y=new E;let G=0,j=1/0,k=-1/0;for(const{v:g}of this.#n)G+=g,g<j&&(j=g),g>k&&(k=g),Y.add(g);return{over:B,count:this.#n.length,sum:G,mean:Y.mean(),min:j,max:k,variance:Y.variance(),stddev:Y.stddev()}}reduce(B){const Y=this.aggregate(),G={sum:Y.sum,avg:Y.mean,mean:Y.mean,min:Y.min,max:Y.max,count:Y.count,variance:Y.variance,stddev:Y.stddev};if(!(B in G))throw new RangeError(`unknown windowed aggregate: ${B}`);return{value:G[B],over:Y.over}}}const z=Object.freeze(["count","time","session"]);function _(X,B=Date.now){const Y=X.kind==="time"&&X.minutes!=null?X.minutes*6e4:X.span??0;return new q(X.kind,Y,B)}const Z={Window:q,WINDOW_KINDS:z,openWindow:_}}),Ue("packages/core/src/compute/rolling.js",function(e,U){"use strict";Object.defineProperty(e,"ROLLING_WINDOW_FIELDS",{enumerable:!0,get:function(){return _}}),Object.defineProperty(e,"rollingWindow",{enumerable:!0,get:function(){return X}}),Object.defineProperty(e,"cumulativeToDate",{enumerable:!0,get:function(){return B}}),Object.defineProperty(e,"periodOverPeriod",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(e,"QUANTILE_SPAN_CAP",{enumerable:!0,get:function(){return G}}),Object.defineProperty(e,"rollingQuantile",{enumerable:!0,get:function(){return g}}),Object.defineProperty(e,"seasonalDecompose",{enumerable:!0,get:function(){return d}}),Object.defineProperty(e,"exponentialSmoothing",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return u}});const E=U("packages/core/src/compute/windowed.js").openWindow,z=U("packages/core/src/compute/sketch.js").KLL,_=Object.freeze({rollingSum:"sum",rollingAvg:"avg",rollingMin:"min",rollingMax:"max"});function Z(r,o,f,w){if(r.kind==="count"){const m=Math.max(1,Math.floor(r.span||0));return{coverage:Math.min(1,o/m),partial:o<m}}if(r.kind==="time"){const m=r.minutes!=null?r.minutes*6e4:r.span||0;if(!(m>0))return{coverage:1,partial:!1};const v=f-w;return{coverage:Math.min(1,v/m),partial:v<m}}return{coverage:null,partial:!1}}function X(r,o){const f=E(o),w=new Map,m=r.length?r[0].at:0;for(let v=0;v<r.length;v++){const{key:h,at:p,value:b}=r[v];Number.isFinite(b)&&f.push(b,p);const O=f.aggregate(),y=Z(o,O.count,p,m);h!=null&&w.set(String(h),{sum:O.sum,avg:O.mean,min:O.min,max:O.max,count:O.count,coverage:y.coverage,partial:y.partial})}return w}function B(r){const o=new Map;let f=0;for(const{key:w,value:m}of r)Number.isFinite(m)&&(f+=m),w!=null&&o.set(String(w),f);return o}function Y(r,o=1){const f=new Map,w=Math.max(1,Math.floor(o));for(let m=0;m<r.length;m++){const{key:v,value:h}=r[m];if(v==null)continue;const p=m>=w?r[m-w].value:null,b=Number.isFinite(h)?h:null,O=Number.isFinite(p)?p:null;f.set(String(v),b!==null&&O!==null?b-O:null)}return f}const G=4096;function j(r){let o=r>>>0;return()=>{o+=1831565813;let f=o;return f=Math.imul(f^f>>>15,f|1),f^=f+Math.imul(f^f>>>7,f|61),((f^f>>>14)>>>0)/4294967296}}function k(r,o){const f=r.length;if(f===1)return r[0];const w=(f-1)*o,m=Math.floor(w),v=Math.ceil(w);return m===v?r[m]:r[m]+(w-m)*(r[v]-r[m])}function g(r,o,f={}){const w=Math.min(1,Math.max(0,f.q==null?.5:f.q)),m=Math.max(1,Math.floor(f.cap==null?G:f.cap)),v=j(f.seed==null?2654435769:f.seed),h=new Map,p=r.length?r[0].at:0;if(o.kind==="session"){const O=new z(200,v);let y=0;for(const{key:L,value:M}of r)Number.isFinite(M)&&(O.add(M),y++),L!=null&&h.set(String(L),{value:y?O.quantile(w):null,approx:y>0,count:y,coverage:null,partial:!1});return h}const b=E(o);for(const{key:O,at:y,value:L}of r){Number.isFinite(L)&&b.push(L,y);const M=b.values(),D=M.length;let F=null,T=!1;if(D)if(D<=m)F=k([...M].sort((P,R)=>P-R),w);else{const P=new z(200,v);for(const R of M)P.add(R);F=P.quantile(w),T=!0}const I=Z(o,D,y,p);O!=null&&h.set(String(O),{value:F,approx:T,count:D,coverage:I.coverage,partial:I.partial})}return h}function c(r,o){const f=r.length,w=new Array(f).fill(null),m=Math.floor(o/2),v=o%2===0;for(let h=0;h<f;h++){if(h-m<0||h+m>=f)continue;let p=0,b=!0;if(v)for(let O=-m;O<=m;O++){const y=r[h+O];if(!Number.isFinite(y)){b=!1;break}p+=O===-m||O===m?y*.5:y}else for(let O=-m;O<=m;O++){const y=r[h+O];if(!Number.isFinite(y)){b=!1;break}p+=y}b&&(w[h]=p/o)}return w}function d(r,o){const f=new Map,w=Math.floor(Number(o&&o.period));if(!(w>=2))return f;const m=o&&o.model==="multiplicative",v=r.length,h=r.map(T=>Number.isFinite(T.value)?T.value:null),p=c(h,w),b=new Array(v).fill(null);for(let T=0;T<v;T++){const I=p[T],P=h[T];I===null||P===null||(m?I!==0&&(b[T]=P/I):b[T]=P-I)}const O=new Array(w).fill(0),y=new Array(w).fill(0);for(let T=0;T<v;T++){if(b[T]===null)continue;const I=T%w;O[I]+=b[T],y[I]+=1}const L=m?1:0,M=O.map((T,I)=>y[I]?T/y[I]:L),D=M.reduce((T,I)=>T+I,0)/w,F=m?M.map(T=>D!==0?T/D:1):M.map(T=>T-D);for(let T=0;T<v;T++){const{key:I}=r[T];if(I==null)continue;const P=p[T],R=F[T%w],$=h[T];let C=null;P!==null&&$!==null&&(C=m?P*R!==0?$/(P*R):null:$-P-R),f.set(String(I),{trend:P,seasonal:$===null?null:R,residual:C,coverage:P===null?0:1,partial:P===null})}return f}function l(r,o,f,w=80){const m=(Math.sqrt(5)-1)/2;let v=o,h=f,p=h-m*(h-v),b=v+m*(h-v),O=r(p),y=r(b);for(let L=0;L<w;L++)O<y?(h=b,b=p,y=O,p=h-m*(h-v),O=r(p)):(v=p,p=b,O=y,b=v+m*(h-v),y=r(b));return(v+h)/2}const i=1e-4,n=1-1e-4;function a(r,o){const f=r.length,w=new Array(f).fill(null),m=new Array(f).fill(null);let v=null,h=0;for(let p=0;p<f;p++){const b=r[p];if(!Number.isFinite(b)){v!==null&&(m[p]=v,w[p]=v);continue}if(v===null){v=b,m[p]=b,w[p]=b;continue}m[p]=v,h+=(b-v)**2,v=o*b+(1-o)*v,w[p]=v}return{smoothed:w,fitted:m,sse:h}}function s(r,o,f){const w=r.length,m=new Array(w).fill(null),v=new Array(w).fill(null);let h=null,p=null,b=0;for(let O=0;O<w;O++){const y=r[O];if(!Number.isFinite(y)){h!==null&&(h+=p,m[O]=h);continue}if(h===null){h=y,m[O]=y;continue}if(p===null){p=y-h;const D=h+p;v[O]=D,b+=(y-D)**2;const F=h;h=o*y+(1-o)*(F+p),p=f*(h-F)+(1-f)*p,m[O]=h;continue}const L=h+p;v[O]=L,b+=(y-L)**2;const M=h;h=o*y+(1-o)*(M+p),p=f*(h-M)+(1-f)*p,m[O]=h}return{smoothed:m,fitted:v,sse:b}}function t(r,o={}){const f=new Map,w=o.method==="holt",m=r.map(L=>Number.isFinite(L.value)?L.value:null),v=m.filter(L=>L!==null).length,h=L=>Math.min(n,Math.max(i,L)),p=()=>{for(const{key:L}of r)L!=null&&f.set(String(L),{smoothed:null,fitted:null,alpha:null,beta:null,sse:null});return f};if(v<(w?2:1))return p();let b=Number.isFinite(o.alpha)?h(o.alpha):null,O=w&&Number.isFinite(o.beta)?h(o.beta):null;if(w){if(b===null||O===null){let L=b===null?.5:b,M=O===null?.5:O;for(let D=0;D<6;D++)b===null&&(L=l(F=>s(m,F,M).sse,i,n)),O===null&&(M=l(F=>s(m,L,F).sse,i,n));b=b===null?L:b,O=O===null?M:O}}else b===null&&(b=l(L=>a(m,L).sse,i,n));const y=w?s(m,b,O):a(m,b);for(let L=0;L<r.length;L++){const{key:M}=r[L];M!=null&&f.set(String(M),{smoothed:y.smoothed[L],fitted:y.fitted[L],alpha:b,beta:w?O:null,sse:y.sse})}return f}const u={ROLLING_WINDOW_FIELDS:_,QUANTILE_SPAN_CAP:G,rollingWindow:X,rollingQuantile:g,cumulativeToDate:B,periodOverPeriod:Y,seasonalDecompose:d,exponentialSmoothing:t}}),Ue("packages/core/src/compute/compare.js",function(e,U){"use strict";Object.defineProperty(e,"COMPARE_MEASURES",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(e,"pooledStandardMeanDifference",{enumerable:!0,get:function(){return G}}),Object.defineProperty(e,"numericSummary",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"bothNumeric",{enumerable:!0,get:function(){return k}}),Object.defineProperty(e,"compareColumnAcross",{enumerable:!0,get:function(){return g}}),Object.defineProperty(e,"compareDatasets",{enumerable:!0,get:function(){return c}});const te=U("packages/core/src/compute/statistics.js"),E=te.numbers,q=te.moments,z=te.frequencyMap,_=te.categoricalDistance,Z=te.normalTotalVariation,X=te.isNumericColumn,B=te.SUBSET_RELIABILITY_FLOOR,Y=Object.freeze({numeric:"pooledStandardMeanDifference",categorical:"categoricalTotalVariation",common:"totalVariationDistance"});function G(d,l){if(!d||!l||!(d.n>0)||!(l.n>0)||!Number.isFinite(d.mean)||!Number.isFinite(l.mean))return null;const i=(d.n*d.sd*d.sd+l.n*l.sd*l.sd)/(d.n+l.n);return i>0?(d.mean-l.mean)/Math.sqrt(i):null}function j(d,l){const i=E(d,l),{n,mean:a,m2:s}=q(i),t=n>0?Math.sqrt(s/n):0;return{mean:a,sd:t,n}}function k(d,l,i,n){return X(d,l)&&X(i,n)}function g(d,l,i,n){if(k(d,l,i,n)){const u=j(d,l),r=j(i,n),o=G(u,r);return{measure:Y.numeric,magnitude:o,distance:o===null?0:Z(o),direction:o===null?0:Math.sign(o),nA:u.n,nB:r.n,reliable:u.n>=B&&r.n>=B}}const a=z(d,l),s=z(i,n),t=_(a.map,a.total,s.map,s.total);return{measure:Y.categorical,magnitude:t,distance:t===null?0:t,direction:0,nA:a.total,nB:s.total,reliable:a.total>=B&&s.total>=B}}function c(d,l,i={}){const n=new Set(d.columns),a=new Set(l.columns),s=d.columns.filter(f=>a.has(f)),t=Array.isArray(i.columns)&&i.columns.length?s.filter(f=>i.columns.includes(f)):s,u=d.indices(),r=l.indices(),o=[];for(const f of t){const w=d.handle(f),m=l.handle(f);if(!w||!m)continue;const v=g(w,u,m,r);o.push({column:f,name:d.name&&d.name(f)||l.name&&l.name(f)||f,measure:v.measure,magnitude:v.magnitude,distance:v.distance,direction:v.direction,nA:v.nA,nB:v.nB,reliable:v.reliable})}return o.sort((f,w)=>w.distance-f.distance||Math.abs(w.magnitude||0)-Math.abs(f.magnitude||0)),{ranked:o,nA:u.length,nB:r.length,unmatched:{onlyA:d.columns.filter(f=>!a.has(f)),onlyB:l.columns.filter(f=>!n.has(f))},measures:Y}}}),Ue("packages/core/src/compute/anomaly.js",function(e,U){"use strict";Object.defineProperty(e,"MAD_SCALE",{enumerable:!0,get:function(){return _}}),Object.defineProperty(e,"DEFAULT_MODIFIED_Z_THRESHOLD",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"DEFAULT_IQR_K",{enumerable:!0,get:function(){return X}}),Object.defineProperty(e,"DEFAULT_CHI_SQUARE_P",{enumerable:!0,get:function(){return B}}),Object.defineProperty(e,"ANOMALY_METHODS",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(e,"robustSpread",{enumerable:!0,get:function(){return G}}),Object.defineProperty(e,"modifiedZScores",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"iqrFences",{enumerable:!0,get:function(){return k}}),Object.defineProperty(e,"chiSquareCdf",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"chiSquareQuantile",{enumerable:!0,get:function(){return d}}),Object.defineProperty(e,"mahalanobis",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"DEFAULT_ROLLING_WINDOW",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"ROLLING_ANOMALY_METHODS",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"rollingAnomalies",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"anomalyCondition",{enumerable:!0,get:function(){return u}});const E=U("packages/core/src/compute/statistics.js").quantileSorted,z=U("packages/core/src/compute/special.js").logGamma,_=.6745,Z=3.5,X=1.5,B=.975,Y=Object.freeze(["modifiedZScore","iqr","mahalanobis"]);function G(r){if(!r.length)return null;const f=Array.from(r,Number).sort((h,p)=>h-p),w=E(f,.5),m=f.map(h=>Math.abs(h-w)).sort((h,p)=>h-p),v=E(m,.5);return{median:w,mad:v}}function j(r,o={}){const f=Number.isFinite(o.threshold)?o.threshold:Z,w=r.length,m=new Array(w).fill(null),v=new Array(w).fill(!1),h=[];for(let O=0;O<w;O++){const y=Number(r[O]);Number.isFinite(y)&&h.push(y)}if(!h.length)return{median:null,mad:null,threshold:f,scores:m,flags:v,flagged:0};const p=G(h);if(p.mad===0)return{median:p.median,mad:0,threshold:f,scores:m,flags:v,flagged:0};let b=0;for(let O=0;O<w;O++){const y=Number(r[O]);if(!Number.isFinite(y))continue;const L=_*(y-p.median)/p.mad;m[O]=L,Math.abs(L)>f&&(v[O]=!0,b++)}return{median:p.median,mad:p.mad,threshold:f,scores:m,flags:v,flagged:b}}function k(r,o={}){const f=Number.isFinite(o.k)?o.k:X,w=[];for(let b=0;b<r.length;b++){const O=Number(r[b]);Number.isFinite(O)&&w.push(O)}if(!w.length)return null;const m=w.sort((b,O)=>b-O),v=E(m,.25),h=E(m,.75),p=h-v;return{q1:v,q3:h,iqr:p,lower:v-f*p,upper:h+f*p,k:f}}function g(r,o){if(o<=0)return 0;const f=z(r);if(o<r+1){let O=r,y=1/r,L=y;for(let M=0;M<1e3&&(O+=1,L*=o/O,y+=L,!(Math.abs(L)<Math.abs(y)*1e-15));M++);return y*Math.exp(-o+r*Math.log(o)-f)}const w=1e-300;let m=o+1-r,v=1/w,h=1/m,p=h;for(let O=1;O<1e3;O++){const y=-O*(O-r);m+=2,h=y*h+m,Math.abs(h)<w&&(h=w),v=m+y/v,Math.abs(v)<w&&(v=w),h=1/h;const L=h*v;if(p*=L,Math.abs(L-1)<1e-15)break}return 1-Math.exp(-o+r*Math.log(o)-f)*p}function c(r,o){return r<=0?0:g(o/2,r/2)}function d(r,o=B){if(!(o>0)||!(o<1))return NaN;let f=0,w=Math.max(1,r);for(;c(w,r)<o;)w*=2;for(let m=0;m<200;m++){const v=(f+w)/2;if(c(v,r)<o?f=v:w=v,w-f<1e-10)break}return(f+w)/2}function l(r){const o=r.length,f=r.map((w,m)=>{const v=w.slice();for(let h=0;h<o;h++)v.push(m===h?1:0);return v});for(let w=0;w<o;w++){let m=w;for(let h=w+1;h<o;h++)Math.abs(f[h][w])>Math.abs(f[m][w])&&(m=h);if(Math.abs(f[m][w])<1e-12)return null;if(m!==w){const h=f[m];f[m]=f[w],f[w]=h}const v=f[w][w];for(let h=0;h<2*o;h++)f[w][h]/=v;for(let h=0;h<o;h++){if(h===w)continue;const p=f[h][w];if(p!==0)for(let b=0;b<2*o;b++)f[h][b]-=p*f[w][b]}}return f.map(w=>w.slice(o))}function i(r,o){const f=r.length,w=new Array(o).fill(0);for(const h of r)for(let p=0;p<o;p++)w[p]+=h[p];for(let h=0;h<o;h++)w[h]/=f;const m=Array.from({length:o},()=>new Array(o).fill(0));for(const h of r)for(let p=0;p<o;p++){const b=h[p]-w[p];for(let O=p;O<o;O++)m[p][O]+=b*(h[O]-w[O])}const v=f>1?f-1:1;for(let h=0;h<o;h++)for(let p=h;p<o;p++)m[h][p]/=v,m[p][h]=m[h][p];return{mean:w,cov:m}}function n(r,o={}){const f=Number.isFinite(o.p)?o.p:B,w=Number.isFinite(o.ridge)?o.ridge:1e-6,m=r.length;if(!m)return null;const v=r[0].length;if(!v)return null;const h=new Array(m).fill(null),p=new Array(m).fill(null),b=new Array(m).fill(!1),O=[],y=[];for(let R=0;R<m;R++){const $=r[R];let C=$.length===v;const A=new Array(v);for(let S=0;C&&S<v;S++){const x=Number($[S]);Number.isFinite(x)?A[S]=x:C=!1}C&&(O.push(R),y.push(A))}const L=v,M=d(L,f);if(y.length<=v)return{center:[],df:L,cutoff:M,singular:!0,used:y.length,distances:h,squared:p,flags:b,flagged:0};const{mean:D,cov:F}=i(y,v);let T=l(F),I=!1;if(!T){I=!0;let R=0;for(let A=0;A<v;A++)R+=F[A][A];const $=R/v*w||w,C=F.map((A,S)=>A.map((x,H)=>S===H?x+$:x));if(T=l(C),!T)return{center:D,df:L,cutoff:M,singular:!0,used:y.length,distances:h,squared:p,flags:b,flagged:0}}let P=0;for(let R=0;R<y.length;R++){const $=y[R],C=new Array(v);for(let x=0;x<v;x++)C[x]=$[x]-D[x];let A=0;for(let x=0;x<v;x++){let H=0;for(let V=0;V<v;V++)H+=T[x][V]*C[V];A+=C[x]*H}A<0&&(A=0);const S=O[R];p[S]=A,h[S]=Math.sqrt(A),A>M&&(b[S]=!0,P++)}return{center:D,df:L,cutoff:M,singular:I,used:y.length,distances:h,squared:p,flags:b,flagged:P}}const a=20,s=Object.freeze(["rollingModifiedZScore","rollingIqr"]);function t(r,o={}){const f=o.method==="rollingIqr"?"rollingIqr":"rollingModifiedZScore",w=Number.isFinite(o.windowLen)&&o.windowLen>=1?Math.floor(o.windowLen):a,m=Number.isFinite(o.threshold)?o.threshold:Z,v=Number.isFinite(o.k)?o.k:X,h=Number.isFinite(o.minPeriods)&&o.minPeriods>=1?Math.floor(o.minPeriods):w,p=r.length,b=new Array(p).fill(null),O=new Array(p).fill(!1);let y=0;for(let L=0;L<p;L++){const M=Number(r[L]);if(!Number.isFinite(M))continue;const D=Math.max(0,L-w+1),F=[];for(let T=D;T<=L;T++){const I=Number(r[T]);Number.isFinite(I)&&F.push(I)}if(!(F.length<h))if(f==="rollingIqr"){const T=k(F,{k:v});if(!T)continue;(M<T.lower||M>T.upper)&&(O[L]=!0,y++)}else{const T=G(F);if(!T||T.mad===0)continue;const I=_*(M-T.median)/T.mad;b[L]=I,Math.abs(I)>m&&(O[L]=!0,y++)}}return{method:f,windowLen:w,minPeriods:h,threshold:m,k:v,scores:b,flags:O,flagged:y}}function u(r={}){const o=r||{},f=o.field;if(typeof f!="string"||!f)throw new TypeError("[lattice] anomalyCondition: a string `field` naming the numeric property to monitor is required");const w=o.method||"modifiedZScore";if(!(Y.includes(w)||s.includes(w))||w==="mahalanobis")throw new RangeError(`[lattice] anomalyCondition: unknown or unsupported method '${w}'`);const v=typeof o.orderBy=="string"?o.orderBy:null,h=o.latest===!0,p=s.includes(w),b=O=>Number(O==null?NaN:O[f]);return O=>{const y=Array.isArray(O)?O.slice():[...O];v&&y.sort((T,I)=>{const P=T?.[v],R=I?.[v];return P===R?0:P==null?-1:R==null?1:P<R?-1:1});const L=y.map(b);let M,D;if(p)({flags:M,scores:D}=t(L,{method:w,windowLen:o.windowLen,threshold:o.threshold,k:o.k,minPeriods:o.minPeriods}));else if(w==="iqr"){const T=k(L,{k:o.k});M=L.map(I=>T?Number.isFinite(I)&&(I<T.lower||I>T.upper):!1),D=L.map(()=>null)}else({flags:M,scores:D}=j(L,{threshold:o.threshold}));if(h){const T=M.length-1;return T<0||!M[T]?!1:{method:w,field:f,flagged:[{row:y[T],score:D[T]}]}}const F=[];for(let T=0;T<M.length;T++)M[T]&&F.push({row:y[T],score:D[T]});return F.length?{method:w,field:f,flagged:F}:!1}}}),Ue("packages/core/src/compute/forecast.js",function(e,U){"use strict";Object.defineProperty(e,"FORECAST_METHODS",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"forecast",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return r}});const te=U("packages/core/src/compute/special.js"),E=te.normalQuantile,q=te.studentTQuantile,_=U("packages/core/src/internal/warn.js").warnOnce,Z=Object.freeze(["movingAverage","ses","holt","holtWinters","linear"]),X=1e-4,B=1-1e-4;function Y(o){const f=[];for(let w=0;w<o.length;w++){const m=o[w];if(m!==null&&typeof m=="object"){const v=Number.isFinite(m.at)?m.at:w,h=Number.isFinite(m.value)?m.value:null;f.push({at:v,value:h})}else f.push({at:w,value:Number.isFinite(m)?Number(m):null})}return f}function G(o){const f=o.filter(p=>p.value!==null),w=f[0],m=f[f.length-1],v=m.at-w.at,h=f.length>1&&v>0?v/(f.length-1):1;return{lastAt:m.at,step:h}}function j(o){return Math.min(B,Math.max(X,o))}function k(o,f=X,w=B,m=80){const v=(Math.sqrt(5)-1)/2;let h=f,p=w,b=p-v*(p-h),O=h+v*(p-h),y=o(b),L=o(O);for(let M=0;M<m;M++)y<L?(p=O,O=b,L=y,b=p-v*(p-h),y=o(b)):(h=b,b=O,y=L,O=h+v*(p-h),L=o(O));return(h+p)/2}function g(o,f){let w=null,m=0,v=0;for(let h=0;h<o.length;h++){const p=o[h];if(p!==null){if(w===null){w=p;continue}m+=(p-w)**2,v+=1,w=f*p+(1-f)*w}}return{level:w,sse:m,m:v}}function c(o,f,w){let m=null,v=null,h=0,p=0;for(let b=0;b<o.length;b++){const O=o[b];if(O===null){m!==null&&v!==null&&(m+=v);continue}if(m===null){m=O;continue}v===null&&(v=O-m);const y=m+v;h+=(O-y)**2,p+=1;const L=m;m=f*O+(1-f)*(L+v),v=w*(m-L)+(1-w)*v}return{level:m,trend:v,sse:h,m:p}}function d(o,f,w,m,v){const h=o.length;if(h<2*f)return null;const p=I=>{let P=0,R=0;for(let $=I;$<I+f&&$<h;$++)o[$]!==null&&(P+=o[$],R+=1);return R?P/R:null},b=p(0),O=p(f);if(b===null||O===null)return null;let y=b,L=(O-b)/f;const M=new Array(f).fill(0);for(let I=0;I<f;I++)M[I]=o[I]===null?0:o[I]-y;const D=M.reduce((I,P)=>I+P,0)/f;for(let I=0;I<f;I++)M[I]-=D;let F=0,T=0;for(let I=f;I<h;I++){const P=I%f,R=M[P],$=o[I];if($===null){y+=L;continue}const C=y+L+R;F+=($-C)**2,T+=1;const A=y;y=w*($-R)+(1-w)*(y+L),L=m*(y-A)+(1-m)*L,M[P]=v*($-y)+(1-v)*R}return{level:y,trend:L,season:M,phase:(h-1)%f,sse:F,count:T}}function l(o,f,w){let m=1;for(const h of f)m+=h*h;const v=Math.sqrt(o*m);return{se:v,margin:w*v}}function i(o,f={}){if(!o||typeof o.length!="number"||o.length===0)return null;const w=Z.includes(f.method)?f.method:"linear",m=Math.max(1,Math.floor(Number(f.horizon)||1)),v=Number.isFinite(f.confidence)&&f.confidence>0&&f.confidence<1?f.confidence:.95,h=1-(1-v)/2,p=Y(o),b=p.map(F=>F.value),O=b.filter(F=>F!==null),y=O.length,{lastAt:L,step:M}=y?G(p):{lastAt:0,step:1},D=F=>L+F*M;return w==="linear"?n(p,y,m,v,h,D):w==="movingAverage"?a(O,y,m,v,h,f,D):w==="ses"?s(b,y,m,v,h,f,D):w==="holt"?t(b,y,m,v,h,f,D):u(b,y,m,v,h,f,D)}function n(o,f,w,m,v,h){if(f<2)return null;let p=0,b=0;for(const $ of o)$.value!==null&&(p+=$.at,b+=$.value);p/=f,b/=f;let O=0,y=0,L=0;for(const $ of o){if($.value===null)continue;const C=$.at-p,A=$.value-b;O+=C*C,y+=C*A,L+=A*A}if(O===0)return null;const M=y/O,D=b-M*p,F=L===0?1:Math.max(0,Math.min(1,y*y/(O*L))),T=Math.max(0,L-M*y),I=f>2?Math.sqrt(T/(f-2)):null,P=f>2?q(v,f-2):null,R=[];for(let $=1;$<=w;$++){const C=h($),A=D+M*C;let S=null,x=null,H=null,V=null,W=null;if(I!==null){const Q=1/f+(C-p)**2/O,ee=I*Math.sqrt(1+Q),re=I*Math.sqrt(Q);W=ee,S=A-P*ee,x=A+P*ee,H=A-P*re,V=A+P*re}R.push({step:$,at:C,mean:A,lower:S,upper:x,lowerMean:H,upperMean:V,se:W})}return{method:"linear",horizon:w,confidence:m,n:f,sigma:I,r2:F,params:{slope:M,intercept:D},points:R}}function a(o,f,w,m,v,h,p){if(f<1)return null;const b=Math.max(1,Math.min(f,Math.floor(Number(h.windowLen)||f))),O=o.slice(f-b);let y=0;for(const I of O)y+=I;const L=y/b;let M=null,D=null;if(b>1){let I=0;for(const R of O)I+=(R-L)**2;M=Math.sqrt(I/(b-1))*Math.sqrt(1+1/b),D=q(v,b-1)}const F=M===null?null:D*M,T=[];for(let I=1;I<=w;I++)T.push({step:I,at:p(I),mean:L,lower:F===null?null:L-F,upper:F===null?null:L+F,se:M});return{method:"movingAverage",horizon:w,confidence:m,n:f,sigma:M===null?null:M,params:{windowLen:b},points:T}}function s(o,f,w,m,v,h,p){if(f<1)return null;let b=Number.isFinite(h.alpha)?j(h.alpha):null;b===null&&(b=k(D=>g(o,D).sse));const O=g(o,b),y=E(v),L=O.m>0?O.sse/O.m:null,M=[];for(let D=1;D<=w;D++){const F=O.level;let T=null,I=null,P=null;if(L!==null){const R=[];for(let C=1;C<D;C++)R.push(b);const $=l(L,R,y);P=$.se,T=F-$.margin,I=F+$.margin}M.push({step:D,at:p(D),mean:F,lower:T,upper:I,se:P})}return{method:"ses",horizon:w,confidence:m,n:f,sigma:L===null?null:Math.sqrt(L),params:{alpha:b},points:M}}function t(o,f,w,m,v,h,p){if(f<2)return null;let b=Number.isFinite(h.alpha)?j(h.alpha):null,O=Number.isFinite(h.beta)?j(h.beta):null;if(b===null||O===null){let T=b===null?.5:b,I=O===null?.5:O;for(let P=0;P<6;P++)b===null&&(T=k(R=>c(o,R,I).sse)),O===null&&(I=k(R=>c(o,T,R).sse));b=b===null?T:b,O=O===null?I:O}const y=c(o,b,O),L=E(v),M=y.m>0?y.sse/y.m:null,D=b*O,F=[];for(let T=1;T<=w;T++){const I=y.level+T*y.trend;let P=null,R=null,$=null;if(M!==null){const C=[];for(let S=1;S<T;S++)C.push(b+S*D);const A=l(M,C,L);$=A.se,P=I-A.margin,R=I+A.margin}F.push({step:T,at:p(T),mean:I,lower:P,upper:R,se:$})}return{method:"holt",horizon:w,confidence:m,n:f,sigma:M===null?null:Math.sqrt(M),params:{alpha:b,beta:O},points:F}}function u(o,f,w,m,v,h,p){const b=Math.floor(Number(h.period));if(!(b>=2))return _("forecast.holtWinters.period","forecast: holtWinters needs a period (opts.period >= 2)"),null;if(f<2*b)return null;let O=Number.isFinite(h.alpha)?j(h.alpha):null,y=Number.isFinite(h.beta)?j(h.beta):null,L=Number.isFinite(h.gamma)?j(h.gamma):null;const M=($,C,A)=>{const S=d(o,b,$,C,A);return S?S.sse:1/0};if(O===null||y===null||L===null){let $=O===null?.5:O,C=y===null?.5:y,A=L===null?.5:L;for(let S=0;S<8;S++)O===null&&($=k(x=>M(x,C,A))),y===null&&(C=k(x=>M($,x,A))),L===null&&(A=k(x=>M($,C,x)));O=O===null?$:O,y=y===null?C:y,L=L===null?A:L}const D=d(o,b,O,y,L);if(!D)return null;const F=E(v),T=D.count>0?D.sse/D.count:null,I=O*y,P=L*(1-O),R=[];for(let $=1;$<=w;$++){const C=D.season[(D.phase+$)%b],A=D.level+$*D.trend+C;let S=null,x=null,H=null;if(T!==null){const V=[];for(let Q=1;Q<$;Q++)V.push(O+Q*I+(Q%b===0?P:0));const W=l(T,V,F);H=W.se,S=A-W.margin,x=A+W.margin}R.push({step:$,at:p($),mean:A,lower:S,upper:x,se:H})}return{method:"holtWinters",horizon:w,confidence:m,n:f,sigma:T===null?null:Math.sqrt(T),params:{alpha:O,beta:y,gamma:L,period:b},points:R}}const r={FORECAST_METHODS:Z,forecast:i}}),Ue("packages/core/src/compute/hypothesis.js",function(e,U){"use strict";Object.defineProperty(e,"GROUP_TESTS",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"NORMALITY_ALPHA",{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,"HL_PAIR_LIMIT",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"welchTTest",{enumerable:!0,get:function(){return h}}),Object.defineProperty(e,"mannWhitneyUTest",{enumerable:!0,get:function(){return O}}),Object.defineProperty(e,"chiSquareTest",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"compareGroups",{enumerable:!0,get:function(){return F}});const E=U("packages/core/src/internal/warn.js").warnOnce,z=U("packages/core/src/compute/handle.js").valueReader,_=U("packages/core/src/compute/statistics.js"),Z=_.numbers,X=_.moments,B=_.frequencyMap,Y=_.categoricalDistance,G=_.isNumericColumn,j=_.jarqueBera,k=_.proportionInterval,g=_.SUBSET_RELIABILITY_FLOOR,d=U("packages/core/src/compute/compare.js").pooledStandardMeanDifference,l=U("packages/core/src/compute/special.js"),i=l.studentT,n=l.studentTQuantile,a=l.normalCdf,s=l.normalQuantile,t=l.chiSquareUpperTail,u=Object.freeze({WELCH:"welch",MANN_WHITNEY:"mannWhitney",CHI_SQUARE:"chiSquare"}),r=.05,o=2e6;function f(T){const I=Number(T);return Number.isFinite(I)&&I>0&&I<1?I:.95}function w(T){const{n:I,mean:P,m2:R}=X(T);return{mean:P,sd:I>0?Math.sqrt(R/I):0,n:I}}function m(T,I){const P=T.length;if(P<2)return 0;let R=0;for(let $=0;$<P;$++){const C=T[$]-I;R+=C*C}return R/(P-1)}function v(T,I){return{name:"pooledStandardMeanDifference",value:d(w(T),w(I))}}function h(T,I,P){const R=T.length,$=I.length;if(R<2||$<2)return null;const C=f(P),{mean:A}=X(T),{mean:S}=X(I),x=m(T,A),H=m(I,S),V=x/R+H/$;if(!(V>0))return null;const W=Math.sqrt(V),Q=(A-S)/W,ee=x/R*(x/R)/(R-1),re=H/$*(H/$)/($-1),ae=V*V/(ee+re),ue=Math.min(1,Math.max(0,2*(1-i(Math.abs(Q),ae)))),ge=A-S,Ae=n(1-(1-C)/2,ae)*W;return{test:u.WELCH,statistic:Q,statisticName:"t",df:ae,pValue:ue,interval:{estimate:ge,lower:ge-Ae,upper:ge+Ae,confidence:C,method:"welch-t (difference of means)"},effectSize:v(T,I),nA:R,nB:$,reliable:R>=g&&$>=g,method:"Welch's t-test (unequal variances; Welch–Satterthwaite df)"}}function p(T){const I=T.length;if(I===0)return Number.NaN;const P=I>>1;return I%2?T[P]:(T[P-1]+T[P])/2}function b(T,I,P){const R=T.length,$=I.length,C=R*$;if(C===0||C>o)return null;const A=new Float64Array(C);let S=0;for(let ee=0;ee<R;ee++)for(let re=0;re<$;re++)A[S++]=T[ee]-I[re];A.sort();const x=p(A),H=Math.sqrt(R*$*(R+$+1)/12),V=s(1-(1-P)/2);let W=Math.round(C/2-V*H);W>=0||(W=0);const Q=Math.floor((C-1)/2);return W>Q&&(W=Q),{estimate:x,lower:A[W],upper:A[C-1-W],confidence:P,method:"hodges-lehmann (normal approximation)"}}function O(T,I,P){const R=T.length,$=I.length;if(R<1||$<1)return null;const C=f(P),A=R+$,S=new Array(A);for(let ue=0;ue<R;ue++)S[ue]={v:T[ue],g:0};for(let ue=0;ue<$;ue++)S[R+ue]={v:I[ue],g:1};S.sort((ue,ge)=>ue.v-ge.v);let x=0,H=0,V=0;for(;V<A;){let ue=V;for(;ue<A&&S[ue].v===S[V].v;)ue++;const ge=ue-V,Ae=(V+1+ue)/2;for(let pe=V;pe<ue;pe++)S[pe].g===0&&(x+=Ae);H+=ge*ge*ge-ge,V=ue}const W=x-R*(R+1)/2,Q=R*$/2,ee=R*$/12*(A+1-H/(A*(A-1)));let re=1;if(ee>0){const ue=Math.max(0,Math.abs(W-Q)-.5);re=Math.min(1,2*a(-ue/Math.sqrt(ee)))}const ae=b(T,I,C);return{test:u.MANN_WHITNEY,statistic:W,statisticName:"U",df:null,pValue:re,interval:ae,effectSize:v(T,I),nA:R,nB:$,reliable:R>=g&&$>=g,method:"Mann-Whitney U (normal approximation, tie- and continuity-corrected)"}}function y(T,I,P,R,$){const C=k(T,I,$),A=k(P,R,$);if(!C||!A)return null;const S=C.proportion-A.proportion,x=S-Math.sqrt((C.proportion-C.lower)**2+(A.upper-A.proportion)**2),H=S+Math.sqrt((C.upper-C.proportion)**2+(A.proportion-A.lower)**2);return{lower:x,upper:H}}function L(T,I,P,R,$,C={}){if(!(I>0)||!(R>0))return null;const A=new Set([...T.keys(),...P.keys()]),S=A.size;if(S<2)return null;const x=I+R;let H=0;for(const re of A){const ae=T.get(re)||0,ue=P.get(re)||0,ge=ae+ue,Ae=I*ge/x,pe=R*ge/x;Ae>0&&(H+=(ae-Ae)*(ae-Ae)/Ae),pe>0&&(H+=(ue-pe)*(ue-pe)/pe)}const V=S-1,W=t(H,V);let Q=null;C.category!==void 0&&A.has(C.category)?Q=C.category:S===2&&([Q]=[...A]);let ee=null;if(Q!==null){const re=y(T.get(Q)||0,I,P.get(Q)||0,R,f($));re&&(ee={estimate:(T.get(Q)||0)/I-(P.get(Q)||0)/R,lower:re.lower,upper:re.upper,confidence:f($),method:"newcombe (difference in this category's share)",category:Q})}return{test:u.CHI_SQUARE,statistic:H,statisticName:"chiSquare",df:V,pValue:W,interval:ee,effectSize:{name:"categoricalTotalVariation",value:Y(T,I,P,R)},nA:I,nB:R,reliable:I>=g&&R>=g,method:"Pearson chi-square test of independence (2×k, no continuity correction)"}}function M(T){return T==null||T===""||typeof T=="number"&&Number.isNaN(T)?null:T instanceof Date?T.getTime():typeof T=="object"?String(T):T}function D(T,I,P){if(P===u.WELCH||P===u.MANN_WHITNEY)return{test:P,chosenBy:"override",reason:`caller override: ${P}`};const R=j(T),$=j(I),C=R===null?null:Math.exp(-R/2),A=$===null?null:Math.exp(-$/2);return C!==null&&C<r||A!==null&&A<r?{test:u.MANN_WHITNEY,chosenBy:"auto",reason:`column family: numeric, non-normal by Jarque-Bera (p < ${r})`}:{test:u.WELCH,chosenBy:"auto",reason:C!==null||A!==null?"column family: numeric, no departure from normality detected":"column family: numeric (too few rows to screen normality)"}}function F(T,I,P,R={}){if(!T||!I)return null;const $=f(R.confidence),C=z(I);let A;if(Array.isArray(R.groups)&&R.groups.length===2)A=[M(R.groups[0]),M(R.groups[1])];else{const{map:ue}=B(I,P),ge=[...ue.entries()].sort((Ae,pe)=>pe[1]-Ae[1]).slice(0,2).map(Ae=>Ae[0]);if(ge.length<2)return E("compareGroups:groups",'[lattice] compareGroups: the "by" column has fewer than two distinct values to group by.'),null;A=ge}const[S,x]=A;if(S===null||x===null||S===x)return E("compareGroups:distinct","[lattice] compareGroups: the two groups must be two distinct, present values."),null;const H=[],V=[];for(let ue=0;ue<P.length;ue++){const ge=M(C(P[ue]));ge===S?H.push(P[ue]):ge===x&&V.push(P[ue])}if(H.length===0||V.length===0)return E("compareGroups:empty","[lattice] compareGroups: one of the two groups has no rows in the current set."),null;const W=R.test&&R.test!=="auto"?String(R.test):null,Q=G(T,H.concat(V));let ee,re,ae;if(W===u.CHI_SQUARE||!W&&!Q){re=W?"override":"auto",ae=W?"caller override: chiSquare":"column family: categorical";const ue=B(T,H),ge=B(T,V);ee=L(ue.map,ue.total,ge.map,ge.total,$,{category:R.category})}else{if((W===u.WELCH||W===u.MANN_WHITNEY)&&!Q)return E("compareGroups:numeric-override",`[lattice] compareGroups: ${W} needs a numeric column, but the column is not numeric.`),null;const ue=Z(T,H),ge=Z(T,V),Ae=D(ue,ge,W);re=Ae.chosenBy,ae=Ae.reason,ee=Ae.test===u.MANN_WHITNEY?O(ue,ge,$):h(ue,ge,$)}return ee?{...ee,chosenBy:re,reason:ae,groups:[S,x]}:(E("compareGroups:degenerate","[lattice] compareGroups: the chosen test had too little to work with (too few values, or no variation)."),null)}}),Ue("packages/core/src/columns/detailcolumn.js",function(e,U){"use strict";Object.defineProperty(e,"DETAIL_COLUMN_ID",{enumerable:!0,get:function(){return te}}),Object.defineProperty(e,"createDetailColumn",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return z}});const te="__lattice_detail",E=36;function q(_){const Z=_.config&&_.config.detailColumnWidth||E;return{id:te,field:null,title:"",type:"text",dataType:{base:"text"},nullable:!0,align:"center",generated:!0,control:!0,detailExpander:!0,value:{pure:!0},cell:{render:"detailExpander",align:"center"},edit:{enabled:!1},sort:{enabled:!1,direction:null},filter:{enabled:!1},group:{enabled:!1,index:0,explode:!1},pivot:{enabled:!1,index:0},total:null,lookup:null,layout:{width:Z,min:Z,max:Z,pin:_.config&&_.config.detailColumnPin||"start",hidden:!1,resizable:!1,movable:!1,lockPosition:!0},header:{},export:{csv:!1,excel:!1},allowGroup:!1,allowPivot:!1,allowTotal:!1,def:{},getValue(X,B){return!!(B&&B.expanded)},formatValue(){return""}}}const z=q}),Ue("packages/core/src/columns/treecolumn.js",function(e,U){"use strict";Object.defineProperty(e,"TREE_COLUMN_ID",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"createTreeColumn",{enumerable:!0,get:function(){return _}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return Z}});const E=U("packages/core/src/internal/predicates.js").isFunction,q="__lattice_tree",z=260;function _(X){const B=X.tree||{},Y=X.config&&X.config.treeColumnWidth||z,G=()=>(X.columns&&E(X.columns.visible)?X.columns.visible():[]).find(c=>!c.generated)||null,j=(g,c)=>{if(c&&c.group)return c.groupValue;if(E(B.label))return B.label(g,c);if(typeof B.label=="string")return g==null?null:g[B.label];const d=G();return d&&E(d.getValue)?d.getValue(g,c):null},k=()=>{if(B.title)return B.title;const g=typeof B.label=="string"?X.columns&&E(X.columns.get)?X.columns.get(B.label):null:G();return g&&(g.title||g.id)||"Hierarchy"};return{id:q,get title(){return k()},field:null,type:"text",dataType:{base:"text"},nullable:!0,align:"start",generated:!0,value:{pure:!0},cell:{render:"group"},edit:{enabled:!1},sort:{enabled:!0,direction:null},filter:{enabled:!1},group:{enabled:!1,index:0,explode:!1},pivot:{enabled:!1,index:0},total:null,lookup:null,layout:{width:Y,min:140,pin:X.config&&X.config.treeColumnPin||null,hidden:!1,resizable:!0,movable:!1,lockPosition:!0},header:{},export:{csv:!1,excel:!1},allowGroup:!1,allowPivot:!1,allowTotal:!1,def:{},getValue(g,c){return j(g,c)},formatValue(g,c){if(c&&c.grandTotal)return X.config&&X.config.grandTotalLabel||"Total";if(g==null)return"";if(!B.label){const d=G();if(d&&E(d.formatValue))return d.formatValue(g,c)}return String(g)}}}const Z=_}),Ue("packages/core/src/columns/pivotcolumns.js",function(e,U){"use strict";Object.defineProperty(e,"PIVOT_PREFIX",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"createPivotColumns",{enumerable:!0,get:function(){return _}});const E=U("packages/core/src/internal/warn.js").warnOnce,q="__lattice_pivot",z=500;function _(Y){const{pivot:G,valueColumns:j,config:k}=Y,g=G&&G.paths||[],c=Y.separator||k&&k.pivot&&k.pivot.separator||" | ",d=k&&k.pivot&&k.pivot.maxColumns||z;if(!g.length||!j.length)return{tree:[],leaves:[],error:null};const l=Z(k),i=g.length*j.length+(l?j.length:0);if(i>d){const s=`pivot would generate ${i} columns, above the limit of ${d}. Pivot on a lower-cardinality column, or raise pivot.maxColumns.`;return E(`pivot.maxColumns:${i}`,s),{tree:[],leaves:[],error:s}}const n=[],a=[];for(const s of g){const t=[];for(const u of j){const r=B(s,u,c);t.push(r),a.push(r)}t.length===1?(t[0].title=String(s),n.push(t[0])):n.push({id:`${q}:group:${s}`,title:String(s),columns:t,collapsible:!1,openByDefault:!0,showWhen:"always",marryChildren:!0,generated:!0})}if(l){const s=j.map(u=>X(u,k));a.push(...s);const t=k&&k.pivot&&k.pivot.totalsLabel||"Total";if(s.length===1)s[0].title=t,l==="before"?n.unshift(s[0]):n.push(s[0]);else{const u={id:`${q}:group:__totals`,title:t,columns:s,collapsible:!1,openByDefault:!0,showWhen:"always",marryChildren:!0,generated:!0};l==="before"?n.unshift(u):n.push(u)}}return{tree:n,leaves:a,error:null}}function Z(Y){const G=Y&&Y.pivot&&Y.pivot.groupTotals;return G==="before"||G==="after"?G:null}function X(Y,G){return{id:`${q}:__total${G&&G.pivot&&G.pivot.separator||" | "}${Y.id}`,field:null,title:Y.title||Y.id,type:Y.type,dataType:Y.dataType,nullable:!0,align:Y.align,generated:!0,pivot:{enabled:!1,index:0,sourceId:Y.id,total:!0},value:{pure:!0},cell:{align:Y.align},edit:{enabled:!1},sort:{enabled:!1,direction:null},filter:{enabled:!1},group:{enabled:!1,index:0,explode:!1},total:Y.total,lookup:null,layout:{width:Y.layout&&Y.layout.width||120,min:80,pin:null,hidden:!1,resizable:!0,movable:!1},header:{},export:{csv:!0,excel:!0},allowGroup:!1,allowPivot:!1,allowTotal:!1,def:{},getValue(j,k){const g=k&&k.totals;return g&&Object.hasOwn(g,Y.id)?g[Y.id]:null},formatValue(j,k){return j==null?"":Y.formatValue?Y.formatValue(j,k):String(j)}}}function B(Y,G,j){return{id:`${q}:${Y}${j}${G.id}`,field:null,title:G.title||G.id,type:G.type,dataType:G.dataType,nullable:!0,align:G.align,generated:!0,pivot:{enabled:!1,index:0,path:Y,sourceId:G.id},value:{pure:!0},cell:{align:G.align},edit:{enabled:!1},sort:{enabled:!1,direction:null},filter:{enabled:!1},group:{enabled:!1,index:0,explode:!1},total:G.total,lookup:null,layout:{width:G.layout&&G.layout.width||120,min:80,pin:null,hidden:!1,resizable:!0,movable:!1},header:{},export:{csv:!0,excel:!0},allowGroup:!1,allowPivot:!1,allowTotal:!1,def:{},getValue(){return null},formatValue(k,g){return k==null?"":G.formatValue?G.formatValue(k,g):String(k)}}}}),Ue("packages/core/src/compute/group.js",function(e,U){"use strict";Object.defineProperty(e,"packKeys",{enumerable:!0,get:function(){return G}}),Object.defineProperty(e,"groupByColumns",{enumerable:!0,get:function(){return k}});const te=U("packages/core/src/compute/handle.js"),E=te.dictSize,q=te.identity,z=te.presenceReader,_=te.rowCount,Z=te.valueReader,X="",B="\0",Y=1<<20;function G(g,c,d,l){const i=g.length,n=g.map(o=>Z(o)),a=Array.isArray(l)&&l.some(Boolean),s=a?n.map((o,f)=>l[f]?w=>l[f](o(w)):o):n;if(!a&&i>0&&g.every(o=>o&&o.kind==="dictionary"&&o.dict)){const o=g.map(w=>E(w.dict)+1);let f=1;for(let w=0;w<i;w++)f*=o[w];if(f<=Number.MAX_SAFE_INTEGER){const w=g.map(p=>p.values),m=g.map(p=>z(p)),v=p=>{let b=0;for(let O=0;O<i;O++){const y=m[O],L=y&&y(p)===0?o[O]-1:w[O][p];b=b*o[O]+L}return b},h=new Float64Array(d);for(let p=0;p<d;p++)h[p]=v(c[p]);return{packed:h,strings:null,product:f,readers:s,keyOf:v}}}const u=o=>{let f="";for(let w=0;w<i;w++){const m=s[w](o);f+=(w===0?"":X)+(m==null?B:String(m))}return f},r=new Array(d);for(let o=0;o<d;o++)r[o]=u(c[o]);return{packed:null,strings:r,product:1/0,readers:s,keyOf:u}}function j(g,c,d,l){const i=new Uint32Array(l+1);for(let t=0;t<d;t++)i[c[t]+1]++;for(let t=0;t<l;t++)i[t+1]+=i[t];const n=new Uint32Array(d),a=i.slice(0,l);for(let t=0;t<d;t++)n[a[c[t]]++]=g[t];const s=new Array(l);for(let t=0;t<l;t++)s[t]=n.subarray(i[t],i[t+1]);return s}function k(g,c,d={}){const l=g||[],i=c||q(_(l[0],d)),n=i.length;if(l.length===0||n===0)return{keys:[],buckets:[]};const{packed:a,strings:s,product:t,readers:u}=G(l,i,n,d.project),r=new Uint32Array(n);let o=0,f=null;if(a&&t<=Math.max(1024,Math.min(Y,n*4))){const h=t,p=new Int32Array(h).fill(-1);for(let b=0;b<n;b++)p[a[b]]=0;for(let b=0;b<h;b++)p[b]===0&&(p[b]=o++);for(let b=0;b<n;b++)r[b]=p[a[b]];f=new Float64Array(o);for(let b=0;b<h;b++)p[b]>=0&&(f[p[b]]=b)}else if(a){const h=new Map;for(let p=0;p<n;p++){const b=a[p];let O=h.get(b);O===void 0&&(O=o++,h.set(b,O)),r[p]=O}f=new Float64Array(o);for(const[p,b]of h)f[b]=p}else{const h=new Map;for(let p=0;p<n;p++){const b=s[p];let O=h.get(b);O===void 0&&(O=o++,h.set(b,O)),r[p]=O}}const w=j(i,r,n,o),m=new Array(o);for(let h=0;h<o;h++){const p=w[h][0],b=new Array(u.length);for(let O=0;O<u.length;O++)b[O]=u[O](p);m[h]=b}const v={keys:m,buckets:w};return f&&(v.packed=f),v}}),Ue("packages/core/src/compute/pivot.js",function(e,U){"use strict";Object.defineProperty(e,"KEY_DELIMITER",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(e,"DEFAULT_PATH_SEPARATOR",{enumerable:!0,get:function(){return G}}),Object.defineProperty(e,"DEFAULT_MAX_COLUMNS",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"pivotKey",{enumerable:!0,get:function(){return k}}),Object.defineProperty(e,"joinPath",{enumerable:!0,get:function(){return g}}),Object.defineProperty(e,"resolvePivotKeys",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"pivot",{enumerable:!0,get:function(){return n}});const E=U("packages/core/src/internal/warn.js").warnOnce,z=U("packages/core/src/compute/handle.js").valueComparator,Z=U("packages/core/src/compute/group.js").packKeys,B=U("packages/core/src/compute/total.js").total,Y="|",G="/",j=2e3;function k(t,u,r){return`${t}${Y}${u}${Y}${r}`}function g(t,u){let r="";for(let o=0;o<t.length;o++){const f=t[o];r+=(o===0?"":u)+(f==null?"":String(f))}return r}function c(t,u,r={}){const o=r.separator||G,f=u.length,{keyOf:w,readers:m}=Z(t,u,0),v=new Map,h=[],p=[];for(let F=0;F<f;F++){const T=u[F],I=w(T);if(v.has(I))continue;v.set(I,h.length),p.push(I);const P=new Array(m.length);for(let R=0;R<m.length;R++)P[R]=m[R](T);h.push(P)}const b=z(r.locale),O=h.map((F,T)=>T);O.sort((F,T)=>{const I=h[F],P=h[T];for(let R=0;R<I.length;R++){const $=d(I[R],P[R],b);if($!==0)return $}return F-T});const y=new Array(O.length),L=new Array(O.length),M=new Map;for(let F=0;F<O.length;F++){const T=O[F];y[F]=h[T],L[F]=g(h[T],o),M.set(p[T],F)}return{keys:y,paths:L,idOf:F=>{const T=M.get(w(F));return T===void 0?-1:T}}}function d(t,u,r){const o=t==null,f=u==null;return o||f?o&&f?0:o?1:-1:r(t,u)}function l(t){const u=t.values||t.totals||[];if(u.length&&typeof u[0]=="object"&&u[0]!==null)return u.filter(w=>w&&w.handle);const r=typeof t.handle=="function"?t.handle:null;if(!r)return u.length&&E("pivot:handles","pivot was given total column ids but no handle(colId) resolver, so no cell values were reduced. Pass values: [{ colId, handle, fn }] or opts.handle."),[];const o=typeof t.totalOf=="function"?t.totalOf:null,f=[];for(const w of u){const m=r(w);m&&f.push({colId:w,handle:m,fn:o?o(w):"sum"})}return f}function i(t,u,r){if(Array.isArray(t)){const o=r||{};return{...o,pivotHandles:t,order:u||null,groups:o.groups||null}}return t||{}}function n(t,u,r){const o=i(t,u,r),f=o.separator||G,w=l(o),m=o.maxColumns===void 0?j:o.maxColumns,v=o.groups&&o.groups.buckets?o.groups:null,h=v?v.buckets:[o.order||new Uint32Array(0)],p=o.groupPaths||(v?v.keys.map(I=>g(I,f)):[""]),b=s(h),{keys:O,paths:y,idOf:L}=c(o.pivotHandles||[],b,o),M=y.length*Math.max(1,w.length),D=a(y,w,f);if(m&&M>m){const I=new Map;return{keys:O,paths:y,fields:D,groupPaths:p,columns:M,values:I,cells:I,error:{code:"pivot-max-columns",message:`[lattice] pivot would generate ${M} columns, above pivot.maxColumns of ${m}. Narrow the pivot columns or raise the limit.`,columns:M,maxColumns:m}}}const F=new Map,T=y.length;for(let I=0;I<h.length;I++){const P=h[I],R=p[I]===void 0?"":p[I],$=P.length;if($===0)continue;const C=new Int32Array($),A=new Uint32Array(T+1);for(let H=0;H<$;H++){const V=L(P[H]);C[H]=V,V>=0&&A[V+1]++}for(let H=0;H<T;H++)A[H+1]+=A[H];const S=new Uint32Array($),x=A.slice(0,T);for(let H=0;H<$;H++){const V=C[H];V>=0&&(S[x[V]++]=P[H])}for(let H=0;H<T;H++){const V=A[H],W=A[H+1];if(W===V)continue;const Q=S.subarray(V,W);for(let ee=0;ee<w.length;ee++){const re=w[ee],ae=B(re.handle,Q,re.fn,o.totalContext||{locale:o.locale});F.set(k(R,y[H],re.colId),ae)}}}return{keys:O,paths:y,fields:D,groupPaths:p,columns:M,values:F,cells:F,error:null}}function a(t,u,r){if(u.length===0)return t.slice();const o=[];for(const f of t)for(const w of u)o.push(`${f}${r}${w.colId}`);return o}function s(t){if(t.length===1)return t[0]||new Uint32Array(0);let u=0;for(const f of t)u+=f?f.length:0;const r=new Uint32Array(u);let o=0;for(const f of t)!f||f.length===0||(r.set(f,o),o+=f.length);return r}}),Ue("packages/core/src/store/bitset.js",function(e,U){"use strict";Object.defineProperty(e,"Bitset",{enumerable:!0,get:function(){return E}});const te=8;class E{static#e=new Uint8Array(256);static{for(let z=1;z<256;z++)E.#e[z]=E.#e[z>>1]+(z&1)}#t;#n;constructor(z=0){const _=Math.max(0,z|0);this.#n=_,this.#t=new Uint8Array(Math.ceil(_/te))}get size(){return this.#n}get words(){return this.#t}get bytes(){return this.#t?this.#t.byteLength:0}get(z){return z<0||z>=this.#n?0:this.#t[z>>3]>>(z&7)&1}set(z){return z>=0&&z<this.#n&&(this.#t[z>>3]|=1<<(z&7)),this}clear(z){return z>=0&&z<this.#n&&(this.#t[z>>3]&=~(1<<(z&7))),this}assign(z,_){return _?this.set(z):this.clear(z)}fill(z=!1){return this.#t.fill(z?255:0),z&&this.#r(),this}grow(z){const _=Math.max(0,z|0);if(_<=this.#n)return this;const Z=Math.ceil(_/te);if(Z>this.#t.length){const X=new Uint8Array(Z);X.set(this.#t),this.#t=X}return this.#n=_,this}count(){const z=this.#t,_=E.#e;let Z=0;for(let X=0;X<z.length;X++)Z+=_[z[X]];return Z}and(z){const _=z instanceof E?z.words:z,Z=this.#t,X=Math.min(Z.length,_.length);for(let B=0;B<X;B++)Z[B]&=_[B];for(let B=X;B<Z.length;B++)Z[B]=0;return this}or(z){const _=z instanceof E?z.words:z,Z=this.#t,X=Math.min(Z.length,_.length);for(let B=0;B<X;B++)Z[B]|=_[B];return this}not(){const z=this.#t;for(let _=0;_<z.length;_++)z[_]=~z[_]&255;return this.#r(),this}clone(){const z=new E(this.#n);return z.words.set(this.#t.subarray(0,z.words.length)),z}release(){this.#t=new Uint8Array(0),this.#n=0}#r(){const z=this.#n&7;if(z===0)return;const _=this.#n>>3;_<this.#t.length&&(this.#t[_]&=(1<<z)-1)}static from(z){const _=Array.isArray(z)?z:Array.from(z),Z=new E(_.length);for(let X=0;X<_.length;X++)_[X]&&Z.set(X);return Z}}}),Ue("packages/core/src/store/dictionary.js",function(e,U){"use strict";Object.defineProperty(e,"Dictionary",{enumerable:!0,get:function(){return z}});const te=U("packages/core/src/internal/compare.js"),E=te.collator,q=te.defaultCompare;class z{#e;#t=new Map;#n=0;#r=null;#s=-1;#i="\0";constructor(Z=[]){this.#e=[];for(let X=0;X<Z.length;X++){const B=Z[X];this.#t.has(B)||(this.#t.set(B,this.#e.length),this.#e.push(B))}}get size(){return this.#e.length}get version(){return this.#n}get bytes(){let Z=this.#e.length*8;for(let X=0;X<this.#e.length;X++){const B=this.#e[X];typeof B=="string"&&(Z+=B.length*2),Z+=16}return Z}codeOf(Z){const X=this.#t.get(Z);if(X!==void 0)return X;const B=this.#e.length;return this.#e.push(Z),this.#t.set(Z,B),this.#n++,B}lookup(Z){const X=this.#t.get(Z);return X===void 0?-1:X}has(Z){return this.#t.has(Z)}valueOf(Z){return this.#e[Z]}values(){return this.#e}ranks(Z){const X=Z||"";if(this.#r&&this.#s===this.#n&&this.#i===X)return this.#r;const B=this.#e.length,Y=new Array(B);for(let g=0;g<B;g++)Y[g]=g;const G=E(Z).compare,j=this.#e;Y.sort((g,c)=>this.#o(j[g],j[c],G));const k=new Uint32Array(B);for(let g=0;g<B;g++)k[Y[g]]=g;return this.#r=k,this.#s=this.#n,this.#i=X,k}#o(Z,X,B){return typeof Z=="string"&&typeof X=="string"?B(Z,X):q(Z,X)}}}),Ue("packages/core/src/store/multivalue.js",function(e,U){"use strict";Object.defineProperty(e,"MultiValue",{enumerable:!0,get:function(){return te}});class te{#e;#t;#n=0;#r=0;constructor(q={}){const z=Math.max(1,q.rows??16),_=Math.max(1,q.values??z);this.#e=new Int32Array(_),this.#t=new Uint32Array(z+1)}get values(){return this.#e}get offsets(){return this.#t}get rows(){return this.#n}get length(){return this.#r}get bytes(){return this.#e.byteLength+this.#t.byteLength}count(q){return q<0||q>=this.#n?0:this.#t[q+1]-this.#t[q]}at(q){return q<0||q>=this.#n?this.#e.subarray(0,0):this.#e.subarray(this.#t[q],this.#t[q+1])}has(q,z){if(q<0||q>=this.#n)return!1;const _=this.#e,Z=this.#t[q+1];for(let X=this.#t[q];X<Z;X++)if(_[X]===z)return!0;return!1}hasAny(q,z){for(let _=0;_<z.length;_++)if(this.has(q,z[_]))return!0;return!1}hasAll(q,z){for(let _=0;_<z.length;_++)if(!this.has(q,z[_]))return!1;return!0}hasNone(q,z){return!this.hasAny(q,z)}push(q){const z=this.#n,_=q.length;this.#s(z+1),this.#i(this.#r+_);const Z=this.#r;for(let X=0;X<_;X++)this.#e[Z+X]=q[X]|0;return this.#r+=_,this.#n=z+1,this.#t[z]=Z,this.#t[z+1]=this.#r,z}write(q,z){if(q===this.#n){this.push(z);return}if(q<0||q>this.#n)return;const _=this.#t[q],Z=this.#t[q+1],X=z.length;if(Z-_===X){for(let B=0;B<X;B++)this.#e[_+B]=z[B]|0;return}this.#o(q,z)}compact(q,z,_){const Z=this.#e,X=this.#t,B=this.#n,Y=new Int32Array(Math.max(1,this.#r)),G=new Uint32Array(z+1);let j=0;for(let k=0;k<B;k++){if(q[k]===_)continue;const g=X[k],c=X[k+1];G[q[k]]=j;for(let d=g;d<c;d++)Y[j++]=Z[d];G[q[k]+1]=j}this.#e=Y,this.#t=G,this.#n=z,this.#r=j}release(){this.#e=new Int32Array(0),this.#t=new Uint32Array(1),this.#n=0,this.#r=0}#s(q){if(q+1<=this.#t.length)return;let z=this.#t.length-1;for(;z<q;)z=z*2||16;const _=new Uint32Array(z+1);_.set(this.#t),this.#t=_}#i(q){if(q<=this.#e.length)return;let z=this.#e.length;for(;z<q;)z=z*2||16;const _=new Int32Array(z);_.set(this.#e),this.#e=_}#o(q,z){const _=this.#e,Z=this.#t,X=this.#n,B=z.length-(Z[q+1]-Z[q]),Y=new Int32Array(Math.max(1,this.#r+B)),G=new Uint32Array(Z.length);let j=0;for(let k=0;k<X;k++){if(G[k]=j,k===q)for(let g=0;g<z.length;g++)Y[j++]=z[g]|0;else for(let g=Z[k];g<Z[k+1];g++)Y[j++]=_[g];G[k+1]=j}this.#e=Y,this.#t=G,this.#r=j}}}),Ue("packages/core/src/compute/sort.js",function(e,U){"use strict";Object.defineProperty(e,"radixSortFloat64",{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,"radixSortInt32",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"rankSortDictionary",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"mergeSortComparator",{enumerable:!0,get:function(){return w}}),Object.defineProperty(e,"rankSortStrings",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"collateStringRanks",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"sortColumn",{enumerable:!0,get:function(){return F}}),Object.defineProperty(e,"sortMulti",{enumerable:!0,get:function(){return T}});const te=U("packages/core/src/compute/handle.js"),E=te.bitReader,q=te.dictRanks,z=te.dictSize,_=te.identity,Z=te.isMissing,X=te.presenceReader,B=te.rowCount,Y=te.valueComparator,G=te.valueReader,j=new Uint32Array(0),k=new ArrayBuffer(8),g=new Float64Array(k),c=new Uint32Array(k),d=(g[0]=-1,(c[1]&2147483648)!==0?1:0),l=d===1?0:1;function i(P,R){g[0]=P;let $=c[d],C=c[l];($&2147483648)!==0?($=~$>>>0,C=~C>>>0):$=($^2147483648)>>>0,R[0]=C,R[1]=$}function n(P,R,$,C){if(C<2)return P;const A=new Uint32Array(256*8);for(let re=0;re<C;re++){const ae=R[re],ue=$[re];A[ae&255]++,A[256+(ae>>>8&255)]++,A[512+(ae>>>16&255)]++,A[768+(ae>>>24&255)]++,A[1024+(ue&255)]++,A[1280+(ue>>>8&255)]++,A[1536+(ue>>>16&255)]++,A[1792+(ue>>>24&255)]++}let S=P,x=R,H=$,V=new Uint32Array(C),W=new Uint32Array(C),Q=new Uint32Array(C);const ee=new Uint32Array(256);for(let re=0;re<8;re++){const ae=re<<8,ue=(re&3)<<3,ge=re>=4;let Ae=!1;for(let Ne=0;Ne<256;Ne++)if(A[ae+Ne]===C){Ae=!0;break}if(Ae)continue;let pe=0;for(let Ne=0;Ne<256;Ne++)ee[Ne]=pe,pe+=A[ae+Ne];for(let Ne=0;Ne<C;Ne++){const Pe=x[Ne],ie=H[Ne],Oe=(ge?ie:Pe)>>>ue&255,je=ee[Oe]++;V[je]=S[Ne],W[je]=Pe,Q[je]=ie}let Me=S;S=V,V=Me,Me=x,x=W,W=Me,Me=H,H=Q,Q=Me}return S}function a(P,R,$){if($<2)return P;const C=new Uint32Array(256*4);for(let W=0;W<$;W++){const Q=R[W];C[Q&255]++,C[256+(Q>>>8&255)]++,C[512+(Q>>>16&255)]++,C[768+(Q>>>24&255)]++}let A=P,S=R,x=new Uint32Array($),H=new Uint32Array($);const V=new Uint32Array(256);for(let W=0;W<4;W++){const Q=W<<8,ee=W<<3;let re=!1;for(let ge=0;ge<256;ge++)if(C[Q+ge]===$){re=!0;break}if(re)continue;let ae=0;for(let ge=0;ge<256;ge++)V[ge]=ae,ae+=C[Q+ge];for(let ge=0;ge<$;ge++){const Ae=S[ge],pe=V[Ae>>>ee&255]++;x[pe]=A[ge],H[pe]=Ae}let ue=A;A=x,x=ue,ue=S,S=H,H=ue}return A}function s(P,R,$,C){const A=new Uint32Array(C+1);for(let H=0;H<$;H++)A[R[H]]++;let S=0;for(let H=0;H<=C;H++){const V=A[H];A[H]=S,S+=V}const x=new Uint32Array($);for(let H=0;H<$;H++)x[A[R[H]]++]=P[H];return x}function t(P,R,$,C){return $<2?P:C<=65536||C<=$*2?s(P,R,$,C):a(P,R,$)}function u(P,R){return P.length===R&&P.byteOffset===0?P:Uint32Array.prototype.slice.call(P,0,R)}function r(P,R,$=!1){const C=R||_(P.length),A=C.length;if(A<2)return Uint32Array.from(C);const S=new Uint32Array(A),x=new Uint32Array(A),H=new Uint32Array(A),V=new Uint32Array(A),W=new Uint32Array(2);let Q=0,ee=0;for(let ue=0;ue<A;ue++){const ge=C[ue],Ae=P[ge];if(Number.isNaN(Ae)){V[ee++]=ge;continue}i(Ae,W),$?(x[Q]=~W[0]>>>0,H[Q]=~W[1]>>>0):(x[Q]=W[0],H[Q]=W[1]),S[Q++]=ge}const re=n(S.subarray(0,Q),x.subarray(0,Q),H.subarray(0,Q),Q);if(ee===0)return u(re,Q);const ae=new Uint32Array(A);return ae.set(re.subarray(0,Q),0),ae.set(V.subarray(0,ee),Q),ae}function o(P,R,$=!1){const C=R||_(P.length),A=C.length;if(A<2)return Uint32Array.from(C);const S=Uint32Array.from(C),x=new Uint32Array(A);for(let H=0;H<A;H++){const V=(P[S[H]]^2147483648)>>>0;x[H]=$?~V>>>0:V}return u(a(S,x,A),A)}function f(P,R,$={}){const C=R||_(B(P,$)),A=C.length;if(A<2)return Uint32Array.from(C);const S=q(P.dict,$.locale),x=P.values,H=X(P),V=Math.max(z(P.dict),S.length),W=V,Q=Uint32Array.from(C),ee=new Uint32Array(A),re=!!$.descending;for(let ae=0;ae<A;ae++){const ue=Q[ae];let ge=H&&H(ue)===0?W:S[x[ue]];ge===void 0&&(ge=W),ee[ae]=re?W-ge:ge}return u(t(Q,ee,A,V+1),A)}function w(P,R,$){const C=R.length;let A=Uint32Array.from(R);if(C<2)return A;let S=new Uint32Array(C);for(let x=1;x<C;x<<=1){for(let V=0;V<C;V+=x<<1){const W=Math.min(V+x,C),Q=Math.min(V+(x<<1),C);let ee=V,re=W,ae=V;for(;ee<W&&re<Q;)S[ae++]=$(P[A[ee]],P[A[re]])<=0?A[ee++]:A[re++];for(;ee<W;)S[ae++]=A[ee++];for(;re<Q;)S[ae++]=A[re++]}const H=A;A=S,S=H}return A}function m(P,R,$){const C=E(P.values),A=R.length,S=new Uint32Array(A),x=$?1:0;let H=0;for(let V=0;V<A;V++)C(R[V])===x&&(S[H++]=R[V]);for(let V=0;V<A;V++)C(R[V])!==x&&(S[H++]=R[V]);return S}function v(P,R){const $=P.values,C=P.kind;if((C==="object"||C===void 0)&&(Array.isArray($)||ArrayBuffer.isView($))&&!P.presence)return $;const S=G(P),x=new Array(B(P)||0);for(let H=0;H<R.length;H++){const V=R[H];x[V]=S(V)}return x}function h(P,R){for(let $=0;$<R.length;$++)if(typeof P[R[$]]!="string")return!1;return!0}function p(P,R,$,C,A){const S=P.length,x=Uint32Array.from(P);if(S<2||C<1)return x;const H=new Uint32Array(S),V=C-1;for(let W=0;W<S;W++){const Q=$[R[W]];H[W]=A?V-Q:Q}return u(t(x,H,S,C),S)}function b(P,R,$){const C=Y($),A=new Array(R);for(let x=0;x<R;x++)A[x]=x;A.sort((x,H)=>C(P[x],P[H])||x-H);const S=new Uint32Array(R);for(let x=0;x<R;x++)S[A[x]]=x;return S}function O(P,R,$){const C=R.length,A=new Map,S=[],x=new Uint32Array(C);for(let W=0;W<C;W++){const Q=P[R[W]];let ee=A.get(Q);ee===void 0&&(ee=S.length,A.set(Q,ee),S.push(Q)),x[W]=ee}const H=S.length,V=b(S,H,$.locale);return p(R,x,V,H,!!$.descending)}function y(P,R,$){const C=v(P,R);if(R.length>=2&&h(C,R)){const x=P.stringRank;return x&&x.version===P.version&&x.usable(R,C,$.locale)?x.sort(R,$):O(C,R,$)}const A=Y($.locale),S=$.descending?(x,H)=>A(H,x):A;return w(C,R,S)}function L(P,R,$){const C=v(P,R),A=$.compare,x=!!$.descending?(H,V)=>-A(H,V,void 0,void 0,!0):(H,V)=>A(H,V,void 0,void 0,!1);return w(C,R,x)}function M(P,R){const $=R.length,C=X(P),A=P.values,S=P.kind==="float64"&&!!A,x=P.kind==="object"||P.kind==="multi"||P.kind===void 0;if(!C&&!S&&!x)return{present:R,absent:j};const H=new Uint32Array($),V=new Uint32Array($);let W=0,Q=0;if(C&&S)for(let ee=0;ee<$;ee++){const re=R[ee];C(re)===1&&!Number.isNaN(A[re])?H[W++]=re:V[Q++]=re}else if(S&&!C)for(let ee=0;ee<$;ee++){const re=R[ee];Number.isNaN(A[re])?V[Q++]=re:H[W++]=re}else if(C&&!x)for(let ee=0;ee<$;ee++){const re=R[ee];C(re)===1?H[W++]=re:V[Q++]=re}else{const ee=G(P);for(let re=0;re<$;re++){const ae=R[re];Z(ee(ae))?V[Q++]=ae:H[W++]=ae}}return Q===0?{present:R,absent:j}:{present:H.subarray(0,W),absent:V.subarray(0,Q)}}function D(P,R,$){if(R.length===0)return P;const C=new Uint32Array(P.length+R.length);return $?(C.set(R,0),C.set(P,R.length)):(C.set(P,0),C.set(R,P.length)),C}function F(P,R,$={}){const C=R||_(B(P,$));if(!P||C.length<2)return Uint32Array.from(C);const{present:A,absent:S}=M(P,C);if(A.length===0)return Uint32Array.from(C);const x=!!$.descending;let H;if(typeof $.compare=="function")H=L(P,A,$);else switch(P.kind){case"float64":H=r(P.values,A,x);break;case"int32":H=o(P.values,A,x);break;case"dictionary":H=f(P,A,$);break;case"bitset":H=m(P,A,x);break;default:H=y(P,A,$);break}return D(H,S,!!$.nullsFirst)}function T(P,R,$,C={}){const A=R||[],S=A.length&&(A[0].handle||I(P,A[0].col))||P&&P[0];let x=$||_(B(S,C));for(let H=A.length-1;H>=0;H--){const V=A[H],W=V.handle||I(P,V.col)||P&&P[H];W&&(x=F(W,x,{descending:V.descending!==void 0?!!V.descending:V.dir==="desc",nullsFirst:!!V.nullsFirst,locale:V.locale!==void 0?V.locale:C.locale,compare:V.compare}))}return x instanceof Uint32Array?x:Uint32Array.from(x)}function I(P,R){if(!(!P||R===void 0)){for(let $=0;$<P.length;$++)if(P[$]&&P[$].id===R)return P[$]}}}),Ue("packages/core/src/store/stringrank.js",function(e,U){"use strict";Object.defineProperty(e,"DEFAULT_MAX_DISTINCT",{enumerable:!0,get:function(){return z}}),Object.defineProperty(e,"StringRankIndex",{enumerable:!0,get:function(){return _}});const te=U("packages/core/src/compute/sort.js"),E=te.collateStringRanks,q=te.rankSortStrings,z=1e5;class _{#e=[];#t=new Map;#n;#r=0;#s=0;#i=-1;#o;#l=!1;#a=null;#c=-1;#u="\0";constructor(X=z){this.#o=X>0?X:z,this.#n=new Uint32Array(0)}get version(){return this.#i}set version(X){this.#i=X}get generation(){return this.#s}get size(){return this.#e.length}get capped(){return this.#l}get length(){return this.#r}get bytes(){let X=this.#n.byteLength;const B=this.#e;for(let Y=0;Y<B.length;Y++)X+=B[Y].length*2+24;return X}#f(X,B){const Y=this.#t.get(X);if(Y!==void 0)return Y;if(this.#l)return-1;if(B&&this.#e.length>=this.#o)return this.#l=!0,-1;const G=this.#e.length;return this.#e.push(X),this.#t.set(X,G),this.#s++,G}build(X,B){const Y=B|0;this.#e=[],this.#t=new Map,this.#s=0,this.#l=!1,this.#a=null,this.#c=-1,this.#n=new Uint32Array(Y);for(let G=0;G<Y;G++){const j=X[G],k=typeof j=="string"?this.#f(j,!1):-1;this.#n[G]=k<0?0:k}this.#r=Y}append(X,B,Y){const G=(B|0)+(Y|0);if(G>this.#n.length){const j=new Uint32Array(G);j.set(this.#n.subarray(0,this.#r)),this.#n=j}for(let j=B|0;j<G;j++){const k=X[j],g=typeof k=="string"?this.#f(k,!0):-1;this.#n[j]=g<0?0:g}this.#r=Math.max(this.#r,G)}ranks(X){const B=X||"";if(this.#a&&this.#c===this.#s&&this.#u===B)return this.#a;const Y=E(this.#e,this.#e.length,X);return this.#a=Y,this.#c=this.#s,this.#u=B,Y}usable(X,B,Y){if(this.#l||this.#e.length===0)return!1;const G=this.#n,j=this.#e,k=this.#r;for(let g=0;g<X.length;g++){const c=X[g];if(c>=k||j[G[c]]!==B[c])return!1}return!0}sort(X,B){const Y=this.ranks(B.locale),G=this.#e.length,j=X.length,k=new Uint32Array(j),g=this.#n;for(let c=0;c<j;c++)k[c]=g[X[c]];return q(X,k,Y,G,!!B.descending)}}}),Ue("packages/core/src/store/columnstore.js",function(e,U){"use strict";Object.defineProperty(e,"REMOVED",{enumerable:!0,get:function(){return d}}),Object.defineProperty(e,"toFloat",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"ColumnHandle",{enumerable:!0,get:function(){return w}}),Object.defineProperty(e,"ColumnStore",{enumerable:!0,get:function(){return m}});const E=U("packages/core/src/internal/warn.js").warnOnce,z=U("packages/core/src/internal/predicates.js").isFunction,Z=U("packages/core/src/internal/paths.js").pathGetter,B=U("packages/core/src/store/bitset.js").Bitset,G=U("packages/core/src/store/dictionary.js").Dictionary,k=U("packages/core/src/store/multivalue.js").MultiValue,c=U("packages/core/src/store/stringrank.js").StringRankIndex,d=4294967295,l=1024,i=5e3,n=.2,a=new Set(["float64","int32","bitset","dictionary","object","multi"]);function s(v){return v==null}function t(v){if(typeof v=="number")return v;if(v instanceof Date)return v.getTime();if(typeof v=="boolean")return v?1:0;const h=Number(v);return Number.isNaN(h)&&typeof v=="string"?Date.parse(v):h}function u(v){const h=t(v);return Number.isFinite(h)?h|0:0}function r(v){return s(v)?[]:Array.isArray(v)?v:[v]}function o(v,h){switch(v.kind){case"float64":case"int32":return v.buf[h];case"bitset":return v.bits.get(h)===1;case"dictionary":return v.dict.valueOf(v.buf[h]);case"multi":{const p=v.mv.at(h),b=new Array(p.length);for(let O=0;O<p.length;O++)b[O]=v.dict.valueOf(p[O]);return b}default:return v.buf[h]}}function f(v,h){switch(v.kind){case"float64":case"int32":return v.values[h];case"bitset":return(v.values[h>>3]&1<<(h&7))!==0;case"dictionary":return(v.table||[])[v.values[h]];case"multi":{const p=v.offsets[h],b=v.offsets[h+1],O=v.table||[],y=new Array(b-p);for(let L=p;L<b;L++)y[L-p]=O[v.values[L]];return y}default:return v.values[h]}}class w{#e;#t;#n;#r;#s;#i;#o;#l=!1;#a=null;#c=null;#u=null;#f=null;#d=null;#h;#p;#m=-1;#g=null;#b=0;#y=0;#A=null;#w=null;#O=!1;constructor(h,p){this.#e=h.id;const b=a.has(h.kind)?h.kind:"object";h.kind&&!a.has(h.kind)&&E(`store.kind.${h.id}`,`column "${h.id}" declares unknown storage kind "${h.kind}"; falling back to object`),this.#n=b,this.#t=b,this.#r=h.nullable!==!1,this.#o=h.dictionary??null,this.#i=p,this.#s=z(h.read)?h.read:Z(h.field||h.id),this.#h=h.stringRankIndex!=="off",this.#p=typeof h.stringRankMaxDistinct=="number"?h.stringRankMaxDistinct:0,this.#A=new Map}get id(){return this.#e}get kind(){return this.#l?this.#t:"object"}get target(){return this.#n}get nullable(){return this.#r}get values(){return this.#O?null:this.#l?this.#t==="bitset"?this.#c.words:this.#t==="multi"?this.#u.values:this.#a:this.#P().values}get presence(){return this.#O||!this.#r?null:this.#l?this.#g:this.#P().presence}get dict(){return this.#O||!this.#l?null:this.#t==="dictionary"||this.#t==="multi"?this.#f:null}get stringRank(){if(this.#O||!this.#h||this.kind!=="object")return null;const h=this.values,p=this.#i.physical();if(!h||p===0)return null;if(this.#d===null){if(typeof h[0]!="string")return null;const b=new c(this.#v());return b.build(h,p),b.version=this.#y,this.#d=b,this.#m=this.#y,b.capped?null:b}return this.#d.length<p&&this.#d.append(h,this.#d.length,p-this.#d.length),this.#d.version=this.#y,this.#m=this.#y,this.#d.capped?null:this.#d}#v(){return this.#p}#T(){this.#d=null,this.#m=-1}get offsets(){return this.#O||!this.#l||this.#t!=="multi"?null:this.#u.offsets}get version(){return this.#y}get bytes(){let h=0;return this.#a&&(h+=this.#a.byteLength??this.#a.length*8),this.#c&&(h+=this.#c.bytes),this.#u&&(h+=this.#u.bytes),this.#g&&(h+=this.#g.bytes),this.#f&&(h+=this.#f.bytes),this.#A&&(h+=this.#A.size*24),h}get(h){if(!this.#O&&!(h<0||h>=this.#i.physical())){if(!this.#l)return this.#M(h);if(this.#r&&this.#g.get(h)===0)return null;switch(this.#t){case"float64":case"int32":return this.#a[h];case"bitset":return this.#c.get(h)===1;case"dictionary":return this.#f.valueOf(this.#a[h]);case"multi":{const p=this.#u.at(h),b=new Array(p.length);for(let O=0;O<p.length;O++)b[O]=this.#f.valueOf(p[O]);return b}default:return this.#a[h]}}}set(h,p){this.#O||(this.#l?this.#E(h,p):this.#A.set(h,p===void 0?null:p),this.#d&&this.#T(),this.#y++)}read(h){return this.#s(h)}appendColumn(h,p,b){if(this.#O||b<=0)return;if(!this.#l){this.#y++;return}const O=this.#s,y=this.#r,L=this.#g;let M=!1;switch(this.#t){case"float64":{const D=this.#a;for(let F=0;F<b;F++){const T=O(h[F]);if(typeof T=="number"){y&&L.set(p+F),D[p+F]=T;continue}const I=T==null;y?L.assign(p+F,!I):I&&(M=!0),D[p+F]=I?NaN:t(T)}break}case"int32":{const D=this.#a;for(let F=0;F<b;F++){const T=O(h[F]),I=T==null;y?L.assign(p+F,!I):I&&(M=!0),D[p+F]=I?0:u(T)}break}case"bitset":{const D=this.#c;for(let F=0;F<b;F++){const T=O(h[F]),I=T==null;y?L.assign(p+F,!I):I&&(M=!0),D.assign(p+F,!I&&!!T)}break}case"dictionary":{const D=this.#a,F=this.#f;for(let T=0;T<b;T++){const I=O(h[T]),P=I==null;y?L.assign(p+T,!P):P&&(M=!0),D[p+T]=P?0:F.codeOf(I)}break}case"multi":{const D=this.#u,F=this.#f;for(let T=0;T<b;T++){const I=O(h[T]),P=I==null;y?L.assign(p+T,!P):P&&(M=!0);const R=r(I),$=new Array(R.length);for(let C=0;C<R.length;C++)$[C]=F.codeOf(R[C]);D.write(p+T,$)}break}default:{const D=this.#a;for(let F=0;F<b;F++){const T=O(h[F]),I=T==null;y?L.assign(p+F,!I):I&&(M=!0),D[p+F]=I?null:T}break}}M&&E(`store.null.${this.#e}`,`column "${this.#e}" is declared non-nullable but received null; storing a filler value`),this.#d&&this.#t==="object"&&(this.#d.append(this.#a,p,b),this.#d.version=this.#y+1,this.#m=this.#y+1),this.#y++}appendPacked(h,p,b){if(this.#O||b<=0||!h)return;if(!this.#l){this.#y++;return}const O=this.#g,y=h.presence;if(O)if(y)for(let M=0;M<b;M++)O.assign(p+M,(y[M>>3]&1<<(M&7))!==0);else for(let M=0;M<b;M++)O.set(p+M);const L=h.kind===this.#t;if(L&&(this.#t==="float64"||this.#t==="int32")){this.#a.set(h.values,p),this.#y++;return}if(L&&this.#t==="bitset"){const M=h.values;for(let D=0;D<b;D++)this.#c.assign(p+D,(M[D>>3]&1<<(D&7))!==0);this.#y++;return}if(L&&this.#t==="dictionary"){const M=h.table||[],D=new Uint32Array(M.length);for(let P=0;P<M.length;P++)D[P]=this.#f.codeOf(M[P]);const F=h.values,T=this.#a,I=O;for(let P=0;P<b;P++){if(I&&(y&&(y[P>>3]&1<<(P&7))===0)){T[p+P]=0;continue}T[p+P]=D[F[P]]??0}this.#y++;return}if(L&&this.#t==="multi"){const M=h.table||[],D=new Uint32Array(M.length);for(let I=0;I<M.length;I++)D[I]=this.#f.codeOf(M[I]);const F=h.values,T=h.offsets;for(let I=0;I<b;I++){const P=T[I],R=T[I+1],$=new Array(R-P);for(let C=P;C<R;C++)$[C-P]=D[F[C]]??0;this.#u.write(p+I,$)}this.#y++;return}for(let M=0;M<b;M++){const D=y?(y[M>>3]&1<<(M&7))===0:h.kind==="object"?h.values[M]===null:!1;this.#E(p+M,D?null:f(h,M))}this.#y++}touch(){this.#y++}columnarise(h,p){if(this.#l||this.#O)return;const b=new Array(p);for(let O=0;O<p;O++)b[O]=this.#M(O);this.#t=this.#n,this.#l=!0,this.#S(h);for(let O=0;O<p;O++)this.#E(O,b[O]);this.#A.clear(),this.#w=null,this.#T(),this.#y++}grow(h){if(!(!this.#l||this.#O||h<=this.#b)){switch(this.#t){case"float64":case"int32":case"dictionary":{const p=new this.#a.constructor(h);p.set(this.#a),this.#a=p;break}case"bitset":this.#c.grow(h);break;case"multi":break;default:this.#a.length=h;break}this.#g&&this.#g.grow(h),this.#b=h,this.#y++}}convert(h){if(this.#O||!a.has(h)||(this.#n=h,!this.#l||h===this.#t))return!1;const p={kind:this.#t,buf:this.#a,bits:this.#c,mv:this.#u,dict:this.#f},b=this.#i.physical(),O=this.#g;this.#t=h,this.#S(this.#b);for(let y=0;y<b;y++){const L=O!==null&&O.get(y)===0;L&&h!=="multi"||this.#E(y,L?null:o(p,y))}return this.#T(),this.#y++,!0}compact(h,p,b){if(!this.#O){if(this.#T(),!this.#l){const O=this.#A;if(O.size){const y=new Map;for(const[L,M]of O)h[L]!==d&&y.set(h[L],M);this.#A=y}this.#w=null,this.#y++;return}switch(this.#t){case"float64":case"int32":case"dictionary":case"object":{const O=this.#a;for(let y=0;y<p;y++)h[y]!==d&&(O[h[y]]=O[y]);if(this.#t==="object")for(let y=b;y<p;y++)O[y]=void 0;break}case"bitset":{const O=this.#c;for(let y=0;y<p;y++)h[y]!==d&&O.assign(h[y],O.get(y)===1);for(let y=b;y<p;y++)O.clear(y);break}case"multi":this.#u.compact(h,b,d);break;default:break}if(this.#g){const O=this.#g;for(let y=0;y<p;y++)h[y]!==d&&O.assign(h[y],O.get(y)===1);for(let y=b;y<p;y++)O.clear(y)}this.#y++}}release(){this.#O||(this.#O=!0,this.#a=null,this.#c&&this.#c.release(),this.#c=null,this.#u&&this.#u.release(),this.#u=null,this.#g&&this.#g.release(),this.#g=null,this.#f=null,this.#d=null,this.#A=new Map,this.#w=null,this.#b=0,this.#y++)}#S(h){const p=Math.max(1,h);switch(this.#a=null,this.#c=null,this.#u=null,this.#t){case"float64":this.#a=new Float64Array(p);break;case"int32":this.#a=new Int32Array(p);break;case"bitset":this.#c=new B(p);break;case"dictionary":this.#a=new Uint32Array(p),this.#f=this.#f??new G(this.#o??[]);break;case"multi":this.#u=new k({rows:p,values:p}),this.#f=this.#f??new G(this.#o??[]);break;default:this.#a=new Array(p);break}this.#t!=="dictionary"&&this.#t!=="multi"&&(this.#f=null),this.#r&&(this.#g?this.#g.grow(p):this.#g=new B(p)),this.#b=p}#E(h,p){const b=s(p);switch(this.#r?this.#g.assign(h,!b):b&&E(`store.null.${this.#e}`,`column "${this.#e}" is declared non-nullable but received null; storing a filler value`),this.#t){case"float64":this.#a[h]=b?NaN:t(p);break;case"int32":this.#a[h]=b?0:u(p);break;case"bitset":this.#c.assign(h,!b&&!!p);break;case"dictionary":this.#a[h]=b?0:this.#f.codeOf(p);break;case"multi":{const O=r(p),y=new Array(O.length);for(let L=0;L<O.length;L++)y[L]=this.#f.codeOf(O[L]);this.#u.write(h,y);break}default:this.#a[h]=b?null:p;break}}#M(h){if(this.#A.has(h))return this.#A.get(h);const p=this.#s(this.#i.rowAt(h));return p===void 0?null:p}#P(){if(this.#w&&this.#w.version===this.#y)return this.#w;const h=this.#i.physical(),p=new Array(h),b=this.#r?new B(h):null;for(let O=0;O<h;O++){const y=this.#M(O);p[O]=y,b&&!s(y)&&b.set(O)}return this.#w={version:this.#y,values:p,presence:b},this.#w}}class m{#e;#t=new Map;#n=[];#r=[];#s=0;#i=0;#o=0;#l=0;#a=new B(0);#c=!1;#u=!0;#f;#d;#h;#p=!1;constructor(h,p={}){this.#e=Array.isArray(h)?h:[],this.#d=Math.max(1,p.initialCapacity??l),this.#u=p.retainSource!==!1,this.#f=this.#u?p.columnarBelow??i:0,this.#h=p.compactRatio??n;const b={rowAt:O=>this.#r[O],physical:()=>this.#s};for(const O of this.#e){if(!O||!O.id)continue;if(this.#t.has(O.id)){E(`store.dup.${O.id}`,`duplicate column id "${O.id}" in the store schema; ignoring the second`);continue}const y=new w(O,b);this.#t.set(O.id,y),this.#n.push(y)}this.#f<=0&&this.#b()}get count(){return this.#o}get physical(){return this.#s}get capacity(){return this.#c?this.#i:this.#r.length}get tombstones(){return this.#l}get columnar(){return this.#c}get destroyed(){return this.#p}get bytes(){let h=this.#a.bytes+this.#r.length*8;for(const p of this.#n)h+=p.bytes;return h}append(h){const p=this.#s;if(this.#p||!h)return{from:p,to:p};const b=h.length|0;if(b===0)return{from:p,to:p};if(this.#u)for(let y=0;y<b;y++)this.#r[p+y]=h[y];if(this.#s=p+b,this.#o+=b,this.#a.grow(this.#s),!this.#c){if(this.#s>=this.#f)this.#b();else for(const y of this.#n)y.touch();return{from:p,to:this.#s}}this.#m(this.#s);const O=this.#n;for(let y=0;y<O.length;y++)O[y].appendColumn(h,p,b);return{from:p,to:this.#s}}appendPacked(h,p){const b=this.#s;if(this.#p||!h)return{from:b,to:b};const O=h.count|0;if(O===0)return{from:b,to:b};if(this.#u&&p)for(let L=0;L<O;L++)this.#r[b+L]=p[L];this.#s=b+O,this.#o+=O,this.#a.grow(this.#s),this.#c||this.#b(),this.#m(this.#s);const y=new Map;for(const L of h.columns)y.set(L.id,L);for(const L of this.#n){const M=y.get(L.id);M?L.appendPacked(M,b,O):L.grow(this.#i)}return{from:b,to:this.#s}}source(h){if(this.#u)return this.#r[h];if(!(h<0||h>=this.#s))return this.#g(h)}setSource(h,p){this.#p||h<0||h>=this.#s||this.#u&&(this.#r[h]=p)}get(h,p){const b=this.#t.get(h);return b?b.get(p):void 0}set(h,p,b){if(this.#p||p<0||p>=this.#s)return;const O=this.#t.get(h);if(!O){E(`store.set.${h}`,`set() on unknown column "${h}"`);return}O.set(p,b)}remove(h){return this.#p||h<0||h>=this.#s||this.#a.get(h)===1?!1:(this.#a.set(h),this.#l++,this.#o--,!0)}live(h){return h<0||h>=this.#s?!1:this.#a.get(h)===0}compact(h={}){if(this.#p||this.#l===0||!h.force&&this.#l/this.#s<this.#h)return null;const p=this.#s,b=new Uint32Array(p);let O=0;for(let y=0;y<p;y++)b[y]=this.#a.get(y)===1?d:O++;for(const y of this.#n)y.compact(b,p,O);if(this.#u){const y=this.#r;for(let L=0;L<p;L++)b[L]!==d&&(y[b[L]]=y[L]);y.length=O}return this.#s=O,this.#o=O,this.#l=0,this.#a=new B(Math.max(this.#i,O)),b}column(h){return this.#t.get(h)}columns(){return this.#n.slice()}liveIndices(){const h=new Uint32Array(this.#o);if(this.#l===0){for(let b=0;b<this.#s;b++)h[b]=b;return h}let p=0;for(let b=0;b<this.#s;b++)this.#a.get(b)===0&&(h[p++]=b);return h}convert(h,p){const b=this.#t.get(h);return b?b.convert(p):!1}destroy(){if(!this.#p){this.#p=!0;for(const h of this.#n)h.release();this.#t.clear(),this.#n.length=0,this.#r.length=0,this.#a.release(),this.#s=0,this.#o=0,this.#l=0,this.#i=0}}#m(h){if(h<=this.#i)return;let p=this.#i||this.#d;for(;p<h;)p*=2;for(const b of this.#n)b.grow(p);this.#a.grow(p),this.#i=p}#g(h){const p={};for(const b of this.#n)p[b.id]=b.get(h);return p}#b(){if(this.#c)return;let h=this.#d;for(;h<this.#s;)h*=2;this.#c=!0,this.#i=h,this.#a.grow(h);for(const p of this.#n)p.columnarise(h,this.#s)}}}),Ue("packages/core/src/store/pool.js",function(e,U){"use strict";Object.defineProperty(e,"MaskPool",{enumerable:!0,get:function(){return z}}),Object.defineProperty(e,"sharedPool",{enumerable:!0,get:function(){return _}});const te=64,E=8;function q(X){let B=te;for(;B<X;)B*=2;return B}class z{#e=new Map;#t=new WeakSet;#n;#r=0;#s={acquired:0,reused:0,released:0};constructor(B={}){this.#n=B.limit??E}get bytes(){return this.#r}mask(B){const Y=new Uint8Array(this.#i(B),0,B);return Y.fill(0),Y}indices(B){return new Uint32Array(this.#i(B*4),0,B)}release(B){if(!B||!B.buffer)return!1;const Y=B.buffer;if(!this.#t.has(Y))return!1;this.#t.delete(Y),this.#s.released++;const G=Y.byteLength;let j=this.#e.get(G);return j||this.#e.set(G,j=[]),j.length>=this.#n||(j.push(Y),this.#r+=G),!0}releaseAll(B){for(const Y of B)this.release(Y)}clear(){this.#e.clear(),this.#r=0}stats(){return{...this.#s,retained:this.#r}}#i(B){const Y=q(B),G=this.#e.get(Y);this.#s.acquired++;let j;return G&&G.length?(j=G.pop(),this.#r-=Y,this.#s.reused++):j=new ArrayBuffer(Y),this.#t.add(j),j}}function _(){return Z??=new z,Z}let Z=null}),Ue("packages/core/src/compute/sortspec.js",function(e,U){"use strict";Object.defineProperty(e,"collationDescriptor",{enumerable:!0,get:function(){return te}}),Object.defineProperty(e,"isPortableSort",{enumerable:!0,get:function(){return E}}),Object.defineProperty(e,"isPortableSortSet",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"describeSortEntry",{enumerable:!0,get:function(){return z}}),Object.defineProperty(e,"describeSort",{enumerable:!0,get:function(){return _}});function te(Z){return{locale:Z===void 0?void 0:String(Z),numeric:!0,sensitivity:"variant"}}function E(Z){return!!Z&&typeof Z.compare!="function"}function q(Z){if(!Z)return!0;for(let X=0;X<Z.length;X++)if(!E(Z[X]))return!1;return!0}function z(Z,X){const B=Z.col!==void 0?Z.col:Z.handle&&Z.handle.id,Y=Z.locale!==void 0?Z.locale:X;return{col:B,descending:Z.descending!==void 0?!!Z.descending:Z.dir==="desc",nullsFirst:!!Z.nullsFirst,collation:te(Y)}}function _(Z,X){const B=Z||[],Y=new Array(B.length);for(let G=0;G<B.length;G++)Y[G]=z(B[G],X);return Y}}),Ue("packages/core/src/compute/facet.js",function(e,U){"use strict";Object.defineProperty(e,"STRATEGIES",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"GRANULARITIES",{enumerable:!0,get:function(){return X}}),Object.defineProperty(e,"DEFAULT_BUCKETS",{enumerable:!0,get:function(){return B}}),Object.defineProperty(e,"DEFAULT_CARDINALITY_LIMIT",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(e,"QUANTILE_SAMPLE",{enumerable:!0,get:function(){return G}}),Object.defineProperty(e,"facetKind",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"orderedReader",{enumerable:!0,get:function(){return k}}),Object.defineProperty(e,"toNumeric",{enumerable:!0,get:function(){return g}}),Object.defineProperty(e,"cardinalityOf",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"pickGranularity",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"floorTo",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"advance",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"computeBounds",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"countInto",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"bucketOf",{enumerable:!0,get:function(){return v}}),Object.defineProperty(e,"facet",{enumerable:!0,get:function(){return h}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return p}});const te=U("packages/core/src/compute/handle.js"),E=te.presenceReader,q=te.valueReader,z=te.dictSize,_=te.dictValue,Z=Object.freeze(["equal","quantile","log"]),X=Object.freeze(["hour","day","week","month","quarter","year"]),B=20,Y=50,G=1e4;function j(b,O){if(!b)return"none";const y=O;if(y&&(y.multi===!0||typeof y.items=="function"))return"category";const L=O&&O.base;if(L==="date"||L==="datetime"||L==="time"||L==="dateString")return"date";switch(b.kind){case"bitset":return"boolean";case"float64":case"int32":return"numeric";case"dictionary":return"category";case"multi":return"category";default:return L==="number"?"numeric":L==="boolean"?"boolean":L==="text"?"category":"none"}}function k(b){const O=b.values,y=b.kind;if((y==="float64"||y==="int32")&&O)return M=>O[M];const L=q(b);return M=>g(L(M))}function g(b){if(typeof b=="number")return b;if(b instanceof Date)return b.getTime();if(b==null||b==="")return NaN;if(typeof b=="boolean")return b?1:0;if(typeof b=="string"){const O=Number(b);if(Number.isFinite(O))return O;const y=Date.parse(b);return Number.isFinite(y)?y:NaN}return NaN}function c(b,O,y,L=Y){if(!b)return{cardinality:0,exact:!0};if(b.dict)return{cardinality:z(b.dict),exact:!0};if(b.kind==="bitset")return{cardinality:2,exact:!0};const M=q(b),D=O?O.length:y,F=new Set;for(let T=0;T<D;T++){const I=M(O?O[T]:T);if(I!=null&&(F.add(I),F.size>L))return{cardinality:F.size,exact:!1}}return{cardinality:F.size,exact:!0}}const d=36e5,l=864e5;function i(b,O=B){const y=Number.isFinite(b)&&b>0?b:0,L=Math.max(1,O)*2;return y/d<=L?"hour":y/l<=L?"day":y/(7*l)<=L?"week":y/(30*l)<=L?"month":y/(91*l)<=L?"quarter":"year"}function n(b,O){if(!Number.isFinite(b))return NaN;const y=new Date(b);switch(O){case"hour":return y.setMinutes(0,0,0),y.getTime();case"day":return y.setHours(0,0,0,0),y.getTime();case"week":{y.setHours(0,0,0,0);const L=(y.getDay()+6)%7;return y.setDate(y.getDate()-L),y.getTime()}case"month":return y.setDate(1),y.setHours(0,0,0,0),y.getTime();case"quarter":return y.setMonth(Math.floor(y.getMonth()/3)*3,1),y.setHours(0,0,0,0),y.getTime();default:return y.setMonth(0,1),y.setHours(0,0,0,0),y.getTime()}}function a(b,O){const y=new Date(b);switch(O){case"hour":y.setHours(y.getHours()+1);break;case"day":y.setDate(y.getDate()+1);break;case"week":y.setDate(y.getDate()+7);break;case"month":y.setMonth(y.getMonth()+1);break;case"quarter":y.setMonth(y.getMonth()+3);break;default:y.setFullYear(y.getFullYear()+1);break}return y.getTime()}function s(b,O,y){const L=k(b),M=E(b),D=O?O.length:y;let F=1/0,T=-1/0,I=0,P=0;for(let R=0;R<D;R++){const $=O?O[R]:R;if(M&&!M($)){I++;continue}const C=L($);if(!Number.isFinite(C)){I++;continue}C<F&&(F=C),C>T&&(T=C),P++}return{min:F,max:T,nulls:I,finite:P}}function t(b,O,y,L){const M=k(b),D=E(b),F=O?O.length:y,T=F>L?F/L:1,I=[];for(let R=0;R<F;R+=T){const $=O?O[Math.floor(R)]:Math.floor(R);if(D&&!D($))continue;const C=M($);Number.isFinite(C)&&I.push(C)}const P=Float64Array.from(I);return P.sort(),P}function u(b,O,y,L={}){const M=L.kind||j(b,L.type);return M==="none"||!b?{kind:"none",buckets:[],suppressed:"type"}:M==="boolean"?r(b,O,y):M==="category"?o(b,O,y,L):f(b,O,y,M,L)}function r(b,O,y){const L=E(b);let M=0;if(L){const F=O?O.length:y;for(let T=0;T<F;T++)L(O?O[T]:T)||M++}const D=[{value:!1,label:"false"},{value:!0,label:"true"}];return M>0&&D.push({null:!0,label:"Empty"}),{kind:"boolean",buckets:D}}function o(b,O,y,L){const M=L.cardinalityLimit??Y,{cardinality:D}=c(b,O,y,M);if(D>M&&(L.aboveLimit||"suppress")==="suppress")return{kind:"category",buckets:[],suppressed:"cardinality",cardinality:D};const F=q(b),T=O?O.length:y,I=new Map;let P=0;for(let S=0;S<T;S++){const x=F(O?O[S]:S);if(x==null||x===""){P++;continue}if(Array.isArray(x)){if(!x.length){P++;continue}for(const H of x)I.set(H,(I.get(H)||0)+1);continue}I.set(x,(I.get(x)||0)+1)}let R=[...I.entries()];L.order==="alpha"?R.sort((S,x)=>String(S[0]).localeCompare(String(x[0]))):R.sort((S,x)=>x[1]-S[1]);let $=0,C=0;if(R.length>M){C=R.length-M;for(let S=M;S<R.length;S++)$+=R[S][1];R=R.slice(0,M)}const A=R.map(([S])=>({value:S,label:String(S)}));return $>0&&A.push({remainder:!0,label:`Other (${C} values)`}),P>0&&A.push({null:!0,label:"Empty"}),{kind:"category",buckets:A,cardinality:D}}function f(b,O,y,L,M){const{min:D,max:F,nulls:T,finite:I}=s(b,O,y);if(!I)return{kind:L,buckets:T?[{null:!0,label:"Empty"}]:[],empty:!0};const P=Math.max(1,Math.floor(M.buckets||B));let R=[];if(L==="date"){const C=X.includes(M.granularity)?M.granularity:i(F-D,P);let A=n(D,C);for(;A<=F&&R.length<4096;){const S=a(A,C);if(!(S>A))break;R.push({from:A,to:S}),A=S}return{kind:L,buckets:w(R,T),granularity:C}}const $=Z.includes(M.strategy)?M.strategy:"equal";if($==="quantile"){const C=t(b,O,y,G);if(C.length){const A=[C[0]];for(let S=1;S<P;S++){const x=C[Math.min(C.length-1,Math.floor(S/P*C.length))];x>A[A.length-1]&&A.push(x)}A.push(F);for(let S=0;S<A.length-1;S++)R.push({from:A[S],to:A[S+1]})}}else if($==="log"&&D>0){const C=Math.log10(D),S=(Math.log10(F)-C)/P||1;for(let x=0;x<P;x++)R.push({from:10**(C+x*S),to:10**(C+(x+1)*S)})}if(!R.length){const C=(F-D)/P||1;for(let A=0;A<P;A++)R.push({from:D+A*C,to:D+(A+1)*C})}return R[R.length-1].to=F,{kind:L,buckets:w(R,T),strategy:$,min:D,max:F}}function w(b,O){return O>0?[...b,{null:!0,label:"Empty"}]:b}function m(b,O,y,L,M){const D=L&&L.buckets||[],F=M&&M.length>=D.length?M.subarray(0,D.length):new Uint32Array(D.length);if(F.fill(0),!b||!D.length)return F;const T=D.length-1,I=!!D[T]&&D[T].null===!0,P=O?O.length:y;if(L.kind==="boolean"){const S=q(b);for(let x=0;x<P;x++){const H=S(O?O[x]:x);if(H==null){I&&F[T]++;continue}F[H?1:0]++}return F}if(L.kind==="category"){const S=new Map;for(let V=0;V<D.length;V++)!D[V].null&&!D[V].remainder&&S.set(D[V].value,V);const x=D.findIndex(V=>V.remainder),H=q(b);for(let V=0;V<P;V++){const W=H(O?O[V]:V);if(W==null||W===""){I&&F[T]++;continue}if(Array.isArray(W)){if(!W.length){I&&F[T]++;continue}for(const ee of W){const re=S.get(ee);re!==void 0?F[re]++:x>=0&&F[x]++}continue}const Q=S.get(W);Q!==void 0?F[Q]++:x>=0&&F[x]++}return F}const R=I?D.length-1:D.length,$=new Float64Array(R+1);for(let S=0;S<R;S++)$[S]=D[S].from;$[R]=R?D[R-1].to:0;const C=k(b),A=E(b);for(let S=0;S<P;S++){const x=O?O[S]:S;if(A&&!A(x)){I&&F[T]++;continue}const H=C(x);if(!Number.isFinite(H)){I&&F[T]++;continue}const V=v($,R,H);V>=0&&F[V]++}return F}function v(b,O,y){if(!O||y<b[0])return-1;if(y>=b[O])return y===b[O]?O-1:-1;let L=0,M=O-1;for(;L<M;){const D=L+M+1>>>1;y>=b[D]?L=D:M=D-1}return L}function h(b,O,y,L={}){const M=L.bounds||u(b,L.boundsIndices??O,y,L);return{bounds:M,counts:m(b,O,y,M)}}const p=h}),Ue("packages/core/src/compute/pivotmatrix.js",function(e,U){"use strict";Object.defineProperty(e,"GRAND_PATH",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"resolveAxis",{enumerable:!0,get:function(){return k}}),Object.defineProperty(e,"pivotMatrix",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"cellKey",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"marginKey",{enumerable:!0,get:function(){return n}});const E=U("packages/core/src/compute/handle.js").valueComparator,z=U("packages/core/src/compute/total.js").total,Z=U("packages/core/src/compute/group.js").packKeys,X=U("packages/core/src/compute/pivot.js"),B=X.joinPath,Y=X.DEFAULT_PATH_SEPARATOR,G=X.DEFAULT_MAX_COLUMNS,j="";function k(a,s,t={}){const u=t.separator||Y,r=a||[],o=s instanceof Uint32Array?s:Uint32Array.from(s||[]),f=o.length;if(r.length===0)return{tuples:[[]],paths:[j],buckets:[o]};const{keyOf:w,readers:m}=Z(r,o,0),v=new Map,h=[],p=[],b=[];for(let F=0;F<f;F++){const T=o[F],I=w(T);let P=v.get(I);if(P===void 0){P=h.length,v.set(I,P),p.push(I);const R=new Array(m.length);for(let $=0;$<m.length;$++)R[$]=m[$](T);h.push(R),b.push([])}b[P].push(T)}const O=E(t.locale),y=h.map((F,T)=>T);y.sort((F,T)=>{const I=h[F],P=h[T];for(let R=0;R<I.length;R++){const $=g(I[R],P[R],O);if($!==0)return $}return F-T});const L=new Array(y.length),M=new Array(y.length),D=new Array(y.length);for(let F=0;F<y.length;F++){const T=y[F];L[F]=h[T],M[F]=B(h[T],u),D[F]=Uint32Array.from(b[T])}return{tuples:L,paths:M,buckets:D}}function g(a,s,t){const u=a==null,r=s==null;return u||r?u&&r?0:u?1:-1:t(a,s)}function c(a,s,t){const u=[];for(let r=0;r<a.length;r++)t.has(a[r])&&u.push(a[r]);return Uint32Array.from(u)}function d(a,s,t,u){return{value:s.length?z(a,s,t,u):null,leaves:s,count:s.length}}function l(a){const s=a&&a.opts||{},t=s.separator||Y,u=s.totalContext||{locale:s.locale},r=(a.measures||[]).filter(M=>M&&M.handle),o=a.leaves instanceof Uint32Array?a.leaves:Uint32Array.from(a.leaves||[]),f=k(a.rowHandles||[],o,{...s,separator:t}),w=k(a.columnHandles||[],o,{...s,separator:t}),m=s.maxColumns===void 0?G:s.maxColumns,v=w.paths.length*Math.max(1,r.length),h=new Map;if(m&&v>m)return{rowAxis:f,columnAxis:w,measures:r.map(M=>({colId:M.colId,fn:M.fn})),body:h,rowMargin:h,columnMargin:h,grand:h,columns:v,error:{code:"pivot-max-columns",message:`[lattice] pivot would generate ${v} columns, above pivot.maxColumns of ${m}. Narrow the pivot columns or raise the limit.`,columns:v,maxColumns:m}};const p=new Map,b=new Map,O=new Map,y=new Map,L=w.buckets.map(M=>new Set(M));for(let M=0;M<w.paths.length;M++){const D=w.buckets[M],F=w.paths[M];for(const T of r)O.set(n(F,T.colId),d(T.handle,D,T.fn,u))}for(let M=0;M<f.paths.length;M++){const D=f.buckets[M],F=f.paths[M];for(const T of r)b.set(n(F,T.colId),d(T.handle,D,T.fn,u));for(let T=0;T<w.paths.length;T++){const I=c(D,w.buckets[T],L[T]);if(I.length===0)continue;const P=w.paths[T];for(const R of r)p.set(i(F,P,R.colId),d(R.handle,I,R.fn,u))}}for(const M of r)y.set(M.colId,d(M.handle,o,M.fn,u));return{rowAxis:f,columnAxis:w,measures:r.map(M=>({colId:M.colId,fn:M.fn})),body:p,rowMargin:b,columnMargin:O,grand:y,columns:v,error:null}}function i(a,s,t){return`${a}\0${s}\0${t}`}function n(a,s){return`${a}\0${s}`}}),Ue("packages/core/src/compute/reference.js",function(e,U){"use strict";Object.defineProperty(e,"referenceValue",{enumerable:!0,get:function(){return G}}),Object.defineProperty(e,"referenceSort",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"referenceFilter",{enumerable:!0,get:function(){return g}}),Object.defineProperty(e,"referencePasses",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"referenceGroup",{enumerable:!0,get:function(){return d}}),Object.defineProperty(e,"referenceTotal",{enumerable:!0,get:function(){return l}});const E=U("packages/core/src/internal/paths.js").getPath,q=U("packages/core/src/compute/handle.js"),z=q.isMissing,_=q.valueComparator,X=U("packages/core/src/compute/filter.js").testValue,B="",Y="\0";function G(a,s){const t=s.includes(".")?E(a,s):a?.[s];return t===void 0?null:t}function j(a,s,t={}){const u=s||[];let r=a.map((o,f)=>f);if(u.length===0)return r;for(let o=u.length-1;o>=0;o--)r=k(a,r,u[o],t);return r}function k(a,s,t,u){const r=t.locale!==void 0?t.locale:u.locale,o=_(r),f=t.descending!==void 0?!!t.descending:t.dir==="desc",w=[],m=[];for(const p of s){const b=G(a[p],t.col);z(b)?m.push(p):w.push(p)}const v=new Map;for(let p=0;p<w.length;p++)v.set(w[p],p);const h=(p,b)=>{const O=G(a[p],t.col),y=G(a[b],t.col);let L;return typeof t.compare=="function"?(L=t.compare(O,y,a[p],a[b],f),f&&(L=-L)):L=f?o(y,O):o(O,y),L!==0?L:v.get(p)-v.get(b)};return w.sort(h),t.nullsFirst?m.concat(w):w.concat(m)}function g(a,s,t={}){const u=[];for(let r=0;r<a.length;r++)c(a[r],s,t,r)&&u.push(r);return u}function c(a,s,t,u){if(!s)return!0;if(Array.isArray(s.conditions)){const r=s.conditions.filter(f=>f!=null);if(r.length===0)return!0;if(s.op==="or")return r.some(f=>c(a,f,t,u));const o=r.every(f=>c(a,f,t,u));return s.op==="not"?!o:o}return s.col===void 0&&typeof t.custom=="function"?!!t.custom(s,a,u):X(G(a,s.col),s,t.locale)}function d(a,s,t,u){const r=t||a.map((m,v)=>v),o=new Map,f=[],w=[];for(const m of r){const v=s.map((b,O)=>{const y=G(a[m],b);return u&&u[O]?u[O](y):y}),h=v.map(b=>b==null?Y:String(b)).join(B);let p=o.get(h);p===void 0&&(p=f.length,o.set(h,p),f.push(v),w.push([])),w[p].push(m)}return{keys:f,buckets:w}}function l(a,s,t={}){const u=_(t.locale),r=a.filter(f=>!z(f)),o=r.map(i).filter(f=>f!==null);switch(s){case"count":return a.length;case"countValues":return r.length;case"sum":return o.reduce((f,w)=>f+w,0);case"avg":return r.length===0?null:o.reduce((f,w)=>f+w,0)/r.length;case"min":return r.length===0?null:r.reduce((f,w)=>u(w,f)<0?w:f);case"max":return r.length===0?null:r.reduce((f,w)=>u(w,f)>0?w:f);case"first":return a.length===0?null:n(a[0]);case"last":return a.length===0?null:n(a[a.length-1]);default:return null}}function i(a){if(typeof a=="number")return Number.isNaN(a)?null:a;if(a==null||a===""||typeof a=="boolean")return null;if(a instanceof Date)return a.getTime();const s=Number(a);return Number.isNaN(s)?null:s}function n(a){return a===void 0?null:a}}),Ue("packages/core/src/compute/index.js",function(e,U){"use strict";const te=U("packages/core/src/compute/sort.js");Object.defineProperty(e,"sortColumn",{enumerable:!0,get:function(){return te.sortColumn}}),Object.defineProperty(e,"sortMulti",{enumerable:!0,get:function(){return te.sortMulti}}),Object.defineProperty(e,"radixSortFloat64",{enumerable:!0,get:function(){return te.radixSortFloat64}}),Object.defineProperty(e,"radixSortInt32",{enumerable:!0,get:function(){return te.radixSortInt32}}),Object.defineProperty(e,"rankSortDictionary",{enumerable:!0,get:function(){return te.rankSortDictionary}}),Object.defineProperty(e,"mergeSortComparator",{enumerable:!0,get:function(){return te.mergeSortComparator}}),Object.defineProperty(e,"collateStringRanks",{enumerable:!0,get:function(){return te.collateStringRanks}}),Object.defineProperty(e,"rankSortStrings",{enumerable:!0,get:function(){return te.rankSortStrings}});const E=U("packages/core/src/compute/sortspec.js");Object.defineProperty(e,"collationDescriptor",{enumerable:!0,get:function(){return E.collationDescriptor}}),Object.defineProperty(e,"isPortableSort",{enumerable:!0,get:function(){return E.isPortableSort}}),Object.defineProperty(e,"isPortableSortSet",{enumerable:!0,get:function(){return E.isPortableSortSet}}),Object.defineProperty(e,"describeSortEntry",{enumerable:!0,get:function(){return E.describeSortEntry}}),Object.defineProperty(e,"describeSort",{enumerable:!0,get:function(){return E.describeSort}});const q=U("packages/core/src/compute/filter.js");Object.defineProperty(e,"evaluateFilters",{enumerable:!0,get:function(){return q.evaluateFilters}}),Object.defineProperty(e,"evaluateCondition",{enumerable:!0,get:function(){return q.evaluateCondition}}),Object.defineProperty(e,"compact",{enumerable:!0,get:function(){return q.compact}}),Object.defineProperty(e,"testValue",{enumerable:!0,get:function(){return q.testValue}}),Object.defineProperty(e,"compilePredicate",{enumerable:!0,get:function(){return q.compilePredicate}}),Object.defineProperty(e,"releaseMask",{enumerable:!0,get:function(){return q.releaseMask}}),Object.defineProperty(e,"pruneColumn",{enumerable:!0,get:function(){return q.pruneColumn}}),Object.defineProperty(e,"mentionsColumn",{enumerable:!0,get:function(){return q.mentionsColumn}});const z=U("packages/core/src/compute/group.js");Object.defineProperty(e,"groupByColumns",{enumerable:!0,get:function(){return z.groupByColumns}}),Object.defineProperty(e,"packKeys",{enumerable:!0,get:function(){return z.packKeys}});const _=U("packages/core/src/compute/facet.js");Object.defineProperty(e,"facet",{enumerable:!0,get:function(){return _.facet}}),Object.defineProperty(e,"computeBounds",{enumerable:!0,get:function(){return _.computeBounds}}),Object.defineProperty(e,"countInto",{enumerable:!0,get:function(){return _.countInto}}),Object.defineProperty(e,"bucketOf",{enumerable:!0,get:function(){return _.bucketOf}}),Object.defineProperty(e,"facetKind",{enumerable:!0,get:function(){return _.facetKind}}),Object.defineProperty(e,"cardinalityOf",{enumerable:!0,get:function(){return _.cardinalityOf}}),Object.defineProperty(e,"pickGranularity",{enumerable:!0,get:function(){return _.pickGranularity}}),Object.defineProperty(e,"floorTo",{enumerable:!0,get:function(){return _.floorTo}}),Object.defineProperty(e,"advance",{enumerable:!0,get:function(){return _.advance}}),Object.defineProperty(e,"STRATEGIES",{enumerable:!0,get:function(){return _.STRATEGIES}}),Object.defineProperty(e,"GRANULARITIES",{enumerable:!0,get:function(){return _.GRANULARITIES}}),Object.defineProperty(e,"DEFAULT_BUCKETS",{enumerable:!0,get:function(){return _.DEFAULT_BUCKETS}}),Object.defineProperty(e,"DEFAULT_CARDINALITY_LIMIT",{enumerable:!0,get:function(){return _.DEFAULT_CARDINALITY_LIMIT}}),Object.defineProperty(e,"QUANTILE_SAMPLE",{enumerable:!0,get:function(){return _.QUANTILE_SAMPLE}});const Z=U("packages/core/src/compute/total.js");Object.defineProperty(e,"TOTAL_FNS",{enumerable:!0,get:function(){return Z.TOTAL_FNS}}),Object.defineProperty(e,"TOTAL_LABELS",{enumerable:!0,get:function(){return Z.TOTAL_LABELS}}),Object.defineProperty(e,"totalLabel",{enumerable:!0,get:function(){return Z.totalLabel}}),Object.defineProperty(e,"total",{enumerable:!0,get:function(){return Z.total}}),Object.defineProperty(e,"collectValues",{enumerable:!0,get:function(){return Z.collectValues}});const X=U("packages/core/src/compute/pivot.js");Object.defineProperty(e,"pivot",{enumerable:!0,get:function(){return X.pivot}}),Object.defineProperty(e,"resolvePivotKeys",{enumerable:!0,get:function(){return X.resolvePivotKeys}}),Object.defineProperty(e,"pivotKey",{enumerable:!0,get:function(){return X.pivotKey}}),Object.defineProperty(e,"joinPath",{enumerable:!0,get:function(){return X.joinPath}}),Object.defineProperty(e,"KEY_DELIMITER",{enumerable:!0,get:function(){return X.KEY_DELIMITER}}),Object.defineProperty(e,"DEFAULT_PATH_SEPARATOR",{enumerable:!0,get:function(){return X.DEFAULT_PATH_SEPARATOR}}),Object.defineProperty(e,"DEFAULT_MAX_COLUMNS",{enumerable:!0,get:function(){return X.DEFAULT_MAX_COLUMNS}});const B=U("packages/core/src/compute/pivotmatrix.js");Object.defineProperty(e,"pivotMatrix",{enumerable:!0,get:function(){return B.pivotMatrix}}),Object.defineProperty(e,"resolveAxis",{enumerable:!0,get:function(){return B.resolveAxis}}),Object.defineProperty(e,"cellKey",{enumerable:!0,get:function(){return B.cellKey}}),Object.defineProperty(e,"marginKey",{enumerable:!0,get:function(){return B.marginKey}}),Object.defineProperty(e,"GRAND_PATH",{enumerable:!0,get:function(){return B.GRAND_PATH}});const Y=U("packages/core/src/compute/reference.js");Object.defineProperty(e,"referenceSort",{enumerable:!0,get:function(){return Y.referenceSort}}),Object.defineProperty(e,"referenceFilter",{enumerable:!0,get:function(){return Y.referenceFilter}}),Object.defineProperty(e,"referenceGroup",{enumerable:!0,get:function(){return Y.referenceGroup}}),Object.defineProperty(e,"referenceTotal",{enumerable:!0,get:function(){return Y.referenceTotal}}),Object.defineProperty(e,"referencePasses",{enumerable:!0,get:function(){return Y.referencePasses}}),Object.defineProperty(e,"referenceValue",{enumerable:!0,get:function(){return Y.referenceValue}});const G=U("packages/core/src/compute/handle.js");Object.defineProperty(e,"identity",{enumerable:!0,get:function(){return G.identity}}),Object.defineProperty(e,"rowCount",{enumerable:!0,get:function(){return G.rowCount}}),Object.defineProperty(e,"presenceReader",{enumerable:!0,get:function(){return G.presenceReader}}),Object.defineProperty(e,"bitReader",{enumerable:!0,get:function(){return G.bitReader}}),Object.defineProperty(e,"valueReader",{enumerable:!0,get:function(){return G.valueReader}}),Object.defineProperty(e,"valueComparator",{enumerable:!0,get:function(){return G.valueComparator}}),Object.defineProperty(e,"numericTotalOrder",{enumerable:!0,get:function(){return G.numericTotalOrder}}),Object.defineProperty(e,"dictRanks",{enumerable:!0,get:function(){return G.dictRanks}}),Object.defineProperty(e,"dictSize",{enumerable:!0,get:function(){return G.dictSize}}),Object.defineProperty(e,"dictValue",{enumerable:!0,get:function(){return G.dictValue}}),Object.defineProperty(e,"multiValue",{enumerable:!0,get:function(){return G.multiValue}}),Object.defineProperty(e,"isMissing",{enumerable:!0,get:function(){return G.isMissing}});const j=U("packages/core/src/compute/sketch.js");Object.defineProperty(e,"Welford",{enumerable:!0,get:function(){return j.Welford}}),Object.defineProperty(e,"Reservoir",{enumerable:!0,get:function(){return j.Reservoir}}),Object.defineProperty(e,"HyperLogLog",{enumerable:!0,get:function(){return j.HyperLogLog}}),Object.defineProperty(e,"SpaceSaving",{enumerable:!0,get:function(){return j.SpaceSaving}}),Object.defineProperty(e,"KLL",{enumerable:!0,get:function(){return j.KLL}}),Object.defineProperty(e,"hash32",{enumerable:!0,get:function(){return j.hash32}}),Object.defineProperty(e,"SKETCH_BOUNDS",{enumerable:!0,get:function(){return j.SKETCH_BOUNDS}});const k=U("packages/core/src/compute/windowed.js");Object.defineProperty(e,"Window",{enumerable:!0,get:function(){return k.Window}}),Object.defineProperty(e,"WINDOW_KINDS",{enumerable:!0,get:function(){return k.WINDOW_KINDS}}),Object.defineProperty(e,"openWindow",{enumerable:!0,get:function(){return k.openWindow}});const g=U("packages/core/src/compute/statistics.js");Object.defineProperty(e,"MAINTENANCE",{enumerable:!0,get:function(){return g.MAINTENANCE}}),Object.defineProperty(e,"APPROXIMATE",{enumerable:!0,get:function(){return g.APPROXIMATE}}),Object.defineProperty(e,"maintenanceOf",{enumerable:!0,get:function(){return g.maintenanceOf}});const c=U("packages/core/src/compute/anomaly.js");Object.defineProperty(e,"ANOMALY_METHODS",{enumerable:!0,get:function(){return c.ANOMALY_METHODS}}),Object.defineProperty(e,"modifiedZScores",{enumerable:!0,get:function(){return c.modifiedZScores}}),Object.defineProperty(e,"iqrFences",{enumerable:!0,get:function(){return c.iqrFences}}),Object.defineProperty(e,"mahalanobis",{enumerable:!0,get:function(){return c.mahalanobis}}),Object.defineProperty(e,"ROLLING_ANOMALY_METHODS",{enumerable:!0,get:function(){return c.ROLLING_ANOMALY_METHODS}}),Object.defineProperty(e,"rollingAnomalies",{enumerable:!0,get:function(){return c.rollingAnomalies}}),Object.defineProperty(e,"anomalyCondition",{enumerable:!0,get:function(){return c.anomalyCondition}});const d=U("packages/core/src/compute/forecast.js");Object.defineProperty(e,"FORECAST_METHODS",{enumerable:!0,get:function(){return d.FORECAST_METHODS}}),Object.defineProperty(e,"forecast",{enumerable:!0,get:function(){return d.forecast}})}),Ue("packages/core/src/source/rows.js",function(e,U){"use strict";Object.defineProperty(e,"DEFAULT_ROW_HEIGHT",{enumerable:!0,get:function(){return _}}),Object.defineProperty(e,"KEY_SEP",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"createRowFactory",{enumerable:!0,get:function(){return X}}),Object.defineProperty(e,"RowFactory",{enumerable:!0,get:function(){return B}}),Object.defineProperty(e,"pinnedRow",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(e,"lazyRowView",{enumerable:!0,get:function(){return G}}),Object.defineProperty(e,"groupPathElement",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"groupKey",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"groupPrefixKeys",{enumerable:!0,get:function(){return d}});const E=U("packages/core/src/internal/warn.js").warnOnce,z=U("packages/core/src/internal/predicates.js").isFunction,_=32,Z="\0";function X(l){return new B(l)}class B{#e;#t;constructor(i){this.#e=z(i&&i.rowKey)?i.rowKey:null;const n=i&&i.config?i.config.rowHeight:void 0;this.#t=typeof n=="number"||z(n)?n:_}get keyed(){return this.#e!==null}keyOf(i,n){if(this.#e){const a=this.#e(i);if(a!=null)return String(a)}else E("source.rowKey.missing","no config.rowKey; falling back to index identity.","Row changes, streaming dedupe, selection persistence and remote reload are disabled.");return`#${n}`}heightOf(i){return z(this.#t)?Number(this.#t(i))||_:this.#t}leaf(i,n,a=0,s=null){const t={key:this.keyOf(i,n),data:i,level:a,parent:s,group:!1,expanded:!1,leafCount:1,height:0,index:null,selected:!1,physical:n};return t.height=this.heightOf(t),t}group(i){const n={key:c(i.keyPath||i.path),data:null,level:i.level,parent:i.parent||null,children:[],group:!0,expanded:i.expanded!==!1,leafCount:i.leafCount||0,height:0,index:null,selected:!1,physical:null,groupColumn:i.column,groupValue:i.value,groupPath:i.path,hasChildren:i.hasChildren!==!1};return i.totals&&(n.totals=i.totals),n.height=this.heightOf(n),n}footer(i){const n={key:`${i.key}${Z}footer`,data:null,level:i.level,parent:i,group:!0,footer:!0,expanded:!1,leafCount:i.leafCount||0,height:0,index:null,selected:!1,physical:null,groupColumn:i.groupColumn,groupValue:i.groupValue,groupPath:i.groupPath,hasChildren:!1,totals:i.totals};return n.height=this.heightOf(n),n}detail(i,n){return{key:`${i.key}${Z}detail`,data:i.data,level:i.level+1,parent:i,group:!1,detail:!0,expanded:!1,leafCount:0,height:n,index:null,selected:!1,physical:null,hasChildren:!1,masterKey:i.key}}grandTotal(i,n){const a={key:`${Z}grandTotal`,data:null,level:0,parent:null,group:!0,grandTotal:!0,expanded:!1,leafCount:n,height:0,index:null,selected:!1,physical:null,groupPath:[],hasChildren:!1,totals:i};return a.height=this.heightOf(a),a}skeleton(i,n=0,a=!1){const s={key:`${Z}pending${Z}${i}`,data:null,level:n,parent:null,group:!1,expanded:!1,leafCount:1,height:0,index:i,selected:!1,physical:null,pending:!0};return a&&(s.loadError=!0),s.height=this.heightOf(s),s}}function Y(l,i,n,a){return{key:`${Z}pinned${Z}${n}${Z}${i}`,data:l,level:0,parent:null,group:!1,expanded:!1,leafCount:0,height:a,index:null,selected:!1,physical:null,hasChildren:!1,pinned:n}}function G(l,i){return new Proxy([],{get(n,a,s){if(a==="length")return l();if(typeof a=="string"){const t=Number(a);if(Number.isInteger(t)&&t>=0)return i(t)}return Reflect.get(n,a,s)},has(n,a){if(typeof a=="string"){const s=Number(a);if(Number.isInteger(s)&&s>=0)return s<l()}return Reflect.has(n,a)}})}function j(l){return l==null?"":String(l)}const k="";function g(l){if(l==null)return k;const i=String(l);return i.startsWith(k)?k+i:i}function c(l){const i=l||[];let n="g";for(let a=0;a<i.length;a++)n+=Z+g(i[a]);return n}function d(l){const i=new Array(l.length),n=[];for(let a=0;a<l.length;a++)n.push(l[a]),i[a]=c(n);return i}}),Ue("packages/core/src/source/handles.js",function(e,U){"use strict";Object.defineProperty(e,"HandleProvider",{enumerable:!0,get:function(){return _}}),Object.defineProperty(e,"createHandleProvider",{enumerable:!0,get:function(){return Z}});const E=U("packages/core/src/internal/predicates.js").isFunction,z=U("packages/core/src/internal/warn.js").warnOnce;class _{#e;#t;#n;#r=new Map;#s=0;constructor(B,Y,G){this.#e=B,this.#t=Y,this.#n=E(G)?G:()=>!1}get store(){const B=this.#e.store;return B&&E(B.column)?B:null}invalidate(){this.#s++}handle(B){const Y=this.store;if(Y){const g=Y.column(B);if(g)return g}const G=this.#r.get(B);if(G&&G.builtAt===this.#s)return G.handle;const j=this.#i(B);if(!j)return;if(Y&&this.#n()){z(`source.dropped.${B}`,`column "${B}" cannot be served under ingest.dropSourceRows: it is an impure computed column (a shadow or a positional/rank column) that is never stored, so it can only be read from the caller's row objects — which dropSourceRows has released. Do not sort, filter, group or total on such a column with dropSourceRows enabled.`);return}const k=this.#o(j);return this.#r.set(B,{handle:k,builtAt:this.#s}),k}#i(B){const Y=this.#e.columns;return Y&&E(Y.get)?Y.get(B):void 0}#o(B){const Y=this.#t()||[],G=Y.length,j=new Array(G),k=E(B.getValue)?c=>B.getValue(c):c=>c?.[B.field||B.id];for(let c=0;c<G;c++)j[c]=Y[c]===void 0?void 0:k(Y[c]);const g=this.#s;return{id:B.id,kind:"object",nullable:!1,values:j,presence:null,dict:null,offsets:null,get(c){return j[c]},version:g}}}function Z(X,B,Y){return new _(X,B,Y)}}),Ue("packages/core/src/compute/incremental.js",function(e,U){"use strict";Object.defineProperty(e,"INCREMENTAL_FNS",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"INCREMENTAL_KINDS",{enumerable:!0,get:function(){return z}}),Object.defineProperty(e,"MAGNITUDE_LIMIT",{enumerable:!0,get:function(){return _}}),Object.defineProperty(e,"isIncremental",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"RunningTotal",{enumerable:!0,get:function(){return B}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return Y}});const E=U("packages/core/src/store/columnstore.js").toFloat,q=Object.freeze(["sum","avg","countValues","min","max"]),z=Object.freeze(["float64"]),_=1e15;function Z(G,j){return typeof G!="string"||!q.includes(G)?!1:!!j&&z.includes(j.kind)}function X(G){if(G==null)return null;const j=E(G);return Number.isNaN(j)?null:j}class B{#e;#t=0;#n=0;#r=0;#s=1/0;#i=-1/0;#o=!1;#l=!1;constructor(j){this.#e=j}get valid(){return this.#o&&!this.#l}get fn(){return this.#e}seed(j){this.#a();for(let k=0;k<j.length;k++){const g=X(j[k]);g!==null&&this.#c(g)}this.#o=!0}seedColumn(j,k,g){this.#a();for(let c=0;c<g.length;c++){const d=g[c];if(k&&k(d)===0)continue;const l=j[d];Number.isNaN(l)||this.#c(l)}this.#o=!0}#a(){this.#t=0,this.#n=0,this.#r=0,this.#s=1/0,this.#i=-1/0,this.#l=!1}#c(j){if(!Number.isFinite(j)){this.#l=!0;return}const k=this.#t+j;this.#n+=Math.abs(this.#t)>=Math.abs(j)?this.#t-k+j:j-k+this.#t,this.#t=k,this.#r++,j<this.#s&&(this.#s=j),j>this.#i&&(this.#i=j)}#u(j){const k=this.#t-j;this.#n+=Math.abs(this.#t)>=Math.abs(j)?this.#t-k-j:-j-k+this.#t,this.#t=k,this.#r--}update(j,k){if(!this.#o)return!1;const g=X(j),c=X(k);return g===null&&c===null?!0:g!==null&&!Number.isFinite(g)||c!==null&&!Number.isFinite(c)?!1:this.#e==="min"||this.#e==="max"?g===null||c===null?!1:this.#e==="min"?c<this.#s?(this.#s=c,!0):g>this.#s:c>this.#i?(this.#i=c,!0):g<this.#i:Math.abs(this.#t)>_?!1:(g!==null&&this.#u(g),c!==null&&this.#c(c),!0)}value(){switch(this.#e){case"countValues":return this.#r;case"avg":return this.#r?(this.#t+this.#n)/this.#r:null;case"min":return this.#r?this.#s:null;case"max":return this.#r?this.#i:null;default:return this.#t+this.#n}}invalidate(){this.#o=!1}}const Y=B}),Ue("packages/core/src/source/filterwire.js",function(e,U){"use strict";Object.defineProperty(e,"HOST_FILTER_WARN_ID",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"WHERE_PAGE_RELATIVE_WARN_ID",{enumerable:!0,get:function(){return z}}),Object.defineProperty(e,"warnWherePageRelative",{enumerable:!0,get:function(){return _}}),Object.defineProperty(e,"warnHostFilterNotApplied",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"WHERE_NOT_APPLIED_WARN_ID",{enumerable:!0,get:function(){return X}}),Object.defineProperty(e,"warnWhereNotApplied",{enumerable:!0,get:function(){return B}}),Object.defineProperty(e,"WHERE_OVER_THRESHOLD_WARN_ID",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(e,"warnWhereOverThreshold",{enumerable:!0,get:function(){return G}}),Object.defineProperty(e,"RELATIVE_TOKENS",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"parseRelativeToken",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"resolveRelativeRange",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"relativeTokenOf",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"relativeTokenHelp",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"isResolvableRelative",{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,"resolveRelativeCondition",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"isGroup",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"forEachCondition",{enumerable:!0,get:function(){return w}}),Object.defineProperty(e,"mapConditions",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"normaliseFilterSet",{enumerable:!0,get:function(){return h}}),Object.defineProperty(e,"buildFilterSet",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"wireFilters",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"querySignature",{enumerable:!0,get:function(){return O}});const E=U("packages/core/src/internal/warn.js").warnOnce,q="source.remote.hostFilter",z="source.where.pageRelative";function _(M,D){!Array.isArray(M)||!M.length||E(z,`filters.where (${M.join(", ")}) runs over the rows the ${D} source fetched,`,"not the whole dataset: match counts and totals are page-relative.","Give the predicate a { condition } twin so the engine can narrow the fetch itself.")}function Z(M){const D=(M||{}).config;!D||!D.hostFilter||E(q,"config.hostFilter is not sent to a server-delegated source (paged/remote) and is not applied:","filtering only the fetched window would give wrong counts and totals.","Express the filter as a FilterSet condition, or send it through config.context.")}const X="source.where.notApplied";function B(M,D){E(`${X}:${M}`,`filters.where("${M}") is registered but the ${D} source holds only its fetched window`,"and cannot run the predicate over it: the predicate is not applied there, and rows it would","exclude stay on screen.","Give it a { condition } twin so the engine can narrow the fetch itself — that is the","supported route for a paged or remote source.")}const Y="source.where.overThreshold";function G(M,D,F,T){!Array.isArray(M)||!M.length||E(`${Y}:${D}`,`filters.where (${M.join(", ")}) is not applied to the ${D} pushdown source:`,F===null?"the adapter reports no row total, so the size of the matching set is unknown.":`its matching set is ${F.toLocaleString()} rows, at or past the whereRowLimit of ${T.toLocaleString()}.`,"Running the predicate needs every matching row fetched and held here, which is the whole","download a pushdown source exists to avoid, so it is refused and the rows the predicate","would exclude stay on screen.","Give the predicate a { condition } twin so the engine narrows the fetch itself — that is the","route that works at any size — or raise `whereRowLimit` on the source config if you want the","download.")}const j=new Map;function k(M){let D=j.get(M);return D||(D=new Intl.DateTimeFormat("en-US",{timeZone:M,hourCycle:"h23",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}),j.set(M,D)),D}function g(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone||"UTC"}catch{return"UTC"}}function c(M,D){const F=k(D).formatToParts(new Date(M)),T={y:1970,m:1,d:1,h:0,mi:0,s:0};for(const I of F)I.type==="year"?T.y=+I.value:I.type==="month"?T.m=+I.value:I.type==="day"?T.d=+I.value:I.type==="hour"?T.h=+I.value%24:I.type==="minute"?T.mi=+I.value:I.type==="second"&&(T.s=+I.value);return T}function d(M,D){const F=c(M,D);return Date.UTC(F.y,F.m-1,F.d,F.h,F.mi,F.s)-Math.floor(M/1e3)*1e3}function l(M,D,F,T){const I=Date.UTC(M,D-1,F),P=I-d(I,T);return I-d(P,T)}function i(M,D,F){const T=new Date(Date.UTC(M.y,M.m-1,M.d+D));return l(T.getUTCFullYear(),T.getUTCMonth()+1,T.getUTCDate(),F)}const n=Object.freeze(["today","yesterday","lastNDays","thisWeek","thisMonth","thisQuarter","thisYear","quarterToDate","yearToDate"]);function a(M,D){if(typeof M!="string")return null;const F=M.trim().toLowerCase().replace(/[\s_-]+/g,""),T=/^last(\d*|n)days?$/.exec(F);if(T){const I=T[1]==="n"?"":T[1],P=Number(I||D);return!Number.isFinite(P)||P<=0?null:{kind:"lastNDays",n:Math.floor(P)}}switch(F){case"today":return{kind:"today",n:0};case"yesterday":return{kind:"yesterday",n:0};case"thisweek":return{kind:"thisWeek",n:0};case"thismonth":return{kind:"thisMonth",n:0};case"thisquarter":return{kind:"thisQuarter",n:0};case"thisyear":return{kind:"thisYear",n:0};case"quartertodate":case"qtd":return{kind:"quarterToDate",n:0};case"yeartodate":case"ytd":return{kind:"yearToDate",n:0};default:return null}}function s(M,D={}){const F=a(M,D.n);if(!F)return null;const T=D.tz||g(),I=D.now instanceof Date?D.now.getTime():typeof D.now=="number"?D.now:Date.now(),P=c(I,T),R=l(P.y,P.m,P.d,T),$=i(P,1,T);let C=R,A=$;switch(F.kind){case"today":break;case"yesterday":C=i(P,-1,T),A=R;break;case"lastNDays":A=D.includeToday?$:R,C=i(P,D.includeToday?-(F.n-1):-F.n,T);break;case"thisWeek":{const S=Number.isFinite(D.weekStartsOn)?Number(D.weekStartsOn):1,H=(new Date(Date.UTC(P.y,P.m-1,P.d)).getUTCDay()-S+7)%7;C=i(P,-H,T),A=i(P,-H+7,T);break}case"thisMonth":C=l(P.y,P.m,1,T),A=l(P.m===12?P.y+1:P.y,P.m===12?1:P.m+1,1,T);break;case"thisQuarter":case"quarterToDate":{const S=Math.floor((P.m-1)/3)*3+1;C=l(P.y,S,1,T),A=F.kind==="quarterToDate"?$:S===10?l(P.y+1,1,1,T):l(P.y,S+3,1,T);break}case"thisYear":case"yearToDate":C=l(P.y,1,1,T),A=F.kind==="yearToDate"?$:l(P.y+1,1,1,T);break;default:return null}return{from:new Date(C).toISOString(),to:new Date(A).toISOString(),bounds:"[)",tz:T,relative:F.kind==="lastNDays"?`last${F.n}Days`:F.kind,n:F.n}}function t(M){if(!M||typeof M!="object")return null;const D=M.value;if(D&&typeof D=="object"&&!Array.isArray(D)&&"relative"in D)return{token:String(D.relative),n:typeof D.n=="number"?D.n:void 0};if(M.op==="relative"&&typeof M.value=="string")return{token:M.value,n:void 0};const F=M.meta;return F&&typeof F.relative=="string"&&M.value===void 0?{token:F.relative,n:typeof F.n=="number"?F.n:void 0}:null}function u(){return`Known tokens: ${n.filter(D=>D!=="lastNDays").join(", ")}. "lastNDays" needs a count: pass "last7Days", or the value object { relative: 'lastNDays', n: 7 }.`}function r(M){const D=t(M);return D?a(D.token,D.n)!==null:!1}function o(M,D={}){const F=t(M);if(!F)return M;const T=s(F.token,{...D,n:F.n});return T?{...M,type:M.type||"date",op:"between",value:[T.from,T.to],bounds:M.bounds||T.bounds,meta:{...M.meta||{},relative:T.relative,tz:T.tz}}:(E(`source.relative.${F.token}`,`unknown relative date token "${F.token}"; sending the condition unresolved.`,u()),M)}function f(M){return!!M&&typeof M=="object"&&Array.isArray(M.conditions)}function w(M,D){if(M){if(f(M)){for(const F of M.conditions)w(F,D);return}D(M)}}function m(M,D){if(!M)return null;if(!f(M))return D(M);const F=M;let T=!1;const I=[];for(const P of F.conditions){const R=m(P,D);R!==P&&(T=!0),R&&I.push(R)}return!T&&I.length===F.conditions.length?M:I.length?{...F,conditions:I}:null}function v(M){if(!M)return null;if(!f(M))return M;const D=M,F=[];for(const T of D.conditions){const I=v(T);I&&F.push(I)}return F.length?{op:D.op,conditions:F}:null}function h(M){const D=v(M);return D?f(D)&&D.op==="and"?D:{op:"and",conditions:[D]}:null}function p(M){const D=(M||[]).filter(Boolean);return D.length?{op:"and",conditions:D}:null}function b(M,D={}){const F=m(M,T=>o(T,D));return h(F)}function O(M){const D=y(M.filters??null);return JSON.stringify([D,M.sort??null,M.quick??"",M.groupBy??null,M.pivotBy??null,L(M.context)])}function y(M){if(!M)return null;if(f(M)){const T=M;return{op:T.op,conditions:T.conditions.map(y)}}const D=M,F=D.meta&&typeof D.meta.relative=="string"?D.meta.relative:t(D)?.token;return{col:D.col,op:D.op,bounds:D.bounds??null,caseSensitive:D.caseSensitive??!1,value:F?`rel:${F}`:D.value??null}}function L(M){if(M==null)return null;try{return JSON.parse(JSON.stringify(M))}catch{return E("source.context.unserialisable","config.context is not JSON-serialisable; cache keys ignore it."),"[unserialisable]"}}}),Ue("packages/core/src/source/tree.js",function(e,U){"use strict";Object.defineProperty(e,"SYNTHETIC",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"buildFromPath",{enumerable:!0,get:function(){return B}}),Object.defineProperty(e,"buildFromParentKey",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(e,"assignLevels",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"resolveTree",{enumerable:!0,get:function(){return k}}),Object.defineProperty(e,"buildTree",{enumerable:!0,get:function(){return g}}),Object.defineProperty(e,"indexTree",{enumerable:!0,get:function(){return c}});const E=U("packages/core/src/internal/predicates.js").isFunction,z=U("packages/core/src/internal/warn.js").warnOnce,_="",Z="\0tree:";function X(d,l){return{physical:d,key:l,level:0,children:[],value:void 0}}function B(d,l){const i=[],n=new Map;for(let a=0;a<d.length;a++){const s=d[a],t=l.pathOf(s),u=Array.isArray(t)?t.map(o=>String(o)):[];if(!u.length){const o=X(s,l.keyOf(s));i.push(o);continue}let r=null;for(let o=0;o<u.length;o++){const f=u.slice(0,o+1).join(_),w=o===u.length-1;let m=n.get(f);m&&w&&m.physical===-1&&(m.physical=s,m.key=l.keyOf(s)),m||(m=X(w?s:-1,w?l.keyOf(s):Z+f),m.level=o,m.value=u[o],n.set(f,m),r?r.children.push(m):i.push(m)),r=m}}return{roots:i,nodes:n}}function Y(d,l){const i=new Map,n=[];for(let u=0;u<d.length;u++){const r=d[u],o=l.keyOf(r),f=X(r,o);i.set(o,f);const w=l.parentOf(r);w!=null&&w!==""&&n.push({node:f,parent:String(w)})}let a=null;const s=new Map;for(const{node:u,parent:r}of n){const o=i.get(r);if(o){s.set(u.key,o);continue}l.orphans&&l.orphans!=="root"&&(a||(a=X(-1,`${Z}orphans`),a.value=l.orphans),s.set(u.key,a))}const t=[];for(const u of i.values()){const r=s.get(u.key);r?r.children.push(u):t.push(u)}return a&&a.children.length&&t.push(a),{roots:G(t,i,l.orphans,a),nodes:i}}function G(d,l,i,n){const a=new Set,s=[...d];for(;s.length;){const f=s.pop();if(!a.has(f.key)){a.add(f.key);for(const w of f.children)s.push(w)}}const t=[];for(const f of l.values())a.has(f.key)||t.push(f);if(!t.length)return d;const u=!!i&&i!=="root";z("tree.cycle",`tree.parentKey produced ${t.length} row(s) inside a parent cycle; `+(u?`they are shown under "${i}".`:"they are shown at the root."));for(const f of t)f.children=f.children.filter(w=>a.has(w.key));if(!u)return[...d,...t];let r=n;const o=[...d];return r||(r=X(-1,`${Z}orphans`),r.value=i,o.push(r)),r.children.push(...t),o}function j(d){let l=0;const i=(n,a)=>{for(const s of n)s.level=a,a>l&&(l=a),s.children.length&&i(s.children,a+1)};return i(d,0),l}function k(d,l){if(!d||typeof d!="object")return null;const i=d.path,n=d.parentKey,a=E(d.hasChildren)?s=>!!d.hasChildren(l.dataAt(s)):null;if(E(i))return{mode:"path",pathOf:s=>i(l.dataAt(s)),keyOf:l.keyOf,declaresChildren:a};if(n!=null){const s=E(n)?n:t=>t?.[n];return{mode:"parentKey",parentOf:t=>s(l.dataAt(t)),keyOf:l.keyOf,orphans:d.orphans||"root",declaresChildren:a}}return z("tree.shape","tree is configured with neither `path` nor `parentKey`; rows stay flat."),null}function g(d,l){const i=l.mode==="path"?B(d,l):Y(d,l),n=j(i.roots);return{...i,depth:n}}function c(d,l){const i=new Map,n=a=>{for(let s=0;s<a.length;s++){const t=a[s];if(t.physical>=0){const u=l?l(t.physical):!1,r=u&&t.children.length===0;i.set(t.physical,{level:t.level,posinset:s+1,setsize:a.length,hasChildren:t.children.length>0||u,lazy:r})}t.children.length&&n(t.children)}};return n(d),i}}),Ue("packages/core/src/source/settle.js",function(e,U){"use strict";Object.defineProperty(e,"PIPELINE_SETTLE_REASONS",{enumerable:!0,get:function(){return te}}),Object.defineProperty(e,"isPipelineSettle",{enumerable:!0,get:function(){return E}});const te=Object.freeze(["pipeline:sort","pipeline:sort:error"]);function E(q){const z=q&&typeof q=="object"?q.reason:null;return typeof z=="string"&&te.includes(z)}}),Ue("packages/core/src/source/memory.js",function(e,U){"use strict";Object.defineProperty(e,"STAGES",{enumerable:!0,get:function(){return D}}),Object.defineProperty(e,"PIPELINE_SETTLE_REASONS",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"isPipelineSettle",{enumerable:!0,get:function(){return M}}),Object.defineProperty(e,"createMemorySource",{enumerable:!0,get:function(){return S}}),Object.defineProperty(e,"quickMatcher",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"MemorySource",{enumerable:!0,get:function(){return H}});const E=U("packages/core/src/internal/lru.js").Lru,q=U("packages/core/src/internal/warn.js"),z=q.warnOnce,_=q.fail,X=U("packages/core/src/internal/predicates.js").isFunction,Y=U("packages/core/src/internal/compare.js").defaultCompare,j=U("packages/core/src/internal/merge.js").mergeRow,k=U("packages/core/src/source/rows.js"),g=k.createRowFactory,c=k.groupKey,d=k.groupPathElement,l=k.groupPrefixKeys,i=k.lazyRowView,a=U("packages/core/src/source/handles.js").createHandleProvider,s=U("packages/core/src/compute/incremental.js"),t=s.RunningTotal,u=s.isIncremental,o=U("packages/core/src/compute/handle.js").presenceReader,f=U("packages/core/src/source/filterwire.js"),w=f.querySignature,m=f.mapConditions,v=f.resolveRelativeCondition,h=U("packages/core/src/source/tree.js"),p=h.buildTree,b=h.resolveTree,O=h.indexTree,y=U("packages/core/src/source/settle.js"),L=y.PIPELINE_SETTLE_REASONS,M=y.isPipelineSettle,D=Object.freeze(["filter","sort","group","total","pivot","flatten"]),F=Object.freeze([]);function T(V,W){if(!V)return null;const Q=W==="grand"?V.grandTotal:V.groupTotal;return Q??V.total}function I(V){return!!V&&!V.running}function P(V){if(V)return V.value&&X(V.value.compare)?V.value.compare:X(V.compare)?V.compare:void 0}function R(V){const W=V&&V.dataType;return!W||!X(W.items)?null:{items:W.items,type:V.itemType&&V.itemType.name||"text"}}function $(V){return!!V&&(typeof V=="object"||typeof V=="function")&&X(V.then)}const C=new Uint32Array(0),A=4096;function S(V,W){return new H(V,W)}function x(V,W){if(W==="regex")try{const Q=new RegExp(V,"iu");return ee=>Q.test(ee)}catch{return Q=>Q.includes(V)}if(W==="fuzzy"){const Q=[...V].filter(ee=>ee!==" ");return Q.length?ee=>{let re=0;for(let ae=0;ae<ee.length&&re<Q.length;ae++)ee[ae]===Q[re]&&re++;return re===Q.length}:()=>!0}if(W==="words"){const Q=V.split(/\s+/).filter(Boolean);return Q.length?ee=>Q.every(re=>ee.includes(re)):()=>!0}return Q=>Q.includes(V)}class H{mode="memory";#e;#t;#n;#r=!1;#s=null;#i;#o;#l=new Map;#a=!1;#c=0;#u=0;#f=new Map;#d=new Map;#h;#p=null;#m=H.#g();static#g(){return{slots:[],groupHeadings:F,unnumbered:F,pivot:null,inlineLeaves:null,matchCount:0,grand:null,grandLeaves:0,groupLeaves:null}}#b=new Map;#y=null;#A=new Map;#w=-1;#O=[];#v=new Map;#T=-1;#S=[];#E=null;#M=null;#P=null;#N=null;#R=null;#$=null;#_=null;#G=null;#D=Symbol("unset");#F=new Map;#Y=null;get#x(){return this.#m.slots}set#x(W){this.#m.slots=W}get#K(){return this.#m.inlineLeaves}set#K(W){this.#m.inlineLeaves=W}get#U(){return this.#m.groupHeadings}set#U(W){this.#m.groupHeadings=W}get#H(){return this.#m.unnumbered}set#H(W){this.#m.unnumbered=W}get#fe(){return this.#m.pivot}set#fe(W){this.#m.pivot=W}constructor(W,Q){this.#t=W||{mode:"memory"},this.#e=Q||{};const ee=this.#e.config||{};this.#n=this.#t.rows||ee.rows||[],this.#i=g(this.#e),this.#o=a(this.#e,()=>this.#n,()=>this.#r),this.#h=new E(Number(ee.rowCacheSize)||A);for(const re of D)this.#l.set(re,{key:null,result:null,id:0,computed:!1})}count(){this.#I();const W=this.#ne();return W?W.length:this.#x.length}#ne(){const W=Number(this.#z("pageSize",0))||0;if(W<=0)return null;const Q=this.#x.length,ee=Math.max(1,Math.ceil(Q/W)),ae=Math.min(Math.max(0,Number(this.#z("page",0))||0),ee-1)*W;return{offset:ae,length:Math.max(0,Math.min(W,Q-ae))}}pageInfo(){this.#I();const W=Number(this.#z("pageSize",0))||0,Q=this.#x.length;if(W<=0)return{page:0,pageSize:0,total:Q,pageCount:1};const ee=Math.max(1,Math.ceil(Q/W));return{page:Math.min(Math.max(0,Number(this.#z("page",0))||0),ee-1),pageSize:W,total:Q,pageCount:ee}}totalCount(){return this.#ue().length}matchCount(){return this.#I(),this.#m.matchCount}at(W){this.#I();const Q=this.#ne();if(Q)return W<0||W>=Q.length?void 0:this.#$e(Q.offset+W,W);if(!(W<0||W>=this.#x.length))return this.#$e(W,W)}byKey(W){this.#I(),this.#p||this.#Ce();const Q=this.#p.get(W);if(Q!==void 0)return this.#Ae(Q);for(let ee=0;ee<this.#x.length;ee++){const re=this.#x[ee];if(typeof re!="number"&&re&&re.key===W)return this.#$e(ee)}}loaded(W){return W>=0&&W<this.count()}hint(W,Q){}display(){return this.#I(),this.#Y||(this.#Y=this.#Nt()),this.#Y}invalidateQuickText(){this.#F.clear(),this.invalidate("filter")}invalidate(W){const Q=D.indexOf(W);Q<0&&_(`unknown pipeline stage "${W}"; expected one of ${D.join(", ")}`);for(let ee=Q;ee<D.length;ee++){const re=this.#l.get(D[ee]);re.key=null,re.computed=!1}this.#Y=null}apply(W){const Q=[],ee={added:[],updated:[],removed:[],rejected:Q};if(!W)return ee;let re=!1;const ae=new Set;if(W.remove&&W.remove.length)for(const ue of W.remove){const ge=this.#de(ue);if(ge===void 0){Q.push({operation:"remove",id:this.#ye(ue),reason:"unknown-id"});continue}ee.removed.push(this.#i.keyOf(this.#r?this.#ae(ge):this.#n[ge],ge)),this.#r||(this.#n[ge]=void 0),this.#h.delete(ge),this.#F.delete(ge),re=!0}if(W.update&&W.update.length){const ue=this.#A.size||this.#Ke()?this.#Ze():null,ge=this.#v.size?this.#kt():null,Ae=ge&&ge.length?this.#Ze():null;for(const pe of W.update){const Me=this.#de(pe);if(Me===void 0){Q.push({operation:"update",id:this.#Pe(pe),reason:"unknown-id"});continue}const Ne=this.#r?this.#s&&this.#s.has(Me)?this.#s.get(Me):this.#ae(Me):this.#n[Me],Pe=j(Ne,pe);for(const ie of this.#te(Ne,Pe))ae.add(ie);if(this.#r||(this.#n[Me]=Pe),ue&&this.#Tt(ue,Me,Ne,Pe),Ae&&this.#lt(ge,Ae,Me,Ne,Pe),this.#p){const ie=this.#i.keyOf(Ne,Me),Oe=this.#i.keyOf(Pe,Me);ie!==Oe&&(this.#p.delete(ie),this.#p.set(Oe,Me))}this.#h.delete(Me),this.#F.delete(Me),ee.updated.push(this.#Ae(Me))}}if(W.add&&W.add.length&&this.#r){typeof W.at=="number"&&W.at<this.#Ne()&&(this.#h.clear(),this.#F.clear()),this.#p=null;for(const ue of W.add){const ge=this.#se(this.#Pe(ue));ge!==void 0&&ee.added.push(this.#Ae(ge))}re=!0}else if(W.add&&W.add.length){const ue=typeof W.at=="number"?W.at:this.#n.length,ge=this.#n.length;let Ae=W.add===this.#n?W.add.slice():W.add;if(this.#i.keyed){const pe=[];for(const Me of Ae){const Ne=this.#Pe(Me);if(this.#de(Ne)!==void 0){Q.push({operation:"add",id:Ne,reason:"duplicate-id"});continue}pe.push(Me)}pe.length!==Ae.length&&(Ae=pe)}if(!Ae.length)return ee;if(ue>=ge)for(let pe=0;pe<Ae.length;pe++)this.#n.push(Ae[pe]);else this.#n.splice(ue,0,...Ae),this.#h.clear(),this.#F.clear();for(let pe=0;pe<Ae.length;pe++)ee.added.push(this.#Ae(ue>=ge?ge+pe:ue+pe));re=!0}return this.#c++,re&&(this.#p=null,this.#nt()),this.#o.invalidate(),this.#Y=null,re||this.#X(ae)?(this.#u++,this.invalidate("filter")):this.invalidate("total"),this.#Qe("rows:changed",{companion:!0,added:ee.added.length,updated:ee.updated.length,removed:ee.removed.length}),this.#s=null,ee}groupHeadingsAt(W){this.#I();const Q=this.#U;if(!Q.length||!Number.isInteger(W)||W<0)return F;let ee=0,re=Q.length-1,ae=-1;for(;ee<=re;){const ge=ee+re>>1;Q[ge].at<=W?(ae=ge,ee=ge+1):re=ge-1}if(ae<0)return F;const ue=[];for(let ge=Q[ae].row;ge;ge=ge.parent)ue.push(ge);return ue.reverse(),ue}unnumberedRowCount(W){this.#I();const Q=this.#H;if(!Q.length||!Number.isInteger(W)||W<0)return 0;let ee=0,re=Q.length-1,ae=-1;for(;ee<=re;){const ue=ee+re>>1;Q[ue].at<=W?(ae=ue,ee=ue+1):re=ue-1}return ae+1}moveRow(W,Q){if(this.#r)return z("source.moveRow.dropped","rows.move() is not supported under ingest.dropSourceRows: the source objects have been released and the store cannot reorder its columns in place. Enable retainSource (leave dropSourceRows off) to reorder rows."),!1;const ee=this.#n;if(!Number.isInteger(W)||!Number.isInteger(Q)||W<0||W>=ee.length)return!1;const re=Math.max(0,Math.min(ee.length-1,Q));if(re===W)return!1;const[ae]=ee.splice(W,1);return ee.splice(re,0,ae),this.#c++,this.#u++,this.#p=null,this.#h.clear(),this.#F.clear(),this.#nt(),this.#o.invalidate(),this.#Y=null,this.invalidate("filter"),this.#Qe("rows:changed",{companion:!0,added:0,updated:0,removed:0,moved:1}),!0}reload(W){this.#pe(),this.#c++,this.#u++,this.#p=null,this.#F.clear(),this.#h.clear(),this.#nt(),this.#o.invalidate(),this.invalidate("filter"),this.#Qe("model:changed",{reason:"reload"})}destroy(){this.#pe(),this.#h.clear(),this.#F.clear(),this.#p=null,this.#x=[],this.#K=null,this.#Y=null,this.#nt();for(const W of D)this.#l.set(W,{key:null,result:null,id:0,computed:!1})}#pe(){for(const{controller:W}of this.#b.values())try{W.abort()}catch{}this.#b.clear()}setRows(W){this.#n=W||[],this.#r=!1,this.#c++,this.#u++,this.#p=null,this.#F.clear(),this.#h.clear(),this.#nt(),this.#o.invalidate(),this.invalidate("filter")}notePriorRows(W){this.#s=W||null}releaseSource(){this.#r=!0,this.#n=[],this.#p=null,this.#h.clear(),this.#F.clear(),this.#o.invalidate()}data(){if(!this.#r)return this.#n;const W=this.#e.store;if(!W||!X(W.source))return this.#n;const Q=W.physical||0,ee=new Array(Q);for(let re=0;re<Q;re++)ee[re]=W.live&&!W.live(re)?void 0:W.source(re);return ee}#xe(){const W=this.#z("detail",null);return!W||!X(W.isOpen)||W.inline===!1?null:W}#Oe(){const W=(this.#e.config||{}).tree;return this.#D!==W&&(this.#D=W,this.#G=b(W,{dataAt:Q=>this.#ae(Q),keyOf:Q=>this.#i.keyOf(this.#ae(Q),Q)})),this.#G}#me(){return(this.#e.config||{}).grandTotalRow==="bottom"}grandTotalRow(){if(!this.#me())return null;this.#I();const W=this.#m.grand;return W?this.#i.grandTotal(W,this.#et(this.#m.grandLeaves)):null}pivot(){return this.#I(),this.#fe}pivotMatrix(){this.#I();const W=this.#m.groupLeaves,Q=(this.#e.compute||{}).pivotMatrix;if(!X(Q))return null;const ee=this.#z("groupBy",[]),re=this.#z("pivotBy",[]);if(!ee.length&&!re.length)return z("pivotView.no-dimension","pivotView is on but the grid has no pivot dimension, so there is no matrix to draw. Put a column on the pivot (its `pivot` setting, or `pivotBy` in the query) for the columns across the top, and group by a column for the rows down the side."),null;const ae=this.#Ze().map(ge=>({colId:ge.id,handle:this.#o.handle(ge.id),fn:T(ge,"group")})).filter(ge=>ge.handle&&ge.fn),ue=this.#e.config||{};return Q({rowHandles:ee.map(ge=>this.#o.handle(ge)).filter(Boolean),columnHandles:re.map(ge=>this.#o.handle(ge)).filter(Boolean),measures:ae,leaves:W||new Uint32Array(0),opts:{locale:ue.locale,separator:(ue.pivot||{}).separator,maxColumns:(ue.pivot||{}).maxColumns}})}keysForLeaves(W){const Q=[];if(!W)return Q;for(let ee=0;ee<W.length;ee++){const re=this.#Ae(W[ee]);re&&re.key!=null&&Q.push(String(re.key))}return Q}leavesOf(W){this.#I();const Q=this.#l.get("group"),ee=Q&&Q.result;if(!ee||!ee.nodes)return[];const re=ee.nodes.get(W);if(!re)return[];const ae=[],ue=ge=>{const Ae=ge.row&&ge.row.children;if(Ae&&Ae.length){for(const pe of Ae){const Me=ee.nodes.get(pe.key);Me&&ue(Me)}return}if(ge.leaves)for(let pe=0;pe<ge.leaves.length;pe++)ae.push(this.#Ae(ge.leaves[pe]))};return ue(re),ae}#ye(W){return typeof W=="string"?W:this.#Pe(W)}#Pe(W){try{return this.#i.keyOf(W,-1)}catch{return"(unkeyed)"}}#de(W){if(typeof W=="string")return this.#se(W);if(this.#i.keyed){const ee=this.#i.keyOf(W,-1),re=this.#se(ee);if(re!==void 0)return re}if(this.#r)return;const Q=this.#n.indexOf(W);return Q>=0?Q:void 0}#se(W){return this.#p||this.#Ce(),this.#p.get(W)}#Ce(){this.#p=new Map;const W=this.#Ne(),Q=this.#e.store,ee=Q&&X(Q.live)?re=>Q.live(re):null;for(let re=0;re<W;re++){if(ee&&!ee(re))continue;const ae=this.#ae(re);ae!==void 0&&this.#p.set(this.#i.keyOf(ae,re),re)}}#te(W,Q){const ee=[];for(const re of this.#V())this.#_e(re)&&this.#J(re,W,Q,new Set)&&ee.push(re);return ee}#J(W,Q,ee,re){if(re.has(W))return!1;re.add(W);const ae=this.#_e(W);if(!ae)return!1;const ue=ae.value&&ae.value.deps;return Array.isArray(ue)&&ue.length?ue.some(ge=>this.#J(String(ge),Q,ee,re)):X(ae.getValue)?!Object.is(ae.getValue(Q),ae.getValue(ee)):!1}#V(){const W=new Set;for(const ee of this.#z("sort",[]))W.add(ee.col);for(const ee of this.#z("groupBy",[]))W.add(ee);const Q=ee=>{if(ee){if(Array.isArray(ee.conditions)){ee.conditions.forEach(Q);return}ee.col&&W.add(ee.col)}};return Q(this.#z("filters",null)),[...W]}#X(W){if(!W.size)return!1;if(this.#z("quick",""))return!0;for(const Q of this.#V())if(W.has(Q))return!0;return!1}#I(){if(!this.#a){this.#a=!0;try{this.#Me()}finally{this.#a=!1}}}pipelineRunning(){return this.#a}#Me(){const W=this.#B("filter",()=>this.#W(),()=>this.#Re()),Q=this.#q(W),ee=this.#B("group",()=>this.#ge(),()=>this.#Ye(Q)),re=this.#B("total",()=>this.#we(),()=>this.#We(ee));this.#B("pivot",()=>this.#k(),()=>this.#At(ee)),this.#B("flatten",()=>this.#Se(),()=>this.#Ge(ee)),this.#Be(ee,re)}#q(W){const Q=this.#l.get("sort"),ee=this.#ie();if(Q.computed&&Q.key===ee&&!this.#b.has("sort"))return Q.result;const re=this.#b.get("sort");return re&&re.key===ee?Q.result:Q.result&&this.#Ee(W)?(this.#Te(W,ee),Q.result):this.#B("sort",()=>ee,()=>this.#Fe(W))}#re(){if(this.#y===null){const W=this.#e.pipelineWorker,Q=X(W)?W():null;this.#y=Q||!1}return this.#y||null}#ve(){const W=this.#z("sort",[]);if(!Array.isArray(W)||!W.length)return null;const Q=(this.#e.config||{}).locale,ee=[],re=[];for(const ae of W){const ue=this.#_e(ae.col);if(ue&&ue.running)continue;if(ue&&ue.value&&X(ue.value.compare))return null;const ge=this.#o.handle(ae.col);if(!ge)return null;ee.push({col:ae.col,descending:ae.dir==="desc",nullsFirst:!!ae.nullsFirst,locale:Q}),re.push(ge)}return ee.length?{entries:ee,handles:re,locale:Q}:null}#Ee(W){if(this.#ce())return!1;const Q=this.#re();if(!Q)return!1;const ee=Number(Q.threshold);return Number.isFinite(ee)&&W.length<ee?!1:!!this.#ve()}#Te(W,Q){const ee=this.#re(),re=ee&&this.#ve();if(!re){this.#B("sort",()=>Q,()=>this.#Fe(W));return}const ae=new AbortController;this.#b.set("sort",{key:Q,controller:ae});const ue=re.entries.length===1?ee.sortColumn(re.handles[0],W,{descending:re.entries[0].descending,nullsFirst:re.entries[0].nullsFirst,locale:re.locale,signal:ae.signal,key:"sort"}):ee.sortMulti(re.handles,re.entries.map((ge,Ae)=>({...ge,handle:re.handles[Ae]})),W,{signal:ae.signal,key:"sort"});if(!$(ue)){this.#b.delete("sort"),this.#B("sort",()=>Q,()=>ue);return}ue.then(ge=>this.#le(Q,ge),ge=>this.#he("sort",Q,ge))}#le(W,Q){const ee=this.#b.get("sort");if(!(!ee||ee.key!==W)){if(this.#ie()!==W){this.#b.delete("sort");return}this.#b.delete("sort"),this.#B("sort",()=>W,()=>Q),this.#Y=null,this.#I(),this.#Qe("model:changed",{reason:L[0]})}}#he(W,Q,ee){const re=this.#b.get(W);if(!(!re||re.key!==Q)&&(this.#b.delete(W),!(ee&&ee.name==="AbortError")&&W==="sort"&&this.#ie()===Q)){const ae=this.#B("filter",()=>this.#W(),()=>this.#Re());this.#B("sort",()=>Q,()=>this.#Fe(ae)),this.#Y=null,this.#I(),z("source.pipeline.sort","off-thread sort failed; recomputed on the main thread.",ee),this.#Qe("model:changed",{reason:L[1]})}}#Be(W,Q){const ee=W&&W.leaves?W.leaves.length:this.#m.slots.length;this.#m.matchCount=ee,this.#m.grand=Q&&Q.grand||null,this.#m.grandLeaves=W&&W.leaves?W.leaves.length:0,this.#m.groupLeaves=W&&W.leaves?W.leaves:null}#B(W,Q,ee){const re=this.#l.get(W),ae=Q();return re.computed&&re.key===ae||(re.result=ee(),re.key=ae,re.computed=!0,re.id++,W==="flatten"&&(this.#Y=null)),re.result}#C(W){return this.#l.get(W).id}#W(){const W=(this.#e.config||{}).hostFilter,Q=W&&X(W.active)&&W.active()?1:0,ee=this.#z("where",null),re=ee?ee.version:0,ae=this.#gt("filter.sig",`${this.#ut()}`,()=>w({filters:this.#z("filters",null),quick:this.#z("quick",""),quickMode:this.#z("quickMode","contains")}));return`${this.#u}|${ae}|${Q}|${re}`}#ie(){const W=this.#ce();return`${this.#C("filter")}|${JSON.stringify(this.#z("sort",[]))}`+(W?`|manual:${W.version}`:"")}#ce(){const W=this.#z("rowOrder",null);return W&&Array.isArray(W.keys)?W:null}#oe(W,Q){this.#p||this.#Ce();const ee=this.#p,re=this.#Ne(),ae=Q.keys.length,ue=new Float64Array(re);for(let ge=0;ge<re;ge++)ue[ge]=ae+ge;for(let ge=0;ge<ae;ge++){const Ae=ee.get(Q.keys[ge]);Ae!==void 0&&(ue[Ae]=ge)}return Uint32Array.from(W).sort((ge,Ae)=>ue[ge]-ue[Ae])}orderedKeys(){this.#p||this.#Ce();const W=this.#p,Q=new Map;for(const[ge,Ae]of W)Q.set(Ae,ge);const ee=Uint32Array.from([...Q.keys()]).sort(),re=this.#ce(),ae=re?this.#oe(ee,re):this.#Fe(ee),ue=new Array(ae.length);for(let ge=0;ge<ae.length;ge++)ue[ge]=Q.get(ae[ge]);return ue}#ge(){const W=this.#z("pivotBy",[]).length>0?"p":"u";return`${this.#C("sort")}|${JSON.stringify(this.#z("groupBy",[]))}|${W}`}#we(){const W=this.#Xe()?"f":"a",Q=(this.#e.config||{}).totalOnlyChangedColumns?"n":"w";return`${this.#C("group")}|${JSON.stringify(this.#z("totals",[]))}|${W}${Q}|${this.#c}`}#k(){return`${this.#C("group")}|${JSON.stringify(this.#z("pivotBy",[]))}`}#Se(){const Q=this.#He()||!this.#me()?this.#C("total"):"x",ee=`${this.#ut()}`,re=this.#gt("flatten.keys",ee,()=>{const ue=this.#z("expanded",null);return ue?[...ue].sort().join(""):"*"}),ae=this.#gt("flatten.detail",ee,()=>{const ue=this.#z("detail",null);return ue&&X(ue.signature)?ue.signature():""});return`${Q}|${this.#C("pivot")}|${re}|${ae}`}#He(){const W=this.#z("groupBy",[]);return Array.isArray(W)&&W.length>0}stageState(){const W=[];for(const[Q,ee]of this.#l){const re=ee.result;W.push({stage:Q,materialised:!!ee.computed,bytes:re&&typeof re.byteLength=="number"?re.byteLength:null,rows:re&&typeof re.length=="number"?re.length:null,rebuilds:ee.id})}return W}facetIndices(W){return this.#Re(W||null)}facetRows(W){const Q=this.facetIndices(W),ee=[];for(let re=0;re<Q.length;re++){const ae=this.#Ae(Q[re]);ae&&ee.push(ae)}return ee}invalidateRows(){this.#h.clear(),this.#F.clear(),this.#Y=null}invalidateHandles(){this.#o.invalidate()}rows(){return this.#n}unfilteredIndices(){return this.#ue()}filteredIndices(){const W=this.#l.get("filter");if(W&&W.computed&&W.key===this.#W())return W.result||this.#ue();this.#I();const Q=this.#l.get("filter");return(Q&&Q.computed?Q.result:null)||this.#ue()}unfilteredRows(){const W=this.#ue(),Q=[];for(let ee=0;ee<W.length;ee++){const re=this.#Ae(W[ee]);re&&Q.push(re)}return Q}#Re(W=null){const Q=this.#ue(),ee=this.#z("filters",null),re=W?this.#st("pruneColumn")(ee,W):ee,ae=this.#it(re),ue=String(this.#z("quick","")||"").trim().toLowerCase(),ge=ue?x(ue,String(this.#z("quickMode","contains")||"contains")):null,Ae=(this.#e.config||{}).hostFilter,pe=!!(Ae&&X(Ae.active)&&Ae.active()),Me=this.#z("where",null),Ne=!!(Me&&Me.active);if(!ae&&!ue&&!pe&&!Ne)return Q;let Pe=null;ae&&(Pe=this.#st("evaluateFilters")(ae,{handle:Ce=>this.#o.handle(Ce),count:this.#Ne(),pool:this.#e.pool,locale:(this.#e.config||{}).locale,itemwise:Ce=>R(this.#_e(Ce))}));const ie=new Uint32Array(Q.length);let Oe=0;for(let je=0;je<Q.length;je++){const Ce=Q[je];if(!(Pe&&!Pe[Ce])&&!(ge&&!this.#ct(Ce,ge))){if(pe||Ne){const fe=this.#Ae(Ce);if(pe&&!Ae.passes(fe)||Ne&&!Me.passes(fe.data,fe.key))continue}ie[Oe++]=Ce}}if(Pe){const je=(this.#e.compute||{}).releaseMask;X(je)&&je({pool:this.#e.pool},Pe)}return ie.subarray(0,Oe)}handleFor(W){return this.#o.handle(W)}#Fe(W){const Q=this.#ce();if(Q)return this.#oe(W,Q);const ee=this.#z("sort",[]).filter(ue=>{const ge=this.#_e(ue.col);return!ge||!ge.running?!0:(z(`source.sort.running.${ue.col}`,`sort ignores "${ue.col}": a running total is a function of the sort order, so it cannot also decide it. Sort by the column it runs over instead.`),!1)});if(!ee.length)return W;const re=(this.#e.config||{}).locale;if(ee.length===1){const ue=ee[0],ge=this.#o.handle(ue.col);if(!ge)return z(`source.sort.${ue.col}`,`sort ignores unknown column "${ue.col}".`),W;const Ae=this.#_e(ue.col);return this.#st("sortColumn")(ge,W,{descending:ue.dir==="desc",nullsFirst:ue.nullsFirst,locale:re,compare:P(Ae)})}const ae=[];for(const ue of ee){const ge=this.#o.handle(ue.col);if(!ge){z(`source.sort.${ue.col}`,`sort ignores unknown column "${ue.col}".`);continue}ae.push({handle:ge,descending:ue.dir==="desc",nullsFirst:ue.nullsFirst,locale:re,compare:P(this.#_e(ue.col))})}return ae.length?this.#st("sortMulti")(ae.map(ue=>ue.handle),ae,W):W}#Ye(W){const Q=this.#z("groupBy",[]),ee=this.#Oe();if(ee&&!Q.length){const je=p(W,ee);return this.#$=O(je.roots,ee.declaresChildren),{roots:null,leaves:W,nodes:new Map,tree:je}}if(this.#$=null,ee&&Q.length&&z("tree.grouped","grouping is active on a grid configured with `tree`; the grouping wins and the hierarchy is not shown."),!Q.length)return{roots:null,leaves:W,nodes:new Map};const re=(this.#e.config||{}).timeZone,ae=[],ue=[];let ge=!1;for(const je of Q){const Ce=this.#o.handle(je);if(!Ce){z(`source.group.${je}`,`grouping ignores unknown column "${je}".`);continue}ae.push(Ce);const fe=this.#_e(je),Ee=fe&&fe.dataType;if(Ee&&X(Ee.groupProjector)){const le=fe.typeOptions&&fe.typeOptions.timeZone||re||void 0,de=Ee.groupProjector(fe,le);ue.push(de||null),de&&(ge=!0)}else ue.push(null)}if(!ae.length)return{roots:null,leaves:W,nodes:new Map};const{keys:Ae,buckets:pe}=this.#st("groupByColumns")(ae,W,{locale:(this.#e.config||{}).locale,project:ge?ue:void 0}),Me=this.#z("pivotBy",[]).length>0,Ne=[],Pe=new Map;for(let je=0;je<pe.length;je++){const Ce=Ae[je];let fe=null;const Ee=[];for(let le=0;le<Ce.length;le++){Ee.push(d(Ce[le]));const de=c(Ee),Se=le===Ce.length-1;let Fe=Pe.get(de);if(!Fe){const ke=this.#i.group({path:[...Ee],column:Q[le],value:Ce[le],level:le,parent:fe,expanded:Me&&Se?!1:this.#pt(de,{key:de,column:Q[le],value:Ce[le],level:le,path:[...Ee]}),hasChildren:!(Me&&Se)});Fe={row:ke,leaves:null},Pe.set(de,Fe),fe?fe.children.push(ke):Ne.push(ke)}Fe.row.leafCount+=pe[je].length,le===Ce.length-1&&(Fe.leaves=pe[je]),fe=Fe.row}}const ie=this.#z("sort",[])||[],Oe=(je,Ce)=>{if(!je||je.length<2){if(je)for(const de of je)Oe(de.children,Ce+1);return}const fe=Q[Ce],Ee=ie.find(de=>de.col===fe),le=Ee&&Ee.dir==="desc"?-1:1;je.sort((de,Se)=>le*Y(de.groupValue,Se.groupValue));for(const de of je)Oe(de.children,Ce+1)};return Oe(Ne,0),{roots:Ne,leaves:W,nodes:Pe,keys:Ae,buckets:pe}}#ze(W,Q){const ee=new Map,re=new Map,ae=ue=>{const ge=ue.physical>=0?[ue.physical]:[];for(const Ae of ue.children)ge.push(...ae(Ae));if(ue.children.length){const Ae=this.#rt(Q,Uint32Array.from(ge),null);ue.physical>=0?ee.set(ue.physical,Ae):re.set(ue.key,Ae)}return ge};for(const ue of W.roots)ae(ue);return{byPhysical:ee,byKey:re}}#We(W){const Q=this.#Ze();if(!Q.length)return this.#M=null,this.#P=null,{grand:null};const ee={id:this.#C("group"),columns:Q.map(ie=>ie.id).join("")},re=this.#M&&this.#M.id===ee.id&&this.#M.columns===ee.columns,ae=this.#Ke()&&re?this.#E:null,ue=ae?Q.filter(ie=>ae.has(ie.id)):Q,ge=re?this.#P:null,Ae=this.#Xe()?null:this.#tt(),pe=this.#be(Q),Me=ie=>{const Oe=W.nodes.get(ie.key);let je=Oe&&Oe.leaves?Oe.leaves:null;if(ie.children&&ie.children.length){const Ee=ie.children.map(Me);let le=0;for(const Fe of Ee)le+=Fe.length;const de=new Uint32Array(le);let Se=0;for(const Fe of Ee)de.set(Fe,Se),Se+=Fe.length;je=de}je=je||new Uint32Array(0);const Ce=Ae?Ae.get(ie.key)||C:je,fe=this.#at(ie,ae?ue:Q,Ce,pe);return ie.totals=ae?{...ie.totals,...fe}:fe,je};if(W.roots&&ue.length)for(const ie of W.roots)Me(ie);if(this.#_=W.tree?this.#ze(W.tree,Q):null,this.#M=ee,this.#E=this.#Ke()?new Set:null,!(this.#e.config||{}).grandTotalRow)return this.#O.length=0,this.#P=null,{grand:null};const Pe=Ae?this.#qe():W.leaves;return this.#P=this.#Ve(Q,Pe,ae,ge),{grand:this.#P}}#Ve(W,Q,ee,re){const ae={},ue=this.#C("group");ue!==this.#w&&(this.#St(),this.#w=ue);const ge=this.#O;this.#O=[];for(const Ae of W){if(!I(Ae))continue;const pe=this.#o.handle(Ae.id);if(!pe)continue;const Me=T(Ae,"grand");if(!u(Me,pe)){if(ee&&!ee.has(Ae.id)&&re&&Ae.id in re){ae[Ae.id]=re[Ae.id];continue}ae[Ae.id]=this.#rt([Ae],Q,null,"grand")[Ae.id];continue}let Ne=this.#A.get(Ae.id);if((!Ne||Ne.fn!==Me)&&(Ne=new t(Me),this.#A.set(Ae.id,Ne)),Ne.valid){let Pe=!0;for(const ie of ge)if(ie.colId===Ae.id&&!Ne.update(ie.before,ie.after)){Pe=!1;break}if(Pe){ae[Ae.id]=Ne.value();continue}Ne.invalidate()}Ne.seedColumn(pe.values,o(pe),Q),ae[Ae.id]=Ne.valid?Ne.value():this.#rt([Ae],Q,null,"grand")[Ae.id]}return ae}#be(W){const Q=this.#C("group");Q!==this.#T&&(this.#v.clear(),this.#T=Q);const ee=new Map;for(const ae of W){if(!I(ae))continue;const ue=this.#o.handle(ae.id),ge=T(ae,"group");u(ge,ue)&&ee.set(ae.id,{fn:ge})}if(!ee.size)return this.#S.length=0,ee;const re=this.#S;this.#S=[];for(const ae of re){const{beforeKeys:ue,afterKeys:ge,colDeltas:Ae}=ae,pe=ue.length?new Set(ue):null,Me=ge.length?new Set(ge):null;for(const{colId:Ne,before:Pe,after:ie}of Ae)if(ee.has(Ne)){for(const Oe of ue)Me&&Me.has(Oe)||this.#ke(Oe,Ne,Pe,null);for(const Oe of ge)pe&&pe.has(Oe)||this.#ke(Oe,Ne,null,ie);for(const Oe of ue)Me&&!Me.has(Oe)||this.#ke(Oe,Ne,Pe,ie)}}return ee}#ke(W,Q,ee,re){const ae=this.#v.get(W),ue=ae&&ae.get(Q);!ue||!ue.valid||ue.update(ee,re)||ue.invalidate()}#at(W,Q,ee,re){if(!re||!re.size)return this.#rt(Q,ee,W);const ae={};let ue=null,ge=this.#v.get(W.key);for(const Ae of Q){const pe=re.get(Ae.id);if(!pe){(ue||(ue=[])).push(Ae);continue}const Me=this.#o.handle(Ae.id);if(!Me)continue;ge||(ge=new Map,this.#v.set(W.key,ge));let Ne=ge.get(Ae.id);if((!Ne||Ne.fn!==pe.fn)&&(Ne=new t(pe.fn),ge.set(Ae.id,Ne)),Ne.valid||Ne.seedColumn(Me.values,o(Me),ee),Ne.valid){ae[Ae.id]=Ne.value();continue}(ue||(ue=[])).push(Ae)}return ue&&Object.assign(ae,this.#rt(ue,ee,W)),ae}#Tt(W,Q,ee,re){const ae=!this.#Xe()||this.#Ot(Q);for(const ue of W){const ge=ue.getValue;if(!X(ge))continue;const Ae=ge(ee),pe=ge(re);Object.is(Ae,pe)||(this.#E&&this.#E.add(ue.id),ae&&this.#A.has(ue.id)&&this.#O.push({colId:ue.id,before:Ae,after:pe}))}}#kt(){const W=this.#z("groupBy",[]),Q=[];for(const ee of W){const re=this.#_e(ee);re&&Q.push(re)}return Q}#ee(W,Q){const ee=new Array(W.length);for(let re=0;re<W.length;re++){const ae=W[re].getValue;ee[re]=d(X(ae)?ae(Q):void 0)}return ee}#lt(W,Q,ee,re,ae){if(this.#Xe()&&!this.#Ot(ee))return;const ue=l(this.#ee(W,re)),ge=l(this.#ee(W,ae)),Ae=ue.length!==ge.length||ue.some((Me,Ne)=>Me!==ge[Ne]),pe=[];for(const Me of Q){const Ne=Me.getValue;if(!X(Ne))continue;const Pe=Ne(re),ie=Ne(ae);!Ae&&Object.is(Pe,ie)||pe.push({colId:Me.id,before:Pe,after:ie})}!pe.length&&!Ae||this.#S.push({beforeKeys:ue,afterKeys:ge,colDeltas:pe})}#Ot(W){const Q=this.#l.get("filter"),ee=Q&&Q.computed?Q.result:null;if(!ee)return!0;let re=0,ae=ee.length-1;for(;re<=ae;){const ue=re+ae>>1,ge=ee[ue];if(ge===W)return!0;ge<W?re=ue+1:ae=ue-1}return!1}#Xe(){return(this.#e.config||{}).totalFilteredOnly!==!1}#et(W){return this.#Xe()?W:this.#qe().length}#qe(){return(!this.#N||this.#N.version!==this.#u)&&(this.#N={version:this.#u,indices:this.#ue()}),this.#N.indices}#tt(){const W=this.#z("groupBy",[]),Q=`${this.#u}|${JSON.stringify(W)}`;if(this.#R&&this.#R.key===Q)return this.#R.map;const ee=new Map,re=[];for(const ae of W){const ue=this.#o.handle(ae);ue&&re.push(ue)}if(re.length){const ae=this.#qe(),{keys:ue,buckets:ge}=this.#st("groupByColumns")(re,ae,{locale:(this.#e.config||{}).locale}),Ae=new Map;for(let pe=0;pe<ge.length;pe++){const Me=ue[pe],Ne=[];for(let Pe=0;Pe<Me.length;Pe++){Ne.push(d(Me[Pe]));const ie=c(Ne);let Oe=Ae.get(ie);Oe||(Oe=[],Ae.set(ie,Oe));for(let je=0;je<ge[pe].length;je++)Oe.push(ge[pe][je])}}for(const[pe,Me]of Ae)ee.set(pe,Uint32Array.from(Me))}return this.#R={key:Q,map:ee},ee}#Ke(){return!!(this.#e.config||{}).totalOnlyChangedColumns}#nt(){this.#St(),this.#j(),this.#E=null,this.#M=null,this.#P=null}#St(){this.#A.clear(),this.#O.length=0,this.#w=-1}#j(){this.#v.clear(),this.#S.length=0,this.#T=-1}#At(W){const Q=this.#z("pivotBy",[]);if(!Q.length)return this.#fe=null,null;const ee=(this.#e.compute||{}).pivot;if(!X(ee))return z("source.pivot.kernel","pivot requested but ctx.compute.pivot is not available; showing unpivoted rows."),this.#fe=null,null;const re=Q.map(ue=>this.#o.handle(ue)).filter(Boolean),ae=this.#Ze();return this.#fe=ee(re,W.leaves,{groups:W.keys&&W.buckets?{keys:W.keys,buckets:W.buckets}:null,totals:ae.map(ue=>ue.id),handle:ue=>this.#o.handle(ue),totalOf:ue=>T(ae.find(ge=>ge.id===ue),"group"),separator:((this.#e.config||{}).pivot||{}).separator,maxColumns:((this.#e.config||{}).pivot||{}).maxColumns})||null,this.#fe}#Ge(W){const Q=this.#l.get("total").result,ee=!!(this.#e.config||{}).groupFooter,re=this.#xe();if(W.tree)return this.#jt(W,Q,re);if(!W.roots&&!re){if(Q&&Q.grand&&!this.#me()){const Me=this.#i.grandTotal(Q.grand,this.#et(W.leaves.length));if(this.#K===W.leaves&&Array.isArray(this.#x))this.#x[this.#x.length-1]=Me;else{const Ne=Array.from(W.leaves);Ne.push(Me),this.#x=Ne,this.#K=W.leaves}this.#H=[{at:this.#x.length-1}]}else this.#K=null,this.#x=W.leaves,this.#H=F;return this.#U=F,this.#x}const ae=[],ue=[],ge=[],Ae=Me=>{if(ae.push(Me),!re)return;const Ne=this.#Ae(Me);!Ne||!re.isOpen(Ne.key)||(Ne.master=!0,Ne.expanded=!0,ge.push({at:ae.length}),ae.push(this.#i.detail(Ne,re.heightOf(Ne))))};if(!W.roots){for(let Me=0;Me<W.leaves.length;Me++)Ae(W.leaves[Me]);return Q&&Q.grand&&!this.#me()&&(ge.push({at:ae.length}),ae.push(this.#i.grandTotal(Q.grand,this.#et(W.leaves.length)))),this.#K=null,this.#U=F,this.#H=ge.length?ge:F,this.#x=ae,ae}const pe=(Me,Ne,Pe)=>{if(Me.expanded=Me.hasChildren===!1?!1:this.#pt(Me.key,{key:Me.key,column:Me.groupColumn,value:Me.groupValue,level:Me.level,path:Me.groupPath}),Me.posinset=Ne+1,Me.setsize=Pe,ue.push({at:ae.length,row:Me}),ge.push({at:ae.length}),ae.push(Me),!!Me.expanded){if(Me.children&&Me.children.length)for(let ie=0;ie<Me.children.length;ie++)pe(Me.children[ie],ie,Me.children.length);else{const ie=W.nodes.get(Me.key),Oe=ie&&ie.leaves?ie.leaves:null;if(Oe)for(let je=0;je<Oe.length;je++)Ae(Oe[je])}ee&&Me.totals&&(ge.push({at:ae.length}),ae.push(this.#i.footer(Me)))}};for(let Me=0;Me<W.roots.length;Me++)pe(W.roots[Me],Me,W.roots.length);return Q&&Q.grand&&!this.#me()&&(ge.push({at:ae.length}),ae.push(this.#i.grandTotal(Q.grand,this.#et(W.leaves.length)))),this.#U=ue,this.#H=ge,this.#x=ae,ae}#ue(){const W=this.#e.store;if(W&&X(W.liveIndices))return W.liveIndices();const Q=new Uint32Array(this.#n.length);let ee=0;for(let re=0;re<this.#n.length;re++)this.#n[re]!==void 0&&(Q[ee++]=re);return Q.subarray(0,ee)}#Ne(){const W=this.#e.store;return W&&typeof W.physical=="number"?W.physical:this.#n.length}#ae(W){const Q=this.#e.store;return Q&&X(Q.source)?Q.source(W):this.#n[W]}#$e(W,Q=W){const ee=this.#x[W];if(typeof ee!="number")return ee.index=Q,ee;const re=this.#Ae(ee);return re.index=Q,re}#Ae(W){let Q=this.#h.get(W);Q||(Q=this.#i.leaf(this.#ae(W),W),this.#h.set(W,Q));const ee=this.#$?this.#$.get(W):null;if(ee){Q.level=ee.level,Q.posinset=ee.posinset,Q.setsize=ee.setsize,Q.hasChildren=ee.hasChildren,Q.expanded=ee.hasChildren&&!ee.lazy&&this.#pt(Q.key);const re=this.#_?this.#_.byPhysical.get(W):void 0;re?Q.totals=re:Q.totals&&(Q.totals=null)}else Q.hasChildren&&(Q.level=0,Q.hasChildren=!1,Q.expanded=!1,Q.posinset=void 0,Q.setsize=void 0);return Q}#jt(W,Q,ee){const re=[],ae=[],ue=Ae=>{if(Ae.leafCount!==void 0)return Ae.leafCount;let pe=Ae.physical>=0?1:0;for(const Me of Ae.children)pe+=ue(Me);return Ae.leafCount=pe,pe},ge=Ae=>{const pe=this.#pt(Ae.key);if(Ae.physical>=0){if(re.push(Ae.physical),ee&&ee.isOpen(this.#Ae(Ae.physical).key)){const Me=this.#Ae(Ae.physical);ae.push({at:re.length}),re.push(this.#i.detail(Me,ee.heightOf(Me)))}}else re.push(this.#i.group({path:[Ae.key],column:null,value:Ae.value,level:Ae.level,parent:null,expanded:pe,hasChildren:Ae.children.length>0,leafCount:ue(Ae),totals:this.#_?this.#_.byKey.get(Ae.key):void 0}));if(pe)for(const Me of Ae.children)ge(Me)};for(const Ae of W.tree.roots)ge(Ae);return Q&&Q.grand&&!this.#me()&&(ae.push({at:re.length}),re.push(this.#i.grandTotal(Q.grand,this.#et(W.leaves.length)))),this.#K=null,this.#U=F,this.#H=ae.length?ae:F,this.#x=re,re}#Nt(){return i(()=>this.count(),W=>this.at(W))}#ct(W,Q){let ee=this.#F.get(W);if(ee===void 0){const re=this.#ae(W),ae=this.#ot(),ue=[],ge=this.#e.columnHidden;for(const Ae of ae){if(Ae.quickFilter===!1||X(ge)&&ge(Ae.id))continue;const pe=Ae.value&&X(Ae.value.quickFilterText)?Ae.value.quickFilterText({value:void 0,data:re,row:null,column:Ae,colId:Ae.id,grid:null,context:this.#z("context",null)}):null,Me=pe??(X(Ae.formatValue)?Ae.formatValue(X(Ae.getValue)?Ae.getValue(re):void 0):"");Me!=null&&Me!==""&&ue.push(String(Me))}ee=ue.join(" ").toLowerCase(),this.#F.set(W,ee)}return Q(ee)}#Ze(){const W=this.#z("totals",[]),Q=W&&W.length?new Set(W):null;return this.#ot().filter(ee=>Q?Q.has(ee.id):!!(ee.total||ee.groupTotal||ee.grandTotal))}#rt(W,Q,ee,re="group"){const ae={},ue=(this.#e.compute||{}).total;for(const ge of W){if(!I(ge))continue;const Ae=this.#o.handle(ge.id);if(!Ae)continue;const pe=T(ge,re);if(pe)if(X(pe)){const Me=new Array(Q.length);for(let Ne=0;Ne<Q.length;Ne++)Me[Ne]=Ae.get(Q[Ne]);ae[ge.id]=pe(Me,{row:ee,column:ge,grid:this.#e.grid||null,context:this.#z("context",null),valueAt:(Ne,Pe)=>{const ie=this.#o.handle(Ne);return ie&&Pe>=0&&Pe<Q.length?ie.get(Q[Pe]):null}})}else X(ue)&&(ae[ge.id]=ue(Ae,Q,pe))}return ae}#it(W){if(!W)return W;const Q=this.#e.config||{},ee={tz:Q.timeZone,weekStartsOn:Q.weekStartsOn};return m(W,re=>{const ae=v(re,ee),ue=this.#_e(ae&&ae.col),ge=ue&&ue.type==="datetime";if(ae&&ae.type)return ae.type==="datetime"&&!ae.timeZone&&ue?{...ae,timeZone:Q.timeZone||void 0}:ae;if(ge)return{...ae,type:"datetime",timeZone:Q.timeZone||void 0};const Ae=ue&&(ue.dataType?.base||ue.type);return Ae?{...ae,type:Ae}:ae})}#pt(W,Q){const ee=this.#z("expanded",null);return ee?X(ee.has)?ee.has(W,Q):Array.prototype.includes.call(ee,W):!0}#z(W,Q){if(W==="context"||!X(this.#e.stateVersion))return this.#Mt(W,Q);const ee=this.#mt(W),re=this.#f.get(W);if(re&&re.version===ee)return re.value;const ae=this.#Mt(W,Q);return this.#f.set(W,{version:ee,value:ae}),ae}#Mt(W,Q){const ee=this.#e.state;if(ee&&X(ee[W])){const re=ee[W]();return re??Q}return Q}#ut(){const W=this.#e.stateVersion;return X(W)?W():0}#Dt(){const W=this.#e.columnsVersion,Q=this.#e.permissionsVersion;return`${X(W)?W():0}|${X(Q)?Q():0}`}#mt(W){return W==="totals"?this.#Dt():`${this.#ut()}`}#gt(W,Q,ee){if(!X(this.#e.stateVersion))return ee();const re=this.#d.get(W);if(re&&re.version===Q)return re.key;const ae=ee();return this.#d.set(W,{version:Q,key:ae}),ae}#st(W){const Q=(this.#e.compute||{})[W];return X(Q)||_(`ctx.compute.${W} is required by the memory source pipeline`),Q}#ot(){const W=this.#e.columns;return W&&X(W.all)?W.all():[]}#_e(W){const Q=this.#e.columns;return Q&&X(Q.get)?Q.get(W):void 0}#Qe(W,Q){const ee=this.#e.emit;X(ee)&&ee(W,Q)}}}),Ue("packages/core/src/source/abort.js",function(e,U){"use strict";Object.defineProperty(e,"SupersededError",{enumerable:!0,get:function(){return te}}),Object.defineProperty(e,"RequestToken",{enumerable:!0,get:function(){return E}}),Object.defineProperty(e,"AbortScope",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"createAbortScope",{enumerable:!0,get:function(){return z}}),Object.defineProperty(e,"isAbortError",{enumerable:!0,get:function(){return _}});class te extends Error{constructor(X,B="superseded"){super(`[lattice] request ${X?`"${X}" `:""}${B}`),this.name="SupersededError",this.superseded=!0,this.key=X}}class E{#e;constructor(X,B,Y,G){this.#e=X,this.key=B,this.controller=Y,this.signal=Y.signal,this.seq=G}get current(){return!this.signal.aborted&&this.#e.tokenFor(this.key)===this}settle(){this.#e.settle(this)}abort(X){this.signal.aborted||this.controller.abort(new te(this.key,X)),this.#e.settle(this)}}class q{#e=new Map;#t=0;begin(X="",B="superseded"){const Y=this.#e.get(X);Y&&!Y.signal.aborted&&Y.controller.abort(new te(X,B));const G=new E(this,X,new AbortController,++this.#t);return this.#e.set(X,G),G}tokenFor(X){return this.#e.get(X)}pending(X=""){const B=this.#e.get(X);return!!B&&!B.signal.aborted}get size(){return this.#e.size}settle(X){this.#e.get(X.key)===X&&this.#e.delete(X.key)}abort(X="",B="superseded"){const Y=this.#e.get(X);Y&&Y.abort(B)}abortAll(X="superseded"){for(const B of[...this.#e.values()])B.abort(X);this.#e.clear()}}function z(){return new q}function _(Z){if(!Z||typeof Z!="object")return!1;const X=Z;return X.superseded===!0||X.name==="AbortError"||X.name==="SupersededError"}}),Ue("packages/core/src/source/blockcache.js",function(e,U){"use strict";Object.defineProperty(e,"DEFAULT_PAGE_SIZE",{enumerable:!0,get:function(){return te}}),Object.defineProperty(e,"DEFAULT_MAX_CACHED_PAGES",{enumerable:!0,get:function(){return E}}),Object.defineProperty(e,"BlockCache",{enumerable:!0,get:function(){return z}});const te=100,E=32;class q{constructor(Z){this.id=Z,this.rows=null,this.state="pending",this.token=null,this.error=null}}class z{#e=new Map;#t;#n;#r=0;#s=-1;constructor(Z={}){this.#t=Math.max(1,Math.floor(Number(Z.pageSize)||te)),this.#n=Math.max(1,Math.floor(Number(Z.maxCachedPages)||E))}get pageSize(){return this.#t}get maxBlocks(){return this.#n}get size(){return this.#e.size}blockOf(Z){return Math.floor(Z/this.#t)}rangeOf(Z){return{start:Z*this.#t,end:(Z+1)*this.#t}}has(Z){return this.#e.has(Z)}pending(Z){const X=this.#e.get(Z);return!!X&&X.state==="pending"}loaded(Z){const X=this.#e.get(Z);return!!X&&X.state==="loaded"}begin(Z,X){let B=this.#e.get(Z);return B||(B=new q(Z)),B.state="pending",B.token=X,B.error=null,this.#i(Z,B),B}fill(Z,X){const B=this.#e.get(Z)||new q(Z);B.rows=X,B.state="loaded",B.token=null,this.#i(Z,B)}failed(Z,X){const B=this.#e.get(Z)||new q(Z);B.state="error",B.error=X,B.token=null,this.#i(Z,B)}delete(Z){return this.#e.delete(Z)}rowAt(Z){const X=this.blockOf(Z),B=this.#e.get(X);if(!(!B||B.state!=="loaded"||!B.rows))return this.#i(X,B),B.rows[Z-X*this.#t]}rowLoaded(Z){const X=this.blockOf(Z),B=this.#e.get(X);return!!B&&B.state==="loaded"&&!!B.rows&&Z-X*this.#t<B.rows.length}erroredAt(Z){const X=this.#e.get(this.blockOf(Z));return!!X&&X.state==="error"}loadedExtent(){let Z=0;for(const X of this.#e.values()){if(X.state!=="loaded"||!X.rows)continue;const B=X.id*this.#t+X.rows.length;B>Z&&(Z=B)}return Z}fillOf(Z){const X=this.#e.get(Z);return X&&X.state==="loaded"&&X.rows?X.rows.length:null}protect(Z,X){this.#r=this.blockOf(Math.max(0,Z)),this.#s=this.blockOf(Math.max(0,X))}evict(){const Z=[];if(this.#e.size<=this.#n)return Z;for(const[X,B]of this.#e){if(this.#e.size-Z.length<=this.#n)break;X>=this.#r&&X<=this.#s||B.state!=="pending"&&Z.push(X)}for(const X of Z)this.#e.delete(X);return Z}ids(){return[...this.#e.keys()]}clear(){this.#e.clear()}#i(Z,X){this.#e.delete(Z),this.#e.set(Z,X)}}}),Ue("packages/core/src/source/pagewindow.js",function(e,U){"use strict";Object.defineProperty(e,"pageWindow",{enumerable:!0,get:function(){return te}});function te(E,q,z,_){const Z=Math.floor(Number(E)||0);if(Z<=0)return null;const X=Math.max(0,Math.floor(Number(q)||0)),B=Math.max(0,Math.floor(Number(z)||0));if(_){const Y=Math.max(1,Math.ceil(B/Z)),G=Math.min(X,Y-1),j=G*Z;return{page:G,pageSize:Z,offset:j,length:Math.max(0,Math.min(Z,B-j)),pageCount:Y,total:B}}return{page:X,pageSize:Z,offset:X*Z,length:Z,pageCount:Math.max(X+2,Math.ceil(B/Z)),total:null}}}),Ue("packages/core/src/source/paged.js",function(e,U){"use strict";Object.defineProperty(e,"HINT_SETTLE_MS",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"createPagedSource",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"PagedSource",{enumerable:!0,get:function(){return w}});const E=U("packages/core/src/internal/lru.js").Lru,z=U("packages/core/src/internal/predicates.js").isFunction,Z=U("packages/core/src/internal/warn.js").warnOnce,B=U("packages/core/src/internal/schedule.js").settleDebounce,Y=U("packages/core/src/source/abort.js"),G=Y.createAbortScope,j=Y.isAbortError,k=U("packages/core/src/source/blockcache.js"),g=k.BlockCache,c=k.DEFAULT_PAGE_SIZE,d=k.DEFAULT_MAX_CACHED_PAGES,i=U("packages/core/src/source/rows.js").createRowFactory,n=U("packages/core/src/source/filterwire.js"),a=n.wireFilters,s=n.querySignature,t=n.warnHostFilterNotApplied,r=U("packages/core/src/source/pagewindow.js").pageWindow,o=120;function f(m,v){return new w(m,v)}class w{mode="paged";#e;#t;#n;#r=G();#s;#i;#o=new Map;#l=null;#a=null;#c=!1;#u=0;#f="";#d={start:0,end:0};#h;#p=!1;#m=0;#g="";constructor(v,h){this.#e=v||{mode:"paged"},this.#t=h||{},this.#n=new g({pageSize:this.#e.pageSize||c,maxCachedPages:this.#e.maxCachedPages||d}),this.#s=i(this.#t),this.#i=new E(this.#n.pageSize*4),this.#h=B((p,b)=>this.#w(p,b),o),this.#f=this.#E(),z(this.#e.fetch)||Z("source.paged.fetch",'source.mode "paged" requires a fetch function; the grid will stay empty.'),t(this.#t)}count(){const v=this.#y();return v?v.length:this.#b()}#b(){if(this.#T(),this.#l!==null)return this.#l;const v=Math.max(this.#u,this.#n.loadedExtent());return this.#c?v:v+this.#n.pageSize}matchCount(){return this.#b()}totalCount(){return this.#b()}pageInfo(){const v=this.#y();if(!v){const h=this.#b();return{page:0,pageSize:0,total:this.exact()?h:null,pageCount:1,counting:!1}}return{page:v.page,pageSize:v.pageSize,total:v.total,pageCount:v.pageCount,counting:v.total===null&&this.#r.size>0&&this.#u===0&&this.#n.loadedExtent()===0}}#y(){const v=this.#b(),h=r(this.#P("pageSize",0),this.#P("page",0),v,this.exact());if(!h)return this.#g="",null;const p=`${this.#m}:${h.offset}:${h.length}`;if(p!==this.#g&&!this.#p&&(this.#g=p,h.length>0)){const b=h.offset+h.length-1;this.#d={start:h.offset,end:b},this.#w(h.offset,b)}return h}at(v){const h=this.#y();if(h){if(v<0||v>=h.length)return;const p=this.#A(h.offset+v);return p&&(p.index=v),p}return this.#A(v)}#A(v){if(v<0||v>=this.#b())return;const h=this.#i.get(v);if(h&&(h.data!==null||!this.#n.rowLoaded(v)))return h;const p=this.#n.rowAt(v);if(p===void 0){const O=this.#s.skeleton(v,0,this.#n.erroredAt(v));return this.#i.set(v,O),O}const b=this.#s.leaf(p,v);return b.index=v,this.#i.set(v,b),this.#o.set(b.key,v),b}byKey(v){const h=this.#o.get(v);return h===void 0?void 0:this.#A(h)}loaded(v){const h=this.#y();return h?v>=0&&v<h.length&&this.#n.rowLoaded(h.offset+v):this.#n.rowLoaded(v)}loadedCount(){this.#T();let v=0;for(const h of this.#n.ids()){if(!this.#n.loaded(h))continue;const p=this.#n.fillOf(h);typeof p=="number"&&(v+=p)}return v}residentRows(){this.#T();const v=this.#y(),h=v?v.offset:0,p=v?v.offset+v.length:1/0,b=[],O=this.#n.ids().sort((y,L)=>y-L);for(const y of O){if(!this.#n.loaded(y))continue;const{start:L}=this.#n.rangeOf(y),M=this.#n.fillOf(y)||0;for(let D=L;D<L+M;D++){if(D<h||D>=p)continue;const F=this.#i.peek(D);if(F&&F.data!==null&&F.data!==void 0){b.push(F);continue}const T=this.#n.rowAt(D);if(T===void 0)continue;const I=this.#s.leaf(T,D);I.index=D,this.#i.set(D,I),this.#o.set(I.key,D),b.push(I)}}return b}hint(v,h){if(this.#p)return;const p=this.#T();let b=Math.max(0,Math.floor(v)),O=Math.max(b,Math.floor(h));const y=this.#y();if(y){if(y.length===0)return;b=y.offset,O=y.offset+y.length-1}this.#d={start:b,end:O},this.#n.protect(b,O);for(const L of this.#n.evict())this.#v(L);this.#h(b,O),p&&this.#h.flush()}#w(v,h){if(this.#p)return;this.#n.protect(v,h);const p=this.#n.blockOf(v),b=this.#n.blockOf(h);for(let O=p;O<=b&&!(this.#l!==null&&O*this.#n.pageSize>=this.#l);O++)this.#n.has(O)||this.#O(O)}apply(v){const h={added:[],updated:[],removed:[]};if(!v)return h;if(v.update)for(const p of v.update){const b=this.#s.keyOf(p,-1),O=this.#o.get(b);if(O===void 0)continue;const y=this.#s.leaf(p,O);y.index=O,this.#i.set(O,y),h.updated.push(y)}return(v.add&&v.add.length||v.remove&&v.remove.length)&&this.reload(),h}reload(v){this.#S("reload"),this.#h.cancel(),this.hint(this.#d.start,this.#d.end)}destroy(){this.#p=!0,this.#h.cancel(),this.#r.abortAll("destroyed"),this.#n.clear(),this.#i.clear(),this.#o.clear()}exact(){return this.#l!==null||this.#c}pending(){return this.#r.size}async#O(v){if(!z(this.#e.fetch))return;const h=this.#r.begin(`block:${v}`);this.#n.begin(v,h);const{start:p,end:b}=this.#n.rangeOf(v),O=this.#f;try{const y=await this.#e.fetch({range:{start:p,end:b},sort:this.#P("sort",[]),filters:a(this.#P("filters",null),this.#M()),quick:this.#P("quick","")||void 0,context:this.#P("context",null),signal:h.signal});if(!h.current||O!==this.#f||this.#p)return;h.settle();const L=y&&y.rows||[];this.#n.fill(v,L);for(let D=0;D<L.length;D++)this.#i.delete(p+D);const M=y&&typeof y.total=="number"?y.total:y&&typeof y.count=="number"?y.count:null;M!==null?(this.#l=M,this.#c=!0):L.length<this.#n.pageSize?(this.#c=!0,this.#l=p+L.length):this.#u=Math.max(this.#u,p+L.length),this.#N("model:changed",{reason:"page",block:v,from:p,to:p+L.length}),this.#N("rows:changed",{companion:!0,reason:"page",block:v,from:p,to:p+L.length}),this.#l!==null&&this.#l!==this.#a&&(this.#a=this.#l,this.#N("source:total",{total:this.#l,groupPath:[]}))}catch(y){if(h.settle(),j(y))return;this.#n.failed(v,y);for(let L=p;L<b;L++)this.#i.delete(L);this.#N("model:changed",{reason:"page-error",block:v,range:{start:p,end:b}}),this.#N("source:error",{error:y,block:v,range:{start:p,end:b}})}}#v(v){const{start:h,end:p}=this.#n.rangeOf(v);for(let b=h;b<p;b++){const O=this.#i.peek(b);O&&this.#o.delete(O.key),this.#i.delete(b)}}#T(){const v=this.#E();return v===this.#f?!1:(this.#f=v,this.#S("query"),!0)}#S(v){this.#r.abortAll(v),this.#n.clear(),this.#i.clear(),this.#o.clear(),this.#l=null,this.#a=null,this.#c=!1,this.#u=0,this.#m++,this.#N("model:changed",{reason:v})}#E(){return s({filters:this.#P("filters",null),sort:this.#P("sort",[]),quick:this.#P("quick",""),context:this.#P("context",null)})}#M(){const v=this.#t.config||{};return{tz:v.timeZone,weekStartsOn:v.weekStartsOn}}#P(v,h){const p=this.#t.state;if(p&&z(p[v])){const b=p[v]();return b??h}return h}#N(v,h){const p=this.#t.emit;z(p)&&p(v,h)}}}),Ue("packages/core/src/source/aggregates.js",function(e,U){"use strict";Object.defineProperty(e,"STAT_PUSHDOWN",{enumerable:!0,get:function(){return te}}),Object.defineProperty(e,"pushableAggregates",{enumerable:!0,get:function(){return E}}),Object.defineProperty(e,"fillAggregateSql",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"resolveAggregatesConfig",{enumerable:!0,get:function(){return z}}),Object.defineProperty(e,"routeAggregate",{enumerable:!0,get:function(){return _}}),Object.defineProperty(e,"resolveAggregatePlan",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"groupKeysPushable",{enumerable:!0,get:function(){return B}}),Object.defineProperty(e,"pushdownDocRows",{enumerable:!0,get:function(){return Y}});const te=Object.freeze({sum:{pushable:!0,class:"identical",sql:"sum(%c)"},avg:{pushable:!0,class:"identical",sql:"avg(%c)"},min:{pushable:!0,class:"identical",sql:"min(%c)"},max:{pushable:!0,class:"identical",sql:"max(%c)"},count:{pushable:!0,class:"identical",sql:"count(*)"},countValues:{pushable:!0,class:"identical",sql:"count(%c)",blankAware:!0},range:{pushable:!0,class:"identical",sql:"(max(%c) - min(%c))"},variance:{pushable:!0,class:"identical",sql:"var_samp(%c)"},varianceP:{pushable:!0,class:"identical",sql:"var_pop(%c)"},stddev:{pushable:!0,class:"identical",sql:"stddev_samp(%c)"},stddevP:{pushable:!0,class:"identical",sql:"stddev_pop(%c)"},sumSquares:{pushable:!0,class:"identical",sql:"sum(%c * %c)"},median:{pushable:!0,class:"identical",sql:"median(%c)"},p25:{pushable:!0,class:"identical",sql:"quantile_cont(%c, 0.25)"},p75:{pushable:!0,class:"identical",sql:"quantile_cont(%c, 0.75)"},p90:{pushable:!0,class:"identical",sql:"quantile_cont(%c, 0.9)"},p95:{pushable:!0,class:"identical",sql:"quantile_cont(%c, 0.95)"},p99:{pushable:!0,class:"identical",sql:"quantile_cont(%c, 0.99)"},iqr:{pushable:!0,class:"identical",sql:"(quantile_cont(%c, 0.75) - quantile_cont(%c, 0.25))"},mad:{pushable:!0,class:"identical",sql:"mad(%c)"},distinct:{pushable:!0,class:"identical",sql:"count(DISTINCT %c)",blankAware:!0},skewness:{pushable:!0,class:"identical",sql:"skewness(%c)"},kurtosis:{pushable:!0,class:"identical",sql:"kurtosis(%c)"},geomean:{pushable:!0,class:"identical",sql:"exp(avg(ln(%c)))"},harmean:{pushable:!0,class:"identical",sql:"(count(%c) / sum(1.0 / %c))"},entropy:{pushable:!0,class:"identical",sql:"entropy(%c)",blankAware:!0},correlation:{pushable:!0,class:"identical",sql:"corr(%w, %c)",twoColumn:!0},hhi:{pushable:!0,class:"identical",blankAware:!0,sql:"CASE WHEN count(%c)=0 THEN NULL ELSE list_sum(list_transform(map_values(histogram(%c)), lambda v: (v::DOUBLE/count(%c))*(v::DOUBLE/count(%c)))) END"},evenness:{pushable:!0,class:"identical",blankAware:!0,sql:"CASE WHEN count(%c)=0 THEN NULL WHEN count(DISTINCT %c)<2 THEN 1.0 ELSE entropy(%c)/log2(count(DISTINCT %c)) END"},top3Share:{pushable:!0,class:"identical",blankAware:!0,sql:"CASE WHEN count(%c)=0 THEN NULL ELSE list_sum(list_slice(list_sort(map_values(histogram(%c)),'DESC'),1,3))::DOUBLE/count(%c) END"},top10Share:{pushable:!0,class:"identical",blankAware:!0,sql:"CASE WHEN count(%c)=0 THEN NULL ELSE list_sum(list_slice(list_sort(map_values(histogram(%c)),'DESC'),1,10))::DOUBLE/count(%c) END"},gini:{pushable:!0,class:"identical",sql:"CASE WHEN list_min(list(%c) FILTER (WHERE isfinite(%c)))<0 THEN NULL WHEN len(list(%c) FILTER (WHERE isfinite(%c)))=0 THEN NULL WHEN list_sum(list(%c) FILTER (WHERE isfinite(%c)))=0 THEN 0 ELSE 2.0*list_sum(list_transform(list_sort(list(%c) FILTER (WHERE isfinite(%c))), lambda v, i: i*v))/(len(list(%c) FILTER (WHERE isfinite(%c)))*list_sum(list(%c) FILTER (WHERE isfinite(%c))))-(len(list(%c) FILTER (WHERE isfinite(%c)))+1.0)/len(list(%c) FILTER (WHERE isfinite(%c))) END"},trimmedMean:{pushable:!0,class:"identical",sql:"CASE WHEN len(list(%c) FILTER (WHERE isfinite(%c)))=0 THEN NULL ELSE list_avg(list_slice(list_sort(list(%c) FILTER (WHERE isfinite(%c))), floor(len(list(%c) FILTER (WHERE isfinite(%c)))*0.1)::BIGINT+1, len(list(%c) FILTER (WHERE isfinite(%c)))-floor(len(list(%c) FILTER (WHERE isfinite(%c)))*0.1)::BIGINT)) END"},winsorizedMean:{pushable:!0,class:"identical",sql:"CASE WHEN len(list(%c) FILTER (WHERE isfinite(%c)))=0 THEN NULL ELSE list_avg(list_transform(list_sort(list(%c) FILTER (WHERE isfinite(%c))), lambda v: least(list_sort(list(%c) FILTER (WHERE isfinite(%c)))[len(list(%c) FILTER (WHERE isfinite(%c)))-floor(len(list(%c) FILTER (WHERE isfinite(%c)))*0.1)::BIGINT], greatest(list_sort(list(%c) FILTER (WHERE isfinite(%c)))[floor(len(list(%c) FILTER (WHERE isfinite(%c)))*0.1)::BIGINT+1], v)))) END"},robustOutliers:{pushable:!0,class:"identical",sql:"(SELECT CASE WHEN len(d.a)=0 THEN NULL WHEN d.mad=0 THEN NULL ELSE len(list_filter(d.a, lambda v: abs(0.6745*(v-d.med)/d.mad)>3.5)) END FROM (SELECT xs AS a, list_median(xs) AS med, list_median(list_transform(xs, lambda w: abs(w-list_median(xs)))) AS mad FROM (SELECT list(%c) FILTER (WHERE isfinite(%c)) AS xs)) d)"},jarqueBera:{pushable:!0,class:"identical",sql:"CASE WHEN len(list(%c) FILTER (WHERE isfinite(%c)))<8 THEN NULL WHEN list_avg(list_transform(list(%c) FILTER (WHERE isfinite(%c)), lambda v: power(v-list_avg(list(%c) FILTER (WHERE isfinite(%c))),2)))=0 THEN NULL ELSE (len(list(%c) FILTER (WHERE isfinite(%c)))/6.0)*(power(list_avg(list_transform(list(%c) FILTER (WHERE isfinite(%c)), lambda v: power(v-list_avg(list(%c) FILTER (WHERE isfinite(%c))),3)))/power(list_avg(list_transform(list(%c) FILTER (WHERE isfinite(%c)), lambda v: power(v-list_avg(list(%c) FILTER (WHERE isfinite(%c))),2))),1.5),2)+power(list_avg(list_transform(list(%c) FILTER (WHERE isfinite(%c)), lambda v: power(v-list_avg(list(%c) FILTER (WHERE isfinite(%c))),4)))/power(list_avg(list_transform(list(%c) FILTER (WHERE isfinite(%c)), lambda v: power(v-list_avg(list(%c) FILTER (WHERE isfinite(%c))),2))),2)-3,2)/4.0) END"},weightedAvg:{pushable:!0,class:"identical",twoColumn:!0,sql:"sum(%c*%w) FILTER (WHERE isfinite(%c) AND isfinite(%w))/nullif(sum(%w) FILTER (WHERE isfinite(%c) AND isfinite(%w)),0)"},mode:{pushable:!0,class:"may-differ",sql:"mode(%c)",note:"DuckDB returns a modal value even for an all-distinct column; the grid returns null. Tie-breaking can also differ, and on a text column an empty string counts as a value. Under pushdown you will see a value."},weightedQuantile:{pushable:!1,class:"fallback",note:"No SQL equivalent for the grid's weighted-quantile midpoint convention; always computed client-side (needs a full-dataset pull for a correct figure over a remote source)."}});function E(){const G=new Set;for(const[j,k]of Object.entries(te))k.pushable&&G.add(j);return G}function q(G,j,k){let g=G.split("%c").join(j);return k!==void 0&&(g=g.split("%w").join(k)),g}function z(G){const j=G||{},k=j.default==="engine"||j.default==="engine-if-identical"?j.default:"client",g={};if(j.overrides&&typeof j.overrides=="object")for(const[c,d]of Object.entries(j.overrides))(d==="engine"||d==="client")&&(g[c]=d);return{default:k,overrides:g}}function _(G,j){const k=te[G];if(!k||!k.pushable)return"client";const g=j.overrides[G];return g==="engine"||g==="client"?g:j.default==="client"?"client":j.default==="engine-if-identical"?k.class==="identical"?"engine":"client":"engine"}function Z(G,j){const k=z(j),g=[],c=[];for(const d of G||[]){const l=te[d.fn],i=_(d.fn,k),n={id:d.id,col:d.col,fn:d.fn,class:l?l.class:"fallback"};d.weight!==void 0&&(n.weight=d.weight),d.params!==void 0&&(n.params=d.params),i==="engine"?g.push(n):(n.reason=l&&!l.pushable?l.note||"the engine cannot express this stat":"client by config",c.push(n))}return{engine:g,client:c,config:k}}const X=/^[A-Za-z_][A-Za-z0-9_$]*$/;function B(G,j=[]){return(G||[]).every(g=>{if(typeof g=="string")return X.test(g);if(!g||typeof g!="object")return!1;const c=g;return Array.isArray(j)&&j.includes(c.bucket)&&typeof c.col=="string"&&X.test(c.col)&&typeof c.size=="number"&&Number.isFinite(c.size)&&c.size>0})}function Y(){return Object.entries(te).map(([G,j])=>({stat:G,class:j.class,sql:j.sql?q(j.sql,"col",j.twoColumn?"weight":void 0):"",note:j.note||(j.class==="identical"?"Pushes to DuckDB with the same result.":"")}))}}),Ue("packages/core/src/source/pushdown.js",function(e,U){"use strict";Object.defineProperty(e,"FOREGROUND_WAIT_MS",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"NO_CAPABILITIES",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"resolveMutate",{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,"capabilitiesOf",{enumerable:!0,get:function(){return w}}),Object.defineProperty(e,"splitFilters",{enumerable:!0,get:function(){return v}}),Object.defineProperty(e,"LEAF_COUNT_ID",{enumerable:!0,get:function(){return h}}),Object.defineProperty(e,"PIVOT_UNSUPPORTED",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"GROUP_UNSUPPORTED",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"UNGROUPED_LEVEL",{enumerable:!0,get:function(){return M}}),Object.defineProperty(e,"planQuery",{enumerable:!0,get:function(){return F}}),Object.defineProperty(e,"applyResidual",{enumerable:!0,get:function(){return P}}),Object.defineProperty(e,"DEFAULT_WHERE_ROW_LIMIT",{enumerable:!0,get:function(){return A}}),Object.defineProperty(e,"createPushdownSource",{enumerable:!0,get:function(){return V}});const E=U("packages/core/src/internal/compare.js").defaultCompare,z=U("packages/core/src/internal/predicates.js").isFunction,Z=U("packages/core/src/internal/merge.js").toArray,B=U("packages/core/src/internal/warn.js").warnOnce,Y=U("packages/core/src/source/filterwire.js"),G=Y.isGroup,j=Y.warnWherePageRelative,k=Y.warnWhereOverThreshold,g=Y.wireFilters,c=U("packages/core/src/source/aggregates.js"),d=c.resolveAggregatePlan,l=c.groupKeysPushable,i=c.STAT_PUSHDOWN,a=U("packages/core/src/source/abort.js").SupersededError,s=1e3;function t(W){const Q=W&&W.signal;if(!Q||!Q.aborted)return;const ee=Q.reason;throw ee instanceof Error?ee:new a("","superseded before it was sent")}const u=Object.freeze({filter:!1,operators:Object.freeze([]),sort:!1,quick:!1,range:!1,total:!1,group:!1,pivot:!1,mutate:!1});function r(W){if(!W||typeof W!="object")return!1;const Q=W.returning==="row"||W.returning==="key"?W.returning:"none";return{append:W.append===!0,update:W.update===!0,delete:W.delete===!0,returning:Q}}function o(W,Q){if(!W||typeof Q!="string")return;if(!Q.includes("."))return W[Q];let ee=W;for(const re of Q.split(".")){if(ee===null||typeof ee!="object")return;ee=ee[re]}return ee}function f(W){if(W===!0)return!0;if(!W||typeof W!="object")return!1;const Q=W;return Q.enabled===!1?!1:Q.enabled===!0||z(Q.commit)}function w(W){const Q={...u,...W||{}};return Q.operators=new Set(Q.operators||[]),Q.mutate=r(Q.mutate),Q}function m(W,Q){return!W||!W.op||!Q.operators.size?!1:Q.operators.has(W.op)}function v(W,Q){if(!W)return{pushed:null,residual:null};if(!Q.filter)return{pushed:null,residual:W};if(Q.filter==="term"){if(G(W)){const ue=W.conditions||[];if(String(W.op)!=="and")return{pushed:null,residual:W};const ge=ue.findIndex(pe=>!G(pe)&&m(pe,Q));if(ge<0)return{pushed:null,residual:W};const Ae=ue.filter((pe,Me)=>Me!==ge);return{pushed:ue[ge],residual:Ae.length?{op:"and",conditions:Ae}:null}}return m(W,Q)?{pushed:W,residual:null}:{pushed:null,residual:W}}if(!G(W))return m(W,Q)?{pushed:W,residual:null}:{pushed:null,residual:W};if(String(W.op)!=="and")return(W.conditions||[]).every(ge=>G(ge)?v(ge,Q).residual===null:m(ge,Q))?{pushed:W,residual:null}:{pushed:null,residual:W};const ee=[],re=[];for(const ue of W.conditions||[]){if(G(ue)){if(Q.filter==="flat"){re.push(ue);continue}const ge=v(ue,Q);ge.pushed&&ee.push(ge.pushed),ge.residual&&re.push(ge.residual);continue}(m(ue,Q)?ee:re).push(ue)}const ae=ue=>ue.length===0?null:ue.length===1?ue[0]:{op:"and",conditions:ue};return{pushed:ae(ee),residual:ae(re)}}const h="__lattice_leaves";function p(W){return W.aggregates?W.aggregates instanceof Set?W.aggregates:new Set(Z(W.aggregates)):new Set}function b(W){const Q=p(W);return Q.size?Q.has("count")?W.filter!=="tree"||!W.operators||!W.operators.has("eq")?"the adapter does not declare the `group` capability, and cannot narrow a group's rows by its key (that needs a `tree` filter with the `eq` operator)":"":"the adapter does not declare the `group` capability, and its declared aggregates have no `count` to give each group its row count":"the adapter does not declare the `group` capability"}function O(W,Q,ee,re,ae,ue,ge){const Ae=Array.isArray(W.groupBy)?W.groupBy:[],pe=Array.isArray(W.groupPath)?W.groupPath:[],Me=Array.isArray(W.groupValues)?W.groupValues:null;if(!Q.group){const Ne=b(Q);if(Ne)return Ne}return l(Ae)?ee.residual?"the filter did not fully push, so the engine would group a superset of the matching rows":re?ae?ue?"a host `where` predicate can only run in the browser, over rows the engine grouped":ge?"fullDataset holds the whole matching set, so the grid groups it itself":!Me||Me.length!==pe.length?"the request carries no typed `groupValues` for its group path, and the string `groupPath` cannot be compared against a typed column":"":"a quick search did not push, so the engine would group unsearched rows":"the sort did not push, so the engine would order the groups differently":"a grouping key is not a plain column the engine can name in a GROUP BY"}const y="pushdown:pivot-unsupported",L="pushdown:group-unsupported",M=Symbol("lattice.remote.ungroupedLevel");function D(W,Q,ee,re,ae,ue){const ge=Array.isArray(W.pivotBy)?W.pivotBy:[],Ae=Array.isArray(W.groupBy)?W.groupBy:[],pe=Array.isArray(W.groupPath)?W.groupPath:[],Me=Array.isArray(W.groupValues)?W.groupValues:null;return Q.pivot?l(ge)?Ae.length&&!l(Ae)?"a grouping key is not a plain column the engine can name in a GROUP BY":ee.residual?"the filter did not fully push, so the engine would pivot a superset of the matching rows":re?ae?ue?"a host `where` predicate can only run in the browser, over rows the engine pivoted":!Me||Me.length!==pe.length?"the request carries no typed `groupValues` for its group path, and the string `groupPath` cannot be compared against a typed column":"":"a quick search did not push, so the engine would pivot unsearched rows":"the sort did not push, so the engine would order the rows differently":"a pivot column is not a plain column the engine can name in a GROUP BY":"the adapter does not declare the `pivot` capability"}function F(W,Q,ee=!1){const re=v(W.filters||null,Q),ae=[];re.residual&&ae.push("filter");const ue=W.sort||[],ge=ue.length===0||Q.sort==="multi"&&ue.length>=1||Q.sort==="single"&&ue.length===1;!ge&&ue.length&&ae.push("sort");const Ae=W.quick?String(W.quick):"",pe=!Ae||!!Q.quick;pe||ae.push("quick");const Me=W.where&&W.where.active?W.where:null;Me&&ae.push("where");const Ne={filters:re.residual,sort:ge?null:ue,quick:pe?"":Ae,where:Me},Pe=!!ee,ie=Array.isArray(W.groupBy)&&W.groupBy.length>0,Oe=ie?O(W,Q,re,ge,pe,Me,Pe):"",je=W.pivotMode!==!1&&Array.isArray(W.pivotBy)&&W.pivotBy.length>0,Ce=je?D(W,Q,re,ge,pe,Me):"",fe=je&&Ce==="";je&&!fe&&ae.push("pivot");const Ee=je?fe&&ie:ie&&Oe==="";ie&&!je&&!Ee&&ae.push("group");const le=(Ee||fe)&&Array.isArray(W.groupValues)?W.groupValues.length:0,de=Ee||je?!1:Pe||!!(Ne.filters||Ne.sort||Ne.quick||Ne.where)||!Q.range;return{pushed:{...W,filters:re.pushed,sort:ge?ue:[],quick:pe?Ae:"",range:de?null:W.range},residual:Ne,needsAll:de,unpushed:ae,full:Pe,grouped:Ee,groupLevel:le,groupReason:je?"":Oe,pivoted:fe,pivotReason:Ce}}function T(W){const Q=Array.isArray(W.totals)?W.totals:[],ee=W.totalFns&&typeof W.totalFns=="object"?W.totalFns:{},re=[],ae=[];for(const ue of Q){const ge=String(ue),Ae=typeof ee[ge]=="string"?ee[ge]:null,pe=Ae?i[Ae]:null;Ae?!pe||!pe.pushable||!pe.sql?ae.push({id:ge,fn:Ae,class:pe?pe.class:"fallback",reason:pe&&pe.note?pe.note:`the pushdown map cannot express "${Ae}"`}):pe.twoColumn?ae.push({id:ge,fn:Ae,class:pe.class,reason:`"${Ae}" reduces two columns, and a grouped request carries no weight column`}):re.push({id:ge,col:ge,fn:Ae,class:pe.class}):ae.push({id:ge,fn:null,class:"fallback",reason:"the column totals with a host function, so there is no named statistic to push"})}return{engine:re,client:ae}}const I=Object.freeze({items:W=>W==null?[]:Array.isArray(W)?W:[W]});function P(W,Q,ee){if(!Q)return W;let re=W;if(Q.filters&&z(ee.evaluateFilters)){const ae=re,ue={count:re.length,handle:pe=>({id:pe,get:Me=>o(ae[Me],pe)}),itemwise:pe=>ae.some(Me=>Array.isArray(o(Me,pe)))?I:null},ge=ee.evaluateFilters(Q.filters,ue),Ae=[];for(let pe=0;pe<re.length;pe++)ge[pe]&&Ae.push(re[pe]);re=Ae}if(Q.where&&Q.where.active&&(Q.whole||j(Q.where.names,"pushdown"),re=re.filter(ae=>Q.where.passes(ae))),Q.quick){const ae=Q.quick.toLowerCase();re=re.filter(ue=>{if(!ue||typeof ue!="object")return!1;for(const ge of Object.values(ue))if(ge!=null&&String(ge).toLowerCase().includes(ae))return!0;return!1})}if(Q.sort&&Q.sort.length&&z(ee.sortMulti)){const ae=[...new Set(Q.sort.map(pe=>pe.col))],ue=re,ge=ae.map(pe=>({id:pe,get:Me=>o(ue[Me],pe)})),Ae=ee.sortMulti(ge,Q.sort.map(pe=>({col:pe.col,dir:pe.dir})),Uint32Array.from({length:re.length},(pe,Me)=>Me),{});re=Array.from(Ae,pe=>ue[pe])}return re}function R(W){return JSON.stringify({filters:W.filters||null,sort:W.sort||[],quick:W.quick||"",groupBy:W.groupBy||[],groupPath:W.groupPath||[],context:W.context??null})}function $(W){if(!W||typeof W!="object")return 16;let Q="";try{Q=JSON.stringify(W)}catch{return 200}return Q.length*2+64}function C(W){const Q=W||{};return{enabled:!!Q.enabled,maxRows:Number.isFinite(Q.maxRows)?Q.maxRows:1e6,maxBytesEstimate:Number.isFinite(Q.maxBytesEstimate)?Q.maxBytesEstimate:512*1024*1024}}const A=5e4;function S(W){return Number.isFinite(W)&&W>=0?W:A}function x(W){return!!W&&z(W.then)}async function H(W){if(!W||W.total!==void 0||!x(W.pendingTotal))return W;const Q=await W.pendingTotal,{pendingTotal:ee,...re}=W;return typeof Q=="number"?{...re,total:Q}:re}function V(W={}){const Q=W.adapter;if(!Q||!z(Q.execute))return B("source.pushdown.adapter","createPushdownSource needs an `adapter` with an `execute(query)` function."),{...W,mode:"remote",fetch:async()=>({rows:[],total:0})};const ee=w(Q.capabilities),re=Q.capabilities&&Object.getOwnPropertyDescriptor(Q.capabilities,"operators");re&&z(re.get)&&Object.defineProperty(ee,"operators",{enumerable:!0,configurable:!0,get:()=>new Set(Q.capabilities.operators||[]),set:()=>{}});const ae=Q.name||"adapter";let ue=null;const ge=()=>z(Q.ready)?(ue||(ue=Promise.resolve(Q.ready()).then(()=>{Object.assign(ee,w(Q.capabilities))},ce=>{throw ue=null,ce})),ue):null,Ae=C(W.fullDataset),pe=!!W.allowPartialResults,Me=S(W.whereRowLimit);let Ne=null;const Pe=W.aggregates;let ie=null,Oe=null,je=null,Ce=null,fe=null,Ee,le=null,de=0,Se=null;const Fe=()=>!Ae.enabled||!ie?null:(Se!==ie.key&&(de++,Se=ie.key),{rows:ie.rows,version:de}),ke=async ce=>{const he=ce.where&&ce.where.active?ce.where:null;if(!he)return{request:ce,probe:null};const{where:ye,...ve}=ce,Te=F(ve,ee,Ae.enabled);if(Te.needsAll)return{request:ce,probe:null};const xe=R(Te.pushed);let ze=null;return(!Ne||Ne.key!==xe)&&(ee.total?(t(ce),ze=await H(await Q.execute(Te.pushed,ce)),Ne={key:xe,size:ze&&typeof ze.total=="number"?ze.total:null}):Ne={key:xe,size:null}),Ne.size!==null&&Ne.size<Me?{request:ce,probe:null}:(k(he.names,ae,Ne.size,Me),{request:ve,probe:ze})},Ie=async(ce,he)=>{le=null;const ye=T(ce.pushed);je={engine:ye.engine,client:ye.client,groupBy:ce.pushed.groupBy},ye.client.length&&B(`source.pushdown.group.totals.${ae}.${ye.client.map(xe=>xe.id).join(".")}`,`the ${ae} adapter cannot compute the group subtotal for ${ye.client.map(xe=>`"${xe.id}" (${xe.reason})`).join(", ")}, so those group rows carry no value for that column. A figure computed over anything other than the group would be wrong, so none is shown; \`lastPlan().aggregates.client\` names them.`);const ve=await Q.executeGroupLevel(ce.pushed,ye.engine,he)||{};let Te=ve.rows||[];return!ee.range&&he.range&&(Te=Te.slice(he.range.start,he.range.end)),tt(ve),ve.total===void 0?{rows:Te}:{rows:Te,total:ve.total}},Be=new Map,Ke=64,rt=async(ce,he)=>{le=null;const ye=ce.pushed,ve=ye.groupBy,Te=Array.isArray(ye.groupValues)?ye.groupValues:[],xe=Te.length,ze=[...ye.filters?[ye.filters]:[],...ve.slice(0,xe).map((mt,dt)=>({col:mt,op:"eq",value:Te[dt]===void 0?null:Te[dt],caseSensitive:!0}))],Ye=ze.length===0?null:ze.length===1?ze[0]:{op:"and",conditions:ze},$e=he.range?he.range.start:0;if(xe>=ve.length){const mt={...ye,filters:Ye,groupBy:[],groupPath:[],groupValues:[],totals:[],totalFns:{}},dt=await H(await Q.execute(mt,he))||{};let Nt=dt.rows||[];return!ee.range&&he.range&&(Nt=Nt.slice(he.range.start,he.range.end)),typeof dt.total=="number"?{rows:Nt,total:dt.total}:{rows:Nt}}const Ge=ve[xe],Ze=T(ye),Je=p(ee),Qe=Ze.engine.filter(mt=>Je.has(mt.fn)),lt=[...Ze.engine.filter(mt=>!Je.has(mt.fn)).map(mt=>({id:mt.id,fn:mt.fn,class:mt.class,reason:`the ${ae} adapter does not compute "${mt.fn}"`})),...Ze.client];je={engine:Qe,client:lt,groupBy:ve},lt.length&&B(`source.pushdown.group.totals.${ae}.${lt.map(mt=>mt.id).join(".")}`,`the ${ae} adapter cannot compute the group subtotal for ${lt.map(mt=>`"${mt.id}" (${mt.reason})`).join(", ")}, so those group rows carry no value for that column. A figure computed over anything other than the group would be wrong, so none is shown; \`lastPlan().aggregates.client\` names them.`);const ot=[...Qe.map(mt=>({id:mt.id,col:mt.col,fn:mt.fn})),{id:h,col:Ge,fn:"count"}],st={...ye,filters:Ye,range:null},St=JSON.stringify([R(st),Te,Ge,ot]);let jt=$e>0?Be.get(St):void 0;if(!jt){for(jt=Promise.resolve(Q.executeGroupedAggregates(st,[Ge],ot)),Be.delete(St),Be.set(St,jt);Be.size>Ke;)Be.delete(Be.keys().next().value);jt.catch(()=>{Be.get(St)===jt&&Be.delete(St)})}const Mt=await jt||[];t(he);const We=mt=>{const dt={};for(const Nt of Qe)dt[Nt.id]=mt?mt[Nt.id]:void 0;return dt},ut=(ye.sort||[]).find(mt=>mt&&mt.col===Ge),ft=ut&&ut.dir==="desc"?-1:1,wt=Mt.filter(mt=>mt&&mt.level===1).map(mt=>({[Ge]:mt.keys[0]===void 0?null:mt.keys[0],leafCount:Number(mt.values&&mt.values[h])||0,totals:We(mt.values)})).sort((mt,dt)=>ft*E(mt[Ge],dt[Ge]));if(xe===0){const mt=Mt.find(Nt=>Nt&&Nt.level===0),dt=mt?Number(mt.values&&mt.values[h]):NaN;tt({matchCount:Number.isFinite(dt)?dt:wt.reduce((Nt,Ut)=>Nt+Ut.leafCount,0),...mt?{grand:We(mt.values)}:{}})}const Et=he.range?he.range.end:wt.length;return{rows:wt.slice($e,Et),total:wt.length}},tt=ce=>{typeof ce.matchCount=="number"&&(Ce=ce.matchCount,fe=ce.grand?{totals:ce.grand,leafCount:ce.matchCount}:null,Ee===void 0&&z(Q.unfilteredCount)&&(Ee=null,Promise.resolve(Q.unfilteredCount()).then(he=>{Ee=typeof he=="number"?he:null}).catch(he=>{B(`source.pushdown.group.unfiltered.${ae}`,`the ${ae} adapter could not count the unfiltered set (${he&&he.message?he.message:he}), so "N of M" falls back to the display count for its denominator.`)})))},pt=async(ce,he)=>{le=null;const ye=T(ce.pushed);je={engine:ye.engine,client:ye.client,groupBy:ce.pushed.groupBy,pivotBy:ce.pushed.pivotBy},ye.client.length&&B(`source.pushdown.pivot.totals.${ae}.${ye.client.map(Ye=>Ye.id).join(".")}`,`the ${ae} adapter cannot compute the pivot cells for ${ye.client.map(Ye=>`"${Ye.id}" (${Ye.reason})`).join(", ")}, so those cells are empty. A figure computed over anything other than the cell would be wrong, so none is shown; \`lastPlan().aggregates.client\` names them.`);const ve=await Q.executePivotLevel(ce.pushed,ye.engine,he)||{};let Te=ve.rows||[];!ee.range&&he.range&&(Te=Te.slice(he.range.start,he.range.end)),tt(ve);const xe=ve.pivot&&typeof ve.pivot=="object"?ve.pivot:{},ze={cells:Array.isArray(xe.cells)?xe.cells:[],...Array.isArray(xe.axis)?{axis:xe.axis}:{}};return ve.total===void 0?{rows:Te,pivot:ze}:{rows:Te,total:ve.total,pivot:ze}},yt=ce=>{B(`source.pushdown.pivot.${ae}.${ce}`,`pushdown:pivot-unsupported: the ${ae} adapter cannot pivot this query because ${ce}, so no rows are fetched rather than every leaf row being pulled into the browser to pivot there. \`lastPlan().pivotReason\` says the same.`);const he=new Error(`[lattice] ${y}: the ${ae} adapter cannot pivot this query because ${ce}, so no rows are fetched rather than every leaf row being pulled into the browser to pivot there. \`lastPlan().pivotReason\` says the same.`);throw he.code=y,he.reason=ce,he},kt=(ce,he)=>{const ye={key:he,state:"pending",value:null};return le=ye,ce.then(ve=>(le===ye&&(le={key:he,state:"settled",value:typeof ve=="number"?ve:null}),ve),ve=>{throw le===ye&&(le={key:he,state:"failed",value:null}),ve})};let Pt=0,Ct=[];const Lt=()=>Pt===0?null:new Promise(ce=>{const he=setTimeout(ce,s);Ct.push(()=>{clearTimeout(he),ce()})});let Rt;const Bt=async ce=>{const he=ge();he&&await he;const ve=ce&&ce.pivotMode!==!1&&Array.isArray(ce.pivotBy)&&ce.pivotBy.length>0?{request:ce,probe:null}:await ke(ce);t(ce);let Te=F(ve.request,ee,Ae.enabled);if(ee.group&&Te.grouped&&!Te.pivoted&&!z(Q.executeGroupLevel)&&(B(`source.pushdown.group.method.${ae}`,`the ${ae} adapter declares the \`group\` capability but has no \`executeGroupLevel(query, aggregates, request)\`, so grouping is not pushed and the grid stays ungrouped unless it holds the whole matching set. Implement the method or drop the capability.`),Te=F(ve.request,{...ee,group:!1,aggregates:null},Ae.enabled)),Te.pivoted&&!z(Q.executePivotLevel)&&(Te=F(ve.request,{...ee,pivot:!1},Ae.enabled),Te.pivotReason="the adapter declares the `pivot` capability but has no `executePivotLevel(query, aggregates, request)`"),Te.grouped&&!Te.pivoted&&!ee.group&&!z(Q.executeGroupedAggregates)&&(B(`source.pushdown.group.aggregates.method.${ae}`,`the ${ae} adapter declares \`aggregates\` but has no \`executeGroupedAggregates(query, groupBy, aggregates)\`, so the grouped view cannot be built from grouped aggregates and the grid stays ungrouped unless it holds the whole matching set. Implement the method, or declare \`group\` and implement \`executeGroupLevel\`.`),Te=F(ve.request,{...ee,aggregates:null},Ae.enabled)),Oe=Te,Te.pivoted)return pt(Te,ce);if(Te.pivotReason&&yt(Te.pivotReason),Te.grouped)return ee.group?Ie(Te,ce):rt(Te,ce);const ze=!!Te.groupReason&&!Te.full;ze?B(`source.pushdown.group-unsupported.${ae}.${Te.groupReason}`,`pushdown:group-unsupported: the ${ae} adapter was not asked to group this query because ${Te.groupReason}, so the grid stays ungrouped rather than building group rows, counts and subtotals from a window of leaf rows. \`lastPlan().groupReason\` says the same.`):Te.groupReason&&B(`source.pushdown.group.${ae}.${Te.groupReason}`,`the ${ae} adapter was not asked to group this query because ${Te.groupReason}. The engine returns rows and the grouping is the grid's to do, which needs every matching row in the browser — correct where the grid holds them, and wrong-looking where it holds a window. \`lastPlan().unpushed\` names it.`);const Ye=ot=>ze?{...ot,[M]:!0}:ot;if(!Te.needsAll){const ot=ve.probe||await Q.execute(Te.pushed,ce),st=ot.rows||[];return x(ot.pendingTotal)&&ot.total===void 0?Ye({rows:st,pendingTotal:kt(ot.pendingTotal,R(Te.pushed))}):(le=null,!ee.total&&ot.total===void 0?Ye({rows:st}):Ye({rows:st,total:ot.total??st.length}))}Te.unpushed.length&&B(`source.pushdown.residual.${ae}.${Te.unpushed.join(".")}`,`the ${ae} adapter cannot push ${Te.unpushed.join(" or ")}, so every matching row is fetched and the rest is applied in the browser. Correct, and slower than it needs to be: widening the adapter is the fix.`);const $e=R(Te.pushed);if(!ie||ie.key!==$e){const ot=await H(await Q.execute(Te.pushed,ce));le=null;const st=ot.rows||[];if(Te.full){const St=typeof ot.total=="number"?Math.max(ot.total,st.length):st.length;if(St>Ae.maxRows)throw new Error(`[lattice] fullDataset refused: the ${ae} adapter's matching set is ${St.toLocaleString()} rows, past the configured maxRows of ${Ae.maxRows.toLocaleString()}. The whole set cannot be held client-side, so it is refused rather than truncated — a fraction shown as the whole would make every total and statistic silently wrong. Narrow the filter or raise maxRows.`);const jt=st.length*$(st[0]);if(jt>Ae.maxBytesEstimate)throw new Error(`[lattice] fullDataset refused: the ${ae} adapter's matching set is an estimated ${Math.round(jt/(1024*1024)).toLocaleString()} MB across ${st.length.toLocaleString()} rows, past the configured maxBytesEstimate of ${Math.round(Ae.maxBytesEstimate/(1024*1024)).toLocaleString()} MB. The whole set cannot be held client-side, so it is refused rather than truncated. Narrow the filter or raise maxBytesEstimate.`)}if(typeof ot.total=="number"&&st.length<ot.total){const St=!!(Te.residual.filters||Te.residual.quick||Te.residual.sort&&Te.residual.sort.length);if(St&&!pe)throw new Error(`[lattice] the ${ae} adapter returned ${st.length} of ${ot.total} matching rows when asked for the whole result, and the query has residual ${Te.unpushed.join(" and ")||"work"} to finish in the browser. Filtering or sorting a fraction of the result would return wrong rows, so the result is refused. Fix the adapter to follow the engine's own paging before returning, hold the data in memory, or set \`allowPartialResults: true\` on the source config to accept this knowingly.`);St?B(`source.pushdown.partial.residual.${ae}`,`the ${ae} adapter returned ${st.length} of ${ot.total} matching rows when asked for the whole result, and residual work will run over that fraction. allowPartialResults is set, so the result is used as-is — it may be wrong. The adapter must follow the engine's own paging to be correct.`):B(`source.pushdown.partial.${ae}`,`the ${ae} adapter returned ${st.length} of ${ot.total} matching rows when asked for the whole result. The adapter must follow the engine's own paging before returning.`)}ie={key:$e,rows:st,total:typeof ot.total=="number"?ot.total:null}}let Ge=Te;if(Te.residual.where){const ot=ie.total??ie.rows.length;if(ot>=Me){k(Te.residual.where.names,ae,ot,Me);const{where:st,...St}=ve.request;Ge=F(St,ee,Ae.enabled),Oe=Ge}}const Ze=ie.total!==null&&ie.rows.length>=ie.total,Je=P(ie.rows,{...Ge.residual,whole:Ze},W.compute||{}),Qe=ce.range?ce.range.start:0,lt=ce.range?ce.range.end:Je.length;return Ye({rows:Je.slice(Qe,lt),total:Je.length})},ht=async(ce,he,ye)=>{const Te=ye&&ye.waitForPage&&Rt&&z(Rt.pageForegroundIdle)?Rt.pageForegroundIdle():Lt();Te&&await Te;const xe=ge();xe&&await xe;const ze=F(ce,ee,Ae.enabled);Oe=ze;const Ye=d(he,Pe),$e=Array.isArray(ce.groupBy)?ce.groupBy:[],Ge=$e.length>0,Ze=!ze.residual.filters&&!ze.residual.quick,Je=!Ge||l($e,ee.buckets);let Qe=Ye.engine,lt=Ye.client;if(ee.aggregates&&Qe.length){const jt=ee.aggregates instanceof Set?ee.aggregates:new Set(Z(ee.aggregates)),Mt=Qe.filter(We=>!jt.has(We.fn));Mt.length&&(Qe=Qe.filter(We=>jt.has(We.fn)),lt=[...Mt.map(We=>({...We,reason:`the ${ae} adapter does not compute "${We.fn}"`})),...lt])}const ot=jt=>{lt=[...Qe.map(Mt=>({...Mt,reason:jt})),...lt],Qe=[]};Qe.length&&!Ze?ot(ze.residual.quick&&!ze.residual.filters?"a quick search the adapter cannot push forces all-client (no mixed provenance)":"residual filter forces all-client (no mixed provenance)"):Qe.length&&!Je&&ot("a grouping key the engine cannot form forces all-client (no mixed provenance)");let st={},St;return Qe.length&&(z(Ge?Q.executeGroupedAggregates:Q.executeAggregates)?Ge?St=await Q.executeGroupedAggregates(ze.pushed,$e,Qe)||[]:st=await Q.executeAggregates(ze.pushed,Qe)||{}:(B(`source.pushdown.aggregates.${ae}${Ge?".grouped":""}`,`the ${ae} adapter cannot compute ${Ge?"grouped ":""}aggregates, so every requested statistic is computed client-side. Correct, and slower than it needs to be.`),ot(`adapter cannot compute ${Ge?"grouped ":""}aggregates`))),je={engine:Qe,client:lt,...Ge?{groupBy:$e}:{}},{values:st,engine:Qe,client:lt,...St!==void 0?{groups:St}:{}}},ct=async ce=>{Pt++;try{return await Bt(ce)}finally{if(Pt--,Pt===0&&Ct.length){const he=Ct;Ct=[];for(const ye of he)ye()}}},bt=f(W.edit),it=W.edit&&typeof W.edit=="object"&&z(W.edit.commit);let we=W.edit;if(bt&&!it)if(ee.mutate&&ee.mutate.update){const ce=he=>{if(!ee.mutate||!ee.mutate.update)throw new Error(`[lattice] the ${ae} adapter cannot update rows (mutate.update is not declared), so this edit cannot be persisted. The cell is reverted rather than left looking saved.`);const ye={kind:"update",key:String(he.key),patch:{[he.colId]:he.value}};return Q.mutate(ye,he.request||{})};we={...W.edit===!0?{}:W.edit,commit:ce}}else B(`source.pushdown.readonly.${ae}`,`edit is enabled but the ${ae} adapter declares mutate: ${ee.mutate?"without update":"false"} (read-only by declaration), so no commit is synthesised and the grid stays read-only. Declare \`mutate: { update: true }\` on the adapter to allow cell edits.`);const Le=bt&&ee.mutate&&(ee.mutate.append||ee.mutate.delete)?{append:ee.mutate.append===!0,remove:ee.mutate.delete===!0,returning:ee.mutate.returning,mutate:(ce,he)=>Q.mutate(ce,he||{})}:null,Re=async ce=>{const he=ge();he&&await he;const{range:ye,signal:ve,export:Te,...xe}=ce||{},ze={...xe,groupBy:[],groupPath:[],groupValues:[],pivotBy:[],pivotMode:!1,totals:[]};return{plan:F(ze,ee,Ae.enabled),signal:ve}};async function*ne(ce,he={}){const{plan:ye,signal:ve}=await Re(ce),Te=Math.max(1,Math.floor(Number(he.pageSize))||5e3),xe={signal:ve,stream:!0};if(!ye.needsAll)for(let $e=0;;$e+=Te){t(xe);const Ge=await Q.execute({...ye.pushed,range:{start:$e,end:$e+Te}},xe);Ge&&x(Ge.pendingTotal)&&Ge.pendingTotal.then(null,()=>{});const Ze=Ge&&Ge.rows||[];if(Ze.length&&(yield Ze),Ze.length<Te)return}t(xe);const ze=await H(await Q.execute({...ye.pushed,range:void 0},xe)),Ye=P(ze&&ze.rows||[],{...ye.residual,whole:!0},W.compute||{});for(let $e=0;$e<Ye.length;$e+=Te)yield Ye.slice($e,$e+Te)}return Rt={...W,edit:we,rowMutate:Le,mode:"remote",fetch:ct,foregroundIdle:Lt,aggregate:ht,countMatching:async ce=>{const{plan:he,signal:ye}=await Re(ce);if(!he.needsAll&&ee.total){t({signal:ye});const Te=await H(await Q.execute({...he.pushed,range:{start:0,end:0}},{signal:ye}));if(Te&&typeof Te.total=="number")return Te.total}let ve=0;for await(const Te of ne(ce))ve+=Te.length;return ve},streamMatching:ne,capabilitiesOf:w,planQuery:F,wireFilters:g,resolveAggregatePlan:ce=>d(ce,Pe),STAT_PUSHDOWN:i,lastPlan:()=>Oe?{...Oe,...je?{aggregates:je}:{},...le?{total:{deferred:!0,state:le.state,value:le.value}}:{}}:null,fullFrame:Fe,counts:()=>({match:Ce,total:Ee??null,pending:!!le&&le.state==="pending"}),grandTotals:()=>fe},Rt}}),Ue("packages/core/src/source/remote.js",function(e,U){"use strict";Object.defineProperty(e,"PROTOCOL",{enumerable:!0,get:function(){return M}}),Object.defineProperty(e,"HINT_SETTLE_MS",{enumerable:!0,get:function(){return D}}),Object.defineProperty(e,"createRemoteSource",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"RemoteSource",{enumerable:!0,get:function(){return R}});const E=U("packages/core/src/internal/lru.js").Lru,z=U("packages/core/src/internal/predicates.js").isFunction,Z=U("packages/core/src/internal/warn.js").warnOnce,B=U("packages/core/src/internal/schedule.js").settleDebounce,Y=U("packages/core/src/source/abort.js"),G=Y.createAbortScope,j=Y.isAbortError,k=U("packages/core/src/source/blockcache.js"),g=k.BlockCache,c=k.DEFAULT_PAGE_SIZE,d=k.DEFAULT_MAX_CACHED_PAGES,l=U("packages/core/src/source/rows.js"),i=l.createRowFactory,n=l.groupKey,a=U("packages/core/src/source/filterwire.js"),s=a.wireFilters,t=a.querySignature,u=a.warnHostFilterNotApplied,o=U("packages/core/src/source/pagewindow.js").pageWindow,w=U("packages/core/src/source/memory.js").MemorySource,v=U("packages/core/src/compute/handle.js").valueComparator,h=U("packages/core/src/compute/pivot.js"),p=h.pivotKey,b=h.joinPath,O=h.DEFAULT_PATH_SEPARATOR,L=U("packages/core/src/source/pushdown.js").UNGROUPED_LEVEL,M=1,D=120,F=1e3;function T($,C,A){for(let S=0;S<Math.max($.length,C.length);S++){const x=$[S],H=C[S],V=x==null,W=H==null;if(V||W){if(V&&W)continue;return V?1:-1}const Q=A(x,H);if(Q!==0)return Q}return 0}function I($,C){return new R($,C)}class P{constructor(C,A,S,x){this.path=C,this.keyPath=x||C,this.values=[],this.level=A,this.key=n(this.keyPath),this.cache=new g(S),this.count=null,this.complete=!1,this.announced=null,this.counting=!1,this.failed=!1,this.children=new Map,this.row=null,this.flat=!1}}class R{mode="remote";#e;#t;#n;#r;#s=new Map;#i=new Set;#o=G();#l;#a;#c=new Map;#u=[];#f=null;#d="";#h;#p=!1;#m=!1;#g=[];#b=!1;#y=0;#A="";#w=null;#O=-1;constructor(C,A){this.#e=C||{mode:"remote"},this.#t=A||{},z(this.#e.fullFrame)&&(this.filteredIndices=()=>this.#_(),this.unfilteredIndices=()=>this.#G(),this.handleFor=W=>this.#D(W),this.display=()=>this.#F(),this.grandTotalRow=()=>this.#x(),this.unfilteredRows=()=>this.#H(),this.facetIndices=W=>this.#Y(W));const S=this.#e.counts;z(S)&&(this.matchCount=()=>this.#K("match"),this.totalCount=()=>this.#K("total"));const x=this.#e.grandTotals;z(x)&&(this.grandTotalRow=()=>this.#U());const H=this.#e.foregroundIdle;z(H)&&(this.foregroundIdle=()=>this.#ye(H),this.#e.pageForegroundIdle=()=>this.#b?this.#ye(H):null);const V=this.#e;z(V.countMatching)&&z(V.streamMatching)&&(this.selectionQuery=()=>this.#fe(),this.countMatching=W=>V.countMatching(W),this.streamMatching=(W,Q)=>V.streamMatching(W,Q),this.loadedRows=()=>this.#ne(),this.resident=()=>this.#R()!==null),this.#n={pageSize:this.#e.pageSize||c,maxCachedPages:this.#e.maxCachedPages||d},this.#l=i(this.#t),this.#a=new E(this.#n.pageSize*4),this.#h=B((W,Q)=>this.#P(W,Q),D),this.#r=new P([],0,this.#n),this.#s.set(this.#r.key,this.#r),this.#d=this.#ve(),z(this.#e.fetch)||Z("source.remote.fetch",'source.mode "remote" requires a fetch function; the grid will stay empty.'),this.#Be()}count(){const C=this.#S();return C?C.length:this.#v()}#v(){const C=this.#R();return C?C.count():(this.#q(),this.#te(this.#r))}#T(){if(this.#R())return!0;const C=A=>{if(A.count===null&&!A.complete)return!1;for(const S of A.children.values())if(this.#Ee(S.key)&&!C(S))return!1;return!0};return C(this.#r)}pageInfo(){const C=this.#S(),A=this.totalPending();if(!C){const S=this.#v();return{page:0,pageSize:0,total:this.#T()?S:null,pageCount:1,counting:A}}return{page:C.page,pageSize:C.pageSize,total:C.total,pageCount:C.pageCount,counting:A||C.total===null&&this.#o.size>0&&this.#r.cache.loadedExtent()===0}}#S(){const C=this.#v(),A=o(this.#C("pageSize",0),this.#C("page",0),C,this.#T());if(!A)return this.#A="",null;const S=`${this.#y}:${A.offset}:${A.length}`;return S!==this.#A&&!this.#p&&(this.#A=S,A.length>0&&!this.#R()&&this.#P(A.offset,A.offset+A.length-1)),A}at(C){const A=this.#S();if(A){if(C<0||C>=A.length)return;const S=this.#E(A.offset+C);return S&&(S.index=C),S}return this.#E(C)}#E(C){const A=this.#R();if(A)return A.at(C);if(this.#q(),C<0||C>=this.#v())return;const S=this.#V(this.#r,C);if(!S)return;const x=this.#X(S.node,S.local);return x&&(x.index=C),x||this.#l.skeleton(C,S.node.level,S.node.cache.erroredAt(S.local))}byKey(C){const A=this.#R();if(A)return A.byKey(C);const S=this.#c.get(C);if(!S)return;const x=S.lastIndexOf(":"),H=this.#s.get(S.slice(0,x));return H&&this.#X(H,Number(S.slice(x+1)))||void 0}loaded(C){const A=this.#S();if(A){if(C<0||C>=A.length)return!1;C+=A.offset}const S=this.#R();if(S)return S.loaded(C);if(C<0||C>=this.#v())return!1;const x=this.#V(this.#r,C);return!!x&&x.node.cache.rowLoaded(x.local)}hint(C,A){if(this.#p)return;this.#b=!0;const S=this.#q();let x=Math.max(0,Math.floor(C)),H=Math.max(x,Math.floor(A));const V=this.#S();if(V){if(V.length===0)return;x=V.offset,H=V.offset+V.length-1}for(const[W,Q]of this.#M(x,H)){W.cache.protect(Q.min,Q.max);for(const ee of W.cache.evict())this.#Me(W,ee)}this.#h(x,H),S&&this.#h.flush()}#M(C,A){const S=this.#v(),x=new Map;for(let H=C;H<=A&&H<S;H++){const V=this.#V(this.#r,H);if(!V)continue;const W=x.get(V.node);W?(W.min=Math.min(W.min,V.local),W.max=Math.max(W.max,V.local)):x.set(V.node,{min:V.local,max:V.local})}return x.size||x.set(this.#r,{min:C,max:C}),x}#P(C,A){if(!this.#p)for(const[S,x]of this.#M(C,A)){S.cache.protect(x.min,x.max);const H=S.cache.blockOf(x.min),V=S.cache.blockOf(x.max);for(let W=H;W<=V&&!(S.count!==null&&W*S.cache.pageSize>=S.count);W++)S.cache.has(W)||this.#xe(S,W)}}apply(C){const A={added:[],updated:[],removed:[]};if(!C)return A;if(C.update)for(const S of C.update){const x=this.#c.get(this.#l.keyOf(S,-1));if(!x)continue;this.#a.delete(x);const H=x.lastIndexOf(":"),V=this.#s.get(x.slice(0,H));if(!V)continue;const W=Number(x.slice(H+1)),Q=V.cache.blockOf(W);if(!V.cache.loaded(Q))continue;const{start:ee}=V.cache.rangeOf(Q),re=[];for(let ue=ee;ue<ee+V.cache.pageSize;ue++){const ge=V.cache.rowAt(ue);if(ge===void 0)break;re.push(ue===W?S:ge)}V.cache.fill(Q,re);const ae=this.#X(V,W);ae&&A.updated.push(ae)}return(C.add&&C.add.length||C.remove&&C.remove.length)&&this.reload({keepExpanded:!0}),A}reload(C){this.#o.abortAll("reload"),this.#h.cancel(),C&&C.keepExpanded===!1&&this.#i.clear(),this.#re(),this.#W("model:changed",{reason:"reload"})}destroy(){this.#p=!0,this.#h.cancel(),this.#o.abortAll("destroyed"),this.#re(),this.#s.clear(),this.#i.clear(),this.#w&&z(this.#w.destroy)&&this.#w.destroy(),this.#w=null}expand(C){this.#i.has(C)||(this.#i.add(C),this.#W("group:toggled",{key:C,expanded:!0}),this.#W("model:changed",{reason:"expand",key:C}))}collapse(C){this.#i.delete(C)&&(this.#W("group:toggled",{key:C,expanded:!1}),this.#W("model:changed",{reason:"collapse",key:C}))}expandedKeys(){return[...this.#i]}pivotFields(){return this.#u}pivot(){this.#q();const C=this.#f;if(!C||!C.keys.size||!this.#C("pivotBy",[]).length)return null;if(!C.result){const A=v((this.#t.config||{}).locale),S=[...C.keys.entries()].sort((H,V)=>T(H[1],V[1],A)),x=S.map(([H])=>H);C.result={keys:S.map(([,H])=>H),paths:x,fields:this.#se(x),groupPaths:[],columns:x.length*Math.max(1,this.#Te().length),values:C.cells,cells:C.cells,error:null}}return C.result}invalidateHandles(){this.#w&&(z(this.#w.invalidateHandles)&&this.#w.invalidateHandles(),z(this.#w.invalidate)&&this.#w.invalidate("filter"))}#N(){const C=this.#e.fullFrame;return z(C)?C():null}#R(){const C=this.#N();return C?(this.#w||(this.#w=new w({mode:"memory"},this.#$())),C.version!==this.#O&&(this.#w.setRows(C.rows),this.#O=C.version),this.#w):null}#$(){const C=this.#t,A=C.state||{};return{...C,state:{...A,page:()=>0,pageSize:()=>0}}}#_(){const C=this.#R();return C?C.filteredIndices():new Uint32Array(0)}#G(){const C=this.#R();return C?C.unfilteredIndices():new Uint32Array(0)}#D(C){const A=this.#R();return A?A.handleFor(C):void 0}#F(){const C=this.#R();return C?C.display():[]}#Y(C){const A=this.#R();return A&&z(A.facetIndices)?A.facetIndices(C):new Uint32Array(0)}#x(){const C=this.#R();return C&&z(C.grandTotalRow)?C.grandTotalRow():null}#K(C){const A=this.#R();if(A){const V=C==="match"?A.matchCount:A.totalCount;if(z(V))return V.call(A)}const S=this.#e.counts,x=z(S)?S():null,H=x?x[C]:null;return typeof H=="number"?H:this.#v()}#U(){const C=this.#R();if(C&&z(C.grandTotalRow))return C.grandTotalRow();if((this.#t.config||{}).grandTotalRow!=="bottom")return null;const S=this.#e.grandTotals,x=z(S)?S():null;return!x||!x.totals?null:this.#l.grandTotal(x.totals,x.leafCount||0)}#H(){const C=this.#R();if(C&&z(C.unfilteredRows))return C.unfilteredRows();const A=[],S=this.count();for(let x=0;x<S;x++){const H=this.at(x);H&&A.push(H)}return A}#fe(){const C=this.#C("quick",""),A={protocol:M,groupPath:[],groupValues:[],groupBy:[],totals:[],totalFns:{},pivotBy:[],pivotMode:!1,filters:s(this.#C("filters",null),this.#B()),sort:this.#C("sort",[]),context:this.#C("context",null)};C&&(A.quick=C);const S=this.#C("where",null);return S&&S.active&&(A.where=S),A}#ne(){const C=this.#C("groupBy",[]).length,A=[];for(const S of this.#s.values())if(!(S.level!==C&&!S.flat))for(const x of S.cache.ids()){if(!S.cache.loaded(x))continue;const{start:H,end:V}=S.cache.rangeOf(x);for(let W=H;W<V&&S.cache.rowLoaded(W);W++){const Q=this.#X(S,W);Q&&!Q.group&&A.push(Q)}}return A}loadedCount(){const C=this.#R();if(C){const x=C.matchCount();return typeof x=="number"?x:C.count()}this.#q();const A=this.#C("groupBy",[]).length;let S=0;for(const x of this.#s.values())if(!(x.level!==A&&!x.flat))for(const H of x.cache.ids()){if(!x.cache.loaded(H))continue;const V=x.cache.fillOf(H);typeof V=="number"&&(S+=V)}return S}residentRows(){const C=this.#R();return C?C.display():this.#C("groupBy",[]).length>0?null:(this.#q(),this.#ne())}#pe(C,A,S){const{start:x,end:H}=C.cache.rangeOf(A),V=this.#C("groupBy",[]),W=this.#C("pivotBy",[]),Q=this.#C("quick",""),ee=this.#Te(),re={protocol:M,range:{start:x,end:H},groupPath:C.path,groupValues:C.values,groupBy:V,totals:ee,totalFns:this.#le(ee),pivotBy:W,pivotMode:W.length>0,filters:s(this.#C("filters",null),this.#B()),sort:this.#C("sort",[]),context:this.#C("context",null),signal:S};Q&&(re.quick=Q);const ae=this.#C("where",null);return ae&&ae.active&&(re.where=ae),re}async#xe(C,A){if(!z(this.#e.fetch))return;if(!this.#m){this.#m=!0;const V=this.#g;this.#g=[],queueMicrotask(()=>{for(const W of V)W()})}const S=this.#o.begin(`${C.key}:${A}`);C.cache.begin(A,S);const x=this.#d,{start:H}=C.cache.rangeOf(A);try{const V=await this.#e.fetch(this.#pe(C,A,S.signal));if(!S.current||x!==this.#d||this.#p)return;S.settle();const W=V&&V.rows||[];if(!!(V&&V[L])&&!C.flat){C.flat=!0,C.children.clear();for(const[ae,ue]of[...this.#c])ue.startsWith(`${C.key}:`)&&(this.#a.delete(ue),this.#c.delete(ae))}C.cache.fill(A,W),C.failed=!1;for(let ae=0;ae<W.length;ae++)this.#a.delete(`${C.key}:${H+ae}`);const ee=V&&typeof V.count=="number"?V.count:V&&typeof V.total=="number"?V.total:null,re=V&&z(V.pendingTotal?.then)?V.pendingTotal:null;ee!==null?(C.count=ee,C.complete=!0):W.length<C.cache.pageSize?(C.count=H+W.length,C.complete=!0):re&&(C.counting=!0,C.announced=null),V&&Array.isArray(V.pivotFields)&&this.#Pe(V.pivotFields),V&&V.pivot&&typeof V.pivot=="object"&&this.#Ce(V.pivot),this.#W("model:changed",{reason:"page",groupPath:C.path,block:A}),this.#W("rows:changed",{companion:!0,reason:"page",groupPath:C.path,block:A}),this.#me(C),re&&this.#Oe(C,re,x)}catch(V){if(S.settle(),j(V))return;C.cache.failed(A,V),C.failed=!0;const{end:W}=C.cache.rangeOf(A);for(let Q=H;Q<W;Q++)this.#a.delete(`${C.key}:${Q}`);this.#W("model:changed",{reason:"page-error",groupPath:C.path,block:A}),this.#W("source:error",{error:V,groupPath:C.path,block:A})}}async#Oe(C,A,S){let x;try{x=await A}catch(H){if(S!==this.#d||this.#p)return;C.counting=!1,j(H)||(C.failed=!0),j(H)||this.#W("source:error",{error:H,groupPath:C.path});return}S!==this.#d||this.#p||(C.counting=!1,typeof x=="number"&&(C.count=x,C.complete=!0,this.#me(C),this.#W("model:changed",{reason:"total",count:x,groupPath:C.path})))}#me(C){typeof C.count!="number"||!C.complete||C.announced!==C.count&&(C.announced=C.count,this.#W("source:total",{total:C.count,groupPath:C.path}))}#ye(C){if(this.#p)return null;this.#q();const A=this.#m?null:new Promise(W=>{this.#g.push(W),setTimeout(W,F)}),S=C();if(!A&&!S)return null;const x=(async()=>{A&&await A;for(let W=C();W;W=C())await W})();let H;const V=new Promise(W=>{H=setTimeout(W,F)});return Promise.race([x,V]).then(()=>clearTimeout(H))}totalPending(){if(this.#r.failed)return!1;if(this.#r.counting===!0)return!0;if(this.#R())return!1;this.#q();const C=this.#r;return C.count===null&&!C.complete&&C.cache.loadedExtent()===0}totalFailed(){return this.#r.failed===!0}#Pe(C){C.length===this.#u.length&&C.every((A,S)=>A===this.#u[S])||(this.#u=C,this.#W("column:pivoted",{pivotFields:C,remote:!0}))}#de(){const C=this.#t.config||{};return C.pivot&&C.pivot.separator||O}#se(C){const A=this.#de(),S=this.#Te();if(!S.length)return C.slice();const x=[];for(const H of C)for(const V of S)x.push(`${H}${A}${V}`);return x}#Ce(C){const A=this.#de();this.#f||(this.#f={keys:new Map,cells:new Map,result:null});const S=this.#f;let x=!1;const H=W=>{const Q=Array.isArray(W)?W:[W],ee=b(Q,A);return S.keys.has(ee)||(S.keys.set(ee,Q),x=!0),ee},V=this.#C("groupBy",[]).length>0;for(const W of Array.isArray(C.axis)?C.axis:[])H(W);for(const W of Array.isArray(C.cells)?C.cells:[]){if(!W||typeof W!="object")continue;const Q=H(W.pivot);if(V&&!(Array.isArray(W.group)&&W.group.length))continue;const ee=b(Array.isArray(W.group)?W.group:[],A);for(const[re,ae]of Object.entries(W.values||{}))S.cells.set(p(ee,Q,re),ae)}S.result=null,x&&this.#Pe((this.pivot()||{fields:[]}).fields)}#te(C){let A=this.#J(C);for(const S of C.children.values())this.#Ee(S.key)&&(A+=this.#te(S));return A}#J(C){if(C.count!==null)return C.count;const A=C.cache.loadedExtent();return C.complete?A:C.row&&C.row.leafCount>0?C.level>=this.#C("groupBy",[]).length?Math.max(A,C.row.leafCount):A===0?1:Math.min(A+C.cache.pageSize,Math.max(A,C.row.leafCount)):A+C.cache.pageSize}#V(C,A){let S=A,x=0;const H=[...C.children.entries()].filter(([,W])=>this.#Ee(W.key)).sort((W,Q)=>W[0]-Q[0]);for(const[W,Q]of H){const ee=W-x+1;if(S<ee)return{node:C,local:x+S};S-=ee,x=W+1;const re=this.#te(Q);if(S<re)return this.#V(Q,S);S-=re}const V=this.#J(C);return x+S<V?{node:C,local:x+S}:null}#X(C,A){const S=`${C.key}:${A}`,x=this.#a.get(S);if(x)return x;const H=C.cache.rowAt(A);if(H===void 0)return null;const V=this.#C("groupBy",[]);let W;if(C.level<V.length&&!C.flat){const Q=V[C.level],ee=this.#f!==null&&C.level===V.length-1&&this.#C("pivotBy",[]).length>0,re=this.#he(H,Q),ae=re==null,ue=[...C.path,ae?"":String(re)],ge=[...C.keyPath,ae?null:String(re)];if(W=this.#l.group({path:ue,keyPath:ge,column:Q,value:re,level:C.level,parent:C.row,leafCount:Number(H.leafCount)||0,expanded:ee?!1:this.#Ee(n(ge)),...ee?{hasChildren:!1}:{}}),W.totals=this.#I(H),W.data=H,!ee){let Ae=this.#s.get(W.key);Ae?Ae.row=W:(Ae=new P(ue,C.level+1,this.#n,ge),Ae.row=W,this.#s.set(Ae.key,Ae)),Ae.values=[...C.values,re],C.children.set(A,Ae)}}else W=this.#l.leaf(H,A,C.level,C.row);return this.#a.set(S,W),this.#c.set(W.key,S),W}#I(C){const A=C||{};if(A.totals&&typeof A.totals=="object")return A.totals;const S={};for(const x of this.#Te())Object.hasOwn(A,x)&&(S[x]=A[x]);return S}#Me(C,A){const{start:S,end:x}=C.cache.rangeOf(A);for(let H=S;H<x;H++){const V=`${C.key}:${H}`,W=this.#a.peek(V);W&&this.#c.delete(W.key),this.#a.delete(V)}}#q(){const C=this.#ve();return C===this.#d?!1:(this.#d=C,this.#o.abortAll("query"),this.#re(),this.#m=!1,this.#W("model:changed",{reason:"query"}),!0)}#re(){for(const C of this.#s.values())C.cache.clear(),C.count=null,C.complete=!1,C.announced=null,C.counting=!1,C.failed=!1,C.children.clear(),C.flat=!1;this.#a.clear(),this.#c.clear(),this.#y++,this.#f=null}#ve(){const C=this.#C("where",null);return`${t({filters:this.#C("filters",null),sort:this.#C("sort",[]),quick:this.#C("quick",""),groupBy:this.#C("groupBy",[]),pivotBy:this.#C("pivotBy",[]),context:this.#C("context",null)})}|${C?C.version:0}`}#Ee(C){const A=this.#C("expanded",null);return A?z(A.has)?A.has(C):Array.prototype.includes.call(A,C):this.#i.has(C)}#Te(){const C=this.#C("totals",[]);if(C&&C.length)return[...C];const A=this.#t.columns;return!A||!z(A.all)?[]:A.all().filter(S=>!!S.total).map(S=>S.id)}#le(C){const A=this.#t.columns,S={};if(!A||!z(A.get))return S;for(const x of C){const H=A.get(x);if(!H)continue;const V=H.groupTotal!=null?H.groupTotal:H.total;typeof V=="string"&&(S[x]=V)}return S}#he(C,A){const S=this.#t.columns,x=S&&z(S.get)?S.get(A):void 0;return x&&z(x.getValue)?x.getValue(C):C?.[A]}#Be(){u(this.#t)}#B(){const C=this.#t.config||{};return{tz:C.timeZone,weekStartsOn:C.weekStartsOn}}#C(C,A){const S=this.#t.state;if(S&&z(S[C])){const x=S[C]();return x??A}return A}#W(C,A){const S=this.#t.emit;z(S)&&S(C,A)}}}),Ue("packages/core/src/source/gapbuffer.js",function(e,U){"use strict";Object.defineProperty(e,"GapBuffer",{enumerable:!0,get:function(){return E}});const te=64;class E{#e;#t=0;#n=0;constructor(z=te){this.#e=new Uint32Array(Math.max(1,z)),this.#n=this.#e.length}static from(z,_=te){const Z=new E(z.length+Math.max(1,_));return Z.#e.set(z,0),Z.#t=z.length,Z.#n=Z.#e.length,Z}get length(){return this.#t+(this.#e.length-this.#n)}get capacity(){return this.#e.length}at(z){return z<0||z>=this.length?0:z<this.#t?this.#e[z]:this.#e[z+(this.#n-this.#t)]}insert(z,_){const Z=z<0?0:z>this.length?this.length:z;this.#r(Z),this.#t===this.#n&&this.#s(),this.#e[this.#t++]=_}push(z){this.insert(this.length,z)}removeAt(z){return!Number.isInteger(z)||z<0||z>=this.length?!1:(this.#r(z),this.#n++,!0)}toArray(){const z=new Uint32Array(this.length);return z.set(this.#e.subarray(0,this.#t),0),z.set(this.#e.subarray(this.#n),this.#t),z}clear(){this.#t=0,this.#n=this.#e.length}#r(z){if(z!==this.#t)if(z<this.#t){const _=this.#t-z;this.#e.copyWithin(this.#n-_,z,this.#t),this.#t=z,this.#n-=_}else{const _=z-this.#t;this.#e.copyWithin(this.#t,this.#n,this.#n+_),this.#t=z,this.#n+=_}}#s(){const z=this.#e.length-this.#n,_=new Uint32Array(Math.max(this.#e.length*2,this.#e.length+te));_.set(this.#e.subarray(0,this.#t),0),_.set(this.#e.subarray(this.#n),_.length-z),this.#e=_,this.#n=_.length-z}}}),Ue("packages/core/src/store/ingest.js",function(e,U){"use strict";Object.defineProperty(e,"INGEST_DEFAULTS",{enumerable:!0,get:function(){return g}}),Object.defineProperty(e,"inferKind",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"decideText",{enumerable:!0,get:function(){return d}}),Object.defineProperty(e,"createReaders",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"Ingest",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"ingest",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"ingestSync",{enumerable:!0,get:function(){return s}});const te=U("packages/core/src/internal/schedule.js"),E=te.now,q=te.nextFrame,z=U("packages/core/src/internal/warn.js"),_=z.infoOnce,Z=z.warnOnce,B=U("packages/core/src/internal/predicates.js").isFunction,G=U("packages/core/src/internal/paths.js").pathGetter,k=U("packages/core/src/store/columnstore.js").ColumnStore,g=Object.freeze({chunkMs:8,chunkRows:512,sampleSize:100,dictionaryRatio:.1,columnarBelow:5e3,initialCapacity:1024});function c(t,u={}){if(u.multi)return"multi";if(t.length===0)return"object";let r=0,o=0,f=0,w=0,m=0;for(let h=0;h<t.length;h++){const p=t[h];typeof p=="number"?r++:typeof p=="boolean"?o++:typeof p=="string"?f++:p instanceof Date?w++:Array.isArray(p)&&m++}const v=t.length;return r===v?"float64":o===v?"bitset":w===v?"float64":f===v?"text":m===v?"multi":"object"}function d(t,u,r){return u<=0||t<r*u?"dictionary":"object"}function l(t,u,r){const o=new Map,f=new Map;for(const M of t){if(M.computed)continue;const D=B(M.read)?M.read:G(M.field||M.id);f.set(M.id,D),o.set(M.id,D)}const w=u?.order??[],m=u?.fns??{},v=u?.deps??{},h=u?.wrapDeps??null,p=w.filter(M=>B(m[M])),b=p.some(M=>v[M]==="*");let O=new WeakMap;const y=M=>{const D={};if(b)for(const[F,T]of f)D[F]=T(M);for(const F of p){const T=v[F];let I;if(T==="*")I=D;else{I={};const P=T||[];for(let R=0;R<P.length;R++){const $=P[R];I[$]=$ in D?D[$]:f.get($)?.(M)}}D[F]=m[F](h?h(I,F):I,{data:M,row:null,column:null,grid:null,context:r})}return D},L=M=>{if(M===null||typeof M!="object"&&typeof M!="function")return y(M);let D=O.get(M);return D===void 0&&(D=y(M),O.set(M,D)),D};for(const M of p)o.set(M,D=>L(D)[M]);return{readers:o,reset(){O=new WeakMap}}}class i{spec;read;kind;inferred;nullable;candidate=!1;distinct=null;change=null;reason="";constructor(u,r){this.spec=u,this.read=r,this.kind="object",this.inferred=!1,this.nullable=u.nullable!==!1}}class n{#e;#t=[];#n=null;#r;#s=0;#i;#o=!1;#l=!1;#a=0;#c;constructor(u,r={},o={}){this.#e=Array.isArray(u)?u:Array.from(u||[]),this.#i={...g,...o};const f=r.columns??[];this.#r=l(f,r.computed??null,r.context),this.#c=this.#e.length>=this.#i.columnarBelow,this.#u(f,r.computed??null),this.#n=new k(this.#t.map(w=>({id:w.spec.id,kind:w.kind,nullable:w.nullable,read:w.read,dictionary:w.spec.dictionary})),{initialCapacity:this.#i.initialCapacity,columnarBelow:this.#i.columnarBelow})}get store(){return this.#n}get done(){return this.#o||this.#l}get progress(){return this.#s}slice(){if(this.done)return!1;if(this.#i.signal?.aborted)return this.#l=!0,!1;const u=E(),{chunkMs:r,chunkRows:o}=this.#i,f=this.#e.length;do{const w=Math.min(this.#s+o,f);this.#n.append(this.#e.slice(this.#s,w)),this.#f(this.#s,w),this.#s=w,this.#r.reset(),this.#h(!1)}while(this.#s<f&&E()-u<r);return this.#a+=E()-u,this.#i.onProgress?.({loaded:this.#s,total:f}),this.#s>=f?(this.#h(!0),this.#o=!0,!1):!0}cancel(){this.#l=!0}result(){return{store:this.#n,schema:this.#t.map(u=>({id:u.spec.id,kind:u.kind,nullable:u.nullable,read:u.read,dictionary:u.spec.dictionary})),decisions:this.#t.map(u=>({id:u.spec.id,kind:u.kind,nullable:u.nullable,inferred:u.inferred,distinct:u.candidate||u.change?this.#d(u):null,change:u.change,reason:u.reason})),count:this.#n.count,elapsed:this.#a,cancelled:this.#l}}#u(u,r){const o=this.#e,f=Math.min(this.#i.sampleSize,o.length),w=this.#i.dictionaryRatio,m=r?.pure instanceof Set?r.pure:new Set(r?.pure??r?.order??[]);for(const v of u){if(!v||!v.id)continue;if(v.computed&&(v.pure===!1||r&&!m.has(v.id))){Z(`ingest.impure.${v.id}`,`column "${v.id}" is an impure computed column and is not materialised into the store`);continue}const h=this.#r.readers.get(v.id)??(B(v.read)?v.read:G(v.field||v.id)),p=new i(v,h);if(v.kind)p.kind=v.kind,p.reason="declared by the caller";else if(v.dictionary)p.kind=v.multi?"multi":"dictionary",p.reason="value table supplied (lookup column)";else{const b=[];for(let y=0;y<f&&b.length<this.#i.sampleSize;y++){const L=h(o[y]);L!=null&&b.push(L)}p.inferred=!0;const O=c(b,{multi:v.multi});if(O==="text"){const y=new Set(b).size;p.kind=d(y,b.length,w),p.candidate=this.#c,p.reason=`sampled ${y} distinct in ${b.length}`}else p.kind=O,p.reason=`inferred from ${b.length} sampled values`,O==="object"&&b.length&&_(`ingest.mixed.${v.id}`,`column "${v.id}" holds mixed or unrecognised value types; storing as an object array. Declare a type to avoid this.`);p.kind==="object"&&p.candidate&&(p.distinct=new Set(b))}this.#t.push(p)}}#f(u,r){const o=this.#e;for(const f of this.#t){if(!f.candidate||!f.distinct)continue;const w=f.distinct;for(let m=u;m<r;m++){const v=f.read(o[m]);v!=null&&w.add(v)}}}#d(u){if(u.distinct)return u.distinct.size;const r=this.#n.column(u.spec.id);return r?.dict?r.dict.size:0}#h(u){const r=this.#i.dictionaryRatio,o=this.#e.length;for(const f of this.#t){if(!f.candidate)continue;const w=this.#d(f);if(f.kind==="dictionary"&&w>=r*o){const m=this.#n.column(f.spec.id);f.distinct=new Set(m?.dict?m.dict.values():[]),this.#n.convert(f.spec.id,"object"),f.kind="object",f.change="demoted",f.reason=`${w} distinct values is at or above ${r*100}% of ${o} rows`;continue}if(f.kind==="object"&&w>=r*o){f.candidate=!1,f.distinct=null,f.reason=`${w} distinct values is at or above ${r*100}% of ${o} rows`;continue}u&&f.kind==="object"&&w<r*o&&(this.#n.convert(f.spec.id,"dictionary"),f.kind="dictionary",f.change=f.change==="demoted"?null:"promoted",f.reason=`${w} distinct values is below ${r*100}% of ${o} rows`,f.distinct=null),u&&(f.candidate=!1)}}}async function a(t,u={},r={}){const o=new n(t,u,r),f=r.scheduler?.frame??q;for(;o.slice();)await new Promise(w=>{f(w)});return o.result()}function s(t,u={},r={}){const o=new n(t,u,{...r,chunkMs:1/0});for(;o.slice(););return o.result()}}),Ue("packages/core/src/store/columnpack.js",function(e,U){"use strict";Object.defineProperty(e,"isPortableSchema",{enumerable:!0,get:function(){return G}}),Object.defineProperty(e,"packChunk",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"packedTransfers",{enumerable:!0,get:function(){return d}});const E=U("packages/core/src/internal/paths.js").pathGetter,q=U("packages/core/src/store/ingest.js"),z=q.inferKind,_=q.decideText,Z=q.INGEST_DEFAULTS,B=U("packages/core/src/store/columnstore.js").toFloat,Y=new Set(["float64","int32","bitset","dictionary","object","multi"]);function G(l){if(!Array.isArray(l)||l.length===0)return!1;for(const i of l)if(!i||typeof i.id!="string"||typeof i.field!="string"||i.field===""||i.kind&&!Y.has(i.kind))return!1;return!0}function j(l){const i=B(l);return Number.isFinite(i)?i|0:0}function k(l){return l==null?[]:Array.isArray(l)?l:[l]}function g(l,i,n,a){if(l.kind)return l.kind;const s=[];for(let r=0;r<i.length&&s.length<Z.sampleSize;r++){const o=i[r];o!=null&&s.push(o)}const t=z(s,{multi:l.multi});if(t!=="text")return t;const u=new Set(s).size;return _(u,s.length,a)}function c(l,i,n={}){const a=i.length|0,s=n.dictionaryRatio??Z.dictionaryRatio,t=[];for(const u of l){const r=E(u.field||u.id),o=u.nullable!==!1,f=new Array(a);for(let p=0;p<a;p++){const b=r(i[p]);f[p]=b===void 0?null:b}const w=g(u,f,a,s),m=o?new Uint8Array(a+7>>3):null,v=p=>{m&&(m[p>>3]|=1<<(p&7))};let h;switch(w){case"float64":{const p=new Float64Array(a);for(let b=0;b<a;b++){const O=f[b],y=O===null;y||v(b),p[b]=y?NaN:B(O)}h={id:u.id,kind:w,nullable:o,values:p,presence:m,offsets:null,table:null};break}case"int32":{const p=new Int32Array(a);for(let b=0;b<a;b++){const O=f[b],y=O===null;y||v(b),p[b]=y?0:j(O)}h={id:u.id,kind:w,nullable:o,values:p,presence:m,offsets:null,table:null};break}case"bitset":{const p=new Uint8Array(a+7>>3);for(let b=0;b<a;b++){const O=f[b],y=O===null;y||v(b),!y&&O&&(p[b>>3]|=1<<(b&7))}h={id:u.id,kind:w,nullable:o,values:p,presence:m,offsets:null,table:null};break}case"dictionary":{const p=new Uint32Array(a),b=[],O=new Map;for(let y=0;y<a;y++){const L=f[y];if(L===null){p[y]=0;continue}v(y);let M=O.get(L);M===void 0&&(M=b.length,b.push(L),O.set(L,M)),p[y]=M}h={id:u.id,kind:w,nullable:o,values:p,presence:m,offsets:null,table:b};break}case"multi":{const p=[],b=new Map,O=new Uint32Array(a+1),y=[];for(let L=0;L<a;L++){const M=f[L];O[L]=y.length,M===null||v(L);const F=k(M);for(let T=0;T<F.length;T++){const I=F[T];let P=b.get(I);P===void 0&&(P=p.length,p.push(I),b.set(I,P)),y.push(P)}}O[a]=y.length,h={id:u.id,kind:w,nullable:o,values:Int32Array.from(y),presence:m,offsets:O,table:p};break}default:{const p=new Array(a);for(let b=0;b<a;b++){const O=f[b];O!==null&&v(b),p[b]=O}h={id:u.id,kind:"object",nullable:o,values:p,presence:m,offsets:null,table:null};break}}t.push(h)}return{count:a,columns:t}}function d(l){const i=[];if(!l||!Array.isArray(l.columns))return i;const n=a=>{ArrayBuffer.isView(a)&&a.buffer&&!i.includes(a.buffer)&&i.push(a.buffer)};for(const a of l.columns)n(a.values),n(a.presence),n(a.offsets);return i}}),Ue("packages/core/src/source/stream.js",function(e,U){"use strict";Object.defineProperty(e,"DEFAULT_PROMOTE_BELOW",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"createStreamSource",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"StreamSource",{enumerable:!0,get:function(){return P}});const E=U("packages/core/src/internal/lru.js").Lru,z=U("packages/core/src/internal/predicates.js").isFunction,_=U("packages/core/src/internal/schedule.js"),Z=_.now,X=_.nextFrame,B=_.cancelFrame,Y=_.whenIdle,j=U("packages/core/src/internal/compare.js").defaultCompare,k=U("packages/core/src/internal/warn.js"),g=k.warnOnce,c=k.infoOnce,l=U("packages/core/src/internal/paths.js").getPath,i=U("packages/core/src/source/abort.js"),n=i.createAbortScope,a=i.isAbortError,s=U("packages/core/src/source/rows.js"),t=s.createRowFactory,u=s.lazyRowView,o=U("packages/core/src/source/gapbuffer.js").GapBuffer,w=U("packages/core/src/source/memory.js").createMemorySource,v=U("packages/core/src/source/filterwire.js").querySignature,p=U("packages/core/src/store/columnpack.js").isPortableSchema,b=25e4,O=Symbol("lattice.stream.storeBacked"),y=8,L=.1,M=1e3,D=50;function F(R){return Math.min(M,Math.max(D,Math.floor(R/4)))}function T(R){if(R instanceof Date)return R.getTime();if(typeof R=="number")return Number.isFinite(R)?R:NaN;if(typeof R=="string"){const $=R.trim();if(!$)return NaN;const C=Date.parse($);return Number.isNaN(C)?Number($):C}return NaN}function I(R,$){return new P(R,$)}class P{mode="stream";writesStore=!0;#e;#t;#n=[];#r=null;#s=[];#i=null;#o;#l;#a=new Map;#c=n();#u={loaded:0,estimated:void 0};#f=null;#d=0;#h=0;#p=0;#m=0;#g=null;#b=null;#y=null;#A=!1;#w=!1;#O=!1;#v=!1;#T="";#S=0;#E=0;#M=0;#P=null;#N=1/0;#R=!1;#$=null;#_=null;#G=null;#D=null;#F=!1;#Y=0;#x=0;#K=!1;constructor($,C){this.#e=$||{mode:"stream"},this.#t=C||{},this.#o=t(this.#t),this.#l=new E(4096),this.#T=this.#Ve();const A=(this.#t.config||{}).ingest;this.#F=!!A&&A.retainSource===!1,z(this.#e.open)||g("source.stream.open",'source.mode "stream" requires an open function; the grid will stay empty.'),this.#e.autoStart!==!1&&queueMicrotask(()=>this.start());const S=Number(this.#e.poll);Number.isFinite(S)&&S>0&&(this.#D=setInterval(()=>{this.#v||this.reload()},S),this.#D&&z(this.#D.unref)&&this.#D.unref()),this.#H()}#U(){const $=Number(this.#e.maxAge);return Number.isFinite($)&&$>0?$:0}#H(){const $=this.#U();if(!$)return;const C=this.#e.ageBy;z(C)?this.#_=C:typeof C=="string"&&C?this.#_=A=>l(A,C):this.#_=null,this.#P=[],this.#$=setInterval(()=>{this.#v||this.#fe()&&(this.#q(),this.#ce())},F($)),this.#$&&z(this.#$.unref)&&this.#$.unref()}#fe(){const $=this.#U();return!$||!this.#P?!1:this.#R?!0:this.#N<Date.now()-$*(1+L)}#ne($,C){if(!this.#P)return;const A=this.#_?T(this.#_(C)):Date.now();this.#P[$]=A,Number.isNaN(A)||(A<this.#N&&(this.#N=A),A<Date.now()-this.#U()&&(this.#R=!0))}#pe(){return this.#be("groupBy",[]).length>0?!0:!!this.#be("pivotMode",!1)&&this.#be("pivotBy",[]).length>0}#xe(){if(this.#g||this.#v)return;const $=this.#pe();if($&&!this.#b){this.#b=w({mode:"memory",rows:this.#n},this.#Oe()),this.#A=!1;return}!$&&this.#b&&(this.#b.destroy(),this.#b=null)}#Oe(){if(this.#y)return this.#y;const $=this,C={liveIndices:()=>$.#me(),live:A=>$.#n[A]!==void 0,source:A=>$.#Se(A),get physical(){return $.#n.length}};return this.#F&&(C.column=A=>{const S=$.#t.store;return S&&z(S.column)?S.column(A):void 0}),this.#y=Object.create(this.#t,{store:{value:C,enumerable:!0,configurable:!0}}),this.#y}#me(){const $=new Uint32Array(this.#n.length);let C=0;for(let A=0;A<this.#n.length;A++)this.#n[A]!==void 0&&($[C++]=A);return $.subarray(0,C)}#ye(){return this.#g?this.#g:this.#b?(this.#A&&(this.#A=!1,this.#b.setRows(this.#n)),this.#b):null}invalidate($="filter"){if(this.#g){this.#g.invalidate($);return}this.#xe(),this.#b&&this.#b.invalidate($),($==="filter"||$==="sort")&&this.#Te()}count(){const $=this.#ye();return $?$.count():this.#r?this.#r.length:this.#S}matchCount(){const $=this.#ye();return $&&z($.matchCount)?$.matchCount():this.#r?this.#r.length:this.#S}totalCount(){const $=this.#ye();return $&&z($.totalCount)?$.totalCount():this.#S}unfilteredRows(){const $=this.#ye();if($&&z($.unfilteredRows))return $.unfilteredRows();const C=[];for(let A=0;A<this.#n.length;A++){if(!this.#n[A])continue;const S=this.#Re(A);S&&C.push(S)}return C}at($){const C=this.#ye();if(C)return C.at($);if($<0||$>=this.count())return;const A=this.#r?this.#r.at($):$,S=this.#Re(A);return S.index=$,S}byKey($){const C=this.#ye();if(C)return C.byKey($);const A=this.#a.get($);return A===void 0?void 0:this.#Re(A)}leavesOf($){const C=this.#ye();return C&&z(C.leavesOf)?C.leavesOf($):[]}loaded($){return $>=0&&$<this.count()}hint($,C){if(this.#g){this.#g.hint($,C);return}this.#Pe(),this.#p=Math.max(0,Math.floor($))}#Pe(){this.#v||this.#Ve()===this.#T||this.reload()}display(){const $=this.#ye();return $?$.display():u(()=>this.count(),C=>this.at(C))}apply($){if(this.#g)return this.#g.apply($);const C={added:[],updated:[],removed:[]};if(!$)return C;if($.update){let A=!1;for(const S of $.update){const x=this.#a.get(this.#o.keyOf(S,-1));if(x===void 0)continue;const H=this.#Be(x);this.#F?this.#He(x,S):this.#n[x]=S,this.#l.delete(x),this.#B(x,H),this.#P&&(this.#ne(x,S),A=!0),this.#A=!0,C.updated.push(this.#Re(x))}A&&this.#q()}if($.add&&$.add.length){const A=this.#I($.add);for(const S of A)C.added.push(this.#Re(S))}return $.remove&&$.remove.length&&g("source.stream.remove","removing rows from a live stream is not supported; reload instead."),this.#ce(),C}reload($){this.#c.abortAll("reload"),this.#We(),this.#b&&(this.#b.destroy(),this.#b=null),this.#A=!1,this.#n=[],this.#r=null,this.#a.clear(),this.#l.clear(),this.#g=null,this.#S=0,this.#E=0,this.#M=0,this.#P&&(this.#P=[]),this.#N=1/0,this.#R=!1,this.#w=!1,this.#O=!1,this.#u={loaded:0,estimated:void 0},this.#T=this.#Ve(),this.#ke("model:changed",{reason:"reload"}),this.start()}destroy(){this.#v=!0,this.#D!==null&&(clearInterval(this.#D),this.#D=null),this.#$!==null&&(clearInterval(this.#$),this.#$=null),this.#P=null,this.#c.abortAll("destroyed"),this.#We(),this.#f!==null&&(this.#k(this.#f),this.#f=null),this.#b&&(this.#b.destroy(),this.#b=null),this.#g&&this.#g.destroy(),this.#n=[],this.#r=null,this.#a.clear(),this.#l.clear()}async start(){if(this.#O||this.#v||!z(this.#e.open))return;this.#O=!0;const $=this.#c.begin("stream");this.#Te(),this.#xe();let C;try{C=this.#e.open({sort:this.#be("sort",[]),filters:this.#be("filters",null),quick:this.#be("quick","")||void 0,context:this.#be("context",null),signal:$.signal})}catch(S){this.#ke("source:error",{error:S});return}const A=z(C[Symbol.asyncIterator])?C[Symbol.asyncIterator]():C[Symbol.iterator]();this.#G=A;try{for(;;){const S=await A.next();if(!$.current||this.#v)return;if(S.done){this.#ie();return}if(await this.#de(S.value,$),!$.current||this.#v)return;if(S.value&&S.value.done){this.#ie();return}if(await this.#oe(),!$.current||this.#v)return}}catch(S){if(a(S))return;this.#ke("source:error",{error:S})}finally{$.settle()}}progress(){return{loaded:this.#u.loaded,estimated:this.#u.estimated,done:this.#w,live:this.#S,evicted:this.#E}}promoted(){return this.#g!==null}memorySource(){return this.#g}invalidateHandles(){const $=this.#ye();$&&(z($.invalidateHandles)&&$.invalidateHandles(),z($.invalidate)&&$.invalidate("sort"))}renderCount(){return this.#d}ingestStats(){return{worker:this.#Y,inline:this.#x,storeBacked:this.#F}}#de($,C){if(!$)return;const A=$.rows;if(A&&A.length&&this.#Ce(A))return this.#J($,C);const S=Z();A&&A.length&&(this.#I(A),this.#x++),this.#se($),this.#h+=Z()-S,this.#ce()}#se($){this.#u.loaded=$.progress&&typeof $.progress.loaded=="number"?$.progress.loaded:this.#n.length,$.progress&&typeof $.progress.estimated=="number"&&(this.#u.estimated=$.progress.estimated)}#Ce($){if(this.#K||this.#g)return!1;const C=this.#V();if(!C)return!1;const A=this.#t.store;if(!A||!z(A.appendPacked))return!1;const S=this.#X();return!S||!p(S)?(this.#K=!0,c("source.stream.ingest-worker","stream ingest.useWorker is on but a column reads through a closure (a computed or date column); columnizing on the main thread instead."),!1):$.length<C.threshold?!1:!this.#te($)}#te($){if(!this.#o.keyed)return!1;const C=new Set;for(let A=0;A<$.length;A++){const S=this.#o.keyOf($[A],this.#n.length+A);if(S!=null){if(C.has(S)||this.#a.has(S))return!0;C.add(S)}}return!1}async#J($,C){const A=$.rows,S=this.#V(),x=this.#X();let H;try{H=await S.columnize(x,A,{key:"ingest:stream",signal:C&&C.signal})}catch(re){if(a(re)||(g("source.stream.columnize","worker columnization failed; columnizing on the main thread",re),this.#K=!0,C&&(!C.current||this.#v)))return;this.#I(A),this.#x++,this.#se($),this.#ce();return}if(C&&(!C.current||this.#v))return;const V=this.#t.store,W=this.#F?void 0:A,{from:Q}=V.appendPacked(H,W),ee=H.count|0;for(let re=0;re<ee;re++){const ae=Q+re,ue=A[re],ge=this.#o.keyed?this.#o.keyOf(ue,ae):null;if(this.#n[ae]=this.#F?O:ue,this.#S++,this.#ne(ae,ue),ge!==null&&this.#a.set(ge,ae),!this.#r||!this.#le(ae))continue;const Ae=this.#C(ae);this.#r.insert(Ae,ae),Ae<=this.#p&&this.#m++}this.#A=!0,this.#q(),this.#Y++,this.#se($),this.#ce()}#V(){const $=this.#t.ingestWorker;return z($)?$():null}#X(){const $=this.#t.storeSchema;return z($)?$():null}#I($){const C=[],A=this.#t.store,S=new Array($.length),x=[],H=new Set;for(let W=0;W<$.length;W++){const Q=this.#o.keyed?this.#o.keyOf($[W],this.#n.length+x.length):null;S[W]=Q,!(Q!==null&&(this.#a.has(Q)||H.has(Q)))&&(Q!==null&&H.add(Q),x.push($[W]))}let V=x.length&&A&&z(A.append)?A.append(x).from:this.#n.length;for(let W=0;W<$.length;W++){const Q=$[W],ee=S[W];if(ee!==null&&this.#a.has(ee)){const ue=this.#a.get(ee),ge=this.#Be(ue);this.#F||(this.#n[ue]=Q,A&&z(A.setSource)&&A.setSource(ue,Q)),this.#He(ue,Q),this.#l.delete(ue),this.#ne(ue,Q),this.#B(ue,ge);continue}const re=V++;if(this.#n[re]=this.#F?O:Q,this.#S++,this.#ne(re,Q),ee!==null&&this.#a.set(ee,re),C.push(re),!this.#r||!this.#le(re))continue;const ae=this.#C(re);this.#r.insert(ae,re),ae<=this.#p&&this.#m++}return this.#A=!0,this.#q(),C}#Me($){const C=this.#n[$];let A=!1;if(this.#r){const V=this.#Ee($);V>=0&&V<=this.#p&&(A=!0)}else $<=this.#p&&(A=!0);const S=C===O?this.#Se($):C,x=this.#o.keyed?this.#o.keyOf(S,$):null;x!==null&&this.#a.get(x)===$&&this.#a.delete(x),this.#n[$]=void 0,this.#P&&(this.#P[$]=NaN),this.#l.delete($);const H=this.#t.store;return H&&z(H.remove)&&H.remove($),this.#S--,A}#q(){let $=0,C=0;const A=this.#ve();$+=A.dropped,C+=A.aboveAnchor;const S=this.#re();$+=S.dropped,C+=S.aboveAnchor,$&&(this.#A=!0,this.#E+=$,this.#Te(),this.#m-=C,this.#ke("stream:evicted",{evicted:$,total:this.#E,live:this.#S}))}#re(){const $=this.#e.maxRows;if(!Number.isFinite($)||$<=0||this.#S<=$)return{dropped:0,aboveAnchor:0};const C=Math.max(1,Math.floor($*(1-L)));let A=0,S=0;for(;this.#S>C&&this.#M<this.#n.length;){const x=this.#M++;this.#n[x]!==void 0&&(this.#Me(x)&&S++,A++)}return{dropped:A,aboveAnchor:S}}#ve(){const $=this.#U();if(!$||!this.#P||!this.#fe())return{dropped:0,aboveAnchor:0};const C=Date.now()-$;let A=0,S=0,x=1/0;for(let H=this.#M;H<this.#n.length;H++){if(this.#n[H]===void 0)continue;const V=this.#P[H];if(!(Number.isNaN(V)||V===void 0)){if(V>=C){V<x&&(x=V);continue}this.#Me(H)&&S++,A++}}for(this.#N=x,this.#R=!1;this.#M<this.#n.length&&this.#n[this.#M]===void 0;)this.#M++;return{dropped:A,aboveAnchor:S}}#Ee($){if(!this.#r)return $;for(let C=0;C<this.#r.length;C++)if(this.#r.at(C)===$)return C;return-1}#Te(){this.#s=this.#be("sort",[]),this.#i=this.#be("filters",null);const $=Number.isFinite(this.#e.maxRows)&&this.#e.maxRows>0||this.#U()>0,C=this.#be("where",null),A=(this.#t.config||{}).hostFilter,S=!!(C&&C.active)||!!(A&&z(A.active)&&A.active());if(!($||this.#s.length>0||!!this.#i||!!this.#be("quick","")||S)){this.#r=null;return}this.#r=new o(Math.max(64,this.#n.length+64));for(let H=0;H<this.#n.length;H++)this.#n[H]!==void 0&&this.#le(H)&&this.#r.insert(this.#C(H),H)}#le($){const C=this.#Se($);if(this.#i&&!this.#he(this.#i,C))return!1;const A=String(this.#be("quick","")||"").toLowerCase();if(A&&!this.#Ye(C).includes(A))return!1;const S=(this.#t.config||{}).hostFilter;if(S&&z(S.active)&&S.active()&&!S.passes(this.#Re($)))return!1;const x=this.#be("where",null);if(x&&x.active){const H=this.#Re($);if(!x.passes(H.data,H.key))return!1}return!0}#he($,C){if(!$)return!0;const A=$;if(Array.isArray(A.conditions))return A.op==="or"?A.conditions.some(H=>this.#he(H,C)):A.op==="not"?!A.conditions.some(H=>this.#he(H,C)):A.conditions.every(H=>this.#he(H,C));const S=$,x=(this.#t.compute||{}).testValue;return z(x)?!!x(this.#Fe(C,S.col),S,(this.#t.config||{}).locale):(g("source.stream.testValue","ctx.compute.testValue is unavailable; streamed rows are not filtered client-side."),!0)}#Be($){if(!this.#r)return-1;if(!this.#s.length)return this.#Ee($);let C=0,A=this.#r.length;for(;C<A;){const S=C+A>>>1;this.#W(this.#r.at(S),$)<0?C=S+1:A=S}for(let S=C;S<this.#r.length;S++){const x=this.#r.at(S);if(x===$)return S;if(this.#W(x,$)>0)break}return this.#Ee($)}#B($,C){if(!this.#r||!this.#s.length)return;const A=this.#le($);if(C>=0&&this.#r.at(C)===$)this.#r.removeAt(C),C<=this.#p&&this.#m--;else if(C>=0)return;if(!A)return;const S=this.#C($);this.#r.insert(S,$),S<=this.#p&&this.#m++}#C($){if(!this.#r||!this.#s.length)return this.#r?this.#r.length:0;let C=0,A=this.#r.length;for(;C<A;){const S=C+A>>>1;this.#W($,this.#r.at(S))<0?A=S:C=S+1}return C}#W($,C){const A=this.#Se($),S=this.#Se(C);for(const x of this.#s){const H=this.#ze(x.col),V=this.#Fe(A,x.col),W=this.#Fe(S,x.col),ee=(H&&H.value&&z(H.value.compare)?H.value.compare:j)(V,W);if(ee!==0)return x.dir==="desc"?-ee:ee}return 0}#ie(){this.#w=!0,this.#u.loaded=this.#u.loaded||this.#n.length;const $=typeof this.#e.promoteToMemoryBelow=="number"?this.#e.promoteToMemoryBelow:b;!this.#F&&this.#n.length<$&&(this.#g=w({mode:"memory",rows:this.#n},this.#t),this.#$!==null&&(clearInterval(this.#$),this.#$=null),this.#b&&(this.#b.destroy(),this.#b=null)),this.#ce(),this.#ke("stream:end",{loaded:this.#n.length,promoted:this.#g!==null,threshold:$})}#ce(){this.#f!==null||this.#v||(this.#f=this.#we(()=>{this.#f=null,this.#d++;const $=this.#m;this.#m=0,this.#h=0,this.#ke("stream:chunk",{loaded:this.#u.loaded,estimated:this.#u.estimated,count:this.count(),renders:this.#d}),this.#ke("model:changed",{reason:"stream",shiftAboveViewport:$,anchor:this.#p}),this.#ke("rows:changed",{companion:!0,reason:"stream"})}))}#oe(){return this.#d===0||this.#h<this.#ge()?Promise.resolve():(this.#h=0,new Promise($=>{const C=(this.#t.scheduler||{}).idle;z(C)?C(()=>$()):Y(()=>$())}))}#ge(){return typeof this.#e.coalesceMs=="number"&&this.#e.coalesceMs>0?this.#e.coalesceMs:y}#we($){const C=this.#t.scheduler||{};return z(C.frame)?C.frame($):X($)}#k($){const C=this.#t.scheduler||{};z(C.cancel)?C.cancel($):B($)}#Se($){const C=this.#n[$];if(C!==void 0&&C!==O)return C;if(C===void 0)return;const A=this.#t.store;return A&&z(A.source)?A.source($):void 0}#He($,C){const A=this.#t.store;if(!A||!z(A.set))return;const S=this.#X();if(Array.isArray(S))for(const x of S){if(!x||!x.id)continue;const H=z(x.read)?x.read:V=>l(V,x.field||x.id);A.set(x.id,$,H(C))}}#Re($){let C=this.#l.get($);return C||(C=this.#o.leaf(this.#Se($),$),this.#l.set($,C)),C}#Fe($,C){const A=this.#ze(C);return A&&z(A.getValue)?A.getValue($):$?.[C]}#Ye($){const C=this.#t.columns,A=C&&z(C.all)?C.all():[],S=[];for(const x of A){const H=z(x.getValue)?x.getValue($):void 0;H!=null&&H!==""&&S.push(String(H))}return S.join(" ").toLowerCase()}#ze($){const C=this.#t.columns;return C&&z(C.get)?C.get($):void 0}#We(){const $=this.#G;if(this.#G=null,$&&z($.return))try{$.return()}catch{}}#Ve(){return v({context:this.#be("context",null)})}#be($,C){const A=this.#t.state;if(A&&z(A[$])){const S=A[$]();return S??C}return C}#ke($,C){const A=this.#t.emit;z(A)&&A($,C)}}}),Ue("packages/core/src/source/url.js",function(e,U){"use strict";Object.defineProperty(e,"DEFAULT_URL_BATCH",{enumerable:!0,get:function(){return G}}),Object.defineProperty(e,"createUrlSource",{enumerable:!0,get:function(){return g}});const E=U("packages/core/src/internal/warn.js").warnOnce,q=U("packages/core/src/internal/predicates.js"),z=q.isObject,_=q.isFunction,X=U("packages/core/src/internal/paths.js").getPath,Y=U("packages/core/src/source/abort.js").isAbortError,G=500,j=new Set(["application/x-ndjson","application/ndjson","application/jsonlines","application/jsonl","application/x-jsonlines","text/x-ndjson"]),k=Symbol("lattice.url.skip");function g(m,v={}){const h=z(v)?v:{},p=_(h.fetch)?h.fetch:typeof globalThis<"u"&&_(globalThis.fetch)?globalThis.fetch:null,b=h.format==="json"||h.format==="ndjson"?h.format:void 0,O=typeof h.rowsPath=="string"&&h.rowsPath?h.rowsPath:void 0,y=_(h.map)?h.map:void 0,L=z(h.headers)?h.headers:void 0,M=Number.isFinite(h.batchSize)&&h.batchSize>0?Math.floor(h.batchSize):G,D=h.lenient===!0,F=Number.isFinite(h.poll)&&h.poll>0?Math.floor(h.poll):void 0,T=typeof m=="string"&&m.length>0;T||E("source.url.url","createUrlSource needs a URL string; the grid will stay empty.");async function*I(R={}){if(!T)return;if(!p)throw new Error("[lattice] createUrlSource: no fetch available — pass opts.fetch or run where globalThis.fetch exists.");const $=R&&R.signal;let C;try{C=await p(m,L?{signal:$,headers:L}:{signal:$})}catch(x){throw Y(x)?x:new Error(`[lattice] createUrlSource: request to ${m} failed — ${x&&x.message||x}`)}if(!C||!C.ok){const x=C?C.status:"no response";throw new Error(`[lattice] createUrlSource: ${x} for ${m}`)}const A=c(m,b,C),S=C.body&&_(C.body.getReader)?C.body.getReader():null;try{if(!S){const V=await C.text();(A||i(V,m))==="ndjson"?yield*r(null,null,V,0,C,m,M,D):yield*u(V,m,O,y);return}const x=new TextDecoder("utf-8");if(A==="json"){yield*u(await t(S,x,""),m,O,y);return}if(A==="ndjson"){yield*r(S,x,"",0,C,m,M,D);return}const H=await n(S,x,m);H.format==="json"?yield*u(await t(S,x,H.seed),m,O,y):yield*r(S,x,H.seed,H.bytes,C,m,M,D)}finally{if(S&&_(S.cancel))try{await S.cancel()}catch{}}}const P={mode:"stream",open:I,autoStart:h.autoStart!==!1};return F!==void 0&&(P.poll=F),Number.isFinite(h.maxRows)&&(P.maxRows=h.maxRows),Number.isFinite(h.maxAge)&&(P.maxAge=h.maxAge),(typeof h.ageBy=="string"||_(h.ageBy))&&(P.ageBy=h.ageBy),Number.isFinite(h.coalesceMs)&&(P.coalesceMs=h.coalesceMs),Number.isFinite(h.promoteToMemoryBelow)&&(P.promoteToMemoryBelow=h.promoteToMemoryBelow),P}function c(m,v,h){if(v)return v;const p=d(m);if(p)return p;const b=h&&h.headers&&_(h.headers.get)?h.headers.get("content-type"):null;return l(b)}function d(m){const v=String(m).split(/[?#]/)[0].toLowerCase();if(v.endsWith(".ndjson")||v.endsWith(".jsonl"))return"ndjson";if(v.endsWith(".json"))return"json"}function l(m){if(!m)return;const v=m.split(";")[0].trim().toLowerCase();if(j.has(v))return"ndjson";if(v==="application/json"||v==="text/json"||v.endsWith("+json"))return"json"}function i(m,v){const h=m.replace(/^\s+/,""),p=a(h);if(p==="error")throw new Error(`[lattice] createUrlSource: could not tell JSON from NDJSON for ${v} — pass opts.format: 'json' | 'ndjson'.`);return p}async function n(m,v,h){let p="",b=0;for(;;){const{value:y,done:L}=await m.read();if(y&&(b+=y.byteLength,p+=v.decode(y,{stream:!0})),L){p+=v.decode();break}const M=p.replace(/^\s+/,"");if(M){if(M[0]==="[")return{format:"json",seed:p,bytes:b};if(M[0]!=="{"||p.indexOf(`
|
|
8
8
|
`)!==-1)break}}const O=a(p.replace(/^\s+/,""));if(O==="error")throw new Error(`[lattice] createUrlSource: could not tell JSON from NDJSON for ${h} — pass opts.format: 'json' | 'ndjson'.`);return{format:O,seed:p,bytes:b}}function a(m){if(!m||m[0]==="[")return"json";if(m[0]!=="{")return"error";const v=m.indexOf(`
|
|
9
9
|
`);if(v===-1)return"json";let h=m.slice(0,v);return h.endsWith("\r")&&(h=h.slice(0,-1)),s(h)?"ndjson":"json"}function s(m){try{return JSON.parse(m),!0}catch{return!1}}async function t(m,v,h){let p=h;for(;;){const{value:b,done:O}=await m.read();if(b&&(p+=v.decode(b,{stream:!0})),O)break}return p+=v.decode(),p}function*u(m,v,h,p){let b;try{b=JSON.parse(m)}catch(y){throw new Error(`[lattice] createUrlSource: ${v} is not valid JSON — ${y.message}`)}let O=h!==void 0?X(b,h):b;if(p&&(O=p(O)),!Array.isArray(O)){const y=h!==void 0||p?"":"; pass opts.rowsPath or opts.map to select the array";throw new Error(`[lattice] createUrlSource: ${v} did not resolve to an array${y}.`)}yield{rows:O,progress:{loaded:O.length,estimated:O.length}}}async function*r(m,v,h,p,b,O,y,L){const M=w(b);let D=h||"",F=p||0,T=0,I=0,P=[];function*R(){let C;for(;(C=D.indexOf(`
|
|
10
10
|
`))!==-1;){const A=D.slice(0,C);D=D.slice(C+1),I++;const S=o(A,I,O,L);S!==k&&(P.push(S),P.length>=y&&(T+=P.length,yield f(P,T,M,F),P=[]))}}if(m){for(;;){const{value:C,done:A}=await m.read();if(C&&(F+=C.byteLength,D+=v.decode(C,{stream:!0}),yield*R()),A)break}D+=v.decode()}yield*R(),I++;const $=o(D,I,O,L);$!==k&&P.push($),P.length&&(T+=P.length,yield f(P,T,M,F))}function o(m,v,h,p){let b=m;if(b.endsWith("\r")&&(b=b.slice(0,-1)),!b.trim())return k;try{return JSON.parse(b)}catch(O){if(p)return E(`source.url.badline.${h}`,`skipping a malformed NDJSON line (line ${v}) from ${h} — ${O.message}`),k;throw new Error(`[lattice] createUrlSource: malformed NDJSON at line ${v} of ${h} — ${O.message}`)}}function f(m,v,h,p){const b=h&&p>0&&v>0?Math.max(v,Math.round(h/(p/v))):void 0;return{rows:m,progress:{loaded:v,estimated:b}}}function w(m){const v=m&&m.headers&&_(m.headers.get)?m.headers.get("content-length"):null,h=v!=null?Number(v):NaN;return Number.isFinite(h)&&h>0?h:void 0}}),Ue("packages/core/src/source/derive.js",function(e,U){"use strict";Object.defineProperty(e,"FOLLOW_MODES",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"BUCKETS",{enumerable:!0,get:function(){return X}}),Object.defineProperty(e,"DERIVED_ROW_KEY",{enumerable:!0,get:function(){return B}}),Object.defineProperty(e,"DERIVED_SOURCE_KEY",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(e,"UNION_KEY_SEP",{enumerable:!0,get:function(){return G}}),Object.defineProperty(e,"readPath",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"unnest",{enumerable:!0,get:function(){return k}}),Object.defineProperty(e,"bucketOf",{enumerable:!0,get:function(){return g}}),Object.defineProperty(e,"reduceValues",{enumerable:!0,get:function(){return d}}),Object.defineProperty(e,"applyLimit",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"applyCumulative",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"groupRows",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"finishGroups",{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,"derive",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"normalizeUnionSource",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"namespaceUnionKeys",{enumerable:!0,get:function(){return w}}),Object.defineProperty(e,"joinRows",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"preGroup",{enumerable:!0,get:function(){return v}}),Object.defineProperty(e,"buildJoinIndex",{enumerable:!0,get:function(){return h}}),Object.defineProperty(e,"joinOne",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"joinKeyOf",{enumerable:!0,get:function(){return b}});const te=U("packages/core/src/internal/predicates.js"),E=te.isFunction,q=te.isObject,_=U("packages/core/src/compute/total.js").TOTAL_FNS,Z=Object.freeze(["filtered","all","selected","grouped"]),X=Object.freeze(["day","week","month","quarter","year"]),B="__key",Y="__source",G="";function j(O,y){if(!q(O)||typeof y!="string")return;if(!y.includes("."))return O[y];let L=O;for(const M of y.split(".")){if(!q(L))return;L=L[M]}return L}function k(O,y){const L=[];for(const M of O){const D=j(M,y);if(!(!Array.isArray(D)||!D.length))for(const F of D)L.push({...M,[y]:F})}return L}function g(O,y){const L=O instanceof Date?O:new Date(O),M=L.getTime();if(!Number.isFinite(M))return null;const D=L.getUTCFullYear(),F=L.getUTCMonth(),T=L.getUTCDate(),I=P=>P.toISOString().slice(0,10);switch(y){case"year":return I(new Date(Date.UTC(D,0,1)));case"quarter":return I(new Date(Date.UTC(D,Math.floor(F/3)*3,1)));case"month":return I(new Date(Date.UTC(D,F,1)));case"week":{const P=(L.getUTCDay()+6)%7;return I(new Date(Date.UTC(D,F,T-P)))}default:return I(new Date(Date.UTC(D,F,T)))}}function c(O,y,L){const M=y.map(D=>L&&L.of===D?g(j(O,D),L.by):j(O,D));return{key:M.map(D=>D==null?"\0":String(D)).join(""),values:M}}function d(O,y){const L=_[y];return L?L({get:M=>O[M]},n(O.length)):null}function l(O,y){return!y||typeof y.of!="string"||y.of===""||O&&O.includes(y.of)?O:[y.of,...O||[]]}function i(O,y){const L={},M=n(O.length);for(const[D,F]of Object.entries(y)){const T=F.fn||"count",I=_[T];if(!I){L[D]=null;continue}const P=F.of?O.map(R=>j(R,F.of)):[];L[D]=I({get:R=>P[R]},M)}return L}const n=(()=>{const O=new Map;return y=>{let L=O.get(y);if(!L){L=new Uint32Array(y);for(let M=0;M<y;M++)L[M]=M;O.size<512&&O.set(y,L)}return L}})();function a(O,y,L){if(!Number.isFinite(y)||y<=0)return O;if(!L)return O.slice(0,y);const M=new Map,D=[];for(const F of O){const T=String(j(F,L)),I=M.get(T)||0;I>=y||(M.set(T,I+1),D.push(F))}return D}function s(O,y){const L=O.reduce((T,I)=>T+(Number(j(I,y.of))||0),0);if(!L)return O;const M=L*y.upTo;let D=0;const F=[];for(const T of O)if(F.push(T),D+=Number(j(T,y.of))||0,D>=M)break;return F}function t(O,y){return!Array.isArray(y)||!y.length?O:[...O].sort((L,M)=>{for(const D of y){const F=j(L,D.col),T=j(M,D.col);if(F===T)continue;return F==null?1:T==null?-1:((typeof F=="number"&&typeof T=="number"?F<T:String(F)<String(T))?-1:1)*(D.dir==="desc"?-1:1)}return 0})}function u(O,y,L){const M=y.groupBy?Array.isArray(y.groupBy)?y.groupBy:[y.groupBy]:null,D=q(y.bucket)?y.bucket:null,F=l(M,D),T=new Map,I=new Map;if(!F)return{groups:T,rowGroup:I};for(const P of O){const{key:R,values:$}=c(P,F,D);let C=T.get(R);C||(C={values:$,rows:new Map},T.set(R,C));const A=L(P);C.rows.set(A,P),I.set(A,R)}return{groups:T,rowGroup:I}}function r(O,y,L=null,M=null){const D=y.groupBy?Array.isArray(y.groupBy)?y.groupBy:[y.groupBy]:null,F=q(y.bucket)?y.bucket:null,T=l(D,F);let I=[...O.entries()].map(([P,R])=>{if(L&&M&&!M.has(P)){const C=L.get(P);if(C)return C}const $={[B]:P};return T.forEach((C,A)=>{$[C.includes(".")?C.split(".").pop():C]=R.values[A]}),Object.assign($,i([...R.rows.values()],y.select||{})),L&&L.set(P,$),$});return I=t(I,y.sort),q(y.cumulative)&&(I=s(I,y.cumulative)),a(I,y.limit,y.limitPer||null)}function o(O,y){const L=v(O,y),M=y.groupBy?Array.isArray(y.groupBy)?y.groupBy:[y.groupBy]:null,D=q(y.bucket)?y.bucket:null,F=l(M,D);let T;if(!F)T=L.map((I,P)=>({...I,[B]:String(j(I,y.rowKey||"id")??P)}));else{const I=new Map;for(const P of L){const{key:R,values:$}=c(P,F,D);let C=I.get(R);C||(C={values:$,rows:[]},I.set(R,C)),C.rows.push(P)}T=[...I.entries()].map(([P,R])=>{const $={[B]:P};return F.forEach((C,A)=>{$[C.includes(".")?C.split(".").pop():C]=R.values[A]}),Object.assign($,i(R.rows,y.select||{})),$})}return T=t(T,y.sort),q(y.cumulative)&&(T=s(T,y.cumulative)),a(T,y.limit,y.limitPer||null)}function f(O,y){const M=q(O)&&q(O.grid)?O:{grid:O};return{grid:q(M.grid)?M.grid:null,label:M.label!=null&&M.label!==""?String(M.label):String(y),follow:typeof M.follow=="string"?M.follow:void 0,map:E(M.map)?M.map:null}}function w(O){for(const y of O){const L=y[Y];L!==void 0&&(y[B]=`${L}${G}${y[B]}`)}return O}function m(O,y){const L=y.on,M=q(L)?String(L.left||L.right||""):String(L||""),D=q(L)?String(L.right||L.left||""):String(L||"");if(!M||!D)return O;const F=y.index instanceof Map?y.index:h(Array.isArray(y.rows)?y.rows:[],D),T=Array.isArray(y.select)?y.select.map(String):null,I=y.prefix?String(y.prefix):"",P=String(y.type||"inner")==="left",R=[];for(const $ of O){const C=j($,M),A=C==null?void 0:F.get(String(C));if(!A){P&&R.push($);continue}const S={...$},x=T||Object.keys(A);for(const H of x)!I&&H===M||(S[I?I+H:H]=j(A,H));R.push(S)}return R}function v(O,y){let L=Array.isArray(O)?O:[];return y.unnest&&(L=k(L,y.unnest)),q(y.join)&&(Array.isArray(y.join.rows)||y.join.index instanceof Map)&&(L=m(L,y.join)),E(y.where)&&(L=L.filter(M=>!!y.where(M))),L}function h(O,y){const L=new Map;for(const M of O){const D=j(M,y);if(D==null)continue;const F=String(D);L.has(F)||L.set(F,M)}return L}function p(O,y){const L=y.on,M=q(L)?String(L.left||L.right||""):String(L||""),D=q(L)?String(L.right||L.left||""):String(L||"");if(!M||!D)return O;const F=y.index instanceof Map?y.index:new Map,T=j(O,M),I=T==null?void 0:F.get(String(T));if(!I)return String(y.type||"inner")==="left"?O:null;const P=Array.isArray(y.select)?y.select.map(String):null,R=y.prefix?String(y.prefix):"",$={...O};for(const C of P||Object.keys(I))!R&&C===M||($[R?R+C:C]=j(I,C));return $}function b(O,y){const L=j(O,y);return L==null?null:String(L)}}),Ue("packages/core/src/source/derived.js",function(e,U){"use strict";Object.defineProperty(e,"IDLE_REFRESH_MS",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"PROFILE_FIELDS",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"ALERT_THRESHOLDS",{enumerable:!0,get:function(){return w}}),Object.defineProperty(e,"STATISTICS_FNS",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"SERIES_METRICS",{enumerable:!0,get:function(){return v}}),Object.defineProperty(e,"PRODUCER_IGNORED_KEYS",{enumerable:!0,get:function(){return h}}),Object.defineProperty(e,"profileAlerts",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"DerivedSource",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"createDerivedSource",{enumerable:!0,get:function(){return D}});const te=U("packages/core/src/internal/predicates.js"),E=te.isFunction,q=te.isObject,_=U("packages/core/src/internal/warn.js").warnOnce,X=U("packages/core/src/source/memory.js").MemorySource,Y=U("packages/core/src/source/settle.js").isPipelineSettle,G=U("packages/core/src/source/derive.js"),j=G.derive,k=G.preGroup,g=G.groupRows,c=G.finishGroups,d=G.readPath,l=G.buildJoinIndex,i=G.joinOne,n=G.joinKeyOf,a=G.FOLLOW_MODES,s=G.DERIVED_ROW_KEY,t=G.DERIVED_SOURCE_KEY,u=G.normalizeUnionSource,r=G.namespaceUnionKeys,o=16,f=Object.freeze(["column","rows","present","missing","numeric","distinct","min","max","mean","median","q1","q3","iqr","stddev","outliers","alerts","alertCount"]),w=Object.freeze({missing:.2,cardinality:.9,skew:1,outliers:.05}),m=Object.freeze(["correlation","series","datasetVsDataset"]),v=Object.freeze(["n","first","last","change","changePercent","volatility","annualisedVolatility","growth","maxDrawdown","maxDrawdownFrom","maxDrawdownTo","autocorrelation","upDays","downDays"]),h=Object.freeze(["unnest","join","where","bucket","groupBy","select","sort","limit","limitPer","cumulative"]);function p(F,T={}){const I={...w,...q(T)?T:{}},P=ee=>typeof ee=="number"&&Number.isFinite(ee)?ee:null,R=P(F.rows)??0,$=P(F.numeric)??0,C=P(F.missing)??0,A=P(F.distinct),S=P(F.mean),x=P(F.median),H=P(F.stddev),V=P(Array.isArray(F.outliers)?F.outliers.length:F.outliers),W=$>0,Q=[];return A===0?["empty"]:(A===1&&Q.push("constant"),R>0&&C/R>=I.missing&&Q.push("high-missing"),!W&&A!==null&&R>1&&A===R&&C===0?Q.push("unique"):A!==null&&R>0&&A/R>=I.cardinality&&Q.push("high-cardinality"),W&&S!==null&&x!==null&&H!==null&&H>0&&Math.abs(3*(S-x)/H)>=I.skew&&Q.push("skewed"),W&&V!==null&&V/$>=I.outliers&&Q.push("outliers"),Q)}class b extends X{#e=null;#t={};#n=[];#r=null;#s=!1;#i={};#o=!1;#l=null;#a=null;#c=!1;#u=null;#f=!1;#d=null;constructor(T,I){super({mode:"memory",rows:[]},I),this.#i=I||{},this.#t=q(T)?T:{};const P=this.#t.from;if(Array.isArray(P)){if(this.#e=null,this.#d=this.#g(P),!this.#d.length){_("source.derived.from",'source.mode "derived" needs `from`: at least one grid to derive from.');return}this.#t.follow!==void 0&&_("source.derived.union.follow",'source.mode "derived": `follow` is ignored when `from` is a union of several grids (BACKLOG-0001045) — each entry carries its own `follow` instead.'),this.#t.crossFilter&&_("source.derived.union.crossfilter",'source.mode "derived": `crossFilter` is not supported when `from` is a union of several grids (BACKLOG-0001045) — it has no single target once there is more than one parent. Push a filter onto the individual source grid you mean instead.'),this.#t.statistics!==void 0&&(_("source.derived.union.statistics",'source.mode "derived": `statistics` is not supported when `from` is a union of several grids (BACKLOG-0001046) — a relational statistic reduces one grid\'s own columns, and a union has no single set of them. Derive the statistics of a single grid instead.'),this.#f=!0),this.#m(),this.#b(),this.refresh();return}if(this.#e=P||null,!this.#e){_("source.derived.from",'source.mode "derived" needs `from`: the grid to derive from.');return}this.#t.follow&&!a.includes(String(this.#t.follow))&&_(`source.derived.follow.${this.#t.follow}`,`unknown follow "${this.#t.follow}"; using "filtered". Known: ${a.join(", ")}.`),this.#h()||(this.#f=!0),this.#m(),this.#b(),this.refresh()}#h(){const T=this.#t.statistics;if(T===void 0)return!0;if(this.#t.profile!==void 0)return _("source.derived.producer.conflict",'source.mode "derived": `profile` and `statistics` are both terminal producers and cannot be used together — each replaces the pipeline with its own output builder. Declare one, or chain a second derived grid whose `from` is the first.'),!1;if(!q(T))return _("source.derived.statistics.shape",`source.mode "derived": \`statistics\` needs an object naming the statistic, e.g. \`{ fn: 'correlation', columns: ['a', 'b'] }\`. Known fn: ${m.join(", ")}.`),!1;const I=String(T.fn||"");return m.includes(I)?this.#p(I,T):(_(`source.derived.statistics.fn.${I}`,`source.mode "derived": unknown \`statistics.fn\` "${I}". Known: ${m.join(", ")}. Every *single-column* statistic is reached through \`select\` instead, e.g. \`select: { p95: { of: 'amount', fn: 'p95' } }\`.`),!1)}#p(T,I){if(T==="correlation"){if((Array.isArray(I.columns)?I.columns.filter(Boolean):[]).length<2)return _("source.derived.statistics.columns","source.mode \"derived\": `statistics: { fn: 'correlation' }` needs `columns`: at least two column ids to correlate pairwise."),!1;const R=I.orient===void 0?"pairs":String(I.orient);return R!=="pairs"&&R!=="matrix"&&_(`source.derived.statistics.orient.${R}`,`source.mode "derived": unknown \`statistics.orient\` "${R}" for \`fn: 'correlation'\`; using "pairs". Known: pairs, matrix.`),!0}return T==="series"?!I.of||!I.by?(_("source.derived.statistics.series","source.mode \"derived\": `statistics: { fn: 'series' }` needs both `of` (the column to summarise) and `by` (the column that orders it). `by` is never guessed — kernels see rows in arrival order, which is not the grid's sort."),!1):!0:q(I.with)?!0:(_("source.derived.statistics.with","source.mode \"derived\": `statistics: { fn: 'datasetVsDataset' }` needs `with`: the second grid to compare this one against."),!1)}#m(){const T=this.#t.statistics!==void 0?"statistics":this.#t.profile!==void 0?"profile":null;if(!T)return;const I=h.filter(P=>this.#t[P]!==void 0);I.length&&_(`source.derived.producer.ignored.${T}`,`source.mode "derived": \`${T}\` is a terminal producer and replaces the pipeline, so ${I.map(P=>`\`${P}\``).join(", ")} ${I.length>1?"are":"is"} ignored. Sort, filter or limit the derived grid itself, or chain a second derived grid whose \`from\` is this one.`)}#g(T){const I=this.#i&&this.#i.grid,P=new Set,R=[];return T.forEach(($,C)=>{const A=u($,C);if(P.has(A.label)&&_(`source.derived.union.label.${A.label}`,`source.mode "derived": two union sources share the label "${A.label}"; give each a distinct \`label\` or __source/__key will not distinguish them.`),P.add(A.label),!A.grid){_(`source.derived.union.missing.${A.label}`,`source.mode "derived": union source "${A.label}" has no grid and was skipped.`),R.push(A);return}if(I&&E(A.grid.on)){const S=y(I,A.grid,[A.label]);if(S){_(`source.derived.union.cycle.${A.label}`,`source.mode "derived": union source "${A.label}" was refused — it derives from the grid being derived, directly or through a chain (${S.join(" → ")}). Remove it from \`from\`.`),R.push({...A,grid:null});return}}R.push(A)}),R}#b(){if(this.#d){this.#A(),this.#w();return}const T=this.#e;if(!T||!E(T.on))return;const I=String(this.#t.follow||"filtered"),P=["rows:changed"];(I==="filtered"||I==="grouped")&&P.push("filter:changed","model:changed"),I==="selected"&&P.push("selection:changed"),I==="grouped"&&P.push("column:grouped");for(const R of P){const $=C=>{R==="rows:changed"&&O(C)||R==="model:changed"&&!Y(C)||this.schedule(R==="rows:changed"?C:null)};T.on(R,$),this.#n.push(()=>E(T.off)&&T.off(R,$))}this.#w(),this.#y()}#y(){const T=this.#t.statistics,I=q(T)?T.with:null;if(!q(I)||!E(I.on))return;const P=I;for(const R of["rows:changed","filter:changed","model:changed"]){const $=C=>{R==="rows:changed"&&O(C)||R==="model:changed"&&!Y(C)||this.schedule(null)};P.on(R,$),this.#n.push(()=>E(P.off)&&P.off(R,$))}}#A(){for(const T of this.#d){const I=T.grid;if(!I||!E(I.on))continue;const P=a.includes(String(T.follow))?String(T.follow):"filtered",R=["rows:changed"];(P==="filtered"||P==="grouped")&&R.push("filter:changed","model:changed"),P==="selected"&&R.push("selection:changed"),P==="grouped"&&R.push("column:grouped");for(const $ of R){const C=A=>{$==="rows:changed"&&O(A)||$==="model:changed"&&!Y(A)||this.schedule(null)};I.on($,C),this.#n.push(()=>E(I.off)&&I.off($,C))}}}#w(){const T=this.#t.join,I=T&&T.with;if(!I||!E(I.on))return;const R=String(T.follow||"all")==="all"?["rows:changed"]:["rows:changed","filter:changed","model:changed"];for(const $ of R){const C=A=>{$==="rows:changed"&&O(A)||$==="model:changed"&&!Y(A)||this.schedule({partner:!0})};I.on($,C),this.#n.push(()=>E(I.off)&&I.off($,C))}}#O(){const T=this.#t.join;if(!T||!T.with)return null;const I=T.on,P=q(I)?String(I.left||I.right||""):String(I||""),R=q(I)?String(I.right||I.left||""):String(I||"");return P&&R?{left:P,right:R}:null}#v(){const T=this.#O();if(!T)return this.#u=null,null;const I=this.#u;if(this.#u=l(this.#E(),T.right),!I)return null;const P=this.#t.join||{},R=Array.isArray(P.select)?P.select.map(String):null,$=S=>S?(R||Object.keys(S)).map(H=>String(d(S,H))).join(""):null,C=new Set,A=new Set;for(const[S,x]of this.#u)$(x)!==$(I.get(S))&&(C.add(S),I.has(S)||A.add(S));for(const S of I.keys())this.#u.has(S)||C.add(S);return{affected:C,gained:A}}#T(T,I){const P=this.#l;if(!P||!P.leftByJoinKey)return null;const R=[];for(const $ of T){const C=P.leftByJoinKey.get($);if(C)for(const A of C){const S=P.rowData.get(A);S!==void 0&&R.push({key:A,data:S})}}return this.#N({updated:R,added:[],removed:[]},I)}#S(T,I){if(!this.#l||!this.#l.leftByJoinKey||T.unnest||T.where||String(T.follow||"filtered")==="grouped")return!1;const P=T.join||{};return String(P.type||"inner")==="left"?!0:I.size===0}#E(){const T=this.#t.join,I=T&&T.with;if(!I||!I.rows)return[];const P=[],R=$=>{$.group||P.push(L($))};return String(T.follow||"all")==="filtered"&&E(I.rows.forEach)?I.rows.forEach(R):E(I.rows.forEachAll)&&I.rows.forEachAll(R),P}schedule(T){const I=this.#t.refresh===void 0?"idle":this.#t.refresh;if(I==="manual")return;if(I==="live"){this.refresh(T);return}const P=typeof I=="number"&&Number.isFinite(I)?I:o;if(this.#r){this.#c=!0;return}this.#c=!1,this.#r=setTimeout(()=>{this.#r=null,this.refresh(this.#c?null:T)},P)}refresh(T){if(!(this.#s||!this.#e&&!this.#d)){if(this.#o){_("source.derived.cycle","a derived grid is deriving from itself, directly or through a chain. The cycle was refused; check the `from` of each grid in the chain.");return}this.#o=!0;try{const I=this.#f?[]:this.#d?this.#t.profile?this.#Y():this.#F():this.#t.statistics!==void 0?this.#ne():this.#t.profile?this.#me():this.#M(T);this.setRows(I),this.invalidate("filter"),E(this.#i.emit)&&this.#i.emit("rows:changed",{derived:!0},"derived")}finally{this.#o=!1}}}#M(T){const P=q(T)&&T.partner===!0?this.#v():null,R=this.#_();if(P&&this.#l){if(!P.affected.size)return c(this.#l.groups,R,this.#l.reduced,new Set);if(this.#S(R,P.gained)){const re=this.#T(P.affected,R);if(re)return c(this.#l.groups,R,this.#l.reduced,re)}}const $=this.#P(R,T);if($&&this.#l){const re=this.#N($,R);return c(this.#l.groups,R,this.#l.reduced,re)}const C=k(this.#x(),R);if(this.#a=this.#$(),!R.groupBy)return this.#l=null,j(C,R);const A=this.#R(),{groups:S,rowGroup:x}=g(C,R,A),H=new Map;for(const[re,ae]of x){const ue=S.get(ae);ue&&H.set(re,ue.rows.get(re))}const V=new Map,W=this.#O(),Q=new Map,ee=new Map;if(W)for(const[re,ae]of H){const ue=n(ae,W.left);if(ue===null)continue;Q.set(re,ue);let ge=ee.get(ue);ge||(ge=new Set,ee.set(ue,ge)),ge.add(re)}return this.#l={groups:S,rowGroup:x,rowData:H,reduced:V,leftJoinKey:Q,leftByJoinKey:ee},c(S,R,V,null)}#P(T,I){if(!this.#l||!T.groupBy||T.unnest||T.where||String(T.follow||"filtered")==="grouped"||q(T.join)&&T.join.with&&!(T.join.index instanceof Map)||!q(I))return null;const P=Array.isArray(I.updated)?I.updated:null,R=Array.isArray(I.added)?I.added:null,$=Array.isArray(I.removed)?I.removed:null;if(!P&&!R&&!$)return null;const C=this.#a;if(C&&C.size&&String(T.follow||"filtered")!=="all"){if(I.edit===!0&&Array.isArray(I.columns)){for(const A of I.columns)if(C.has(String(A)))return null}for(const A of P||[]){const S=A&&A.key,x=S===void 0?void 0:this.#l.rowData.get(String(S)),H=L(A);for(const V of C)if(d(x,V)!==d(H,V))return null}}return{updated:P||[],added:R||[],removed:$||[]}}#N(T,I){const P=this.#l,R=this.#R(),$=new Set,C=q(I.join)&&I.join.index instanceof Map?I.join:null,A=this.#O(),S=H=>{const V=P.rowGroup.get(H);if(V===void 0)return;$.add(V);const W=P.groups.get(V);if(W&&(W.rows.delete(H),W.rows.size||P.groups.delete(V)),P.rowGroup.delete(H),P.rowData.delete(H),P.leftJoinKey){const Q=P.leftJoinKey.get(H);if(Q!==void 0){const ee=P.leftByJoinKey.get(Q);ee&&(ee.delete(H),ee.size||P.leftByJoinKey.delete(Q)),P.leftJoinKey.delete(H)}}},x=H=>{const V=C?i(H,C):H;if(!V)return;const W=R(V),Q=g([V],I,R);for(const[ee,re]of Q.groups){let ae=P.groups.get(ee);ae||(ae={values:re.values,rows:new Map},P.groups.set(ee,ae)),ae.rows.set(W,V),P.rowGroup.set(W,ee),$.add(ee)}if(P.rowData.set(W,V),A&&P.leftByJoinKey){const ee=n(V,A.left);if(ee!==null){P.leftJoinKey.set(W,ee);let re=P.leftByJoinKey.get(ee);re||(re=new Set,P.leftByJoinKey.set(ee,re)),re.add(W)}}};for(const H of T.removed)S(String(H));for(const H of T.updated)S(String(H.key)),x(L(H));for(const H of T.added)x(L(H));return $}#R(){const T=this.#e,I=T&&T.config&&T.config.rowKey||"id";return P=>String(d(P,typeof I=="string"?I:"id")??"")}#$(){const T=this.#e,I=T&&T.state&&E(T.state.get)?T.state.get():null,P=new Set,R=$=>{if($){if(Array.isArray($.conditions)){$.conditions.forEach(R);return}$.col&&P.add(String($.col))}};return I&&R(I.filters),P}#_(){let T=this.#t;if(T.join&&T.join.with&&(this.#u||this.#v(),T={...T,join:{...T.join,index:this.#u}}),this.#d||String(T.follow||"filtered")!=="grouped")return T;const I=this.#e,P=I&&I.state&&E(I.state.get)?I.state.get():null,R=P&&Array.isArray(P.group)?P.group:[];return R.length?{...T,groupBy:[...R]}:T}#G(){const T=[];for(const I of this.#d)if(I.grid)try{const P=a.includes(String(I.follow))?String(I.follow):"filtered",R=this.#D(I.grid,P);for(const $ of R){const C=I.map?I.map($):$;q(C)&&T.push({...C,[t]:I.label})}}catch(P){_(`source.derived.union.failed.${I.label}`,`source.mode "derived": union source "${I.label}" failed to read (${P&&P.message?P.message:P}) and was skipped this pass.`)}return T}#D(T,I){if(!T||!T.rows)return[];if(I==="all"){const R=[];return E(T.rows.forEachAll)&&T.rows.forEachAll($=>{$.group||R.push(L($))}),R}if(I==="selected")return(T.selection&&E(T.selection.rows)?T.selection.rows():[]).filter(Boolean).map(L);const P=[];return E(T.rows.forEach)&&T.rows.forEach(R=>{R.group||P.push(L(R))}),P}#F(){const T=this.#_(),I=this.#G(),P=j(I,T);return T.groupBy?P:r(P)}#Y(){return _("source.derived.union.profile",'source.mode "derived": `profile` is not supported when `from` is a union of several grids (BACKLOG-0001045); profile a single grid instead.'),[]}#x(){const T=this.#e,I=String(this.#t.follow||"filtered");if(!T||!T.rows)return[];if(I==="all"){const $=[];return E(T.rows.forEachAll)&&T.rows.forEachAll(C=>{C.group||$.push(L(C))}),$}if(I==="selected")return(T.selection&&E(T.selection.rows)?T.selection.rows():[]).filter(Boolean).map(L);const P=this.#K(),R=[];return P&&this.#U().length&&E(T.rows.forEachExcept)?(T.rows.forEachExcept(P,$=>{$.group||R.push(L($))}),R):(E(T.rows.forEach)&&T.rows.forEach($=>{$.group||R.push(L($))}),R)}#K(){const T=this.#t.crossFilter;if(!T||this.#d)return null;if(typeof T=="string")return T;if(T.col)return String(T.col);const I=this.#t.groupBy,P=Array.isArray(I)?I[0]:I;return P?String(P):null}#U(){const T=this.#K(),I=this.#e;if(!T||!I||!I.filters||!E(I.filters.get))return[];const P=M(I.filters.get(),T);return P?P.op==="in"&&Array.isArray(P.value)?P.value.map(String):P.op==="eq"&&P.value!==void 0?[String(P.value)]:[]:[]}#H(T){const I=this.#K(),P=this.#e;if(!I||!P||!P.filters||!E(P.filters.set))return;const R=this.#i.compute||{},$=E(P.filters.get)?P.filters.get():null,C=E(R.pruneColumn)?R.pruneColumn($,I):null;if(!T.length){P.filters.set(C||null);return}const A=T.length===1?{col:I,op:"eq",value:T[0]}:{col:I,op:"in",value:T.slice()},S=C?C.conditions&&C.op?C.conditions:[C]:[];P.filters.set(S.length?{op:"and",conditions:[...S,A]}:A)}crossFilter(){const T=this;return{enabled(){return!!T.#K()},column(){return T.#K()},get(){return T.#U()},set(I){const P=I==null?[]:(Array.isArray(I)?I:[I]).map(R=>String(R));T.#H(P)},toggle(I){const P=String(I),R=T.#U(),C=R.indexOf(P)>=0?R.filter(A=>A!==P):[...R,P];T.#H(C)},clear(){T.#H([])}}}#fe(T){const I=T&&T.rows;if(I&&E(I.matchCount)){const P=I.matchCount(),R=Number(P);if(P!==null&&Number.isFinite(R))return R}if(I&&E(I.count)){const P=Number(I.count());if(Number.isFinite(P))return P}return 0}#ne(){const T=this.#e,I=this.#t.statistics;if(!T||!T.statistics||!q(I))return[];switch(String(I.fn)){case"correlation":return this.#pe(T,I);case"series":return this.#xe(T,I);case"datasetVsDataset":return this.#Oe(T,I);default:return[]}}#pe(T,I){const P=I.columns.filter(Boolean).map(String),R=this.#fe(T),$=(C,A)=>{const S=T.statistics.correlation(C,A);return typeof S=="number"&&Number.isFinite(S)?S:null};if(String(I.orient||"pairs")!=="matrix"){const C=[];for(let A=0;A<P.length;A++)for(let S=A+1;S<P.length;S++)C.push({[s]:`${P[A]}${P[S]}`,a:P[A],b:P[S],coefficient:$(P[A],P[S]),n:R});return C}return P.map(C=>{const A={[s]:C,column:C};for(const S of P)A[S]=C===S?1:$(C,S);return A.n=R,A})}#xe(T,I){const P=this.#fe(T),R={by:String(I.by)};I.periodsPerYear!==void 0&&(R.periodsPerYear=Number(I.periodsPerYear));const $=T.statistics.series(String(I.of),R)||{};return v.map(C=>({[s]:C,metric:C,value:$[C]??null,n:P}))}#Oe(T,I){const P=I.with,R=Array.isArray(I.columns)?{columns:I.columns.map(String)}:void 0,$=T.statistics.datasetVsDataset(P,R);if(!q($))return[];const A=(Array.isArray($.ranked)?$.ranked:[]).map(H=>({[s]:String(H.column),column:H.column,measure:H.measure??null,magnitude:H.magnitude??null,distance:H.distance??null,direction:H.direction??null,nA:H.nA??null,nB:H.nB??null,reliable:H.reliable??null,unmatched:""})),S=$.unmatched,x=[["A",S&&S.onlyA],["B",S&&S.onlyB]];for(const[H,V]of x)for(const W of V||[])A.push({[s]:`${H}${W}`,column:W,measure:null,magnitude:null,distance:null,direction:null,nA:null,nB:null,reliable:!1,unmatched:H});return A}#me(){const T=this.#e;if(!T||!T.statistics||!E(T.statistics.profile))return[];const P=(Array.isArray(this.#t.profile)?this.#t.profile:[this.#t.profile]).filter(Boolean).map($=>{const C=T.statistics.profile(String($))||{},A={[s]:String($)};for(const x of f)A[x]=x==="column"?String($):C[x]??null;A.outliers=Array.isArray(C.outliers)?C.outliers.length:C.outliers??null;const S=p({...C,rows:A.rows,outliers:A.outliers,numeric:C.numeric},this.#t.alerts);return A.alerts=S.join(", "),A.alertCount=S.length,A});if(this.#t.orient!=="metrics")return P;const R=P[0];return R?f.filter($=>$!=="column").map($=>({[s]:$,metric:$,value:R[$]})):[]}apply(T){const I=["add","update","remove"],P=[];for(const R of I)for(const $ of T&&T[R]||[])P.push({operation:R,id:$&&$.id,reason:"derived-read-only"});return P.length&&_("source.derived.readonly","a derived grid is read-only: its rows are computed from another grid. Write to the source grid instead, and the derived one follows."),{added:[],updated:[],removed:[],rejected:P}}destroy(){this.#s=!0,this.#r&&(clearTimeout(this.#r),this.#r=null),this.#K()&&this.#U().length&&this.#H([]);for(const T of this.#n)try{T()}catch{}this.#n=[],this.#e=null,this.#d=null,super.destroy()}}function O(F){return q(F)&&F.companion===!0}function y(F,T,I,P=new Set){if(T===F)return I;if(P.has(T))return null;P.add(T);let R=null;try{R=E(T.config)?T.config():null}catch{R=null}const $=R&&q(R.source)?R.source:null;if(!$||$.mode!=="derived")return null;const C=$.from;if(Array.isArray(C)){for(let A=0;A<C.length;A++){const S=u(C[A],A);if(!S.grid||!E(S.grid.on))continue;const x=y(F,S.grid,[...I,S.label],P);if(x)return x}return null}return q(C)&&E(C.on)?y(F,C,[...I,"(from)"],P):null}function L(F){return q(F)&&"data"in F?F.data:F}function M(F,T){if(!F||typeof F!="object")return null;if(Array.isArray(F.conditions)){for(const P of F.conditions){const R=M(P,T);if(R)return R}return null}return F.col===T?F:null}function D(F,T){return new b(F,T)}}),Ue("packages/core/src/source/adapters/odata.js",function(e,U){"use strict";Object.defineProperty(e,"conditionToOData",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"filtersToOData",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"odataAdapter",{enumerable:!0,get:function(){return f}});const E=U("packages/core/src/internal/warn.js").warnOnce,z=U("packages/core/src/source/filterwire.js").isGroup,_=Object.freeze(["eq","ne","gt","gte","lt","lte","contains","startsWith","endsWith","blank","notBlank","between","notBetween"]),Z=/^\d{4}-\d{2}-\d{2}$/,X=/^\d{2}:\d{2}(:\d{2}(\.\d+)?)?$/,B=/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d+)?(Z|[+-]\d{2}:\d{2})$/;function Y(w){const m=w instanceof Date?w:typeof w=="number"&&Number.isFinite(w)?new Date(w):typeof w=="string"&&B.test(w)?new Date(w):null;return m&&!Number.isNaN(m.getTime())?m:null}const G=/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}(:\d{2}(\.\d+)?)?$/;function j(w,m){throw typeof m=="string"&&G.test(m)?new Error(`odataAdapter: "${m}" needs a zone designator to be used as a ${w} value — add "Z" for UTC or a "+HH:MM"/"-HH:MM" offset. A date-time with no zone is ambiguous (whose local time?) and would otherwise silently become the wrong instant rather than the one intended.`):new Error(`odataAdapter: "${String(m)}" is not a usable ${w} value`)}function k(w){const m=Y(w);return m||j("DateTimeOffset",w),m.toISOString()}function g(w){if(typeof w=="string"&&Z.test(w))return w;const m=Y(w);return m||j("Date",w),m.toISOString().slice(0,10)}function c(w){if(typeof w=="string"&&X.test(w))return w.length===5?`${w}:00`:w;if(typeof w=="number"&&Number.isFinite(w)&&w>=0&&w<864e5){const m=Math.floor(w),v=h=>String(h).padStart(2,"0");return`${v(Math.floor(m/36e5))}:${v(Math.floor(m%36e5/6e4))}:${v(Math.floor(m%6e4/1e3))}`}throw new Error(`odataAdapter: "${String(w)}" is not a usable TimeOfDay value`)}const d=Object.freeze({timestamp:k,datetime:k,date:g,dateString:g,time:c}),l=200,i=1e3,n=Object.freeze({eq:"eq",ne:"ne",gt:"gt",gte:"ge",lt:"lt",lte:"le"});function a(w,m){if(w==null)return"null";const v=m&&d[String(m)];return v?v(w):typeof w=="number"||typeof w=="boolean"?String(w):w instanceof Date?w.toISOString():`'${String(w).replace(/'/g,"''")}'`}function s(w){const m=String(w),v=/^[A-Za-z_][A-Za-z0-9_]*$/;if(!m||!m.split("/").every(h=>v.test(h)))throw new Error(`odataAdapter: "${m}" is not a usable column name`);return m}const t=Object.freeze({lo:{incl:"ge",excl:"gt"},hi:{incl:"le",excl:"lt"}});function u(w){const m=s(w.col),v=String(w.op),h=w.type;if(n[v])return`${m} ${n[v]} ${a(w.value,h)}`;if(v==="contains")return`contains(${m},${a(w.value,h)})`;if(v==="startsWith")return`startswith(${m},${a(w.value,h)})`;if(v==="endsWith")return`endswith(${m},${a(w.value,h)})`;if(v==="blank")return`(${m} eq null)`;if(v==="notBlank")return`(${m} ne null)`;if(v==="between"||v==="notBetween"){const p=Array.isArray(w.value)?w.value:[w.value,w.value],b=String(w.bounds||"[]"),O=b.charAt(0)==="("?t.lo.excl:t.lo.incl,y=b.charAt(1)===")"?t.hi.excl:t.hi.incl,L=`(${m} ${O} ${a(p[0],h)} and ${m} ${y} ${a(p[1],h)})`;return v==="between"?L:`(${m} eq null or not ${L})`}return null}function r(w){const m=String(w&&w.op);throw E(`source.odata.filter.refuse.${m}`,`a "${m}" filter condition cannot be written as an OData $filter expression, so the request was refused rather than sent without it — silently dropping it would have matched more or fewer rows than the filter asked for. Route this condition through a source that can pushdown-split it as residual (source.filter capability), or drop it from the tree before building the URL.`),new Error(`odataAdapter: a "${m}" filter condition cannot be expressed in OData and was refused`)}function o(w){if(!w)return"";if(!z(w)){const h=u(w);return h===null?r(w):h}const m=String(w.op)==="or"?" or ":" and ",v=(w.conditions||[]).map(h=>{if(z(h))return o(h);const p=u(h);return p===null?r(h):p}).filter(Boolean);return v.length?v.length===1?v[0]:`(${v.join(m)})`:""}function f(w={}){const m=String(w.url||""),v=w.fetch||(typeof fetch=="function"?fetch:null),h=w.count!==!1,p=s(w.key||"id"),b=w.edit===!0;return{name:"odata",capabilities:{filter:"tree",operators:_,sort:"multi",quick:w.search===!0,range:!0,total:h,mutate:b?{update:!0,delete:!0,append:!0,returning:"row"}:!1},urlFor(O){const y=[],L=(D,F)=>y.push(`${D}=${encodeURIComponent(F)}`),M=o(O.filters);return M&&L("$filter",M),O.sort&&O.sort.length&&L("$orderby",O.sort.map(D=>`${s(D.col)}${D.dir==="desc"?" desc":" asc"}`).join(",")),O.range&&(L("$skip",String(O.range.start)),L("$top",String(O.range.end-O.range.start))),O.quick&&L("$search",`"${String(O.quick).replace(/"/g,"")}"`),h&&L("$count","true"),y.length?`${m}?${y.join("&")}`:m},async execute(O,y){if(!v)throw new Error("odataAdapter needs a fetch implementation");const L={Accept:"application/json",...w.headers||{}},M=y&&y.signal,D=async P=>{const R=await v(P,{headers:L,signal:M});if(!R.ok)throw new Error(`OData request failed: ${R.status}`);return R.json()};let F=await D(this.urlFor(O)),T=F.value||F.rows||[];const I=F["@odata.count"]??F.count;if(!O.range){let P=F["@odata.nextLink"];for(;P&&T.length<l*i;)F=await D(P),T=T.concat(F.value||F.rows||[]),P=F["@odata.nextLink"]}return I==null?(h&&E("source.odata.nocount",`${m} was asked for $count=true and answered without an @odata.count, so the grid has no total for this query and will scroll open-ended rather than present the page size as the whole. The endpoint does not support $count, or filters it out.`),{rows:T}):{rows:T,total:Number(I)}},urlForKey(O){return`${m}(${a(O)})`},async mutate(O,y){if(!v)throw new Error("odataAdapter needs a fetch implementation");if(!O||O.kind!=="update"&&O.kind!=="delete"&&O.kind!=="append")throw new Error(`odataAdapter: mutation kind "${O&&O.kind}" is not supported (update, delete and append are wired)`);const L={Accept:"application/json","Content-Type":"application/json",...w.headers||{}},M=y&&y.signal;if(O.kind==="delete"){const P=Array.isArray(O.keys)&&O.keys.length?O.keys[0]:O.key;if(P==null)throw new Error("odataAdapter: a delete needs a row key");const R=await v(this.urlForKey(P),{method:"DELETE",headers:L,signal:M});if(!R.ok)throw new Error(`OData delete failed: ${R.status}`);return{ok:!0}}if(O.kind==="append"){const P=Array.isArray(O.rows)?O.rows.filter(S=>S&&typeof S=="object"):[];if(P.length!==1)throw new Error("odataAdapter: an append needs exactly one row object (OData creates one entity per POST)");const R=await v(m,{method:"POST",headers:L,signal:M,body:JSON.stringify(P[0])});if(!R.ok)throw new Error(`OData add-row failed: ${R.status}`);const $=R.status===204?null:await R.json().catch(()=>null),C=$&&typeof $=="object"&&"value"in $?$.value:$;if(!C||typeof C!="object")throw new Error("odataAdapter: the POST returned no created entity to rekey the appended row by. Have the service return the created entity (Prefer: return=representation).");const A=C[p];if(A==null)throw new Error(`odataAdapter: the created entity carried no ${p} to rekey the appended row by.`);return{ok:!0,keys:[String(A)],rows:[C]}}const D=this.urlForKey(O.key),F=await v(D,{method:"PATCH",headers:L,signal:M,body:JSON.stringify(O.patch||{})});if(!F.ok)throw new Error(`OData update failed: ${F.status}`);if(F.status===204)return{ok:!0};const T=await F.json(),I=T&&typeof T=="object"&&"value"in T?T.value:T;return I==null?{ok:!0}:{ok:!0,rows:[I]}}}}}),Ue("packages/core/src/source/adapters/rest.js",function(e,U){"use strict";Object.defineProperty(e,"DEFAULT_PARAMS",{enumerable:!0,get:function(){return te}}),Object.defineProperty(e,"DEFAULT_VERBS",{enumerable:!0,get:function(){return E}}),Object.defineProperty(e,"restAdapter",{enumerable:!0,get:function(){return q}});const te=Object.freeze({offset:"offset",limit:"limit",sort:"sort",order:"order",filter:"filter",search:"q"}),E=Object.freeze({update:"PATCH",delete:"DELETE",append:"POST"});function q(z={}){const _=String(z.url||""),Z=z.fetch||(typeof fetch=="function"?fetch:null),X={...te,...z.params||{}},B=z.encodeFilter||(i=>JSON.stringify(i)),Y=z.rows||(i=>Array.isArray(i)?i:i.rows||i.data||[]),G=z.total||((i,n)=>Array.isArray(i)?n.length:i.total??i.count??n.length),j=z.edit===!0,k=z.returning==="row"?"row":z.returning==="key"?"key":"none",g=z.keyField||"id",c=z.writeUrlFor||(i=>`${_}/${encodeURIComponent(String(i.key??(i.keys&&i.keys[0])))}`),d=z.encodeMutation||(i=>{const n=E[i.kind];if(i.kind==="update")return{method:n,url:c(i),headers:{"Content-Type":"application/json"},body:JSON.stringify(i.patch||{})};if(i.kind==="append"){const a=Array.isArray(i.rows)?i.rows:i.rows?[i.rows]:[];return{method:n,url:_,headers:{"Content-Type":"application/json"},body:JSON.stringify(a.length===1?a[0]:a)}}return{method:n,url:c(i)}}),l=z.writeRow||(i=>{if(i===null||typeof i!="object")return null;if(Array.isArray(i))return i.length?i[0]:null;const n=i;return n.row??n.data??i});return{name:"rest",capabilities:{range:!0,total:!0,sort:"multi",filter:!1,quick:!1,mutate:j?{update:!0,delete:!0,append:!0,returning:k}:!1,...z.capabilities||{},...z.operators?{filter:"tree",operators:z.operators}:{}},urlFor(i){const n=new URLSearchParams;i.range&&(n.set(X.offset,String(i.range.start)),n.set(X.limit,String(i.range.end-i.range.start))),i.sort&&i.sort.length&&(n.set(X.sort,i.sort.map(s=>s.col).join(",")),n.set(X.order,i.sort.map(s=>s.dir||"asc").join(","))),i.filters&&n.set(X.filter,B(i.filters)),i.quick&&n.set(X.search,String(i.quick));const a=n.toString();return a?`${_}?${a}`:_},async execute(i,n){if(!Z)throw new Error("restAdapter needs a fetch implementation");const a=await Z(this.urlFor(i),{headers:{Accept:"application/json",...z.headers||{}},signal:n&&n.signal});if(!a.ok)throw new Error(`request failed: ${a.status}`);const s=await a.json(),t=Y(s);return{rows:t,total:G(s,t)}},writeUrlFor(i){return c(i)},encodeMutation(i){return d(i)},async mutate(i,n){if(!Z)throw new Error("restAdapter needs a fetch implementation");if(!i||i.kind!=="update"&&i.kind!=="delete"&&i.kind!=="append")throw new Error(`restAdapter: mutation kind "${i&&i.kind}" is not supported (update, delete and append are wired)`);const a=d(i);if(!a||!a.url||!a.method)throw new Error("restAdapter: encodeMutation must return { method, url }");const s={Accept:"application/json",...z.headers||{},...a.headers||{}},t=await Z(a.url,{method:a.method,headers:s,signal:n&&n.signal,...a.body!==void 0?{body:a.body}:{}});if(!t.ok)throw new Error(`REST ${i.kind} failed: ${t.status}`);if(i.kind==="append"){if(k==="none")return{ok:!0};if(t.status===204)throw new Error("restAdapter: the add-row POST returned 204 with no body, so the appended row has no server key to rekey by. Declare returning: 'row'/'key' and have the endpoint return the created row.");const o=await t.json(),f=l(o),w=f&&typeof f=="object"?f[g]:void 0;if(w==null)throw new Error(`restAdapter: the add-row response carried no ${g} to rekey the appended row by. Point \`keyField\` at the primary key the endpoint returns, or override \`writeRow\`.`);return k==="row"?{ok:!0,keys:[String(w)],rows:[f]}:{ok:!0,keys:[String(w)]}}if(k!=="row"||t.status===204)return{ok:!0};const u=await t.json(),r=l(u);return r==null?{ok:!0}:{ok:!0,rows:[r]}}}}}),Ue("packages/core/src/source/adapters/dfql.js",function(e,U){"use strict";Object.defineProperty(e,"DFQL_BASE",{enumerable:!0,get:function(){return _}}),Object.defineProperty(e,"DFQL_WRITE_URL",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"dfqlAdapter",{enumerable:!0,get:function(){return j}});const E=U("packages/core/src/internal/predicates.js").isFunction,z=U("packages/core/src/internal/warn.js").warnOnce,_="https://rest.demandflow.com",Z="https://stream.demandflow.com/dfql",X=Object.freeze(["id","created","updated","ownerId","entity"]);function B(k){const g={},c=[];for(const[d,l]of Object.entries(k||{})){if(X.includes(d)){c.push(d);continue}g[d]=l}return c.length&&z("source.dfql.protected",`a DFQL update tried to write protected field(s) ${c.join(", ")}; they are server-assigned and immutable, so they were dropped from the PATCH.`),g}function Y(k){if(!k||typeof k!="object"||Array.isArray(k))return["fields (must be an object)"];const g=k,c=[];return(typeof g.entity!="string"||!g.entity)&&c.push("entity (uppercase code)"),Number.isFinite(Number(g.level))||c.push("level (numeric)"),(typeof g.comboKey!="string"||!g.comboKey.endsWith("|ENT:"))&&c.push("comboKey (a string ending '|ENT:')"),c}async function G(k){const g=[],c=n=>{const a=n.trim();if(a)try{g.push(JSON.parse(a))}catch{}};if(!k.body||typeof k.body.getReader!="function")return(await k.text()).split(`
|