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