@toclocoinc/lattice-grid 1.89.0 → 1.89.1

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