@toclocoinc/lattice-grid 1.86.4 → 1.86.5
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 +10 -0
- package/README.md +1 -1
- 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/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/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 +3 -3
- package/lattice-grid.min.cjs +3 -3
- package/lattice-grid.min.css +1 -1
- package/lattice-grid.min.js +3 -3
- package/modules/ai.d.ts +1 -1
- package/modules/ai.esm.min.js +2 -2
- package/modules/ai.min.cjs +2 -2
- package/modules/ai.min.js +2 -2
- package/modules/alarms.d.ts +1 -1
- package/modules/alarms.esm.min.js +2 -2
- package/modules/alarms.min.cjs +2 -2
- package/modules/alarms.min.js +2 -2
- package/modules/angular.d.ts +1 -1
- package/modules/angular.esm.min.js +2 -2
- package/modules/angular.min.cjs +2 -2
- package/modules/angular.min.js +2 -2
- package/modules/calendar.d.ts +1 -1
- package/modules/calendar.esm.min.js +2 -2
- package/modules/calendar.min.cjs +2 -2
- package/modules/calendar.min.js +2 -2
- 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 +2 -2
- package/modules/chart-forcetree.esm.min.js.map +2 -2
- package/modules/chart-forcetree.min.cjs +2 -2
- package/modules/chart-forcetree.min.js +2 -2
- package/modules/chart-forcetree.min.js.map +2 -2
- package/modules/chart-hexbin.d.ts +1 -1
- package/modules/chart-hexbin.esm.min.js +2 -2
- package/modules/chart-hexbin.esm.min.js.map +1 -1
- package/modules/chart-hexbin.min.cjs +2 -2
- package/modules/chart-hexbin.min.js +2 -2
- package/modules/chart-hexbin.min.js.map +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-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 +2 -2
- package/modules/chart-tree.esm.min.js.map +2 -2
- package/modules/chart-tree.min.cjs +2 -2
- package/modules/chart-tree.min.js +2 -2
- package/modules/chart-tree.min.js.map +2 -2
- 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 +235 -235
- package/modules/charts.esm.min.js.map +2 -2
- package/modules/charts.min.cjs +235 -235
- package/modules/charts.min.js +235 -235
- package/modules/charts.min.js.map +2 -2
- package/modules/dashboard.d.ts +1 -1
- package/modules/dashboard.esm.min.js +2 -2
- package/modules/dashboard.min.cjs +2 -2
- package/modules/dashboard.min.js +2 -2
- package/modules/data-router.d.ts +1 -1
- package/modules/data-router.esm.min.js +2 -2
- package/modules/data-router.min.cjs +2 -2
- package/modules/data-router.min.js +2 -2
- package/modules/deckgl.d.ts +1 -1
- package/modules/deckgl.esm.min.js +2 -2
- package/modules/deckgl.min.cjs +2 -2
- package/modules/deckgl.min.js +2 -2
- 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 +2 -2
- package/modules/dhtmlx-compat.min.cjs +2 -2
- package/modules/dhtmlx-compat.min.js +2 -2
- package/modules/gantt.d.ts +1 -1
- package/modules/gantt.esm.min.js +2 -2
- package/modules/gantt.min.cjs +2 -2
- package/modules/gantt.min.js +2 -2
- 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 +2 -2
- package/modules/geometry.min.cjs +2 -2
- package/modules/geometry.min.js +2 -2
- package/modules/htmx.d.ts +1 -1
- package/modules/htmx.esm.min.js +3 -3
- package/modules/htmx.min.cjs +3 -3
- package/modules/htmx.min.js +3 -3
- package/modules/kanban.d.ts +1 -1
- package/modules/kanban.esm.min.js +2 -2
- package/modules/kanban.min.cjs +2 -2
- package/modules/kanban.min.js +2 -2
- package/modules/kpi.d.ts +1 -1
- package/modules/kpi.esm.min.js +2 -2
- package/modules/kpi.min.cjs +2 -2
- package/modules/kpi.min.js +2 -2
- package/modules/layout.d.ts +1 -1
- package/modules/layout.esm.min.js +2 -2
- package/modules/layout.min.cjs +2 -2
- package/modules/layout.min.js +2 -2
- package/modules/leaflet.d.ts +1 -1
- package/modules/leaflet.esm.min.js +2 -2
- package/modules/leaflet.min.cjs +2 -2
- package/modules/leaflet.min.js +2 -2
- package/modules/list.d.ts +1 -1
- package/modules/list.esm.min.js +2 -2
- package/modules/list.min.cjs +2 -2
- package/modules/list.min.js +2 -2
- package/modules/mapview.d.ts +1 -1
- package/modules/mapview.esm.min.js +2 -2
- package/modules/mapview.min.cjs +2 -2
- package/modules/mapview.min.js +2 -2
- 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 +2 -2
- package/modules/presets.min.cjs +2 -2
- package/modules/presets.min.js +2 -2
- package/modules/react.d.ts +1 -1
- package/modules/react.esm.min.js +2 -2
- package/modules/react.min.cjs +2 -2
- package/modules/react.min.js +2 -2
- package/modules/svelte.d.ts +1 -1
- package/modules/svelte.esm.min.js +2 -2
- package/modules/svelte.min.cjs +2 -2
- package/modules/svelte.min.js +2 -2
- package/modules/tabs.d.ts +1 -1
- package/modules/tabs.esm.min.js +2 -2
- package/modules/tabs.min.cjs +2 -2
- package/modules/tabs.min.js +2 -2
- package/modules/vue.d.ts +1 -1
- package/modules/vue.esm.min.js +2 -2
- package/modules/vue.min.cjs +2 -2
- package/modules/vue.min.js +2 -2
- package/modules/webcomponent.d.ts +1 -1
- package/modules/webcomponent.esm.min.js +3 -3
- package/modules/webcomponent.min.cjs +3 -3
- package/modules/webcomponent.min.js +3 -3
- package/package.json +1 -1
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* Lattice Grid 1.86.
|
|
2
|
+
* Lattice Grid 1.86.5, mapview module
|
|
3
3
|
* Copyright (c) 2026 TOCLOCO Inc. All rights reserved.
|
|
4
4
|
* https://latticegrid.dev
|
|
5
5
|
*/
|
|
6
|
-
var kn=Object.create(null),vn=Object.create(null);function Xe(n,ge){kn[n]=ge}function xn(n){var ge=vn[n];if(ge)return ge;var ke=Object.create(null);vn[n]=ke;var ee=kn[n];if(!ee)throw new Error("[lattice] missing module: "+n);return ee(ke,xn),ke}Xe("packages/core/src/internal/util.js",function(n,ge){"use strict";Object.defineProperty(n,"VERSION",{enumerable:!0,get:function(){return a}}),Object.defineProperty(n,"reportedWarnings",{enumerable:!0,get:function(){return v}}),Object.defineProperty(n,"warnOnce",{enumerable:!0,get:function(){return m}}),Object.defineProperty(n,"infoOnce",{enumerable:!0,get:function(){return D}}),Object.defineProperty(n,"resetWarnings",{enumerable:!0,get:function(){return j}}),Object.defineProperty(n,"fail",{enumerable:!0,get:function(){return u}}),Object.defineProperty(n,"invariant",{enumerable:!0,get:function(){return l}}),Object.defineProperty(n,"DEV",{enumerable:!0,get:function(){return s}}),Object.defineProperty(n,"isObject",{enumerable:!0,get:function(){return c}}),Object.defineProperty(n,"isFunction",{enumerable:!0,get:function(){return b}}),Object.defineProperty(n,"isNil",{enumerable:!0,get:function(){return y}}),Object.defineProperty(n,"isBlank",{enumerable:!0,get:function(){return i}}),Object.defineProperty(n,"isCtor",{enumerable:!0,get:function(){return x}}),Object.defineProperty(n,"pathGetter",{enumerable:!0,get:function(){return w}}),Object.defineProperty(n,"pathSetter",{enumerable:!0,get:function(){return K}}),Object.defineProperty(n,"getPath",{enumerable:!0,get:function(){return H}}),Object.defineProperty(n,"setPath",{enumerable:!0,get:function(){return q}}),Object.defineProperty(n,"humanise",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(n,"escapeHtml",{enumerable:!0,get:function(){return pe}}),Object.defineProperty(n,"titleCase",{enumerable:!0,get:function(){return he}}),Object.defineProperty(n,"expand",{enumerable:!0,get:function(){return $}}),Object.defineProperty(n,"toArray",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(n,"merge",{enumerable:!0,get:function(){return h}}),Object.defineProperty(n,"mergeRow",{enumerable:!0,get:function(){return e}}),Object.defineProperty(n,"Lru",{enumerable:!0,get:function(){return M}}),Object.defineProperty(n,"collator",{enumerable:!0,get:function(){return z}}),Object.defineProperty(n,"defaultCompare",{enumerable:!0,get:function(){return A}}),Object.defineProperty(n,"now",{enumerable:!0,get:function(){return ne}}),Object.defineProperty(n,"nextFrame",{enumerable:!0,get:function(){return P}}),Object.defineProperty(n,"cancelFrame",{enumerable:!0,get:function(){return d}}),Object.defineProperty(n,"frameBatched",{enumerable:!0,get:function(){return C}}),Object.defineProperty(n,"settleDebounce",{enumerable:!0,get:function(){return J}}),Object.defineProperty(n,"whenIdle",{enumerable:!0,get:function(){return E}}),Object.defineProperty(n,"uid",{enumerable:!0,get:function(){return oe}});const ke="1.86.4";async function ee(){return ke}const a="1.86.4",ye=new Set,le=2e3;function be(S){if(ye.add(S),ye.size>le){const O=ye.values().next().value;O!==void 0&&ye.delete(O)}}const F=[],G=500;function ie(S,O,V){F.push({key:S,level:O,message:V.map(r=>typeof r=="string"?r:U(r)).join(" "),at:Date.now()}),F.length>G&&F.shift()}function U(S){if(S instanceof Error)return S.message;try{return JSON.stringify(S)}catch{return String(S)}}function v(){return F.map(S=>({...S}))}function L(S){if(S.length===0||typeof S[0]!="string")return S;const O=S[0].replace(/^\[lattice\]\s*/,"");return O===S[0]?S:[O,...S.slice(1)]}function m(S,...O){if(ye.has(S))return;be(S);const V=L(O);ie(S,"warn",V),console.warn("[lattice]",...V)}function D(S,...O){if(ye.has(S))return;be(S);const V=L(O);ie(S,"info",V),console.info("[lattice]",...V)}function j(){ye.clear(),F.length=0}function u(S,O){const V=new Error(`[lattice] ${S}`);throw O!==void 0&&(V.cause=O),V}function l(S,O){S||u(O)}const s=(()=>{try{return!(typeof process<"u"&&process.env&&process.env.NODE_ENV==="production")}catch{return!0}})();function c(S){return S!==null&&typeof S=="object"&&!Array.isArray(S)}function b(S){return typeof S=="function"}function y(S){return S==null}function i(S){return S==null||S===""}function x(S){return typeof S!="function"?!1:/^class[\s{]/.test(Function.prototype.toString.call(S))?!0:!!(S.prototype&&Object.getOwnPropertyNames(S.prototype).length>1)}const t=new Map;function w(S){let O=t.get(S);if(O)return O;if(!S.includes("."))O=V=>V?.[S];else{const V=S.split("."),r=V.length;O=_=>{let o=_;for(let g=0;g<r;g++){if(o==null)return;o=o[V[g]]}return o}}return t.set(S,O),O}const B=new Map;function K(S){let O=B.get(S);if(O)return O;if(!S.includes("."))O=(V,r)=>{V!=null&&(V[S]=r)};else{const V=S.split("."),r=V.length-1;O=(_,o)=>{let g=_;for(let f=0;f<r;f++){if(g==null)return;const R=V[f];g[R]==null&&(g[R]={}),g=g[R]}g!=null&&(g[V[r]]=o)}}return B.set(S,O),O}function H(S,O){return w(O)(S)}function q(S,O,V){K(O)(S,V)}function Q(S){return S?(S.includes(".")?S.slice(S.lastIndexOf(".")+1):S).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(/^./,V=>V.toUpperCase()):""}const re={"&":"&","<":"<",">":">",'"':""","'":"'"};function pe(S){const O=S==null?"":String(S);return/[&<>"']/.test(O)?O.replace(/[&<>"']/g,V=>re[V]):O}function he(S){return String(S).replace(/\w\S*/g,O=>O[0].toUpperCase()+O.slice(1).toLowerCase())}function $(S,O,V){if(S!==void 0)return S===!0?{enabled:!0,...V}:S===!1?{enabled:!1}:c(S)?S:{[O]:S,enabled:!0}}function Z(S){return S==null?[]:Array.isArray(S)?S:[S]}const ae=Object.freeze(new Set(["__proto__","constructor","prototype"]));function h(S,O){if(!c(S))return c(O)?{...O}:O;if(!c(O))return O===void 0?S:O;const V={...S};for(const r of Object.keys(O)){if(ae.has(r))continue;const _=O[r];_!==void 0&&(V[r]=c(_)&&c(V[r])?h(V[r],_):_)}return V}function e(S,O){if(!c(S)||!c(O)||S===O)return O;const V=Object.create(Object.getPrototypeOf(S));return Object.assign(V,S,O),V}class M{#e;#t=new Map;#n;constructor(O=256,V=null){this.#e=O,this.#n=V}get size(){return this.#t.size}get max(){return this.#e}set max(O){this.#e=O,this.#r()}has(O){return this.#t.has(O)}get(O){const V=this.#t;if(!V.has(O))return;const r=V.get(O);return V.delete(O),V.set(O,r),r}peek(O){return this.#t.get(O)}set(O,V){const r=this.#t;return r.has(O)&&r.delete(O),r.set(O,V),this.#r(),V}delete(O){const V=this.#t.get(O);return this.#t.delete(O)&&this.#n&&this.#n(V,O),V}clear(){if(this.#n)for(const[O,V]of this.#t)this.#n(V,O);this.#t.clear()}keys(){return this.#t.keys()}values(){return this.#t.values()}#r(){const O=this.#t;for(;O.size>this.#e;){const V=O.keys().next().value,r=O.get(V);O.delete(V),this.#n&&this.#n(r,V)}}}const k=new Map;function z(S,O){const V=`${S||""}|${O?JSON.stringify(O):""}`;let r=k.get(V);return r||(r=new Intl.Collator(S||void 0,{numeric:!0,sensitivity:"variant",...O}),k.set(V,r)),r}function A(S,O){if(S===O)return 0;if(S==null)return 1;if(O==null)return-1;if(typeof S=="number"&&typeof O=="number")return Number.isNaN(S)?Number.isNaN(O)?0:1:Number.isNaN(O)||S<O?-1:S>O?1:0;const V=String(S),r=String(O);return V<r?-1:V>r?1:0}function ne(){return typeof performance<"u"&&performance.now?performance.now():Date.now()}const te=typeof requestAnimationFrame=="function";function P(S){return te?requestAnimationFrame(S):setTimeout(()=>S(ne()),16)}function d(S){S!=null&&(te?cancelAnimationFrame(S):clearTimeout(S))}function C(S){let O=null,V=null;const r=()=>{O=null;const o=V;V=null,S(...o||[])},_=(...o)=>{V=o,O===null&&(O=P(r))};return _.cancel=()=>{d(O),O=null,V=null},_.flush=()=>{O!==null&&(d(O),r())},_}function J(S,O){let V=null,r=null;const _=()=>{if(V=null,r===null)return;const f=r;r=null,S(...f),o()},o=()=>{V=setTimeout(_,O),typeof V?.unref=="function"&&V.unref()},g=(...f)=>{V===null?(S(...f),o()):(r=f,clearTimeout(V),o())};return g.flush=()=>{if(V!==null&&clearTimeout(V),V=null,r===null)return;const f=r;r=null,S(...f)},g.cancel=()=>{V!==null&&clearTimeout(V),V=null,r=null},g.pending=()=>V!==null||r!==null,g}function E(S,O=50){return typeof requestIdleCallback=="function"?requestIdleCallback(S,{timeout:O}):setTimeout(()=>S({timeRemaining:()=>0,didTimeout:!0}),1)}let se=0;function oe(S="l"){return`${S}${(++se).toString(36)}`}}),Xe("packages/modules/geometry/geodata.js",function(n,ge){"use strict";Object.defineProperty(n,"GEOMETRY_KINDS",{enumerable:!0,get:function(){return le}}),Object.defineProperty(n,"SPATIAL_OPERATORS",{enumerable:!0,get:function(){return be}}),Object.defineProperty(n,"GEOMETRY_OPERATORS",{enumerable:!0,get:function(){return F}}),Object.defineProperty(n,"EARTH_RADIUS",{enumerable:!0,get:function(){return G}}),Object.defineProperty(n,"toWkt",{enumerable:!0,get:function(){return q}}),Object.defineProperty(n,"toWkb",{enumerable:!0,get:function(){return he}}),Object.defineProperty(n,"readGeometry",{enumerable:!0,get:function(){return z}}),Object.defineProperty(n,"parseGeometry",{enumerable:!0,get:function(){return ne}}),Object.defineProperty(n,"haversine",{enumerable:!0,get:function(){return P}}),Object.defineProperty(n,"geometryInfo",{enumerable:!0,get:function(){return V}}),Object.defineProperty(n,"geometryKind",{enumerable:!0,get:function(){return r}}),Object.defineProperty(n,"spatialOperand",{enumerable:!0,get:function(){return o}}),Object.defineProperty(n,"spatialPredicate",{enumerable:!0,get:function(){return $e}});const ke=ge("packages/core/src/internal/util.js"),ee=ke.isNil,a=ke.isObject,ye=ke.warnOnce,le=Object.freeze(["Point","LineString","Polygon","MultiPoint","MultiLineString","MultiPolygon","GeometryCollection"]),be=Object.freeze(["withinBbox","withinPolygon","intersects","withinDistance"]),F=Object.freeze([...be,"blank","notBlank"]),G=63710088e-1,ie=Math.PI/180,U=16,v=1e-12;class L extends Error{}function m(N){throw new L(N)}function D(N){(!Array.isArray(N)||N.length<2)&&m("a position needs at least two numbers");const T=Number(N[0]),X=Number(N[1]);return(typeof N[0]!="number"||typeof N[1]!="number"||!Number.isFinite(T)||!Number.isFinite(X))&&m("a coordinate is not a finite number"),[T,X]}function j(N,T,X){Array.isArray(N)||m(`${X} is not an array of positions`);const ce=N.map(D);return ce.length<T&&m(`${X} needs at least ${T} positions, found ${ce.length}`),ce}function u(N){const T=j(N,3,"a polygon ring"),X=T[0],ce=T[T.length-1];return(X[0]!==ce[0]||X[1]!==ce[1])&&T.push([X[0],X[1]]),T.length<4&&m(`a polygon ring needs at least 3 distinct corners, found ${T.length-1}`),T}function l(N){return(!Array.isArray(N)||N.length===0)&&m("a polygon needs at least an outer ring"),N.map(u)}function s(N,T){switch(T>U&&m("geometry collections nest too deeply"),a(N)||m("GeoJSON must be an object"),N.type){case"Feature":return N.geometry==null?null:s(N.geometry,T+1);case"FeatureCollection":return m("a FeatureCollection holds many rows, not one value; load its features as rows");case"Point":return{type:"Point",coordinates:D(N.coordinates)};case"MultiPoint":return{type:"MultiPoint",coordinates:j(N.coordinates,1,"a MultiPoint")};case"LineString":return{type:"LineString",coordinates:j(N.coordinates,2,"a LineString")};case"MultiLineString":return(!Array.isArray(N.coordinates)||!N.coordinates.length)&&m("a MultiLineString needs at least one line"),{type:"MultiLineString",coordinates:N.coordinates.map(X=>j(X,2,"a LineString"))};case"Polygon":return{type:"Polygon",coordinates:l(N.coordinates)};case"MultiPolygon":return(!Array.isArray(N.coordinates)||!N.coordinates.length)&&m("a MultiPolygon needs at least one polygon"),{type:"MultiPolygon",coordinates:N.coordinates.map(l)};case"GeometryCollection":{(!Array.isArray(N.geometries)||!N.geometries.length)&&m("a GeometryCollection needs at least one geometry");const X=N.geometries.map(ce=>s(ce,T+1)).filter(Boolean);return X.length?{type:"GeometryCollection",geometries:X}:null}default:return m(`"${String(N.type)}" is not a GeoJSON geometry type`)}}const c=Object.freeze({POINT:"Point",LINESTRING:"LineString",POLYGON:"Polygon",MULTIPOINT:"MultiPoint",MULTILINESTRING:"MultiLineString",MULTIPOLYGON:"MultiPolygon",GEOMETRYCOLLECTION:"GeometryCollection"}),b=/[-+]?(?:\d+\.?\d*|\.\d+)(?:[eE][-+]?\d+)?/y,y=/[A-Za-z]+/y,i=/^\s*(?:SRID\s*=\s*\d+\s*;\s*)?[A-Za-z]+\s*(?:ZM|Z|M)?\s*(?:\(|EMPTY\b)/i;class x{text;at=0;constructor(T){this.text=T}space(){for(;this.at<this.text.length&&/\s/.test(this.text[this.at]);)this.at++}expect(T){this.space(),this.text[this.at]!==T&&m(`WKT expected "${T}" at character ${this.at+1}, found "${this.text[this.at]??"the end"}"`),this.at++}accept(T){return this.space(),this.text[this.at]===T?(this.at++,!0):!1}word(){this.space(),y.lastIndex=this.at;const T=y.exec(this.text);return T?(this.at+=T[0].length,T[0].toUpperCase()):""}numberNext(){return this.space(),b.lastIndex=this.at,b.test(this.text)}number(){this.space(),b.lastIndex=this.at;const T=b.exec(this.text);return T||m(`WKT expected a number at character ${this.at+1}`),this.at+=T[0].length,Number(T[0])}position(){const T=this.number(),X=this.number();for(;this.numberNext();)this.number();return[T,X]}positionList(){this.expect("(");const T=[this.position()];for(;this.accept(",");)T.push(this.position());return this.expect(")"),T}empty(){const T=this.at;return this.word()==="EMPTY"?!0:(this.at=T,!1)}geometry(T){T>U&&m("geometry collections nest too deeply");const X=this.word(),ce=c[X];ce||m(X?`"${X}" is not a WKT geometry type`:"WKT expected a geometry type");const Se=this.at,Ne=this.word();return Ne!=="Z"&&Ne!=="M"&&Ne!=="ZM"&&(this.at=Se),this.empty()?null:this.body(ce,T)}body(T,X){switch(T){case"Point":{this.expect("(");const ce=this.position();return this.expect(")"),{type:"Point",coordinates:ce}}case"LineString":return{type:"LineString",coordinates:j(this.positionList(),2,"a LineString")};case"Polygon":return{type:"Polygon",coordinates:this.polygonBody()};case"MultiPoint":{this.expect("(");const ce=[];do this.empty()||(this.accept("(")?(ce.push(this.position()),this.expect(")")):ce.push(this.position()));while(this.accept(","));return this.expect(")"),ce.length?{type:"MultiPoint",coordinates:ce}:null}case"MultiLineString":{const ce=this.parts(()=>j(this.positionList(),2,"a LineString"));return ce.length?{type:"MultiLineString",coordinates:ce}:null}case"MultiPolygon":{const ce=this.parts(()=>this.polygonBody());return ce.length?{type:"MultiPolygon",coordinates:ce}:null}default:{this.expect("(");const ce=[];do{const Se=this.geometry(X+1);Se&&ce.push(Se)}while(this.accept(","));return this.expect(")"),ce.length?{type:"GeometryCollection",geometries:ce}:null}}}parts(T){this.expect("(");const X=[];do this.empty()||X.push(T());while(this.accept(","));return this.expect(")"),X}polygonBody(){return l(this.parts(()=>this.positionList()))}}function t(N){const T=new x(String(N).replace(/^\s*SRID\s*=\s*\d+\s*;/i,"")),X=T.geometry(0);return T.space(),T.at<T.text.length&&m(`WKT has unexpected text after the geometry at character ${T.at+1}`),X}function w(N){return Object.is(N,-0)?"0":String(N)}function B(N){return`${w(N[0])} ${w(N[1])}`}function K(N){return`(${N.map(B).join(", ")})`}function H(N){return`(${N.map(K).join(", ")})`}function q(N){const T=ne(N);return T?Q(T):""}function Q(N){switch(N.type){case"Point":return`POINT (${B(N.coordinates)})`;case"LineString":return`LINESTRING ${K(N.coordinates)}`;case"Polygon":return`POLYGON ${H(N.coordinates)}`;case"MultiPoint":return`MULTIPOINT (${N.coordinates.map(T=>`(${B(T)})`).join(", ")})`;case"MultiLineString":return`MULTILINESTRING (${N.coordinates.map(K).join(", ")})`;case"MultiPolygon":return`MULTIPOLYGON (${N.coordinates.map(H).join(", ")})`;default:return`GEOMETRYCOLLECTION (${N.geometries.map(Q).join(", ")})`}}class re{view;at=0;constructor(T){this.view=new DataView(T.buffer,T.byteOffset,T.byteLength)}need(T){this.at+T>this.view.byteLength&&m(`WKB ends after ${this.view.byteLength} bytes, in the middle of a geometry`)}u8(){return this.need(1),this.view.getUint8(this.at++)}u32(T){this.need(4);const X=this.view.getUint32(this.at,T);return this.at+=4,X}f64(T){this.need(8);const X=this.view.getFloat64(this.at,T);return this.at+=8,X}count(T,X){const ce=this.u32(T);return ce*X>this.view.byteLength-this.at&&m(`WKB claims ${ce} elements, more than its bytes can hold`),ce}position(T,X){const ce=this.f64(T),Se=this.f64(T);for(let Ne=2;Ne<X;Ne++)this.f64(T);return[ce,Se]}positions(T,X){const ce=this.count(T,8*X),Se=new Array(ce);for(let Ne=0;Ne<ce;Ne++)Se[Ne]=this.position(T,X);return Se}geometry(T,X){T>U&&m("geometry collections nest too deeply");const ce=this.u8();ce!==0&&ce!==1&&m(`WKB byte-order mark is ${ce}, not 0 or 1`);const Se=ce===1,Ne=this.u32(Se);let Le=2;Ne&2147483648&&Le++,Ne&1073741824&&Le++,Ne&536870912&&this.u32(Se);let Ce=Ne&268435455;if(Ce>=1e3){const Ge=Math.floor(Ce/1e3);Ge>3&&m(`WKB geometry type ${Ce} is not one this reads`),Le=2+(Ge===3?2:1),Ce%=1e3}const We=le[Ce-1];switch(We||m(`WKB geometry type ${Ce} is not one this reads`),X&&We!==X&&m(`a part of a WKB Multi${X} is a ${We}`),We){case"Point":{const Ge=this.position(Se,Le);return Number.isNaN(Ge[0])&&Number.isNaN(Ge[1])?null:{type:"Point",coordinates:D(Ge)}}case"LineString":return{type:"LineString",coordinates:j(this.positions(Se,Le),2,"a LineString")};case"Polygon":{const Ge=this.count(Se,4),De=[];for(let Ue=0;Ue<Ge;Ue++)De.push(this.positions(Se,Le));return Ge?{type:"Polygon",coordinates:l(De)}:null}default:{const Ge=this.count(Se,5),De=We==="GeometryCollection"?void 0:We.slice(5),Ue=[];for(let He=0;He<Ge;He++){const pt=this.geometry(T+1,De);pt&&Ue.push(pt)}return Ue.length?We==="GeometryCollection"?{type:We,geometries:Ue}:{type:We,coordinates:Ue.map(He=>He.coordinates)}:null}}}}function pe(N){const T=new re(N),X=T.geometry(0);return T.at!==N.byteLength&&m(`WKB has ${N.byteLength-T.at} bytes left over after the geometry`),X}function he(N){const T=ne(N);if(!T)return null;const X=[];let ce=0;const Se=De=>{const Ue=new DataView(new ArrayBuffer(5));Ue.setUint8(0,1),Ue.setUint32(1,le.indexOf(De)+1,!0),X.push(Ue),ce+=5},Ne=De=>{const Ue=new DataView(new ArrayBuffer(4));Ue.setUint32(0,De,!0),X.push(Ue),ce+=4},Le=De=>{const Ue=new DataView(new ArrayBuffer(16*De.length));De.forEach((He,pt)=>{Ue.setFloat64(pt*16,He[0],!0),Ue.setFloat64(pt*16+8,He[1],!0)}),X.push(Ue),ce+=16*De.length},Ce=De=>{switch(Se(De.type),De.type){case"Point":Le([De.coordinates]);break;case"LineString":Ne(De.coordinates.length),Le(De.coordinates);break;case"Polygon":Ne(De.coordinates.length);for(const Ue of De.coordinates)Ne(Ue.length),Le(Ue);break;case"GeometryCollection":Ne(De.geometries.length);for(const Ue of De.geometries)Ce(Ue);break;default:{const Ue=De.type.slice(5);Ne(De.coordinates.length);for(const He of De.coordinates)Ce({type:Ue,coordinates:He})}}};Ce(T);const We=new Uint8Array(ce);let Ge=0;for(const De of X)We.set(new Uint8Array(De.buffer),Ge),Ge+=De.byteLength;return We}const $=/^0[01](?:[0-9a-fA-F]{2})+$/,Z=/^[A-Za-z0-9+/_-]+={0,2}$/,ae=(()=>{const N=new Int16Array(128).fill(-1),T="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(let X=0;X<T.length;X++)N[T.charCodeAt(X)]=X;return N[45]=62,N[95]=63,N})();function h(N){const T=new Uint8Array(N.length/2);for(let X=0;X<T.length;X++)T[X]=parseInt(N.slice(X*2,X*2+2),16);return T}function e(N){const T=N.replace(/=+$/,""),X=new Uint8Array(Math.floor(T.length*3/4));let ce=0,Se=0,Ne=0;for(let Le=0;Le<T.length;Le++)Se=Se<<6|ae[T.charCodeAt(Le)],ce+=6,ce>=8&&(ce-=8,X[Ne++]=Se>>ce&255);return X.subarray(0,Ne)}function M(N){const T=N.trim();if(T==="")return null;if(T[0]==="{"){let X;try{X=JSON.parse(T)}catch{return m("the text starts like GeoJSON but is not valid JSON")}return s(X,0)}if($.test(T))return pe(h(T));if(i.test(T))return t(T);if(Z.test(T)){const X=e(T);if(X.length>=5&&(X[0]===0||X[0]===1))return pe(X)}return m("the text is not WKT, GeoJSON, or hex or base64 WKB")}const k=new WeakSet;function z(N){if(ee(N))return{geometry:null,reason:null};if(typeof N=="object"&&k.has(N))return{geometry:N,reason:null};try{let T;return typeof N=="string"?T=M(N):N instanceof Uint8Array?T=pe(N):N instanceof ArrayBuffer?T=pe(new Uint8Array(N)):ArrayBuffer.isView(N)?T=pe(new Uint8Array(N.buffer,N.byteOffset,N.byteLength)):a(N)?T=s(N,0):m(`${Array.isArray(N)?"an array":`a ${typeof N}`} is not a geometry`),T&&A(T),{geometry:T||null,reason:null}}catch(T){if(T instanceof L)return{geometry:null,reason:T.message};throw T}}function A(N){if(k.add(N),N.type==="GeometryCollection")for(const T of N.geometries)A(T)}function ne(N){return z(N).geometry}function te(N,T){switch(N.type){case"Point":T(N.coordinates);break;case"MultiPoint":case"LineString":N.coordinates.forEach(T);break;case"MultiLineString":case"Polygon":for(const X of N.coordinates)X.forEach(T);break;case"MultiPolygon":for(const X of N.coordinates)for(const ce of X)ce.forEach(T);break;default:for(const X of N.geometries)te(X,T)}}function P(N,T){const X=N[1]*ie,ce=T[1]*ie,Se=ce-X,Ne=(T[0]-N[0])*ie,Le=Math.sin(Se/2)**2+Math.cos(X)*Math.cos(ce)*Math.sin(Ne/2)**2;return 2*G*Math.asin(Math.min(1,Math.sqrt(Le)))}function d(N){let T=0;for(let X=1;X<N.length;X++)T+=P(N[X-1],N[X]);return T}function C(N){const T=N.length-1;if(T<3)return 0;let X=0;for(let ce=0;ce<T;ce++){const Se=N[(ce-1+T)%T],Ne=N[(ce+1)%T];X+=(Ne[0]-Se[0])*ie*Math.sin(N[ce][1]*ie)}return Math.abs(X)*G*G/2}function J(N){let T=C(N[0]);for(let X=1;X<N.length;X++)T-=C(N[X]);return Math.max(0,T)}function E(N){let T=0,X=0,ce=0;for(let Se=0;Se<N.length-1;Se++){const[Ne,Le]=N[Se],[Ce,We]=N[Se+1],Ge=Ne*We-Ce*Le;T+=Ge,X+=(Ne+Ce)*Ge,ce+=(Le+We)*Ge}return{a:T,cx:X,cy:ce}}function se(){let N=0,T=0,X=0;return{add(ce,Se,Ne){N+=ce*Ne,T+=Se*Ne,X+=Ne},get(){return X>0?[N/X,T/X]:null}}}function oe(N){let T=0,X=0;for(const ce of N)T+=ce[0],X+=ce[1];return[T/N.length,X/N.length]}function S(N,T){switch(N.type){case"Point":T[0].add(N.coordinates[0],N.coordinates[1],1);break;case"MultiPoint":for(const X of N.coordinates)T[0].add(X[0],X[1],1);break;case"LineString":case"MultiLineString":{const X=N.type==="LineString"?[N.coordinates]:N.coordinates;for(const ce of X){for(let Se=1;Se<ce.length;Se++){const[Ne,Le]=ce[Se-1],[Ce,We]=ce[Se],Ge=Math.hypot(Ce-Ne,We-Le);T[1].add((Ne+Ce)/2,(Le+We)/2,Ge)}for(const Se of ce)T[0].add(Se[0],Se[1],1)}break}case"Polygon":case"MultiPolygon":{const X=N.type==="Polygon"?[N.coordinates]:N.coordinates;for(const ce of X){let Se=0,Ne=0,Le=0;ce.forEach((We,Ge)=>{const De=E(We),Ue=(Ge===0?1:-1)*(De.a<0?-1:1);Se+=Ue*De.a,Ne+=Ue*De.cx,Le+=Ue*De.cy}),Math.abs(Se)>v&&T[2].add(Ne/(3*Se),Le/(3*Se),Math.abs(Se)/2);const Ce=ce[0].slice(0,-1);for(const We of Ce)T[0].add(We[0],We[1],1)}break}default:for(const X of N.geometries)S(X,T)}}const O=new WeakMap;function V(N){const T=ne(N);if(!T)return null;const X=O.get(T);if(X)return X;const ce=[1/0,1/0,-1/0,-1/0];te(T,De=>{De[0]<ce[0]&&(ce[0]=De[0]),De[1]<ce[1]&&(ce[1]=De[1]),De[0]>ce[2]&&(ce[2]=De[0]),De[1]>ce[3]&&(ce[3]=De[1])});const Se=[se(),se(),se()];S(T,Se);const Ne=Se[2].get()||Se[1].get()||Se[0].get()||oe([[ce[0],ce[1]],[ce[2],ce[3]]]);let Le=0,Ce=0;const We=De=>{switch(De.type){case"LineString":Le+=d(De.coordinates);break;case"MultiLineString":for(const Ue of De.coordinates)Le+=d(Ue);break;case"Polygon":Ce+=J(De.coordinates);for(const Ue of De.coordinates)Le+=d(Ue);break;case"MultiPolygon":for(const Ue of De.coordinates){Ce+=J(Ue);for(const He of Ue)Le+=d(He)}break;case"GeometryCollection":for(const Ue of De.geometries)We(Ue);break;default:break}};We(T);const Ge=Object.freeze({kind:T.type,bbox:Object.freeze(ce),centroid:Object.freeze(Ne),length:Le,area:Ce});return O.set(T,Ge),Ge}function r(N){const T=V(N);return T?T.kind:null}function _(N,T){const X=typeof N=="string"?N.split(/[\s,;]+/).filter(Boolean):N;if(!Array.isArray(X)||X.length!==T)return null;const ce=X.map(Se=>typeof Se=="number"?Se:typeof Se=="string"?Number(Se):NaN);return ce.every(Number.isFinite)?ce:null}function o(N,T){if(N==="withinBbox"){const X=_(T,4);return X?X[0]>X[2]?{reason:'the box crosses the antimeridian (its west edge is east of its east edge), which is not supported; split it into two withinBbox conditions joined by "or"'}:X[1]>X[3]?{reason:"the box's minLat is above its maxLat"}:{operand:X}:{reason:"withinBbox needs [minLon, minLat, maxLon, maxLat]"}}if(N==="withinDistance"){let X=null;if(a(T)&&!Array.isArray(T)){const ce=T;X=_([ce.lon,ce.lat,ce.metres],3)}else X=_(T,3);return!X||X[2]<0?{reason:"withinDistance needs { lon, lat, metres } with metres of 0 or more"}:{operand:{lon:X[0],lat:X[1],metres:X[2]}}}if(N==="withinPolygon"||N==="intersects"){const X=N==="intersects"?_(T,4):null;if(X){if(X[0]>X[2]||X[1]>X[3])return{reason:"the box's minimum is above its maximum"};const[Ne,Le,Ce,We]=X;return{operand:{type:"Polygon",coordinates:[[[Ne,Le],[Ce,Le],[Ce,We],[Ne,We],[Ne,Le]]]}}}const{geometry:ce,reason:Se}=z(T);return ce?N==="withinPolygon"&&ce.type!=="Polygon"&&ce.type!=="MultiPolygon"?{reason:`withinPolygon needs a Polygon or MultiPolygon, not a ${ce.type}`}:{operand:ce}:{reason:`${N} needs a geometry: ${Se||"none was given"}`}}return{reason:`"${N}" is not a spatial operator`}}function g(N,T){const[X,ce]=N;let Se=!1;for(let Ne=0,Le=T.length-2;Ne<T.length-1;Le=Ne++){const[Ce,We]=T[Ne],[Ge,De]=T[Le];We>ce!=De>ce&&X<(Ge-Ce)*(ce-We)/(De-We)+Ce&&(Se=!Se)}return Se}function f(N,T){if(!g(N,T[0]))return!1;for(let X=1;X<T.length;X++)if(g(N,T[X]))return!1;return!0}function R(N,T={points:[],segments:[],polygons:[]}){const X=ce=>{for(let Se=1;Se<ce.length;Se++)T.segments.push([ce[Se-1],ce[Se]]);for(const Se of ce)T.points.push(Se)};switch(N.type){case"Point":T.points.push(N.coordinates);break;case"MultiPoint":for(const ce of N.coordinates)T.points.push(ce);break;case"LineString":X(N.coordinates);break;case"MultiLineString":N.coordinates.forEach(X);break;case"Polygon":T.polygons.push(N.coordinates),N.coordinates.forEach(X);break;case"MultiPolygon":for(const ce of N.coordinates)T.polygons.push(ce),ce.forEach(X);break;default:for(const ce of N.geometries)R(ce,T)}return T}function W(N,T,X){const ce=(T[0]-N[0])*(X[1]-N[1])-(T[1]-N[1])*(X[0]-N[0]);return Math.abs(ce)<=v?0:Math.sign(ce)}function Y(N,T,X){return N[0]>=Math.min(T[0],X[0])-v&&N[0]<=Math.max(T[0],X[0])+v&&N[1]>=Math.min(T[1],X[1])-v&&N[1]<=Math.max(T[1],X[1])+v}function I(N,T){const[X,ce]=N,[Se,Ne]=T,Le=W(X,ce,Se),Ce=W(X,ce,Ne),We=W(Se,Ne,X),Ge=W(Se,Ne,ce);return Le!==Ce&&We!==Ge?!0:Le===0&&Y(Se,X,ce)||Ce===0&&Y(Ne,X,ce)||We===0&&Y(X,Se,Ne)||Ge===0&&Y(ce,Se,Ne)}function fe(N,T){return N[0]<=T[2]&&T[0]<=N[2]&&N[1]<=T[3]&&T[1]<=N[3]}function ve(N,T){const X=V(N),ce=V(T);if(!fe(X.bbox,ce.bbox))return!1;const Se=R(N),Ne=R(T);for(const Le of Ne.polygons)for(const Ce of Se.points)if(f(Ce,Le))return!0;for(const Le of Se.polygons)for(const Ce of Ne.points)if(f(Ce,Le))return!0;for(const Le of Se.segments)for(const Ce of Ne.segments)if(I(Le,Ce))return!0;for(const Le of Se.points){for(const Ce of Ne.points)if(Math.abs(Le[0]-Ce[0])<=v&&Math.abs(Le[1]-Ce[1])<=v)return!0;for(const Ce of Ne.segments)if(W(Ce[0],Ce[1],Le)===0&&Y(Le,Ce[0],Ce[1]))return!0}for(const Le of Ne.points)for(const Ce of Se.segments)if(W(Ce[0],Ce[1],Le)===0&&Y(Le,Ce[0],Ce[1]))return!0;return!1}function $e(N,T){const{operand:X,reason:ce}=o(N,T);if(ce)return ye(`filter:geometry:${N}`,`a "${N}" condition was refused: ${ce}. It matches no row rather than guessing.`),()=>!1;switch(N){case"withinBbox":return Se=>{const Ne=V(Se);if(!Ne)return!1;const Le=Ne.bbox;return Le[0]>=X[0]&&Le[1]>=X[1]&&Le[2]<=X[2]&&Le[3]<=X[3]};case"withinPolygon":{const Se=X.type==="Polygon"?[X.coordinates]:X.coordinates,Ne=Le=>Se.some(Ce=>f(Le,Ce));return Le=>{const Ce=ne(Le);return Ce?Ce.type==="Point"?Ne(Ce.coordinates):Ce.type==="MultiPoint"?Ce.coordinates.every(Ne):Ne(V(Ce).centroid):!1}}case"intersects":return Se=>{const Ne=ne(Se);return!!Ne&&ve(Ne,X)};default:{const Se=[X.lon,X.lat];return Ne=>{const Le=V(Ne);return!!Le&&P(Le.centroid,Se)<=X.metres}}}}}),Xe("packages/core/src/source/filterwire.js",function(n,ge){"use strict";Object.defineProperty(n,"HOST_FILTER_WARN_ID",{enumerable:!0,get:function(){return a}}),Object.defineProperty(n,"WHERE_PAGE_RELATIVE_WARN_ID",{enumerable:!0,get:function(){return ye}}),Object.defineProperty(n,"warnWherePageRelative",{enumerable:!0,get:function(){return le}}),Object.defineProperty(n,"warnHostFilterNotApplied",{enumerable:!0,get:function(){return be}}),Object.defineProperty(n,"WHERE_NOT_APPLIED_WARN_ID",{enumerable:!0,get:function(){return F}}),Object.defineProperty(n,"warnWhereNotApplied",{enumerable:!0,get:function(){return G}}),Object.defineProperty(n,"WHERE_OVER_THRESHOLD_WARN_ID",{enumerable:!0,get:function(){return ie}}),Object.defineProperty(n,"warnWhereOverThreshold",{enumerable:!0,get:function(){return U}}),Object.defineProperty(n,"RELATIVE_TOKENS",{enumerable:!0,get:function(){return s}}),Object.defineProperty(n,"parseRelativeToken",{enumerable:!0,get:function(){return c}}),Object.defineProperty(n,"resolveRelativeRange",{enumerable:!0,get:function(){return b}}),Object.defineProperty(n,"relativeTokenOf",{enumerable:!0,get:function(){return y}}),Object.defineProperty(n,"relativeTokenHelp",{enumerable:!0,get:function(){return i}}),Object.defineProperty(n,"isResolvableRelative",{enumerable:!0,get:function(){return x}}),Object.defineProperty(n,"resolveRelativeCondition",{enumerable:!0,get:function(){return t}}),Object.defineProperty(n,"isGroup",{enumerable:!0,get:function(){return w}}),Object.defineProperty(n,"forEachCondition",{enumerable:!0,get:function(){return B}}),Object.defineProperty(n,"mapConditions",{enumerable:!0,get:function(){return K}}),Object.defineProperty(n,"normaliseFilterSet",{enumerable:!0,get:function(){return q}}),Object.defineProperty(n,"buildFilterSet",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(n,"wireFilters",{enumerable:!0,get:function(){return re}}),Object.defineProperty(n,"querySignature",{enumerable:!0,get:function(){return pe}});const ee=ge("packages/core/src/internal/util.js").warnOnce,a="source.remote.hostFilter",ye="source.where.pageRelative";function le(Z,ae){!Array.isArray(Z)||!Z.length||ee(ye,`filters.where (${Z.join(", ")}) runs over the rows the ${ae} 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 be(Z){const ae=(Z||{}).config;!ae||!ae.hostFilter||ee(a,"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 F="source.where.notApplied";function G(Z,ae){ee(`${F}:${Z}`,`filters.where("${Z}") is registered but the ${ae} 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 ie="source.where.overThreshold";function U(Z,ae,h,e){!Array.isArray(Z)||!Z.length||ee(`${ie}:${ae}`,`filters.where (${Z.join(", ")}) is not applied to the ${ae} pushdown source:`,h===null?"the adapter reports no row total, so the size of the matching set is unknown.":`its matching set is ${h.toLocaleString()} rows, at or past the whereRowLimit of ${e.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 v=new Map;function L(Z){let ae=v.get(Z);return ae||(ae=new Intl.DateTimeFormat("en-US",{timeZone:Z,hourCycle:"h23",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}),v.set(Z,ae)),ae}function m(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone||"UTC"}catch{return"UTC"}}function D(Z,ae){const h=L(ae).formatToParts(new Date(Z)),e={y:1970,m:1,d:1,h:0,mi:0,s:0};for(const M of h)M.type==="year"?e.y=+M.value:M.type==="month"?e.m=+M.value:M.type==="day"?e.d=+M.value:M.type==="hour"?e.h=+M.value%24:M.type==="minute"?e.mi=+M.value:M.type==="second"&&(e.s=+M.value);return e}function j(Z,ae){const h=D(Z,ae);return Date.UTC(h.y,h.m-1,h.d,h.h,h.mi,h.s)-Math.floor(Z/1e3)*1e3}function u(Z,ae,h,e){const M=Date.UTC(Z,ae-1,h),k=M-j(M,e);return M-j(k,e)}function l(Z,ae,h){const e=new Date(Date.UTC(Z.y,Z.m-1,Z.d+ae));return u(e.getUTCFullYear(),e.getUTCMonth()+1,e.getUTCDate(),h)}const s=Object.freeze(["today","yesterday","lastNDays","thisWeek","thisMonth","thisQuarter","thisYear","quarterToDate","yearToDate"]);function c(Z,ae){if(typeof Z!="string")return null;const h=Z.trim().toLowerCase().replace(/[\s_-]+/g,""),e=/^last(\d*|n)days?$/.exec(h);if(e){const M=e[1]==="n"?"":e[1],k=Number(M||ae);return!Number.isFinite(k)||k<=0?null:{kind:"lastNDays",n:Math.floor(k)}}switch(h){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 b(Z,ae={}){const h=c(Z,ae.n);if(!h)return null;const e=ae.tz||m(),M=ae.now instanceof Date?ae.now.getTime():typeof ae.now=="number"?ae.now:Date.now(),k=D(M,e),z=u(k.y,k.m,k.d,e),A=l(k,1,e);let ne=z,te=A;switch(h.kind){case"today":break;case"yesterday":ne=l(k,-1,e),te=z;break;case"lastNDays":te=ae.includeToday?A:z,ne=l(k,ae.includeToday?-(h.n-1):-h.n,e);break;case"thisWeek":{const P=Number.isFinite(ae.weekStartsOn)?Number(ae.weekStartsOn):1,C=(new Date(Date.UTC(k.y,k.m-1,k.d)).getUTCDay()-P+7)%7;ne=l(k,-C,e),te=l(k,-C+7,e);break}case"thisMonth":ne=u(k.y,k.m,1,e),te=u(k.m===12?k.y+1:k.y,k.m===12?1:k.m+1,1,e);break;case"thisQuarter":case"quarterToDate":{const P=Math.floor((k.m-1)/3)*3+1;ne=u(k.y,P,1,e),te=h.kind==="quarterToDate"?A:P===10?u(k.y+1,1,1,e):u(k.y,P+3,1,e);break}case"thisYear":case"yearToDate":ne=u(k.y,1,1,e),te=h.kind==="yearToDate"?A:u(k.y+1,1,1,e);break;default:return null}return{from:new Date(ne).toISOString(),to:new Date(te).toISOString(),bounds:"[)",tz:e,relative:h.kind==="lastNDays"?`last${h.n}Days`:h.kind,n:h.n}}function y(Z){if(!Z||typeof Z!="object")return null;const ae=Z.value;if(ae&&typeof ae=="object"&&!Array.isArray(ae)&&"relative"in ae)return{token:String(ae.relative),n:typeof ae.n=="number"?ae.n:void 0};if(Z.op==="relative"&&typeof Z.value=="string")return{token:Z.value,n:void 0};const h=Z.meta;return h&&typeof h.relative=="string"&&Z.value===void 0?{token:h.relative,n:typeof h.n=="number"?h.n:void 0}:null}function i(){return`Known tokens: ${s.filter(ae=>ae!=="lastNDays").join(", ")}. "lastNDays" needs a count: pass "last7Days", or the value object { relative: 'lastNDays', n: 7 }.`}function x(Z){const ae=y(Z);return ae?c(ae.token,ae.n)!==null:!1}function t(Z,ae={}){const h=y(Z);if(!h)return Z;const e=b(h.token,{...ae,n:h.n});return e?{...Z,type:Z.type||"date",op:"between",value:[e.from,e.to],bounds:Z.bounds||e.bounds,meta:{...Z.meta||{},relative:e.relative,tz:e.tz}}:(ee(`source.relative.${h.token}`,`unknown relative date token "${h.token}"; sending the condition unresolved.`,i()),Z)}function w(Z){return!!Z&&typeof Z=="object"&&Array.isArray(Z.conditions)}function B(Z,ae){if(Z){if(w(Z)){for(const h of Z.conditions)B(h,ae);return}ae(Z)}}function K(Z,ae){if(!Z)return null;if(!w(Z))return ae(Z);const h=Z;let e=!1;const M=[];for(const k of h.conditions){const z=K(k,ae);z!==k&&(e=!0),z&&M.push(z)}return!e&&M.length===h.conditions.length?Z:M.length?{...h,conditions:M}:null}function H(Z){if(!Z)return null;if(!w(Z))return Z;const ae=Z,h=[];for(const e of ae.conditions){const M=H(e);M&&h.push(M)}return h.length?{op:ae.op,conditions:h}:null}function q(Z){const ae=H(Z);return ae?w(ae)&&ae.op==="and"?ae:{op:"and",conditions:[ae]}:null}function Q(Z){const ae=(Z||[]).filter(Boolean);return ae.length?{op:"and",conditions:ae}:null}function re(Z,ae={}){const h=K(Z,e=>t(e,ae));return q(h)}function pe(Z){const ae=he(Z.filters??null);return JSON.stringify([ae,Z.sort??null,Z.quick??"",Z.groupBy??null,Z.pivotBy??null,$(Z.context)])}function he(Z){if(!Z)return null;if(w(Z)){const e=Z;return{op:e.op,conditions:e.conditions.map(he)}}const ae=Z,h=ae.meta&&typeof ae.meta.relative=="string"?ae.meta.relative:y(ae)?.token;return{col:ae.col,op:ae.op,bounds:ae.bounds??null,caseSensitive:ae.caseSensitive??!1,value:h?`rel:${h}`:ae.value??null}}function $(Z){if(Z==null)return null;try{return JSON.parse(JSON.stringify(Z))}catch{return ee("source.context.unserialisable","config.context is not JSON-serialisable; cache keys ignore it."),"[unserialisable]"}}}),Xe("packages/core/src/source/aggregates.js",function(n,ge){"use strict";Object.defineProperty(n,"STAT_PUSHDOWN",{enumerable:!0,get:function(){return ke}}),Object.defineProperty(n,"pushableAggregates",{enumerable:!0,get:function(){return ee}}),Object.defineProperty(n,"fillAggregateSql",{enumerable:!0,get:function(){return a}}),Object.defineProperty(n,"resolveAggregatesConfig",{enumerable:!0,get:function(){return ye}}),Object.defineProperty(n,"routeAggregate",{enumerable:!0,get:function(){return le}}),Object.defineProperty(n,"resolveAggregatePlan",{enumerable:!0,get:function(){return be}}),Object.defineProperty(n,"groupKeysPushable",{enumerable:!0,get:function(){return G}}),Object.defineProperty(n,"pushdownDocRows",{enumerable:!0,get:function(){return ie}});const ke=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 ee(){const U=new Set;for(const[v,L]of Object.entries(ke))L.pushable&&U.add(v);return U}function a(U,v,L){let m=U.split("%c").join(v);return L!==void 0&&(m=m.split("%w").join(L)),m}function ye(U){const v=U||{},L=v.default==="engine"||v.default==="engine-if-identical"?v.default:"client",m={};if(v.overrides&&typeof v.overrides=="object")for(const[D,j]of Object.entries(v.overrides))(j==="engine"||j==="client")&&(m[D]=j);return{default:L,overrides:m}}function le(U,v){const L=ke[U];if(!L||!L.pushable)return"client";const m=v.overrides[U];return m==="engine"||m==="client"?m:v.default==="client"?"client":v.default==="engine-if-identical"?L.class==="identical"?"engine":"client":"engine"}function be(U,v){const L=ye(v),m=[],D=[];for(const j of U||[]){const u=ke[j.fn],l=le(j.fn,L),s={id:j.id,col:j.col,fn:j.fn,class:u?u.class:"fallback"};j.weight!==void 0&&(s.weight=j.weight),j.params!==void 0&&(s.params=j.params),l==="engine"?m.push(s):(s.reason=u&&!u.pushable?u.note||"the engine cannot express this stat":"client by config",D.push(s))}return{engine:m,client:D,config:L}}const F=/^[A-Za-z_][A-Za-z0-9_$]*$/;function G(U,v=[]){return(U||[]).every(m=>{if(typeof m=="string")return F.test(m);if(!m||typeof m!="object")return!1;const D=m;return Array.isArray(v)&&v.includes(D.bucket)&&typeof D.col=="string"&&F.test(D.col)&&typeof D.size=="number"&&Number.isFinite(D.size)&&D.size>0})}function ie(){return Object.entries(ke).map(([U,v])=>({stat:U,class:v.class,sql:v.sql?a(v.sql,"col",v.twoColumn?"weight":void 0):"",note:v.note||(v.class==="identical"?"Pushes to DuckDB with the same result.":"")}))}}),Xe("packages/core/src/source/abort.js",function(n,ge){"use strict";Object.defineProperty(n,"SupersededError",{enumerable:!0,get:function(){return ke}}),Object.defineProperty(n,"RequestToken",{enumerable:!0,get:function(){return ee}}),Object.defineProperty(n,"AbortScope",{enumerable:!0,get:function(){return a}}),Object.defineProperty(n,"createAbortScope",{enumerable:!0,get:function(){return ye}}),Object.defineProperty(n,"isAbortError",{enumerable:!0,get:function(){return le}});class ke extends Error{constructor(F,G="superseded"){super(`[lattice] request ${F?`"${F}" `:""}${G}`),this.name="SupersededError",this.superseded=!0,this.key=F}}class ee{#e;constructor(F,G,ie,U){this.#e=F,this.key=G,this.controller=ie,this.signal=ie.signal,this.seq=U}get current(){return!this.signal.aborted&&this.#e.tokenFor(this.key)===this}settle(){this.#e.settle(this)}abort(F){this.signal.aborted||this.controller.abort(new ke(this.key,F)),this.#e.settle(this)}}class a{#e=new Map;#t=0;begin(F="",G="superseded"){const ie=this.#e.get(F);ie&&!ie.signal.aborted&&ie.controller.abort(new ke(F,G));const U=new ee(this,F,new AbortController,++this.#t);return this.#e.set(F,U),U}tokenFor(F){return this.#e.get(F)}pending(F=""){const G=this.#e.get(F);return!!G&&!G.signal.aborted}get size(){return this.#e.size}settle(F){this.#e.get(F.key)===F&&this.#e.delete(F.key)}abort(F="",G="superseded"){const ie=this.#e.get(F);ie&&ie.abort(G)}abortAll(F="superseded"){for(const G of[...this.#e.values()])G.abort(F);this.#e.clear()}}function ye(){return new a}function le(be){if(!be||typeof be!="object")return!1;const F=be;return F.superseded===!0||F.name==="AbortError"||F.name==="SupersededError"}}),Xe("packages/core/src/source/pushdown.js",function(n,ge){"use strict";Object.defineProperty(n,"FOREGROUND_WAIT_MS",{enumerable:!0,get:function(){return u}}),Object.defineProperty(n,"NO_CAPABILITIES",{enumerable:!0,get:function(){return s}}),Object.defineProperty(n,"resolveMutate",{enumerable:!0,get:function(){return c}}),Object.defineProperty(n,"capabilitiesOf",{enumerable:!0,get:function(){return i}}),Object.defineProperty(n,"splitFilters",{enumerable:!0,get:function(){return t}}),Object.defineProperty(n,"LEAF_COUNT_ID",{enumerable:!0,get:function(){return w}}),Object.defineProperty(n,"PIVOT_UNSUPPORTED",{enumerable:!0,get:function(){return q}}),Object.defineProperty(n,"GROUP_UNSUPPORTED",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(n,"UNGROUPED_LEVEL",{enumerable:!0,get:function(){return re}}),Object.defineProperty(n,"planQuery",{enumerable:!0,get:function(){return he}}),Object.defineProperty(n,"applyResidual",{enumerable:!0,get:function(){return ae}}),Object.defineProperty(n,"DEFAULT_WHERE_ROW_LIMIT",{enumerable:!0,get:function(){return k}}),Object.defineProperty(n,"createPushdownSource",{enumerable:!0,get:function(){return te}});const ke=ge("packages/core/src/internal/util.js"),ee=ke.defaultCompare,a=ke.isFunction,ye=ke.toArray,le=ke.warnOnce,be=ge("packages/core/src/source/filterwire.js"),F=be.isGroup,G=be.warnWherePageRelative,ie=be.warnWhereOverThreshold,U=ge("packages/core/src/source/aggregates.js"),v=U.resolveAggregatePlan,L=U.groupKeysPushable,m=U.STAT_PUSHDOWN,j=ge("packages/core/src/source/abort.js").SupersededError,u=1e3;function l(P){const d=P&&P.signal;if(!d||!d.aborted)return;const C=d.reason;throw C instanceof Error?C:new j("","superseded before it was sent")}const s=Object.freeze({filter:!1,operators:Object.freeze([]),sort:!1,quick:!1,range:!1,total:!1,group:!1,pivot:!1,mutate:!1});function c(P){if(!P||typeof P!="object")return!1;const d=P.returning==="row"||P.returning==="key"?P.returning:"none";return{append:P.append===!0,update:P.update===!0,delete:P.delete===!0,returning:d}}function b(P,d){if(!P||typeof d!="string")return;if(!d.includes("."))return P[d];let C=P;for(const J of d.split(".")){if(C===null||typeof C!="object")return;C=C[J]}return C}function y(P){if(P===!0)return!0;if(!P||typeof P!="object")return!1;const d=P;return d.enabled===!1?!1:d.enabled===!0||a(d.commit)}function i(P){const d={...s,...P||{}};return d.operators=new Set(d.operators||[]),d.mutate=c(d.mutate),d}function x(P,d){return!P||!P.op||!d.operators.size?!1:d.operators.has(P.op)}function t(P,d){if(!P)return{pushed:null,residual:null};if(!d.filter)return{pushed:null,residual:P};if(d.filter==="term"){if(F(P)){const se=P.conditions||[];if(String(P.op)!=="and")return{pushed:null,residual:P};const oe=se.findIndex(O=>!F(O)&&x(O,d));if(oe<0)return{pushed:null,residual:P};const S=se.filter((O,V)=>V!==oe);return{pushed:se[oe],residual:S.length?{op:"and",conditions:S}:null}}return x(P,d)?{pushed:P,residual:null}:{pushed:null,residual:P}}if(!F(P))return x(P,d)?{pushed:P,residual:null}:{pushed:null,residual:P};if(String(P.op)!=="and")return(P.conditions||[]).every(oe=>F(oe)?t(oe,d).residual===null:x(oe,d))?{pushed:P,residual:null}:{pushed:null,residual:P};const C=[],J=[];for(const se of P.conditions||[]){if(F(se)){if(d.filter==="flat"){J.push(se);continue}const oe=t(se,d);oe.pushed&&C.push(oe.pushed),oe.residual&&J.push(oe.residual);continue}(x(se,d)?C:J).push(se)}const E=se=>se.length===0?null:se.length===1?se[0]:{op:"and",conditions:se};return{pushed:E(C),residual:E(J)}}const w="__lattice_leaves";function B(P){return P.aggregates?P.aggregates instanceof Set?P.aggregates:new Set(ye(P.aggregates)):new Set}function K(P){const d=B(P);return d.size?d.has("count")?P.filter!=="tree"||!P.operators||!P.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 H(P,d,C,J,E,se,oe){const S=Array.isArray(P.groupBy)?P.groupBy:[],O=Array.isArray(P.groupPath)?P.groupPath:[],V=Array.isArray(P.groupValues)?P.groupValues:null;if(!d.group){const r=K(d);if(r)return r}return L(S)?C.residual?"the filter did not fully push, so the engine would group a superset of the matching rows":J?E?se?"a host `where` predicate can only run in the browser, over rows the engine grouped":oe?"fullDataset holds the whole matching set, so the grid groups it itself":!V||V.length!==O.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 q="pushdown:pivot-unsupported",Q="pushdown:group-unsupported",re=Symbol("lattice.remote.ungroupedLevel");function pe(P,d,C,J,E,se){const oe=Array.isArray(P.pivotBy)?P.pivotBy:[],S=Array.isArray(P.groupBy)?P.groupBy:[],O=Array.isArray(P.groupPath)?P.groupPath:[],V=Array.isArray(P.groupValues)?P.groupValues:null;return d.pivot?L(oe)?S.length&&!L(S)?"a grouping key is not a plain column the engine can name in a GROUP BY":C.residual?"the filter did not fully push, so the engine would pivot a superset of the matching rows":J?E?se?"a host `where` predicate can only run in the browser, over rows the engine pivoted":!V||V.length!==O.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 he(P,d,C=!1){const J=t(P.filters||null,d),E=[];J.residual&&E.push("filter");const se=P.sort||[],oe=se.length===0||d.sort==="multi"&&se.length>=1||d.sort==="single"&&se.length===1;!oe&&se.length&&E.push("sort");const S=P.quick?String(P.quick):"",O=!S||!!d.quick;O||E.push("quick");const V=P.where&&P.where.active?P.where:null;V&&E.push("where");const r={filters:J.residual,sort:oe?null:se,quick:O?"":S,where:V},_=!!C,o=Array.isArray(P.groupBy)&&P.groupBy.length>0,g=o?H(P,d,J,oe,O,V,_):"",f=P.pivotMode!==!1&&Array.isArray(P.pivotBy)&&P.pivotBy.length>0,R=f?pe(P,d,J,oe,O,V):"",W=f&&R==="";f&&!W&&E.push("pivot");const Y=f?W&&o:o&&g==="";o&&!f&&!Y&&E.push("group");const I=(Y||W)&&Array.isArray(P.groupValues)?P.groupValues.length:0,fe=Y||f?!1:_||!!(r.filters||r.sort||r.quick||r.where)||!d.range;return{pushed:{...P,filters:J.pushed,sort:oe?se:[],quick:O?S:"",range:fe?null:P.range},residual:r,needsAll:fe,unpushed:E,full:_,grouped:Y,groupLevel:I,groupReason:f?"":g,pivoted:W,pivotReason:R}}function $(P){const d=Array.isArray(P.totals)?P.totals:[],C=P.totalFns&&typeof P.totalFns=="object"?P.totalFns:{},J=[],E=[];for(const se of d){const oe=String(se),S=typeof C[oe]=="string"?C[oe]:null,O=S?m[S]:null;S?!O||!O.pushable||!O.sql?E.push({id:oe,fn:S,class:O?O.class:"fallback",reason:O&&O.note?O.note:`the pushdown map cannot express "${S}"`}):O.twoColumn?E.push({id:oe,fn:S,class:O.class,reason:`"${S}" reduces two columns, and a grouped request carries no weight column`}):J.push({id:oe,col:oe,fn:S,class:O.class}):E.push({id:oe,fn:null,class:"fallback",reason:"the column totals with a host function, so there is no named statistic to push"})}return{engine:J,client:E}}const Z=Object.freeze({items:P=>P==null?[]:Array.isArray(P)?P:[P]});function ae(P,d,C){if(!d)return P;let J=P;if(d.filters&&a(C.evaluateFilters)){const E=J,se={count:J.length,handle:O=>({id:O,get:V=>b(E[V],O)}),itemwise:O=>E.some(V=>Array.isArray(b(V,O)))?Z:null},oe=C.evaluateFilters(d.filters,se),S=[];for(let O=0;O<J.length;O++)oe[O]&&S.push(J[O]);J=S}if(d.where&&d.where.active&&(d.whole||G(d.where.names,"pushdown"),J=J.filter(E=>d.where.passes(E))),d.quick){const E=d.quick.toLowerCase();J=J.filter(se=>{if(!se||typeof se!="object")return!1;for(const oe of Object.values(se))if(oe!=null&&String(oe).toLowerCase().includes(E))return!0;return!1})}if(d.sort&&d.sort.length&&a(C.sortMulti)){const E=[...new Set(d.sort.map(O=>O.col))],se=J,oe=E.map(O=>({id:O,get:V=>b(se[V],O)})),S=C.sortMulti(oe,d.sort.map(O=>({col:O.col,dir:O.dir})),Uint32Array.from({length:J.length},(O,V)=>V),{});J=Array.from(S,O=>se[O])}return J}function h(P){return JSON.stringify({filters:P.filters||null,sort:P.sort||[],quick:P.quick||"",groupBy:P.groupBy||[],groupPath:P.groupPath||[],context:P.context??null})}function e(P){if(!P||typeof P!="object")return 16;let d="";try{d=JSON.stringify(P)}catch{return 200}return d.length*2+64}function M(P){const d=P||{};return{enabled:!!d.enabled,maxRows:Number.isFinite(d.maxRows)?d.maxRows:1e6,maxBytesEstimate:Number.isFinite(d.maxBytesEstimate)?d.maxBytesEstimate:512*1024*1024}}const k=5e4;function z(P){return Number.isFinite(P)&&P>=0?P:k}function A(P){return!!P&&a(P.then)}async function ne(P){if(!P||P.total!==void 0||!A(P.pendingTotal))return P;const d=await P.pendingTotal,{pendingTotal:C,...J}=P;return typeof d=="number"?{...J,total:d}:J}function te(P={}){const d=P.adapter;if(!d||!a(d.execute))return le("source.pushdown.adapter","createPushdownSource needs an `adapter` with an `execute(query)` function."),{...P,mode:"remote",fetch:async()=>({rows:[],total:0})};const C=i(d.capabilities),J=d.capabilities&&Object.getOwnPropertyDescriptor(d.capabilities,"operators");J&&a(J.get)&&Object.defineProperty(C,"operators",{enumerable:!0,configurable:!0,get:()=>new Set(d.capabilities.operators||[]),set:()=>{}});const E=d.name||"adapter";let se=null;const oe=()=>a(d.ready)?(se||(se=Promise.resolve(d.ready()).then(()=>{Object.assign(C,i(d.capabilities))},Ee=>{throw se=null,Ee})),se):null,S=M(P.fullDataset),O=!!P.allowPartialResults,V=z(P.whereRowLimit);let r=null;const _=P.aggregates;let o=null,g=null,f=null,R=null,W=null,Y,I=null,fe=0,ve=null;const $e=()=>!S.enabled||!o?null:(ve!==o.key&&(fe++,ve=o.key),{rows:o.rows,version:fe}),N=async Ee=>{const Ie=Ee.where&&Ee.where.active?Ee.where:null;if(!Ie)return{request:Ee,probe:null};const{where:Ye,...Ke}=Ee,Te=he(Ke,C,S.enabled);if(Te.needsAll)return{request:Ee,probe:null};const tt=h(Te.pushed);let et=null;return(!r||r.key!==tt)&&(C.total?(l(Ee),et=await ne(await d.execute(Te.pushed,Ee)),r={key:tt,size:et&&typeof et.total=="number"?et.total:null}):r={key:tt,size:null}),r.size!==null&&r.size<V?{request:Ee,probe:null}:(ie(Ie.names,E,r.size,V),{request:Ke,probe:et})},T=async(Ee,Ie)=>{I=null;const Ye=$(Ee.pushed);f={engine:Ye.engine,client:Ye.client,groupBy:Ee.pushed.groupBy},Ye.client.length&&le(`source.pushdown.group.totals.${E}.${Ye.client.map(tt=>tt.id).join(".")}`,`the ${E} adapter cannot compute the group subtotal for ${Ye.client.map(tt=>`"${tt.id}" (${tt.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 Ke=await d.executeGroupLevel(Ee.pushed,Ye.engine,Ie)||{};let Te=Ke.rows||[];return!C.range&&Ie.range&&(Te=Te.slice(Ie.range.start,Ie.range.end)),Ne(Ke),Ke.total===void 0?{rows:Te}:{rows:Te,total:Ke.total}},X=new Map,ce=64,Se=async(Ee,Ie)=>{I=null;const Ye=Ee.pushed,Ke=Ye.groupBy,Te=Array.isArray(Ye.groupValues)?Ye.groupValues:[],tt=Te.length,et=[...Ye.filters?[Ye.filters]:[],...Ke.slice(0,tt).map((de,Ae)=>({col:de,op:"eq",value:Te[Ae]===void 0?null:Te[Ae],caseSensitive:!0}))],lt=et.length===0?null:et.length===1?et[0]:{op:"and",conditions:et},bt=Ie.range?Ie.range.start:0;if(tt>=Ke.length){const de={...Ye,filters:lt,groupBy:[],groupPath:[],groupValues:[],totals:[],totalFns:{}},Ae=await ne(await d.execute(de,Ie))||{};let Be=Ae.rows||[];return!C.range&&Ie.range&&(Be=Be.slice(Ie.range.start,Ie.range.end)),typeof Ae.total=="number"?{rows:Be,total:Ae.total}:{rows:Be}}const dt=Ke[tt],ut=$(Ye),mt=B(C),Rt=ut.engine.filter(de=>mt.has(de.fn)),Ft=[...ut.engine.filter(de=>!mt.has(de.fn)).map(de=>({id:de.id,fn:de.fn,class:de.class,reason:`the ${E} adapter does not compute "${de.fn}"`})),...ut.client];f={engine:Rt,client:Ft,groupBy:Ke},Ft.length&&le(`source.pushdown.group.totals.${E}.${Ft.map(de=>de.id).join(".")}`,`the ${E} adapter cannot compute the group subtotal for ${Ft.map(de=>`"${de.id}" (${de.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 st=[...Rt.map(de=>({id:de.id,col:de.col,fn:de.fn})),{id:w,col:dt,fn:"count"}],yt={...Ye,filters:lt,range:null},St=JSON.stringify([h(yt),Te,dt,st]);let Pt=bt>0?X.get(St):void 0;if(!Pt){for(Pt=Promise.resolve(d.executeGroupedAggregates(yt,[dt],st)),X.delete(St),X.set(St,Pt);X.size>ce;)X.delete(X.keys().next().value);Pt.catch(()=>{X.get(St)===Pt&&X.delete(St)})}const Gt=await Pt||[];l(Ie);const Wt=de=>{const Ae={};for(const Be of Rt)Ae[Be.id]=de?de[Be.id]:void 0;return Ae},Ut=(Ye.sort||[]).find(de=>de&&de.col===dt),Xt=Ut&&Ut.dir==="desc"?-1:1,Dt=Gt.filter(de=>de&&de.level===1).map(de=>({[dt]:de.keys[0]===void 0?null:de.keys[0],leafCount:Number(de.values&&de.values[w])||0,totals:Wt(de.values)})).sort((de,Ae)=>Xt*ee(de[dt],Ae[dt]));if(tt===0){const de=Gt.find(Be=>Be&&Be.level===0),Ae=de?Number(de.values&&de.values[w]):NaN;Ne({matchCount:Number.isFinite(Ae)?Ae:Dt.reduce((Be,Re)=>Be+Re.leafCount,0),...de?{grand:Wt(de.values)}:{}})}const Vt=Ie.range?Ie.range.end:Dt.length;return{rows:Dt.slice(bt,Vt),total:Dt.length}},Ne=Ee=>{typeof Ee.matchCount=="number"&&(R=Ee.matchCount,W=Ee.grand?{totals:Ee.grand,leafCount:Ee.matchCount}:null,Y===void 0&&a(d.unfilteredCount)&&(Y=null,Promise.resolve(d.unfilteredCount()).then(Ie=>{Y=typeof Ie=="number"?Ie:null}).catch(Ie=>{le(`source.pushdown.group.unfiltered.${E}`,`the ${E} adapter could not count the unfiltered set (${Ie&&Ie.message?Ie.message:Ie}), so "N of M" falls back to the display count for its denominator.`)})))},Le=async(Ee,Ie)=>{I=null;const Ye=$(Ee.pushed);f={engine:Ye.engine,client:Ye.client,groupBy:Ee.pushed.groupBy,pivotBy:Ee.pushed.pivotBy},Ye.client.length&&le(`source.pushdown.pivot.totals.${E}.${Ye.client.map(lt=>lt.id).join(".")}`,`the ${E} adapter cannot compute the pivot cells for ${Ye.client.map(lt=>`"${lt.id}" (${lt.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 Ke=await d.executePivotLevel(Ee.pushed,Ye.engine,Ie)||{};let Te=Ke.rows||[];!C.range&&Ie.range&&(Te=Te.slice(Ie.range.start,Ie.range.end)),Ne(Ke);const tt=Ke.pivot&&typeof Ke.pivot=="object"?Ke.pivot:{},et={cells:Array.isArray(tt.cells)?tt.cells:[],...Array.isArray(tt.axis)?{axis:tt.axis}:{}};return Ke.total===void 0?{rows:Te,pivot:et}:{rows:Te,total:Ke.total,pivot:et}},Ce=Ee=>{le(`source.pushdown.pivot.${E}.${Ee}`,`pushdown:pivot-unsupported: the ${E} adapter cannot pivot this query because ${Ee}, so no rows are fetched rather than every leaf row being pulled into the browser to pivot there. \`lastPlan().pivotReason\` says the same.`);const Ie=new Error(`[lattice] ${q}: the ${E} adapter cannot pivot this query because ${Ee}, so no rows are fetched rather than every leaf row being pulled into the browser to pivot there. \`lastPlan().pivotReason\` says the same.`);throw Ie.code=q,Ie.reason=Ee,Ie},We=(Ee,Ie)=>{const Ye={key:Ie,state:"pending",value:null};return I=Ye,Ee.then(Ke=>(I===Ye&&(I={key:Ie,state:"settled",value:typeof Ke=="number"?Ke:null}),Ke),Ke=>{throw I===Ye&&(I={key:Ie,state:"failed",value:null}),Ke})};let Ge=0,De=[];const Ue=()=>Ge===0?null:new Promise(Ee=>{const Ie=setTimeout(Ee,u);De.push(()=>{clearTimeout(Ie),Ee()})}),He=async Ee=>{const Ie=oe();Ie&&await Ie;const Ke=Ee&&Ee.pivotMode!==!1&&Array.isArray(Ee.pivotBy)&&Ee.pivotBy.length>0?{request:Ee,probe:null}:await N(Ee);l(Ee);let Te=he(Ke.request,C,S.enabled);if(C.group&&Te.grouped&&!Te.pivoted&&!a(d.executeGroupLevel)&&(le(`source.pushdown.group.method.${E}`,`the ${E} 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=he(Ke.request,{...C,group:!1,aggregates:null},S.enabled)),Te.pivoted&&!a(d.executePivotLevel)&&(Te=he(Ke.request,{...C,pivot:!1},S.enabled),Te.pivotReason="the adapter declares the `pivot` capability but has no `executePivotLevel(query, aggregates, request)`"),Te.grouped&&!Te.pivoted&&!C.group&&!a(d.executeGroupedAggregates)&&(le(`source.pushdown.group.aggregates.method.${E}`,`the ${E} 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=he(Ke.request,{...C,aggregates:null},S.enabled)),g=Te,Te.pivoted)return Le(Te,Ee);if(Te.pivotReason&&Ce(Te.pivotReason),Te.grouped)return C.group?T(Te,Ee):Se(Te,Ee);const et=!!Te.groupReason&&!Te.full;et?le(`source.pushdown.group-unsupported.${E}.${Te.groupReason}`,`pushdown:group-unsupported: the ${E} 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&&le(`source.pushdown.group.${E}.${Te.groupReason}`,`the ${E} 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 lt=st=>et?{...st,[re]:!0}:st;if(!Te.needsAll){const st=Ke.probe||await d.execute(Te.pushed,Ee),yt=st.rows||[];return A(st.pendingTotal)&&st.total===void 0?lt({rows:yt,pendingTotal:We(st.pendingTotal,h(Te.pushed))}):(I=null,!C.total&&st.total===void 0?lt({rows:yt}):lt({rows:yt,total:st.total??yt.length}))}Te.unpushed.length&&le(`source.pushdown.residual.${E}.${Te.unpushed.join(".")}`,`the ${E} 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 bt=h(Te.pushed);if(!o||o.key!==bt){const st=await ne(await d.execute(Te.pushed,Ee));I=null;const yt=st.rows||[];if(Te.full){const St=typeof st.total=="number"?Math.max(st.total,yt.length):yt.length;if(St>S.maxRows)throw new Error(`[lattice] fullDataset refused: the ${E} adapter's matching set is ${St.toLocaleString()} rows, past the configured maxRows of ${S.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 Pt=yt.length*e(yt[0]);if(Pt>S.maxBytesEstimate)throw new Error(`[lattice] fullDataset refused: the ${E} adapter's matching set is an estimated ${Math.round(Pt/(1024*1024)).toLocaleString()} MB across ${yt.length.toLocaleString()} rows, past the configured maxBytesEstimate of ${Math.round(S.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 st.total=="number"&&yt.length<st.total){const St=!!(Te.residual.filters||Te.residual.quick||Te.residual.sort&&Te.residual.sort.length);if(St&&!O)throw new Error(`[lattice] the ${E} adapter returned ${yt.length} of ${st.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?le(`source.pushdown.partial.residual.${E}`,`the ${E} adapter returned ${yt.length} of ${st.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.`):le(`source.pushdown.partial.${E}`,`the ${E} adapter returned ${yt.length} of ${st.total} matching rows when asked for the whole result. The adapter must follow the engine's own paging before returning.`)}o={key:bt,rows:yt,total:typeof st.total=="number"?st.total:null}}let dt=Te;if(Te.residual.where){const st=o.total??o.rows.length;if(st>=V){ie(Te.residual.where.names,E,st,V);const{where:yt,...St}=Ke.request;dt=he(St,C,S.enabled),g=dt}}const ut=o.total!==null&&o.rows.length>=o.total,mt=ae(o.rows,{...dt.residual,whole:ut},P.compute||{}),Rt=Ee.range?Ee.range.start:0,Ft=Ee.range?Ee.range.end:mt.length;return lt({rows:mt.slice(Rt,Ft),total:mt.length})},pt=async(Ee,Ie)=>{const Ye=Ue();Ye&&await Ye;const Ke=oe();Ke&&await Ke;const Te=he(Ee,C,S.enabled);g=Te;const tt=v(Ie,_),et=Array.isArray(Ee.groupBy)?Ee.groupBy:[],lt=et.length>0,bt=!Te.residual.filters&&!Te.residual.quick,dt=!lt||L(et,C.buckets);let ut=tt.engine,mt=tt.client;if(C.aggregates&&ut.length){const yt=C.aggregates instanceof Set?C.aggregates:new Set(ye(C.aggregates)),St=ut.filter(Pt=>!yt.has(Pt.fn));St.length&&(ut=ut.filter(Pt=>yt.has(Pt.fn)),mt=[...St.map(Pt=>({...Pt,reason:`the ${E} adapter does not compute "${Pt.fn}"`})),...mt])}const Rt=yt=>{mt=[...ut.map(St=>({...St,reason:yt})),...mt],ut=[]};ut.length&&!bt?Rt(Te.residual.quick&&!Te.residual.filters?"a quick search the adapter cannot push forces all-client (no mixed provenance)":"residual filter forces all-client (no mixed provenance)"):ut.length&&!dt&&Rt("a grouping key the engine cannot form forces all-client (no mixed provenance)");let Ft={},st;return ut.length&&(a(lt?d.executeGroupedAggregates:d.executeAggregates)?lt?st=await d.executeGroupedAggregates(Te.pushed,et,ut)||[]:Ft=await d.executeAggregates(Te.pushed,ut)||{}:(le(`source.pushdown.aggregates.${E}${lt?".grouped":""}`,`the ${E} adapter cannot compute ${lt?"grouped ":""}aggregates, so every requested statistic is computed client-side. Correct, and slower than it needs to be.`),Rt(`adapter cannot compute ${lt?"grouped ":""}aggregates`))),f={engine:ut,client:mt,...lt?{groupBy:et}:{}},{values:Ft,engine:ut,client:mt,...st!==void 0?{groups:st}:{}}},Mt=async Ee=>{Ge++;try{return await He(Ee)}finally{if(Ge--,Ge===0&&De.length){const Ie=De;De=[];for(const Ye of Ie)Ye()}}},Nt=y(P.edit),ft=P.edit&&typeof P.edit=="object"&&a(P.edit.commit);let ct=P.edit;if(Nt&&!ft)if(C.mutate&&C.mutate.update){const Ee=Ie=>{if(!C.mutate||!C.mutate.update)throw new Error(`[lattice] the ${E} 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(Ie.key),patch:{[Ie.colId]:Ie.value}};return d.mutate(Ye,Ie.request||{})};ct={...P.edit===!0?{}:P.edit,commit:Ee}}else le(`source.pushdown.readonly.${E}`,`edit is enabled but the ${E} adapter declares mutate: ${C.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 Ct=Nt&&C.mutate&&(C.mutate.append||C.mutate.delete)?{append:C.mutate.append===!0,remove:C.mutate.delete===!0,returning:C.mutate.returning,mutate:(Ee,Ie)=>d.mutate(Ee,Ie||{})}:null,Ze=async Ee=>{const Ie=oe();Ie&&await Ie;const{range:Ye,signal:Ke,export:Te,...tt}=Ee||{},et={...tt,groupBy:[],groupPath:[],groupValues:[],pivotBy:[],pivotMode:!1,totals:[]};return{plan:he(et,C,S.enabled),signal:Ke}};async function*gt(Ee,Ie={}){const{plan:Ye,signal:Ke}=await Ze(Ee),Te=Math.max(1,Math.floor(Number(Ie.pageSize))||5e3),tt={signal:Ke,stream:!0};if(!Ye.needsAll)for(let bt=0;;bt+=Te){l(tt);const dt=await d.execute({...Ye.pushed,range:{start:bt,end:bt+Te}},tt);dt&&A(dt.pendingTotal)&&dt.pendingTotal.then(null,()=>{});const ut=dt&&dt.rows||[];if(ut.length&&(yield ut),ut.length<Te)return}l(tt);const et=await ne(await d.execute({...Ye.pushed,range:void 0},tt)),lt=ae(et&&et.rows||[],{...Ye.residual,whole:!0},P.compute||{});for(let bt=0;bt<lt.length;bt+=Te)yield lt.slice(bt,bt+Te)}return{...P,edit:ct,rowMutate:Ct,mode:"remote",fetch:Mt,foregroundIdle:Ue,aggregate:pt,countMatching:async Ee=>{const{plan:Ie,signal:Ye}=await Ze(Ee);if(!Ie.needsAll&&C.total){l({signal:Ye});const Te=await ne(await d.execute({...Ie.pushed,range:{start:0,end:0}},{signal:Ye}));if(Te&&typeof Te.total=="number")return Te.total}let Ke=0;for await(const Te of gt(Ee))Ke+=Te.length;return Ke},streamMatching:gt,lastPlan:()=>g?{...g,...f?{aggregates:f}:{},...I?{total:{deferred:!0,state:I.state,value:I.value}}:{}}:null,fullFrame:$e,counts:()=>({match:R,total:Y??null,pending:!!I&&I.state==="pending"}),grandTotals:()=>W}}}),Xe("packages/modules/shared/engine.js",function(n,ge){"use strict";Object.defineProperty(n,"sourceId",{enumerable:!0,get:function(){return G}}),Object.defineProperty(n,"engineSource",{enumerable:!0,get:function(){return ie}}),Object.defineProperty(n,"gridPivoted",{enumerable:!0,get:function(){return U}}),Object.defineProperty(n,"loadedAndMatching",{enumerable:!0,get:function(){return v}}),Object.defineProperty(n,"gridHoldsWindow",{enumerable:!0,get:function(){return L}}),Object.defineProperty(n,"gridEngineRequest",{enumerable:!0,get:function(){return D}}),Object.defineProperty(n,"EngineFlight",{enumerable:!0,get:function(){return j}});const ke=ge("packages/core/src/source/pushdown.js"),ee=ke.capabilitiesOf,a=ke.planQuery,le=ge("packages/core/src/source/filterwire.js").wireFilters,be=new WeakMap;let F=0;function G(u){let l=be.get(u);return l===void 0&&(l=++F,be.set(u,l)),l}function ie(u){const l=u&&typeof u.config=="function"?u.config():null,s=l&&l.source&&typeof l.source=="object"?l.source:null;if(!s||typeof s.aggregate!="function")return{reason:"the grid's source has no aggregate() — it is not a pushdown source"};const c=ee(s.adapter&&s.adapter.capabilities);return{source:s,caps:c,config:l}}function U(u){const l=u&&typeof u.config=="function"?u.config():null,s=l&&l.source&&typeof l.source=="object"?l.source:null;if(!s||typeof s.lastPlan!="function")return!1;const c=u&&u.state&&typeof u.state.get=="function"?u.state.get():null,b=c&&c.pivot;return!!(b&&b.enabled&&Array.isArray(b.columns)&&b.columns.length>0)}function v(u){const l=u.rows&&typeof u.rows.residentCount=="function"?u.rows.residentCount():0,s=typeof u.rows.matchCount=="function"?u.rows.matchCount():NaN;return{loaded:l,total:Number.isFinite(s)?s:NaN}}function L(u){const l=u&&typeof u.config=="function"?u.config():null,s=l&&l.source&&typeof l.source=="object"?l.source:null;if(!s||s.mode!=="remote"&&s.mode!=="paged")return!1;if(typeof u.rows.matchCount=="function"&&u.rows.matchCount()===null)return!0;const{loaded:c,total:b}=v(u);return Number.isFinite(b)&&c<b}function m(u,l){return l?u?{op:"and",conditions:[u,l]}:l:u||null}function D(u,l,s=null){const c=u.filters&&typeof u.filters.where=="function"?u.filters.where():[];if(Array.isArray(c)&&c.length)return{reason:`a \`where\` predicate is in force (${c.join(", ")}), which only the browser can run`};const b=u.filters&&typeof u.filters.quickState=="function"?u.filters.quickState():{text:""},y=b&&b.text?String(b.text):"",{config:i,caps:x}=l,t={filters:le(m(u.filters.get(),s),{tz:i.timeZone,weekStartsOn:i.weekStartsOn}),sort:[],range:null,context:i.context??null,...y?{quick:y}:{}},w=a(t,x);return w.unpushed.includes("filter")?{reason:s?"the grid's filter, or the viewport condition, did not fully push to the engine":"the grid's filter did not fully push to the engine"}:w.unpushed.includes("quick")?{reason:"the quick search did not push to the engine"}:{request:t,quick:y}}class j{#e=null;#t=null;#n=!1;answer(l){return this.#t&&this.#t.key===l?this.#t:null}last(){return this.#t}get busy(){return this.#e!==null}ask(l,s,c){const b=this.#e;if(b){b.key!==l&&b.controller&&b.controller.abort();return}const y=globalThis.AbortController,i=typeof y=="function"?new y:null,x={key:l,controller:i};this.#e=x;let t;Promise.resolve().then(()=>s(i?i.signal:null)).then(w=>{t={key:l,result:w}},w=>{t={key:l,error:w}}).then(()=>{this.#e===x&&(this.#e=null),!this.#n&&(i&&i.signal.aborted||(this.#t=t),c())})}abort(){const l=this.#e;l&&l.controller&&l.controller.abort()}close(){this.#n=!0,this.abort()}}}),Xe("packages/modules/charts/scale.js",function(n,ge){"use strict";Object.defineProperty(n,"isNumber",{enumerable:!0,get:function(){return G}}),Object.defineProperty(n,"toNumber",{enumerable:!0,get:function(){return ie}}),Object.defineProperty(n,"toTime",{enumerable:!0,get:function(){return U}}),Object.defineProperty(n,"extent",{enumerable:!0,get:function(){return v}}),Object.defineProperty(n,"niceStep",{enumerable:!0,get:function(){return L}}),Object.defineProperty(n,"niceDomain",{enumerable:!0,get:function(){return m}}),Object.defineProperty(n,"measureDomain",{enumerable:!0,get:function(){return D}}),Object.defineProperty(n,"linearTicks",{enumerable:!0,get:function(){return j}}),Object.defineProperty(n,"timeStepFor",{enumerable:!0,get:function(){return u}}),Object.defineProperty(n,"timeTicks",{enumerable:!0,get:function(){return s}}),Object.defineProperty(n,"linearScale",{enumerable:!0,get:function(){return c}}),Object.defineProperty(n,"timeScale",{enumerable:!0,get:function(){return b}}),Object.defineProperty(n,"key",{enumerable:!0,get:function(){return y}}),Object.defineProperty(n,"bandScale",{enumerable:!0,get:function(){return i}}),Object.defineProperty(n,"sqrtScale",{enumerable:!0,get:function(){return x}});const ke=[1,2,2.5,5,10],ee=6e4,a=36e5,ye=864e5,le=365.25*ye,be=[1,2,5,10,20,25,50,100],F=[1,5,10,25,50,100,250,500,1e3,5e3,15e3,3e4,ee,5*ee,15*ee,30*ee,a,3*a,6*a,12*a,ye,2*ye,7*ye,14*ye,30*ye,90*ye,180*ye,...be.map(t=>t*le)];function G(t){return typeof t=="number"&&Number.isFinite(t)}function ie(t){if(t==null||t==="")return null;if(t instanceof Date){const B=t.getTime();return Number.isFinite(B)?B:null}if(typeof t=="boolean")return t?1:0;const w=Number(t);return Number.isFinite(w)?w:null}function U(t){if(t==null||t==="")return null;if(t instanceof Date){const B=t.getTime();return Number.isFinite(B)?B:null}if(typeof t=="number")return Number.isFinite(t)?t:null;const w=Date.parse(String(t));return Number.isFinite(w)?w:null}function v(t){let w=1/0,B=-1/0;for(let K=0;K<t.length;K++){const H=t[K];G(H)&&(H<w&&(w=H),H>B&&(B=H))}return w===1/0?null:{min:w,max:B}}function L(t){if(!(t>0))return 1;const w=10**Math.floor(Math.log10(t));for(const B of ke)if(t<=B*w)return B*w;return 10*w}function m(t,w=5){const B=L((t.max-t.min)/Math.max(1,w));return{min:Math.floor(t.min/B)*B,max:Math.ceil(t.max/B)*B,step:B}}function D(t,w={}){const B=v(t)||{min:0,max:1};let{min:K,max:H}=B;if(w.zero&&(K>0&&(K=0),H<0&&(H=0)),K===H){const q=Math.abs(K)>0?Math.abs(K)/10:1;K-=q,H+=q}if(w.nice!==!1){const q=m({min:K,max:H},w.ticks||5);K=q.min,H=q.max}return G(w.min)&&(K=w.min),G(w.max)&&(H=w.max),K===H&&(H=K+1),{min:K,max:H}}function j(t,w=5){const B=L((t.max-t.min)/Math.max(1,w)),K=Math.ceil(t.min/B),H=Math.floor(t.max/B),q=[];for(let Q=K;Q<=H;Q++){const re=Q*B;q.push(Math.abs(re)<B/1e6?0:Number(re.toPrecision(12)))}return q}function u(t,w=5){const B=Math.max(1,w),K=t/B;let H=F[F.length-1];for(const re of F)if(re>=K){H=re;break}if(H<le)return H;let q=H,Q=Math.abs(t/H-B);for(const re of F){if(re<le)continue;const pe=Math.abs(t/re-B);pe<Q&&(Q=pe,q=re)}return q}function l(t,w){const B=new Date(t.min).getUTCFullYear();let K=Math.ceil(B/w)*w;Date.UTC(K,0,1)<t.min&&(K+=w);const H=[];for(;Date.UTC(K,0,1)<=t.max;K+=w)H.push(Date.UTC(K,0,1));return H}function s(t,w=5){const B=u(t.max-t.min,w);if(B>=le)return l(t,Math.round(B/le));const K=[],H=Math.ceil(t.min/B)*B;for(let q=H;q<=t.max;q+=B)K.push(q);return K}function c(t,w){const B=t.max-t.min||1,[K,H]=w;return{kind:"linear",domain:t,range:w,of(q){return K+(q-t.min)/B*(H-K)},invert(q){return t.min+(q-K)/(H-K||1)*B},ticks(q=5){return j(t,q)}}}function b(t,w){return{...c(t,w),kind:"time",ticks(K=5){return s(t,K)}}}function y(t){if(t==null)return" null";if(t instanceof Date)return` date:${t.getTime()}`;if(typeof t=="object"){const w=t,B=w.id??w.key??w.value;return B!==void 0&&typeof B!="object"?` obj:${String(B)}`:` obj:${String(t)}`}return String(t)}function i(t,w,B=.2){const K=Math.min(.9,Math.max(0,B)),[H,q]=w,Q=new Map;for(let he=0;he<t.length;he++){const $=y(t[he]);Q.has($)||Q.set($,he)}const re=t.length?(q-H)/t.length:q-H,pe=Math.max(0,re*(1-K));return{kind:"band",domain:t,range:w,bandwidth:pe,step:re,of(he){const $=Q.get(y(he));return $===void 0?NaN:H+$*re+(re-pe)/2},centre(he){const $=this.of(he);return Number.isNaN($)?NaN:$+pe/2},ticks(){return t}}}function x(t,w){const[B,K]=w,H=Math.max(Math.abs(t.max),Math.abs(t.min),0)||1;return{kind:"sqrt",domain:t,range:w,of(q){const Q=Math.sqrt(Math.abs(q)/H);return B+Q*(K-B)}}}}),Xe("packages/modules/charts/svg.js",function(n,ge){"use strict";Object.defineProperty(n,"SVG_NS",{enumerable:!0,get:function(){return ke}}),Object.defineProperty(n,"el",{enumerable:!0,get:function(){return a}}),Object.defineProperty(n,"svg",{enumerable:!0,get:function(){return ye}}),Object.defineProperty(n,"attr",{enumerable:!0,get:function(){return le}}),Object.defineProperty(n,"attrs",{enumerable:!0,get:function(){return be}}),Object.defineProperty(n,"setText",{enumerable:!0,get:function(){return F}}),Object.defineProperty(n,"clear",{enumerable:!0,get:function(){return G}}),Object.defineProperty(n,"append",{enumerable:!0,get:function(){return ie}}),Object.defineProperty(n,"path",{enumerable:!0,get:function(){return U}}),Object.defineProperty(n,"ribbonPath",{enumerable:!0,get:function(){return v}}),Object.defineProperty(n,"round",{enumerable:!0,get:function(){return L}}),Object.defineProperty(n,"pathRings",{enumerable:!0,get:function(){return m}}),Object.defineProperty(n,"insideRings",{enumerable:!0,get:function(){return D}});const ke="http://www.w3.org/2000/svg";function ee(j){const u=j.indexOf(")");return u<0?j:j.slice(u+1).trim()||"#0072b2"}function a(j,u,l){const s=j.createElement(u);return l&&s.setAttribute("class",l),s}function ye(j,u,l){const s=j.createElementNS(ke,u);if(l)for(const c of Object.keys(l))s.setAttribute(c,String(l[c]));return s}function le(j,u,l){if(!j)return;if(l==null){j.removeAttribute(u);return}let s=String(l);s.startsWith("url(#")&&(u==="stroke"||u==="fill"&&j.localName==="text")&&(s=ee(s)),j.setAttribute(u,s)}function be(j,u){if(j)for(const l of Object.keys(u))le(j,l,u[l])}function F(j,u){j&&(j.textContent=u==null?"":String(u))}function G(j){if(j)for(;j.firstChild;)j.removeChild(j.firstChild)}function ie(j,u){for(const l of u)l&&j.appendChild(l);return j}function U(j){return j.join(" ")}function v(j){if(!j||j.length<2)return"";const u=["M",j[0].x,j[0].upper];for(let l=1;l<j.length;l++)u.push("L",j[l].x,j[l].upper);for(let l=j.length-1;l>=0;l--)u.push("L",j[l].x,j[l].lower);return u.push("Z"),U(u)}function L(j){return Math.round(j*100)/100}function m(j){const u=[];let l=[];const s=String(j||"").match(/[A-Za-z]|-?\d*\.?\d+(?:e[-+]?\d+)?/gi)||[];let c="",b=[];const y=()=>{if(!c||!b.length){b=[];return}if(c==="M"||c==="L")for(let i=0;i+1<b.length;i+=2)l.push([b[i],b[i+1]]);else c!=="Z"&&b.length>=2&&l.push([b[b.length-2],b[b.length-1]]);b=[]};for(const i of s){if(/[A-Za-z]/.test(i)){if(y(),i==="Z"||i==="z"){l.length>2&&u.push(l),l=[],c="";continue}i==="M"&&l.length>2&&(u.push(l),l=[]),c=i;continue}b.push(Number(i))}return y(),l.length>2&&u.push(l),u}function D(j,u,l){let s=!1;for(const c of j)for(let b=0,y=c.length-1;b<c.length;y=b++){const[i,x]=c[b],[t,w]=c[y];x>l!=w>l&&u<(t-i)*(l-x)/(w-x||1e-12)+i&&(s=!s)}return s}}),Xe("packages/modules/charts/typography.js",function(n,ge){"use strict";Object.defineProperty(n,"BASE_SIZE",{enumerable:!0,get:function(){return ke}}),Object.defineProperty(n,"BASE_FAMILY",{enumerable:!0,get:function(){return ee}}),Object.defineProperty(n,"CHAR_RATIO",{enumerable:!0,get:function(){return a}}),Object.defineProperty(n,"resolveType",{enumerable:!0,get:function(){return ye}}),Object.defineProperty(n,"textWidth",{enumerable:!0,get:function(){return be}}),Object.defineProperty(n,"widestLabel",{enumerable:!0,get:function(){return F}}),Object.defineProperty(n,"truncateTo",{enumerable:!0,get:function(){return G}}),Object.defineProperty(n,"applySize",{enumerable:!0,get:function(){return ie}});const ke=12,ee="var(--lattice-font-family, system-ui, -apple-system, sans-serif)",a=.62;function ye(U){const v=U&&U.font,L=typeof v=="number"?{size:v}:v||{},m=le(L.size,ke);return{family:L.family||ee,size:m,small:le(L.small??L.tickSize,Math.max(9,m-1)),title:le(L.title,Math.round(m*1.15)),axisTitle:le(L.axisTitle,Math.max(10,m-1)),weight:L.weight||"inherit"}}function le(U,v){const L=Number(U);return Number.isFinite(L)&&L>0?L:v}function be(U,v){return String(U??"").length*v*a}function F(U,v){let L=0;for(const m of U||[]){const D=be(m,v);D>L&&(L=D)}return L}function G(U,v,L){const m=String(U??""),D=Math.floor(v/(L*a));return D<=0?"":m.length<=D?m:D===1?"…":`${m.slice(0,D-1)}…`}function ie(U,v){!U||!Number.isFinite(v)||(U.style?U.style.fontSize=`${v}px`:U.setAttribute("style",`font-size:${v}px`))}}),Xe("packages/modules/charts/frame.js",function(n,ge){"use strict";Object.defineProperty(n,"LABEL_GAP",{enumerable:!0,get:function(){return F}}),Object.defineProperty(n,"LABEL_GUTTER_SHARE",{enumerable:!0,get:function(){return G}}),Object.defineProperty(n,"resolveMargin",{enumerable:!0,get:function(){return ie}}),Object.defineProperty(n,"plotRect",{enumerable:!0,get:function(){return U}}),Object.defineProperty(n,"shouldRotate",{enumerable:!0,get:function(){return v}}),Object.defineProperty(n,"Pool",{enumerable:!0,get:function(){return L}});const ee=ge("packages/modules/charts/svg.js").SVG_NS,a=ge("packages/modules/charts/typography.js"),ye=a.textWidth,le=a.widestLabel,be=8,F=6,G=.4;function ie(m,D){const j=typeof m=="number"?m:D,u=m&&typeof m=="object"?m:{},l=s=>Number.isFinite(s)&&s>=0?Number(s):j;return{base:j,top:l(u.top),right:l(u.right),bottom:l(u.bottom),left:l(u.left)}}function U(m){const D=ie(m.margin,typeof m.padding=="number"?m.padding:8),j=D.base,u=m.fontSize||12,l=m.yLabels||[],s=m.xLabels||[],c=m.ySide==="right"?"right":"left",b=c==="right"?"left":"right",y=m.titles||{},i=m.titleSize||u,x=$=>$?i+F:0,t=le(l,u),w=l.length?Math.min(m.width*G,D[c]+t+F):Math.max(be,D[c]),B=D[b]+(m.rightGutter||0),K=(c==="left"?w:B)+x(y.left),H=le(s.map($=>String($).slice(0,14)),u),q=(s.length?m.rotated?Math.min(m.height*G,F+H):u+F+D.bottom:Math.max(be,D.bottom))+x(y.bottom),Q=(c==="right"?w:B)+x(y.right),re=D.top+(m.topGutter||0),pe=Math.max(0,m.width-K-Q),he=Math.max(0,m.height-re-q);return{left:K,top:re,width:pe,height:he,right:K+pe,bottom:re+he,gutter:{left:K,bottom:q,right:Q,top:re}}}function v(m,D,j,u){if(!m.length||D<=0)return!1;const l=Number.isFinite(u)&&u>0?Number(u):1;return le(m,j)>D*l-4}class L{#e;#t=0;static#n="data-pool-key";constructor(D,j=0){this.#e=D,this.#t=j>0?j:0}next(D,j,u){if(u!=null)return this.#r(D,j,String(u));const l=this.#e.childNodes[this.#t],s=l&&l.tagName,c=/(^|\s)\S*__axis-title(\s|$)/,b=s&&c.test(String(l.getAttribute("class")||"")),y=!!j&&c.test(String(j));if(s&&(!b||y)&&String(s).toLowerCase()===D.toLowerCase())return j&&l.setAttribute("class",j),this.#t++,l;const i=this.#e.ownerDocument.createElementNS(ee,D);return j&&i.setAttribute("class",j),l?this.#e.insertBefore(i,l):this.#e.appendChild(i),this.#t++,i}#r(D,j,u){const l=D.toLowerCase();for(let b=this.#t;b<this.#e.childNodes.length;b++){const y=this.#e.childNodes[b],i=y&&y.tagName;if(i&&String(i).toLowerCase()===l&&y.getAttribute(L.#n)===u)return b!==this.#t&&this.#e.insertBefore(y,this.#e.childNodes[this.#t]),j&&y.setAttribute("class",j),this.#t++,y}const s=this.#e.ownerDocument.createElementNS(ee,D);s.setAttribute(L.#n,u),j&&s.setAttribute("class",j);const c=this.#e.childNodes[this.#t];return c?this.#e.insertBefore(s,c):this.#e.appendChild(s),this.#t++,s}finish(){for(;this.#e.childNodes.length>this.#t;)this.#e.removeChild(this.#e.lastChild);this.#t=0}}}),Xe("packages/modules/charts/fills.js",function(n,ge){"use strict";Object.defineProperty(n,"PATTERNS",{enumerable:!0,get:function(){return a}}),Object.defineProperty(n,"GRADIENTS",{enumerable:!0,get:function(){return ye}}),Object.defineProperty(n,"isFill",{enumerable:!0,get:function(){return ie}}),Object.defineProperty(n,"isPaintRef",{enumerable:!0,get:function(){return U}}),Object.defineProperty(n,"paintFallback",{enumerable:!0,get:function(){return v}}),Object.defineProperty(n,"normaliseFill",{enumerable:!0,get:function(){return m}}),Object.defineProperty(n,"swatchCss",{enumerable:!0,get:function(){return j}}),Object.defineProperty(n,"createFillRegistry",{enumerable:!0,get:function(){return u}}),Object.defineProperty(n,"rowPaint",{enumerable:!0,get:function(){return l}}),Object.defineProperty(n,"patternSeries",{enumerable:!0,get:function(){return s}}),Object.defineProperty(n,"paintSolid",{enumerable:!0,get:function(){return c}}),Object.defineProperty(n,"rowFillSource",{enumerable:!0,get:function(){return b}}),Object.defineProperty(n,"nodePaint",{enumerable:!0,get:function(){return y}});const ee=ge("packages/core/src/internal/util.js").warnOnce,a=Object.freeze(["hatch","crosshatch","dots","grid"]),ye=Object.freeze(["linear","radial"]),le=8,be="#0072b2";let F=0;const G=new Map;function ie(i){return!!i&&typeof i=="object"&&!Array.isArray(i)&&(typeof i.gradient=="string"||typeof i.pattern=="string")}function U(i){return typeof i=="string"&&i.startsWith("url(#")}function v(i){if(typeof i!="string")return i==null?"":String(i);if(!i.startsWith("url("))return i;const x=i.indexOf(")");return(x<0?"":i.slice(x+1).trim())||be}function L(i,x){ee(`chart:fill:invalid:${i}`,`a chart fill object was ignored: ${x} The mark was drawn in a solid colour instead. A fill is a gradient object (gradient: "linear" or "radial", with stops of [offset, colour]) or a pattern object (pattern: "hatch", "crosshatch", "dots" or "grid", with a colour).`)}function m(i,x){if(!ie(i))return null;const t=x||be;if(typeof i.gradient=="string"){if(!ye.includes(i.gradient))return L("gradient",`the gradient "${i.gradient}" is not one of ${ye.join(", ")}.`),null;const H=Array.isArray(i.stops)?i.stops:[],q=[];for(const re of H){const pe=Array.isArray(re)?Number(re[0]):Number(re&&re.offset),he=Array.isArray(re)?re[1]:re&&re.colour;!Number.isFinite(pe)||typeof he!="string"||!he||q.push({offset:Math.min(1,Math.max(0,pe)),colour:he})}if(q.length<2)return L("stops","a gradient needs at least two [offset, colour] stops."),null;q.sort((re,pe)=>re.offset-pe.offset);const Q=Number.isFinite(Number(i.angle))?Number(i.angle):180;return{kind:i.gradient,angle:Q,stops:q,solid:q[0].colour}}if(!a.includes(i.pattern))return L("pattern",`the pattern "${i.pattern}" is not one of ${a.join(", ")}.`),null;const w=Number(i.size),B=Number(i.angle),K=typeof i.colour=="string"&&i.colour?i.colour:t;return{kind:"pattern",pattern:i.pattern,colour:K,background:typeof i.background=="string"&&i.background?i.background:null,size:Number.isFinite(w)&&w>=2?w:le,angle:Number.isFinite(B)?B:i.pattern==="grid"||i.pattern==="dots"?0:45,solid:K}}function D(i){if(i.kind==="pattern"){const t=i.colour,w=i.size,B=Math.max(1,w/5),K=i.background||"transparent",H=q=>`repeating-linear-gradient(${q+90}deg,${t} 0 ${B}px,transparent ${B}px ${w}px)`;return i.pattern==="hatch"?`${H(i.angle)},${K}`:i.pattern==="crosshatch"?`${H(i.angle)},${H(i.angle+90)},${K}`:i.pattern==="grid"?`${H(i.angle)},${H(i.angle+90)},${K}`:`radial-gradient(circle at 50% 50%,${t} ${w/6}px,transparent ${w/6+.5}px) 0 0/${w}px ${w}px,${K}`}const x=i.stops.map(t=>`${t.colour} ${Math.round(t.offset*100)}%`).join(",");return i.kind==="radial"?`radial-gradient(circle,${x})`:`linear-gradient(${i.angle}deg,${x})`}function j(i){if(!U(i))return typeof i=="string"?i:"";const x=String(i).indexOf(")"),t=String(i).slice(5,x),w=G.get(t);return w?D(w):v(i)}function u(i){const x=`lattice-fill-${++F}`;let t=new Map,w=0;const B=(H,q)=>{const Q=i.ownerDocument.createElementNS("http://www.w3.org/2000/svg",H);for(const re of Object.keys(q))Q.setAttribute(re,String(q[re]));return Q},K=(H,q)=>{if(q.kind==="pattern"){const re=q.size,pe=Math.max(1,re/5),he=B("pattern",{id:H,width:re,height:re,patternUnits:"userSpaceOnUse"});q.angle&&he.setAttribute("patternTransform",`rotate(${q.angle})`),q.background&&he.appendChild(B("rect",{width:re,height:re,fill:q.background}));const $={stroke:q.colour,"stroke-width":pe};q.pattern==="dots"?he.appendChild(B("circle",{cx:re/2,cy:re/2,r:Math.max(1,re/6),fill:q.colour})):(he.appendChild(B("line",{x1:re/2,y1:0,x2:re/2,y2:re,...$})),q.pattern!=="hatch"&&he.appendChild(B("line",{x1:0,y1:re/2,x2:re,y2:re/2,...$}))),i.appendChild(he);return}let Q;if(q.kind==="radial")Q=B("radialGradient",{id:H,cx:.5,cy:.5,r:.5});else{const re=q.angle*Math.PI/180,pe=Math.sin(re)/2,he=-Math.cos(re)/2;Q=B("linearGradient",{id:H,x1:+(.5-pe).toFixed(4),y1:+(.5-he).toFixed(4),x2:+(.5+pe).toFixed(4),y2:+(.5+he).toFixed(4)})}for(const re of q.stops)Q.appendChild(B("stop",{offset:re.offset,"stop-color":re.colour}));i.appendChild(Q)};return{prefix:x,paint(H,q){const Q=m(H,q);if(!Q)return q||be;if(!i||!i.ownerDocument)return Q.solid;const re=JSON.stringify(Q);let pe=t.get(re);if(!pe){const he=`${x}-${w++}`;K(he,Q),G.set(he,Q),pe=`url(#${he}) ${Q.solid}`,t.set(re,pe)}return pe},reset(){for(const H of t.values())G.delete(H.slice(5,H.indexOf(")")));if(t=new Map,w=0,i)for(;i.firstChild;)i.removeChild(i.firstChild)},ids(){return[...t.values()].map(H=>H.slice(5,H.indexOf(")")))}}}function l(i,x,t){if(i==null||i==="")return null;const w=v(t);if(ie(i))return x?x.paint(i,w):(m(i,w)||{}).solid||null;if(typeof i=="string"){if(a.includes(i)){const B={pattern:i,colour:w};return x?x.paint(B,w):w}return i}return null}function s(i){const x=[{pattern:"hatch",angle:45},{pattern:"dots"},{pattern:"crosshatch",angle:45},{pattern:"hatch",angle:135},{pattern:"grid"},{pattern:"dots",size:5},{pattern:"hatch",angle:0},{pattern:"crosshatch",angle:0,size:6}];return i.map((t,w)=>({...x[w%x.length],colour:t,background:"var(--lattice-background, #fff)"}))}function c(i){return U(i)?String(i).replace(/^url\([^)]*\)\s*/,""):i}function b(i,x){const t=i.fill;if(ie(t))return(B,K)=>l(t,x.fills,c(K));if(typeof t=="function")return(B,K)=>{let H=null;try{H=t({label:B.label,x:B.x,y:B.y,rowKey:B.rowKey})}catch{H=null}return l(H,x.fills,c(K))};const w=typeof t=="string"?t:t&&typeof t=="object"&&typeof t.col=="string"?t.col:null;return w?(B,K)=>B.rowKey===void 0||B.rowKey===null?null:l(i.grid.rows.value(B.rowKey,w),x.fills,c(K)):null}function y(i,x,t){return i&&i({label:x.label,x:x.value,y:x.total,rowKey:x.rowKey},t)||t}}),Xe("packages/modules/charts/scheme.js",function(n,ge){"use strict";Object.defineProperty(n,"PALETTE",{enumerable:!0,get:function(){return F}}),Object.defineProperty(n,"SCHEMES",{enumerable:!0,get:function(){return G}}),Object.defineProperty(n,"registerScheme",{enumerable:!0,get:function(){return v}}),Object.defineProperty(n,"setDefaultScheme",{enumerable:!0,get:function(){return L}}),Object.defineProperty(n,"schemeNames",{enumerable:!0,get:function(){return m}}),Object.defineProperty(n,"resolveScheme",{enumerable:!0,get:function(){return l}}),Object.defineProperty(n,"RAMP_SCALES",{enumerable:!0,get:function(){return c}}),Object.defineProperty(n,"toRgb",{enumerable:!0,get:function(){return i}}),Object.defineProperty(n,"rampStops",{enumerable:!0,get:function(){return x}});const ee=ge("packages/core/src/internal/util.js").warnOnce,a=ge("packages/modules/charts/fills.js"),ye=a.isFill,le=a.patternSeries,be=a.rowPaint,F=Object.freeze(["#0072b2","#e69f00","#009e73","#cc79a7","#56b4e9","#d55e00","#7a5195","#6b7d8c"]),G=Object.freeze({default:{series:F,sequential:["#ecf3f9","#005280"],diverging:["#b04a00","#f7f7f7","#005280"],positive:"#009e73",negative:"#d55e00"},bright:{series:["#1f77d0","#ff7f0e","#2ca02c","#d62728","#9467bd","#17becf","#e377c2","#7f7f7f"],sequential:["#eef4fb","#1f77d0"],diverging:["#d62728","#f7f7f7","#1f77d0"],positive:"#2ca02c",negative:"#d62728"},earth:{series:["#5b7c6f","#c08b52","#7a6a53","#a4553f","#4e6a83","#8f8259","#6d5566","#8c9196"],sequential:["#f2efe9","#4e6a83"],diverging:["#a4553f","#f2efe9","#4e6a83"],positive:"#5b7c6f",negative:"#a4553f"},mono:{series:["#0b2a3d","#17475f","#2c6480","#4a82a0","#6da0bd","#94bcd6","#bcd7e9","#dfecf5"],sequential:["#eef3f7","#0b2a3d"],diverging:["#7a5c00","#f5f5f5","#0b2a3d"],positive:"#17475f",negative:"#7a5c00"},patterns:{series:le(F),sequential:["#ecf3f9","#005280"],diverging:["#b04a00","#f7f7f7","#005280"],positive:"#009e73",negative:"#d55e00"}}),ie=new Map;let U="default";function v(t,w){!t||!w||ie.set(String(t),w)}function L(t){if(typeof t=="string"){U=t;return}t&&typeof t=="object"&&(ie.set("__default__",t),U="__default__")}function m(){return[...Object.keys(G),...ie.keys()].filter(t=>!t.startsWith("__"))}function D(t){return ie.has(t)?ie.get(t):G[t]||null}const j=["series","sequential","diverging","positive","negative"];function u(t){return!t||typeof t!="object"||Array.isArray(t)?!1:!j.some(w=>w in t)}function l(t,w){const B=w&&w.fills||null,K=D(U)||G.default,H=t&&t.scheme,q=u(H)?H:null,Q=Array.isArray(H)&&H.length?H:null,re=typeof H=="string"?D(H):q||Array.isArray(H)?null:H||null,pe=(t&&Array.isArray(t.palette)&&t.palette.length?t.palette:null)||Q;q&&pe&&ee("chart:scheme:array-and-map",'chart "scheme" was given as a name map together with a "palette" array; the two do not combine. Colours came from the map and the array was ignored. Pass one or the other.');const he=q?null:pe,$={...G.default,...K,...re||{}};he&&($.series=he);const Z=t&&t.ramp&&typeof t.ramp=="object"&&!Array.isArray(t.ramp)?t.ramp:null,ae=Z?Z.colours:t&&t.ramp,h=Array.isArray(ae)&&ae.length>=2?ae:null;h&&($.sequential=h);const e=Z?b(Z.scale):null,M=!!(re||he||q),k=$.series&&$.series.length?$.series:F,z=new Map;let A=0;return{...$,series:(te,P)=>{if(q&&P!==void 0&&P!==null){const d=String(P);return Object.prototype.hasOwnProperty.call(q,d)?s(q[d],B,te):(z.has(d)||z.set(d,A++),s(y(k,z.get(d),!0),B,z.get(d)))}return s(y(k,te,M),B,te)},explicit:M,nameMap:!!q,rampScale:e,fills:B}}function s(t,w,B){if(!ye(t))return t;const K=F[(B%F.length+F.length)%F.length];return be(t,w,K)||K}const c=Object.freeze(["linear","log","quantile"]);function b(t){return t==null?null:c.includes(t)?t:(ee(`chart:ramp:scale:${String(t)}`,`chart "ramp.scale" was "${String(t)}", which is not a ramp scale; the chart chose one from its values instead. Use "linear", "log" or "quantile".`),null)}function y(t,w,B){const K=(w%t.length+t.length)%t.length;return B||typeof t[K]!="string"?t[K]:`var(--lattice-chart-${K+1}, ${t[K]})`}function i(t){if(typeof t!="string")return null;const w=t.trim(),B=/^#([0-9a-f]{3}|[0-9a-f]{6})$/i.exec(w);if(B){const q=B[1];return q.length===3?[0,1,2].map(Q=>parseInt(q[Q]+q[Q],16)):[0,2,4].map(Q=>parseInt(q.slice(Q,Q+2),16))}const K=/^rgba?\(([^)]+)\)$/i.exec(w);if(!K)return null;const H=K[1].split(/[\s,/]+/).filter(Boolean).slice(0,3).map(Number);return H.length===3&&H.every(q=>Number.isFinite(q))?H:null}function x(t,w){const B=w?t.diverging:t.sequential,K=w?G.default.diverging:G.default.sequential,H=(Array.isArray(B)?B:K).map((q,Q)=>i(q)||i(K[Q])||[0,0,0]);return H.length>=2?H:K.map(q=>i(q))}}),Xe("packages/modules/charts/styles.js",function(n,ge){"use strict";Object.defineProperty(n,"NS",{enumerable:!0,get:function(){return a}}),Object.defineProperty(n,"seriesColour",{enumerable:!0,get:function(){return le}}),Object.defineProperty(n,"css",{enumerable:!0,get:function(){return be}}),Object.defineProperty(n,"injectStyles",{enumerable:!0,get:function(){return F}});const ee=ge("packages/modules/charts/scheme.js").PALETTE,a="lat-chartview",ye="data-lattice-chartview";function le(G){const ie=(G%ee.length+ee.length)%ee.length;return`var(--lattice-chart-${ie+1}, ${ee[ie]})`}function be(){return`
|
|
6
|
+
var kn=Object.create(null),vn=Object.create(null);function Xe(n,ge){kn[n]=ge}function xn(n){var ge=vn[n];if(ge)return ge;var ke=Object.create(null);vn[n]=ke;var ee=kn[n];if(!ee)throw new Error("[lattice] missing module: "+n);return ee(ke,xn),ke}Xe("packages/core/src/internal/util.js",function(n,ge){"use strict";Object.defineProperty(n,"VERSION",{enumerable:!0,get:function(){return a}}),Object.defineProperty(n,"reportedWarnings",{enumerable:!0,get:function(){return v}}),Object.defineProperty(n,"warnOnce",{enumerable:!0,get:function(){return m}}),Object.defineProperty(n,"infoOnce",{enumerable:!0,get:function(){return D}}),Object.defineProperty(n,"resetWarnings",{enumerable:!0,get:function(){return j}}),Object.defineProperty(n,"fail",{enumerable:!0,get:function(){return u}}),Object.defineProperty(n,"invariant",{enumerable:!0,get:function(){return l}}),Object.defineProperty(n,"DEV",{enumerable:!0,get:function(){return s}}),Object.defineProperty(n,"isObject",{enumerable:!0,get:function(){return c}}),Object.defineProperty(n,"isFunction",{enumerable:!0,get:function(){return b}}),Object.defineProperty(n,"isNil",{enumerable:!0,get:function(){return y}}),Object.defineProperty(n,"isBlank",{enumerable:!0,get:function(){return i}}),Object.defineProperty(n,"isCtor",{enumerable:!0,get:function(){return x}}),Object.defineProperty(n,"pathGetter",{enumerable:!0,get:function(){return w}}),Object.defineProperty(n,"pathSetter",{enumerable:!0,get:function(){return K}}),Object.defineProperty(n,"getPath",{enumerable:!0,get:function(){return H}}),Object.defineProperty(n,"setPath",{enumerable:!0,get:function(){return q}}),Object.defineProperty(n,"humanise",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(n,"escapeHtml",{enumerable:!0,get:function(){return pe}}),Object.defineProperty(n,"titleCase",{enumerable:!0,get:function(){return he}}),Object.defineProperty(n,"expand",{enumerable:!0,get:function(){return $}}),Object.defineProperty(n,"toArray",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(n,"merge",{enumerable:!0,get:function(){return h}}),Object.defineProperty(n,"mergeRow",{enumerable:!0,get:function(){return e}}),Object.defineProperty(n,"Lru",{enumerable:!0,get:function(){return M}}),Object.defineProperty(n,"collator",{enumerable:!0,get:function(){return z}}),Object.defineProperty(n,"defaultCompare",{enumerable:!0,get:function(){return A}}),Object.defineProperty(n,"now",{enumerable:!0,get:function(){return ne}}),Object.defineProperty(n,"nextFrame",{enumerable:!0,get:function(){return P}}),Object.defineProperty(n,"cancelFrame",{enumerable:!0,get:function(){return d}}),Object.defineProperty(n,"frameBatched",{enumerable:!0,get:function(){return C}}),Object.defineProperty(n,"settleDebounce",{enumerable:!0,get:function(){return J}}),Object.defineProperty(n,"whenIdle",{enumerable:!0,get:function(){return E}}),Object.defineProperty(n,"uid",{enumerable:!0,get:function(){return oe}});const ke="1.86.5";async function ee(){return ke}const a="1.86.5",ye=new Set,le=2e3;function be(S){if(ye.add(S),ye.size>le){const O=ye.values().next().value;O!==void 0&&ye.delete(O)}}const F=[],G=500;function ie(S,O,V){F.push({key:S,level:O,message:V.map(r=>typeof r=="string"?r:U(r)).join(" "),at:Date.now()}),F.length>G&&F.shift()}function U(S){if(S instanceof Error)return S.message;try{return JSON.stringify(S)}catch{return String(S)}}function v(){return F.map(S=>({...S}))}function L(S){if(S.length===0||typeof S[0]!="string")return S;const O=S[0].replace(/^\[lattice\]\s*/,"");return O===S[0]?S:[O,...S.slice(1)]}function m(S,...O){if(ye.has(S))return;be(S);const V=L(O);ie(S,"warn",V),console.warn("[lattice]",...V)}function D(S,...O){if(ye.has(S))return;be(S);const V=L(O);ie(S,"info",V),console.info("[lattice]",...V)}function j(){ye.clear(),F.length=0}function u(S,O){const V=new Error(`[lattice] ${S}`);throw O!==void 0&&(V.cause=O),V}function l(S,O){S||u(O)}const s=(()=>{try{return!(typeof process<"u"&&process.env&&process.env.NODE_ENV==="production")}catch{return!0}})();function c(S){return S!==null&&typeof S=="object"&&!Array.isArray(S)}function b(S){return typeof S=="function"}function y(S){return S==null}function i(S){return S==null||S===""}function x(S){return typeof S!="function"?!1:/^class[\s{]/.test(Function.prototype.toString.call(S))?!0:!!(S.prototype&&Object.getOwnPropertyNames(S.prototype).length>1)}const t=new Map;function w(S){let O=t.get(S);if(O)return O;if(!S.includes("."))O=V=>V?.[S];else{const V=S.split("."),r=V.length;O=_=>{let o=_;for(let g=0;g<r;g++){if(o==null)return;o=o[V[g]]}return o}}return t.set(S,O),O}const B=new Map;function K(S){let O=B.get(S);if(O)return O;if(!S.includes("."))O=(V,r)=>{V!=null&&(V[S]=r)};else{const V=S.split("."),r=V.length-1;O=(_,o)=>{let g=_;for(let f=0;f<r;f++){if(g==null)return;const R=V[f];g[R]==null&&(g[R]={}),g=g[R]}g!=null&&(g[V[r]]=o)}}return B.set(S,O),O}function H(S,O){return w(O)(S)}function q(S,O,V){K(O)(S,V)}function Q(S){return S?(S.includes(".")?S.slice(S.lastIndexOf(".")+1):S).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(/^./,V=>V.toUpperCase()):""}const re={"&":"&","<":"<",">":">",'"':""","'":"'"};function pe(S){const O=S==null?"":String(S);return/[&<>"']/.test(O)?O.replace(/[&<>"']/g,V=>re[V]):O}function he(S){return String(S).replace(/\w\S*/g,O=>O[0].toUpperCase()+O.slice(1).toLowerCase())}function $(S,O,V){if(S!==void 0)return S===!0?{enabled:!0,...V}:S===!1?{enabled:!1}:c(S)?S:{[O]:S,enabled:!0}}function Z(S){return S==null?[]:Array.isArray(S)?S:[S]}const ae=Object.freeze(new Set(["__proto__","constructor","prototype"]));function h(S,O){if(!c(S))return c(O)?{...O}:O;if(!c(O))return O===void 0?S:O;const V={...S};for(const r of Object.keys(O)){if(ae.has(r))continue;const _=O[r];_!==void 0&&(V[r]=c(_)&&c(V[r])?h(V[r],_):_)}return V}function e(S,O){if(!c(S)||!c(O)||S===O)return O;const V=Object.create(Object.getPrototypeOf(S));return Object.assign(V,S,O),V}class M{#e;#t=new Map;#n;constructor(O=256,V=null){this.#e=O,this.#n=V}get size(){return this.#t.size}get max(){return this.#e}set max(O){this.#e=O,this.#r()}has(O){return this.#t.has(O)}get(O){const V=this.#t;if(!V.has(O))return;const r=V.get(O);return V.delete(O),V.set(O,r),r}peek(O){return this.#t.get(O)}set(O,V){const r=this.#t;return r.has(O)&&r.delete(O),r.set(O,V),this.#r(),V}delete(O){const V=this.#t.get(O);return this.#t.delete(O)&&this.#n&&this.#n(V,O),V}clear(){if(this.#n)for(const[O,V]of this.#t)this.#n(V,O);this.#t.clear()}keys(){return this.#t.keys()}values(){return this.#t.values()}#r(){const O=this.#t;for(;O.size>this.#e;){const V=O.keys().next().value,r=O.get(V);O.delete(V),this.#n&&this.#n(r,V)}}}const k=new Map;function z(S,O){const V=`${S||""}|${O?JSON.stringify(O):""}`;let r=k.get(V);return r||(r=new Intl.Collator(S||void 0,{numeric:!0,sensitivity:"variant",...O}),k.set(V,r)),r}function A(S,O){if(S===O)return 0;if(S==null)return 1;if(O==null)return-1;if(typeof S=="number"&&typeof O=="number")return Number.isNaN(S)?Number.isNaN(O)?0:1:Number.isNaN(O)||S<O?-1:S>O?1:0;const V=String(S),r=String(O);return V<r?-1:V>r?1:0}function ne(){return typeof performance<"u"&&performance.now?performance.now():Date.now()}const te=typeof requestAnimationFrame=="function";function P(S){return te?requestAnimationFrame(S):setTimeout(()=>S(ne()),16)}function d(S){S!=null&&(te?cancelAnimationFrame(S):clearTimeout(S))}function C(S){let O=null,V=null;const r=()=>{O=null;const o=V;V=null,S(...o||[])},_=(...o)=>{V=o,O===null&&(O=P(r))};return _.cancel=()=>{d(O),O=null,V=null},_.flush=()=>{O!==null&&(d(O),r())},_}function J(S,O){let V=null,r=null;const _=()=>{if(V=null,r===null)return;const f=r;r=null,S(...f),o()},o=()=>{V=setTimeout(_,O),typeof V?.unref=="function"&&V.unref()},g=(...f)=>{V===null?(S(...f),o()):(r=f,clearTimeout(V),o())};return g.flush=()=>{if(V!==null&&clearTimeout(V),V=null,r===null)return;const f=r;r=null,S(...f)},g.cancel=()=>{V!==null&&clearTimeout(V),V=null,r=null},g.pending=()=>V!==null||r!==null,g}function E(S,O=50){return typeof requestIdleCallback=="function"?requestIdleCallback(S,{timeout:O}):setTimeout(()=>S({timeRemaining:()=>0,didTimeout:!0}),1)}let se=0;function oe(S="l"){return`${S}${(++se).toString(36)}`}}),Xe("packages/modules/geometry/geodata.js",function(n,ge){"use strict";Object.defineProperty(n,"GEOMETRY_KINDS",{enumerable:!0,get:function(){return le}}),Object.defineProperty(n,"SPATIAL_OPERATORS",{enumerable:!0,get:function(){return be}}),Object.defineProperty(n,"GEOMETRY_OPERATORS",{enumerable:!0,get:function(){return F}}),Object.defineProperty(n,"EARTH_RADIUS",{enumerable:!0,get:function(){return G}}),Object.defineProperty(n,"toWkt",{enumerable:!0,get:function(){return q}}),Object.defineProperty(n,"toWkb",{enumerable:!0,get:function(){return he}}),Object.defineProperty(n,"readGeometry",{enumerable:!0,get:function(){return z}}),Object.defineProperty(n,"parseGeometry",{enumerable:!0,get:function(){return ne}}),Object.defineProperty(n,"haversine",{enumerable:!0,get:function(){return P}}),Object.defineProperty(n,"geometryInfo",{enumerable:!0,get:function(){return V}}),Object.defineProperty(n,"geometryKind",{enumerable:!0,get:function(){return r}}),Object.defineProperty(n,"spatialOperand",{enumerable:!0,get:function(){return o}}),Object.defineProperty(n,"spatialPredicate",{enumerable:!0,get:function(){return $e}});const ke=ge("packages/core/src/internal/util.js"),ee=ke.isNil,a=ke.isObject,ye=ke.warnOnce,le=Object.freeze(["Point","LineString","Polygon","MultiPoint","MultiLineString","MultiPolygon","GeometryCollection"]),be=Object.freeze(["withinBbox","withinPolygon","intersects","withinDistance"]),F=Object.freeze([...be,"blank","notBlank"]),G=63710088e-1,ie=Math.PI/180,U=16,v=1e-12;class L extends Error{}function m(N){throw new L(N)}function D(N){(!Array.isArray(N)||N.length<2)&&m("a position needs at least two numbers");const T=Number(N[0]),X=Number(N[1]);return(typeof N[0]!="number"||typeof N[1]!="number"||!Number.isFinite(T)||!Number.isFinite(X))&&m("a coordinate is not a finite number"),[T,X]}function j(N,T,X){Array.isArray(N)||m(`${X} is not an array of positions`);const ce=N.map(D);return ce.length<T&&m(`${X} needs at least ${T} positions, found ${ce.length}`),ce}function u(N){const T=j(N,3,"a polygon ring"),X=T[0],ce=T[T.length-1];return(X[0]!==ce[0]||X[1]!==ce[1])&&T.push([X[0],X[1]]),T.length<4&&m(`a polygon ring needs at least 3 distinct corners, found ${T.length-1}`),T}function l(N){return(!Array.isArray(N)||N.length===0)&&m("a polygon needs at least an outer ring"),N.map(u)}function s(N,T){switch(T>U&&m("geometry collections nest too deeply"),a(N)||m("GeoJSON must be an object"),N.type){case"Feature":return N.geometry==null?null:s(N.geometry,T+1);case"FeatureCollection":return m("a FeatureCollection holds many rows, not one value; load its features as rows");case"Point":return{type:"Point",coordinates:D(N.coordinates)};case"MultiPoint":return{type:"MultiPoint",coordinates:j(N.coordinates,1,"a MultiPoint")};case"LineString":return{type:"LineString",coordinates:j(N.coordinates,2,"a LineString")};case"MultiLineString":return(!Array.isArray(N.coordinates)||!N.coordinates.length)&&m("a MultiLineString needs at least one line"),{type:"MultiLineString",coordinates:N.coordinates.map(X=>j(X,2,"a LineString"))};case"Polygon":return{type:"Polygon",coordinates:l(N.coordinates)};case"MultiPolygon":return(!Array.isArray(N.coordinates)||!N.coordinates.length)&&m("a MultiPolygon needs at least one polygon"),{type:"MultiPolygon",coordinates:N.coordinates.map(l)};case"GeometryCollection":{(!Array.isArray(N.geometries)||!N.geometries.length)&&m("a GeometryCollection needs at least one geometry");const X=N.geometries.map(ce=>s(ce,T+1)).filter(Boolean);return X.length?{type:"GeometryCollection",geometries:X}:null}default:return m(`"${String(N.type)}" is not a GeoJSON geometry type`)}}const c=Object.freeze({POINT:"Point",LINESTRING:"LineString",POLYGON:"Polygon",MULTIPOINT:"MultiPoint",MULTILINESTRING:"MultiLineString",MULTIPOLYGON:"MultiPolygon",GEOMETRYCOLLECTION:"GeometryCollection"}),b=/[-+]?(?:\d+\.?\d*|\.\d+)(?:[eE][-+]?\d+)?/y,y=/[A-Za-z]+/y,i=/^\s*(?:SRID\s*=\s*\d+\s*;\s*)?[A-Za-z]+\s*(?:ZM|Z|M)?\s*(?:\(|EMPTY\b)/i;class x{text;at=0;constructor(T){this.text=T}space(){for(;this.at<this.text.length&&/\s/.test(this.text[this.at]);)this.at++}expect(T){this.space(),this.text[this.at]!==T&&m(`WKT expected "${T}" at character ${this.at+1}, found "${this.text[this.at]??"the end"}"`),this.at++}accept(T){return this.space(),this.text[this.at]===T?(this.at++,!0):!1}word(){this.space(),y.lastIndex=this.at;const T=y.exec(this.text);return T?(this.at+=T[0].length,T[0].toUpperCase()):""}numberNext(){return this.space(),b.lastIndex=this.at,b.test(this.text)}number(){this.space(),b.lastIndex=this.at;const T=b.exec(this.text);return T||m(`WKT expected a number at character ${this.at+1}`),this.at+=T[0].length,Number(T[0])}position(){const T=this.number(),X=this.number();for(;this.numberNext();)this.number();return[T,X]}positionList(){this.expect("(");const T=[this.position()];for(;this.accept(",");)T.push(this.position());return this.expect(")"),T}empty(){const T=this.at;return this.word()==="EMPTY"?!0:(this.at=T,!1)}geometry(T){T>U&&m("geometry collections nest too deeply");const X=this.word(),ce=c[X];ce||m(X?`"${X}" is not a WKT geometry type`:"WKT expected a geometry type");const Se=this.at,Ne=this.word();return Ne!=="Z"&&Ne!=="M"&&Ne!=="ZM"&&(this.at=Se),this.empty()?null:this.body(ce,T)}body(T,X){switch(T){case"Point":{this.expect("(");const ce=this.position();return this.expect(")"),{type:"Point",coordinates:ce}}case"LineString":return{type:"LineString",coordinates:j(this.positionList(),2,"a LineString")};case"Polygon":return{type:"Polygon",coordinates:this.polygonBody()};case"MultiPoint":{this.expect("(");const ce=[];do this.empty()||(this.accept("(")?(ce.push(this.position()),this.expect(")")):ce.push(this.position()));while(this.accept(","));return this.expect(")"),ce.length?{type:"MultiPoint",coordinates:ce}:null}case"MultiLineString":{const ce=this.parts(()=>j(this.positionList(),2,"a LineString"));return ce.length?{type:"MultiLineString",coordinates:ce}:null}case"MultiPolygon":{const ce=this.parts(()=>this.polygonBody());return ce.length?{type:"MultiPolygon",coordinates:ce}:null}default:{this.expect("(");const ce=[];do{const Se=this.geometry(X+1);Se&&ce.push(Se)}while(this.accept(","));return this.expect(")"),ce.length?{type:"GeometryCollection",geometries:ce}:null}}}parts(T){this.expect("(");const X=[];do this.empty()||X.push(T());while(this.accept(","));return this.expect(")"),X}polygonBody(){return l(this.parts(()=>this.positionList()))}}function t(N){const T=new x(String(N).replace(/^\s*SRID\s*=\s*\d+\s*;/i,"")),X=T.geometry(0);return T.space(),T.at<T.text.length&&m(`WKT has unexpected text after the geometry at character ${T.at+1}`),X}function w(N){return Object.is(N,-0)?"0":String(N)}function B(N){return`${w(N[0])} ${w(N[1])}`}function K(N){return`(${N.map(B).join(", ")})`}function H(N){return`(${N.map(K).join(", ")})`}function q(N){const T=ne(N);return T?Q(T):""}function Q(N){switch(N.type){case"Point":return`POINT (${B(N.coordinates)})`;case"LineString":return`LINESTRING ${K(N.coordinates)}`;case"Polygon":return`POLYGON ${H(N.coordinates)}`;case"MultiPoint":return`MULTIPOINT (${N.coordinates.map(T=>`(${B(T)})`).join(", ")})`;case"MultiLineString":return`MULTILINESTRING (${N.coordinates.map(K).join(", ")})`;case"MultiPolygon":return`MULTIPOLYGON (${N.coordinates.map(H).join(", ")})`;default:return`GEOMETRYCOLLECTION (${N.geometries.map(Q).join(", ")})`}}class re{view;at=0;constructor(T){this.view=new DataView(T.buffer,T.byteOffset,T.byteLength)}need(T){this.at+T>this.view.byteLength&&m(`WKB ends after ${this.view.byteLength} bytes, in the middle of a geometry`)}u8(){return this.need(1),this.view.getUint8(this.at++)}u32(T){this.need(4);const X=this.view.getUint32(this.at,T);return this.at+=4,X}f64(T){this.need(8);const X=this.view.getFloat64(this.at,T);return this.at+=8,X}count(T,X){const ce=this.u32(T);return ce*X>this.view.byteLength-this.at&&m(`WKB claims ${ce} elements, more than its bytes can hold`),ce}position(T,X){const ce=this.f64(T),Se=this.f64(T);for(let Ne=2;Ne<X;Ne++)this.f64(T);return[ce,Se]}positions(T,X){const ce=this.count(T,8*X),Se=new Array(ce);for(let Ne=0;Ne<ce;Ne++)Se[Ne]=this.position(T,X);return Se}geometry(T,X){T>U&&m("geometry collections nest too deeply");const ce=this.u8();ce!==0&&ce!==1&&m(`WKB byte-order mark is ${ce}, not 0 or 1`);const Se=ce===1,Ne=this.u32(Se);let Le=2;Ne&2147483648&&Le++,Ne&1073741824&&Le++,Ne&536870912&&this.u32(Se);let Ce=Ne&268435455;if(Ce>=1e3){const Ge=Math.floor(Ce/1e3);Ge>3&&m(`WKB geometry type ${Ce} is not one this reads`),Le=2+(Ge===3?2:1),Ce%=1e3}const We=le[Ce-1];switch(We||m(`WKB geometry type ${Ce} is not one this reads`),X&&We!==X&&m(`a part of a WKB Multi${X} is a ${We}`),We){case"Point":{const Ge=this.position(Se,Le);return Number.isNaN(Ge[0])&&Number.isNaN(Ge[1])?null:{type:"Point",coordinates:D(Ge)}}case"LineString":return{type:"LineString",coordinates:j(this.positions(Se,Le),2,"a LineString")};case"Polygon":{const Ge=this.count(Se,4),De=[];for(let Ue=0;Ue<Ge;Ue++)De.push(this.positions(Se,Le));return Ge?{type:"Polygon",coordinates:l(De)}:null}default:{const Ge=this.count(Se,5),De=We==="GeometryCollection"?void 0:We.slice(5),Ue=[];for(let He=0;He<Ge;He++){const pt=this.geometry(T+1,De);pt&&Ue.push(pt)}return Ue.length?We==="GeometryCollection"?{type:We,geometries:Ue}:{type:We,coordinates:Ue.map(He=>He.coordinates)}:null}}}}function pe(N){const T=new re(N),X=T.geometry(0);return T.at!==N.byteLength&&m(`WKB has ${N.byteLength-T.at} bytes left over after the geometry`),X}function he(N){const T=ne(N);if(!T)return null;const X=[];let ce=0;const Se=De=>{const Ue=new DataView(new ArrayBuffer(5));Ue.setUint8(0,1),Ue.setUint32(1,le.indexOf(De)+1,!0),X.push(Ue),ce+=5},Ne=De=>{const Ue=new DataView(new ArrayBuffer(4));Ue.setUint32(0,De,!0),X.push(Ue),ce+=4},Le=De=>{const Ue=new DataView(new ArrayBuffer(16*De.length));De.forEach((He,pt)=>{Ue.setFloat64(pt*16,He[0],!0),Ue.setFloat64(pt*16+8,He[1],!0)}),X.push(Ue),ce+=16*De.length},Ce=De=>{switch(Se(De.type),De.type){case"Point":Le([De.coordinates]);break;case"LineString":Ne(De.coordinates.length),Le(De.coordinates);break;case"Polygon":Ne(De.coordinates.length);for(const Ue of De.coordinates)Ne(Ue.length),Le(Ue);break;case"GeometryCollection":Ne(De.geometries.length);for(const Ue of De.geometries)Ce(Ue);break;default:{const Ue=De.type.slice(5);Ne(De.coordinates.length);for(const He of De.coordinates)Ce({type:Ue,coordinates:He})}}};Ce(T);const We=new Uint8Array(ce);let Ge=0;for(const De of X)We.set(new Uint8Array(De.buffer),Ge),Ge+=De.byteLength;return We}const $=/^0[01](?:[0-9a-fA-F]{2})+$/,Z=/^[A-Za-z0-9+/_-]+={0,2}$/,ae=(()=>{const N=new Int16Array(128).fill(-1),T="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(let X=0;X<T.length;X++)N[T.charCodeAt(X)]=X;return N[45]=62,N[95]=63,N})();function h(N){const T=new Uint8Array(N.length/2);for(let X=0;X<T.length;X++)T[X]=parseInt(N.slice(X*2,X*2+2),16);return T}function e(N){const T=N.replace(/=+$/,""),X=new Uint8Array(Math.floor(T.length*3/4));let ce=0,Se=0,Ne=0;for(let Le=0;Le<T.length;Le++)Se=Se<<6|ae[T.charCodeAt(Le)],ce+=6,ce>=8&&(ce-=8,X[Ne++]=Se>>ce&255);return X.subarray(0,Ne)}function M(N){const T=N.trim();if(T==="")return null;if(T[0]==="{"){let X;try{X=JSON.parse(T)}catch{return m("the text starts like GeoJSON but is not valid JSON")}return s(X,0)}if($.test(T))return pe(h(T));if(i.test(T))return t(T);if(Z.test(T)){const X=e(T);if(X.length>=5&&(X[0]===0||X[0]===1))return pe(X)}return m("the text is not WKT, GeoJSON, or hex or base64 WKB")}const k=new WeakSet;function z(N){if(ee(N))return{geometry:null,reason:null};if(typeof N=="object"&&k.has(N))return{geometry:N,reason:null};try{let T;return typeof N=="string"?T=M(N):N instanceof Uint8Array?T=pe(N):N instanceof ArrayBuffer?T=pe(new Uint8Array(N)):ArrayBuffer.isView(N)?T=pe(new Uint8Array(N.buffer,N.byteOffset,N.byteLength)):a(N)?T=s(N,0):m(`${Array.isArray(N)?"an array":`a ${typeof N}`} is not a geometry`),T&&A(T),{geometry:T||null,reason:null}}catch(T){if(T instanceof L)return{geometry:null,reason:T.message};throw T}}function A(N){if(k.add(N),N.type==="GeometryCollection")for(const T of N.geometries)A(T)}function ne(N){return z(N).geometry}function te(N,T){switch(N.type){case"Point":T(N.coordinates);break;case"MultiPoint":case"LineString":N.coordinates.forEach(T);break;case"MultiLineString":case"Polygon":for(const X of N.coordinates)X.forEach(T);break;case"MultiPolygon":for(const X of N.coordinates)for(const ce of X)ce.forEach(T);break;default:for(const X of N.geometries)te(X,T)}}function P(N,T){const X=N[1]*ie,ce=T[1]*ie,Se=ce-X,Ne=(T[0]-N[0])*ie,Le=Math.sin(Se/2)**2+Math.cos(X)*Math.cos(ce)*Math.sin(Ne/2)**2;return 2*G*Math.asin(Math.min(1,Math.sqrt(Le)))}function d(N){let T=0;for(let X=1;X<N.length;X++)T+=P(N[X-1],N[X]);return T}function C(N){const T=N.length-1;if(T<3)return 0;let X=0;for(let ce=0;ce<T;ce++){const Se=N[(ce-1+T)%T],Ne=N[(ce+1)%T];X+=(Ne[0]-Se[0])*ie*Math.sin(N[ce][1]*ie)}return Math.abs(X)*G*G/2}function J(N){let T=C(N[0]);for(let X=1;X<N.length;X++)T-=C(N[X]);return Math.max(0,T)}function E(N){let T=0,X=0,ce=0;for(let Se=0;Se<N.length-1;Se++){const[Ne,Le]=N[Se],[Ce,We]=N[Se+1],Ge=Ne*We-Ce*Le;T+=Ge,X+=(Ne+Ce)*Ge,ce+=(Le+We)*Ge}return{a:T,cx:X,cy:ce}}function se(){let N=0,T=0,X=0;return{add(ce,Se,Ne){N+=ce*Ne,T+=Se*Ne,X+=Ne},get(){return X>0?[N/X,T/X]:null}}}function oe(N){let T=0,X=0;for(const ce of N)T+=ce[0],X+=ce[1];return[T/N.length,X/N.length]}function S(N,T){switch(N.type){case"Point":T[0].add(N.coordinates[0],N.coordinates[1],1);break;case"MultiPoint":for(const X of N.coordinates)T[0].add(X[0],X[1],1);break;case"LineString":case"MultiLineString":{const X=N.type==="LineString"?[N.coordinates]:N.coordinates;for(const ce of X){for(let Se=1;Se<ce.length;Se++){const[Ne,Le]=ce[Se-1],[Ce,We]=ce[Se],Ge=Math.hypot(Ce-Ne,We-Le);T[1].add((Ne+Ce)/2,(Le+We)/2,Ge)}for(const Se of ce)T[0].add(Se[0],Se[1],1)}break}case"Polygon":case"MultiPolygon":{const X=N.type==="Polygon"?[N.coordinates]:N.coordinates;for(const ce of X){let Se=0,Ne=0,Le=0;ce.forEach((We,Ge)=>{const De=E(We),Ue=(Ge===0?1:-1)*(De.a<0?-1:1);Se+=Ue*De.a,Ne+=Ue*De.cx,Le+=Ue*De.cy}),Math.abs(Se)>v&&T[2].add(Ne/(3*Se),Le/(3*Se),Math.abs(Se)/2);const Ce=ce[0].slice(0,-1);for(const We of Ce)T[0].add(We[0],We[1],1)}break}default:for(const X of N.geometries)S(X,T)}}const O=new WeakMap;function V(N){const T=ne(N);if(!T)return null;const X=O.get(T);if(X)return X;const ce=[1/0,1/0,-1/0,-1/0];te(T,De=>{De[0]<ce[0]&&(ce[0]=De[0]),De[1]<ce[1]&&(ce[1]=De[1]),De[0]>ce[2]&&(ce[2]=De[0]),De[1]>ce[3]&&(ce[3]=De[1])});const Se=[se(),se(),se()];S(T,Se);const Ne=Se[2].get()||Se[1].get()||Se[0].get()||oe([[ce[0],ce[1]],[ce[2],ce[3]]]);let Le=0,Ce=0;const We=De=>{switch(De.type){case"LineString":Le+=d(De.coordinates);break;case"MultiLineString":for(const Ue of De.coordinates)Le+=d(Ue);break;case"Polygon":Ce+=J(De.coordinates);for(const Ue of De.coordinates)Le+=d(Ue);break;case"MultiPolygon":for(const Ue of De.coordinates){Ce+=J(Ue);for(const He of Ue)Le+=d(He)}break;case"GeometryCollection":for(const Ue of De.geometries)We(Ue);break;default:break}};We(T);const Ge=Object.freeze({kind:T.type,bbox:Object.freeze(ce),centroid:Object.freeze(Ne),length:Le,area:Ce});return O.set(T,Ge),Ge}function r(N){const T=V(N);return T?T.kind:null}function _(N,T){const X=typeof N=="string"?N.split(/[\s,;]+/).filter(Boolean):N;if(!Array.isArray(X)||X.length!==T)return null;const ce=X.map(Se=>typeof Se=="number"?Se:typeof Se=="string"?Number(Se):NaN);return ce.every(Number.isFinite)?ce:null}function o(N,T){if(N==="withinBbox"){const X=_(T,4);return X?X[0]>X[2]?{reason:'the box crosses the antimeridian (its west edge is east of its east edge), which is not supported; split it into two withinBbox conditions joined by "or"'}:X[1]>X[3]?{reason:"the box's minLat is above its maxLat"}:{operand:X}:{reason:"withinBbox needs [minLon, minLat, maxLon, maxLat]"}}if(N==="withinDistance"){let X=null;if(a(T)&&!Array.isArray(T)){const ce=T;X=_([ce.lon,ce.lat,ce.metres],3)}else X=_(T,3);return!X||X[2]<0?{reason:"withinDistance needs { lon, lat, metres } with metres of 0 or more"}:{operand:{lon:X[0],lat:X[1],metres:X[2]}}}if(N==="withinPolygon"||N==="intersects"){const X=N==="intersects"?_(T,4):null;if(X){if(X[0]>X[2]||X[1]>X[3])return{reason:"the box's minimum is above its maximum"};const[Ne,Le,Ce,We]=X;return{operand:{type:"Polygon",coordinates:[[[Ne,Le],[Ce,Le],[Ce,We],[Ne,We],[Ne,Le]]]}}}const{geometry:ce,reason:Se}=z(T);return ce?N==="withinPolygon"&&ce.type!=="Polygon"&&ce.type!=="MultiPolygon"?{reason:`withinPolygon needs a Polygon or MultiPolygon, not a ${ce.type}`}:{operand:ce}:{reason:`${N} needs a geometry: ${Se||"none was given"}`}}return{reason:`"${N}" is not a spatial operator`}}function g(N,T){const[X,ce]=N;let Se=!1;for(let Ne=0,Le=T.length-2;Ne<T.length-1;Le=Ne++){const[Ce,We]=T[Ne],[Ge,De]=T[Le];We>ce!=De>ce&&X<(Ge-Ce)*(ce-We)/(De-We)+Ce&&(Se=!Se)}return Se}function f(N,T){if(!g(N,T[0]))return!1;for(let X=1;X<T.length;X++)if(g(N,T[X]))return!1;return!0}function R(N,T={points:[],segments:[],polygons:[]}){const X=ce=>{for(let Se=1;Se<ce.length;Se++)T.segments.push([ce[Se-1],ce[Se]]);for(const Se of ce)T.points.push(Se)};switch(N.type){case"Point":T.points.push(N.coordinates);break;case"MultiPoint":for(const ce of N.coordinates)T.points.push(ce);break;case"LineString":X(N.coordinates);break;case"MultiLineString":N.coordinates.forEach(X);break;case"Polygon":T.polygons.push(N.coordinates),N.coordinates.forEach(X);break;case"MultiPolygon":for(const ce of N.coordinates)T.polygons.push(ce),ce.forEach(X);break;default:for(const ce of N.geometries)R(ce,T)}return T}function W(N,T,X){const ce=(T[0]-N[0])*(X[1]-N[1])-(T[1]-N[1])*(X[0]-N[0]);return Math.abs(ce)<=v?0:Math.sign(ce)}function Y(N,T,X){return N[0]>=Math.min(T[0],X[0])-v&&N[0]<=Math.max(T[0],X[0])+v&&N[1]>=Math.min(T[1],X[1])-v&&N[1]<=Math.max(T[1],X[1])+v}function I(N,T){const[X,ce]=N,[Se,Ne]=T,Le=W(X,ce,Se),Ce=W(X,ce,Ne),We=W(Se,Ne,X),Ge=W(Se,Ne,ce);return Le!==Ce&&We!==Ge?!0:Le===0&&Y(Se,X,ce)||Ce===0&&Y(Ne,X,ce)||We===0&&Y(X,Se,Ne)||Ge===0&&Y(ce,Se,Ne)}function fe(N,T){return N[0]<=T[2]&&T[0]<=N[2]&&N[1]<=T[3]&&T[1]<=N[3]}function ve(N,T){const X=V(N),ce=V(T);if(!fe(X.bbox,ce.bbox))return!1;const Se=R(N),Ne=R(T);for(const Le of Ne.polygons)for(const Ce of Se.points)if(f(Ce,Le))return!0;for(const Le of Se.polygons)for(const Ce of Ne.points)if(f(Ce,Le))return!0;for(const Le of Se.segments)for(const Ce of Ne.segments)if(I(Le,Ce))return!0;for(const Le of Se.points){for(const Ce of Ne.points)if(Math.abs(Le[0]-Ce[0])<=v&&Math.abs(Le[1]-Ce[1])<=v)return!0;for(const Ce of Ne.segments)if(W(Ce[0],Ce[1],Le)===0&&Y(Le,Ce[0],Ce[1]))return!0}for(const Le of Ne.points)for(const Ce of Se.segments)if(W(Ce[0],Ce[1],Le)===0&&Y(Le,Ce[0],Ce[1]))return!0;return!1}function $e(N,T){const{operand:X,reason:ce}=o(N,T);if(ce)return ye(`filter:geometry:${N}`,`a "${N}" condition was refused: ${ce}. It matches no row rather than guessing.`),()=>!1;switch(N){case"withinBbox":return Se=>{const Ne=V(Se);if(!Ne)return!1;const Le=Ne.bbox;return Le[0]>=X[0]&&Le[1]>=X[1]&&Le[2]<=X[2]&&Le[3]<=X[3]};case"withinPolygon":{const Se=X.type==="Polygon"?[X.coordinates]:X.coordinates,Ne=Le=>Se.some(Ce=>f(Le,Ce));return Le=>{const Ce=ne(Le);return Ce?Ce.type==="Point"?Ne(Ce.coordinates):Ce.type==="MultiPoint"?Ce.coordinates.every(Ne):Ne(V(Ce).centroid):!1}}case"intersects":return Se=>{const Ne=ne(Se);return!!Ne&&ve(Ne,X)};default:{const Se=[X.lon,X.lat];return Ne=>{const Le=V(Ne);return!!Le&&P(Le.centroid,Se)<=X.metres}}}}}),Xe("packages/core/src/source/filterwire.js",function(n,ge){"use strict";Object.defineProperty(n,"HOST_FILTER_WARN_ID",{enumerable:!0,get:function(){return a}}),Object.defineProperty(n,"WHERE_PAGE_RELATIVE_WARN_ID",{enumerable:!0,get:function(){return ye}}),Object.defineProperty(n,"warnWherePageRelative",{enumerable:!0,get:function(){return le}}),Object.defineProperty(n,"warnHostFilterNotApplied",{enumerable:!0,get:function(){return be}}),Object.defineProperty(n,"WHERE_NOT_APPLIED_WARN_ID",{enumerable:!0,get:function(){return F}}),Object.defineProperty(n,"warnWhereNotApplied",{enumerable:!0,get:function(){return G}}),Object.defineProperty(n,"WHERE_OVER_THRESHOLD_WARN_ID",{enumerable:!0,get:function(){return ie}}),Object.defineProperty(n,"warnWhereOverThreshold",{enumerable:!0,get:function(){return U}}),Object.defineProperty(n,"RELATIVE_TOKENS",{enumerable:!0,get:function(){return s}}),Object.defineProperty(n,"parseRelativeToken",{enumerable:!0,get:function(){return c}}),Object.defineProperty(n,"resolveRelativeRange",{enumerable:!0,get:function(){return b}}),Object.defineProperty(n,"relativeTokenOf",{enumerable:!0,get:function(){return y}}),Object.defineProperty(n,"relativeTokenHelp",{enumerable:!0,get:function(){return i}}),Object.defineProperty(n,"isResolvableRelative",{enumerable:!0,get:function(){return x}}),Object.defineProperty(n,"resolveRelativeCondition",{enumerable:!0,get:function(){return t}}),Object.defineProperty(n,"isGroup",{enumerable:!0,get:function(){return w}}),Object.defineProperty(n,"forEachCondition",{enumerable:!0,get:function(){return B}}),Object.defineProperty(n,"mapConditions",{enumerable:!0,get:function(){return K}}),Object.defineProperty(n,"normaliseFilterSet",{enumerable:!0,get:function(){return q}}),Object.defineProperty(n,"buildFilterSet",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(n,"wireFilters",{enumerable:!0,get:function(){return re}}),Object.defineProperty(n,"querySignature",{enumerable:!0,get:function(){return pe}});const ee=ge("packages/core/src/internal/util.js").warnOnce,a="source.remote.hostFilter",ye="source.where.pageRelative";function le(Z,ae){!Array.isArray(Z)||!Z.length||ee(ye,`filters.where (${Z.join(", ")}) runs over the rows the ${ae} 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 be(Z){const ae=(Z||{}).config;!ae||!ae.hostFilter||ee(a,"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 F="source.where.notApplied";function G(Z,ae){ee(`${F}:${Z}`,`filters.where("${Z}") is registered but the ${ae} 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 ie="source.where.overThreshold";function U(Z,ae,h,e){!Array.isArray(Z)||!Z.length||ee(`${ie}:${ae}`,`filters.where (${Z.join(", ")}) is not applied to the ${ae} pushdown source:`,h===null?"the adapter reports no row total, so the size of the matching set is unknown.":`its matching set is ${h.toLocaleString()} rows, at or past the whereRowLimit of ${e.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 v=new Map;function L(Z){let ae=v.get(Z);return ae||(ae=new Intl.DateTimeFormat("en-US",{timeZone:Z,hourCycle:"h23",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}),v.set(Z,ae)),ae}function m(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone||"UTC"}catch{return"UTC"}}function D(Z,ae){const h=L(ae).formatToParts(new Date(Z)),e={y:1970,m:1,d:1,h:0,mi:0,s:0};for(const M of h)M.type==="year"?e.y=+M.value:M.type==="month"?e.m=+M.value:M.type==="day"?e.d=+M.value:M.type==="hour"?e.h=+M.value%24:M.type==="minute"?e.mi=+M.value:M.type==="second"&&(e.s=+M.value);return e}function j(Z,ae){const h=D(Z,ae);return Date.UTC(h.y,h.m-1,h.d,h.h,h.mi,h.s)-Math.floor(Z/1e3)*1e3}function u(Z,ae,h,e){const M=Date.UTC(Z,ae-1,h),k=M-j(M,e);return M-j(k,e)}function l(Z,ae,h){const e=new Date(Date.UTC(Z.y,Z.m-1,Z.d+ae));return u(e.getUTCFullYear(),e.getUTCMonth()+1,e.getUTCDate(),h)}const s=Object.freeze(["today","yesterday","lastNDays","thisWeek","thisMonth","thisQuarter","thisYear","quarterToDate","yearToDate"]);function c(Z,ae){if(typeof Z!="string")return null;const h=Z.trim().toLowerCase().replace(/[\s_-]+/g,""),e=/^last(\d*|n)days?$/.exec(h);if(e){const M=e[1]==="n"?"":e[1],k=Number(M||ae);return!Number.isFinite(k)||k<=0?null:{kind:"lastNDays",n:Math.floor(k)}}switch(h){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 b(Z,ae={}){const h=c(Z,ae.n);if(!h)return null;const e=ae.tz||m(),M=ae.now instanceof Date?ae.now.getTime():typeof ae.now=="number"?ae.now:Date.now(),k=D(M,e),z=u(k.y,k.m,k.d,e),A=l(k,1,e);let ne=z,te=A;switch(h.kind){case"today":break;case"yesterday":ne=l(k,-1,e),te=z;break;case"lastNDays":te=ae.includeToday?A:z,ne=l(k,ae.includeToday?-(h.n-1):-h.n,e);break;case"thisWeek":{const P=Number.isFinite(ae.weekStartsOn)?Number(ae.weekStartsOn):1,C=(new Date(Date.UTC(k.y,k.m-1,k.d)).getUTCDay()-P+7)%7;ne=l(k,-C,e),te=l(k,-C+7,e);break}case"thisMonth":ne=u(k.y,k.m,1,e),te=u(k.m===12?k.y+1:k.y,k.m===12?1:k.m+1,1,e);break;case"thisQuarter":case"quarterToDate":{const P=Math.floor((k.m-1)/3)*3+1;ne=u(k.y,P,1,e),te=h.kind==="quarterToDate"?A:P===10?u(k.y+1,1,1,e):u(k.y,P+3,1,e);break}case"thisYear":case"yearToDate":ne=u(k.y,1,1,e),te=h.kind==="yearToDate"?A:u(k.y+1,1,1,e);break;default:return null}return{from:new Date(ne).toISOString(),to:new Date(te).toISOString(),bounds:"[)",tz:e,relative:h.kind==="lastNDays"?`last${h.n}Days`:h.kind,n:h.n}}function y(Z){if(!Z||typeof Z!="object")return null;const ae=Z.value;if(ae&&typeof ae=="object"&&!Array.isArray(ae)&&"relative"in ae)return{token:String(ae.relative),n:typeof ae.n=="number"?ae.n:void 0};if(Z.op==="relative"&&typeof Z.value=="string")return{token:Z.value,n:void 0};const h=Z.meta;return h&&typeof h.relative=="string"&&Z.value===void 0?{token:h.relative,n:typeof h.n=="number"?h.n:void 0}:null}function i(){return`Known tokens: ${s.filter(ae=>ae!=="lastNDays").join(", ")}. "lastNDays" needs a count: pass "last7Days", or the value object { relative: 'lastNDays', n: 7 }.`}function x(Z){const ae=y(Z);return ae?c(ae.token,ae.n)!==null:!1}function t(Z,ae={}){const h=y(Z);if(!h)return Z;const e=b(h.token,{...ae,n:h.n});return e?{...Z,type:Z.type||"date",op:"between",value:[e.from,e.to],bounds:Z.bounds||e.bounds,meta:{...Z.meta||{},relative:e.relative,tz:e.tz}}:(ee(`source.relative.${h.token}`,`unknown relative date token "${h.token}"; sending the condition unresolved.`,i()),Z)}function w(Z){return!!Z&&typeof Z=="object"&&Array.isArray(Z.conditions)}function B(Z,ae){if(Z){if(w(Z)){for(const h of Z.conditions)B(h,ae);return}ae(Z)}}function K(Z,ae){if(!Z)return null;if(!w(Z))return ae(Z);const h=Z;let e=!1;const M=[];for(const k of h.conditions){const z=K(k,ae);z!==k&&(e=!0),z&&M.push(z)}return!e&&M.length===h.conditions.length?Z:M.length?{...h,conditions:M}:null}function H(Z){if(!Z)return null;if(!w(Z))return Z;const ae=Z,h=[];for(const e of ae.conditions){const M=H(e);M&&h.push(M)}return h.length?{op:ae.op,conditions:h}:null}function q(Z){const ae=H(Z);return ae?w(ae)&&ae.op==="and"?ae:{op:"and",conditions:[ae]}:null}function Q(Z){const ae=(Z||[]).filter(Boolean);return ae.length?{op:"and",conditions:ae}:null}function re(Z,ae={}){const h=K(Z,e=>t(e,ae));return q(h)}function pe(Z){const ae=he(Z.filters??null);return JSON.stringify([ae,Z.sort??null,Z.quick??"",Z.groupBy??null,Z.pivotBy??null,$(Z.context)])}function he(Z){if(!Z)return null;if(w(Z)){const e=Z;return{op:e.op,conditions:e.conditions.map(he)}}const ae=Z,h=ae.meta&&typeof ae.meta.relative=="string"?ae.meta.relative:y(ae)?.token;return{col:ae.col,op:ae.op,bounds:ae.bounds??null,caseSensitive:ae.caseSensitive??!1,value:h?`rel:${h}`:ae.value??null}}function $(Z){if(Z==null)return null;try{return JSON.parse(JSON.stringify(Z))}catch{return ee("source.context.unserialisable","config.context is not JSON-serialisable; cache keys ignore it."),"[unserialisable]"}}}),Xe("packages/core/src/source/aggregates.js",function(n,ge){"use strict";Object.defineProperty(n,"STAT_PUSHDOWN",{enumerable:!0,get:function(){return ke}}),Object.defineProperty(n,"pushableAggregates",{enumerable:!0,get:function(){return ee}}),Object.defineProperty(n,"fillAggregateSql",{enumerable:!0,get:function(){return a}}),Object.defineProperty(n,"resolveAggregatesConfig",{enumerable:!0,get:function(){return ye}}),Object.defineProperty(n,"routeAggregate",{enumerable:!0,get:function(){return le}}),Object.defineProperty(n,"resolveAggregatePlan",{enumerable:!0,get:function(){return be}}),Object.defineProperty(n,"groupKeysPushable",{enumerable:!0,get:function(){return G}}),Object.defineProperty(n,"pushdownDocRows",{enumerable:!0,get:function(){return ie}});const ke=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 ee(){const U=new Set;for(const[v,L]of Object.entries(ke))L.pushable&&U.add(v);return U}function a(U,v,L){let m=U.split("%c").join(v);return L!==void 0&&(m=m.split("%w").join(L)),m}function ye(U){const v=U||{},L=v.default==="engine"||v.default==="engine-if-identical"?v.default:"client",m={};if(v.overrides&&typeof v.overrides=="object")for(const[D,j]of Object.entries(v.overrides))(j==="engine"||j==="client")&&(m[D]=j);return{default:L,overrides:m}}function le(U,v){const L=ke[U];if(!L||!L.pushable)return"client";const m=v.overrides[U];return m==="engine"||m==="client"?m:v.default==="client"?"client":v.default==="engine-if-identical"?L.class==="identical"?"engine":"client":"engine"}function be(U,v){const L=ye(v),m=[],D=[];for(const j of U||[]){const u=ke[j.fn],l=le(j.fn,L),s={id:j.id,col:j.col,fn:j.fn,class:u?u.class:"fallback"};j.weight!==void 0&&(s.weight=j.weight),j.params!==void 0&&(s.params=j.params),l==="engine"?m.push(s):(s.reason=u&&!u.pushable?u.note||"the engine cannot express this stat":"client by config",D.push(s))}return{engine:m,client:D,config:L}}const F=/^[A-Za-z_][A-Za-z0-9_$]*$/;function G(U,v=[]){return(U||[]).every(m=>{if(typeof m=="string")return F.test(m);if(!m||typeof m!="object")return!1;const D=m;return Array.isArray(v)&&v.includes(D.bucket)&&typeof D.col=="string"&&F.test(D.col)&&typeof D.size=="number"&&Number.isFinite(D.size)&&D.size>0})}function ie(){return Object.entries(ke).map(([U,v])=>({stat:U,class:v.class,sql:v.sql?a(v.sql,"col",v.twoColumn?"weight":void 0):"",note:v.note||(v.class==="identical"?"Pushes to DuckDB with the same result.":"")}))}}),Xe("packages/core/src/source/abort.js",function(n,ge){"use strict";Object.defineProperty(n,"SupersededError",{enumerable:!0,get:function(){return ke}}),Object.defineProperty(n,"RequestToken",{enumerable:!0,get:function(){return ee}}),Object.defineProperty(n,"AbortScope",{enumerable:!0,get:function(){return a}}),Object.defineProperty(n,"createAbortScope",{enumerable:!0,get:function(){return ye}}),Object.defineProperty(n,"isAbortError",{enumerable:!0,get:function(){return le}});class ke extends Error{constructor(F,G="superseded"){super(`[lattice] request ${F?`"${F}" `:""}${G}`),this.name="SupersededError",this.superseded=!0,this.key=F}}class ee{#e;constructor(F,G,ie,U){this.#e=F,this.key=G,this.controller=ie,this.signal=ie.signal,this.seq=U}get current(){return!this.signal.aborted&&this.#e.tokenFor(this.key)===this}settle(){this.#e.settle(this)}abort(F){this.signal.aborted||this.controller.abort(new ke(this.key,F)),this.#e.settle(this)}}class a{#e=new Map;#t=0;begin(F="",G="superseded"){const ie=this.#e.get(F);ie&&!ie.signal.aborted&&ie.controller.abort(new ke(F,G));const U=new ee(this,F,new AbortController,++this.#t);return this.#e.set(F,U),U}tokenFor(F){return this.#e.get(F)}pending(F=""){const G=this.#e.get(F);return!!G&&!G.signal.aborted}get size(){return this.#e.size}settle(F){this.#e.get(F.key)===F&&this.#e.delete(F.key)}abort(F="",G="superseded"){const ie=this.#e.get(F);ie&&ie.abort(G)}abortAll(F="superseded"){for(const G of[...this.#e.values()])G.abort(F);this.#e.clear()}}function ye(){return new a}function le(be){if(!be||typeof be!="object")return!1;const F=be;return F.superseded===!0||F.name==="AbortError"||F.name==="SupersededError"}}),Xe("packages/core/src/source/pushdown.js",function(n,ge){"use strict";Object.defineProperty(n,"FOREGROUND_WAIT_MS",{enumerable:!0,get:function(){return u}}),Object.defineProperty(n,"NO_CAPABILITIES",{enumerable:!0,get:function(){return s}}),Object.defineProperty(n,"resolveMutate",{enumerable:!0,get:function(){return c}}),Object.defineProperty(n,"capabilitiesOf",{enumerable:!0,get:function(){return i}}),Object.defineProperty(n,"splitFilters",{enumerable:!0,get:function(){return t}}),Object.defineProperty(n,"LEAF_COUNT_ID",{enumerable:!0,get:function(){return w}}),Object.defineProperty(n,"PIVOT_UNSUPPORTED",{enumerable:!0,get:function(){return q}}),Object.defineProperty(n,"GROUP_UNSUPPORTED",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(n,"UNGROUPED_LEVEL",{enumerable:!0,get:function(){return re}}),Object.defineProperty(n,"planQuery",{enumerable:!0,get:function(){return he}}),Object.defineProperty(n,"applyResidual",{enumerable:!0,get:function(){return ae}}),Object.defineProperty(n,"DEFAULT_WHERE_ROW_LIMIT",{enumerable:!0,get:function(){return k}}),Object.defineProperty(n,"createPushdownSource",{enumerable:!0,get:function(){return te}});const ke=ge("packages/core/src/internal/util.js"),ee=ke.defaultCompare,a=ke.isFunction,ye=ke.toArray,le=ke.warnOnce,be=ge("packages/core/src/source/filterwire.js"),F=be.isGroup,G=be.warnWherePageRelative,ie=be.warnWhereOverThreshold,U=ge("packages/core/src/source/aggregates.js"),v=U.resolveAggregatePlan,L=U.groupKeysPushable,m=U.STAT_PUSHDOWN,j=ge("packages/core/src/source/abort.js").SupersededError,u=1e3;function l(P){const d=P&&P.signal;if(!d||!d.aborted)return;const C=d.reason;throw C instanceof Error?C:new j("","superseded before it was sent")}const s=Object.freeze({filter:!1,operators:Object.freeze([]),sort:!1,quick:!1,range:!1,total:!1,group:!1,pivot:!1,mutate:!1});function c(P){if(!P||typeof P!="object")return!1;const d=P.returning==="row"||P.returning==="key"?P.returning:"none";return{append:P.append===!0,update:P.update===!0,delete:P.delete===!0,returning:d}}function b(P,d){if(!P||typeof d!="string")return;if(!d.includes("."))return P[d];let C=P;for(const J of d.split(".")){if(C===null||typeof C!="object")return;C=C[J]}return C}function y(P){if(P===!0)return!0;if(!P||typeof P!="object")return!1;const d=P;return d.enabled===!1?!1:d.enabled===!0||a(d.commit)}function i(P){const d={...s,...P||{}};return d.operators=new Set(d.operators||[]),d.mutate=c(d.mutate),d}function x(P,d){return!P||!P.op||!d.operators.size?!1:d.operators.has(P.op)}function t(P,d){if(!P)return{pushed:null,residual:null};if(!d.filter)return{pushed:null,residual:P};if(d.filter==="term"){if(F(P)){const se=P.conditions||[];if(String(P.op)!=="and")return{pushed:null,residual:P};const oe=se.findIndex(O=>!F(O)&&x(O,d));if(oe<0)return{pushed:null,residual:P};const S=se.filter((O,V)=>V!==oe);return{pushed:se[oe],residual:S.length?{op:"and",conditions:S}:null}}return x(P,d)?{pushed:P,residual:null}:{pushed:null,residual:P}}if(!F(P))return x(P,d)?{pushed:P,residual:null}:{pushed:null,residual:P};if(String(P.op)!=="and")return(P.conditions||[]).every(oe=>F(oe)?t(oe,d).residual===null:x(oe,d))?{pushed:P,residual:null}:{pushed:null,residual:P};const C=[],J=[];for(const se of P.conditions||[]){if(F(se)){if(d.filter==="flat"){J.push(se);continue}const oe=t(se,d);oe.pushed&&C.push(oe.pushed),oe.residual&&J.push(oe.residual);continue}(x(se,d)?C:J).push(se)}const E=se=>se.length===0?null:se.length===1?se[0]:{op:"and",conditions:se};return{pushed:E(C),residual:E(J)}}const w="__lattice_leaves";function B(P){return P.aggregates?P.aggregates instanceof Set?P.aggregates:new Set(ye(P.aggregates)):new Set}function K(P){const d=B(P);return d.size?d.has("count")?P.filter!=="tree"||!P.operators||!P.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 H(P,d,C,J,E,se,oe){const S=Array.isArray(P.groupBy)?P.groupBy:[],O=Array.isArray(P.groupPath)?P.groupPath:[],V=Array.isArray(P.groupValues)?P.groupValues:null;if(!d.group){const r=K(d);if(r)return r}return L(S)?C.residual?"the filter did not fully push, so the engine would group a superset of the matching rows":J?E?se?"a host `where` predicate can only run in the browser, over rows the engine grouped":oe?"fullDataset holds the whole matching set, so the grid groups it itself":!V||V.length!==O.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 q="pushdown:pivot-unsupported",Q="pushdown:group-unsupported",re=Symbol("lattice.remote.ungroupedLevel");function pe(P,d,C,J,E,se){const oe=Array.isArray(P.pivotBy)?P.pivotBy:[],S=Array.isArray(P.groupBy)?P.groupBy:[],O=Array.isArray(P.groupPath)?P.groupPath:[],V=Array.isArray(P.groupValues)?P.groupValues:null;return d.pivot?L(oe)?S.length&&!L(S)?"a grouping key is not a plain column the engine can name in a GROUP BY":C.residual?"the filter did not fully push, so the engine would pivot a superset of the matching rows":J?E?se?"a host `where` predicate can only run in the browser, over rows the engine pivoted":!V||V.length!==O.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 he(P,d,C=!1){const J=t(P.filters||null,d),E=[];J.residual&&E.push("filter");const se=P.sort||[],oe=se.length===0||d.sort==="multi"&&se.length>=1||d.sort==="single"&&se.length===1;!oe&&se.length&&E.push("sort");const S=P.quick?String(P.quick):"",O=!S||!!d.quick;O||E.push("quick");const V=P.where&&P.where.active?P.where:null;V&&E.push("where");const r={filters:J.residual,sort:oe?null:se,quick:O?"":S,where:V},_=!!C,o=Array.isArray(P.groupBy)&&P.groupBy.length>0,g=o?H(P,d,J,oe,O,V,_):"",f=P.pivotMode!==!1&&Array.isArray(P.pivotBy)&&P.pivotBy.length>0,R=f?pe(P,d,J,oe,O,V):"",W=f&&R==="";f&&!W&&E.push("pivot");const Y=f?W&&o:o&&g==="";o&&!f&&!Y&&E.push("group");const I=(Y||W)&&Array.isArray(P.groupValues)?P.groupValues.length:0,fe=Y||f?!1:_||!!(r.filters||r.sort||r.quick||r.where)||!d.range;return{pushed:{...P,filters:J.pushed,sort:oe?se:[],quick:O?S:"",range:fe?null:P.range},residual:r,needsAll:fe,unpushed:E,full:_,grouped:Y,groupLevel:I,groupReason:f?"":g,pivoted:W,pivotReason:R}}function $(P){const d=Array.isArray(P.totals)?P.totals:[],C=P.totalFns&&typeof P.totalFns=="object"?P.totalFns:{},J=[],E=[];for(const se of d){const oe=String(se),S=typeof C[oe]=="string"?C[oe]:null,O=S?m[S]:null;S?!O||!O.pushable||!O.sql?E.push({id:oe,fn:S,class:O?O.class:"fallback",reason:O&&O.note?O.note:`the pushdown map cannot express "${S}"`}):O.twoColumn?E.push({id:oe,fn:S,class:O.class,reason:`"${S}" reduces two columns, and a grouped request carries no weight column`}):J.push({id:oe,col:oe,fn:S,class:O.class}):E.push({id:oe,fn:null,class:"fallback",reason:"the column totals with a host function, so there is no named statistic to push"})}return{engine:J,client:E}}const Z=Object.freeze({items:P=>P==null?[]:Array.isArray(P)?P:[P]});function ae(P,d,C){if(!d)return P;let J=P;if(d.filters&&a(C.evaluateFilters)){const E=J,se={count:J.length,handle:O=>({id:O,get:V=>b(E[V],O)}),itemwise:O=>E.some(V=>Array.isArray(b(V,O)))?Z:null},oe=C.evaluateFilters(d.filters,se),S=[];for(let O=0;O<J.length;O++)oe[O]&&S.push(J[O]);J=S}if(d.where&&d.where.active&&(d.whole||G(d.where.names,"pushdown"),J=J.filter(E=>d.where.passes(E))),d.quick){const E=d.quick.toLowerCase();J=J.filter(se=>{if(!se||typeof se!="object")return!1;for(const oe of Object.values(se))if(oe!=null&&String(oe).toLowerCase().includes(E))return!0;return!1})}if(d.sort&&d.sort.length&&a(C.sortMulti)){const E=[...new Set(d.sort.map(O=>O.col))],se=J,oe=E.map(O=>({id:O,get:V=>b(se[V],O)})),S=C.sortMulti(oe,d.sort.map(O=>({col:O.col,dir:O.dir})),Uint32Array.from({length:J.length},(O,V)=>V),{});J=Array.from(S,O=>se[O])}return J}function h(P){return JSON.stringify({filters:P.filters||null,sort:P.sort||[],quick:P.quick||"",groupBy:P.groupBy||[],groupPath:P.groupPath||[],context:P.context??null})}function e(P){if(!P||typeof P!="object")return 16;let d="";try{d=JSON.stringify(P)}catch{return 200}return d.length*2+64}function M(P){const d=P||{};return{enabled:!!d.enabled,maxRows:Number.isFinite(d.maxRows)?d.maxRows:1e6,maxBytesEstimate:Number.isFinite(d.maxBytesEstimate)?d.maxBytesEstimate:512*1024*1024}}const k=5e4;function z(P){return Number.isFinite(P)&&P>=0?P:k}function A(P){return!!P&&a(P.then)}async function ne(P){if(!P||P.total!==void 0||!A(P.pendingTotal))return P;const d=await P.pendingTotal,{pendingTotal:C,...J}=P;return typeof d=="number"?{...J,total:d}:J}function te(P={}){const d=P.adapter;if(!d||!a(d.execute))return le("source.pushdown.adapter","createPushdownSource needs an `adapter` with an `execute(query)` function."),{...P,mode:"remote",fetch:async()=>({rows:[],total:0})};const C=i(d.capabilities),J=d.capabilities&&Object.getOwnPropertyDescriptor(d.capabilities,"operators");J&&a(J.get)&&Object.defineProperty(C,"operators",{enumerable:!0,configurable:!0,get:()=>new Set(d.capabilities.operators||[]),set:()=>{}});const E=d.name||"adapter";let se=null;const oe=()=>a(d.ready)?(se||(se=Promise.resolve(d.ready()).then(()=>{Object.assign(C,i(d.capabilities))},Ee=>{throw se=null,Ee})),se):null,S=M(P.fullDataset),O=!!P.allowPartialResults,V=z(P.whereRowLimit);let r=null;const _=P.aggregates;let o=null,g=null,f=null,R=null,W=null,Y,I=null,fe=0,ve=null;const $e=()=>!S.enabled||!o?null:(ve!==o.key&&(fe++,ve=o.key),{rows:o.rows,version:fe}),N=async Ee=>{const Ie=Ee.where&&Ee.where.active?Ee.where:null;if(!Ie)return{request:Ee,probe:null};const{where:Ye,...Ke}=Ee,Te=he(Ke,C,S.enabled);if(Te.needsAll)return{request:Ee,probe:null};const tt=h(Te.pushed);let et=null;return(!r||r.key!==tt)&&(C.total?(l(Ee),et=await ne(await d.execute(Te.pushed,Ee)),r={key:tt,size:et&&typeof et.total=="number"?et.total:null}):r={key:tt,size:null}),r.size!==null&&r.size<V?{request:Ee,probe:null}:(ie(Ie.names,E,r.size,V),{request:Ke,probe:et})},T=async(Ee,Ie)=>{I=null;const Ye=$(Ee.pushed);f={engine:Ye.engine,client:Ye.client,groupBy:Ee.pushed.groupBy},Ye.client.length&&le(`source.pushdown.group.totals.${E}.${Ye.client.map(tt=>tt.id).join(".")}`,`the ${E} adapter cannot compute the group subtotal for ${Ye.client.map(tt=>`"${tt.id}" (${tt.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 Ke=await d.executeGroupLevel(Ee.pushed,Ye.engine,Ie)||{};let Te=Ke.rows||[];return!C.range&&Ie.range&&(Te=Te.slice(Ie.range.start,Ie.range.end)),Ne(Ke),Ke.total===void 0?{rows:Te}:{rows:Te,total:Ke.total}},X=new Map,ce=64,Se=async(Ee,Ie)=>{I=null;const Ye=Ee.pushed,Ke=Ye.groupBy,Te=Array.isArray(Ye.groupValues)?Ye.groupValues:[],tt=Te.length,et=[...Ye.filters?[Ye.filters]:[],...Ke.slice(0,tt).map((de,Ae)=>({col:de,op:"eq",value:Te[Ae]===void 0?null:Te[Ae],caseSensitive:!0}))],lt=et.length===0?null:et.length===1?et[0]:{op:"and",conditions:et},bt=Ie.range?Ie.range.start:0;if(tt>=Ke.length){const de={...Ye,filters:lt,groupBy:[],groupPath:[],groupValues:[],totals:[],totalFns:{}},Ae=await ne(await d.execute(de,Ie))||{};let Be=Ae.rows||[];return!C.range&&Ie.range&&(Be=Be.slice(Ie.range.start,Ie.range.end)),typeof Ae.total=="number"?{rows:Be,total:Ae.total}:{rows:Be}}const dt=Ke[tt],ut=$(Ye),mt=B(C),Rt=ut.engine.filter(de=>mt.has(de.fn)),Ft=[...ut.engine.filter(de=>!mt.has(de.fn)).map(de=>({id:de.id,fn:de.fn,class:de.class,reason:`the ${E} adapter does not compute "${de.fn}"`})),...ut.client];f={engine:Rt,client:Ft,groupBy:Ke},Ft.length&&le(`source.pushdown.group.totals.${E}.${Ft.map(de=>de.id).join(".")}`,`the ${E} adapter cannot compute the group subtotal for ${Ft.map(de=>`"${de.id}" (${de.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 st=[...Rt.map(de=>({id:de.id,col:de.col,fn:de.fn})),{id:w,col:dt,fn:"count"}],yt={...Ye,filters:lt,range:null},St=JSON.stringify([h(yt),Te,dt,st]);let Pt=bt>0?X.get(St):void 0;if(!Pt){for(Pt=Promise.resolve(d.executeGroupedAggregates(yt,[dt],st)),X.delete(St),X.set(St,Pt);X.size>ce;)X.delete(X.keys().next().value);Pt.catch(()=>{X.get(St)===Pt&&X.delete(St)})}const Gt=await Pt||[];l(Ie);const Wt=de=>{const Ae={};for(const Be of Rt)Ae[Be.id]=de?de[Be.id]:void 0;return Ae},Ut=(Ye.sort||[]).find(de=>de&&de.col===dt),Xt=Ut&&Ut.dir==="desc"?-1:1,Dt=Gt.filter(de=>de&&de.level===1).map(de=>({[dt]:de.keys[0]===void 0?null:de.keys[0],leafCount:Number(de.values&&de.values[w])||0,totals:Wt(de.values)})).sort((de,Ae)=>Xt*ee(de[dt],Ae[dt]));if(tt===0){const de=Gt.find(Be=>Be&&Be.level===0),Ae=de?Number(de.values&&de.values[w]):NaN;Ne({matchCount:Number.isFinite(Ae)?Ae:Dt.reduce((Be,Re)=>Be+Re.leafCount,0),...de?{grand:Wt(de.values)}:{}})}const Vt=Ie.range?Ie.range.end:Dt.length;return{rows:Dt.slice(bt,Vt),total:Dt.length}},Ne=Ee=>{typeof Ee.matchCount=="number"&&(R=Ee.matchCount,W=Ee.grand?{totals:Ee.grand,leafCount:Ee.matchCount}:null,Y===void 0&&a(d.unfilteredCount)&&(Y=null,Promise.resolve(d.unfilteredCount()).then(Ie=>{Y=typeof Ie=="number"?Ie:null}).catch(Ie=>{le(`source.pushdown.group.unfiltered.${E}`,`the ${E} adapter could not count the unfiltered set (${Ie&&Ie.message?Ie.message:Ie}), so "N of M" falls back to the display count for its denominator.`)})))},Le=async(Ee,Ie)=>{I=null;const Ye=$(Ee.pushed);f={engine:Ye.engine,client:Ye.client,groupBy:Ee.pushed.groupBy,pivotBy:Ee.pushed.pivotBy},Ye.client.length&&le(`source.pushdown.pivot.totals.${E}.${Ye.client.map(lt=>lt.id).join(".")}`,`the ${E} adapter cannot compute the pivot cells for ${Ye.client.map(lt=>`"${lt.id}" (${lt.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 Ke=await d.executePivotLevel(Ee.pushed,Ye.engine,Ie)||{};let Te=Ke.rows||[];!C.range&&Ie.range&&(Te=Te.slice(Ie.range.start,Ie.range.end)),Ne(Ke);const tt=Ke.pivot&&typeof Ke.pivot=="object"?Ke.pivot:{},et={cells:Array.isArray(tt.cells)?tt.cells:[],...Array.isArray(tt.axis)?{axis:tt.axis}:{}};return Ke.total===void 0?{rows:Te,pivot:et}:{rows:Te,total:Ke.total,pivot:et}},Ce=Ee=>{le(`source.pushdown.pivot.${E}.${Ee}`,`pushdown:pivot-unsupported: the ${E} adapter cannot pivot this query because ${Ee}, so no rows are fetched rather than every leaf row being pulled into the browser to pivot there. \`lastPlan().pivotReason\` says the same.`);const Ie=new Error(`[lattice] ${q}: the ${E} adapter cannot pivot this query because ${Ee}, so no rows are fetched rather than every leaf row being pulled into the browser to pivot there. \`lastPlan().pivotReason\` says the same.`);throw Ie.code=q,Ie.reason=Ee,Ie},We=(Ee,Ie)=>{const Ye={key:Ie,state:"pending",value:null};return I=Ye,Ee.then(Ke=>(I===Ye&&(I={key:Ie,state:"settled",value:typeof Ke=="number"?Ke:null}),Ke),Ke=>{throw I===Ye&&(I={key:Ie,state:"failed",value:null}),Ke})};let Ge=0,De=[];const Ue=()=>Ge===0?null:new Promise(Ee=>{const Ie=setTimeout(Ee,u);De.push(()=>{clearTimeout(Ie),Ee()})}),He=async Ee=>{const Ie=oe();Ie&&await Ie;const Ke=Ee&&Ee.pivotMode!==!1&&Array.isArray(Ee.pivotBy)&&Ee.pivotBy.length>0?{request:Ee,probe:null}:await N(Ee);l(Ee);let Te=he(Ke.request,C,S.enabled);if(C.group&&Te.grouped&&!Te.pivoted&&!a(d.executeGroupLevel)&&(le(`source.pushdown.group.method.${E}`,`the ${E} 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=he(Ke.request,{...C,group:!1,aggregates:null},S.enabled)),Te.pivoted&&!a(d.executePivotLevel)&&(Te=he(Ke.request,{...C,pivot:!1},S.enabled),Te.pivotReason="the adapter declares the `pivot` capability but has no `executePivotLevel(query, aggregates, request)`"),Te.grouped&&!Te.pivoted&&!C.group&&!a(d.executeGroupedAggregates)&&(le(`source.pushdown.group.aggregates.method.${E}`,`the ${E} 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=he(Ke.request,{...C,aggregates:null},S.enabled)),g=Te,Te.pivoted)return Le(Te,Ee);if(Te.pivotReason&&Ce(Te.pivotReason),Te.grouped)return C.group?T(Te,Ee):Se(Te,Ee);const et=!!Te.groupReason&&!Te.full;et?le(`source.pushdown.group-unsupported.${E}.${Te.groupReason}`,`pushdown:group-unsupported: the ${E} 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&&le(`source.pushdown.group.${E}.${Te.groupReason}`,`the ${E} 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 lt=st=>et?{...st,[re]:!0}:st;if(!Te.needsAll){const st=Ke.probe||await d.execute(Te.pushed,Ee),yt=st.rows||[];return A(st.pendingTotal)&&st.total===void 0?lt({rows:yt,pendingTotal:We(st.pendingTotal,h(Te.pushed))}):(I=null,!C.total&&st.total===void 0?lt({rows:yt}):lt({rows:yt,total:st.total??yt.length}))}Te.unpushed.length&&le(`source.pushdown.residual.${E}.${Te.unpushed.join(".")}`,`the ${E} 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 bt=h(Te.pushed);if(!o||o.key!==bt){const st=await ne(await d.execute(Te.pushed,Ee));I=null;const yt=st.rows||[];if(Te.full){const St=typeof st.total=="number"?Math.max(st.total,yt.length):yt.length;if(St>S.maxRows)throw new Error(`[lattice] fullDataset refused: the ${E} adapter's matching set is ${St.toLocaleString()} rows, past the configured maxRows of ${S.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 Pt=yt.length*e(yt[0]);if(Pt>S.maxBytesEstimate)throw new Error(`[lattice] fullDataset refused: the ${E} adapter's matching set is an estimated ${Math.round(Pt/(1024*1024)).toLocaleString()} MB across ${yt.length.toLocaleString()} rows, past the configured maxBytesEstimate of ${Math.round(S.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 st.total=="number"&&yt.length<st.total){const St=!!(Te.residual.filters||Te.residual.quick||Te.residual.sort&&Te.residual.sort.length);if(St&&!O)throw new Error(`[lattice] the ${E} adapter returned ${yt.length} of ${st.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?le(`source.pushdown.partial.residual.${E}`,`the ${E} adapter returned ${yt.length} of ${st.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.`):le(`source.pushdown.partial.${E}`,`the ${E} adapter returned ${yt.length} of ${st.total} matching rows when asked for the whole result. The adapter must follow the engine's own paging before returning.`)}o={key:bt,rows:yt,total:typeof st.total=="number"?st.total:null}}let dt=Te;if(Te.residual.where){const st=o.total??o.rows.length;if(st>=V){ie(Te.residual.where.names,E,st,V);const{where:yt,...St}=Ke.request;dt=he(St,C,S.enabled),g=dt}}const ut=o.total!==null&&o.rows.length>=o.total,mt=ae(o.rows,{...dt.residual,whole:ut},P.compute||{}),Rt=Ee.range?Ee.range.start:0,Ft=Ee.range?Ee.range.end:mt.length;return lt({rows:mt.slice(Rt,Ft),total:mt.length})},pt=async(Ee,Ie)=>{const Ye=Ue();Ye&&await Ye;const Ke=oe();Ke&&await Ke;const Te=he(Ee,C,S.enabled);g=Te;const tt=v(Ie,_),et=Array.isArray(Ee.groupBy)?Ee.groupBy:[],lt=et.length>0,bt=!Te.residual.filters&&!Te.residual.quick,dt=!lt||L(et,C.buckets);let ut=tt.engine,mt=tt.client;if(C.aggregates&&ut.length){const yt=C.aggregates instanceof Set?C.aggregates:new Set(ye(C.aggregates)),St=ut.filter(Pt=>!yt.has(Pt.fn));St.length&&(ut=ut.filter(Pt=>yt.has(Pt.fn)),mt=[...St.map(Pt=>({...Pt,reason:`the ${E} adapter does not compute "${Pt.fn}"`})),...mt])}const Rt=yt=>{mt=[...ut.map(St=>({...St,reason:yt})),...mt],ut=[]};ut.length&&!bt?Rt(Te.residual.quick&&!Te.residual.filters?"a quick search the adapter cannot push forces all-client (no mixed provenance)":"residual filter forces all-client (no mixed provenance)"):ut.length&&!dt&&Rt("a grouping key the engine cannot form forces all-client (no mixed provenance)");let Ft={},st;return ut.length&&(a(lt?d.executeGroupedAggregates:d.executeAggregates)?lt?st=await d.executeGroupedAggregates(Te.pushed,et,ut)||[]:Ft=await d.executeAggregates(Te.pushed,ut)||{}:(le(`source.pushdown.aggregates.${E}${lt?".grouped":""}`,`the ${E} adapter cannot compute ${lt?"grouped ":""}aggregates, so every requested statistic is computed client-side. Correct, and slower than it needs to be.`),Rt(`adapter cannot compute ${lt?"grouped ":""}aggregates`))),f={engine:ut,client:mt,...lt?{groupBy:et}:{}},{values:Ft,engine:ut,client:mt,...st!==void 0?{groups:st}:{}}},Mt=async Ee=>{Ge++;try{return await He(Ee)}finally{if(Ge--,Ge===0&&De.length){const Ie=De;De=[];for(const Ye of Ie)Ye()}}},Nt=y(P.edit),ft=P.edit&&typeof P.edit=="object"&&a(P.edit.commit);let ct=P.edit;if(Nt&&!ft)if(C.mutate&&C.mutate.update){const Ee=Ie=>{if(!C.mutate||!C.mutate.update)throw new Error(`[lattice] the ${E} 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(Ie.key),patch:{[Ie.colId]:Ie.value}};return d.mutate(Ye,Ie.request||{})};ct={...P.edit===!0?{}:P.edit,commit:Ee}}else le(`source.pushdown.readonly.${E}`,`edit is enabled but the ${E} adapter declares mutate: ${C.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 Ct=Nt&&C.mutate&&(C.mutate.append||C.mutate.delete)?{append:C.mutate.append===!0,remove:C.mutate.delete===!0,returning:C.mutate.returning,mutate:(Ee,Ie)=>d.mutate(Ee,Ie||{})}:null,Ze=async Ee=>{const Ie=oe();Ie&&await Ie;const{range:Ye,signal:Ke,export:Te,...tt}=Ee||{},et={...tt,groupBy:[],groupPath:[],groupValues:[],pivotBy:[],pivotMode:!1,totals:[]};return{plan:he(et,C,S.enabled),signal:Ke}};async function*gt(Ee,Ie={}){const{plan:Ye,signal:Ke}=await Ze(Ee),Te=Math.max(1,Math.floor(Number(Ie.pageSize))||5e3),tt={signal:Ke,stream:!0};if(!Ye.needsAll)for(let bt=0;;bt+=Te){l(tt);const dt=await d.execute({...Ye.pushed,range:{start:bt,end:bt+Te}},tt);dt&&A(dt.pendingTotal)&&dt.pendingTotal.then(null,()=>{});const ut=dt&&dt.rows||[];if(ut.length&&(yield ut),ut.length<Te)return}l(tt);const et=await ne(await d.execute({...Ye.pushed,range:void 0},tt)),lt=ae(et&&et.rows||[],{...Ye.residual,whole:!0},P.compute||{});for(let bt=0;bt<lt.length;bt+=Te)yield lt.slice(bt,bt+Te)}return{...P,edit:ct,rowMutate:Ct,mode:"remote",fetch:Mt,foregroundIdle:Ue,aggregate:pt,countMatching:async Ee=>{const{plan:Ie,signal:Ye}=await Ze(Ee);if(!Ie.needsAll&&C.total){l({signal:Ye});const Te=await ne(await d.execute({...Ie.pushed,range:{start:0,end:0}},{signal:Ye}));if(Te&&typeof Te.total=="number")return Te.total}let Ke=0;for await(const Te of gt(Ee))Ke+=Te.length;return Ke},streamMatching:gt,lastPlan:()=>g?{...g,...f?{aggregates:f}:{},...I?{total:{deferred:!0,state:I.state,value:I.value}}:{}}:null,fullFrame:$e,counts:()=>({match:R,total:Y??null,pending:!!I&&I.state==="pending"}),grandTotals:()=>W}}}),Xe("packages/modules/shared/engine.js",function(n,ge){"use strict";Object.defineProperty(n,"sourceId",{enumerable:!0,get:function(){return G}}),Object.defineProperty(n,"engineSource",{enumerable:!0,get:function(){return ie}}),Object.defineProperty(n,"gridPivoted",{enumerable:!0,get:function(){return U}}),Object.defineProperty(n,"loadedAndMatching",{enumerable:!0,get:function(){return v}}),Object.defineProperty(n,"gridHoldsWindow",{enumerable:!0,get:function(){return L}}),Object.defineProperty(n,"gridEngineRequest",{enumerable:!0,get:function(){return D}}),Object.defineProperty(n,"EngineFlight",{enumerable:!0,get:function(){return j}});const ke=ge("packages/core/src/source/pushdown.js"),ee=ke.capabilitiesOf,a=ke.planQuery,le=ge("packages/core/src/source/filterwire.js").wireFilters,be=new WeakMap;let F=0;function G(u){let l=be.get(u);return l===void 0&&(l=++F,be.set(u,l)),l}function ie(u){const l=u&&typeof u.config=="function"?u.config():null,s=l&&l.source&&typeof l.source=="object"?l.source:null;if(!s||typeof s.aggregate!="function")return{reason:"the grid's source has no aggregate() — it is not a pushdown source"};const c=ee(s.adapter&&s.adapter.capabilities);return{source:s,caps:c,config:l}}function U(u){const l=u&&typeof u.config=="function"?u.config():null,s=l&&l.source&&typeof l.source=="object"?l.source:null;if(!s||typeof s.lastPlan!="function")return!1;const c=u&&u.state&&typeof u.state.get=="function"?u.state.get():null,b=c&&c.pivot;return!!(b&&b.enabled&&Array.isArray(b.columns)&&b.columns.length>0)}function v(u){const l=u.rows&&typeof u.rows.residentCount=="function"?u.rows.residentCount():0,s=typeof u.rows.matchCount=="function"?u.rows.matchCount():NaN;return{loaded:l,total:Number.isFinite(s)?s:NaN}}function L(u){const l=u&&typeof u.config=="function"?u.config():null,s=l&&l.source&&typeof l.source=="object"?l.source:null;if(!s||s.mode!=="remote"&&s.mode!=="paged")return!1;if(typeof u.rows.matchCount=="function"&&u.rows.matchCount()===null)return!0;const{loaded:c,total:b}=v(u);return Number.isFinite(b)&&c<b}function m(u,l){return l?u?{op:"and",conditions:[u,l]}:l:u||null}function D(u,l,s=null){const c=u.filters&&typeof u.filters.where=="function"?u.filters.where():[];if(Array.isArray(c)&&c.length)return{reason:`a \`where\` predicate is in force (${c.join(", ")}), which only the browser can run`};const b=u.filters&&typeof u.filters.quickState=="function"?u.filters.quickState():{text:""},y=b&&b.text?String(b.text):"",{config:i,caps:x}=l,t={filters:le(m(u.filters.get(),s),{tz:i.timeZone,weekStartsOn:i.weekStartsOn}),sort:[],range:null,context:i.context??null,...y?{quick:y}:{}},w=a(t,x);return w.unpushed.includes("filter")?{reason:s?"the grid's filter, or the viewport condition, did not fully push to the engine":"the grid's filter did not fully push to the engine"}:w.unpushed.includes("quick")?{reason:"the quick search did not push to the engine"}:{request:t,quick:y}}class j{#e=null;#t=null;#n=!1;answer(l){return this.#t&&this.#t.key===l?this.#t:null}last(){return this.#t}get busy(){return this.#e!==null}ask(l,s,c){const b=this.#e;if(b){b.key!==l&&b.controller&&b.controller.abort();return}const y=globalThis.AbortController,i=typeof y=="function"?new y:null,x={key:l,controller:i};this.#e=x;let t;Promise.resolve().then(()=>s(i?i.signal:null)).then(w=>{t={key:l,result:w}},w=>{t={key:l,error:w}}).then(()=>{this.#e===x&&(this.#e=null),!this.#n&&(i&&i.signal.aborted||(this.#t=t),c())})}abort(){const l=this.#e;l&&l.controller&&l.controller.abort()}close(){this.#n=!0,this.abort()}}}),Xe("packages/modules/charts/scale.js",function(n,ge){"use strict";Object.defineProperty(n,"isNumber",{enumerable:!0,get:function(){return G}}),Object.defineProperty(n,"toNumber",{enumerable:!0,get:function(){return ie}}),Object.defineProperty(n,"toTime",{enumerable:!0,get:function(){return U}}),Object.defineProperty(n,"extent",{enumerable:!0,get:function(){return v}}),Object.defineProperty(n,"niceStep",{enumerable:!0,get:function(){return L}}),Object.defineProperty(n,"niceDomain",{enumerable:!0,get:function(){return m}}),Object.defineProperty(n,"measureDomain",{enumerable:!0,get:function(){return D}}),Object.defineProperty(n,"linearTicks",{enumerable:!0,get:function(){return j}}),Object.defineProperty(n,"timeStepFor",{enumerable:!0,get:function(){return u}}),Object.defineProperty(n,"timeTicks",{enumerable:!0,get:function(){return s}}),Object.defineProperty(n,"linearScale",{enumerable:!0,get:function(){return c}}),Object.defineProperty(n,"timeScale",{enumerable:!0,get:function(){return b}}),Object.defineProperty(n,"key",{enumerable:!0,get:function(){return y}}),Object.defineProperty(n,"bandScale",{enumerable:!0,get:function(){return i}}),Object.defineProperty(n,"sqrtScale",{enumerable:!0,get:function(){return x}});const ke=[1,2,2.5,5,10],ee=6e4,a=36e5,ye=864e5,le=365.25*ye,be=[1,2,5,10,20,25,50,100],F=[1,5,10,25,50,100,250,500,1e3,5e3,15e3,3e4,ee,5*ee,15*ee,30*ee,a,3*a,6*a,12*a,ye,2*ye,7*ye,14*ye,30*ye,90*ye,180*ye,...be.map(t=>t*le)];function G(t){return typeof t=="number"&&Number.isFinite(t)}function ie(t){if(t==null||t==="")return null;if(t instanceof Date){const B=t.getTime();return Number.isFinite(B)?B:null}if(typeof t=="boolean")return t?1:0;const w=Number(t);return Number.isFinite(w)?w:null}function U(t){if(t==null||t==="")return null;if(t instanceof Date){const B=t.getTime();return Number.isFinite(B)?B:null}if(typeof t=="number")return Number.isFinite(t)?t:null;const w=Date.parse(String(t));return Number.isFinite(w)?w:null}function v(t){let w=1/0,B=-1/0;for(let K=0;K<t.length;K++){const H=t[K];G(H)&&(H<w&&(w=H),H>B&&(B=H))}return w===1/0?null:{min:w,max:B}}function L(t){if(!(t>0))return 1;const w=10**Math.floor(Math.log10(t));for(const B of ke)if(t<=B*w)return B*w;return 10*w}function m(t,w=5){const B=L((t.max-t.min)/Math.max(1,w));return{min:Math.floor(t.min/B)*B,max:Math.ceil(t.max/B)*B,step:B}}function D(t,w={}){const B=v(t)||{min:0,max:1};let{min:K,max:H}=B;if(w.zero&&(K>0&&(K=0),H<0&&(H=0)),K===H){const q=Math.abs(K)>0?Math.abs(K)/10:1;K-=q,H+=q}if(w.nice!==!1){const q=m({min:K,max:H},w.ticks||5);K=q.min,H=q.max}return G(w.min)&&(K=w.min),G(w.max)&&(H=w.max),K===H&&(H=K+1),{min:K,max:H}}function j(t,w=5){const B=L((t.max-t.min)/Math.max(1,w)),K=Math.ceil(t.min/B),H=Math.floor(t.max/B),q=[];for(let Q=K;Q<=H;Q++){const re=Q*B;q.push(Math.abs(re)<B/1e6?0:Number(re.toPrecision(12)))}return q}function u(t,w=5){const B=Math.max(1,w),K=t/B;let H=F[F.length-1];for(const re of F)if(re>=K){H=re;break}if(H<le)return H;let q=H,Q=Math.abs(t/H-B);for(const re of F){if(re<le)continue;const pe=Math.abs(t/re-B);pe<Q&&(Q=pe,q=re)}return q}function l(t,w){const B=new Date(t.min).getUTCFullYear();let K=Math.ceil(B/w)*w;Date.UTC(K,0,1)<t.min&&(K+=w);const H=[];for(;Date.UTC(K,0,1)<=t.max;K+=w)H.push(Date.UTC(K,0,1));return H}function s(t,w=5){const B=u(t.max-t.min,w);if(B>=le)return l(t,Math.round(B/le));const K=[],H=Math.ceil(t.min/B)*B;for(let q=H;q<=t.max;q+=B)K.push(q);return K}function c(t,w){const B=t.max-t.min||1,[K,H]=w;return{kind:"linear",domain:t,range:w,of(q){return K+(q-t.min)/B*(H-K)},invert(q){return t.min+(q-K)/(H-K||1)*B},ticks(q=5){return j(t,q)}}}function b(t,w){return{...c(t,w),kind:"time",ticks(K=5){return s(t,K)}}}function y(t){if(t==null)return" null";if(t instanceof Date)return` date:${t.getTime()}`;if(typeof t=="object"){const w=t,B=w.id??w.key??w.value;return B!==void 0&&typeof B!="object"?` obj:${String(B)}`:` obj:${String(t)}`}return String(t)}function i(t,w,B=.2){const K=Math.min(.9,Math.max(0,B)),[H,q]=w,Q=new Map;for(let he=0;he<t.length;he++){const $=y(t[he]);Q.has($)||Q.set($,he)}const re=t.length?(q-H)/t.length:q-H,pe=Math.max(0,re*(1-K));return{kind:"band",domain:t,range:w,bandwidth:pe,step:re,of(he){const $=Q.get(y(he));return $===void 0?NaN:H+$*re+(re-pe)/2},centre(he){const $=this.of(he);return Number.isNaN($)?NaN:$+pe/2},ticks(){return t}}}function x(t,w){const[B,K]=w,H=Math.max(Math.abs(t.max),Math.abs(t.min),0)||1;return{kind:"sqrt",domain:t,range:w,of(q){const Q=Math.sqrt(Math.abs(q)/H);return B+Q*(K-B)}}}}),Xe("packages/modules/charts/svg.js",function(n,ge){"use strict";Object.defineProperty(n,"SVG_NS",{enumerable:!0,get:function(){return ke}}),Object.defineProperty(n,"el",{enumerable:!0,get:function(){return a}}),Object.defineProperty(n,"svg",{enumerable:!0,get:function(){return ye}}),Object.defineProperty(n,"attr",{enumerable:!0,get:function(){return le}}),Object.defineProperty(n,"attrs",{enumerable:!0,get:function(){return be}}),Object.defineProperty(n,"setText",{enumerable:!0,get:function(){return F}}),Object.defineProperty(n,"clear",{enumerable:!0,get:function(){return G}}),Object.defineProperty(n,"append",{enumerable:!0,get:function(){return ie}}),Object.defineProperty(n,"path",{enumerable:!0,get:function(){return U}}),Object.defineProperty(n,"ribbonPath",{enumerable:!0,get:function(){return v}}),Object.defineProperty(n,"round",{enumerable:!0,get:function(){return L}}),Object.defineProperty(n,"pathRings",{enumerable:!0,get:function(){return m}}),Object.defineProperty(n,"insideRings",{enumerable:!0,get:function(){return D}});const ke="http://www.w3.org/2000/svg";function ee(j){const u=j.indexOf(")");return u<0?j:j.slice(u+1).trim()||"#0072b2"}function a(j,u,l){const s=j.createElement(u);return l&&s.setAttribute("class",l),s}function ye(j,u,l){const s=j.createElementNS(ke,u);if(l)for(const c of Object.keys(l))s.setAttribute(c,String(l[c]));return s}function le(j,u,l){if(!j)return;if(l==null){j.removeAttribute(u);return}let s=String(l);s.startsWith("url(#")&&(u==="stroke"||u==="fill"&&j.localName==="text")&&(s=ee(s)),j.setAttribute(u,s)}function be(j,u){if(j)for(const l of Object.keys(u))le(j,l,u[l])}function F(j,u){j&&(j.textContent=u==null?"":String(u))}function G(j){if(j)for(;j.firstChild;)j.removeChild(j.firstChild)}function ie(j,u){for(const l of u)l&&j.appendChild(l);return j}function U(j){return j.join(" ")}function v(j){if(!j||j.length<2)return"";const u=["M",j[0].x,j[0].upper];for(let l=1;l<j.length;l++)u.push("L",j[l].x,j[l].upper);for(let l=j.length-1;l>=0;l--)u.push("L",j[l].x,j[l].lower);return u.push("Z"),U(u)}function L(j){return Math.round(j*100)/100}function m(j){const u=[];let l=[];const s=String(j||"").match(/[A-Za-z]|-?\d*\.?\d+(?:e[-+]?\d+)?/gi)||[];let c="",b=[];const y=()=>{if(!c||!b.length){b=[];return}if(c==="M"||c==="L")for(let i=0;i+1<b.length;i+=2)l.push([b[i],b[i+1]]);else c!=="Z"&&b.length>=2&&l.push([b[b.length-2],b[b.length-1]]);b=[]};for(const i of s){if(/[A-Za-z]/.test(i)){if(y(),i==="Z"||i==="z"){l.length>2&&u.push(l),l=[],c="";continue}i==="M"&&l.length>2&&(u.push(l),l=[]),c=i;continue}b.push(Number(i))}return y(),l.length>2&&u.push(l),u}function D(j,u,l){let s=!1;for(const c of j)for(let b=0,y=c.length-1;b<c.length;y=b++){const[i,x]=c[b],[t,w]=c[y];x>l!=w>l&&u<(t-i)*(l-x)/(w-x||1e-12)+i&&(s=!s)}return s}}),Xe("packages/modules/charts/typography.js",function(n,ge){"use strict";Object.defineProperty(n,"BASE_SIZE",{enumerable:!0,get:function(){return ke}}),Object.defineProperty(n,"BASE_FAMILY",{enumerable:!0,get:function(){return ee}}),Object.defineProperty(n,"CHAR_RATIO",{enumerable:!0,get:function(){return a}}),Object.defineProperty(n,"resolveType",{enumerable:!0,get:function(){return ye}}),Object.defineProperty(n,"textWidth",{enumerable:!0,get:function(){return be}}),Object.defineProperty(n,"widestLabel",{enumerable:!0,get:function(){return F}}),Object.defineProperty(n,"truncateTo",{enumerable:!0,get:function(){return G}}),Object.defineProperty(n,"applySize",{enumerable:!0,get:function(){return ie}});const ke=12,ee="var(--lattice-font-family, system-ui, -apple-system, sans-serif)",a=.62;function ye(U){const v=U&&U.font,L=typeof v=="number"?{size:v}:v||{},m=le(L.size,ke);return{family:L.family||ee,size:m,small:le(L.small??L.tickSize,Math.max(9,m-1)),title:le(L.title,Math.round(m*1.15)),axisTitle:le(L.axisTitle,Math.max(10,m-1)),weight:L.weight||"inherit"}}function le(U,v){const L=Number(U);return Number.isFinite(L)&&L>0?L:v}function be(U,v){return String(U??"").length*v*a}function F(U,v){let L=0;for(const m of U||[]){const D=be(m,v);D>L&&(L=D)}return L}function G(U,v,L){const m=String(U??""),D=Math.floor(v/(L*a));return D<=0?"":m.length<=D?m:D===1?"…":`${m.slice(0,D-1)}…`}function ie(U,v){!U||!Number.isFinite(v)||(U.style?U.style.fontSize=`${v}px`:U.setAttribute("style",`font-size:${v}px`))}}),Xe("packages/modules/charts/frame.js",function(n,ge){"use strict";Object.defineProperty(n,"LABEL_GAP",{enumerable:!0,get:function(){return F}}),Object.defineProperty(n,"LABEL_GUTTER_SHARE",{enumerable:!0,get:function(){return G}}),Object.defineProperty(n,"resolveMargin",{enumerable:!0,get:function(){return ie}}),Object.defineProperty(n,"plotRect",{enumerable:!0,get:function(){return U}}),Object.defineProperty(n,"shouldRotate",{enumerable:!0,get:function(){return v}}),Object.defineProperty(n,"Pool",{enumerable:!0,get:function(){return L}});const ee=ge("packages/modules/charts/svg.js").SVG_NS,a=ge("packages/modules/charts/typography.js"),ye=a.textWidth,le=a.widestLabel,be=8,F=6,G=.4;function ie(m,D){const j=typeof m=="number"?m:D,u=m&&typeof m=="object"?m:{},l=s=>Number.isFinite(s)&&s>=0?Number(s):j;return{base:j,top:l(u.top),right:l(u.right),bottom:l(u.bottom),left:l(u.left)}}function U(m){const D=ie(m.margin,typeof m.padding=="number"?m.padding:8),j=D.base,u=m.fontSize||12,l=m.yLabels||[],s=m.xLabels||[],c=m.ySide==="right"?"right":"left",b=c==="right"?"left":"right",y=m.titles||{},i=m.titleSize||u,x=$=>$?i+F:0,t=le(l,u),w=l.length?Math.min(m.width*G,D[c]+t+F):Math.max(be,D[c]),B=D[b]+(m.rightGutter||0),K=(c==="left"?w:B)+x(y.left),H=le(s.map($=>String($).slice(0,14)),u),q=(s.length?m.rotated?Math.min(m.height*G,F+H):u+F+D.bottom:Math.max(be,D.bottom))+x(y.bottom),Q=(c==="right"?w:B)+x(y.right),re=D.top+(m.topGutter||0),pe=Math.max(0,m.width-K-Q),he=Math.max(0,m.height-re-q);return{left:K,top:re,width:pe,height:he,right:K+pe,bottom:re+he,gutter:{left:K,bottom:q,right:Q,top:re}}}function v(m,D,j,u){if(!m.length||D<=0)return!1;const l=Number.isFinite(u)&&u>0?Number(u):1;return le(m,j)>D*l-4}class L{#e;#t=0;static#n="data-pool-key";constructor(D,j=0){this.#e=D,this.#t=j>0?j:0}next(D,j,u){if(u!=null)return this.#r(D,j,String(u));const l=this.#e.childNodes[this.#t],s=l&&l.tagName,c=/(^|\s)\S*__axis-title(\s|$)/,b=s&&c.test(String(l.getAttribute("class")||"")),y=!!j&&c.test(String(j));if(s&&(!b||y)&&String(s).toLowerCase()===D.toLowerCase())return j&&l.setAttribute("class",j),this.#t++,l;const i=this.#e.ownerDocument.createElementNS(ee,D);return j&&i.setAttribute("class",j),l?this.#e.insertBefore(i,l):this.#e.appendChild(i),this.#t++,i}#r(D,j,u){const l=D.toLowerCase();for(let b=this.#t;b<this.#e.childNodes.length;b++){const y=this.#e.childNodes[b],i=y&&y.tagName;if(i&&String(i).toLowerCase()===l&&y.getAttribute(L.#n)===u)return b!==this.#t&&this.#e.insertBefore(y,this.#e.childNodes[this.#t]),j&&y.setAttribute("class",j),this.#t++,y}const s=this.#e.ownerDocument.createElementNS(ee,D);s.setAttribute(L.#n,u),j&&s.setAttribute("class",j);const c=this.#e.childNodes[this.#t];return c?this.#e.insertBefore(s,c):this.#e.appendChild(s),this.#t++,s}finish(){for(;this.#e.childNodes.length>this.#t;)this.#e.removeChild(this.#e.lastChild);this.#t=0}}}),Xe("packages/modules/charts/fills.js",function(n,ge){"use strict";Object.defineProperty(n,"PATTERNS",{enumerable:!0,get:function(){return a}}),Object.defineProperty(n,"GRADIENTS",{enumerable:!0,get:function(){return ye}}),Object.defineProperty(n,"isFill",{enumerable:!0,get:function(){return ie}}),Object.defineProperty(n,"isPaintRef",{enumerable:!0,get:function(){return U}}),Object.defineProperty(n,"paintFallback",{enumerable:!0,get:function(){return v}}),Object.defineProperty(n,"normaliseFill",{enumerable:!0,get:function(){return m}}),Object.defineProperty(n,"swatchCss",{enumerable:!0,get:function(){return j}}),Object.defineProperty(n,"createFillRegistry",{enumerable:!0,get:function(){return u}}),Object.defineProperty(n,"rowPaint",{enumerable:!0,get:function(){return l}}),Object.defineProperty(n,"patternSeries",{enumerable:!0,get:function(){return s}}),Object.defineProperty(n,"paintSolid",{enumerable:!0,get:function(){return c}}),Object.defineProperty(n,"rowFillSource",{enumerable:!0,get:function(){return b}}),Object.defineProperty(n,"nodePaint",{enumerable:!0,get:function(){return y}});const ee=ge("packages/core/src/internal/util.js").warnOnce,a=Object.freeze(["hatch","crosshatch","dots","grid"]),ye=Object.freeze(["linear","radial"]),le=8,be="#0072b2";let F=0;const G=new Map;function ie(i){return!!i&&typeof i=="object"&&!Array.isArray(i)&&(typeof i.gradient=="string"||typeof i.pattern=="string")}function U(i){return typeof i=="string"&&i.startsWith("url(#")}function v(i){if(typeof i!="string")return i==null?"":String(i);if(!i.startsWith("url("))return i;const x=i.indexOf(")");return(x<0?"":i.slice(x+1).trim())||be}function L(i,x){ee(`chart:fill:invalid:${i}`,`a chart fill object was ignored: ${x} The mark was drawn in a solid colour instead. A fill is a gradient object (gradient: "linear" or "radial", with stops of [offset, colour]) or a pattern object (pattern: "hatch", "crosshatch", "dots" or "grid", with a colour).`)}function m(i,x){if(!ie(i))return null;const t=x||be;if(typeof i.gradient=="string"){if(!ye.includes(i.gradient))return L("gradient",`the gradient "${i.gradient}" is not one of ${ye.join(", ")}.`),null;const H=Array.isArray(i.stops)?i.stops:[],q=[];for(const re of H){const pe=Array.isArray(re)?Number(re[0]):Number(re&&re.offset),he=Array.isArray(re)?re[1]:re&&re.colour;!Number.isFinite(pe)||typeof he!="string"||!he||q.push({offset:Math.min(1,Math.max(0,pe)),colour:he})}if(q.length<2)return L("stops","a gradient needs at least two [offset, colour] stops."),null;q.sort((re,pe)=>re.offset-pe.offset);const Q=Number.isFinite(Number(i.angle))?Number(i.angle):180;return{kind:i.gradient,angle:Q,stops:q,solid:q[0].colour}}if(!a.includes(i.pattern))return L("pattern",`the pattern "${i.pattern}" is not one of ${a.join(", ")}.`),null;const w=Number(i.size),B=Number(i.angle),K=typeof i.colour=="string"&&i.colour?i.colour:t;return{kind:"pattern",pattern:i.pattern,colour:K,background:typeof i.background=="string"&&i.background?i.background:null,size:Number.isFinite(w)&&w>=2?w:le,angle:Number.isFinite(B)?B:i.pattern==="grid"||i.pattern==="dots"?0:45,solid:K}}function D(i){if(i.kind==="pattern"){const t=i.colour,w=i.size,B=Math.max(1,w/5),K=i.background||"transparent",H=q=>`repeating-linear-gradient(${q+90}deg,${t} 0 ${B}px,transparent ${B}px ${w}px)`;return i.pattern==="hatch"?`${H(i.angle)},${K}`:i.pattern==="crosshatch"?`${H(i.angle)},${H(i.angle+90)},${K}`:i.pattern==="grid"?`${H(i.angle)},${H(i.angle+90)},${K}`:`radial-gradient(circle at 50% 50%,${t} ${w/6}px,transparent ${w/6+.5}px) 0 0/${w}px ${w}px,${K}`}const x=i.stops.map(t=>`${t.colour} ${Math.round(t.offset*100)}%`).join(",");return i.kind==="radial"?`radial-gradient(circle,${x})`:`linear-gradient(${i.angle}deg,${x})`}function j(i){if(!U(i))return typeof i=="string"?i:"";const x=String(i).indexOf(")"),t=String(i).slice(5,x),w=G.get(t);return w?D(w):v(i)}function u(i){const x=`lattice-fill-${++F}`;let t=new Map,w=0;const B=(H,q)=>{const Q=i.ownerDocument.createElementNS("http://www.w3.org/2000/svg",H);for(const re of Object.keys(q))Q.setAttribute(re,String(q[re]));return Q},K=(H,q)=>{if(q.kind==="pattern"){const re=q.size,pe=Math.max(1,re/5),he=B("pattern",{id:H,width:re,height:re,patternUnits:"userSpaceOnUse"});q.angle&&he.setAttribute("patternTransform",`rotate(${q.angle})`),q.background&&he.appendChild(B("rect",{width:re,height:re,fill:q.background}));const $={stroke:q.colour,"stroke-width":pe};q.pattern==="dots"?he.appendChild(B("circle",{cx:re/2,cy:re/2,r:Math.max(1,re/6),fill:q.colour})):(he.appendChild(B("line",{x1:re/2,y1:0,x2:re/2,y2:re,...$})),q.pattern!=="hatch"&&he.appendChild(B("line",{x1:0,y1:re/2,x2:re,y2:re/2,...$}))),i.appendChild(he);return}let Q;if(q.kind==="radial")Q=B("radialGradient",{id:H,cx:.5,cy:.5,r:.5});else{const re=q.angle*Math.PI/180,pe=Math.sin(re)/2,he=-Math.cos(re)/2;Q=B("linearGradient",{id:H,x1:+(.5-pe).toFixed(4),y1:+(.5-he).toFixed(4),x2:+(.5+pe).toFixed(4),y2:+(.5+he).toFixed(4)})}for(const re of q.stops)Q.appendChild(B("stop",{offset:re.offset,"stop-color":re.colour}));i.appendChild(Q)};return{prefix:x,paint(H,q){const Q=m(H,q);if(!Q)return q||be;if(!i||!i.ownerDocument)return Q.solid;const re=JSON.stringify(Q);let pe=t.get(re);if(!pe){const he=`${x}-${w++}`;K(he,Q),G.set(he,Q),pe=`url(#${he}) ${Q.solid}`,t.set(re,pe)}return pe},reset(){for(const H of t.values())G.delete(H.slice(5,H.indexOf(")")));if(t=new Map,w=0,i)for(;i.firstChild;)i.removeChild(i.firstChild)},ids(){return[...t.values()].map(H=>H.slice(5,H.indexOf(")")))}}}function l(i,x,t){if(i==null||i==="")return null;const w=v(t);if(ie(i))return x?x.paint(i,w):(m(i,w)||{}).solid||null;if(typeof i=="string"){if(a.includes(i)){const B={pattern:i,colour:w};return x?x.paint(B,w):w}return i}return null}function s(i){const x=[{pattern:"hatch",angle:45},{pattern:"dots"},{pattern:"crosshatch",angle:45},{pattern:"hatch",angle:135},{pattern:"grid"},{pattern:"dots",size:5},{pattern:"hatch",angle:0},{pattern:"crosshatch",angle:0,size:6}];return i.map((t,w)=>({...x[w%x.length],colour:t,background:"var(--lattice-background, #fff)"}))}function c(i){return U(i)?String(i).replace(/^url\([^)]*\)\s*/,""):i}function b(i,x){const t=i.fill;if(ie(t))return(B,K)=>l(t,x.fills,c(K));if(typeof t=="function")return(B,K)=>{let H=null;try{H=t({label:B.label,x:B.x,y:B.y,rowKey:B.rowKey})}catch{H=null}return l(H,x.fills,c(K))};const w=typeof t=="string"?t:t&&typeof t=="object"&&typeof t.col=="string"?t.col:null;return w?(B,K)=>B.rowKey===void 0||B.rowKey===null?null:l(i.grid.rows.value(B.rowKey,w),x.fills,c(K)):null}function y(i,x,t){return i&&i({label:x.label,x:x.value,y:x.total,rowKey:x.rowKey},t)||t}}),Xe("packages/modules/charts/scheme.js",function(n,ge){"use strict";Object.defineProperty(n,"PALETTE",{enumerable:!0,get:function(){return F}}),Object.defineProperty(n,"SCHEMES",{enumerable:!0,get:function(){return G}}),Object.defineProperty(n,"registerScheme",{enumerable:!0,get:function(){return v}}),Object.defineProperty(n,"setDefaultScheme",{enumerable:!0,get:function(){return L}}),Object.defineProperty(n,"schemeNames",{enumerable:!0,get:function(){return m}}),Object.defineProperty(n,"resolveScheme",{enumerable:!0,get:function(){return l}}),Object.defineProperty(n,"RAMP_SCALES",{enumerable:!0,get:function(){return c}}),Object.defineProperty(n,"toRgb",{enumerable:!0,get:function(){return i}}),Object.defineProperty(n,"rampStops",{enumerable:!0,get:function(){return x}});const ee=ge("packages/core/src/internal/util.js").warnOnce,a=ge("packages/modules/charts/fills.js"),ye=a.isFill,le=a.patternSeries,be=a.rowPaint,F=Object.freeze(["#0072b2","#e69f00","#009e73","#cc79a7","#56b4e9","#d55e00","#7a5195","#6b7d8c"]),G=Object.freeze({default:{series:F,sequential:["#ecf3f9","#005280"],diverging:["#b04a00","#f7f7f7","#005280"],positive:"#009e73",negative:"#d55e00"},bright:{series:["#1f77d0","#ff7f0e","#2ca02c","#d62728","#9467bd","#17becf","#e377c2","#7f7f7f"],sequential:["#eef4fb","#1f77d0"],diverging:["#d62728","#f7f7f7","#1f77d0"],positive:"#2ca02c",negative:"#d62728"},earth:{series:["#5b7c6f","#c08b52","#7a6a53","#a4553f","#4e6a83","#8f8259","#6d5566","#8c9196"],sequential:["#f2efe9","#4e6a83"],diverging:["#a4553f","#f2efe9","#4e6a83"],positive:"#5b7c6f",negative:"#a4553f"},mono:{series:["#0b2a3d","#17475f","#2c6480","#4a82a0","#6da0bd","#94bcd6","#bcd7e9","#dfecf5"],sequential:["#eef3f7","#0b2a3d"],diverging:["#7a5c00","#f5f5f5","#0b2a3d"],positive:"#17475f",negative:"#7a5c00"},patterns:{series:le(F),sequential:["#ecf3f9","#005280"],diverging:["#b04a00","#f7f7f7","#005280"],positive:"#009e73",negative:"#d55e00"}}),ie=new Map;let U="default";function v(t,w){!t||!w||ie.set(String(t),w)}function L(t){if(typeof t=="string"){U=t;return}t&&typeof t=="object"&&(ie.set("__default__",t),U="__default__")}function m(){return[...Object.keys(G),...ie.keys()].filter(t=>!t.startsWith("__"))}function D(t){return ie.has(t)?ie.get(t):G[t]||null}const j=["series","sequential","diverging","positive","negative"];function u(t){return!t||typeof t!="object"||Array.isArray(t)?!1:!j.some(w=>w in t)}function l(t,w){const B=w&&w.fills||null,K=D(U)||G.default,H=t&&t.scheme,q=u(H)?H:null,Q=Array.isArray(H)&&H.length?H:null,re=typeof H=="string"?D(H):q||Array.isArray(H)?null:H||null,pe=(t&&Array.isArray(t.palette)&&t.palette.length?t.palette:null)||Q;q&&pe&&ee("chart:scheme:array-and-map",'chart "scheme" was given as a name map together with a "palette" array; the two do not combine. Colours came from the map and the array was ignored. Pass one or the other.');const he=q?null:pe,$={...G.default,...K,...re||{}};he&&($.series=he);const Z=t&&t.ramp&&typeof t.ramp=="object"&&!Array.isArray(t.ramp)?t.ramp:null,ae=Z?Z.colours:t&&t.ramp,h=Array.isArray(ae)&&ae.length>=2?ae:null;h&&($.sequential=h);const e=Z?b(Z.scale):null,M=!!(re||he||q),k=$.series&&$.series.length?$.series:F,z=new Map;let A=0;return{...$,series:(te,P)=>{if(q&&P!==void 0&&P!==null){const d=String(P);return Object.prototype.hasOwnProperty.call(q,d)?s(q[d],B,te):(z.has(d)||z.set(d,A++),s(y(k,z.get(d),!0),B,z.get(d)))}return s(y(k,te,M),B,te)},explicit:M,nameMap:!!q,rampScale:e,fills:B}}function s(t,w,B){if(!ye(t))return t;const K=F[(B%F.length+F.length)%F.length];return be(t,w,K)||K}const c=Object.freeze(["linear","log","quantile"]);function b(t){return t==null?null:c.includes(t)?t:(ee(`chart:ramp:scale:${String(t)}`,`chart "ramp.scale" was "${String(t)}", which is not a ramp scale; the chart chose one from its values instead. Use "linear", "log" or "quantile".`),null)}function y(t,w,B){const K=(w%t.length+t.length)%t.length;return B||typeof t[K]!="string"?t[K]:`var(--lattice-chart-${K+1}, ${t[K]})`}function i(t){if(typeof t!="string")return null;const w=t.trim(),B=/^#([0-9a-f]{3}|[0-9a-f]{6})$/i.exec(w);if(B){const q=B[1];return q.length===3?[0,1,2].map(Q=>parseInt(q[Q]+q[Q],16)):[0,2,4].map(Q=>parseInt(q.slice(Q,Q+2),16))}const K=/^rgba?\(([^)]+)\)$/i.exec(w);if(!K)return null;const H=K[1].split(/[\s,/]+/).filter(Boolean).slice(0,3).map(Number);return H.length===3&&H.every(q=>Number.isFinite(q))?H:null}function x(t,w){const B=w?t.diverging:t.sequential,K=w?G.default.diverging:G.default.sequential,H=(Array.isArray(B)?B:K).map((q,Q)=>i(q)||i(K[Q])||[0,0,0]);return H.length>=2?H:K.map(q=>i(q))}}),Xe("packages/modules/charts/styles.js",function(n,ge){"use strict";Object.defineProperty(n,"NS",{enumerable:!0,get:function(){return a}}),Object.defineProperty(n,"seriesColour",{enumerable:!0,get:function(){return le}}),Object.defineProperty(n,"css",{enumerable:!0,get:function(){return be}}),Object.defineProperty(n,"injectStyles",{enumerable:!0,get:function(){return F}});const ee=ge("packages/modules/charts/scheme.js").PALETTE,a="lat-chartview",ye="data-lattice-chartview";function le(G){const ie=(G%ee.length+ee.length)%ee.length;return`var(--lattice-chart-${ie+1}, ${ee[ie]})`}function be(){return`
|
|
7
7
|
.${a}{position:relative;display:flex;flex-direction:column;min-width:0;min-height:0;
|
|
8
8
|
width:100%;height:100%;box-sizing:border-box;
|
|
9
9
|
font-family:var(--lattice-font-family,system-ui,-apple-system,"Segoe UI",Roboto,sans-serif);
|