@toclocoinc/lattice-grid 1.88.2 → 1.88.3

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.
Files changed (309) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/README.md +1 -1
  3. package/angular/fesm2022/toclocoinc-lattice-grid-angular.mjs +6 -2
  4. package/angular/package.json +1 -1
  5. package/angular/types/toclocoinc-lattice-grid-angular.d.ts +3 -1
  6. package/docs/API.html +62 -6
  7. package/docs/api/adapters.html +1 -1
  8. package/docs/api/ai.html +1 -1
  9. package/docs/api/alarms.html +1 -1
  10. package/docs/api/calendar.html +1 -1
  11. package/docs/api/charts.html +1 -1
  12. package/docs/api/dashboard.html +1 -1
  13. package/docs/api/data-router.html +1 -1
  14. package/docs/api/deckgl.html +1 -1
  15. package/docs/api/gantt.html +58 -2
  16. package/docs/api/geometry.html +1 -1
  17. package/docs/api/grid.html +2 -2
  18. package/docs/api/index.html +2 -2
  19. package/docs/api/kanban.html +1 -1
  20. package/docs/api/kpi.html +1 -1
  21. package/docs/api/layout.html +1 -1
  22. package/docs/api/leaflet.html +1 -1
  23. package/docs/api/list.html +1 -1
  24. package/docs/api/mapview.html +1 -1
  25. package/docs/api/mock-socket.html +1 -1
  26. package/docs/api/presets.html +1 -1
  27. package/docs/api/tabs.html +1 -1
  28. package/docs/api/types.html +2 -2
  29. package/docs/api-detail.html +4 -4
  30. package/docs/warnings.json +1 -1
  31. package/lattice-grid.d.ts +1 -1
  32. package/lattice-grid.esm.min.js +3 -3
  33. package/lattice-grid.min.cjs +3 -3
  34. package/lattice-grid.min.js +3 -3
  35. package/modules/ai.d.ts +1 -1
  36. package/modules/ai.esm.min.js +2 -2
  37. package/modules/ai.min.cjs +2 -2
  38. package/modules/ai.min.js +2 -2
  39. package/modules/alarms.d.ts +1 -1
  40. package/modules/alarms.esm.min.js +2 -2
  41. package/modules/alarms.min.cjs +2 -2
  42. package/modules/alarms.min.js +2 -2
  43. package/modules/angular.d.ts +1 -1
  44. package/modules/angular.esm.min.js +2 -2
  45. package/modules/angular.min.cjs +2 -2
  46. package/modules/angular.min.js +2 -2
  47. package/modules/calendar.d.ts +1 -1
  48. package/modules/calendar.esm.min.js +2 -2
  49. package/modules/calendar.min.cjs +2 -2
  50. package/modules/calendar.min.js +2 -2
  51. package/modules/chart-alluvial.d.ts +1 -1
  52. package/modules/chart-alluvial.esm.min.js +1 -1
  53. package/modules/chart-alluvial.min.cjs +1 -1
  54. package/modules/chart-alluvial.min.js +1 -1
  55. package/modules/chart-arc.d.ts +1 -1
  56. package/modules/chart-arc.esm.min.js +1 -1
  57. package/modules/chart-arc.min.cjs +1 -1
  58. package/modules/chart-arc.min.js +1 -1
  59. package/modules/chart-barrace.d.ts +1 -1
  60. package/modules/chart-barrace.esm.min.js +1 -1
  61. package/modules/chart-barrace.min.cjs +1 -1
  62. package/modules/chart-barrace.min.js +1 -1
  63. package/modules/chart-bubblemap.d.ts +1 -1
  64. package/modules/chart-bubblemap.esm.min.js +1 -1
  65. package/modules/chart-bubblemap.min.cjs +1 -1
  66. package/modules/chart-bubblemap.min.js +1 -1
  67. package/modules/chart-bump.d.ts +1 -1
  68. package/modules/chart-bump.esm.min.js +1 -1
  69. package/modules/chart-bump.min.cjs +1 -1
  70. package/modules/chart-bump.min.js +1 -1
  71. package/modules/chart-calendar.d.ts +1 -1
  72. package/modules/chart-calendar.esm.min.js +1 -1
  73. package/modules/chart-calendar.min.cjs +1 -1
  74. package/modules/chart-calendar.min.js +1 -1
  75. package/modules/chart-choropleth.d.ts +1 -1
  76. package/modules/chart-choropleth.esm.min.js +1 -1
  77. package/modules/chart-choropleth.min.cjs +1 -1
  78. package/modules/chart-choropleth.min.js +1 -1
  79. package/modules/chart-decomposition.d.ts +1 -1
  80. package/modules/chart-decomposition.esm.min.js +1 -1
  81. package/modules/chart-decomposition.min.cjs +1 -1
  82. package/modules/chart-decomposition.min.js +1 -1
  83. package/modules/chart-diverging.d.ts +1 -1
  84. package/modules/chart-diverging.esm.min.js +1 -1
  85. package/modules/chart-diverging.min.cjs +1 -1
  86. package/modules/chart-diverging.min.js +1 -1
  87. package/modules/chart-dumbbell.d.ts +1 -1
  88. package/modules/chart-dumbbell.esm.min.js +1 -1
  89. package/modules/chart-dumbbell.min.cjs +1 -1
  90. package/modules/chart-dumbbell.min.js +1 -1
  91. package/modules/chart-fan.d.ts +1 -1
  92. package/modules/chart-fan.esm.min.js +1 -1
  93. package/modules/chart-fan.min.cjs +1 -1
  94. package/modules/chart-fan.min.js +1 -1
  95. package/modules/chart-forcetree.d.ts +1 -1
  96. package/modules/chart-forcetree.esm.min.js +1 -1
  97. package/modules/chart-forcetree.min.cjs +1 -1
  98. package/modules/chart-forcetree.min.js +1 -1
  99. package/modules/chart-hexbin.d.ts +1 -1
  100. package/modules/chart-hexbin.esm.min.js +1 -1
  101. package/modules/chart-hexbin.min.cjs +1 -1
  102. package/modules/chart-hexbin.min.js +1 -1
  103. package/modules/chart-hexmap.d.ts +1 -1
  104. package/modules/chart-hexmap.esm.min.js +1 -1
  105. package/modules/chart-hexmap.min.cjs +1 -1
  106. package/modules/chart-hexmap.min.js +1 -1
  107. package/modules/chart-icicle.d.ts +1 -1
  108. package/modules/chart-icicle.esm.min.js +1 -1
  109. package/modules/chart-icicle.min.cjs +1 -1
  110. package/modules/chart-icicle.min.js +1 -1
  111. package/modules/chart-markermap.d.ts +1 -1
  112. package/modules/chart-markermap.esm.min.js +1 -1
  113. package/modules/chart-markermap.min.cjs +1 -1
  114. package/modules/chart-markermap.min.js +1 -1
  115. package/modules/chart-motion.d.ts +1 -1
  116. package/modules/chart-motion.esm.min.js +1 -1
  117. package/modules/chart-motion.min.cjs +1 -1
  118. package/modules/chart-motion.min.js +1 -1
  119. package/modules/chart-pack.d.ts +1 -1
  120. package/modules/chart-pack.esm.min.js +1 -1
  121. package/modules/chart-pack.min.cjs +1 -1
  122. package/modules/chart-pack.min.js +1 -1
  123. package/modules/chart-parallel.d.ts +1 -1
  124. package/modules/chart-parallel.esm.min.js +1 -1
  125. package/modules/chart-parallel.min.cjs +1 -1
  126. package/modules/chart-parallel.min.js +1 -1
  127. package/modules/chart-pictorial.d.ts +1 -1
  128. package/modules/chart-pictorial.esm.min.js +1 -1
  129. package/modules/chart-pictorial.min.cjs +1 -1
  130. package/modules/chart-pictorial.min.js +1 -1
  131. package/modules/chart-polararea.d.ts +1 -1
  132. package/modules/chart-polararea.esm.min.js +1 -1
  133. package/modules/chart-polararea.min.cjs +1 -1
  134. package/modules/chart-polararea.min.js +1 -1
  135. package/modules/chart-polarscatter.d.ts +1 -1
  136. package/modules/chart-polarscatter.esm.min.js +1 -1
  137. package/modules/chart-polarscatter.min.cjs +1 -1
  138. package/modules/chart-polarscatter.min.js +1 -1
  139. package/modules/chart-pyramid.d.ts +1 -1
  140. package/modules/chart-pyramid.esm.min.js +1 -1
  141. package/modules/chart-pyramid.min.cjs +1 -1
  142. package/modules/chart-pyramid.min.js +1 -1
  143. package/modules/chart-radialbar.d.ts +1 -1
  144. package/modules/chart-radialbar.esm.min.js +1 -1
  145. package/modules/chart-radialbar.min.cjs +1 -1
  146. package/modules/chart-radialbar.min.js +1 -1
  147. package/modules/chart-ridgeline.d.ts +1 -1
  148. package/modules/chart-ridgeline.esm.min.js +1 -1
  149. package/modules/chart-ridgeline.min.cjs +1 -1
  150. package/modules/chart-ridgeline.min.js +1 -1
  151. package/modules/chart-roc.d.ts +1 -1
  152. package/modules/chart-roc.esm.min.js +1 -1
  153. package/modules/chart-roc.min.cjs +1 -1
  154. package/modules/chart-roc.min.js +1 -1
  155. package/modules/chart-serpentine.d.ts +1 -1
  156. package/modules/chart-serpentine.esm.min.js +1 -1
  157. package/modules/chart-serpentine.min.cjs +1 -1
  158. package/modules/chart-serpentine.min.js +1 -1
  159. package/modules/chart-slope.d.ts +1 -1
  160. package/modules/chart-slope.esm.min.js +1 -1
  161. package/modules/chart-slope.min.cjs +1 -1
  162. package/modules/chart-slope.min.js +1 -1
  163. package/modules/chart-spiral.d.ts +1 -1
  164. package/modules/chart-spiral.esm.min.js +1 -1
  165. package/modules/chart-spiral.min.cjs +1 -1
  166. package/modules/chart-spiral.min.js +1 -1
  167. package/modules/chart-splom.d.ts +1 -1
  168. package/modules/chart-splom.esm.min.js +1 -1
  169. package/modules/chart-splom.min.cjs +1 -1
  170. package/modules/chart-splom.min.js +1 -1
  171. package/modules/chart-tree.d.ts +1 -1
  172. package/modules/chart-tree.esm.min.js +1 -1
  173. package/modules/chart-tree.min.cjs +1 -1
  174. package/modules/chart-tree.min.js +1 -1
  175. package/modules/chart-venn.d.ts +1 -1
  176. package/modules/chart-venn.esm.min.js +1 -1
  177. package/modules/chart-venn.min.cjs +1 -1
  178. package/modules/chart-venn.min.js +1 -1
  179. package/modules/chart-voronoi.d.ts +1 -1
  180. package/modules/chart-voronoi.esm.min.js +1 -1
  181. package/modules/chart-voronoi.min.cjs +1 -1
  182. package/modules/chart-voronoi.min.js +1 -1
  183. package/modules/chart-waffle.d.ts +1 -1
  184. package/modules/chart-waffle.esm.min.js +1 -1
  185. package/modules/chart-waffle.min.cjs +1 -1
  186. package/modules/chart-waffle.min.js +1 -1
  187. package/modules/chart-wordcloud.d.ts +1 -1
  188. package/modules/chart-wordcloud.esm.min.js +1 -1
  189. package/modules/chart-wordcloud.min.cjs +1 -1
  190. package/modules/chart-wordcloud.min.js +1 -1
  191. package/modules/charts.d.ts +1 -1
  192. package/modules/charts.esm.min.js +2 -2
  193. package/modules/charts.min.cjs +2 -2
  194. package/modules/charts.min.js +2 -2
  195. package/modules/dashboard.d.ts +1 -1
  196. package/modules/dashboard.esm.min.js +2 -2
  197. package/modules/dashboard.min.cjs +2 -2
  198. package/modules/dashboard.min.js +2 -2
  199. package/modules/data-router.d.ts +1 -1
  200. package/modules/data-router.esm.min.js +2 -2
  201. package/modules/data-router.min.cjs +2 -2
  202. package/modules/data-router.min.js +2 -2
  203. package/modules/deckgl.d.ts +1 -1
  204. package/modules/deckgl.esm.min.js +2 -2
  205. package/modules/deckgl.min.cjs +2 -2
  206. package/modules/deckgl.min.js +2 -2
  207. package/modules/devtools.d.ts +1 -1
  208. package/modules/devtools.esm.min.js +1 -1
  209. package/modules/devtools.min.cjs +1 -1
  210. package/modules/devtools.min.js +1 -1
  211. package/modules/dhtmlx-compat.d.ts +1 -1
  212. package/modules/dhtmlx-compat.esm.min.js +2 -2
  213. package/modules/dhtmlx-compat.min.cjs +2 -2
  214. package/modules/dhtmlx-compat.min.js +2 -2
  215. package/modules/gantt.d.ts +58 -3
  216. package/modules/gantt.esm.min.js +223 -217
  217. package/modules/gantt.esm.min.js.map +2 -2
  218. package/modules/gantt.min.cjs +222 -216
  219. package/modules/gantt.min.js +222 -216
  220. package/modules/gantt.min.js.map +2 -2
  221. package/modules/geo-europe-nuts.d.ts +1 -1
  222. package/modules/geo-europe-nuts.esm.min.js +1 -1
  223. package/modules/geo-europe-nuts.min.cjs +1 -1
  224. package/modules/geo-europe-nuts.min.js +1 -1
  225. package/modules/geo-uk.d.ts +1 -1
  226. package/modules/geo-uk.esm.min.js +1 -1
  227. package/modules/geo-uk.min.cjs +1 -1
  228. package/modules/geo-uk.min.js +1 -1
  229. package/modules/geo-us-states.d.ts +1 -1
  230. package/modules/geo-us-states.esm.min.js +1 -1
  231. package/modules/geo-us-states.min.cjs +1 -1
  232. package/modules/geo-us-states.min.js +1 -1
  233. package/modules/geo-world-110m.d.ts +1 -1
  234. package/modules/geo-world-110m.esm.min.js +1 -1
  235. package/modules/geo-world-110m.min.cjs +1 -1
  236. package/modules/geo-world-110m.min.js +1 -1
  237. package/modules/geo-world-50m.d.ts +1 -1
  238. package/modules/geo-world-50m.esm.min.js +1 -1
  239. package/modules/geo-world-50m.min.cjs +1 -1
  240. package/modules/geo-world-50m.min.js +1 -1
  241. package/modules/geometry.d.ts +1 -1
  242. package/modules/geometry.esm.min.js +2 -2
  243. package/modules/geometry.min.cjs +2 -2
  244. package/modules/geometry.min.js +2 -2
  245. package/modules/htmx.d.ts +1 -1
  246. package/modules/htmx.esm.min.js +3 -3
  247. package/modules/htmx.min.cjs +3 -3
  248. package/modules/htmx.min.js +3 -3
  249. package/modules/kanban.d.ts +1 -1
  250. package/modules/kanban.esm.min.js +2 -2
  251. package/modules/kanban.min.cjs +2 -2
  252. package/modules/kanban.min.js +2 -2
  253. package/modules/kpi.d.ts +1 -1
  254. package/modules/kpi.esm.min.js +2 -2
  255. package/modules/kpi.min.cjs +2 -2
  256. package/modules/kpi.min.js +2 -2
  257. package/modules/layout.d.ts +1 -1
  258. package/modules/layout.esm.min.js +2 -2
  259. package/modules/layout.min.cjs +2 -2
  260. package/modules/layout.min.js +2 -2
  261. package/modules/leaflet.d.ts +1 -1
  262. package/modules/leaflet.esm.min.js +2 -2
  263. package/modules/leaflet.min.cjs +2 -2
  264. package/modules/leaflet.min.js +2 -2
  265. package/modules/list.d.ts +1 -1
  266. package/modules/list.esm.min.js +2 -2
  267. package/modules/list.min.cjs +2 -2
  268. package/modules/list.min.js +2 -2
  269. package/modules/mapview.d.ts +1 -1
  270. package/modules/mapview.esm.min.js +2 -2
  271. package/modules/mapview.min.cjs +2 -2
  272. package/modules/mapview.min.js +2 -2
  273. package/modules/mock-socket.d.ts +1 -1
  274. package/modules/mock-socket.esm.min.js +1 -1
  275. package/modules/mock-socket.min.cjs +1 -1
  276. package/modules/mock-socket.min.js +1 -1
  277. package/modules/presets.d.ts +1 -1
  278. package/modules/presets.esm.min.js +2 -2
  279. package/modules/presets.min.cjs +2 -2
  280. package/modules/presets.min.js +2 -2
  281. package/modules/react.d.ts +1 -1
  282. package/modules/react.esm.min.js +2 -2
  283. package/modules/react.esm.min.js.map +1 -1
  284. package/modules/react.min.cjs +2 -2
  285. package/modules/react.min.js +2 -2
  286. package/modules/react.min.js.map +1 -1
  287. package/modules/svelte.d.ts +1 -1
  288. package/modules/svelte.esm.min.js +3 -3
  289. package/modules/svelte.esm.min.js.map +1 -1
  290. package/modules/svelte.min.cjs +2 -2
  291. package/modules/svelte.min.js +2 -2
  292. package/modules/svelte.min.js.map +1 -1
  293. package/modules/tabs.d.ts +1 -1
  294. package/modules/tabs.esm.min.js +2 -2
  295. package/modules/tabs.min.cjs +2 -2
  296. package/modules/tabs.min.js +2 -2
  297. package/modules/vue.d.ts +1 -1
  298. package/modules/vue.esm.min.js +2 -2
  299. package/modules/vue.esm.min.js.map +1 -1
  300. package/modules/vue.min.cjs +2 -2
  301. package/modules/vue.min.js +2 -2
  302. package/modules/vue.min.js.map +1 -1
  303. package/modules/webcomponent.d.ts +1 -1
  304. package/modules/webcomponent.esm.min.js +4 -4
  305. package/modules/webcomponent.esm.min.js.map +1 -1
  306. package/modules/webcomponent.min.cjs +4 -4
  307. package/modules/webcomponent.min.js +4 -4
  308. package/modules/webcomponent.min.js.map +1 -1
  309. package/package.json +1 -1
@@ -1,9 +1,9 @@
1
1
  /*!
2
- * Lattice Grid 1.88.2, leaflet module
2
+ * Lattice Grid 1.88.3, leaflet module
3
3
  * Copyright (c) 2026 TOCLOCO Inc. All rights reserved.
4
4
  * https://latticegrid.dev
5
5
  */
6
- (function(On){"use strict";var hn=Object.create(null),mn=Object.create(null);function Ve(n,de){hn[n]=de}function gn(n){var de=mn[n];if(de)return de;var Ne=Object.create(null);mn[n]=Ne;var ee=hn[n];if(!ee)throw new Error("[lattice] missing module: "+n);return ee(Ne,gn),Ne}Ve("packages/core/src/internal/util.js",function(n,de){"use strict";Object.defineProperty(n,"VERSION",{enumerable:!0,get:function(){return o}}),Object.defineProperty(n,"reportedWarnings",{enumerable:!0,get:function(){return S}}),Object.defineProperty(n,"warnOnce",{enumerable:!0,get:function(){return g}}),Object.defineProperty(n,"infoOnce",{enumerable:!0,get:function(){return z}}),Object.defineProperty(n,"resetWarnings",{enumerable:!0,get:function(){return A}}),Object.defineProperty(n,"fail",{enumerable:!0,get:function(){return i}}),Object.defineProperty(n,"invariant",{enumerable:!0,get:function(){return m}}),Object.defineProperty(n,"DEV",{enumerable:!0,get:function(){return c}}),Object.defineProperty(n,"isObject",{enumerable:!0,get:function(){return h}}),Object.defineProperty(n,"isFunction",{enumerable:!0,get:function(){return M}}),Object.defineProperty(n,"isNil",{enumerable:!0,get:function(){return b}}),Object.defineProperty(n,"isBlank",{enumerable:!0,get:function(){return r}}),Object.defineProperty(n,"isCtor",{enumerable:!0,get:function(){return O}}),Object.defineProperty(n,"pathGetter",{enumerable:!0,get:function(){return y}}),Object.defineProperty(n,"pathSetter",{enumerable:!0,get:function(){return B}}),Object.defineProperty(n,"getPath",{enumerable:!0,get:function(){return H}}),Object.defineProperty(n,"setPath",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(n,"humanise",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(n,"escapeHtml",{enumerable:!0,get:function(){return fe}}),Object.defineProperty(n,"titleCase",{enumerable:!0,get:function(){return ue}}),Object.defineProperty(n,"expand",{enumerable:!0,get:function(){return W}}),Object.defineProperty(n,"toArray",{enumerable:!0,get:function(){return N}}),Object.defineProperty(n,"merge",{enumerable:!0,get:function(){return l}}),Object.defineProperty(n,"mergeRow",{enumerable:!0,get:function(){return e}}),Object.defineProperty(n,"Lru",{enumerable:!0,get:function(){return p}}),Object.defineProperty(n,"collator",{enumerable:!0,get:function(){return F}}),Object.defineProperty(n,"defaultCompare",{enumerable:!0,get:function(){return x}}),Object.defineProperty(n,"now",{enumerable:!0,get:function(){return J}}),Object.defineProperty(n,"nextFrame",{enumerable:!0,get:function(){return w}}),Object.defineProperty(n,"cancelFrame",{enumerable:!0,get:function(){return k}}),Object.defineProperty(n,"frameBatched",{enumerable:!0,get:function(){return D}}),Object.defineProperty(n,"settleDebounce",{enumerable:!0,get:function(){return ae}}),Object.defineProperty(n,"whenIdle",{enumerable:!0,get:function(){return te}}),Object.defineProperty(n,"uid",{enumerable:!0,get:function(){return V}});const Ne="1.88.2";async function ee(){return Ne}const o="1.88.2",ye=new Set,ce=2e3;function me(u){if(ye.add(u),ye.size>ce){const f=ye.values().next().value;f!==void 0&&ye.delete(f)}}const R=[],_=500;function re(u,f,L){R.push({key:u,level:f,message:L.map(s=>typeof s=="string"?s:q(s)).join(" "),at:Date.now()}),R.length>_&&R.shift()}function q(u){if(u instanceof Error)return u.message;try{return JSON.stringify(u)}catch{return String(u)}}function S(){return R.map(u=>({...u}))}function T(u){if(u.length===0||typeof u[0]!="string")return u;const f=u[0].replace(/^\[lattice\]\s*/,"");return f===u[0]?u:[f,...u.slice(1)]}function g(u,...f){if(ye.has(u))return;me(u);const L=T(f);re(u,"warn",L),console.warn("[lattice]",...L)}function z(u,...f){if(ye.has(u))return;me(u);const L=T(f);re(u,"info",L),console.info("[lattice]",...L)}function A(){ye.clear(),R.length=0}function i(u,f){const L=new Error(`[lattice] ${u}`);throw f!==void 0&&(L.cause=f),L}function m(u,f){u||i(f)}const c=(()=>{try{return!(typeof process<"u"&&process.env&&process.env.NODE_ENV==="production")}catch{return!0}})();function h(u){return u!==null&&typeof u=="object"&&!Array.isArray(u)}function M(u){return typeof u=="function"}function b(u){return u==null}function r(u){return u==null||u===""}function O(u){return typeof u!="function"?!1:/^class[\s{]/.test(Function.prototype.toString.call(u))?!0:!!(u.prototype&&Object.getOwnPropertyNames(u.prototype).length>1)}const t=new Map;function y(u){let f=t.get(u);if(f)return f;if(!u.includes("."))f=L=>L?.[u];else{const L=u.split("."),s=L.length;f=E=>{let a=E;for(let G=0;G<s;G++){if(a==null)return;a=a[L[G]]}return a}}return t.set(u,f),f}const I=new Map;function B(u){let f=I.get(u);if(f)return f;if(!u.includes("."))f=(L,s)=>{L!=null&&(L[u]=s)};else{const L=u.split("."),s=L.length-1;f=(E,a)=>{let G=E;for(let C=0;C<s;C++){if(G==null)return;const oe=L[C];G[oe]==null&&(G[oe]={}),G=G[oe]}G!=null&&(G[L[s]]=a)}}return I.set(u,f),f}function H(u,f){return y(f)(u)}function Y(u,f,L){B(f)(u,L)}function Q(u){return u?(u.includes(".")?u.slice(u.lastIndexOf(".")+1):u).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(/^./,L=>L.toUpperCase()):""}const he={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"};function fe(u){const f=u==null?"":String(u);return/[&<>"']/.test(f)?f.replace(/[&<>"']/g,L=>he[L]):f}function ue(u){return String(u).replace(/\w\S*/g,f=>f[0].toUpperCase()+f.slice(1).toLowerCase())}function W(u,f,L){if(u!==void 0)return u===!0?{enabled:!0,...L}:u===!1?{enabled:!1}:h(u)?u:{[f]:u,enabled:!0}}function N(u){return u==null?[]:Array.isArray(u)?u:[u]}const ne=Object.freeze(new Set(["__proto__","constructor","prototype"]));function l(u,f){if(!h(u))return h(f)?{...f}:f;if(!h(f))return f===void 0?u:f;const L={...u};for(const s of Object.keys(f)){if(ne.has(s))continue;const E=f[s];E!==void 0&&(L[s]=h(E)&&h(L[s])?l(L[s],E):E)}return L}function e(u,f){if(!h(u)||!h(f)||u===f)return f;const L=Object.create(Object.getPrototypeOf(u));return Object.assign(L,u,f),L}class p{#e;#t=new Map;#n;constructor(f=256,L=null){this.#e=f,this.#n=L}get size(){return this.#t.size}get max(){return this.#e}set max(f){this.#e=f,this.#r()}has(f){return this.#t.has(f)}get(f){const L=this.#t;if(!L.has(f))return;const s=L.get(f);return L.delete(f),L.set(f,s),s}peek(f){return this.#t.get(f)}set(f,L){const s=this.#t;return s.has(f)&&s.delete(f),s.set(f,L),this.#r(),L}delete(f){const L=this.#t.get(f);return this.#t.delete(f)&&this.#n&&this.#n(L,f),L}clear(){if(this.#n)for(const[f,L]of this.#t)this.#n(L,f);this.#t.clear()}keys(){return this.#t.keys()}values(){return this.#t.values()}#r(){const f=this.#t;for(;f.size>this.#e;){const L=f.keys().next().value,s=f.get(L);f.delete(L),this.#n&&this.#n(s,L)}}}const v=new Map;function F(u,f){const L=`${u||""}|${f?JSON.stringify(f):""}`;let s=v.get(L);return s||(s=new Intl.Collator(u||void 0,{numeric:!0,sensitivity:"variant",...f}),v.set(L,s)),s}function x(u,f){if(u===f)return 0;if(u==null)return 1;if(f==null)return-1;if(typeof u=="number"&&typeof f=="number")return Number.isNaN(u)?Number.isNaN(f)?0:1:Number.isNaN(f)||u<f?-1:u>f?1:0;const L=String(u),s=String(f);return L<s?-1:L>s?1:0}function J(){return typeof performance<"u"&&performance.now?performance.now():Date.now()}const K=typeof requestAnimationFrame=="function";function w(u){return K?requestAnimationFrame(u):setTimeout(()=>u(J()),16)}function k(u){u!=null&&(K?cancelAnimationFrame(u):clearTimeout(u))}function D(u){let f=null,L=null;const s=()=>{f=null;const a=L;L=null,u(...a||[])},E=(...a)=>{L=a,f===null&&(f=w(s))};return E.cancel=()=>{k(f),f=null,L=null},E.flush=()=>{f!==null&&(k(f),s())},E}function ae(u,f){let L=null,s=null;const E=()=>{if(L=null,s===null)return;const C=s;s=null,u(...C),a()},a=()=>{L=setTimeout(E,f),typeof L?.unref=="function"&&L.unref()},G=(...C)=>{L===null?(u(...C),a()):(s=C,clearTimeout(L),a())};return G.flush=()=>{if(L!==null&&clearTimeout(L),L=null,s===null)return;const C=s;s=null,u(...C)},G.cancel=()=>{L!==null&&clearTimeout(L),L=null,s=null},G.pending=()=>L!==null||s!==null,G}function te(u,f=50){return typeof requestIdleCallback=="function"?requestIdleCallback(u,{timeout:f}):setTimeout(()=>u({timeRemaining:()=>0,didTimeout:!0}),1)}let $=0;function V(u="l"){return`${u}${(++$).toString(36)}`}}),Ve("packages/modules/geometry/geodata.js",function(n,de){"use strict";Object.defineProperty(n,"GEOMETRY_KINDS",{enumerable:!0,get:function(){return ce}}),Object.defineProperty(n,"SPATIAL_OPERATORS",{enumerable:!0,get:function(){return me}}),Object.defineProperty(n,"GEOMETRY_OPERATORS",{enumerable:!0,get:function(){return R}}),Object.defineProperty(n,"EARTH_RADIUS",{enumerable:!0,get:function(){return _}}),Object.defineProperty(n,"toWkt",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(n,"toWkb",{enumerable:!0,get:function(){return ue}}),Object.defineProperty(n,"readGeometry",{enumerable:!0,get:function(){return F}}),Object.defineProperty(n,"parseGeometry",{enumerable:!0,get:function(){return J}}),Object.defineProperty(n,"haversine",{enumerable:!0,get:function(){return w}}),Object.defineProperty(n,"geometryInfo",{enumerable:!0,get:function(){return L}}),Object.defineProperty(n,"geometryKind",{enumerable:!0,get:function(){return s}}),Object.defineProperty(n,"spatialOperand",{enumerable:!0,get:function(){return a}}),Object.defineProperty(n,"spatialPredicate",{enumerable:!0,get:function(){return Ae}});const Ne=de("packages/core/src/internal/util.js"),ee=Ne.isNil,o=Ne.isObject,ye=Ne.warnOnce,ce=Object.freeze(["Point","LineString","Polygon","MultiPoint","MultiLineString","MultiPolygon","GeometryCollection"]),me=Object.freeze(["withinBbox","withinPolygon","intersects","withinDistance"]),R=Object.freeze([...me,"blank","notBlank"]),_=63710088e-1,re=Math.PI/180,q=16,S=1e-12;class T extends Error{}function g(P){throw new T(P)}function z(P){(!Array.isArray(P)||P.length<2)&&g("a position needs at least two numbers");const j=Number(P[0]),U=Number(P[1]);return(typeof P[0]!="number"||typeof P[1]!="number"||!Number.isFinite(j)||!Number.isFinite(U))&&g("a coordinate is not a finite number"),[j,U]}function A(P,j,U){Array.isArray(P)||g(`${U} is not an array of positions`);const se=P.map(z);return se.length<j&&g(`${U} needs at least ${j} positions, found ${se.length}`),se}function i(P){const j=A(P,3,"a polygon ring"),U=j[0],se=j[j.length-1];return(U[0]!==se[0]||U[1]!==se[1])&&j.push([U[0],U[1]]),j.length<4&&g(`a polygon ring needs at least 3 distinct corners, found ${j.length-1}`),j}function m(P){return(!Array.isArray(P)||P.length===0)&&g("a polygon needs at least an outer ring"),P.map(i)}function c(P,j){switch(j>q&&g("geometry collections nest too deeply"),o(P)||g("GeoJSON must be an object"),P.type){case"Feature":return P.geometry==null?null:c(P.geometry,j+1);case"FeatureCollection":return g("a FeatureCollection holds many rows, not one value; load its features as rows");case"Point":return{type:"Point",coordinates:z(P.coordinates)};case"MultiPoint":return{type:"MultiPoint",coordinates:A(P.coordinates,1,"a MultiPoint")};case"LineString":return{type:"LineString",coordinates:A(P.coordinates,2,"a LineString")};case"MultiLineString":return(!Array.isArray(P.coordinates)||!P.coordinates.length)&&g("a MultiLineString needs at least one line"),{type:"MultiLineString",coordinates:P.coordinates.map(U=>A(U,2,"a LineString"))};case"Polygon":return{type:"Polygon",coordinates:m(P.coordinates)};case"MultiPolygon":return(!Array.isArray(P.coordinates)||!P.coordinates.length)&&g("a MultiPolygon needs at least one polygon"),{type:"MultiPolygon",coordinates:P.coordinates.map(m)};case"GeometryCollection":{(!Array.isArray(P.geometries)||!P.geometries.length)&&g("a GeometryCollection needs at least one geometry");const U=P.geometries.map(se=>c(se,j+1)).filter(Boolean);return U.length?{type:"GeometryCollection",geometries:U}:null}default:return g(`"${String(P.type)}" is not a GeoJSON geometry type`)}}const h=Object.freeze({POINT:"Point",LINESTRING:"LineString",POLYGON:"Polygon",MULTIPOINT:"MultiPoint",MULTILINESTRING:"MultiLineString",MULTIPOLYGON:"MultiPolygon",GEOMETRYCOLLECTION:"GeometryCollection"}),M=/[-+]?(?:\d+\.?\d*|\.\d+)(?:[eE][-+]?\d+)?/y,b=/[A-Za-z]+/y,r=/^\s*(?:SRID\s*=\s*\d+\s*;\s*)?[A-Za-z]+\s*(?:ZM|Z|M)?\s*(?:\(|EMPTY\b)/i;class O{text;at=0;constructor(j){this.text=j}space(){for(;this.at<this.text.length&&/\s/.test(this.text[this.at]);)this.at++}expect(j){this.space(),this.text[this.at]!==j&&g(`WKT expected "${j}" at character ${this.at+1}, found "${this.text[this.at]??"the end"}"`),this.at++}accept(j){return this.space(),this.text[this.at]===j?(this.at++,!0):!1}word(){this.space(),b.lastIndex=this.at;const j=b.exec(this.text);return j?(this.at+=j[0].length,j[0].toUpperCase()):""}numberNext(){return this.space(),M.lastIndex=this.at,M.test(this.text)}number(){this.space(),M.lastIndex=this.at;const j=M.exec(this.text);return j||g(`WKT expected a number at character ${this.at+1}`),this.at+=j[0].length,Number(j[0])}position(){const j=this.number(),U=this.number();for(;this.numberNext();)this.number();return[j,U]}positionList(){this.expect("(");const j=[this.position()];for(;this.accept(",");)j.push(this.position());return this.expect(")"),j}empty(){const j=this.at;return this.word()==="EMPTY"?!0:(this.at=j,!1)}geometry(j){j>q&&g("geometry collections nest too deeply");const U=this.word(),se=h[U];se||g(U?`"${U}" is not a WKT geometry type`:"WKT expected a geometry type");const Oe=this.at,xe=this.word();return xe!=="Z"&&xe!=="M"&&xe!=="ZM"&&(this.at=Oe),this.empty()?null:this.body(se,j)}body(j,U){switch(j){case"Point":{this.expect("(");const se=this.position();return this.expect(")"),{type:"Point",coordinates:se}}case"LineString":return{type:"LineString",coordinates:A(this.positionList(),2,"a LineString")};case"Polygon":return{type:"Polygon",coordinates:this.polygonBody()};case"MultiPoint":{this.expect("(");const se=[];do this.empty()||(this.accept("(")?(se.push(this.position()),this.expect(")")):se.push(this.position()));while(this.accept(","));return this.expect(")"),se.length?{type:"MultiPoint",coordinates:se}:null}case"MultiLineString":{const se=this.parts(()=>A(this.positionList(),2,"a LineString"));return se.length?{type:"MultiLineString",coordinates:se}:null}case"MultiPolygon":{const se=this.parts(()=>this.polygonBody());return se.length?{type:"MultiPolygon",coordinates:se}:null}default:{this.expect("(");const se=[];do{const Oe=this.geometry(U+1);Oe&&se.push(Oe)}while(this.accept(","));return this.expect(")"),se.length?{type:"GeometryCollection",geometries:se}:null}}}parts(j){this.expect("(");const U=[];do this.empty()||U.push(j());while(this.accept(","));return this.expect(")"),U}polygonBody(){return m(this.parts(()=>this.positionList()))}}function t(P){const j=new O(String(P).replace(/^\s*SRID\s*=\s*\d+\s*;/i,"")),U=j.geometry(0);return j.space(),j.at<j.text.length&&g(`WKT has unexpected text after the geometry at character ${j.at+1}`),U}function y(P){return Object.is(P,-0)?"0":String(P)}function I(P){return`${y(P[0])} ${y(P[1])}`}function B(P){return`(${P.map(I).join(", ")})`}function H(P){return`(${P.map(B).join(", ")})`}function Y(P){const j=J(P);return j?Q(j):""}function Q(P){switch(P.type){case"Point":return`POINT (${I(P.coordinates)})`;case"LineString":return`LINESTRING ${B(P.coordinates)}`;case"Polygon":return`POLYGON ${H(P.coordinates)}`;case"MultiPoint":return`MULTIPOINT (${P.coordinates.map(j=>`(${I(j)})`).join(", ")})`;case"MultiLineString":return`MULTILINESTRING (${P.coordinates.map(B).join(", ")})`;case"MultiPolygon":return`MULTIPOLYGON (${P.coordinates.map(H).join(", ")})`;default:return`GEOMETRYCOLLECTION (${P.geometries.map(Q).join(", ")})`}}class he{view;at=0;constructor(j){this.view=new DataView(j.buffer,j.byteOffset,j.byteLength)}need(j){this.at+j>this.view.byteLength&&g(`WKB ends after ${this.view.byteLength} bytes, in the middle of a geometry`)}u8(){return this.need(1),this.view.getUint8(this.at++)}u32(j){this.need(4);const U=this.view.getUint32(this.at,j);return this.at+=4,U}f64(j){this.need(8);const U=this.view.getFloat64(this.at,j);return this.at+=8,U}count(j,U){const se=this.u32(j);return se*U>this.view.byteLength-this.at&&g(`WKB claims ${se} elements, more than its bytes can hold`),se}position(j,U){const se=this.f64(j),Oe=this.f64(j);for(let xe=2;xe<U;xe++)this.f64(j);return[se,Oe]}positions(j,U){const se=this.count(j,8*U),Oe=new Array(se);for(let xe=0;xe<se;xe++)Oe[xe]=this.position(j,U);return Oe}geometry(j,U){j>q&&g("geometry collections nest too deeply");const se=this.u8();se!==0&&se!==1&&g(`WKB byte-order mark is ${se}, not 0 or 1`);const Oe=se===1,xe=this.u32(Oe);let je=2;xe&2147483648&&je++,xe&1073741824&&je++,xe&536870912&&this.u32(Oe);let Fe=xe&268435455;if(Fe>=1e3){const Be=Math.floor(Fe/1e3);Be>3&&g(`WKB geometry type ${Fe} is not one this reads`),je=2+(Be===3?2:1),Fe%=1e3}const Ie=ce[Fe-1];switch(Ie||g(`WKB geometry type ${Fe} is not one this reads`),U&&Ie!==U&&g(`a part of a WKB Multi${U} is a ${Ie}`),Ie){case"Point":{const Be=this.position(Oe,je);return Number.isNaN(Be[0])&&Number.isNaN(Be[1])?null:{type:"Point",coordinates:z(Be)}}case"LineString":return{type:"LineString",coordinates:A(this.positions(Oe,je),2,"a LineString")};case"Polygon":{const Be=this.count(Oe,4),Re=[];for(let Ke=0;Ke<Be;Ke++)Re.push(this.positions(Oe,je));return Be?{type:"Polygon",coordinates:m(Re)}:null}default:{const Be=this.count(Oe,5),Re=Ie==="GeometryCollection"?void 0:Ie.slice(5),Ke=[];for(let rt=0;rt<Be;rt++){const Nt=this.geometry(j+1,Re);Nt&&Ke.push(Nt)}return Ke.length?Ie==="GeometryCollection"?{type:Ie,geometries:Ke}:{type:Ie,coordinates:Ke.map(rt=>rt.coordinates)}:null}}}}function fe(P){const j=new he(P),U=j.geometry(0);return j.at!==P.byteLength&&g(`WKB has ${P.byteLength-j.at} bytes left over after the geometry`),U}function ue(P){const j=J(P);if(!j)return null;const U=[];let se=0;const Oe=Re=>{const Ke=new DataView(new ArrayBuffer(5));Ke.setUint8(0,1),Ke.setUint32(1,ce.indexOf(Re)+1,!0),U.push(Ke),se+=5},xe=Re=>{const Ke=new DataView(new ArrayBuffer(4));Ke.setUint32(0,Re,!0),U.push(Ke),se+=4},je=Re=>{const Ke=new DataView(new ArrayBuffer(16*Re.length));Re.forEach((rt,Nt)=>{Ke.setFloat64(Nt*16,rt[0],!0),Ke.setFloat64(Nt*16+8,rt[1],!0)}),U.push(Ke),se+=16*Re.length},Fe=Re=>{switch(Oe(Re.type),Re.type){case"Point":je([Re.coordinates]);break;case"LineString":xe(Re.coordinates.length),je(Re.coordinates);break;case"Polygon":xe(Re.coordinates.length);for(const Ke of Re.coordinates)xe(Ke.length),je(Ke);break;case"GeometryCollection":xe(Re.geometries.length);for(const Ke of Re.geometries)Fe(Ke);break;default:{const Ke=Re.type.slice(5);xe(Re.coordinates.length);for(const rt of Re.coordinates)Fe({type:Ke,coordinates:rt})}}};Fe(j);const Ie=new Uint8Array(se);let Be=0;for(const Re of U)Ie.set(new Uint8Array(Re.buffer),Be),Be+=Re.byteLength;return Ie}const W=/^0[01](?:[0-9a-fA-F]{2})+$/,N=/^[A-Za-z0-9+/_-]+={0,2}$/,ne=(()=>{const P=new Int16Array(128).fill(-1),j="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(let U=0;U<j.length;U++)P[j.charCodeAt(U)]=U;return P[45]=62,P[95]=63,P})();function l(P){const j=new Uint8Array(P.length/2);for(let U=0;U<j.length;U++)j[U]=parseInt(P.slice(U*2,U*2+2),16);return j}function e(P){const j=P.replace(/=+$/,""),U=new Uint8Array(Math.floor(j.length*3/4));let se=0,Oe=0,xe=0;for(let je=0;je<j.length;je++)Oe=Oe<<6|ne[j.charCodeAt(je)],se+=6,se>=8&&(se-=8,U[xe++]=Oe>>se&255);return U.subarray(0,xe)}function p(P){const j=P.trim();if(j==="")return null;if(j[0]==="{"){let U;try{U=JSON.parse(j)}catch{return g("the text starts like GeoJSON but is not valid JSON")}return c(U,0)}if(W.test(j))return fe(l(j));if(r.test(j))return t(j);if(N.test(j)){const U=e(j);if(U.length>=5&&(U[0]===0||U[0]===1))return fe(U)}return g("the text is not WKT, GeoJSON, or hex or base64 WKB")}const v=new WeakSet;function F(P){if(ee(P))return{geometry:null,reason:null};if(typeof P=="object"&&v.has(P))return{geometry:P,reason:null};try{let j;return typeof P=="string"?j=p(P):P instanceof Uint8Array?j=fe(P):P instanceof ArrayBuffer?j=fe(new Uint8Array(P)):ArrayBuffer.isView(P)?j=fe(new Uint8Array(P.buffer,P.byteOffset,P.byteLength)):o(P)?j=c(P,0):g(`${Array.isArray(P)?"an array":`a ${typeof P}`} is not a geometry`),j&&x(j),{geometry:j||null,reason:null}}catch(j){if(j instanceof T)return{geometry:null,reason:j.message};throw j}}function x(P){if(v.add(P),P.type==="GeometryCollection")for(const j of P.geometries)x(j)}function J(P){return F(P).geometry}function K(P,j){switch(P.type){case"Point":j(P.coordinates);break;case"MultiPoint":case"LineString":P.coordinates.forEach(j);break;case"MultiLineString":case"Polygon":for(const U of P.coordinates)U.forEach(j);break;case"MultiPolygon":for(const U of P.coordinates)for(const se of U)se.forEach(j);break;default:for(const U of P.geometries)K(U,j)}}function w(P,j){const U=P[1]*re,se=j[1]*re,Oe=se-U,xe=(j[0]-P[0])*re,je=Math.sin(Oe/2)**2+Math.cos(U)*Math.cos(se)*Math.sin(xe/2)**2;return 2*_*Math.asin(Math.min(1,Math.sqrt(je)))}function k(P){let j=0;for(let U=1;U<P.length;U++)j+=w(P[U-1],P[U]);return j}function D(P){const j=P.length-1;if(j<3)return 0;let U=0;for(let se=0;se<j;se++){const Oe=P[(se-1+j)%j],xe=P[(se+1)%j];U+=(xe[0]-Oe[0])*re*Math.sin(P[se][1]*re)}return Math.abs(U)*_*_/2}function ae(P){let j=D(P[0]);for(let U=1;U<P.length;U++)j-=D(P[U]);return Math.max(0,j)}function te(P){let j=0,U=0,se=0;for(let Oe=0;Oe<P.length-1;Oe++){const[xe,je]=P[Oe],[Fe,Ie]=P[Oe+1],Be=xe*Ie-Fe*je;j+=Be,U+=(xe+Fe)*Be,se+=(je+Ie)*Be}return{a:j,cx:U,cy:se}}function $(){let P=0,j=0,U=0;return{add(se,Oe,xe){P+=se*xe,j+=Oe*xe,U+=xe},get(){return U>0?[P/U,j/U]:null}}}function V(P){let j=0,U=0;for(const se of P)j+=se[0],U+=se[1];return[j/P.length,U/P.length]}function u(P,j){switch(P.type){case"Point":j[0].add(P.coordinates[0],P.coordinates[1],1);break;case"MultiPoint":for(const U of P.coordinates)j[0].add(U[0],U[1],1);break;case"LineString":case"MultiLineString":{const U=P.type==="LineString"?[P.coordinates]:P.coordinates;for(const se of U){for(let Oe=1;Oe<se.length;Oe++){const[xe,je]=se[Oe-1],[Fe,Ie]=se[Oe],Be=Math.hypot(Fe-xe,Ie-je);j[1].add((xe+Fe)/2,(je+Ie)/2,Be)}for(const Oe of se)j[0].add(Oe[0],Oe[1],1)}break}case"Polygon":case"MultiPolygon":{const U=P.type==="Polygon"?[P.coordinates]:P.coordinates;for(const se of U){let Oe=0,xe=0,je=0;se.forEach((Ie,Be)=>{const Re=te(Ie),Ke=(Be===0?1:-1)*(Re.a<0?-1:1);Oe+=Ke*Re.a,xe+=Ke*Re.cx,je+=Ke*Re.cy}),Math.abs(Oe)>S&&j[2].add(xe/(3*Oe),je/(3*Oe),Math.abs(Oe)/2);const Fe=se[0].slice(0,-1);for(const Ie of Fe)j[0].add(Ie[0],Ie[1],1)}break}default:for(const U of P.geometries)u(U,j)}}const f=new WeakMap;function L(P){const j=J(P);if(!j)return null;const U=f.get(j);if(U)return U;const se=[1/0,1/0,-1/0,-1/0];K(j,Re=>{Re[0]<se[0]&&(se[0]=Re[0]),Re[1]<se[1]&&(se[1]=Re[1]),Re[0]>se[2]&&(se[2]=Re[0]),Re[1]>se[3]&&(se[3]=Re[1])});const Oe=[$(),$(),$()];u(j,Oe);const xe=Oe[2].get()||Oe[1].get()||Oe[0].get()||V([[se[0],se[1]],[se[2],se[3]]]);let je=0,Fe=0;const Ie=Re=>{switch(Re.type){case"LineString":je+=k(Re.coordinates);break;case"MultiLineString":for(const Ke of Re.coordinates)je+=k(Ke);break;case"Polygon":Fe+=ae(Re.coordinates);for(const Ke of Re.coordinates)je+=k(Ke);break;case"MultiPolygon":for(const Ke of Re.coordinates){Fe+=ae(Ke);for(const rt of Ke)je+=k(rt)}break;case"GeometryCollection":for(const Ke of Re.geometries)Ie(Ke);break;default:break}};Ie(j);const Be=Object.freeze({kind:j.type,bbox:Object.freeze(se),centroid:Object.freeze(xe),length:je,area:Fe});return f.set(j,Be),Be}function s(P){const j=L(P);return j?j.kind:null}function E(P,j){const U=typeof P=="string"?P.split(/[\s,;]+/).filter(Boolean):P;if(!Array.isArray(U)||U.length!==j)return null;const se=U.map(Oe=>typeof Oe=="number"?Oe:typeof Oe=="string"?Number(Oe):NaN);return se.every(Number.isFinite)?se:null}function a(P,j){if(P==="withinBbox"){const U=E(j,4);return U?U[0]>U[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"'}:U[1]>U[3]?{reason:"the box's minLat is above its maxLat"}:{operand:U}:{reason:"withinBbox needs [minLon, minLat, maxLon, maxLat]"}}if(P==="withinDistance"){let U=null;if(o(j)&&!Array.isArray(j)){const se=j;U=E([se.lon,se.lat,se.metres],3)}else U=E(j,3);return!U||U[2]<0?{reason:"withinDistance needs { lon, lat, metres } with metres of 0 or more"}:{operand:{lon:U[0],lat:U[1],metres:U[2]}}}if(P==="withinPolygon"||P==="intersects"){const U=P==="intersects"?E(j,4):null;if(U){if(U[0]>U[2]||U[1]>U[3])return{reason:"the box's minimum is above its maximum"};const[xe,je,Fe,Ie]=U;return{operand:{type:"Polygon",coordinates:[[[xe,je],[Fe,je],[Fe,Ie],[xe,Ie],[xe,je]]]}}}const{geometry:se,reason:Oe}=F(j);return se?P==="withinPolygon"&&se.type!=="Polygon"&&se.type!=="MultiPolygon"?{reason:`withinPolygon needs a Polygon or MultiPolygon, not a ${se.type}`}:{operand:se}:{reason:`${P} needs a geometry: ${Oe||"none was given"}`}}return{reason:`"${P}" is not a spatial operator`}}function G(P,j){const[U,se]=P;let Oe=!1;for(let xe=0,je=j.length-2;xe<j.length-1;je=xe++){const[Fe,Ie]=j[xe],[Be,Re]=j[je];Ie>se!=Re>se&&U<(Be-Fe)*(se-Ie)/(Re-Ie)+Fe&&(Oe=!Oe)}return Oe}function C(P,j){if(!G(P,j[0]))return!1;for(let U=1;U<j.length;U++)if(G(P,j[U]))return!1;return!0}function oe(P,j={points:[],segments:[],polygons:[]}){const U=se=>{for(let Oe=1;Oe<se.length;Oe++)j.segments.push([se[Oe-1],se[Oe]]);for(const Oe of se)j.points.push(Oe)};switch(P.type){case"Point":j.points.push(P.coordinates);break;case"MultiPoint":for(const se of P.coordinates)j.points.push(se);break;case"LineString":U(P.coordinates);break;case"MultiLineString":P.coordinates.forEach(U);break;case"Polygon":j.polygons.push(P.coordinates),P.coordinates.forEach(U);break;case"MultiPolygon":for(const se of P.coordinates)j.polygons.push(se),se.forEach(U);break;default:for(const se of P.geometries)oe(se,j)}return j}function le(P,j,U){const se=(j[0]-P[0])*(U[1]-P[1])-(j[1]-P[1])*(U[0]-P[0]);return Math.abs(se)<=S?0:Math.sign(se)}function X(P,j,U){return P[0]>=Math.min(j[0],U[0])-S&&P[0]<=Math.max(j[0],U[0])+S&&P[1]>=Math.min(j[1],U[1])-S&&P[1]<=Math.max(j[1],U[1])+S}function Z(P,j){const[U,se]=P,[Oe,xe]=j,je=le(U,se,Oe),Fe=le(U,se,xe),Ie=le(Oe,xe,U),Be=le(Oe,xe,se);return je!==Fe&&Ie!==Be?!0:je===0&&X(Oe,U,se)||Fe===0&&X(xe,U,se)||Ie===0&&X(U,Oe,xe)||Be===0&&X(se,Oe,xe)}function we(P,j){return P[0]<=j[2]&&j[0]<=P[2]&&P[1]<=j[3]&&j[1]<=P[3]}function Se(P,j){const U=L(P),se=L(j);if(!we(U.bbox,se.bbox))return!1;const Oe=oe(P),xe=oe(j);for(const je of xe.polygons)for(const Fe of Oe.points)if(C(Fe,je))return!0;for(const je of Oe.polygons)for(const Fe of xe.points)if(C(Fe,je))return!0;for(const je of Oe.segments)for(const Fe of xe.segments)if(Z(je,Fe))return!0;for(const je of Oe.points){for(const Fe of xe.points)if(Math.abs(je[0]-Fe[0])<=S&&Math.abs(je[1]-Fe[1])<=S)return!0;for(const Fe of xe.segments)if(le(Fe[0],Fe[1],je)===0&&X(je,Fe[0],Fe[1]))return!0}for(const je of xe.points)for(const Fe of Oe.segments)if(le(Fe[0],Fe[1],je)===0&&X(je,Fe[0],Fe[1]))return!0;return!1}function Ae(P,j){const{operand:U,reason:se}=a(P,j);if(se)return ye(`filter:geometry:${P}`,`a "${P}" condition was refused: ${se}. It matches no row rather than guessing.`),()=>!1;switch(P){case"withinBbox":return Oe=>{const xe=L(Oe);if(!xe)return!1;const je=xe.bbox;return je[0]>=U[0]&&je[1]>=U[1]&&je[2]<=U[2]&&je[3]<=U[3]};case"withinPolygon":{const Oe=U.type==="Polygon"?[U.coordinates]:U.coordinates,xe=je=>Oe.some(Fe=>C(je,Fe));return je=>{const Fe=J(je);return Fe?Fe.type==="Point"?xe(Fe.coordinates):Fe.type==="MultiPoint"?Fe.coordinates.every(xe):xe(L(Fe).centroid):!1}}case"intersects":return Oe=>{const xe=J(Oe);return!!xe&&Se(xe,U)};default:{const Oe=[U.lon,U.lat];return xe=>{const je=L(xe);return!!je&&w(je.centroid,Oe)<=U.metres}}}}}),Ve("packages/core/src/source/filterwire.js",function(n,de){"use strict";Object.defineProperty(n,"HOST_FILTER_WARN_ID",{enumerable:!0,get:function(){return o}}),Object.defineProperty(n,"WHERE_PAGE_RELATIVE_WARN_ID",{enumerable:!0,get:function(){return ye}}),Object.defineProperty(n,"warnWherePageRelative",{enumerable:!0,get:function(){return ce}}),Object.defineProperty(n,"warnHostFilterNotApplied",{enumerable:!0,get:function(){return me}}),Object.defineProperty(n,"WHERE_NOT_APPLIED_WARN_ID",{enumerable:!0,get:function(){return R}}),Object.defineProperty(n,"warnWhereNotApplied",{enumerable:!0,get:function(){return _}}),Object.defineProperty(n,"WHERE_OVER_THRESHOLD_WARN_ID",{enumerable:!0,get:function(){return re}}),Object.defineProperty(n,"warnWhereOverThreshold",{enumerable:!0,get:function(){return q}}),Object.defineProperty(n,"RELATIVE_TOKENS",{enumerable:!0,get:function(){return c}}),Object.defineProperty(n,"parseRelativeToken",{enumerable:!0,get:function(){return h}}),Object.defineProperty(n,"resolveRelativeRange",{enumerable:!0,get:function(){return M}}),Object.defineProperty(n,"relativeTokenOf",{enumerable:!0,get:function(){return b}}),Object.defineProperty(n,"relativeTokenHelp",{enumerable:!0,get:function(){return r}}),Object.defineProperty(n,"isResolvableRelative",{enumerable:!0,get:function(){return O}}),Object.defineProperty(n,"resolveRelativeCondition",{enumerable:!0,get:function(){return t}}),Object.defineProperty(n,"isGroup",{enumerable:!0,get:function(){return y}}),Object.defineProperty(n,"forEachCondition",{enumerable:!0,get:function(){return I}}),Object.defineProperty(n,"mapConditions",{enumerable:!0,get:function(){return B}}),Object.defineProperty(n,"normaliseFilterSet",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(n,"buildFilterSet",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(n,"wireFilters",{enumerable:!0,get:function(){return he}}),Object.defineProperty(n,"querySignature",{enumerable:!0,get:function(){return fe}});const ee=de("packages/core/src/internal/util.js").warnOnce,o="source.remote.hostFilter",ye="source.where.pageRelative";function ce(N,ne){!Array.isArray(N)||!N.length||ee(ye,`filters.where (${N.join(", ")}) runs over the rows the ${ne} 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 me(N){const ne=(N||{}).config;!ne||!ne.hostFilter||ee(o,"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 R="source.where.notApplied";function _(N,ne){ee(`${R}:${N}`,`filters.where("${N}") is registered but the ${ne} 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 q(N,ne,l,e){!Array.isArray(N)||!N.length||ee(`${re}:${ne}`,`filters.where (${N.join(", ")}) is not applied to the ${ne} pushdown source:`,l===null?"the adapter reports no row total, so the size of the matching set is unknown.":`its matching set is ${l.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 S=new Map;function T(N){let ne=S.get(N);return ne||(ne=new Intl.DateTimeFormat("en-US",{timeZone:N,hourCycle:"h23",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}),S.set(N,ne)),ne}function g(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone||"UTC"}catch{return"UTC"}}function z(N,ne){const l=T(ne).formatToParts(new Date(N)),e={y:1970,m:1,d:1,h:0,mi:0,s:0};for(const p of l)p.type==="year"?e.y=+p.value:p.type==="month"?e.m=+p.value:p.type==="day"?e.d=+p.value:p.type==="hour"?e.h=+p.value%24:p.type==="minute"?e.mi=+p.value:p.type==="second"&&(e.s=+p.value);return e}function A(N,ne){const l=z(N,ne);return Date.UTC(l.y,l.m-1,l.d,l.h,l.mi,l.s)-Math.floor(N/1e3)*1e3}function i(N,ne,l,e){const p=Date.UTC(N,ne-1,l),v=p-A(p,e);return p-A(v,e)}function m(N,ne,l){const e=new Date(Date.UTC(N.y,N.m-1,N.d+ne));return i(e.getUTCFullYear(),e.getUTCMonth()+1,e.getUTCDate(),l)}const c=Object.freeze(["today","yesterday","lastNDays","thisWeek","thisMonth","thisQuarter","thisYear","quarterToDate","yearToDate"]);function h(N,ne){if(typeof N!="string")return null;const l=N.trim().toLowerCase().replace(/[\s_-]+/g,""),e=/^last(\d*|n)days?$/.exec(l);if(e){const p=e[1]==="n"?"":e[1],v=Number(p||ne);return!Number.isFinite(v)||v<=0?null:{kind:"lastNDays",n:Math.floor(v)}}switch(l){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 M(N,ne={}){const l=h(N,ne.n);if(!l)return null;const e=ne.tz||g(),p=ne.now instanceof Date?ne.now.getTime():typeof ne.now=="number"?ne.now:Date.now(),v=z(p,e),F=i(v.y,v.m,v.d,e),x=m(v,1,e);let J=F,K=x;switch(l.kind){case"today":break;case"yesterday":J=m(v,-1,e),K=F;break;case"lastNDays":K=ne.includeToday?x:F,J=m(v,ne.includeToday?-(l.n-1):-l.n,e);break;case"thisWeek":{const w=Number.isFinite(ne.weekStartsOn)?Number(ne.weekStartsOn):1,D=(new Date(Date.UTC(v.y,v.m-1,v.d)).getUTCDay()-w+7)%7;J=m(v,-D,e),K=m(v,-D+7,e);break}case"thisMonth":J=i(v.y,v.m,1,e),K=i(v.m===12?v.y+1:v.y,v.m===12?1:v.m+1,1,e);break;case"thisQuarter":case"quarterToDate":{const w=Math.floor((v.m-1)/3)*3+1;J=i(v.y,w,1,e),K=l.kind==="quarterToDate"?x:w===10?i(v.y+1,1,1,e):i(v.y,w+3,1,e);break}case"thisYear":case"yearToDate":J=i(v.y,1,1,e),K=l.kind==="yearToDate"?x:i(v.y+1,1,1,e);break;default:return null}return{from:new Date(J).toISOString(),to:new Date(K).toISOString(),bounds:"[)",tz:e,relative:l.kind==="lastNDays"?`last${l.n}Days`:l.kind,n:l.n}}function b(N){if(!N||typeof N!="object")return null;const ne=N.value;if(ne&&typeof ne=="object"&&!Array.isArray(ne)&&"relative"in ne)return{token:String(ne.relative),n:typeof ne.n=="number"?ne.n:void 0};if(N.op==="relative"&&typeof N.value=="string")return{token:N.value,n:void 0};const l=N.meta;return l&&typeof l.relative=="string"&&N.value===void 0?{token:l.relative,n:typeof l.n=="number"?l.n:void 0}:null}function r(){return`Known tokens: ${c.filter(ne=>ne!=="lastNDays").join(", ")}. "lastNDays" needs a count: pass "last7Days", or the value object { relative: 'lastNDays', n: 7 }.`}function O(N){const ne=b(N);return ne?h(ne.token,ne.n)!==null:!1}function t(N,ne={}){const l=b(N);if(!l)return N;const e=M(l.token,{...ne,n:l.n});return e?{...N,type:N.type||"date",op:"between",value:[e.from,e.to],bounds:N.bounds||e.bounds,meta:{...N.meta||{},relative:e.relative,tz:e.tz}}:(ee(`source.relative.${l.token}`,`unknown relative date token "${l.token}"; sending the condition unresolved.`,r()),N)}function y(N){return!!N&&typeof N=="object"&&Array.isArray(N.conditions)}function I(N,ne){if(N){if(y(N)){for(const l of N.conditions)I(l,ne);return}ne(N)}}function B(N,ne){if(!N)return null;if(!y(N))return ne(N);const l=N;let e=!1;const p=[];for(const v of l.conditions){const F=B(v,ne);F!==v&&(e=!0),F&&p.push(F)}return!e&&p.length===l.conditions.length?N:p.length?{...l,conditions:p}:null}function H(N){if(!N)return null;if(!y(N))return N;const ne=N,l=[];for(const e of ne.conditions){const p=H(e);p&&l.push(p)}return l.length?{op:ne.op,conditions:l}:null}function Y(N){const ne=H(N);return ne?y(ne)&&ne.op==="and"?ne:{op:"and",conditions:[ne]}:null}function Q(N){const ne=(N||[]).filter(Boolean);return ne.length?{op:"and",conditions:ne}:null}function he(N,ne={}){const l=B(N,e=>t(e,ne));return Y(l)}function fe(N){const ne=ue(N.filters??null);return JSON.stringify([ne,N.sort??null,N.quick??"",N.groupBy??null,N.pivotBy??null,W(N.context)])}function ue(N){if(!N)return null;if(y(N)){const e=N;return{op:e.op,conditions:e.conditions.map(ue)}}const ne=N,l=ne.meta&&typeof ne.meta.relative=="string"?ne.meta.relative:b(ne)?.token;return{col:ne.col,op:ne.op,bounds:ne.bounds??null,caseSensitive:ne.caseSensitive??!1,value:l?`rel:${l}`:ne.value??null}}function W(N){if(N==null)return null;try{return JSON.parse(JSON.stringify(N))}catch{return ee("source.context.unserialisable","config.context is not JSON-serialisable; cache keys ignore it."),"[unserialisable]"}}}),Ve("packages/core/src/source/aggregates.js",function(n,de){"use strict";Object.defineProperty(n,"STAT_PUSHDOWN",{enumerable:!0,get:function(){return Ne}}),Object.defineProperty(n,"pushableAggregates",{enumerable:!0,get:function(){return ee}}),Object.defineProperty(n,"fillAggregateSql",{enumerable:!0,get:function(){return o}}),Object.defineProperty(n,"resolveAggregatesConfig",{enumerable:!0,get:function(){return ye}}),Object.defineProperty(n,"routeAggregate",{enumerable:!0,get:function(){return ce}}),Object.defineProperty(n,"resolveAggregatePlan",{enumerable:!0,get:function(){return me}}),Object.defineProperty(n,"groupKeysPushable",{enumerable:!0,get:function(){return _}}),Object.defineProperty(n,"pushdownDocRows",{enumerable:!0,get:function(){return re}});const Ne=Object.freeze({sum:{pushable:!0,class:"identical",sql:"sum(%c)"},avg:{pushable:!0,class:"identical",sql:"avg(%c)"},min:{pushable:!0,class:"identical",sql:"min(%c)"},max:{pushable:!0,class:"identical",sql:"max(%c)"},count:{pushable:!0,class:"identical",sql:"count(*)"},countValues:{pushable:!0,class:"identical",sql:"count(%c)",blankAware:!0},range:{pushable:!0,class:"identical",sql:"(max(%c) - min(%c))"},variance:{pushable:!0,class:"identical",sql:"var_samp(%c)"},varianceP:{pushable:!0,class:"identical",sql:"var_pop(%c)"},stddev:{pushable:!0,class:"identical",sql:"stddev_samp(%c)"},stddevP:{pushable:!0,class:"identical",sql:"stddev_pop(%c)"},sumSquares:{pushable:!0,class:"identical",sql:"sum(%c * %c)"},median:{pushable:!0,class:"identical",sql:"median(%c)"},p25:{pushable:!0,class:"identical",sql:"quantile_cont(%c, 0.25)"},p75:{pushable:!0,class:"identical",sql:"quantile_cont(%c, 0.75)"},p90:{pushable:!0,class:"identical",sql:"quantile_cont(%c, 0.9)"},p95:{pushable:!0,class:"identical",sql:"quantile_cont(%c, 0.95)"},p99:{pushable:!0,class:"identical",sql:"quantile_cont(%c, 0.99)"},iqr:{pushable:!0,class:"identical",sql:"(quantile_cont(%c, 0.75) - quantile_cont(%c, 0.25))"},mad:{pushable:!0,class:"identical",sql:"mad(%c)"},distinct:{pushable:!0,class:"identical",sql:"count(DISTINCT %c)",blankAware:!0},skewness:{pushable:!0,class:"identical",sql:"skewness(%c)"},kurtosis:{pushable:!0,class:"identical",sql:"kurtosis(%c)"},geomean:{pushable:!0,class:"identical",sql:"exp(avg(ln(%c)))"},harmean:{pushable:!0,class:"identical",sql:"(count(%c) / sum(1.0 / %c))"},entropy:{pushable:!0,class:"identical",sql:"entropy(%c)",blankAware:!0},correlation:{pushable:!0,class:"identical",sql:"corr(%w, %c)",twoColumn:!0},hhi:{pushable:!0,class:"identical",blankAware:!0,sql:"CASE WHEN count(%c)=0 THEN NULL ELSE list_sum(list_transform(map_values(histogram(%c)), lambda v: (v::DOUBLE/count(%c))*(v::DOUBLE/count(%c)))) END"},evenness:{pushable:!0,class:"identical",blankAware:!0,sql:"CASE WHEN count(%c)=0 THEN NULL WHEN count(DISTINCT %c)<2 THEN 1.0 ELSE entropy(%c)/log2(count(DISTINCT %c)) END"},top3Share:{pushable:!0,class:"identical",blankAware:!0,sql:"CASE WHEN count(%c)=0 THEN NULL ELSE list_sum(list_slice(list_sort(map_values(histogram(%c)),'DESC'),1,3))::DOUBLE/count(%c) END"},top10Share:{pushable:!0,class:"identical",blankAware:!0,sql:"CASE WHEN count(%c)=0 THEN NULL ELSE list_sum(list_slice(list_sort(map_values(histogram(%c)),'DESC'),1,10))::DOUBLE/count(%c) END"},gini:{pushable:!0,class:"identical",sql:"CASE WHEN list_min(list(%c) FILTER (WHERE isfinite(%c)))<0 THEN NULL WHEN len(list(%c) FILTER (WHERE isfinite(%c)))=0 THEN NULL WHEN list_sum(list(%c) FILTER (WHERE isfinite(%c)))=0 THEN 0 ELSE 2.0*list_sum(list_transform(list_sort(list(%c) FILTER (WHERE isfinite(%c))), lambda v, i: i*v))/(len(list(%c) FILTER (WHERE isfinite(%c)))*list_sum(list(%c) FILTER (WHERE isfinite(%c))))-(len(list(%c) FILTER (WHERE isfinite(%c)))+1.0)/len(list(%c) FILTER (WHERE isfinite(%c))) END"},trimmedMean:{pushable:!0,class:"identical",sql:"CASE WHEN len(list(%c) FILTER (WHERE isfinite(%c)))=0 THEN NULL ELSE list_avg(list_slice(list_sort(list(%c) FILTER (WHERE isfinite(%c))), floor(len(list(%c) FILTER (WHERE isfinite(%c)))*0.1)::BIGINT+1, len(list(%c) FILTER (WHERE isfinite(%c)))-floor(len(list(%c) FILTER (WHERE isfinite(%c)))*0.1)::BIGINT)) END"},winsorizedMean:{pushable:!0,class:"identical",sql:"CASE WHEN len(list(%c) FILTER (WHERE isfinite(%c)))=0 THEN NULL ELSE list_avg(list_transform(list_sort(list(%c) FILTER (WHERE isfinite(%c))), lambda v: least(list_sort(list(%c) FILTER (WHERE isfinite(%c)))[len(list(%c) FILTER (WHERE isfinite(%c)))-floor(len(list(%c) FILTER (WHERE isfinite(%c)))*0.1)::BIGINT], greatest(list_sort(list(%c) FILTER (WHERE isfinite(%c)))[floor(len(list(%c) FILTER (WHERE isfinite(%c)))*0.1)::BIGINT+1], v)))) END"},robustOutliers:{pushable:!0,class:"identical",sql:"(SELECT CASE WHEN len(d.a)=0 THEN NULL WHEN d.mad=0 THEN NULL ELSE len(list_filter(d.a, lambda v: abs(0.6745*(v-d.med)/d.mad)>3.5)) END FROM (SELECT xs AS a, list_median(xs) AS med, list_median(list_transform(xs, lambda w: abs(w-list_median(xs)))) AS mad FROM (SELECT list(%c) FILTER (WHERE isfinite(%c)) AS xs)) d)"},jarqueBera:{pushable:!0,class:"identical",sql:"CASE WHEN len(list(%c) FILTER (WHERE isfinite(%c)))<8 THEN NULL WHEN list_avg(list_transform(list(%c) FILTER (WHERE isfinite(%c)), lambda v: power(v-list_avg(list(%c) FILTER (WHERE isfinite(%c))),2)))=0 THEN NULL ELSE (len(list(%c) FILTER (WHERE isfinite(%c)))/6.0)*(power(list_avg(list_transform(list(%c) FILTER (WHERE isfinite(%c)), lambda v: power(v-list_avg(list(%c) FILTER (WHERE isfinite(%c))),3)))/power(list_avg(list_transform(list(%c) FILTER (WHERE isfinite(%c)), lambda v: power(v-list_avg(list(%c) FILTER (WHERE isfinite(%c))),2))),1.5),2)+power(list_avg(list_transform(list(%c) FILTER (WHERE isfinite(%c)), lambda v: power(v-list_avg(list(%c) FILTER (WHERE isfinite(%c))),4)))/power(list_avg(list_transform(list(%c) FILTER (WHERE isfinite(%c)), lambda v: power(v-list_avg(list(%c) FILTER (WHERE isfinite(%c))),2))),2)-3,2)/4.0) END"},weightedAvg:{pushable:!0,class:"identical",twoColumn:!0,sql:"sum(%c*%w) FILTER (WHERE isfinite(%c) AND isfinite(%w))/nullif(sum(%w) FILTER (WHERE isfinite(%c) AND isfinite(%w)),0)"},mode:{pushable:!0,class:"may-differ",sql:"mode(%c)",note:"DuckDB returns a modal value even for an all-distinct column; the grid returns null. Tie-breaking can also differ, and on a text column an empty string counts as a value. Under pushdown you will see a value."},weightedQuantile:{pushable:!1,class:"fallback",note:"No SQL equivalent for the grid's weighted-quantile midpoint convention; always computed client-side (needs a full-dataset pull for a correct figure over a remote source)."}});function ee(){const q=new Set;for(const[S,T]of Object.entries(Ne))T.pushable&&q.add(S);return q}function o(q,S,T){let g=q.split("%c").join(S);return T!==void 0&&(g=g.split("%w").join(T)),g}function ye(q){const S=q||{},T=S.default==="engine"||S.default==="engine-if-identical"?S.default:"client",g={};if(S.overrides&&typeof S.overrides=="object")for(const[z,A]of Object.entries(S.overrides))(A==="engine"||A==="client")&&(g[z]=A);return{default:T,overrides:g}}function ce(q,S){const T=Ne[q];if(!T||!T.pushable)return"client";const g=S.overrides[q];return g==="engine"||g==="client"?g:S.default==="client"?"client":S.default==="engine-if-identical"?T.class==="identical"?"engine":"client":"engine"}function me(q,S){const T=ye(S),g=[],z=[];for(const A of q||[]){const i=Ne[A.fn],m=ce(A.fn,T),c={id:A.id,col:A.col,fn:A.fn,class:i?i.class:"fallback"};A.weight!==void 0&&(c.weight=A.weight),A.params!==void 0&&(c.params=A.params),m==="engine"?g.push(c):(c.reason=i&&!i.pushable?i.note||"the engine cannot express this stat":"client by config",z.push(c))}return{engine:g,client:z,config:T}}const R=/^[A-Za-z_][A-Za-z0-9_$]*$/;function _(q,S=[]){return(q||[]).every(g=>{if(typeof g=="string")return R.test(g);if(!g||typeof g!="object")return!1;const z=g;return Array.isArray(S)&&S.includes(z.bucket)&&typeof z.col=="string"&&R.test(z.col)&&typeof z.size=="number"&&Number.isFinite(z.size)&&z.size>0})}function re(){return Object.entries(Ne).map(([q,S])=>({stat:q,class:S.class,sql:S.sql?o(S.sql,"col",S.twoColumn?"weight":void 0):"",note:S.note||(S.class==="identical"?"Pushes to DuckDB with the same result.":"")}))}}),Ve("packages/core/src/source/abort.js",function(n,de){"use strict";Object.defineProperty(n,"SupersededError",{enumerable:!0,get:function(){return Ne}}),Object.defineProperty(n,"RequestToken",{enumerable:!0,get:function(){return ee}}),Object.defineProperty(n,"AbortScope",{enumerable:!0,get:function(){return o}}),Object.defineProperty(n,"createAbortScope",{enumerable:!0,get:function(){return ye}}),Object.defineProperty(n,"isAbortError",{enumerable:!0,get:function(){return ce}});class Ne extends Error{constructor(R,_="superseded"){super(`[lattice] request ${R?`"${R}" `:""}${_}`),this.name="SupersededError",this.superseded=!0,this.key=R}}class ee{#e;constructor(R,_,re,q){this.#e=R,this.key=_,this.controller=re,this.signal=re.signal,this.seq=q}get current(){return!this.signal.aborted&&this.#e.tokenFor(this.key)===this}settle(){this.#e.settle(this)}abort(R){this.signal.aborted||this.controller.abort(new Ne(this.key,R)),this.#e.settle(this)}}class o{#e=new Map;#t=0;begin(R="",_="superseded"){const re=this.#e.get(R);re&&!re.signal.aborted&&re.controller.abort(new Ne(R,_));const q=new ee(this,R,new AbortController,++this.#t);return this.#e.set(R,q),q}tokenFor(R){return this.#e.get(R)}pending(R=""){const _=this.#e.get(R);return!!_&&!_.signal.aborted}get size(){return this.#e.size}settle(R){this.#e.get(R.key)===R&&this.#e.delete(R.key)}abort(R="",_="superseded"){const re=this.#e.get(R);re&&re.abort(_)}abortAll(R="superseded"){for(const _ of[...this.#e.values()])_.abort(R);this.#e.clear()}}function ye(){return new o}function ce(me){if(!me||typeof me!="object")return!1;const R=me;return R.superseded===!0||R.name==="AbortError"||R.name==="SupersededError"}}),Ve("packages/core/src/source/pushdown.js",function(n,de){"use strict";Object.defineProperty(n,"FOREGROUND_WAIT_MS",{enumerable:!0,get:function(){return i}}),Object.defineProperty(n,"NO_CAPABILITIES",{enumerable:!0,get:function(){return c}}),Object.defineProperty(n,"resolveMutate",{enumerable:!0,get:function(){return h}}),Object.defineProperty(n,"capabilitiesOf",{enumerable:!0,get:function(){return r}}),Object.defineProperty(n,"splitFilters",{enumerable:!0,get:function(){return t}}),Object.defineProperty(n,"LEAF_COUNT_ID",{enumerable:!0,get:function(){return y}}),Object.defineProperty(n,"PIVOT_UNSUPPORTED",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(n,"GROUP_UNSUPPORTED",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(n,"UNGROUPED_LEVEL",{enumerable:!0,get:function(){return he}}),Object.defineProperty(n,"planQuery",{enumerable:!0,get:function(){return ue}}),Object.defineProperty(n,"applyResidual",{enumerable:!0,get:function(){return ne}}),Object.defineProperty(n,"DEFAULT_WHERE_ROW_LIMIT",{enumerable:!0,get:function(){return v}}),Object.defineProperty(n,"createPushdownSource",{enumerable:!0,get:function(){return K}});const Ne=de("packages/core/src/internal/util.js"),ee=Ne.defaultCompare,o=Ne.isFunction,ye=Ne.toArray,ce=Ne.warnOnce,me=de("packages/core/src/source/filterwire.js"),R=me.isGroup,_=me.warnWherePageRelative,re=me.warnWhereOverThreshold,q=de("packages/core/src/source/aggregates.js"),S=q.resolveAggregatePlan,T=q.groupKeysPushable,g=q.STAT_PUSHDOWN,A=de("packages/core/src/source/abort.js").SupersededError,i=1e3;function m(w){const k=w&&w.signal;if(!k||!k.aborted)return;const D=k.reason;throw D instanceof Error?D:new A("","superseded before it was sent")}const c=Object.freeze({filter:!1,operators:Object.freeze([]),sort:!1,quick:!1,range:!1,total:!1,group:!1,pivot:!1,mutate:!1});function h(w){if(!w||typeof w!="object")return!1;const k=w.returning==="row"||w.returning==="key"?w.returning:"none";return{append:w.append===!0,update:w.update===!0,delete:w.delete===!0,returning:k}}function M(w,k){if(!w||typeof k!="string")return;if(!k.includes("."))return w[k];let D=w;for(const ae of k.split(".")){if(D===null||typeof D!="object")return;D=D[ae]}return D}function b(w){if(w===!0)return!0;if(!w||typeof w!="object")return!1;const k=w;return k.enabled===!1?!1:k.enabled===!0||o(k.commit)}function r(w){const k={...c,...w||{}};return k.operators=new Set(k.operators||[]),k.mutate=h(k.mutate),k}function O(w,k){return!w||!w.op||!k.operators.size?!1:k.operators.has(w.op)}function t(w,k){if(!w)return{pushed:null,residual:null};if(!k.filter)return{pushed:null,residual:w};if(k.filter==="term"){if(R(w)){const $=w.conditions||[];if(String(w.op)!=="and")return{pushed:null,residual:w};const V=$.findIndex(f=>!R(f)&&O(f,k));if(V<0)return{pushed:null,residual:w};const u=$.filter((f,L)=>L!==V);return{pushed:$[V],residual:u.length?{op:"and",conditions:u}:null}}return O(w,k)?{pushed:w,residual:null}:{pushed:null,residual:w}}if(!R(w))return O(w,k)?{pushed:w,residual:null}:{pushed:null,residual:w};if(String(w.op)!=="and")return(w.conditions||[]).every(V=>R(V)?t(V,k).residual===null:O(V,k))?{pushed:w,residual:null}:{pushed:null,residual:w};const D=[],ae=[];for(const $ of w.conditions||[]){if(R($)){if(k.filter==="flat"){ae.push($);continue}const V=t($,k);V.pushed&&D.push(V.pushed),V.residual&&ae.push(V.residual);continue}(O($,k)?D:ae).push($)}const te=$=>$.length===0?null:$.length===1?$[0]:{op:"and",conditions:$};return{pushed:te(D),residual:te(ae)}}const y="__lattice_leaves";function I(w){return w.aggregates?w.aggregates instanceof Set?w.aggregates:new Set(ye(w.aggregates)):new Set}function B(w){const k=I(w);return k.size?k.has("count")?w.filter!=="tree"||!w.operators||!w.operators.has("eq")?"the adapter does not declare the `group` capability, and cannot narrow a group's rows by its key (that needs a `tree` filter with the `eq` operator)":"":"the adapter does not declare the `group` capability, and its declared aggregates have no `count` to give each group its row count":"the adapter does not declare the `group` capability"}function H(w,k,D,ae,te,$,V){const u=Array.isArray(w.groupBy)?w.groupBy:[],f=Array.isArray(w.groupPath)?w.groupPath:[],L=Array.isArray(w.groupValues)?w.groupValues:null;if(!k.group){const s=B(k);if(s)return s}return T(u)?D.residual?"the filter did not fully push, so the engine would group a superset of the matching rows":ae?te?$?"a host `where` predicate can only run in the browser, over rows the engine grouped":V?"fullDataset holds the whole matching set, so the grid groups it itself":!L||L.length!==f.length?"the request carries no typed `groupValues` for its group path, and the string `groupPath` cannot be compared against a typed column":"":"a quick search did not push, so the engine would group unsearched rows":"the sort did not push, so the engine would order the groups differently":"a grouping key is not a plain column the engine can name in a GROUP BY"}const Y="pushdown:pivot-unsupported",Q="pushdown:group-unsupported",he=Symbol("lattice.remote.ungroupedLevel");function fe(w,k,D,ae,te,$){const V=Array.isArray(w.pivotBy)?w.pivotBy:[],u=Array.isArray(w.groupBy)?w.groupBy:[],f=Array.isArray(w.groupPath)?w.groupPath:[],L=Array.isArray(w.groupValues)?w.groupValues:null;return k.pivot?T(V)?u.length&&!T(u)?"a grouping key is not a plain column the engine can name in a GROUP BY":D.residual?"the filter did not fully push, so the engine would pivot a superset of the matching rows":ae?te?$?"a host `where` predicate can only run in the browser, over rows the engine pivoted":!L||L.length!==f.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 ue(w,k,D=!1){const ae=t(w.filters||null,k),te=[];ae.residual&&te.push("filter");const $=w.sort||[],V=$.length===0||k.sort==="multi"&&$.length>=1||k.sort==="single"&&$.length===1;!V&&$.length&&te.push("sort");const u=w.quick?String(w.quick):"",f=!u||!!k.quick;f||te.push("quick");const L=w.where&&w.where.active?w.where:null;L&&te.push("where");const s={filters:ae.residual,sort:V?null:$,quick:f?"":u,where:L},E=!!D,a=Array.isArray(w.groupBy)&&w.groupBy.length>0,G=a?H(w,k,ae,V,f,L,E):"",C=w.pivotMode!==!1&&Array.isArray(w.pivotBy)&&w.pivotBy.length>0,oe=C?fe(w,k,ae,V,f,L):"",le=C&&oe==="";C&&!le&&te.push("pivot");const X=C?le&&a:a&&G==="";a&&!C&&!X&&te.push("group");const Z=(X||le)&&Array.isArray(w.groupValues)?w.groupValues.length:0,we=X||C?!1:E||!!(s.filters||s.sort||s.quick||s.where)||!k.range;return{pushed:{...w,filters:ae.pushed,sort:V?$:[],quick:f?u:"",range:we?null:w.range},residual:s,needsAll:we,unpushed:te,full:E,grouped:X,groupLevel:Z,groupReason:C?"":G,pivoted:le,pivotReason:oe}}function W(w){const k=Array.isArray(w.totals)?w.totals:[],D=w.totalFns&&typeof w.totalFns=="object"?w.totalFns:{},ae=[],te=[];for(const $ of k){const V=String($),u=typeof D[V]=="string"?D[V]:null,f=u?g[u]:null;u?!f||!f.pushable||!f.sql?te.push({id:V,fn:u,class:f?f.class:"fallback",reason:f&&f.note?f.note:`the pushdown map cannot express "${u}"`}):f.twoColumn?te.push({id:V,fn:u,class:f.class,reason:`"${u}" reduces two columns, and a grouped request carries no weight column`}):ae.push({id:V,col:V,fn:u,class:f.class}):te.push({id:V,fn:null,class:"fallback",reason:"the column totals with a host function, so there is no named statistic to push"})}return{engine:ae,client:te}}const N=Object.freeze({items:w=>w==null?[]:Array.isArray(w)?w:[w]});function ne(w,k,D){if(!k)return w;let ae=w;if(k.filters&&o(D.evaluateFilters)){const te=ae,$={count:ae.length,handle:f=>({id:f,get:L=>M(te[L],f)}),itemwise:f=>te.some(L=>Array.isArray(M(L,f)))?N:null},V=D.evaluateFilters(k.filters,$),u=[];for(let f=0;f<ae.length;f++)V[f]&&u.push(ae[f]);ae=u}if(k.where&&k.where.active&&(k.whole||_(k.where.names,"pushdown"),ae=ae.filter(te=>k.where.passes(te))),k.quick){const te=k.quick.toLowerCase();ae=ae.filter($=>{if(!$||typeof $!="object")return!1;for(const V of Object.values($))if(V!=null&&String(V).toLowerCase().includes(te))return!0;return!1})}if(k.sort&&k.sort.length&&o(D.sortMulti)){const te=[...new Set(k.sort.map(f=>f.col))],$=ae,V=te.map(f=>({id:f,get:L=>M($[L],f)})),u=D.sortMulti(V,k.sort.map(f=>({col:f.col,dir:f.dir})),Uint32Array.from({length:ae.length},(f,L)=>L),{});ae=Array.from(u,f=>$[f])}return ae}function l(w){return JSON.stringify({filters:w.filters||null,sort:w.sort||[],quick:w.quick||"",groupBy:w.groupBy||[],groupPath:w.groupPath||[],context:w.context??null})}function e(w){if(!w||typeof w!="object")return 16;let k="";try{k=JSON.stringify(w)}catch{return 200}return k.length*2+64}function p(w){const k=w||{};return{enabled:!!k.enabled,maxRows:Number.isFinite(k.maxRows)?k.maxRows:1e6,maxBytesEstimate:Number.isFinite(k.maxBytesEstimate)?k.maxBytesEstimate:512*1024*1024}}const v=5e4;function F(w){return Number.isFinite(w)&&w>=0?w:v}function x(w){return!!w&&o(w.then)}async function J(w){if(!w||w.total!==void 0||!x(w.pendingTotal))return w;const k=await w.pendingTotal,{pendingTotal:D,...ae}=w;return typeof k=="number"?{...ae,total:k}:ae}function K(w={}){const k=w.adapter;if(!k||!o(k.execute))return ce("source.pushdown.adapter","createPushdownSource needs an `adapter` with an `execute(query)` function."),{...w,mode:"remote",fetch:async()=>({rows:[],total:0})};const D=r(k.capabilities),ae=k.capabilities&&Object.getOwnPropertyDescriptor(k.capabilities,"operators");ae&&o(ae.get)&&Object.defineProperty(D,"operators",{enumerable:!0,configurable:!0,get:()=>new Set(k.capabilities.operators||[]),set:()=>{}});const te=k.name||"adapter";let $=null;const V=()=>o(k.ready)?($||($=Promise.resolve(k.ready()).then(()=>{Object.assign(D,r(k.capabilities))},Ce=>{throw $=null,Ce})),$):null,u=p(w.fullDataset),f=!!w.allowPartialResults,L=F(w.whereRowLimit);let s=null;const E=w.aggregates;let a=null,G=null,C=null,oe=null,le=null,X,Z=null,we=0,Se=null;const Ae=()=>!u.enabled||!a?null:(Se!==a.key&&(we++,Se=a.key),{rows:a.rows,version:we}),P=async Ce=>{const Me=Ce.where&&Ce.where.active?Ce.where:null;if(!Me)return{request:Ce,probe:null};const{where:Ge,...We}=Ce,Le=ue(We,D,u.enabled);if(Le.needsAll)return{request:Ce,probe:null};const Je=l(Le.pushed);let Xe=null;return(!s||s.key!==Je)&&(D.total?(m(Ce),Xe=await J(await k.execute(Le.pushed,Ce)),s={key:Je,size:Xe&&typeof Xe.total=="number"?Xe.total:null}):s={key:Je,size:null}),s.size!==null&&s.size<L?{request:Ce,probe:null}:(re(Me.names,te,s.size,L),{request:We,probe:Xe})},j=async(Ce,Me)=>{Z=null;const Ge=W(Ce.pushed);C={engine:Ge.engine,client:Ge.client,groupBy:Ce.pushed.groupBy},Ge.client.length&&ce(`source.pushdown.group.totals.${te}.${Ge.client.map(Je=>Je.id).join(".")}`,`the ${te} 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 We=await k.executeGroupLevel(Ce.pushed,Ge.engine,Me)||{};let Le=We.rows||[];return!D.range&&Me.range&&(Le=Le.slice(Me.range.start,Me.range.end)),xe(We),We.total===void 0?{rows:Le}:{rows:Le,total:We.total}},U=new Map,se=64,Oe=async(Ce,Me)=>{Z=null;const Ge=Ce.pushed,We=Ge.groupBy,Le=Array.isArray(Ge.groupValues)?Ge.groupValues:[],Je=Le.length,Xe=[...Ge.filters?[Ge.filters]:[],...We.slice(0,Je).map((He,vt)=>({col:He,op:"eq",value:Le[vt]===void 0?null:Le[vt],caseSensitive:!0}))],nt=Xe.length===0?null:Xe.length===1?Xe[0]:{op:"and",conditions:Xe},it=Me.range?Me.range.start:0;if(Je>=We.length){const He={...Ge,filters:nt,groupBy:[],groupPath:[],groupValues:[],totals:[],totalFns:{}},vt=await J(await k.execute(He,Me))||{};let Ot=vt.rows||[];return!D.range&&Me.range&&(Ot=Ot.slice(Me.range.start,Me.range.end)),typeof vt.total=="number"?{rows:Ot,total:vt.total}:{rows:Ot}}const et=We[Je],ut=W(Ge),lt=I(D),ft=ut.engine.filter(He=>lt.has(He.fn)),yt=[...ut.engine.filter(He=>!lt.has(He.fn)).map(He=>({id:He.id,fn:He.fn,class:He.class,reason:`the ${te} adapter does not compute "${He.fn}"`})),...ut.client];C={engine:ft,client:yt,groupBy:We},yt.length&&ce(`source.pushdown.group.totals.${te}.${yt.map(He=>He.id).join(".")}`,`the ${te} adapter cannot compute the group subtotal for ${yt.map(He=>`"${He.id}" (${He.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=[...ft.map(He=>({id:He.id,col:He.col,fn:He.fn})),{id:y,col:et,fn:"count"}],ct={...Ge,filters:nt,range:null},wt=JSON.stringify([l(ct),Le,et,tt]);let kt=it>0?U.get(wt):void 0;if(!kt){for(kt=Promise.resolve(k.executeGroupedAggregates(ct,[et],tt)),U.delete(wt),U.set(wt,kt);U.size>se;)U.delete(U.keys().next().value);kt.catch(()=>{U.get(wt)===kt&&U.delete(wt)})}const At=await kt||[];m(Me);const Pt=He=>{const vt={};for(const Ot of ft)vt[Ot.id]=He?He[Ot.id]:void 0;return vt},qt=(Ge.sort||[]).find(He=>He&&He.col===et),nn=qt&&qt.dir==="desc"?-1:1,_t=At.filter(He=>He&&He.level===1).map(He=>({[et]:He.keys[0]===void 0?null:He.keys[0],leafCount:Number(He.values&&He.values[y])||0,totals:Pt(He.values)})).sort((He,vt)=>nn*ee(He[et],vt[et]));if(Je===0){const He=At.find(Ot=>Ot&&Ot.level===0),vt=He?Number(He.values&&He.values[y]):NaN;xe({matchCount:Number.isFinite(vt)?vt:_t.reduce((Ot,on)=>Ot+on.leafCount,0),...He?{grand:Pt(He.values)}:{}})}const rn=Me.range?Me.range.end:_t.length;return{rows:_t.slice(it,rn),total:_t.length}},xe=Ce=>{typeof Ce.matchCount=="number"&&(oe=Ce.matchCount,le=Ce.grand?{totals:Ce.grand,leafCount:Ce.matchCount}:null,X===void 0&&o(k.unfilteredCount)&&(X=null,Promise.resolve(k.unfilteredCount()).then(Me=>{X=typeof Me=="number"?Me:null}).catch(Me=>{ce(`source.pushdown.group.unfiltered.${te}`,`the ${te} adapter could not count the unfiltered set (${Me&&Me.message?Me.message:Me}), so "N of M" falls back to the display count for its denominator.`)})))},je=async(Ce,Me)=>{Z=null;const Ge=W(Ce.pushed);C={engine:Ge.engine,client:Ge.client,groupBy:Ce.pushed.groupBy,pivotBy:Ce.pushed.pivotBy},Ge.client.length&&ce(`source.pushdown.pivot.totals.${te}.${Ge.client.map(nt=>nt.id).join(".")}`,`the ${te} 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 We=await k.executePivotLevel(Ce.pushed,Ge.engine,Me)||{};let Le=We.rows||[];!D.range&&Me.range&&(Le=Le.slice(Me.range.start,Me.range.end)),xe(We);const Je=We.pivot&&typeof We.pivot=="object"?We.pivot:{},Xe={cells:Array.isArray(Je.cells)?Je.cells:[],...Array.isArray(Je.axis)?{axis:Je.axis}:{}};return We.total===void 0?{rows:Le,pivot:Xe}:{rows:Le,total:We.total,pivot:Xe}},Fe=Ce=>{ce(`source.pushdown.pivot.${te}.${Ce}`,`pushdown:pivot-unsupported: the ${te} adapter cannot pivot this query because ${Ce}, so no rows are fetched rather than every leaf row being pulled into the browser to pivot there. \`lastPlan().pivotReason\` says the same.`);const Me=new Error(`[lattice] ${Y}: the ${te} adapter cannot pivot this query because ${Ce}, so no rows are fetched rather than every leaf row being pulled into the browser to pivot there. \`lastPlan().pivotReason\` says the same.`);throw Me.code=Y,Me.reason=Ce,Me},Ie=(Ce,Me)=>{const Ge={key:Me,state:"pending",value:null};return Z=Ge,Ce.then(We=>(Z===Ge&&(Z={key:Me,state:"settled",value:typeof We=="number"?We:null}),We),We=>{throw Z===Ge&&(Z={key:Me,state:"failed",value:null}),We})};let Be=0,Re=[];const Ke=()=>Be===0?null:new Promise(Ce=>{const Me=setTimeout(Ce,i);Re.push(()=>{clearTimeout(Me),Ce()})});let rt;const Nt=async Ce=>{const Me=V();Me&&await Me;const We=Ce&&Ce.pivotMode!==!1&&Array.isArray(Ce.pivotBy)&&Ce.pivotBy.length>0?{request:Ce,probe:null}:await P(Ce);m(Ce);let Le=ue(We.request,D,u.enabled);if(D.group&&Le.grouped&&!Le.pivoted&&!o(k.executeGroupLevel)&&(ce(`source.pushdown.group.method.${te}`,`the ${te} 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.`),Le=ue(We.request,{...D,group:!1,aggregates:null},u.enabled)),Le.pivoted&&!o(k.executePivotLevel)&&(Le=ue(We.request,{...D,pivot:!1},u.enabled),Le.pivotReason="the adapter declares the `pivot` capability but has no `executePivotLevel(query, aggregates, request)`"),Le.grouped&&!Le.pivoted&&!D.group&&!o(k.executeGroupedAggregates)&&(ce(`source.pushdown.group.aggregates.method.${te}`,`the ${te} 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\`.`),Le=ue(We.request,{...D,aggregates:null},u.enabled)),G=Le,Le.pivoted)return je(Le,Ce);if(Le.pivotReason&&Fe(Le.pivotReason),Le.grouped)return D.group?j(Le,Ce):Oe(Le,Ce);const Xe=!!Le.groupReason&&!Le.full;Xe?ce(`source.pushdown.group-unsupported.${te}.${Le.groupReason}`,`pushdown:group-unsupported: the ${te} adapter was not asked to group this query because ${Le.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.`):Le.groupReason&&ce(`source.pushdown.group.${te}.${Le.groupReason}`,`the ${te} adapter was not asked to group this query because ${Le.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=>Xe?{...tt,[he]:!0}:tt;if(!Le.needsAll){const tt=We.probe||await k.execute(Le.pushed,Ce),ct=tt.rows||[];return x(tt.pendingTotal)&&tt.total===void 0?nt({rows:ct,pendingTotal:Ie(tt.pendingTotal,l(Le.pushed))}):(Z=null,!D.total&&tt.total===void 0?nt({rows:ct}):nt({rows:ct,total:tt.total??ct.length}))}Le.unpushed.length&&ce(`source.pushdown.residual.${te}.${Le.unpushed.join(".")}`,`the ${te} adapter cannot push ${Le.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 it=l(Le.pushed);if(!a||a.key!==it){const tt=await J(await k.execute(Le.pushed,Ce));Z=null;const ct=tt.rows||[];if(Le.full){const wt=typeof tt.total=="number"?Math.max(tt.total,ct.length):ct.length;if(wt>u.maxRows)throw new Error(`[lattice] fullDataset refused: the ${te} adapter's matching set is ${wt.toLocaleString()} rows, past the configured maxRows of ${u.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 kt=ct.length*e(ct[0]);if(kt>u.maxBytesEstimate)throw new Error(`[lattice] fullDataset refused: the ${te} adapter's matching set is an estimated ${Math.round(kt/(1024*1024)).toLocaleString()} MB across ${ct.length.toLocaleString()} rows, past the configured maxBytesEstimate of ${Math.round(u.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"&&ct.length<tt.total){const wt=!!(Le.residual.filters||Le.residual.quick||Le.residual.sort&&Le.residual.sort.length);if(wt&&!f)throw new Error(`[lattice] the ${te} adapter returned ${ct.length} of ${tt.total} matching rows when asked for the whole result, and the query has residual ${Le.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.`);wt?ce(`source.pushdown.partial.residual.${te}`,`the ${te} adapter returned ${ct.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.`):ce(`source.pushdown.partial.${te}`,`the ${te} adapter returned ${ct.length} of ${tt.total} matching rows when asked for the whole result. The adapter must follow the engine's own paging before returning.`)}a={key:it,rows:ct,total:typeof tt.total=="number"?tt.total:null}}let et=Le;if(Le.residual.where){const tt=a.total??a.rows.length;if(tt>=L){re(Le.residual.where.names,te,tt,L);const{where:ct,...wt}=We.request;et=ue(wt,D,u.enabled),G=et}}const ut=a.total!==null&&a.rows.length>=a.total,lt=ne(a.rows,{...et.residual,whole:ut},w.compute||{}),ft=Ce.range?Ce.range.start:0,yt=Ce.range?Ce.range.end:lt.length;return nt({rows:lt.slice(ft,yt),total:lt.length})},Et=async(Ce,Me,Ge)=>{const Le=Ge&&Ge.waitForPage&&rt&&o(rt.pageForegroundIdle)?rt.pageForegroundIdle():Ke();Le&&await Le;const Je=V();Je&&await Je;const Xe=ue(Ce,D,u.enabled);G=Xe;const nt=S(Me,E),it=Array.isArray(Ce.groupBy)?Ce.groupBy:[],et=it.length>0,ut=!Xe.residual.filters&&!Xe.residual.quick,lt=!et||T(it,D.buckets);let ft=nt.engine,yt=nt.client;if(D.aggregates&&ft.length){const kt=D.aggregates instanceof Set?D.aggregates:new Set(ye(D.aggregates)),At=ft.filter(Pt=>!kt.has(Pt.fn));At.length&&(ft=ft.filter(Pt=>kt.has(Pt.fn)),yt=[...At.map(Pt=>({...Pt,reason:`the ${te} adapter does not compute "${Pt.fn}"`})),...yt])}const tt=kt=>{yt=[...ft.map(At=>({...At,reason:kt})),...yt],ft=[]};ft.length&&!ut?tt(Xe.residual.quick&&!Xe.residual.filters?"a quick search the adapter cannot push forces all-client (no mixed provenance)":"residual filter forces all-client (no mixed provenance)"):ft.length&&!lt&&tt("a grouping key the engine cannot form forces all-client (no mixed provenance)");let ct={},wt;return ft.length&&(o(et?k.executeGroupedAggregates:k.executeAggregates)?et?wt=await k.executeGroupedAggregates(Xe.pushed,it,ft)||[]:ct=await k.executeAggregates(Xe.pushed,ft)||{}:(ce(`source.pushdown.aggregates.${te}${et?".grouped":""}`,`the ${te} adapter cannot compute ${et?"grouped ":""}aggregates, so every requested statistic is computed client-side. Correct, and slower than it needs to be.`),tt(`adapter cannot compute ${et?"grouped ":""}aggregates`))),C={engine:ft,client:yt,...et?{groupBy:it}:{}},{values:ct,engine:ft,client:yt,...wt!==void 0?{groups:wt}:{}}},Ct=async Ce=>{Be++;try{return await Nt(Ce)}finally{if(Be--,Be===0&&Re.length){const Me=Re;Re=[];for(const Ge of Me)Ge()}}},zt=b(w.edit),Rt=w.edit&&typeof w.edit=="object"&&o(w.edit.commit);let Tt=w.edit;if(zt&&!Rt)if(D.mutate&&D.mutate.update){const Ce=Me=>{if(!D.mutate||!D.mutate.update)throw new Error(`[lattice] the ${te} 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(Me.key),patch:{[Me.colId]:Me.value}};return k.mutate(Ge,Me.request||{})};Tt={...w.edit===!0?{}:w.edit,commit:Ce}}else ce(`source.pushdown.readonly.${te}`,`edit is enabled but the ${te} adapter declares mutate: ${D.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 Gt=zt&&D.mutate&&(D.mutate.append||D.mutate.delete)?{append:D.mutate.append===!0,remove:D.mutate.delete===!0,returning:D.mutate.returning,mutate:(Ce,Me)=>k.mutate(Ce,Me||{})}:null,Lt=async Ce=>{const Me=V();Me&&await Me;const{range:Ge,signal:We,export:Le,...Je}=Ce||{},Xe={...Je,groupBy:[],groupPath:[],groupValues:[],pivotBy:[],pivotMode:!1,totals:[]};return{plan:ue(Xe,D,u.enabled),signal:We}};async function*Dt(Ce,Me={}){const{plan:Ge,signal:We}=await Lt(Ce),Le=Math.max(1,Math.floor(Number(Me.pageSize))||5e3),Je={signal:We,stream:!0};if(!Ge.needsAll)for(let it=0;;it+=Le){m(Je);const et=await k.execute({...Ge.pushed,range:{start:it,end:it+Le}},Je);et&&x(et.pendingTotal)&&et.pendingTotal.then(null,()=>{});const ut=et&&et.rows||[];if(ut.length&&(yield ut),ut.length<Le)return}m(Je);const Xe=await J(await k.execute({...Ge.pushed,range:void 0},Je)),nt=ne(Xe&&Xe.rows||[],{...Ge.residual,whole:!0},w.compute||{});for(let it=0;it<nt.length;it+=Le)yield nt.slice(it,it+Le)}return rt={...w,edit:Tt,rowMutate:Gt,mode:"remote",fetch:Ct,foregroundIdle:Ke,aggregate:Et,countMatching:async Ce=>{const{plan:Me,signal:Ge}=await Lt(Ce);if(!Me.needsAll&&D.total){m({signal:Ge});const Le=await J(await k.execute({...Me.pushed,range:{start:0,end:0}},{signal:Ge}));if(Le&&typeof Le.total=="number")return Le.total}let We=0;for await(const Le of Dt(Ce))We+=Le.length;return We},streamMatching:Dt,lastPlan:()=>G?{...G,...C?{aggregates:C}:{},...Z?{total:{deferred:!0,state:Z.state,value:Z.value}}:{}}:null,fullFrame:Ae,counts:()=>({match:oe,total:X??null,pending:!!Z&&Z.state==="pending"}),grandTotals:()=>le},rt}}),Ve("packages/modules/shared/engine.js",function(n,de){"use strict";Object.defineProperty(n,"sourceId",{enumerable:!0,get:function(){return _}}),Object.defineProperty(n,"engineSource",{enumerable:!0,get:function(){return re}}),Object.defineProperty(n,"gridPivoted",{enumerable:!0,get:function(){return q}}),Object.defineProperty(n,"loadedAndMatching",{enumerable:!0,get:function(){return S}}),Object.defineProperty(n,"gridHoldsWindow",{enumerable:!0,get:function(){return T}}),Object.defineProperty(n,"gridEngineRequest",{enumerable:!0,get:function(){return z}}),Object.defineProperty(n,"EngineFlight",{enumerable:!0,get:function(){return A}});const Ne=de("packages/core/src/source/pushdown.js"),ee=Ne.capabilitiesOf,o=Ne.planQuery,ce=de("packages/core/src/source/filterwire.js").wireFilters,me=new WeakMap;let R=0;function _(i){let m=me.get(i);return m===void 0&&(m=++R,me.set(i,m)),m}function re(i){const m=i&&typeof i.config=="function"?i.config():null,c=m&&m.source&&typeof m.source=="object"?m.source:null;if(!c||typeof c.aggregate!="function")return{reason:"the grid's source has no aggregate() — it is not a pushdown source"};const h=ee(c.adapter&&c.adapter.capabilities);return{source:c,caps:h,config:m}}function q(i){const m=i&&typeof i.config=="function"?i.config():null,c=m&&m.source&&typeof m.source=="object"?m.source:null;if(!c||typeof c.lastPlan!="function")return!1;const h=i&&i.state&&typeof i.state.get=="function"?i.state.get():null,M=h&&h.pivot;return!!(M&&M.enabled&&Array.isArray(M.columns)&&M.columns.length>0)}function S(i){const m=i.rows&&typeof i.rows.residentCount=="function"?i.rows.residentCount():0,c=typeof i.rows.matchCount=="function"?i.rows.matchCount():NaN;return{loaded:m,total:Number.isFinite(c)?c:NaN}}function T(i){const m=i&&typeof i.config=="function"?i.config():null,c=m&&m.source&&typeof m.source=="object"?m.source:null;if(!c||c.mode!=="remote"&&c.mode!=="paged")return!1;if(typeof i.rows.matchCount=="function"&&i.rows.matchCount()===null)return!0;const{loaded:h,total:M}=S(i);return Number.isFinite(M)&&h<M}function g(i,m){return m?i?{op:"and",conditions:[i,m]}:m:i||null}function z(i,m,c=null){const h=i.filters&&typeof i.filters.where=="function"?i.filters.where():[];if(Array.isArray(h)&&h.length)return{reason:`a \`where\` predicate is in force (${h.join(", ")}), which only the browser can run`};const M=i.filters&&typeof i.filters.quickState=="function"?i.filters.quickState():{text:""},b=M&&M.text?String(M.text):"",{config:r,caps:O}=m,t={filters:ce(g(i.filters.get(),c),{tz:r.timeZone,weekStartsOn:r.weekStartsOn}),sort:[],range:null,context:r.context??null,...b?{quick:b}:{}},y=o(t,O);return y.unpushed.includes("filter")?{reason:c?"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"}:y.unpushed.includes("quick")?{reason:"the quick search did not push to the engine"}:{request:t,quick:b}}class A{#e=null;#t=null;#n=!1;answer(m){return this.#t&&this.#t.key===m?this.#t:null}last(){return this.#t}get busy(){return this.#e!==null}ask(m,c,h){const M=this.#e;if(M){M.key!==m&&M.controller&&M.controller.abort();return}const b=globalThis.AbortController,r=typeof b=="function"?new b:null,O={key:m,controller:r};this.#e=O;let t;Promise.resolve().then(()=>c(r?r.signal:null)).then(y=>{t={key:m,result:y}},y=>{t={key:m,error:y}}).then(()=>{this.#e===O&&(this.#e=null),!this.#n&&(r&&r.signal.aborted||(this.#t=t),h())})}abort(){const m=this.#e;m&&m.controller&&m.controller.abort()}close(){this.#n=!0,this.abort()}}}),Ve("packages/modules/charts/scale.js",function(n,de){"use strict";Object.defineProperty(n,"isNumber",{enumerable:!0,get:function(){return _}}),Object.defineProperty(n,"toNumber",{enumerable:!0,get:function(){return re}}),Object.defineProperty(n,"toTime",{enumerable:!0,get:function(){return q}}),Object.defineProperty(n,"extent",{enumerable:!0,get:function(){return S}}),Object.defineProperty(n,"niceStep",{enumerable:!0,get:function(){return T}}),Object.defineProperty(n,"niceDomain",{enumerable:!0,get:function(){return g}}),Object.defineProperty(n,"measureDomain",{enumerable:!0,get:function(){return z}}),Object.defineProperty(n,"linearTicks",{enumerable:!0,get:function(){return A}}),Object.defineProperty(n,"timeStepFor",{enumerable:!0,get:function(){return i}}),Object.defineProperty(n,"timeTicks",{enumerable:!0,get:function(){return c}}),Object.defineProperty(n,"linearScale",{enumerable:!0,get:function(){return h}}),Object.defineProperty(n,"timeScale",{enumerable:!0,get:function(){return M}}),Object.defineProperty(n,"key",{enumerable:!0,get:function(){return b}}),Object.defineProperty(n,"bandScale",{enumerable:!0,get:function(){return r}}),Object.defineProperty(n,"sqrtScale",{enumerable:!0,get:function(){return O}});const Ne=[1,2,2.5,5,10],ee=6e4,o=36e5,ye=864e5,ce=365.25*ye,me=[1,2,5,10,20,25,50,100],R=[1,5,10,25,50,100,250,500,1e3,5e3,15e3,3e4,ee,5*ee,15*ee,30*ee,o,3*o,6*o,12*o,ye,2*ye,7*ye,14*ye,30*ye,90*ye,180*ye,...me.map(t=>t*ce)];function _(t){return typeof t=="number"&&Number.isFinite(t)}function re(t){if(t==null||t==="")return null;if(t instanceof Date){const I=t.getTime();return Number.isFinite(I)?I:null}if(typeof t=="boolean")return t?1:0;const y=Number(t);return Number.isFinite(y)?y:null}function q(t){if(t==null||t==="")return null;if(t instanceof Date){const I=t.getTime();return Number.isFinite(I)?I:null}if(typeof t=="number")return Number.isFinite(t)?t:null;const y=Date.parse(String(t));return Number.isFinite(y)?y:null}function S(t){let y=1/0,I=-1/0;for(let B=0;B<t.length;B++){const H=t[B];_(H)&&(H<y&&(y=H),H>I&&(I=H))}return y===1/0?null:{min:y,max:I}}function T(t){if(!(t>0))return 1;const y=10**Math.floor(Math.log10(t));for(const I of Ne)if(t<=I*y)return I*y;return 10*y}function g(t,y=5){const I=T((t.max-t.min)/Math.max(1,y));return{min:Math.floor(t.min/I)*I,max:Math.ceil(t.max/I)*I,step:I}}function z(t,y={}){const I=S(t)||{min:0,max:1};let{min:B,max:H}=I;if(y.zero&&(B>0&&(B=0),H<0&&(H=0)),B===H){const Y=Math.abs(B)>0?Math.abs(B)/10:1;B-=Y,H+=Y}if(y.nice!==!1){const Y=g({min:B,max:H},y.ticks||5);B=Y.min,H=Y.max}return _(y.min)&&(B=y.min),_(y.max)&&(H=y.max),B===H&&(H=B+1),{min:B,max:H}}function A(t,y=5){const I=T((t.max-t.min)/Math.max(1,y)),B=Math.ceil(t.min/I),H=Math.floor(t.max/I),Y=[];for(let Q=B;Q<=H;Q++){const he=Q*I;Y.push(Math.abs(he)<I/1e6?0:Number(he.toPrecision(12)))}return Y}function i(t,y=5){const I=Math.max(1,y),B=t/I;let H=R[R.length-1];for(const he of R)if(he>=B){H=he;break}if(H<ce)return H;let Y=H,Q=Math.abs(t/H-I);for(const he of R){if(he<ce)continue;const fe=Math.abs(t/he-I);fe<Q&&(Q=fe,Y=he)}return Y}function m(t,y){const I=new Date(t.min).getUTCFullYear();let B=Math.ceil(I/y)*y;Date.UTC(B,0,1)<t.min&&(B+=y);const H=[];for(;Date.UTC(B,0,1)<=t.max;B+=y)H.push(Date.UTC(B,0,1));return H}function c(t,y=5){const I=i(t.max-t.min,y);if(I>=ce)return m(t,Math.round(I/ce));const B=[],H=Math.ceil(t.min/I)*I;for(let Y=H;Y<=t.max;Y+=I)B.push(Y);return B}function h(t,y){const I=t.max-t.min||1,[B,H]=y;return{kind:"linear",domain:t,range:y,of(Y){return B+(Y-t.min)/I*(H-B)},invert(Y){return t.min+(Y-B)/(H-B||1)*I},ticks(Y=5){return A(t,Y)}}}function M(t,y){return{...h(t,y),kind:"time",ticks(B=5){return c(t,B)}}}function b(t){if(t==null)return" null";if(t instanceof Date)return` date:${t.getTime()}`;if(typeof t=="object"){const y=t,I=y.id??y.key??y.value;return I!==void 0&&typeof I!="object"?` obj:${String(I)}`:` obj:${String(t)}`}return String(t)}function r(t,y,I=.2){const B=Math.min(.9,Math.max(0,I)),[H,Y]=y,Q=new Map;for(let ue=0;ue<t.length;ue++){const W=b(t[ue]);Q.has(W)||Q.set(W,ue)}const he=t.length?(Y-H)/t.length:Y-H,fe=Math.max(0,he*(1-B));return{kind:"band",domain:t,range:y,bandwidth:fe,step:he,of(ue){const W=Q.get(b(ue));return W===void 0?NaN:H+W*he+(he-fe)/2},centre(ue){const W=this.of(ue);return Number.isNaN(W)?NaN:W+fe/2},ticks(){return t}}}function O(t,y){const[I,B]=y,H=Math.max(Math.abs(t.max),Math.abs(t.min),0)||1;return{kind:"sqrt",domain:t,range:y,of(Y){const Q=Math.sqrt(Math.abs(Y)/H);return I+Q*(B-I)}}}}),Ve("packages/modules/charts/svg.js",function(n,de){"use strict";Object.defineProperty(n,"SVG_NS",{enumerable:!0,get:function(){return Ne}}),Object.defineProperty(n,"el",{enumerable:!0,get:function(){return o}}),Object.defineProperty(n,"svg",{enumerable:!0,get:function(){return ye}}),Object.defineProperty(n,"attr",{enumerable:!0,get:function(){return ce}}),Object.defineProperty(n,"attrs",{enumerable:!0,get:function(){return me}}),Object.defineProperty(n,"setText",{enumerable:!0,get:function(){return R}}),Object.defineProperty(n,"clear",{enumerable:!0,get:function(){return _}}),Object.defineProperty(n,"append",{enumerable:!0,get:function(){return re}}),Object.defineProperty(n,"path",{enumerable:!0,get:function(){return q}}),Object.defineProperty(n,"ribbonPath",{enumerable:!0,get:function(){return S}}),Object.defineProperty(n,"round",{enumerable:!0,get:function(){return T}}),Object.defineProperty(n,"pathRings",{enumerable:!0,get:function(){return g}}),Object.defineProperty(n,"insideRings",{enumerable:!0,get:function(){return z}});const Ne="http://www.w3.org/2000/svg";function ee(A){const i=A.indexOf(")");return i<0?A:A.slice(i+1).trim()||"#0072b2"}function o(A,i,m){const c=A.createElement(i);return m&&c.setAttribute("class",m),c}function ye(A,i,m){const c=A.createElementNS(Ne,i);if(m)for(const h of Object.keys(m))c.setAttribute(h,String(m[h]));return c}function ce(A,i,m){if(!A)return;if(m==null){A.removeAttribute(i);return}let c=String(m);c.startsWith("url(#")&&(i==="stroke"||i==="fill"&&A.localName==="text")&&(c=ee(c)),A.setAttribute(i,c)}function me(A,i){if(A)for(const m of Object.keys(i))ce(A,m,i[m])}function R(A,i){A&&(A.textContent=i==null?"":String(i))}function _(A){if(A)for(;A.firstChild;)A.removeChild(A.firstChild)}function re(A,i){for(const m of i)m&&A.appendChild(m);return A}function q(A){return A.join(" ")}function S(A){if(!A||A.length<2)return"";const i=["M",A[0].x,A[0].upper];for(let m=1;m<A.length;m++)i.push("L",A[m].x,A[m].upper);for(let m=A.length-1;m>=0;m--)i.push("L",A[m].x,A[m].lower);return i.push("Z"),q(i)}function T(A){return Math.round(A*100)/100}function g(A){const i=[];let m=[];const c=String(A||"").match(/[A-Za-z]|-?\d*\.?\d+(?:e[-+]?\d+)?/gi)||[];let h="",M=[];const b=()=>{if(!h||!M.length){M=[];return}if(h==="M"||h==="L")for(let r=0;r+1<M.length;r+=2)m.push([M[r],M[r+1]]);else h!=="Z"&&M.length>=2&&m.push([M[M.length-2],M[M.length-1]]);M=[]};for(const r of c){if(/[A-Za-z]/.test(r)){if(b(),r==="Z"||r==="z"){m.length>2&&i.push(m),m=[],h="";continue}r==="M"&&m.length>2&&(i.push(m),m=[]),h=r;continue}M.push(Number(r))}return b(),m.length>2&&i.push(m),i}function z(A,i,m){let c=!1;for(const h of A)for(let M=0,b=h.length-1;M<h.length;b=M++){const[r,O]=h[M],[t,y]=h[b];O>m!=y>m&&i<(t-r)*(m-O)/(y-O||1e-12)+r&&(c=!c)}return c}}),Ve("packages/modules/charts/typography.js",function(n,de){"use strict";Object.defineProperty(n,"BASE_SIZE",{enumerable:!0,get:function(){return Ne}}),Object.defineProperty(n,"BASE_FAMILY",{enumerable:!0,get:function(){return ee}}),Object.defineProperty(n,"CHAR_RATIO",{enumerable:!0,get:function(){return o}}),Object.defineProperty(n,"resolveType",{enumerable:!0,get:function(){return ye}}),Object.defineProperty(n,"textWidth",{enumerable:!0,get:function(){return me}}),Object.defineProperty(n,"widestLabel",{enumerable:!0,get:function(){return R}}),Object.defineProperty(n,"truncateTo",{enumerable:!0,get:function(){return _}}),Object.defineProperty(n,"applySize",{enumerable:!0,get:function(){return re}});const Ne=12,ee="var(--lattice-font-family, system-ui, -apple-system, sans-serif)",o=.62;function ye(q){const S=q&&q.font,T=typeof S=="number"?{size:S}:S||{},g=ce(T.size,Ne);return{family:T.family||ee,size:g,small:ce(T.small??T.tickSize,Math.max(9,g-1)),title:ce(T.title,Math.round(g*1.15)),axisTitle:ce(T.axisTitle,Math.max(10,g-1)),weight:T.weight||"inherit"}}function ce(q,S){const T=Number(q);return Number.isFinite(T)&&T>0?T:S}function me(q,S){return String(q??"").length*S*o}function R(q,S){let T=0;for(const g of q||[]){const z=me(g,S);z>T&&(T=z)}return T}function _(q,S,T){const g=String(q??""),z=Math.floor(S/(T*o));return z<=0?"":g.length<=z?g:z===1?"…":`${g.slice(0,z-1)}…`}function re(q,S){!q||!Number.isFinite(S)||(q.style?q.style.fontSize=`${S}px`:q.setAttribute("style",`font-size:${S}px`))}}),Ve("packages/modules/charts/frame.js",function(n,de){"use strict";Object.defineProperty(n,"LABEL_GAP",{enumerable:!0,get:function(){return R}}),Object.defineProperty(n,"LABEL_GUTTER_SHARE",{enumerable:!0,get:function(){return _}}),Object.defineProperty(n,"resolveMargin",{enumerable:!0,get:function(){return re}}),Object.defineProperty(n,"plotRect",{enumerable:!0,get:function(){return q}}),Object.defineProperty(n,"shouldRotate",{enumerable:!0,get:function(){return S}}),Object.defineProperty(n,"Pool",{enumerable:!0,get:function(){return T}});const ee=de("packages/modules/charts/svg.js").SVG_NS,o=de("packages/modules/charts/typography.js"),ye=o.textWidth,ce=o.widestLabel,me=8,R=6,_=.4;function re(g,z){const A=typeof g=="number"?g:z,i=g&&typeof g=="object"?g:{},m=c=>Number.isFinite(c)&&c>=0?Number(c):A;return{base:A,top:m(i.top),right:m(i.right),bottom:m(i.bottom),left:m(i.left)}}function q(g){const z=re(g.margin,typeof g.padding=="number"?g.padding:8),A=z.base,i=g.fontSize||12,m=g.yLabels||[],c=g.xLabels||[],h=g.ySide==="right"?"right":"left",M=h==="right"?"left":"right",b=g.titles||{},r=g.titleSize||i,O=W=>W?r+R:0,t=ce(m,i),y=m.length?Math.min(g.width*_,z[h]+t+R):Math.max(me,z[h]),I=z[M]+(g.rightGutter||0),B=(h==="left"?y:I)+O(b.left),H=ce(c.map(W=>String(W).slice(0,14)),i),Y=(c.length?g.rotated?Math.min(g.height*_,R+H):i+R+z.bottom:Math.max(me,z.bottom))+O(b.bottom),Q=(h==="right"?y:I)+O(b.right),he=z.top+(g.topGutter||0),fe=Math.max(0,g.width-B-Q),ue=Math.max(0,g.height-he-Y);return{left:B,top:he,width:fe,height:ue,right:B+fe,bottom:he+ue,gutter:{left:B,bottom:Y,right:Q,top:he}}}function S(g,z,A,i){if(!g.length||z<=0)return!1;const m=Number.isFinite(i)&&i>0?Number(i):1;return ce(g,A)>z*m-4}class T{#e;#t=0;static#n="data-pool-key";constructor(z,A=0){this.#e=z,this.#t=A>0?A:0}next(z,A,i){if(i!=null)return this.#r(z,A,String(i));const m=this.#e.childNodes[this.#t],c=m&&m.tagName,h=/(^|\s)\S*__axis-title(\s|$)/,M=c&&h.test(String(m.getAttribute("class")||"")),b=!!A&&h.test(String(A));if(c&&(!M||b)&&String(c).toLowerCase()===z.toLowerCase())return A&&m.setAttribute("class",A),this.#t++,m;const r=this.#e.ownerDocument.createElementNS(ee,z);return A&&r.setAttribute("class",A),m?this.#e.insertBefore(r,m):this.#e.appendChild(r),this.#t++,r}#r(z,A,i){const m=z.toLowerCase();for(let M=this.#t;M<this.#e.childNodes.length;M++){const b=this.#e.childNodes[M],r=b&&b.tagName;if(r&&String(r).toLowerCase()===m&&b.getAttribute(T.#n)===i)return M!==this.#t&&this.#e.insertBefore(b,this.#e.childNodes[this.#t]),A&&b.setAttribute("class",A),this.#t++,b}const c=this.#e.ownerDocument.createElementNS(ee,z);c.setAttribute(T.#n,i),A&&c.setAttribute("class",A);const h=this.#e.childNodes[this.#t];return h?this.#e.insertBefore(c,h):this.#e.appendChild(c),this.#t++,c}finish(){for(;this.#e.childNodes.length>this.#t;)this.#e.removeChild(this.#e.lastChild);this.#t=0}}}),Ve("packages/modules/charts/fills.js",function(n,de){"use strict";Object.defineProperty(n,"PATTERNS",{enumerable:!0,get:function(){return o}}),Object.defineProperty(n,"GRADIENTS",{enumerable:!0,get:function(){return ye}}),Object.defineProperty(n,"isFill",{enumerable:!0,get:function(){return re}}),Object.defineProperty(n,"isPaintRef",{enumerable:!0,get:function(){return q}}),Object.defineProperty(n,"paintFallback",{enumerable:!0,get:function(){return S}}),Object.defineProperty(n,"normaliseFill",{enumerable:!0,get:function(){return g}}),Object.defineProperty(n,"swatchCss",{enumerable:!0,get:function(){return A}}),Object.defineProperty(n,"createFillRegistry",{enumerable:!0,get:function(){return i}}),Object.defineProperty(n,"rowPaint",{enumerable:!0,get:function(){return m}}),Object.defineProperty(n,"patternSeries",{enumerable:!0,get:function(){return c}}),Object.defineProperty(n,"paintSolid",{enumerable:!0,get:function(){return h}}),Object.defineProperty(n,"rowFillSource",{enumerable:!0,get:function(){return M}}),Object.defineProperty(n,"nodePaint",{enumerable:!0,get:function(){return b}});const ee=de("packages/core/src/internal/util.js").warnOnce,o=Object.freeze(["hatch","crosshatch","dots","grid"]),ye=Object.freeze(["linear","radial"]),ce=8,me="#0072b2";let R=0;const _=new Map;function re(r){return!!r&&typeof r=="object"&&!Array.isArray(r)&&(typeof r.gradient=="string"||typeof r.pattern=="string")}function q(r){return typeof r=="string"&&r.startsWith("url(#")}function S(r){if(typeof r!="string")return r==null?"":String(r);if(!r.startsWith("url("))return r;const O=r.indexOf(")");return(O<0?"":r.slice(O+1).trim())||me}function T(r,O){ee(`chart:fill:invalid:${r}`,`a chart fill object was ignored: ${O} 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 g(r,O){if(!re(r))return null;const t=O||me;if(typeof r.gradient=="string"){if(!ye.includes(r.gradient))return T("gradient",`the gradient "${r.gradient}" is not one of ${ye.join(", ")}.`),null;const H=Array.isArray(r.stops)?r.stops:[],Y=[];for(const he of H){const fe=Array.isArray(he)?Number(he[0]):Number(he&&he.offset),ue=Array.isArray(he)?he[1]:he&&he.colour;!Number.isFinite(fe)||typeof ue!="string"||!ue||Y.push({offset:Math.min(1,Math.max(0,fe)),colour:ue})}if(Y.length<2)return T("stops","a gradient needs at least two [offset, colour] stops."),null;Y.sort((he,fe)=>he.offset-fe.offset);const Q=Number.isFinite(Number(r.angle))?Number(r.angle):180;return{kind:r.gradient,angle:Q,stops:Y,solid:Y[0].colour}}if(!o.includes(r.pattern))return T("pattern",`the pattern "${r.pattern}" is not one of ${o.join(", ")}.`),null;const y=Number(r.size),I=Number(r.angle),B=typeof r.colour=="string"&&r.colour?r.colour:t;return{kind:"pattern",pattern:r.pattern,colour:B,background:typeof r.background=="string"&&r.background?r.background:null,size:Number.isFinite(y)&&y>=2?y:ce,angle:Number.isFinite(I)?I:r.pattern==="grid"||r.pattern==="dots"?0:45,solid:B}}function z(r){if(r.kind==="pattern"){const t=r.colour,y=r.size,I=Math.max(1,y/5),B=r.background||"transparent",H=Y=>`repeating-linear-gradient(${Y+90}deg,${t} 0 ${I}px,transparent ${I}px ${y}px)`;return r.pattern==="hatch"?`${H(r.angle)},${B}`:r.pattern==="crosshatch"?`${H(r.angle)},${H(r.angle+90)},${B}`:r.pattern==="grid"?`${H(r.angle)},${H(r.angle+90)},${B}`:`radial-gradient(circle at 50% 50%,${t} ${y/6}px,transparent ${y/6+.5}px) 0 0/${y}px ${y}px,${B}`}const O=r.stops.map(t=>`${t.colour} ${Math.round(t.offset*100)}%`).join(",");return r.kind==="radial"?`radial-gradient(circle,${O})`:`linear-gradient(${r.angle}deg,${O})`}function A(r){if(!q(r))return typeof r=="string"?r:"";const O=String(r).indexOf(")"),t=String(r).slice(5,O),y=_.get(t);return y?z(y):S(r)}function i(r){const O=`lattice-fill-${++R}`;let t=new Map,y=0;const I=(H,Y)=>{const Q=r.ownerDocument.createElementNS("http://www.w3.org/2000/svg",H);for(const he of Object.keys(Y))Q.setAttribute(he,String(Y[he]));return Q},B=(H,Y)=>{if(Y.kind==="pattern"){const he=Y.size,fe=Math.max(1,he/5),ue=I("pattern",{id:H,width:he,height:he,patternUnits:"userSpaceOnUse"});Y.angle&&ue.setAttribute("patternTransform",`rotate(${Y.angle})`),Y.background&&ue.appendChild(I("rect",{width:he,height:he,fill:Y.background}));const W={stroke:Y.colour,"stroke-width":fe};Y.pattern==="dots"?ue.appendChild(I("circle",{cx:he/2,cy:he/2,r:Math.max(1,he/6),fill:Y.colour})):(ue.appendChild(I("line",{x1:he/2,y1:0,x2:he/2,y2:he,...W})),Y.pattern!=="hatch"&&ue.appendChild(I("line",{x1:0,y1:he/2,x2:he,y2:he/2,...W}))),r.appendChild(ue);return}let Q;if(Y.kind==="radial")Q=I("radialGradient",{id:H,cx:.5,cy:.5,r:.5});else{const he=Y.angle*Math.PI/180,fe=Math.sin(he)/2,ue=-Math.cos(he)/2;Q=I("linearGradient",{id:H,x1:+(.5-fe).toFixed(4),y1:+(.5-ue).toFixed(4),x2:+(.5+fe).toFixed(4),y2:+(.5+ue).toFixed(4)})}for(const he of Y.stops)Q.appendChild(I("stop",{offset:he.offset,"stop-color":he.colour}));r.appendChild(Q)};return{prefix:O,paint(H,Y){const Q=g(H,Y);if(!Q)return Y||me;if(!r||!r.ownerDocument)return Q.solid;const he=JSON.stringify(Q);let fe=t.get(he);if(!fe){const ue=`${O}-${y++}`;B(ue,Q),_.set(ue,Q),fe=`url(#${ue}) ${Q.solid}`,t.set(he,fe)}return fe},reset(){for(const H of t.values())_.delete(H.slice(5,H.indexOf(")")));if(t=new Map,y=0,r)for(;r.firstChild;)r.removeChild(r.firstChild)},ids(){return[...t.values()].map(H=>H.slice(5,H.indexOf(")")))}}}function m(r,O,t){if(r==null||r==="")return null;const y=S(t);if(re(r))return O?O.paint(r,y):(g(r,y)||{}).solid||null;if(typeof r=="string"){if(o.includes(r)){const I={pattern:r,colour:y};return O?O.paint(I,y):y}return r}return null}function c(r){const O=[{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 r.map((t,y)=>({...O[y%O.length],colour:t,background:"var(--lattice-background, #fff)"}))}function h(r){return q(r)?String(r).replace(/^url\([^)]*\)\s*/,""):r}function M(r,O){const t=r.fill;if(re(t))return(I,B)=>m(t,O.fills,h(B));if(typeof t=="function")return(I,B)=>{let H=null;try{H=t({label:I.label,x:I.x,y:I.y,rowKey:I.rowKey})}catch{H=null}return m(H,O.fills,h(B))};const y=typeof t=="string"?t:t&&typeof t=="object"&&typeof t.col=="string"?t.col:null;return y?(I,B)=>I.rowKey===void 0||I.rowKey===null?null:m(r.grid.rows.value(I.rowKey,y),O.fills,h(B)):null}function b(r,O,t){return r&&r({label:O.label,x:O.value,y:O.total,rowKey:O.rowKey},t)||t}}),Ve("packages/modules/charts/scheme.js",function(n,de){"use strict";Object.defineProperty(n,"PALETTE",{enumerable:!0,get:function(){return R}}),Object.defineProperty(n,"SCHEMES",{enumerable:!0,get:function(){return _}}),Object.defineProperty(n,"registerScheme",{enumerable:!0,get:function(){return S}}),Object.defineProperty(n,"setDefaultScheme",{enumerable:!0,get:function(){return T}}),Object.defineProperty(n,"schemeNames",{enumerable:!0,get:function(){return g}}),Object.defineProperty(n,"resolveScheme",{enumerable:!0,get:function(){return m}}),Object.defineProperty(n,"RAMP_SCALES",{enumerable:!0,get:function(){return h}}),Object.defineProperty(n,"toRgb",{enumerable:!0,get:function(){return r}}),Object.defineProperty(n,"rampStops",{enumerable:!0,get:function(){return O}});const ee=de("packages/core/src/internal/util.js").warnOnce,o=de("packages/modules/charts/fills.js"),ye=o.isFill,ce=o.patternSeries,me=o.rowPaint,R=Object.freeze(["#0072b2","#e69f00","#009e73","#cc79a7","#56b4e9","#d55e00","#7a5195","#6b7d8c"]),_=Object.freeze({default:{series:R,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:ce(R),sequential:["#ecf3f9","#005280"],diverging:["#b04a00","#f7f7f7","#005280"],positive:"#009e73",negative:"#d55e00"}}),re=new Map;let q="default";function S(t,y){!t||!y||re.set(String(t),y)}function T(t){if(typeof t=="string"){q=t;return}t&&typeof t=="object"&&(re.set("__default__",t),q="__default__")}function g(){return[...Object.keys(_),...re.keys()].filter(t=>!t.startsWith("__"))}function z(t){return re.has(t)?re.get(t):_[t]||null}const A=["series","sequential","diverging","positive","negative"];function i(t){return!t||typeof t!="object"||Array.isArray(t)?!1:!A.some(y=>y in t)}function m(t,y){const I=y&&y.fills||null,B=z(q)||_.default,H=t&&t.scheme,Y=i(H)?H:null,Q=Array.isArray(H)&&H.length?H:null,he=typeof H=="string"?z(H):Y||Array.isArray(H)?null:H||null,fe=(t&&Array.isArray(t.palette)&&t.palette.length?t.palette:null)||Q;Y&&fe&&ee("chart:scheme:array-and-map",'chart "scheme" was given as a name map together with a "palette" array; the two do not combine. Colours came from the map and the array was ignored. Pass one or the other.');const ue=Y?null:fe,W={..._.default,...B,...he||{}};ue&&(W.series=ue);const N=t&&t.ramp&&typeof t.ramp=="object"&&!Array.isArray(t.ramp)?t.ramp:null,ne=N?N.colours:t&&t.ramp,l=Array.isArray(ne)&&ne.length>=2?ne:null;l&&(W.sequential=l);const e=N?M(N.scale):null,p=!!(he||ue||Y),v=W.series&&W.series.length?W.series:R,F=new Map;let x=0;return{...W,series:(K,w)=>{if(Y&&w!==void 0&&w!==null){const k=String(w);return Object.prototype.hasOwnProperty.call(Y,k)?c(Y[k],I,K):(F.has(k)||F.set(k,x++),c(b(v,F.get(k),!0),I,F.get(k)))}return c(b(v,K,p),I,K)},explicit:p,nameMap:!!Y,rampScale:e,fills:I}}function c(t,y,I){if(!ye(t))return t;const B=R[(I%R.length+R.length)%R.length];return me(t,y,B)||B}const h=Object.freeze(["linear","log","quantile"]);function M(t){return t==null?null:h.includes(t)?t:(ee(`chart:ramp:scale:${String(t)}`,`chart "ramp.scale" was "${String(t)}", which is not a ramp scale; the chart chose one from its values instead. Use "linear", "log" or "quantile".`),null)}function b(t,y,I){const B=(y%t.length+t.length)%t.length;return I||typeof t[B]!="string"?t[B]:`var(--lattice-chart-${B+1}, ${t[B]})`}function r(t){if(typeof t!="string")return null;const y=t.trim(),I=/^#([0-9a-f]{3}|[0-9a-f]{6})$/i.exec(y);if(I){const Y=I[1];return Y.length===3?[0,1,2].map(Q=>parseInt(Y[Q]+Y[Q],16)):[0,2,4].map(Q=>parseInt(Y.slice(Q,Q+2),16))}const B=/^rgba?\(([^)]+)\)$/i.exec(y);if(!B)return null;const H=B[1].split(/[\s,/]+/).filter(Boolean).slice(0,3).map(Number);return H.length===3&&H.every(Y=>Number.isFinite(Y))?H:null}function O(t,y){const I=y?t.diverging:t.sequential,B=y?_.default.diverging:_.default.sequential,H=(Array.isArray(I)?I:B).map((Y,Q)=>r(Y)||r(B[Q])||[0,0,0]);return H.length>=2?H:B.map(Y=>r(Y))}}),Ve("packages/modules/charts/styles.js",function(n,de){"use strict";Object.defineProperty(n,"NS",{enumerable:!0,get:function(){return o}}),Object.defineProperty(n,"seriesColour",{enumerable:!0,get:function(){return ce}}),Object.defineProperty(n,"css",{enumerable:!0,get:function(){return me}}),Object.defineProperty(n,"injectStyles",{enumerable:!0,get:function(){return R}});const ee=de("packages/modules/charts/scheme.js").PALETTE,o="lat-chartview",ye="data-lattice-chartview";function ce(_){const re=(_%ee.length+ee.length)%ee.length;return`var(--lattice-chart-${re+1}, ${ee[re]})`}function me(){return`
6
+ (function(On){"use strict";var hn=Object.create(null),mn=Object.create(null);function Ve(n,de){hn[n]=de}function gn(n){var de=mn[n];if(de)return de;var Ne=Object.create(null);mn[n]=Ne;var ee=hn[n];if(!ee)throw new Error("[lattice] missing module: "+n);return ee(Ne,gn),Ne}Ve("packages/core/src/internal/util.js",function(n,de){"use strict";Object.defineProperty(n,"VERSION",{enumerable:!0,get:function(){return o}}),Object.defineProperty(n,"reportedWarnings",{enumerable:!0,get:function(){return S}}),Object.defineProperty(n,"warnOnce",{enumerable:!0,get:function(){return g}}),Object.defineProperty(n,"infoOnce",{enumerable:!0,get:function(){return z}}),Object.defineProperty(n,"resetWarnings",{enumerable:!0,get:function(){return A}}),Object.defineProperty(n,"fail",{enumerable:!0,get:function(){return i}}),Object.defineProperty(n,"invariant",{enumerable:!0,get:function(){return m}}),Object.defineProperty(n,"DEV",{enumerable:!0,get:function(){return c}}),Object.defineProperty(n,"isObject",{enumerable:!0,get:function(){return h}}),Object.defineProperty(n,"isFunction",{enumerable:!0,get:function(){return M}}),Object.defineProperty(n,"isNil",{enumerable:!0,get:function(){return b}}),Object.defineProperty(n,"isBlank",{enumerable:!0,get:function(){return r}}),Object.defineProperty(n,"isCtor",{enumerable:!0,get:function(){return O}}),Object.defineProperty(n,"pathGetter",{enumerable:!0,get:function(){return y}}),Object.defineProperty(n,"pathSetter",{enumerable:!0,get:function(){return B}}),Object.defineProperty(n,"getPath",{enumerable:!0,get:function(){return H}}),Object.defineProperty(n,"setPath",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(n,"humanise",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(n,"escapeHtml",{enumerable:!0,get:function(){return fe}}),Object.defineProperty(n,"titleCase",{enumerable:!0,get:function(){return ue}}),Object.defineProperty(n,"expand",{enumerable:!0,get:function(){return W}}),Object.defineProperty(n,"toArray",{enumerable:!0,get:function(){return N}}),Object.defineProperty(n,"merge",{enumerable:!0,get:function(){return l}}),Object.defineProperty(n,"mergeRow",{enumerable:!0,get:function(){return e}}),Object.defineProperty(n,"Lru",{enumerable:!0,get:function(){return p}}),Object.defineProperty(n,"collator",{enumerable:!0,get:function(){return F}}),Object.defineProperty(n,"defaultCompare",{enumerable:!0,get:function(){return x}}),Object.defineProperty(n,"now",{enumerable:!0,get:function(){return J}}),Object.defineProperty(n,"nextFrame",{enumerable:!0,get:function(){return w}}),Object.defineProperty(n,"cancelFrame",{enumerable:!0,get:function(){return k}}),Object.defineProperty(n,"frameBatched",{enumerable:!0,get:function(){return D}}),Object.defineProperty(n,"settleDebounce",{enumerable:!0,get:function(){return ae}}),Object.defineProperty(n,"whenIdle",{enumerable:!0,get:function(){return te}}),Object.defineProperty(n,"uid",{enumerable:!0,get:function(){return V}});const Ne="1.88.3";async function ee(){return Ne}const o="1.88.3",ye=new Set,ce=2e3;function me(u){if(ye.add(u),ye.size>ce){const f=ye.values().next().value;f!==void 0&&ye.delete(f)}}const R=[],_=500;function re(u,f,L){R.push({key:u,level:f,message:L.map(s=>typeof s=="string"?s:q(s)).join(" "),at:Date.now()}),R.length>_&&R.shift()}function q(u){if(u instanceof Error)return u.message;try{return JSON.stringify(u)}catch{return String(u)}}function S(){return R.map(u=>({...u}))}function T(u){if(u.length===0||typeof u[0]!="string")return u;const f=u[0].replace(/^\[lattice\]\s*/,"");return f===u[0]?u:[f,...u.slice(1)]}function g(u,...f){if(ye.has(u))return;me(u);const L=T(f);re(u,"warn",L),console.warn("[lattice]",...L)}function z(u,...f){if(ye.has(u))return;me(u);const L=T(f);re(u,"info",L),console.info("[lattice]",...L)}function A(){ye.clear(),R.length=0}function i(u,f){const L=new Error(`[lattice] ${u}`);throw f!==void 0&&(L.cause=f),L}function m(u,f){u||i(f)}const c=(()=>{try{return!(typeof process<"u"&&process.env&&process.env.NODE_ENV==="production")}catch{return!0}})();function h(u){return u!==null&&typeof u=="object"&&!Array.isArray(u)}function M(u){return typeof u=="function"}function b(u){return u==null}function r(u){return u==null||u===""}function O(u){return typeof u!="function"?!1:/^class[\s{]/.test(Function.prototype.toString.call(u))?!0:!!(u.prototype&&Object.getOwnPropertyNames(u.prototype).length>1)}const t=new Map;function y(u){let f=t.get(u);if(f)return f;if(!u.includes("."))f=L=>L?.[u];else{const L=u.split("."),s=L.length;f=E=>{let a=E;for(let G=0;G<s;G++){if(a==null)return;a=a[L[G]]}return a}}return t.set(u,f),f}const I=new Map;function B(u){let f=I.get(u);if(f)return f;if(!u.includes("."))f=(L,s)=>{L!=null&&(L[u]=s)};else{const L=u.split("."),s=L.length-1;f=(E,a)=>{let G=E;for(let C=0;C<s;C++){if(G==null)return;const oe=L[C];G[oe]==null&&(G[oe]={}),G=G[oe]}G!=null&&(G[L[s]]=a)}}return I.set(u,f),f}function H(u,f){return y(f)(u)}function Y(u,f,L){B(f)(u,L)}function Q(u){return u?(u.includes(".")?u.slice(u.lastIndexOf(".")+1):u).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(/^./,L=>L.toUpperCase()):""}const he={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"};function fe(u){const f=u==null?"":String(u);return/[&<>"']/.test(f)?f.replace(/[&<>"']/g,L=>he[L]):f}function ue(u){return String(u).replace(/\w\S*/g,f=>f[0].toUpperCase()+f.slice(1).toLowerCase())}function W(u,f,L){if(u!==void 0)return u===!0?{enabled:!0,...L}:u===!1?{enabled:!1}:h(u)?u:{[f]:u,enabled:!0}}function N(u){return u==null?[]:Array.isArray(u)?u:[u]}const ne=Object.freeze(new Set(["__proto__","constructor","prototype"]));function l(u,f){if(!h(u))return h(f)?{...f}:f;if(!h(f))return f===void 0?u:f;const L={...u};for(const s of Object.keys(f)){if(ne.has(s))continue;const E=f[s];E!==void 0&&(L[s]=h(E)&&h(L[s])?l(L[s],E):E)}return L}function e(u,f){if(!h(u)||!h(f)||u===f)return f;const L=Object.create(Object.getPrototypeOf(u));return Object.assign(L,u,f),L}class p{#e;#t=new Map;#n;constructor(f=256,L=null){this.#e=f,this.#n=L}get size(){return this.#t.size}get max(){return this.#e}set max(f){this.#e=f,this.#r()}has(f){return this.#t.has(f)}get(f){const L=this.#t;if(!L.has(f))return;const s=L.get(f);return L.delete(f),L.set(f,s),s}peek(f){return this.#t.get(f)}set(f,L){const s=this.#t;return s.has(f)&&s.delete(f),s.set(f,L),this.#r(),L}delete(f){const L=this.#t.get(f);return this.#t.delete(f)&&this.#n&&this.#n(L,f),L}clear(){if(this.#n)for(const[f,L]of this.#t)this.#n(L,f);this.#t.clear()}keys(){return this.#t.keys()}values(){return this.#t.values()}#r(){const f=this.#t;for(;f.size>this.#e;){const L=f.keys().next().value,s=f.get(L);f.delete(L),this.#n&&this.#n(s,L)}}}const v=new Map;function F(u,f){const L=`${u||""}|${f?JSON.stringify(f):""}`;let s=v.get(L);return s||(s=new Intl.Collator(u||void 0,{numeric:!0,sensitivity:"variant",...f}),v.set(L,s)),s}function x(u,f){if(u===f)return 0;if(u==null)return 1;if(f==null)return-1;if(typeof u=="number"&&typeof f=="number")return Number.isNaN(u)?Number.isNaN(f)?0:1:Number.isNaN(f)||u<f?-1:u>f?1:0;const L=String(u),s=String(f);return L<s?-1:L>s?1:0}function J(){return typeof performance<"u"&&performance.now?performance.now():Date.now()}const K=typeof requestAnimationFrame=="function";function w(u){return K?requestAnimationFrame(u):setTimeout(()=>u(J()),16)}function k(u){u!=null&&(K?cancelAnimationFrame(u):clearTimeout(u))}function D(u){let f=null,L=null;const s=()=>{f=null;const a=L;L=null,u(...a||[])},E=(...a)=>{L=a,f===null&&(f=w(s))};return E.cancel=()=>{k(f),f=null,L=null},E.flush=()=>{f!==null&&(k(f),s())},E}function ae(u,f){let L=null,s=null;const E=()=>{if(L=null,s===null)return;const C=s;s=null,u(...C),a()},a=()=>{L=setTimeout(E,f),typeof L?.unref=="function"&&L.unref()},G=(...C)=>{L===null?(u(...C),a()):(s=C,clearTimeout(L),a())};return G.flush=()=>{if(L!==null&&clearTimeout(L),L=null,s===null)return;const C=s;s=null,u(...C)},G.cancel=()=>{L!==null&&clearTimeout(L),L=null,s=null},G.pending=()=>L!==null||s!==null,G}function te(u,f=50){return typeof requestIdleCallback=="function"?requestIdleCallback(u,{timeout:f}):setTimeout(()=>u({timeRemaining:()=>0,didTimeout:!0}),1)}let $=0;function V(u="l"){return`${u}${(++$).toString(36)}`}}),Ve("packages/modules/geometry/geodata.js",function(n,de){"use strict";Object.defineProperty(n,"GEOMETRY_KINDS",{enumerable:!0,get:function(){return ce}}),Object.defineProperty(n,"SPATIAL_OPERATORS",{enumerable:!0,get:function(){return me}}),Object.defineProperty(n,"GEOMETRY_OPERATORS",{enumerable:!0,get:function(){return R}}),Object.defineProperty(n,"EARTH_RADIUS",{enumerable:!0,get:function(){return _}}),Object.defineProperty(n,"toWkt",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(n,"toWkb",{enumerable:!0,get:function(){return ue}}),Object.defineProperty(n,"readGeometry",{enumerable:!0,get:function(){return F}}),Object.defineProperty(n,"parseGeometry",{enumerable:!0,get:function(){return J}}),Object.defineProperty(n,"haversine",{enumerable:!0,get:function(){return w}}),Object.defineProperty(n,"geometryInfo",{enumerable:!0,get:function(){return L}}),Object.defineProperty(n,"geometryKind",{enumerable:!0,get:function(){return s}}),Object.defineProperty(n,"spatialOperand",{enumerable:!0,get:function(){return a}}),Object.defineProperty(n,"spatialPredicate",{enumerable:!0,get:function(){return Ae}});const Ne=de("packages/core/src/internal/util.js"),ee=Ne.isNil,o=Ne.isObject,ye=Ne.warnOnce,ce=Object.freeze(["Point","LineString","Polygon","MultiPoint","MultiLineString","MultiPolygon","GeometryCollection"]),me=Object.freeze(["withinBbox","withinPolygon","intersects","withinDistance"]),R=Object.freeze([...me,"blank","notBlank"]),_=63710088e-1,re=Math.PI/180,q=16,S=1e-12;class T extends Error{}function g(P){throw new T(P)}function z(P){(!Array.isArray(P)||P.length<2)&&g("a position needs at least two numbers");const j=Number(P[0]),U=Number(P[1]);return(typeof P[0]!="number"||typeof P[1]!="number"||!Number.isFinite(j)||!Number.isFinite(U))&&g("a coordinate is not a finite number"),[j,U]}function A(P,j,U){Array.isArray(P)||g(`${U} is not an array of positions`);const se=P.map(z);return se.length<j&&g(`${U} needs at least ${j} positions, found ${se.length}`),se}function i(P){const j=A(P,3,"a polygon ring"),U=j[0],se=j[j.length-1];return(U[0]!==se[0]||U[1]!==se[1])&&j.push([U[0],U[1]]),j.length<4&&g(`a polygon ring needs at least 3 distinct corners, found ${j.length-1}`),j}function m(P){return(!Array.isArray(P)||P.length===0)&&g("a polygon needs at least an outer ring"),P.map(i)}function c(P,j){switch(j>q&&g("geometry collections nest too deeply"),o(P)||g("GeoJSON must be an object"),P.type){case"Feature":return P.geometry==null?null:c(P.geometry,j+1);case"FeatureCollection":return g("a FeatureCollection holds many rows, not one value; load its features as rows");case"Point":return{type:"Point",coordinates:z(P.coordinates)};case"MultiPoint":return{type:"MultiPoint",coordinates:A(P.coordinates,1,"a MultiPoint")};case"LineString":return{type:"LineString",coordinates:A(P.coordinates,2,"a LineString")};case"MultiLineString":return(!Array.isArray(P.coordinates)||!P.coordinates.length)&&g("a MultiLineString needs at least one line"),{type:"MultiLineString",coordinates:P.coordinates.map(U=>A(U,2,"a LineString"))};case"Polygon":return{type:"Polygon",coordinates:m(P.coordinates)};case"MultiPolygon":return(!Array.isArray(P.coordinates)||!P.coordinates.length)&&g("a MultiPolygon needs at least one polygon"),{type:"MultiPolygon",coordinates:P.coordinates.map(m)};case"GeometryCollection":{(!Array.isArray(P.geometries)||!P.geometries.length)&&g("a GeometryCollection needs at least one geometry");const U=P.geometries.map(se=>c(se,j+1)).filter(Boolean);return U.length?{type:"GeometryCollection",geometries:U}:null}default:return g(`"${String(P.type)}" is not a GeoJSON geometry type`)}}const h=Object.freeze({POINT:"Point",LINESTRING:"LineString",POLYGON:"Polygon",MULTIPOINT:"MultiPoint",MULTILINESTRING:"MultiLineString",MULTIPOLYGON:"MultiPolygon",GEOMETRYCOLLECTION:"GeometryCollection"}),M=/[-+]?(?:\d+\.?\d*|\.\d+)(?:[eE][-+]?\d+)?/y,b=/[A-Za-z]+/y,r=/^\s*(?:SRID\s*=\s*\d+\s*;\s*)?[A-Za-z]+\s*(?:ZM|Z|M)?\s*(?:\(|EMPTY\b)/i;class O{text;at=0;constructor(j){this.text=j}space(){for(;this.at<this.text.length&&/\s/.test(this.text[this.at]);)this.at++}expect(j){this.space(),this.text[this.at]!==j&&g(`WKT expected "${j}" at character ${this.at+1}, found "${this.text[this.at]??"the end"}"`),this.at++}accept(j){return this.space(),this.text[this.at]===j?(this.at++,!0):!1}word(){this.space(),b.lastIndex=this.at;const j=b.exec(this.text);return j?(this.at+=j[0].length,j[0].toUpperCase()):""}numberNext(){return this.space(),M.lastIndex=this.at,M.test(this.text)}number(){this.space(),M.lastIndex=this.at;const j=M.exec(this.text);return j||g(`WKT expected a number at character ${this.at+1}`),this.at+=j[0].length,Number(j[0])}position(){const j=this.number(),U=this.number();for(;this.numberNext();)this.number();return[j,U]}positionList(){this.expect("(");const j=[this.position()];for(;this.accept(",");)j.push(this.position());return this.expect(")"),j}empty(){const j=this.at;return this.word()==="EMPTY"?!0:(this.at=j,!1)}geometry(j){j>q&&g("geometry collections nest too deeply");const U=this.word(),se=h[U];se||g(U?`"${U}" is not a WKT geometry type`:"WKT expected a geometry type");const Oe=this.at,xe=this.word();return xe!=="Z"&&xe!=="M"&&xe!=="ZM"&&(this.at=Oe),this.empty()?null:this.body(se,j)}body(j,U){switch(j){case"Point":{this.expect("(");const se=this.position();return this.expect(")"),{type:"Point",coordinates:se}}case"LineString":return{type:"LineString",coordinates:A(this.positionList(),2,"a LineString")};case"Polygon":return{type:"Polygon",coordinates:this.polygonBody()};case"MultiPoint":{this.expect("(");const se=[];do this.empty()||(this.accept("(")?(se.push(this.position()),this.expect(")")):se.push(this.position()));while(this.accept(","));return this.expect(")"),se.length?{type:"MultiPoint",coordinates:se}:null}case"MultiLineString":{const se=this.parts(()=>A(this.positionList(),2,"a LineString"));return se.length?{type:"MultiLineString",coordinates:se}:null}case"MultiPolygon":{const se=this.parts(()=>this.polygonBody());return se.length?{type:"MultiPolygon",coordinates:se}:null}default:{this.expect("(");const se=[];do{const Oe=this.geometry(U+1);Oe&&se.push(Oe)}while(this.accept(","));return this.expect(")"),se.length?{type:"GeometryCollection",geometries:se}:null}}}parts(j){this.expect("(");const U=[];do this.empty()||U.push(j());while(this.accept(","));return this.expect(")"),U}polygonBody(){return m(this.parts(()=>this.positionList()))}}function t(P){const j=new O(String(P).replace(/^\s*SRID\s*=\s*\d+\s*;/i,"")),U=j.geometry(0);return j.space(),j.at<j.text.length&&g(`WKT has unexpected text after the geometry at character ${j.at+1}`),U}function y(P){return Object.is(P,-0)?"0":String(P)}function I(P){return`${y(P[0])} ${y(P[1])}`}function B(P){return`(${P.map(I).join(", ")})`}function H(P){return`(${P.map(B).join(", ")})`}function Y(P){const j=J(P);return j?Q(j):""}function Q(P){switch(P.type){case"Point":return`POINT (${I(P.coordinates)})`;case"LineString":return`LINESTRING ${B(P.coordinates)}`;case"Polygon":return`POLYGON ${H(P.coordinates)}`;case"MultiPoint":return`MULTIPOINT (${P.coordinates.map(j=>`(${I(j)})`).join(", ")})`;case"MultiLineString":return`MULTILINESTRING (${P.coordinates.map(B).join(", ")})`;case"MultiPolygon":return`MULTIPOLYGON (${P.coordinates.map(H).join(", ")})`;default:return`GEOMETRYCOLLECTION (${P.geometries.map(Q).join(", ")})`}}class he{view;at=0;constructor(j){this.view=new DataView(j.buffer,j.byteOffset,j.byteLength)}need(j){this.at+j>this.view.byteLength&&g(`WKB ends after ${this.view.byteLength} bytes, in the middle of a geometry`)}u8(){return this.need(1),this.view.getUint8(this.at++)}u32(j){this.need(4);const U=this.view.getUint32(this.at,j);return this.at+=4,U}f64(j){this.need(8);const U=this.view.getFloat64(this.at,j);return this.at+=8,U}count(j,U){const se=this.u32(j);return se*U>this.view.byteLength-this.at&&g(`WKB claims ${se} elements, more than its bytes can hold`),se}position(j,U){const se=this.f64(j),Oe=this.f64(j);for(let xe=2;xe<U;xe++)this.f64(j);return[se,Oe]}positions(j,U){const se=this.count(j,8*U),Oe=new Array(se);for(let xe=0;xe<se;xe++)Oe[xe]=this.position(j,U);return Oe}geometry(j,U){j>q&&g("geometry collections nest too deeply");const se=this.u8();se!==0&&se!==1&&g(`WKB byte-order mark is ${se}, not 0 or 1`);const Oe=se===1,xe=this.u32(Oe);let je=2;xe&2147483648&&je++,xe&1073741824&&je++,xe&536870912&&this.u32(Oe);let Fe=xe&268435455;if(Fe>=1e3){const Be=Math.floor(Fe/1e3);Be>3&&g(`WKB geometry type ${Fe} is not one this reads`),je=2+(Be===3?2:1),Fe%=1e3}const Ie=ce[Fe-1];switch(Ie||g(`WKB geometry type ${Fe} is not one this reads`),U&&Ie!==U&&g(`a part of a WKB Multi${U} is a ${Ie}`),Ie){case"Point":{const Be=this.position(Oe,je);return Number.isNaN(Be[0])&&Number.isNaN(Be[1])?null:{type:"Point",coordinates:z(Be)}}case"LineString":return{type:"LineString",coordinates:A(this.positions(Oe,je),2,"a LineString")};case"Polygon":{const Be=this.count(Oe,4),Re=[];for(let Ke=0;Ke<Be;Ke++)Re.push(this.positions(Oe,je));return Be?{type:"Polygon",coordinates:m(Re)}:null}default:{const Be=this.count(Oe,5),Re=Ie==="GeometryCollection"?void 0:Ie.slice(5),Ke=[];for(let rt=0;rt<Be;rt++){const Nt=this.geometry(j+1,Re);Nt&&Ke.push(Nt)}return Ke.length?Ie==="GeometryCollection"?{type:Ie,geometries:Ke}:{type:Ie,coordinates:Ke.map(rt=>rt.coordinates)}:null}}}}function fe(P){const j=new he(P),U=j.geometry(0);return j.at!==P.byteLength&&g(`WKB has ${P.byteLength-j.at} bytes left over after the geometry`),U}function ue(P){const j=J(P);if(!j)return null;const U=[];let se=0;const Oe=Re=>{const Ke=new DataView(new ArrayBuffer(5));Ke.setUint8(0,1),Ke.setUint32(1,ce.indexOf(Re)+1,!0),U.push(Ke),se+=5},xe=Re=>{const Ke=new DataView(new ArrayBuffer(4));Ke.setUint32(0,Re,!0),U.push(Ke),se+=4},je=Re=>{const Ke=new DataView(new ArrayBuffer(16*Re.length));Re.forEach((rt,Nt)=>{Ke.setFloat64(Nt*16,rt[0],!0),Ke.setFloat64(Nt*16+8,rt[1],!0)}),U.push(Ke),se+=16*Re.length},Fe=Re=>{switch(Oe(Re.type),Re.type){case"Point":je([Re.coordinates]);break;case"LineString":xe(Re.coordinates.length),je(Re.coordinates);break;case"Polygon":xe(Re.coordinates.length);for(const Ke of Re.coordinates)xe(Ke.length),je(Ke);break;case"GeometryCollection":xe(Re.geometries.length);for(const Ke of Re.geometries)Fe(Ke);break;default:{const Ke=Re.type.slice(5);xe(Re.coordinates.length);for(const rt of Re.coordinates)Fe({type:Ke,coordinates:rt})}}};Fe(j);const Ie=new Uint8Array(se);let Be=0;for(const Re of U)Ie.set(new Uint8Array(Re.buffer),Be),Be+=Re.byteLength;return Ie}const W=/^0[01](?:[0-9a-fA-F]{2})+$/,N=/^[A-Za-z0-9+/_-]+={0,2}$/,ne=(()=>{const P=new Int16Array(128).fill(-1),j="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(let U=0;U<j.length;U++)P[j.charCodeAt(U)]=U;return P[45]=62,P[95]=63,P})();function l(P){const j=new Uint8Array(P.length/2);for(let U=0;U<j.length;U++)j[U]=parseInt(P.slice(U*2,U*2+2),16);return j}function e(P){const j=P.replace(/=+$/,""),U=new Uint8Array(Math.floor(j.length*3/4));let se=0,Oe=0,xe=0;for(let je=0;je<j.length;je++)Oe=Oe<<6|ne[j.charCodeAt(je)],se+=6,se>=8&&(se-=8,U[xe++]=Oe>>se&255);return U.subarray(0,xe)}function p(P){const j=P.trim();if(j==="")return null;if(j[0]==="{"){let U;try{U=JSON.parse(j)}catch{return g("the text starts like GeoJSON but is not valid JSON")}return c(U,0)}if(W.test(j))return fe(l(j));if(r.test(j))return t(j);if(N.test(j)){const U=e(j);if(U.length>=5&&(U[0]===0||U[0]===1))return fe(U)}return g("the text is not WKT, GeoJSON, or hex or base64 WKB")}const v=new WeakSet;function F(P){if(ee(P))return{geometry:null,reason:null};if(typeof P=="object"&&v.has(P))return{geometry:P,reason:null};try{let j;return typeof P=="string"?j=p(P):P instanceof Uint8Array?j=fe(P):P instanceof ArrayBuffer?j=fe(new Uint8Array(P)):ArrayBuffer.isView(P)?j=fe(new Uint8Array(P.buffer,P.byteOffset,P.byteLength)):o(P)?j=c(P,0):g(`${Array.isArray(P)?"an array":`a ${typeof P}`} is not a geometry`),j&&x(j),{geometry:j||null,reason:null}}catch(j){if(j instanceof T)return{geometry:null,reason:j.message};throw j}}function x(P){if(v.add(P),P.type==="GeometryCollection")for(const j of P.geometries)x(j)}function J(P){return F(P).geometry}function K(P,j){switch(P.type){case"Point":j(P.coordinates);break;case"MultiPoint":case"LineString":P.coordinates.forEach(j);break;case"MultiLineString":case"Polygon":for(const U of P.coordinates)U.forEach(j);break;case"MultiPolygon":for(const U of P.coordinates)for(const se of U)se.forEach(j);break;default:for(const U of P.geometries)K(U,j)}}function w(P,j){const U=P[1]*re,se=j[1]*re,Oe=se-U,xe=(j[0]-P[0])*re,je=Math.sin(Oe/2)**2+Math.cos(U)*Math.cos(se)*Math.sin(xe/2)**2;return 2*_*Math.asin(Math.min(1,Math.sqrt(je)))}function k(P){let j=0;for(let U=1;U<P.length;U++)j+=w(P[U-1],P[U]);return j}function D(P){const j=P.length-1;if(j<3)return 0;let U=0;for(let se=0;se<j;se++){const Oe=P[(se-1+j)%j],xe=P[(se+1)%j];U+=(xe[0]-Oe[0])*re*Math.sin(P[se][1]*re)}return Math.abs(U)*_*_/2}function ae(P){let j=D(P[0]);for(let U=1;U<P.length;U++)j-=D(P[U]);return Math.max(0,j)}function te(P){let j=0,U=0,se=0;for(let Oe=0;Oe<P.length-1;Oe++){const[xe,je]=P[Oe],[Fe,Ie]=P[Oe+1],Be=xe*Ie-Fe*je;j+=Be,U+=(xe+Fe)*Be,se+=(je+Ie)*Be}return{a:j,cx:U,cy:se}}function $(){let P=0,j=0,U=0;return{add(se,Oe,xe){P+=se*xe,j+=Oe*xe,U+=xe},get(){return U>0?[P/U,j/U]:null}}}function V(P){let j=0,U=0;for(const se of P)j+=se[0],U+=se[1];return[j/P.length,U/P.length]}function u(P,j){switch(P.type){case"Point":j[0].add(P.coordinates[0],P.coordinates[1],1);break;case"MultiPoint":for(const U of P.coordinates)j[0].add(U[0],U[1],1);break;case"LineString":case"MultiLineString":{const U=P.type==="LineString"?[P.coordinates]:P.coordinates;for(const se of U){for(let Oe=1;Oe<se.length;Oe++){const[xe,je]=se[Oe-1],[Fe,Ie]=se[Oe],Be=Math.hypot(Fe-xe,Ie-je);j[1].add((xe+Fe)/2,(je+Ie)/2,Be)}for(const Oe of se)j[0].add(Oe[0],Oe[1],1)}break}case"Polygon":case"MultiPolygon":{const U=P.type==="Polygon"?[P.coordinates]:P.coordinates;for(const se of U){let Oe=0,xe=0,je=0;se.forEach((Ie,Be)=>{const Re=te(Ie),Ke=(Be===0?1:-1)*(Re.a<0?-1:1);Oe+=Ke*Re.a,xe+=Ke*Re.cx,je+=Ke*Re.cy}),Math.abs(Oe)>S&&j[2].add(xe/(3*Oe),je/(3*Oe),Math.abs(Oe)/2);const Fe=se[0].slice(0,-1);for(const Ie of Fe)j[0].add(Ie[0],Ie[1],1)}break}default:for(const U of P.geometries)u(U,j)}}const f=new WeakMap;function L(P){const j=J(P);if(!j)return null;const U=f.get(j);if(U)return U;const se=[1/0,1/0,-1/0,-1/0];K(j,Re=>{Re[0]<se[0]&&(se[0]=Re[0]),Re[1]<se[1]&&(se[1]=Re[1]),Re[0]>se[2]&&(se[2]=Re[0]),Re[1]>se[3]&&(se[3]=Re[1])});const Oe=[$(),$(),$()];u(j,Oe);const xe=Oe[2].get()||Oe[1].get()||Oe[0].get()||V([[se[0],se[1]],[se[2],se[3]]]);let je=0,Fe=0;const Ie=Re=>{switch(Re.type){case"LineString":je+=k(Re.coordinates);break;case"MultiLineString":for(const Ke of Re.coordinates)je+=k(Ke);break;case"Polygon":Fe+=ae(Re.coordinates);for(const Ke of Re.coordinates)je+=k(Ke);break;case"MultiPolygon":for(const Ke of Re.coordinates){Fe+=ae(Ke);for(const rt of Ke)je+=k(rt)}break;case"GeometryCollection":for(const Ke of Re.geometries)Ie(Ke);break;default:break}};Ie(j);const Be=Object.freeze({kind:j.type,bbox:Object.freeze(se),centroid:Object.freeze(xe),length:je,area:Fe});return f.set(j,Be),Be}function s(P){const j=L(P);return j?j.kind:null}function E(P,j){const U=typeof P=="string"?P.split(/[\s,;]+/).filter(Boolean):P;if(!Array.isArray(U)||U.length!==j)return null;const se=U.map(Oe=>typeof Oe=="number"?Oe:typeof Oe=="string"?Number(Oe):NaN);return se.every(Number.isFinite)?se:null}function a(P,j){if(P==="withinBbox"){const U=E(j,4);return U?U[0]>U[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"'}:U[1]>U[3]?{reason:"the box's minLat is above its maxLat"}:{operand:U}:{reason:"withinBbox needs [minLon, minLat, maxLon, maxLat]"}}if(P==="withinDistance"){let U=null;if(o(j)&&!Array.isArray(j)){const se=j;U=E([se.lon,se.lat,se.metres],3)}else U=E(j,3);return!U||U[2]<0?{reason:"withinDistance needs { lon, lat, metres } with metres of 0 or more"}:{operand:{lon:U[0],lat:U[1],metres:U[2]}}}if(P==="withinPolygon"||P==="intersects"){const U=P==="intersects"?E(j,4):null;if(U){if(U[0]>U[2]||U[1]>U[3])return{reason:"the box's minimum is above its maximum"};const[xe,je,Fe,Ie]=U;return{operand:{type:"Polygon",coordinates:[[[xe,je],[Fe,je],[Fe,Ie],[xe,Ie],[xe,je]]]}}}const{geometry:se,reason:Oe}=F(j);return se?P==="withinPolygon"&&se.type!=="Polygon"&&se.type!=="MultiPolygon"?{reason:`withinPolygon needs a Polygon or MultiPolygon, not a ${se.type}`}:{operand:se}:{reason:`${P} needs a geometry: ${Oe||"none was given"}`}}return{reason:`"${P}" is not a spatial operator`}}function G(P,j){const[U,se]=P;let Oe=!1;for(let xe=0,je=j.length-2;xe<j.length-1;je=xe++){const[Fe,Ie]=j[xe],[Be,Re]=j[je];Ie>se!=Re>se&&U<(Be-Fe)*(se-Ie)/(Re-Ie)+Fe&&(Oe=!Oe)}return Oe}function C(P,j){if(!G(P,j[0]))return!1;for(let U=1;U<j.length;U++)if(G(P,j[U]))return!1;return!0}function oe(P,j={points:[],segments:[],polygons:[]}){const U=se=>{for(let Oe=1;Oe<se.length;Oe++)j.segments.push([se[Oe-1],se[Oe]]);for(const Oe of se)j.points.push(Oe)};switch(P.type){case"Point":j.points.push(P.coordinates);break;case"MultiPoint":for(const se of P.coordinates)j.points.push(se);break;case"LineString":U(P.coordinates);break;case"MultiLineString":P.coordinates.forEach(U);break;case"Polygon":j.polygons.push(P.coordinates),P.coordinates.forEach(U);break;case"MultiPolygon":for(const se of P.coordinates)j.polygons.push(se),se.forEach(U);break;default:for(const se of P.geometries)oe(se,j)}return j}function le(P,j,U){const se=(j[0]-P[0])*(U[1]-P[1])-(j[1]-P[1])*(U[0]-P[0]);return Math.abs(se)<=S?0:Math.sign(se)}function X(P,j,U){return P[0]>=Math.min(j[0],U[0])-S&&P[0]<=Math.max(j[0],U[0])+S&&P[1]>=Math.min(j[1],U[1])-S&&P[1]<=Math.max(j[1],U[1])+S}function Z(P,j){const[U,se]=P,[Oe,xe]=j,je=le(U,se,Oe),Fe=le(U,se,xe),Ie=le(Oe,xe,U),Be=le(Oe,xe,se);return je!==Fe&&Ie!==Be?!0:je===0&&X(Oe,U,se)||Fe===0&&X(xe,U,se)||Ie===0&&X(U,Oe,xe)||Be===0&&X(se,Oe,xe)}function we(P,j){return P[0]<=j[2]&&j[0]<=P[2]&&P[1]<=j[3]&&j[1]<=P[3]}function Se(P,j){const U=L(P),se=L(j);if(!we(U.bbox,se.bbox))return!1;const Oe=oe(P),xe=oe(j);for(const je of xe.polygons)for(const Fe of Oe.points)if(C(Fe,je))return!0;for(const je of Oe.polygons)for(const Fe of xe.points)if(C(Fe,je))return!0;for(const je of Oe.segments)for(const Fe of xe.segments)if(Z(je,Fe))return!0;for(const je of Oe.points){for(const Fe of xe.points)if(Math.abs(je[0]-Fe[0])<=S&&Math.abs(je[1]-Fe[1])<=S)return!0;for(const Fe of xe.segments)if(le(Fe[0],Fe[1],je)===0&&X(je,Fe[0],Fe[1]))return!0}for(const je of xe.points)for(const Fe of Oe.segments)if(le(Fe[0],Fe[1],je)===0&&X(je,Fe[0],Fe[1]))return!0;return!1}function Ae(P,j){const{operand:U,reason:se}=a(P,j);if(se)return ye(`filter:geometry:${P}`,`a "${P}" condition was refused: ${se}. It matches no row rather than guessing.`),()=>!1;switch(P){case"withinBbox":return Oe=>{const xe=L(Oe);if(!xe)return!1;const je=xe.bbox;return je[0]>=U[0]&&je[1]>=U[1]&&je[2]<=U[2]&&je[3]<=U[3]};case"withinPolygon":{const Oe=U.type==="Polygon"?[U.coordinates]:U.coordinates,xe=je=>Oe.some(Fe=>C(je,Fe));return je=>{const Fe=J(je);return Fe?Fe.type==="Point"?xe(Fe.coordinates):Fe.type==="MultiPoint"?Fe.coordinates.every(xe):xe(L(Fe).centroid):!1}}case"intersects":return Oe=>{const xe=J(Oe);return!!xe&&Se(xe,U)};default:{const Oe=[U.lon,U.lat];return xe=>{const je=L(xe);return!!je&&w(je.centroid,Oe)<=U.metres}}}}}),Ve("packages/core/src/source/filterwire.js",function(n,de){"use strict";Object.defineProperty(n,"HOST_FILTER_WARN_ID",{enumerable:!0,get:function(){return o}}),Object.defineProperty(n,"WHERE_PAGE_RELATIVE_WARN_ID",{enumerable:!0,get:function(){return ye}}),Object.defineProperty(n,"warnWherePageRelative",{enumerable:!0,get:function(){return ce}}),Object.defineProperty(n,"warnHostFilterNotApplied",{enumerable:!0,get:function(){return me}}),Object.defineProperty(n,"WHERE_NOT_APPLIED_WARN_ID",{enumerable:!0,get:function(){return R}}),Object.defineProperty(n,"warnWhereNotApplied",{enumerable:!0,get:function(){return _}}),Object.defineProperty(n,"WHERE_OVER_THRESHOLD_WARN_ID",{enumerable:!0,get:function(){return re}}),Object.defineProperty(n,"warnWhereOverThreshold",{enumerable:!0,get:function(){return q}}),Object.defineProperty(n,"RELATIVE_TOKENS",{enumerable:!0,get:function(){return c}}),Object.defineProperty(n,"parseRelativeToken",{enumerable:!0,get:function(){return h}}),Object.defineProperty(n,"resolveRelativeRange",{enumerable:!0,get:function(){return M}}),Object.defineProperty(n,"relativeTokenOf",{enumerable:!0,get:function(){return b}}),Object.defineProperty(n,"relativeTokenHelp",{enumerable:!0,get:function(){return r}}),Object.defineProperty(n,"isResolvableRelative",{enumerable:!0,get:function(){return O}}),Object.defineProperty(n,"resolveRelativeCondition",{enumerable:!0,get:function(){return t}}),Object.defineProperty(n,"isGroup",{enumerable:!0,get:function(){return y}}),Object.defineProperty(n,"forEachCondition",{enumerable:!0,get:function(){return I}}),Object.defineProperty(n,"mapConditions",{enumerable:!0,get:function(){return B}}),Object.defineProperty(n,"normaliseFilterSet",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(n,"buildFilterSet",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(n,"wireFilters",{enumerable:!0,get:function(){return he}}),Object.defineProperty(n,"querySignature",{enumerable:!0,get:function(){return fe}});const ee=de("packages/core/src/internal/util.js").warnOnce,o="source.remote.hostFilter",ye="source.where.pageRelative";function ce(N,ne){!Array.isArray(N)||!N.length||ee(ye,`filters.where (${N.join(", ")}) runs over the rows the ${ne} 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 me(N){const ne=(N||{}).config;!ne||!ne.hostFilter||ee(o,"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 R="source.where.notApplied";function _(N,ne){ee(`${R}:${N}`,`filters.where("${N}") is registered but the ${ne} 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 q(N,ne,l,e){!Array.isArray(N)||!N.length||ee(`${re}:${ne}`,`filters.where (${N.join(", ")}) is not applied to the ${ne} pushdown source:`,l===null?"the adapter reports no row total, so the size of the matching set is unknown.":`its matching set is ${l.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 S=new Map;function T(N){let ne=S.get(N);return ne||(ne=new Intl.DateTimeFormat("en-US",{timeZone:N,hourCycle:"h23",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}),S.set(N,ne)),ne}function g(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone||"UTC"}catch{return"UTC"}}function z(N,ne){const l=T(ne).formatToParts(new Date(N)),e={y:1970,m:1,d:1,h:0,mi:0,s:0};for(const p of l)p.type==="year"?e.y=+p.value:p.type==="month"?e.m=+p.value:p.type==="day"?e.d=+p.value:p.type==="hour"?e.h=+p.value%24:p.type==="minute"?e.mi=+p.value:p.type==="second"&&(e.s=+p.value);return e}function A(N,ne){const l=z(N,ne);return Date.UTC(l.y,l.m-1,l.d,l.h,l.mi,l.s)-Math.floor(N/1e3)*1e3}function i(N,ne,l,e){const p=Date.UTC(N,ne-1,l),v=p-A(p,e);return p-A(v,e)}function m(N,ne,l){const e=new Date(Date.UTC(N.y,N.m-1,N.d+ne));return i(e.getUTCFullYear(),e.getUTCMonth()+1,e.getUTCDate(),l)}const c=Object.freeze(["today","yesterday","lastNDays","thisWeek","thisMonth","thisQuarter","thisYear","quarterToDate","yearToDate"]);function h(N,ne){if(typeof N!="string")return null;const l=N.trim().toLowerCase().replace(/[\s_-]+/g,""),e=/^last(\d*|n)days?$/.exec(l);if(e){const p=e[1]==="n"?"":e[1],v=Number(p||ne);return!Number.isFinite(v)||v<=0?null:{kind:"lastNDays",n:Math.floor(v)}}switch(l){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 M(N,ne={}){const l=h(N,ne.n);if(!l)return null;const e=ne.tz||g(),p=ne.now instanceof Date?ne.now.getTime():typeof ne.now=="number"?ne.now:Date.now(),v=z(p,e),F=i(v.y,v.m,v.d,e),x=m(v,1,e);let J=F,K=x;switch(l.kind){case"today":break;case"yesterday":J=m(v,-1,e),K=F;break;case"lastNDays":K=ne.includeToday?x:F,J=m(v,ne.includeToday?-(l.n-1):-l.n,e);break;case"thisWeek":{const w=Number.isFinite(ne.weekStartsOn)?Number(ne.weekStartsOn):1,D=(new Date(Date.UTC(v.y,v.m-1,v.d)).getUTCDay()-w+7)%7;J=m(v,-D,e),K=m(v,-D+7,e);break}case"thisMonth":J=i(v.y,v.m,1,e),K=i(v.m===12?v.y+1:v.y,v.m===12?1:v.m+1,1,e);break;case"thisQuarter":case"quarterToDate":{const w=Math.floor((v.m-1)/3)*3+1;J=i(v.y,w,1,e),K=l.kind==="quarterToDate"?x:w===10?i(v.y+1,1,1,e):i(v.y,w+3,1,e);break}case"thisYear":case"yearToDate":J=i(v.y,1,1,e),K=l.kind==="yearToDate"?x:i(v.y+1,1,1,e);break;default:return null}return{from:new Date(J).toISOString(),to:new Date(K).toISOString(),bounds:"[)",tz:e,relative:l.kind==="lastNDays"?`last${l.n}Days`:l.kind,n:l.n}}function b(N){if(!N||typeof N!="object")return null;const ne=N.value;if(ne&&typeof ne=="object"&&!Array.isArray(ne)&&"relative"in ne)return{token:String(ne.relative),n:typeof ne.n=="number"?ne.n:void 0};if(N.op==="relative"&&typeof N.value=="string")return{token:N.value,n:void 0};const l=N.meta;return l&&typeof l.relative=="string"&&N.value===void 0?{token:l.relative,n:typeof l.n=="number"?l.n:void 0}:null}function r(){return`Known tokens: ${c.filter(ne=>ne!=="lastNDays").join(", ")}. "lastNDays" needs a count: pass "last7Days", or the value object { relative: 'lastNDays', n: 7 }.`}function O(N){const ne=b(N);return ne?h(ne.token,ne.n)!==null:!1}function t(N,ne={}){const l=b(N);if(!l)return N;const e=M(l.token,{...ne,n:l.n});return e?{...N,type:N.type||"date",op:"between",value:[e.from,e.to],bounds:N.bounds||e.bounds,meta:{...N.meta||{},relative:e.relative,tz:e.tz}}:(ee(`source.relative.${l.token}`,`unknown relative date token "${l.token}"; sending the condition unresolved.`,r()),N)}function y(N){return!!N&&typeof N=="object"&&Array.isArray(N.conditions)}function I(N,ne){if(N){if(y(N)){for(const l of N.conditions)I(l,ne);return}ne(N)}}function B(N,ne){if(!N)return null;if(!y(N))return ne(N);const l=N;let e=!1;const p=[];for(const v of l.conditions){const F=B(v,ne);F!==v&&(e=!0),F&&p.push(F)}return!e&&p.length===l.conditions.length?N:p.length?{...l,conditions:p}:null}function H(N){if(!N)return null;if(!y(N))return N;const ne=N,l=[];for(const e of ne.conditions){const p=H(e);p&&l.push(p)}return l.length?{op:ne.op,conditions:l}:null}function Y(N){const ne=H(N);return ne?y(ne)&&ne.op==="and"?ne:{op:"and",conditions:[ne]}:null}function Q(N){const ne=(N||[]).filter(Boolean);return ne.length?{op:"and",conditions:ne}:null}function he(N,ne={}){const l=B(N,e=>t(e,ne));return Y(l)}function fe(N){const ne=ue(N.filters??null);return JSON.stringify([ne,N.sort??null,N.quick??"",N.groupBy??null,N.pivotBy??null,W(N.context)])}function ue(N){if(!N)return null;if(y(N)){const e=N;return{op:e.op,conditions:e.conditions.map(ue)}}const ne=N,l=ne.meta&&typeof ne.meta.relative=="string"?ne.meta.relative:b(ne)?.token;return{col:ne.col,op:ne.op,bounds:ne.bounds??null,caseSensitive:ne.caseSensitive??!1,value:l?`rel:${l}`:ne.value??null}}function W(N){if(N==null)return null;try{return JSON.parse(JSON.stringify(N))}catch{return ee("source.context.unserialisable","config.context is not JSON-serialisable; cache keys ignore it."),"[unserialisable]"}}}),Ve("packages/core/src/source/aggregates.js",function(n,de){"use strict";Object.defineProperty(n,"STAT_PUSHDOWN",{enumerable:!0,get:function(){return Ne}}),Object.defineProperty(n,"pushableAggregates",{enumerable:!0,get:function(){return ee}}),Object.defineProperty(n,"fillAggregateSql",{enumerable:!0,get:function(){return o}}),Object.defineProperty(n,"resolveAggregatesConfig",{enumerable:!0,get:function(){return ye}}),Object.defineProperty(n,"routeAggregate",{enumerable:!0,get:function(){return ce}}),Object.defineProperty(n,"resolveAggregatePlan",{enumerable:!0,get:function(){return me}}),Object.defineProperty(n,"groupKeysPushable",{enumerable:!0,get:function(){return _}}),Object.defineProperty(n,"pushdownDocRows",{enumerable:!0,get:function(){return re}});const Ne=Object.freeze({sum:{pushable:!0,class:"identical",sql:"sum(%c)"},avg:{pushable:!0,class:"identical",sql:"avg(%c)"},min:{pushable:!0,class:"identical",sql:"min(%c)"},max:{pushable:!0,class:"identical",sql:"max(%c)"},count:{pushable:!0,class:"identical",sql:"count(*)"},countValues:{pushable:!0,class:"identical",sql:"count(%c)",blankAware:!0},range:{pushable:!0,class:"identical",sql:"(max(%c) - min(%c))"},variance:{pushable:!0,class:"identical",sql:"var_samp(%c)"},varianceP:{pushable:!0,class:"identical",sql:"var_pop(%c)"},stddev:{pushable:!0,class:"identical",sql:"stddev_samp(%c)"},stddevP:{pushable:!0,class:"identical",sql:"stddev_pop(%c)"},sumSquares:{pushable:!0,class:"identical",sql:"sum(%c * %c)"},median:{pushable:!0,class:"identical",sql:"median(%c)"},p25:{pushable:!0,class:"identical",sql:"quantile_cont(%c, 0.25)"},p75:{pushable:!0,class:"identical",sql:"quantile_cont(%c, 0.75)"},p90:{pushable:!0,class:"identical",sql:"quantile_cont(%c, 0.9)"},p95:{pushable:!0,class:"identical",sql:"quantile_cont(%c, 0.95)"},p99:{pushable:!0,class:"identical",sql:"quantile_cont(%c, 0.99)"},iqr:{pushable:!0,class:"identical",sql:"(quantile_cont(%c, 0.75) - quantile_cont(%c, 0.25))"},mad:{pushable:!0,class:"identical",sql:"mad(%c)"},distinct:{pushable:!0,class:"identical",sql:"count(DISTINCT %c)",blankAware:!0},skewness:{pushable:!0,class:"identical",sql:"skewness(%c)"},kurtosis:{pushable:!0,class:"identical",sql:"kurtosis(%c)"},geomean:{pushable:!0,class:"identical",sql:"exp(avg(ln(%c)))"},harmean:{pushable:!0,class:"identical",sql:"(count(%c) / sum(1.0 / %c))"},entropy:{pushable:!0,class:"identical",sql:"entropy(%c)",blankAware:!0},correlation:{pushable:!0,class:"identical",sql:"corr(%w, %c)",twoColumn:!0},hhi:{pushable:!0,class:"identical",blankAware:!0,sql:"CASE WHEN count(%c)=0 THEN NULL ELSE list_sum(list_transform(map_values(histogram(%c)), lambda v: (v::DOUBLE/count(%c))*(v::DOUBLE/count(%c)))) END"},evenness:{pushable:!0,class:"identical",blankAware:!0,sql:"CASE WHEN count(%c)=0 THEN NULL WHEN count(DISTINCT %c)<2 THEN 1.0 ELSE entropy(%c)/log2(count(DISTINCT %c)) END"},top3Share:{pushable:!0,class:"identical",blankAware:!0,sql:"CASE WHEN count(%c)=0 THEN NULL ELSE list_sum(list_slice(list_sort(map_values(histogram(%c)),'DESC'),1,3))::DOUBLE/count(%c) END"},top10Share:{pushable:!0,class:"identical",blankAware:!0,sql:"CASE WHEN count(%c)=0 THEN NULL ELSE list_sum(list_slice(list_sort(map_values(histogram(%c)),'DESC'),1,10))::DOUBLE/count(%c) END"},gini:{pushable:!0,class:"identical",sql:"CASE WHEN list_min(list(%c) FILTER (WHERE isfinite(%c)))<0 THEN NULL WHEN len(list(%c) FILTER (WHERE isfinite(%c)))=0 THEN NULL WHEN list_sum(list(%c) FILTER (WHERE isfinite(%c)))=0 THEN 0 ELSE 2.0*list_sum(list_transform(list_sort(list(%c) FILTER (WHERE isfinite(%c))), lambda v, i: i*v))/(len(list(%c) FILTER (WHERE isfinite(%c)))*list_sum(list(%c) FILTER (WHERE isfinite(%c))))-(len(list(%c) FILTER (WHERE isfinite(%c)))+1.0)/len(list(%c) FILTER (WHERE isfinite(%c))) END"},trimmedMean:{pushable:!0,class:"identical",sql:"CASE WHEN len(list(%c) FILTER (WHERE isfinite(%c)))=0 THEN NULL ELSE list_avg(list_slice(list_sort(list(%c) FILTER (WHERE isfinite(%c))), floor(len(list(%c) FILTER (WHERE isfinite(%c)))*0.1)::BIGINT+1, len(list(%c) FILTER (WHERE isfinite(%c)))-floor(len(list(%c) FILTER (WHERE isfinite(%c)))*0.1)::BIGINT)) END"},winsorizedMean:{pushable:!0,class:"identical",sql:"CASE WHEN len(list(%c) FILTER (WHERE isfinite(%c)))=0 THEN NULL ELSE list_avg(list_transform(list_sort(list(%c) FILTER (WHERE isfinite(%c))), lambda v: least(list_sort(list(%c) FILTER (WHERE isfinite(%c)))[len(list(%c) FILTER (WHERE isfinite(%c)))-floor(len(list(%c) FILTER (WHERE isfinite(%c)))*0.1)::BIGINT], greatest(list_sort(list(%c) FILTER (WHERE isfinite(%c)))[floor(len(list(%c) FILTER (WHERE isfinite(%c)))*0.1)::BIGINT+1], v)))) END"},robustOutliers:{pushable:!0,class:"identical",sql:"(SELECT CASE WHEN len(d.a)=0 THEN NULL WHEN d.mad=0 THEN NULL ELSE len(list_filter(d.a, lambda v: abs(0.6745*(v-d.med)/d.mad)>3.5)) END FROM (SELECT xs AS a, list_median(xs) AS med, list_median(list_transform(xs, lambda w: abs(w-list_median(xs)))) AS mad FROM (SELECT list(%c) FILTER (WHERE isfinite(%c)) AS xs)) d)"},jarqueBera:{pushable:!0,class:"identical",sql:"CASE WHEN len(list(%c) FILTER (WHERE isfinite(%c)))<8 THEN NULL WHEN list_avg(list_transform(list(%c) FILTER (WHERE isfinite(%c)), lambda v: power(v-list_avg(list(%c) FILTER (WHERE isfinite(%c))),2)))=0 THEN NULL ELSE (len(list(%c) FILTER (WHERE isfinite(%c)))/6.0)*(power(list_avg(list_transform(list(%c) FILTER (WHERE isfinite(%c)), lambda v: power(v-list_avg(list(%c) FILTER (WHERE isfinite(%c))),3)))/power(list_avg(list_transform(list(%c) FILTER (WHERE isfinite(%c)), lambda v: power(v-list_avg(list(%c) FILTER (WHERE isfinite(%c))),2))),1.5),2)+power(list_avg(list_transform(list(%c) FILTER (WHERE isfinite(%c)), lambda v: power(v-list_avg(list(%c) FILTER (WHERE isfinite(%c))),4)))/power(list_avg(list_transform(list(%c) FILTER (WHERE isfinite(%c)), lambda v: power(v-list_avg(list(%c) FILTER (WHERE isfinite(%c))),2))),2)-3,2)/4.0) END"},weightedAvg:{pushable:!0,class:"identical",twoColumn:!0,sql:"sum(%c*%w) FILTER (WHERE isfinite(%c) AND isfinite(%w))/nullif(sum(%w) FILTER (WHERE isfinite(%c) AND isfinite(%w)),0)"},mode:{pushable:!0,class:"may-differ",sql:"mode(%c)",note:"DuckDB returns a modal value even for an all-distinct column; the grid returns null. Tie-breaking can also differ, and on a text column an empty string counts as a value. Under pushdown you will see a value."},weightedQuantile:{pushable:!1,class:"fallback",note:"No SQL equivalent for the grid's weighted-quantile midpoint convention; always computed client-side (needs a full-dataset pull for a correct figure over a remote source)."}});function ee(){const q=new Set;for(const[S,T]of Object.entries(Ne))T.pushable&&q.add(S);return q}function o(q,S,T){let g=q.split("%c").join(S);return T!==void 0&&(g=g.split("%w").join(T)),g}function ye(q){const S=q||{},T=S.default==="engine"||S.default==="engine-if-identical"?S.default:"client",g={};if(S.overrides&&typeof S.overrides=="object")for(const[z,A]of Object.entries(S.overrides))(A==="engine"||A==="client")&&(g[z]=A);return{default:T,overrides:g}}function ce(q,S){const T=Ne[q];if(!T||!T.pushable)return"client";const g=S.overrides[q];return g==="engine"||g==="client"?g:S.default==="client"?"client":S.default==="engine-if-identical"?T.class==="identical"?"engine":"client":"engine"}function me(q,S){const T=ye(S),g=[],z=[];for(const A of q||[]){const i=Ne[A.fn],m=ce(A.fn,T),c={id:A.id,col:A.col,fn:A.fn,class:i?i.class:"fallback"};A.weight!==void 0&&(c.weight=A.weight),A.params!==void 0&&(c.params=A.params),m==="engine"?g.push(c):(c.reason=i&&!i.pushable?i.note||"the engine cannot express this stat":"client by config",z.push(c))}return{engine:g,client:z,config:T}}const R=/^[A-Za-z_][A-Za-z0-9_$]*$/;function _(q,S=[]){return(q||[]).every(g=>{if(typeof g=="string")return R.test(g);if(!g||typeof g!="object")return!1;const z=g;return Array.isArray(S)&&S.includes(z.bucket)&&typeof z.col=="string"&&R.test(z.col)&&typeof z.size=="number"&&Number.isFinite(z.size)&&z.size>0})}function re(){return Object.entries(Ne).map(([q,S])=>({stat:q,class:S.class,sql:S.sql?o(S.sql,"col",S.twoColumn?"weight":void 0):"",note:S.note||(S.class==="identical"?"Pushes to DuckDB with the same result.":"")}))}}),Ve("packages/core/src/source/abort.js",function(n,de){"use strict";Object.defineProperty(n,"SupersededError",{enumerable:!0,get:function(){return Ne}}),Object.defineProperty(n,"RequestToken",{enumerable:!0,get:function(){return ee}}),Object.defineProperty(n,"AbortScope",{enumerable:!0,get:function(){return o}}),Object.defineProperty(n,"createAbortScope",{enumerable:!0,get:function(){return ye}}),Object.defineProperty(n,"isAbortError",{enumerable:!0,get:function(){return ce}});class Ne extends Error{constructor(R,_="superseded"){super(`[lattice] request ${R?`"${R}" `:""}${_}`),this.name="SupersededError",this.superseded=!0,this.key=R}}class ee{#e;constructor(R,_,re,q){this.#e=R,this.key=_,this.controller=re,this.signal=re.signal,this.seq=q}get current(){return!this.signal.aborted&&this.#e.tokenFor(this.key)===this}settle(){this.#e.settle(this)}abort(R){this.signal.aborted||this.controller.abort(new Ne(this.key,R)),this.#e.settle(this)}}class o{#e=new Map;#t=0;begin(R="",_="superseded"){const re=this.#e.get(R);re&&!re.signal.aborted&&re.controller.abort(new Ne(R,_));const q=new ee(this,R,new AbortController,++this.#t);return this.#e.set(R,q),q}tokenFor(R){return this.#e.get(R)}pending(R=""){const _=this.#e.get(R);return!!_&&!_.signal.aborted}get size(){return this.#e.size}settle(R){this.#e.get(R.key)===R&&this.#e.delete(R.key)}abort(R="",_="superseded"){const re=this.#e.get(R);re&&re.abort(_)}abortAll(R="superseded"){for(const _ of[...this.#e.values()])_.abort(R);this.#e.clear()}}function ye(){return new o}function ce(me){if(!me||typeof me!="object")return!1;const R=me;return R.superseded===!0||R.name==="AbortError"||R.name==="SupersededError"}}),Ve("packages/core/src/source/pushdown.js",function(n,de){"use strict";Object.defineProperty(n,"FOREGROUND_WAIT_MS",{enumerable:!0,get:function(){return i}}),Object.defineProperty(n,"NO_CAPABILITIES",{enumerable:!0,get:function(){return c}}),Object.defineProperty(n,"resolveMutate",{enumerable:!0,get:function(){return h}}),Object.defineProperty(n,"capabilitiesOf",{enumerable:!0,get:function(){return r}}),Object.defineProperty(n,"splitFilters",{enumerable:!0,get:function(){return t}}),Object.defineProperty(n,"LEAF_COUNT_ID",{enumerable:!0,get:function(){return y}}),Object.defineProperty(n,"PIVOT_UNSUPPORTED",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(n,"GROUP_UNSUPPORTED",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(n,"UNGROUPED_LEVEL",{enumerable:!0,get:function(){return he}}),Object.defineProperty(n,"planQuery",{enumerable:!0,get:function(){return ue}}),Object.defineProperty(n,"applyResidual",{enumerable:!0,get:function(){return ne}}),Object.defineProperty(n,"DEFAULT_WHERE_ROW_LIMIT",{enumerable:!0,get:function(){return v}}),Object.defineProperty(n,"createPushdownSource",{enumerable:!0,get:function(){return K}});const Ne=de("packages/core/src/internal/util.js"),ee=Ne.defaultCompare,o=Ne.isFunction,ye=Ne.toArray,ce=Ne.warnOnce,me=de("packages/core/src/source/filterwire.js"),R=me.isGroup,_=me.warnWherePageRelative,re=me.warnWhereOverThreshold,q=de("packages/core/src/source/aggregates.js"),S=q.resolveAggregatePlan,T=q.groupKeysPushable,g=q.STAT_PUSHDOWN,A=de("packages/core/src/source/abort.js").SupersededError,i=1e3;function m(w){const k=w&&w.signal;if(!k||!k.aborted)return;const D=k.reason;throw D instanceof Error?D:new A("","superseded before it was sent")}const c=Object.freeze({filter:!1,operators:Object.freeze([]),sort:!1,quick:!1,range:!1,total:!1,group:!1,pivot:!1,mutate:!1});function h(w){if(!w||typeof w!="object")return!1;const k=w.returning==="row"||w.returning==="key"?w.returning:"none";return{append:w.append===!0,update:w.update===!0,delete:w.delete===!0,returning:k}}function M(w,k){if(!w||typeof k!="string")return;if(!k.includes("."))return w[k];let D=w;for(const ae of k.split(".")){if(D===null||typeof D!="object")return;D=D[ae]}return D}function b(w){if(w===!0)return!0;if(!w||typeof w!="object")return!1;const k=w;return k.enabled===!1?!1:k.enabled===!0||o(k.commit)}function r(w){const k={...c,...w||{}};return k.operators=new Set(k.operators||[]),k.mutate=h(k.mutate),k}function O(w,k){return!w||!w.op||!k.operators.size?!1:k.operators.has(w.op)}function t(w,k){if(!w)return{pushed:null,residual:null};if(!k.filter)return{pushed:null,residual:w};if(k.filter==="term"){if(R(w)){const $=w.conditions||[];if(String(w.op)!=="and")return{pushed:null,residual:w};const V=$.findIndex(f=>!R(f)&&O(f,k));if(V<0)return{pushed:null,residual:w};const u=$.filter((f,L)=>L!==V);return{pushed:$[V],residual:u.length?{op:"and",conditions:u}:null}}return O(w,k)?{pushed:w,residual:null}:{pushed:null,residual:w}}if(!R(w))return O(w,k)?{pushed:w,residual:null}:{pushed:null,residual:w};if(String(w.op)!=="and")return(w.conditions||[]).every(V=>R(V)?t(V,k).residual===null:O(V,k))?{pushed:w,residual:null}:{pushed:null,residual:w};const D=[],ae=[];for(const $ of w.conditions||[]){if(R($)){if(k.filter==="flat"){ae.push($);continue}const V=t($,k);V.pushed&&D.push(V.pushed),V.residual&&ae.push(V.residual);continue}(O($,k)?D:ae).push($)}const te=$=>$.length===0?null:$.length===1?$[0]:{op:"and",conditions:$};return{pushed:te(D),residual:te(ae)}}const y="__lattice_leaves";function I(w){return w.aggregates?w.aggregates instanceof Set?w.aggregates:new Set(ye(w.aggregates)):new Set}function B(w){const k=I(w);return k.size?k.has("count")?w.filter!=="tree"||!w.operators||!w.operators.has("eq")?"the adapter does not declare the `group` capability, and cannot narrow a group's rows by its key (that needs a `tree` filter with the `eq` operator)":"":"the adapter does not declare the `group` capability, and its declared aggregates have no `count` to give each group its row count":"the adapter does not declare the `group` capability"}function H(w,k,D,ae,te,$,V){const u=Array.isArray(w.groupBy)?w.groupBy:[],f=Array.isArray(w.groupPath)?w.groupPath:[],L=Array.isArray(w.groupValues)?w.groupValues:null;if(!k.group){const s=B(k);if(s)return s}return T(u)?D.residual?"the filter did not fully push, so the engine would group a superset of the matching rows":ae?te?$?"a host `where` predicate can only run in the browser, over rows the engine grouped":V?"fullDataset holds the whole matching set, so the grid groups it itself":!L||L.length!==f.length?"the request carries no typed `groupValues` for its group path, and the string `groupPath` cannot be compared against a typed column":"":"a quick search did not push, so the engine would group unsearched rows":"the sort did not push, so the engine would order the groups differently":"a grouping key is not a plain column the engine can name in a GROUP BY"}const Y="pushdown:pivot-unsupported",Q="pushdown:group-unsupported",he=Symbol("lattice.remote.ungroupedLevel");function fe(w,k,D,ae,te,$){const V=Array.isArray(w.pivotBy)?w.pivotBy:[],u=Array.isArray(w.groupBy)?w.groupBy:[],f=Array.isArray(w.groupPath)?w.groupPath:[],L=Array.isArray(w.groupValues)?w.groupValues:null;return k.pivot?T(V)?u.length&&!T(u)?"a grouping key is not a plain column the engine can name in a GROUP BY":D.residual?"the filter did not fully push, so the engine would pivot a superset of the matching rows":ae?te?$?"a host `where` predicate can only run in the browser, over rows the engine pivoted":!L||L.length!==f.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 ue(w,k,D=!1){const ae=t(w.filters||null,k),te=[];ae.residual&&te.push("filter");const $=w.sort||[],V=$.length===0||k.sort==="multi"&&$.length>=1||k.sort==="single"&&$.length===1;!V&&$.length&&te.push("sort");const u=w.quick?String(w.quick):"",f=!u||!!k.quick;f||te.push("quick");const L=w.where&&w.where.active?w.where:null;L&&te.push("where");const s={filters:ae.residual,sort:V?null:$,quick:f?"":u,where:L},E=!!D,a=Array.isArray(w.groupBy)&&w.groupBy.length>0,G=a?H(w,k,ae,V,f,L,E):"",C=w.pivotMode!==!1&&Array.isArray(w.pivotBy)&&w.pivotBy.length>0,oe=C?fe(w,k,ae,V,f,L):"",le=C&&oe==="";C&&!le&&te.push("pivot");const X=C?le&&a:a&&G==="";a&&!C&&!X&&te.push("group");const Z=(X||le)&&Array.isArray(w.groupValues)?w.groupValues.length:0,we=X||C?!1:E||!!(s.filters||s.sort||s.quick||s.where)||!k.range;return{pushed:{...w,filters:ae.pushed,sort:V?$:[],quick:f?u:"",range:we?null:w.range},residual:s,needsAll:we,unpushed:te,full:E,grouped:X,groupLevel:Z,groupReason:C?"":G,pivoted:le,pivotReason:oe}}function W(w){const k=Array.isArray(w.totals)?w.totals:[],D=w.totalFns&&typeof w.totalFns=="object"?w.totalFns:{},ae=[],te=[];for(const $ of k){const V=String($),u=typeof D[V]=="string"?D[V]:null,f=u?g[u]:null;u?!f||!f.pushable||!f.sql?te.push({id:V,fn:u,class:f?f.class:"fallback",reason:f&&f.note?f.note:`the pushdown map cannot express "${u}"`}):f.twoColumn?te.push({id:V,fn:u,class:f.class,reason:`"${u}" reduces two columns, and a grouped request carries no weight column`}):ae.push({id:V,col:V,fn:u,class:f.class}):te.push({id:V,fn:null,class:"fallback",reason:"the column totals with a host function, so there is no named statistic to push"})}return{engine:ae,client:te}}const N=Object.freeze({items:w=>w==null?[]:Array.isArray(w)?w:[w]});function ne(w,k,D){if(!k)return w;let ae=w;if(k.filters&&o(D.evaluateFilters)){const te=ae,$={count:ae.length,handle:f=>({id:f,get:L=>M(te[L],f)}),itemwise:f=>te.some(L=>Array.isArray(M(L,f)))?N:null},V=D.evaluateFilters(k.filters,$),u=[];for(let f=0;f<ae.length;f++)V[f]&&u.push(ae[f]);ae=u}if(k.where&&k.where.active&&(k.whole||_(k.where.names,"pushdown"),ae=ae.filter(te=>k.where.passes(te))),k.quick){const te=k.quick.toLowerCase();ae=ae.filter($=>{if(!$||typeof $!="object")return!1;for(const V of Object.values($))if(V!=null&&String(V).toLowerCase().includes(te))return!0;return!1})}if(k.sort&&k.sort.length&&o(D.sortMulti)){const te=[...new Set(k.sort.map(f=>f.col))],$=ae,V=te.map(f=>({id:f,get:L=>M($[L],f)})),u=D.sortMulti(V,k.sort.map(f=>({col:f.col,dir:f.dir})),Uint32Array.from({length:ae.length},(f,L)=>L),{});ae=Array.from(u,f=>$[f])}return ae}function l(w){return JSON.stringify({filters:w.filters||null,sort:w.sort||[],quick:w.quick||"",groupBy:w.groupBy||[],groupPath:w.groupPath||[],context:w.context??null})}function e(w){if(!w||typeof w!="object")return 16;let k="";try{k=JSON.stringify(w)}catch{return 200}return k.length*2+64}function p(w){const k=w||{};return{enabled:!!k.enabled,maxRows:Number.isFinite(k.maxRows)?k.maxRows:1e6,maxBytesEstimate:Number.isFinite(k.maxBytesEstimate)?k.maxBytesEstimate:512*1024*1024}}const v=5e4;function F(w){return Number.isFinite(w)&&w>=0?w:v}function x(w){return!!w&&o(w.then)}async function J(w){if(!w||w.total!==void 0||!x(w.pendingTotal))return w;const k=await w.pendingTotal,{pendingTotal:D,...ae}=w;return typeof k=="number"?{...ae,total:k}:ae}function K(w={}){const k=w.adapter;if(!k||!o(k.execute))return ce("source.pushdown.adapter","createPushdownSource needs an `adapter` with an `execute(query)` function."),{...w,mode:"remote",fetch:async()=>({rows:[],total:0})};const D=r(k.capabilities),ae=k.capabilities&&Object.getOwnPropertyDescriptor(k.capabilities,"operators");ae&&o(ae.get)&&Object.defineProperty(D,"operators",{enumerable:!0,configurable:!0,get:()=>new Set(k.capabilities.operators||[]),set:()=>{}});const te=k.name||"adapter";let $=null;const V=()=>o(k.ready)?($||($=Promise.resolve(k.ready()).then(()=>{Object.assign(D,r(k.capabilities))},Ce=>{throw $=null,Ce})),$):null,u=p(w.fullDataset),f=!!w.allowPartialResults,L=F(w.whereRowLimit);let s=null;const E=w.aggregates;let a=null,G=null,C=null,oe=null,le=null,X,Z=null,we=0,Se=null;const Ae=()=>!u.enabled||!a?null:(Se!==a.key&&(we++,Se=a.key),{rows:a.rows,version:we}),P=async Ce=>{const Me=Ce.where&&Ce.where.active?Ce.where:null;if(!Me)return{request:Ce,probe:null};const{where:Ge,...We}=Ce,Le=ue(We,D,u.enabled);if(Le.needsAll)return{request:Ce,probe:null};const Je=l(Le.pushed);let Xe=null;return(!s||s.key!==Je)&&(D.total?(m(Ce),Xe=await J(await k.execute(Le.pushed,Ce)),s={key:Je,size:Xe&&typeof Xe.total=="number"?Xe.total:null}):s={key:Je,size:null}),s.size!==null&&s.size<L?{request:Ce,probe:null}:(re(Me.names,te,s.size,L),{request:We,probe:Xe})},j=async(Ce,Me)=>{Z=null;const Ge=W(Ce.pushed);C={engine:Ge.engine,client:Ge.client,groupBy:Ce.pushed.groupBy},Ge.client.length&&ce(`source.pushdown.group.totals.${te}.${Ge.client.map(Je=>Je.id).join(".")}`,`the ${te} 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 We=await k.executeGroupLevel(Ce.pushed,Ge.engine,Me)||{};let Le=We.rows||[];return!D.range&&Me.range&&(Le=Le.slice(Me.range.start,Me.range.end)),xe(We),We.total===void 0?{rows:Le}:{rows:Le,total:We.total}},U=new Map,se=64,Oe=async(Ce,Me)=>{Z=null;const Ge=Ce.pushed,We=Ge.groupBy,Le=Array.isArray(Ge.groupValues)?Ge.groupValues:[],Je=Le.length,Xe=[...Ge.filters?[Ge.filters]:[],...We.slice(0,Je).map((He,vt)=>({col:He,op:"eq",value:Le[vt]===void 0?null:Le[vt],caseSensitive:!0}))],nt=Xe.length===0?null:Xe.length===1?Xe[0]:{op:"and",conditions:Xe},it=Me.range?Me.range.start:0;if(Je>=We.length){const He={...Ge,filters:nt,groupBy:[],groupPath:[],groupValues:[],totals:[],totalFns:{}},vt=await J(await k.execute(He,Me))||{};let Ot=vt.rows||[];return!D.range&&Me.range&&(Ot=Ot.slice(Me.range.start,Me.range.end)),typeof vt.total=="number"?{rows:Ot,total:vt.total}:{rows:Ot}}const et=We[Je],ut=W(Ge),lt=I(D),ft=ut.engine.filter(He=>lt.has(He.fn)),yt=[...ut.engine.filter(He=>!lt.has(He.fn)).map(He=>({id:He.id,fn:He.fn,class:He.class,reason:`the ${te} adapter does not compute "${He.fn}"`})),...ut.client];C={engine:ft,client:yt,groupBy:We},yt.length&&ce(`source.pushdown.group.totals.${te}.${yt.map(He=>He.id).join(".")}`,`the ${te} adapter cannot compute the group subtotal for ${yt.map(He=>`"${He.id}" (${He.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=[...ft.map(He=>({id:He.id,col:He.col,fn:He.fn})),{id:y,col:et,fn:"count"}],ct={...Ge,filters:nt,range:null},wt=JSON.stringify([l(ct),Le,et,tt]);let kt=it>0?U.get(wt):void 0;if(!kt){for(kt=Promise.resolve(k.executeGroupedAggregates(ct,[et],tt)),U.delete(wt),U.set(wt,kt);U.size>se;)U.delete(U.keys().next().value);kt.catch(()=>{U.get(wt)===kt&&U.delete(wt)})}const At=await kt||[];m(Me);const Pt=He=>{const vt={};for(const Ot of ft)vt[Ot.id]=He?He[Ot.id]:void 0;return vt},qt=(Ge.sort||[]).find(He=>He&&He.col===et),nn=qt&&qt.dir==="desc"?-1:1,_t=At.filter(He=>He&&He.level===1).map(He=>({[et]:He.keys[0]===void 0?null:He.keys[0],leafCount:Number(He.values&&He.values[y])||0,totals:Pt(He.values)})).sort((He,vt)=>nn*ee(He[et],vt[et]));if(Je===0){const He=At.find(Ot=>Ot&&Ot.level===0),vt=He?Number(He.values&&He.values[y]):NaN;xe({matchCount:Number.isFinite(vt)?vt:_t.reduce((Ot,on)=>Ot+on.leafCount,0),...He?{grand:Pt(He.values)}:{}})}const rn=Me.range?Me.range.end:_t.length;return{rows:_t.slice(it,rn),total:_t.length}},xe=Ce=>{typeof Ce.matchCount=="number"&&(oe=Ce.matchCount,le=Ce.grand?{totals:Ce.grand,leafCount:Ce.matchCount}:null,X===void 0&&o(k.unfilteredCount)&&(X=null,Promise.resolve(k.unfilteredCount()).then(Me=>{X=typeof Me=="number"?Me:null}).catch(Me=>{ce(`source.pushdown.group.unfiltered.${te}`,`the ${te} adapter could not count the unfiltered set (${Me&&Me.message?Me.message:Me}), so "N of M" falls back to the display count for its denominator.`)})))},je=async(Ce,Me)=>{Z=null;const Ge=W(Ce.pushed);C={engine:Ge.engine,client:Ge.client,groupBy:Ce.pushed.groupBy,pivotBy:Ce.pushed.pivotBy},Ge.client.length&&ce(`source.pushdown.pivot.totals.${te}.${Ge.client.map(nt=>nt.id).join(".")}`,`the ${te} 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 We=await k.executePivotLevel(Ce.pushed,Ge.engine,Me)||{};let Le=We.rows||[];!D.range&&Me.range&&(Le=Le.slice(Me.range.start,Me.range.end)),xe(We);const Je=We.pivot&&typeof We.pivot=="object"?We.pivot:{},Xe={cells:Array.isArray(Je.cells)?Je.cells:[],...Array.isArray(Je.axis)?{axis:Je.axis}:{}};return We.total===void 0?{rows:Le,pivot:Xe}:{rows:Le,total:We.total,pivot:Xe}},Fe=Ce=>{ce(`source.pushdown.pivot.${te}.${Ce}`,`pushdown:pivot-unsupported: the ${te} adapter cannot pivot this query because ${Ce}, so no rows are fetched rather than every leaf row being pulled into the browser to pivot there. \`lastPlan().pivotReason\` says the same.`);const Me=new Error(`[lattice] ${Y}: the ${te} adapter cannot pivot this query because ${Ce}, so no rows are fetched rather than every leaf row being pulled into the browser to pivot there. \`lastPlan().pivotReason\` says the same.`);throw Me.code=Y,Me.reason=Ce,Me},Ie=(Ce,Me)=>{const Ge={key:Me,state:"pending",value:null};return Z=Ge,Ce.then(We=>(Z===Ge&&(Z={key:Me,state:"settled",value:typeof We=="number"?We:null}),We),We=>{throw Z===Ge&&(Z={key:Me,state:"failed",value:null}),We})};let Be=0,Re=[];const Ke=()=>Be===0?null:new Promise(Ce=>{const Me=setTimeout(Ce,i);Re.push(()=>{clearTimeout(Me),Ce()})});let rt;const Nt=async Ce=>{const Me=V();Me&&await Me;const We=Ce&&Ce.pivotMode!==!1&&Array.isArray(Ce.pivotBy)&&Ce.pivotBy.length>0?{request:Ce,probe:null}:await P(Ce);m(Ce);let Le=ue(We.request,D,u.enabled);if(D.group&&Le.grouped&&!Le.pivoted&&!o(k.executeGroupLevel)&&(ce(`source.pushdown.group.method.${te}`,`the ${te} 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.`),Le=ue(We.request,{...D,group:!1,aggregates:null},u.enabled)),Le.pivoted&&!o(k.executePivotLevel)&&(Le=ue(We.request,{...D,pivot:!1},u.enabled),Le.pivotReason="the adapter declares the `pivot` capability but has no `executePivotLevel(query, aggregates, request)`"),Le.grouped&&!Le.pivoted&&!D.group&&!o(k.executeGroupedAggregates)&&(ce(`source.pushdown.group.aggregates.method.${te}`,`the ${te} 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\`.`),Le=ue(We.request,{...D,aggregates:null},u.enabled)),G=Le,Le.pivoted)return je(Le,Ce);if(Le.pivotReason&&Fe(Le.pivotReason),Le.grouped)return D.group?j(Le,Ce):Oe(Le,Ce);const Xe=!!Le.groupReason&&!Le.full;Xe?ce(`source.pushdown.group-unsupported.${te}.${Le.groupReason}`,`pushdown:group-unsupported: the ${te} adapter was not asked to group this query because ${Le.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.`):Le.groupReason&&ce(`source.pushdown.group.${te}.${Le.groupReason}`,`the ${te} adapter was not asked to group this query because ${Le.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=>Xe?{...tt,[he]:!0}:tt;if(!Le.needsAll){const tt=We.probe||await k.execute(Le.pushed,Ce),ct=tt.rows||[];return x(tt.pendingTotal)&&tt.total===void 0?nt({rows:ct,pendingTotal:Ie(tt.pendingTotal,l(Le.pushed))}):(Z=null,!D.total&&tt.total===void 0?nt({rows:ct}):nt({rows:ct,total:tt.total??ct.length}))}Le.unpushed.length&&ce(`source.pushdown.residual.${te}.${Le.unpushed.join(".")}`,`the ${te} adapter cannot push ${Le.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 it=l(Le.pushed);if(!a||a.key!==it){const tt=await J(await k.execute(Le.pushed,Ce));Z=null;const ct=tt.rows||[];if(Le.full){const wt=typeof tt.total=="number"?Math.max(tt.total,ct.length):ct.length;if(wt>u.maxRows)throw new Error(`[lattice] fullDataset refused: the ${te} adapter's matching set is ${wt.toLocaleString()} rows, past the configured maxRows of ${u.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 kt=ct.length*e(ct[0]);if(kt>u.maxBytesEstimate)throw new Error(`[lattice] fullDataset refused: the ${te} adapter's matching set is an estimated ${Math.round(kt/(1024*1024)).toLocaleString()} MB across ${ct.length.toLocaleString()} rows, past the configured maxBytesEstimate of ${Math.round(u.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"&&ct.length<tt.total){const wt=!!(Le.residual.filters||Le.residual.quick||Le.residual.sort&&Le.residual.sort.length);if(wt&&!f)throw new Error(`[lattice] the ${te} adapter returned ${ct.length} of ${tt.total} matching rows when asked for the whole result, and the query has residual ${Le.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.`);wt?ce(`source.pushdown.partial.residual.${te}`,`the ${te} adapter returned ${ct.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.`):ce(`source.pushdown.partial.${te}`,`the ${te} adapter returned ${ct.length} of ${tt.total} matching rows when asked for the whole result. The adapter must follow the engine's own paging before returning.`)}a={key:it,rows:ct,total:typeof tt.total=="number"?tt.total:null}}let et=Le;if(Le.residual.where){const tt=a.total??a.rows.length;if(tt>=L){re(Le.residual.where.names,te,tt,L);const{where:ct,...wt}=We.request;et=ue(wt,D,u.enabled),G=et}}const ut=a.total!==null&&a.rows.length>=a.total,lt=ne(a.rows,{...et.residual,whole:ut},w.compute||{}),ft=Ce.range?Ce.range.start:0,yt=Ce.range?Ce.range.end:lt.length;return nt({rows:lt.slice(ft,yt),total:lt.length})},Et=async(Ce,Me,Ge)=>{const Le=Ge&&Ge.waitForPage&&rt&&o(rt.pageForegroundIdle)?rt.pageForegroundIdle():Ke();Le&&await Le;const Je=V();Je&&await Je;const Xe=ue(Ce,D,u.enabled);G=Xe;const nt=S(Me,E),it=Array.isArray(Ce.groupBy)?Ce.groupBy:[],et=it.length>0,ut=!Xe.residual.filters&&!Xe.residual.quick,lt=!et||T(it,D.buckets);let ft=nt.engine,yt=nt.client;if(D.aggregates&&ft.length){const kt=D.aggregates instanceof Set?D.aggregates:new Set(ye(D.aggregates)),At=ft.filter(Pt=>!kt.has(Pt.fn));At.length&&(ft=ft.filter(Pt=>kt.has(Pt.fn)),yt=[...At.map(Pt=>({...Pt,reason:`the ${te} adapter does not compute "${Pt.fn}"`})),...yt])}const tt=kt=>{yt=[...ft.map(At=>({...At,reason:kt})),...yt],ft=[]};ft.length&&!ut?tt(Xe.residual.quick&&!Xe.residual.filters?"a quick search the adapter cannot push forces all-client (no mixed provenance)":"residual filter forces all-client (no mixed provenance)"):ft.length&&!lt&&tt("a grouping key the engine cannot form forces all-client (no mixed provenance)");let ct={},wt;return ft.length&&(o(et?k.executeGroupedAggregates:k.executeAggregates)?et?wt=await k.executeGroupedAggregates(Xe.pushed,it,ft)||[]:ct=await k.executeAggregates(Xe.pushed,ft)||{}:(ce(`source.pushdown.aggregates.${te}${et?".grouped":""}`,`the ${te} adapter cannot compute ${et?"grouped ":""}aggregates, so every requested statistic is computed client-side. Correct, and slower than it needs to be.`),tt(`adapter cannot compute ${et?"grouped ":""}aggregates`))),C={engine:ft,client:yt,...et?{groupBy:it}:{}},{values:ct,engine:ft,client:yt,...wt!==void 0?{groups:wt}:{}}},Ct=async Ce=>{Be++;try{return await Nt(Ce)}finally{if(Be--,Be===0&&Re.length){const Me=Re;Re=[];for(const Ge of Me)Ge()}}},zt=b(w.edit),Rt=w.edit&&typeof w.edit=="object"&&o(w.edit.commit);let Tt=w.edit;if(zt&&!Rt)if(D.mutate&&D.mutate.update){const Ce=Me=>{if(!D.mutate||!D.mutate.update)throw new Error(`[lattice] the ${te} 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(Me.key),patch:{[Me.colId]:Me.value}};return k.mutate(Ge,Me.request||{})};Tt={...w.edit===!0?{}:w.edit,commit:Ce}}else ce(`source.pushdown.readonly.${te}`,`edit is enabled but the ${te} adapter declares mutate: ${D.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 Gt=zt&&D.mutate&&(D.mutate.append||D.mutate.delete)?{append:D.mutate.append===!0,remove:D.mutate.delete===!0,returning:D.mutate.returning,mutate:(Ce,Me)=>k.mutate(Ce,Me||{})}:null,Lt=async Ce=>{const Me=V();Me&&await Me;const{range:Ge,signal:We,export:Le,...Je}=Ce||{},Xe={...Je,groupBy:[],groupPath:[],groupValues:[],pivotBy:[],pivotMode:!1,totals:[]};return{plan:ue(Xe,D,u.enabled),signal:We}};async function*Dt(Ce,Me={}){const{plan:Ge,signal:We}=await Lt(Ce),Le=Math.max(1,Math.floor(Number(Me.pageSize))||5e3),Je={signal:We,stream:!0};if(!Ge.needsAll)for(let it=0;;it+=Le){m(Je);const et=await k.execute({...Ge.pushed,range:{start:it,end:it+Le}},Je);et&&x(et.pendingTotal)&&et.pendingTotal.then(null,()=>{});const ut=et&&et.rows||[];if(ut.length&&(yield ut),ut.length<Le)return}m(Je);const Xe=await J(await k.execute({...Ge.pushed,range:void 0},Je)),nt=ne(Xe&&Xe.rows||[],{...Ge.residual,whole:!0},w.compute||{});for(let it=0;it<nt.length;it+=Le)yield nt.slice(it,it+Le)}return rt={...w,edit:Tt,rowMutate:Gt,mode:"remote",fetch:Ct,foregroundIdle:Ke,aggregate:Et,countMatching:async Ce=>{const{plan:Me,signal:Ge}=await Lt(Ce);if(!Me.needsAll&&D.total){m({signal:Ge});const Le=await J(await k.execute({...Me.pushed,range:{start:0,end:0}},{signal:Ge}));if(Le&&typeof Le.total=="number")return Le.total}let We=0;for await(const Le of Dt(Ce))We+=Le.length;return We},streamMatching:Dt,lastPlan:()=>G?{...G,...C?{aggregates:C}:{},...Z?{total:{deferred:!0,state:Z.state,value:Z.value}}:{}}:null,fullFrame:Ae,counts:()=>({match:oe,total:X??null,pending:!!Z&&Z.state==="pending"}),grandTotals:()=>le},rt}}),Ve("packages/modules/shared/engine.js",function(n,de){"use strict";Object.defineProperty(n,"sourceId",{enumerable:!0,get:function(){return _}}),Object.defineProperty(n,"engineSource",{enumerable:!0,get:function(){return re}}),Object.defineProperty(n,"gridPivoted",{enumerable:!0,get:function(){return q}}),Object.defineProperty(n,"loadedAndMatching",{enumerable:!0,get:function(){return S}}),Object.defineProperty(n,"gridHoldsWindow",{enumerable:!0,get:function(){return T}}),Object.defineProperty(n,"gridEngineRequest",{enumerable:!0,get:function(){return z}}),Object.defineProperty(n,"EngineFlight",{enumerable:!0,get:function(){return A}});const Ne=de("packages/core/src/source/pushdown.js"),ee=Ne.capabilitiesOf,o=Ne.planQuery,ce=de("packages/core/src/source/filterwire.js").wireFilters,me=new WeakMap;let R=0;function _(i){let m=me.get(i);return m===void 0&&(m=++R,me.set(i,m)),m}function re(i){const m=i&&typeof i.config=="function"?i.config():null,c=m&&m.source&&typeof m.source=="object"?m.source:null;if(!c||typeof c.aggregate!="function")return{reason:"the grid's source has no aggregate() — it is not a pushdown source"};const h=ee(c.adapter&&c.adapter.capabilities);return{source:c,caps:h,config:m}}function q(i){const m=i&&typeof i.config=="function"?i.config():null,c=m&&m.source&&typeof m.source=="object"?m.source:null;if(!c||typeof c.lastPlan!="function")return!1;const h=i&&i.state&&typeof i.state.get=="function"?i.state.get():null,M=h&&h.pivot;return!!(M&&M.enabled&&Array.isArray(M.columns)&&M.columns.length>0)}function S(i){const m=i.rows&&typeof i.rows.residentCount=="function"?i.rows.residentCount():0,c=typeof i.rows.matchCount=="function"?i.rows.matchCount():NaN;return{loaded:m,total:Number.isFinite(c)?c:NaN}}function T(i){const m=i&&typeof i.config=="function"?i.config():null,c=m&&m.source&&typeof m.source=="object"?m.source:null;if(!c||c.mode!=="remote"&&c.mode!=="paged")return!1;if(typeof i.rows.matchCount=="function"&&i.rows.matchCount()===null)return!0;const{loaded:h,total:M}=S(i);return Number.isFinite(M)&&h<M}function g(i,m){return m?i?{op:"and",conditions:[i,m]}:m:i||null}function z(i,m,c=null){const h=i.filters&&typeof i.filters.where=="function"?i.filters.where():[];if(Array.isArray(h)&&h.length)return{reason:`a \`where\` predicate is in force (${h.join(", ")}), which only the browser can run`};const M=i.filters&&typeof i.filters.quickState=="function"?i.filters.quickState():{text:""},b=M&&M.text?String(M.text):"",{config:r,caps:O}=m,t={filters:ce(g(i.filters.get(),c),{tz:r.timeZone,weekStartsOn:r.weekStartsOn}),sort:[],range:null,context:r.context??null,...b?{quick:b}:{}},y=o(t,O);return y.unpushed.includes("filter")?{reason:c?"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"}:y.unpushed.includes("quick")?{reason:"the quick search did not push to the engine"}:{request:t,quick:b}}class A{#e=null;#t=null;#n=!1;answer(m){return this.#t&&this.#t.key===m?this.#t:null}last(){return this.#t}get busy(){return this.#e!==null}ask(m,c,h){const M=this.#e;if(M){M.key!==m&&M.controller&&M.controller.abort();return}const b=globalThis.AbortController,r=typeof b=="function"?new b:null,O={key:m,controller:r};this.#e=O;let t;Promise.resolve().then(()=>c(r?r.signal:null)).then(y=>{t={key:m,result:y}},y=>{t={key:m,error:y}}).then(()=>{this.#e===O&&(this.#e=null),!this.#n&&(r&&r.signal.aborted||(this.#t=t),h())})}abort(){const m=this.#e;m&&m.controller&&m.controller.abort()}close(){this.#n=!0,this.abort()}}}),Ve("packages/modules/charts/scale.js",function(n,de){"use strict";Object.defineProperty(n,"isNumber",{enumerable:!0,get:function(){return _}}),Object.defineProperty(n,"toNumber",{enumerable:!0,get:function(){return re}}),Object.defineProperty(n,"toTime",{enumerable:!0,get:function(){return q}}),Object.defineProperty(n,"extent",{enumerable:!0,get:function(){return S}}),Object.defineProperty(n,"niceStep",{enumerable:!0,get:function(){return T}}),Object.defineProperty(n,"niceDomain",{enumerable:!0,get:function(){return g}}),Object.defineProperty(n,"measureDomain",{enumerable:!0,get:function(){return z}}),Object.defineProperty(n,"linearTicks",{enumerable:!0,get:function(){return A}}),Object.defineProperty(n,"timeStepFor",{enumerable:!0,get:function(){return i}}),Object.defineProperty(n,"timeTicks",{enumerable:!0,get:function(){return c}}),Object.defineProperty(n,"linearScale",{enumerable:!0,get:function(){return h}}),Object.defineProperty(n,"timeScale",{enumerable:!0,get:function(){return M}}),Object.defineProperty(n,"key",{enumerable:!0,get:function(){return b}}),Object.defineProperty(n,"bandScale",{enumerable:!0,get:function(){return r}}),Object.defineProperty(n,"sqrtScale",{enumerable:!0,get:function(){return O}});const Ne=[1,2,2.5,5,10],ee=6e4,o=36e5,ye=864e5,ce=365.25*ye,me=[1,2,5,10,20,25,50,100],R=[1,5,10,25,50,100,250,500,1e3,5e3,15e3,3e4,ee,5*ee,15*ee,30*ee,o,3*o,6*o,12*o,ye,2*ye,7*ye,14*ye,30*ye,90*ye,180*ye,...me.map(t=>t*ce)];function _(t){return typeof t=="number"&&Number.isFinite(t)}function re(t){if(t==null||t==="")return null;if(t instanceof Date){const I=t.getTime();return Number.isFinite(I)?I:null}if(typeof t=="boolean")return t?1:0;const y=Number(t);return Number.isFinite(y)?y:null}function q(t){if(t==null||t==="")return null;if(t instanceof Date){const I=t.getTime();return Number.isFinite(I)?I:null}if(typeof t=="number")return Number.isFinite(t)?t:null;const y=Date.parse(String(t));return Number.isFinite(y)?y:null}function S(t){let y=1/0,I=-1/0;for(let B=0;B<t.length;B++){const H=t[B];_(H)&&(H<y&&(y=H),H>I&&(I=H))}return y===1/0?null:{min:y,max:I}}function T(t){if(!(t>0))return 1;const y=10**Math.floor(Math.log10(t));for(const I of Ne)if(t<=I*y)return I*y;return 10*y}function g(t,y=5){const I=T((t.max-t.min)/Math.max(1,y));return{min:Math.floor(t.min/I)*I,max:Math.ceil(t.max/I)*I,step:I}}function z(t,y={}){const I=S(t)||{min:0,max:1};let{min:B,max:H}=I;if(y.zero&&(B>0&&(B=0),H<0&&(H=0)),B===H){const Y=Math.abs(B)>0?Math.abs(B)/10:1;B-=Y,H+=Y}if(y.nice!==!1){const Y=g({min:B,max:H},y.ticks||5);B=Y.min,H=Y.max}return _(y.min)&&(B=y.min),_(y.max)&&(H=y.max),B===H&&(H=B+1),{min:B,max:H}}function A(t,y=5){const I=T((t.max-t.min)/Math.max(1,y)),B=Math.ceil(t.min/I),H=Math.floor(t.max/I),Y=[];for(let Q=B;Q<=H;Q++){const he=Q*I;Y.push(Math.abs(he)<I/1e6?0:Number(he.toPrecision(12)))}return Y}function i(t,y=5){const I=Math.max(1,y),B=t/I;let H=R[R.length-1];for(const he of R)if(he>=B){H=he;break}if(H<ce)return H;let Y=H,Q=Math.abs(t/H-I);for(const he of R){if(he<ce)continue;const fe=Math.abs(t/he-I);fe<Q&&(Q=fe,Y=he)}return Y}function m(t,y){const I=new Date(t.min).getUTCFullYear();let B=Math.ceil(I/y)*y;Date.UTC(B,0,1)<t.min&&(B+=y);const H=[];for(;Date.UTC(B,0,1)<=t.max;B+=y)H.push(Date.UTC(B,0,1));return H}function c(t,y=5){const I=i(t.max-t.min,y);if(I>=ce)return m(t,Math.round(I/ce));const B=[],H=Math.ceil(t.min/I)*I;for(let Y=H;Y<=t.max;Y+=I)B.push(Y);return B}function h(t,y){const I=t.max-t.min||1,[B,H]=y;return{kind:"linear",domain:t,range:y,of(Y){return B+(Y-t.min)/I*(H-B)},invert(Y){return t.min+(Y-B)/(H-B||1)*I},ticks(Y=5){return A(t,Y)}}}function M(t,y){return{...h(t,y),kind:"time",ticks(B=5){return c(t,B)}}}function b(t){if(t==null)return" null";if(t instanceof Date)return` date:${t.getTime()}`;if(typeof t=="object"){const y=t,I=y.id??y.key??y.value;return I!==void 0&&typeof I!="object"?` obj:${String(I)}`:` obj:${String(t)}`}return String(t)}function r(t,y,I=.2){const B=Math.min(.9,Math.max(0,I)),[H,Y]=y,Q=new Map;for(let ue=0;ue<t.length;ue++){const W=b(t[ue]);Q.has(W)||Q.set(W,ue)}const he=t.length?(Y-H)/t.length:Y-H,fe=Math.max(0,he*(1-B));return{kind:"band",domain:t,range:y,bandwidth:fe,step:he,of(ue){const W=Q.get(b(ue));return W===void 0?NaN:H+W*he+(he-fe)/2},centre(ue){const W=this.of(ue);return Number.isNaN(W)?NaN:W+fe/2},ticks(){return t}}}function O(t,y){const[I,B]=y,H=Math.max(Math.abs(t.max),Math.abs(t.min),0)||1;return{kind:"sqrt",domain:t,range:y,of(Y){const Q=Math.sqrt(Math.abs(Y)/H);return I+Q*(B-I)}}}}),Ve("packages/modules/charts/svg.js",function(n,de){"use strict";Object.defineProperty(n,"SVG_NS",{enumerable:!0,get:function(){return Ne}}),Object.defineProperty(n,"el",{enumerable:!0,get:function(){return o}}),Object.defineProperty(n,"svg",{enumerable:!0,get:function(){return ye}}),Object.defineProperty(n,"attr",{enumerable:!0,get:function(){return ce}}),Object.defineProperty(n,"attrs",{enumerable:!0,get:function(){return me}}),Object.defineProperty(n,"setText",{enumerable:!0,get:function(){return R}}),Object.defineProperty(n,"clear",{enumerable:!0,get:function(){return _}}),Object.defineProperty(n,"append",{enumerable:!0,get:function(){return re}}),Object.defineProperty(n,"path",{enumerable:!0,get:function(){return q}}),Object.defineProperty(n,"ribbonPath",{enumerable:!0,get:function(){return S}}),Object.defineProperty(n,"round",{enumerable:!0,get:function(){return T}}),Object.defineProperty(n,"pathRings",{enumerable:!0,get:function(){return g}}),Object.defineProperty(n,"insideRings",{enumerable:!0,get:function(){return z}});const Ne="http://www.w3.org/2000/svg";function ee(A){const i=A.indexOf(")");return i<0?A:A.slice(i+1).trim()||"#0072b2"}function o(A,i,m){const c=A.createElement(i);return m&&c.setAttribute("class",m),c}function ye(A,i,m){const c=A.createElementNS(Ne,i);if(m)for(const h of Object.keys(m))c.setAttribute(h,String(m[h]));return c}function ce(A,i,m){if(!A)return;if(m==null){A.removeAttribute(i);return}let c=String(m);c.startsWith("url(#")&&(i==="stroke"||i==="fill"&&A.localName==="text")&&(c=ee(c)),A.setAttribute(i,c)}function me(A,i){if(A)for(const m of Object.keys(i))ce(A,m,i[m])}function R(A,i){A&&(A.textContent=i==null?"":String(i))}function _(A){if(A)for(;A.firstChild;)A.removeChild(A.firstChild)}function re(A,i){for(const m of i)m&&A.appendChild(m);return A}function q(A){return A.join(" ")}function S(A){if(!A||A.length<2)return"";const i=["M",A[0].x,A[0].upper];for(let m=1;m<A.length;m++)i.push("L",A[m].x,A[m].upper);for(let m=A.length-1;m>=0;m--)i.push("L",A[m].x,A[m].lower);return i.push("Z"),q(i)}function T(A){return Math.round(A*100)/100}function g(A){const i=[];let m=[];const c=String(A||"").match(/[A-Za-z]|-?\d*\.?\d+(?:e[-+]?\d+)?/gi)||[];let h="",M=[];const b=()=>{if(!h||!M.length){M=[];return}if(h==="M"||h==="L")for(let r=0;r+1<M.length;r+=2)m.push([M[r],M[r+1]]);else h!=="Z"&&M.length>=2&&m.push([M[M.length-2],M[M.length-1]]);M=[]};for(const r of c){if(/[A-Za-z]/.test(r)){if(b(),r==="Z"||r==="z"){m.length>2&&i.push(m),m=[],h="";continue}r==="M"&&m.length>2&&(i.push(m),m=[]),h=r;continue}M.push(Number(r))}return b(),m.length>2&&i.push(m),i}function z(A,i,m){let c=!1;for(const h of A)for(let M=0,b=h.length-1;M<h.length;b=M++){const[r,O]=h[M],[t,y]=h[b];O>m!=y>m&&i<(t-r)*(m-O)/(y-O||1e-12)+r&&(c=!c)}return c}}),Ve("packages/modules/charts/typography.js",function(n,de){"use strict";Object.defineProperty(n,"BASE_SIZE",{enumerable:!0,get:function(){return Ne}}),Object.defineProperty(n,"BASE_FAMILY",{enumerable:!0,get:function(){return ee}}),Object.defineProperty(n,"CHAR_RATIO",{enumerable:!0,get:function(){return o}}),Object.defineProperty(n,"resolveType",{enumerable:!0,get:function(){return ye}}),Object.defineProperty(n,"textWidth",{enumerable:!0,get:function(){return me}}),Object.defineProperty(n,"widestLabel",{enumerable:!0,get:function(){return R}}),Object.defineProperty(n,"truncateTo",{enumerable:!0,get:function(){return _}}),Object.defineProperty(n,"applySize",{enumerable:!0,get:function(){return re}});const Ne=12,ee="var(--lattice-font-family, system-ui, -apple-system, sans-serif)",o=.62;function ye(q){const S=q&&q.font,T=typeof S=="number"?{size:S}:S||{},g=ce(T.size,Ne);return{family:T.family||ee,size:g,small:ce(T.small??T.tickSize,Math.max(9,g-1)),title:ce(T.title,Math.round(g*1.15)),axisTitle:ce(T.axisTitle,Math.max(10,g-1)),weight:T.weight||"inherit"}}function ce(q,S){const T=Number(q);return Number.isFinite(T)&&T>0?T:S}function me(q,S){return String(q??"").length*S*o}function R(q,S){let T=0;for(const g of q||[]){const z=me(g,S);z>T&&(T=z)}return T}function _(q,S,T){const g=String(q??""),z=Math.floor(S/(T*o));return z<=0?"":g.length<=z?g:z===1?"…":`${g.slice(0,z-1)}…`}function re(q,S){!q||!Number.isFinite(S)||(q.style?q.style.fontSize=`${S}px`:q.setAttribute("style",`font-size:${S}px`))}}),Ve("packages/modules/charts/frame.js",function(n,de){"use strict";Object.defineProperty(n,"LABEL_GAP",{enumerable:!0,get:function(){return R}}),Object.defineProperty(n,"LABEL_GUTTER_SHARE",{enumerable:!0,get:function(){return _}}),Object.defineProperty(n,"resolveMargin",{enumerable:!0,get:function(){return re}}),Object.defineProperty(n,"plotRect",{enumerable:!0,get:function(){return q}}),Object.defineProperty(n,"shouldRotate",{enumerable:!0,get:function(){return S}}),Object.defineProperty(n,"Pool",{enumerable:!0,get:function(){return T}});const ee=de("packages/modules/charts/svg.js").SVG_NS,o=de("packages/modules/charts/typography.js"),ye=o.textWidth,ce=o.widestLabel,me=8,R=6,_=.4;function re(g,z){const A=typeof g=="number"?g:z,i=g&&typeof g=="object"?g:{},m=c=>Number.isFinite(c)&&c>=0?Number(c):A;return{base:A,top:m(i.top),right:m(i.right),bottom:m(i.bottom),left:m(i.left)}}function q(g){const z=re(g.margin,typeof g.padding=="number"?g.padding:8),A=z.base,i=g.fontSize||12,m=g.yLabels||[],c=g.xLabels||[],h=g.ySide==="right"?"right":"left",M=h==="right"?"left":"right",b=g.titles||{},r=g.titleSize||i,O=W=>W?r+R:0,t=ce(m,i),y=m.length?Math.min(g.width*_,z[h]+t+R):Math.max(me,z[h]),I=z[M]+(g.rightGutter||0),B=(h==="left"?y:I)+O(b.left),H=ce(c.map(W=>String(W).slice(0,14)),i),Y=(c.length?g.rotated?Math.min(g.height*_,R+H):i+R+z.bottom:Math.max(me,z.bottom))+O(b.bottom),Q=(h==="right"?y:I)+O(b.right),he=z.top+(g.topGutter||0),fe=Math.max(0,g.width-B-Q),ue=Math.max(0,g.height-he-Y);return{left:B,top:he,width:fe,height:ue,right:B+fe,bottom:he+ue,gutter:{left:B,bottom:Y,right:Q,top:he}}}function S(g,z,A,i){if(!g.length||z<=0)return!1;const m=Number.isFinite(i)&&i>0?Number(i):1;return ce(g,A)>z*m-4}class T{#e;#t=0;static#n="data-pool-key";constructor(z,A=0){this.#e=z,this.#t=A>0?A:0}next(z,A,i){if(i!=null)return this.#r(z,A,String(i));const m=this.#e.childNodes[this.#t],c=m&&m.tagName,h=/(^|\s)\S*__axis-title(\s|$)/,M=c&&h.test(String(m.getAttribute("class")||"")),b=!!A&&h.test(String(A));if(c&&(!M||b)&&String(c).toLowerCase()===z.toLowerCase())return A&&m.setAttribute("class",A),this.#t++,m;const r=this.#e.ownerDocument.createElementNS(ee,z);return A&&r.setAttribute("class",A),m?this.#e.insertBefore(r,m):this.#e.appendChild(r),this.#t++,r}#r(z,A,i){const m=z.toLowerCase();for(let M=this.#t;M<this.#e.childNodes.length;M++){const b=this.#e.childNodes[M],r=b&&b.tagName;if(r&&String(r).toLowerCase()===m&&b.getAttribute(T.#n)===i)return M!==this.#t&&this.#e.insertBefore(b,this.#e.childNodes[this.#t]),A&&b.setAttribute("class",A),this.#t++,b}const c=this.#e.ownerDocument.createElementNS(ee,z);c.setAttribute(T.#n,i),A&&c.setAttribute("class",A);const h=this.#e.childNodes[this.#t];return h?this.#e.insertBefore(c,h):this.#e.appendChild(c),this.#t++,c}finish(){for(;this.#e.childNodes.length>this.#t;)this.#e.removeChild(this.#e.lastChild);this.#t=0}}}),Ve("packages/modules/charts/fills.js",function(n,de){"use strict";Object.defineProperty(n,"PATTERNS",{enumerable:!0,get:function(){return o}}),Object.defineProperty(n,"GRADIENTS",{enumerable:!0,get:function(){return ye}}),Object.defineProperty(n,"isFill",{enumerable:!0,get:function(){return re}}),Object.defineProperty(n,"isPaintRef",{enumerable:!0,get:function(){return q}}),Object.defineProperty(n,"paintFallback",{enumerable:!0,get:function(){return S}}),Object.defineProperty(n,"normaliseFill",{enumerable:!0,get:function(){return g}}),Object.defineProperty(n,"swatchCss",{enumerable:!0,get:function(){return A}}),Object.defineProperty(n,"createFillRegistry",{enumerable:!0,get:function(){return i}}),Object.defineProperty(n,"rowPaint",{enumerable:!0,get:function(){return m}}),Object.defineProperty(n,"patternSeries",{enumerable:!0,get:function(){return c}}),Object.defineProperty(n,"paintSolid",{enumerable:!0,get:function(){return h}}),Object.defineProperty(n,"rowFillSource",{enumerable:!0,get:function(){return M}}),Object.defineProperty(n,"nodePaint",{enumerable:!0,get:function(){return b}});const ee=de("packages/core/src/internal/util.js").warnOnce,o=Object.freeze(["hatch","crosshatch","dots","grid"]),ye=Object.freeze(["linear","radial"]),ce=8,me="#0072b2";let R=0;const _=new Map;function re(r){return!!r&&typeof r=="object"&&!Array.isArray(r)&&(typeof r.gradient=="string"||typeof r.pattern=="string")}function q(r){return typeof r=="string"&&r.startsWith("url(#")}function S(r){if(typeof r!="string")return r==null?"":String(r);if(!r.startsWith("url("))return r;const O=r.indexOf(")");return(O<0?"":r.slice(O+1).trim())||me}function T(r,O){ee(`chart:fill:invalid:${r}`,`a chart fill object was ignored: ${O} 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 g(r,O){if(!re(r))return null;const t=O||me;if(typeof r.gradient=="string"){if(!ye.includes(r.gradient))return T("gradient",`the gradient "${r.gradient}" is not one of ${ye.join(", ")}.`),null;const H=Array.isArray(r.stops)?r.stops:[],Y=[];for(const he of H){const fe=Array.isArray(he)?Number(he[0]):Number(he&&he.offset),ue=Array.isArray(he)?he[1]:he&&he.colour;!Number.isFinite(fe)||typeof ue!="string"||!ue||Y.push({offset:Math.min(1,Math.max(0,fe)),colour:ue})}if(Y.length<2)return T("stops","a gradient needs at least two [offset, colour] stops."),null;Y.sort((he,fe)=>he.offset-fe.offset);const Q=Number.isFinite(Number(r.angle))?Number(r.angle):180;return{kind:r.gradient,angle:Q,stops:Y,solid:Y[0].colour}}if(!o.includes(r.pattern))return T("pattern",`the pattern "${r.pattern}" is not one of ${o.join(", ")}.`),null;const y=Number(r.size),I=Number(r.angle),B=typeof r.colour=="string"&&r.colour?r.colour:t;return{kind:"pattern",pattern:r.pattern,colour:B,background:typeof r.background=="string"&&r.background?r.background:null,size:Number.isFinite(y)&&y>=2?y:ce,angle:Number.isFinite(I)?I:r.pattern==="grid"||r.pattern==="dots"?0:45,solid:B}}function z(r){if(r.kind==="pattern"){const t=r.colour,y=r.size,I=Math.max(1,y/5),B=r.background||"transparent",H=Y=>`repeating-linear-gradient(${Y+90}deg,${t} 0 ${I}px,transparent ${I}px ${y}px)`;return r.pattern==="hatch"?`${H(r.angle)},${B}`:r.pattern==="crosshatch"?`${H(r.angle)},${H(r.angle+90)},${B}`:r.pattern==="grid"?`${H(r.angle)},${H(r.angle+90)},${B}`:`radial-gradient(circle at 50% 50%,${t} ${y/6}px,transparent ${y/6+.5}px) 0 0/${y}px ${y}px,${B}`}const O=r.stops.map(t=>`${t.colour} ${Math.round(t.offset*100)}%`).join(",");return r.kind==="radial"?`radial-gradient(circle,${O})`:`linear-gradient(${r.angle}deg,${O})`}function A(r){if(!q(r))return typeof r=="string"?r:"";const O=String(r).indexOf(")"),t=String(r).slice(5,O),y=_.get(t);return y?z(y):S(r)}function i(r){const O=`lattice-fill-${++R}`;let t=new Map,y=0;const I=(H,Y)=>{const Q=r.ownerDocument.createElementNS("http://www.w3.org/2000/svg",H);for(const he of Object.keys(Y))Q.setAttribute(he,String(Y[he]));return Q},B=(H,Y)=>{if(Y.kind==="pattern"){const he=Y.size,fe=Math.max(1,he/5),ue=I("pattern",{id:H,width:he,height:he,patternUnits:"userSpaceOnUse"});Y.angle&&ue.setAttribute("patternTransform",`rotate(${Y.angle})`),Y.background&&ue.appendChild(I("rect",{width:he,height:he,fill:Y.background}));const W={stroke:Y.colour,"stroke-width":fe};Y.pattern==="dots"?ue.appendChild(I("circle",{cx:he/2,cy:he/2,r:Math.max(1,he/6),fill:Y.colour})):(ue.appendChild(I("line",{x1:he/2,y1:0,x2:he/2,y2:he,...W})),Y.pattern!=="hatch"&&ue.appendChild(I("line",{x1:0,y1:he/2,x2:he,y2:he/2,...W}))),r.appendChild(ue);return}let Q;if(Y.kind==="radial")Q=I("radialGradient",{id:H,cx:.5,cy:.5,r:.5});else{const he=Y.angle*Math.PI/180,fe=Math.sin(he)/2,ue=-Math.cos(he)/2;Q=I("linearGradient",{id:H,x1:+(.5-fe).toFixed(4),y1:+(.5-ue).toFixed(4),x2:+(.5+fe).toFixed(4),y2:+(.5+ue).toFixed(4)})}for(const he of Y.stops)Q.appendChild(I("stop",{offset:he.offset,"stop-color":he.colour}));r.appendChild(Q)};return{prefix:O,paint(H,Y){const Q=g(H,Y);if(!Q)return Y||me;if(!r||!r.ownerDocument)return Q.solid;const he=JSON.stringify(Q);let fe=t.get(he);if(!fe){const ue=`${O}-${y++}`;B(ue,Q),_.set(ue,Q),fe=`url(#${ue}) ${Q.solid}`,t.set(he,fe)}return fe},reset(){for(const H of t.values())_.delete(H.slice(5,H.indexOf(")")));if(t=new Map,y=0,r)for(;r.firstChild;)r.removeChild(r.firstChild)},ids(){return[...t.values()].map(H=>H.slice(5,H.indexOf(")")))}}}function m(r,O,t){if(r==null||r==="")return null;const y=S(t);if(re(r))return O?O.paint(r,y):(g(r,y)||{}).solid||null;if(typeof r=="string"){if(o.includes(r)){const I={pattern:r,colour:y};return O?O.paint(I,y):y}return r}return null}function c(r){const O=[{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 r.map((t,y)=>({...O[y%O.length],colour:t,background:"var(--lattice-background, #fff)"}))}function h(r){return q(r)?String(r).replace(/^url\([^)]*\)\s*/,""):r}function M(r,O){const t=r.fill;if(re(t))return(I,B)=>m(t,O.fills,h(B));if(typeof t=="function")return(I,B)=>{let H=null;try{H=t({label:I.label,x:I.x,y:I.y,rowKey:I.rowKey})}catch{H=null}return m(H,O.fills,h(B))};const y=typeof t=="string"?t:t&&typeof t=="object"&&typeof t.col=="string"?t.col:null;return y?(I,B)=>I.rowKey===void 0||I.rowKey===null?null:m(r.grid.rows.value(I.rowKey,y),O.fills,h(B)):null}function b(r,O,t){return r&&r({label:O.label,x:O.value,y:O.total,rowKey:O.rowKey},t)||t}}),Ve("packages/modules/charts/scheme.js",function(n,de){"use strict";Object.defineProperty(n,"PALETTE",{enumerable:!0,get:function(){return R}}),Object.defineProperty(n,"SCHEMES",{enumerable:!0,get:function(){return _}}),Object.defineProperty(n,"registerScheme",{enumerable:!0,get:function(){return S}}),Object.defineProperty(n,"setDefaultScheme",{enumerable:!0,get:function(){return T}}),Object.defineProperty(n,"schemeNames",{enumerable:!0,get:function(){return g}}),Object.defineProperty(n,"resolveScheme",{enumerable:!0,get:function(){return m}}),Object.defineProperty(n,"RAMP_SCALES",{enumerable:!0,get:function(){return h}}),Object.defineProperty(n,"toRgb",{enumerable:!0,get:function(){return r}}),Object.defineProperty(n,"rampStops",{enumerable:!0,get:function(){return O}});const ee=de("packages/core/src/internal/util.js").warnOnce,o=de("packages/modules/charts/fills.js"),ye=o.isFill,ce=o.patternSeries,me=o.rowPaint,R=Object.freeze(["#0072b2","#e69f00","#009e73","#cc79a7","#56b4e9","#d55e00","#7a5195","#6b7d8c"]),_=Object.freeze({default:{series:R,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:ce(R),sequential:["#ecf3f9","#005280"],diverging:["#b04a00","#f7f7f7","#005280"],positive:"#009e73",negative:"#d55e00"}}),re=new Map;let q="default";function S(t,y){!t||!y||re.set(String(t),y)}function T(t){if(typeof t=="string"){q=t;return}t&&typeof t=="object"&&(re.set("__default__",t),q="__default__")}function g(){return[...Object.keys(_),...re.keys()].filter(t=>!t.startsWith("__"))}function z(t){return re.has(t)?re.get(t):_[t]||null}const A=["series","sequential","diverging","positive","negative"];function i(t){return!t||typeof t!="object"||Array.isArray(t)?!1:!A.some(y=>y in t)}function m(t,y){const I=y&&y.fills||null,B=z(q)||_.default,H=t&&t.scheme,Y=i(H)?H:null,Q=Array.isArray(H)&&H.length?H:null,he=typeof H=="string"?z(H):Y||Array.isArray(H)?null:H||null,fe=(t&&Array.isArray(t.palette)&&t.palette.length?t.palette:null)||Q;Y&&fe&&ee("chart:scheme:array-and-map",'chart "scheme" was given as a name map together with a "palette" array; the two do not combine. Colours came from the map and the array was ignored. Pass one or the other.');const ue=Y?null:fe,W={..._.default,...B,...he||{}};ue&&(W.series=ue);const N=t&&t.ramp&&typeof t.ramp=="object"&&!Array.isArray(t.ramp)?t.ramp:null,ne=N?N.colours:t&&t.ramp,l=Array.isArray(ne)&&ne.length>=2?ne:null;l&&(W.sequential=l);const e=N?M(N.scale):null,p=!!(he||ue||Y),v=W.series&&W.series.length?W.series:R,F=new Map;let x=0;return{...W,series:(K,w)=>{if(Y&&w!==void 0&&w!==null){const k=String(w);return Object.prototype.hasOwnProperty.call(Y,k)?c(Y[k],I,K):(F.has(k)||F.set(k,x++),c(b(v,F.get(k),!0),I,F.get(k)))}return c(b(v,K,p),I,K)},explicit:p,nameMap:!!Y,rampScale:e,fills:I}}function c(t,y,I){if(!ye(t))return t;const B=R[(I%R.length+R.length)%R.length];return me(t,y,B)||B}const h=Object.freeze(["linear","log","quantile"]);function M(t){return t==null?null:h.includes(t)?t:(ee(`chart:ramp:scale:${String(t)}`,`chart "ramp.scale" was "${String(t)}", which is not a ramp scale; the chart chose one from its values instead. Use "linear", "log" or "quantile".`),null)}function b(t,y,I){const B=(y%t.length+t.length)%t.length;return I||typeof t[B]!="string"?t[B]:`var(--lattice-chart-${B+1}, ${t[B]})`}function r(t){if(typeof t!="string")return null;const y=t.trim(),I=/^#([0-9a-f]{3}|[0-9a-f]{6})$/i.exec(y);if(I){const Y=I[1];return Y.length===3?[0,1,2].map(Q=>parseInt(Y[Q]+Y[Q],16)):[0,2,4].map(Q=>parseInt(Y.slice(Q,Q+2),16))}const B=/^rgba?\(([^)]+)\)$/i.exec(y);if(!B)return null;const H=B[1].split(/[\s,/]+/).filter(Boolean).slice(0,3).map(Number);return H.length===3&&H.every(Y=>Number.isFinite(Y))?H:null}function O(t,y){const I=y?t.diverging:t.sequential,B=y?_.default.diverging:_.default.sequential,H=(Array.isArray(I)?I:B).map((Y,Q)=>r(Y)||r(B[Q])||[0,0,0]);return H.length>=2?H:B.map(Y=>r(Y))}}),Ve("packages/modules/charts/styles.js",function(n,de){"use strict";Object.defineProperty(n,"NS",{enumerable:!0,get:function(){return o}}),Object.defineProperty(n,"seriesColour",{enumerable:!0,get:function(){return ce}}),Object.defineProperty(n,"css",{enumerable:!0,get:function(){return me}}),Object.defineProperty(n,"injectStyles",{enumerable:!0,get:function(){return R}});const ee=de("packages/modules/charts/scheme.js").PALETTE,o="lat-chartview",ye="data-lattice-chartview";function ce(_){const re=(_%ee.length+ee.length)%ee.length;return`var(--lattice-chart-${re+1}, ${ee[re]})`}function me(){return`
7
7
  .${o}{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);